A map that declares itself a sphere can now be looked at as one. The globe pane sits where the chart does, one toggle apart: three.js through globe.gl, fed entirely from the bundle. The texture is composited from the map's own equirectangular tiles, which drape a sphere with no reprojection at all, and every pin stands off the surface where its packed position lands when run backward through the mapping the map declares -- the same inversion the build's golden test holds to the Gazetteer's published coordinates. Pins are billboards wearing the same haloed category icons the chart composes, so what a marker is reads the same on the sphere as on the sheet; the selected one grows, takes a ring, lifts higher, and the globe turns to face it, because a ring on the far side of a planet selects nothing anyone can see. The legend and the search reach the sphere the same moment they reach the chart. Every map that stays quiet about its geometry keeps the chart it always had, untouched.
- commit
- fe9b08bc5d688f256d2c55ce730471a1cd200aad
- parent
- d77d55823e6d568761ad5a14d139980fad365198
- author
- Dami <dami.etoile@gmail.com>
| M | .gitignore | 1 | + |
| M | assets/ | 2 | +- |
| M | assets/ | 5298 | ++++++++++++++++++++++++++++++- |
| M | assets/ | 5 | + |
| M | frontend/ | 1 | + |
| A | frontend/ | 18 | + |
| M | frontend/ | 521 | +++- |
| M | frontend/ | 4 | +- |
| M | frontend/ | 4 | + |
| M | frontend/ | 2 | + |
| M | frontend/ | 8 | +- |
| A | frontend/ | 263 | + |
| M | frontend/ | 4 | + |
| M | frontend/ | 3 | + |
| M | frontend/ | 27 | + |
| M | frontend/ | 3 | + |
@@ -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: #121417;--panel: #17191d;--panel-raised: #1e2126;--line: rgba(236, 229, 216, .1);--line-strong: rgba(236, 229, 216, .22);--text: #ece5d8;--text-strong: #f9ebe0;--muted: #8e897c;--accent: #3aa5c9;--accent-ink: #0c1216;--accent-wash: rgba(32, 138, 174, .13);--accent-wash-strong: rgba(32, 138, 174, .24);--data: #7fc5de;--warm: #8a6a44;--warm-strong: #b08a5a;--map-surround: #0d1626;--topbar: 72px;--sidebar: 330px;--dock: 336px;--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) minmax(0,1fr) auto;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:#17191df5;box-shadow:0 8px 30px #0000002e}.brand{display:flex;align-items:center;gap:9px;height:100%;padding:0 22px;border-right:1px solid var(--line)}.brand svg{width:11px;height:11px;fill:var(--accent)}.brand strong{font-family:Arial Narrow,Roboto Condensed,sans-serif;font-size:16px;letter-spacing:.3em;line-height:1;color:var(--text-strong)}.map-pickers{display:flex;align-items:center;min-width:0;padding:0 12px}.map-pickers label{display:flex;min-width:0;align-items:center}.map-pickers label>span{position:absolute;overflow:hidden;width:1px;height:1px;clip-path:inset(50%);white-space:nowrap}.map-pickers label+label:before{padding:0 10px;color:var(--muted);content:"/";font-size:12px}.map-pickers select{max-width:300px;height:34px;padding:0 21px 0 8px;border:0;border-radius:7px;outline:none;-webkit-appearance:none;appearance:none;background:transparent no-repeat right 7px center;background-image:linear-gradient(45deg,transparent 50%,var(--muted) 50%),linear-gradient(135deg,var(--muted) 50%,transparent 50%);background-position:right 12px center,right 7px center;background-size:5px 5px;color:var(--text-strong);font-size:13px;font-weight:600;text-overflow:ellipsis;white-space:nowrap}.map-pickers select:hover{background-color:#ffffff0d}.map-pickers select:focus-visible{box-shadow:0 0 0 2px #3aa5c999}.map-pickers select:disabled{padding-right:8px;background-image:none;color:var(--muted);cursor:default;opacity:1}#variant-field[hidden]{display:none}.map-pickers .add-bundles{width:30px;height:30px;margin-left:auto;padding:0;border:0;border-radius:7px;background:transparent;color:var(--muted);cursor:pointer}.map-pickers .add-bundles:hover{background:#ffffff0d;color:var(--text-strong)}.map-pickers .add-bundles:focus-visible{box-shadow:0 0 0 2px #3aa5c999;outline:none}.map-pickers .add-bundles svg{width:14px;height:14px}.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) auto}.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(58,165,201,.025),transparent 22%),var(--panel)}.search-wrap{position:relative;display:flex;align-items:center;margin:18px 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:#111318;color:var(--text);font-size:13px}.search-wrap input::placeholder{color:#757064}.search-wrap input:focus{border-color:#3aa5c980;box-shadow:0 0 0 3px #3aa5c90f}.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-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-actions{display:flex;align-items:center;gap:2px}.legend-actions-break{width:1px;height:12px;margin:0 5px;background:var(--line)}.legend-action{display:grid;width:22px;height:22px;padding:0;place-items:center;border:0;border-radius:3px;background:none;color:var(--muted);cursor:pointer}.legend-action svg,.only-button svg{width:14px;fill:none;stroke:currentColor;stroke-linecap:round;stroke-linejoin:round;stroke-width:1.4}.legend-action:hover{background:#ffffff0f;color:var(--accent)}[data-label]{position:relative}[data-label]:after{position:absolute;z-index:12;top:50%;right:calc(100% + 6px);padding:4px 7px;border:1px solid var(--line-strong);border-radius:4px;opacity:0;background:#0f1014f7;box-shadow:0 6px 18px #0006;color:var(--text);content:attr(data-label);font-size:10px;font-weight:600;letter-spacing:0;text-transform:none;transform:translateY(-50%);transition:opacity 90ms ease;pointer-events:none;white-space:nowrap}[data-label]:hover:after,[data-label]:focus-visible:after{opacity:1;transition-delay:.52s}.layers{overflow-x:hidden;overflow-y:auto;min-height:0;flex:1;padding-bottom:12px;scrollbar-color:#44403a 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:grid;align-items:center;grid-template-columns:minmax(0,1fr) 22px 46px;gap:8px;padding:8px 18px 8px 12px}.layer-header .layer-switch{grid-column:3}.layer-title{display:flex;min-width:0;flex:1;align-items:center;gap:7px;padding:4px 0;border:0;background:transparent;color:#c8c2b4;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:#6b665a;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{display:grid;justify-self:end;width:20px;height:20px;padding:0;place-items:center;border:0;border-radius:3px;opacity:0;background:none;color:var(--accent);cursor:pointer;transition:opacity .11s ease}.category-row.is-hovered .only-button,.layer-header.is-hovered .only-button,.only-button:focus-visible{opacity:1}.only-button:hover{background:#3aa5c924}.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;justify-self:end;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 #6b665a;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:#9a9488;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:#f2ece0}.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) 22px 46px;gap:8px;min-height:26px;padding:0 4px;border-radius:3px;color:#7d786c;cursor:pointer;-webkit-user-select:none;user-select:none}.category-row.is-hovered{background:#ffffff0a;color:var(--text)}.category-row:has(input:checked){color:#d8d2c4}.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:#6f6a5e;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 #3aa5c999}.map-panel{position:relative;grid-column:2;grid-row:2;min-width:0;min-height:0;background:var(--map-surround)}.map{position:absolute;inset:0;overflow:hidden;outline:none;background:radial-gradient(circle at 50% 50%,rgba(32,138,174,.07),transparent 56%),#0b1220;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(4,7,14,.36),transparent 7%,transparent 93%,rgba(4,7,14,.25)),linear-gradient(180deg,rgba(4,7,14,.2),transparent 10%,transparent 92%,rgba(4,7,14,.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:#17191deb;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(58,165,201,.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-shelf{display:flex;align-items:center;transition:transform .22s cubic-bezier(.22,.61,.36,1)}.overview-shelf[hidden]{display:none}.overview-shelf.is-docked{transform:translate(calc(100% - 23px))}.overview-shelf.is-docked .overview{pointer-events:none}.overview-dock{display:grid;width:24px;height:52px;padding:0;border:1px solid var(--line-strong);border-right:0;border-radius:8px 0 0 8px;margin-right:-1px;place-items:center;background:#17191de6;box-shadow:-5px 6px 20px #0000003d;color:var(--muted);cursor:pointer}.overview-dock:hover{color:var(--accent)}.overview-dock svg{width:13px;fill:none;stroke:currentColor;stroke-linecap:round;stroke-linejoin:round;stroke-width:1.8;transition:transform .22s cubic-bezier(.22,.61,.36,1)}.overview-shelf.is-docked .overview-dock svg{transform:rotate(180deg)}.overview{position:relative;overflow:hidden;border:1px solid var(--line-strong);border-radius:8px;background:#17191de6;box-shadow:0 6px 25px #00000047;cursor:crosshair;line-height:0;touch-action:none}.overview[hidden]{display:none}.overview canvas{display:block;opacity:.85}.overview-viewport{position:absolute;border:1px solid var(--accent);border-radius:2px;background:#3aa5c924;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:#17191de6;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:#17191df0;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)}.subgrid-toggle{display:grid;border-right:0;border-left:1px solid var(--line);place-items:center}.subgrid-toggle svg{width:15px;fill:none;stroke:currentColor;stroke-linecap:round;stroke-linejoin:round;stroke-width:1.3}.subgrid-toggle .subgrid-toggle-slash{display:none}.subgrid-toggle[aria-pressed=false]{color:#6d6860}.subgrid-toggle[aria-pressed=false] .subgrid-toggle-slash{display:inline;stroke:currentColor;stroke-width:1.6}.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 #3c3833;border-radius:4px;outline:none;background:#0e1014;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:#3aa5c9ad}.map-hint{position:relative;display:flex;align-items:center;gap:8px;padding:7px 10px;border:1px solid var(--line);border-radius:6px;background:#0f1014c2;color:#ece5d89e;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}.dock{display:flex;overflow:hidden;width:var(--dock);flex-direction:column;border-left:1px solid var(--line);background:var(--panel);grid-column:3;grid-row:2;transition:width .2s cubic-bezier(.22,.61,.36,1)}.dock[hidden]{display:none}.dock-readout{display:flex;width:100%;align-items:center;gap:8px;padding:12px 16px;border:0;border-bottom:1px solid var(--line);background:var(--panel-raised);cursor:pointer;color:var(--data);font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:10px;font-weight:600;letter-spacing:.1em;text-transform:uppercase;white-space:nowrap}.dock-flag{overflow:hidden;max-width:130px;padding:2px 7px;border-radius:4px;background:var(--accent-wash-strong);color:var(--accent);text-overflow:ellipsis}.dock-flag[hidden]{display:none}.dock-readout:hover{background:#22262c}.dock-readout:focus-visible{outline:1px solid var(--accent);outline-offset:-2px}.dock-fold{display:grid;width:22px;height:22px;margin-left:auto;border-radius:5px;color:var(--muted);place-items:center}.dock-readout:hover .dock-fold{background:#ffffff0f;color:var(--text)}.dock-fold svg{width:13px;height:13px;fill:none;stroke:currentColor;stroke-width:2}.dock-body{display:flex;min-height:0;flex:1;flex-direction:column}.dock-results{overflow:hidden auto;flex:1;scrollbar-width:thin}.dock-results[hidden]{display:none}.dock-results .search-result.is-selected{background:var(--accent-wash);box-shadow:inset 3px 0 0 var(--accent)}.dock-note{padding:11px 16px;color:var(--muted);font-size:10.5px}.dock-rail-label{display:none}.dock.is-folded{width:41px}.dock.is-folded .dock-readout{justify-content:center;padding:12px 0}.dock.is-folded .dock-readout>:not(.dock-fold){display:none}.dock.is-folded .dock-fold{margin-left:0}.dock.is-folded .dock-fold svg{transform:rotate(180deg)}.dock.is-folded .dock-body{display:none}.dock.is-folded .dock-rail-label{display:block;overflow:hidden;min-height:0;margin:14px auto 0;color:var(--muted);font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:9.5px;font-weight:700;letter-spacing:.18em;text-transform:uppercase;writing-mode:vertical-rl}.dock-rail-name{color:var(--accent)}.dock-rail-name[hidden]{display:none}.pin-detail{overflow:hidden auto;flex:1;padding:14px 18px 18px;-webkit-user-select:text;user-select:text;scrollbar-width:thin}.pin-detail[hidden]{display:none}.dock-body:has(.pin-detail:not([hidden])) .dock-results{display:none}.detail-back{display:inline-flex;align-items:center;gap:6px;margin-bottom:14px;padding:0;border:0;background:none;color:var(--accent);font-size:11px;font-weight:700;letter-spacing:.04em;cursor:pointer}.detail-back:hover{color:var(--text)}.detail-back svg{width:11px;height:11px;fill:none;stroke:currentColor;stroke-width:2.4}.detail-category{display:flex;align-items:center;gap:7px;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:24px;line-height:1.1;color:var(--text-strong)}.pin-detail>p{margin:0;color:#b9b3a5;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:13px;border:1px solid var(--line);border-radius:8px;background:var(--panel-raised)}.pin-detail dl div{min-width:0}.pin-detail dt{color:#716c60;font-size:8px;font-weight:800;letter-spacing:.1em;text-transform:uppercase}.pin-detail dd{overflow:hidden;margin:4px 0 0;color:var(--data);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}.empty-state{position:fixed;z-index:90;inset:50% auto auto 50%;width:min(460px,calc(100% - 40px));padding:24px;border:1px solid var(--line-strong);border-radius:12px;background:var(--panel);box-shadow:0 25px 80px #00000080;transform:translate(-50%,-50%);text-align:center;-webkit-user-select:text;user-select:text}.empty-state[hidden]{display:none}.empty-state strong{color:var(--text-strong)}.empty-state p{margin:8px 0 0;color:var(--muted);font-size:13px}.empty-state code{color:var(--data);font-size:12px;word-break:break-all}.empty-state button{margin-top:16px;padding:8px 14px;border:1px solid var(--line-strong);border-radius:8px;background:var(--panel-raised);color:var(--text);font:inherit;font-size:13px;cursor:pointer}.empty-state button:hover:not(:disabled){border-color:var(--accent);background:var(--accent-wash)}.empty-state button:disabled{opacity:.6;cursor:default}@media(max-width:1180px){.app-shell{grid-template-columns:var(--sidebar) minmax(0,1fr)}.dock{position:fixed;z-index:9;top:var(--topbar);right:0;bottom:0;border-left:1px solid var(--line-strong);background:#17191df5;-webkit-backdrop-filter:blur(14px);backdrop-filter:blur(14px);box-shadow:0 18px 55px #00000073}}@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}.dock{width:min(336px,calc(100% - 42px))}}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: #121417;--panel: #17191d;--panel-raised: #1e2126;--line: rgba(236, 229, 216, .1);--line-strong: rgba(236, 229, 216, .22);--text: #ece5d8;--text-strong: #f9ebe0;--muted: #8e897c;--accent: #3aa5c9;--accent-ink: #0c1216;--accent-wash: rgba(32, 138, 174, .13);--accent-wash-strong: rgba(32, 138, 174, .24);--data: #7fc5de;--warm: #8a6a44;--warm-strong: #b08a5a;--map-surround: #0d1626;--topbar: 72px;--sidebar: 330px;--dock: 336px;--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) minmax(0,1fr) auto;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:#17191df5;box-shadow:0 8px 30px #0000002e}.brand{display:flex;align-items:center;gap:9px;height:100%;padding:0 22px;border-right:1px solid var(--line)}.brand svg{width:11px;height:11px;fill:var(--accent)}.brand strong{font-family:Arial Narrow,Roboto Condensed,sans-serif;font-size:16px;letter-spacing:.3em;line-height:1;color:var(--text-strong)}.map-pickers{display:flex;align-items:center;min-width:0;padding:0 12px}.map-pickers label{display:flex;min-width:0;align-items:center}.map-pickers label>span{position:absolute;overflow:hidden;width:1px;height:1px;clip-path:inset(50%);white-space:nowrap}.map-pickers label+label:before{padding:0 10px;color:var(--muted);content:"/";font-size:12px}.map-pickers select{max-width:300px;height:34px;padding:0 21px 0 8px;border:0;border-radius:7px;outline:none;-webkit-appearance:none;appearance:none;background:transparent no-repeat right 7px center;background-image:linear-gradient(45deg,transparent 50%,var(--muted) 50%),linear-gradient(135deg,var(--muted) 50%,transparent 50%);background-position:right 12px center,right 7px center;background-size:5px 5px;color:var(--text-strong);font-size:13px;font-weight:600;text-overflow:ellipsis;white-space:nowrap}.map-pickers select:hover{background-color:#ffffff0d}.map-pickers select:focus-visible{box-shadow:0 0 0 2px #3aa5c999}.map-pickers select:disabled{padding-right:8px;background-image:none;color:var(--muted);cursor:default;opacity:1}#variant-field[hidden]{display:none}.map-pickers .add-bundles{width:30px;height:30px;margin-left:auto;padding:0;border:0;border-radius:7px;background:transparent;color:var(--muted);cursor:pointer}.map-pickers .add-bundles:hover{background:#ffffff0d;color:var(--text-strong)}.map-pickers .add-bundles:focus-visible{box-shadow:0 0 0 2px #3aa5c999;outline:none}.map-pickers .add-bundles svg{width:14px;height:14px}.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) auto}.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(58,165,201,.025),transparent 22%),var(--panel)}.search-wrap{position:relative;display:flex;align-items:center;margin:18px 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:#111318;color:var(--text);font-size:13px}.search-wrap input::placeholder{color:#757064}.search-wrap input:focus{border-color:#3aa5c980;box-shadow:0 0 0 3px #3aa5c90f}.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-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-actions{display:flex;align-items:center;gap:2px}.legend-actions-break{width:1px;height:12px;margin:0 5px;background:var(--line)}.legend-action{display:grid;width:22px;height:22px;padding:0;place-items:center;border:0;border-radius:3px;background:none;color:var(--muted);cursor:pointer}.legend-action svg,.only-button svg{width:14px;fill:none;stroke:currentColor;stroke-linecap:round;stroke-linejoin:round;stroke-width:1.4}.legend-action:hover{background:#ffffff0f;color:var(--accent)}[data-label]{position:relative}[data-label]:after{position:absolute;z-index:12;top:50%;right:calc(100% + 6px);padding:4px 7px;border:1px solid var(--line-strong);border-radius:4px;opacity:0;background:#0f1014f7;box-shadow:0 6px 18px #0006;color:var(--text);content:attr(data-label);font-size:10px;font-weight:600;letter-spacing:0;text-transform:none;transform:translateY(-50%);transition:opacity 90ms ease;pointer-events:none;white-space:nowrap}[data-label]:hover:after,[data-label]:focus-visible:after{opacity:1;transition-delay:.52s}.layers{overflow-x:hidden;overflow-y:auto;min-height:0;flex:1;padding-bottom:12px;scrollbar-color:#44403a 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:grid;align-items:center;grid-template-columns:minmax(0,1fr) 22px 46px;gap:8px;padding:8px 18px 8px 12px}.layer-header .layer-switch{grid-column:3}.layer-title{display:flex;min-width:0;flex:1;align-items:center;gap:7px;padding:4px 0;border:0;background:transparent;color:#c8c2b4;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:#6b665a;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{display:grid;justify-self:end;width:20px;height:20px;padding:0;place-items:center;border:0;border-radius:3px;opacity:0;background:none;color:var(--accent);cursor:pointer;transition:opacity .11s ease}.category-row.is-hovered .only-button,.layer-header.is-hovered .only-button,.only-button:focus-visible{opacity:1}.only-button:hover{background:#3aa5c924}.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;justify-self:end;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 #6b665a;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:#9a9488;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:#f2ece0}.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) 22px 46px;gap:8px;min-height:26px;padding:0 4px;border-radius:3px;color:#7d786c;cursor:pointer;-webkit-user-select:none;user-select:none}.category-row.is-hovered{background:#ffffff0a;color:var(--text)}.category-row:has(input:checked){color:#d8d2c4}.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:#6f6a5e;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 #3aa5c999}.map-panel{position:relative;grid-column:2;grid-row:2;min-width:0;min-height:0;background:var(--map-surround)}.map{position:absolute;inset:0;overflow:hidden;outline:none;background:radial-gradient(circle at 50% 50%,rgba(32,138,174,.07),transparent 56%),#0b1220;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(4,7,14,.36),transparent 7%,transparent 93%,rgba(4,7,14,.25)),linear-gradient(180deg,rgba(4,7,14,.2),transparent 10%,transparent 92%,rgba(4,7,14,.35));content:"";pointer-events:none}.globe{position:absolute;inset:0;background:#0b0e12;overflow:hidden}.globe[hidden]{display:none}.globe-toggle[aria-pressed=true]{color:var(--accent, #d98a4b);border-color:currentColor}.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:#17191deb;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(58,165,201,.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-shelf{display:flex;align-items:center;transition:transform .22s cubic-bezier(.22,.61,.36,1)}.overview-shelf[hidden]{display:none}.overview-shelf.is-docked{transform:translate(calc(100% - 23px))}.overview-shelf.is-docked .overview{pointer-events:none}.overview-dock{display:grid;width:24px;height:52px;padding:0;border:1px solid var(--line-strong);border-right:0;border-radius:8px 0 0 8px;margin-right:-1px;place-items:center;background:#17191de6;box-shadow:-5px 6px 20px #0000003d;color:var(--muted);cursor:pointer}.overview-dock:hover{color:var(--accent)}.overview-dock svg{width:13px;fill:none;stroke:currentColor;stroke-linecap:round;stroke-linejoin:round;stroke-width:1.8;transition:transform .22s cubic-bezier(.22,.61,.36,1)}.overview-shelf.is-docked .overview-dock svg{transform:rotate(180deg)}.overview{position:relative;overflow:hidden;border:1px solid var(--line-strong);border-radius:8px;background:#17191de6;box-shadow:0 6px 25px #00000047;cursor:crosshair;line-height:0;touch-action:none}.overview[hidden]{display:none}.overview canvas{display:block;opacity:.85}.overview-viewport{position:absolute;border:1px solid var(--accent);border-radius:2px;background:#3aa5c924;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:#17191de6;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:#17191df0;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)}.subgrid-toggle{display:grid;border-right:0;border-left:1px solid var(--line);place-items:center}.subgrid-toggle svg{width:15px;fill:none;stroke:currentColor;stroke-linecap:round;stroke-linejoin:round;stroke-width:1.3}.subgrid-toggle .subgrid-toggle-slash{display:none}.subgrid-toggle[aria-pressed=false]{color:#6d6860}.subgrid-toggle[aria-pressed=false] .subgrid-toggle-slash{display:inline;stroke:currentColor;stroke-width:1.6}.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 #3c3833;border-radius:4px;outline:none;background:#0e1014;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:#3aa5c9ad}.map-hint{position:relative;display:flex;align-items:center;gap:8px;padding:7px 10px;border:1px solid var(--line);border-radius:6px;background:#0f1014c2;color:#ece5d89e;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}.dock{display:flex;overflow:hidden;width:var(--dock);flex-direction:column;border-left:1px solid var(--line);background:var(--panel);grid-column:3;grid-row:2;transition:width .2s cubic-bezier(.22,.61,.36,1)}.dock[hidden]{display:none}.dock-readout{display:flex;width:100%;align-items:center;gap:8px;padding:12px 16px;border:0;border-bottom:1px solid var(--line);background:var(--panel-raised);cursor:pointer;color:var(--data);font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:10px;font-weight:600;letter-spacing:.1em;text-transform:uppercase;white-space:nowrap}.dock-flag{overflow:hidden;max-width:130px;padding:2px 7px;border-radius:4px;background:var(--accent-wash-strong);color:var(--accent);text-overflow:ellipsis}.dock-flag[hidden]{display:none}.dock-readout:hover{background:#22262c}.dock-readout:focus-visible{outline:1px solid var(--accent);outline-offset:-2px}.dock-fold{display:grid;width:22px;height:22px;margin-left:auto;border-radius:5px;color:var(--muted);place-items:center}.dock-readout:hover .dock-fold{background:#ffffff0f;color:var(--text)}.dock-fold svg{width:13px;height:13px;fill:none;stroke:currentColor;stroke-width:2}.dock-body{display:flex;min-height:0;flex:1;flex-direction:column}.dock-results{overflow:hidden auto;flex:1;scrollbar-width:thin}.dock-results[hidden]{display:none}.dock-results .search-result.is-selected{background:var(--accent-wash);box-shadow:inset 3px 0 0 var(--accent)}.dock-note{padding:11px 16px;color:var(--muted);font-size:10.5px}.dock-rail-label{display:none}.dock.is-folded{width:41px}.dock.is-folded .dock-readout{justify-content:center;padding:12px 0}.dock.is-folded .dock-readout>:not(.dock-fold){display:none}.dock.is-folded .dock-fold{margin-left:0}.dock.is-folded .dock-fold svg{transform:rotate(180deg)}.dock.is-folded .dock-body{display:none}.dock.is-folded .dock-rail-label{display:block;overflow:hidden;min-height:0;margin:14px auto 0;color:var(--muted);font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:9.5px;font-weight:700;letter-spacing:.18em;text-transform:uppercase;writing-mode:vertical-rl}.dock-rail-name{color:var(--accent)}.dock-rail-name[hidden]{display:none}.pin-detail{overflow:hidden auto;flex:1;padding:14px 18px 18px;-webkit-user-select:text;user-select:text;scrollbar-width:thin}.pin-detail[hidden]{display:none}.dock-body:has(.pin-detail:not([hidden])) .dock-results{display:none}.detail-back{display:inline-flex;align-items:center;gap:6px;margin-bottom:14px;padding:0;border:0;background:none;color:var(--accent);font-size:11px;font-weight:700;letter-spacing:.04em;cursor:pointer}.detail-back:hover{color:var(--text)}.detail-back svg{width:11px;height:11px;fill:none;stroke:currentColor;stroke-width:2.4}.detail-category{display:flex;align-items:center;gap:7px;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:24px;line-height:1.1;color:var(--text-strong)}.pin-detail>p{margin:0;color:#b9b3a5;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:13px;border:1px solid var(--line);border-radius:8px;background:var(--panel-raised)}.pin-detail dl div{min-width:0}.pin-detail dt{color:#716c60;font-size:8px;font-weight:800;letter-spacing:.1em;text-transform:uppercase}.pin-detail dd{overflow:hidden;margin:4px 0 0;color:var(--data);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}.empty-state{position:fixed;z-index:90;inset:50% auto auto 50%;width:min(460px,calc(100% - 40px));padding:24px;border:1px solid var(--line-strong);border-radius:12px;background:var(--panel);box-shadow:0 25px 80px #00000080;transform:translate(-50%,-50%);text-align:center;-webkit-user-select:text;user-select:text}.empty-state[hidden]{display:none}.empty-state strong{color:var(--text-strong)}.empty-state p{margin:8px 0 0;color:var(--muted);font-size:13px}.empty-state code{color:var(--data);font-size:12px;word-break:break-all}.empty-state button{margin-top:16px;padding:8px 14px;border:1px solid var(--line-strong);border-radius:8px;background:var(--panel-raised);color:var(--text);font:inherit;font-size:13px;cursor:pointer}.empty-state button:hover:not(:disabled){border-color:var(--accent);background:var(--accent-wash)}.empty-state button:disabled{opacity:.6;cursor:default}@media(max-width:1180px){.app-shell{grid-template-columns:var(--sidebar) minmax(0,1fr)}.dock{position:fixed;z-index:9;top:var(--topbar);right:0;bottom:0;border-left:1px solid var(--line-strong);background:#17191df5;-webkit-backdrop-filter:blur(14px);backdrop-filter:blur(14px);box-shadow:0 18px 55px #00000073}}@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}.dock{width:min(336px,calc(100% - 42px))}}@@ -1,9 +1,5289 @@
1-(()=>{var uu=n=>new Promise(t=>setTimeout(t,n)),yt=n=>document.querySelector(n);async function Ym(){for(let n=0;n<300&&!(window.__atlasDebug&&!yt("#map-loading")?.checkVisibility?.());n+=1)await uu(100)}async function Km(){let n="";for(let t=0;t<100;t+=1){await uu(120),await new Promise(r=>requestAnimationFrame(r)),window.advanceTime?.();let e=window.__atlasDebug.snapshot(),i=JSON.stringify([e.zoom,e.center,e.resolution,e.tileStats]);if(i===n)return;n=i}}function bi(n,t={}){window.dispatchEvent(new KeyboardEvent("keydown",{key:n,bubbles:!0,cancelable:!0,...t}))}function Zm(n,t={}){window.dispatchEvent(new KeyboardEvent("keyup",{key:n,bubbles:!0,cancelable:!0,...t}))}function Bm(n){yt("#map").dispatchEvent(new KeyboardEvent("keydown",{key:n,bubbles:!0,cancelable:!0}))}function nn(n,t){n.value=t,n.dispatchEvent(new Event("change",{bubbles:!0}))}function va(n,t){let e=yt(n);e.value=t,e.dispatchEvent(new Event("input",{bubbles:!0}))}function Sa(n,t=!1){let e=yt("#parity-badge");e||(e=document.createElement("div"),e.id="parity-badge",e.style.cssText="position:fixed;top:8px;right:8px;z-index:9999;padding:6px 12px;font:700 13px monospace;border-radius:6px;color:#fff;pointer-events:none;",document.body.append(e)),e.style.background=t?"#b3261e":"#1a7f37",e.textContent=n}async function Vm(){let n=[],t=async f=>{await Km(),n.push({name:f,snapshot:JSON.parse(window.render_game_to_text())})};await Ym(),localStorage.clear();let e=yt("#game-select"),i=e.options[0].value;nn(e,i),await t("initial"),va("#pin-search","a"),await t("search-a");let r=yt(".search-result");r&&(r.click(),await t("search-select-first"),yt("#close-detail").click(),await t("detail-closed")),va("#pin-search",""),await t("search-cleared");let s=yt(".category-row input");s&&(s.click(),await t("category-hidden"),s.click(),await t("category-restored"));let o=yt(".only-button");if(o){o.click(),await t("solo-first");let f=yt("#solo-chip");f&&!f.hidden&&f.click(),await t("solo-cleared")}let a=yt("#legend .layer-title");a&&(a.click(),await t("section-folded"),yt("#expand-all").click(),await t("sections-unfolded")),yt("#hide-all").click(),await t("all-hidden"),yt("#show-all").click(),await t("all-shown");let l=yt(".zone-index-item");l&&(l.click(),await t("zone-jumped"),l.dispatchEvent(new MouseEvent("contextmenu",{bubbles:!0,cancelable:!0})),await t("zone-highlighted"),l.dispatchEvent(new MouseEvent("contextmenu",{bubbles:!0,cancelable:!0})),await t("zone-unhighlighted")),bi("g"),await t("grid-open"),va("#grid-input","m"),await t("grid-descended"),bi(" "),await t("subgrid-hidden"),bi(" "),bi("Escape"),await t("grid-ascended"),bi("Escape"),await t("grid-closed"),bi("z"),await t("labels-on"),Zm("z"),await t("labels-off"),bi("b",{metaKey:!0}),await t("sidebar-collapsed"),bi("b",{metaKey:!0}),await t("sidebar-restored"),yt("#zoom-in").click(),await t("zoomed-in");let h=yt("#overview-dock");h&&!yt("#overview-shelf").hidden&&(h.click(),await t("overview-docked"),h.click(),await t("overview-undocked")),yt("#zoom-out").click(),await t("zoomed-out"),Bm("Escape"),await t("viewport-escape");let c=yt("#variant-select");c.options.length>1&&(nn(c,c.options[1].value),await t("variant-second"),nn(c,c.options[0].value),await t("variant-first"));let d=yt("#map-select");return d.options.length>1&&(nn(d,d.options[1].value),await t("map-second"),nn(d,d.options[0].value),await t("map-first")),e.options.length>1&&(nn(e,e.options[1].value),await t("game-second"),nn(e,i),await t("game-first")),localStorage.clear(),{viewport:[window.innerWidth,window.innerHeight],steps:n}}var Ra=!1;async function du(){if(!Ra){Ra=!0,Sa("parity tour running\u2026");try{let n=await Vm(),t=await fetch("/parity/result",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n,null,2)}),e=(await t.text()).trim();if(!t.ok)throw new Error(`saving failed: ${t.status} ${e}`);Sa(`parity tour complete \u2713 ${n.steps.length} steps`),console.log("parity tour saved to",e)}catch(n){Sa(`parity tour failed: ${n}`,!0),console.error("parity tour failed",n)}finally{Ra=!1}}}window.__atlasTour=du;window.addEventListener("keydown",n=>{n.key==="F9"&&du()});var k=n=>document.querySelector(n),w={game:k("#game-select"),map:k("#map-select"),variant:k("#variant-select"),variantField:k("#variant-field"),legend:k("#legend"),search:k("#pin-search"),searchResults:k("#dock-results"),dock:k("#dock"),dockCount:k("#dock-count"),dockFlag:k("#dock-flag"),dockFold:k("#dock-fold"),dockRailName:k("#dock-rail-name"),visibleCount:k("#visible-count"),viewport:k("#map"),layers:k("#layers"),zoneToggle:k("#zone-toggle"),zoneCount:k("#zone-count"),zoneIndex:k("#zone-index"),zoneList:k("#zone-list"),loading:k("#map-loading"),labelsHint:k("#labels-hint"),gridHint:k("#grid-hint"),soloChip:k("#solo-chip"),overview:k("#overview"),overviewShelf:k("#overview-shelf"),overviewDock:k("#overview-dock"),overviewCanvas:k("#overview-canvas"),overviewViewport:k("#overview-viewport"),gridNavigator:k("#grid-navigator"),gridInput:k("#grid-input"),gridBack:k("#grid-back"),subgridToggle:k("#subgrid-toggle"),detail:k("#pin-detail"),detailTitle:k("#detail-title"),detailCategory:k("#detail-category"),detailDescription:k("#detail-description"),detailID:k("#detail-id"),detailCoordinates:k("#detail-coordinates"),detailCell:k("#detail-cell"),detailCellField:k("#detail-cell-field"),detailSource:k("#detail-source"),detailSourceField:k("#detail-source-field"),detailLinks:k("#detail-links"),detailDot:k("#detail-dot"),sidebar:k("#sidebar"),mobileLegend:k("#mobile-legend"),fatal:k("#fatal-error"),fatalMessage:k("#fatal-message"),emptyState:k("#empty-state"),emptyPath:k("#empty-path"),emptyOpen:k("#empty-open"),addBundles:k("#add-bundles")};function rn(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)})}var u={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,labelsHeld:!1,gridEnabled:!1,subgridVisible:!0,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:"",overviewPointer:null,overviewDocked:!1,dockFolded:!0,dockDismissed:!1,renderedShard:0,mapRun:0,textByMap:new Map,restore:null,settling:!1,styleCache:new Map,markerIcons:new Map};var Pn=["#4fb3d5","#c9924b","#82b56a","#c96a6a","#9581cc","#4bc9a9","#d4b04a","#6a92c9","#b08a5a","#8fb3a2"],ae="0123456789bcdefghjkmnpqrstuvwxyz";var Ta="atlas.session";var fu={light:"rgba(255, 255, 255, 0.96)",dark:"rgba(7, 9, 7, 0.98)"};var xt={UNKNOWN:0,INTERSECTING:1,ABOVE:2,RIGHT:4,BELOW:8,LEFT:16};function Ia(n){let t=ut();for(let e=0,i=n.length;e<i;++e)an(t,n[e]);return t}function jm(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 Qt(i,r,s,o,e)}function On(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 Os(n,t){return t?(t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t):n.slice()}function Li(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 pe(n,t){return Ar(n,t[0],t[1])}function Fe(n,t){return n[0]<=t[0]&&t[2]<=n[2]&&n[1]<=t[1]&&t[3]<=n[3]}function Ar(n,t,e){return n[0]<=t&&t<=n[2]&&n[1]<=e&&e<=n[3]}function Ps(n,t){let e=n[0],i=n[1],r=n[2],s=n[3],o=t[0],a=t[1],l=xt.UNKNOWN;return o<e?l=l|xt.LEFT:o>r&&(l=l|xt.RIGHT),a<i?l=l|xt.BELOW:a>s&&(l=l|xt.ABOVE),l===xt.UNKNOWN&&(l=xt.INTERSECTING),l}function ut(){return[1/0,1/0,-1/0,-1/0]}function Qt(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 sn(n){return Qt(1/0,1/0,-1/0,-1/0,n)}function Ds(n,t){let e=n[0],i=n[1];return Qt(e,i,e,i,t)}function Dn(n,t,e,i,r){let s=sn(r);return ba(s,n,t,e,i)}function on(n,t){return n[0]==t[0]&&n[2]==t[2]&&n[1]==t[1]&&n[3]==t[3]}function ks(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 an(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 ba(n,t,e,i,r){for(;e<i;e+=r)Hm(n,t[e],t[e+1]);return n}function Hm(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 Fs(n,t){let e;return e=t(kn(n)),e||(e=t(Fn(n)),e)||(e=t(Nn(n)),e)||(e=t(le(n)),e)?e:!1}function Mr(n){let t=0;return ze(n)||(t=j(n)*ct(n)),t}function kn(n){return[n[0],n[1]]}function Fn(n){return[n[2],n[1]]}function Bt(n){return[(n[0]+n[2])/2,(n[1]+n[3])/2]}function gu(n,t){let e;if(t==="bottom-left")e=kn(n);else if(t==="bottom-right")e=Fn(n);else if(t==="top-left")e=le(n);else if(t==="top-right")e=Nn(n);else throw new Error("Invalid corner");return e}function Pr(n,t,e,i,r){let[s,o,a,l,h,c,d,f]=La(n,t,e,i);return Qt(Math.min(s,a,h,d),Math.min(o,l,c,f),Math.max(s,a,h,d),Math.max(o,l,c,f),r)}function La(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,d=s*a,f=n[0],g=n[1];return[f-l+d,g-h-c,f-l-d,g-h+c,f+l-d,g+h+c,f+l+d,g+h-c,f-l+d,g-h-c]}function ct(n){return n[3]-n[1]}function Ne(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]):sn(i),i}function Aa(n,t){if(!ht(n,t))return[n.slice()];if(Fe(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 le(n){return[n[0],n[3]]}function Nn(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 ze(n){return n[2]<n[0]||n[3]<n[1]}function mu(n,t){return t?(t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t):n}function pu(n,t,e){let i=!1,r=Ps(n,t),s=Ps(n,e);if(r===xt.INTERSECTING||s===xt.INTERSECTING)i=!0;else{let o=n[0],a=n[1],l=n[2],h=n[3],c=t[0],d=t[1],f=e[0],g=e[1],m=(g-d)/(f-c),_,p;s&xt.ABOVE&&!(r&xt.ABOVE)&&(_=f-(g-h)/m,i=_>=o&&_<=l),!i&&s&xt.RIGHT&&!(r&xt.RIGHT)&&(p=g-(f-l)*m,i=p>=a&&p<=h),!i&&s&xt.BELOW&&!(r&xt.BELOW)&&(_=f-(g-a)/m,i=_>=o&&_<=l),!i&&s&xt.LEFT&&!(r&xt.LEFT)&&(p=g-(f-o)*m,i=p>=a&&p<=h)}return i}function _u(n,t,e,i){if(ze(n))return sn(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 jm(s,o,e)}function Ma(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 Ns(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]]];Ma(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 yu(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}var xu={info:1,warn:2,error:3,none:4},qm=xu.info;function zs(...n){qm>xu.warn||console.warn(...n)}function et(n,t,e){return Math.min(Math.max(n,t),e)}function Eu(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 _e(n,t,e,i)}function _e(n,t,e,i){let r=e-n,s=i-t;return r*r+s*s}function wu(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 Gs(n){return n*180/Math.PI}function ye(n){return n*Math.PI/180}function Ge(n,t){let e=n%t;return e*t<0?e+t:e}function zt(n,t,e){return n+e*(t-n)}function ln(n,t){let e=Math.pow(10,t);return Math.round(n*e)/e}function Or(n,t){return Math.floor(ln(n,t))}function Dr(n,t){return Math.ceil(ln(n,t))}function Xs(n,t,e){if(n>=t&&n<e)return n;let i=e-t;return((n-t)%i+i)%i+t}function Cu(n,t){return n[0]+=+t[0],n[1]+=+t[1],n}function cn(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 zn(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 vu(n,t){return n[0]*=t,n[1]*=t,n}function Ws(n,t){if(t.canWrapX()){let e=j(t.getExtent()),i=Su(n,t,e);i&&(n[0]-=i*e)}return n}function Su(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 Ru(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}var oi={radians:6370997/(2*Math.PI),degrees:2*Math.PI*6370997/360,ft:.3048,m:1,"us-ft":1200/3937};var Pa=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_||oi[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_}},Ai=Pa;var kr=6378137,Gn=Math.PI*kr,$m=[-Gn,-Gn,Gn,Gn],Jm=[-180,-85,180,85],Us=kr*Math.log(Math.tan(Math.PI/2)),Mi=class extends Ai{constructor(t){super({code:t,units:"m",extent:$m,global:!0,worldExtent:Jm,getPointResolution:function(e,i){return e/Math.cosh(i[1]/kr)}})}},Oa=[new Mi("EPSG:3857"),new Mi("EPSG:102100"),new Mi("EPSG:102113"),new Mi("EPSG:900913"),new Mi("http://www.opengis.net/def/crs/EPSG/0/3857"),new Mi("http://www.opengis.net/gml/srs/epsg.xml#3857")];function Tu(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]=Gn*n[s]/180;let o=kr*Math.log(Math.tan(Math.PI*(+n[s+1]+90)/360));o>Us?o=Us:o<-Us&&(o=-Us),t[s+1]=o}return t}function Iu(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]/Gn,t[s+1]=360*Math.atan(Math.exp(n[s+1]/kr))/Math.PI-90;return t}var Qm=6378137,bu=[-180,-90,180,90],tp=Math.PI*Qm/180,ai=class extends Ai{constructor(t,e){super({code:t,units:"degrees",extent:bu,axisOrientation:e,global:!0,metersPerUnit:tp,worldExtent:bu})}},Da=[new ai("CRS:84"),new ai("EPSG:4326","neu"),new ai("urn:ogc:def:crs:OGC:1.3:CRS84"),new ai("urn:ogc:def:crs:OGC:2:84"),new ai("http://www.opengis.net/def/crs/OGC/1.3/CRS84"),new ai("http://www.opengis.net/gml/srs/epsg.xml#4326","neu"),new ai("http://www.opengis.net/def/crs/EPSG/0/4326","neu")];var ka={};function Lu(n){return ka[n]||ka[n.replace(/urn:(x-)?ogc:def:crs:EPSG:(.*:)?(\w+)$/,"EPSG:$3")]||null}function Au(n,t){ka[n]=t}function Xe(n){for(let t in n)delete n[t]}function xe(n){let t;for(t in n)return!1;return!t}var Xn={};function Wn(n,t,e){let i=n.getCode(),r=t.getCode();i in Xn||(Xn[i]={}),Xn[i][r]=e}function Ys(n,t){return n in Xn&&t in Xn[n]?Xn[n][t]:null}var Ks=.9996,ce=.00669438,Bs=ce*ce,Vs=Bs*ce,hn=ce/(1-ce),Mu=Math.sqrt(1-ce),Un=(1-Mu)/(1+Mu),ku=Un*Un,Fa=ku*Un,Na=Fa*Un,Fu=Na*Un,Nu=1-ce/4-3*Bs/64-5*Vs/256,ep=3*ce/8+3*Bs/32+45*Vs/1024,ip=15*Bs/256+45*Vs/1024,np=35*Vs/3072,rp=3/2*Un-27/32*Fa+269/512*Fu,sp=21/16*ku-55/32*Na,op=151/96*Fa-417/128*Fu,ap=1097/512*Na,Zs=6378137;function lp(n,t,e){let i=n-5e5,o=(e.north?t:t-1e7)/Ks/(Zs*Nu),a=o+rp*Math.sin(2*o)+sp*Math.sin(4*o)+op*Math.sin(6*o)+ap*Math.sin(8*o),l=Math.sin(a),h=l*l,c=Math.cos(a),d=l/c,f=d*d,g=f*f,m=1-ce*h,_=Math.sqrt(1-ce*h),p=Zs/_,y=(1-ce)/m,E=hn*c**2,v=E*E,x=i/(p*Ks),C=x*x,T=C*x,A=T*x,R=A*x,I=R*x,b=a-d/y*(C/2-A/24*(5+3*f+10*E-4*v-9*hn))+I/720*(61+90*f+298*E+45*g-252*hn-3*v),z=(x-T/6*(1+2*f+E)+R/120*(5-2*E+28*f-3*v+8*hn+24*g))/c;return z=Xs(z+ye(zu(e.number)),-Math.PI,Math.PI),[Gs(z),Gs(b)]}var Pu=-80,Ou=84,cp=-180,hp=180;function up(n,t,e){n=Xs(n,cp,hp),t<Pu?t=Pu:t>Ou&&(t=Ou);let i=ye(t),r=Math.sin(i),s=Math.cos(i),o=r/s,a=o*o,l=a*a,h=ye(n),c=zu(e.number),d=ye(c),f=Zs/Math.sqrt(1-ce*r**2),g=hn*s**2,m=s*Xs(h-d,-Math.PI,Math.PI),_=m*m,p=_*m,y=p*m,E=y*m,v=E*m,x=Zs*(Nu*i-ep*Math.sin(2*i)+ip*Math.sin(4*i)-np*Math.sin(6*i)),C=Ks*f*(m+p/6*(1-a+g)+E/120*(5-18*a+l+72*g-58*hn))+5e5,T=Ks*(x+f*o*(_/2+y/24*(5-a+9*g+4*g**2)+v/720*(61-58*a+l+600*g-330*hn)));return e.north||(T+=1e7),[C,T]}function zu(n){return(n-1)*6-180+3}var dp=[/^EPSG:(\d+)$/,/^urn:ogc:def:crs:EPSG::(\d+)$/,/^http:\/\/www\.opengis\.net\/def\/crs\/EPSG\/0\/(\d+)$/];function Gu(n){let t=0;for(let r of dp){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 Du(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 Xu(n){return Gu(n)?new Ai({code:n,units:"m"}):null}function Wu(n){let t=Gu(n.getCode());return t?{forward:Du(up,t),inverse:Du(lp,t)}:null}var fp=63710088e-1;function za(n,t,e){e=e||fp;let i=ye(n[1]),r=ye(t[1]),s=(r-i)/2,o=ye(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 gp=[Wu],mp=[Xu];var Xa=!0;function Yu(n){Xa=!(n===void 0?!0:n)}function Ua(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 Wa(n){Au(n.getCode(),n),Wn(n,n,Ua)}function pp(n){n.forEach(Wa)}function Et(n){if(typeof n!="string")return n;let t=Lu(n);if(t)return t;for(let e of mp){let i=e(n);if(i)return i}return null}function Ya(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/oi[i])}}else{let o=n.getUnits();if(o=="degrees"&&!i||i=="degrees")r=t;else{let a=un(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=za(h.slice(0,2),h.slice(2,4)),d=za(h.slice(4,6),h.slice(6,8));r=(c+d)/2}let l=i?oi[i]:n.getMetersPerUnit();l!==void 0&&(r/=l)}}return r}function Uu(n){pp(n),n.forEach(function(t){n.forEach(function(e){t!==e&&Wn(t,e,Ua)})})}function _p(n,t,e,i){n.forEach(function(r){t.forEach(function(s){Wn(r,s,e),Wn(s,r,i)})})}function js(n,t){return n?typeof n=="string"?Et(n):n:Et(t)}function Ku(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 Yn(n,t){if(n===t)return!0;let e=n.getUnits()===t.getUnits();return(n.getCode()===t.getCode()||un(n,t)===Ua)&&e}function un(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 gp)s||(s=l(n)),o||(o=l(t));if(!s&&!o)return null;let a="EPSG:4326";if(o)if(s)r=Ga(s.inverse,o.forward);else{let l=Ys(e,a);l&&(r=Ga(l,o.forward))}else{let l=Ys(a,i);l&&(r=Ga(s.inverse,l))}return r&&(Wa(n),Wa(t),Wn(n,t,r)),r}function Ga(n,t){return function(e,i,r,s){return i=n(e,i,r,s),t(i,i,r,s)}}function dn(n,t){let e=Et(n),i=Et(t);return un(e,i)}function Kn(n,t,e){let i=dn(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 Zu(n,t,e,i){let r=dn(t,e);return _u(n,r,void 0,i)}var Ee=null;function fn(){return Ee}function Fr(n,t){return Ee?Kn(n,t,Ee):n}function we(n,t){return Ee?Kn(n,Ee,t):(Xa&&!cn(n,[0,0])&&n[0]>=-180&&n[0]<=180&&n[1]>=-90&&n[1]<=90&&(Xa=!1,zs("Call useGeographic() from ol/proj once to work with [longitude, latitude] coordinates.")),n)}function Pi(n,t){return Ee?Zu(n,t,Ee):n}function Ce(n,t){return Ee?Zu(n,Ee,t):n}function Bu(n,t){if(!Ee)return n;let e=Et(t).getMetersPerUnit(),i=Ee.getMetersPerUnit();return e&&i?n*e/i:n}function yp(){Uu(Oa),Uu(Da),_p(Da,Oa,Tu,Iu)}yp();function Ka(n){return n[0]>0&&n[1]>0}function Vu(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 mt(n,t){return Array.isArray(n)?n:(t===void 0?t=[n,n]:(t[0]=n,t[1]=n),t)}var Hs=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 gn(n,t,e,i,r){return r!==void 0?(r.minX=n,r.maxX=t,r.minY=e,r.maxY=i,r):new Hs(n,t,e,i)}var qs=Hs;function ju(n,t,e){let i,r;e=e||Vt;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 Vt(n,t){return n>t?1:n<t?-1:0}function Hu(n,t){return n<t?1:n>t?-1:0}function Zn(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 qu(n,t,e){for(;t<e;){let i=n[t];n[t]=n[e],n[e]=i,++t,--e}}function ve(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 Gt(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 $u(n,t,e){let i=t||Vt;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 B(n,t){if(!n)throw new Error(t)}function Ju(n,t,e,i,r){return!Fs(r,function(o){return!Oi(n,t,e,i,o[0],o[1])})}function Oi(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 Nr(n,t,e,i,r,s){if(e.length===0||!Oi(n,t,e[0],i,r,s))return!1;for(let o=1,a=e.length;o<a;++o)if(Oi(n,e[o-1],e[o],i,r,s))return!1;return!0}function Qu(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(Nr(n,t,l,i,r,s))return!0;t=l[l.length-1]}return!1}function td(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 $s(n,t,e,i,r,s){return s=s??ba(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:td(n,t,e,i,function(o,a){return pu(r,o,a)}):!1}function Za(n,t,e,i,r){return!!($s(n,t,e,i,r)||Oi(n,t,e,i,r[0],r[1])||Oi(n,t,e,i,r[0],r[3])||Oi(n,t,e,i,r[2],r[1])||Oi(n,t,e,i,r[2],r[3]))}function Ba(n,t,e,i,r){if(!Za(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(Ju(n,e[s-1],e[s],i,r)&&!$s(n,e[s-1],e[s],i,r))return!1;return!0}function ed(n,t,e,i,r){for(let s=0,o=e.length;s<o;++s){let a=e[s];if(Ba(n,t,a,i,r))return!0;t=a[a.length-1]}return!1}function H(){throw new Error("Unimplemented abstract method.")}var xp=0;function Y(n){return n.ol_uid||(n.ol_uid=String(++xp))}function Bn(n,t,e,i){return i!==void 0?(i[0]=n,i[1]=t,i[2]=e,i):[n,t,e]}function Ep(n,t,e){return n+"/"+t+"/"+e}function Vn(n,t,e,i,r){return`${Y(n)},${t},${Ep(e,i,r)}`}function id(n){return wp(n[0],n[1],n[2])}function wp(n,t,e){return(t<<n)+e}function nd(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 jn=[0,0,0],Di=5,Va=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($u(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_=le(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 qs(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=gn(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 gn(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 gn(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 gn(h,h,c,c,i);let d=Math.floor(l*(s+1))-1,f=Math.floor(l*(o+1))-1;return gn(h,d,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 gn(r,o,s,a,i)}getTileCoordCenter(t){let e=this.getOrigin(t[0]),i=this.getResolution(t[0]),r=mt(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=mt(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 Qt(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=mt(this.getTileSize(o),this.tmpSize_),c=a*(t-l[0])/i/h[0],d=a*(l[1]-e)/i/h[1];return r?(c=Dr(c,Di)-1,d=Dr(d,Di)-1):(c=Or(c,Di),d=Or(d,Di)),Bn(o,c,d,s)}getTileCoordForXYAndZ_(t,e,i,r,s){let o=this.getOrigin(i),a=this.getResolution(i),l=mt(this.getTileSize(i),this.tmpSize_),h=(t-o[0])/a/l[0],c=(o[1]-e)/a/l[1];return r?(h=Dr(h,Di)-1,c=Dr(c,Di)-1):(h=Or(h,Di),c=Or(c,Di)),Bn(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=Zn(this.resolutions_,t,e||0);return et(i,this.minZoom,this.maxZoom)}tileCoordIntersectsViewport(t,e){return Za(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}},zr=Va;function Js(n){let t=n.getDefaultTileGrid();return t||(t=vp(n),n.setDefaultTileGrid(t)),t}function sd(n,t,e){let i=t[0],r=n.getTileCoordCenter(t),s=Qs(e);if(!pe(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 Cp(n,t,e,i){i=i!==void 0?i:"top-left";let r=ad(n,t,e);return new zr({extent:n,origin:gu(n,i),resolutions:r,tileSize:e})}function od(n){let t=n||{},e=t.extent||Et("EPSG:3857").getExtent(),i={extent:e,minZoom:t.minZoom,tileSize:t.tileSize,resolutions:ad(e,t.maxZoom,t.tileSize,t.maxResolution)};return new zr(i)}function ad(n,t,e,i){t=t!==void 0?t:42,e=mt(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 vp(n,t,e,i){let r=Qs(n);return Cp(r,t,e,i)}function Qs(n){n=Et(n);let t=n.getExtent();if(!t){let e=180*oi.degrees/n.getMetersPerUnit();t=Qt(-e,-e,e,e)}return t}var U={IDLE:0,LOADING:1,LOADED:2,ERROR:3,EMPTY:4};function Z(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 Hn(n,t,e,i){return Z(n,t,e,i,!0)}function J(n){n&&n.target&&(n.target.removeEventListener(n.type,n.listener),Xe(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 ja=class{constructor(){this.disposed=!1}dispose(){this.disposed||(this.disposed=!0,this.disposeInternal())}disposeInternal(){}},ki=ja;function li(){return!0}function ci(){return!1}function hi(){}function to(n){let t,e,i;return function(){let r=Array.prototype.slice.call(arguments);return(!e||this!==i||!Gt(r,e))&&(i=this,e=r,t=n.apply(this,arguments)),t}}function ld(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 Ha=class{constructor(t){this.propagationStopped,this.defaultPrevented,this.type=t,this.target=null}preventDefault(){this.defaultPrevented=!0}stopPropagation(){this.propagationStopped=!0}};var Lt=Ha;var qa=class extends ki{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 Lt(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,hi);delete o[i]}return l}disposeInternal(){this.listeners_&&Xe(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]=hi,++this.pendingRemovals_[t]):(i.splice(r,1),i.length===0&&delete this.listeners_[t]))}},Fi=qa;var mn=typeof navigator<"u"&&typeof navigator.userAgent<"u"?navigator.userAgent.toLowerCase():"",Sp=mn.includes("safari")&&!mn.includes("chrom"),X0=Sp&&(mn.includes("version/15.4")||/cpu (os|iphone os) 15_4 like mac os x/.test(mn)),cd=mn.includes("webkit")&&!mn.includes("edge"),$a=mn.includes("macintosh"),hd=typeof devicePixelRatio<"u"?devicePixelRatio:1,Rt=typeof WorkerGlobalScope<"u"&&typeof OffscreenCanvas<"u"&&self instanceof WorkerGlobalScope,Ja=typeof Image<"u"&&Image.prototype.decode;var eo=(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})();function ud(n,t,e){let i=n,r=!0,s=!1,o=!1,a=[Hn(i,P.LOAD,function(){o=!0,s||t()})];return i.src&&Ja?(s=!0,i.decode().then(function(){r&&t()}).catch(function(l){r&&(o?t():e())})):a.push(Hn(i,P.ERROR,e)),function(){r=!1,a.forEach(J)}}function Rp(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 dd(n,t){return t&&(n.src=t),n.src&&Ja?new Promise((e,i)=>n.decode().then(()=>e(n)).catch(r=>n.complete&&n.width?e(n):i(r))):Rp(n)}var D={IDLE:0,LOADING:1,LOADED:2,ERROR:3,EMPTY:4};function Qa(n){return Math.pow(n,3)}function he(n){return 1-Qa(1-n)}function fd(n){return 3*n*n-2*n*n*n}function gd(n){return n}var tl=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(D.EMPTY)}getKey(){return this.key+"/"+this.tileCoord}getTileCoord(){return this.tileCoord}getState(){return this.state}setState(t){if(this.state!==D.EMPTY){if(this.state!==D.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:Qa(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()}},qn=tl;function nt(n,t,e,i){let r;return e&&e.length?r=e.shift():Rt?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 el;function Gr(){return el||(el=nt(1,1)),el}function pn(n){let t=n.canvas;t.width=1,t.height=1,n.clearRect(0,0,1,1)}function il(n,t){let e=t.parentNode;e&&e.replaceChild(n,t)}function md(n){for(;n.lastChild;)n.lastChild.remove()}function pd(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 io(){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 nl=class extends qn{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_,Rt?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=D.LOADED,this.unlistenImage_(),this.changed()}getCrossOrigin(){return this.crossOrigin_}getReferrerPolicy(){return this.referrerPolicy_}handleImageError_(){this.state=D.ERROR,this.unlistenImage_(),this.image_=Tp(),this.changed()}handleImageLoad_(){if(Rt)this.state=D.LOADED;else{let t=this.image_;t.naturalWidth&&t.naturalHeight?this.state=D.LOADED:this.state=D.EMPTY}this.unlistenImage_(),this.changed()}load(){this.state==D.ERROR&&(this.state=D.IDLE,this.image_=new Image,this.crossOrigin_!==null&&(this.image_.crossOrigin=this.crossOrigin_),this.referrerPolicy_!==void 0&&(this.image_.referrerPolicy=this.referrerPolicy_)),this.state==D.IDLE&&(this.state=D.LOADING,this.changed(),this.tileLoadFunction_(this,this.src_),this.unlisten_=ud(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 Tp(){let n=nt(1,1);return n.fillStyle="rgba(0,0,0,0)",n.fillRect(0,0,1,1),n.canvas}var no=nl;var rl,_n=[];function _d(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 sl(n,t){return Math.abs(n[t*4]-210)>2||Math.abs(n[t*4+3]-.75*255)>2}function Ip(){if(rl===void 0){let n=nt(6,6,_n);n.globalCompositeOperation="lighter",n.fillStyle="rgba(210, 0, 0, 0.75)",_d(n,4,5,4,0),_d(n,4,5,0,5);let t=n.getImageData(0,0,3,3).data;rl=sl(t,0)||sl(t,4)||sl(t,8),pn(n),_n.push(n.canvas)}return rl}function yd(n,t,e,i){let r=Kn(e,t,n),s=Ya(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||pe(l,r)){let h=Ya(n,s,r)/s;isFinite(h)&&h>0&&(s/=h)}return s}function xd(n,t,e,i){let r=Bt(e),s=yd(n,t,r,i);return(!isFinite(s)||s<=0)&&Fs(e,function(o){return s=yd(n,t,o,i),isFinite(s)&&s>0}),s}function Ed(n,t,e,i,r,s,o,a,l,h,c,d,f,g){let m=nt(Math.round(e*n),Math.round(e*t),_n);if(d||(m.imageSmoothingEnabled=!1),l.length===0)return m.canvas;m.scale(e,e);function _(C){return Math.round(C*e)/e}m.globalCompositeOperation="lighter";let p=ut();l.forEach(function(C,T,A){ks(p,C.extent)});let y,E=e/i,v=(d?1:1+Math.pow(2,-24))/E;if(!f||l.length!==1||h!==0){if(y=nt(Math.round(j(p)*E),Math.round(ct(p)*E),_n),d||(y.imageSmoothingEnabled=!1),r&&g){let C=(r[0]-p[0])*E,T=-(r[3]-p[3])*E,A=j(r)*E,R=ct(r)*E;y.rect(C,T,A,R),y.clip()}l.forEach(function(C,T,A){if(C.image.width>0&&C.image.height>0){if(C.clipExtent){y.save();let X=(C.clipExtent[0]-p[0])*E,N=-(C.clipExtent[3]-p[3])*E,V=j(C.clipExtent)*E,lt=ct(C.clipExtent)*E;y.rect(d?X:Math.round(X),d?N:Math.round(N),d?V:Math.round(X+V)-Math.round(X),d?lt:Math.round(N+lt)-Math.round(N)),y.clip()}let R=(C.extent[0]-p[0])*E,I=-(C.extent[3]-p[3])*E,b=j(C.extent)*E,z=ct(C.extent)*E;y.drawImage(C.image,h,h,C.image.width-2*h,C.image.height-2*h,d?R:Math.round(R),d?I:Math.round(I),d?b:Math.round(R+b)-Math.round(R),d?z:Math.round(I+z)-Math.round(I)),C.clipExtent&&y.restore()}})}let x=le(o);return a.getTriangles().forEach(function(C,T,A){let R=C.source,I=C.target,b=R[0][0],z=R[0][1],X=R[1][0],N=R[1][1],V=R[2][0],lt=R[2][1],M=_((I[0][0]-x[0])/s),W=_(-(I[0][1]-x[1])/s),O=_((I[1][0]-x[0])/s),$=_(-(I[1][1]-x[1])/s),G=_((I[2][0]-x[0])/s),tt=_(-(I[2][1]-x[1])/s),it=b,Ct=z;b=0,z=0,X-=it,N-=Ct,V-=it,lt-=Ct;let L=[[X,N,0,0,O-M],[V,lt,0,0,G-M],[0,0,X,N,$-W],[0,0,V,lt,tt-W]],Jt=wu(L);if(!Jt)return;if(m.save(),m.beginPath(),Ip()||!d){m.moveTo(O,$);let ot=4,Oe=M-O,Ji=W-$;for(let re=0;re<ot;re++)m.lineTo(O+_((re+1)*Oe/ot),$+_(re*Ji/(ot-1))),re!=ot-1&&m.lineTo(O+_((re+1)*Oe/ot),$+_((re+1)*Ji/(ot-1)));m.lineTo(G,tt)}else m.moveTo(O,$),m.lineTo(M,W),m.lineTo(G,tt);m.clip(),m.transform(Jt[0],Jt[2],Jt[1],Jt[3],M,W),m.translate(p[0]-it,p[3]-Ct);let vt;if(y)vt=y.canvas,m.scale(v,-v);else{let ot=l[0],Oe=ot.extent;vt=ot.image,m.scale(j(Oe)/vt.width,-ct(Oe)/vt.height)}m.drawImage(vt,0,0),m.restore()}),y&&(pn(y),_n.push(y.canvas)),c&&(m.save(),m.globalCompositeOperation="source-over",m.strokeStyle="black",m.lineWidth=1,a.getTriangles().forEach(function(C,T,A){let R=C.target,I=(R[0][0]-x[0])/s,b=-(R[0][1]-x[1])/s,z=(R[1][0]-x[0])/s,X=-(R[1][1]-x[1])/s,N=(R[2][0]-x[0])/s,V=-(R[2][1]-x[1])/s;m.beginPath(),m.moveTo(z,X),m.lineTo(I,b),m.lineTo(N,V),m.closePath(),m.stroke()}),m.restore()),m.canvas}var bp=[1,0,0,1,0,0],pE=new Array(6);function At(){return bp.slice(0)}function wd(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 Ot(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 so(n,t){let e=Lp(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 Lp(n){return n[0]*n[3]-n[1]*n[2]}var Ap=[1e5,1e5,1e5,1e5,2,2];function Cd(n){return"matrix("+n.join(", ")+")"}function ro(n){return n.substring(7,n.length-1).split(",").map(parseFloat)}function vd(n,t){let e=ro(n),i=ro(t);for(let r=0;r<6;++r)if(Math.round((e[r]-i[r])*Ap[r])!==0)return!1;return!0}var Mp=10,Sd=.25,ol=class{constructor(t,e,i,r,s,o,a){this.sourceProj_=t,this.targetProj_=e;let l={},h=a?Ku(v=>dt(a,Kn(v,this.targetProj_,this.sourceProj_))):dn(this.targetProj_,this.sourceProj_);this.transformInv_=function(v){let x=v[0]+"/"+v[1];return l[x]||(l[x]=h(v)),l[x]},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=le(i),d=Nn(i),f=Fn(i),g=kn(i),m=this.transformInv_(c),_=this.transformInv_(d),p=this.transformInv_(f),y=this.transformInv_(g),E=Mp+(o?Math.max(0,Math.ceil(Math.log2(Mr(i)/(o*o*256*256)))):0);if(this.addQuad_(c,d,f,g,m,_,p,y,E),this.wrapsXInSource_){let v=1/0;this.triangles_.forEach(function(x,C,T){v=Math.min(v,x.source[0][0],x.source[1][0],x.source[2][0])}),this.triangles_.forEach(x=>{if(Math.max(x.source[0][0],x.source[1][0],x.source[2][0])-v>this.sourceWorldWidth_/2){let C=[[x.source[0][0],x.source[0][1]],[x.source[1][0],x.source[1][1]],[x.source[2][0],x.source[2][1]]];C[0][0]-v>this.sourceWorldWidth_/2&&(C[0][0]-=this.sourceWorldWidth_),C[1][0]-v>this.sourceWorldWidth_/2&&(C[1][0]-=this.sourceWorldWidth_),C[2][0]-v>this.sourceWorldWidth_/2&&(C[2][0]-=this.sourceWorldWidth_);let T=Math.min(C[0][0],C[1][0],C[2][0]);Math.max(C[0][0],C[1][0],C[2][0])-T<this.sourceWorldWidth_/2&&(x.source=C)}})}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=Ia([s,o,a,l]),d=this.sourceWorldWidth_?j(c)/this.sourceWorldWidth_:null,f=this.sourceWorldWidth_,g=this.sourceProj_.canWrapX()&&d>.5&&d<1,m=!1;if(h>0){if(this.targetProj_.isGlobal()&&this.targetWorldWidth_){let p=Ia([t,e,i,r]);m=j(p)/this.targetWorldWidth_>Sd||m}!g&&this.sourceProj_.isGlobal()&&d&&(m=d>Sd||m)}if(!m&&this.maxSourceExtent_&&isFinite(c[0])&&isFinite(c[1])&&isFinite(c[2])&&isFinite(c[3])&&!ht(c,this.maxSourceExtent_))return;let _=0;if(!m&&(!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)m=!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(!m){let p=[(t[0]+i[0])/2,(t[1]+i[1])/2],y=this.transformInv_(p),E;g?E=(Ge(s[0],f)+Ge(a[0],f))/2-Ge(y[0],f):E=(s[0]+a[0])/2-y[0];let v=(s[1]+a[1])/2-y[1];m=E*E+v*v>this.errorThresholdSquared_}if(m){if(Math.abs(t[0]-i[0])<=Math.abs(t[1]-i[1])){let p=[(e[0]+i[0])/2,(e[1]+i[1])/2],y=this.transformInv_(p),E=[(r[0]+t[0])/2,(r[1]+t[1])/2],v=this.transformInv_(E);this.addQuad_(t,e,p,E,s,o,y,v,h-1),this.addQuad_(E,p,i,r,v,y,a,l,h-1)}else{let p=[(t[0]+e[0])/2,(t[1]+e[1])/2],y=this.transformInv_(p),E=[(i[0]+r[0])/2,(i[1]+r[1])/2],v=this.transformInv_(E);this.addQuad_(t,p,E,r,s,y,v,l,h-1),this.addQuad_(p,e,i,E,y,o,a,v,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;an(t,s[0]),an(t,s[1]),an(t,s[2])}),t}getTriangles(){return this.triangles_}},Rd=ol;var al=class extends qn{constructor(t,e,i,r,s,o,a,l,h,c,d,f){super(s,D.IDLE,f),this.renderEdges_=d!==void 0?d:!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_),m=this.targetTileGrid_.getExtent(),_=this.sourceTileGrid_.getExtent(),p=m?Ne(g,m):g;if(Mr(p)===0){this.state=D.EMPTY;return}let y=t.getExtent();y&&(_?_=Ne(_,y):_=y);let E=r.getResolution(this.wrappedTileCoord_[0]),v=xd(t,i,p,E);if(!isFinite(v)||v<=0){this.state=D.EMPTY;return}let x=c!==void 0?c:.5;if(this.triangulation_=new Rd(t,i,p,_,v*x,E),this.triangulation_.getTriangles().length===0){this.state=D.EMPTY;return}this.sourceZ_=e.getZForResolution(v);let C=this.triangulation_.calculateSourceExtent();if(_&&(t.canWrapX()?(C[1]=et(C[1],_[1],_[3]),C[3]=et(C[3],_[1],_[3])):C=Ne(C,_)),!Mr(C))this.state=D.EMPTY;else{let T=0,A=0;t.canWrapX()&&(T=j(y),A=Math.floor((C[0]-y[0])/T)),Ns(C.slice(),t,!0).forEach(I=>{let b=e.getTileRangeForExtentAndZ(I,this.sourceZ_);for(let z=b.minX;z<=b.maxX;z++)for(let X=b.minY;X<=b.maxY;X++){let N=A*T;this.sourceTiles_.push({getTile:()=>h(this.sourceZ_,z,X,a),offset:N})}++A}),this.sourceTiles_.length===0&&(this.state=D.EMPTY)}}getImage(){return this.canvas_}reproject_(){let t=[];if(this.sourceTiles_.forEach(e=>{let i=e.tile;if(i&&i.getState()==D.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=D.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_=Ed(r,s,this.pixelRatio_,a,this.sourceTileGrid_.getExtent(),o,l,this.triangulation_,t,this.gutter_,this.renderEdges_,this.interpolate),this.state=D.LOADED}this.changed()}load(){for(let t of this.sourceTiles_)t.tile=t.getTile();if(this.state==D.IDLE){this.state=D.LOADING,this.changed();let t=0;this.sourcesListenerKeys_=[],this.sourceTiles_.forEach(({tile:e})=>{let i=e.getState();if(i==D.IDLE||i==D.LOADING){t++;let r=Z(e,P.CHANGE,s=>{let o=e.getState();(o==D.LOADED||o==D.ERROR||o==D.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()==D.IDLE&&e.load()})}}unlistenSources_(){this.sourcesListenerKeys_.forEach(J),this.sourcesListenerKeys_=null}release(){this.canvas_&&(pn(this.canvas_.getContext("2d")),_n.push(this.canvas_),this.canvas_=null),this.sourceTiles_.length=0,super.release()}},oo=al;var Pp=/\{z\}/g,Op=/\{x\}/g,Dp=/\{y\}/g,kp=/\{-y\}/g;function Td(n,t,e,i,r){return n.replace(Pp,t.toString()).replace(Op,e.toString()).replace(Dp,i.toString()).replace(kp,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 Id(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 Fp(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 Td(n,o,e[1],e[2],s)})}function bd(n,t){let e=n.length,i=new Array(e);for(let r=0;r<e;++r)i[r]=Fp(n[r],t);return Np(i)}function Np(n){return n.length===1?n[0]:(function(t,e,i){if(!t)return;let r=id(t),s=Ge(r,n.length);return n[s](t,e,i)})}var Se={PROPERTYCHANGE:"propertychange"};var $n=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]=Z(this,t[s],e);return r}return Z(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]=Hn(this,t[s],e)}else i=Hn(this,t,e);return e.ol_key=i,i}unInternal(t,e){let i=e.ol_key;if(i)zp(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)}};$n.prototype.on;$n.prototype.once;$n.prototype.un;function zp(n){if(Array.isArray(n))for(let t=0,e=n.length;t<e;++t)J(n[t]);else J(n)}var ao=$n;var lo=class extends Lt{constructor(t,e,i){super(t),this.key=e,this.oldValue=i}},ll=class extends ao{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 lo(i,t,e)),i=Se.PROPERTYCHANGE,this.hasListener(i)&&this.dispatchEvent(new lo(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],xe(this.values_)&&(this.values_=null),e||this.notify(t,i)}}},wt=ll;var cl=class extends wt{constructor(t){super(),this.projection=Et(t.projection),this.attributions_=Ld(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_=Ld(t),this.changed()}setState(t){this.state_=t,this.changed()}};function Ld(n){return n?typeof n=="function"?n:(Array.isArray(n)||(n=[n]),t=>n):null}var co=cl;var hl=class extends co{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&&mt(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:Js(t)}getTilePixelRatio(t){return this.tilePixelRatio_}getTilePixelSize(t,e,i){let r=this.getTileGridForProjection(i),s=this.getTilePixelRatio(e),o=mt(r.getTileSize(t),this.tmpSize);return s==1?o:Vu(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=sd(r,t,i)),nd(t,r)?t:null}clear(){}refresh(){this.clear(),super.refresh()}},ho=class extends Lt{constructor(t,e){super(t),this.tile=e}},Ad=hl;var uo={TILELOADSTART:"tileloadstart",TILELOADEND:"tileloadend",TILELOADERROR:"tileloaderror"};var ul=class n extends Ad{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==D.LOADING?(this.tileLoadingKeys_[i]=!0,s=uo.TILELOADSTART):i in this.tileLoadingKeys_&&(delete this.tileLoadingKeys_[i],s=r==D.ERROR?uo.TILELOADERROR:r==D.LOADED?uo.TILELOADEND:void 0),s!=null&&this.dispatchEvent(new ho(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=Id(t);this.urls=e,this.setUrls(e)}setUrls(t){this.urls=t;let e=t.join(`2-`);this.generateTileUrlFunction_?this.setTileUrlFunction(bd(t,this.tileGrid),e):this.setKey(e)}tileUrlFunction(t,e,i){}},Md=ul;var dl=class extends Md{constructor(t){super({attributions:t.attributions,cacheSize:t.cacheSize,projection:t.projection,state:t.state,tileGrid:t.tileGrid,tileLoadFunction:t.tileLoadFunction?t.tileLoadFunction:Gp,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:no,this.tileGridForProjection={},this.reprojectionErrorThreshold_=t.reprojectionErrorThreshold,this.renderReprojectionEdges_=!1}getGutterForProjection(t){return this.getProjection()&&t&&!Yn(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||Yn(e,t)))return this.tileGrid;let i=Y(t);return i in this.tileGridForProjection||(this.tileGridForProjection[i]=Js(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?D.IDLE:D.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||Yn(a,s))return this.getTileInternal(t,e,i,r,a||s);let l=[t,e,i],h=this.getKey(),c=this.getTileGridForProjection(a),d=this.getTileGridForProjection(s),f=this.getTileCoordForTileUrlFunction(l,s),g=new oo(a,c,s,d,l,f,this.getTilePixelRatio(r),this.getGutter(),(m,_,p,y)=>this.getTileInternal(m,_,p,y,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=Vn(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 Gp(n,t){if(Rt){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 Pd=dl;var fl=class extends Pd{constructor(t){t=t||{};let e=t.projection!==void 0?t.projection:"EPSG:3857",i=t.tileGrid!==void 0?t.tileGrid:od({extent:Qs(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_}},Od=fl;function Re(){if(!u.map||!u.variant||u.settling)return;let n=u.engine?.getView();try{let t=Dd();t.last=u.game.slug,t.games[u.game.slug]={game:u.game.slug,map:u.map.slug,variant:u.map.variants.indexOf(u.variant),center:n?.getCenter(),zoom:n?.getZoom(),hidden:[...u.hiddenCategories],collapsed:[...u.collapsedSections],overviewDocked:u.overviewDocked,dockFolded:u.dockFolded,dockDismissed:u.dockDismissed},localStorage.setItem(Ta,JSON.stringify(t))}catch{}}function Dd(){try{let n=JSON.parse(localStorage.getItem(Ta)||"null");if(n&&n.games)return n}catch{}return{last:"",games:{}}}function Jn(n){let t=Dd(),e=n||t.last,i=e&&t.games[e];return i&&i.game&&i.map?i:null}function Qn(){let[n,t]=decodeURIComponent(location.hash.replace(/^#\/?/,"")).split("/").map(e=>e.trim());return{game:n,map:t}}function kd(){if(!u.game||!u.map)return;let n=`#${u.game.slug}/${u.map.slug}`;location.hash!==n&&history.replaceState(null,"",n)}var gl=class n extends wt{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_=Z(t,P.CHANGE,this.handleGeometryChange_,this)),this.changed()}setGeometry(t){this.set(this.geometryName_,t)}setStyle(t){this.style_=t,this.styleFunction_=t?Xp(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 Xp(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 Ni=gl;function jt(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 d=2;d<o;d++)s[a++]=n[l+d]}return s&&s.length!=a&&(s.length=a),s}function fo(n,t,e,i,r,s,o){o=o||[];let a=Math.cos(r),l=Math.sin(r),h=s[0],c=s[1],d=0;for(let f=t;f<e;f+=i){let g=n[f]-h,m=n[f+1]-c;o[d++]=h+g*a-m*l,o[d++]=c+g*l+m*a;for(let _=f+2;_<f+i;++_)o[d++]=n[_]}return o&&o.length!=d&&(o.length=d),o}function Fd(n,t,e,i,r,s,o,a){a=a||[];let l=o[0],h=o[1],c=0;for(let d=t;d<e;d+=i){let f=n[d]-l,g=n[d+1]-h;a[c++]=l+r*f,a[c++]=h+s*g;for(let m=d+2;m<d+i;++m)a[c++]=n[m]}return a&&a.length!=c&&(a.length=c),a}function Nd(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 zd=At(),Wp=[NaN,NaN],ml=class extends wt{constructor(){super(),this.extent_=ut(),this.extentRevision_=-1,this.simplifiedGeometryMaxMinSquaredTolerance=0,this.simplifiedGeometryRevision=0,this.simplifyTransformedInternal=to((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,Wp,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]))&&sn(e),this.extentRevision_=this.getRevision()}return mu(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);Ot(zd,h[0],h[3],c,-c,0,0,0);let d=jt(s,0,s.length,a,zd,o),f=dn(i,e);return f?f(d,d,a):d}:dn(i,e);return this.applyTransform(r),this}},Gd=ml;var pl=class extends Gd{constructor(){super(),this.layout="XY",this.stride=2,this.flatCoordinates}computeExtent(t){return Dn(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=Xd(t),this.layout=t,this.flatCoordinates=e}setCoordinates(t,e){H()}setLayout(t,e,i){let r;if(t)r=Xd(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=Up(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();fo(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();Fd(r,0,r.length,s,t,e,i,r),this.changed()}}translate(t,e){let i=this.getFlatCoordinates();if(i){let r=this.getStride();Nd(i,0,i.length,r,t,e,i),this.changed()}}};function Up(n){let t;return n==2?t="XY":n==3?t="XYZ":n==4&&(t="XYZM"),t}function Xd(n){let t;return n=="XY"?t=2:n=="XYZ"||n=="XYM"?t=3:n=="XYZM"&&(t=4),t}function Wd(n,t,e){let i=n.getFlatCoordinates();if(!i)return null;let r=n.getStride();return jt(i,0,i.length,r,t,e)}var We=pl;function Ud(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 _l(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 Yd(n,t,e,i,r){r=r||[];let s=0;for(let o=0,a=e.length;o<a;++o){let l=_l(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}var yl=class n extends We{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=_e(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 Ar(t,this.flatCoordinates[0],this.flatCoordinates[1])}setCoordinates(t,e){this.setLayout(e,t,0),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=Ud(this.flatCoordinates,0,t,this.stride),this.changed()}},ui=yl;function xl(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 El(n,t,e,i){let r=0;for(let s=0,o=e.length;s<o;++s){let a=e[s];r+=xl(n,t,a,i),t=a}return r}function Kd(n,t,e,i){let r=0;for(let s=0,o=e.length;s<o;++s){let a=e[s];r+=El(n,t,a,i),t=a[a.length-1]}return r}function Zd(n,t,e,i,r,s,o){let a=n[t],l=n[t+1],h=n[e]-a,c=n[e+1]-l,d;if(h===0&&c===0)d=t;else{let f=((r-a)*h+(s-l)*c)/(h*h+c*c);if(f>1)d=e;else if(f>0){for(let g=0;g<i;++g)o[g]=zt(n[t+g],n[e+g],f);o.length=i;return}else d=t}for(let f=0;f<i;++f)o[f]=n[d+f];o.length=i}function wl(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=_e(s,o,a,l);h>r&&(r=h),s=a,o=l}return r}function Cl(n,t,e,i,r){for(let s=0,o=e.length;s<o;++s){let a=e[s];r=wl(n,t,a,i,r),t=a}return r}function Bd(n,t,e,i,r){for(let s=0,o=e.length;s<o;++s){let a=e[s];r=Cl(n,t,a,i,r),t=a[a.length-1]}return r}function vl(n,t,e,i,r,s,o,a,l,h,c){if(t==e)return h;let d,f;if(r===0){if(f=_e(o,a,n[t],n[t+1]),f<h){for(d=0;d<i;++d)l[d]=n[t+d];return l.length=i,f}return h}c=c||[NaN,NaN];let g=t+i;for(;g<e;)if(Zd(n,g-i,g,i,o,a,c),f=_e(o,a,c[0],c[1]),f<h){for(h=f,d=0;d<i;++d)l[d]=c[d];l.length=i,g+=i}else g+=i*Math.max((Math.sqrt(f)-Math.sqrt(h))/r|0,1);if(s&&(Zd(n,e-i,t,i,o,a,c),f=_e(o,a,c[0],c[1]),f<h)){for(h=f,d=0;d<i;++d)l[d]=c[d];l.length=i}return h}function Sl(n,t,e,i,r,s,o,a,l,h,c){c=c||[NaN,NaN];for(let d=0,f=e.length;d<f;++d){let g=e[d];h=vl(n,t,g,i,r,s,o,a,l,h,c),t=g}return h}function Vd(n,t,e,i,r,s,o,a,l,h,c){c=c||[NaN,NaN];for(let d=0,f=e.length;d<f;++d){let g=e[d];h=Sl(n,t,g,i,r,s,o,a,l,h,c),t=g[g.length-1]}return h}function Ue(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 tr(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++]=Ue(n,t,l,i,r[s]),t=l}return r.length=s,r}function Wr(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?[]:tr(n,t,l,i,r[s]),t=l[l.length-1]}return r.length=s,r}function Ur(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 d=h.pop(),f=h.pop(),g=0,m=n[f],_=n[f+1],p=n[d],y=n[d+1];for(let E=f+i;E<d;E+=i){let v=n[E],x=n[E+1],C=Eu(v,x,m,_,p,y);C>g&&(c=E,g=C)}g>r&&(l[(c-t)/i]=1,f+i<c&&h.push(f,c),c+i<d&&h.push(c,d))}for(let d=0;d<a;++d)l[d]&&(s[o++]=n[t+d*i],s[o++]=n[t+d*i+1]);return o}function jd(n,t,e,i,r,s,o,a){for(let l=0,h=e.length;l<h;++l){let c=e[l];o=Ur(n,t,c,i,r,s,o),a.push(o),t=c}return o}function zi(n,t){return t*Math.round(n/t)}function Yp(n,t,e,i,r,s,o){if(t==e)return o;let a=zi(n[t],r),l=zi(n[t+1],r);t+=i,s[o++]=a,s[o++]=l;let h,c;do if(h=zi(n[t],r),c=zi(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 d=zi(n[t],r),f=zi(n[t+1],r);if(t+=i,d==h&&f==c)continue;let g=h-a,m=c-l,_=d-a,p=f-l;if(g*p==m*_&&(g<0&&_<g||g==_||g>0&&_>g)&&(m<0&&p<m||m==p||m>0&&p>m)){h=d,c=f;continue}s[o++]=h,s[o++]=c,a=h,l=c,h=d,c=f}return s[o++]=h,s[o++]=c,o}function Yr(n,t,e,i,r,s,o,a){for(let l=0,h=e.length;l<h;++l){let c=e[l];o=Yp(n,t,c,i,r,s,o),a.push(o),t=c}return o}function Hd(n,t,e,i,r,s,o,a){for(let l=0,h=e.length;l<h;++l){let c=e[l],d=[];o=Yr(n,t,c,i,r,s,o,d),a.push(d),t=c[c.length-1]}return o}var Rl=class n extends We{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<Li(this.getExtent(),t,e)?r:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(wl(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),vl(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,this.maxDelta_,!0,t,e,i,r))}getArea(){return xl(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getCoordinates(){return Ue(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getSimplifiedGeometryInternal(t){let e=[];return e.length=Ur(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t,e,0),new n(e,"XY")}getType(){return"LinearRing"}intersectsExtent(t){return $s(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()}},Tl=Rl;function Kr(n,t,e,i,r,s,o){let a,l,h,c,d,f,g,m=r[s+1],_=[];for(let E=0,v=e.length;E<v;++E){let x=e[E];for(c=n[x-i],f=n[x-i+1],a=t;a<x;a+=i)d=n[a],g=n[a+1],(m<=f&&g<=m||f<=m&&m<=g)&&(h=(m-f)/(g-f)*(d-c)+c,_.push(h)),c=d,f=g}let p=NaN,y=-1/0;for(_.sort(Vt),c=_[0],a=1,l=_.length;a<l;++a){d=_[a];let E=Math.abs(d-c);E>y&&(h=(c+d)/2,Nr(n,t,e,i,h,m)&&(p=h,y=E)),c=d}return isNaN(p)&&(p=r[s]),o?(o.push(p,m,y),o):[p,m,y]}function go(n,t,e,i,r){let s=[];for(let o=0,a=e.length;o<a;++o){let l=e[o];s=Kr(n,t,l,i,r,2*o,s),t=l[l.length-1]}return s}function qd(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 Il(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 bl(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=Il(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 $d(n,t,e,i,r){for(let s=0,o=e.length;s<o;++s){let a=e[s];if(!bl(n,t,a,i,r))return!1;a.length&&(t=a[a.length-1])}return!0}function mo(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=Il(n,t,a,i);(s===0?r&&l||!r&&!l:r&&!l||!r&&l)&&qd(n,t,a,i),t=a}return t}function Ll(n,t,e,i,r){for(let s=0,o=e.length;s<o;++s)t=mo(n,t,e[s],i,r);return t}function Jd(n,t){let e=[],i=0,r=0,s;for(let o=0,a=t.length;o<a;++o){let l=t[o],h=Il(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 po=class n extends We{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?ve(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<Li(this.getExtent(),t,e)?r:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(Cl(this.flatCoordinates,0,this.ends_,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),Sl(this.flatCoordinates,0,this.ends_,this.stride,this.maxDelta_,!0,t,e,i,r))}containsXY(t,e){return Nr(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,t,e)}getArea(){return El(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride)}getCoordinates(t){let e;return t!==void 0?(e=this.getOrientedFlatCoordinates().slice(),mo(e,0,this.ends_,this.stride,t)):e=this.flatCoordinates,tr(e,0,this.ends_,this.stride)}getEnds(){return this.ends_}getFlatInteriorPoint(){if(this.flatInteriorPointRevision_!=this.getRevision()){let t=Bt(this.getExtent());this.flatInteriorPoint_=Kr(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,t,0),this.flatInteriorPointRevision_=this.getRevision()}return this.flatInteriorPoint_}getInteriorPoint(){return new ui(this.getFlatInteriorPoint(),"XYM")}getLinearRingCount(){return this.ends_.length}getLinearRing(t){return t<0||this.ends_.length<=t?null:new Tl(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 Tl(e.slice(s,l),t);r.push(h),s=l}return r}getOrientedFlatCoordinates(){if(this.orientedRevision_!=this.getRevision()){let t=this.flatCoordinates;bl(t,0,this.ends_,this.stride)?this.orientedFlatCoordinates_=t:(this.orientedFlatCoordinates_=t.slice(),this.orientedFlatCoordinates_.length=mo(this.orientedFlatCoordinates_,0,this.ends_,this.stride)),this.orientedRevision_=this.getRevision()}return this.orientedFlatCoordinates_}getSimplifiedGeometryInternal(t){let e=[],i=[];return e.length=Yr(this.flatCoordinates,0,this.ends_,this.stride,Math.sqrt(t),e,0,i),new n(e,"XY",i)}getType(){return"Polygon"}intersectsExtent(t){return Ba(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,t)}setCoordinates(t,e){this.setLayout(e,t,2),this.flatCoordinates||(this.flatCoordinates=[]);let i=_l(this.flatCoordinates,0,t,this.stride,this.ends_);this.flatCoordinates.length=i.length===0?0:i[i.length-1],this.changed()}},Ye=po;function Al(n){if(ze(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 po(s,"XY",[s.length])}function Qd(){let n=u.variant?.surface;return n?[n.x,-(n.y+n.height),n.x+n.width,-n.y]:di()}function tf(n){return n.key.toLocaleLowerCase()==="g"?(n.preventDefault(),ef(),u.gridEnabled?(w.gridInput.focus(),w.gridInput.select()):w.viewport.focus({preventScroll:!0}),!0):n.key===" "&&u.gridEnabled&&n.target!==w.subgridToggle?(n.preventDefault(),Zr(!u.subgridVisible),!0):n.key==="Escape"&&u.gridEnabled?(n.preventDefault(),Ml(),!0):!1}function ef(n=!u.gridEnabled){u.gridEnabled=n,n&&Zr(!0),yo(),Ke(),u.layers.pins.changed(),u.layers.text.changed(),u.layers.priority.changed()}function Zr(n){u.subgridVisible=n,u.layers.grid.changed(),u.layers.gridContext.changed(),w.subgridToggle.setAttribute("aria-pressed",String(n)),w.subgridToggle.setAttribute("aria-label",n?"Hide the subgrid":"Show the subgrid"),nf()}function nf(){if(!u.gridEnabled){w.gridHint.textContent="G \xB7 grid off";return}w.gridHint.textContent=`G-${u.gridPrefix||"root"}`+(u.subgridVisible?"":" no subgrid")}function Br(n){let t=yn(),e=[...n.toLocaleLowerCase()].filter(r=>ae.includes(r)).slice(0,t).join(""),i=e!==u.gridPrefix;u.gridPrefix=e,u.gridEnabled||(u.gridEnabled=!0),yo(),Ke(),u.layers.pins.changed(),u.layers.text.changed(),u.layers.priority.changed(),i&&(Te(),u.engine.getView().fit(er(),{size:u.engine.getSize(),padding:[52,52,52,52],maxZoom:Ze(u.variant),duration:180}))}function Ml(){if(u.gridEnabled){if(!u.gridPrefix){ef(!1);return}Br(u.gridPrefix.slice(0,-1))}}function yo(){if(!u.sources||(u.sources.grid.clear(),u.sources.gridContext.clear(),w.gridNavigator.hidden=!u.gridEnabled,nf(),!u.gridEnabled||!u.variant))return;let n=yn();if(w.gridInput.maxLength=n,w.gridInput.value=u.gridPrefix,w.gridBack.title=u.gridPrefix?"Back one geohash level":"Close geohash grid",Zp(),u.gridPrefix.length>=n){_o(u.gridPrefix,er(),"leaf");return}u.gridPrefix&&_o(u.gridPrefix,er(),"scope");for(let t of ae){let e=u.gridPrefix+t;_o(e,Pl(e),"child")}}function Zp(){for(let n=0;n<u.gridPrefix.length;n++){let t=u.gridPrefix.slice(0,n),e=u.gridPrefix.slice(0,n+1);for(let i of ae){let r=t+i;r!==e&&_o(r,Pl(r),"neighbor",u.gridPrefix.length-n)}}}function _o(n,t,e,i=0){let[r,s,o,a]=t,l=u.pins.filter(d=>{if(d.filteredHidden)return!1;let[f,g]=d.coordinate;return f>=r&&f<=o&&g>=s&&g<=a}).length,h=new Ni({geometry:new Ye([[[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+ae.indexOf(n[n.length-1]):ae.indexOf(n[n.length-1])});(e==="neighbor"?u.sources.gridContext:u.sources.grid).addFeature(h)}function er(){return Pl(u.gridPrefix)}function Pl(n){let t=[...Qd()],e=!0;for(let i of n){let r=ae.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 yn(){return 3}function rf(n,t=yn()){let e=[...Qd()],[i,r]=n;if(i<e[0]||i>e[2]||r<e[1]||r>e[3])return"";let s=!0,o="";for(let a=0;a<t;a++){let l=0;for(let h of[16,8,4,2,1]){if(s){let c=(e[0]+e[2])/2;i>=c?(l|=h,e[0]=c):e[2]=c}else{let c=(e[1]+e[3])/2;r>=c?(l|=h,e[1]=c):e[3]=c}s=!s}o+=ae[l]}return o}function ir(n){if(!u.gridEnabled||!u.gridPrefix)return!1;let t=er(),[e,i]=n.coordinate;return e>=t[0]&&e<=t[2]&&i>=t[1]&&i<=t[3]}function Vr(){return fu[u.map?.iconOutset==="dark"?"dark":"light"]}function Bp(n){let t=u.map?.iconOutset==="dark",e=jp(n);return(t?e>.3:e<.88)?n:Vp(n,t?.74:.42)}function Vp(n,t){let e=String(n).replace("#","");if(e.length!==6)return n;let[i,r,s]=[0,2,4].map(v=>parseInt(e.slice(v,v+2),16)/255),o=Math.max(i,r,s),a=Math.min(i,r,s),l=(o+a)/2,h=0,c=o-a,d=c===0?0:c/(1-Math.abs(2*l-1));c!==0&&(o===i?h=(r-s)/c%6:o===r?h=(s-i)/c+2:h=(i-r)/c+4,h*=60,h<0&&(h+=360));let f=(1-Math.abs(2*t-1))*d,g=f*(1-Math.abs(h/60%2-1)),m=t-f/2,[_,p,y]=h<60?[f,g,0]:h<120?[g,f,0]:h<180?[0,f,g]:h<240?[0,g,f]:h<300?[g,0,f]:[f,0,g],E=v=>Math.round((v+m)*255).toString(16).padStart(2,"0");return`#${E(_)}${E(p)}${E(y)}`}function jp(n){let t=String(n).replace("#","");if(t.length!==6)return .5;let e=i=>parseInt(t.slice(i,i+2),16)/255;return .2126*e(0)+.7152*e(2)+.0722*e(4)}function xo(n){let t=Math.abs(Number(n)||0);return Pn[(Math.imul(t,2654435761)>>>0)%Pn.length]}function fi(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 nr(n,t){n.style.setProperty("--pin-color",jr(t))}function jr(n){return Bp(n.color||xo(n.id))}function rr(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("${Ol(t.iconAsset)}")`),n.classList.add("has-source-icon")}function Ol(n){let t=n.split("/").map(e=>encodeURIComponent(e)).join("/");return`${u.game.base}/icons/${t}`}function Gi(n){return n.split(/\s+/).slice(0,2).map(t=>t[0]||"").join("")}function sf(n){return Math.imul(Number(n)||0,2654435761)>>>0}function of(n){return String(n||"").replace(/\[([^\]]+)\]\([^)]+\)/g,"$1").replace(/[*_`>#]/g,"").replace(/\r/g,"").replace(/\n{3,}/g,`3-4-`).trim()}function Ie(n){return new Intl.NumberFormat().format(n)}function be(n,t,e){return Math.min(e,Math.max(t,n))}function Eo(n){return n instanceof HTMLElement&&(n.matches("input, textarea, select")||n.isContentEditable)}var Hp=100;function Xi(){if(!w.searchResults)return;let n=u.pins.filter(i=>!i.filteredHidden).sort((i,r)=>i.location.title.localeCompare(r.location.title)),t=n.slice(0,Hp),e=document.createDocumentFragment();if(!t.length){let i=document.createElement("p");i.className="search-empty",i.textContent=u.search?"No visible locations match.":"Nothing is enabled. Show a category to list its locations.",e.append(i)}for(let i of t){let r=document.createElement("button");r.type="button",r.className="search-result",u.selectedPin===i&&r.classList.add("is-selected"),r.dataset.location=String(i.location.id),nr(r,i.category);let s=document.createElement("span");s.className="result-dot",rr(s,i.category,Gi(i.category.title));let o=document.createElement("span"),a=document.createElement("strong");a.textContent=i.location.title;let l=document.createElement("small");l.textContent=`${i.category.title} \xB7 ${i.group.title}`,o.append(a,l),r.append(s,o),e.append(r)}if(n.length>t.length){let i=document.createElement("p");i.className="dock-note",i.textContent=`First ${t.length} of ${Ie(n.length)} \u2014 search or filter to narrow the list.`,e.append(i)}w.searchResults.replaceChildren(e),$p(n.length),qp()}var af=28;function qp(){let n=u.selectedPin?.location.title||"",t=n.length>af?`${n.slice(0,af-1).trimEnd()}\u2026`:n;w.dockRailName.textContent=t?` \xB7 ${t}`:"",w.dockRailName.hidden=!t}function $p(n){w.dockCount.textContent=`${Ie(n)} ${n===1?"location":"locations"}`,u.search?(w.dockFlag.textContent=`\u201C${u.search}\u201D`,w.dockFlag.hidden=!1):u.hiddenCategories.size>0?(w.dockFlag.textContent="filtered",w.dockFlag.hidden=!1):w.dockFlag.hidden=!0}function wo(){!u.dockFolded||u.dockDismissed||Co(!1)}function Dl(n){u.dockDismissed=n,Co(n)}function Co(n,t=!0){u.dockFolded=n,w.dock.classList.toggle("is-folded",n),w.dockFold.setAttribute("aria-expanded",String(!n));let e=n?"Bring the panel back (\u2318\u2325B)":"Put the panel away (\u2318\u2325B)";w.dockFold.setAttribute("aria-label",e),w.dockFold.setAttribute("title",e),t&&Re()}function kl(n){u.hiddenCategories.delete(n.category.id),Hr(),ue(),Wi(),Fl(n,!0)}function Fl(n,t=!1){u.selectedPin=n,Ke(),u.layers.pins.changed(),u.layers.pinLabels.changed(),u.layers.text.changed(),u.layers.textDetail.changed(),u.layers.priority.changed(),w.detailTitle.textContent=n.location.title,w.detailCategory.textContent=`${n.group.title} / ${n.category.title}`,w.detailDescription.textContent="",w.detailLinks.hidden=!0,Qp(n),w.detailID.textContent=String(n.location.id),w.detailCoordinates.textContent=`${n.location.lat.toFixed(6)}, ${n.location.lng.toFixed(6)}`;let e=rf(n.coordinate);w.detailCell.textContent=e,w.detailCellField.hidden=!e;let i=Jp(n);if(w.detailSource.textContent=i,w.detailSourceField.hidden=!i,nr(w.detailDot,n.category),rr(w.detailDot,n.category,Gi(n.category.title)),w.detail.hidden=!1,wo(),Xi(),t){let r=u.engine.getView();r.animate({center:n.coordinate,zoom:Math.min(Ze(u.variant),Math.max(r.getZoom()||0,4)),duration:220})}}function Jp(n){let t=u.map?.merged;if(!t?.length)return"";let e=t.find(i=>i.origin)?.source||"";if(u.pinSourceIndex?.map!==u.map){let i=new Map;for(let r of t){for(let s of r.adopted||[])i.set(s.d,r.source);for(let s of r.matched||[]){let o=`confirmed by ${r.source}`;i.set(s.w,e?`${e} \xB7 ${o}`:o)}}u.pinSourceIndex={map:u.map,byID:i}}for(let i of t)if(!i.origin&&n.group.title===i.source)return i.source;return u.pinSourceIndex.byID.get(n.location.id)||e}async function Qp(n){let t=await lf();if(u.selectedPin!==n)return;let e=t[String(n.location.id)]||{};n.location.description=e.d||"",n.location.links=e.l||[],w.detailDescription.textContent=of(e.d)||"No description is included in the archive.",t_(n)}function t_(n){let t=(n.location.links||[]).filter(i=>u.pinByID.has(i.locationId));if(w.detailLinks.hidden=t.length===0,!t.length){w.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)}w.detailLinks.replaceChildren(e)}function Te(){let n=u.selectedPin!==null;u.selectedPin=null,u.sources&&(Ke(),u.layers.pins.changed(),u.layers.pinLabels.changed(),u.layers.text.changed(),u.layers.textDetail.changed(),u.layers.priority.changed()),w.detail.hidden=!0,n&&Xi()}function Be(n){let t=n.attrs?.["atlas.render.as"];return t||(n.displayType==="text"?"text":"pin")}var So=[NaN,NaN,NaN,0],Nl;function e_(){return Nl||(Nl=nt(1,1,void 0,{willReadFrequently:!0,desynchronized:!0})),Nl}var i_=/^rgba?\(\s*(\d+%?)\s+(\d+%?)\s+(\d+%?)(?:\s*\/\s*(\d+%|\d*\.\d+|[01]))?\s*\)$/i,n_=/^rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)(?:\s*,\s*(\d+%|\d*\.\d+|[01]))?\s*\)$/i,r_=/^rgba?\(\s*(\d+%)\s*,\s*(\d+%)\s*,\s*(\d+%)(?:\s*,\s*(\d+%|\d*\.\d+|[01]))?\s*\)$/i,s_=/^#([\da-f]{3,4}|[\da-f]{6}|[\da-f]{8})$/i;function vo(n,t){return n.endsWith("%")?Number(n.substring(0,n.length-1))/t:Number(n)}function $r(n){throw new Error('failed to parse "'+n+'" as color')}function cf(n){if(n.toLowerCase().startsWith("rgb")){let s=n.match(n_)||n.match(i_)||n.match(r_);if(s){let o=s[4],a=100/255;return[et(vo(s[1],a)+.5|0,0,255),et(vo(s[2],a)+.5|0,0,255),et(vo(s[3],a)+.5|0,0,255),o!==void 0?et(vo(o,100),0,1):1]}$r(n)}if(n.startsWith("#")){if(s_.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}$r(n)}let t=e_();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&&$r(n));let i=t.fillStyle;if(i.startsWith("#")||i.startsWith("rgba"))return cf(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]=ln(r[3]/255,3),r}function hf(n){return typeof n=="string"?n:Qr(n)}var o_=1024,qr={},zl=0;function uf(n){if(n.length===4)return n;let t=n.slice();return t[3]=1,t}function Gl(n){return n>.0031308?Math.pow(n,1/2.4)*269.025-14.025:n*3294.6}function Xl(n){return n>.2068965?Math.pow(n,3):(n-4/29)*(108/841)}function Wl(n){return n>10.314724?Math.pow((n+14.025)/269.025,2.4):n/3294.6}function Ul(n){return n>.0088564?Math.pow(n,1/3):n/(108/841)+4/29}function Yl(n){let t=Wl(n[0]),e=Wl(n[1]),i=Wl(n[2]),r=Ul(t*.222488403+e*.716873169+i*.06060791),s=500*(Ul(t*.452247074+e*.399439023+i*.148375274)-r),o=200*(r-Ul(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 df(n){let t=(n[0]+16)/116,e=n[1],i=n[2]*Math.PI/180,r=Xl(t),s=Xl(t+e/500*Math.cos(i)),o=Xl(t-e/200*Math.sin(i)),a=Gl(s*3.021973625-r*1.617392459-o*.404875592),l=Gl(s*-.943766287+r*1.916279586+o*.027607165),h=Gl(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 Jr(n){if(n==="none")return So;if(qr.hasOwnProperty(n))return qr[n];if(zl>=o_){let e=0;for(let i in qr)(e++&3)===0&&(delete qr[i],--zl)}let t=cf(n);t.length!==4&&$r(n);for(let e of t)isNaN(e)&&$r(n);return qr[n]=t,++zl,t}function de(n){return Array.isArray(n)?n:Jr(n)}function Qr(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+")"}var Zl=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=Kl(t,e);return i in this.cache_?this.cache_[i]:null}getPattern(t,e){let i=Kl(t,e);return i in this.patternCache_?this.patternCache_[i]:null}set(t,e,i,r){let s=Kl(t,e),o=s in this.cache_;this.cache_[s]=i,r&&(i.getImageState()===U.IDLE&&i.load(),i.getImageState()===U.LOADING?i.ready().then(()=>{this.patternCache_[s]=Gr().createPattern(i.getImage(1),"repeat")}):this.patternCache_[s]=Gr().createPattern(i.getImage(1),"repeat")),o||++this.cacheSize_}setSize(t){this.maxCacheSize_=t,this.expire()}};function Kl(n,t){let e=t?de(t):"null";return n+":"+e}var Xt=new Zl;var ts=null,Ro=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?U.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_===U.LOADED){ts||(ts=nt(1,1,void 0,{willReadFrequently:!0})),ts.drawImage(this.image_,0,0);try{ts.getImageData(0,0,1,1),this.tainted_=!1}catch{ts=null,this.tainted_=!0}}return this.tainted_===!0}dispatchChangeEvent_(){this.dispatchEvent(P.CHANGE)}handleImageError_(){this.imageState_=U.ERROR,this.dispatchChangeEvent_()}handleImageLoad_(){this.imageState_=U.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_===U.IDLE){this.image_||this.initializeImage_(),this.imageState_=U.LOADING;try{this.src_!==void 0&&(this.image_.src=this.src_)}catch{this.handleImageError_()}this.image_ instanceof HTMLImageElement&&dd(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_!==U.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=hf(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_===U.LOADED||this.imageState_===U.ERROR)t();else{let e=()=>{(this.imageState_===U.LOADED||this.imageState_===U.ERROR)&&(this.removeEventListener(P.CHANGE,e),t())};this.addEventListener(P.CHANGE,e)}})),this.ready_}};function Ui(n,t,e,i,r,s){let o=t===void 0?void 0:Xt.get(t,r);return o||(o=new Ro(n,n&&"src"in n?n.src||void 0:t,e,i,r),Xt.set(t,r,o,s)),s&&o&&!Xt.getPattern(t,r)&&Xt.set(t,r,o,s),o}var ff=Ro;function Ht(n){return n?Array.isArray(n)?Qr(n):typeof n=="object"&&"src"in n?a_(n):n:null}function a_(n){if(!n.offset||!n.size)return Xt.getPattern(n.src,n.color);let t=n.src+":"+n.offset,e=Xt.getPattern(t,n.color);if(e)return e;let i=Xt.get(n.src,null);if(i.getImageState()!==U.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]),Ui(r.canvas,t,void 0,U.LOADED,n.color,!0),Xt.getPattern(t,n.color)}var es="ol-hidden";var Yi="ol-unselectable";var sr="ol-control",Bl="ol-collapsed",l_=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"),gf=["style","variant","weight","size","lineHeight","family"],To={normal:400,bold:700},Io=function(n){let t=n.match(l_);if(!t)return null;let e={lineHeight:"normal",size:"1.2em",style:"normal",weight:"400",variant:"normal"};for(let i=0,r=gf.length;i<r;++i){let s=t[i+1];s!==void 0&&(e[gf[i]]=typeof s=="string"?s.trim():s)}return isNaN(Number(e.weight))&&e.weight in To&&(e.weight=To[e.weight]),e.families=e.family.split(/,\s?/).map(i=>i.trim().replace(/^['"]|['"]$/g,"")),e};var bo="10px sans-serif",Tt="#000",Ve="round",qt=[],$t=0,je="round",gi=10,pf=0,Wt="#000",Ki="center",En="middle",mi=[0,0,0,0],pi=1,xn=new wt,is=null,mf,Vl={},c_=new Set(["serif","sans-serif","monospace","cursive","fantasy","system-ui","ui-serif","ui-sans-serif","ui-monospace","ui-rounded","emoji","math","fangsong"]);function h_(n,t,e){return`${n} ${t} 16px "${e}"`}var _f=(function(){let t,e;async function i(s){await e.ready;let o=Io(s),a=o.families[0].toLowerCase(),l=o.weight,h=[];return e.forEach(d=>{let f=d.family.replace(/^['"]|['"]$/g,"").toLowerCase(),g=To[d.weight]||d.weight;f===a&&d.style===o.style&&g==l&&h.push(d)}),h.length===0?!1:(await Promise.all(h.map(d=>d.load().then(()=>!0,()=>!1)))).some(d=>d)}async function r(){await e.ready;let s=!0,o=xn.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)?(Xe(Vl),xn.set(h,100)):(c+=10,xn.set(h,c,!0),c<100&&(s=!1)))}t=void 0,s||(t=setTimeout(r,100))}return async function(s){e||(e=Rt?self.fonts:document.fonts);let o=Io(s);if(!o)return;let a=o.families,l=!1;for(let h of a){if(c_.has(h))continue;let c=h_(o.style,o.weight,h);xn.get(c)===void 0&&(xn.set(c,0,!0),l=!0)}l&&(clearTimeout(t),t=setTimeout(r,100))}})(),u_=(function(){let n;return function(t){let e=Vl[t];if(e==null){if(Rt){let i=Io(t),r=yf(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);Vl[t]=e}return e}})();function yf(n,t){return is||(is=nt(1,1)),n!=mf&&(is.font=n,mf=is.font),is.measureText(t)}function xf(n,t){return yf(n,t).width}function jl(n,t,e){if(t in e)return e[t];let i=t.split(`5-`).reduce((r,s)=>Math.max(r,xf(n,s)),0);return e[t]=i,i}function Ef(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 d=t[h];if(d===`6-`||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=xf(f,d);e.push(g),o+=g;let m=u_(f);i.push(m),l=Math.max(l,m)}return{width:s,height:a,widths:e,heights:i,lineWidths:r}}function wf(n,t,e,i,r,s,o,a,l,h,c){n.save(),e!==1&&(n.globalAlpha===void 0?n.globalAlpha=d=>d.globalAlpha*=e:n.globalAlpha*=e),t&&n.transform.apply(n,t),i.contextInstructions?(n.translate(l,h),n.scale(c[0],c[1]),d_(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 d_(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 Hl=class n{constructor(t){this.opacity_=t.opacity,this.rotateWithView_=t.rotateWithView,this.rotation_=t.rotation,this.scale_=t.scale,this.scaleArray_=mt(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_=mt(t)}listenImageChange(t){H()}load(){H()}unlistenImageChange(t){H()}ready(){return Promise.resolve()}},Lo=Hl;var ql=class n extends Lo{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()?U.LOADING:U.LOADED,this.imageState_===U.LOADING&&this.ready().then(()=>this.imageState_=U.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=Xt.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 ff(r,void 0,null,U.LOADED,null);Xt.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 T=r;r=s,s=T}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,d=Math.sqrt(l*l+c*c),f=d/l;if(t==="miter"&&f<=i)return f*e;let g=e/2/f,m=e/2*(c/d),p=Math.sqrt((r+g)*(r+g)+m*m)-r;if(this.radius2_===void 0||t==="bevel")return p*2;let y=r*Math.sin(a),E=Math.sqrt(r*r-y*y),v=s-E,C=Math.sqrt(y*y+v*v)/y;if(C<=i){let T=C*e/2-s-r;return 2*Math.max(p,T)}return p*2}createRenderOptions(){let t=Ve,e=je,i=0,r=null,s=0,o,a=0;this.stroke_&&(o=Ht(this.stroke_.getColor()??Wt),a=this.stroke_.getWidth()??pi,r=this.stroke_.getLineDash(),s=this.stroke_.getLineDashOffset()??0,e=this.stroke_.getLineJoin()??je,t=this.stroke_.getLineCap()??Ve,i=this.stroke_.getMiterLimit()??gi);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=Tt),e.fillStyle=Ht(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=de(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=Tt,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()}},Ao=ql;var $l=class n extends Ao{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}},Mo=$l;var Jl=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=Ui(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()===U.IDLE&&e.load(),e.getImageState()===U.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:de(t).toString():""}loading(){return!!this.patternImage_}ready(){return this.patternImage_?this.patternImage_.ready():Promise.resolve()}},pt=Jl;function Cf(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 Ql=class n extends Lo{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=U.IDLE:o!==void 0&&("complete"in o?o.complete?l=o.src?U.LOADED:U.IDLE:l=U.LOADING:l=U.LOADED),this.color_=t.color!==void 0?de(t.color):null,this.iconImage_=Ui(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 d=this.getImage(1);if(d.width&&d.height)h=d.width,c=d.height;else if(d instanceof HTMLImageElement){this.initialOptions_=t;let f=()=>{if(this.unlistenImageChange(f),!this.initialOptions_)return;let g=this.iconImage_.getSize();this.setScale(Cf(g[0],g[1],t.width,t.height))};this.listenImageChange(f);return}}h!==void 0&&this.setScale(Cf(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?de(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?U.IDLE:this.iconImage_.getImageState();this.iconImage_=Ui(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_=Ui(null,t,{crossOrigin:this.crossOrigin_,referrerPolicy:this.referrerPolicy_},U.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()==U.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()==U.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()}},wn=Ql;var tc=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}},Mt=tc;var Po=class n{constructor(t){t=t||{},this.geometry_=null,this.geometryFunction_=vf,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_=vf,this.geometry_=t}setZIndex(t){this.zIndex_=t}};function Sf(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 ec=null;function ic(n,t){if(!ec){let e=new pt({color:"rgba(255,255,255,0.4)"}),i=new Mt({color:"#3399CC",width:1.25});ec=[new Po({image:new Mo({fill:e,stroke:i,radius:5}),fill:e,stroke:i})]}return ec}function vf(n){return n.getGeometry()}var It=Po;var f_="#333",nc=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_=mt(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 pt({color:f_}),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 pt?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_=mt(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}},_i=nc;function fe(n,t){return(n.get("priority")||0)-(t.get("priority")||0)}function If(n){let t=n.get("pin");return!t||ge(t)||t.insideHighlightedZone||or(t)?null:rc(t,!1)}function bf(n){let t=n.get("pin");return!t||!u.highlightedZones.size||!t.insideHighlightedZone||ge(t)||or(t)?null:rc(t,!1)}function Lf(n){let t=n.get("pin");return!t||ge(t)||!u.labelsHeld?null:Df(t)}function Af(n){let t=n.get("pin");if(!t||ge(t)||t.insideHighlightedZone||or(t)||rs())return null;if(u.labelsHeld)return ns(t,!1);let e=u.fitZoom+Math.log2(Yf(t.category));return(u.engine.getView().getZoom()||0)<e?null:ns(t,!1)}function Mf(n){let t=n.get("pin");return!t||ge(t)||t.insideHighlightedZone||or(t)||!rs()?null:ns(t,!1)}function Pf(n){let t=n.get("pin");return!t||!u.highlightedZones.size||!t.insideHighlightedZone||ge(t)||or(t)?null:ns(t,!1)}function Of(n){let t=n.get("pin");if(!t||ge(t))return null;if(Be(t.category)==="text")return ns(t,t===u.selectedPin);let e=rc(t,t===u.selectedPin);return t===u.hoveredPin||t===u.selectedPin?[e,Df(t)]:e}function rc(n,t){let e=`marker:${n.category.id}:${t?1:0}`;if(u.styleCache.has(e))return u.styleCache.get(e);let i=jr(n.category),r=t?2e7:n.priority,s=u.markerIcons.get(Ff(n.category)),o;return s?o=new It({image:new wn({src:s,width:t?36:31,height:t?36:31}),zIndex:r}):o=new It({text:new _i({text:Gi(n.category.title),font:`900 ${t?15:13}px Inter, sans-serif`,fill:new pt({color:i}),stroke:new Mt({color:Vr(),width:t?4:3})}),zIndex:r}),u.styleCache.set(e,o),o}function Df(n){let t=`marker-label:${n.location.id}`;if(u.styleCache.has(t))return u.styleCache.get(t);let e=new It({text:new _i({text:n.location.title,offsetY:21,font:'700 10px "Arial Narrow", "Roboto Condensed", sans-serif',fill:new pt({color:"#f2ece0"}),stroke:new Mt({color:"rgba(0,0,0,0.98)",width:3}),backgroundFill:new pt({color:"rgba(10,12,17,0.72)"}),padding:[2,4,2,4],overflow:!0}),zIndex:n.priority});return u.styleCache.set(t,e),e}function kf(n){if(!n.iconAsset)return;let t=Ff(n);if(u.markerIcons.has(t))return;u.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=jr(n),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=Vr(),h.fillRect(0,0,64,64);for(let c=-3;c<=3;c++)for(let d=-3;d<=3;d++)d*d+c*c<=10&&r.drawImage(l,d,c);r.drawImage(o,0,0),u.markerIcons.set(t,i.toDataURL("image/png")),g_(),u.layers.pins.changed(),u.layers.zonePins.changed(),u.layers.priority.changed()},e.onerror=()=>u.markerIcons.set(t,!1),e.src=Ol(n.iconAsset)}function g_(){for(let n of u.styleCache.keys())n.startsWith("marker:")&&u.styleCache.delete(n)}function Ff(n){return`${n.iconAsset||""}:${jr(n)}:${u.map?.iconOutset||"light"}`}function ns(n,t){let e=`text:${n.location.id}:${t?1:0}`;if(u.styleCache.has(e))return u.styleCache.get(e);let r=[new It({text:new _i({text:n.location.title,font:`${t?"900":"800"} 14px "Arial Narrow", "Roboto Condensed", sans-serif`,fill:new pt({color:t?"#7fd0ea":"#f2ece0"}),stroke:new Mt({color:"rgba(0,0,0,0.95)",width:4}),backgroundFill:new pt({color:t?"rgba(13,16,23,0.9)":"rgba(10,12,17,0.58)"}),backgroundStroke:t?new Mt({color:"#3aa5c9",width:1}):void 0,padding:[3,6,3,6],overflow:!0}),zIndex:t?2e7:n.priority+3e6})];return u.styleCache.set(e,r),r}function sc(n,t){let e=n.get("gridCell");if(!e)return null;let i=e.role==="leaf",r=e.role==="scope",s=e.role==="neighbor",o=i||r?15:s?10:11,l=`${i||r?900:s?750:800} ${o}px ui-monospace, SFMono-Regular, Menlo, monospace`,h=s?[2,4,2,4]:[3,5,3,5],c=m_(e,l,o,h,t);if(e.role==="child"&&(!c||!u.subgridVisible))return null;let d=r&&u.subgridVisible,f=`grid:${e.hash}:${e.role}:${e.contextDistance}:${c?1:0}:${d?1:0}`;if(u.styleCache.has(f))return u.styleCache.get(f);let g=Pn[Math.max(0,ae.indexOf(e.hash[e.hash.length-1]))%Pn.length],m=new It({fill:r?void 0:new pt({color:s?`rgba(5, 8, 16, ${Math.min(.52,.3+e.contextDistance*.06)})`:fi(g,i?.14:.055)}),stroke:new Mt({color:i||r?"#ffffff":fi(g,s?.44:.82),width:i?2.5:r?d?1.8:2.5:s?1:1.4}),text:c&&!d?new _i({text:e.hash,font:l,fill:new pt({color:i||r?"#ffffff":s?fi(g,.72):g}),stroke:new Mt({color:"rgba(0,0,0,0.96)",width:4}),backgroundFill:new pt({color:s?"rgba(8,11,18,0.88)":"rgba(12,15,22,0.76)"}),padding:h,overflow:!0}):void 0,zIndex:i||r?100:n.get("priority")});return u.styleCache.set(f,m),m}function m_(n,t,e,i,r){if(!r)return!0;let s=p_(n.hash,t)+i[1]+i[3],o=e+i[0]+i[2];return s<=(n.extent[2]-n.extent[0])/r&&o<=(n.extent[3]-n.extent[1])/r}var Rf=document.createElement("canvas").getContext("2d"),Tf=new Map;function p_(n,t){let e=`${t}|${n}`,i=Tf.get(e);return i===void 0&&(Rf.font=t,i=Rf.measureText(n).width,Tf.set(e,i)),i}var __=new It({fill:new pt({color:"rgba(5, 8, 16, 0.62)"})});function Nf(){return u.zonesVisible?__:null}function zf(n){if(!u.zonesVisible)return null;let t=n.get("zone"),e=n.get("child"),i=u.highlightedZones.has(t.id),r=Uf(t.id),s=`zone:${t.id}:${e?1:0}:${i?1:r?2:0}`;if(u.styleCache.has(s))return u.styleCache.get(s);let o=n.get("color");if(r){let h=new It({stroke:new Mt({color:fi(o,e?.34:.44),width:e?1:1.3,lineDash:e?[3,4]:[7,5]}),zIndex:e?101:100});return u.styleCache.set(s,h),h}let a=new It({fill:new pt({color:fi(o,e?.035:.07)}),stroke:new Mt({color:fi(o,e?.5:.72),width:e?1.2:1.8,lineDash:e?[3,4]:[7,5]})});if(!i)return u.styleCache.set(s,a),a;let l=[new It({stroke:new Mt({color:"rgba(255,255,255,0.94)",width:5}),zIndex:9e3}),new It({fill:new pt({color:fi(o,.22)}),stroke:new Mt({color:o,width:2.6}),zIndex:9001})];return u.styleCache.set(s,l),l}function Gf(n){if(!u.zonesVisible||rs())return null;let t=n.get("child"),e=u.highlightedZones.has(n.get("zone").id),i=u.engine.getView().getZoom()||0;if(!e&&t&&i<u.fitZoom+3)return null;let r=n.get("span")/u.engine.getView().getResolution();return!e&&u.zoneTitleCount>40&&r<52?null:Wf(n)}function Xf(n){return!u.zonesVisible||!rs()?null:Wf(n)}function Wf(n){let t=n.get("child"),e=n.get("zone"),i=u.highlightedZones.has(e.id),r=Uf(e.id),s=`zone-title:${e.id}:${t?1:0}:${i?1:r?2:0}`;if(u.styleCache.has(s))return u.styleCache.get(s);let o=n.get("color"),a=new It({text:new _i({text:e.title.toLocaleUpperCase(),font:`${t?"700 12px":"800 14px"} "Arial Narrow", "Roboto Condensed", sans-serif`,fill:new pt({color:i?"#10131a":r?"rgba(196,191,177,0.56)":t?"#c8c2b4":"#f2ece0"}),stroke:new Mt({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 pt({color:i?o:r?"rgba(8,11,18,0.84)":"rgba(13,16,23,0.72)"}),backgroundStroke:new Mt({color:i?"#ffffff":fi(o,r?.24:.55),width:i?2:1}),padding:[5,8,5,8],overflow:!0}),zIndex:i?91e5:n.get("priority")});return u.styleCache.set(s,a),a}function Uf(n){if(!u.highlightedZones.size||u.highlightedZones.has(n))return!1;for(let t of u.highlightedZones)if(y_(n,t))return!1;return!0}function y_(n,t){let e=new Set,i=u.zoneRecords.get(t)?.zone.parentRegionId;for(;i!=null&&!e.has(i);){if(i===n)return!0;e.add(i),i=u.zoneRecords.get(i)?.zone.parentRegionId}return!1}var oc=class n extends We{constructor(t,e){super(),e&&!Array.isArray(t[0])?this.setFlatCoordinates(e,t):this.setCoordinates(t,e)}appendPoint(t){ve(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<Li(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=_e(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 Ue(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getPoint(t){let e=this.flatCoordinates.length/this.stride;return t<0||e<=t?null:new ui(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 ui(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(Ar(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()}},Kf=oc;function Oo(n,t,e,i){let r=[],s=ut();for(let o=0,a=e.length;o<a;++o){let l=e[o];s=Dn(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 ac=class n extends We{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,d=h.getEnds();for(let f=0,g=d.length;f<g;++f)d[f]+=c;ve(s,h.getFlatCoordinates()),o.push(d)}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;ve(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<Li(this.getExtent(),t,e)?r:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(Bd(this.flatCoordinates,0,this.endss_,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),Vd(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,this.maxDelta_,!0,t,e,i,r))}containsXY(t,e){return Qu(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,t,e)}getArea(){return Kd(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride)}getCoordinates(t){let e;return t!==void 0?(e=this.getOrientedFlatCoordinates().slice(),Ll(e,0,this.endss_,this.stride,t)):e=this.flatCoordinates,Wr(e,0,this.endss_,this.stride)}getEndss(){return this.endss_}getFlatInteriorPoints(){if(this.flatInteriorPointsRevision_!=this.getRevision()){let t=Oo(this.flatCoordinates,0,this.endss_,this.stride);this.flatInteriorPoints_=go(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,t),this.flatInteriorPointsRevision_=this.getRevision()}return this.flatInteriorPoints_}getInteriorPoints(){return new Kf(this.getFlatInteriorPoints().slice(),"XYM")}getOrientedFlatCoordinates(){if(this.orientedRevision_!=this.getRevision()){let t=this.flatCoordinates;$d(t,0,this.endss_,this.stride)?this.orientedFlatCoordinates_=t:(this.orientedFlatCoordinates_=t.slice(),this.orientedFlatCoordinates_.length=Ll(this.orientedFlatCoordinates_,0,this.endss_,this.stride)),this.orientedRevision_=this.getRevision()}return this.orientedFlatCoordinates_}getSimplifiedGeometryInternal(t){let e=[],i=[];return e.length=Hd(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 Ye(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 d=0,f=l.length;d<f;++d)l[d]-=s;let c=new Ye(e.slice(s,h),t,l);r.push(c),s=h}return r}getType(){return"MultiPolygon"}intersectsExtent(t){return ed(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,t)}setCoordinates(t,e){this.setLayout(e,t,3),this.flatCoordinates||(this.flatCoordinates=[]);let i=Yd(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()}},Zf=ac;function lc(){let n=(u.map.zones||[]).filter(uc);u.renderedShard=u.variant?.shard||0,u.sources.zones.clear(),u.sources.zoneTitles.clear(),u.zoneRecords.clear(),u.highlightedZones.clear(),u.focusedZoneID=null,u.zoneTitleCount=0,Do(!0),w.zoneIndex.hidden=n.length===0,w.zoneCount.textContent=Ie(n.length);for(let t of n){let e=ut(),i=[],r=!1;for(let l of t.features||[]){let h=w_(l);h&&(r=!0,i.push(h),ks(e,h.getExtent()),u.sources.zones.addFeature(new Ni({geometry:h,zone:t,color:xo(t.id),child:t.parentRegionId!=null})))}if(!r)continue;let s=xo(t.id),o=t.center?ko(t.center.lat,t.center.lng):Bt(e),a=Math.max(e[2]-e[0],e[3]-e[1]);u.sources.zoneTitles.addFeature(new Ni({geometry:new ui(o),zone:t,color:s,child:t.parentRegionId!=null,span:a,priority:(t.parentRegionId==null?2e6:1e6)+Math.round(a)})),u.zoneRecords.set(t.id,{zone:t,extent:e.slice(),geometries:i,color:s})}u.zoneTitleCount=u.sources.zoneTitles.getFeatures().length,Vf(),x_()}function Vf(){if(u.sources.zoneScrim.clear(),!u.highlightedZones.size)return;let[n,t,e,i]=u.projection.getExtent(),r=[Bf([[n,t],[e,t],[e,i],[n,i],[n,t]],!0)];for(let s of u.highlightedZones)for(let o of u.zoneRecords.get(s)?.geometries||[]){let a=o.getType()==="MultiPolygon"?o.getPolygons():[o];for(let l of a)l.getLinearRings().forEach((h,c)=>{r.push(Bf(h.getCoordinates(),c>0))})}u.sources.zoneScrim.addFeature(new Ni({geometry:new Ye(r)}))}function Bf(n,t){let e=0;for(let i=0,r=n.length-1;i<n.length;r=i++)e+=n[r][0]*n[i][1]-n[i][0]*n[r][1];return e<0===t?n:n.slice().reverse()}function x_(){let n=document.createDocumentFragment();for(let{zone:t,depth:e}of E_()){let i=u.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)}w.zoneList.replaceChildren(n),w.zoneIndex.hidden=u.zoneRecords.size===0}function E_(){let n=[...u.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 Do(n){u.zonesVisible=n,w.zoneToggle.checked=n,u.layers.zoneScrim.setVisible(n),u.layers.zones.setVisible(n),u.layers.zoneTitles.setVisible(n),u.layers.zoneTitleDetail.setVisible(n)}function jf(n){let t=u.zoneRecords.get(n);t&&(u.focusedZoneID=n,qf(),Te(),u.engine.getView().fit(t.extent,{size:u.engine.getSize(),padding:[54,54,54,54],maxZoom:Ze(u.variant),duration:220}),w.sidebar.classList.remove("is-open"),w.mobileLegend.setAttribute("aria-expanded","false"))}function Hf(n){u.zoneRecords.has(n)&&(u.highlightedZones.has(n)?u.highlightedZones.delete(n):(u.highlightedZones.add(n),Do(!0)),u.hoveredPin=null,cc(),hc(),qf(),Vf(),u.layers.zones.changed(),u.layers.zoneTitles.changed(),u.layers.zoneTitleDetail.changed())}function qf(){w.zoneIndex.classList.toggle("has-highlights",u.highlightedZones.size>0);for(let n of w.zoneList.querySelectorAll("[data-zone]")){let t=Number(n.dataset.zone),e=u.highlightedZones.has(t);n.classList.toggle("is-highlighted",e),n.classList.toggle("is-current",u.focusedZoneID===t),n.setAttribute("aria-pressed",String(e))}}function w_(n){if(!n?.coordinates)return null;let t=([e,i])=>ko(i,e);return n.type==="Polygon"?new Ye(n.coordinates.map(e=>e.map(t))):n.type==="MultiPolygon"?new Zf(n.coordinates.map(e=>e.map(i=>i.map(t)))):null}function ko(n,t){let e=C_(),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 C_(){let n=u.game.tileGrid,t=u.map?.grid;return t?{...n,...t}:n}function $f(){u.sources.pins.clear(),u.sources.text.clear(),u.sources.priority.clear(),u.pins=[],u.pinByID.clear();for(let n of u.map.groups)for(let t of n.categories){Be(t)!=="text"&&kf(t);for(let e of t.locations){let i={location:e,category:t,group:n,coordinate:ko(e.lat,e.lng),filteredHidden:!1,priority:T_(t,e),feature:null};i.feature=new Ni({geometry:new ui(i.coordinate),pin:i,priority:i.priority}),u.pins.push(i),u.pinByID.set(e.id,i),Be(t)==="text"?u.sources.text.addFeature(i.feature):u.sources.pins.addFeature(i.feature)}}ue()}function ue(){for(let n of u.pins){let t=u.hiddenCategories.has(n.category.id),e=u.search&&!n.location.title.toLocaleLowerCase().includes(u.search);n.filteredHidden=!!(t||e)}cc(),hc(),u.selectedPin?.filteredHidden&&Te(),Xi()}function cc(){if(!u.highlightedZones.size){for(let t of u.pins)t.insideHighlightedZone=!1;return}let n=[...u.highlightedZones].map(t=>u.zoneRecords.get(t)).filter(Boolean);for(let t of u.pins)t.insideHighlightedZone=n.some(e=>e.geometries.some(i=>v_(i,t.coordinate)))}function v_(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 hc(){u.eligibleLocations=u.pins.filter(n=>!ge(n)).length,Ke(),u.layers.pins.changed(),u.layers.zonePins.changed(),u.layers.pinLabels.changed(),u.layers.text.changed(),u.layers.zoneText.changed(),u.layers.textDetail.changed(),u.layers.priority.changed(),Cn()}function Ke(){u.sources.priority.clear();for(let n of u.pins){if(ge(n))continue;let t=!!u.search&&n.location.title.toLocaleLowerCase().includes(u.search);(n===u.selectedPin||n===u.hoveredPin||t||ir(n))&&u.sources.priority.addFeature(n.feature)}}function ar(n){u.hoveredPin!==n&&(u.hoveredPin=n,u.sources&&(Ke(),u.layers.pins.changed(),u.layers.priority.changed()))}function Fo(n){u.labelsHeld!==n&&(u.labelsHeld=n,w.labelsHint.textContent=n?"Z \xB7 labels shown":"Z \xB7 hold for labels",u.layers.pinLabels.changed(),u.layers.text.changed())}function or(n){return n===u.selectedPin||n===u.hoveredPin||ir(n)||!!u.search&&n.location.title.toLocaleLowerCase().includes(u.search)}function ge(n){return n.filteredHidden||S_(n)||R_(n)||!uc(n.location)}function uc(n){let t=u.variant?.shard;return!t||!n.shard||n.shard===t}function S_(n){return!u.highlightedZones.size||n.insideHighlightedZone||n===u.selectedPin?!1:!(u.search&&n.location.title.toLocaleLowerCase().includes(u.search))}function R_(n){return!u.gridEnabled||!u.gridPrefix||ir(n)||n===u.selectedPin?!1:!(u.search&&n.location.title.toLocaleLowerCase().includes(u.search))}function T_(n,t){return Math.max(0,1e6-Math.min(n.locations.length,999)*1e3)+sf(t.id)%1e3}function Yf(n){return n.locations.length>200?4:n.locations.length>75?2.5:1}function rs(){return(u.engine?.getView().getZoom()||0)>=(u.variant?.maxZoom||0)-.05}function Jf(n){let t=[],e=[];for(let i of n){let r=[];for(let s of i.categories)(Be(s)==="text"?e:r).push(s);r.length&&t.push({key:`group-${i.id}`,title:i.title,categories:r})}return e.length&&t.unshift({key:"text",title:"Text",categories:e}),t}function Qf(){let n=document.createDocumentFragment();for(let t of u.map.sections){let e=document.createElement("section");e.className="layer-section",e.dataset.layerSection=t.key;let i=t.categories.reduce((s,o)=>s+o.locations.length,0);e.append(I_(t.key,t.title,i));let r=document.createElement("div");r.className="category-toggles";for(let s of t.categories)r.append(b_(s));e.append(r),n.append(e)}w.legend.replaceChildren(n),No(),Wi()}function I_(n,t,e){let i=document.createElement("div");i.className="layer-header";let r=document.createElement("button");r.type="button",r.className="layer-title",r.dataset.section=n;let s=document.createElement("span");s.className="layer-chevron",s.setAttribute("aria-hidden","true"),s.innerHTML='<svg viewBox="0 0 24 24"><path d="m9 6 6 6-6 6"/></svg>';let o=document.createElement("span");o.textContent=t;let a=document.createElement("span");a.className="layer-count",a.textContent=Ie(e),r.append(s,o,a);let l=tg(`Show only ${t}`);l.dataset.onlySection=n;let h=document.createElement("label");h.className="layer-switch";let c=document.createElement("input");c.type="checkbox",c.dataset.sectionToggle=n,c.setAttribute("aria-label",`Show ${t}`);let d=document.createElement("span");return d.setAttribute("aria-hidden","true"),h.append(c,d),i.append(r,l,h),i}function tg(n){let t=document.createElement("button");return t.type="button",t.className="only-button",t.dataset.label=n,t.setAttribute("aria-label",n),t.innerHTML='<svg viewBox="0 0 16 16" aria-hidden="true"><circle cx="8" cy="8" r="4.6"/><circle cx="8" cy="8" r="1.3" fill="currentColor" stroke="none"/><path d="M8 1v2M8 13v2M1 8h2M13 8h2"/></svg>',t}function b_(n){let t=Be(n)==="text",e=document.createElement("label");e.className="category-row",nr(e,n);let i=document.createElement("input");i.type="checkbox",i.dataset.category=String(n.id),i.checked=!u.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",rr(r,n,Gi(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=Ie(n.locations.length);let a=tg(`Show only ${n.title}`);return a.dataset.onlyCategory=String(n.id),e.append(i,r,s,a,o),e}function dc(n){if(u.collapsedSections.clear(),n)for(let t of w.layers.querySelectorAll("[data-section]"))u.collapsedSections.add(t.dataset.section);No()}function No(){for(let n of w.layers.querySelectorAll("[data-section]")){let t=u.collapsedSections.has(n.dataset.section);n.setAttribute("aria-expanded",String(!t)),n.closest(".layer-section").classList.toggle("is-collapsed",t)}Re()}function ss(n){if(u.hiddenCategories.clear(),!n)for(let t of u.map.groups)for(let e of t.categories)u.hiddenCategories.add(e.id);Hr(),ue(),Xi(),Wi()}function Hr(){for(let n of document.querySelectorAll("[data-category]"))n.checked=!u.hiddenCategories.has(Number(n.dataset.category))}function eg(n){let t=u.map.sections.find(i=>i.key===n);if(!t)return;let e=t.categories.some(i=>!u.hiddenCategories.has(i.id));for(let i of t.categories)e?u.hiddenCategories.add(i.id):u.hiddenCategories.delete(i.id);Hr(),ue(),Wi()}function ig(n){if(u.map){if(L_(n)){ss(!0);return}u.hiddenCategories.clear();for(let t of u.map.sections){let e=n.section===t.key;for(let i of t.categories)!e&&n.category!==i.id&&u.hiddenCategories.add(i.id)}Hr(),ue(),Xi(),Wi()}}function L_(n){for(let t of u.map.sections)for(let e of t.categories)if((n.section===t.key||n.category===e.id)===u.hiddenCategories.has(e.id))return!1;return!0}function A_(){let n=w.soloChip;if(!u.map){n.hidden=!0;return}let t=null,e=0,i=null,r=0;for(let o of u.map.sections){let a=0;for(let l of o.categories)u.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 Wi(){if(u.map){for(let n of u.map.sections){let t=w.legend.querySelector(`input[data-section-toggle="${n.key}"]`);t&&(t.checked=n.categories.some(e=>!u.hiddenCategories.has(e.id)))}A_(),Re()}}async function ng(n){let[t,e]=await Promise.all([fetch(`${u.game.base}/maps/${n.slug}.json`),fetch(`${u.game.base}/maps/${n.slug}.bin`)]);if(!t.ok||!e.ok)throw new Error(`map ${n.slug} is not served under this catalog any more`);let[i,r]=await Promise.all([t.json(),e.arrayBuffer()]),s=i.groups.flatMap(o=>o.categories);return M_(r,s),{...n,grid:i.grid,variants:i.variants,groups:i.groups,zones:i.zones||[],attrs:i.attrs||{},merged:i.merged||[],sections:Jf(i.groups)}}function M_(n,t){let e=new DataView(n);if(String.fromCharCode(...new Uint8Array(n,0,8))!=="ATLASLOC")throw new Error("location payload is not in the expected form");let r=e.getUint16(8,!0);if(r!==2)throw new Error(`location payload is version ${r}, and this reads 2`);let s=e.getUint32(10,!0),o=16,a=new Int32Array(n,o,s),l=new Float32Array(n,o+=s*4,s),h=new Float32Array(n,o+=s*4,s),c=new Int32Array(n,o+=s*4,s),d=new Int32Array(n,o+=s*4,s),f=new Uint32Array(n,o+=s*4,s+1),g=new Uint16Array(n,o+=(s+1)*4,s),m=new Uint8Array(n,o+s*2),_=new TextDecoder;for(let p of t)p.locations=[];for(let p=0;p<s;p++)t[g[p]].locations.push({id:a[p],title:_.decode(m.subarray(f[p],f[p+1])),lat:l[p],lng:h[p],regionId:c[p]||void 0,shard:d[p]||void 0})}async function lf(){let n=`${u.game.base}/${u.map.slug}`;return u.textByMap.has(n)||u.textByMap.set(n,fetch(`${u.game.base}/maps/${u.map.slug}.text`).then(t=>t.json()).catch(()=>({}))),u.textByMap.get(n)}var zo=null;function vn(){return zo||(zo=P_().finally(()=>{zo=null})),zo}async function P_(){let n=await fetch("/data/catalog.json");if(!n.ok)return;let t=u.game;if(u.catalog=await n.json(),rn(w.game,u.catalog.games,"title"),fc(),!u.catalog.games.length)return;let e=t&&u.catalog.games.find(i=>i.slug===t.slug);if(!e){let i=Qn();await yi(i.game||Jn()?.game||u.catalog.games[0].slug,i.game?i.map:void 0);return}if(e.stamp!==t.stamp){for(let r of u.textByMap.keys())r.startsWith(t.base+"/")&&u.textByMap.delete(r);let i=u.engine?.getView();u.restore={game:e.slug,map:u.map?.slug,variant:u.map?u.map.variants.indexOf(u.variant):0,center:i?.getCenter(),zoom:i?.getZoom(),hidden:[...u.hiddenCategories],collapsed:[...u.collapsedSections],overviewDocked:u.overviewDocked,dockFolded:u.dockFolded,dockDismissed:u.dockDismissed},await yi(e.slug,u.map?.slug);return}u.game=e,w.game.value=e.slug}function fc(){let n=!u.catalog?.games?.length;w.emptyState.hidden=!n,u.catalog?.bundlesDir&&(w.emptyPath.textContent=u.catalog.bundlesDir)}async function gc(){for(let n of[w.emptyOpen,w.addBundles])n.disabled=!0;try{let t=await(await fetch("/data/bundles/import",{method:"POST"})).json().catch(()=>({}));await vn();let e=t.imported?.[0];e&&u.catalog.games.some(i=>i.slug===e)&&await yi(e)}finally{for(let n of[w.emptyOpen,w.addBundles])n.disabled=!1}}var Pt={ADD:"add",REMOVE:"remove"};var rg={LENGTH:"length"},lr=class extends Lt{constructor(t,e,i){super(t),this.element=e,this.index=i}},mc=class extends wt{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(rg.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 lr(Pt.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 lr(Pt.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 lr(Pt.REMOVE,r,t)),this.dispatchEvent(new lr(Pt.ADD,e,t))}updateLength_(){this.set(rg.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")}},Dt=mc;var pc=class extends Lt{constructor(t,e,i){super(t),this.map=e,this.frameState=i!==void 0?i:null}},Zi=pc;var _c=class extends Zi{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()}},He=_c;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 os={POINTERMOVE:"pointermove",POINTERDOWN:"pointerdown",POINTERUP:"pointerup",POINTEROVER:"pointerover",POINTEROUT:"pointerout",POINTERENTER:"pointerenter",POINTERLEAVE:"pointerleave",POINTERCANCEL:"pointercancel"};var yc=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_=Z(i,os.POINTERDOWN,this.handlePointerDown_,this),this.originalPointerMoveEvent_,this.relayedListenerKey_=Z(i,os.POINTERMOVE,this.relayMoveEvent_,this),this.boundHandleTouchMove_=this.handleTouchMove_.bind(this),this.element_.addEventListener(P.TOUCHMOVE,this.boundHandleTouchMove_,eo?{passive:!1}:!1)}emulateClick_(t){let e=new He(at.CLICK,this.map_,t);this.dispatchEvent(e),this.clickTimeoutId_!==void 0?(clearTimeout(this.clickTimeoutId_),this.clickTimeoutId_=void 0,e=new He(at.DBLCLICK,this.map_,t),this.dispatchEvent(e)):this.clickTimeoutId_=setTimeout(()=>{this.clickTimeoutId_=void 0;let i=new He(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 He(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 He(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(Z(i,at.POINTERMOVE,this.handlePointerMove_,this),Z(i,at.POINTERUP,this.handlePointerUp_,this),Z(this.element_,at.POINTERCANCEL,this.handlePointerUp_,this)),this.element_.getRootNode&&this.element_.getRootNode()!==i&&this.dragListenerKeys_.push(Z(this.element_.getRootNode(),at.POINTERUP,this.handlePointerUp_,this))}}handlePointerMove_(t){if(this.isMoving_(t)){this.updateActivePointers_(t),this.dragging_=!0;let e=new He(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 He(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()}},sg=yc;var qe={POSTRENDER:"postrender",MOVESTART:"movestart",MOVEEND:"moveend",LOADSTART:"loadstart",LOADEND:"loadend"};var kt={LAYERGROUP:"layergroup",SIZE:"size",TARGET:"target",VIEW:"view"};var as=1/0,xc=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,Xe(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!=as?(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==as?delete this.queuedElements_[this.keyFunction_(o)]:(i[r]=l,e[r++]=o);e.length=r,i.length=r,this.heapify_()}},og=xc;var Ec=class extends og{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===D.LOADED||i===D.ERROR||i===D.EMPTY){i!==D.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()===D.IDLE&&!(s in this.tilesLoadingKeys_)&&(this.tilesLoadingKeys_[s]=!0,++this.tilesLoading_,++i,r.load())}}},ag=Ec;function lg(n,t,e,i,r){if(!n||!(e in n.wantedTiles))return as;if(!n.wantedTiles[e][t.getKey()])return as;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 bt={ANIMATING:0,INTERACTING:1};var me={CENTER:"center",RESOLUTION:"resolution",ROTATION:"rotation"};function wc(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,d=a?a[1]:0,f=n[0]+l/2+c,g=n[2]-l/2+c,m=n[1]+h/2+d,_=n[3]-h/2+d;f>g&&(f=(g+f)/2,g=f),m>_&&(m=(_+m)/2,_=m);let p=et(i[0],f,g),y=et(i[1],m,_);if(o&&e&&r){let E=30*r;p+=-E*Math.log(1+Math.max(0,f-i[0])/E)+E*Math.log(1+Math.max(0,i[0]-g)/E),y+=-E*Math.log(1+Math.max(0,m-i[1])/E)+E*Math.log(1+Math.max(0,i[1]-_)/E)}return[p,y]})}function cg(n){return n}function Cc(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 vc(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 hg(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?Cc(l,e,o,i):l;if(a)return t?vc(r,c,h):et(r,h,c);let d=Math.min(c,r),f=Math.floor(Zn(n,d,s));return n[f]>c&&f<n.length-1?n[f+1]:n[f]}})}function ug(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?Cc(t,r,l,s):t;if(h)return i?vc(o,c,e):et(o,e,c);let d=1e-9,f=Math.ceil(Math.log(t/c)/Math.log(n)-d),g=-a*(.5-d)+.5,m=Math.min(c,o),_=Math.floor(Math.log(t/m)/Math.log(n)+g),p=Math.max(f,_),y=t/Math.pow(n,p);return et(y,e,c)}})}function Sc(n,t,e,i,r){return e=e!==void 0?e:!0,(function(s,o,a,l){if(s!==void 0){let h=i?Cc(n,i,a,r):n;return!e||!l?et(s,t,h):vc(s,h,t)}})}function cr(n){if(n!==void 0)return 0}function Rc(n){if(n!==void 0)return n}function dg(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 fg(n){let t=n===void 0?ye(5):n;return(function(e,i){return i||e===void 0?e:Math.abs(e)<=t?0:e})}var Tc=0,bc=class extends wt{constructor(t){super(),this.on,this.once,this.un,t=Object.assign({},t),this.hints_=[0,0],this.animations_=[],this.updateAnimationKey_,this.projection_=js(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&&Yu(),t.center&&(t.center=we(t.center,this.projection_)),t.extent&&(t.extent=Ce(t.extent,this.projection_)),this.applyOptions_(t)}applyOptions_(t){let e=Object.assign({},t);for(let a in me)delete e[a];this.setProperties(e,!0);let i=D_(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=O_(t),s=i.constraint,o=k_(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=we(r.center,this.getProjection())),r.anchor&&(r=Object.assign({},r),r.anchor=we(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&&Go(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],d={start:s,complete:!1,anchor:c.anchor,duration:c.duration!==void 0?c.duration:1e3,easing:c.easing||fd,callback:i};if(c.center&&(d.sourceCenter=o,d.targetCenter=c.center.slice(),o=d.targetCenter),c.zoom!==void 0?(d.sourceResolution=a,d.targetResolution=this.getResolutionForZoom(c.zoom),a=d.targetResolution):c.resolution&&(d.sourceResolution=a,d.targetResolution=c.resolution,a=d.targetResolution),c.rotation!==void 0){d.sourceRotation=l;let f=Ge(c.rotation-l+Math.PI,2*Math.PI)-Math.PI;d.targetRotation=l+f,l=d.targetRotation}F_(d)?d.complete=!0:s+=d.duration,h.push(d)}this.animations_.push(h),this.setHint(bt.ANIMATING,1),this.updateAnimations_()}getAnimating(){return this.hints_[bt.ANIMATING]>0}getInteracting(){return this.hints_[bt.INTERACTING]>0}cancelAnimations(){this.setHint(bt.ANIMATING,-this.hints_[bt.ANIMATING]);let t;for(let e=0,i=this.animations_.length;e<i;++e){let r=this.animations_[e];if(r[0].callback&&Go(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 d=l.easing(c);if(l.sourceCenter){let f=l.sourceCenter[0],g=l.sourceCenter[1],m=l.targetCenter[0],_=l.targetCenter[1];this.nextCenter_=l.targetCenter;let p=f+d*(m-f),y=g+d*(_-g);this.targetCenter_=[p,y]}if(l.sourceResolution&&l.targetResolution){let f=d===1?l.targetResolution:l.sourceResolution+d*(l.targetResolution-l.sourceResolution);if(l.anchor){let g=this.getViewportSize_(this.getRotation()),m=this.constraints_.resolution(f,0,g,!0);this.targetCenter_=this.calculateCenterZoom(m,l.anchor)}this.nextResolution_=l.targetResolution,this.targetResolution_=f,this.applyTargetState_(!0)}if(l.sourceRotation!==void 0&&l.targetRotation!==void 0){let f=d===1?Ge(l.targetRotation+Math.PI,2*Math.PI)-Math.PI:l.sourceRotation+d*(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(bt.ANIMATING,-1),this.nextCenter_=null,this.nextResolution_=NaN,this.nextRotation_=NaN;let o=r[0].callback;o&&Go(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]],zn(i,t-this.getRotation()),Cu(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&&Fr(t,this.getProjection())}getCenterInternal(){return this.get(me.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 Pi(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(me.RESOLUTION)}getResolutions(){return this.resolutions_}getResolutionForExtent(t,e){return this.getResolutionForExtentInternal(Ce(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(me.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=Ic(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=Zn(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(!ze(t),"Cannot fit empty extent provided as `geometry`");let r=Ce(t,this.getProjection());i=Al(r)}else if(t.getType()==="Circle"){let r=Ce(t.getExtent(),this.getProjection());i=Al(r),i.rotate(this.getRotation(),Bt(r))}else{let r=fn();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 d=0,f=s.length;d<f;d+=o){let g=s[d]*i-s[d+1]*r,m=s[d]*r+s[d+1]*i;a=Math.min(a,g),l=Math.min(l,m),h=Math.max(h,g),c=Math.max(c,m)}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),d=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]*d-f[1]*c,m=f[1]*d+f[0]*c,_=this.getConstrainedCenter([g,m],l),p=e.callback?e.callback:hi;e.duration!==void 0?this.animateInternal({resolution:l,center:_,duration:e.duration,easing:e.easing},p):(this.targetResolution_=l,this.targetCenter_=_,this.applyTargetState_(!1,!0),Go(p,!0))}centerOn(t,e,i){this.centerOnInternal(we(t,this.getProjection()),e,i)}centerOnInternal(t,e,i){this.setCenterInternal(Ic(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=Ic(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=Fr(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&&we(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=we(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&&we(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(me.ROTATION)!==r&&this.set(me.ROTATION,r),this.get(me.RESOLUTION)!==o&&(this.set(me.RESOLUTION,o),this.set("zoom",this.getZoom(),!0)),(!a||!this.get(me.CENTER)||!cn(this.get(me.CENTER),a))&&this.set(me.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()||!cn(this.getCenterInternal(),l))&&(this.getAnimating()&&this.cancelAnimations(),this.animateInternal({rotation:s,center:l,resolution:a,duration:t,easing:he,anchor:i}))}beginInteraction(){this.resolveConstraints(0),this.setHint(bt.INTERACTING,1)}endInteraction(t,e,i){i=i&&we(i,this.getProjection()),this.endInteractionInternal(t,e,i)}endInteractionInternal(t,e,i){this.getInteracting()&&(this.setHint(bt.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 Go(n,t){setTimeout(function(){n(t)},0)}function O_(n){if(n.extent!==void 0){let e=n.smoothExtentConstraint!==void 0?n.smoothExtentConstraint:!0;return wc(n.extent,n.constrainOnlyCenter,e)}let t=js(n.projection,"EPSG:3857");if(n.multiWorld!==!0&&t.isGlobal()){let e=t.getExtent().slice();return e[0]=-1/0,e[2]=1/0,wc(e,!1,!1)}return cg}function D_(n){let t,e,i,o=n.minZoom!==void 0?n.minZoom:Tc,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,d=n.showFullExtent!==void 0?n.showFullExtent:!1,f=js(n.projection,"EPSG:3857"),g=f.getExtent(),m=n.constrainOnlyCenter,_=n.extent;if(!h&&!_&&f.isGlobal()&&(m=!1,_=g),n.resolutions!==void 0){let p=n.resolutions;e=p[o],i=p[a]!==void 0?p[a]:p[p.length-1],n.constrainResolution?t=hg(p,c,!m&&_,d):t=Sc(e,i,c,!m&&_,d)}else{let y=(g?Math.max(j(g),ct(g)):360*oi.degrees/f.getMetersPerUnit())/256/Math.pow(2,Tc),E=y/Math.pow(2,28-Tc);e=n.maxResolution,e!==void 0?o=0:e=y/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=y/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=ug(l,e,i,c,!m&&_,d):t=Sc(e,i,c,!m&&_,d)}return{constraint:t,maxResolution:e,minResolution:i,minZoom:o,zoomFactor:l}}function k_(n){if(n.enableRotation!==void 0?n.enableRotation:!0){let e=n.constrainRotation;return e===void 0||e===!0?fg():e===!1?Rc:typeof e=="number"?dg(e):Rc}return cr}function F_(n){return!(n.sourceCenter&&n.targetCenter&&!cn(n.sourceCenter,n.targetCenter)||n.sourceResolution!==n.targetResolution||n.sourceRotation!==n.targetRotation)}function Ic(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 ee=bc;var Lc=class extends wt{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!==hi&&this.listenerKeys.push(Z(t,qe.POSTRENDER,this.render,this)),t.render()}}render(t){}setTarget(t){this.target_=typeof t=="string"?document.getElementById(t):t}},hr=Lc;var Ac=class extends hr{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+" "+Yi+" "+sr+(this.collapsed_&&this.collapsible_?" "+Bl:"")+(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=>ld(()=>r))),i=e.length>0;if(this.renderedVisible_!=i&&(this.element.style.display=i?"":"none",this.renderedVisible_=i),!Gt(e,this.renderedAttributions_)){md(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(Bl),this.collapsed_?il(this.collapseLabel_,this.label_):il(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)}},gg=Ac;var Mc=class extends hr{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+" "+Yi+" "+sr,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(es)}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:he}):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(es);!s&&i===0?this.element.classList.add(es):s&&i!==0&&this.element.classList.remove(es)}this.label_.style.transform=r}this.rotation_=i}},mg=Mc;var Pc=class extends hr{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 d=document.createElement("button");d.className=s,d.setAttribute("type","button"),d.title=h,d.appendChild(typeof a=="string"?document.createTextNode(a):a),d.addEventListener(P.CLICK,this.handleClick_.bind(this,-i),!1);let f=e+" "+Yi+" "+sr,g=this.element;g.className=f,g.appendChild(c),g.appendChild(d),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:he})):i.setZoom(s)}}},pg=Pc;function Xo(n){n=n||{};let t=new Dt;return(n.zoom===void 0||n.zoom)&&t.push(new pg(n.zoomOptions)),(n.rotate===void 0||n.rotate)&&t.push(new mg(n.rotateOptions)),(n.attribution===void 0||n.attribution)&&t.push(new gg(n.attributionOptions)),t}var Oc=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_}},_g=Oc;var Dc={ACTIVE:"active"};var kc=class extends wt{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(Dc.ACTIVE)}getMap(){return this.map_}handleEvent(t){return!0}setActive(t){this.set(Dc.ACTIVE,t)}setMap(t){this.map_=t}};function yg(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:gd,center:n.getConstrainedCenter(r)})}}function ur(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:he})}var $e=kc;var Fc=class extends $e{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();ur(a,o,s,this.duration_),i.preventDefault(),e=!0}return!e}},xg=Fc;function ls(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 Eg=function(n){let t=n.originalEvent;return t.altKey&&!(t.metaKey||t.ctrlKey)&&t.shiftKey},N_=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)},Wo=function(n){let t=n.map.getTargetElement(),e=t.getRootNode();return(e instanceof ShadowRoot?e.host:t).hasAttribute("tabindex")?N_(n):!0},wg=li;var Uo=function(n){let t=n.originalEvent;return"pointerId"in t&&t.button==0&&!(cd&&$a&&t.ctrlKey)};var Yo=function(n){let t=n.originalEvent;return!t.altKey&&!(t.metaKey||t.ctrlKey)&&!t.shiftKey};var Cg=function(n){let t=n.originalEvent;return $a?t.metaKey:t.ctrlKey},vg=function(n){let t=n.originalEvent;return!t.altKey&&!(t.metaKey||t.ctrlKey)&&t.shiftKey},Ko=function(n){let t=n.originalEvent,e=t.target.tagName;return e!=="INPUT"&&e!=="SELECT"&&e!=="TEXTAREA"&&!t.target.isContentEditable},Zo=function(n){let t=n.originalEvent;return"pointerId"in t&&t.pointerType=="mouse"};var Sg=function(n){let t=n.originalEvent;return"pointerId"in t&&t.isPrimary&&t.button===0};var Nc=class extends $e{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 dr(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 Je=Nc;var zc=class extends Je{constructor(t){super({stopDown:ci}),t=t||{},this.kinetic_=t.kinetic,this.lastCentroid=null,this.lastPointersCount_,this.panning_=!1;let e=t.condition?t.condition:ls(Yo,Sg);this.condition_=t.onFocusOnly?ls(Wo,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(dr(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();vu(s,a.getResolution()),zn(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:he})}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}},Rg=zc;var Gc=class extends Je{constructor(t){t=t||{},super({stopDown:ci}),this.condition_=t.condition?t.condition:Eg,this.lastAngle_=void 0,this.duration_=t.duration!==void 0?t.duration:250}handleDragEvent(t){if(!Zo(t))return;let e=t.map,i=e.getView();if(i.getConstraints().rotation===cr)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 Zo(t)?(t.map.getView().endInteraction(this.duration_),!1):!0}handleDownEvent(t){return Zo(t)&&Uo(t)&&this.condition_(t)?(t.map.getView().beginInteraction(),this.lastAngle_=void 0,!0):!1}},Tg=Gc;var Xc=class extends ki{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 Ye([r])}getGeometry(){return this.geometry_}},Ig=Xc;var fr={BOXSTART:"boxstart",BOXDRAG:"boxdrag",BOXEND:"boxend",BOXCANCEL:"boxcancel"},Sn=class extends Lt{constructor(t,e,i){super(t),this.coordinate=e,this.mapBrowserEvent=i}},Wc=class extends Je{constructor(t){super(),this.on,this.once,this.un,t=t??{},this.box_=new Ig(t.className||"ol-dragbox"),this.minArea_=t.minArea??64,t.onBoxEnd&&(this.onBoxEnd=t.onBoxEnd),this.startPixel_=null,this.condition_=t.condition??Uo,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 Sn(fr.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 Sn(e?fr.BOXEND:fr.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 Sn(fr.BOXSTART,t.coordinate,t)),!0):!1}onBoxEnd(t){}setActive(t){t||(this.box_.setMap(null),this.startPixel_&&(this.dispatchEvent(new Sn(fr.BOXCANCEL,this.startPixel_,null)),this.startPixel_=null)),super.setActive(t)}setMap(t){this.getMap()&&(this.box_.setMap(null),this.startPixel_&&(this.dispatchEvent(new Sn(fr.BOXCANCEL,this.startPixel_,null)),this.startPixel_=null)),super.setMap(t)}},bg=Wc;var Uc=class extends bg{constructor(t){t=t||{};let e=t.condition?t.condition:vg;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:he})}},Lg=Uc;var Bi={LEFT:"ArrowLeft",UP:"ArrowUp",RIGHT:"ArrowRight",DOWN:"ArrowDown"};var Yc=class extends $e{constructor(t){super(),t=t||{},this.defaultCondition_=function(e){return Yo(e)&&Ko(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];zn(c,o.getRotation()),yg(o,c,this.duration_),i.preventDefault(),e=!0}}return!e}},Ag=Yc;var Kc=class extends $e{constructor(t){super(),t=t||{},this.condition_=t.condition?t.condition:function(e){return!Cg(e)&&Ko(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();ur(a,o,void 0,this.duration_),i.preventDefault(),e=!0}}return!e}},Mg=Kc;var z_=40,G_=300,X_=3,Zc=class extends $e{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:wg;this.condition_=t.onFocusOnly?ls(Wo,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(Z(e,"keydown",i=>{i.key==="Control"&&(this.ctrlKeyPressed_=!0)}),Z(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*=z_;break;case WheelEvent.DOM_DELTA_PAGE:o*=G_;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*X_),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),ur(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)}},Pg=Zc;var Bc=class extends Je{constructor(t){t=t||{};let e=t;e.stopDown||(e.stopDown=ci),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!==cr&&(this.anchor_=o.getCoordinateFromPixelInternal(o.getEventPixel(dr(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}},Og=Bc;var Vc=class extends Je{constructor(t){t=t||{};let e=t;e.stopDown||(e.stopDown=ci),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(dr(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}},Dg=Vc;function Bo(n){n=n||{};let t=new Dt,e=new _g(-.005,.05,100);return(n.altShiftDragRotate===void 0||n.altShiftDragRotate)&&t.push(new Tg),(n.doubleClickZoom===void 0||n.doubleClickZoom)&&t.push(new xg({delta:n.zoomDelta,duration:n.zoomDuration})),(n.dragPan===void 0||n.dragPan)&&t.push(new Rg({onFocusOnly:n.onFocusOnly,kinetic:e})),(n.pinchRotate===void 0||n.pinchRotate)&&t.push(new Og),(n.pinchZoom===void 0||n.pinchZoom)&&t.push(new Dg({duration:n.zoomDuration})),(n.keyboard===void 0||n.keyboard)&&(t.push(new Ag),t.push(new Mg({delta:n.zoomDelta,duration:n.zoomDuration}))),(n.mouseWheelZoom===void 0||n.mouseWheelZoom)&&t.push(new Pg({onFocusOnly:n.onFocusOnly,duration:n.zoomDuration})),(n.shiftDragZoom===void 0||n.shiftDragZoom)&&t.push(new Lg({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 jc=class extends wt{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()}},Vo=jc;var Vi={ADDLAYER:"addlayer",REMOVELAYER:"removelayer"},Le=class extends Lt{constructor(t,e){super(t),this.layer=e}},Hc={LAYERS:"layers"},qc=class n extends Vo{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(Hc.LAYERS,this.handleLayersChanged_),i?Array.isArray(i)?i=new Dt(i.slice(),{unique:!0}):B(typeof i.getArray=="function","Expected `layers` to be an array or a `Collection`"):i=new Dt(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(Z(t,Pt.ADD,this.handleLayersAdd_,this),Z(t,Pt.REMOVE,this.handleLayersRemove_,this));for(let i in this.listenerKeys_)this.listenerKeys_[i].forEach(J);Xe(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 Le(Vi.ADDLAYER,s))}this.changed()}registerLayerListeners_(t){let e=[Z(t,Se.PROPERTYCHANGE,this.handleLayerChange_,this),Z(t,P.CHANGE,this.handleLayerChange_,this)];t instanceof n&&e.push(Z(t,Vi.ADDLAYER,this.handleLayerGroupAdd_,this),Z(t,Vi.REMOVELAYER,this.handleLayerGroupRemove_,this)),this.listenerKeys_[Y(t)]=e}handleLayerGroupAdd_(t){this.dispatchEvent(new Le(Vi.ADDLAYER,t.layer))}handleLayerGroupRemove_(t){this.dispatchEvent(new Le(Vi.REMOVELAYER,t.layer))}handleLayersAdd_(t){let e=t.element;this.registerLayerListeners_(e),this.dispatchEvent(new Le(Vi.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 Le(Vi.REMOVELAYER,e)),this.changed()}getLayers(){return this.get(Hc.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 Le(Vi.REMOVELAYER,i[r]))}this.set(Hc.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=Ne(l.extent,r.extent):l.extent=r.extent),l.zIndex===void 0&&(l.zIndex=s)}return e}getSourceState(){return"ready"}},cs=qc;var Ft={PRERENDER:"prerender",POSTRENDER:"postrender",PRECOMPOSE:"precompose",POSTCOMPOSE:"postcompose",RENDERCOMPLETE:"rendercomplete"};var $c=class extends Vo{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_=Z(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 ee?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 hs(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 ee?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_=Z(t,Ft.PRECOMPOSE,this.handlePrecompose_,this),this.mapRenderKey_=Z(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 hs(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 Rn=$c;function jo(n,t,e=0,i=n.length-1,r=W_){for(;i>e;){if(i-e>600){let l=i-e+1,h=t-e+1,c=Math.log(l),d=.5*Math.exp(2*c/3),f=.5*Math.sqrt(c*d*(l-d)/l)*(h-l/2<0?-1:1),g=Math.max(e,Math.floor(t-h*d/l+f)),m=Math.min(i,Math.floor(t+(l-h)*d/l+f));jo(n,t,g,m,r)}let s=n[t],o=e,a=i;for(us(n,e,t),r(n[i],s)>0&&us(n,e,i);o<a;){for(us(n,o,a),o++,a--;r(n[o],s)<0;)o++;for(;r(n[a],s)>0;)a--}r(n[e],s)===0?us(n,e,a):(a++,us(n,a,i)),a<=t&&(e=a+1),t<=a&&(i=a-1)}}function us(n,t,e){let i=n[t];n[t]=n[e],n[e]=i}function W_(n,t){return n<t?-1:n>t?1:0}var Tn=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(!qo(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;qo(t,l)&&(e.leaf?i.push(a):Qc(t,l)?this._all(a,i):s.push(a))}e=s.pop()}return i}collides(t){let e=this.data;if(!qo(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(qo(t,o)){if(e.leaf||Qc(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=mr([]),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=U_(t,i.children,e);if(c!==-1)return i.children.splice(c,1),s.push(i),this._condense(s),this}!h&&!i.leaf&&Qc(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=mr(t.slice(e,i+1)),gr(a,this.toBBox),a;r||(r=Math.ceil(Math.log(s)/Math.log(o)),o=Math.ceil(s/Math.pow(o,r-1))),a=mr([]),a.leaf=!1,a.height=r;let l=Math.ceil(s/o),h=l*Math.ceil(Math.sqrt(o));kg(t,e,i,h,this.compareMinX);for(let c=e;c<=i;c+=h){let d=Math.min(c+h-1,i);kg(t,c,d,l,this.compareMinY);for(let f=c;f<=d;f+=l){let g=Math.min(f+l-1,d);a.children.push(this._build(t,f,g,r-1))}}return gr(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=Jc(h),d=Z_(t,h)-c;d<o?(o=d,s=c<s?c:s,a=h):d===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),fs(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=mr(i.children.splice(o,i.children.length-o));a.height=i.height,a.leaf=i.leaf,gr(i,this.toBBox),gr(a,this.toBBox),e?t[e-1].children.push(a):this._splitRoot(i,a)}_splitRoot(t,e){this.data=mr([t,e]),this.data.height=t.height+1,this.data.leaf=!1,gr(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=ds(t,0,a,this.toBBox),h=ds(t,a,i,this.toBBox),c=B_(l,h),d=Jc(l)+Jc(h);c<s?(s=c,r=a,o=d<o?d:o):c===s&&d<o&&(o=d,r=a)}return r||i-e}_chooseSplitAxis(t,e,i){let r=t.leaf?this.compareMinX:Y_,s=t.leaf?this.compareMinY:K_,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=ds(t,0,e,s),a=ds(t,i-e,i,s),l=Ho(o)+Ho(a);for(let h=e;h<i-e;h++){let c=t.children[h];fs(o,t.leaf?s(c):c),l+=Ho(o)}for(let h=i-e-1;h>=e;h--){let c=t.children[h];fs(a,t.leaf?s(c):c),l+=Ho(a)}return l}_adjustParentBBoxes(t,e,i){for(let r=i;r>=0;r--)fs(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():gr(t[e],this.toBBox)}};function U_(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 gr(n,t){ds(n,0,n.children.length,t,n)}function ds(n,t,e,i,r){r||(r=mr(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];fs(r,n.leaf?i(o):o)}return r}function fs(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 Y_(n,t){return n.minX-t.minX}function K_(n,t){return n.minY-t.minY}function Jc(n){return(n.maxX-n.minX)*(n.maxY-n.minY)}function Ho(n){return n.maxX-n.minX+(n.maxY-n.minY)}function Z_(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 B_(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 Qc(n,t){return n.minX<=t.minX&&n.minY<=t.minY&&t.maxX<=n.maxX&&t.maxY<=n.maxY}function qo(n,t){return t.minX<=n.maxX&&t.minY<=n.maxY&&t.maxX>=n.minX&&t.maxY>=n.minY}function mr(n){return{children:n,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function kg(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;jo(n,o,t,e,r),s.push(t,o,o,e)}}var bn=0,Jo=0,Ut=1<<bn++,Q=1<<bn++,Yt=1<<bn++,Zt=1<<bn++,Ei=1<<bn++,In=1<<bn++,Qo=Math.pow(2,bn)-1,eh={[Ut]:"boolean",[Q]:"number",[Yt]:"string",[Zt]:"color",[Ei]:"number[]",[In]:"size"},V_=Object.keys(eh).map(Number).sort(Vt);function j_(n){return n in eh}function xi(n){let t=[];for(let e of V_)gs(n,e)&&t.push(eh[e]);return t.length===0?"untyped":t.length<3?t.join(" or "):t.slice(0,-1).join(", ")+", or "+t[t.length-1]}function gs(n,t){return(n&t)===t}function $o(n,t){return!!(n&t)}function ji(n,t){return n===t}var ft=class{constructor(t,e){if(!j_(t))throw new Error(`literal expressions must have a specific type, got ${xi(t)}`);this.type=t,this.value=e}},ta=class{constructor(t,e,...i){this.type=t,this.operator=e,this.args=i}};function ea(n){return{variables:new Map,properties:new Map,featureId:!1,geometryType:!1,mCoordinate:!1,mapState:!1,inputVariables:n}}function _t(n,t,e){switch(typeof n){case"boolean":{if(ji(t,Yt))return new ft(Yt,n?"true":"false");if(!gs(t,Ut))throw new Error(`got a boolean, but expected ${xi(t)}`);return new ft(Ut,n)}case"number":{if(ji(t,In))return new ft(In,mt(n));if(ji(t,Ut))return new ft(Ut,!!n);if(ji(t,Yt))return new ft(Yt,n.toString());if(!gs(t,Q))throw new Error(`got a number, but expected ${xi(t)}`);return new ft(Q,n)}case"string":{if(ji(t,Zt))return new ft(Zt,Jr(n));if(ji(t,Ut))return new ft(Ut,!!n);if(!gs(t,Yt))throw new Error(`got a string, but expected ${xi(t)}`);return new ft(Yt,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 oy(n,t,e);for(let i of n)if(typeof i!="number")throw new Error("expected an array of numbers");if(ji(t,In)){if(n.length!==2)throw new Error(`expected an array of two values for a size, got ${n.length}`);return new ft(In,n)}if(ji(t,Zt)){if(n.length===3)return new ft(Zt,[...n,1]);if(n.length===4)return new ft(Zt,n);throw new Error(`expected an array of 3 or 4 values for a color, got ${n.length}`)}if(!gs(t,Ei))throw new Error(`got an array of numbers, but expected ${xi(t)}`);return new ft(Ei,n)}var S={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"},H_={[S.Get]:K(q(1,1/0),Fg),[S.Var]:q_(),[S.Has]:K(q(1,1/0),Fg),[S.Id]:K($_,pr),[S.Concat]:K(q(2,1/0),st(Yt)),[S.GeometryType]:K(J_,pr),[S.LineMetric]:K(Q_,pr),[S.Resolution]:K(th,pr),[S.Zoom]:K(th,pr),[S.Time]:K(th,pr),[S.Any]:K(q(2,1/0),st(Ut)),[S.All]:K(q(2,1/0),st(Ut)),[S.Not]:K(q(1,1),st(Ut)),[S.Equal]:K(q(2,2),zg()),[S.NotEqual]:K(q(2,2),zg()),[S.GreaterThan]:K(q(2,2),st(Q)),[S.GreaterThanOrEqualTo]:K(q(2,2),st(Q)),[S.LessThan]:K(q(2,2),st(Q)),[S.LessThanOrEqualTo]:K(q(2,2),st(Q)),[S.Multiply]:K(q(2,1/0),Ng),[S.Coalesce]:K(q(2,1/0),Ng),[S.Divide]:K(q(2,2),st(Q)),[S.Add]:K(q(2,1/0),st(Q)),[S.Subtract]:K(q(2,2),st(Q)),[S.Clamp]:K(q(3,3),st(Q)),[S.Mod]:K(q(2,2),st(Q)),[S.Pow]:K(q(2,2),st(Q)),[S.Abs]:K(q(1,1),st(Q)),[S.Floor]:K(q(1,1),st(Q)),[S.Ceil]:K(q(1,1),st(Q)),[S.Round]:K(q(1,1),st(Q)),[S.Sin]:K(q(1,1),st(Q)),[S.Cos]:K(q(1,1),st(Q)),[S.Atan]:K(q(1,2),st(Q)),[S.Sqrt]:K(q(1,1),st(Q)),[S.Match]:K(q(4,1/0),Gg,ey),[S.Between]:K(q(3,3),st(Q)),[S.Interpolate]:K(q(6,1/0),Gg,iy),[S.Case]:K(q(3,1/0),ty,ny),[S.In]:K(q(2,2),ry),[S.Number]:K(q(1,1/0),st(Qo)),[S.String]:K(q(1,1/0),st(Qo)),[S.Array]:K(q(1,1/0),st(Q)),[S.Color]:K(q(1,4),st(Q)),[S.Band]:K(q(1,3),st(Q)),[S.Palette]:K(q(2,2),sy),[S.ToString]:K(q(1,1),st(Ut|Q|Yt|Zt))};function Fg(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(Yt,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 q_(){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=_t(s,Qo,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"&&$o(r,Zt)&&!$o(r,Yt)?a=Zt:Array.isArray(s)&&s.length===2&&$o(r,In)&&!$o(r,Ei)&&(a=In),r&=a,r===Jo)throw new Error(`the type expected from the var operator (${xi(t)}) did not have any overlap with the type of the corresponding style variables (${xi(a)}), variable name: ${i}`)}if(e.variables.has(i)){let o=e.variables.get(i);if(r&=o,r===Jo)throw new Error(`a new type expected from the var operator (${xi(t)}) did not have any overlap with the previous type expected for it (${xi(o)}), variable name: ${i}`)}return e.variables.set(i,r),new ta(r,"var",new ft(Yt,i))}}function $_(n,t,e){e.featureId=!0}function J_(n,t,e){e.geometryType=!0}function Q_(n,t,e){e.mCoordinate=!0}function th(n,t,e){e.mapState=!0}function pr(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 Ng(n,t,e){let i=n.length-1,r=new Array(i);for(let s=0;s<i;++s){let o=_t(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=_t(t[o+1],n,i);s[o]=a}return s}}function zg(){return function(n,t,e){let i=n[0],r=n.length-1,s=new Array(r),o=Qo;for(let a=0;a<r;++a){let l=_t(n[a+1],o,e);o&=l.type}if(o===Jo)throw new Error(`no common type was found among the arguments of ${i}`);for(let a=0;a<r;++a){let l=_t(n[a+1],o,e);s[a]=l}return s}}function ty(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 Gg(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 ey(n,t,e){let i=n.length-1,r=_t(n[n.length-1],t,e),s=Yt|Q|Ut,o=new Array(i-2);for(let l=0;l<i-2;l+=2){try{let h=_t(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===Jo)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=_t(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=_t(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[_t(n[1],s,e),...o,r]}function iy(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=_t(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=_t(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=_t(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 ny(n,t,e){let i=_t(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=_t(n[s+1],Ut,e);r[s]=o}catch(o){throw new Error(`failed to parse argument ${s} of case expression: ${o.message}`)}try{let o=_t(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 ry(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=Yt:r=Q;let s=new Array(i.length);for(let a=0;a<s.length;a++)try{let l=_t(i[a],r,e);s[a]=l}catch(l){throw new Error(`failed to parse haystack item ${a} for "in" expression: ${l.message}`)}return[_t(n[1],r,e),...s]}function sy(n,t,e){let i;try{i=_t(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=_t(r[o],Zt,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 K(...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 ta(e,r,...s)}}function oy(n,t,e){let i=n[0],r=H_[i];if(!r)throw new Error(`unknown operator: ${i}`);return r(n,t,e)}function ia(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 ia(n.getGeometries()[0]);default:return""}}function ih(){return{variables:{},properties:{},resolution:NaN,featureId:null,geometryType:""}}function Me(n,t,e){let i=_t(n,t,e);return Ae(i,e)}function Ae(n,t){if(n instanceof ft){if(n.type===Zt&&typeof n.value=="string"){let i=Jr(n.value);return function(){return i}}return function(){return n.value}}let e=n.operator;switch(e){case S.Number:case S.String:case S.Coalesce:return ay(n,t);case S.Get:case S.Var:case S.Has:return ly(n,t);case S.Id:return i=>i.featureId;case S.GeometryType:return i=>i.geometryType;case S.Concat:{let i=n.args.map(r=>Ae(r,t));return r=>"".concat(...i.map(s=>s(r).toString()))}case S.Resolution:return i=>i.resolution;case S.Any:case S.All:case S.Between:case S.In:case S.Not:return hy(n,t);case S.Equal:case S.NotEqual:case S.LessThan:case S.LessThanOrEqualTo:case S.GreaterThan:case S.GreaterThanOrEqualTo:return cy(n,t);case S.Multiply:case S.Divide:case S.Add:case S.Subtract:case S.Clamp:case S.Mod:case S.Pow:case S.Abs:case S.Floor:case S.Ceil:case S.Round:case S.Sin:case S.Cos:case S.Atan:case S.Sqrt:return uy(n,t);case S.Case:return dy(n,t);case S.Match:return fy(n,t);case S.Interpolate:return gy(n,t);case S.ToString:return my(n,t);default:throw new Error(`Unsupported operator ${e}`)}}function ay(n,t){let e=n.operator,i=n.args.length,r=new Array(i);for(let s=0;s<i;++s)r[s]=Ae(n.args[s],t);switch(e){case S.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 S.Number:case S.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 ly(n,t){let i=n.args[0].value;switch(n.operator){case S.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 S.Var:return r=>r.variables[i];case S.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 cy(n,t){let e=n.operator,i=Ae(n.args[0],t),r=Ae(n.args[1],t);switch(e){case S.Equal:return s=>i(s)===r(s);case S.NotEqual:return s=>i(s)!==r(s);case S.LessThan:return s=>i(s)<r(s);case S.LessThanOrEqualTo:return s=>i(s)<=r(s);case S.GreaterThan:return s=>i(s)>r(s);case S.GreaterThanOrEqualTo:return s=>i(s)>=r(s);default:throw new Error(`Unsupported comparison operator ${e}`)}}function hy(n,t){let e=n.operator,i=n.args.length,r=new Array(i);for(let s=0;s<i;++s)r[s]=Ae(n.args[s],t);switch(e){case S.Any:return s=>{for(let o=0;o<i;++o)if(r[o](s))return!0;return!1};case S.All:return s=>{for(let o=0;o<i;++o)if(!r[o](s))return!1;return!0};case S.Between:return s=>{let o=r[0](s),a=r[1](s),l=r[2](s);return o>=a&&o<=l};case S.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 S.Not:return s=>!r[0](s);default:throw new Error(`Unsupported logical operator ${e}`)}}function uy(n,t){let e=n.operator,i=n.args.length,r=new Array(i);for(let s=0;s<i;++s)r[s]=Ae(n.args[s],t);switch(e){case S.Multiply:return s=>{let o=1;for(let a=0;a<i;++a)o*=r[a](s);return o};case S.Divide:return s=>r[0](s)/r[1](s);case S.Add:return s=>{let o=0;for(let a=0;a<i;++a)o+=r[a](s);return o};case S.Subtract:return s=>r[0](s)-r[1](s);case S.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 S.Mod:return s=>r[0](s)%r[1](s);case S.Pow:return s=>Math.pow(r[0](s),r[1](s));case S.Abs:return s=>Math.abs(r[0](s));case S.Floor:return s=>Math.floor(r[0](s));case S.Ceil:return s=>Math.ceil(r[0](s));case S.Round:return s=>Math.round(r[0](s));case S.Sin:return s=>Math.sin(r[0](s));case S.Cos:return s=>Math.cos(r[0](s));case S.Atan:return i===2?s=>Math.atan2(r[0](s),r[1](s)):s=>Math.atan(r[0](s));case S.Sqrt:return s=>Math.sqrt(r[0](s));default:throw new Error(`Unsupported numeric operator ${e}`)}}function dy(n,t){let e=n.args.length,i=new Array(e);for(let r=0;r<e;++r)i[r]=Ae(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 fy(n,t){let e=n.args.length,i=new Array(e);for(let r=0;r<e;++r)i[r]=Ae(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 gy(n,t){let e=n.args.length,i=new Array(e);for(let r=0;r<e;++r)i[r]=Ae(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),d=i[h+1](r),f=Array.isArray(d);if(f&&(d=uf(d)),c>=o)return h===2?d:f?py(s,o,a,l,c,d):ms(s,o,a,l,c,d);a=c,l=d}return l}}function my(n,t){let e=n.operator,i=n.args.length,r=new Array(i);for(let s=0;s<i;++s)r[s]=Ae(n.args[s],t);if(e===S.ToString)return s=>{let o=r[0](s);return n.args[0].type===Zt?Qr(o):o.toString()};throw new Error(`Unsupported convert operator ${e}`)}function ms(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 py(n,t,e,i,r,s){if(r-e===0)return i;let a=Yl(i),l=Yl(s),h=l[2]-a[2];h>180?h-=360:h<-180&&(h+=360);let c=[ms(n,t,e,a[0],r,l[0]),ms(n,t,e,a[1],r,l[1]),a[2]+ms(n,t,e,0,r,h),ms(n,t,e,i[3],r,s[3])];return df(c)}function _y(n){return!0}function yy(n,t){t=t??ea();let e=xy(n,t),i=ih();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=ia(r.getGeometry())),e(i)}}function Xg(n,t){t=t??ea();let e=n.length,i=new Array(e);for(let o=0;o<e;++o)i[o]=nh(n[o],t);let r=ih(),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=ia(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 Kg(n,t){if(t=t??ea(),!Array.isArray(n))return Xg([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 yy(s,t)}return Xg(n,t)}function xy(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?Me(s.filter,Ut,t):_y,a;if(Array.isArray(s.style)){let l=s.style.length;a=new Array(l);for(let h=0;h<l;++h)a[h]=nh(s.style[h],t)}else a=[nh(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 nh(n,t){let e=ps(n,"",t),i=_s(n,"",t),r=Ey(n,t),s=wy(n,t),o=Nt(n,"z-index",t);if(!e&&!i&&!r&&!s&&!xe(n))throw new Error("No fill, stroke, point, or text symbolizer properties in style: "+JSON.stringify(n));let a=new It;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 ps(n,t,e){let i;if(t+"fill-pattern-src"in n)i=Ry(n,t+"fill-",e);else{if(n[t+"fill-color"]==="none")return s=>null;i=ra(n,t+"fill-color",e)}if(!i)return null;let r=new pt;return function(s){let o=i(s);return o===So?null:(r.setColor(o),r)}}function _s(n,t,e){let i=Nt(n,t+"stroke-width",e),r=ra(n,t+"stroke-color",e);if(!i&&!r)return null;let s=wi(n,t+"stroke-line-cap",e),o=wi(n,t+"stroke-line-join",e),a=Zg(n,t+"stroke-line-dash",e),l=Nt(n,t+"stroke-line-dash-offset",e),h=Nt(n,t+"stroke-miter-limit",e),c=Nt(n,t+"stroke-offset",e),d=new Mt;return function(f){if(r){let g=r(f);if(g===So)return null;d.setColor(g)}if(i&&d.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");d.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");d.setLineJoin(g)}return a&&d.setLineDash(a(f)),l&&d.setLineDashOffset(l(f)),h&&d.setMiterLimit(h(f)),c&&d.setOffset(c(f)),d}}function Ey(n,t){let e="text-",i=wi(n,e+"value",t);if(!i)return null;let r=ps(n,e,t),s=ps(n,e+"background-",t),o=_s(n,e,t),a=_s(n,e+"background-",t),l=wi(n,e+"font",t),h=Nt(n,e+"max-angle",t),c=Nt(n,e+"offset-x",t),d=Nt(n,e+"offset-y",t),f=_r(n,e+"overflow",t),g=wi(n,e+"placement",t),m=Nt(n,e+"repeat",t),_=sa(n,e+"scale",t),p=_r(n,e+"rotate-with-view",t),y=Nt(n,e+"rotation",t),E=wi(n,e+"align",t),v=wi(n,e+"justify",t),x=wi(n,e+"baseline",t),C=_r(n,e+"keep-upright",t),T=Zg(n,e+"padding",t),A=oa(n,e+"declutter-mode"),R=new _i({declutterMode:A});return function(I){if(R.setText(i(I)),r&&R.setFill(r(I)),s&&R.setBackgroundFill(s(I)),o&&R.setStroke(o(I)),a&&R.setBackgroundStroke(a(I)),l&&R.setFont(l(I)),h&&R.setMaxAngle(h(I)),c&&R.setOffsetX(c(I)),d&&R.setOffsetY(d(I)),f&&R.setOverflow(f(I)),g){let b=g(I);if(b!=="point"&&b!=="line")throw new Error("Expected point or line for text-placement");R.setPlacement(b)}if(m&&R.setRepeat(m(I)),_&&R.setScale(_(I)),p&&R.setRotateWithView(p(I)),y&&R.setRotation(y(I)),E){let b=E(I);if(b!=="left"&&b!=="center"&&b!=="right"&&b!=="end"&&b!=="start")throw new Error("Expected left, right, center, start, or end for text-align");R.setTextAlign(b)}if(v){let b=v(I);if(b!=="left"&&b!=="right"&&b!=="center")throw new Error("Expected left, right, or center for text-justify");R.setJustify(b)}if(x){let b=x(I);if(b!=="bottom"&&b!=="top"&&b!=="middle"&&b!=="alphabetic"&&b!=="hanging")throw new Error("Expected bottom, top, middle, alphabetic, or hanging for text-baseline");R.setTextBaseline(b)}return T&&R.setPadding(T(I)),C&&R.setKeepUpright(C(I)),R}}function wy(n,t){return"icon-src"in n?Cy(n,t):"shape-points"in n?vy(n,t):"circle-radius"in n?Sy(n,t):null}function Cy(n,t){let e="icon-",i=e+"src",r=Bg(n[i],i),s=na(n,e+"anchor",t),o=sa(n,e+"scale",t),a=Nt(n,e+"opacity",t),l=na(n,e+"displacement",t),h=Nt(n,e+"rotation",t),c=_r(n,e+"rotate-with-view",t),d=Ug(n,e+"anchor-origin"),f=Yg(n,e+"anchor-x-units"),g=Yg(n,e+"anchor-y-units"),m=Ci(n,e+"color"),_,p=null;m!==void 0&&(Array.isArray(m)&&m.length>0&&typeof m[0]=="string"?p=ra(n,e+"color",t):_=Vg(m,e+"color"));let y=Iy(n,e+"cross-origin"),E=by(n,e+"offset"),v=Ug(n,e+"offset-origin"),x=rh(n,e+"width"),C=rh(n,e+"height"),T=Ty(n,e+"size"),A=oa(n,e+"declutter-mode"),R={src:r,anchorOrigin:d,anchorXUnits:f,anchorYUnits:g,crossOrigin:y,offset:E,offsetOrigin:v,height:C,width:x,size:T,declutterMode:A},I=null;return function(b){if(I)p&&I.setColor(p(b));else{let z=p?p(b):_;I=new wn(z!==void 0?Object.assign({},R,{color:z}):Object.assign({},R))}return a&&I.setOpacity(a(b)),l&&I.setDisplacement(l(b)),h&&I.setRotation(h(b)),c&&I.setRotateWithView(c(b)),o&&I.setScale(o(b)),s&&I.setAnchor(s(b)),I}}function vy(n,t){let e="shape-",i=e+"points",r=e+"radius",s=sh(n[i],i);if(!(r in n))throw new Error(`Expected a number for ${r}`);let o=Nt(n,r,t),a=typeof n[r]=="number"?n[r]:5,l=e+"radius2",h=Nt(n,l,t),c=typeof n[l]=="number"?n[l]:void 0,d=ps(n,e,t),f=_s(n,e,t),g=sa(n,e+"scale",t),m=na(n,e+"displacement",t),_=Nt(n,e+"rotation",t),p=_r(n,e+"rotate-with-view",t),y=rh(n,e+"angle"),E=oa(n,e+"declutter-mode"),v=new Ao({points:s,radius:a,radius2:c,angle:y,declutterMode:E});return function(x){return o&&v.setRadius(o(x)),h&&v.setRadius2(h(x)),d&&v.setFill(d(x)),f&&v.setStroke(f(x)),m&&v.setDisplacement(m(x)),_&&v.setRotation(_(x)),p&&v.setRotateWithView(p(x)),g&&v.setScale(g(x)),v}}function Sy(n,t){let e="circle-",i=ps(n,e,t),r=_s(n,e,t),s=Nt(n,e+"radius",t),o=sa(n,e+"scale",t),a=na(n,e+"displacement",t),l=Nt(n,e+"rotation",t),h=_r(n,e+"rotate-with-view",t),c=oa(n,e+"declutter-mode"),d=new Mo({radius:5,declutterMode:c});return function(f){return s&&d.setRadius(s(f)),i&&d.setFill(i(f)),r&&d.setStroke(r(f)),a&&d.setDisplacement(a(f)),l&&d.setRotation(l(f)),h&&d.setRotateWithView(h(f)),o&&d.setScale(o(f)),d}}function Ci(n,t){if(!(t in n))return;let e=n[t];return e===void 0?void 0:e}function Nt(n,t,e){let i=Ci(n,t);if(i===void 0)return;let r=Me(i,Q,e);return function(s){return sh(r(s),t)}}function wi(n,t,e){let i=Ci(n,t);if(i===void 0)return null;let r=Me(i,Yt,e);return function(s){return Bg(r(s),t)}}function Ry(n,t,e){let i=wi(n,t+"pattern-src",e),r=Wg(n,t+"pattern-offset",e),s=Wg(n,t+"pattern-size",e),o=ra(n,t+"color",e);return function(a){return{src:i(a),offset:r&&r(a),size:s&&s(a),color:o&&o(a)}}}function _r(n,t,e){let i=Ci(n,t);if(i===void 0)return null;let r=Me(i,Ut,e);return function(s){let o=r(s);if(typeof o!="boolean")throw new Error(`Expected a boolean for ${t}`);return o}}function ra(n,t,e){let i=Ci(n,t);if(i===void 0)return null;let r=Me(i,Zt,e);return function(s){return Vg(r(s),t)}}function Zg(n,t,e){let i=Ci(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=Me(o,Q,e);return function(h){return sh(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=Me(i,Ei,e);return function(s){return ys(r(s),t)}}function na(n,t,e){let i=Ci(n,t);if(i===void 0)return null;let r=Me(i,Ei,e);return function(s){let o=ys(r(s),t);if(o.length!==2)throw new Error(`Expected two numbers for ${t}`);return o}}function Wg(n,t,e){let i=Ci(n,t);if(i===void 0)return null;let r=Me(i,Ei,e);return function(s){return jg(r(s),t)}}function sa(n,t,e){let i=Ci(n,t);if(i===void 0)return null;let r=Me(i,Ei|Q,e);return function(s){return Ly(r(s),t)}}function rh(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 Ty(n,t){let e=n[t];if(e!==void 0){if(typeof e=="number")return mt(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 Iy(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 Ug(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 Yg(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 by(n,t){let e=n[t];if(e!==void 0)return ys(e,t)}function oa(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 ys(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 Bg(n,t){if(typeof n!="string")throw new Error(`Expected a string for ${t}`);return n}function sh(n,t){if(typeof n!="number")throw new Error(`Expected a number for ${t}`);return n}function Vg(n,t){if(typeof n=="string")return n;let e=ys(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 jg(n,t){let e=ys(n,t);if(e.length!==2)throw new Error(`Expected an array of two numbers for ${t}`);return e}function Ly(n,t){return typeof n=="number"?n:jg(n,t)}var Hg={RENDER_ORDER:"renderOrder"},oh=class extends Rn{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(Hg.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 Tn(9)),this.getRenderer().renderDeclutter(t,e)}setRenderOrder(t){this.set(Hg.RENDER_ORDER,t)}setStyle(t){this.style_=t===void 0?ic:t;let e=Ay(t);this.styleFunction_=t===null?void 0:Sf(e),this.changed()}setDeclutter(t){this.declutter_=t?String(t):void 0,this.changed()}};function Ay(n){if(n===void 0)return ic;if(!n)return null;if(typeof n=="function"||n instanceof It)return n;if(Array.isArray(n)&&n.length===0)return[];if(Array.isArray(n)&&n[0]instanceof It){let e=n.length,i=new Array(e);for(let r=0;r<e;++r){let s=n[r];if(!(s instanceof It))throw new Error("Expected a list of style instances");i[r]=s}return i}return Kg(n)}var aa=oh;var ah=class extends Lt{constructor(t,e,i,r){super(t),this.inversePixelTransform=e,this.frameState=i,this.context=r}},la=ah;var lh=class extends ki{constructor(t){super(),this.map_=t}dispatchRenderEvent(t,e){H()}calculateMatrices2D(t){let e=t.viewState,i=t.coordinateToPixelTransform,r=t.pixelToCoordinateTransform;Ot(i,t.size[0]/2,t.size[1]/2,1/e.resolution,-1/e.resolution,-e.rotation,-e.center[0],-e.center[1]),so(r,i)}forEachFeatureAtCoordinate(t,e,i,r,s,o,a,l){let h,c=e.viewState;function d(x,C,T,A){return s.call(o,C,x?T:null,A)}let f=c.projection,g=Ws(t.slice(),f),m=[[0,0]];if(f.canWrapX()&&r){let x=f.getExtent(),C=j(x);m.push([-C,0],[C,0])}let _=e.layerStatesArray,p=_.length,y=[],E=[];for(let x=0;x<m.length;x++)for(let C=p-1;C>=0;--C){let T=_[C],A=T.layer;if(A.hasRenderer()&&hs(T,c)&&a.call(l,A)){let R=A.getRenderer(),I=A.getSource();if(R&&I){let b=I.getWrapX()?g:t,z=d.bind(null,T.managed);E[0]=b[0]+m[x][0],E[1]=b[1]+m[x][1],h=R.forEachFeatureAtCoordinate(E,e,i,z,y)}if(h)return h}}if(y.length===0)return;let v=1/y.length;return y.forEach((x,C)=>x.distanceSq+=C*v),y.sort((x,C)=>x.distanceSq-C.distanceSq),y.some(x=>h=x.callback(x.feature,x.layer,x.geometry)),h}hasFeatureAtCoordinate(t,e,i,r,s,o){return this.forEachFeatureAtCoordinate(t,e,i,r,li,this,s,o)!==void 0}getMap(){return this.map_}renderFrame(t){H()}scheduleExpireIconCache(t){Xt.canExpireCache()&&t.postRenderFunctions.push(My)}};function My(n,t){Xt.expire()}var qg=lh;var ch=class extends qg{constructor(t){super(t),this.fontChangeListenerKey_=Z(xn,Se.PROPERTYCHANGE,t.redrawText,t),this.element_=Rt?io():document.createElement("div");let e=this.element_.style;e.position="absolute",e.width="100%",e.height="100%",e.zIndex="0",this.element_.className=Yi+" 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 la(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(Ft.PRECOMPOSE,t);let e=t.layerStatesArray.sort((c,d)=>c.zIndex-d.zIndex);e.some(c=>c.layer instanceof aa&&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,d=e.length;c<d;++c){let f=e[c];t.layerIndex=c;let g=f.layer,m=g.getSourceState();if(!hs(f,r)||m!="ready"&&m!="undefined"){g.unrender();continue}let _=g.render(t,h);_&&(_!==h&&(this.children_.push(_),h=_),l.push(f))}this.declutter(t,l),pd(this.element_,this.children_);for(let c of a?this.children_:[]){let d=c.firstElementChild||c,f=c.style.backgroundColor;if(f&&(!te(d)||d.width>0)&&(a.fillStyle=f,a.fillRect(0,0,a.canvas.width,a.canvas.height)),!te(d)||d.width===0)continue;a.save();let g=c.style.opacity||d.style.opacity;a.globalAlpha=g===""?1:Number(g);let m=d.style.transform;if(m)a.transform(...ro(m));else{let _=parseFloat(d.style.width)/d.width,p=parseFloat(d.style.height)/d.height;a.transform(_,0,0,p,0,0)}a.drawImage(d,0,0),a.restore()}this.dispatchRenderEvent(Ft.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))}}},$g=ch;function Jg(n){if(n instanceof Rn){n.setMapInternal(null);return}n instanceof cs&&n.getLayers().forEach(Jg)}function Qg(n,t){if(n instanceof Rn){n.setMapInternal(t);return}if(n instanceof cs){let e=n.getLayers().getArray();for(let i=0,r=e.length;i<r;++i)Qg(e[i],t)}}var hh=class extends wt{constructor(t){super(),t=t||{},this.on,this.once,this.un;let e=Py(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:hd,this.postRenderTimeoutHandle_,this.animationDelayKey_,this.animationDelay_=this.animationDelay_.bind(this),this.coordinateToPixelTransform_=At(),this.pixelToCoordinateTransform_=At(),this.frameIndex_=0,this.frameState_=null,this.previousExtent_=null,this.viewPropertyListenerKey_=null,this.viewChangeListenerKey_=null,this.layerGroupPropertyListenerKeys_=null,Rt||(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,Rt||(this.resizeObserver_=new ResizeObserver(()=>this.updateSize())),this.controls=e.controls||(Rt?new Dt:Xo()),this.interactions=e.interactions||(Rt?new Dt:Bo({onFocusOnly:!0})),this.overlays_=e.overlays,this.overlayIdIndex_={},this.renderer_=null,this.postRenderFunctions_=[],this.tileQueue_=new ag(this.getTilePriority.bind(this),this.handleTileChange_.bind(this)),this.addChangeListener(kt.LAYERGROUP,this.handleLayerGroupChanged_),this.addChangeListener(kt.VIEW,this.handleViewChanged_),this.addChangeListener(kt.SIZE,this.handleSizeChanged_),this.addChangeListener(kt.TARGET,this.handleTargetChanged_),this.setProperties(e.values);let i=this;t.view&&!(t.view instanceof ee)&&t.view.then(function(r){i.setView(new ee(r))}),this.controls.addEventListener(Pt.ADD,r=>{r.element.setMap(this)}),this.controls.addEventListener(Pt.REMOVE,r=>{r.element.setMap(null)}),this.interactions.addEventListener(Pt.ADD,r=>{r.element.setMap(this)}),this.interactions.addEventListener(Pt.REMOVE,r=>{r.element.setMap(null)}),this.overlays_.addEventListener(Pt.ADD,r=>{this.addOverlayInternal_(r.element)}),this.overlays_.addEventListener(Pt.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){Qg(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:li,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 cs?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:li,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(kt.TARGET)}getTargetElement(){return this.targetElement_}getCoordinateFromPixel(t){return Fr(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(kt.LAYERGROUP)}setLayers(t){let e=this.getLayerGroup();if(t instanceof Dt){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=we(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(kt.SIZE)}getView(){return this.get(kt.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 lg(this.frameState_,t,e,i,r)}handleBrowserEvent(t,e){e=e||t.type;let i=new He(e,this,t);this.handleMapBrowserEvent(i)}handleMapBrowserEvent(t){if(!this.frameState_)return;let e=t.originalEvent,i=e.type;if(i===os.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[bt.ANIMATING]||o[bt.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(Ft.RENDERCOMPLETE)&&this.renderer_.dispatchRenderEvent(Ft.RENDERCOMPLETE,t),this.loaded_===!1&&(this.loaded_=!0,this.dispatchEvent(new Zi(qe.LOADEND,this,t)))):this.loaded_===!0&&(this.loaded_=!1,this.dispatchEvent(new Zi(qe.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 $g(this)),!te(e)){this.mapBrowserEventHandler_=new sg(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_,eo?{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_=[Z(i,P.KEYDOWN,this.handleBrowserEvent,this),Z(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_=Z(t,Se.PROPERTYCHANGE,this.handleViewPropertyChanged_,this),this.viewChangeListenerKey_=Z(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 Le("addlayer",t)),this.layerGroupPropertyListenerKeys_=[Z(t,Se.PROPERTYCHANGE,this.render,this),Z(t,P.CHANGE,this.render,this),Z(t,"addlayer",this.handleLayerAdd_,this),Z(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){Jg(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&&Ka(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_||!ze(this.previousExtent_)&&!on(s.extent,this.previousExtent_))&&(this.dispatchEvent(new Zi(qe.MOVESTART,this,r)),this.previousExtent_=sn(this.previousExtent_)),this.previousExtent_&&!s.viewHints[bt.ANIMATING]&&!s.viewHints[bt.INTERACTING]&&!on(s.extent,this.previousExtent_)&&(this.dispatchEvent(new Zi(qe.MOVEEND,this,s)),Os(s.extent,this.previousExtent_))),this.dispatchEvent(new Zi(qe.POSTRENDER,this,s)),this.renderComplete_=(this.hasListener(qe.LOADSTART)||this.hasListener(qe.LOADEND)||this.hasListener(Ft.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 Le("removelayer",e)),this.set(kt.LAYERGROUP,t)}setSize(t){this.set(kt.SIZE,t)}setTarget(t){this.set(kt.TARGET,t)}setView(t){if(!t||t instanceof ee){this.set(kt.VIEW,t);return}this.set(kt.VIEW,new ee);let e=this;t.then(function(i){e.setView(new ee(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)],!Ka(e)&&(t.offsetWidth||t.offsetHeight||t.getClientRects().length)&&zs("No map visible because the map container's width or height are 0."))}let i=this.getSize();e&&(!i||!Gt(e,i))&&(this.updateViewportSize_(e),this.setSize(e))}updateViewportSize_(t){let e=this.getView();e&&e.setViewportSize(t)}};function Py(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 cs({layers:n.layers});e[kt.LAYERGROUP]=i,e[kt.TARGET]=n.target,e[kt.VIEW]=n.view instanceof ee?n.view:new ee;let r;n.controls!==void 0&&(Array.isArray(n.controls)?r=new Dt(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 Dt(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 Dt(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 Dt,{controls:r,interactions:s,keyboardEventTarget:t,overlays:o,values:e}}var tm=hh;function ca(n){return n instanceof Image||n instanceof HTMLCanvasElement||n instanceof HTMLVideoElement||n instanceof ImageBitmap?n:null}var Oy=new Error("disposed");var Dy=[256,256],uh=class extends qn{constructor(t){let e=D.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=ca(this.data_);return t?[t.width,t.height]:Dy}getData(){return this.data_}getError(){return this.error_}load(){if(this.state!==D.IDLE&&this.state!==D.ERROR)return;this.state=D.LOADING,this.changed();let t=this;this.loader_().then(function(e){t.data_=e,t.state=D.LOADED,t.changed()}).catch(function(e){t.error_=e,t.state=D.ERROR,t.changed()})}disposeInternal(){this.controller_&&(this.controller_.abort(Oy),this.controller_=null),super.disposeInternal()}},dh=uh;var fh=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 ki&&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}},gh=fh;var mh=class{constructor(){this.instructions_=[],this.zIndex=0,this.offset_=0,this.pendingMethod_,this.context_=new Proxy(Gr(),{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}},ha=mh;var ky=5,ph=class extends ao{constructor(t){super(),this.ready=!0,this.boundHandleImageChange_=this.handleImageChange_.bind(this),this.layer_=t,this.staleKeys_=new Array,this.maxStaleKeys=ky,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()===U.LOADED||e.getState()===U.ERROR)&&this.renderIfReadyAndVisible()}loadImage(t){let e=t.getState();return e!=U.LOADED&&e!=U.ERROR&&t.addEventListener(P.CHANGE,this.boundHandleImageChange_),e==U.IDLE&&(t.load(),e=t.getState()),e==U.LOADED}renderIfReadyAndVisible(){let t=this.getLayer();t&&t.getVisible()&&t.getSourceState()==="ready"&&t.changed()}renderDeferred(t){}disposeInternal(){delete this.layer_,super.disposeInternal()}},em=ph;var yh=[],yr=null;function Fy(){yr=nt(1,1,void 0,{willReadFrequently:!0})}var _h=class extends em{constructor(t){super(t),this.container=null,this.renderedResolution,this.tempTransform=At(),this.pixelTransform=At(),this.inversePixelTransform=At(),this.context=null,this.deferredContext_=null,this.containerReused=!1,this.frameState=null}getImageData(t,e,i){yr||Fy(),yr.clearRect(0,0,1,1);let r;try{yr.drawImage(t,e,i,1,1,0,0,1,1),r=yr.getImageData(0,0,1,1).data}catch{return yr=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&&Gt(de(t.style.backgroundColor),de(i)))){let h=t.firstElementChild;te(h)&&(l=h.getContext("2d"))}if(l&&vd(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=Rt?io():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=le(i),s=Nn(i),o=Fn(i),a=kn(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);Ot(this.pixelTransform,t.size[0]/2,t.size[1]/2,1/o,1/o,s,-a/2,-l/2),so(this.inversePixelTransform,this.pixelTransform);let h=Cd(this.pixelTransform),c=this.getBackground(t);if(this.useContainer(e,h,c,a,l),!this.containerReused){let d=this.context.canvas;d.width!=a||d.height!=l?(d.width=a,d.height=l):this.context.clearRect(0,0,a,l),h!==d.style.transform&&(d.style.transform=h)}}dispatchRenderEvent_(t,e,i){let r=this.getLayer();if(r.hasListener(t)){let s=new la(t,this.inversePixelTransform,i,e);r.dispatchEvent(s)}}preRender(t,e){this.frameState=e,!e.declutter&&this.dispatchRenderEvent_(Ft.PRERENDER,t,e)}postRender(t,e){e.declutter||this.dispatchRenderEvent_(Ft.POSTRENDER,t,e)}renderDeferredInternal(t){}getRenderContext(t){return t.declutter&&!this.deferredContext_&&(this.deferredContext_=new ha),t.declutter?this.deferredContext_.getContext():this.context}renderDeferred(t){t.declutter&&(this.dispatchRenderEvent_(Ft.PRERENDER,this.context,t),t.declutter&&this.deferredContext_&&(this.deferredContext_.draw(this.context),this.deferredContext_.clear()),this.renderDeferredInternal(t),this.dispatchRenderEvent_(Ft.POSTRENDER,this.context,t))}getRenderTransform(t,e,i,r,s,o,a){let l=s/2,h=o/2,c=r/e,d=-c,f=-t[0]+a,g=-t[1];return Ot(this.tempTransform,l,h,c,d,-i,f,g)}disposeInternal(){delete this.frameState,super.disposeInternal()}},ua=_h;function xh(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 Ny(n,t,e){let i=n[e];return i?i.delete(t):!1}function im(n,t){let e=n.layerStatesArray[n.layerIndex];e.extent&&(t=Ne(t,Ce(e.extent,n.viewState.projection)));let i=e.layer.getRenderSource();if(!i.getWrapX()){let r=i.getTileGridForProjection(n.viewState.projection).getExtent();r&&(t=Ne(t,r))}return t}var Eh=class extends ua{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 qs(0,0,0,0),this.tempTileCoord_=Bn(0,0,0);let i=e.cacheSize!==void 0?e.cacheSize:512;this.tileCache_=new gh(i),this.sourceTileCache_=null,this.layerExtent=null,this.maxStaleKeys=i*.5}getTileCache(){return this.tileCache_}getSourceTileCache(){return this.sourceTileCache_||(this.sourceTileCache_=new gh(512)),this.sourceTileCache_}getOrCreateTile(t,e,i,r){let s=this.tileCache_,a=this.getLayer().getSource(),l=Vn(a,a.getKey(),t,e,i),h;if(s.containsKey(l))h=s.get(l);else{let c=r.viewState.projection,d=a.getProjection();if(h=a.getTile(t,e,i,r.pixelRatio,c,!d||Yn(d,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&&!pe(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 d=l.getTileCoordForCoordAndZ(r,c),f=this.getTile(c,d[1],d[2],e);if(!f||f.getState()!==D.LOADED)continue;let g=l.getOrigin(c),m=mt(l.getTileSize(c)),_=l.getResolution(c),p;if(f instanceof no||f instanceof oo)p=f.getImage();else if(f instanceof dh){if(p=ca(f.getData()),!p)continue}else continue;let y=Math.floor(h*((r[0]-g[0])/_-d[1]*m[0])),E=Math.floor(h*((g[1]-r[1])/_-d[2]*m[1])),v=Math.round(h*a.getGutterForProjection(o.projection));return this.getImageData(p,y+v,E+v)}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 d=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)),m=o.rotation,_=m?La(o.center,o.resolution,m,t.size):void 0;for(let p=i;p>=g;--p){let y=h.getTileRangeForExtentAndZ(e,p,this.tempTileRange_),E=h.getResolution(p);for(let v=y.minX;v<=y.maxX;++v)for(let x=y.minY;x<=y.maxY;++x){if(m&&!h.tileCoordIntersectsViewport([p,v,x],_))continue;let C=this.getTile(p,v,x,t);if(!C||!xh(r,C,p))continue;let A=C.getKey();if(d[A]=!0,C.getState()===D.IDLE&&!t.tileQueue.isKeyQueued(A)){let R=Bn(p,v,x,this.tempTileCoord_);t.tileQueue.enqueue([C,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=Vn(this.getLayer().getSource(),a[l],r,s,o);if(i.containsKey(h)){let c=i.peek(h);if(c.getState()===D.LOADED)return c.endTransition(Y(this)),xh(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 d=s.minY;d<=s.maxY;++d){let f=Vn(l,h,i,c,d),g=!1;if(a.containsKey(f)){let m=a.peek(f);m.getState()===D.LOADED&&(xh(r,m,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(),d=c.getTileGridForProjection(s),f=d.getZForResolution(o,c.zDirection),g=d.getResolution(f);this.updateStaleKeys(c.getKey());let m=t.extent,_=c.getTilePixelRatio(l);this.prepareContainer(t,e);let p=this.context.canvas.width,y=this.context.canvas.height;this.layerExtent=i.extent?Ce(i.extent,s):null,this.layerExtent&&(m=Ne(m,this.layerExtent));let E=g*p/2/_,v=g*y/2/_,x=[a[0]-E,a[1]-v,a[0]+E,a[1]+v],C={};this.renderedTiles.length=0;let T=h.getPreload();if(t.nextExtent&&this.enqueueTilesForNextExtent()){let M=d.getZForResolution(r.nextResolution,c.zDirection),W=im(t,t.nextExtent);this.enqueueTiles(t,W,M,C,T)}let A=im(t,m);if(this.enqueueTiles(t,A,f,C,0),T>0&&setTimeout(()=>{this.enqueueTiles(t,A,f-1,C,T-1)},0),!(f in C))return this.container;let R=Y(this),I=t.time;for(let M of C[f]){let W=M.getState();if(W===D.EMPTY)continue;let O=M.tileCoord;if(W===D.LOADED&&M.getAlpha(R,I)===1){M.endTransition(R);continue}if(W!==D.ERROR&&(this.renderComplete=!1),this.findStaleTile_(O,C)){Ny(C,M,f),t.animate=!0;continue}if(this.findAltTiles_(d,O,f+1,C))continue;let tt=d.getMinZoom();for(let it=f-1;it>=tt&&!this.findAltTiles_(d,O,it,C);--it);}let b=g/o*l/_,z=this.getRenderContext(t);Ot(this.tempTransform,p/2,y/2,b,b,0,-p/2,-y/2),this.layerExtent&&this.clipUnrotated(z,t,this.layerExtent),c.getInterpolate()||(z.imageSmoothingEnabled=!1),this.preRender(z,t);let X=Object.keys(C).map(Number);X.sort(Vt);let N=[],V=[],lt=[];for(let M=X.length-1;M>=0;--M){let W=X[M],O=c.getTilePixelSize(W,l,s),G=d.getResolution(W)/g,tt=O[0]*G*b,it=O[1]*G*b,Ct=d.getTileCoordForCoordAndZ(le(x),W),L=d.getTileCoordExtent(Ct),Jt=dt(this.tempTransform,[_*(L[0]-x[0])/g,_*(x[3]-L[3])/g]),vt=_*c.getGutterForProjection(s);for(let ot of C[W]){if(ot.getState()!==D.LOADED)continue;let Oe=ot.tileCoord,Ji=Ct[1]-Oe[1],re=Math.round(Jt[0]-(Ji-1)*tt),wr=Ct[2]-Oe[2],Ts=Math.round(Jt[1]-(wr-1)*it),Qi=Math.round(Jt[0]-Ji*tt),tn=Math.round(Jt[1]-wr*it),An=re-Qi,ii=Ts-tn,Mn=W===f;if(Mn&&ot.inTransition(R)){lt.push({tile:ot,x:Qi,y:tn,w:An,h:ii,gutter:vt}),this.renderedTiles.unshift(ot),this.updateUsedTiles(t.usedTiles,c,ot);continue}let Cr=[Qi,tn,Qi+An,tn+ii],vr=[];for(let Ii=0,Sr=N.length;Ii<Sr;++Ii)W<V[Ii]&&ht(Cr,N[Ii])&&vr.push(N[Ii]);let Is;vr.length>0&&(Is=yu(Cr,vr)),N.push(Cr),V.push(W),this.drawTile(ot,t,Qi,tn,An,ii,vt,Mn,Is),this.renderedTiles.unshift(ot),this.updateUsedTiles(t.usedTiles,c,ot)}}for(let M=0,W=lt.length;M<W;++M){let{tile:O,x:$,y:G,w:tt,h:it,gutter:Ct}=lt[M];this.drawTile(O,t,$,G,tt,it,Ct,!0,void 0)}if(this.renderedResolution=g,this.extentChanged=!this.renderedExtent_||!on(this.renderedExtent_,x),this.renderedExtent_=x,this.renderedPixelRatio=l,this.postRender(this.context,t),this.layerExtent&&z.restore(),z.imageSmoothingEnabled=!0,this.renderComplete){let M=(W,O)=>{let $=Y(c),G=O.wantedTiles[$],tt=G?Object.keys(G).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 dh){if(c=ca(t.getData()),!c)throw new Error("Rendering array data is not yet supported")}else c=this.getTileImage(t);if(!c)return;let d=this.getRenderContext(e),f=Y(this),g=e.layerStatesArray[e.layerIndex],m=g.opacity*(l?t.getAlpha(f,e.time):1),_=m!==d.globalAlpha;_&&(d.save(),d.globalAlpha=m);let p=c.width-2*a,y=c.height-2*a;if(h){let E=p/s,v=y/o;for(let x=0,C=h.length;x<C;++x){let T=h[x],A=T[0],R=T[1],I=T[2]-T[0],b=T[3]-T[1];d.drawImage(c,a+(A-i)*E,a+(R-r)*v,I*E,b*v,A,R,I,b)}}else d.drawImage(c,a,a,p,y,i,r,s,o);_&&d.restore(),m!==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}},nm=Eh;var xs={PRELOAD:"preload",USE_INTERIM_TILES_ON_ERROR:"useInterimTilesOnError"};var wh=class extends Rn{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(xs.PRELOAD)}setPreload(t){this.set(xs.PRELOAD,t)}getUseInterimTilesOnError(){return this.get(xs.USE_INTERIM_TILES_ON_ERROR)}setUseInterimTilesOnError(t){this.set(xs.USE_INTERIM_TILES_ON_ERROR,t)}getData(t){return super.getData(t)}},rm=wh;var Ch=class extends rm{constructor(t){super(t)}createRenderer(){return new nm(this,{cacheSize:this.getCacheSize()})}},vh=Ch;var Sh=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){}},da=Sh;var Es={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},ws=[Es.FILL],Qe=[Es.STROKE],vi=[Es.BEGIN_PATH],Rh=[Es.CLOSE_PATH],F=Es;var Th=class extends da{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],pe(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],d=t[e+1],f=this.tmpCoordinate_,g=!0,m,_,p;for(m=e+r;m<i;m+=r)f[0]=t[m],f[1]=t[m+1],p=Ps(h,f),p!==_?(g&&(a[l++]=c,a[l++]=d,g=!1),a[l++]=f[0],a[l++]=f[1]):p===xt.INTERSECTING?(a[l++]=f[0],a[l++]=f[1],g=!1):g=!0,c=f[0],d=f[1],_=p;return(s&&g||m===e+r)&&(a[l++]=c,a[l++]=d),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,d,f,g;switch(o){case"MultiPolygon":h=t.getOrientedFlatCoordinates(),f=[];let m=t.getEndss();g=0;for(let _=0,p=m.length;_<p;++_){let y=[];g=this.drawCustomCoordinates_(h,g,m[_],a,y),f.push(y)}this.instructions.push([F.CUSTOM,l,f,t,i,Wr,s]),this.hitDetectionInstructions.push([F.CUSTOM,l,f,t,r||i,Wr,s]);break;case"Polygon":case"MultiLineString":d=[],h=o=="Polygon"?t.getOrientedFlatCoordinates():t.getFlatCoordinates(),g=this.drawCustomCoordinates_(h,0,t.getEnds(),a,d),this.instructions.push([F.CUSTOM,l,d,t,i,tr,s]),this.hitDetectionInstructions.push([F.CUSTOM,l,d,t,r||i,tr,s]);break;case"LineString":case"Circle":h=t.getFlatCoordinates(),c=this.appendFlatLineCoordinates(h,0,h.length,a,!1,!1),this.instructions.push([F.CUSTOM,l,c,t,i,Ue,s]),this.hitDetectionInstructions.push([F.CUSTOM,l,c,t,r||i,Ue,s]);break;case"MultiPoint":h=t.getFlatCoordinates(),c=this.appendFlatPointCoordinates(h,a),c>l&&(this.instructions.push([F.CUSTOM,l,c,t,i,Ue,s]),this.hitDetectionInstructions.push([F.CUSTOM,l,c,t,r||i,Ue,s]));break;case"Point":h=t.getFlatCoordinates(),this.coordinates.push(h[0],h[1]),c=this.coordinates.length,this.instructions.push([F.CUSTOM,l,c,t,i,void 0,s]),this.hitDetectionInstructions.push([F.CUSTOM,l,c,t,r||i,void 0,s]);break;default:}this.endGeometry(e)}beginGeometry(t,e,i){this.beginGeometryInstruction1_=[F.BEGIN_GEOMETRY,e,0,t,i],this.instructions.push(this.beginGeometryInstruction1_),this.beginGeometryInstruction2_=[F.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==F.END_GEOMETRY?o=e:s==F.BEGIN_GEOMETRY&&(r[2]=e,qu(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=Ht(i||Tt)??void 0}else e.fillStyle=void 0;return e}strokeStyleToState(t,e={}){if(t){let i=t.getColor();e.strokeStyle=Ht(i||Wt);let r=t.getLineCap();e.lineCap=r!==void 0?r:Ve;let s=t.getLineDash();e.lineDash=s?s.slice():qt;let o=t.getLineDashOffset();e.lineDashOffset=o||$t;let a=t.getLineJoin();e.lineJoin=a!==void 0?a:je;let l=t.getWidth();e.lineWidth=l!==void 0?l:pi;let h=t.getMiterLimit();e.miterLimit=h!==void 0?h:gi;let c=t.getOffset();e.strokeOffset=c??pf,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=[F.SET_FILL_STYLE,e];return typeof e!="string"&&i.push(t.fillPatternScale),i}applyStroke(t){this.instructions.push(this.createStroke(t))}createStroke(t){return[F.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&&!Gt(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=[F.END_GEOMETRY,t];this.instructions.push(e),this.hitDetectionInstructions.push(e)}getBufferedMaxExtent(){if(!this.bufferedMaxExtent_&&(this.bufferedMaxExtent_=Os(this.maxExtent),this.maxLineWidth>0)){let t=this.resolution*(this.maxLineWidth+1)/2;On(this.bufferedMaxExtent_,t,this.bufferedMaxExtent_)}return this.bufferedMaxExtent_}},ti=Th;var Ih=class extends ti{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&&!pe(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([F.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([F.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||pe(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([F.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([F.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}},sm=Ih;var bh=class extends ti{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([F.MOVE_TO_LINE_TO,o,a,s*this.pixelRatio]),this.hitDetectionInstructions.push([F.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([F.SET_STROKE_STYLE,Wt,r.lineWidth,r.lineCap,r.lineJoin,r.miterLimit,qt,$t],vi);let l=t.getFlatCoordinates(),h=t.getStride();this.drawFlatCoordinates_(l,0,l.length,h,a),this.hitDetectionInstructions.push(Qe),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([F.SET_STROKE_STYLE,Wt,r.lineWidth,r.lineCap,r.lineJoin,r.miterLimit,qt,$t],vi);let l=t.getEnds(),h=t.getFlatCoordinates(),c=t.getStride(),d=0;for(let f=0,g=l.length;f<g;++f)d=this.drawFlatCoordinates_(h,d,l[f],c,a);this.hitDetectionInstructions.push(Qe),this.endGeometry(e)}finish(){let t=this.state;return t.lastStroke!=null&&t.lastStroke!=this.coordinates.length&&this.instructions.push(Qe),this.reverseHitDetectionInstructions(),this.state=null,super.finish()}applyStroke(t){t.lastStroke!=null&&t.lastStroke!=this.coordinates.length&&(this.instructions.push(Qe),t.lastStroke=this.coordinates.length),t.lastStroke=0,super.applyStroke(t),this.instructions.push(vi)}},om=bh;var Lh=class extends ti{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(vi),this.hitDetectionInstructions.push(vi);for(let c=0;c<h;++c){let d=i[c],f=this.coordinates.length,g=this.appendFlatLineCoordinates(t,e,d,r,!0,!l);this.instructions.push([F.MOVE_TO_LINE_TO,f,g,s*this.pixelRatio,!0]),this.hitDetectionInstructions.push([F.MOVE_TO_LINE_TO,f,g,s,!0]),l&&(this.instructions.push(Rh),this.hitDetectionInstructions.push(Rh)),e=d}return a&&(this.instructions.push(ws),this.hitDetectionInstructions.push(ws)),l&&(this.instructions.push(Qe),this.hitDetectionInstructions.push(Qe)),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([F.SET_FILL_STYLE,Tt]),r.strokeStyle!==void 0&&this.hitDetectionInstructions.push([F.SET_STROKE_STYLE,Wt,r.lineWidth,r.lineCap,r.lineJoin,r.miterLimit,qt,$t]);let l=t.getFlatCoordinates(),h=t.getStride(),c=this.coordinates.length;this.appendFlatLineCoordinates(l,0,l.length,h,!1,!1);let d=[F.CIRCLE,c,a];this.instructions.push(vi,d),this.hitDetectionInstructions.push(vi,d),r.fillStyle!==void 0&&(this.instructions.push(ws),this.hitDetectionInstructions.push(ws)),r.strokeStyle!==void 0&&(this.instructions.push(Qe),this.hitDetectionInstructions.push(Qe)),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([F.SET_FILL_STYLE,Tt]),r.strokeStyle!==void 0&&this.hitDetectionInstructions.push([F.SET_STROKE_STYLE,Wt,r.lineWidth,r.lineCap,r.lineJoin,r.miterLimit,qt,$t]);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([F.SET_FILL_STYLE,Tt]),r.strokeStyle!==void 0&&this.hitDetectionInstructions.push([F.SET_STROKE_STYLE,Wt,r.lineWidth,r.lineCap,r.lineJoin,r.miterLimit,qt,$t]);let l=t.getEndss(),h=t.getOrientedFlatCoordinates(),c=t.getStride(),d=0;for(let f=0,g=l.length;f<g;++f)d=this.drawFlatCoordinatess_(h,d,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]=zi(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}},Ah=Lh;var Mh=0,Ph=1;function zy(n,t,e,i,r,s,o,a){let l=o-r,h=a-s,c=0,d=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 m=f;f=g,g=m}if(f>c&&(c=f),g<d&&(d=g),c>d)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 m=f;f=g,g=m}if(f>c&&(c=f),g<d&&(d=g),c>d)return!1}return Mh=c,Ph=d,!0}function am(n,t,e,i){let r=i[0],s=i[1],o=i[2],a=i[3],l=[],h=[],c=!1,d,f,g=0;for(let m=0,_=t.length;m<_;++m){let p=t[m],y=n[g],E=n[g+1],v=!1;for(let x=g+e;x<p;x+=e){let C=n[x],T=n[x+1];if(zy(r,s,o,a,y,E,C,T)){let A=C-y,R=T-E,I=y+Mh*A,b=E+Mh*R,z=y+Ph*A,X=E+Ph*R;c&&v&&I===d&&b===f?l.push(z,X):(c&&h.push(l.length),l.push(I,b,z,X),c=!0),d=z,f=X,v=!0}y=C,E=T}g=p}return c&&h.push(l.length),{flatCoordinates:l,ends:h}}function lm(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),d=t[o+r],f=t[o+r+1],g=Math.sqrt((d-h)*(d-h)+(f-c)*(f-c));if(a+=g,a>=n){let m=(n-a+g)/g,_=zt(h,d,m),p=zt(c,f,m);l.push(_,p),s.push(l),l=[_,p],a==n&&(o+=r),a=0}else if(a<n)l.push(t[o+r],t[o+r+1]),o+=r;else{let m=g-a,_=zt(h,d,m/g),p=zt(c,f,m/g);l.push(_,p),s.push(l),l=[_,p],a=0,o+=r}}return a>0&&s.push(l),s}function cm(n,t,e,i,r){let s=e,o=e,a=0,l=0,h=e,c,d,f,g,m,_,p,y,E,v;for(d=e;d<i;d+=r){let x=t[d],C=t[d+1];m!==void 0&&(E=x-m,v=C-_,g=Math.sqrt(E*E+v*v),p!==void 0&&(l+=f,c=Math.acos((p*E+y*v)/(f*g)),c>n&&(l>a&&(a=l,s=h,o=d),l=0,h=d-r)),f=g,p=E,y=v),m=x,_=C}return l+=g,l>a?[h,d]:[s,o]}var Cs={left:0,center:.5,right:1,top:0,middle:.5,hanging:.2,alphabetic:.8,ideographic:.8,bottom:1},Oh=class extends ti{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[Tt]={fillStyle:Tt},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,d=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 y=t.getEndss();g=[];for(let E=0,v=y.length;E<v;++E)g.push(y[E][0])}if((h=="LineString"||h=="MultiLineString")&&!Fe(this.getBufferedMaxExtent(),f)){let y=am(c,g,d,this.getBufferedMaxExtent());if(c=y.flatCoordinates,g=y.ends,d=2,g.length===0)return}this.beginGeometry(t,e,i);let m=o.repeat,_=m?void 0:o.textAlign,p=0;for(let y=0,E=g.length;y<E;++y){let v;m?v=lm(m*this.resolution,c,p,g[y],d):v=[c.slice(p,g[y])];for(let x=0,C=v.length;x<C;++x){let T=v[x],A=0,R=T.length;if(_==null){let b=cm(o.maxAngle,T,0,T.length,2);A=b[0],R=b[1]}for(let b=A;b<R;b+=d)a.push(T[b],T[b+1]);let I=a.length;p=g[y],this.drawChars_(l,I),l=I}}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(),d=2;break;case"Polygon":c=t.getFlatInteriorPoint(),o.overflow||f.push(c[2]/this.resolution),d=3;break;case"MultiPolygon":let x=t.getFlatInteriorPoints();c=[];for(let C=0,T=x.length;C<T;C+=3)o.overflow||f.push(x[C+2]/this.resolution),c.push(x[C],x[C+1]);if(c.length===0)return;d=2;break;default:}let g=this.appendFlatPointCoordinates(c,d);if(g===l)return;if(f&&(g-l)/2!==c.length/d){let x=l/2;f=f.filter((C,T)=>{let A=a[(x+T)*2]===c[T*d]&&a[(x+T)*2+1]===c[T*d+1];return A||--x,A})}this.saveTextStates_();let m=o.backgroundFill?this.createFill(this.fillStyleToState(o.backgroundFill)):null,_=o.backgroundStroke?this.createStroke(this.strokeStyleToState(o.backgroundStroke)):null;this.beginGeometry(t,e,i);let p=o.padding;if(p!=mi&&(o.scale[0]<0||o.scale[1]<0)){let x=o.padding[0],C=o.padding[1],T=o.padding[2],A=o.padding[3];o.scale[0]<0&&(C=-C,A=-A),o.scale[1]<0&&(x=-x,T=-T),p=[x,C,T,A]}let y=this.pixelRatio;this.instructions.push([F.DRAW_IMAGE,l,g,null,NaN,NaN,NaN,1,0,0,this.textRotateWithView_,this.textRotation_,[1,1],NaN,this.declutterMode_,this.declutterImageWithText_,p==mi?mi:p.map(function(x){return x*y}),m,_,this.text_,this.textKey_,this.strokeKey_,this.fillKey_,this.textOffsetX_,this.textOffsetY_,f]);let E=1/y,v=m?m.slice(0):null;v&&(v[1]=Tt),this.hitDetectionInstructions.push([F.DRAW_IMAGE,l,g,null,NaN,NaN,NaN,1,0,0,this.textRotateWithView_,this.textRotation_,[E,E],NaN,this.declutterMode_,this.declutterImageWithText_,p,v,_,this.text_,this.textKey_,this.strokeKey_,this.fillKey_?Tt: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||Ki,justify:e.justify,textBaseline:e.textBaseline||En,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=Cs[r.textBaseline],c=this.textOffsetX_*l,d=this.textOffsetY_*l,f=this.text_,g=i?i.lineWidth*Math.abs(r.scale[0])/2:0;this.instructions.push([F.DRAW_CHARS,t,e,h,r.overflow,a,r.maxAngle,l,d,s,g*l,f,o,1,this.declutterMode_,this.textKeepUpright_,c]),this.hitDetectionInstructions.push([F.DRAW_CHARS,t,e,h,r.overflow,a&&Tt,r.maxAngle,l,d,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=Ht(o.getColor()||Tt)):(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(),p=a.getLineDashOffset(),y=a.getWidth(),E=a.getMiterLimit();s.lineCap=a.getLineCap()||Ve,s.lineDash=_?_.slice():qt,s.lineDashOffset=p===void 0?$t:p,s.lineJoin=a.getLineJoin()||je,s.lineWidth=y===void 0?pi:y,s.miterLimit=E===void 0?gi:E,s.strokeStyle=Ht(a.getColor()||Wt)}i=this.textState_;let l=t.getFont()||bo;_f(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()||En,i.backgroundFill=t.getBackgroundFill(),i.backgroundStroke=t.getBackgroundStroke(),i.padding=t.getPadding()||mi,i.scale=h===void 0?[1,1]:h;let c=t.getOffsetX(),d=t.getOffsetY(),f=t.getRotateWithView(),g=t.getKeepUpright(),m=t.getRotation();this.text_=t.getText()||"",this.textOffsetX_=c===void 0?0:c,this.textOffsetY_=d===void 0?0:d,this.textRotateWithView_=f===void 0?!1:f,this.textKeepUpright_=g===void 0?!0:g,this.textRotation_=m===void 0?0:m,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}},hm=Oh;var Gy={Circle:Ah,Default:ti,Image:sm,LineString:om,Polygon:Ah,Text:hm},Dh=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=Gy[e];s=new o(this.tolerance_,this.maxExtent_,this.resolution_,this.pixelRatio_),r[e]=s}return s}},um=Dh;function dm(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 fa(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],d=n[e-2*i+1],f,g,m,_,p,y,E,v,x=0;for(let C=t;C<e;C+=i){m=f,_=g,p=void 0,y=void 0,C+i<e&&(p=n[C+i],y=n[C+i+1]),s&&C===t&&(m=c,_=d),s&&C===e-i&&(p=l,y=h),f=n[C],g=n[C+1],[E,v]=Xy(f,g,m,_,p,y,r),o[x++]=E,o[x++]=v;for(let T=2;T<a;T++)o[x++]=n[C+T]}return o.length!=x&&(o.length=x),o}function Xy(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,d=l/h;if(a=-d,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=Ru([n,t],[e,i],[r,s]);if(Math.cos(f)>.998)return[n+c*o,t+d*o];let g=Math.cos(f/2),m=Math.sin(f/2),_=m*a+g*l,p=-g*a+m*l,y=_*(1/m),E=p*(1/m);return[n+y*o,t+E*o]}function ga(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],d=n[o],f=n[o+1],g=n[o+t],m=n[o+t+1],_=(m-f)*(h-a)-(g-d)*(c-l);if(_===0)continue;let p=((g-d)*(l-f)-(m-f)*(a-d))/_,y=((h-a)*(l-f)-(c-l)*(a-d))/_;if(p>0&&p<1&&y>0&&y<1){let E=a+p*(h-a),v=l+p*(c-l);n[i+t]=E,n[i+t+1]=v,n.splice(i+2*t,o-i-t);break}}}return n}var kh;function Wy(){return kh||(kh=new Intl.Segmenter(void 0,{granularity:"grapheme"})),kh}function fm(n,t,e,i,r,s,o,a,l,h,c,d,f=!0){let g=n[t],m=n[t+1],_=0,p=0,y=0,E=0;function v(){_=g,p=m,t+=i,g=n[t],m=n[t+1],E+=y,y=Math.sqrt((g-_)*(g-_)+(m-p)*(m-p))}do v();while(t<e-i&&E+y<s);let x=y===0?0:(s-E)/y,C=zt(_,g,x),T=zt(p,m,x),A=t-i,R=E,I=s+a*l(h,r,c);for(;t<e-i&&E+y<I;)v();x=y===0?0:(I-E)/y;let b=zt(_,g,x),z=zt(p,m,x),X=!1;if(f)if(d){let O=[C,T,b,z];fo(O,0,4,2,d,O,O),X=O[0]>O[2]}else X=C>b;let N=Math.PI,V=[],lt=A+i===t;t=A,y=0,E=R,g=n[t],m=n[t+1];let M;if(lt){v(),M=Math.atan2(m-p,g-_),X&&(M+=M>0?-N:N);let O=(b+C)/2,$=(z+T)/2;return V[0]=[O,$,(I-s)/2,M,r],V}r=r.replace(/\n/g," ");let W=Array.from(Wy().segment(r),O=>O.segment);for(let O=0,$=W.length;O<$;){v();let G=Math.atan2(m-p,g-_);if(X&&(G+=G>0?-N:N),M!==void 0){let vt=G-M;if(vt+=vt>N?-2*N:vt<-N?2*N:0,Math.abs(vt)>o)return null}M=G;let tt=O,it=0;for(;O<$;++O){let vt=X?$-O-1:O,ot=a*l(h,W[vt],c);if(t+i<e&&E+y<s+it+ot/2)break;it+=ot}if(O===tt)continue;let Ct=(X?W.slice($-O,$-tt):W.slice(tt,O)).join("");x=y===0?0:(s+it/2-E)/y;let L=zt(_,g,x),Jt=zt(p,m,x);V.push([L,Jt,it/2,G,Ct]),s+=it}return V}var xr=ut(),Hi=[],Si=[],Ri=[],qi=[];function gm(n){return n[3].declutterBox}var mm=new RegExp("[\u0591-\u08FF\uFB1D-\uFDFF\uFE70-\uFEFC\u0800-\u0FFF\uE800-\uEFFF]");function Fh(n,t){return t==="start"?t=mm.test(n)?"right":"left":t==="end"&&(t=mm.test(n)?"left":"right"),Cs[t]}function Uy(n,t,e){return e>0&&n.push(`7-`,""),n.push(t,""),n}function Yy(n,t,e){return e%2===0&&(n+=t),n}var Nh=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_=At(),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 ha: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],d=l.justify?Cs[l.justify]:Fh(Array.isArray(t)?t[0]:t,l.textAlign||Ki),f=r&&o.lineWidth?o.lineWidth:0,g=Array.isArray(t)?t:String(t).split(`8-`).reduce(Uy,[]),{width:m,height:_,widths:p,heights:y,lineWidths:E}=Ef(l,g),v=m+f,x=[],C=(v+2)*c[0],T=(_+f)*c[1],A={width:C<0?Math.floor(C):Math.ceil(C),height:T<0?Math.floor(T):Math.ceil(T),contextInstructions:x};(c[0]!=1||c[1]!=1)&&x.push("scale",c),r&&(x.push("strokeStyle",o.strokeStyle),x.push("lineWidth",f),x.push("lineCap",o.lineCap),x.push("lineJoin",o.lineJoin),x.push("miterLimit",o.miterLimit),x.push("setLineDash",[o.lineDash]),x.push("lineDashOffset",o.lineDashOffset)),i&&x.push("fillStyle",a.fillStyle),x.push("textBaseline","middle"),x.push("textAlign","center");let R=.5-d,I=d*v+R*f,b=[],z=[],X=0,N=0,V=0,lt=0,M;for(let W=0,O=g.length;W<O;W+=2){let $=g[W];if($===`9-`){N+=X,X=0,I=d*v+R*f,++lt;continue}let G=g[W+1]||l.font;G!==M&&(r&&b.push("font",G),i&&z.push("font",G),M=G),X=Math.max(X,y[V]);let tt=[$,I+R*p[V]+d*(p[V]-E[lt]),.5*(f+X)+N];I+=p[V],r&&b.push("strokeText",tt),i&&z.push("fillText",tt),++V}return Array.prototype.push.apply(x,b),Array.prototype.push.apply(x,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,d,f,g,m,_,p){a*=f[0],l*=f[1];let y=i-a,E=r-l,v=s+h>t?t-h:s,x=o+c>e?e-c:o,C=m[3]+v*f[0]+m[1],T=m[0]+x*f[1]+m[2],A=y-m[3],R=E-m[0];(_||d!==0)&&(Hi[0]=A,qi[0]=A,Hi[1]=R,Si[1]=R,Si[0]=A+C,Ri[0]=Si[0],Ri[1]=R+T,qi[1]=Ri[1]);let I;return d!==0?(I=Ot(At(),i,r,1,1,d,-i,-r),dt(I,Hi),dt(I,Si),dt(I,Ri),dt(I,qi),Qt(Math.min(Hi[0],Si[0],Ri[0],qi[0]),Math.min(Hi[1],Si[1],Ri[1],qi[1]),Math.max(Hi[0],Si[0],Ri[0],qi[0]),Math.max(Hi[1],Si[1],Ri[1],qi[1]),xr)):Qt(Math.min(A,A+C),Math.min(R,R+T),Math.max(A,A+C),Math.max(R,R+T),xr),g&&(y=Math.round(y),E=Math.round(E)),{drawImageX:y,drawImageY:E,drawImageW:v,drawImageH:x,originX:h,originY:c,declutterBox:{minX:xr[0],minY:xr[1],maxX:xr[2],maxY:xr[3],value:p},canvasTransform:I,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,Hi,Si,Ri,qi,o,a),wf(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=Fh(Array.isArray(t)?t[0]:t,s.textAlign||Ki),c=Cs[s.textBaseline||En],d=a&&a.lineWidth?a.lineWidth:0,f=o.width/l-2*s.scale[0],g=h*f+2*(.5-h)*d,m=c*o.height/l+2*(.5-c)*d;return{label:o,anchorX:g,anchorY:m}}execute_(t,e,i,r,s,o,a,l){let h=this.zIndexContext_,c;this.pixelCoordinates_&&Gt(i,this.renderedTransform_)?c=this.pixelCoordinates_:(this.pixelCoordinates_||(this.pixelCoordinates_=[]),c=jt(this.coordinates,0,this.coordinates.length,2,i,this.pixelCoordinates_),wd(this.renderedTransform_,i));let d=0,f=r.length,g=0,m,_=[],p,y,E,v,x,C,T,A,R,I,b,z,X,N=0,V=0,lt=this.coordinateCache_,M=this.viewRotation_,W=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,G,tt,it,Ct;for(;d<f;){let L=r[d];switch(L[0]){case F.BEGIN_GEOMETRY:G=L[1],Ct=L[3],G.getGeometry()?a!==void 0&&!ht(a,Ct.getExtent())?d=L[2]+1:++d:d=L[2],h&&(h.zIndex=L[4]);break;case F.BEGIN_PATH:N>$&&(this.fill_(t),N=0),V>$&&(t.stroke(),V=0),!N&&!V&&(t.beginPath(),x=NaN,C=NaN),++d;break;case F.CIRCLE:g=L[1],E=L[2]??0;let vt=c[g],ot=c[g+1],Oe=c[g+2]-E,Ji=c[g+3]-E,re=Oe-vt,wr=Ji-ot,Ts=Math.sqrt(re*re+wr*wr);t.moveTo(vt+Ts,ot),t.arc(vt,ot,Ts,0,2*Math.PI,!0),++d;break;case F.CLOSE_PATH:t.closePath(),++d;break;case F.CUSTOM:g=L[1],m=L[2];let Qi=L[3],tn=L[4],An=L[5];O.geometry=Qi,O.feature=G,d in lt||(lt[d]=[]);let ii=lt[d];An?An(c,g,m,2,ii):(ii[0]=c[g],ii[1]=c[g+1],ii.length=2),h&&(h.zIndex=L[6]),tn(ii,O),++d;break;case F.DRAW_IMAGE:g=L[1],m=L[2],R=L[3],p=L[4],y=L[5];let Mn=L[6],Cr=L[7],vr=L[8],Is=L[9],Ii=L[10],Sr=L[11],Nm=L[12],bs=L[13];v=L[14]||"declutter";let Rr=L[15];if(!R&&L.length>=20){I=L[19],b=L[20],z=L[21],X=L[22];let St=this.drawLabelWithPointPlacement_(I,b,z,X);R=St.label,L[3]=R;let De=L[23];p=(St.anchorX-De)*this.pixelRatio,L[4]=p;let se=L[24];y=(St.anchorY-se)*this.pixelRatio,L[5]=y,Mn=R.height,L[6]=Mn,bs=R.width,L[13]=bs}let ya;L.length>25&&(ya=L[25]);let xa,Ls,As;L.length>17?(xa=L[16],Ls=L[17],As=L[18]):(xa=mi,Ls=null,As=null),Ii&&W?Sr+=M:!Ii&&!W&&(Sr-=M);let zm=0;for(;g<m;g+=2){if(ya&&ya[zm++]<bs/this.pixelRatio)continue;let St=this.calculateImageOrLabelDimensions_(R.width,R.height,c[g],c[g+1],bs,Mn,p,y,vr,Is,Sr,Nm,s,xa,!!Ls||!!As,G),De=[t,e,R,St,Cr,Ls,As];if(l){let se,ke,oe;if(Rr){let gt=m-g;if(!Rr[gt]){Rr[gt]={args:De,declutterMode:v};continue}let Kt=Rr[gt];se=Kt.args,ke=Kt.declutterMode,delete Rr[gt],oe=gm(se)}let ni,ri;if(se&&(ke!=="declutter"||!l.collides(oe))&&(ni=!0),(v!=="declutter"||!l.collides(St.declutterBox))&&(ri=!0),ke==="declutter"&&v==="declutter"){let gt=ni&&ri;ni=gt,ri=gt}ni&&(ke!=="none"&&l.insert(oe),this.replayImageOrLabel_.apply(this,se)),ri&&(v!=="none"&&l.insert(St.declutterBox),this.replayImageOrLabel_.apply(this,De))}else this.replayImageOrLabel_.apply(this,De)}++d;break;case F.DRAW_CHARS:let nu=L[1],ru=L[2],Ea=L[3],Gm=L[4];X=L[5];let Xm=L[6],su=L[7],ou=L[8];z=L[9];let wa=L[10];I=L[11],Array.isArray(I)&&(I=I.reduce(Yy,"")),b=L[12];let au=[L[13],L[13]];v=L[14]||"declutter";let Wm=L[15],lu=L[16],Ca=this.textStates[b],Tr=Ca.font,Ir=[Ca.scale[0]*su,Ca.scale[1]*su],br;Tr in this.widths_?br=this.widths_[Tr]:(br={},this.widths_[Tr]=br);let cu=dm(c,nu,ru,2),hu=Math.abs(Ir[0])*jl(Tr,I,br);if(Gm||hu<=cu){let St=this.textStates[b].textAlign,De=(cu-hu)*Fh(I,St),se=fm(c,nu,ru,2,I,De,Xm,Math.abs(Ir[0]),jl,Tr,br,W?0:this.viewRotation_,Wm);t:if(se){let ke=[],oe,ni,ri,gt,Kt;if(z)for(oe=0,ni=se.length;oe<ni;++oe){Kt=se[oe],ri=Kt[4],gt=this.createLabel(ri,b,"",z),p=Kt[2]+(Ir[0]<0?-wa:wa)-lu,y=Ea*gt.height+(.5-Ea)*2*wa*Ir[1]/Ir[0]-ou;let si=this.calculateImageOrLabelDimensions_(gt.width,gt.height,Kt[0],Kt[1],gt.width,gt.height,p,y,0,0,Kt[3],au,!1,mi,!1,G);if(l&&v==="declutter"&&l.collides(si.declutterBox))break t;ke.push([t,e,gt,si,1,null,null])}if(X)for(oe=0,ni=se.length;oe<ni;++oe){Kt=se[oe],ri=Kt[4],gt=this.createLabel(ri,b,X,""),p=Kt[2]-lu,y=Ea*gt.height-ou;let si=this.calculateImageOrLabelDimensions_(gt.width,gt.height,Kt[0],Kt[1],gt.width,gt.height,p,y,0,0,Kt[3],au,!1,mi,!1,G);if(l&&v==="declutter"&&l.collides(si.declutterBox))break t;ke.push([t,e,gt,si,1,null,null])}l&&v!=="none"&&l.load(ke.map(gm));for(let si=0,Um=ke.length;si<Um;++si)this.replayImageOrLabel_.apply(this,ke[si])}}++d;break;case F.END_GEOMETRY:if(o!==void 0){G=L[1];let St=o(G,Ct,v);if(St)return St}++d;break;case F.FILL:$?N++:this.fill_(t),++d;break;case F.MOVE_TO_LINE_TO:g=L[1],m=L[2],E=L[3];let en,Lr,Ms;if(E){let De=(L[4]??!1)||Math.abs(c[g]-c[m-2])<1e-6&&Math.abs(c[g+1]-c[m-1])<1e-6;fa(c,g,m,2,E,De,_),ga(_,2,De),en=_,Lr=0,Ms=en.length}else en=c,Lr=g,Ms=m;tt=en[Lr],it=en[Lr+1],t.moveTo(tt,it),x=tt+.5|0,C=it+.5|0;for(let St=Lr+2;St<Ms;St+=2)tt=en[St],it=en[St+1],T=tt+.5|0,A=it+.5|0,(St==Ms-2||T!==x||A!==C)&&(t.lineTo(tt,it),x=T,C=A);++d;break;case F.SET_FILL_STYLE:this.alignAndScaleFill_=L[2],N?(this.fill_(t),N=0,V&&(t.stroke(),V=0)):V&&L[1]&&(t.stroke(),V=0),t.fillStyle=L[1],++d;break;case F.SET_STROKE_STYLE:N&&L[1]&&(this.fill_(t),N=0),V&&(t.stroke(),V=0),this.setStrokeStyle_(t,L),++d;break;case F.STROKE:$?V++:t.stroke(),++d;break;default:++d;break}}N&&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)}},pm=Nh;var $i=["Polygon","Circle","LineString","Image","Text","Default"],Xh=["Image","Text"],_m=$i.filter(n=>!Xh.includes(n)),ym=!1,xm=!1;function Ky(){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};ym={[t(!0)]:!0,[t(!1)]:!1,[t(void 0)]:void 0}[n],xm=!0}var Gh=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_=At(),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 pm(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){xm===!1&&Ky(),r=Math.round(r);let a=r*2+1,l=Ot(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:ym}));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 d;this.renderBuffer_!==void 0&&(d=ut(),an(d,t),On(d,e*(this.renderBuffer_+r),d));let f=Zy(r),g;function m(C,T,A){let R=c.getImageData(0,0,a,a).data;for(let I=0,b=f.length;I<b;I++)if(R[f[I]]>0){if(!o||A==="none"||g!=="Image"&&g!=="Text"||o.includes(C)){let z=(f[I]-3)/4,X=r-z%a,N=r-(z/a|0),V=s(C,T,X*X+N*N);if(V)return V}c.clearRect(0,0,a,a);break}}let _=Object.keys(this.executorsByZIndex_).map(Number);_.sort(Vt);let p,y,E,v,x;for(p=_.length-1;p>=0;--p){let C=_[p].toString();for(E=this.executorsByZIndex_[C],y=$i.length-1;y>=0;--y)if(g=$i[y],v=E[g],v!==void 0&&(x=v.executeHitDetection(c,l,i,m,d),x))return x}}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 jt(a,0,8,2,t,a),a}isEmpty(){return xe(this.executorsByZIndex_)}execute(t,e,i,r,s,o,a){let l=Object.keys(this.executorsByZIndex_).map(Number);l.sort(a?Hu:Vt),o=o||$i;let h=$i.length;for(let c=0,d=l.length;c<d;++c){let f=l[c].toString(),g=this.executorsByZIndex_[f];for(let m=0,_=o.length;m<_;++m){let p=o[m],y=g[p];if(y!==void 0){let E=a===null?void 0:y.getZIndexContext(),v=E?E.getContext():t,x=this.maxExtent_&&p!=="Image"&&p!=="Text";if(x&&(v.save(),this.clip(v,i)),!E||p==="Text"||p==="Image"?y.execute(v,e,i,r,s,a):E.pushFunction(C=>y.execute(C,e,i,r,s,a)),x&&v.restore(),E){E.offset();let C=l[c]*h+$i.indexOf(p);this.deferredZIndexContexts_[C]||(this.deferredZIndexContexts_[C]=[]),this.deferredZIndexContexts_[C].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(Vt);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}},zh={};function Zy(n){if(zh[n]!==void 0)return zh[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 zh[n]=r,r}var Em=Gh;var Wh=class extends da{constructor(t,e,i,r,s,o,a){super(),this.context_=t,this.pixelRatio_=e,this.extent_=i,this.transform_=r,this.transformRotation_=r?ln(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_=At()}drawImages_(t,e,i,r){if(!this.image_)return;let s=jt(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,d=s.length;c<d;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 m=f+this.imageAnchorX_,_=g+this.imageAnchorY_;Ot(a,m,_,1,1,h,-m,-_),o.save(),o.transform.apply(o,a),o.translate(m,_),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=jt(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=jt(t,e,i,r,this.transform_,this.pixelCoordinates_);if(Math.abs(o)>0){let c=l.length,d=s||Math.abs(l[0]-l[c-2])<1e-6&&Math.abs(l[1]-l[c-1])<1e-6;l=fa(l,0,c,2,o,d,l),ga(l,2,d)}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=Wd(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),Gt(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:Ki;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:Ht(i||Tt)}}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||qt,d=e.getOffset();this.strokeState_={lineCap:r!==void 0?r:Ve,lineDash:this.pixelRatio_===1?c:c.map(f=>f*this.pixelRatio_),lineDashOffset:(o||$t)*this.pixelRatio_,lineJoin:a!==void 0?a:je,lineWidth:(l!==void 0?l:pi)*this.pixelRatio_,miterLimit:h!==void 0?h:gi,strokeStyle:Ht(i||Wt),strokeOffset:(d??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:Ht(g||Tt)}}let i=t.getStroke();if(!i)this.textStrokeState_=null;else{let g=i.getColor(),m=i.getLineCap(),_=i.getLineDash(),p=i.getLineDashOffset(),y=i.getLineJoin(),E=i.getWidth(),v=i.getMiterLimit();this.textStrokeState_={lineCap:m!==void 0?m:Ve,lineDash:_||qt,lineDashOffset:p||$t,lineJoin:y!==void 0?y:je,lineWidth:E!==void 0?E:pi,miterLimit:v!==void 0?v:gi,strokeStyle:Ht(g||Wt)}}let r=t.getFont(),s=t.getOffsetX(),o=t.getOffsetY(),a=t.getRotateWithView(),l=t.getRotation(),h=t.getScaleArray(),c=t.getText(),d=t.getTextAlign(),f=t.getTextBaseline();this.textState_={font:r!==void 0?r:bo,textAlign:d!==void 0?d:Ki,textBaseline:f!==void 0?f:En},this.text_=c!==void 0?Array.isArray(c)?c.reduce((g,m,_)=>g+=_%2?" ":m,""):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]]}}},wm=Wh;var Pe=.5;function Cm(n,t,e,i,r,s,o,a,l){let h=l?Pi(r,l):r,c=n[0]*Pe,d=n[1]*Pe,f=nt(c,d);f.imageSmoothingEnabled=!1;let g=f.canvas,m=new wm(f,Pe,r,null,o,a,l?un(fn(),l):null),_=e.length,p=Math.floor((256*256*256-1)/_),y={};for(let v=1;v<=_;++v){let x=e[v-1],C=x.getStyleFunction()||i;if(!C)continue;let T=C(x,s);if(!T)continue;Array.isArray(T)||(T=[T]);let R=(v*p).toString(16).padStart(7,"#00000");for(let I=0,b=T.length;I<b;++I){let z=T[I],X=z.getGeometryFunction()(x);if(!X||!ht(h,X.getExtent()))continue;let N=z.clone(),V=N.getFill();V&&V.setColor(R);let lt=N.getStroke();lt&&(lt.setColor(R),lt.setLineDash(null)),N.setText(void 0);let M=z.getImage();if(M){let G=M.getImageSize();if(!G)continue;let tt=nt(G[0],G[1],void 0,{alpha:!1}),it=tt.canvas;tt.fillStyle=R,tt.fillRect(0,0,it.width,it.height),N.setImage(new wn({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 W=N.getZIndex()||0,O=y[W];O||(O={},y[W]=O,O.Polygon=[],O.Circle=[],O.LineString=[],O.Point=[]);let $=X.getType();if($==="GeometryCollection"){let G=X.getGeometriesArrayRecursive();for(let tt=0,it=G.length;tt<it;++tt){let Ct=G[tt];O[Ct.getType().replace("Multi","")].push(Ct,N)}}else O[$.replace("Multi","")].push(X,N)}}let E=Object.keys(y).map(Number).sort(Vt);for(let v=0,x=E.length;v<x;++v){let C=y[E[v]];for(let T in C){let A=C[T];for(let R=0,I=A.length;R<I;R+=2){m.setStyle(A[R+1]);for(let b=0,z=t.length;b<z;++b)m.setTransform(t[b]),m.drawGeometry(A[R])}}}return f.getImageData(0,0,g.width,g.height)}function vm(n,t,e){let i=[];if(e){let r=Math.floor(Math.round(n[0])*Pe),s=Math.floor(Math.round(n[1])*Pe),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),d=Math.floor((256*256*256-1)/t.length);c&&c%d===0&&i.push(t[c/d-1])}return i}var By=.5,Sm={Point:Qy,LineString:qy,Polygon:ex,MultiPoint:tx,MultiLineString:$y,MultiPolygon:Jy,GeometryCollection:Hy,Circle:Vy};function Rm(n,t){return parseInt(Y(n),10)-parseInt(Y(t),10)}function Uh(n,t){let e=Yh(n,t);return e*e}function Yh(n,t){return By*n/t}function Vy(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 Kh(n,t,e,i,r,s,o,a){let l=[],h=e.getImage();if(h){let f=!0,g=h.getImageState();g==U.LOADED||g==U.ERROR?f=!1:g==U.IDLE&&h.load(),f&&l.push(h.ready())}let c=e.getFill();c&&c.loading()&&l.push(c.ready());let d=l.length>0;return d&&Promise.all(l).then(()=>r(null)),jy(n,t,e,i,s,o,a),d}function jy(n,t,e,i,r,s,o){let a=e.getGeometryFunction()(t);if(!a)return;let l=a.simplifyTransformed(i,r);if(e.getRenderer())Tm(n,l,e,t,o);else{let c=Sm[l.getType()];c(n,l,e,t,o,s)}}function Tm(n,t,e,i,r){if(t.getType()=="GeometryCollection"){let o=t.getGeometries();for(let a=0,l=o.length;a<l;++a)Tm(n,o[a],e,i,r);return}n.getBuilder(e.getZIndex(),"Default").drawCustom(t,i,e.getRenderer(),e.getHitDetectionRenderer(),r)}function Hy(n,t,e,i,r,s){let o=t.getGeometriesArray(),a,l;for(a=0,l=o.length;a<l;++a){let h=Sm[o[a].getType()];h(n,o[a],e,i,r,s)}}function qy(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 $y(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 Jy(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 Qy(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()!=U.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 tx(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()!=U.LOADED)return;let d=n.getBuilder(e.getZIndex(),"Image");d.setImageStyle(o,c),d.drawMultiPoint(t,i,r)}if(h){let d=n.getBuilder(e.getZIndex(),"Text");d.setTextStyle(l,c),d.drawText(t,i,r)}}function ex(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 Zh=class extends ua{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(),d=this.getLayer().getSource(),f=this.getLayer().getDeclutter(),g=e.pixelRatio,m=e.viewHints,_=!(m[bt.ANIMATING]||m[bt.INTERACTING]),p=this.context,y=Math.round(j(r)/a*g),E=Math.round(ct(r)/a*g),v=d.getWrapX()&&l.canWrapX(),x=v?j(c):null,C=v?Math.ceil((r[2]-c[2])/x)+(this.extendX_?2:1):1,T=v?Math.floor((r[0]-c[0])/x)-(this.extendX_?1:0):0;do{let A=this.getRenderTransform(o,a,0,g,y,E,T*x);e.declutter&&(A=A.slice(0)),t.execute(p,[p.canvas.width,p.canvas.height],A,h,_,i===void 0?$i:i?Xh:_m,i?f&&e.declutter[f]:void 0)}while(++T<C)}setDrawContext_(){this.opacity_!==1&&(this.targetContext_=this.context,this.context=nt(this.context.canvas.width,this.context.canvas.height,yh))}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,pn(this.context),yh.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(Ft.PRERENDER)||this.getLayer().hasListener(Ft.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=Ce(i.extent,l);a=ht(c,t.extent),a&&!Fe(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=[],d=i[0]*Pe,f=i[1]*Pe;c.push(this.getRenderTransform(r,s,o,Pe,d,f,0).slice());let g=h.getSource(),m=a.getExtent();if(g.getWrapX()&&a.canWrapX()&&!Fe(m,l)){let p=l[0],y=j(m),E=0,v;for(;p<m[0];)--E,v=y*E,c.push(this.getRenderTransform(r,s,o,Pe,d,f,v).slice()),p+=y;for(E=0,p=l[2];p>m[2];)++E,v=y*E,c.push(this.getRenderTransform(r,s,o,Pe,d,f,v).slice()),p-=y}let _=fn();this.hitDetectionImageData_=Cm(i,c,this.renderedFeatures_,h.getStyleFunction(),l,s,o,Uh(s,this.renderedPixelRatio_),_?a:null)}e(vm(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,m){let _=Y(f),p=h[_];if(p){if(p!==!0&&m<p.distanceSq){if(m===0)return h[_]=!0,s.splice(s.lastIndexOf(p),1),r(f,l,g);p.geometry=g,p.distanceSq=m}}else{if(m===0)return h[_]=!0,r(f,l,g);s.push(h[_]={feature:f,layer:l,geometry:g,distanceSq:m,callback:r})}},d=this.getLayer().getDeclutter();return this.replayGroup_.forEachFeatureAtCoordinate(t,o,a,i,c,d?e.declutter?.[d]?.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[bt.ANIMATING],s=t.viewHints[bt.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,d=h.resolution,f=t.pixelRatio,g=e.getRevision(),m=e.getRenderBuffer(),_=e.getRenderOrder();_===void 0&&(_=Rm);let p=h.center.slice(),y=On(l,m*d),E=y.slice(),v=[y.slice()],x=c.getExtent(),C=i.getWrapX()&&c.canWrapX();if(this.extendX_=!1,C){let M=i.getExtent();M&&!ze(M)&&(this.extendX_=M[0]<x[0]||M[2]>x[2])}if(C&&(!Fe(x,t.extent)||this.extendX_)){let M=j(x),W=Math.max(j(y)/2,M),O=x[0],$=x[2];this.extendX_&&(O-=M,$+=M),y[0]=O-W,y[2]=$+W,Ws(p,c);let G=Ma(v[0],c);G[0]<x[0]&&G[2]<x[2]?v.push([G[0]+M,G[1],G[2]+M,G[3]]):G[0]>x[0]&&G[2]>x[2]&&v.push([G[0]-M,G[1],G[2]-M,G[3]])}if(this.ready&&this.renderedResolution_==d&&this.renderedPixelRatio_===f&&this.renderedRevision_==g&&this.renderedRenderOrder_==_&&this.renderedFrameDeclutter_===!!t.declutter&&Fe(this.wrappedRenderedExtent_,y))return Gt(this.renderedExtent_,E)||(this.hitDetectionImageData_=null,this.renderedExtent_=E),this.renderedCenter_=p,this.replayGroupChanged=!1,!0;this.replayGroup_=null;let T=new um(Yh(d,f),y,d,f),A=fn(),R;if(A){for(let M=0,W=v.length;M<W;++M){let O=v[M],$=Pi(O,c);i.loadFeatures($,Bu(d,c),A)}R=un(A,c)}else for(let M=0,W=v.length;M<W;++M)i.loadFeatures(v[M],d,c);let I=Uh(d,f),b=!0,z=(M,W)=>{let O,$=M.getStyleFunction()||e.getStyleFunction();if($&&(O=$(M,d)),O){let G=this.renderFeature(M,I,O,T,R,this.getLayer().getDeclutter(),W);b=b&&!G}},X=Pi(y,c),N=i.getFeaturesInExtent(X);_&&N.sort(_);for(let M=0,W=N.length;M<W;++M)z(N[M],M);this.renderedFeatures_=N,this.ready=b;let V=T.finish(),lt=new Em(y,d,f,i.getOverlaps(),V,e.getRenderBuffer(),!!t.declutter);return this.renderedResolution_=d,this.renderedRevision_=g,this.renderedRenderOrder_=_,this.renderedFrameDeclutter_=!!t.declutter,this.renderedExtent_=E,this.wrappedRenderedExtent_=y,this.renderedCenter_=p,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=Kh(r,t,i[h],e,this.boundHandleStyleImageChange_,s,o,a)||l;else l=Kh(r,t,i,e,this.boundHandleStyleImageChange_,s,o,a);return l}},Im=Zh;var Bh=class extends aa{constructor(t){super(t)}createRenderer(){return new Im(this)}},bm=Bh;var ix=!1;function nx(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=ix,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 Vh(n,t){return function(e,i,r,s,o){nx(n,t,e,i,r,(a,l)=>{this.addFeatures(a),s!==void 0&&s(a)},()=>{this.changed(),o!==void 0&&o()})}}function Lm(n,t){return[[-1/0,-1/0,1/0,1/0]]}function jh(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],d=n[t+1],f=0,g=[0];for(let p=t+i;p<e;p+=i){let y=n[p],E=n[p+1];f+=Math.sqrt((y-c)*(y-c)+(E-d)*(E-d)),g.push(f),c=y,d=E}let m=r*f,_=ju(g,m);_<0?(l=(m-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]:zt(n[a+c],n[a+i+c],l);return s}var Am=At(),vs=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_):Dn(this.flatCoordinates_,0,this.flatCoordinates_.length,this.stride_)),this.extent_}getFlatInteriorPoint(){if(!this.flatInteriorPoints_){let t=Bt(this.getExtent());this.flatInteriorPoints_=Kr(this.flatCoordinates_,0,this.ends_,this.stride_,t,0)}return this.flatInteriorPoints_}getFlatInteriorPoints(){if(!this.flatInteriorPoints_){let t=Jd(this.flatCoordinates_,this.ends_),e=Oo(this.flatCoordinates_,0,t,this.stride_);this.flatInteriorPoints_=go(this.flatCoordinates_,0,t,this.stride_,e)}return this.flatInteriorPoints_}getFlatMidpoint(){return this.flatMidpoints_||(this.flatMidpoints_=jh(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=jh(t,e,o,this.stride_,.5);ve(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);Ot(Am,i[0],i[3],r,-r,0,0,0),jt(this.flatCoordinates_,0,this.flatCoordinates_.length,this.stride_,Am,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=to((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=Ur(i,0,this.simplifiedGeometry_.flatCoordinates_.length,this.simplifiedGeometry_.stride_,t,i,0),r=[i.length];break;case"MultiLineString":r=[],i.length=jd(i,0,this.simplifiedGeometry_.ends_,this.simplifiedGeometry_.stride_,t,i,0,r);break;case"Polygon":r=[],i.length=Yr(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}};vs.prototype.getFlatCoordinates=vs.prototype.getOrientedFlatCoordinates;var Ln=vs;var Hh=class{constructor(t){this.rbush_=new Tn(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];on(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 xe(this.items_)}clear(){this.rbush_.clear(),this.items_={}}getExtent(t){let e=this.rbush_.toJSON();return Qt(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]}},qh=Hh;var ie={ADDFEATURE:"addfeature",CHANGEFEATURE:"changefeature",CLEAR:"clear",REMOVEFEATURE:"removefeature",FEATURESLOADSTART:"featuresloadstart",FEATURESLOADEND:"featuresloadend",FEATURESLOADERROR:"featuresloaderror"};var ei=class extends Lt{constructor(t,e,i){super(t),this.feature=e,this.features=i}},$h=class extends co{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_=hi,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_=Vh(this.url_,this.format_)),this.strategy_=t.strategy!==void 0?t.strategy:Lm;let e=t.useSpatialIndex!==void 0?t.useSpatialIndex:!0;this.featuresRtree_=e?new qh:null,this.loadedExtentsRtree_=new qh,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 Dt(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 ei(ie.ADDFEATURE,t))}setupChangeEvents_(t,e){e instanceof Ln||(this.featureChangeKeys_[t]=[Z(e,P.CHANGE,this.handleFeatureChange_,this),Z(e,Se.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 Ln){let s=this.idIndex_[r];s instanceof Ln?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 ei(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(Pt.ADD,i=>{e||(e=!0,this.addFeature(i.element),e=!1)}),t.addEventListener(Pt.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 ei(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 Ln||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 Ln||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(),xe(this.nullGeometryFeatures_)||ve(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=Ns(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||li,this.featuresRtree_.forEachInExtent(l,function(h){if(e(h)){let c=h.getGeometry(),d=a;if(a=c instanceof Ln?0:c.closestPointXY(i,r,o,a),a<d){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 ei(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()&&xe(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 Fe(c.extent,l)})){this.loading=Number(this.loading)+1,this.dispatchEvent(new ei(ie.FEATURESLOADSTART));let c=m=>{this.loading=Number(this.loading)-1,this.dispatchEvent(new ei(ie.FEATURESLOADEND,void 0,m))},d=()=>{this.changed(),this.loading=Number(this.loading)-1,this.dispatchEvent(new ei(ie.FEATURESLOADERROR))},f=!1,g=this.loader_.call(this,l,e,i,m=>f||c(m),()=>f||d());g instanceof Promise?(f=!0,g.then(m=>{this.addFeatures(m),c(m)}).catch(d)):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 ei(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(Vh(t,this.format_))}setOverlaps(t){this.overlaps_=t,this.changed()}},Ti=$h;function Mm(){let n=u.variant,t=w.overviewCanvas,e=t.getContext("2d"),i=di(),r=u.game.tileGrid.size,s=u.game.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<168;)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=++u.overviewRun,d=n.formats[l],f=Math.floor(i[0]/r*2**l),g=Math.ceil(i[2]/r*2**l),m=Math.floor(-i[3]/r*2**l),_=Math.ceil(-i[1]/r*2**l);for(let p=m;p<_;p++)for(let y=f;y<g;y++){if(!d||!pa(n,l,y,p))continue;let E=new Image;E.onload=()=>{u.overviewRun===c&&e.drawImage(E,y*s-i[0]*h,p*s+i[3]*h,s,s)},E.src=`${u.game.base}/tiles/${encodeURIComponent(n.tiles)}/${l}/${y}/${p}.${d}`}Ss()}function Ss(){let n=u.engine?.getView();if(!n||!u.variant)return;let t=di(),e=n.calculateExtent(u.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===u.overviewKey||(u.overviewKey=a,w.overviewShelf.hidden=o,o))return;let l=w.overviewCanvas,h=be((e[0]-t[0])/i,0,1),c=be((e[2]-t[0])/i,0,1),d=be((t[3]-e[3])/r,0,1),f=be((t[3]-e[1])/r,0,1),g=w.overviewViewport.style;g.left=`${h*l.width}px`,g.top=`${d*l.height}px`,g.width=`${Math.max(8,(c-h)*l.width)}px`,g.height=`${Math.max(8,(f-d)*l.height)}px`}function ma(n,t=!0){u.overviewDocked=n,n&&u.overviewPointer!==null&&(u.overviewPointer=null,Er()),w.overviewShelf.classList.toggle("is-docked",n),w.overviewDock.setAttribute("aria-expanded",String(!n));let e=n?"Bring the overview back":"Put the overview away";w.overviewDock.setAttribute("aria-label",e),w.overviewDock.title=e,t&&Re()}function Jh(n,t){let e=u.engine?.getView();if(!e||!u.variant)return;let i=w.overviewCanvas.getBoundingClientRect(),r=di(),s=(a,l,h)=>be((a-l)/(h-l),0,1),o=[r[0]+s(n.clientX,i.left,i.right)*(r[2]-r[0]),r[3]-s(n.clientY,i.top,i.bottom)*(r[3]-r[1])];if(t){e.animate({center:o,duration:180});return}e.cancelAnimations(),e.setCenter(o)}function ne(n){return new bm({updateWhileAnimating:!0,...n})}function Pm(){let n=u.game.tileGrid.size,t=[0,-n,n,0];u.projection=new Ai({code:"ATLAS:PIXELS",units:"pixels",extent:t}),u.sources={grid:new Ti({wrapX:!1}),gridContext:new Ti({wrapX:!1}),zoneScrim:new Ti({wrapX:!1}),zones:new Ti({wrapX:!1}),zoneTitles:new Ti({wrapX:!1}),text:new Ti({wrapX:!1}),pins:new Ti({wrapX:!1}),priority:new Ti({wrapX:!1})},u.layers={raster:new vh({zIndex:0}),rasterDetail:new vh({zIndex:1}),grid:ne({source:u.sources.grid,style:sc,renderOrder:fe,renderBuffer:40,zIndex:5}),zoneScrim:ne({source:u.sources.zoneScrim,style:Nf,zIndex:6}),zones:ne({source:u.sources.zones,style:zf,renderBuffer:32,zIndex:10}),zoneTitles:ne({source:u.sources.zoneTitles,style:Gf,renderOrder:fe,renderBuffer:160,zIndex:20}),zoneTitleDetail:ne({source:u.sources.zoneTitles,style:Xf,renderOrder:fe,renderBuffer:160,zIndex:44}),text:ne({source:u.sources.text,style:Af,renderOrder:fe,renderBuffer:220,zIndex:30}),textDetail:ne({source:u.sources.text,style:Mf,renderOrder:fe,renderBuffer:220,zIndex:45}),zoneText:ne({source:u.sources.text,style:Pf,renderOrder:fe,renderBuffer:220,zIndex:41}),pins:ne({source:u.sources.pins,style:If,renderOrder:fe,renderBuffer:48,zIndex:40}),zonePins:ne({source:u.sources.pins,style:bf,renderOrder:fe,renderBuffer:48,zIndex:42}),pinLabels:ne({source:u.sources.pins,style:Lf,renderOrder:fe,renderBuffer:180,zIndex:45}),gridContext:ne({source:u.sources.gridContext,style:sc,renderOrder:fe,renderBuffer:40,zIndex:48}),priority:ne({source:u.sources.priority,style:Of,renderOrder:fe,renderBuffer:220,zIndex:50})},u.engine=new tm({target:w.viewport,layers:Object.values(u.layers),controls:Xo({attribution:!1,rotate:!1,zoom:!1}),interactions:Bo({onFocusOnly:!1}),view:Qh(5)}),u.engine.on("movestart",()=>{u.engine.getViewport().classList.add("is-dragging")}),u.engine.on("moveend",()=>{u.engine.getViewport().classList.remove("is-dragging"),u.overviewPointer===null&&Er()}),u.engine.on("postrender",Ss),w.viewport.addEventListener("wheel",()=>{document.activeElement!==w.viewport&&w.viewport.focus({preventScroll:!0})},{capture:!0,passive:!0}),u.engine.on("singleclick",e=>{if(u.gridEnabled){let r=u.engine.forEachFeatureAtPixel(e.pixel,s=>{let o=s.get("gridCell");return o&&o.role!=="leaf"&&o.role!=="scope"?o:null},{hitTolerance:1,layerFilter:s=>s===u.layers.grid||s===u.layers.gridContext});if(r){Br(r.hash);return}}let i=u.engine.forEachFeatureAtPixel(e.pixel,(r,s)=>_a(s)&&r.get("pin")||null,{hitTolerance:5,layerFilter:_a});i&&Fl(i)}),u.engine.on("pointermove",e=>{if(e.dragging){ar(null);return}let i=u.engine.forEachFeatureAtPixel(e.pixel,(o,a)=>_a(a)&&o.get("pin")||null,{hitTolerance:4,layerFilter:_a}),r=i&&Be(i.category)==="text"?null:i;ar(r||null);let s=u.gridEnabled&&u.engine.hasFeatureAtPixel(e.pixel,{layerFilter:o=>o===u.layers.grid||o===u.layers.gridContext});u.engine.getTargetElement().style.cursor=i||s?"pointer":""}),u.engine.getViewport().addEventListener("pointerleave",()=>ar(null))}function _a(n){return n===u.layers.pins||n===u.layers.zonePins||n===u.layers.pinLabels||n===u.layers.priority||n===u.layers.text||n===u.layers.textDetail||n===u.layers.zoneText}function Qh(n){let t=u.game.tileGrid.size;return new ee({projection:u.projection,center:[t/2,-t/2],resolutions:tu(n),minZoom:0,maxZoom:n,extent:[0,-t,t,0],constrainResolution:!1,smoothResolutionConstraint:!1,showFullExtent:!0,zoom:0})}function tu(n){let t=u.game.tileGrid.size/u.game.tileGrid.tileSize;return Array.from({length:n+1},(e,i)=>t/2**i)}async function yi(n,t){u.game=u.catalog.games.find(r=>r.slug===n)||u.catalog.games[0],u.engine||Pm(),!t&&!u.restore&&(u.restore=Jn(u.game.slug)),w.game.value=u.game.slug,rn(w.map,u.game.maps,"title"),w.map.disabled=u.game.maps.length===1,w.map.title=w.map.disabled?"This game has one map":"Choose a map";let e=u.restore?.game===u.game.slug?u.restore:null,i=t&&u.game.maps.find(r=>r.slug===t)||e&&u.game.maps.find(r=>r.slug===e.map);await eu((i||u.game.maps[0]).slug)}async function eu(n){let t=u.game.maps.find(s=>s.slug===n)||u.game.maps[0],e=++u.mapRun;w.loading.hidden=!1;let i;try{i=await ng(t)}catch{u.mapRun===e&&(w.loading.hidden=!0,vn());return}if(u.mapRun!==e)return;u.settling=!0,u.map=i,document.documentElement.style.setProperty("--icon-outset-color",Vr()),w.map.value=u.map.slug,rn(w.variant,u.map.variants,"name"),w.variantField.hidden=u.map.variants.length<2,u.styleCache.clear(),ar(null),u.gridPrefix="",u.hiddenCategories.clear(),u.collapsedSections.clear(),u.collapsedSections.add("zones");for(let s of u.map.groups)for(let o of s.categories)o.visible||u.hiddenCategories.add(o.id);let r=u.restore?.map===u.map.slug?u.restore:null;r&&(u.hiddenCategories=new Set(r.hidden),u.collapsedSections=new Set(r.collapsed)),ma(!!u.restore?.overviewDocked,!1),Co(u.restore?!!u.restore.dockFolded:!0,!1),u.dockDismissed=!!u.restore?.dockDismissed,u.search="",w.search.value="",w.dock.hidden=!1,Te(),Qf(),lc(),$f(),iu(r?be(r.variant,0,u.map.variants.length-1):0,!0),u.restore=null,w.sidebar.classList.remove("is-open"),w.mobileLegend.setAttribute("aria-expanded","false"),kd(),u.settling=!1,Re()}function iu(n,t=!1){let e=u.variant;u.variant=u.map.variants[n]||u.map.variants[0];let i=u.variant,r=t?null:ax(e,i),s=Ze(i);w.variant.value=String(u.map.variants.indexOf(u.variant)),t?u.engine.setView(Qh(s)):(u.engine.getView().setMinZoom(i.minZoom),u.engine.getView().setMaxZoom(s));let o=++u.tileRun,a=0;u.tileStats={requested:0,loaded:0,errors:0,peakPending:0},w.loading.hidden=!1;let l=_=>{_.on("tileloadstart",()=>{u.tileRun===o&&(a++,u.tileStats.requested++,u.tileStats.peakPending=Math.max(u.tileStats.peakPending,a))});let p=y=>{u.tileRun===o&&(a=Math.max(0,a-1),y?u.tileStats.errors++:u.tileStats.loaded++,a===0&&u.tileStats.loaded>0&&(w.loading.hidden=!0))};return _.on("tileloadend",()=>p(!1)),_.on("tileloaderror",()=>p(!0)),_},h=(_,p)=>l(new Od({projection:u.projection,tileGrid:new zr({extent:[0,-u.game.tileGrid.size,u.game.tileGrid.size,0],origin:[0,0],resolutions:tu(_),tileSize:u.game.tileGrid.tileSize}),cacheSize:64,interpolate:i.interpolate,transition:0,wrapX:!1,tileUrlFunction:([y,E,v])=>{let x=i.formats[y];if(!(!x||E<0||v<0||!p(y,E,v)))return`${u.game.base}/tiles/${encodeURIComponent(i.tiles)}/${y}/${E}/${v}.${x}`}})),c=i.fullZoom??i.maxZoom,d=h(c,(_,p,y)=>pa(i,_,p,y)),f=u.layers.raster.getSource();u.layers.raster.setSource(d),u.layers.raster.setExtent(di()),u.layers.raster.setBackground(i.background||void 0),f?.clear();let g=u.layers.rasterDetail.getSource();i.maxZoom>c?(u.layers.rasterDetail.setSource(h(i.maxZoom,(_,p,y)=>_>c&&pa(i,_,p,y))),u.layers.rasterDetail.setExtent(di()),u.layers.rasterDetail.setVisible(!0)):u.layers.rasterDetail.setVisible(!1),g?.clear(),yo(),u.gridEnabled&&(Ke(),u.layers.pins.changed(),u.layers.text.changed(),u.layers.priority.changed()),u.overviewKey="",Mm();let m=t&&u.restore?.map===u.map.slug?u.restore:null;if(u.renderedShard!==(i.shard||0)&&(lc(),ue()),m?.center&&Number.isFinite(m.zoom)){let _=u.engine.getView();_.setCenter(m.center),_.setZoom(m.zoom),u.fitZoom=m.zoom,Cn()}else t?requestAnimationFrame(lx):(r&&u.engine.getView().animate({center:r,duration:200}),Cn());Re()}function pa(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=ox(n,t,r),l=o*r.w+s;return(a[l>>3]&1<<(l&7))!==0}function ox(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 Ze(n){return n.maxZoom+2}function Er(){Cn(),Re()}function ax(n,t){if(!n||!t||!n.shard||!t.shard||n.shard===t.shard||!n.bounds||!t.bounds)return null;let i=u.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+be(r,0,1)*t.bounds.width,-(t.bounds.y+be(s,0,1)*t.bounds.height)]}function Om(){let t=document.querySelector(".app-shell").classList.toggle("sidebar-collapsed");w.mobileLegend.setAttribute("aria-expanded",String(!t)),requestAnimationFrame(()=>u.engine?.updateSize())}function di(){let n=u.game.tileGrid.size,t=u.variant?.bounds||{x:0,y:0,width:n,height:n};return[t.x,-(t.y+t.height),t.x+t.width,-t.y]}function lx(){if(!u.engine||!u.variant)return;let n=u.engine.getView();n.fit(di(),{size:u.engine.getSize(),padding:[36,36,36,36],maxZoom:u.variant.maxZoom,duration:0}),u.fitZoom=n.getZoom()||0,Cn()}function Rs(n){let t=u.engine.getView(),e=t.getZoom()||0;t.animate({zoom:be(e+n,u.variant.minZoom,Ze(u.variant)),duration:140})}function Cn(){let n=u.engine?.getView().getZoom();if(w.viewport.dataset.zoom=Number.isFinite(n)?n.toFixed(3):"",!u.engine||!u.pins.length){w.visibleCount.textContent="0 locations visible";return}let t=u.engine.getView().calculateExtent(u.engine.getSize()),e=0;for(let i of u.pins){if(ge(i))continue;let[r,s]=i.coordinate;r>=t[0]&&r<=t[2]&&s>=t[1]&&s<=t[3]&&e++}w.visibleCount.textContent=`${Ie(u.eligibleLocations)} enabled \xB7 ${Ie(e)} in view`}function Dm(){w.game.addEventListener("change",()=>{yi(w.game.value)}),w.map.addEventListener("change",()=>{eu(w.map.value)}),w.addBundles.addEventListener("click",()=>{gc()}),w.emptyOpen.addEventListener("click",()=>{gc()}),w.variant.addEventListener("change",()=>iu(Number(w.variant.value))),w.legend.addEventListener("change",i=>{let r=i.target;if(r.dataset.sectionToggle){eg(r.dataset.sectionToggle);return}if(!r.dataset.category)return;let s=Number(r.dataset.category);r.checked?u.hiddenCategories.delete(s):u.hiddenCategories.add(s),ue(),Wi()});let n=null,t=()=>{for(let s of w.layers.querySelectorAll(".is-hovered"))s.classList.remove("is-hovered");if(!n)return;let r=document.elementFromPoint(n.x,n.y)?.closest(".category-row, .layer-header");r&&w.layers.contains(r)&&r.classList.add("is-hovered")};w.layers.addEventListener("pointermove",i=>{n={x:i.clientX,y:i.clientY},t()},{passive:!0}),w.layers.addEventListener("pointerleave",()=>{n=null,t()}),w.layers.addEventListener("scroll",t,{passive:!0}),w.layers.addEventListener("click",i=>{let r=i.target.closest("[data-only-category], [data-only-section]");if(r){i.preventDefault(),i.stopPropagation(),ig(r.dataset.onlyCategory?{category:Number(r.dataset.onlyCategory)}:{section:r.dataset.onlySection});return}let s=i.target.closest("[data-section]");if(!s)return;let o=s.dataset.section;u.collapsedSections.has(o)?u.collapsedSections.delete(o):u.collapsedSections.add(o),No()}),w.soloChip.addEventListener("click",()=>ss(!0)),k("#expand-all").addEventListener("click",()=>dc(!1)),k("#collapse-all").addEventListener("click",()=>dc(!0)),k("#show-all").addEventListener("click",()=>ss(!0)),k("#hide-all").addEventListener("click",()=>ss(!1)),w.zoneToggle.addEventListener("change",()=>{Do(w.zoneToggle.checked)}),w.zoneIndex.addEventListener("click",i=>{let r=i.target.closest("[data-zone]");r&&jf(Number(r.dataset.zone))}),w.zoneIndex.addEventListener("contextmenu",i=>{let r=i.target.closest("[data-zone]");r&&(i.preventDefault(),Hf(Number(r.dataset.zone)))}),w.search.addEventListener("input",()=>{u.search=w.search.value.trim().toLocaleLowerCase(),ue(),u.search&&wo()}),w.dockFold.addEventListener("click",()=>{Dl(!u.dockFolded)}),w.searchResults.addEventListener("click",i=>{let r=i.target.closest("[data-location]");if(!r)return;let s=u.pinByID.get(Number(r.dataset.location));s&&kl(s)}),w.detailLinks.addEventListener("click",i=>{let r=i.target.closest("[data-location]");if(!r)return;let s=u.pinByID.get(Number(r.dataset.location));s&&kl(s)}),k("#close-detail").addEventListener("click",Te),k("#zoom-in").addEventListener("click",()=>Rs(1)),k("#zoom-out").addEventListener("click",()=>Rs(-1)),w.gridBack.addEventListener("click",Ml),w.gridInput.addEventListener("input",()=>{let i=yn(),r=[...w.gridInput.value.toLocaleLowerCase()].filter(s=>ae.includes(s)).slice(0,i).join("");w.gridInput.value=r,Br(r)}),w.subgridToggle.addEventListener("click",()=>{Zr(!u.subgridVisible),w.viewport.focus({preventScroll:!0})}),w.gridInput.addEventListener("keydown",i=>{if(i.key===" "){i.preventDefault(),Zr(!u.subgridVisible);return}i.key==="Escape"&&(i.preventDefault(),i.stopPropagation(),w.viewport.focus({preventScroll:!0}))}),w.viewport.addEventListener("keydown",i=>{if(!Eo(i.target)){if(i.key==="+"||i.key==="=")Rs(1);else if(i.key==="-")Rs(-1);else if(i.key==="Escape")Te();else return;i.preventDefault()}}),window.addEventListener("contextmenu",i=>{Eo(i.target)||i.preventDefault()}),window.addEventListener("keydown",i=>{if((i.metaKey||i.ctrlKey)&&i.key.toLocaleLowerCase()==="r"){i.preventDefault(),location.reload();return}if(!Eo(i.target)){if((i.metaKey||i.ctrlKey)&&i.key.toLocaleLowerCase()==="k"){i.preventDefault(),w.search.focus(),w.search.select();return}if((i.metaKey||i.ctrlKey)&&i.altKey&&i.code==="KeyB"){i.preventDefault(),w.dock.hidden||Dl(!u.dockFolded);return}if((i.metaKey||i.ctrlKey)&&i.key.toLocaleLowerCase()==="b"){i.preventDefault(),Om();return}tf(i)||i.key.toLocaleLowerCase()==="z"&&(i.preventDefault(),i.repeat||Fo(!0))}}),window.addEventListener("keyup",i=>{i.key.toLocaleLowerCase()==="z"&&Fo(!1)}),window.addEventListener("blur",()=>Fo(!1)),window.addEventListener("hashchange",()=>{let i=Qn();i.game===u.game?.slug&&i.map===u.map?.slug||(u.restore=null,yi(i.game||u.catalog.games[0].slug,i.map))}),window.addEventListener("resize",()=>{u.engine?.updateSize(),Ss()}),w.overview.addEventListener("pointerdown",i=>{u.overviewDocked||i.pointerType==="mouse"&&i.button!==0||(i.preventDefault(),w.overview.setPointerCapture(i.pointerId),u.overviewPointer=i.pointerId,Jh(i,!0))}),w.overview.addEventListener("pointermove",i=>{u.overviewPointer===i.pointerId&&(i.preventDefault(),Jh(i,!1))});let e=i=>{u.overviewPointer===i.pointerId&&(u.overviewPointer=null,Er())};w.overview.addEventListener("pointerup",e),w.overview.addEventListener("pointercancel",e),w.overviewDock.addEventListener("click",()=>{ma(!u.overviewDocked),w.viewport.focus({preventScroll:!0})}),w.mobileLegend.addEventListener("click",()=>{let i=w.sidebar.classList.toggle("is-open");w.mobileLegend.setAttribute("aria-expanded",String(i))})}function km(){let n=()=>({game:u.game?.title,map:u.map?.title,variant:u.variant?.name,zoom:u.engine?.getView().getZoom(),center:u.engine?.getView().getCenter(),resolution:u.engine?.getView().getResolution(),nativeMaxZoom:u.variant?.maxZoom,maxZoom:u.variant?Ze(u.variant):null,interpolate:u.variant?.interpolate,tileStats:{...u.tileStats},pins:u.pins.length,eligibleLocations:u.eligibleLocations,domNodes:document.querySelectorAll("*").length,canvases:document.querySelectorAll("canvas").length,rasterCacheSize:64,labelsHeld:u.labelsHeld,hoveredPin:u.hoveredPin?.location.title||null,selectedPin:u.selectedPin?.location.title||null,fitZoom:u.fitZoom,filters:{hiddenCategories:[...u.hiddenCategories].sort(),collapsedSections:[...u.collapsedSections].sort()},ui:{sidebarCollapsed:document.querySelector(".app-shell")?.classList.contains("sidebar-collapsed")??!1,detailOpen:!w.detail.hidden,detailTitle:w.detail.hidden?null:w.detailTitle.textContent||null,searchQuery:u.search,searchResultsVisible:!w.searchResults.hidden,soloChip:w.soloChip.hidden?null:w.soloChip.textContent,visibleCountText:w.visibleCount.textContent,overviewDocked:u.overviewDocked,dockFolded:u.dockFolded,dockDismissed:u.dockDismissed,subgridVisible:u.subgridVisible},zones:{visible:u.zonesVisible,count:u.zoneRecords.size,focused:u.zoneRecords.get(u.focusedZoneID)?.zone.title||null,highlighted:[...u.highlightedZones].map(t=>u.zoneRecords.get(t)?.zone.title).filter(Boolean),focusedPins:u.pins.filter(t=>!t.filteredHidden&&t.insideHighlightedZone).length},grid:{enabled:u.gridEnabled,prefix:u.gridPrefix,maximumDepth:yn(),extent:u.gridEnabled?er():null,cells:[...u.sources.grid.getFeatures(),...u.sources.gridContext.getFeatures()].map(t=>t.get("gridCell")),priorityPins:u.gridPrefix?u.pins.filter(t=>!t.filteredHidden&&ir(t)).length:0}});window.__atlasDebug={snapshot:n,setLayerVisible:(t,e)=>u.layers[t]?.setVisible(e),refreshCatalog:vn},window.render_game_to_text=()=>JSON.stringify({coordinateSystem:"ATLAS:PIXELS; origin top-left; x increases right; y decreases downward",...n()}),window.advanceTime=()=>u.engine?.renderSync()}async function Fm(){Dm();try{let n=await fetch("/data/catalog.json");if(!n.ok)throw new Error(`catalog request returned ${n.status}`);if(u.catalog=await n.json(),rn(w.game,u.catalog.games,"title"),fc(),window.runtime?.EventsOn?.("atlas:catalog-changed",()=>{vn()}),u.catalog.games.length){let t=Qn(),e=Jn(),i=e&&(!t.game||t.game===e.game&&t.map===e.map);u.restore=i?e:null,await yi(t.game||e?.game||u.catalog.games[0].slug,t.map||e?.map),u.restore=null}else w.loading.hidden=!0;km(),requestAnimationFrame(()=>w.viewport.focus({preventScroll:!0}))}catch(n){w.loading.hidden=!0,w.fatalMessage.textContent=n instanceof Error?n.message:String(n),w.fatal.hidden=!1}}Fm();})();1+(()=>{var fse=Object.create;var R4=Object.defineProperty;var dse=Object.getOwnPropertyDescriptor;var pse=Object.getOwnPropertyNames;var Ase=Object.getPrototypeOf,mse=Object.prototype.hasOwnProperty;var gse=(i,e)=>()=>{try{return e||i((e={exports:{}}).exports,e),e.exports}catch(t){throw e=0,t}},_se=(i,e)=>{for(var t in e)R4(i,t,{get:e[t],enumerable:!0})},xse=(i,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of pse(e))!mse.call(i,r)&&r!==t&&R4(i,r,{get:()=>e[r],enumerable:!(n=dse(e,r))||n.enumerable});return i};var yse=(i,e,t)=>(t=i!=null?fse(Ase(i)):{},xse(e||!i||!i.__esModule?R4(t,"default",{value:i,enumerable:!0}):t,i));var m$=gse((cv,x6)=>{(function(i,e){typeof cv=="object"&&typeof x6=="object"?x6.exports=e():typeof define=="function"&&define.amd?define("FrameTicker",[],e):typeof cv=="object"?cv.FrameTicker=e():i.FrameTicker=e()})(cv,function(){return(function(i){function e(n){if(t[n])return t[n].exports;var r=t[n]={exports:{},id:n,loaded:!1};return i[n].call(r.exports,r,r.exports,e),r.loaded=!0,r.exports}var t={};return e.m=i,e.c=t,e.p="",e(0)})([function(i,e,t){"use strict";var n=t(1),r=(function(){function s(o,a,l){o===void 0&&(o=NaN),a===void 0&&(a=NaN),l===void 0&&(l=!1),this._minFPS=a,this._maxFPS=o,this._timeScale=1,this._currentTick=0,this._currentTime=0,this._tickDeltaTime=0,this._isRunning=!1,this._maxInterval=isNaN(this._minFPS)?NaN:1e3/this._minFPS,this._minInterval=isNaN(this._maxFPS)?NaN:1e3/this._maxFPS,this._onResume=new n.default,this._onPause=new n.default,this._onTick=new n.default,this._onTickOncePerFrame=new n.default,l||this.resume()}return s.prototype.updateOnce=function(o){o(this.currentTimeSeconds,this.tickDeltaTimeSeconds,this.currentTick)},s.prototype.resume=function(){this._isRunning||(this._isRunning=!0,this._lastTimeUpdated=this.getTimer(),this._onResume.dispatch(),this.animateOnce())},s.prototype.pause=function(){this._isRunning&&(this._isRunning=!1,this._onPause.dispatch(),window.cancelAnimationFrame(this._animationFrameHandle))},s.prototype.dispose=function(){this.pause(),this._onResume.removeAll(),this._onPause.removeAll(),this._onTick.removeAll()},Object.defineProperty(s.prototype,"currentTick",{get:function(){return this._currentTick},enumerable:!0,configurable:!0}),Object.defineProperty(s.prototype,"currentTimeSeconds",{get:function(){return this._currentTime/1e3},enumerable:!0,configurable:!0}),Object.defineProperty(s.prototype,"tickDeltaTimeSeconds",{get:function(){return this._tickDeltaTime/1e3},enumerable:!0,configurable:!0}),Object.defineProperty(s.prototype,"timeScale",{get:function(){return this._timeScale},set:function(o){this._timeScale!==o&&(this._timeScale=o)},enumerable:!0,configurable:!0}),Object.defineProperty(s.prototype,"onResume",{get:function(){return this._onResume},enumerable:!0,configurable:!0}),Object.defineProperty(s.prototype,"onPause",{get:function(){return this._onPause},enumerable:!0,configurable:!0}),Object.defineProperty(s.prototype,"onTick",{get:function(){return this._onTick},enumerable:!0,configurable:!0}),Object.defineProperty(s.prototype,"onTickOncePerFrame",{get:function(){return this._onTickOncePerFrame},enumerable:!0,configurable:!0}),Object.defineProperty(s.prototype,"isRunning",{get:function(){return this._isRunning},enumerable:!0,configurable:!0}),s.prototype.animateOnce=function(){var o=this;this._animationFrameHandle=window.requestAnimationFrame(function(){return o.onFrame()})},s.prototype.onFrame=function(){if(this._now=this.getTimer(),this._frameDeltaTime=this._now-this._lastTimeUpdated,isNaN(this._minInterval)||this._frameDeltaTime>=this._minInterval)if(isNaN(this._maxInterval))this.update(this._frameDeltaTime*this._timeScale,!0),this._lastTimeUpdated=this._now;else for(this._interval=Math.min(this._frameDeltaTime,this._maxInterval);this._now>=this._lastTimeUpdated+this._interval;)this.update(this._interval*this._timeScale,this._now<=this._lastTimeUpdated+2*this._maxInterval),this._lastTimeUpdated+=this._interval;this._isRunning&&this.animateOnce()},s.prototype.update=function(o,a){a===void 0&&(a=!0),this._currentTick++,this._currentTime+=o,this._tickDeltaTime=o,this._onTick.dispatch(this.currentTimeSeconds,this.tickDeltaTimeSeconds,this.currentTick),a&&this._onTickOncePerFrame.dispatch(this.currentTimeSeconds,this.tickDeltaTimeSeconds,this.currentTick)},s.prototype.getTimer=function(){return Date.now()},s})();Object.defineProperty(e,"__esModule",{value:!0}),e.default=r},function(i,e,t){(function(n,r){i.exports=r()})(this,function(){return(function(n){function r(o){if(s[o])return s[o].exports;var a=s[o]={exports:{},id:o,loaded:!1};return n[o].call(a.exports,a,a.exports,r),a.loaded=!0,a.exports}var s={};return r.m=n,r.c=s,r.p="",r(0)})([function(n,r){"use strict";var s=(function(){function o(){this.functions=[]}return o.prototype.add=function(a){return this.functions.indexOf(a)===-1&&(this.functions.push(a),!0)},o.prototype.remove=function(a){var l=this.functions.indexOf(a);return l>-1&&(this.functions.splice(l,1),!0)},o.prototype.removeAll=function(){return this.functions.length>0&&(this.functions.length=0,!0)},o.prototype.dispatch=function(){for(var a=[],l=0;l<arguments.length;l++)a[l]=arguments[l];var c=this.functions.concat();c.forEach(function(u){u.apply(void 0,a)})},Object.defineProperty(o.prototype,"numItems",{get:function(){return this.functions.length},enumerable:!0,configurable:!0}),o})();Object.defineProperty(r,"__esModule",{value:!0}),r.default=s}])})}])})});var P9=i=>new Promise(e=>setTimeout(e,i)),is=i=>document.querySelector(i);async function vse(){for(let i=0;i<300&&!(window.__atlasDebug&&!is("#map-loading")?.checkVisibility?.());i+=1)await P9(100)}async function bse(){let i="";for(let e=0;e<100;e+=1){await P9(120),await new Promise(r=>requestAnimationFrame(r)),window.advanceTime?.();let t=window.__atlasDebug.snapshot(),n=JSON.stringify([t.zoom,t.center,t.resolution,t.tileStats]);if(n===i)return;i=n}}function ld(i,e={}){window.dispatchEvent(new KeyboardEvent("keydown",{key:i,bubbles:!0,cancelable:!0,...e}))}function wse(i,e={}){window.dispatchEvent(new KeyboardEvent("keyup",{key:i,bubbles:!0,cancelable:!0,...e}))}function Sse(i){is("#map").dispatchEvent(new KeyboardEvent("keydown",{key:i,bubbles:!0,cancelable:!0}))}function C0(i,e){i.value=e,i.dispatchEvent(new Event("change",{bubbles:!0}))}function P4(i,e){let t=is(i);t.value=e,t.dispatchEvent(new Event("input",{bubbles:!0}))}function I4(i,e=!1){let t=is("#parity-badge");t||(t=document.createElement("div"),t.id="parity-badge",t.style.cssText="position:fixed;top:8px;right:8px;z-index:9999;padding:6px 12px;font:700 13px monospace;border-radius:6px;color:#fff;pointer-events:none;",document.body.append(t)),t.style.background=e?"#b3261e":"#1a7f37",t.textContent=i}async function Tse(){let i=[],e=async p=>{await bse(),i.push({name:p,snapshot:JSON.parse(window.render_game_to_text())})};await vse(),localStorage.clear();let t=is("#game-select"),n=t.options[0].value;C0(t,n),await e("initial"),P4("#pin-search","a"),await e("search-a");let r=is(".search-result");r&&(r.click(),await e("search-select-first"),is("#close-detail").click(),await e("detail-closed")),P4("#pin-search",""),await e("search-cleared");let s=is(".category-row input");s&&(s.click(),await e("category-hidden"),s.click(),await e("category-restored"));let o=is(".only-button");if(o){o.click(),await e("solo-first");let p=is("#solo-chip");p&&!p.hidden&&p.click(),await e("solo-cleared")}let a=is("#legend .layer-title");a&&(a.click(),await e("section-folded"),is("#expand-all").click(),await e("sections-unfolded")),is("#hide-all").click(),await e("all-hidden"),is("#show-all").click(),await e("all-shown");let l=is(".zone-index-item");l&&(l.click(),await e("zone-jumped"),l.dispatchEvent(new MouseEvent("contextmenu",{bubbles:!0,cancelable:!0})),await e("zone-highlighted"),l.dispatchEvent(new MouseEvent("contextmenu",{bubbles:!0,cancelable:!0})),await e("zone-unhighlighted")),ld("g"),await e("grid-open"),P4("#grid-input","m"),await e("grid-descended"),ld(" "),await e("subgrid-hidden"),ld(" "),ld("Escape"),await e("grid-ascended"),ld("Escape"),await e("grid-closed"),ld("z"),await e("labels-on"),wse("z"),await e("labels-off"),ld("b",{metaKey:!0}),await e("sidebar-collapsed"),ld("b",{metaKey:!0}),await e("sidebar-restored"),is("#zoom-in").click(),await e("zoomed-in");let c=is("#overview-dock");c&&!is("#overview-shelf").hidden&&(c.click(),await e("overview-docked"),c.click(),await e("overview-undocked")),is("#zoom-out").click(),await e("zoomed-out"),Sse("Escape"),await e("viewport-escape");let u=is("#variant-select");u.options.length>1&&(C0(u,u.options[1].value),await e("variant-second"),C0(u,u.options[0].value),await e("variant-first"));let f=is("#map-select");return f.options.length>1&&(C0(f,f.options[1].value),await e("map-second"),C0(f,f.options[0].value),await e("map-first")),t.options.length>1&&(C0(t,t.options[1].value),await e("game-second"),C0(t,n),await e("game-first")),localStorage.clear(),{viewport:[window.innerWidth,window.innerHeight],steps:i}}var N4=!1;async function I9(){if(!N4){N4=!0,I4("parity tour running\u2026");try{let i=await Tse(),e=await fetch("/parity/result",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(i,null,2)}),t=(await e.text()).trim();if(!e.ok)throw new Error(`saving failed: ${e.status} ${t}`);I4(`parity tour complete \u2713 ${i.steps.length} steps`),console.log("parity tour saved to",t)}catch(i){I4(`parity tour failed: ${i}`,!0),console.error("parity tour failed",i)}finally{N4=!1}}}window.__atlasTour=I9;window.addEventListener("keydown",i=>{i.key==="F9"&&I9()});var nn=i=>document.querySelector(i),we={game:nn("#game-select"),map:nn("#map-select"),variant:nn("#variant-select"),variantField:nn("#variant-field"),legend:nn("#legend"),search:nn("#pin-search"),searchResults:nn("#dock-results"),dock:nn("#dock"),dockCount:nn("#dock-count"),dockFlag:nn("#dock-flag"),dockFold:nn("#dock-fold"),dockRailName:nn("#dock-rail-name"),visibleCount:nn("#visible-count"),viewport:nn("#map"),globe:nn("#globe"),globeToggle:nn("#globe-toggle"),layers:nn("#layers"),zoneToggle:nn("#zone-toggle"),zoneCount:nn("#zone-count"),zoneIndex:nn("#zone-index"),zoneList:nn("#zone-list"),loading:nn("#map-loading"),labelsHint:nn("#labels-hint"),gridHint:nn("#grid-hint"),soloChip:nn("#solo-chip"),overview:nn("#overview"),overviewShelf:nn("#overview-shelf"),overviewDock:nn("#overview-dock"),overviewCanvas:nn("#overview-canvas"),overviewViewport:nn("#overview-viewport"),gridNavigator:nn("#grid-navigator"),gridInput:nn("#grid-input"),gridBack:nn("#grid-back"),subgridToggle:nn("#subgrid-toggle"),detail:nn("#pin-detail"),detailTitle:nn("#detail-title"),detailCategory:nn("#detail-category"),detailDescription:nn("#detail-description"),detailID:nn("#detail-id"),detailCoordinates:nn("#detail-coordinates"),detailCell:nn("#detail-cell"),detailCellField:nn("#detail-cell-field"),detailSource:nn("#detail-source"),detailSourceField:nn("#detail-source-field"),detailLinks:nn("#detail-links"),detailDot:nn("#detail-dot"),sidebar:nn("#sidebar"),mobileLegend:nn("#mobile-legend"),fatal:nn("#fatal-error"),fatalMessage:nn("#fatal-message"),emptyState:nn("#empty-state"),emptyPath:nn("#empty-path"),emptyOpen:nn("#empty-open"),addBundles:nn("#add-bundles")};function R0(i,e,t,n){i.replaceChildren(),e.forEach((r,s)=>{let o=document.createElement("option");o.value=n?String(r[n]):r.slug||String(s),o.textContent=r[t],i.append(o)})}var k={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,labelsHeld:!1,gridEnabled:!1,globeActive:!1,subgridVisible:!0,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:"",overviewPointer:null,overviewDocked:!1,dockFolded:!0,dockDismissed:!1,renderedShard:0,mapRun:0,textByMap:new Map,restore:null,settling:!1,styleCache:new Map,markerIcons:new Map};var Qm=["#4fb3d5","#c9924b","#82b56a","#c96a6a","#9581cc","#4bc9a9","#d4b04a","#6a92c9","#b08a5a","#8fb3a2"],kl="0123456789bcdefghjkmnpqrstuvwxyz";var L4="atlas.session";var N9={light:"rgba(255, 255, 255, 0.96)",dark:"rgba(7, 9, 7, 0.98)"};var ps={UNKNOWN:0,INTERSECTING:1,ABOVE:2,RIGHT:4,BELOW:8,LEFT:16};function D4(i){let e=Er();for(let t=0,n=i.length;t<n;++t)N0(e,i[t]);return e}function Ese(i,e,t){let n=Math.min.apply(null,i),r=Math.min.apply(null,e),s=Math.max.apply(null,i),o=Math.max.apply(null,e);return al(n,r,s,o,t)}function Jm(i,e,t){return t?(t[0]=i[0]-e,t[1]=i[1]-e,t[2]=i[2]+e,t[3]=i[3]+e,t):[i[0]-e,i[1]-e,i[2]+e,i[3]+e]}function Qb(i,e){return e?(e[0]=i[0],e[1]=i[1],e[2]=i[2],e[3]=i[3],e):i.slice()}function cd(i,e,t){let n,r;return e<i[0]?n=i[0]-e:i[2]<e?n=e-i[2]:n=0,t<i[1]?r=i[1]-t:i[3]<t?r=t-i[3]:r=0,n*n+r*r}function _c(i,e){return ax(i,e[0],e[1])}function pu(i,e){return i[0]<=e[0]&&e[2]<=i[2]&&i[1]<=e[1]&&e[3]<=i[3]}function ax(i,e,t){return i[0]<=e&&e<=i[2]&&i[1]<=t&&t<=i[3]}function Kb(i,e){let t=i[0],n=i[1],r=i[2],s=i[3],o=e[0],a=e[1],l=ps.UNKNOWN;return o<t?l=l|ps.LEFT:o>r&&(l=l|ps.RIGHT),a<n?l=l|ps.BELOW:a>s&&(l=l|ps.ABOVE),l===ps.UNKNOWN&&(l=ps.INTERSECTING),l}function Er(){return[1/0,1/0,-1/0,-1/0]}function al(i,e,t,n,r){return r?(r[0]=i,r[1]=e,r[2]=t,r[3]=n,r):[i,e,t,n]}function P0(i){return al(1/0,1/0,-1/0,-1/0,i)}function Jb(i,e){let t=i[0],n=i[1];return al(t,n,t,n,e)}function eg(i,e,t,n,r){let s=P0(r);return F4(s,i,e,t,n)}function I0(i,e){return i[0]==e[0]&&i[2]==e[2]&&i[1]==e[1]&&i[3]==e[3]}function ew(i,e){return e[0]<i[0]&&(i[0]=e[0]),e[2]>i[2]&&(i[2]=e[2]),e[1]<i[1]&&(i[1]=e[1]),e[3]>i[3]&&(i[3]=e[3]),i}function N0(i,e){e[0]<i[0]&&(i[0]=e[0]),e[0]>i[2]&&(i[2]=e[0]),e[1]<i[1]&&(i[1]=e[1]),e[1]>i[3]&&(i[3]=e[1])}function F4(i,e,t,n,r){for(;t<n;t+=r)Mse(i,e[t],e[t+1]);return i}function Mse(i,e,t){i[0]=Math.min(i[0],e),i[1]=Math.min(i[1],t),i[2]=Math.max(i[2],e),i[3]=Math.max(i[3],t)}function tw(i,e){let t;return t=e(tg(i)),t||(t=e(ng(i)),t)||(t=e(ig(i)),t)||(t=e(Gl(i)),t)?t:!1}function lx(i){let e=0;return mu(i)||(e=Wn(i)*gr(i)),e}function tg(i){return[i[0],i[1]]}function ng(i){return[i[2],i[1]]}function Oa(i){return[(i[0]+i[2])/2,(i[1]+i[3])/2]}function L9(i,e){let t;if(e==="bottom-left")t=tg(i);else if(e==="bottom-right")t=ng(i);else if(e==="top-left")t=Gl(i);else if(e==="top-right")t=ig(i);else throw new Error("Invalid corner");return t}function cx(i,e,t,n,r){let[s,o,a,l,c,u,f,p]=O4(i,e,t,n);return al(Math.min(s,a,c,f),Math.min(o,l,u,p),Math.max(s,a,c,f),Math.max(o,l,u,p),r)}function O4(i,e,t,n){let r=e*n[0]/2,s=e*n[1]/2,o=Math.cos(t),a=Math.sin(t),l=r*o,c=r*a,u=s*o,f=s*a,p=i[0],x=i[1];return[p-l+f,x-c-u,p-l-f,x-c+u,p+l-f,x+c+u,p+l+f,x+c-u,p-l+f,x-c-u]}function gr(i){return i[3]-i[1]}function Au(i,e,t){let n=t||Er();return _r(i,e)?(i[0]>e[0]?n[0]=i[0]:n[0]=e[0],i[1]>e[1]?n[1]=i[1]:n[1]=e[1],i[2]<e[2]?n[2]=i[2]:n[2]=e[2],i[3]<e[3]?n[3]=i[3]:n[3]=e[3]):P0(n),n}function B4(i,e){if(!_r(i,e))return[i.slice()];if(pu(e,i))return[];let[t,n,r,s]=i,o=Math.max(t,e[0]),a=Math.max(n,e[1]),l=Math.min(r,e[2]),c=Math.min(s,e[3]),u=[];return o>t&&u.push([t,n,o,s]),l<r&&u.push([l,n,r,s]),a>n&&u.push([o,n,l,a]),c<s&&u.push([o,c,l,s]),u}function Gl(i){return[i[0],i[3]]}function ig(i){return[i[2],i[3]]}function Wn(i){return i[2]-i[0]}function _r(i,e){return i[0]<=e[2]&&i[2]>=e[0]&&i[1]<=e[3]&&i[3]>=e[1]}function mu(i){return i[2]<i[0]||i[3]<i[1]}function D9(i,e){return e?(e[0]=i[0],e[1]=i[1],e[2]=i[2],e[3]=i[3],e):i}function F9(i,e,t){let n=!1,r=Kb(i,e),s=Kb(i,t);if(r===ps.INTERSECTING||s===ps.INTERSECTING)n=!0;else{let o=i[0],a=i[1],l=i[2],c=i[3],u=e[0],f=e[1],p=t[0],x=t[1],b=(x-f)/(p-u),w,S;s&ps.ABOVE&&!(r&ps.ABOVE)&&(w=p-(x-c)/b,n=w>=o&&w<=l),!n&&s&ps.RIGHT&&!(r&ps.RIGHT)&&(S=x-(p-l)*b,n=S>=a&&S<=c),!n&&s&ps.BELOW&&!(r&ps.BELOW)&&(w=p-(x-a)/b,n=w>=o&&w<=l),!n&&s&ps.LEFT&&!(r&ps.LEFT)&&(S=x-(p-o)*b,n=S>=a&&S<=c)}return n}function O9(i,e,t,n){if(mu(i))return P0(t);let r=[];if(n>1){let a=i[2]-i[0],l=i[3]-i[1];for(let c=0;c<n;++c)r.push(i[0]+a*c/n,i[1],i[2],i[1]+l*c/n,i[2]-a*c/n,i[3],i[0],i[3]-l*c/n)}else r=[i[0],i[1],i[2],i[1],i[2],i[3],i[0],i[3]];e(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 Ese(s,o,t)}function U4(i,e){let t=e.getExtent(),n=Oa(i);if(e.canWrapX()&&(n[0]<t[0]||n[0]>=t[2])){let r=Wn(t),o=Math.floor((n[0]-t[0])/r)*r;i[0]-=o,i[2]-=o}return i}function nw(i,e,t){if(e.canWrapX()){let n=e.getExtent();if(!isFinite(i[0])||!isFinite(i[2]))return[[n[0],i[1],n[2],i[3]]];U4(i,e);let r=Wn(n);if(Wn(i)>r&&!t)return[[n[0],i[1],n[2],i[3]]];if(i[0]<n[0])return[[i[0]+r,i[1],n[2],i[3]],[n[0],i[1],i[2],i[3]]];if(i[2]>n[2])return[[i[0],i[1],n[2],i[3]],[n[0],i[1],i[2]-r,i[3]]]}return[i]}function B9(i,e){let t=[i];for(let n=0,r=e.length;n<r&&t.length>0;++n){let s=[];for(let o=0,a=t.length;o<a;++o)s.push(...B4(t[o],e[n]));t=s}return t}var U9={info:1,warn:2,error:3,none:4},Cse=U9.info;function iw(...i){Cse>U9.warn||console.warn(...i)}function _i(i,e,t){return Math.min(Math.max(i,e),t)}function k9(i,e,t,n,r,s){let o=r-t,a=s-n;if(o!==0||a!==0){let l=((i-t)*o+(e-n)*a)/(o*o+a*a);l>1?(t=r,n=s):l>0&&(t+=o*l,n+=a*l)}return xc(i,e,t,n)}function xc(i,e,t,n){let r=t-i,s=n-e;return r*r+s*s}function G9(i){let e=i.length;for(let n=0;n<e;n++){let r=n,s=Math.abs(i[n][n]);for(let a=n+1;a<e;a++){let l=Math.abs(i[a][n]);l>s&&(s=l,r=a)}if(s===0)return null;let o=i[r];i[r]=i[n],i[n]=o;for(let a=n+1;a<e;a++){let l=-i[a][n]/i[n][n];for(let c=n;c<e+1;c++)n==c?i[a][c]=0:i[a][c]+=l*i[n][c]}}let t=new Array(e);for(let n=e-1;n>=0;n--){t[n]=i[n][e]/i[n][n];for(let r=n-1;r>=0;r--)i[r][e]-=i[r][n]*t[n]}return t}function rw(i){return i*180/Math.PI}function yc(i){return i*Math.PI/180}function gu(i,e){let t=i%e;return t*e<0?t+e:t}function Ro(i,e,t){return i+t*(e-i)}function L0(i,e){let t=Math.pow(10,e);return Math.round(i*t)/t}function ux(i,e){return Math.floor(L0(i,e))}function hx(i,e){return Math.ceil(L0(i,e))}function sw(i,e,t){if(i>=e&&i<t)return i;let n=t-e;return((i-e)%n+n)%n+e}function z9(i,e){return i[0]+=+e[0],i[1]+=+e[1],i}function D0(i,e){let t=!0;for(let n=i.length-1;n>=0;--n)if(i[n]!=e[n]){t=!1;break}return t}function rg(i,e){let t=Math.cos(e),n=Math.sin(e),r=i[0]*t-i[1]*n,s=i[1]*t+i[0]*n;return i[0]=r,i[1]=s,i}function V9(i,e){return i[0]*=e,i[1]*=e,i}function ow(i,e){if(e.canWrapX()){let t=Wn(e.getExtent()),n=q9(i,e,t);n&&(i[0]-=n*t)}return i}function q9(i,e,t){let n=e.getExtent(),r=0;return e.canWrapX()&&(i[0]<n[0]||i[0]>n[2])&&(t=t||Wn(n),r=Math.floor((i[0]-n[0])/t)),r}function H9(i,e,t){let n=Math.sqrt((e[0]-i[0])*(e[0]-i[0])+(e[1]-i[1])*(e[1]-i[1])),r=[(e[0]-i[0])/n,(e[1]-i[1])/n],s=[-r[1],r[0]],o=Math.sqrt((t[0]-i[0])*(t[0]-i[0])+(t[1]-i[1])*(t[1]-i[1])),a=[(t[0]-i[0])/o,(t[1]-i[1])/o],l=n===0||o===0?0:Math.acos(_i(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}var Xh={radians:6370997/(2*Math.PI),degrees:2*Math.PI*6370997/360,ft:.3048,m:1,"us-ft":1200/3937};var k4=class{constructor(e){this.code_=e.code,this.units_=e.units,this.extent_=e.extent!==void 0?e.extent:null,this.worldExtent_=e.worldExtent!==void 0?e.worldExtent:null,this.axisOrientation_=e.axisOrientation!==void 0?e.axisOrientation:"enu",this.global_=e.global!==void 0?e.global:!1,this.canWrapX_=!!(this.global_&&this.extent_),this.getPointResolutionFunc_=e.getPointResolution,this.defaultTileGrid_=null,this.metersPerUnit_=e.metersPerUnit}canWrapX(){return this.canWrapX_}getCode(){return this.code_}getExtent(){return this.extent_}getUnits(){return this.units_}getMetersPerUnit(){return this.metersPerUnit_||Xh[this.units_]}getWorldExtent(){return this.worldExtent_}getAxisOrientation(){return this.axisOrientation_}isGlobal(){return this.global_}setGlobal(e){this.global_=e,this.canWrapX_=!!(e&&this.extent_)}getDefaultTileGrid(){return this.defaultTileGrid_}setDefaultTileGrid(e){this.defaultTileGrid_=e}setExtent(e){this.extent_=e,this.canWrapX_=!!(this.global_&&e)}setWorldExtent(e){this.worldExtent_=e}setGetPointResolution(e){this.getPointResolutionFunc_=e}getPointResolutionFunc(){return this.getPointResolutionFunc_}},ud=k4;var fx=6378137,sg=Math.PI*fx,Rse=[-sg,-sg,sg,sg],Pse=[-180,-85,180,85],aw=fx*Math.log(Math.tan(Math.PI/2)),hd=class extends ud{constructor(e){super({code:e,units:"m",extent:Rse,global:!0,worldExtent:Pse,getPointResolution:function(t,n){return t/Math.cosh(n[1]/fx)}})}},G4=[new hd("EPSG:3857"),new hd("EPSG:102100"),new hd("EPSG:102113"),new hd("EPSG:900913"),new hd("http://www.opengis.net/def/crs/EPSG/0/3857"),new hd("http://www.opengis.net/gml/srs/epsg.xml#3857")];function W9(i,e,t,n){let r=i.length;t=t>1?t:2,n=n??t,e===void 0&&(t>2?e=i.slice():e=new Array(r));for(let s=0;s<r;s+=n){e[s]=sg*i[s]/180;let o=fx*Math.log(Math.tan(Math.PI*(+i[s+1]+90)/360));o>aw?o=aw:o<-aw&&(o=-aw),e[s+1]=o}return e}function j9(i,e,t,n){let r=i.length;t=t>1?t:2,n=n??t,e===void 0&&(t>2?e=i.slice():e=new Array(r));for(let s=0;s<r;s+=n)e[s]=180*i[s]/sg,e[s+1]=360*Math.atan(Math.exp(i[s+1]/fx))/Math.PI-90;return e}var Ise=6378137,X9=[-180,-90,180,90],Nse=Math.PI*Ise/180,$h=class extends ud{constructor(e,t){super({code:e,units:"degrees",extent:X9,axisOrientation:t,global:!0,metersPerUnit:Nse,worldExtent:X9})}},z4=[new $h("CRS:84"),new $h("EPSG:4326","neu"),new $h("urn:ogc:def:crs:OGC:1.3:CRS84"),new $h("urn:ogc:def:crs:OGC:2:84"),new $h("http://www.opengis.net/def/crs/OGC/1.3/CRS84"),new $h("http://www.opengis.net/gml/srs/epsg.xml#4326","neu"),new $h("http://www.opengis.net/def/crs/EPSG/0/4326","neu")];var V4={};function $9(i){return V4[i]||V4[i.replace(/urn:(x-)?ogc:def:crs:EPSG:(.*:)?(\w+)$/,"EPSG:$3")]||null}function Y9(i,e){V4[i]=e}function _u(i){for(let e in i)delete i[e]}function vc(i){let e;for(e in i)return!1;return!e}var og={};function ag(i,e,t){let n=i.getCode(),r=e.getCode();n in og||(og[n]={}),og[n][r]=t}function lw(i,e){return i in og&&e in og[i]?og[i][e]:null}var cw=.9996,zl=.00669438,hw=zl*zl,fw=hw*zl,F0=zl/(1-zl),Z9=Math.sqrt(1-zl),lg=(1-Z9)/(1+Z9),eG=lg*lg,q4=eG*lg,H4=q4*lg,tG=H4*lg,nG=1-zl/4-3*hw/64-5*fw/256,Lse=3*zl/8+3*hw/32+45*fw/1024,Dse=15*hw/256+45*fw/1024,Fse=35*fw/3072,Ose=3/2*lg-27/32*q4+269/512*tG,Bse=21/16*eG-55/32*H4,Use=151/96*q4-417/128*tG,kse=1097/512*H4,uw=6378137;function Gse(i,e,t){let n=i-5e5,o=(t.north?e:e-1e7)/cw/(uw*nG),a=o+Ose*Math.sin(2*o)+Bse*Math.sin(4*o)+Use*Math.sin(6*o)+kse*Math.sin(8*o),l=Math.sin(a),c=l*l,u=Math.cos(a),f=l/u,p=f*f,x=p*p,b=1-zl*c,w=Math.sqrt(1-zl*c),S=uw/w,T=(1-zl)/b,P=F0*u**2,R=P*P,C=n/(S*cw),L=C*C,D=L*C,F=D*C,N=F*C,B=N*C,z=a-f/T*(L/2-F/24*(5+3*p+10*P-4*R-9*F0))+B/720*(61+90*p+298*P+45*x-252*F0-3*R),V=(C-D/6*(1+2*p+P)+N/120*(5-2*P+28*p-3*R+8*F0+24*x))/u;return V=sw(V+yc(iG(t.number)),-Math.PI,Math.PI),[rw(V),rw(z)]}var K9=-80,Q9=84,zse=-180,Vse=180;function qse(i,e,t){i=sw(i,zse,Vse),e<K9?e=K9:e>Q9&&(e=Q9);let n=yc(e),r=Math.sin(n),s=Math.cos(n),o=r/s,a=o*o,l=a*a,c=yc(i),u=iG(t.number),f=yc(u),p=uw/Math.sqrt(1-zl*r**2),x=F0*s**2,b=s*sw(c-f,-Math.PI,Math.PI),w=b*b,S=w*b,T=S*b,P=T*b,R=P*b,C=uw*(nG*n-Lse*Math.sin(2*n)+Dse*Math.sin(4*n)-Fse*Math.sin(6*n)),L=cw*p*(b+S/6*(1-a+x)+P/120*(5-18*a+l+72*x-58*F0))+5e5,D=cw*(C+p*o*(w/2+T/24*(5-a+9*x+4*x**2)+R/720*(61-58*a+l+600*x-330*F0)));return t.north||(D+=1e7),[L,D]}function iG(i){return(i-1)*6-180+3}var Hse=[/^EPSG:(\d+)$/,/^urn:ogc:def:crs:EPSG::(\d+)$/,/^http:\/\/www\.opengis\.net\/def\/crs\/EPSG\/0\/(\d+)$/];function rG(i){let e=0;for(let r of Hse){let s=i.match(r);if(s){e=parseInt(s[1]);break}}if(!e)return null;let t=0,n=!1;return e>32700&&e<32761?t=e-32700:e>32600&&e<32661&&(n=!0,t=e-32600),t?{number:t,north:n}:null}function J9(i,e){return function(t,n,r,s){let o=t.length;r=r>1?r:2,s=s??r,n||(r>2?n=t.slice():n=new Array(o));for(let a=0;a<o;a+=s){let l=t[a],c=t[a+1],u=i(l,c,e);n[a]=u[0],n[a+1]=u[1]}return n}}function sG(i){return rG(i)?new ud({code:i,units:"m"}):null}function oG(i){let e=rG(i.getCode());return e?{forward:J9(qse,e),inverse:J9(Gse,e)}:null}var Wse=63710088e-1;function W4(i,e,t){t=t||Wse;let n=yc(i[1]),r=yc(e[1]),s=(r-n)/2,o=yc(e[0]-i[0])/2,a=Math.sin(s)*Math.sin(s)+Math.sin(o)*Math.sin(o)*Math.cos(n)*Math.cos(r);return 2*t*Math.atan2(Math.sqrt(a),Math.sqrt(1-a))}var jse=[oG],Xse=[sG];var X4=!0;function lG(i){X4=!(i===void 0?!0:i)}function Y4(i,e){if(e!==void 0){for(let t=0,n=i.length;t<n;++t)e[t]=i[t];e=e}else e=i.slice();return e}function $4(i){Y9(i.getCode(),i),ag(i,i,Y4)}function $se(i){i.forEach($4)}function As(i){if(typeof i!="string")return i;let e=$9(i);if(e)return e;for(let t of Xse){let n=t(i);if(n)return n}return null}function Z4(i,e,t,n){i=As(i);let r,s=i.getPointResolutionFunc();if(s){if(r=s(e,t),n&&n!==i.getUnits()){let o=i.getMetersPerUnit();o&&(r=r*o/Xh[n])}}else{let o=i.getUnits();if(o=="degrees"&&!n||n=="degrees")r=e;else{let a=O0(i,As("EPSG:4326"));if(!a&&o!=="degrees")r=e*i.getMetersPerUnit();else{let c=[t[0]-e/2,t[1],t[0]+e/2,t[1],t[0],t[1]-e/2,t[0],t[1]+e/2];c=a(c,c,2);let u=W4(c.slice(0,2),c.slice(2,4)),f=W4(c.slice(4,6),c.slice(6,8));r=(u+f)/2}let l=n?Xh[n]:i.getMetersPerUnit();l!==void 0&&(r/=l)}}return r}function aG(i){$se(i),i.forEach(function(e){i.forEach(function(t){e!==t&&ag(e,t,Y4)})})}function Yse(i,e,t,n){i.forEach(function(r){e.forEach(function(s){ag(r,s,t),ag(s,r,n)})})}function dw(i,e){return i?typeof i=="string"?As(i):i:As(e)}function cG(i){return(function(e,t,n,r){let s=e.length;n=n!==void 0?n:2,r=r??n,t=t!==void 0?t:new Array(s);for(let o=0;o<s;o+=r){let a=i(e.slice(o,o+n)),l=a.length;for(let c=0,u=r;c<u;++c)t[o+c]=c>=l?e[o+c]:a[c]}return t})}function cg(i,e){if(i===e)return!0;let t=i.getUnits()===e.getUnits();return(i.getCode()===e.getCode()||O0(i,e)===Y4)&&t}function O0(i,e){let t=i.getCode(),n=e.getCode(),r=lw(t,n);if(r)return r;let s=null,o=null;for(let l of jse)s||(s=l(i)),o||(o=l(e));if(!s&&!o)return null;let a="EPSG:4326";if(o)if(s)r=j4(s.inverse,o.forward);else{let l=lw(t,a);l&&(r=j4(l,o.forward))}else{let l=lw(a,n);l&&(r=j4(s.inverse,l))}return r&&($4(i),$4(e),ag(i,e,r)),r}function j4(i,e){return function(t,n,r,s){return n=i(t,n,r,s),e(n,n,r,s)}}function B0(i,e){let t=As(i),n=As(e);return O0(t,n)}function ug(i,e,t){let n=B0(e,t);if(!n){let r=As(e).getCode(),s=As(t).getCode();throw new Error(`No transform available between ${r} and ${s}`)}return n(i,void 0,i.length)}function uG(i,e,t,n){let r=B0(e,t);return O9(i,r,void 0,n)}var bc=null;function U0(){return bc}function dx(i,e){return bc?ug(i,e,bc):i}function wc(i,e){return bc?ug(i,bc,e):(X4&&!D0(i,[0,0])&&i[0]>=-180&&i[0]<=180&&i[1]>=-90&&i[1]<=90&&(X4=!1,iw("Call useGeographic() from ol/proj once to work with [longitude, latitude] coordinates.")),i)}function fd(i,e){return bc?uG(i,e,bc):i}function Sc(i,e){return bc?uG(i,bc,e):i}function hG(i,e){if(!bc)return i;let t=As(e).getMetersPerUnit(),n=bc.getMetersPerUnit();return t&&n?i*t/n:i}function Zse(){aG(G4),aG(z4),Yse(z4,G4,W9,j9)}Zse();function K4(i){return i[0]>0&&i[1]>0}function fG(i,e,t){return t===void 0&&(t=[0,0]),t[0]=i[0]*e+.5|0,t[1]=i[1]*e+.5|0,t}function Vr(i,e){return Array.isArray(i)?i:(e===void 0?e=[i,i]:(e[0]=i,e[1]=i),e)}var pw=class{constructor(e,t,n,r){this.minX=e,this.maxX=t,this.minY=n,this.maxY=r}contains(e){return this.containsXY(e[1],e[2])}containsTileRange(e){return this.minX<=e.minX&&e.maxX<=this.maxX&&this.minY<=e.minY&&e.maxY<=this.maxY}containsXY(e,t){return this.minX<=e&&e<=this.maxX&&this.minY<=t&&t<=this.maxY}equals(e){return this.minX==e.minX&&this.minY==e.minY&&this.maxX==e.maxX&&this.maxY==e.maxY}extend(e){e.minX<this.minX&&(this.minX=e.minX),e.maxX>this.maxX&&(this.maxX=e.maxX),e.minY<this.minY&&(this.minY=e.minY),e.maxY>this.maxY&&(this.maxY=e.maxY)}getHeight(){return this.maxY-this.minY+1}getSize(){return[this.getWidth(),this.getHeight()]}getWidth(){return this.maxX-this.minX+1}intersects(e){return this.minX<=e.maxX&&this.maxX>=e.minX&&this.minY<=e.maxY&&this.maxY>=e.minY}};function k0(i,e,t,n,r){return r!==void 0?(r.minX=i,r.maxX=e,r.minY=t,r.maxY=n,r):new pw(i,e,t,n)}var Aw=pw;function dG(i,e,t){let n,r;t=t||Ba;let s=0,o=i.length,a=!1;for(;s<o;)n=s+(o-s>>1),r=+t(i[n],e),r<0?s=n+1:(o=n,a=!r);return a?s:~s}function Ba(i,e){return i>e?1:i<e?-1:0}function pG(i,e){return i<e?1:i>e?-1:0}function hg(i,e,t){if(i[0]<=e)return 0;let n=i.length;if(e<=i[n-1])return n-1;if(typeof t=="function"){for(let r=1;r<n;++r){let s=i[r];if(s===e)return r;if(s<e)return t(e,i[r-1],s)>0?r-1:r}return n-1}if(t>0){for(let r=1;r<n;++r)if(i[r]<e)return r-1;return n-1}if(t<0){for(let r=1;r<n;++r)if(i[r]<=e)return r;return n-1}for(let r=1;r<n;++r){if(i[r]==e)return r;if(i[r]<e)return i[r-1]-e<e-i[r]?r-1:r}return n-1}function AG(i,e,t){for(;e<t;){let n=i[e];i[e]=i[t],i[t]=n,++e,--t}}function Tc(i,e){let t=Array.isArray(e)?e:[e],n=t.length;for(let r=0;r<n;r++)i[i.length]=t[r]}function Po(i,e){let t=i.length;if(t!==e.length)return!1;for(let n=0;n<t;n++)if(i[n]!==e[n])return!1;return!0}function mG(i,e,t){let n=e||Ba;return i.every(function(r,s){if(s===0)return!0;let o=n(i[s-1],r);return!(o>0||t&&o===0)})}function zn(i,e){if(!i)throw new Error(e)}function gG(i,e,t,n,r){return!tw(r,function(o){return!dd(i,e,t,n,o[0],o[1])})}function dd(i,e,t,n,r,s){let o=0,a=i[t-n],l=i[t-n+1];for(;e<t;e+=n){let c=i[e],u=i[e+1];l<=s?u>s&&(c-a)*(s-l)-(r-a)*(u-l)>0&&o++:u<=s&&(c-a)*(s-l)-(r-a)*(u-l)<0&&o--,a=c,l=u}return o!==0}function px(i,e,t,n,r,s){if(t.length===0||!dd(i,e,t[0],n,r,s))return!1;for(let o=1,a=t.length;o<a;++o)if(dd(i,t[o-1],t[o],n,r,s))return!1;return!0}function _G(i,e,t,n,r,s){if(t.length===0)return!1;for(let o=0,a=t.length;o<a;++o){let l=t[o];if(px(i,e,l,n,r,s))return!0;e=l[l.length-1]}return!1}function xG(i,e,t,n,r){let s;for(e+=n;e<t;e+=n)if(s=r(i.slice(e-n,e),i.slice(e,e+n)),s)return s;return!1}function mw(i,e,t,n,r,s){return s=s??F4(Er(),i,e,t,n),_r(r,s)?s[0]>=r[0]&&s[2]<=r[2]||s[1]>=r[1]&&s[3]<=r[3]?!0:xG(i,e,t,n,function(o,a){return F9(r,o,a)}):!1}function Q4(i,e,t,n,r){return!!(mw(i,e,t,n,r)||dd(i,e,t,n,r[0],r[1])||dd(i,e,t,n,r[0],r[3])||dd(i,e,t,n,r[2],r[1])||dd(i,e,t,n,r[2],r[3]))}function J4(i,e,t,n,r){if(!Q4(i,e,t[0],n,r))return!1;if(t.length===1)return!0;for(let s=1,o=t.length;s<o;++s)if(gG(i,t[s-1],t[s],n,r)&&!mw(i,t[s-1],t[s],n,r))return!1;return!0}function yG(i,e,t,n,r){for(let s=0,o=t.length;s<o;++s){let a=t[s];if(J4(i,e,a,n,r))return!0;e=a[a.length-1]}return!1}function $n(){throw new Error("Unimplemented abstract method.")}var Kse=0;function Nn(i){return i.ol_uid||(i.ol_uid=String(++Kse))}function fg(i,e,t,n){return n!==void 0?(n[0]=i,n[1]=e,n[2]=t,n):[i,e,t]}function Qse(i,e,t){return i+"/"+e+"/"+t}function dg(i,e,t,n,r){return`${Nn(i)},${e},${Qse(t,n,r)}`}function vG(i){return Jse(i[0],i[1],i[2])}function Jse(i,e,t){return(e<<i)+t}function bG(i,e){let t=i[0],n=i[1],r=i[2];if(e.getMinZoom()>t||t>e.getMaxZoom())return!1;let s=e.getFullTileRange(t);return s?s.containsXY(n,r):!0}var pg=[0,0,0],pd=5,eP=class{constructor(e){let t=e.minZoom,n=e.resolutions;t===void 0&&n&&(t=n.findIndex(o=>o!==void 0)),this.minZoom=t!==void 0?t:0,this.resolutions_=n,zn(mG(this.resolutions_,(o,a)=>a-o,!0),"`resolutions` must be sorted in descending order");let r;if(!e.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_=e.origin!==void 0?e.origin:null,this.origins_=null,e.origins!==void 0&&(this.origins_=e.origins,zn(this.origins_.length==this.resolutions_.length,"Number of `origins` and `resolutions` must be equal"));let s=e.extent;s!==void 0&&!this.origin_&&!this.origins_&&(this.origin_=Gl(s)),zn(!this.origin_&&this.origins_||this.origin_&&!this.origins_,"Either `origin` or `origins` must be configured, never both"),this.tileSizes_=null,e.tileSizes!==void 0&&(this.tileSizes_=e.tileSizes,zn(this.tileSizes_.length==this.resolutions_.length,"Number of `tileSizes` and `resolutions` must be equal")),this.tileSize_=e.tileSize!==void 0?e.tileSize:this.tileSizes_?null:256,zn(!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],e.tileRanges!==void 0?this.fullTileRanges_=e.tileRanges:e.sizes!==void 0?this.fullTileRanges_=e.sizes.map((o,a)=>{let l=new Aw(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 c=this.getTileRangeForExtentAndZ(s,a);l.minX=Math.max(c.minX,l.minX),l.maxX=Math.min(c.maxX,l.maxX),l.minY=Math.max(c.minY,l.minY),l.maxY=Math.min(c.maxY,l.maxY)}return l}):s&&this.calculateTileRanges_(s)}forEachTileCoord(e,t,n){let r=this.getTileRangeForExtentAndZ(e,t);for(let s=r.minX,o=r.maxX;s<=o;++s)for(let a=r.minY,l=r.maxY;a<=l;++a)n([t,s,a])}forEachTileCoordParentTileRange(e,t,n,r){let s,o,a,l=null,c=e[0]-1;for(this.zoomFactor_===2?(o=e[1],a=e[2]):l=this.getTileCoordExtent(e,r);c>=this.minZoom;){if(o!==void 0&&a!==void 0?(o=Math.floor(o/2),a=Math.floor(a/2),s=k0(o,o,a,a,n)):s=this.getTileRangeForExtentAndZ(l,c,n),t(c,s))return!0;--c}return!1}getExtent(){return this.extent_}getMaxZoom(){return this.maxZoom}getMinZoom(){return this.minZoom}getOrigin(e){return this.origin_?this.origin_:this.origins_[e]}getOrigins(){return this.origins_}getResolution(e){return this.resolutions_[e]}getResolutions(){return this.resolutions_}getTileCoordChildTileRange(e,t,n){if(e[0]<this.maxZoom){if(this.zoomFactor_===2){let s=e[1]*2,o=e[2]*2;return k0(s,s+1,o,o+1,t)}let r=this.getTileCoordExtent(e,n||this.tmpExtent_);return this.getTileRangeForExtentAndZ(r,e[0]+1,t)}return null}getTileRangeForTileCoordAndZ(e,t,n){if(t>this.maxZoom||t<this.minZoom)return null;let r=e[0],s=e[1],o=e[2];if(t===r)return k0(s,o,s,o,n);if(this.zoomFactor_){let l=Math.pow(this.zoomFactor_,t-r),c=Math.floor(s*l),u=Math.floor(o*l);if(t<r)return k0(c,c,u,u,n);let f=Math.floor(l*(s+1))-1,p=Math.floor(l*(o+1))-1;return k0(c,f,u,p,n)}let a=this.getTileCoordExtent(e,this.tmpExtent_);return this.getTileRangeForExtentAndZ(a,t,n)}getTileRangeForExtentAndZ(e,t,n){this.getTileCoordForXYAndZ_(e[0],e[3],t,!1,pg);let r=pg[1],s=pg[2];this.getTileCoordForXYAndZ_(e[2],e[1],t,!0,pg);let o=pg[1],a=pg[2];return k0(r,o,s,a,n)}getTileCoordCenter(e){let t=this.getOrigin(e[0]),n=this.getResolution(e[0]),r=Vr(this.getTileSize(e[0]),this.tmpSize_);return[t[0]+(e[1]+.5)*r[0]*n,t[1]-(e[2]+.5)*r[1]*n]}getTileCoordExtent(e,t){let n=this.getOrigin(e[0]),r=this.getResolution(e[0]),s=Vr(this.getTileSize(e[0]),this.tmpSize_),o=n[0]+e[1]*s[0]*r,a=n[1]-(e[2]+1)*s[1]*r,l=o+s[0]*r,c=a+s[1]*r;return al(o,a,l,c,t)}getTileCoordForCoordAndResolution(e,t,n){return this.getTileCoordForXYAndResolution_(e[0],e[1],t,!1,n)}getTileCoordForXYAndResolution_(e,t,n,r,s){let o=this.getZForResolution(n),a=n/this.getResolution(o),l=this.getOrigin(o),c=Vr(this.getTileSize(o),this.tmpSize_),u=a*(e-l[0])/n/c[0],f=a*(l[1]-t)/n/c[1];return r?(u=hx(u,pd)-1,f=hx(f,pd)-1):(u=ux(u,pd),f=ux(f,pd)),fg(o,u,f,s)}getTileCoordForXYAndZ_(e,t,n,r,s){let o=this.getOrigin(n),a=this.getResolution(n),l=Vr(this.getTileSize(n),this.tmpSize_),c=(e-o[0])/a/l[0],u=(o[1]-t)/a/l[1];return r?(c=hx(c,pd)-1,u=hx(u,pd)-1):(c=ux(c,pd),u=ux(u,pd)),fg(n,c,u,s)}getTileCoordForCoordAndZ(e,t,n){return this.getTileCoordForXYAndZ_(e[0],e[1],t,!1,n)}getTileCoordResolution(e){return this.resolutions_[e[0]]}getTileSize(e){return this.tileSize_?this.tileSize_:this.tileSizes_[e]}getFullTileRange(e){return this.fullTileRanges_?this.fullTileRanges_[e]:this.extent_?this.getTileRangeForExtentAndZ(this.extent_,e):null}getZForResolution(e,t){let n=hg(this.resolutions_,e,t||0);return _i(n,this.minZoom,this.maxZoom)}tileCoordIntersectsViewport(e,t){return Q4(t,0,t.length,2,this.getTileCoordExtent(e))}calculateTileRanges_(e){let t=this.resolutions_.length,n=new Array(t);for(let r=this.minZoom;r<t;++r)n[r]=this.getTileRangeForExtentAndZ(e,r);this.fullTileRanges_=n}},Ax=eP;function gw(i){let e=i.getDefaultTileGrid();return e||(e=toe(i),i.setDefaultTileGrid(e)),e}function SG(i,e,t){let n=e[0],r=i.getTileCoordCenter(e),s=_w(t);if(!_c(s,r)){let o=Wn(s),a=Math.ceil((s[0]-r[0])/o);return r[0]+=o*a,i.getTileCoordForCoordAndZ(r,n)}return e}function eoe(i,e,t,n){n=n!==void 0?n:"top-left";let r=EG(i,e,t);return new Ax({extent:i,origin:L9(i,n),resolutions:r,tileSize:t})}function TG(i){let e=i||{},t=e.extent||As("EPSG:3857").getExtent(),n={extent:t,minZoom:e.minZoom,tileSize:e.tileSize,resolutions:EG(t,e.maxZoom,e.tileSize,e.maxResolution)};return new Ax(n)}function EG(i,e,t,n){e=e!==void 0?e:42,t=Vr(t!==void 0?t:256);let r=gr(i),s=Wn(i);n=n>0?n:Math.max(s/t[0],r/t[1]);let o=e+1,a=new Array(o);for(let l=0;l<o;++l)a[l]=n/Math.pow(2,l);return a}function toe(i,e,t,n){let r=_w(i);return eoe(r,e,t,n)}function _w(i){i=As(i);let e=i.getExtent();if(!e){let t=180*Xh.degrees/i.getMetersPerUnit();e=al(-t,-t,t,t)}return e}var Mn={IDLE:0,LOADING:1,LOADED:2,ERROR:3,EMPTY:4};function Un(i,e,t,n,r){if(r){let o=t;t=function(a){return i.removeEventListener(e,t),o.call(n??this,a)}}else n&&n!==i&&(t=t.bind(n));let s={target:i,type:e,listener:t};return i.addEventListener(e,t),s}function Ag(i,e,t,n){return Un(i,e,t,n,!0)}function ii(i){i&&i.target&&(i.target.removeEventListener(i.type,i.listener),_u(i))}var Jt={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 tP=class{constructor(){this.disposed=!1}dispose(){this.disposed||(this.disposed=!0,this.disposeInternal())}disposeInternal(){}},Ad=tP;function Yh(){return!0}function Zh(){return!1}function Kh(){}function xw(i){let e,t,n;return function(){let r=Array.prototype.slice.call(arguments);return(!t||this!==n||!Po(r,t))&&(n=this,t=r,e=i.apply(this,arguments)),e}}function MG(i){function e(){let t;try{t=i()}catch(n){return Promise.reject(n)}return t instanceof Promise?t:Promise.resolve(t)}return e()}var nP=class{constructor(e){this.propagationStopped,this.defaultPrevented,this.type=e,this.target=null}preventDefault(){this.defaultPrevented=!0}stopPropagation(){this.propagationStopped=!0}};var js=nP;var iP=class extends Ad{constructor(e){super(),this.eventTarget_=e,this.pendingRemovals_=null,this.dispatching_=null,this.listeners_=null}addEventListener(e,t){if(!e||!t)return;let n=this.listeners_||(this.listeners_={}),r=n[e]||(n[e]=[]);r.includes(t)||r.push(t)}dispatchEvent(e){let t=typeof e=="string",n=t?e:e.type,r=this.listeners_&&this.listeners_[n];if(!r)return;let s=t?new js(e):e;s.target||(s.target=this.eventTarget_||this);let o=this.dispatching_||(this.dispatching_={}),a=this.pendingRemovals_||(this.pendingRemovals_={});n in o||(o[n]=0,a[n]=0),++o[n];let l;for(let c=0,u=r.length;c<u;++c)if("handleEvent"in r[c]?l=r[c].handleEvent(s):l=r[c].call(this,s),l===!1||s.propagationStopped){l=!1;break}if(--o[n]===0){let c=a[n];for(delete a[n];c--;)this.removeEventListener(n,Kh);delete o[n]}return l}disposeInternal(){this.listeners_&&_u(this.listeners_)}getListeners(e){return this.listeners_&&this.listeners_[e]||void 0}hasListener(e){return this.listeners_?e?e in this.listeners_:Object.keys(this.listeners_).length>0:!1}removeEventListener(e,t){if(!this.listeners_)return;let n=this.listeners_[e];if(!n)return;let r=n.indexOf(t);r!==-1&&(this.pendingRemovals_&&e in this.pendingRemovals_?(n[r]=Kh,++this.pendingRemovals_[e]):(n.splice(r,1),n.length===0&&delete this.listeners_[e]))}},md=iP;var G0=typeof navigator<"u"&&typeof navigator.userAgent<"u"?navigator.userAgent.toLowerCase():"",noe=G0.includes("safari")&&!G0.includes("chrom"),yIe=noe&&(G0.includes("version/15.4")||/cpu (os|iphone os) 15_4 like mac os x/.test(G0)),CG=G0.includes("webkit")&&!G0.includes("edge"),rP=G0.includes("macintosh"),RG=typeof devicePixelRatio<"u"?devicePixelRatio:1,Ns=typeof WorkerGlobalScope<"u"&&typeof OffscreenCanvas<"u"&&self instanceof WorkerGlobalScope,sP=typeof Image<"u"&&Image.prototype.decode;var yw=(function(){let i=!1;try{let e=Object.defineProperty({},"passive",{get:function(){i=!0}});window.addEventListener("_",null,e),window.removeEventListener("_",null,e)}catch{}return i})();function PG(i,e,t){let n=i,r=!0,s=!1,o=!1,a=[Ag(n,Jt.LOAD,function(){o=!0,s||e()})];return n.src&&sP?(s=!0,n.decode().then(function(){r&&e()}).catch(function(l){r&&(o?e():t())})):a.push(Ag(n,Jt.ERROR,t)),function(){r=!1,a.forEach(ii)}}function ioe(i,e){return new Promise((t,n)=>{function r(){o(),t(i)}function s(){o(),n(new Error("Image load error"))}function o(){i.removeEventListener("load",r),i.removeEventListener("error",s)}i.addEventListener("load",r),i.addEventListener("error",s),e&&(i.src=e)})}function IG(i,e){return e&&(i.src=e),i.src&&sP?new Promise((t,n)=>i.decode().then(()=>t(i)).catch(r=>i.complete&&i.width?t(i):n(r))):ioe(i)}var rn={IDLE:0,LOADING:1,LOADED:2,ERROR:3,EMPTY:4};function oP(i){return Math.pow(i,3)}function Vl(i){return 1-oP(1-i)}function NG(i){return 3*i*i-2*i*i*i}function LG(i){return i}var aP=class extends md{constructor(e,t,n){super(),n=n||{},this.tileCoord=e,this.state=t,this.key="",this.transition_=n.transition===void 0?250:n.transition,this.transitionStarts_={},this.interpolate=!!n.interpolate}changed(){this.dispatchEvent(Jt.CHANGE)}release(){this.setState(rn.EMPTY)}getKey(){return this.key+"/"+this.tileCoord}getTileCoord(){return this.tileCoord}getState(){return this.state}setState(e){if(this.state!==rn.EMPTY){if(this.state!==rn.ERROR&&this.state>e)throw new Error("Tile load sequence violation");this.state=e,this.changed()}}load(){$n()}getAlpha(e,t){if(!this.transition_)return 1;let n=this.transitionStarts_[e];if(!n)n=t,this.transitionStarts_[e]=n;else if(n===-1)return 1;let r=t-n+1e3/60;return r>=this.transition_?1:oP(r/this.transition_)}inTransition(e){return this.transition_?this.transitionStarts_[e]!==-1:!1}endTransition(e){this.transition_&&(this.transitionStarts_[e]=-1)}disposeInternal(){this.release(),super.disposeInternal()}},mg=aP;function Si(i,e,t,n){let r;return t&&t.length?r=t.shift():Ns?r=new class extends OffscreenCanvas{style={}}(i??300,e??150):r=document.createElement("canvas"),i&&(r.width=i),e&&(r.height=e),r.getContext("2d",n)}var lP;function mx(){return lP||(lP=Si(1,1)),lP}function z0(i){let e=i.canvas;e.width=1,e.height=1,i.clearRect(0,0,1,1)}function cP(i,e){let t=e.parentNode;t&&t.replaceChild(i,e)}function DG(i){for(;i.lastChild;)i.lastChild.remove()}function FG(i,e){let t=i.childNodes;for(let n=0;;++n){let r=t[n],s=e[n];if(!r&&!s)break;if(r!==s){if(!r){i.appendChild(s);continue}if(!s){i.removeChild(r),--n;continue}i.insertBefore(s,r)}}}function vw(){return new Proxy({childNodes:[],appendChild:function(e){return this.childNodes.push(e),e},remove:function(){},removeChild:function(e){let t=this.childNodes.indexOf(e);if(t===-1)throw new Error("Node to remove was not found");return this.childNodes.splice(t,1),e},insertBefore:function(e,t){let n=this.childNodes.indexOf(t);if(n===-1)throw new Error("Reference node not found");return this.childNodes.splice(n,0,e),e},style:{}},{get(e,t,n){return t==="firstElementChild"?e.childNodes.length>0?e.childNodes[0]:null:Reflect.get(e,t,n)}})}function ll(i){return typeof HTMLCanvasElement<"u"&&i instanceof HTMLCanvasElement||typeof OffscreenCanvas<"u"&&i instanceof OffscreenCanvas}var uP=class extends mg{constructor(e,t,n,r,s,o){super(e,t,o),this.crossOrigin_=r?.crossOrigin,this.referrerPolicy_=r?.referrerPolicy,this.src_=n,this.key=n,this.image_,Ns?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(e){this.image_=e,this.state=rn.LOADED,this.unlistenImage_(),this.changed()}getCrossOrigin(){return this.crossOrigin_}getReferrerPolicy(){return this.referrerPolicy_}handleImageError_(){this.state=rn.ERROR,this.unlistenImage_(),this.image_=roe(),this.changed()}handleImageLoad_(){if(Ns)this.state=rn.LOADED;else{let e=this.image_;e.naturalWidth&&e.naturalHeight?this.state=rn.LOADED:this.state=rn.EMPTY}this.unlistenImage_(),this.changed()}load(){this.state==rn.ERROR&&(this.state=rn.IDLE,this.image_=new Image,this.crossOrigin_!==null&&(this.image_.crossOrigin=this.crossOrigin_),this.referrerPolicy_!==void 0&&(this.image_.referrerPolicy=this.referrerPolicy_)),this.state==rn.IDLE&&(this.state=rn.LOADING,this.changed(),this.tileLoadFunction_(this,this.src_),this.unlisten_=PG(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 roe(){let i=Si(1,1);return i.fillStyle="rgba(0,0,0,0)",i.fillRect(0,0,1,1),i.canvas}var bw=uP;var hP,V0=[];function OG(i,e,t,n,r){i.beginPath(),i.moveTo(0,0),i.lineTo(e,t),i.lineTo(n,r),i.closePath(),i.save(),i.clip(),i.fillRect(0,0,Math.max(e,n)+1,Math.max(t,r)),i.restore()}function fP(i,e){return Math.abs(i[e*4]-210)>2||Math.abs(i[e*4+3]-.75*255)>2}function soe(){if(hP===void 0){let i=Si(6,6,V0);i.globalCompositeOperation="lighter",i.fillStyle="rgba(210, 0, 0, 0.75)",OG(i,4,5,4,0),OG(i,4,5,0,5);let e=i.getImageData(0,0,3,3).data;hP=fP(e,0)||fP(e,4)||fP(e,8),z0(i),V0.push(i.canvas)}return hP}function BG(i,e,t,n){let r=ug(t,e,i),s=Z4(e,n,t),o=e.getMetersPerUnit();o!==void 0&&(s*=o);let a=i.getMetersPerUnit();a!==void 0&&(s/=a);let l=i.getExtent();if(!l||_c(l,r)){let c=Z4(i,s,r)/s;isFinite(c)&&c>0&&(s/=c)}return s}function UG(i,e,t,n){let r=Oa(t),s=BG(i,e,r,n);return(!isFinite(s)||s<=0)&&tw(t,function(o){return s=BG(i,e,o,n),isFinite(s)&&s>0}),s}function kG(i,e,t,n,r,s,o,a,l,c,u,f,p,x){let b=Si(Math.round(t*i),Math.round(t*e),V0);if(f||(b.imageSmoothingEnabled=!1),l.length===0)return b.canvas;b.scale(t,t);function w(L){return Math.round(L*t)/t}b.globalCompositeOperation="lighter";let S=Er();l.forEach(function(L,D,F){ew(S,L.extent)});let T,P=t/n,R=(f?1:1+Math.pow(2,-24))/P;if(!p||l.length!==1||c!==0){if(T=Si(Math.round(Wn(S)*P),Math.round(gr(S)*P),V0),f||(T.imageSmoothingEnabled=!1),r&&x){let L=(r[0]-S[0])*P,D=-(r[3]-S[3])*P,F=Wn(r)*P,N=gr(r)*P;T.rect(L,D,F,N),T.clip()}l.forEach(function(L,D,F){if(L.image.width>0&&L.image.height>0){if(L.clipExtent){T.save();let H=(L.clipExtent[0]-S[0])*P,Z=-(L.clipExtent[3]-S[3])*P,J=Wn(L.clipExtent)*P,j=gr(L.clipExtent)*P;T.rect(f?H:Math.round(H),f?Z:Math.round(Z),f?J:Math.round(H+J)-Math.round(H),f?j:Math.round(Z+j)-Math.round(Z)),T.clip()}let N=(L.extent[0]-S[0])*P,B=-(L.extent[3]-S[3])*P,z=Wn(L.extent)*P,V=gr(L.extent)*P;T.drawImage(L.image,c,c,L.image.width-2*c,L.image.height-2*c,f?N:Math.round(N),f?B:Math.round(B),f?z:Math.round(N+z)-Math.round(N),f?V:Math.round(B+V)-Math.round(B)),L.clipExtent&&T.restore()}})}let C=Gl(o);return a.getTriangles().forEach(function(L,D,F){let N=L.source,B=L.target,z=N[0][0],V=N[0][1],H=N[1][0],Z=N[1][1],J=N[2][0],j=N[2][1],K=w((B[0][0]-C[0])/s),ee=w(-(B[0][1]-C[1])/s),ae=w((B[1][0]-C[0])/s),ce=w(-(B[1][1]-C[1])/s),de=w((B[2][0]-C[0])/s),ve=w(-(B[2][1]-C[1])/s),Ie=z,Qe=V;z=0,V=0,H-=Ie,Z-=Qe,J-=Ie,j-=Qe;let Ue=[[H,Z,0,0,ae-K],[J,j,0,0,de-K],[0,0,H,Z,ce-ee],[0,0,J,j,ve-ee]],mt=G9(Ue);if(!mt)return;if(b.save(),b.beginPath(),soe()||!f){b.moveTo(ae,ce);let ze=4,$e=K-ae,Et=ee-ce;for(let Tt=0;Tt<ze;Tt++)b.lineTo(ae+w((Tt+1)*$e/ze),ce+w(Tt*Et/(ze-1))),Tt!=ze-1&&b.lineTo(ae+w((Tt+1)*$e/ze),ce+w((Tt+1)*Et/(ze-1)));b.lineTo(de,ve)}else b.moveTo(ae,ce),b.lineTo(K,ee),b.lineTo(de,ve);b.clip(),b.transform(mt[0],mt[2],mt[1],mt[3],K,ee),b.translate(S[0]-Ie,S[3]-Qe);let Me;if(T)Me=T.canvas,b.scale(R,-R);else{let ze=l[0],$e=ze.extent;Me=ze.image,b.scale(Wn($e)/Me.width,-gr($e)/Me.height)}b.drawImage(Me,0,0),b.restore()}),T&&(z0(T),V0.push(T.canvas)),u&&(b.save(),b.globalCompositeOperation="source-over",b.strokeStyle="black",b.lineWidth=1,a.getTriangles().forEach(function(L,D,F){let N=L.target,B=(N[0][0]-C[0])/s,z=-(N[0][1]-C[1])/s,V=(N[1][0]-C[0])/s,H=-(N[1][1]-C[1])/s,Z=(N[2][0]-C[0])/s,J=-(N[2][1]-C[1])/s;b.beginPath(),b.moveTo(V,H),b.lineTo(B,z),b.lineTo(Z,J),b.closePath(),b.stroke()}),b.restore()),b.canvas}var ooe=[1,0,0,1,0,0],ZIe=new Array(6);function Xs(){return ooe.slice(0)}function GG(i,e){return i[0]=e[0],i[1]=e[1],i[2]=e[2],i[3]=e[3],i[4]=e[4],i[5]=e[5],i}function Mr(i,e){let t=e[0],n=e[1];return e[0]=i[0]*t+i[2]*n+i[4],e[1]=i[1]*t+i[3]*n+i[5],e}function ao(i,e,t,n,r,s,o,a){let l=Math.sin(s),c=Math.cos(s);return i[0]=n*c,i[1]=r*l,i[2]=-n*l,i[3]=r*c,i[4]=o*n*c-a*n*l+e,i[5]=o*r*l+a*r*c+t,i}function Sw(i,e){let t=aoe(e);zn(t!==0,"Transformation matrix cannot be inverted");let n=e[0],r=e[1],s=e[2],o=e[3],a=e[4],l=e[5];return i[0]=o/t,i[1]=-r/t,i[2]=-s/t,i[3]=n/t,i[4]=(s*l-o*a)/t,i[5]=-(n*l-r*a)/t,i}function aoe(i){return i[0]*i[3]-i[1]*i[2]}var loe=[1e5,1e5,1e5,1e5,2,2];function zG(i){return"matrix("+i.join(", ")+")"}function ww(i){return i.substring(7,i.length-1).split(",").map(parseFloat)}function VG(i,e){let t=ww(i),n=ww(e);for(let r=0;r<6;++r)if(Math.round((t[r]-n[r])*loe[r])!==0)return!1;return!0}var coe=10,qG=.25,dP=class{constructor(e,t,n,r,s,o,a){this.sourceProj_=e,this.targetProj_=t;let l={},c=a?cG(R=>Mr(a,ug(R,this.targetProj_,this.sourceProj_))):B0(this.targetProj_,this.sourceProj_);this.transformInv_=function(R){let C=R[0]+"/"+R[1];return l[C]||(l[C]=c(R)),l[C]},this.maxSourceExtent_=r,this.errorThresholdSquared_=s*s,this.triangles_=[],this.wrapsXInSource_=!1,this.canWrapXInSource_=this.sourceProj_.canWrapX()&&!!r&&!!this.sourceProj_.getExtent()&&Wn(r)>=Wn(this.sourceProj_.getExtent()),this.sourceWorldWidth_=this.sourceProj_.getExtent()?Wn(this.sourceProj_.getExtent()):null,this.targetWorldWidth_=this.targetProj_.getExtent()?Wn(this.targetProj_.getExtent()):null;let u=Gl(n),f=ig(n),p=ng(n),x=tg(n),b=this.transformInv_(u),w=this.transformInv_(f),S=this.transformInv_(p),T=this.transformInv_(x),P=coe+(o?Math.max(0,Math.ceil(Math.log2(lx(n)/(o*o*256*256)))):0);if(this.addQuad_(u,f,p,x,b,w,S,T,P),this.wrapsXInSource_){let R=1/0;this.triangles_.forEach(function(C,L,D){R=Math.min(R,C.source[0][0],C.source[1][0],C.source[2][0])}),this.triangles_.forEach(C=>{if(Math.max(C.source[0][0],C.source[1][0],C.source[2][0])-R>this.sourceWorldWidth_/2){let L=[[C.source[0][0],C.source[0][1]],[C.source[1][0],C.source[1][1]],[C.source[2][0],C.source[2][1]]];L[0][0]-R>this.sourceWorldWidth_/2&&(L[0][0]-=this.sourceWorldWidth_),L[1][0]-R>this.sourceWorldWidth_/2&&(L[1][0]-=this.sourceWorldWidth_),L[2][0]-R>this.sourceWorldWidth_/2&&(L[2][0]-=this.sourceWorldWidth_);let D=Math.min(L[0][0],L[1][0],L[2][0]);Math.max(L[0][0],L[1][0],L[2][0])-D<this.sourceWorldWidth_/2&&(C.source=L)}})}l={}}addTriangle_(e,t,n,r,s,o){this.triangles_.push({source:[r,s,o],target:[e,t,n]})}addQuad_(e,t,n,r,s,o,a,l,c){let u=D4([s,o,a,l]),f=this.sourceWorldWidth_?Wn(u)/this.sourceWorldWidth_:null,p=this.sourceWorldWidth_,x=this.sourceProj_.canWrapX()&&f>.5&&f<1,b=!1;if(c>0){if(this.targetProj_.isGlobal()&&this.targetWorldWidth_){let S=D4([e,t,n,r]);b=Wn(S)/this.targetWorldWidth_>qG||b}!x&&this.sourceProj_.isGlobal()&&f&&(b=f>qG||b)}if(!b&&this.maxSourceExtent_&&isFinite(u[0])&&isFinite(u[1])&&isFinite(u[2])&&isFinite(u[3])&&!_r(u,this.maxSourceExtent_))return;let w=0;if(!b&&(!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(c>0)b=!0;else if(w=(!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),w!=1&&w!=2&&w!=4&&w!=8)return}if(c>0){if(!b){let S=[(e[0]+n[0])/2,(e[1]+n[1])/2],T=this.transformInv_(S),P;x?P=(gu(s[0],p)+gu(a[0],p))/2-gu(T[0],p):P=(s[0]+a[0])/2-T[0];let R=(s[1]+a[1])/2-T[1];b=P*P+R*R>this.errorThresholdSquared_}if(b){if(Math.abs(e[0]-n[0])<=Math.abs(e[1]-n[1])){let S=[(t[0]+n[0])/2,(t[1]+n[1])/2],T=this.transformInv_(S),P=[(r[0]+e[0])/2,(r[1]+e[1])/2],R=this.transformInv_(P);this.addQuad_(e,t,S,P,s,o,T,R,c-1),this.addQuad_(P,S,n,r,R,T,a,l,c-1)}else{let S=[(e[0]+t[0])/2,(e[1]+t[1])/2],T=this.transformInv_(S),P=[(n[0]+r[0])/2,(n[1]+r[1])/2],R=this.transformInv_(P);this.addQuad_(e,S,P,r,s,T,R,l,c-1),this.addQuad_(S,t,n,P,T,o,a,R,c-1)}return}}if(x){if(!this.canWrapXInSource_)return;this.wrapsXInSource_=!0}(w&11)==0&&this.addTriangle_(e,n,r,s,a,l),(w&14)==0&&this.addTriangle_(e,n,t,s,a,o),w&&((w&13)==0&&this.addTriangle_(t,r,e,o,l,s),(w&7)==0&&this.addTriangle_(t,r,n,o,l,a))}calculateSourceExtent(){let e=Er();return this.triangles_.forEach(function(t,n,r){let s=t.source;N0(e,s[0]),N0(e,s[1]),N0(e,s[2])}),e}getTriangles(){return this.triangles_}},HG=dP;var pP=class extends mg{constructor(e,t,n,r,s,o,a,l,c,u,f,p){super(s,rn.IDLE,p),this.renderEdges_=f!==void 0?f:!1,this.pixelRatio_=a,this.gutter_=l,this.canvas_=null,this.sourceTileGrid_=t,this.targetTileGrid_=r,this.wrappedTileCoord_=o||s,this.sourceTiles_=[],this.sourcesListenerKeys_=null,this.sourceZ_=0,this.clipExtent_=e.canWrapX()?e.getExtent():void 0;let x=r.getTileCoordExtent(this.wrappedTileCoord_),b=this.targetTileGrid_.getExtent(),w=this.sourceTileGrid_.getExtent(),S=b?Au(x,b):x;if(lx(S)===0){this.state=rn.EMPTY;return}let T=e.getExtent();T&&(w?w=Au(w,T):w=T);let P=r.getResolution(this.wrappedTileCoord_[0]),R=UG(e,n,S,P);if(!isFinite(R)||R<=0){this.state=rn.EMPTY;return}let C=u!==void 0?u:.5;if(this.triangulation_=new HG(e,n,S,w,R*C,P),this.triangulation_.getTriangles().length===0){this.state=rn.EMPTY;return}this.sourceZ_=t.getZForResolution(R);let L=this.triangulation_.calculateSourceExtent();if(w&&(e.canWrapX()?(L[1]=_i(L[1],w[1],w[3]),L[3]=_i(L[3],w[1],w[3])):L=Au(L,w)),!lx(L))this.state=rn.EMPTY;else{let D=0,F=0;e.canWrapX()&&(D=Wn(T),F=Math.floor((L[0]-T[0])/D)),nw(L.slice(),e,!0).forEach(B=>{let z=t.getTileRangeForExtentAndZ(B,this.sourceZ_);for(let V=z.minX;V<=z.maxX;V++)for(let H=z.minY;H<=z.maxY;H++){let Z=F*D;this.sourceTiles_.push({getTile:()=>c(this.sourceZ_,V,H,a),offset:Z})}++F}),this.sourceTiles_.length===0&&(this.state=rn.EMPTY)}}getImage(){return this.canvas_}reproject_(){let e=[];if(this.sourceTiles_.forEach(t=>{let n=t.tile;if(n&&n.getState()==rn.LOADED){let r=this.sourceTileGrid_.getTileCoordExtent(n.tileCoord);r[0]+=t.offset,r[2]+=t.offset;let s=this.clipExtent_?.slice();s&&(s[0]+=t.offset,s[2]+=t.offset),e.push({extent:r,clipExtent:s,image:n.getImage()})}}),this.sourceTiles_.length=0,e.length===0)this.state=rn.ERROR;else{let t=this.wrappedTileCoord_[0],n=this.targetTileGrid_.getTileSize(t),r=typeof n=="number"?n:n[0],s=typeof n=="number"?n:n[1],o=this.targetTileGrid_.getResolution(t),a=this.sourceTileGrid_.getResolution(this.sourceZ_),l=this.targetTileGrid_.getTileCoordExtent(this.wrappedTileCoord_);this.canvas_=kG(r,s,this.pixelRatio_,a,this.sourceTileGrid_.getExtent(),o,l,this.triangulation_,e,this.gutter_,this.renderEdges_,this.interpolate),this.state=rn.LOADED}this.changed()}load(){for(let e of this.sourceTiles_)e.tile=e.getTile();if(this.state==rn.IDLE){this.state=rn.LOADING,this.changed();let e=0;this.sourcesListenerKeys_=[],this.sourceTiles_.forEach(({tile:t})=>{let n=t.getState();if(n==rn.IDLE||n==rn.LOADING){e++;let r=Un(t,Jt.CHANGE,s=>{let o=t.getState();(o==rn.LOADED||o==rn.ERROR||o==rn.EMPTY)&&(ii(r),e--,e===0&&(this.unlistenSources_(),this.reproject_()))});this.sourcesListenerKeys_.push(r)}}),e===0?setTimeout(this.reproject_.bind(this),0):this.sourceTiles_.forEach(function({tile:t},n,r){t.getState()==rn.IDLE&&t.load()})}}unlistenSources_(){this.sourcesListenerKeys_.forEach(ii),this.sourcesListenerKeys_=null}release(){this.canvas_&&(z0(this.canvas_.getContext("2d")),V0.push(this.canvas_),this.canvas_=null),this.sourceTiles_.length=0,super.release()}},Tw=pP;var uoe=/\{z\}/g,hoe=/\{x\}/g,foe=/\{y\}/g,doe=/\{-y\}/g;function WG(i,e,t,n,r){return i.replace(uoe,e.toString()).replace(hoe,t.toString()).replace(foe,n.toString()).replace(doe,function(){if(r===void 0)throw new Error("If the URL template has a {-y} placeholder, the grid extent must be known");return(r-n).toString()})}function jG(i){let e=[],t=/\{([a-z])-([a-z])\}/.exec(i);if(t){let n=t[1].charCodeAt(0),r=t[2].charCodeAt(0),s;for(s=n;s<=r;++s)e.push(i.replace(t[0],String.fromCharCode(s)));return e}if(t=/\{(\d+)-(\d+)\}/.exec(i),t){let n=parseInt(t[2],10);for(let r=parseInt(t[1],10);r<=n;r++)e.push(i.replace(t[0],r.toString()));return e}return e.push(i),e}function poe(i,e){return(function(t,n,r){if(!t)return;let s,o=t[0];if(e){let a=e.getFullTileRange(o);a&&(s=a.getHeight()-1)}return WG(i,o,t[1],t[2],s)})}function XG(i,e){let t=i.length,n=new Array(t);for(let r=0;r<t;++r)n[r]=poe(i[r],e);return Aoe(n)}function Aoe(i){return i.length===1?i[0]:(function(e,t,n){if(!e)return;let r=vG(e),s=gu(r,i.length);return i[s](e,t,n)})}var Ec={PROPERTYCHANGE:"propertychange"};var gg=class extends md{constructor(){super(),this.on=this.onInternal,this.once=this.onceInternal,this.un=this.unInternal,this.revision_=0}changed(){++this.revision_,this.dispatchEvent(Jt.CHANGE)}getRevision(){return this.revision_}onInternal(e,t){if(Array.isArray(e)){let n=e.length,r=new Array(n);for(let s=0;s<n;++s)r[s]=Un(this,e[s],t);return r}return Un(this,e,t)}onceInternal(e,t){let n;if(Array.isArray(e)){let r=e.length;n=new Array(r);for(let s=0;s<r;++s)n[s]=Ag(this,e[s],t)}else n=Ag(this,e,t);return t.ol_key=n,n}unInternal(e,t){let n=t.ol_key;if(n)moe(n);else if(Array.isArray(e))for(let r=0,s=e.length;r<s;++r)this.removeEventListener(e[r],t);else this.removeEventListener(e,t)}};gg.prototype.on;gg.prototype.once;gg.prototype.un;function moe(i){if(Array.isArray(i))for(let e=0,t=i.length;e<t;++e)ii(i[e]);else ii(i)}var Ew=gg;var Mw=class extends js{constructor(e,t,n){super(e),this.key=t,this.oldValue=n}},AP=class extends Ew{constructor(e){super(),this.on,this.once,this.un,Nn(this),this.values_=null,e!==void 0&&this.setProperties(e)}get(e){let t;return this.values_&&this.values_.hasOwnProperty(e)&&(t=this.values_[e]),t}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(e,t){let n;n=`change:${e}`,this.hasListener(n)&&this.dispatchEvent(new Mw(n,e,t)),n=Ec.PROPERTYCHANGE,this.hasListener(n)&&this.dispatchEvent(new Mw(n,e,t))}addChangeListener(e,t){this.addEventListener(`change:${e}`,t)}removeChangeListener(e,t){this.removeEventListener(`change:${e}`,t)}set(e,t,n){let r=this.values_||(this.values_={});if(n)r[e]=t;else{let s=r[e];r[e]=t,s!==t&&this.notify(e,s)}}setProperties(e,t){for(let n in e)this.set(n,e[n],t)}applyProperties(e){e.values_&&Object.assign(this.values_||(this.values_={}),e.values_)}unset(e,t){if(this.values_&&e in this.values_){let n=this.values_[e];delete this.values_[e],vc(this.values_)&&(this.values_=null),t||this.notify(e,n)}}},ms=AP;var mP=class extends ms{constructor(e){super(),this.projection=As(e.projection),this.attributions_=$G(e.attributions),this.attributionsCollapsible_=e.attributionsCollapsible??!0,this.loading=!1,this.state_=e.state!==void 0?e.state:"ready",this.wrapX_=e.wrapX!==void 0?e.wrapX:!1,this.interpolate_=!!e.interpolate,this.viewResolver=null,this.viewRejector=null;let t=this;this.viewPromise_=new Promise(function(n,r){t.viewResolver=n,t.viewRejector=r})}getAttributions(){return this.attributions_}getAttributionsCollapsible(){return this.attributionsCollapsible_}getProjection(){return this.projection}getResolutions(e){return null}getView(){return this.viewPromise_}ready(){let e=this.getState();return e==="ready"?Promise.resolve():e==="error"?Promise.reject(new Error("Source failed to load")):new Promise((t,n)=>{let r=()=>{let s=this.getState();s==="ready"?(this.un("change",r),t()):s==="error"&&(this.un("change",r),n(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(e){this.attributions_=$G(e),this.changed()}setState(e){this.state_=e,this.changed()}};function $G(i){return i?typeof i=="function"?i:(Array.isArray(i)||(i=[i]),e=>i):null}var Cw=mP;var gP=class extends Cw{constructor(e){super({attributions:e.attributions,attributionsCollapsible:e.attributionsCollapsible,projection:e.projection,state:e.state,wrapX:e.wrapX,interpolate:e.interpolate}),this.on,this.once,this.un,this.tilePixelRatio_=e.tilePixelRatio!==void 0?e.tilePixelRatio:1,this.tileGrid=e.tileGrid!==void 0?e.tileGrid:null;let t=[256,256];this.tileGrid&&Vr(this.tileGrid.getTileSize(this.tileGrid.getMinZoom()),t),this.tmpSize=[0,0],this.key_=e.key||Nn(this),this.tileOptions={transition:e.transition,interpolate:e.interpolate},this.zDirection=e.zDirection?e.zDirection:0}getGutterForProjection(e){return 0}getKey(){return this.key_}setKey(e){this.key_!==e&&(this.key_=e,this.changed())}getResolutions(e){let t=e?this.getTileGridForProjection(e):this.tileGrid;return t?t.getResolutions():null}getTile(e,t,n,r,s,o){return $n()}getTileGrid(){return this.tileGrid}getTileGridForProjection(e){return this.tileGrid?this.tileGrid:gw(e)}getTilePixelRatio(e){return this.tilePixelRatio_}getTilePixelSize(e,t,n){let r=this.getTileGridForProjection(n),s=this.getTilePixelRatio(t),o=Vr(r.getTileSize(e),this.tmpSize);return s==1?o:fG(o,s,this.tmpSize)}getTileCoordForTileUrlFunction(e,t){let n=t!==void 0?t:this.getProjection(),r=t!==void 0?this.getTileGridForProjection(n):this.tileGrid||this.getTileGridForProjection(n);return this.getWrapX()&&n.isGlobal()&&(e=SG(r,e,n)),bG(e,r)?e:null}clear(){}refresh(){this.clear(),super.refresh()}},Rw=class extends js{constructor(e,t){super(e),this.tile=t}},YG=gP;var Pw={TILELOADSTART:"tileloadstart",TILELOADEND:"tileloadend",TILELOADERROR:"tileloaderror"};var _P=class i extends YG{constructor(e){super({attributions:e.attributions,cacheSize:e.cacheSize,projection:e.projection,state:e.state,tileGrid:e.tileGrid,tilePixelRatio:e.tilePixelRatio,wrapX:e.wrapX,transition:e.transition,interpolate:e.interpolate,key:e.key,attributionsCollapsible:e.attributionsCollapsible,zDirection:e.zDirection}),this.generateTileUrlFunction_=this.tileUrlFunction===i.prototype.tileUrlFunction,this.tileLoadFunction=e.tileLoadFunction,e.tileUrlFunction&&(this.tileUrlFunction=e.tileUrlFunction),this.urls=null,e.urls?this.setUrls(e.urls):e.url&&this.setUrl(e.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(e){let t=e.target,n=Nn(t),r=t.getState(),s;r==rn.LOADING?(this.tileLoadingKeys_[n]=!0,s=Pw.TILELOADSTART):n in this.tileLoadingKeys_&&(delete this.tileLoadingKeys_[n],s=r==rn.ERROR?Pw.TILELOADERROR:r==rn.LOADED?Pw.TILELOADEND:void 0),s!=null&&this.dispatchEvent(new Rw(s,t))}setTileLoadFunction(e){this.tileLoadFunction=e,this.changed()}setTileUrlFunction(e,t){this.tileUrlFunction=e,typeof t<"u"?this.setKey(t):this.changed()}setUrl(e){let t=jG(e);this.urls=t,this.setUrls(t)}setUrls(e){this.urls=e;let t=e.join(`2+`);this.generateTileUrlFunction_?this.setTileUrlFunction(XG(e,this.tileGrid),t):this.setKey(t)}tileUrlFunction(e,t,n){}},ZG=_P;var xP=class extends ZG{constructor(e){super({attributions:e.attributions,cacheSize:e.cacheSize,projection:e.projection,state:e.state,tileGrid:e.tileGrid,tileLoadFunction:e.tileLoadFunction?e.tileLoadFunction:goe,tilePixelRatio:e.tilePixelRatio,tileUrlFunction:e.tileUrlFunction,url:e.url,urls:e.urls,wrapX:e.wrapX,transition:e.transition,interpolate:e.interpolate!==void 0?e.interpolate:!0,key:e.key,attributionsCollapsible:e.attributionsCollapsible,zDirection:e.zDirection}),this.crossOrigin=e.crossOrigin!==void 0?e.crossOrigin:null,this.referrerPolicy=e.referrerPolicy,this.tileClass=e.tileClass!==void 0?e.tileClass:bw,this.tileGridForProjection={},this.reprojectionErrorThreshold_=e.reprojectionErrorThreshold,this.renderReprojectionEdges_=!1}getGutterForProjection(e){return this.getProjection()&&e&&!cg(this.getProjection(),e)?0:this.getGutter()}getGutter(){return 0}getKey(){let e=super.getKey();return this.getInterpolate()||(e+=":disable-interpolation"),e}getTileGridForProjection(e){let t=this.getProjection();if(this.tileGrid&&(!t||cg(t,e)))return this.tileGrid;let n=Nn(e);return n in this.tileGridForProjection||(this.tileGridForProjection[n]=gw(e)),this.tileGridForProjection[n]}createTile_(e,t,n,r,s,o){let a=[e,t,n],l=this.getTileCoordForTileUrlFunction(a,s),c=l?this.tileUrlFunction(l,r,s):void 0,u=new this.tileClass(a,c!==void 0?rn.IDLE:rn.EMPTY,c!==void 0?c:"",{crossOrigin:this.crossOrigin,referrerPolicy:this.referrerPolicy},this.tileLoadFunction,this.tileOptions);return u.key=o,u.addEventListener(Jt.CHANGE,this.handleTileChange.bind(this)),u}getTile(e,t,n,r,s,o){let a=this.getProjection();if(!a||!s||cg(a,s))return this.getTileInternal(e,t,n,r,a||s);let l=[e,t,n],c=this.getKey(),u=this.getTileGridForProjection(a),f=this.getTileGridForProjection(s),p=this.getTileCoordForTileUrlFunction(l,s),x=new Tw(a,u,s,f,l,p,this.getTilePixelRatio(r),this.getGutter(),(b,w,S,T)=>this.getTileInternal(b,w,S,T,a,o),this.reprojectionErrorThreshold_,this.renderReprojectionEdges_,this.tileOptions);return x.key=c,x}getTileInternal(e,t,n,r,s,o){let a=this.getKey(),l=dg(this,a,e,t,n);if(o&&o.containsKey(l))return o.get(l);let c=this.createTile_(e,t,n,r,s,a);return o?.set(l,c),c}setRenderReprojectionEdges(e){this.renderReprojectionEdges_!=e&&(this.renderReprojectionEdges_=e,this.changed())}setTileGridForProjection(e,t){let n=As(e);if(n){let r=Nn(n);r in this.tileGridForProjection||(this.tileGridForProjection[r]=t)}}};function goe(i,e){if(Ns){let t=i.getCrossOrigin(),n="same-origin",r="same-origin";t==="anonymous"||t===""?(n="cors",r="omit"):t==="use-credentials"&&(n="cors",r="include");let s={mode:n,credentials:r,referrerPolicy:i.getReferrerPolicy()};fetch(e,s).then(o=>{if(!o.ok)throw new Error(`HTTP ${o.status}`);return o.blob()}).then(o=>createImageBitmap(o)).then(o=>{let a=i.getImage();a.width=o.width,a.height=o.height,a.getContext("2d").drawImage(o,0,0),o.close?.(),a.dispatchEvent(new Event("load"))}).catch(()=>{i.getImage().dispatchEvent(new Event("error"))});return}i.getImage().src=e}var KG=xP;var yP=class extends KG{constructor(e){e=e||{};let t=e.projection!==void 0?e.projection:"EPSG:3857",n=e.tileGrid!==void 0?e.tileGrid:TG({extent:_w(t),maxResolution:e.maxResolution,maxZoom:e.maxZoom,minZoom:e.minZoom,tileSize:e.tileSize});super({attributions:e.attributions,cacheSize:e.cacheSize,crossOrigin:e.crossOrigin,referrerPolicy:e.referrerPolicy,interpolate:e.interpolate,projection:t,reprojectionErrorThreshold:e.reprojectionErrorThreshold,tileGrid:n,tileLoadFunction:e.tileLoadFunction,tilePixelRatio:e.tilePixelRatio,tileUrlFunction:e.tileUrlFunction,url:e.url,urls:e.urls,wrapX:e.wrapX!==void 0?e.wrapX:!0,transition:e.transition,attributionsCollapsible:e.attributionsCollapsible,zDirection:e.zDirection}),this.gutter_=e.gutter!==void 0?e.gutter:0}getGutter(){return this.gutter_}},QG=yP;function Mc(){if(!k.map||!k.variant||k.settling)return;let i=k.engine?.getView();try{let e=JG();e.last=k.game.slug,e.games[k.game.slug]={game:k.game.slug,map:k.map.slug,variant:k.map.variants.indexOf(k.variant),center:i?.getCenter(),zoom:i?.getZoom(),hidden:[...k.hiddenCategories],collapsed:[...k.collapsedSections],overviewDocked:k.overviewDocked,dockFolded:k.dockFolded,dockDismissed:k.dockDismissed},localStorage.setItem(L4,JSON.stringify(e))}catch{}}function JG(){try{let i=JSON.parse(localStorage.getItem(L4)||"null");if(i&&i.games)return i}catch{}return{last:"",games:{}}}function _g(i){let e=JG(),t=i||e.last,n=t&&e.games[t];return n&&n.game&&n.map?n:null}function xg(){let[i,e]=decodeURIComponent(location.hash.replace(/^#\/?/,"")).split("/").map(t=>t.trim());return{game:i,map:e}}function ez(){if(!k.game||!k.map)return;let i=`#${k.game.slug}/${k.map.slug}`;location.hash!==i&&history.replaceState(null,"",i)}var vP=class i extends ms{constructor(e){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_),e)if(typeof e.getSimplifiedGeometry=="function"){let t=e;this.setGeometry(t)}else{let t=e;this.setProperties(t)}}clone(){let e=new i,t=this.geometryName_;e.setGeometryName(t);let n=this.getPropertiesInternal();if(n){let s=this.getGeometry();for(let o in n)o===t&&s?e.set(o,s.clone()):e.set(o,n[o],!0)}let r=this.getStyle();return r&&e.setStyle(r),e}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_&&(ii(this.geometryChangeKey_),this.geometryChangeKey_=null);let e=this.getGeometry();e&&(this.geometryChangeKey_=Un(e,Jt.CHANGE,this.handleGeometryChange_,this)),this.changed()}setGeometry(e){this.set(this.geometryName_,e)}setStyle(e){this.style_=e,this.styleFunction_=e?_oe(e):void 0,this.changed()}setId(e){this.id_=e,this.changed()}setGeometryName(e){e!==this.geometryName_&&(this.removeChangeListener(this.geometryName_,this.handleGeometryChanged_),this.geometryName_=e,this.addChangeListener(this.geometryName_,this.handleGeometryChanged_),this.handleGeometryChanged_())}};function _oe(i){if(typeof i=="function")return i;let e;return Array.isArray(i)?e=i:(zn(typeof i.getZIndex=="function","Expected an `ol/style/Style` or an array of `ol/style/Style.js`"),e=[i]),function(){return e}}var gd=vP;function Ua(i,e,t,n,r,s,o){s=s||[],o=o||2;let a=0;for(let l=e;l<t;l+=n){let c=i[l],u=i[l+1];s[a++]=r[0]*c+r[2]*u+r[4],s[a++]=r[1]*c+r[3]*u+r[5];for(let f=2;f<o;f++)s[a++]=i[l+f]}return s&&s.length!=a&&(s.length=a),s}function Iw(i,e,t,n,r,s,o){o=o||[];let a=Math.cos(r),l=Math.sin(r),c=s[0],u=s[1],f=0;for(let p=e;p<t;p+=n){let x=i[p]-c,b=i[p+1]-u;o[f++]=c+x*a-b*l,o[f++]=u+x*l+b*a;for(let w=p+2;w<p+n;++w)o[f++]=i[w]}return o&&o.length!=f&&(o.length=f),o}function tz(i,e,t,n,r,s,o,a){a=a||[];let l=o[0],c=o[1],u=0;for(let f=e;f<t;f+=n){let p=i[f]-l,x=i[f+1]-c;a[u++]=l+r*p,a[u++]=c+s*x;for(let b=f+2;b<f+n;++b)a[u++]=i[b]}return a&&a.length!=u&&(a.length=u),a}function nz(i,e,t,n,r,s,o){o=o||[];let a=0;for(let l=e;l<t;l+=n){o[a++]=i[l]+r,o[a++]=i[l+1]+s;for(let c=l+2;c<l+n;++c)o[a++]=i[c]}return o&&o.length!=a&&(o.length=a),o}var iz=Xs(),xoe=[NaN,NaN],bP=class extends ms{constructor(){super(),this.extent_=Er(),this.extentRevision_=-1,this.simplifiedGeometryMaxMinSquaredTolerance=0,this.simplifiedGeometryRevision=0,this.simplifyTransformedInternal=xw((e,t,n)=>{if(!n)return this.getSimplifiedGeometry(t);let r=this.clone();return r.applyTransform(n),r.getSimplifiedGeometry(t)})}simplifyTransformed(e,t){return this.simplifyTransformedInternal(this.getRevision(),e,t)}clone(){return $n()}closestPointXY(e,t,n,r){return $n()}containsXY(e,t){return this.closestPointXY(e,t,xoe,Number.MIN_VALUE)===0}getClosestPoint(e,t){return t=t||[NaN,NaN],this.closestPointXY(e[0],e[1],t,1/0),t}intersectsCoordinate(e){return this.containsXY(e[0],e[1])}computeExtent(e){return $n()}getExtent(e){if(this.extentRevision_!=this.getRevision()){let t=this.computeExtent(this.extent_);(isNaN(t[0])||isNaN(t[1]))&&P0(t),this.extentRevision_=this.getRevision()}return D9(this.extent_,e)}rotate(e,t){$n()}scale(e,t,n){$n()}simplify(e){return this.getSimplifiedGeometry(e*e)}getSimplifiedGeometry(e){return $n()}getType(){return $n()}applyTransform(e){$n()}intersectsExtent(e){return $n()}translate(e,t){$n()}transform(e,t){let n=As(e),r=n.getUnits()=="tile-pixels"?function(s,o,a){let l=n.getExtent(),c=n.getWorldExtent(),u=gr(c)/gr(l);ao(iz,c[0],c[3],u,-u,0,0,0);let f=Ua(s,0,s.length,a,iz,o),p=B0(n,t);return p?p(f,f,a):f}:B0(n,t);return this.applyTransform(r),this}},rz=bP;var wP=class extends rz{constructor(){super(),this.layout="XY",this.stride=2,this.flatCoordinates}computeExtent(e){return eg(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,e)}getCoordinates(){return $n()}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(e){if(this.simplifiedGeometryRevision!==this.getRevision()&&(this.simplifiedGeometryMaxMinSquaredTolerance=0,this.simplifiedGeometryRevision=this.getRevision()),e<0||this.simplifiedGeometryMaxMinSquaredTolerance!==0&&e<=this.simplifiedGeometryMaxMinSquaredTolerance)return this;let t=this.getSimplifiedGeometryInternal(e);return t.getFlatCoordinates().length<this.flatCoordinates.length?t:(this.simplifiedGeometryMaxMinSquaredTolerance=e,this)}getSimplifiedGeometryInternal(e){return this}getStride(){return this.stride}setFlatCoordinates(e,t){this.stride=sz(e),this.layout=e,this.flatCoordinates=t}setCoordinates(e,t){$n()}setLayout(e,t,n){let r;if(e)r=sz(e);else{for(let s=0;s<n;++s){if(t.length===0){this.layout="XY",this.stride=2;return}t=t[0]}r=t.length,e=yoe(r)}this.layout=e,this.stride=r}applyTransform(e){this.flatCoordinates&&(e(this.flatCoordinates,this.flatCoordinates,this.layout.startsWith("XYZ")?3:2,this.stride),this.changed())}rotate(e,t){let n=this.getFlatCoordinates();if(n){let r=this.getStride();Iw(n,0,n.length,r,e,t,n),this.changed()}}scale(e,t,n){t===void 0&&(t=e),n||(n=Oa(this.getExtent()));let r=this.getFlatCoordinates();if(r){let s=this.getStride();tz(r,0,r.length,s,e,t,n,r),this.changed()}}translate(e,t){let n=this.getFlatCoordinates();if(n){let r=this.getStride();nz(n,0,n.length,r,e,t,n),this.changed()}}};function yoe(i){let e;return i==2?e="XY":i==3?e="XYZ":i==4&&(e="XYZM"),e}function sz(i){let e;return i=="XY"?e=2:i=="XYZ"||i=="XYM"?e=3:i=="XYZM"&&(e=4),e}function oz(i,e,t){let n=i.getFlatCoordinates();if(!n)return null;let r=i.getStride();return Ua(n,0,n.length,r,e,t)}var xu=wP;function az(i,e,t,n){for(let r=0,s=t.length;r<s;++r)i[e++]=t[r];return e}function gx(i,e,t,n){for(let r=0,s=t.length;r<s;++r){let o=t[r];for(let a=0;a<n;++a)i[e++]=o[a]}return e}function SP(i,e,t,n,r){r=r||[];let s=0;for(let o=0,a=t.length;o<a;++o){let l=gx(i,e,t[o],n);r[s++]=l,e=l}return r.length=s,r}function lz(i,e,t,n,r){r=r||[];let s=0;for(let o=0,a=t.length;o<a;++o){let l=SP(i,e,t[o],n,r[s]);l.length===0&&(l[0]=e),r[s++]=l,e=l[l.length-1]}return r.length=s,r}var TP=class i extends xu{constructor(e,t){super(),this.setCoordinates(e,t)}clone(){let e=new i(this.flatCoordinates.slice(),this.layout);return e.applyProperties(this),e}closestPointXY(e,t,n,r){let s=this.flatCoordinates,o=xc(e,t,s[0],s[1]);if(o<r){let a=this.stride;for(let l=0;l<a;++l)n[l]=s[l];return n.length=a,o}return r}getCoordinates(){return this.flatCoordinates.slice()}computeExtent(e){return Jb(this.flatCoordinates,e)}getType(){return"Point"}intersectsExtent(e){return ax(e,this.flatCoordinates[0],this.flatCoordinates[1])}setCoordinates(e,t){this.setLayout(t,e,0),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=az(this.flatCoordinates,0,e,this.stride),this.changed()}},Qh=TP;function EP(i,e,t,n){let r=0,s=i[t-n],o=i[t-n+1],a=0,l=0;for(;e<t;e+=n){let c=i[e]-s,u=i[e+1]-o;r+=l*c-a*u,a=c,l=u}return r/2}function MP(i,e,t,n){let r=0;for(let s=0,o=t.length;s<o;++s){let a=t[s];r+=EP(i,e,a,n),e=a}return r}function cz(i,e,t,n){let r=0;for(let s=0,o=t.length;s<o;++s){let a=t[s];r+=MP(i,e,a,n),e=a[a.length-1]}return r}function uz(i,e,t,n,r,s,o){let a=i[e],l=i[e+1],c=i[t]-a,u=i[t+1]-l,f;if(c===0&&u===0)f=e;else{let p=((r-a)*c+(s-l)*u)/(c*c+u*u);if(p>1)f=t;else if(p>0){for(let x=0;x<n;++x)o[x]=Ro(i[e+x],i[t+x],p);o.length=n;return}else f=e}for(let p=0;p<n;++p)o[p]=i[f+p];o.length=n}function CP(i,e,t,n,r){let s=i[e],o=i[e+1];for(e+=n;e<t;e+=n){let a=i[e],l=i[e+1],c=xc(s,o,a,l);c>r&&(r=c),s=a,o=l}return r}function RP(i,e,t,n,r){for(let s=0,o=t.length;s<o;++s){let a=t[s];r=CP(i,e,a,n,r),e=a}return r}function hz(i,e,t,n,r){for(let s=0,o=t.length;s<o;++s){let a=t[s];r=RP(i,e,a,n,r),e=a[a.length-1]}return r}function PP(i,e,t,n,r,s,o,a,l,c,u){if(e==t)return c;let f,p;if(r===0){if(p=xc(o,a,i[e],i[e+1]),p<c){for(f=0;f<n;++f)l[f]=i[e+f];return l.length=n,p}return c}u=u||[NaN,NaN];let x=e+n;for(;x<t;)if(uz(i,x-n,x,n,o,a,u),p=xc(o,a,u[0],u[1]),p<c){for(c=p,f=0;f<n;++f)l[f]=u[f];l.length=n,x+=n}else x+=n*Math.max((Math.sqrt(p)-Math.sqrt(c))/r|0,1);if(s&&(uz(i,t-n,e,n,o,a,u),p=xc(o,a,u[0],u[1]),p<c)){for(c=p,f=0;f<n;++f)l[f]=u[f];l.length=n}return c}function IP(i,e,t,n,r,s,o,a,l,c,u){u=u||[NaN,NaN];for(let f=0,p=t.length;f<p;++f){let x=t[f];c=PP(i,e,x,n,r,s,o,a,l,c,u),e=x}return c}function fz(i,e,t,n,r,s,o,a,l,c,u){u=u||[NaN,NaN];for(let f=0,p=t.length;f<p;++f){let x=t[f];c=IP(i,e,x,n,r,s,o,a,l,c,u),e=x[x.length-1]}return c}function yu(i,e,t,n,r){r=r!==void 0?r:[];let s=0;for(let o=e;o<t;o+=n)r[s++]=i.slice(o,o+n);return r.length=s,r}function yg(i,e,t,n,r){r=r!==void 0?r:[];let s=0;for(let o=0,a=t.length;o<a;++o){let l=t[o];r[s++]=yu(i,e,l,n,r[s]),e=l}return r.length=s,r}function _x(i,e,t,n,r){r=r!==void 0?r:[];let s=0;for(let o=0,a=t.length;o<a;++o){let l=t[o];r[s++]=l.length===1&&l[0]===e?[]:yg(i,e,l,n,r[s]),e=l[l.length-1]}return r.length=s,r}function xx(i,e,t,n,r,s,o){let a=(t-e)/n;if(a<3){for(;e<t;e+=n)s[o++]=i[e],s[o++]=i[e+1];return o}let l=new Array(a);l[0]=1,l[a-1]=1;let c=[e,t-n],u=0;for(;c.length>0;){let f=c.pop(),p=c.pop(),x=0,b=i[p],w=i[p+1],S=i[f],T=i[f+1];for(let P=p+n;P<f;P+=n){let R=i[P],C=i[P+1],L=k9(R,C,b,w,S,T);L>x&&(u=P,x=L)}x>r&&(l[(u-e)/n]=1,p+n<u&&c.push(p,u),u+n<f&&c.push(u,f))}for(let f=0;f<a;++f)l[f]&&(s[o++]=i[e+f*n],s[o++]=i[e+f*n+1]);return o}function dz(i,e,t,n,r,s,o,a){for(let l=0,c=t.length;l<c;++l){let u=t[l];o=xx(i,e,u,n,r,s,o),a.push(o),e=u}return o}function _d(i,e){return e*Math.round(i/e)}function voe(i,e,t,n,r,s,o){if(e==t)return o;let a=_d(i[e],r),l=_d(i[e+1],r);e+=n,s[o++]=a,s[o++]=l;let c,u;do if(c=_d(i[e],r),u=_d(i[e+1],r),e+=n,e==t)return s[o++]=c,s[o++]=u,o;while(c==a&&u==l);for(;e<t;){let f=_d(i[e],r),p=_d(i[e+1],r);if(e+=n,f==c&&p==u)continue;let x=c-a,b=u-l,w=f-a,S=p-l;if(x*S==b*w&&(x<0&&w<x||x==w||x>0&&w>x)&&(b<0&&S<b||b==S||b>0&&S>b)){c=f,u=p;continue}s[o++]=c,s[o++]=u,a=c,l=u,c=f,u=p}return s[o++]=c,s[o++]=u,o}function yx(i,e,t,n,r,s,o,a){for(let l=0,c=t.length;l<c;++l){let u=t[l];o=voe(i,e,u,n,r,s,o),a.push(o),e=u}return o}function pz(i,e,t,n,r,s,o,a){for(let l=0,c=t.length;l<c;++l){let u=t[l],f=[];o=yx(i,e,u,n,r,s,o,f),a.push(f),e=u[u.length-1]}return o}var NP=class i extends xu{constructor(e,t){super(),this.maxDelta_=-1,this.maxDeltaRevision_=-1,t!==void 0&&!Array.isArray(e[0])?this.setFlatCoordinates(t,e):this.setCoordinates(e,t)}clone(){return new i(this.flatCoordinates.slice(),this.layout)}closestPointXY(e,t,n,r){return r<cd(this.getExtent(),e,t)?r:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(CP(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),PP(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,this.maxDelta_,!0,e,t,n,r))}getArea(){return EP(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getCoordinates(){return yu(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getSimplifiedGeometryInternal(e){let t=[];return t.length=xx(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,e,t,0),new i(t,"XY")}getType(){return"LinearRing"}intersectsExtent(e){return mw(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,e)}setCoordinates(e,t){this.setLayout(t,e,1),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=gx(this.flatCoordinates,0,e,this.stride),this.changed()}},LP=NP;function vx(i,e,t,n,r,s,o){let a,l,c,u,f,p,x,b=r[s+1],w=[];for(let P=0,R=t.length;P<R;++P){let C=t[P];for(u=i[C-n],p=i[C-n+1],a=e;a<C;a+=n)f=i[a],x=i[a+1],(b<=p&&x<=b||p<=b&&b<=x)&&(c=(b-p)/(x-p)*(f-u)+u,w.push(c)),u=f,p=x}let S=NaN,T=-1/0;for(w.sort(Ba),u=w[0],a=1,l=w.length;a<l;++a){f=w[a];let P=Math.abs(f-u);P>T&&(c=(u+f)/2,px(i,e,t,n,c,b)&&(S=c,T=P)),u=f}return isNaN(S)&&(S=r[s]),o?(o.push(S,b,T),o):[S,b,T]}function Nw(i,e,t,n,r){let s=[];for(let o=0,a=t.length;o<a;++o){let l=t[o];s=vx(i,e,l,n,r,2*o,s),e=l[l.length-1]}return s}function Az(i,e,t,n){for(;e<t-n;){for(let r=0;r<n;++r){let s=i[e+r];i[e+r]=i[t-n+r],i[t-n+r]=s}e+=n,t-=n}}function DP(i,e,t,n){let r=0,s=i[t-n],o=i[t-n+1];for(;e<t;e+=n){let a=i[e],l=i[e+1];r+=(a-s)*(l+o),s=a,o=l}return r===0?void 0:r>0}function FP(i,e,t,n,r){r=r!==void 0?r:!1;for(let s=0,o=t.length;s<o;++s){let a=t[s],l=DP(i,e,a,n);if(s===0){if(r&&l||!r&&!l)return!1}else if(r&&!l||!r&&l)return!1;e=a}return!0}function mz(i,e,t,n,r){for(let s=0,o=t.length;s<o;++s){let a=t[s];if(!FP(i,e,a,n,r))return!1;a.length&&(e=a[a.length-1])}return!0}function Lw(i,e,t,n,r){r=r!==void 0?r:!1;for(let s=0,o=t.length;s<o;++s){let a=t[s],l=DP(i,e,a,n);(s===0?r&&l||!r&&!l:r&&!l||!r&&l)&&Az(i,e,a,n),e=a}return e}function OP(i,e,t,n,r){for(let s=0,o=t.length;s<o;++s)e=Lw(i,e,t[s],n,r);return e}function gz(i,e){let t=[],n=0,r=0,s;for(let o=0,a=e.length;o<a;++o){let l=e[o],c=DP(i,n,l,2);if(s===void 0&&(s=c),c===s)t.push(e.slice(r,o+1));else{if(t.length===0)continue;t[t.length-1].push(e[r])}r=o+1,n=l}return t}var Dw=class i extends xu{constructor(e,t,n){super(),this.ends_=[],this.flatInteriorPointRevision_=-1,this.flatInteriorPoint_=null,this.maxDelta_=-1,this.maxDeltaRevision_=-1,this.orientedRevision_=-1,this.orientedFlatCoordinates_=null,t!==void 0&&n?(this.setFlatCoordinates(t,e),this.ends_=n):this.setCoordinates(e,t)}appendLinearRing(e){this.flatCoordinates?Tc(this.flatCoordinates,e.getFlatCoordinates()):this.flatCoordinates=e.getFlatCoordinates().slice(),this.ends_.push(this.flatCoordinates.length),this.changed()}clone(){let e=new i(this.flatCoordinates.slice(),this.layout,this.ends_.slice());return e.applyProperties(this),e}closestPointXY(e,t,n,r){return r<cd(this.getExtent(),e,t)?r:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(RP(this.flatCoordinates,0,this.ends_,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),IP(this.flatCoordinates,0,this.ends_,this.stride,this.maxDelta_,!0,e,t,n,r))}containsXY(e,t){return px(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,e,t)}getArea(){return MP(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride)}getCoordinates(e){let t;return e!==void 0?(t=this.getOrientedFlatCoordinates().slice(),Lw(t,0,this.ends_,this.stride,e)):t=this.flatCoordinates,yg(t,0,this.ends_,this.stride)}getEnds(){return this.ends_}getFlatInteriorPoint(){if(this.flatInteriorPointRevision_!=this.getRevision()){let e=Oa(this.getExtent());this.flatInteriorPoint_=vx(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,e,0),this.flatInteriorPointRevision_=this.getRevision()}return this.flatInteriorPoint_}getInteriorPoint(){return new Qh(this.getFlatInteriorPoint(),"XYM")}getLinearRingCount(){return this.ends_.length}getLinearRing(e){return e<0||this.ends_.length<=e?null:new LP(this.flatCoordinates.slice(e===0?0:this.ends_[e-1],this.ends_[e]),this.layout)}getLinearRings(){let e=this.layout,t=this.flatCoordinates,n=this.ends_,r=[],s=0;for(let o=0,a=n.length;o<a;++o){let l=n[o],c=new LP(t.slice(s,l),e);r.push(c),s=l}return r}getOrientedFlatCoordinates(){if(this.orientedRevision_!=this.getRevision()){let e=this.flatCoordinates;FP(e,0,this.ends_,this.stride)?this.orientedFlatCoordinates_=e:(this.orientedFlatCoordinates_=e.slice(),this.orientedFlatCoordinates_.length=Lw(this.orientedFlatCoordinates_,0,this.ends_,this.stride)),this.orientedRevision_=this.getRevision()}return this.orientedFlatCoordinates_}getSimplifiedGeometryInternal(e){let t=[],n=[];return t.length=yx(this.flatCoordinates,0,this.ends_,this.stride,Math.sqrt(e),t,0,n),new i(t,"XY",n)}getType(){return"Polygon"}intersectsExtent(e){return J4(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,e)}setCoordinates(e,t){this.setLayout(t,e,2),this.flatCoordinates||(this.flatCoordinates=[]);let n=SP(this.flatCoordinates,0,e,this.stride,this.ends_);this.flatCoordinates.length=n.length===0?0:n[n.length-1],this.changed()}},vu=Dw;function BP(i){if(mu(i))throw new Error("Cannot create polygon from empty extent");let e=i[0],t=i[1],n=i[2],r=i[3],s=[e,t,e,r,n,r,n,t,e,t];return new Dw(s,"XY",[s.length])}function _z(){let i=k.variant?.surface;return i?[i.x,-(i.y+i.height),i.x+i.width,-i.y]:Jh()}function xz(i){return i.key.toLocaleLowerCase()==="g"?(i.preventDefault(),yz(),k.gridEnabled?(we.gridInput.focus(),we.gridInput.select()):we.viewport.focus({preventScroll:!0}),!0):i.key===" "&&k.gridEnabled&&i.target!==we.subgridToggle?(i.preventDefault(),bx(!k.subgridVisible),!0):i.key==="Escape"&&k.gridEnabled?(i.preventDefault(),UP(),!0):!1}function yz(i=!k.gridEnabled){k.gridEnabled=i,i&&bx(!0),Ow(),bu(),k.layers.pins.changed(),k.layers.text.changed(),k.layers.priority.changed()}function bx(i){k.subgridVisible=i,k.layers.grid.changed(),k.layers.gridContext.changed(),we.subgridToggle.setAttribute("aria-pressed",String(i)),we.subgridToggle.setAttribute("aria-label",i?"Hide the subgrid":"Show the subgrid"),vz()}function vz(){if(!k.gridEnabled){we.gridHint.textContent="G \xB7 grid off";return}we.gridHint.textContent=`G-${k.gridPrefix||"root"}`+(k.subgridVisible?"":" no subgrid")}function wx(i){let e=q0(),t=[...i.toLocaleLowerCase()].filter(r=>kl.includes(r)).slice(0,e).join(""),n=t!==k.gridPrefix;k.gridPrefix=t,k.gridEnabled||(k.gridEnabled=!0),Ow(),bu(),k.layers.pins.changed(),k.layers.text.changed(),k.layers.priority.changed(),n&&(Cc(),k.engine.getView().fit(vg(),{size:k.engine.getSize(),padding:[52,52,52,52],maxZoom:wu(k.variant),duration:180}))}function UP(){if(k.gridEnabled){if(!k.gridPrefix){yz(!1);return}wx(k.gridPrefix.slice(0,-1))}}function Ow(){if(!k.sources||(k.sources.grid.clear(),k.sources.gridContext.clear(),we.gridNavigator.hidden=!k.gridEnabled,vz(),!k.gridEnabled||!k.variant))return;let i=q0();if(we.gridInput.maxLength=i,we.gridInput.value=k.gridPrefix,we.gridBack.title=k.gridPrefix?"Back one geohash level":"Close geohash grid",woe(),k.gridPrefix.length>=i){Fw(k.gridPrefix,vg(),"leaf");return}k.gridPrefix&&Fw(k.gridPrefix,vg(),"scope");for(let e of kl){let t=k.gridPrefix+e;Fw(t,kP(t),"child")}}function woe(){for(let i=0;i<k.gridPrefix.length;i++){let e=k.gridPrefix.slice(0,i),t=k.gridPrefix.slice(0,i+1);for(let n of kl){let r=e+n;r!==t&&Fw(r,kP(r),"neighbor",k.gridPrefix.length-i)}}}function Fw(i,e,t,n=0){let[r,s,o,a]=e,l=k.pins.filter(f=>{if(f.filteredHidden)return!1;let[p,x]=f.coordinate;return p>=r&&p<=o&&x>=s&&x<=a}).length,c=new gd({geometry:new vu([[[r,s],[r,a],[o,a],[o,s],[r,s]]]),gridCell:{hash:i,extent:e,role:t,count:l,contextDistance:n},priority:t==="neighbor"?-n*100+kl.indexOf(i[i.length-1]):kl.indexOf(i[i.length-1])});(t==="neighbor"?k.sources.gridContext:k.sources.grid).addFeature(c)}function vg(){return kP(k.gridPrefix)}function kP(i){let e=[..._z()],t=!0;for(let n of i){let r=kl.indexOf(n);if(!(r<0))for(let s of[16,8,4,2,1]){if(t){let o=(e[0]+e[2])/2;r&s?e[0]=o:e[2]=o}else{let o=(e[1]+e[3])/2;r&s?e[1]=o:e[3]=o}t=!t}}return e}function q0(){return 3}function bz(i,e=q0()){let t=[..._z()],[n,r]=i;if(n<t[0]||n>t[2]||r<t[1]||r>t[3])return"";let s=!0,o="";for(let a=0;a<e;a++){let l=0;for(let c of[16,8,4,2,1]){if(s){let u=(t[0]+t[2])/2;n>=u?(l|=c,t[0]=u):t[2]=u}else{let u=(t[1]+t[3])/2;r>=u?(l|=c,t[1]=u):t[3]=u}s=!s}o+=kl[l]}return o}function bg(i){if(!k.gridEnabled||!k.gridPrefix)return!1;let e=vg(),[t,n]=i.coordinate;return t>=e[0]&&t<=e[2]&&n>=e[1]&&n<=e[3]}function H0(){return N9[k.map?.iconOutset==="dark"?"dark":"light"]}function Soe(i){let e=k.map?.iconOutset==="dark",t=Eoe(i);return(e?t>.3:t<.88)?i:Toe(i,e?.74:.42)}function Toe(i,e){let t=String(i).replace("#","");if(t.length!==6)return i;let[n,r,s]=[0,2,4].map(R=>parseInt(t.slice(R,R+2),16)/255),o=Math.max(n,r,s),a=Math.min(n,r,s),l=(o+a)/2,c=0,u=o-a,f=u===0?0:u/(1-Math.abs(2*l-1));u!==0&&(o===n?c=(r-s)/u%6:o===r?c=(s-n)/u+2:c=(n-r)/u+4,c*=60,c<0&&(c+=360));let p=(1-Math.abs(2*e-1))*f,x=p*(1-Math.abs(c/60%2-1)),b=e-p/2,[w,S,T]=c<60?[p,x,0]:c<120?[x,p,0]:c<180?[0,p,x]:c<240?[0,x,p]:c<300?[x,0,p]:[p,0,x],P=R=>Math.round((R+b)*255).toString(16).padStart(2,"0");return`#${P(w)}${P(S)}${P(T)}`}function Eoe(i){let e=String(i).replace("#","");if(e.length!==6)return .5;let t=n=>parseInt(e.slice(n,n+2),16)/255;return .2126*t(0)+.7152*t(2)+.0722*t(4)}function Bw(i){let e=Math.abs(Number(i)||0);return Qm[(Math.imul(e,2654435761)>>>0)%Qm.length]}function ef(i,e){let t=String(i||"#ffffff").replace("#",""),n=t.length===3?t.split("").map(s=>s+s).join(""):t.slice(0,6).padEnd(6,"f"),r=Number.parseInt(n,16);return`rgba(${r>>16&255}, ${r>>8&255}, ${r&255}, ${e})`}function wg(i,e){i.style.setProperty("--pin-color",W0(e))}function W0(i){return Soe(i.color||Bw(i.id))}function Sg(i,e,t){if(i.classList.remove("has-source-icon"),i.style.removeProperty("--pin-icon"),i.textContent="",!e.iconAsset){i.textContent=t;return}i.style.setProperty("--pin-icon",`url("${GP(e.iconAsset)}")`),i.classList.add("has-source-icon")}function GP(i){let e=i.split("/").map(t=>encodeURIComponent(t)).join("/");return`${k.game.base}/icons/${e}`}function Rc(i){return i.split(/\s+/).slice(0,2).map(e=>e[0]||"").join("")}function wz(i){return Math.imul(Number(i)||0,2654435761)>>>0}function Sz(i){return String(i||"").replace(/\[([^\]]+)\]\([^)]+\)/g,"$1").replace(/[*_`>#]/g,"").replace(/\r/g,"").replace(/\n{3,}/g,`3+4+`).trim()}function Pc(i){return new Intl.NumberFormat().format(i)}function Ic(i,e,t){return Math.min(t,Math.max(e,i))}function Uw(i){return i instanceof HTMLElement&&(i.matches("input, textarea, select")||i.isContentEditable)}var Moe=100;function xd(){if(!we.searchResults)return;let i=k.pins.filter(n=>!n.filteredHidden).sort((n,r)=>n.location.title.localeCompare(r.location.title)),e=i.slice(0,Moe),t=document.createDocumentFragment();if(!e.length){let n=document.createElement("p");n.className="search-empty",n.textContent=k.search?"No visible locations match.":"Nothing is enabled. Show a category to list its locations.",t.append(n)}for(let n of e){let r=document.createElement("button");r.type="button",r.className="search-result",k.selectedPin===n&&r.classList.add("is-selected"),r.dataset.location=String(n.location.id),wg(r,n.category);let s=document.createElement("span");s.className="result-dot",Sg(s,n.category,Rc(n.category.title));let o=document.createElement("span"),a=document.createElement("strong");a.textContent=n.location.title;let l=document.createElement("small");l.textContent=`${n.category.title} \xB7 ${n.group.title}`,o.append(a,l),r.append(s,o),t.append(r)}if(i.length>e.length){let n=document.createElement("p");n.className="dock-note",n.textContent=`First ${e.length} of ${Pc(i.length)} \u2014 search or filter to narrow the list.`,t.append(n)}we.searchResults.replaceChildren(t),Roe(i.length),Coe()}var Tz=28;function Coe(){let i=k.selectedPin?.location.title||"",e=i.length>Tz?`${i.slice(0,Tz-1).trimEnd()}\u2026`:i;we.dockRailName.textContent=e?` \xB7 ${e}`:"",we.dockRailName.hidden=!e}function Roe(i){we.dockCount.textContent=`${Pc(i)} ${i===1?"location":"locations"}`,k.search?(we.dockFlag.textContent=`\u201C${k.search}\u201D`,we.dockFlag.hidden=!1):k.hiddenCategories.size>0?(we.dockFlag.textContent="filtered",we.dockFlag.hidden=!1):we.dockFlag.hidden=!0}function kw(){!k.dockFolded||k.dockDismissed||Gw(!1)}function zP(i){k.dockDismissed=i,Gw(i)}function Gw(i,e=!0){k.dockFolded=i,we.dock.classList.toggle("is-folded",i),we.dockFold.setAttribute("aria-expanded",String(!i));let t=i?"Bring the panel back (\u2318\u2325B)":"Put the panel away (\u2318\u2325B)";we.dockFold.setAttribute("aria-label",t),we.dockFold.setAttribute("title",t),e&&Mc()}function VP(i){k.hiddenCategories.delete(i.category.id),Tx(),ql(),yd(),Sx(i,!0)}function Sx(i,e=!1){k.selectedPin=i,document.dispatchEvent(new Event("atlas:selection")),bu(),k.layers.pins.changed(),k.layers.pinLabels.changed(),k.layers.text.changed(),k.layers.textDetail.changed(),k.layers.priority.changed(),we.detailTitle.textContent=i.location.title,we.detailCategory.textContent=`${i.group.title} / ${i.category.title}`,we.detailDescription.textContent="",we.detailLinks.hidden=!0,Ioe(i),we.detailID.textContent=String(i.location.id),we.detailCoordinates.textContent=`${i.location.lat.toFixed(6)}, ${i.location.lng.toFixed(6)}`;let t=bz(i.coordinate);we.detailCell.textContent=t,we.detailCellField.hidden=!t;let n=Poe(i);if(we.detailSource.textContent=n,we.detailSourceField.hidden=!n,wg(we.detailDot,i.category),Sg(we.detailDot,i.category,Rc(i.category.title)),we.detail.hidden=!1,kw(),xd(),e){let r=k.engine.getView();r.animate({center:i.coordinate,zoom:Math.min(wu(k.variant),Math.max(r.getZoom()||0,4)),duration:220})}}function Poe(i){let e=k.map?.merged;if(!e?.length)return"";let t=e.find(n=>n.origin)?.source||"";if(k.pinSourceIndex?.map!==k.map){let n=new Map;for(let r of e){for(let s of r.adopted||[])n.set(s.d,r.source);for(let s of r.matched||[]){let o=`confirmed by ${r.source}`;n.set(s.w,t?`${t} \xB7 ${o}`:o)}}k.pinSourceIndex={map:k.map,byID:n}}for(let n of e)if(!n.origin&&i.group.title===n.source)return n.source;return k.pinSourceIndex.byID.get(i.location.id)||t}async function Ioe(i){let e=await Ez();if(k.selectedPin!==i)return;let t=e[String(i.location.id)]||{};i.location.description=t.d||"",i.location.links=t.l||[],we.detailDescription.textContent=Sz(t.d)||"No description is included in the archive.",Noe(i)}function Noe(i){let e=(i.location.links||[]).filter(n=>k.pinByID.has(n.locationId));if(we.detailLinks.hidden=e.length===0,!e.length){we.detailLinks.replaceChildren();return}let t=document.createDocumentFragment();for(let n of e){let r=document.createElement("button");r.type="button",r.className="detail-link",r.dataset.location=String(n.locationId),r.textContent=n.title,t.append(r)}we.detailLinks.replaceChildren(t)}function Cc(){let i=k.selectedPin!==null;k.selectedPin=null,document.dispatchEvent(new Event("atlas:selection")),k.sources&&(bu(),k.layers.pins.changed(),k.layers.pinLabels.changed(),k.layers.text.changed(),k.layers.textDetail.changed(),k.layers.priority.changed()),we.detail.hidden=!0,i&&xd()}function Su(i){let e=i.attrs?.["atlas.render.as"];return e||(i.displayType==="text"?"text":"pin")}function Mz(i){return i?.attrs?.["atlas.geometry.surface"]||"plane"}function qP(i){let e=i?.attrs||{};if(e["atlas.geometry.projection"]!=="equirect")return null;let t=(e["atlas.geometry.equirect.px"]||"").split(",").map(Number),n=(e["atlas.geometry.equirect.deg"]||"").split(",").map(Number);if(t.length!==4||n.length!==4||t.some(Number.isNaN)||n.some(Number.isNaN))return null;let[r,s,o,a]=t,[l,c,u,f]=n;return!o||!a||c===f||l===u?null:{toLatLng(p,x){return[c-(x-s)/a*(c-f),l+(p-r)/o*(u-l)]}}}var Vw=[NaN,NaN,NaN,0],HP;function Loe(){return HP||(HP=Si(1,1,void 0,{willReadFrequently:!0,desynchronized:!0})),HP}var Doe=/^rgba?\(\s*(\d+%?)\s+(\d+%?)\s+(\d+%?)(?:\s*\/\s*(\d+%|\d*\.\d+|[01]))?\s*\)$/i,Foe=/^rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)(?:\s*,\s*(\d+%|\d*\.\d+|[01]))?\s*\)$/i,Ooe=/^rgba?\(\s*(\d+%)\s*,\s*(\d+%)\s*,\s*(\d+%)(?:\s*,\s*(\d+%|\d*\.\d+|[01]))?\s*\)$/i,Boe=/^#([\da-f]{3,4}|[\da-f]{6}|[\da-f]{8})$/i;function zw(i,e){return i.endsWith("%")?Number(i.substring(0,i.length-1))/e:Number(i)}function Mx(i){throw new Error('failed to parse "'+i+'" as color')}function Cz(i){if(i.toLowerCase().startsWith("rgb")){let s=i.match(Foe)||i.match(Doe)||i.match(Ooe);if(s){let o=s[4],a=100/255;return[_i(zw(s[1],a)+.5|0,0,255),_i(zw(s[2],a)+.5|0,0,255),_i(zw(s[3],a)+.5|0,0,255),o!==void 0?_i(zw(o,100),0,1):1]}Mx(i)}if(i.startsWith("#")){if(Boe.test(i)){let s=i.substring(1),o=s.length<=4?1:2,a=[0,0,0,255];for(let l=0,c=s.length;l<c;l+=o){let u=parseInt(s.substring(l,l+o),16);o===1&&(u+=u<<4),a[l/o]=u}return a[3]=a[3]/255,a}Mx(i)}let e=Loe();e.fillStyle="#abcdef";let t=e.fillStyle;e.fillStyle=i,e.fillStyle===t&&(e.fillStyle="#fedcba",t=e.fillStyle,e.fillStyle=i,e.fillStyle===t&&Mx(i));let n=e.fillStyle;if(n.startsWith("#")||n.startsWith("rgba"))return Cz(n);e.clearRect(0,0,1,1),e.fillRect(0,0,1,1);let r=Array.from(e.getImageData(0,0,1,1).data);return r[3]=L0(r[3]/255,3),r}function Rz(i){return typeof i=="string"?i:Rx(i)}var Uoe=1024,Ex={},WP=0;function Pz(i){if(i.length===4)return i;let e=i.slice();return e[3]=1,e}function jP(i){return i>.0031308?Math.pow(i,1/2.4)*269.025-14.025:i*3294.6}function XP(i){return i>.2068965?Math.pow(i,3):(i-4/29)*(108/841)}function $P(i){return i>10.314724?Math.pow((i+14.025)/269.025,2.4):i/3294.6}function YP(i){return i>.0088564?Math.pow(i,1/3):i/(108/841)+4/29}function ZP(i){let e=$P(i[0]),t=$P(i[1]),n=$P(i[2]),r=YP(e*.222488403+t*.716873169+n*.06060791),s=500*(YP(e*.452247074+t*.399439023+n*.148375274)-r),o=200*(r-YP(e*.016863605+t*.117638439+n*.865350722)),a=Math.atan2(o,s)*(180/Math.PI);return[116*r-16,Math.sqrt(s*s+o*o),a<0?a+360:a,i[3]]}function Iz(i){let e=(i[0]+16)/116,t=i[1],n=i[2]*Math.PI/180,r=XP(e),s=XP(e+t/500*Math.cos(n)),o=XP(e-t/200*Math.sin(n)),a=jP(s*3.021973625-r*1.617392459-o*.404875592),l=jP(s*-.943766287+r*1.916279586+o*.027607165),c=jP(s*.069407491-r*.22898585+o*1.159737864);return[_i(a+.5|0,0,255),_i(l+.5|0,0,255),_i(c+.5|0,0,255),i[3]]}function Cx(i){if(i==="none")return Vw;if(Ex.hasOwnProperty(i))return Ex[i];if(WP>=Uoe){let t=0;for(let n in Ex)(t++&3)===0&&(delete Ex[n],--WP)}let e=Cz(i);e.length!==4&&Mx(i);for(let t of e)isNaN(t)&&Mx(i);return Ex[i]=e,++WP,e}function Hl(i){return Array.isArray(i)?i:Cx(i)}function Rx(i){let e=i[0];e!=(e|0)&&(e=e+.5|0);let t=i[1];t!=(t|0)&&(t=t+.5|0);let n=i[2];n!=(n|0)&&(n=n+.5|0);let r=i[3]===void 0?1:Math.round(i[3]*1e3)/1e3;return"rgba("+e+","+t+","+n+","+r+")"}var QP=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 e=0;for(let t in this.cache_){let n=this.cache_[t];(e++&3)===0&&!n.hasListener()&&(delete this.cache_[t],delete this.patternCache_[t],--this.cacheSize_)}}}get(e,t){let n=KP(e,t);return n in this.cache_?this.cache_[n]:null}getPattern(e,t){let n=KP(e,t);return n in this.patternCache_?this.patternCache_[n]:null}set(e,t,n,r){let s=KP(e,t),o=s in this.cache_;this.cache_[s]=n,r&&(n.getImageState()===Mn.IDLE&&n.load(),n.getImageState()===Mn.LOADING?n.ready().then(()=>{this.patternCache_[s]=mx().createPattern(n.getImage(1),"repeat")}):this.patternCache_[s]=mx().createPattern(n.getImage(1),"repeat")),o||++this.cacheSize_}setSize(e){this.maxCacheSize_=e,this.expire()}};function KP(i,e){let t=e?Hl(e):"null";return i+":"+t}var Io=new QP;var Px=null,qw=class extends md{constructor(e,t,n,r,s){super(),this.hitDetectionImage_=null,this.image_=e,this.crossOrigin_=n?.crossOrigin,this.referrerPolicy_=n?.referrerPolicy,this.canvas_={},this.color_=s,this.imageState_=r===void 0?Mn.IDLE:r,this.size_=e&&e.width&&e.height?[e.width,e.height]:null,this.src_=t,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_===Mn.LOADED){Px||(Px=Si(1,1,void 0,{willReadFrequently:!0})),Px.drawImage(this.image_,0,0);try{Px.getImageData(0,0,1,1),this.tainted_=!1}catch{Px=null,this.tainted_=!0}}return this.tainted_===!0}dispatchChangeEvent_(){this.dispatchEvent(Jt.CHANGE)}handleImageError_(){this.imageState_=Mn.ERROR,this.dispatchChangeEvent_()}handleImageLoad_(){this.imageState_=Mn.LOADED,this.size_=[this.image_.width,this.image_.height],this.dispatchChangeEvent_()}getImage(e){return this.image_||this.initializeImage_(),this.replaceColor_(e),this.canvas_[e]?this.canvas_[e]:this.image_}setImage(e){this.image_=e}getPixelRatio(e){return this.replaceColor_(e),this.canvas_[e]?e:1}getImageState(){return this.imageState_}getHitDetectionImage(){if(this.image_||this.initializeImage_(),!this.hitDetectionImage_)if(this.isTainted_()){let e=this.size_[0],t=this.size_[1],n=Si(e,t);n.fillRect(0,0,e,t),this.hitDetectionImage_=n.canvas}else this.hitDetectionImage_=this.image_;return this.hitDetectionImage_}getSize(){return this.size_}getSrc(){return this.src_}load(){if(this.imageState_===Mn.IDLE){this.image_||this.initializeImage_(),this.imageState_=Mn.LOADING;try{this.src_!==void 0&&(this.image_.src=this.src_)}catch{this.handleImageError_()}this.image_ instanceof HTMLImageElement&&IG(this.image_,this.src_).then(e=>{this.image_=e,this.handleImageLoad_()}).catch(this.handleImageError_.bind(this))}}replaceColor_(e){if(!this.color_||this.canvas_[e]||this.imageState_!==Mn.LOADED)return;let t=this.image_,n=Si(Math.ceil(t.width*e),Math.ceil(t.height*e)),r=n.canvas;n.scale(e,e),n.drawImage(t,0,0),n.globalCompositeOperation="multiply",n.fillStyle=Rz(this.color_),n.fillRect(0,0,r.width/e,r.height/e),n.globalCompositeOperation="destination-in",n.drawImage(t,0,0),this.canvas_[e]=r}ready(){return this.ready_||(this.ready_=new Promise(e=>{if(this.imageState_===Mn.LOADED||this.imageState_===Mn.ERROR)e();else{let t=()=>{(this.imageState_===Mn.LOADED||this.imageState_===Mn.ERROR)&&(this.removeEventListener(Jt.CHANGE,t),e())};this.addEventListener(Jt.CHANGE,t)}})),this.ready_}};function vd(i,e,t,n,r,s){let o=e===void 0?void 0:Io.get(e,r);return o||(o=new qw(i,i&&"src"in i?i.src||void 0:e,t,n,r),Io.set(e,r,o,s)),s&&o&&!Io.getPattern(e,r)&&Io.set(e,r,o,s),o}var Nz=qw;function ka(i){return i?Array.isArray(i)?Rx(i):typeof i=="object"&&"src"in i?koe(i):i:null}function koe(i){if(!i.offset||!i.size)return Io.getPattern(i.src,i.color);let e=i.src+":"+i.offset,t=Io.getPattern(e,i.color);if(t)return t;let n=Io.get(i.src,null);if(n.getImageState()!==Mn.LOADED)return null;let r=Si(i.size[0],i.size[1]);return r.drawImage(n.getImage(1),i.offset[0],i.offset[1],i.size[0],i.size[1],0,0,i.size[0],i.size[1]),vd(r.canvas,e,void 0,Mn.LOADED,i.color,!0),Io.getPattern(e,i.color)}var Ix="ol-hidden";var bd="ol-unselectable";var Tg="ol-control",JP="ol-collapsed",Goe=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"),Lz=["style","variant","weight","size","lineHeight","family"],Hw={normal:400,bold:700},Ww=function(i){let e=i.match(Goe);if(!e)return null;let t={lineHeight:"normal",size:"1.2em",style:"normal",weight:"400",variant:"normal"};for(let n=0,r=Lz.length;n<r;++n){let s=e[n+1];s!==void 0&&(t[Lz[n]]=typeof s=="string"?s.trim():s)}return isNaN(Number(t.weight))&&t.weight in Hw&&(t.weight=Hw[t.weight]),t.families=t.family.split(/,\s?/).map(n=>n.trim().replace(/^['"]|['"]$/g,"")),t};var jw="10px sans-serif",Ls="#000",Tu="round",Ga=[],za=0,Eu="round",tf=10,Fz=0,No="#000",wd="center",X0="middle",nf=[0,0,0,0],rf=1,j0=new ms,Nx=null,Dz,eI={},zoe=new Set(["serif","sans-serif","monospace","cursive","fantasy","system-ui","ui-serif","ui-sans-serif","ui-monospace","ui-rounded","emoji","math","fangsong"]);function Voe(i,e,t){return`${i} ${e} 16px "${t}"`}var Oz=(function(){let e,t;async function n(s){await t.ready;let o=Ww(s),a=o.families[0].toLowerCase(),l=o.weight,c=[];return t.forEach(f=>{let p=f.family.replace(/^['"]|['"]$/g,"").toLowerCase(),x=Hw[f.weight]||f.weight;p===a&&f.style===o.style&&x==l&&c.push(f)}),c.length===0?!1:(await Promise.all(c.map(f=>f.load().then(()=>!0,()=>!1)))).some(f=>f)}async function r(){await t.ready;let s=!0,o=j0.getProperties(),a=Object.keys(o).filter(l=>o[l]<100);for(let l=a.length-1;l>=0;--l){let c=a[l],u=o[c];u<100&&(await n(c)?(_u(eI),j0.set(c,100)):(u+=10,j0.set(c,u,!0),u<100&&(s=!1)))}e=void 0,s||(e=setTimeout(r,100))}return async function(s){t||(t=Ns?self.fonts:document.fonts);let o=Ww(s);if(!o)return;let a=o.families,l=!1;for(let c of a){if(zoe.has(c))continue;let u=Voe(o.style,o.weight,c);j0.get(u)===void 0&&(j0.set(u,0,!0),l=!0)}l&&(clearTimeout(e),e=setTimeout(r,100))}})(),qoe=(function(){let i;return function(e){let t=eI[e];if(t==null){if(Ns){let n=Ww(e),r=Bz(e,"\u017Dg");t=(isNaN(Number(n.lineHeight))?1.2:Number(n.lineHeight))*(r.actualBoundingBoxAscent+r.actualBoundingBoxDescent)}else i||(i=document.createElement("div"),i.innerHTML="M",i.style.minHeight="0",i.style.maxHeight="none",i.style.height="auto",i.style.padding="0",i.style.border="none",i.style.position="absolute",i.style.display="block",i.style.left="-99999px"),i.style.font=e,document.body.appendChild(i),t=i.offsetHeight,document.body.removeChild(i);eI[e]=t}return t}})();function Bz(i,e){return Nx||(Nx=Si(1,1)),i!=Dz&&(Nx.font=i,Dz=Nx.font),Nx.measureText(e)}function Uz(i,e){return Bz(i,e).width}function tI(i,e,t){if(e in t)return t[e];let n=e.split(`5+`).reduce((r,s)=>Math.max(r,Uz(i,s)),0);return t[e]=n,n}function kz(i,e){let t=[],n=[],r=[],s=0,o=0,a=0,l=0;for(let c=0,u=e.length;c<=u;c+=2){let f=e[c];if(f===`6+`||c===u){s=Math.max(s,o),r.push(o),o=0,a+=l,l=0;continue}let p=e[c+1]||i.font,x=Uz(p,f);t.push(x),o+=x;let b=qoe(p);n.push(b),l=Math.max(l,b)}return{width:s,height:a,widths:t,heights:n,lineWidths:r}}function Gz(i,e,t,n,r,s,o,a,l,c,u){i.save(),t!==1&&(i.globalAlpha===void 0?i.globalAlpha=f=>f.globalAlpha*=t:i.globalAlpha*=t),e&&i.transform.apply(i,e),n.contextInstructions?(i.translate(l,c),i.scale(u[0],u[1]),Hoe(n,i)):u[0]<0||u[1]<0?(i.translate(l,c),i.scale(u[0],u[1]),i.drawImage(n,r,s,o,a,0,0,o,a)):i.drawImage(n,r,s,o,a,l,c,o*u[0],a*u[1]),i.restore()}function Hoe(i,e){let t=i.contextInstructions;for(let n=0,r=t.length;n<r;n+=2)Array.isArray(t[n+1])?e[t[n]].apply(e,t[n+1]):e[t[n]]=t[n+1]}var nI=class i{constructor(e){this.opacity_=e.opacity,this.rotateWithView_=e.rotateWithView,this.rotation_=e.rotation,this.scale_=e.scale,this.scaleArray_=Vr(e.scale),this.displacement_=e.displacement,this.declutterMode_=e.declutterMode}clone(){let e=this.getScale();return new i({opacity:this.getOpacity(),scale:Array.isArray(e)?e.slice():e,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 $n()}getImage(e){return $n()}getHitDetectionImage(){return $n()}getPixelRatio(e){return 1}getImageState(){return $n()}getImageSize(){return $n()}getOrigin(){return $n()}getSize(){return $n()}setDisplacement(e){this.displacement_=e}setOpacity(e){this.opacity_=e}setRotateWithView(e){this.rotateWithView_=e}setRotation(e){this.rotation_=e}setScale(e){this.scale_=e,this.scaleArray_=Vr(e)}listenImageChange(e){$n()}load(){$n()}unlistenImageChange(e){$n()}ready(){return Promise.resolve()}},Xw=nI;var iI=class i extends Xw{constructor(e){super({opacity:1,rotateWithView:e.rotateWithView!==void 0?e.rotateWithView:!1,rotation:e.rotation!==void 0?e.rotation:0,scale:e.scale!==void 0?e.scale:1,displacement:e.displacement!==void 0?e.displacement:[0,0],declutterMode:e.declutterMode}),this.hitDetectionCanvas_=null,this.fill_=e.fill!==void 0?e.fill:null,this.origin_=[0,0],this.points_=e.points,this.radius=e.radius,this.radius2_=e.radius2,this.angle_=e.angle!==void 0?e.angle:0,this.stroke_=e.stroke!==void 0?e.stroke:null,this.size_,this.renderOptions_,this.imageState_=this.fill_&&this.fill_.loading()?Mn.LOADING:Mn.LOADED,this.imageState_===Mn.LOADING&&this.ready().then(()=>this.imageState_=Mn.LOADED),this.render()}clone(){let e=this.getScale(),t=new i({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(e)?e.slice():e,displacement:this.getDisplacement().slice(),declutterMode:this.getDeclutterMode()});return t.setOpacity(this.getOpacity()),t}getAnchor(){let e=this.size_,t=this.getDisplacement(),n=this.getScaleArray();return[e[0]/2-t[0]/n[0],e[1]/2+t[1]/n[1]]}getAngle(){return this.angle_}getFill(){return this.fill_}setFill(e){this.fill_=e,this.render()}getHitDetectionImage(){return this.hitDetectionCanvas_||(this.hitDetectionCanvas_=this.createHitDetectionCanvas_(this.renderOptions_)),this.hitDetectionCanvas_}getImage(e){let t=this.fill_?.getKey(),n=`${e},${this.angle_},${this.radius},${this.radius2_},${this.points_},${t}`+Object.values(this.renderOptions_).join(","),r=Io.get(n,null)?.getImage(1);if(!r){let s=this.renderOptions_,o=Math.ceil(s.size*e),a=Si(o,o);this.draw_(s,a,e),r=a.canvas;let l=new Nz(r,void 0,null,Mn.LOADED,null);Io.set(n,null,l),createImageBitmap(r).then(c=>{l.setImage(c)})}return r}getPixelRatio(e){return e}getImageSize(){return this.size_}getImageState(){return this.imageState_}getOrigin(){return this.origin_}getPoints(){return this.points_}getRadius(){return this.radius}setRadius(e){this.radius!==e&&(this.radius=e,this.render())}getRadius2(){return this.radius2_}setRadius2(e){this.radius2_!==e&&(this.radius2_=e,this.render())}getSize(){return this.size_}getStroke(){return this.stroke_}setStroke(e){this.stroke_=e,this.render()}listenImageChange(e){}load(){}unlistenImageChange(e){}calculateLineJoinSize_(e,t,n){if(t===0||this.points_===1/0||e!=="bevel"&&e!=="miter")return t;let r=this.radius,s=this.radius2_===void 0?r:this.radius2_;if(r<s){let D=r;r=s,s=D}let o=this.radius2_===void 0?this.points_:this.points_*2,a=2*Math.PI/o,l=s*Math.sin(a),c=Math.sqrt(s*s-l*l),u=r-c,f=Math.sqrt(l*l+u*u),p=f/l;if(e==="miter"&&p<=n)return p*t;let x=t/2/p,b=t/2*(u/f),S=Math.sqrt((r+x)*(r+x)+b*b)-r;if(this.radius2_===void 0||e==="bevel")return S*2;let T=r*Math.sin(a),P=Math.sqrt(r*r-T*T),R=s-P,L=Math.sqrt(T*T+R*R)/T;if(L<=n){let D=L*t/2-s-r;return 2*Math.max(S,D)}return S*2}createRenderOptions(){let e=Tu,t=Eu,n=0,r=null,s=0,o,a=0;this.stroke_&&(o=ka(this.stroke_.getColor()??No),a=this.stroke_.getWidth()??rf,r=this.stroke_.getLineDash(),s=this.stroke_.getLineDashOffset()??0,t=this.stroke_.getLineJoin()??Eu,e=this.stroke_.getLineCap()??Tu,n=this.stroke_.getMiterLimit()??tf);let l=this.calculateLineJoinSize_(t,a,n),c=Math.max(this.radius,this.radius2_||0),u=Math.ceil(2*c+l);return{strokeStyle:o,strokeWidth:a,size:u,lineCap:e,lineDash:r,lineDashOffset:s,lineJoin:t,miterLimit:n}}render(){this.renderOptions_=this.createRenderOptions();let e=this.renderOptions_.size;this.hitDetectionCanvas_=null,this.size_=[e,e]}draw_(e,t,n){if(t.scale(n,n),t.translate(e.size/2,e.size/2),this.createPath_(t),this.fill_){let r=this.fill_.getColor();r===null&&(r=Ls),t.fillStyle=ka(r),t.fill()}e.strokeStyle&&(t.strokeStyle=e.strokeStyle,t.lineWidth=e.strokeWidth,e.lineDash&&(t.setLineDash(e.lineDash),t.lineDashOffset=e.lineDashOffset),t.lineCap=e.lineCap,t.lineJoin=e.lineJoin,t.miterLimit=e.miterLimit,t.stroke())}createHitDetectionCanvas_(e){let t;if(this.fill_){let n=this.fill_.getColor(),r=0;typeof n=="string"&&(n=Hl(n)),n===null?r=1:Array.isArray(n)&&(r=n.length===4?n[3]:1),r===0&&(t=Si(e.size,e.size),this.drawHitDetectionCanvas_(e,t))}return t?t.canvas:this.getImage(1)}createPath_(e){let t=this.points_,n=this.radius;if(t===1/0)e.arc(0,0,n,0,2*Math.PI);else{let r=this.radius2_===void 0?n:this.radius2_;this.radius2_!==void 0&&(t*=2);let s=this.angle_-Math.PI/2,o=2*Math.PI/t;for(let a=0;a<t;a++){let l=s+a*o,c=a%2===0?n:r;e.lineTo(c*Math.cos(l),c*Math.sin(l))}e.closePath()}}drawHitDetectionCanvas_(e,t){t.translate(e.size/2,e.size/2),this.createPath_(t),t.fillStyle=Ls,t.fill(),e.strokeStyle&&(t.strokeStyle=e.strokeStyle,t.lineWidth=e.strokeWidth,e.lineDash&&(t.setLineDash(e.lineDash),t.lineDashOffset=e.lineDashOffset),t.lineJoin=e.lineJoin,t.miterLimit=e.miterLimit,t.stroke())}ready(){return this.fill_?this.fill_.ready():Promise.resolve()}},$w=iI;var rI=class i extends $w{constructor(e){e=e||{radius:5},super({points:1/0,fill:e.fill,radius:e.radius,stroke:e.stroke,scale:e.scale!==void 0?e.scale:1,rotation:e.rotation!==void 0?e.rotation:0,rotateWithView:e.rotateWithView!==void 0?e.rotateWithView:!1,displacement:e.displacement!==void 0?e.displacement:[0,0],declutterMode:e.declutterMode})}clone(){let e=this.getScale(),t=new i({fill:this.getFill()?this.getFill().clone():void 0,stroke:this.getStroke()?this.getStroke().clone():void 0,radius:this.getRadius(),scale:Array.isArray(e)?e.slice():e,rotation:this.getRotation(),rotateWithView:this.getRotateWithView(),displacement:this.getDisplacement().slice(),declutterMode:this.getDeclutterMode()});return t.setOpacity(this.getOpacity()),t}},Yw=rI;var sI=class i{constructor(e){e=e||{},this.patternImage_=null,this.color_=null,e.color!==void 0&&this.setColor(e.color)}clone(){let e=this.getColor();return new i({color:Array.isArray(e)?e.slice():e||void 0})}getColor(){return this.color_}setColor(e){if(e!==null&&typeof e=="object"&&"src"in e){let t=vd(null,e.src,{crossOrigin:"anonymous"},void 0,e.offset?null:e.color?e.color:null,!(e.offset&&e.size));t.ready().then(()=>{this.patternImage_=null}),t.getImageState()===Mn.IDLE&&t.load(),t.getImageState()===Mn.LOADING&&(this.patternImage_=t)}this.color_=e}getKey(){let e=this.getColor();return e?e instanceof CanvasPattern||e instanceof CanvasGradient?Nn(e):typeof e=="object"&&"src"in e?e.src+":"+e.offset:Hl(e).toString():""}loading(){return!!this.patternImage_}ready(){return this.patternImage_?this.patternImage_.ready():Promise.resolve()}},qr=sI;function zz(i,e,t,n){return t!==void 0&&n!==void 0?[t/i,n/e]:t!==void 0?t/i:n!==void 0?n/e:1}var oI=class i extends Xw{constructor(e){e=e||{};let t=e.opacity!==void 0?e.opacity:1,n=e.rotation!==void 0?e.rotation:0,r=e.scale!==void 0?e.scale:1,s=e.rotateWithView!==void 0?e.rotateWithView:!1;super({opacity:t,rotation:n,scale:r,displacement:e.displacement!==void 0?e.displacement:[0,0],rotateWithView:s,declutterMode:e.declutterMode}),this.anchor_=e.anchor!==void 0?e.anchor:[.5,.5],this.normalizedAnchor_=null,this.anchorOrigin_=e.anchorOrigin!==void 0?e.anchorOrigin:"top-left",this.anchorXUnits_=e.anchorXUnits!==void 0?e.anchorXUnits:"fraction",this.anchorYUnits_=e.anchorYUnits!==void 0?e.anchorYUnits:"fraction",this.crossOrigin_=e.crossOrigin!==void 0?e.crossOrigin:null,this.referrerPolicy_=e.referrerPolicy;let o=e.img!==void 0?e.img:null,a=e.src;zn(!(a!==void 0&&o),"`image` and `src` cannot be provided at the same time"),(a===void 0||a.length===0)&&o&&(a=o.src||Nn(o)),zn(a!==void 0&&a.length>0,"A defined and non-empty `src` or `image` must be provided"),zn(!((e.width!==void 0||e.height!==void 0)&&e.scale!==void 0),"`width` or `height` cannot be provided together with `scale`");let l;if(e.src!==void 0?l=Mn.IDLE:o!==void 0&&("complete"in o?o.complete?l=o.src?Mn.LOADED:Mn.IDLE:l=Mn.LOADING:l=Mn.LOADED),this.color_=e.color!==void 0?Hl(e.color):null,this.iconImage_=vd(o,a,{crossOrigin:this.crossOrigin_,referrerPolicy:this.referrerPolicy_},l,this.color_),this.offset_=e.offset!==void 0?e.offset:[0,0],this.offsetOrigin_=e.offsetOrigin!==void 0?e.offsetOrigin:"top-left",this.origin_=null,this.size_=e.size!==void 0?e.size:null,this.initialOptions_,e.width!==void 0||e.height!==void 0){let c,u;if(e.size)[c,u]=e.size;else{let f=this.getImage(1);if(f.width&&f.height)c=f.width,u=f.height;else if(f instanceof HTMLImageElement){this.initialOptions_=e;let p=()=>{if(this.unlistenImageChange(p),!this.initialOptions_)return;let x=this.iconImage_.getSize();this.setScale(zz(x[0],x[1],e.width,e.height))};this.listenImageChange(p);return}}c!==void 0&&this.setScale(zz(c,u,e.width,e.height))}}clone(){let e,t,n;return this.initialOptions_?(t=this.initialOptions_.width,n=this.initialOptions_.height):(e=this.getScale(),e=Array.isArray(e)?e.slice():e),new i({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:e,width:t,height:n,size:this.size_!==null?this.size_.slice():void 0,src:this.getSrc(),displacement:this.getDisplacement().slice(),declutterMode:this.getDeclutterMode()})}getAnchor(){let e=this.normalizedAnchor_;if(!e){e=this.anchor_;let r=this.getSize();if(this.anchorXUnits_=="fraction"||this.anchorYUnits_=="fraction"){if(!r)return null;e=this.anchor_.slice(),this.anchorXUnits_=="fraction"&&(e[0]*=r[0]),this.anchorYUnits_=="fraction"&&(e[1]*=r[1])}if(this.anchorOrigin_!="top-left"){if(!r)return null;e===this.anchor_&&(e=this.anchor_.slice()),(this.anchorOrigin_=="top-right"||this.anchorOrigin_=="bottom-right")&&(e[0]=-e[0]+r[0]),(this.anchorOrigin_=="bottom-left"||this.anchorOrigin_=="bottom-right")&&(e[1]=-e[1]+r[1])}this.normalizedAnchor_=e}let t=this.getDisplacement(),n=this.getScaleArray();return[e[0]-t[0]/n[0],e[1]+t[1]/n[1]]}setAnchor(e){this.anchor_=e,this.normalizedAnchor_=null}getColor(){return this.color_}setColor(e){let t=e?Hl(e):null;if(this.color_===t||this.color_&&t&&this.color_.length===t.length&&this.color_.every((o,a)=>o===t[a]))return;this.color_=t;let n=this.getSrc(),r=n!==void 0?null:this.getHitDetectionImage(),s=n!==void 0?Mn.IDLE:this.iconImage_.getImageState();this.iconImage_=vd(r,n,{crossOrigin:this.crossOrigin_,referrerPolicy:this.referrerPolicy_},s,this.color_)}getImage(e){return this.iconImage_.getImage(e)}getPixelRatio(e){return this.iconImage_.getPixelRatio(e)}getImageSize(){return this.iconImage_.getSize()}getImageState(){return this.iconImage_.getImageState()}getHitDetectionImage(){return this.iconImage_.getHitDetectionImage()}getOrigin(){if(this.origin_)return this.origin_;let e=this.offset_;if(this.offsetOrigin_!="top-left"){let t=this.getSize(),n=this.iconImage_.getSize();if(!t||!n)return null;e=e.slice(),(this.offsetOrigin_=="top-right"||this.offsetOrigin_=="bottom-right")&&(e[0]=n[0]-t[0]-e[0]),(this.offsetOrigin_=="bottom-left"||this.offsetOrigin_=="bottom-right")&&(e[1]=n[1]-t[1]-e[1])}return this.origin_=e,this.origin_}getSrc(){return this.iconImage_.getSrc()}setSrc(e){this.iconImage_=vd(null,e,{crossOrigin:this.crossOrigin_,referrerPolicy:this.referrerPolicy_},Mn.IDLE,this.color_)}getSize(){return this.size_?this.size_:this.iconImage_.getSize()}getWidth(){let e=this.getScaleArray();if(this.size_)return this.size_[0]*e[0];if(this.iconImage_.getImageState()==Mn.LOADED)return this.iconImage_.getSize()[0]*e[0]}getHeight(){let e=this.getScaleArray();if(this.size_)return this.size_[1]*e[1];if(this.iconImage_.getImageState()==Mn.LOADED)return this.iconImage_.getSize()[1]*e[1]}setScale(e){delete this.initialOptions_,super.setScale(e)}listenImageChange(e){this.iconImage_.addEventListener(Jt.CHANGE,e)}load(){this.iconImage_.load()}unlistenImageChange(e){this.iconImage_.removeEventListener(Jt.CHANGE,e)}ready(){return this.iconImage_.ready()}},$0=oI;var aI=class i{constructor(e){e=e||{},this.color_=e.color!==void 0?e.color:null,this.lineCap_=e.lineCap,this.lineDash_=e.lineDash!==void 0?e.lineDash:null,this.lineDashOffset_=e.lineDashOffset,this.lineJoin_=e.lineJoin,this.miterLimit_=e.miterLimit,this.offset_=e.offset,this.width_=e.width}clone(){let e=this.getColor();return new i({color:Array.isArray(e)?e.slice():e||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(e){this.color_=e}setLineCap(e){this.lineCap_=e}setLineDash(e){this.lineDash_=e}setLineDashOffset(e){this.lineDashOffset_=e}setLineJoin(e){this.lineJoin_=e}setMiterLimit(e){this.miterLimit_=e}setOffset(e){this.offset_=e}setWidth(e){this.width_=e}},$s=aI;var Zw=class i{constructor(e){e=e||{},this.geometry_=null,this.geometryFunction_=Vz,e.geometry!==void 0&&this.setGeometry(e.geometry),this.fill_=e.fill!==void 0?e.fill:null,this.image_=e.image!==void 0?e.image:null,this.renderer_=e.renderer!==void 0?e.renderer:null,this.hitDetectionRenderer_=e.hitDetectionRenderer!==void 0?e.hitDetectionRenderer:null,this.stroke_=e.stroke!==void 0?e.stroke:null,this.text_=e.text!==void 0?e.text:null,this.zIndex_=e.zIndex}clone(){let e=this.getGeometry();return e&&typeof e=="object"&&(e=e.clone()),new i({geometry:e??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(e){this.renderer_=e}setHitDetectionRenderer(e){this.hitDetectionRenderer_=e}getHitDetectionRenderer(){return this.hitDetectionRenderer_}getGeometry(){return this.geometry_}getGeometryFunction(){return this.geometryFunction_}getFill(){return this.fill_}setFill(e){this.fill_=e}getImage(){return this.image_}setImage(e){this.image_=e}getStroke(){return this.stroke_}setStroke(e){this.stroke_=e}getText(){return this.text_}setText(e){this.text_=e}getZIndex(){return this.zIndex_}setGeometry(e){typeof e=="function"?this.geometryFunction_=e:typeof e=="string"?this.geometryFunction_=function(t){return t.get(e)}:e?e!==void 0&&(this.geometryFunction_=function(){return e}):this.geometryFunction_=Vz,this.geometry_=e}setZIndex(e){this.zIndex_=e}};function qz(i){let e;if(typeof i=="function")e=i;else{let t;Array.isArray(i)?t=i:(zn(typeof i.getZIndex=="function","Expected an `Style` or an array of `Style`"),t=[i]),e=function(){return t}}return e}var lI=null;function cI(i,e){if(!lI){let t=new qr({color:"rgba(255,255,255,0.4)"}),n=new $s({color:"#3399CC",width:1.25});lI=[new Zw({image:new Yw({fill:t,stroke:n,radius:5}),fill:t,stroke:n})]}return lI}function Vz(i){return i.getGeometry()}var Ds=Zw;var Woe="#333",uI=class i{constructor(e){e=e||{},this.font_=e.font,this.rotation_=e.rotation,this.rotateWithView_=e.rotateWithView,this.keepUpright_=e.keepUpright,this.scale_=e.scale,this.scaleArray_=Vr(e.scale!==void 0?e.scale:1),this.text_=e.text,this.textAlign_=e.textAlign,this.justify_=e.justify,this.repeat_=e.repeat,this.textBaseline_=e.textBaseline,this.fill_=e.fill!==void 0?e.fill:new qr({color:Woe}),this.maxAngle_=e.maxAngle!==void 0?e.maxAngle:Math.PI/4,this.placement_=e.placement!==void 0?e.placement:"point",this.overflow_=!!e.overflow,this.stroke_=e.stroke!==void 0?e.stroke:null,this.offsetX_=e.offsetX!==void 0?e.offsetX:0,this.offsetY_=e.offsetY!==void 0?e.offsetY:0,this.backgroundFill_=e.backgroundFill?e.backgroundFill:null,this.backgroundStroke_=e.backgroundStroke?e.backgroundStroke:null,this.padding_=e.padding===void 0?null:e.padding,this.declutterMode_=e.declutterMode}clone(){let e=this.getScale();return new i({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(e)?e.slice():e,text:this.getText(),textAlign:this.getTextAlign(),justify:this.getJustify(),textBaseline:this.getTextBaseline(),fill:this.getFill()instanceof qr?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(e){this.overflow_=e}setFont(e){this.font_=e}setMaxAngle(e){this.maxAngle_=e}setOffsetX(e){this.offsetX_=e}setOffsetY(e){this.offsetY_=e}setPlacement(e){this.placement_=e}setRepeat(e){this.repeat_=e}setRotateWithView(e){this.rotateWithView_=e}setKeepUpright(e){this.keepUpright_=e}setFill(e){this.fill_=e}setRotation(e){this.rotation_=e}setScale(e){this.scale_=e,this.scaleArray_=Vr(e!==void 0?e:1)}setStroke(e){this.stroke_=e}setText(e){this.text_=e}setTextAlign(e){this.textAlign_=e}setJustify(e){this.justify_=e}setTextBaseline(e){this.textBaseline_=e}setBackgroundFill(e){this.backgroundFill_=e}setBackgroundStroke(e){this.backgroundStroke_=e}setPadding(e){this.padding_=e}},sf=uI;function Wl(i,e){return(i.get("priority")||0)-(e.get("priority")||0)}function jz(i){let e=i.get("pin");return!e||jl(e)||e.insideHighlightedZone||Eg(e)?null:hI(e,!1)}function Xz(i){let e=i.get("pin");return!e||!k.highlightedZones.size||!e.insideHighlightedZone||jl(e)||Eg(e)?null:hI(e,!1)}function $z(i){let e=i.get("pin");return!e||jl(e)||!k.labelsHeld?null:Jz(e)}function Yz(i){let e=i.get("pin");if(!e||jl(e)||e.insideHighlightedZone||Eg(e)||Fx())return null;if(k.labelsHeld)return Lx(e,!1);let t=k.fitZoom+Math.log2(aV(e.category));return(k.engine.getView().getZoom()||0)<t?null:Lx(e,!1)}function Zz(i){let e=i.get("pin");return!e||jl(e)||e.insideHighlightedZone||Eg(e)||!Fx()?null:Lx(e,!1)}function Kz(i){let e=i.get("pin");return!e||!k.highlightedZones.size||!e.insideHighlightedZone||jl(e)||Eg(e)?null:Lx(e,!1)}function Qz(i){let e=i.get("pin");if(!e||jl(e))return null;if(Su(e.category)==="text")return Lx(e,e===k.selectedPin);let t=hI(e,e===k.selectedPin);return e===k.hoveredPin||e===k.selectedPin?[t,Jz(e)]:t}function hI(i,e){let t=`marker:${i.category.id}:${e?1:0}`;if(k.styleCache.has(t))return k.styleCache.get(t);let n=W0(i.category),r=e?2e7:i.priority,s=k.markerIcons.get(Dx(i.category)),o;return s?o=new Ds({image:new $0({src:s,width:e?36:31,height:e?36:31}),zIndex:r}):o=new Ds({text:new sf({text:Rc(i.category.title),font:`900 ${e?15:13}px Inter, sans-serif`,fill:new qr({color:n}),stroke:new $s({color:H0(),width:e?4:3})}),zIndex:r}),k.styleCache.set(t,o),o}function Jz(i){let e=`marker-label:${i.location.id}`;if(k.styleCache.has(e))return k.styleCache.get(e);let t=new Ds({text:new sf({text:i.location.title,offsetY:21,font:'700 10px "Arial Narrow", "Roboto Condensed", sans-serif',fill:new qr({color:"#f2ece0"}),stroke:new $s({color:"rgba(0,0,0,0.98)",width:3}),backgroundFill:new qr({color:"rgba(10,12,17,0.72)"}),padding:[2,4,2,4],overflow:!0}),zIndex:i.priority});return k.styleCache.set(e,t),t}function eV(i){if(!i.iconAsset)return;let e=Dx(i);if(k.markerIcons.has(e))return;k.markerIcons.set(e,null);let t=new Image;t.onload=()=>{let n=document.createElement("canvas");n.width=64,n.height=64;let r=n.getContext("2d"),s=W0(i),o=document.createElement("canvas");o.width=64,o.height=64;let a=o.getContext("2d");a.imageSmoothingEnabled=!i.iconPicture,a.drawImage(t,6,6,52,52),i.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 c=l.getContext("2d");c.drawImage(t,6,6,52,52),c.globalCompositeOperation="source-in",c.fillStyle=H0(),c.fillRect(0,0,64,64);for(let u=-3;u<=3;u++)for(let f=-3;f<=3;f++)f*f+u*u<=10&&r.drawImage(l,f,u);r.drawImage(o,0,0),k.markerIcons.set(e,n.toDataURL("image/png")),joe(),k.layers.pins.changed(),k.layers.zonePins.changed(),k.layers.priority.changed()},t.onerror=()=>k.markerIcons.set(e,!1),t.src=GP(i.iconAsset)}function joe(){for(let i of k.styleCache.keys())i.startsWith("marker:")&&k.styleCache.delete(i)}function Dx(i){return`${i.iconAsset||""}:${W0(i)}:${k.map?.iconOutset||"light"}`}function Lx(i,e){let t=`text:${i.location.id}:${e?1:0}`;if(k.styleCache.has(t))return k.styleCache.get(t);let r=[new Ds({text:new sf({text:i.location.title,font:`${e?"900":"800"} 14px "Arial Narrow", "Roboto Condensed", sans-serif`,fill:new qr({color:e?"#7fd0ea":"#f2ece0"}),stroke:new $s({color:"rgba(0,0,0,0.95)",width:4}),backgroundFill:new qr({color:e?"rgba(13,16,23,0.9)":"rgba(10,12,17,0.58)"}),backgroundStroke:e?new $s({color:"#3aa5c9",width:1}):void 0,padding:[3,6,3,6],overflow:!0}),zIndex:e?2e7:i.priority+3e6})];return k.styleCache.set(t,r),r}function fI(i,e){let t=i.get("gridCell");if(!t)return null;let n=t.role==="leaf",r=t.role==="scope",s=t.role==="neighbor",o=n||r?15:s?10:11,l=`${n||r?900:s?750:800} ${o}px ui-monospace, SFMono-Regular, Menlo, monospace`,c=s?[2,4,2,4]:[3,5,3,5],u=Xoe(t,l,o,c,e);if(t.role==="child"&&(!u||!k.subgridVisible))return null;let f=r&&k.subgridVisible,p=`grid:${t.hash}:${t.role}:${t.contextDistance}:${u?1:0}:${f?1:0}`;if(k.styleCache.has(p))return k.styleCache.get(p);let x=Qm[Math.max(0,kl.indexOf(t.hash[t.hash.length-1]))%Qm.length],b=new Ds({fill:r?void 0:new qr({color:s?`rgba(5, 8, 16, ${Math.min(.52,.3+t.contextDistance*.06)})`:ef(x,n?.14:.055)}),stroke:new $s({color:n||r?"#ffffff":ef(x,s?.44:.82),width:n?2.5:r?f?1.8:2.5:s?1:1.4}),text:u&&!f?new sf({text:t.hash,font:l,fill:new qr({color:n||r?"#ffffff":s?ef(x,.72):x}),stroke:new $s({color:"rgba(0,0,0,0.96)",width:4}),backgroundFill:new qr({color:s?"rgba(8,11,18,0.88)":"rgba(12,15,22,0.76)"}),padding:c,overflow:!0}):void 0,zIndex:n||r?100:i.get("priority")});return k.styleCache.set(p,b),b}function Xoe(i,e,t,n,r){if(!r)return!0;let s=$oe(i.hash,e)+n[1]+n[3],o=t+n[0]+n[2];return s<=(i.extent[2]-i.extent[0])/r&&o<=(i.extent[3]-i.extent[1])/r}var Hz=document.createElement("canvas").getContext("2d"),Wz=new Map;function $oe(i,e){let t=`${e}|${i}`,n=Wz.get(t);return n===void 0&&(Hz.font=e,n=Hz.measureText(i).width,Wz.set(t,n)),n}var Yoe=new Ds({fill:new qr({color:"rgba(5, 8, 16, 0.62)"})});function tV(){return k.zonesVisible?Yoe:null}function nV(i){if(!k.zonesVisible)return null;let e=i.get("zone"),t=i.get("child"),n=k.highlightedZones.has(e.id),r=oV(e.id),s=`zone:${e.id}:${t?1:0}:${n?1:r?2:0}`;if(k.styleCache.has(s))return k.styleCache.get(s);let o=i.get("color");if(r){let c=new Ds({stroke:new $s({color:ef(o,t?.34:.44),width:t?1:1.3,lineDash:t?[3,4]:[7,5]}),zIndex:t?101:100});return k.styleCache.set(s,c),c}let a=new Ds({fill:new qr({color:ef(o,t?.035:.07)}),stroke:new $s({color:ef(o,t?.5:.72),width:t?1.2:1.8,lineDash:t?[3,4]:[7,5]})});if(!n)return k.styleCache.set(s,a),a;let l=[new Ds({stroke:new $s({color:"rgba(255,255,255,0.94)",width:5}),zIndex:9e3}),new Ds({fill:new qr({color:ef(o,.22)}),stroke:new $s({color:o,width:2.6}),zIndex:9001})];return k.styleCache.set(s,l),l}function iV(i){if(!k.zonesVisible||Fx())return null;let e=i.get("child"),t=k.highlightedZones.has(i.get("zone").id),n=k.engine.getView().getZoom()||0;if(!t&&e&&n<k.fitZoom+3)return null;let r=i.get("span")/k.engine.getView().getResolution();return!t&&k.zoneTitleCount>40&&r<52?null:sV(i)}function rV(i){return!k.zonesVisible||!Fx()?null:sV(i)}function sV(i){let e=i.get("child"),t=i.get("zone"),n=k.highlightedZones.has(t.id),r=oV(t.id),s=`zone-title:${t.id}:${e?1:0}:${n?1:r?2:0}`;if(k.styleCache.has(s))return k.styleCache.get(s);let o=i.get("color"),a=new Ds({text:new sf({text:t.title.toLocaleUpperCase(),font:`${e?"700 12px":"800 14px"} "Arial Narrow", "Roboto Condensed", sans-serif`,fill:new qr({color:n?"#10131a":r?"rgba(196,191,177,0.56)":e?"#c8c2b4":"#f2ece0"}),stroke:new $s({color:n?"rgba(255,255,255,0.96)":r?"rgba(0,0,0,0.82)":"rgba(0,0,0,0.95)",width:n?2:r?3:4}),backgroundFill:new qr({color:n?o:r?"rgba(8,11,18,0.84)":"rgba(13,16,23,0.72)"}),backgroundStroke:new $s({color:n?"#ffffff":ef(o,r?.24:.55),width:n?2:1}),padding:[5,8,5,8],overflow:!0}),zIndex:n?91e5:i.get("priority")});return k.styleCache.set(s,a),a}function oV(i){if(!k.highlightedZones.size||k.highlightedZones.has(i))return!1;for(let e of k.highlightedZones)if(Zoe(i,e))return!1;return!0}function Zoe(i,e){let t=new Set,n=k.zoneRecords.get(e)?.zone.parentRegionId;for(;n!=null&&!t.has(n);){if(n===i)return!0;t.add(n),n=k.zoneRecords.get(n)?.zone.parentRegionId}return!1}var dI=class i extends xu{constructor(e,t){super(),t&&!Array.isArray(e[0])?this.setFlatCoordinates(t,e):this.setCoordinates(e,t)}appendPoint(e){Tc(this.flatCoordinates,e.getFlatCoordinates()),this.changed()}clone(){let e=new i(this.flatCoordinates.slice(),this.layout);return e.applyProperties(this),e}closestPointXY(e,t,n,r){if(r<cd(this.getExtent(),e,t))return r;let s=this.flatCoordinates,o=this.stride;for(let a=0,l=s.length;a<l;a+=o){let c=xc(e,t,s[a],s[a+1]);if(c<r){r=c;for(let u=0;u<o;++u)n[u]=s[a+u];n.length=o}}return r}getCoordinates(){return yu(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getPoint(e){let t=this.flatCoordinates.length/this.stride;return e<0||t<=e?null:new Qh(this.flatCoordinates.slice(e*this.stride,(e+1)*this.stride),this.layout)}getPoints(){let e=this.flatCoordinates,t=this.layout,n=this.stride,r=[];for(let s=0,o=e.length;s<o;s+=n){let a=new Qh(e.slice(s,s+n),t);r.push(a)}return r}getType(){return"MultiPoint"}intersectsExtent(e){let t=this.flatCoordinates,n=this.stride;for(let r=0,s=t.length;r<s;r+=n){let o=t[r],a=t[r+1];if(ax(e,o,a))return!0}return!1}setCoordinates(e,t){this.setLayout(t,e,1),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=gx(this.flatCoordinates,0,e,this.stride),this.changed()}},lV=dI;function Kw(i,e,t,n){let r=[],s=Er();for(let o=0,a=t.length;o<a;++o){let l=t[o];s=eg(i,e,l[0],n),r.push((s[0]+s[2])/2,(s[1]+s[3])/2),e=l[l.length-1]}return r}var pI=class i extends xu{constructor(e,t,n){if(super(),this.endss_=[],this.flatInteriorPointsRevision_=-1,this.flatInteriorPoints_=null,this.maxDelta_=-1,this.maxDeltaRevision_=-1,this.orientedRevision_=-1,this.orientedFlatCoordinates_=null,!n&&!Array.isArray(e[0])){let r=e,s=[],o=[];for(let a=0,l=r.length;a<l;++a){let c=r[a],u=s.length,f=c.getEnds();for(let p=0,x=f.length;p<x;++p)f[p]+=u;Tc(s,c.getFlatCoordinates()),o.push(f)}t=r.length===0?this.getLayout():r[0].getLayout(),e=s,n=o}t!==void 0&&n?(this.setFlatCoordinates(t,e),this.endss_=n):this.setCoordinates(e,t)}appendPolygon(e){let t;if(!this.flatCoordinates)this.flatCoordinates=e.getFlatCoordinates().slice(),t=e.getEnds().slice(),this.endss_.push();else{let n=this.flatCoordinates.length;Tc(this.flatCoordinates,e.getFlatCoordinates()),t=e.getEnds().slice();for(let r=0,s=t.length;r<s;++r)t[r]+=n}this.endss_.push(t),this.changed()}clone(){let e=this.endss_.length,t=new Array(e);for(let r=0;r<e;++r)t[r]=this.endss_[r].slice();let n=new i(this.flatCoordinates.slice(),this.layout,t);return n.applyProperties(this),n}closestPointXY(e,t,n,r){return r<cd(this.getExtent(),e,t)?r:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(hz(this.flatCoordinates,0,this.endss_,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),fz(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,this.maxDelta_,!0,e,t,n,r))}containsXY(e,t){return _G(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,e,t)}getArea(){return cz(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride)}getCoordinates(e){let t;return e!==void 0?(t=this.getOrientedFlatCoordinates().slice(),OP(t,0,this.endss_,this.stride,e)):t=this.flatCoordinates,_x(t,0,this.endss_,this.stride)}getEndss(){return this.endss_}getFlatInteriorPoints(){if(this.flatInteriorPointsRevision_!=this.getRevision()){let e=Kw(this.flatCoordinates,0,this.endss_,this.stride);this.flatInteriorPoints_=Nw(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,e),this.flatInteriorPointsRevision_=this.getRevision()}return this.flatInteriorPoints_}getInteriorPoints(){return new lV(this.getFlatInteriorPoints().slice(),"XYM")}getOrientedFlatCoordinates(){if(this.orientedRevision_!=this.getRevision()){let e=this.flatCoordinates;mz(e,0,this.endss_,this.stride)?this.orientedFlatCoordinates_=e:(this.orientedFlatCoordinates_=e.slice(),this.orientedFlatCoordinates_.length=OP(this.orientedFlatCoordinates_,0,this.endss_,this.stride)),this.orientedRevision_=this.getRevision()}return this.orientedFlatCoordinates_}getSimplifiedGeometryInternal(e){let t=[],n=[];return t.length=pz(this.flatCoordinates,0,this.endss_,this.stride,Math.sqrt(e),t,0,n),new i(t,"XY",n)}getPolygon(e){if(e<0||this.endss_.length<=e)return null;let t;if(e===0)t=0;else{let s=this.endss_[e-1];t=s[s.length-1]}let n=this.endss_[e].slice(),r=n[n.length-1];if(t!==0)for(let s=0,o=n.length;s<o;++s)n[s]-=t;return new vu(this.flatCoordinates.slice(t,r),this.layout,n)}getPolygons(){let e=this.layout,t=this.flatCoordinates,n=this.endss_,r=[],s=0;for(let o=0,a=n.length;o<a;++o){let l=n[o].slice(),c=l[l.length-1];if(s!==0)for(let f=0,p=l.length;f<p;++f)l[f]-=s;let u=new vu(t.slice(s,c),e,l);r.push(u),s=c}return r}getType(){return"MultiPolygon"}intersectsExtent(e){return yG(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,e)}setCoordinates(e,t){this.setLayout(t,e,3),this.flatCoordinates||(this.flatCoordinates=[]);let n=lz(this.flatCoordinates,0,e,this.stride,this.endss_);if(n.length===0)this.flatCoordinates.length=0;else{let r=n[n.length-1];this.flatCoordinates.length=r.length===0?0:r[r.length-1]}this.changed()}},cV=pI;function AI(){let i=(k.map.zones||[]).filter(_I);k.renderedShard=k.variant?.shard||0,k.sources.zones.clear(),k.sources.zoneTitles.clear(),k.zoneRecords.clear(),k.highlightedZones.clear(),k.focusedZoneID=null,k.zoneTitleCount=0,Qw(!0),we.zoneIndex.hidden=i.length===0,we.zoneCount.textContent=Pc(i.length);for(let e of i){let t=Er(),n=[],r=!1;for(let l of e.features||[]){let c=Joe(l);c&&(r=!0,n.push(c),ew(t,c.getExtent()),k.sources.zones.addFeature(new gd({geometry:c,zone:e,color:Bw(e.id),child:e.parentRegionId!=null})))}if(!r)continue;let s=Bw(e.id),o=e.center?Mg(e.center.lat,e.center.lng):Oa(t),a=Math.max(t[2]-t[0],t[3]-t[1]);k.sources.zoneTitles.addFeature(new gd({geometry:new Qh(o),zone:e,color:s,child:e.parentRegionId!=null,span:a,priority:(e.parentRegionId==null?2e6:1e6)+Math.round(a)})),k.zoneRecords.set(e.id,{zone:e,extent:t.slice(),geometries:n,color:s})}k.zoneTitleCount=k.sources.zoneTitles.getFeatures().length,hV(),Koe()}function hV(){if(k.sources.zoneScrim.clear(),!k.highlightedZones.size)return;let[i,e,t,n]=k.projection.getExtent(),r=[uV([[i,e],[t,e],[t,n],[i,n],[i,e]],!0)];for(let s of k.highlightedZones)for(let o of k.zoneRecords.get(s)?.geometries||[]){let a=o.getType()==="MultiPolygon"?o.getPolygons():[o];for(let l of a)l.getLinearRings().forEach((c,u)=>{r.push(uV(c.getCoordinates(),u>0))})}k.sources.zoneScrim.addFeature(new gd({geometry:new vu(r)}))}function uV(i,e){let t=0;for(let n=0,r=i.length-1;n<i.length;r=n++)t+=i[r][0]*i[n][1]-i[n][0]*i[r][1];return t<0===e?i:i.slice().reverse()}function Koe(){let i=document.createDocumentFragment();for(let{zone:e,depth:t}of Qoe()){let n=k.zoneRecords.get(e.id);if(!n)continue;let r=document.createElement("button");r.type="button",r.className="zone-index-item",r.dataset.zone=String(e.id),r.style.setProperty("--zone-color",n.color),r.style.setProperty("--zone-depth",String(t)),r.setAttribute("aria-pressed","false"),r.title=`${e.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=e.title,r.append(s,o),i.append(r)}we.zoneList.replaceChildren(i),we.zoneIndex.hidden=k.zoneRecords.size===0}function Qoe(){let i=[...k.zoneRecords.values()].map(o=>o.zone),e=new Set(i.map(o=>o.id)),t=new Map;for(let o of i){let a=e.has(o.parentRegionId)?o.parentRegionId:null;t.has(a)||t.set(a,[]),t.get(a).push(o)}for(let o of t.values())o.sort((a,l)=>a.title.localeCompare(l.title,void 0,{numeric:!0,sensitivity:"base"}));let n=[],r=new Set,s=(o,a)=>{if(!r.has(o.id)){r.add(o.id),n.push({zone:o,depth:a});for(let l of t.get(o.id)||[])s(l,a+1)}};for(let o of t.get(null)||[])s(o,0);for(let o of i)s(o,0);return n}function Qw(i){k.zonesVisible=i,we.zoneToggle.checked=i,k.layers.zoneScrim.setVisible(i),k.layers.zones.setVisible(i),k.layers.zoneTitles.setVisible(i),k.layers.zoneTitleDetail.setVisible(i)}function fV(i){let e=k.zoneRecords.get(i);e&&(k.focusedZoneID=i,pV(),Cc(),k.engine.getView().fit(e.extent,{size:k.engine.getSize(),padding:[54,54,54,54],maxZoom:wu(k.variant),duration:220}),we.sidebar.classList.remove("is-open"),we.mobileLegend.setAttribute("aria-expanded","false"))}function dV(i){k.zoneRecords.has(i)&&(k.highlightedZones.has(i)?k.highlightedZones.delete(i):(k.highlightedZones.add(i),Qw(!0)),k.hoveredPin=null,mI(),gI(),pV(),hV(),k.layers.zones.changed(),k.layers.zoneTitles.changed(),k.layers.zoneTitleDetail.changed())}function pV(){we.zoneIndex.classList.toggle("has-highlights",k.highlightedZones.size>0);for(let i of we.zoneList.querySelectorAll("[data-zone]")){let e=Number(i.dataset.zone),t=k.highlightedZones.has(e);i.classList.toggle("is-highlighted",t),i.classList.toggle("is-current",k.focusedZoneID===e),i.setAttribute("aria-pressed",String(t))}}function Joe(i){if(!i?.coordinates)return null;let e=([t,n])=>Mg(n,t);return i.type==="Polygon"?new vu(i.coordinates.map(t=>t.map(e))):i.type==="MultiPolygon"?new cV(i.coordinates.map(t=>t.map(n=>n.map(e)))):null}function Mg(i,e){let t=eae(),n=2**t.sourceZoom,r=(e+180)/360*n,s=i*Math.PI/180,o=(1-Math.asinh(Math.tan(s))/Math.PI)/2*n;return[(r-t.firstTile)*t.tileSize,-(o-t.firstTile)*t.tileSize]}function eae(){let i=k.game.tileGrid,e=k.map?.grid;return e?{...i,...e}:i}function AV(){k.sources.pins.clear(),k.sources.text.clear(),k.sources.priority.clear(),k.pins=[],k.pinByID.clear();for(let i of k.map.groups)for(let e of i.categories){Su(e)!=="text"&&eV(e);for(let t of e.locations){let n={location:t,category:e,group:i,coordinate:Mg(t.lat,t.lng),filteredHidden:!1,priority:rae(e,t),feature:null};n.feature=new gd({geometry:new Qh(n.coordinate),pin:n,priority:n.priority}),k.pins.push(n),k.pinByID.set(t.id,n),Su(e)==="text"?k.sources.text.addFeature(n.feature):k.sources.pins.addFeature(n.feature)}}ql()}function ql(){for(let i of k.pins){let e=k.hiddenCategories.has(i.category.id),t=k.search&&!i.location.title.toLocaleLowerCase().includes(k.search);i.filteredHidden=!!(e||t)}mI(),gI(),k.selectedPin?.filteredHidden&&Cc(),xd(),document.dispatchEvent(new Event("atlas:filters"))}function mI(){if(!k.highlightedZones.size){for(let e of k.pins)e.insideHighlightedZone=!1;return}let i=[...k.highlightedZones].map(e=>k.zoneRecords.get(e)).filter(Boolean);for(let e of k.pins)e.insideHighlightedZone=i.some(t=>t.geometries.some(n=>tae(n,e.coordinate)))}function tae(i,e){if(i.intersectsCoordinate(e))return!0;let t=i.getClosestPoint(e),n=t[0]-e[0],r=t[1]-e[1];return n*n+r*r<=1}function gI(){k.eligibleLocations=k.pins.filter(i=>!jl(i)).length,bu(),k.layers.pins.changed(),k.layers.zonePins.changed(),k.layers.pinLabels.changed(),k.layers.text.changed(),k.layers.zoneText.changed(),k.layers.textDetail.changed(),k.layers.priority.changed(),Y0()}function bu(){k.sources.priority.clear();for(let i of k.pins){if(jl(i))continue;let e=!!k.search&&i.location.title.toLocaleLowerCase().includes(k.search);(i===k.selectedPin||i===k.hoveredPin||e||bg(i))&&k.sources.priority.addFeature(i.feature)}}function Cg(i){k.hoveredPin!==i&&(k.hoveredPin=i,k.sources&&(bu(),k.layers.pins.changed(),k.layers.priority.changed()))}function Jw(i){k.labelsHeld!==i&&(k.labelsHeld=i,we.labelsHint.textContent=i?"Z \xB7 labels shown":"Z \xB7 hold for labels",k.layers.pinLabels.changed(),k.layers.text.changed())}function Eg(i){return i===k.selectedPin||i===k.hoveredPin||bg(i)||!!k.search&&i.location.title.toLocaleLowerCase().includes(k.search)}function jl(i){return i.filteredHidden||nae(i)||iae(i)||!_I(i.location)}function _I(i){let e=k.variant?.shard;return!e||!i.shard||i.shard===e}function nae(i){return!k.highlightedZones.size||i.insideHighlightedZone||i===k.selectedPin?!1:!(k.search&&i.location.title.toLocaleLowerCase().includes(k.search))}function iae(i){return!k.gridEnabled||!k.gridPrefix||bg(i)||i===k.selectedPin?!1:!(k.search&&i.location.title.toLocaleLowerCase().includes(k.search))}function rae(i,e){return Math.max(0,1e6-Math.min(i.locations.length,999)*1e3)+wz(e.id)%1e3}function aV(i){return i.locations.length>200?4:i.locations.length>75?2.5:1}function Fx(){return(k.engine?.getView().getZoom()||0)>=(k.variant?.maxZoom||0)-.05}function mV(i){let e=[],t=[];for(let n of i){let r=[];for(let s of n.categories)(Su(s)==="text"?t:r).push(s);r.length&&e.push({key:`group-${n.id}`,title:n.title,categories:r})}return t.length&&e.unshift({key:"text",title:"Text",categories:t}),e}function gV(){let i=document.createDocumentFragment();for(let e of k.map.sections){let t=document.createElement("section");t.className="layer-section",t.dataset.layerSection=e.key;let n=e.categories.reduce((s,o)=>s+o.locations.length,0);t.append(sae(e.key,e.title,n));let r=document.createElement("div");r.className="category-toggles";for(let s of e.categories)r.append(oae(s));t.append(r),i.append(t)}we.legend.replaceChildren(i),eS(),yd()}function sae(i,e,t){let n=document.createElement("div");n.className="layer-header";let r=document.createElement("button");r.type="button",r.className="layer-title",r.dataset.section=i;let s=document.createElement("span");s.className="layer-chevron",s.setAttribute("aria-hidden","true"),s.innerHTML='<svg viewBox="0 0 24 24"><path d="m9 6 6 6-6 6"/></svg>';let o=document.createElement("span");o.textContent=e;let a=document.createElement("span");a.className="layer-count",a.textContent=Pc(t),r.append(s,o,a);let l=_V(`Show only ${e}`);l.dataset.onlySection=i;let c=document.createElement("label");c.className="layer-switch";let u=document.createElement("input");u.type="checkbox",u.dataset.sectionToggle=i,u.setAttribute("aria-label",`Show ${e}`);let f=document.createElement("span");return f.setAttribute("aria-hidden","true"),c.append(u,f),n.append(r,l,c),n}function _V(i){let e=document.createElement("button");return e.type="button",e.className="only-button",e.dataset.label=i,e.setAttribute("aria-label",i),e.innerHTML='<svg viewBox="0 0 16 16" aria-hidden="true"><circle cx="8" cy="8" r="4.6"/><circle cx="8" cy="8" r="1.3" fill="currentColor" stroke="none"/><path d="M8 1v2M8 13v2M1 8h2M13 8h2"/></svg>',e}function oae(i){let e=Su(i)==="text",t=document.createElement("label");t.className="category-row",wg(t,i);let n=document.createElement("input");n.type="checkbox",n.dataset.category=String(i.id),n.checked=!k.hiddenCategories.has(i.id);let r=document.createElement("span");e?(r.className="text-symbol",r.textContent="Tt",r.title="Drawn as a text label"):(r.className="category-icon",Sg(r,i,Rc(i.title)),r.title=i.icon||i.title);let s=document.createElement("span");s.className="category-name",s.textContent=i.title;let o=document.createElement("span");o.className="category-count",o.textContent=Pc(i.locations.length);let a=_V(`Show only ${i.title}`);return a.dataset.onlyCategory=String(i.id),t.append(n,r,s,a,o),t}function xI(i){if(k.collapsedSections.clear(),i)for(let e of we.layers.querySelectorAll("[data-section]"))k.collapsedSections.add(e.dataset.section);eS()}function eS(){for(let i of we.layers.querySelectorAll("[data-section]")){let e=k.collapsedSections.has(i.dataset.section);i.setAttribute("aria-expanded",String(!e)),i.closest(".layer-section").classList.toggle("is-collapsed",e)}Mc()}function Ox(i){if(k.hiddenCategories.clear(),!i)for(let e of k.map.groups)for(let t of e.categories)k.hiddenCategories.add(t.id);Tx(),ql(),xd(),yd()}function Tx(){for(let i of document.querySelectorAll("[data-category]"))i.checked=!k.hiddenCategories.has(Number(i.dataset.category))}function xV(i){let e=k.map.sections.find(n=>n.key===i);if(!e)return;let t=e.categories.some(n=>!k.hiddenCategories.has(n.id));for(let n of e.categories)t?k.hiddenCategories.add(n.id):k.hiddenCategories.delete(n.id);Tx(),ql(),yd()}function yV(i){if(k.map){if(aae(i)){Ox(!0);return}k.hiddenCategories.clear();for(let e of k.map.sections){let t=i.section===e.key;for(let n of e.categories)!t&&i.category!==n.id&&k.hiddenCategories.add(n.id)}Tx(),ql(),xd(),yd()}}function aae(i){for(let e of k.map.sections)for(let t of e.categories)if((i.section===e.key||i.category===t.id)===k.hiddenCategories.has(t.id))return!1;return!0}function lae(){let i=we.soloChip;if(!k.map){i.hidden=!0;return}let e=null,t=0,n=null,r=0;for(let o of k.map.sections){let a=0;for(let l of o.categories)k.hiddenCategories.has(l.id)||(a++,t++,e=l);a>0&&(r++,n=a===o.categories.length?o:null)}let s="";t===1&&e?s=e.title:r===1&&n&&(s=n.title),i.hidden=!s,i.textContent=s?`only: ${s}`:"",i.title=s?`Showing only ${s} \u2014 click to show everything`:""}function yd(){if(k.map){for(let i of k.map.sections){let e=we.legend.querySelector(`input[data-section-toggle="${i.key}"]`);e&&(e.checked=i.categories.some(t=>!k.hiddenCategories.has(t.id)))}lae(),Mc()}}async function vV(i){let[e,t]=await Promise.all([fetch(`${k.game.base}/maps/${i.slug}.json`),fetch(`${k.game.base}/maps/${i.slug}.bin`)]);if(!e.ok||!t.ok)throw new Error(`map ${i.slug} is not served under this catalog any more`);let[n,r]=await Promise.all([e.json(),t.arrayBuffer()]),s=n.groups.flatMap(o=>o.categories);return cae(r,s),{...i,grid:n.grid,variants:n.variants,groups:n.groups,zones:n.zones||[],attrs:n.attrs||{},merged:n.merged||[],sections:mV(n.groups)}}function cae(i,e){let t=new DataView(i);if(String.fromCharCode(...new Uint8Array(i,0,8))!=="ATLASLOC")throw new Error("location payload is not in the expected form");let r=t.getUint16(8,!0);if(r!==2)throw new Error(`location payload is version ${r}, and this reads 2`);let s=t.getUint32(10,!0),o=16,a=new Int32Array(i,o,s),l=new Float32Array(i,o+=s*4,s),c=new Float32Array(i,o+=s*4,s),u=new Int32Array(i,o+=s*4,s),f=new Int32Array(i,o+=s*4,s),p=new Uint32Array(i,o+=s*4,s+1),x=new Uint16Array(i,o+=(s+1)*4,s),b=new Uint8Array(i,o+s*2),w=new TextDecoder;for(let S of e)S.locations=[];for(let S=0;S<s;S++)e[x[S]].locations.push({id:a[S],title:w.decode(b.subarray(p[S],p[S+1])),lat:l[S],lng:c[S],regionId:u[S]||void 0,shard:f[S]||void 0})}async function Ez(){let i=`${k.game.base}/${k.map.slug}`;return k.textByMap.has(i)||k.textByMap.set(i,fetch(`${k.game.base}/maps/${k.map.slug}.text`).then(e=>e.json()).catch(()=>({}))),k.textByMap.get(i)}var tS=null;function Z0(){return tS||(tS=uae().finally(()=>{tS=null})),tS}async function uae(){let i=await fetch("/data/catalog.json");if(!i.ok)return;let e=k.game;if(k.catalog=await i.json(),R0(we.game,k.catalog.games,"title"),yI(),!k.catalog.games.length)return;let t=e&&k.catalog.games.find(n=>n.slug===e.slug);if(!t){let n=xg();await of(n.game||_g()?.game||k.catalog.games[0].slug,n.game?n.map:void 0);return}if(t.stamp!==e.stamp){for(let r of k.textByMap.keys())r.startsWith(e.base+"/")&&k.textByMap.delete(r);let n=k.engine?.getView();k.restore={game:t.slug,map:k.map?.slug,variant:k.map?k.map.variants.indexOf(k.variant):0,center:n?.getCenter(),zoom:n?.getZoom(),hidden:[...k.hiddenCategories],collapsed:[...k.collapsedSections],overviewDocked:k.overviewDocked,dockFolded:k.dockFolded,dockDismissed:k.dockDismissed},await of(t.slug,k.map?.slug);return}k.game=t,we.game.value=t.slug}function yI(){let i=!k.catalog?.games?.length;we.emptyState.hidden=!i,k.catalog?.bundlesDir&&(we.emptyPath.textContent=k.catalog.bundlesDir)}async function vI(){for(let i of[we.emptyOpen,we.addBundles])i.disabled=!0;try{let e=await(await fetch("/data/bundles/import",{method:"POST"})).json().catch(()=>({}));await Z0();let t=e.imported?.[0];t&&k.catalog.games.some(n=>n.slug===t)&&await of(t)}finally{for(let i of[we.emptyOpen,we.addBundles])i.disabled=!1}}var Ys={ADD:"add",REMOVE:"remove"};var bV={LENGTH:"length"},Rg=class extends js{constructor(e,t,n){super(e),this.element=t,this.index=n}},bI=class extends ms{constructor(e,t){if(super(),this.on,this.once,this.un,t=t||{},this.unique_=!!t.unique,this.array_=e??[],this.unique_)for(let n=1,r=this.array_.length;n<r;++n)this.assertUnique_(this.array_[n],n);this.updateLength_()}clear(){for(;this.getLength()>0;)this.pop()}extend(e){for(let t=0,n=e.length;t<n;++t)this.push(e[t]);return this}forEach(e){let t=this.array_;for(let n=0,r=t.length;n<r;++n)e(t[n],n,t)}getArray(){return this.array_}item(e){return this.array_[e]}getLength(){return this.get(bV.LENGTH)}insertAt(e,t){if(e<0||e>this.getLength())throw new Error("Index out of bounds: "+e);this.unique_&&this.assertUnique_(t),this.array_.splice(e,0,t),this.updateLength_(),this.dispatchEvent(new Rg(Ys.ADD,t,e))}pop(){return this.removeAt(this.getLength()-1)}push(e){let t=this.getLength();return this.insertAt(t,e),this.getLength()}remove(e){let t=this.array_;for(let n=0,r=t.length;n<r;++n)if(t[n]===e)return this.removeAt(n)}removeAt(e){if(e<0||e>=this.getLength())return;let t=this.array_[e];return this.array_.splice(e,1),this.updateLength_(),this.dispatchEvent(new Rg(Ys.REMOVE,t,e)),t}setAt(e,t){let n=this.getLength();if(e>=n){this.insertAt(e,t);return}if(e<0)throw new Error("Index out of bounds: "+e);this.unique_&&this.assertUnique_(t,e);let r=this.array_[e];this.array_[e]=t,this.dispatchEvent(new Rg(Ys.REMOVE,r,e)),this.dispatchEvent(new Rg(Ys.ADD,t,e))}updateLength_(){this.set(bV.LENGTH,this.array_.length)}assertUnique_(e,t){let n=this.array_;for(let r=0,s=n.length;r<s;++r)if(n[r]===e&&r!==t)throw new Error("Duplicate item added to a unique collection")}},lo=bI;var wI=class extends js{constructor(e,t,n){super(e),this.map=t,this.frameState=n!==void 0?n:null}},Sd=wI;var SI=class extends Sd{constructor(e,t,n,r,s,o){super(e,t,s),this.originalEvent=n,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(e){this.pixel_=e}get coordinate(){return this.coordinate_||(this.coordinate_=this.map.getCoordinateFromPixel(this.pixel)),this.coordinate_}set coordinate(e){this.coordinate_=e}preventDefault(){super.preventDefault(),"preventDefault"in this.originalEvent&&this.originalEvent.preventDefault()}stopPropagation(){super.stopPropagation(),"stopPropagation"in this.originalEvent&&this.originalEvent.stopPropagation()}},Mu=SI;var nr={SINGLECLICK:"singleclick",CLICK:Jt.CLICK,DBLCLICK:Jt.DBLCLICK,POINTERDRAG:"pointerdrag",POINTERMOVE:"pointermove",POINTERDOWN:"pointerdown",POINTERUP:"pointerup",POINTEROVER:"pointerover",POINTEROUT:"pointerout",POINTERENTER:"pointerenter",POINTERLEAVE:"pointerleave",POINTERCANCEL:"pointercancel"};var Bx={POINTERMOVE:"pointermove",POINTERDOWN:"pointerdown",POINTERUP:"pointerup",POINTEROVER:"pointerover",POINTEROUT:"pointerout",POINTERENTER:"pointerenter",POINTERLEAVE:"pointerleave",POINTERCANCEL:"pointercancel"};var TI=class extends md{constructor(e,t){super(e),this.map_=e,this.clickTimeoutId_,this.emulateClicks_=!1,this.dragging_=!1,this.dragListenerKeys_=[],this.moveTolerance_=t===void 0?1:t,this.down_=null;let n=this.map_.getViewport();this.activePointers_=[],this.trackedTouches_={},this.element_=n,this.pointerdownListenerKey_=Un(n,Bx.POINTERDOWN,this.handlePointerDown_,this),this.originalPointerMoveEvent_,this.relayedListenerKey_=Un(n,Bx.POINTERMOVE,this.relayMoveEvent_,this),this.boundHandleTouchMove_=this.handleTouchMove_.bind(this),this.element_.addEventListener(Jt.TOUCHMOVE,this.boundHandleTouchMove_,yw?{passive:!1}:!1)}emulateClick_(e){let t=new Mu(nr.CLICK,this.map_,e);this.dispatchEvent(t),this.clickTimeoutId_!==void 0?(clearTimeout(this.clickTimeoutId_),this.clickTimeoutId_=void 0,t=new Mu(nr.DBLCLICK,this.map_,e),this.dispatchEvent(t)):this.clickTimeoutId_=setTimeout(()=>{this.clickTimeoutId_=void 0;let n=new Mu(nr.SINGLECLICK,this.map_,e);this.dispatchEvent(n)},250)}updateActivePointers_(e){let t=e,n=t.pointerId;if(t.type==nr.POINTERUP||t.type==nr.POINTERCANCEL){delete this.trackedTouches_[n];for(let r in this.trackedTouches_)if(this.trackedTouches_[r].target!==t.target){delete this.trackedTouches_[r];break}}else(t.type==nr.POINTERDOWN||t.type==nr.POINTERMOVE)&&(this.trackedTouches_[n]=t);this.activePointers_=Object.values(this.trackedTouches_)}handlePointerUp_(e){this.updateActivePointers_(e);let t=new Mu(nr.POINTERUP,this.map_,e,void 0,void 0,this.activePointers_);this.dispatchEvent(t),this.emulateClicks_&&!t.defaultPrevented&&!this.dragging_&&this.isMouseActionButton_(e)&&this.emulateClick_(this.down_),this.activePointers_.length===0&&(this.dragListenerKeys_.forEach(ii),this.dragListenerKeys_.length=0,this.dragging_=!1,this.down_=null)}isMouseActionButton_(e){return e.button===0}handlePointerDown_(e){this.emulateClicks_=this.activePointers_.length===0,this.updateActivePointers_(e);let t=new Mu(nr.POINTERDOWN,this.map_,e,void 0,void 0,this.activePointers_);if(this.dispatchEvent(t),this.down_=new PointerEvent(e.type,e),Object.defineProperty(this.down_,"target",{writable:!1,value:e.target}),this.dragListenerKeys_.length===0){let n=this.map_.getOwnerDocument();this.dragListenerKeys_.push(Un(n,nr.POINTERMOVE,this.handlePointerMove_,this),Un(n,nr.POINTERUP,this.handlePointerUp_,this),Un(this.element_,nr.POINTERCANCEL,this.handlePointerUp_,this)),this.element_.getRootNode&&this.element_.getRootNode()!==n&&this.dragListenerKeys_.push(Un(this.element_.getRootNode(),nr.POINTERUP,this.handlePointerUp_,this))}}handlePointerMove_(e){if(this.isMoving_(e)){this.updateActivePointers_(e),this.dragging_=!0;let t=new Mu(nr.POINTERDRAG,this.map_,e,this.dragging_,void 0,this.activePointers_);this.dispatchEvent(t)}}relayMoveEvent_(e){this.originalPointerMoveEvent_=e;let t=!!(this.down_&&this.isMoving_(e));this.dispatchEvent(new Mu(nr.POINTERMOVE,this.map_,e,t))}handleTouchMove_(e){let t=this.originalPointerMoveEvent_;(!t||t.defaultPrevented)&&(typeof e.cancelable!="boolean"||e.cancelable===!0)&&e.preventDefault()}isMoving_(e){return this.dragging_||Math.abs(e.clientX-this.down_.clientX)>this.moveTolerance_||Math.abs(e.clientY-this.down_.clientY)>this.moveTolerance_}disposeInternal(){this.relayedListenerKey_&&(ii(this.relayedListenerKey_),this.relayedListenerKey_=null),this.element_.removeEventListener(Jt.TOUCHMOVE,this.boundHandleTouchMove_),this.pointerdownListenerKey_&&(ii(this.pointerdownListenerKey_),this.pointerdownListenerKey_=null),this.dragListenerKeys_.forEach(ii),this.dragListenerKeys_.length=0,this.element_=null,super.disposeInternal()}},wV=TI;var Cu={POSTRENDER:"postrender",MOVESTART:"movestart",MOVEEND:"moveend",LOADSTART:"loadstart",LOADEND:"loadend"};var co={LAYERGROUP:"layergroup",SIZE:"size",TARGET:"target",VIEW:"view"};var Ux=1/0,EI=class{constructor(e,t){this.priorityFunction_=e,this.keyFunction_=t,this.elements_=[],this.priorities_=[],this.queuedElements_={}}clear(){this.elements_.length=0,this.priorities_.length=0,_u(this.queuedElements_)}dequeue(){let e=this.elements_,t=this.priorities_,n=e[0];e.length==1?(e.length=0,t.length=0):(e[0]=e.pop(),t[0]=t.pop(),this.siftUp_(0));let r=this.keyFunction_(n);return delete this.queuedElements_[r],n}enqueue(e){zn(!(this.keyFunction_(e)in this.queuedElements_),"Tried to enqueue an `element` that was already added to the queue");let t=this.priorityFunction_(e);return t!=Ux?(this.elements_.push(e),this.priorities_.push(t),this.queuedElements_[this.keyFunction_(e)]=!0,this.siftDown_(0,this.elements_.length-1),!0):!1}getCount(){return this.elements_.length}getLeftChildIndex_(e){return e*2+1}getRightChildIndex_(e){return e*2+2}getParentIndex_(e){return e-1>>1}heapify_(){let e;for(e=(this.elements_.length>>1)-1;e>=0;e--)this.siftUp_(e)}isEmpty(){return this.elements_.length===0}isKeyQueued(e){return e in this.queuedElements_}isQueued(e){return this.isKeyQueued(this.keyFunction_(e))}siftUp_(e){let t=this.elements_,n=this.priorities_,r=t.length,s=t[e],o=n[e],a=e;for(;e<r>>1;){let l=this.getLeftChildIndex_(e),c=this.getRightChildIndex_(e),u=c<r&&n[c]<n[l]?c:l;t[e]=t[u],n[e]=n[u],e=u}t[e]=s,n[e]=o,this.siftDown_(a,e)}siftDown_(e,t){let n=this.elements_,r=this.priorities_,s=n[t],o=r[t];for(;t>e;){let a=this.getParentIndex_(t);if(r[a]>o)n[t]=n[a],r[t]=r[a],t=a;else break}n[t]=s,r[t]=o}reprioritize(){let e=this.priorityFunction_,t=this.elements_,n=this.priorities_,r=0,s=t.length,o,a,l;for(a=0;a<s;++a)o=t[a],l=e(o),l==Ux?delete this.queuedElements_[this.keyFunction_(o)]:(n[r]=l,t[r++]=o);t.length=r,n.length=r,this.heapify_()}},SV=EI;var MI=class extends SV{constructor(e,t){super(n=>e.apply(null,n),n=>n[0].getKey()),this.boundHandleTileChange_=this.handleTileChange.bind(this),this.tileChangeCallback_=t,this.tilesLoading_=0,this.tilesLoadingKeys_={}}enqueue(e){let t=super.enqueue(e);return t&&e[0].addEventListener(Jt.CHANGE,this.boundHandleTileChange_),t}getTilesLoading(){return this.tilesLoading_}handleTileChange(e){let t=e.target,n=t.getState();if(n===rn.LOADED||n===rn.ERROR||n===rn.EMPTY){n!==rn.ERROR&&t.removeEventListener(Jt.CHANGE,this.boundHandleTileChange_);let r=t.getKey();r in this.tilesLoadingKeys_&&(delete this.tilesLoadingKeys_[r],--this.tilesLoading_),this.tileChangeCallback_()}}loadMoreTiles(e,t){let n=0;for(;this.tilesLoading_<e&&n<t&&this.getCount()>0;){let r=this.dequeue()[0],s=r.getKey();r.getState()===rn.IDLE&&!(s in this.tilesLoadingKeys_)&&(this.tilesLoadingKeys_[s]=!0,++this.tilesLoading_,++n,r.load())}}},TV=MI;function EV(i,e,t,n,r){if(!i||!(t in i.wantedTiles))return Ux;if(!i.wantedTiles[t][e.getKey()])return Ux;let s=i.viewState.center,o=n[0]-s[0],a=n[1]-s[1];return 65536*Math.log(r)+Math.sqrt(o*o+a*a)/r}var Fs={ANIMATING:0,INTERACTING:1};var Xl={CENTER:"center",RESOLUTION:"resolution",ROTATION:"rotation"};function CI(i,e,t){return(function(n,r,s,o,a){if(!n)return;if(!r&&!e)return n;let l=e?0:s[0]*r,c=e?0:s[1]*r,u=a?a[0]:0,f=a?a[1]:0,p=i[0]+l/2+u,x=i[2]-l/2+u,b=i[1]+c/2+f,w=i[3]-c/2+f;p>x&&(p=(x+p)/2,x=p),b>w&&(b=(w+b)/2,w=b);let S=_i(n[0],p,x),T=_i(n[1],b,w);if(o&&t&&r){let P=30*r;S+=-P*Math.log(1+Math.max(0,p-n[0])/P)+P*Math.log(1+Math.max(0,n[0]-x)/P),T+=-P*Math.log(1+Math.max(0,b-n[1])/P)+P*Math.log(1+Math.max(0,n[1]-w)/P)}return[S,T]})}function MV(i){return i}function RI(i,e,t,n){let r=Wn(e)/t[0],s=gr(e)/t[1];return n?Math.min(i,Math.max(r,s)):Math.min(i,Math.min(r,s))}function PI(i,e,t){let n=Math.min(i,e),r=50;return n*=Math.log(1+r*Math.max(0,i/e-1))/r+1,t&&(n=Math.max(n,t),n/=Math.log(1+r*Math.max(0,t/i-1))/r+1),_i(n,t/2,e*2)}function CV(i,e,t,n){return e=e!==void 0?e:!0,(function(r,s,o,a){if(r!==void 0){let l=i[0],c=i[i.length-1],u=t?RI(l,t,o,n):l;if(a)return e?PI(r,u,c):_i(r,c,u);let f=Math.min(u,r),p=Math.floor(hg(i,f,s));return i[p]>u&&p<i.length-1?i[p+1]:i[p]}})}function RV(i,e,t,n,r,s){return n=n!==void 0?n:!0,t=t!==void 0?t:0,(function(o,a,l,c){if(o!==void 0){let u=r?RI(e,r,l,s):e;if(c)return n?PI(o,u,t):_i(o,t,u);let f=1e-9,p=Math.ceil(Math.log(e/u)/Math.log(i)-f),x=-a*(.5-f)+.5,b=Math.min(u,o),w=Math.floor(Math.log(e/b)/Math.log(i)+x),S=Math.max(p,w),T=e/Math.pow(i,S);return _i(T,t,u)}})}function II(i,e,t,n,r){return t=t!==void 0?t:!0,(function(s,o,a,l){if(s!==void 0){let c=n?RI(i,n,a,r):i;return!t||!l?_i(s,e,c):PI(s,c,e)}})}function Pg(i){if(i!==void 0)return 0}function NI(i){if(i!==void 0)return i}function PV(i){let e=2*Math.PI/i;return(function(t,n){if(n)return t;if(t!==void 0)return t=Math.floor(t/e+.5)*e,t})}function IV(i){let e=i===void 0?yc(5):i;return(function(t,n){return n||t===void 0?t:Math.abs(t)<=e?0:t})}var LI=0,FI=class extends ms{constructor(e){super(),this.on,this.once,this.un,e=Object.assign({},e),this.hints_=[0,0],this.animations_=[],this.updateAnimationKey_,this.projection_=dw(e.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,e.projection&&lG(),e.center&&(e.center=wc(e.center,this.projection_)),e.extent&&(e.extent=Sc(e.extent,this.projection_)),this.applyOptions_(e)}applyOptions_(e){let t=Object.assign({},e);for(let a in Xl)delete t[a];this.setProperties(t,!0);let n=fae(e);this.maxResolution_=n.maxResolution,this.minResolution_=n.minResolution,this.zoomFactor_=n.zoomFactor,this.resolutions_=e.resolutions,this.padding_=e.padding,this.minZoom_=n.minZoom;let r=hae(e),s=n.constraint,o=dae(e);this.constraints_={center:r,resolution:s,rotation:o},this.setRotation(e.rotation!==void 0?e.rotation:0),this.setCenterInternal(e.center!==void 0?e.center:null),e.resolution!==void 0?this.setResolution(e.resolution):e.zoom!==void 0&&this.setZoom(e.zoom)}get padding(){return this.padding_}set padding(e){let t=this.padding_;this.padding_=e;let n=this.getCenterInternal();if(n){let r=e||[0,0,0,0];t=t||[0,0,0,0];let s=this.getResolution(),o=s/2*(r[3]-t[3]+t[1]-r[1]),a=s/2*(r[0]-t[0]+t[2]-r[2]);this.setCenterInternal([n[0]+o,n[1]-a])}}getUpdatedOptions_(e){let t=this.getProperties();return t.resolution!==void 0?t.resolution=this.getResolution():t.zoom=this.getZoom(),t.center=this.getCenterInternal(),t.rotation=this.getRotation(),Object.assign({},t,e)}animate(e){this.isDef()&&!this.getAnimating()&&this.resolveConstraints(0);let t=new Array(arguments.length);for(let n=0;n<t.length;++n){let r=arguments[n];r.center&&(r=Object.assign({},r),r.center=wc(r.center,this.getProjection())),r.anchor&&(r=Object.assign({},r),r.anchor=wc(r.anchor,this.getProjection())),t[n]=r}this.animateInternal.apply(this,t)}animateInternal(e){let t=arguments.length,n;t>1&&typeof arguments[t-1]=="function"&&(n=arguments[t-1],--t);let r=0;for(;r<t&&!this.isDef();++r){let u=arguments[r];u.center&&this.setCenterInternal(u.center),u.zoom!==void 0?this.setZoom(u.zoom):u.resolution&&this.setResolution(u.resolution),u.rotation!==void 0&&this.setRotation(u.rotation)}if(r===t){n&&nS(n,!0);return}let s=Date.now(),o=this.targetCenter_.slice(),a=this.targetResolution_,l=this.targetRotation_,c=[];for(;r<t;++r){let u=arguments[r],f={start:s,complete:!1,anchor:u.anchor,duration:u.duration!==void 0?u.duration:1e3,easing:u.easing||NG,callback:n};if(u.center&&(f.sourceCenter=o,f.targetCenter=u.center.slice(),o=f.targetCenter),u.zoom!==void 0?(f.sourceResolution=a,f.targetResolution=this.getResolutionForZoom(u.zoom),a=f.targetResolution):u.resolution&&(f.sourceResolution=a,f.targetResolution=u.resolution,a=f.targetResolution),u.rotation!==void 0){f.sourceRotation=l;let p=gu(u.rotation-l+Math.PI,2*Math.PI)-Math.PI;f.targetRotation=l+p,l=f.targetRotation}pae(f)?f.complete=!0:s+=f.duration,c.push(f)}this.animations_.push(c),this.setHint(Fs.ANIMATING,1),this.updateAnimations_()}getAnimating(){return this.hints_[Fs.ANIMATING]>0}getInteracting(){return this.hints_[Fs.INTERACTING]>0}cancelAnimations(){this.setHint(Fs.ANIMATING,-this.hints_[Fs.ANIMATING]);let e;for(let t=0,n=this.animations_.length;t<n;++t){let r=this.animations_[t];if(r[0].callback&&nS(r[0].callback,!1),!e)for(let s=0,o=r.length;s<o;++s){let a=r[s];if(!a.complete){e=a.anchor;break}}}this.animations_.length=0,this.cancelAnchor_=e,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 e=Date.now(),t=!1;for(let n=this.animations_.length-1;n>=0;--n){let r=this.animations_[n],s=!0;for(let o=0,a=r.length;o<a;++o){let l=r[o];if(l.complete)continue;let c=e-l.start,u=l.duration>0?c/l.duration:1;u>=1?(l.complete=!0,u=1):s=!1;let f=l.easing(u);if(l.sourceCenter){let p=l.sourceCenter[0],x=l.sourceCenter[1],b=l.targetCenter[0],w=l.targetCenter[1];this.nextCenter_=l.targetCenter;let S=p+f*(b-p),T=x+f*(w-x);this.targetCenter_=[S,T]}if(l.sourceResolution&&l.targetResolution){let p=f===1?l.targetResolution:l.sourceResolution+f*(l.targetResolution-l.sourceResolution);if(l.anchor){let x=this.getViewportSize_(this.getRotation()),b=this.constraints_.resolution(p,0,x,!0);this.targetCenter_=this.calculateCenterZoom(b,l.anchor)}this.nextResolution_=l.targetResolution,this.targetResolution_=p,this.applyTargetState_(!0)}if(l.sourceRotation!==void 0&&l.targetRotation!==void 0){let p=f===1?gu(l.targetRotation+Math.PI,2*Math.PI)-Math.PI:l.sourceRotation+f*(l.targetRotation-l.sourceRotation);if(l.anchor){let x=this.constraints_.rotation(p,!0);this.targetCenter_=this.calculateCenterRotate(x,l.anchor)}this.nextRotation_=l.targetRotation,this.targetRotation_=p}if(this.applyTargetState_(!0),t=!0,!l.complete)break}if(s){this.animations_[n]=null,this.setHint(Fs.ANIMATING,-1),this.nextCenter_=null,this.nextResolution_=NaN,this.nextRotation_=NaN;let o=r[0].callback;o&&nS(o,!0)}}this.animations_=this.animations_.filter(Boolean),t&&this.updateAnimationKey_===void 0&&(this.updateAnimationKey_=requestAnimationFrame(this.updateAnimations_.bind(this)))}calculateCenterRotate(e,t){let n,r=this.getCenterInternal();return r!==void 0&&(n=[r[0]-t[0],r[1]-t[1]],rg(n,e-this.getRotation()),z9(n,t)),n}calculateCenterZoom(e,t){let n,r=this.getCenterInternal(),s=this.getResolution();if(r!==void 0&&s!==void 0){let o=t[0]-e*(t[0]-r[0])/s,a=t[1]-e*(t[1]-r[1])/s;n=[o,a]}return n}getViewportSize_(e){let t=this.viewportSize_;if(e){let n=t[0],r=t[1];return[Math.abs(n*Math.cos(e))+Math.abs(r*Math.sin(e)),Math.abs(n*Math.sin(e))+Math.abs(r*Math.cos(e))]}return t}setViewportSize(e){this.viewportSize_=Array.isArray(e)?e.slice():[100,100],this.getAnimating()||this.resolveConstraints(0)}getCenter(){let e=this.getCenterInternal();return e&&dx(e,this.getProjection())}getCenterInternal(){return this.get(Xl.CENTER)}getConstraints(){return this.constraints_}getConstrainResolution(){return this.get("constrainResolution")}getHints(e){return e!==void 0?(e[0]=this.hints_[0],e[1]=this.hints_[1],e):this.hints_.slice()}calculateExtent(e){let t=this.calculateExtentInternal(e);return fd(t,this.getProjection())}calculateExtentInternal(e){e=e||this.getViewportSizeMinusPadding_();let t=this.getCenterInternal();zn(t,"The view center is not defined");let n=this.getResolution();zn(n!==void 0,"The view resolution is not defined");let r=this.getRotation();return zn(r!==void 0,"The view rotation is not defined"),cx(t,n,r,e)}getMaxResolution(){return this.maxResolution_}getMinResolution(){return this.minResolution_}getMaxZoom(){return this.getZoomForResolution(this.minResolution_)}setMaxZoom(e){this.applyOptions_(this.getUpdatedOptions_({maxZoom:e}))}getMinZoom(){return this.getZoomForResolution(this.maxResolution_)}setMinZoom(e){this.applyOptions_(this.getUpdatedOptions_({minZoom:e}))}setConstrainResolution(e){this.applyOptions_(this.getUpdatedOptions_({constrainResolution:e}))}getProjection(){return this.projection_}getResolution(){return this.get(Xl.RESOLUTION)}getResolutions(){return this.resolutions_}getResolutionForExtent(e,t){return this.getResolutionForExtentInternal(Sc(e,this.getProjection()),t)}getResolutionForExtentInternal(e,t){t=t||this.getViewportSizeMinusPadding_();let n=Wn(e)/t[0],r=gr(e)/t[1];return Math.max(n,r)}getResolutionForValueFunction(e){e=e||2;let t=this.getConstrainedResolution(this.maxResolution_),n=this.minResolution_,r=Math.log(t/n)/Math.log(e);return(function(s){return t/Math.pow(e,s*r)})}getRotation(){return this.get(Xl.ROTATION)}getValueForResolutionFunction(e){let t=Math.log(e||2),n=this.getConstrainedResolution(this.maxResolution_),r=this.minResolution_,s=Math.log(n/r)/t;return(function(o){return Math.log(n/o)/t/s})}getViewportSizeMinusPadding_(e){let t=this.getViewportSize_(e),n=this.padding_;return n&&(t=[t[0]-n[1]-n[3],t[1]-n[0]-n[2]]),t}getState(){let e=this.getProjection(),t=this.getResolution(),n=this.getRotation(),r=this.getCenterInternal(),s=this.padding_;if(s){let o=this.getViewportSizeMinusPadding_();r=DI(r,this.getViewportSize_(),[o[0]/2+s[3],o[1]/2+s[0]],t,n)}return{center:r.slice(0),projection:e!==void 0?e:null,resolution:t,nextCenter:this.nextCenter_,nextResolution:this.nextResolution_,nextRotation:this.nextRotation_,rotation:n,zoom:this.getZoom()}}getViewStateAndExtent(){return{viewState:this.getState(),extent:this.calculateExtent()}}getZoom(){let e,t=this.getResolution();return t!==void 0&&(e=this.getZoomForResolution(t)),e}getZoomForResolution(e){let t=this.minZoom_||0,n,r;if(this.resolutions_){let s=hg(this.resolutions_,e,1);t=s,n=this.resolutions_[s],s==this.resolutions_.length-1?r=2:r=n/this.resolutions_[s+1]}else n=this.maxResolution_,r=this.zoomFactor_;return t+Math.log(n/e)/Math.log(r)}getResolutionForZoom(e){if(this.resolutions_?.length){if(this.resolutions_.length===1)return this.resolutions_[0];let t=_i(Math.floor(e),0,this.resolutions_.length-2),n=this.resolutions_[t]/this.resolutions_[t+1];return this.resolutions_[t]/Math.pow(n,_i(e-t,0,1))}return this.maxResolution_/Math.pow(this.zoomFactor_,e-this.minZoom_)}fit(e,t){let n;if(zn(Array.isArray(e)||typeof e.getSimplifiedGeometry=="function","Invalid extent or geometry provided as `geometry`"),Array.isArray(e)){zn(!mu(e),"Cannot fit empty extent provided as `geometry`");let r=Sc(e,this.getProjection());n=BP(r)}else if(e.getType()==="Circle"){let r=Sc(e.getExtent(),this.getProjection());n=BP(r),n.rotate(this.getRotation(),Oa(r))}else{let r=U0();r?n=e.clone().transform(r,this.getProjection()):n=e}this.fitInternal(n,t)}rotatedExtentForGeometry(e){let t=this.getRotation(),n=Math.cos(t),r=Math.sin(-t),s=e.getFlatCoordinates(),o=e.getStride(),a=1/0,l=1/0,c=-1/0,u=-1/0;for(let f=0,p=s.length;f<p;f+=o){let x=s[f]*n-s[f+1]*r,b=s[f]*r+s[f+1]*n;a=Math.min(a,x),l=Math.min(l,b),c=Math.max(c,x),u=Math.max(u,b)}return[a,l,c,u]}fitInternal(e,t){t=t||{};let n=t.size;n||(n=this.getViewportSizeMinusPadding_());let r=t.padding!==void 0?t.padding:[0,0,0,0],s=t.nearest!==void 0?t.nearest:!1,o;t.minResolution!==void 0?o=t.minResolution:t.maxZoom!==void 0?o=this.getResolutionForZoom(t.maxZoom):o=0;let a=this.rotatedExtentForGeometry(e),l=this.getResolutionForExtentInternal(a,[n[0]-r[1]-r[3],n[1]-r[0]-r[2]]);l=isNaN(l)?o:Math.max(l,o),l=this.getConstrainedResolution(l,s?0:1);let c=this.getRotation(),u=Math.sin(c),f=Math.cos(c),p=Oa(a);p[0]+=(r[1]-r[3])/2*l,p[1]+=(r[0]-r[2])/2*l;let x=p[0]*f-p[1]*u,b=p[1]*f+p[0]*u,w=this.getConstrainedCenter([x,b],l),S=t.callback?t.callback:Kh;t.duration!==void 0?this.animateInternal({resolution:l,center:w,duration:t.duration,easing:t.easing},S):(this.targetResolution_=l,this.targetCenter_=w,this.applyTargetState_(!1,!0),nS(S,!0))}centerOn(e,t,n){this.centerOnInternal(wc(e,this.getProjection()),t,n)}centerOnInternal(e,t,n){this.setCenterInternal(DI(e,t,n,this.getResolution(),this.getRotation()))}calculateCenterShift(e,t,n,r){let s,o=this.padding_;if(o&&e){let a=this.getViewportSizeMinusPadding_(-n),l=DI(e,r,[a[0]/2+o[3],a[1]/2+o[0]],t,n);s=[e[0]-l[0],e[1]-l[1]]}return s}isDef(){return!!this.getCenterInternal()&&this.getResolution()!==void 0}adjustCenter(e){let t=dx(this.targetCenter_,this.getProjection());this.setCenter([t[0]+e[0],t[1]+e[1]])}adjustCenterInternal(e){let t=this.targetCenter_;this.setCenterInternal([t[0]+e[0],t[1]+e[1]])}adjustResolution(e,t){t=t&&wc(t,this.getProjection()),this.adjustResolutionInternal(e,t)}adjustResolutionInternal(e,t){let n=this.getAnimating()||this.getInteracting(),r=this.getViewportSize_(this.getRotation()),s=this.constraints_.resolution(this.targetResolution_*e,0,r,n);t&&(this.targetCenter_=this.calculateCenterZoom(s,t)),this.targetResolution_*=e,this.applyTargetState_()}adjustZoom(e,t){this.adjustResolution(Math.pow(this.zoomFactor_,-e),t)}adjustRotation(e,t){t&&(t=wc(t,this.getProjection())),this.adjustRotationInternal(e,t)}adjustRotationInternal(e,t){let n=this.getAnimating()||this.getInteracting(),r=this.constraints_.rotation(this.targetRotation_+e,n);t&&(this.targetCenter_=this.calculateCenterRotate(r,t)),this.targetRotation_+=e,this.applyTargetState_()}setCenter(e){this.setCenterInternal(e&&wc(e,this.getProjection()))}setCenterInternal(e){this.targetCenter_=e,this.applyTargetState_()}setHint(e,t){return this.hints_[e]+=t,this.changed(),this.hints_[e]}setResolution(e){this.targetResolution_=e,this.applyTargetState_()}setRotation(e){this.targetRotation_=e,this.applyTargetState_()}setZoom(e){this.setResolution(this.getResolutionForZoom(e))}applyTargetState_(e,t){let n=this.getAnimating()||this.getInteracting()||t,r=this.constraints_.rotation(this.targetRotation_,n),s=this.getViewportSize_(r),o=this.constraints_.resolution(this.targetResolution_,0,s,n),a=this.constraints_.center(this.targetCenter_,o,s,n,this.calculateCenterShift(this.targetCenter_,o,r,s));this.get(Xl.ROTATION)!==r&&this.set(Xl.ROTATION,r),this.get(Xl.RESOLUTION)!==o&&(this.set(Xl.RESOLUTION,o),this.set("zoom",this.getZoom(),!0)),(!a||!this.get(Xl.CENTER)||!D0(this.get(Xl.CENTER),a))&&this.set(Xl.CENTER,a),this.getAnimating()&&!e&&this.cancelAnimations(),this.cancelAnchor_=void 0}resolveConstraints(e,t,n){e=e!==void 0?e:200;let r=t||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(e===0&&!this.cancelAnchor_){this.targetResolution_=a,this.targetRotation_=s,this.targetCenter_=l,this.applyTargetState_();return}n=n||(e===0?this.cancelAnchor_:void 0),this.cancelAnchor_=void 0,(this.getResolution()!==a||this.getRotation()!==s||!this.getCenterInternal()||!D0(this.getCenterInternal(),l))&&(this.getAnimating()&&this.cancelAnimations(),this.animateInternal({rotation:s,center:l,resolution:a,duration:e,easing:Vl,anchor:n}))}beginInteraction(){this.resolveConstraints(0),this.setHint(Fs.INTERACTING,1)}endInteraction(e,t,n){n=n&&wc(n,this.getProjection()),this.endInteractionInternal(e,t,n)}endInteractionInternal(e,t,n){this.getInteracting()&&(this.setHint(Fs.INTERACTING,-1),this.resolveConstraints(e,t,n))}getConstrainedCenter(e,t){let n=this.getViewportSize_(this.getRotation());return this.constraints_.center(e,t||this.getResolution(),n)}getConstrainedZoom(e,t){let n=this.getResolutionForZoom(e);return this.getZoomForResolution(this.getConstrainedResolution(n,t))}getConstrainedResolution(e,t){t=t||0;let n=this.getViewportSize_(this.getRotation());return this.constraints_.resolution(e,t,n)}};function nS(i,e){setTimeout(function(){i(e)},0)}function hae(i){if(i.extent!==void 0){let t=i.smoothExtentConstraint!==void 0?i.smoothExtentConstraint:!0;return CI(i.extent,i.constrainOnlyCenter,t)}let e=dw(i.projection,"EPSG:3857");if(i.multiWorld!==!0&&e.isGlobal()){let t=e.getExtent().slice();return t[0]=-1/0,t[2]=1/0,CI(t,!1,!1)}return MV}function fae(i){let e,t,n,o=i.minZoom!==void 0?i.minZoom:LI,a=i.maxZoom!==void 0?i.maxZoom:28,l=i.zoomFactor!==void 0?i.zoomFactor:2,c=i.multiWorld!==void 0?i.multiWorld:!1,u=i.smoothResolutionConstraint!==void 0?i.smoothResolutionConstraint:!0,f=i.showFullExtent!==void 0?i.showFullExtent:!1,p=dw(i.projection,"EPSG:3857"),x=p.getExtent(),b=i.constrainOnlyCenter,w=i.extent;if(!c&&!w&&p.isGlobal()&&(b=!1,w=x),i.resolutions!==void 0){let S=i.resolutions;t=S[o],n=S[a]!==void 0?S[a]:S[S.length-1],i.constrainResolution?e=CV(S,u,!b&&w,f):e=II(t,n,u,!b&&w,f)}else{let T=(x?Math.max(Wn(x),gr(x)):360*Xh.degrees/p.getMetersPerUnit())/256/Math.pow(2,LI),P=T/Math.pow(2,28-LI);t=i.maxResolution,t!==void 0?o=0:t=T/Math.pow(l,o),n=i.minResolution,n===void 0&&(i.maxZoom!==void 0?i.maxResolution!==void 0?n=t/Math.pow(l,a):n=T/Math.pow(l,a):n=P),a=o+Math.floor(Math.log(t/n)/Math.log(l)),n=t/Math.pow(l,a-o),i.constrainResolution?e=RV(l,t,n,u,!b&&w,f):e=II(t,n,u,!b&&w,f)}return{constraint:e,maxResolution:t,minResolution:n,minZoom:o,zoomFactor:l}}function dae(i){if(i.enableRotation!==void 0?i.enableRotation:!0){let t=i.constrainRotation;return t===void 0||t===!0?IV():t===!1?NI:typeof t=="number"?PV(t):NI}return Pg}function pae(i){return!(i.sourceCenter&&i.targetCenter&&!D0(i.sourceCenter,i.targetCenter)||i.sourceResolution!==i.targetResolution||i.sourceRotation!==i.targetRotation)}function DI(i,e,t,n,r){let s=Math.cos(-r),o=Math.sin(-r),a=i[0]*s-i[1]*o,l=i[1]*s+i[0]*o;a+=(e[0]/2-t[0])*n,l+=(t[1]-e[1]/2)*n,o=-o;let c=a*s-l*o,u=l*s+a*o;return[c,u]}var cl=FI;var OI=class extends ms{constructor(e){super();let t=e.element;t&&!e.target&&!t.style.pointerEvents&&(t.style.pointerEvents="auto"),this.element=t||null,this.target_=null,this.map_=null,this.listenerKeys=[],e.render&&(this.render=e.render),e.target&&this.setTarget(e.target)}disposeInternal(){this.element?.remove(),super.disposeInternal()}getMap(){return this.map_}setMap(e){this.map_&&this.element?.remove();for(let t=0,n=this.listenerKeys.length;t<n;++t)ii(this.listenerKeys[t]);if(this.listenerKeys.length=0,this.map_=e,e){let t=this.target_??e.getOverlayContainerStopEvent();this.element&&t.appendChild(this.element),this.render!==Kh&&this.listenerKeys.push(Un(e,Cu.POSTRENDER,this.render,this)),e.render()}}render(e){}setTarget(e){this.target_=typeof e=="string"?document.getElementById(e):e}},Ig=OI;var BI=class extends Ig{constructor(e){e=e||{},super({element:document.createElement("div"),render:e.render,target:e.target}),this.ulElement_=document.createElement("ul"),this.collapsed_=e.collapsed!==void 0?e.collapsed:!0,this.userCollapsed_=this.collapsed_,this.overrideCollapsible_=e.collapsible!==void 0,this.collapsible_=e.collapsible!==void 0?e.collapsible:!0,this.collapsible_||(this.collapsed_=!1),this.attributions_=e.attributions;let t=e.className!==void 0?e.className:"ol-attribution",n=e.tipLabel!==void 0?e.tipLabel:"Attributions",r=e.expandClassName!==void 0?e.expandClassName:t+"-expand",s=e.collapseLabel!==void 0?e.collapseLabel:"\u203A",o=e.collapseClassName!==void 0?e.collapseClassName:t+"-collapse";typeof s=="string"?(this.collapseLabel_=document.createElement("span"),this.collapseLabel_.textContent=s,this.collapseLabel_.className=o):this.collapseLabel_=s;let a=e.label!==void 0?e.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=n,this.toggleButton_.appendChild(l),this.toggleButton_.addEventListener(Jt.CLICK,this.handleClick_.bind(this),!1);let c=t+" "+bd+" "+Tg+(this.collapsed_&&this.collapsible_?" "+JP:"")+(this.collapsible_?"":" ol-uncollapsible"),u=this.element;u.className=c,u.appendChild(this.toggleButton_),u.appendChild(this.ulElement_),this.renderedAttributions_=[],this.renderedVisible_=!0}collectSourceAttributions_(e){let t=this.getMap().getAllLayers(),n=new Set(t.flatMap(r=>r.getAttributions(e)));if(this.attributions_!==void 0&&(Array.isArray(this.attributions_)?this.attributions_.forEach(r=>n.add(r)):n.add(this.attributions_)),!this.overrideCollapsible_){let r=!t.some(s=>s.getSource()?.getAttributionsCollapsible()===!1);this.setCollapsible(r)}return Array.from(n)}async updateElement_(e){if(!e){this.renderedVisible_&&(this.element.style.display="none",this.renderedVisible_=!1);return}let t=await Promise.all(this.collectSourceAttributions_(e).map(r=>MG(()=>r))),n=t.length>0;if(this.renderedVisible_!=n&&(this.element.style.display=n?"":"none",this.renderedVisible_=n),!Po(t,this.renderedAttributions_)){DG(this.ulElement_);for(let r=0,s=t.length;r<s;++r){let o=document.createElement("li");o.innerHTML=t[r],this.ulElement_.appendChild(o)}this.renderedAttributions_=t}}handleClick_(e){e.preventDefault(),this.handleToggle_(),this.userCollapsed_=this.collapsed_}handleToggle_(){this.element.classList.toggle(JP),this.collapsed_?cP(this.collapseLabel_,this.label_):cP(this.label_,this.collapseLabel_),this.collapsed_=!this.collapsed_,this.toggleButton_.setAttribute("aria-expanded",String(!this.collapsed_))}getCollapsible(){return this.collapsible_}setCollapsible(e){this.collapsible_!==e&&(this.collapsible_=e,this.element.classList.toggle("ol-uncollapsible"),this.userCollapsed_&&this.handleToggle_())}setCollapsed(e){this.userCollapsed_=e,!(!this.collapsible_||this.collapsed_===e)&&this.handleToggle_()}getCollapsed(){return this.collapsed_}render(e){this.updateElement_(e.frameState)}},NV=BI;var UI=class extends Ig{constructor(e){e=e||{},super({element:document.createElement("div"),render:e.render,target:e.target});let t=e.className!==void 0?e.className:"ol-rotate",n=e.label!==void 0?e.label:"\u21E7",r=e.compassClassName!==void 0?e.compassClassName:"ol-compass";this.label_=null,typeof n=="string"?(this.label_=document.createElement("span"),this.label_.className=r,this.label_.textContent=n):(this.label_=n,this.label_.classList.add(r));let s=e.tipLabel?e.tipLabel:"Reset rotation",o=document.createElement("button");o.className=t+"-reset",o.setAttribute("type","button"),o.title=s,o.appendChild(this.label_),o.addEventListener(Jt.CLICK,this.handleClick_.bind(this),!1);let a=t+" "+bd+" "+Tg,l=this.element;l.className=a,l.appendChild(o),this.callResetNorth_=e.resetNorth?e.resetNorth:void 0,this.duration_=e.duration!==void 0?e.duration:250,this.autoHide_=e.autoHide!==void 0?e.autoHide:!0,this.rotation_=void 0,this.autoHide_&&this.element.classList.add(Ix)}handleClick_(e){e.preventDefault(),this.callResetNorth_!==void 0?this.callResetNorth_():this.resetNorth_()}resetNorth_(){let t=this.getMap().getView();if(!t)return;let n=t.getRotation();n!==void 0&&(this.duration_>0&&n%(2*Math.PI)!==0?t.animate({rotation:0,duration:this.duration_,easing:Vl}):t.setRotation(0))}render(e){let t=e.frameState;if(!t)return;let n=t.viewState.rotation;if(n!=this.rotation_){let r="rotate("+n+"rad)";if(this.autoHide_){let s=this.element.classList.contains(Ix);!s&&n===0?this.element.classList.add(Ix):s&&n!==0&&this.element.classList.remove(Ix)}this.label_.style.transform=r}this.rotation_=n}},LV=UI;var kI=class extends Ig{constructor(e){e=e||{},super({element:document.createElement("div"),target:e.target});let t=e.className!==void 0?e.className:"ol-zoom",n=e.delta!==void 0?e.delta:1,r=e.zoomInClassName!==void 0?e.zoomInClassName:t+"-in",s=e.zoomOutClassName!==void 0?e.zoomOutClassName:t+"-out",o=e.zoomInLabel!==void 0?e.zoomInLabel:"+",a=e.zoomOutLabel!==void 0?e.zoomOutLabel:"\u2013",l=e.zoomInTipLabel!==void 0?e.zoomInTipLabel:"Zoom in",c=e.zoomOutTipLabel!==void 0?e.zoomOutTipLabel:"Zoom out",u=document.createElement("button");u.className=r,u.setAttribute("type","button"),u.title=l,u.appendChild(typeof o=="string"?document.createTextNode(o):o),u.addEventListener(Jt.CLICK,this.handleClick_.bind(this,n),!1);let f=document.createElement("button");f.className=s,f.setAttribute("type","button"),f.title=c,f.appendChild(typeof a=="string"?document.createTextNode(a):a),f.addEventListener(Jt.CLICK,this.handleClick_.bind(this,-n),!1);let p=t+" "+bd+" "+Tg,x=this.element;x.className=p,x.appendChild(u),x.appendChild(f),this.duration_=e.duration!==void 0?e.duration:250}handleClick_(e,t){t.preventDefault(),this.zoomByDelta_(e)}zoomByDelta_(e){let n=this.getMap().getView();if(!n)return;let r=n.getZoom();if(r!==void 0){let s=n.getConstrainedZoom(r+e);this.duration_>0?(n.getAnimating()&&n.cancelAnimations(),n.animate({zoom:s,duration:this.duration_,easing:Vl})):n.setZoom(s)}}},DV=kI;function iS(i){i=i||{};let e=new lo;return(i.zoom===void 0||i.zoom)&&e.push(new DV(i.zoomOptions)),(i.rotate===void 0||i.rotate)&&e.push(new LV(i.rotateOptions)),(i.attribution===void 0||i.attribution)&&e.push(new NV(i.attributionOptions)),e}var GI=class{constructor(e,t,n){this.decay_=e,this.minVelocity_=t,this.delay_=n,this.points_=[],this.angle_=0,this.initialVelocity_=0}begin(){this.points_.length=0,this.angle_=0,this.initialVelocity_=0}update(e,t){this.points_.push(e,t,Date.now())}end(){if(this.points_.length<6)return!1;let e=Date.now()-this.delay_,t=this.points_.length-3;if(this.points_[t+2]<e)return!1;let n=t-3;for(;n>0&&this.points_[n+2]>e;)n-=3;let r=this.points_[t+2]-this.points_[n+2];if(r<1e3/60)return!1;let s=this.points_[t]-this.points_[n],o=this.points_[t+1]-this.points_[n+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_}},FV=GI;var zI={ACTIVE:"active"};var VI=class extends ms{constructor(e){super(),this.on,this.once,this.un,e&&e.handleEvent&&(this.handleEvent=e.handleEvent),this.map_=null,this.setActive(!0)}getActive(){return this.get(zI.ACTIVE)}getMap(){return this.map_}handleEvent(e){return!0}setActive(e){this.set(zI.ACTIVE,e)}setMap(e){this.map_=e}};function OV(i,e,t){let n=i.getCenterInternal();if(n){let r=[n[0]+e[0],n[1]+e[1]];i.animateInternal({duration:t!==void 0?t:250,easing:LG,center:i.getConstrainedCenter(r)})}}function Ng(i,e,t,n){let r=i.getZoom();if(r===void 0)return;let s=i.getConstrainedZoom(r+e),o=i.getResolutionForZoom(s);i.getAnimating()&&i.cancelAnimations(),i.animate({resolution:o,anchor:t,duration:n!==void 0?n:250,easing:Vl})}var Ru=VI;var qI=class extends Ru{constructor(e){super(),e=e||{},this.delta_=e.delta?e.delta:1,this.duration_=e.duration!==void 0?e.duration:250}handleEvent(e){let t=!1;if(e.type==nr.DBLCLICK){let n=e.originalEvent,r=e.map,s=e.coordinate,o=n.shiftKey?-this.delta_:this.delta_,a=r.getView();Ng(a,o,s,this.duration_),n.preventDefault(),t=!0}return!t}},BV=qI;function kx(i){let e=arguments;return function(t){let n=!0;for(let r=0,s=e.length;r<s&&(n=n&&e[r](t),!!n);++r);return n}}var UV=function(i){let e=i.originalEvent;return e.altKey&&!(e.metaKey||e.ctrlKey)&&e.shiftKey},Aae=function(i){let e=i.map.getTargetElement(),t=e.getRootNode(),n=i.map.getOwnerDocument().activeElement;return t instanceof ShadowRoot?t.host.contains(n):e.contains(n)},rS=function(i){let e=i.map.getTargetElement(),t=e.getRootNode();return(t instanceof ShadowRoot?t.host:e).hasAttribute("tabindex")?Aae(i):!0},kV=Yh;var sS=function(i){let e=i.originalEvent;return"pointerId"in e&&e.button==0&&!(CG&&rP&&e.ctrlKey)};var oS=function(i){let e=i.originalEvent;return!e.altKey&&!(e.metaKey||e.ctrlKey)&&!e.shiftKey};var GV=function(i){let e=i.originalEvent;return rP?e.metaKey:e.ctrlKey},zV=function(i){let e=i.originalEvent;return!e.altKey&&!(e.metaKey||e.ctrlKey)&&e.shiftKey},aS=function(i){let e=i.originalEvent,t=e.target.tagName;return t!=="INPUT"&&t!=="SELECT"&&t!=="TEXTAREA"&&!e.target.isContentEditable},lS=function(i){let e=i.originalEvent;return"pointerId"in e&&e.pointerType=="mouse"};var VV=function(i){let e=i.originalEvent;return"pointerId"in e&&e.isPrimary&&e.button===0};var HI=class extends Ru{constructor(e){e=e||{},super(e),e.handleDownEvent&&(this.handleDownEvent=e.handleDownEvent),e.handleDragEvent&&(this.handleDragEvent=e.handleDragEvent),e.handleMoveEvent&&(this.handleMoveEvent=e.handleMoveEvent),e.handleUpEvent&&(this.handleUpEvent=e.handleUpEvent),e.stopDown&&(this.stopDown=e.stopDown),this.handlingDownUpSequence=!1,this.targetPointers=[]}getPointerCount(){return this.targetPointers.length}handleDownEvent(e){return!1}handleDragEvent(e){}handleEvent(e){if(!e.originalEvent)return!0;let t=!1;if(this.updateTrackedPointers_(e),this.handlingDownUpSequence){if(e.type==nr.POINTERDRAG)this.handleDragEvent(e),e.originalEvent.preventDefault();else if(e.type==nr.POINTERUP){let n=this.handleUpEvent(e);this.handlingDownUpSequence=n&&this.targetPointers.length>0}}else if(e.type==nr.POINTERDOWN){let n=this.handleDownEvent(e);this.handlingDownUpSequence=n,t=this.stopDown(n)}else e.type==nr.POINTERMOVE&&this.handleMoveEvent(e);return!t}handleMoveEvent(e){}handleUpEvent(e){return!1}stopDown(e){return e}updateTrackedPointers_(e){e.activePointers&&(this.targetPointers=e.activePointers)}};function Lg(i){let e=i.length,t=0,n=0;for(let r=0;r<e;r++)t+=i[r].clientX,n+=i[r].clientY;return{clientX:t/e,clientY:n/e}}var Pu=HI;var WI=class extends Pu{constructor(e){super({stopDown:Zh}),e=e||{},this.kinetic_=e.kinetic,this.lastCentroid=null,this.lastPointersCount_,this.panning_=!1;let t=e.condition?e.condition:kx(oS,VV);this.condition_=e.onFocusOnly?kx(rS,t):t,this.noKinetic_=!1}handleDragEvent(e){let t=e.map;this.panning_||(this.panning_=!0,t.getView().beginInteraction());let n=this.targetPointers,r=t.getEventPixel(Lg(n));if(n.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=e.map.getView();V9(s,a.getResolution()),rg(s,a.getRotation()),a.adjustCenterInternal(s)}}else this.kinetic_&&this.kinetic_.begin();this.lastCentroid=r,this.lastPointersCount_=n.length,e.originalEvent.preventDefault()}handleUpEvent(e){let t=e.map,n=t.getView();if(this.targetPointers.length===0){if(!this.noKinetic_&&this.kinetic_&&this.kinetic_.end()){let r=this.kinetic_.getDistance(),s=this.kinetic_.getAngle(),o=n.getCenterInternal(),a=t.getPixelFromCoordinateInternal(o),l=t.getCoordinateFromPixelInternal([a[0]-r*Math.cos(s),a[1]-r*Math.sin(s)]);n.animateInternal({center:n.getConstrainedCenter(l),duration:500,easing:Vl})}return this.panning_&&(this.panning_=!1,n.endInteraction()),!1}return this.kinetic_&&this.kinetic_.begin(),this.lastCentroid=null,!0}handleDownEvent(e){if(this.targetPointers.length>0&&this.condition_(e)){let n=e.map.getView();return this.lastCentroid=null,n.getAnimating()&&n.cancelAnimations(),this.kinetic_&&this.kinetic_.begin(),this.noKinetic_=this.targetPointers.length>1,!0}return!1}},qV=WI;var jI=class extends Pu{constructor(e){e=e||{},super({stopDown:Zh}),this.condition_=e.condition?e.condition:UV,this.lastAngle_=void 0,this.duration_=e.duration!==void 0?e.duration:250}handleDragEvent(e){if(!lS(e))return;let t=e.map,n=t.getView();if(n.getConstraints().rotation===Pg)return;let r=t.getSize(),s=e.pixel,o=Math.atan2(r[1]/2-s[1],s[0]-r[0]/2);if(this.lastAngle_!==void 0){let a=o-this.lastAngle_;n.adjustRotationInternal(-a)}this.lastAngle_=o}handleUpEvent(e){return lS(e)?(e.map.getView().endInteraction(this.duration_),!1):!0}handleDownEvent(e){return lS(e)&&sS(e)&&this.condition_(e)?(e.map.getView().beginInteraction(),this.lastAngle_=void 0,!0):!1}},HV=jI;var XI=class extends Ad{constructor(e){super(),this.geometry_=null,this.element_=document.createElement("div"),this.element_.style.position="absolute",this.element_.style.pointerEvents="auto",this.element_.className="ol-box "+e,this.map_=null,this.startPixel_=null,this.endPixel_=null}disposeInternal(){this.setMap(null)}render_(){let e=this.startPixel_,t=this.endPixel_,n="px",r=this.element_.style;r.left=Math.min(e[0],t[0])+n,r.top=Math.min(e[1],t[1])+n,r.width=Math.abs(t[0]-e[0])+n,r.height=Math.abs(t[1]-e[1])+n}setMap(e){if(this.map_){this.map_.getOverlayContainer().removeChild(this.element_);let t=this.element_.style;t.left="inherit",t.top="inherit",t.width="inherit",t.height="inherit"}this.map_=e,this.map_&&this.map_.getOverlayContainer().appendChild(this.element_)}setPixels(e,t){this.startPixel_=e,this.endPixel_=t,this.createOrUpdateGeometry(),this.render_()}createOrUpdateGeometry(){if(!this.map_)return;let e=this.startPixel_,t=this.endPixel_,r=[e,[e[0],t[1]],t,[t[0],e[1]]].map(this.map_.getCoordinateFromPixelInternal,this.map_);r[4]=r[0].slice(),this.geometry_?this.geometry_.setCoordinates([r]):this.geometry_=new vu([r])}getGeometry(){return this.geometry_}},WV=XI;var Dg={BOXSTART:"boxstart",BOXDRAG:"boxdrag",BOXEND:"boxend",BOXCANCEL:"boxcancel"},K0=class extends js{constructor(e,t,n){super(e),this.coordinate=t,this.mapBrowserEvent=n}},$I=class extends Pu{constructor(e){super(),this.on,this.once,this.un,e=e??{},this.box_=new WV(e.className||"ol-dragbox"),this.minArea_=e.minArea??64,e.onBoxEnd&&(this.onBoxEnd=e.onBoxEnd),this.startPixel_=null,this.condition_=e.condition??sS,this.boxEndCondition_=e.boxEndCondition??this.defaultBoxEndCondition}defaultBoxEndCondition(e,t,n){let r=n[0]-t[0],s=n[1]-t[1];return r*r+s*s>=this.minArea_}getGeometry(){return this.box_.getGeometry()}handleDragEvent(e){this.startPixel_&&(this.box_.setPixels(this.startPixel_,e.pixel),this.dispatchEvent(new K0(Dg.BOXDRAG,e.coordinate,e)))}handleUpEvent(e){if(!this.startPixel_)return!1;let t=this.boxEndCondition_(e,this.startPixel_,e.pixel);return t&&this.onBoxEnd(e),this.dispatchEvent(new K0(t?Dg.BOXEND:Dg.BOXCANCEL,e.coordinate,e)),this.box_.setMap(null),this.startPixel_=null,!1}handleDownEvent(e){return this.condition_(e)?(this.startPixel_=e.pixel,this.box_.setMap(e.map),this.box_.setPixels(this.startPixel_,this.startPixel_),this.dispatchEvent(new K0(Dg.BOXSTART,e.coordinate,e)),!0):!1}onBoxEnd(e){}setActive(e){e||(this.box_.setMap(null),this.startPixel_&&(this.dispatchEvent(new K0(Dg.BOXCANCEL,this.startPixel_,null)),this.startPixel_=null)),super.setActive(e)}setMap(e){this.getMap()&&(this.box_.setMap(null),this.startPixel_&&(this.dispatchEvent(new K0(Dg.BOXCANCEL,this.startPixel_,null)),this.startPixel_=null)),super.setMap(e)}},jV=$I;var YI=class extends jV{constructor(e){e=e||{};let t=e.condition?e.condition:zV;super({condition:t,className:e.className||"ol-dragzoom",minArea:e.minArea}),this.duration_=e.duration!==void 0?e.duration:200,this.out_=e.out!==void 0?e.out:!1}onBoxEnd(e){let n=this.getMap().getView(),r=this.getGeometry();if(this.out_){let s=n.rotatedExtentForGeometry(r),o=n.getResolutionForExtentInternal(s),a=n.getResolution()/o;r=r.clone(),r.scale(a*a)}n.fitInternal(r,{duration:this.duration_,easing:Vl})}},XV=YI;var Td={LEFT:"ArrowLeft",UP:"ArrowUp",RIGHT:"ArrowRight",DOWN:"ArrowDown"};var ZI=class extends Ru{constructor(e){super(),e=e||{},this.defaultCondition_=function(t){return oS(t)&&aS(t)},this.condition_=e.condition!==void 0?e.condition:this.defaultCondition_,this.duration_=e.duration!==void 0?e.duration:100,this.pixelDelta_=e.pixelDelta!==void 0?e.pixelDelta:128}handleEvent(e){let t=!1;if(e.type==Jt.KEYDOWN){let n=e.originalEvent,r=n.key;if(this.condition_(e)&&(r==Td.DOWN||r==Td.LEFT||r==Td.RIGHT||r==Td.UP)){let o=e.map.getView(),a=o.getResolution()*this.pixelDelta_,l=0,c=0;r==Td.DOWN?c=-a:r==Td.LEFT?l=-a:r==Td.RIGHT?l=a:c=a;let u=[l,c];rg(u,o.getRotation()),OV(o,u,this.duration_),n.preventDefault(),t=!0}}return!t}},$V=ZI;var KI=class extends Ru{constructor(e){super(),e=e||{},this.condition_=e.condition?e.condition:function(t){return!GV(t)&&aS(t)},this.delta_=e.delta?e.delta:1,this.duration_=e.duration!==void 0?e.duration:100}handleEvent(e){let t=!1;if(e.type==Jt.KEYDOWN||e.type==Jt.KEYPRESS){let n=e.originalEvent,r=n.key;if(this.condition_(e)&&(r==="+"||r==="-")){let s=e.map,o=r==="+"?this.delta_:-this.delta_,a=s.getView();Ng(a,o,void 0,this.duration_),n.preventDefault(),t=!0}}return!t}},YV=KI;var mae=40,gae=300,_ae=3,QI=class extends Ru{constructor(e){e=e||{},super(e),this.totalDelta_=0,this.lastDelta_=0,this.maxDelta_=e.maxDelta!==void 0?e.maxDelta:1,this.duration_=e.duration!==void 0?e.duration:250,this.timeout_=e.timeout!==void 0?e.timeout:80,this.useAnchor_=e.useAnchor!==void 0?e.useAnchor:!0,this.constrainResolution_=e.constrainResolution!==void 0?e.constrainResolution:!1;let t=e.condition?e.condition:kV;this.condition_=e.onFocusOnly?kx(rS,t):t,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(e){if(this.ctrlKeyListenerKeys_.forEach(ii),this.ctrlKeyListenerKeys_.length=0,this.ctrlKeyPressed_=!1,super.setMap(e),e){let t=e.getOwnerDocument();this.ctrlKeyListenerKeys_.push(Un(t,"keydown",n=>{n.key==="Control"&&(this.ctrlKeyPressed_=!0)}),Un(t,"keyup",n=>{n.key==="Control"&&(this.ctrlKeyPressed_=!1)}))}}endInteraction_(){this.trackpadTimeoutId_=void 0;let e=this.getMap();if(!e)return;let t=e.getView(),n=this.lastDelta_?this.lastDelta_>0?1:-1:0;t.endInteraction(this.constrainResolution_||t.getConstrainResolution()?100:void 0,n,this.lastAnchor_?e.getCoordinateFromPixel(this.lastAnchor_):null)}handleEvent(e){if(!this.condition_(e)||e.type!==Jt.WHEEL)return!0;let n=e.map,r=e.originalEvent;r.preventDefault();let s=r.ctrlKey&&!this.ctrlKeyPressed_;r.ctrlKey||(this.ctrlKeyPressed_=!1),this.useAnchor_&&(this.lastAnchor_=e.pixel);let o=r.deltaY;switch(r.deltaMode){case WheelEvent.DOM_DELTA_LINE:o*=mae;break;case WheelEvent.DOM_DELTA_PAGE:o*=gae;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=n.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*_ae),l.adjustZoom(-o/this.deltaPerZoom_,this.lastAnchor_?n.getCoordinateFromPixel(this.lastAnchor_):null),this.startTime_=a,!1;this.totalDelta_+=o;let c=Math.max(this.timeout_-(a-this.startTime_),0);return clearTimeout(this.timeoutId_),this.timeoutId_=setTimeout(this.handleWheelZoom_.bind(this,n),c),!1}handleWheelZoom_(e){let t=e.getView();t.getAnimating()&&t.cancelAnimations();let n=-_i(this.totalDelta_,-this.maxDelta_*this.deltaPerZoom_,this.maxDelta_*this.deltaPerZoom_)/this.deltaPerZoom_;(t.getConstrainResolution()||this.constrainResolution_)&&(n=n?n>0?1:-1:0),Ng(t,n,this.lastAnchor_?e.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(e){this.useAnchor_=e,e||(this.lastAnchor_=null)}},ZV=QI;var JI=class extends Pu{constructor(e){e=e||{};let t=e;t.stopDown||(t.stopDown=Zh),super(t),this.anchor_=null,this.lastAngle_=void 0,this.rotating_=!1,this.rotationDelta_=0,this.threshold_=e.threshold!==void 0?e.threshold:.3,this.duration_=e.duration!==void 0?e.duration:250}handleDragEvent(e){let t=0,n=this.targetPointers[0],r=this.targetPointers[1],s=Math.atan2(r.clientY-n.clientY,r.clientX-n.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),t=l}this.lastAngle_=s;let o=e.map,a=o.getView();a.getConstraints().rotation!==Pg&&(this.anchor_=o.getCoordinateFromPixelInternal(o.getEventPixel(Lg(this.targetPointers))),this.rotating_&&(o.render(),a.adjustRotationInternal(t,this.anchor_)))}handleUpEvent(e){return this.targetPointers.length<2?(e.map.getView().endInteraction(this.duration_),!1):!0}handleDownEvent(e){if(this.targetPointers.length>=2){let t=e.map;return this.anchor_=null,this.lastAngle_=void 0,this.rotating_=!1,this.rotationDelta_=0,this.handlingDownUpSequence||t.getView().beginInteraction(),!0}return!1}},KV=JI;var e5=class extends Pu{constructor(e){e=e||{};let t=e;t.stopDown||(t.stopDown=Zh),super(t),this.anchor_=null,this.duration_=e.duration!==void 0?e.duration:400,this.lastDistance_=void 0,this.lastScaleDelta_=1}handleDragEvent(e){let t=1,n=this.targetPointers[0],r=this.targetPointers[1],s=n.clientX-r.clientX,o=n.clientY-r.clientY,a=Math.sqrt(s*s+o*o);this.lastDistance_!==void 0&&(t=this.lastDistance_/a),this.lastDistance_=a;let l=e.map,c=l.getView();t!=1&&(this.lastScaleDelta_=t),this.anchor_=l.getCoordinateFromPixelInternal(l.getEventPixel(Lg(this.targetPointers))),l.render(),c.adjustResolutionInternal(t,this.anchor_)}handleUpEvent(e){if(this.targetPointers.length<2){let n=e.map.getView(),r=this.lastScaleDelta_>1?1:-1;return n.endInteraction(this.duration_,r),!1}return!0}handleDownEvent(e){if(this.targetPointers.length>=2){let t=e.map;return this.anchor_=null,this.lastDistance_=void 0,this.lastScaleDelta_=1,this.handlingDownUpSequence||t.getView().beginInteraction(),!0}return!1}},QV=e5;function cS(i){i=i||{};let e=new lo,t=new FV(-.005,.05,100);return(i.altShiftDragRotate===void 0||i.altShiftDragRotate)&&e.push(new HV),(i.doubleClickZoom===void 0||i.doubleClickZoom)&&e.push(new BV({delta:i.zoomDelta,duration:i.zoomDuration})),(i.dragPan===void 0||i.dragPan)&&e.push(new qV({onFocusOnly:i.onFocusOnly,kinetic:t})),(i.pinchRotate===void 0||i.pinchRotate)&&e.push(new KV),(i.pinchZoom===void 0||i.pinchZoom)&&e.push(new QV({duration:i.zoomDuration})),(i.keyboard===void 0||i.keyboard)&&(e.push(new $V),e.push(new YV({delta:i.zoomDelta,duration:i.zoomDuration}))),(i.mouseWheelZoom===void 0||i.mouseWheelZoom)&&e.push(new ZV({onFocusOnly:i.onFocusOnly,duration:i.zoomDuration})),(i.shiftDragZoom===void 0||i.shiftDragZoom)&&e.push(new XV({duration:i.zoomDuration})),e}var Ti={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 t5=class extends ms{constructor(e){super(),this.on,this.once,this.un,this.background_=e.background;let t=Object.assign({},e);typeof e.properties=="object"&&(delete t.properties,Object.assign(t,e.properties)),t[Ti.OPACITY]=e.opacity!==void 0?e.opacity:1,zn(typeof t[Ti.OPACITY]=="number","Layer opacity must be a number"),t[Ti.VISIBLE]=e.visible!==void 0?e.visible:!0,t[Ti.Z_INDEX]=e.zIndex,t[Ti.MAX_RESOLUTION]=e.maxResolution!==void 0?e.maxResolution:1/0,t[Ti.MIN_RESOLUTION]=e.minResolution!==void 0?e.minResolution:0,t[Ti.MIN_ZOOM]=e.minZoom!==void 0?e.minZoom:-1/0,t[Ti.MAX_ZOOM]=e.maxZoom!==void 0?e.maxZoom:1/0,this.className_=t.className!==void 0?t.className:"ol-layer",delete t.className,this.setProperties(t),this.state_=null}getBackground(){return this.background_}getClassName(){return this.className_}getLayerState(e){let t=this.state_||{layer:this,managed:e===void 0?!0:e},n=this.getZIndex();return t.opacity=_i(Math.round(this.getOpacity()*100)/100,0,1),t.visible=this.getVisible(),t.extent=this.getExtent(),t.zIndex=n===void 0&&!t.managed?1/0:n,t.maxResolution=this.getMaxResolution(),t.minResolution=Math.max(this.getMinResolution(),0),t.minZoom=this.getMinZoom(),t.maxZoom=this.getMaxZoom(),this.state_=t,t}getLayersArray(e){return $n()}getLayerStatesArray(e){return $n()}getExtent(){return this.get(Ti.EXTENT)}getMaxResolution(){return this.get(Ti.MAX_RESOLUTION)}getMinResolution(){return this.get(Ti.MIN_RESOLUTION)}getMinZoom(){return this.get(Ti.MIN_ZOOM)}getMaxZoom(){return this.get(Ti.MAX_ZOOM)}getOpacity(){return this.get(Ti.OPACITY)}getSourceState(){return $n()}getVisible(){return this.get(Ti.VISIBLE)}getZIndex(){return this.get(Ti.Z_INDEX)}setBackground(e){this.background_=e,this.changed()}setExtent(e){this.set(Ti.EXTENT,e)}setMaxResolution(e){this.set(Ti.MAX_RESOLUTION,e)}setMinResolution(e){this.set(Ti.MIN_RESOLUTION,e)}setMaxZoom(e){this.set(Ti.MAX_ZOOM,e)}setMinZoom(e){this.set(Ti.MIN_ZOOM,e)}setOpacity(e){zn(typeof e=="number","Layer opacity must be a number"),this.set(Ti.OPACITY,e)}setVisible(e){this.set(Ti.VISIBLE,e)}setZIndex(e){this.set(Ti.Z_INDEX,e)}disposeInternal(){this.state_&&(this.state_.layer=null,this.state_=null),super.disposeInternal()}},uS=t5;var Ed={ADDLAYER:"addlayer",REMOVELAYER:"removelayer"},Nc=class extends js{constructor(e,t){super(e),this.layer=t}},n5={LAYERS:"layers"},i5=class i extends uS{constructor(e){e=e||{};let t=Object.assign({},e);delete t.layers;let n=e.layers;super(t),this.on,this.once,this.un,this.layersListenerKeys_=[],this.listenerKeys_={},this.addChangeListener(n5.LAYERS,this.handleLayersChanged_),n?Array.isArray(n)?n=new lo(n.slice(),{unique:!0}):zn(typeof n.getArray=="function","Expected `layers` to be an array or a `Collection`"):n=new lo(void 0,{unique:!0}),this.setLayers(n)}handleLayerChange_(){this.changed()}handleLayersChanged_(){this.layersListenerKeys_.forEach(ii),this.layersListenerKeys_.length=0;let e=this.getLayers();this.layersListenerKeys_.push(Un(e,Ys.ADD,this.handleLayersAdd_,this),Un(e,Ys.REMOVE,this.handleLayersRemove_,this));for(let n in this.listenerKeys_)this.listenerKeys_[n].forEach(ii);_u(this.listenerKeys_);let t=e.getArray();for(let n=0,r=t.length;n<r;n++){let s=t[n];this.registerLayerListeners_(s),this.dispatchEvent(new Nc(Ed.ADDLAYER,s))}this.changed()}registerLayerListeners_(e){let t=[Un(e,Ec.PROPERTYCHANGE,this.handleLayerChange_,this),Un(e,Jt.CHANGE,this.handleLayerChange_,this)];e instanceof i&&t.push(Un(e,Ed.ADDLAYER,this.handleLayerGroupAdd_,this),Un(e,Ed.REMOVELAYER,this.handleLayerGroupRemove_,this)),this.listenerKeys_[Nn(e)]=t}handleLayerGroupAdd_(e){this.dispatchEvent(new Nc(Ed.ADDLAYER,e.layer))}handleLayerGroupRemove_(e){this.dispatchEvent(new Nc(Ed.REMOVELAYER,e.layer))}handleLayersAdd_(e){let t=e.element;this.registerLayerListeners_(t),this.dispatchEvent(new Nc(Ed.ADDLAYER,t)),this.changed()}handleLayersRemove_(e){let t=e.element,n=Nn(t);this.listenerKeys_[n].forEach(ii),delete this.listenerKeys_[n],this.dispatchEvent(new Nc(Ed.REMOVELAYER,t)),this.changed()}getLayers(){return this.get(n5.LAYERS)}setLayers(e){let t=this.getLayers();if(t){let n=t.getArray();for(let r=0,s=n.length;r<s;++r)this.dispatchEvent(new Nc(Ed.REMOVELAYER,n[r]))}this.set(n5.LAYERS,e)}getLayersArray(e){return e=e!==void 0?e:[],this.getLayers().forEach(function(t){t.getLayersArray(e)}),e}getLayerStatesArray(e){let t=e!==void 0?e:[],n=t.length;this.getLayers().forEach(function(o){o.getLayerStatesArray(t)});let r=this.getLayerState(),s=r.zIndex;!e&&r.zIndex===void 0&&(s=0);for(let o=n,a=t.length;o<a;o++){let l=t[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=Au(l.extent,r.extent):l.extent=r.extent),l.zIndex===void 0&&(l.zIndex=s)}return t}getSourceState(){return"ready"}},Gx=i5;var uo={PRERENDER:"prerender",POSTRENDER:"postrender",PRECOMPOSE:"precompose",POSTCOMPOSE:"postcompose",RENDERCOMPLETE:"rendercomplete"};var r5=class extends uS{constructor(e){let t=Object.assign({},e);delete t.source,super(t),this.on,this.once,this.un,this.mapPrecomposeKey_=null,this.mapRenderKey_=null,this.sourceChangeKey_=null,this.renderer_=null,this.sourceReady_=!1,this.rendered=!1,e.render&&(this.render=e.render),e.map&&this.setMap(e.map),this.addChangeListener(Ti.SOURCE,this.handleSourcePropertyChange_);let n=e.source?e.source:null;this.setSource(n)}getLayersArray(e){return e=e||[],e.push(this),e}getLayerStatesArray(e){return e=e||[],e.push(this.getLayerState()),e}getSource(){return this.get(Ti.SOURCE)||null}getRenderSource(){return this.getSource()}getSourceState(){let e=this.getSource();return e?e.getState():"undefined"}handleSourceChange_(){this.changed(),!(this.sourceReady_||this.getSource().getState()!=="ready")&&(this.sourceReady_=!0,this.dispatchEvent("sourceready"))}handleSourcePropertyChange_(){this.sourceChangeKey_&&(ii(this.sourceChangeKey_),this.sourceChangeKey_=null),this.sourceReady_=!1;let e=this.getSource();e&&(this.sourceChangeKey_=Un(e,Jt.CHANGE,this.handleSourceChange_,this),e.getState()==="ready"&&(this.sourceReady_=!0,setTimeout(()=>{this.dispatchEvent("sourceready")},0))),this.changed()}getFeatures(e){return this.renderer_?this.renderer_.getFeatures(e):Promise.resolve([])}getData(e){return!this.renderer_||!this.rendered?null:this.renderer_.getData(e)}isVisible(e){let t,n=this.getMapInternal();!e&&n&&(e=n.getView()),e instanceof cl?t={viewState:e.getState(),extent:e.calculateExtent()}:t=e,!t.layerStatesArray&&n&&(t.layerStatesArray=n.getLayerGroup().getLayerStatesArray());let r;if(t.layerStatesArray){if(r=t.layerStatesArray.find(o=>o.layer===this),!r)return!1}else r=this.getLayerState();let s=this.getExtent();return zx(r,t.viewState)&&(!s||_r(s,t.extent))}getAttributions(e){if(!this.isVisible(e))return[];let t=this.getSource()?.getAttributions();if(!t)return[];let n=e instanceof cl?e.getViewStateAndExtent():e,r=t(n);return Array.isArray(r)||(r=[r]),r}render(e,t){let n=this.getRenderer();return n.prepareFrame(e)?(this.rendered=!0,n.renderFrame(e,t)):null}unrender(){this.rendered=!1}getDeclutter(){}renderDeclutter(e,t){}renderDeferred(e){let t=this.getRenderer();t&&t.renderDeferred(e)}setMapInternal(e){e||this.unrender(),this.set(Ti.MAP,e)}getMapInternal(){return this.get(Ti.MAP)}setMap(e){this.mapPrecomposeKey_&&(ii(this.mapPrecomposeKey_),this.mapPrecomposeKey_=null),e||this.changed(),this.mapRenderKey_&&(ii(this.mapRenderKey_),this.mapRenderKey_=null),e&&(this.mapPrecomposeKey_=Un(e,uo.PRECOMPOSE,this.handlePrecompose_,this),this.mapRenderKey_=Un(this,Jt.CHANGE,e.render,e),this.changed())}handlePrecompose_(e){let t=e.frameState.layerStatesArray,n=this.getLayerState(!1);zn(!t.some(r=>r.layer===n.layer),"A layer can only be added to the map once. Use either `layer.setMap()` or `map.addLayer()`, not both."),t.push(n)}setSource(e){this.set(Ti.SOURCE,e)}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 zx(i,e){if(!i.visible)return!1;let t=e.resolution;if(t<i.minResolution||t>=i.maxResolution)return!1;let n=e.zoom;return n>i.minZoom&&n<=i.maxZoom}var Q0=r5;function hS(i,e,t=0,n=i.length-1,r=xae){for(;n>t;){if(n-t>600){let l=n-t+1,c=e-t+1,u=Math.log(l),f=.5*Math.exp(2*u/3),p=.5*Math.sqrt(u*f*(l-f)/l)*(c-l/2<0?-1:1),x=Math.max(t,Math.floor(e-c*f/l+p)),b=Math.min(n,Math.floor(e+(l-c)*f/l+p));hS(i,e,x,b,r)}let s=i[e],o=t,a=n;for(Vx(i,t,e),r(i[n],s)>0&&Vx(i,t,n);o<a;){for(Vx(i,o,a),o++,a--;r(i[o],s)<0;)o++;for(;r(i[a],s)>0;)a--}r(i[t],s)===0?Vx(i,t,a):(a++,Vx(i,a,n)),a<=e&&(t=a+1),e<=a&&(n=a-1)}}function Vx(i,e,t){let n=i[e];i[e]=i[t],i[t]=n}function xae(i,e){return i<e?-1:i>e?1:0}var J0=class{constructor(e=9){this._maxEntries=Math.max(4,e),this._minEntries=Math.max(2,Math.ceil(this._maxEntries*.4)),this.clear()}all(){return this._all(this.data,[])}search(e){let t=this.data,n=[];if(!dS(e,t))return n;let r=this.toBBox,s=[];for(;t;){for(let o=0;o<t.children.length;o++){let a=t.children[o],l=t.leaf?r(a):a;dS(e,l)&&(t.leaf?n.push(a):o5(e,l)?this._all(a,n):s.push(a))}t=s.pop()}return n}collides(e){let t=this.data;if(!dS(e,t))return!1;let n=[];for(;t;){for(let r=0;r<t.children.length;r++){let s=t.children[r],o=t.leaf?this.toBBox(s):s;if(dS(e,o)){if(t.leaf||o5(e,o))return!0;n.push(s)}}t=n.pop()}return!1}load(e){if(!(e&&e.length))return this;if(e.length<this._minEntries){for(let n=0;n<e.length;n++)this.insert(e[n]);return this}let t=this._build(e.slice(),0,e.length-1,0);if(!this.data.children.length)this.data=t;else if(this.data.height===t.height)this._splitRoot(this.data,t);else{if(this.data.height<t.height){let n=this.data;this.data=t,t=n}this._insert(t,this.data.height-t.height-1,!0)}return this}insert(e){return e&&this._insert(e,this.data.height-1),this}clear(){return this.data=Og([]),this}remove(e,t){if(!e)return this;let n=this.data,r=this.toBBox(e),s=[],o=[],a,l,c;for(;n||s.length;){if(n||(n=s.pop(),l=s[s.length-1],a=o.pop(),c=!0),n.leaf){let u=yae(e,n.children,t);if(u!==-1)return n.children.splice(u,1),s.push(n),this._condense(s),this}!c&&!n.leaf&&o5(n,r)?(s.push(n),o.push(a),a=0,l=n,n=n.children[0]):l?(a++,n=l.children[a],c=!1):n=null}return this}toBBox(e){return e}compareMinX(e,t){return e.minX-t.minX}compareMinY(e,t){return e.minY-t.minY}toJSON(){return this.data}fromJSON(e){return this.data=e,this}_all(e,t){let n=[];for(;e;)e.leaf?t.push(...e.children):n.push(...e.children),e=n.pop();return t}_build(e,t,n,r){let s=n-t+1,o=this._maxEntries,a;if(s<=o)return a=Og(e.slice(t,n+1)),Fg(a,this.toBBox),a;r||(r=Math.ceil(Math.log(s)/Math.log(o)),o=Math.ceil(s/Math.pow(o,r-1))),a=Og([]),a.leaf=!1,a.height=r;let l=Math.ceil(s/o),c=l*Math.ceil(Math.sqrt(o));JV(e,t,n,c,this.compareMinX);for(let u=t;u<=n;u+=c){let f=Math.min(u+c-1,n);JV(e,u,f,l,this.compareMinY);for(let p=u;p<=f;p+=l){let x=Math.min(p+l-1,f);a.children.push(this._build(e,p,x,r-1))}}return Fg(a,this.toBBox),a}_chooseSubtree(e,t,n,r){for(;r.push(t),!(t.leaf||r.length-1===n);){let s=1/0,o=1/0,a;for(let l=0;l<t.children.length;l++){let c=t.children[l],u=s5(c),f=wae(e,c)-u;f<o?(o=f,s=u<s?u:s,a=c):f===o&&u<s&&(s=u,a=c)}t=a||t.children[0]}return t}_insert(e,t,n){let r=n?e:this.toBBox(e),s=[],o=this._chooseSubtree(r,this.data,t,s);for(o.children.push(e),Hx(o,r);t>=0&&s[t].children.length>this._maxEntries;)this._split(s,t),t--;this._adjustParentBBoxes(r,s,t)}_split(e,t){let n=e[t],r=n.children.length,s=this._minEntries;this._chooseSplitAxis(n,s,r);let o=this._chooseSplitIndex(n,s,r),a=Og(n.children.splice(o,n.children.length-o));a.height=n.height,a.leaf=n.leaf,Fg(n,this.toBBox),Fg(a,this.toBBox),t?e[t-1].children.push(a):this._splitRoot(n,a)}_splitRoot(e,t){this.data=Og([e,t]),this.data.height=e.height+1,this.data.leaf=!1,Fg(this.data,this.toBBox)}_chooseSplitIndex(e,t,n){let r,s=1/0,o=1/0;for(let a=t;a<=n-t;a++){let l=qx(e,0,a,this.toBBox),c=qx(e,a,n,this.toBBox),u=Sae(l,c),f=s5(l)+s5(c);u<s?(s=u,r=a,o=f<o?f:o):u===s&&f<o&&(o=f,r=a)}return r||n-t}_chooseSplitAxis(e,t,n){let r=e.leaf?this.compareMinX:vae,s=e.leaf?this.compareMinY:bae,o=this._allDistMargin(e,t,n,r),a=this._allDistMargin(e,t,n,s);o<a&&e.children.sort(r)}_allDistMargin(e,t,n,r){e.children.sort(r);let s=this.toBBox,o=qx(e,0,t,s),a=qx(e,n-t,n,s),l=fS(o)+fS(a);for(let c=t;c<n-t;c++){let u=e.children[c];Hx(o,e.leaf?s(u):u),l+=fS(o)}for(let c=n-t-1;c>=t;c--){let u=e.children[c];Hx(a,e.leaf?s(u):u),l+=fS(a)}return l}_adjustParentBBoxes(e,t,n){for(let r=n;r>=0;r--)Hx(t[r],e)}_condense(e){for(let t=e.length-1,n;t>=0;t--)e[t].children.length===0?t>0?(n=e[t-1].children,n.splice(n.indexOf(e[t]),1)):this.clear():Fg(e[t],this.toBBox)}};function yae(i,e,t){if(!t)return e.indexOf(i);for(let n=0;n<e.length;n++)if(t(i,e[n]))return n;return-1}function Fg(i,e){qx(i,0,i.children.length,e,i)}function qx(i,e,t,n,r){r||(r=Og(null)),r.minX=1/0,r.minY=1/0,r.maxX=-1/0,r.maxY=-1/0;for(let s=e;s<t;s++){let o=i.children[s];Hx(r,i.leaf?n(o):o)}return r}function Hx(i,e){return i.minX=Math.min(i.minX,e.minX),i.minY=Math.min(i.minY,e.minY),i.maxX=Math.max(i.maxX,e.maxX),i.maxY=Math.max(i.maxY,e.maxY),i}function vae(i,e){return i.minX-e.minX}function bae(i,e){return i.minY-e.minY}function s5(i){return(i.maxX-i.minX)*(i.maxY-i.minY)}function fS(i){return i.maxX-i.minX+(i.maxY-i.minY)}function wae(i,e){return(Math.max(e.maxX,i.maxX)-Math.min(e.minX,i.minX))*(Math.max(e.maxY,i.maxY)-Math.min(e.minY,i.minY))}function Sae(i,e){let t=Math.max(i.minX,e.minX),n=Math.max(i.minY,e.minY),r=Math.min(i.maxX,e.maxX),s=Math.min(i.maxY,e.maxY);return Math.max(0,r-t)*Math.max(0,s-n)}function o5(i,e){return i.minX<=e.minX&&i.minY<=e.minY&&e.maxX<=i.maxX&&e.maxY<=i.maxY}function dS(i,e){return e.minX<=i.maxX&&e.minY<=i.maxY&&e.maxX>=i.minX&&e.maxY>=i.minY}function Og(i){return{children:i,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function JV(i,e,t,n,r){let s=[e,t];for(;s.length;){if(t=s.pop(),e=s.pop(),t-e<=n)continue;let o=e+Math.ceil((t-e)/n/2)*n;hS(i,o,e,t,r),s.push(e,o,o,t)}}var tA=0,AS=0,Lo=1<<tA++,ri=1<<tA++,Do=1<<tA++,ia=1<<tA++,lf=1<<tA++,eA=1<<tA++,mS=Math.pow(2,tA)-1,l5={[Lo]:"boolean",[ri]:"number",[Do]:"string",[ia]:"color",[lf]:"number[]",[eA]:"size"},Tae=Object.keys(l5).map(Number).sort(Ba);function Eae(i){return i in l5}function af(i){let e=[];for(let t of Tae)Wx(i,t)&&e.push(l5[t]);return e.length===0?"untyped":e.length<3?e.join(" or "):e.slice(0,-1).join(", ")+", or "+e[e.length-1]}function Wx(i,e){return(i&e)===e}function pS(i,e){return!!(i&e)}function Md(i,e){return i===e}var Cr=class{constructor(e,t){if(!Eae(e))throw new Error(`literal expressions must have a specific type, got ${af(e)}`);this.type=e,this.value=t}},gS=class{constructor(e,t,...n){this.type=e,this.operator=t,this.args=n}};function _S(i){return{variables:new Map,properties:new Map,featureId:!1,geometryType:!1,mCoordinate:!1,mapState:!1,inputVariables:i}}function Hr(i,e,t){switch(typeof i){case"boolean":{if(Md(e,Do))return new Cr(Do,i?"true":"false");if(!Wx(e,Lo))throw new Error(`got a boolean, but expected ${af(e)}`);return new Cr(Lo,i)}case"number":{if(Md(e,eA))return new Cr(eA,Vr(i));if(Md(e,Lo))return new Cr(Lo,!!i);if(Md(e,Do))return new Cr(Do,i.toString());if(!Wx(e,ri))throw new Error(`got a number, but expected ${af(e)}`);return new Cr(ri,i)}case"string":{if(Md(e,ia))return new Cr(ia,Cx(i));if(Md(e,Lo))return new Cr(Lo,!!i);if(!Wx(e,Do))throw new Error(`got a string, but expected ${af(e)}`);return new Cr(Do,i)}default:}if(!Array.isArray(i))throw new Error("expression must be an array or a primitive value");if(i.length===0)throw new Error("empty expression");if(typeof i[0]=="string")return Uae(i,e,t);for(let n of i)if(typeof n!="number")throw new Error("expected an array of numbers");if(Md(e,eA)){if(i.length!==2)throw new Error(`expected an array of two values for a size, got ${i.length}`);return new Cr(eA,i)}if(Md(e,ia)){if(i.length===3)return new Cr(ia,[...i,1]);if(i.length===4)return new Cr(ia,i);throw new Error(`expected an array of 3 or 4 values for a color, got ${i.length}`)}if(!Wx(e,lf))throw new Error(`got an array of numbers, but expected ${af(e)}`);return new Cr(lf,i)}var Je={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"},Mae={[Je.Get]:Dn(Yn(1,1/0),eq),[Je.Var]:Cae(),[Je.Has]:Dn(Yn(1,1/0),eq),[Je.Id]:Dn(Rae,Bg),[Je.Concat]:Dn(Yn(2,1/0),ki(Do)),[Je.GeometryType]:Dn(Pae,Bg),[Je.LineMetric]:Dn(Iae,Bg),[Je.Resolution]:Dn(a5,Bg),[Je.Zoom]:Dn(a5,Bg),[Je.Time]:Dn(a5,Bg),[Je.Any]:Dn(Yn(2,1/0),ki(Lo)),[Je.All]:Dn(Yn(2,1/0),ki(Lo)),[Je.Not]:Dn(Yn(1,1),ki(Lo)),[Je.Equal]:Dn(Yn(2,2),nq()),[Je.NotEqual]:Dn(Yn(2,2),nq()),[Je.GreaterThan]:Dn(Yn(2,2),ki(ri)),[Je.GreaterThanOrEqualTo]:Dn(Yn(2,2),ki(ri)),[Je.LessThan]:Dn(Yn(2,2),ki(ri)),[Je.LessThanOrEqualTo]:Dn(Yn(2,2),ki(ri)),[Je.Multiply]:Dn(Yn(2,1/0),tq),[Je.Coalesce]:Dn(Yn(2,1/0),tq),[Je.Divide]:Dn(Yn(2,2),ki(ri)),[Je.Add]:Dn(Yn(2,1/0),ki(ri)),[Je.Subtract]:Dn(Yn(2,2),ki(ri)),[Je.Clamp]:Dn(Yn(3,3),ki(ri)),[Je.Mod]:Dn(Yn(2,2),ki(ri)),[Je.Pow]:Dn(Yn(2,2),ki(ri)),[Je.Abs]:Dn(Yn(1,1),ki(ri)),[Je.Floor]:Dn(Yn(1,1),ki(ri)),[Je.Ceil]:Dn(Yn(1,1),ki(ri)),[Je.Round]:Dn(Yn(1,1),ki(ri)),[Je.Sin]:Dn(Yn(1,1),ki(ri)),[Je.Cos]:Dn(Yn(1,1),ki(ri)),[Je.Atan]:Dn(Yn(1,2),ki(ri)),[Je.Sqrt]:Dn(Yn(1,1),ki(ri)),[Je.Match]:Dn(Yn(4,1/0),iq,Lae),[Je.Between]:Dn(Yn(3,3),ki(ri)),[Je.Interpolate]:Dn(Yn(6,1/0),iq,Dae),[Je.Case]:Dn(Yn(3,1/0),Nae,Fae),[Je.In]:Dn(Yn(2,2),Oae),[Je.Number]:Dn(Yn(1,1/0),ki(mS)),[Je.String]:Dn(Yn(1,1/0),ki(mS)),[Je.Array]:Dn(Yn(1,1/0),ki(ri)),[Je.Color]:Dn(Yn(1,4),ki(ri)),[Je.Band]:Dn(Yn(1,3),ki(ri)),[Je.Palette]:Dn(Yn(2,2),Bae),[Je.ToString]:Dn(Yn(1,1),ki(Lo|ri|Do|ia))};function eq(i,e,t){let n=i.length-1,r=new Array(n);for(let s=0;s<n;++s){let o=i[s+1];switch(typeof o){case"number":{r[s]=new Cr(ri,o);break}case"string":{r[s]=new Cr(Do,o);break}default:throw new Error(`expected a string key or numeric array index for a get operation, got ${o}`)}s===0&&t.properties.set(String(o),e)}return r}function Cae(){return function(i,e,t){let n=i[1];if(typeof n!="string")throw new Error("expected a string argument for var operation");let r=e,s=t.inputVariables?.[n];if(s!==void 0){let o=Hr(s,mS,t);if(!(o instanceof Cr))throw new Error(`style variables should only be literal values (no expressions!), variable name: ${n}`);let a=o.type;if(typeof s=="string"&&pS(r,ia)&&!pS(r,Do)?a=ia:Array.isArray(s)&&s.length===2&&pS(r,eA)&&!pS(r,lf)&&(a=eA),r&=a,r===AS)throw new Error(`the type expected from the var operator (${af(e)}) did not have any overlap with the type of the corresponding style variables (${af(a)}), variable name: ${n}`)}if(t.variables.has(n)){let o=t.variables.get(n);if(r&=o,r===AS)throw new Error(`a new type expected from the var operator (${af(e)}) did not have any overlap with the previous type expected for it (${af(o)}), variable name: ${n}`)}return t.variables.set(n,r),new gS(r,"var",new Cr(Do,n))}}function Rae(i,e,t){t.featureId=!0}function Pae(i,e,t){t.geometryType=!0}function Iae(i,e,t){t.mCoordinate=!0}function a5(i,e,t){t.mapState=!0}function Bg(i,e,t){let n=i[0];if(i.length!==1)throw new Error(`expected no arguments for ${n} operation`);return[]}function Yn(i,e){return function(t,n,r){let s=t[0],o=t.length-1;if(i===e){if(o!==i){let a=i===1?"":"s";throw new Error(`expected ${i} argument${a} for ${s}, got ${o}`)}}else if(o<i||o>e){let a=e===1/0?`${i} or more`:`${i} to ${e}`;throw new Error(`expected ${a} arguments for ${s}, got ${o}`)}}}function tq(i,e,t){let n=i.length-1,r=new Array(n);for(let s=0;s<n;++s){let o=Hr(i[s+1],e,t);r[s]=o}return r}function ki(i){return function(e,t,n){let r=e.length-1,s=new Array(r);for(let o=0;o<r;++o){let a=Hr(e[o+1],i,n);s[o]=a}return s}}function nq(){return function(i,e,t){let n=i[0],r=i.length-1,s=new Array(r),o=mS;for(let a=0;a<r;++a){let l=Hr(i[a+1],o,t);o&=l.type}if(o===AS)throw new Error(`no common type was found among the arguments of ${n}`);for(let a=0;a<r;++a){let l=Hr(i[a+1],o,t);s[a]=l}return s}}function Nae(i,e,t){let n=i[0],r=i.length-1;if(r%2===0)throw new Error(`expected an odd number of arguments for ${n}, got ${r} instead`)}function iq(i,e,t){let n=i[0],r=i.length-1;if(r%2===1)throw new Error(`expected an even number of arguments for operation ${n}, got ${r} instead`)}function Lae(i,e,t){let n=i.length-1,r=Hr(i[i.length-1],e,t),s=Do|ri|Lo,o=new Array(n-2);for(let l=0;l<n-2;l+=2){try{let c=Hr(i[l+2],s,t);s&=c.type}catch(c){throw new Error(`failed to parse argument ${l+1} of match expression: ${c.message}`)}if(s===AS)throw new Error("no common type was found among the arguments of match expression")}for(let l=0;l<n-2;l+=2){try{let c=Hr(i[l+2],s,t);o[l]=c}catch(c){throw new Error(`failed to parse argument ${l+1} of match expression: ${c.message}`)}try{let c=Hr(i[l+3],r.type,t);o[l+1]=c}catch(c){throw new Error(`failed to parse argument ${l+2} of match expression: ${c.message}`)}}return[Hr(i[1],s,t),...o,r]}function Dae(i,e,t){let n=i[1],r;switch(n[0]){case"linear":r=1;break;case"exponential":let l=n[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(n)}`)}let s=new Cr(ri,r),o;try{o=Hr(i[2],ri,t)}catch(l){throw new Error(`failed to parse argument 1 in interpolate expression: ${l.message}`)}let a=new Array(i.length-3);for(let l=0;l<a.length;l+=2){try{let c=Hr(i[l+3],ri,t);a[l]=c}catch(c){throw new Error(`failed to parse argument ${l+2} for interpolate expression: ${c.message}`)}try{let c=Hr(i[l+4],e,t);a[l+1]=c}catch(c){throw new Error(`failed to parse argument ${l+3} for interpolate expression: ${c.message}`)}}return[s,o,...a]}function Fae(i,e,t){let n=Hr(i[i.length-1],e,t),r=new Array(i.length-1);for(let s=0;s<r.length-1;s+=2){try{let o=Hr(i[s+1],Lo,t);r[s]=o}catch(o){throw new Error(`failed to parse argument ${s} of case expression: ${o.message}`)}try{let o=Hr(i[s+2],n.type,t);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]=n,r}function Oae(i,e,t){let n=i[2];if(!Array.isArray(n))throw new Error('the second argument for the "in" operator must be an array');let r;if(n[0]==="literal"){if(n=n[1],!Array.isArray(n))throw new Error('failed to parse "in" expression: the literal operator must be followed by an array')}else if(typeof n[0]=="string")throw new Error('for the "in" operator, a string array should be wrapped in a "literal" operator to disambiguate from expressions');typeof n[0]=="string"?r=Do:r=ri;let s=new Array(n.length);for(let a=0;a<s.length;a++)try{let l=Hr(n[a],r,t);s[a]=l}catch(l){throw new Error(`failed to parse haystack item ${a} for "in" expression: ${l.message}`)}return[Hr(i[1],r,t),...s]}function Bae(i,e,t){let n;try{n=Hr(i[1],ri,t)}catch(o){throw new Error(`failed to parse first argument in palette expression: ${o.message}`)}let r=i[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=Hr(r[o],ia,t)}catch(l){throw new Error(`failed to parse color at index ${o} in palette expression: ${l.message}`)}if(!(a instanceof Cr))throw new Error(`the palette color at index ${o} must be a literal value`);s[o]=a}return[n,...s]}function Dn(...i){return function(e,t,n){let r=e[0],s;for(let o=0;o<i.length;o++){let a=i[o](e,t,n);if(o==i.length-1){if(!a)throw new Error("expected last argument validator to return the parsed args");s=a}}return new gS(t,r,...s)}}function Uae(i,e,t){let n=i[0],r=Mae[n];if(!r)throw new Error(`unknown operator: ${n}`);return r(i,e,t)}function xS(i){if(!i)return"";let e=i.getType();switch(e){case"Point":case"LineString":case"Polygon":return e;case"MultiPoint":case"MultiLineString":case"MultiPolygon":return e.substring(5);case"Circle":return"Polygon";case"GeometryCollection":return xS(i.getGeometries()[0]);default:return""}}function c5(){return{variables:{},properties:{},resolution:NaN,featureId:null,geometryType:""}}function Dc(i,e,t){let n=Hr(i,e,t);return Lc(n,t)}function Lc(i,e){if(i instanceof Cr){if(i.type===ia&&typeof i.value=="string"){let n=Cx(i.value);return function(){return n}}return function(){return i.value}}let t=i.operator;switch(t){case Je.Number:case Je.String:case Je.Coalesce:return kae(i,e);case Je.Get:case Je.Var:case Je.Has:return Gae(i,e);case Je.Id:return n=>n.featureId;case Je.GeometryType:return n=>n.geometryType;case Je.Concat:{let n=i.args.map(r=>Lc(r,e));return r=>"".concat(...n.map(s=>s(r).toString()))}case Je.Resolution:return n=>n.resolution;case Je.Any:case Je.All:case Je.Between:case Je.In:case Je.Not:return Vae(i,e);case Je.Equal:case Je.NotEqual:case Je.LessThan:case Je.LessThanOrEqualTo:case Je.GreaterThan:case Je.GreaterThanOrEqualTo:return zae(i,e);case Je.Multiply:case Je.Divide:case Je.Add:case Je.Subtract:case Je.Clamp:case Je.Mod:case Je.Pow:case Je.Abs:case Je.Floor:case Je.Ceil:case Je.Round:case Je.Sin:case Je.Cos:case Je.Atan:case Je.Sqrt:return qae(i,e);case Je.Case:return Hae(i,e);case Je.Match:return Wae(i,e);case Je.Interpolate:return jae(i,e);case Je.ToString:return Xae(i,e);default:throw new Error(`Unsupported operator ${t}`)}}function kae(i,e){let t=i.operator,n=i.args.length,r=new Array(n);for(let s=0;s<n;++s)r[s]=Lc(i.args[s],e);switch(t){case Je.Coalesce:return s=>{for(let o=0;o<n;++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 Je.Number:case Je.String:return s=>{for(let o=0;o<n;++o){let a=r[o](s);if(typeof a===t)return a}throw new Error(`Expected one of the values to be a ${t}`)};default:throw new Error(`Unsupported assertion operator ${t}`)}}function Gae(i,e){let n=i.args[0].value;switch(i.operator){case Je.Get:return r=>{let s=i.args,o=r.properties[n];for(let a=1,l=s.length;a<l;++a){let u=s[a].value;o=o[u]}return o};case Je.Var:return r=>r.variables[n];case Je.Has:return r=>{let s=i.args;if(!(n in r.properties))return!1;let o=r.properties[n];for(let a=1,l=s.length;a<l;++a){let u=s[a].value;if(!o||!Object.hasOwn(o,u))return!1;o=o[u]}return!0};default:throw new Error(`Unsupported accessor operator ${i.operator}`)}}function zae(i,e){let t=i.operator,n=Lc(i.args[0],e),r=Lc(i.args[1],e);switch(t){case Je.Equal:return s=>n(s)===r(s);case Je.NotEqual:return s=>n(s)!==r(s);case Je.LessThan:return s=>n(s)<r(s);case Je.LessThanOrEqualTo:return s=>n(s)<=r(s);case Je.GreaterThan:return s=>n(s)>r(s);case Je.GreaterThanOrEqualTo:return s=>n(s)>=r(s);default:throw new Error(`Unsupported comparison operator ${t}`)}}function Vae(i,e){let t=i.operator,n=i.args.length,r=new Array(n);for(let s=0;s<n;++s)r[s]=Lc(i.args[s],e);switch(t){case Je.Any:return s=>{for(let o=0;o<n;++o)if(r[o](s))return!0;return!1};case Je.All:return s=>{for(let o=0;o<n;++o)if(!r[o](s))return!1;return!0};case Je.Between:return s=>{let o=r[0](s),a=r[1](s),l=r[2](s);return o>=a&&o<=l};case Je.In:return s=>{let o=r[0](s);for(let a=1;a<n;++a)if(o===r[a](s))return!0;return!1};case Je.Not:return s=>!r[0](s);default:throw new Error(`Unsupported logical operator ${t}`)}}function qae(i,e){let t=i.operator,n=i.args.length,r=new Array(n);for(let s=0;s<n;++s)r[s]=Lc(i.args[s],e);switch(t){case Je.Multiply:return s=>{let o=1;for(let a=0;a<n;++a)o*=r[a](s);return o};case Je.Divide:return s=>r[0](s)/r[1](s);case Je.Add:return s=>{let o=0;for(let a=0;a<n;++a)o+=r[a](s);return o};case Je.Subtract:return s=>r[0](s)-r[1](s);case Je.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 Je.Mod:return s=>r[0](s)%r[1](s);case Je.Pow:return s=>Math.pow(r[0](s),r[1](s));case Je.Abs:return s=>Math.abs(r[0](s));case Je.Floor:return s=>Math.floor(r[0](s));case Je.Ceil:return s=>Math.ceil(r[0](s));case Je.Round:return s=>Math.round(r[0](s));case Je.Sin:return s=>Math.sin(r[0](s));case Je.Cos:return s=>Math.cos(r[0](s));case Je.Atan:return n===2?s=>Math.atan2(r[0](s),r[1](s)):s=>Math.atan(r[0](s));case Je.Sqrt:return s=>Math.sqrt(r[0](s));default:throw new Error(`Unsupported numeric operator ${t}`)}}function Hae(i,e){let t=i.args.length,n=new Array(t);for(let r=0;r<t;++r)n[r]=Lc(i.args[r],e);return r=>{for(let s=0;s<t-1;s+=2)if(n[s](r))return n[s+1](r);return n[t-1](r)}}function Wae(i,e){let t=i.args.length,n=new Array(t);for(let r=0;r<t;++r)n[r]=Lc(i.args[r],e);return r=>{let s=n[0](r);for(let o=1;o<t-1;o+=2)if(s===n[o](r))return n[o+1](r);return n[t-1](r)}}function jae(i,e){let t=i.args.length,n=new Array(t);for(let r=0;r<t;++r)n[r]=Lc(i.args[r],e);return r=>{let s=n[0](r),o=n[1](r),a,l;for(let c=2;c<t;c+=2){let u=n[c](r),f=n[c+1](r),p=Array.isArray(f);if(p&&(f=Pz(f)),u>=o)return c===2?f:p?$ae(s,o,a,l,u,f):jx(s,o,a,l,u,f);a=u,l=f}return l}}function Xae(i,e){let t=i.operator,n=i.args.length,r=new Array(n);for(let s=0;s<n;++s)r[s]=Lc(i.args[s],e);if(t===Je.ToString)return s=>{let o=r[0](s);return i.args[0].type===ia?Rx(o):o.toString()};throw new Error(`Unsupported convert operator ${t}`)}function jx(i,e,t,n,r,s){let o=r-t;if(o===0)return n;let a=e-t,l=i===1?a/o:(Math.pow(i,a)-1)/(Math.pow(i,o)-1);return n+l*(s-n)}function $ae(i,e,t,n,r,s){if(r-t===0)return n;let a=ZP(n),l=ZP(s),c=l[2]-a[2];c>180?c-=360:c<-180&&(c+=360);let u=[jx(i,e,t,a[0],r,l[0]),jx(i,e,t,a[1],r,l[1]),a[2]+jx(i,e,t,0,r,c),jx(i,e,t,n[3],r,s[3])];return Iz(u)}function Yae(i){return!0}function Zae(i,e){e=e??_S();let t=Kae(i,e),n=c5();return function(r,s){if(n.properties=r.getPropertiesInternal(),n.resolution=s,e.featureId){let o=r.getId();o!==void 0?n.featureId=o:n.featureId=null}return e.geometryType&&(n.geometryType=xS(r.getGeometry())),t(n)}}function rq(i,e){e=e??_S();let t=i.length,n=new Array(t);for(let o=0;o<t;++o)n[o]=u5(i[o],e);let r=c5(),s=new Array(t);return function(o,a){if(r.properties=o.getPropertiesInternal(),r.resolution=a,e.featureId){let c=o.getId();c!==void 0?r.featureId=c:r.featureId=null}e.geometryType&&(r.geometryType=xS(o.getGeometry()));let l=0;for(let c=0;c<t;++c){let u=n[c](r);u&&(s[l]=u,l+=1)}return s.length=l,s}}function lq(i,e){if(e=e??_S(),!Array.isArray(i))return rq([i],e);let t=i.length;if("style"in i[0]){let s=new Array(t);for(let o=0;o<t;++o){let a=i[o];if(!("style"in a))throw new Error("Expected a list of rules with a style property");s[o]=a}return Zae(s,e)}return rq(i,e)}function Kae(i,e){let t=i.length,n=new Array(t);for(let r=0;r<t;++r){let s=i[r],o="filter"in s?Dc(s.filter,Lo,e):Yae,a;if(Array.isArray(s.style)){let l=s.style.length;a=new Array(l);for(let c=0;c<l;++c)a[c]=u5(s.style[c],e)}else a=[u5(s.style,e)];n[r]={filter:o,styles:a}}return function(r){let s=[],o=!1;for(let a=0;a<t;++a){let l=n[a].filter;if(l(r)&&!(i[a].else&&o)){o=!0;for(let c of n[a].styles){let u=c(r);u&&s.push(u)}}}return s}}function u5(i,e){let t=Xx(i,"",e),n=$x(i,"",e),r=Qae(i,e),s=Jae(i,e),o=ho(i,"z-index",e);if(!t&&!n&&!r&&!s&&!vc(i))throw new Error("No fill, stroke, point, or text symbolizer properties in style: "+JSON.stringify(i));let a=new Ds;return function(l){let c=!0;if(t){let u=t(l);u&&(c=!1),a.setFill(u)}if(n){let u=n(l);u&&(c=!1),a.setStroke(u)}if(r){let u=r(l);u&&(c=!1),a.setText(u)}if(s){let u=s(l);u&&(c=!1),a.setImage(u)}return o&&a.setZIndex(o(l)),c?null:a}}function Xx(i,e,t){let n;if(e+"fill-pattern-src"in i)n=ile(i,e+"fill-",t);else{if(i[e+"fill-color"]==="none")return s=>null;n=vS(i,e+"fill-color",t)}if(!n)return null;let r=new qr;return function(s){let o=n(s);return o===Vw?null:(r.setColor(o),r)}}function $x(i,e,t){let n=ho(i,e+"stroke-width",t),r=vS(i,e+"stroke-color",t);if(!n&&!r)return null;let s=cf(i,e+"stroke-line-cap",t),o=cf(i,e+"stroke-line-join",t),a=cq(i,e+"stroke-line-dash",t),l=ho(i,e+"stroke-line-dash-offset",t),c=ho(i,e+"stroke-miter-limit",t),u=ho(i,e+"stroke-offset",t),f=new $s;return function(p){if(r){let x=r(p);if(x===Vw)return null;f.setColor(x)}if(n&&f.setWidth(n(p)),s){let x=s(p);if(x!=="butt"&&x!=="round"&&x!=="square")throw new Error("Expected butt, round, or square line cap");f.setLineCap(x)}if(o){let x=o(p);if(x!=="bevel"&&x!=="round"&&x!=="miter")throw new Error("Expected bevel, round, or miter line join");f.setLineJoin(x)}return a&&f.setLineDash(a(p)),l&&f.setLineDashOffset(l(p)),c&&f.setMiterLimit(c(p)),u&&f.setOffset(u(p)),f}}function Qae(i,e){let t="text-",n=cf(i,t+"value",e);if(!n)return null;let r=Xx(i,t,e),s=Xx(i,t+"background-",e),o=$x(i,t,e),a=$x(i,t+"background-",e),l=cf(i,t+"font",e),c=ho(i,t+"max-angle",e),u=ho(i,t+"offset-x",e),f=ho(i,t+"offset-y",e),p=Ug(i,t+"overflow",e),x=cf(i,t+"placement",e),b=ho(i,t+"repeat",e),w=bS(i,t+"scale",e),S=Ug(i,t+"rotate-with-view",e),T=ho(i,t+"rotation",e),P=cf(i,t+"align",e),R=cf(i,t+"justify",e),C=cf(i,t+"baseline",e),L=Ug(i,t+"keep-upright",e),D=cq(i,t+"padding",e),F=wS(i,t+"declutter-mode"),N=new sf({declutterMode:F});return function(B){if(N.setText(n(B)),r&&N.setFill(r(B)),s&&N.setBackgroundFill(s(B)),o&&N.setStroke(o(B)),a&&N.setBackgroundStroke(a(B)),l&&N.setFont(l(B)),c&&N.setMaxAngle(c(B)),u&&N.setOffsetX(u(B)),f&&N.setOffsetY(f(B)),p&&N.setOverflow(p(B)),x){let z=x(B);if(z!=="point"&&z!=="line")throw new Error("Expected point or line for text-placement");N.setPlacement(z)}if(b&&N.setRepeat(b(B)),w&&N.setScale(w(B)),S&&N.setRotateWithView(S(B)),T&&N.setRotation(T(B)),P){let z=P(B);if(z!=="left"&&z!=="center"&&z!=="right"&&z!=="end"&&z!=="start")throw new Error("Expected left, right, center, start, or end for text-align");N.setTextAlign(z)}if(R){let z=R(B);if(z!=="left"&&z!=="right"&&z!=="center")throw new Error("Expected left, right, or center for text-justify");N.setJustify(z)}if(C){let z=C(B);if(z!=="bottom"&&z!=="top"&&z!=="middle"&&z!=="alphabetic"&&z!=="hanging")throw new Error("Expected bottom, top, middle, alphabetic, or hanging for text-baseline");N.setTextBaseline(z)}return D&&N.setPadding(D(B)),L&&N.setKeepUpright(L(B)),N}}function Jae(i,e){return"icon-src"in i?ele(i,e):"shape-points"in i?tle(i,e):"circle-radius"in i?nle(i,e):null}function ele(i,e){let t="icon-",n=t+"src",r=uq(i[n],n),s=yS(i,t+"anchor",e),o=bS(i,t+"scale",e),a=ho(i,t+"opacity",e),l=yS(i,t+"displacement",e),c=ho(i,t+"rotation",e),u=Ug(i,t+"rotate-with-view",e),f=oq(i,t+"anchor-origin"),p=aq(i,t+"anchor-x-units"),x=aq(i,t+"anchor-y-units"),b=uf(i,t+"color"),w,S=null;b!==void 0&&(Array.isArray(b)&&b.length>0&&typeof b[0]=="string"?S=vS(i,t+"color",e):w=hq(b,t+"color"));let T=sle(i,t+"cross-origin"),P=ole(i,t+"offset"),R=oq(i,t+"offset-origin"),C=h5(i,t+"width"),L=h5(i,t+"height"),D=rle(i,t+"size"),F=wS(i,t+"declutter-mode"),N={src:r,anchorOrigin:f,anchorXUnits:p,anchorYUnits:x,crossOrigin:T,offset:P,offsetOrigin:R,height:L,width:C,size:D,declutterMode:F},B=null;return function(z){if(B)S&&B.setColor(S(z));else{let V=S?S(z):w;B=new $0(V!==void 0?Object.assign({},N,{color:V}):Object.assign({},N))}return a&&B.setOpacity(a(z)),l&&B.setDisplacement(l(z)),c&&B.setRotation(c(z)),u&&B.setRotateWithView(u(z)),o&&B.setScale(o(z)),s&&B.setAnchor(s(z)),B}}function tle(i,e){let t="shape-",n=t+"points",r=t+"radius",s=f5(i[n],n);if(!(r in i))throw new Error(`Expected a number for ${r}`);let o=ho(i,r,e),a=typeof i[r]=="number"?i[r]:5,l=t+"radius2",c=ho(i,l,e),u=typeof i[l]=="number"?i[l]:void 0,f=Xx(i,t,e),p=$x(i,t,e),x=bS(i,t+"scale",e),b=yS(i,t+"displacement",e),w=ho(i,t+"rotation",e),S=Ug(i,t+"rotate-with-view",e),T=h5(i,t+"angle"),P=wS(i,t+"declutter-mode"),R=new $w({points:s,radius:a,radius2:u,angle:T,declutterMode:P});return function(C){return o&&R.setRadius(o(C)),c&&R.setRadius2(c(C)),f&&R.setFill(f(C)),p&&R.setStroke(p(C)),b&&R.setDisplacement(b(C)),w&&R.setRotation(w(C)),S&&R.setRotateWithView(S(C)),x&&R.setScale(x(C)),R}}function nle(i,e){let t="circle-",n=Xx(i,t,e),r=$x(i,t,e),s=ho(i,t+"radius",e),o=bS(i,t+"scale",e),a=yS(i,t+"displacement",e),l=ho(i,t+"rotation",e),c=Ug(i,t+"rotate-with-view",e),u=wS(i,t+"declutter-mode"),f=new Yw({radius:5,declutterMode:u});return function(p){return s&&f.setRadius(s(p)),n&&f.setFill(n(p)),r&&f.setStroke(r(p)),a&&f.setDisplacement(a(p)),l&&f.setRotation(l(p)),c&&f.setRotateWithView(c(p)),o&&f.setScale(o(p)),f}}function uf(i,e){if(!(e in i))return;let t=i[e];return t===void 0?void 0:t}function ho(i,e,t){let n=uf(i,e);if(n===void 0)return;let r=Dc(n,ri,t);return function(s){return f5(r(s),e)}}function cf(i,e,t){let n=uf(i,e);if(n===void 0)return null;let r=Dc(n,Do,t);return function(s){return uq(r(s),e)}}function ile(i,e,t){let n=cf(i,e+"pattern-src",t),r=sq(i,e+"pattern-offset",t),s=sq(i,e+"pattern-size",t),o=vS(i,e+"color",t);return function(a){return{src:n(a),offset:r&&r(a),size:s&&s(a),color:o&&o(a)}}}function Ug(i,e,t){let n=uf(i,e);if(n===void 0)return null;let r=Dc(n,Lo,t);return function(s){let o=r(s);if(typeof o!="boolean")throw new Error(`Expected a boolean for ${e}`);return o}}function vS(i,e,t){let n=uf(i,e);if(n===void 0)return null;let r=Dc(n,ia,t);return function(s){return hq(r(s),e)}}function cq(i,e,t){let n=uf(i,e);if(n===void 0)return null;if(Array.isArray(n)&&(n.length===0||typeof n[0]!="string")){let s=n.map((o,a)=>{if(typeof o=="number")return()=>o;let l=Dc(o,ri,t);return function(c){return f5(l(c),`${e}[${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=Dc(n,lf,t);return function(s){return Yx(r(s),e)}}function yS(i,e,t){let n=uf(i,e);if(n===void 0)return null;let r=Dc(n,lf,t);return function(s){let o=Yx(r(s),e);if(o.length!==2)throw new Error(`Expected two numbers for ${e}`);return o}}function sq(i,e,t){let n=uf(i,e);if(n===void 0)return null;let r=Dc(n,lf,t);return function(s){return fq(r(s),e)}}function bS(i,e,t){let n=uf(i,e);if(n===void 0)return null;let r=Dc(n,lf|ri,t);return function(s){return ale(r(s),e)}}function h5(i,e){let t=i[e];if(t!==void 0){if(typeof t!="number")throw new Error(`Expected a number for ${e}`);return t}}function rle(i,e){let t=i[e];if(t!==void 0){if(typeof t=="number")return Vr(t);if(!Array.isArray(t))throw new Error(`Expected a number or size array for ${e}`);if(t.length!==2||typeof t[0]!="number"||typeof t[1]!="number")throw new Error(`Expected a number or size array for ${e}`);return t}}function sle(i,e){let t=i[e];if(t!==void 0){if(typeof t!="string")throw new Error(`Expected a string for ${e}`);return t}}function oq(i,e){let t=i[e];if(t!==void 0){if(t!=="bottom-left"&&t!=="bottom-right"&&t!=="top-left"&&t!=="top-right")throw new Error(`Expected bottom-left, bottom-right, top-left, or top-right for ${e}`);return t}}function aq(i,e){let t=i[e];if(t!==void 0){if(t!=="pixels"&&t!=="fraction")throw new Error(`Expected pixels or fraction for ${e}`);return t}}function ole(i,e){let t=i[e];if(t!==void 0)return Yx(t,e)}function wS(i,e){let t=i[e];if(t!==void 0){if(typeof t!="string")throw new Error(`Expected a string for ${e}`);if(t!=="declutter"&&t!=="obstacle"&&t!=="none")throw new Error(`Expected declutter, obstacle, or none for ${e}`);return t}}function Yx(i,e){if(!Array.isArray(i))throw new Error(`Expected an array for ${e}`);let t=i.length;for(let n=0;n<t;++n)if(typeof i[n]!="number")throw new Error(`Expected an array of numbers for ${e}`);return i}function uq(i,e){if(typeof i!="string")throw new Error(`Expected a string for ${e}`);return i}function f5(i,e){if(typeof i!="number")throw new Error(`Expected a number for ${e}`);return i}function hq(i,e){if(typeof i=="string")return i;let t=Yx(i,e),n=t.length;if(n<3||n>4)throw new Error(`Expected a color with 3 or 4 values for ${e}`);return t}function fq(i,e){let t=Yx(i,e);if(t.length!==2)throw new Error(`Expected an array of two numbers for ${e}`);return t}function ale(i,e){return typeof i=="number"?i:fq(i,e)}var dq={RENDER_ORDER:"renderOrder"},d5=class extends Q0{constructor(e){e=e||{};let t=Object.assign({},e);delete t.style,delete t.renderBuffer,delete t.updateWhileAnimating,delete t.updateWhileInteracting,super(t),this.declutter_=e.declutter?String(e.declutter):void 0,this.renderBuffer_=e.renderBuffer!==void 0?e.renderBuffer:100,this.style_=null,this.styleFunction_=void 0,this.setStyle(e.style),this.updateWhileAnimating_=e.updateWhileAnimating!==void 0?e.updateWhileAnimating:!1,this.updateWhileInteracting_=e.updateWhileInteracting!==void 0?e.updateWhileInteracting:!1}getDeclutter(){return this.declutter_}getFeatures(e){return super.getFeatures(e)}getRenderBuffer(){return this.renderBuffer_}getRenderOrder(){return this.get(dq.RENDER_ORDER)}getStyle(){return this.style_}getStyleFunction(){return this.styleFunction_}getUpdateWhileAnimating(){return this.updateWhileAnimating_}getUpdateWhileInteracting(){return this.updateWhileInteracting_}renderDeclutter(e,t){let n=this.getDeclutter();n in e.declutter||(e.declutter[n]=new J0(9)),this.getRenderer().renderDeclutter(e,t)}setRenderOrder(e){this.set(dq.RENDER_ORDER,e)}setStyle(e){this.style_=e===void 0?cI:e;let t=lle(e);this.styleFunction_=e===null?void 0:qz(t),this.changed()}setDeclutter(e){this.declutter_=e?String(e):void 0,this.changed()}};function lle(i){if(i===void 0)return cI;if(!i)return null;if(typeof i=="function"||i instanceof Ds)return i;if(Array.isArray(i)&&i.length===0)return[];if(Array.isArray(i)&&i[0]instanceof Ds){let t=i.length,n=new Array(t);for(let r=0;r<t;++r){let s=i[r];if(!(s instanceof Ds))throw new Error("Expected a list of style instances");n[r]=s}return n}return lq(i)}var SS=d5;var p5=class extends js{constructor(e,t,n,r){super(e),this.inversePixelTransform=t,this.frameState=n,this.context=r}},TS=p5;var A5=class extends Ad{constructor(e){super(),this.map_=e}dispatchRenderEvent(e,t){$n()}calculateMatrices2D(e){let t=e.viewState,n=e.coordinateToPixelTransform,r=e.pixelToCoordinateTransform;ao(n,e.size[0]/2,e.size[1]/2,1/t.resolution,-1/t.resolution,-t.rotation,-t.center[0],-t.center[1]),Sw(r,n)}forEachFeatureAtCoordinate(e,t,n,r,s,o,a,l){let c,u=t.viewState;function f(C,L,D,F){return s.call(o,L,C?D:null,F)}let p=u.projection,x=ow(e.slice(),p),b=[[0,0]];if(p.canWrapX()&&r){let C=p.getExtent(),L=Wn(C);b.push([-L,0],[L,0])}let w=t.layerStatesArray,S=w.length,T=[],P=[];for(let C=0;C<b.length;C++)for(let L=S-1;L>=0;--L){let D=w[L],F=D.layer;if(F.hasRenderer()&&zx(D,u)&&a.call(l,F)){let N=F.getRenderer(),B=F.getSource();if(N&&B){let z=B.getWrapX()?x:e,V=f.bind(null,D.managed);P[0]=z[0]+b[C][0],P[1]=z[1]+b[C][1],c=N.forEachFeatureAtCoordinate(P,t,n,V,T)}if(c)return c}}if(T.length===0)return;let R=1/T.length;return T.forEach((C,L)=>C.distanceSq+=L*R),T.sort((C,L)=>C.distanceSq-L.distanceSq),T.some(C=>c=C.callback(C.feature,C.layer,C.geometry)),c}hasFeatureAtCoordinate(e,t,n,r,s,o){return this.forEachFeatureAtCoordinate(e,t,n,r,Yh,this,s,o)!==void 0}getMap(){return this.map_}renderFrame(e){$n()}scheduleExpireIconCache(e){Io.canExpireCache()&&e.postRenderFunctions.push(cle)}};function cle(i,e){Io.expire()}var pq=A5;var m5=class extends pq{constructor(e){super(e),this.fontChangeListenerKey_=Un(j0,Ec.PROPERTYCHANGE,e.redrawText,e),this.element_=Ns?vw():document.createElement("div");let t=this.element_.style;t.position="absolute",t.width="100%",t.height="100%",t.zIndex="0",this.element_.className=bd+" ol-layers";let n=e.getViewport();n&&n.insertBefore(this.element_,n.firstChild||null),this.children_=[],this.renderedVisible_=!0}dispatchRenderEvent(e,t){let n=this.getMap();if(n.hasListener(e)){let r=new TS(e,void 0,t);n.dispatchEvent(r)}}disposeInternal(){ii(this.fontChangeListenerKey_),this.element_.remove(),super.disposeInternal()}renderFrame(e){if(!e){this.renderedVisible_&&(this.element_.style.display="none",this.renderedVisible_=!1);return}this.calculateMatrices2D(e),this.dispatchRenderEvent(uo.PRECOMPOSE,e);let t=e.layerStatesArray.sort((u,f)=>u.zIndex-f.zIndex);t.some(u=>u.layer instanceof SS&&u.layer.getDeclutter())&&(e.declutter={});let r=e.viewState;this.children_.length=0;let o=this.getMap().getTargetElement(),a;ll(o)&&(a=o.getContext("2d"),a.setTransform(1,0,0,1,0,0),a.clearRect(0,0,o.width,o.height));let l=[],c=a?o:null;for(let u=0,f=t.length;u<f;++u){let p=t[u];e.layerIndex=u;let x=p.layer,b=x.getSourceState();if(!zx(p,r)||b!="ready"&&b!="undefined"){x.unrender();continue}let w=x.render(e,c);w&&(w!==c&&(this.children_.push(w),c=w),l.push(p))}this.declutter(e,l),FG(this.element_,this.children_);for(let u of a?this.children_:[]){let f=u.firstElementChild||u,p=u.style.backgroundColor;if(p&&(!ll(f)||f.width>0)&&(a.fillStyle=p,a.fillRect(0,0,a.canvas.width,a.canvas.height)),!ll(f)||f.width===0)continue;a.save();let x=u.style.opacity||f.style.opacity;a.globalAlpha=x===""?1:Number(x);let b=f.style.transform;if(b)a.transform(...ww(b));else{let w=parseFloat(f.style.width)/f.width,S=parseFloat(f.style.height)/f.height;a.transform(w,0,0,S,0,0)}a.drawImage(f,0,0),a.restore()}this.dispatchRenderEvent(uo.POSTCOMPOSE,e),this.renderedVisible_||(this.element_.style.display="",this.renderedVisible_=!0),this.scheduleExpireIconCache(e)}declutter(e,t){if(e.declutter){for(let n=t.length-1;n>=0;--n){let r=t[n],s=r.layer;s.getDeclutter()&&s.renderDeclutter(e,r)}t.forEach(n=>n.layer.renderDeferred(e))}}},Aq=m5;function mq(i){if(i instanceof Q0){i.setMapInternal(null);return}i instanceof Gx&&i.getLayers().forEach(mq)}function gq(i,e){if(i instanceof Q0){i.setMapInternal(e);return}if(i instanceof Gx){let t=i.getLayers().getArray();for(let n=0,r=t.length;n<r;++n)gq(t[n],e)}}var g5=class extends ms{constructor(e){super(),e=e||{},this.on,this.once,this.un;let t=ule(e);this.renderComplete_=!1,this.loaded_=!0,this.boundHandleBrowserEvent_=this.handleBrowserEvent.bind(this),this.maxTilesLoading_=e.maxTilesLoading!==void 0?e.maxTilesLoading:16,this.pixelRatio_=e.pixelRatio!==void 0?e.pixelRatio:RG,this.postRenderTimeoutHandle_,this.animationDelayKey_,this.animationDelay_=this.animationDelay_.bind(this),this.coordinateToPixelTransform_=Xs(),this.pixelToCoordinateTransform_=Xs(),this.frameIndex_=0,this.frameState_=null,this.previousExtent_=null,this.viewPropertyListenerKey_=null,this.viewChangeListenerKey_=null,this.layerGroupPropertyListenerKeys_=null,Ns||(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_=e.moveTolerance,this.keyboardEventTarget_=t.keyboardEventTarget,this.targetChangeHandlerKeys_=null,this.targetElement_=null,Ns||(this.resizeObserver_=new ResizeObserver(()=>this.updateSize())),this.controls=t.controls||(Ns?new lo:iS()),this.interactions=t.interactions||(Ns?new lo:cS({onFocusOnly:!0})),this.overlays_=t.overlays,this.overlayIdIndex_={},this.renderer_=null,this.postRenderFunctions_=[],this.tileQueue_=new TV(this.getTilePriority.bind(this),this.handleTileChange_.bind(this)),this.addChangeListener(co.LAYERGROUP,this.handleLayerGroupChanged_),this.addChangeListener(co.VIEW,this.handleViewChanged_),this.addChangeListener(co.SIZE,this.handleSizeChanged_),this.addChangeListener(co.TARGET,this.handleTargetChanged_),this.setProperties(t.values);let n=this;e.view&&!(e.view instanceof cl)&&e.view.then(function(r){n.setView(new cl(r))}),this.controls.addEventListener(Ys.ADD,r=>{r.element.setMap(this)}),this.controls.addEventListener(Ys.REMOVE,r=>{r.element.setMap(null)}),this.interactions.addEventListener(Ys.ADD,r=>{r.element.setMap(this)}),this.interactions.addEventListener(Ys.REMOVE,r=>{r.element.setMap(null)}),this.overlays_.addEventListener(Ys.ADD,r=>{this.addOverlayInternal_(r.element)}),this.overlays_.addEventListener(Ys.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(e){this.getControls().push(e)}addInteraction(e){this.getInteractions().push(e)}addLayer(e){this.getLayerGroup().getLayers().push(e)}handleLayerAdd_(e){gq(e.layer,this)}addOverlay(e){this.getOverlays().push(e)}addOverlayInternal_(e){let t=e.getId();t!==void 0&&(this.overlayIdIndex_[t.toString()]=e),e.setMap(this)}disposeInternal(){this.controls.clear(),this.interactions.clear(),this.overlays_.clear(),this.resizeObserver_?.disconnect(),this.setTarget(null),super.disposeInternal()}forEachFeatureAtPixel(e,t,n){if(!this.frameState_||!this.renderer_)return;let r=this.getCoordinateFromPixelInternal(e);n=n!==void 0?n:{};let s=n.hitTolerance!==void 0?n.hitTolerance:0,o=n.layerFilter!==void 0?n.layerFilter:Yh,a=n.checkWrapped!==!1;return this.renderer_.forEachFeatureAtCoordinate(r,this.frameState_,s,a,t,null,o,null)}getFeaturesAtPixel(e,t){let n=[];return this.forEachFeatureAtPixel(e,function(r){n.push(r)},t),n}getAllLayers(){let e=[];function t(n){n.forEach(function(r){r instanceof Gx?t(r.getLayers()):e.push(r)})}return t(this.getLayers()),e}hasFeatureAtPixel(e,t){if(!this.frameState_||!this.renderer_)return!1;let n=this.getCoordinateFromPixelInternal(e);t=t!==void 0?t:{};let r=t.layerFilter!==void 0?t.layerFilter:Yh,s=t.hitTolerance!==void 0?t.hitTolerance:0,o=t.checkWrapped!==!1;return this.renderer_.hasFeatureAtCoordinate(n,this.frameState_,s,o,r,null)}getEventCoordinate(e){return this.getCoordinateFromPixel(this.getEventPixel(e))}getEventCoordinateInternal(e){return this.getCoordinateFromPixelInternal(this.getEventPixel(e))}getEventPixel(e){let n=this.viewport_.getBoundingClientRect(),r=this.getSize(),s=n.width/r[0],o=n.height/r[1],a="changedTouches"in e?e.changedTouches[0]:e;return[(a.clientX-n.left)/s,(a.clientY-n.top)/o]}getTarget(){return this.get(co.TARGET)}getTargetElement(){return this.targetElement_}getCoordinateFromPixel(e){return dx(this.getCoordinateFromPixelInternal(e),this.getView().getProjection())}getCoordinateFromPixelInternal(e){let t=this.frameState_;return t?Mr(t.pixelToCoordinateTransform,e.slice()):null}getControls(){return this.controls}getOverlays(){return this.overlays_}getOverlayById(e){let t=this.overlayIdIndex_[e.toString()];return t!==void 0?t:null}getInteractions(){return this.interactions}getLayerGroup(){return this.get(co.LAYERGROUP)}setLayers(e){let t=this.getLayerGroup();if(e instanceof lo){t.setLayers(e);return}let n=t.getLayers();n.clear(),n.extend(e)}getLayers(){return this.getLayerGroup().getLayers()}getLoadingOrNotReady(){let e=this.getLayerGroup().getLayerStatesArray();for(let t=0,n=e.length;t<n;++t){let r=e[t];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(e){let t=wc(e,this.getView().getProjection());return this.getPixelFromCoordinateInternal(t)}getPixelFromCoordinateInternal(e){let t=this.frameState_;return t?Mr(t.coordinateToPixelTransform,e.slice(0,2)):null}getPixelRatio(){return this.pixelRatio_}setPixelRatio(e){this.pixelRatio_!==e&&(this.pixelRatio_=e,this.render())}getRenderer(){return this.renderer_}getSize(){return this.get(co.SIZE)}getView(){return this.get(co.VIEW)}getViewport(){return this.viewport_}getOverlayContainer(){return this.overlayContainer_}getOverlayContainerStopEvent(){return this.overlayContainerStopEvent_}getOwnerDocument(){let e=this.getTargetElement();return e?e.ownerDocument:document}getTilePriority(e,t,n,r){return EV(this.frameState_,e,t,n,r)}handleBrowserEvent(e,t){t=t||e.type;let n=new Mu(t,this,e);this.handleMapBrowserEvent(n)}handleMapBrowserEvent(e){if(!this.frameState_)return;let t=e.originalEvent,n=t.type;if(n===Bx.POINTERDOWN||n===Jt.WHEEL||n===Jt.KEYDOWN){let r=this.getOwnerDocument(),s=this.viewport_.getRootNode?this.viewport_.getRootNode():r,o=t.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(e.frameState=this.frameState_,this.dispatchEvent(e)!==!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(e)||e.propagationStopped)break}}}handlePostRender(){let e=this.frameState_,t=this.tileQueue_;if(!t.isEmpty()){let r=this.maxTilesLoading_,s=r,o=e?e.viewHints:void 0,a=o?o[Fs.ANIMATING]||o[Fs.INTERACTING]:!1;if(a){let l=Date.now()-e.time>8;r=l?0:8,s=l?0:2}t.getTilesLoading()<r&&(a&&t.reprioritize(),t.loadMoreTiles(r,s))}e&&this.renderer_&&!e.animate&&(this.renderComplete_?(this.hasListener(uo.RENDERCOMPLETE)&&this.renderer_.dispatchRenderEvent(uo.RENDERCOMPLETE,e),this.loaded_===!1&&(this.loaded_=!0,this.dispatchEvent(new Sd(Cu.LOADEND,this,e)))):this.loaded_===!0&&(this.loaded_=!1,this.dispatchEvent(new Sd(Cu.LOADSTART,this,e))));let n=this.postRenderFunctions_;if(e)for(let r=0,s=n.length;r<s;++r)n[r](this,e);n.length=0}handleSizeChanged_(){this.getView()&&!this.getView().getAnimating()&&this.getView().resolveConstraints(0),this.render()}handleTargetChanged_(){if(this.mapBrowserEventHandler_){for(let n=0,r=this.targetChangeHandlerKeys_.length;n<r;++n)ii(this.targetChangeHandlerKeys_[n]);this.targetChangeHandlerKeys_=null,this.viewport_.removeEventListener(Jt.CONTEXTMENU,this.boundHandleBrowserEvent_),this.viewport_.removeEventListener(Jt.WHEEL,this.boundHandleBrowserEvent_),this.mapBrowserEventHandler_.dispose(),this.mapBrowserEventHandler_=null,this.viewport_.remove()}if(this.targetElement_&&!ll(this.targetElement_)){this.resizeObserver_?.unobserve(this.targetElement_);let n=this.targetElement_.getRootNode();n instanceof ShadowRoot&&this.resizeObserver_.unobserve(n.host),this.setSize(void 0)}let e=this.getTarget(),t=typeof e=="string"?document.getElementById(e):e;if(this.targetElement_=t,!t)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(ll(t)||t.appendChild(this.viewport_),this.renderer_||(this.renderer_=new Aq(this)),!ll(t)){this.mapBrowserEventHandler_=new wV(this,this.moveTolerance_);for(let r in nr)this.mapBrowserEventHandler_.addEventListener(nr[r],this.handleMapBrowserEvent.bind(this));this.viewport_.addEventListener(Jt.CONTEXTMENU,this.boundHandleBrowserEvent_,!1),this.viewport_.addEventListener(Jt.WHEEL,this.boundHandleBrowserEvent_,yw?{passive:!1}:!1);let n;if(this.keyboardEventTarget_)n=this.keyboardEventTarget_;else{let r=t.getRootNode();n=r instanceof ShadowRoot?r.host:t}if(this.targetChangeHandlerKeys_=[Un(n,Jt.KEYDOWN,this.handleBrowserEvent,this),Un(n,Jt.KEYPRESS,this.handleBrowserEvent,this)],!ll(t)){let r=t.getRootNode();r instanceof ShadowRoot&&this.resizeObserver_.observe(r.host),this.resizeObserver_?.observe(t)}}this.updateSize()}}handleTileChange_(){this.render()}handleViewPropertyChanged_(){this.render()}handleViewChanged_(){this.viewPropertyListenerKey_&&(ii(this.viewPropertyListenerKey_),this.viewPropertyListenerKey_=null),this.viewChangeListenerKey_&&(ii(this.viewChangeListenerKey_),this.viewChangeListenerKey_=null);let e=this.getView();e&&(this.updateViewportSize_(this.getSize()),this.viewPropertyListenerKey_=Un(e,Ec.PROPERTYCHANGE,this.handleViewPropertyChanged_,this),this.viewChangeListenerKey_=Un(e,Jt.CHANGE,this.handleViewPropertyChanged_,this),e.resolveConstraints(0)),this.render()}handleLayerGroupChanged_(){this.layerGroupPropertyListenerKeys_&&(this.layerGroupPropertyListenerKeys_.forEach(ii),this.layerGroupPropertyListenerKeys_=null);let e=this.getLayerGroup();e&&(this.handleLayerAdd_(new Nc("addlayer",e)),this.layerGroupPropertyListenerKeys_=[Un(e,Ec.PROPERTYCHANGE,this.render,this),Un(e,Jt.CHANGE,this.render,this),Un(e,"addlayer",this.handleLayerAdd_,this),Un(e,"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 e=this.frameState_.layerStatesArray;for(let t=0,n=e.length;t<n;++t){let r=e[t].layer;r.hasRenderer()&&r.getRenderer().handleFontsChanged()}}render(){this.renderer_&&this.animationDelayKey_===void 0&&(this.animationDelayKey_=requestAnimationFrame(this.animationDelay_))}removeControl(e){return this.getControls().remove(e)}removeInteraction(e){return this.getInteractions().remove(e)}removeLayer(e){return this.getLayerGroup().getLayers().remove(e)}handleLayerRemove_(e){mq(e.layer)}removeOverlay(e){return this.getOverlays().remove(e)}renderFrame_(e){let t=this.getSize(),n=this.getView(),r=this.frameState_,s=null;if(t!==void 0&&K4(t)&&n&&n.isDef()){let o=n.getHints(this.frameState_?this.frameState_.viewHints:void 0),a=n.getState();if(s={animate:!1,coordinateToPixelTransform:this.coordinateToPixelTransform_,declutter:null,extent:cx(a.center,a.resolution,a.rotation,t),index:this.frameIndex_++,layerIndex:0,layerStatesArray:this.getLayerGroup().getLayerStatesArray(),pixelRatio:this.pixelRatio_,pixelToCoordinateTransform:this.pixelToCoordinateTransform_,postRenderFunctions:[],size:t,tileQueue:this.tileQueue_,time:e,usedTiles:{},viewState:a,viewHints:o,wantedTiles:{},mapId:Nn(this),renderTargets:{}},a.nextCenter&&a.nextResolution){let l=isNaN(a.nextRotation)?a.rotation:a.nextRotation;s.nextExtent=cx(a.nextCenter,a.nextResolution,l,t)}}this.frameState_=s,this.renderer_.renderFrame(s),s&&(s.animate&&this.render(),Array.prototype.push.apply(this.postRenderFunctions_,s.postRenderFunctions),r&&(!this.previousExtent_||!mu(this.previousExtent_)&&!I0(s.extent,this.previousExtent_))&&(this.dispatchEvent(new Sd(Cu.MOVESTART,this,r)),this.previousExtent_=P0(this.previousExtent_)),this.previousExtent_&&!s.viewHints[Fs.ANIMATING]&&!s.viewHints[Fs.INTERACTING]&&!I0(s.extent,this.previousExtent_)&&(this.dispatchEvent(new Sd(Cu.MOVEEND,this,s)),Qb(s.extent,this.previousExtent_))),this.dispatchEvent(new Sd(Cu.POSTRENDER,this,s)),this.renderComplete_=(this.hasListener(Cu.LOADSTART)||this.hasListener(Cu.LOADEND)||this.hasListener(uo.RENDERCOMPLETE))&&!this.tileQueue_.getTilesLoading()&&!this.tileQueue_.getCount()&&!this.getLoadingOrNotReady(),this.postRenderTimeoutHandle_||(this.postRenderTimeoutHandle_=setTimeout(()=>{this.postRenderTimeoutHandle_=void 0,this.handlePostRender()},0))}setLayerGroup(e){let t=this.getLayerGroup();t&&this.handleLayerRemove_(new Nc("removelayer",t)),this.set(co.LAYERGROUP,e)}setSize(e){this.set(co.SIZE,e)}setTarget(e){this.set(co.TARGET,e)}setView(e){if(!e||e instanceof cl){this.set(co.VIEW,e);return}this.set(co.VIEW,new cl);let t=this;e.then(function(n){t.setView(new cl(n))})}updateSize(){let e=this.getTargetElement(),t;if(e){let r,s;if(ll(e)){let o=e.getContext("2d").getTransform();r=e.width/o.a,s=e.height/o.d}else{let o=getComputedStyle(e);r=e.offsetWidth-parseFloat(o.borderLeftWidth)-parseFloat(o.paddingLeft)-parseFloat(o.paddingRight)-parseFloat(o.borderRightWidth),s=e.offsetHeight-parseFloat(o.borderTopWidth)-parseFloat(o.paddingTop)-parseFloat(o.paddingBottom)-parseFloat(o.borderBottomWidth)}!isNaN(r)&&!isNaN(s)&&(t=[Math.max(0,r),Math.max(0,s)],!K4(t)&&(e.offsetWidth||e.offsetHeight||e.getClientRects().length)&&iw("No map visible because the map container's width or height are 0."))}let n=this.getSize();t&&(!n||!Po(t,n))&&(this.updateViewportSize_(t),this.setSize(t))}updateViewportSize_(e){let t=this.getView();t&&t.setViewportSize(e)}};function ule(i){let e=null;i.keyboardEventTarget!==void 0&&(e=typeof i.keyboardEventTarget=="string"?document.getElementById(i.keyboardEventTarget):i.keyboardEventTarget);let t={},n=i.layers&&typeof i.layers.getLayers=="function"?i.layers:new Gx({layers:i.layers});t[co.LAYERGROUP]=n,t[co.TARGET]=i.target,t[co.VIEW]=i.view instanceof cl?i.view:new cl;let r;i.controls!==void 0&&(Array.isArray(i.controls)?r=new lo(i.controls.slice()):(zn(typeof i.controls.getArray=="function","Expected `controls` to be an array or an `ol/Collection.js`"),r=i.controls));let s;i.interactions!==void 0&&(Array.isArray(i.interactions)?s=new lo(i.interactions.slice()):(zn(typeof i.interactions.getArray=="function","Expected `interactions` to be an array or an `ol/Collection.js`"),s=i.interactions));let o;return i.overlays!==void 0?Array.isArray(i.overlays)?o=new lo(i.overlays.slice()):(zn(typeof i.overlays.getArray=="function","Expected `overlays` to be an array or an `ol/Collection.js`"),o=i.overlays):o=new lo,{controls:r,interactions:s,keyboardEventTarget:e,overlays:o,values:t}}var _q=g5;function ES(i){return i instanceof Image||i instanceof HTMLCanvasElement||i instanceof HTMLVideoElement||i instanceof ImageBitmap?i:null}var hle=new Error("disposed");var fle=[256,256],_5=class extends mg{constructor(e){let t=rn.IDLE;super(e.tileCoord,t,{transition:e.transition,interpolate:e.interpolate}),this.loader_=e.loader,this.data_=null,this.error_=null,this.size_=e.size||null,this.controller_=e.controller||null}getSize(){if(this.size_)return this.size_;let e=ES(this.data_);return e?[e.width,e.height]:fle}getData(){return this.data_}getError(){return this.error_}load(){if(this.state!==rn.IDLE&&this.state!==rn.ERROR)return;this.state=rn.LOADING,this.changed();let e=this;this.loader_().then(function(t){e.data_=t,e.state=rn.LOADED,e.changed()}).catch(function(t){e.error_=t,e.state=rn.ERROR,e.changed()})}disposeInternal(){this.controller_&&(this.controller_.abort(hle),this.controller_=null),super.disposeInternal()}},x5=_5;var y5=class{constructor(e){this.highWaterMark=e!==void 0?e:2048,this.count_=0,this.entries_={},this.oldest_=null,this.newest_=null}deleteOldest(){let e=this.pop();e instanceof Ad&&e.dispose()}canExpireCache(){return this.highWaterMark>0&&this.getCount()>this.highWaterMark}expireCache(e){for(;this.canExpireCache();)this.deleteOldest()}clear(){for(;this.oldest_;)this.deleteOldest()}containsKey(e){return this.entries_.hasOwnProperty(e)}forEach(e){let t=this.oldest_;for(;t;)e(t.value_,t.key_,this),t=t.newer}get(e,t){let n=this.entries_[e];return zn(n!==void 0,"Tried to get a value for a key that does not exist in the cache"),n===this.newest_||(n===this.oldest_?(this.oldest_=this.oldest_.newer,this.oldest_.older=null):(n.newer.older=n.older,n.older.newer=n.newer),n.newer=null,n.older=this.newest_,this.newest_.newer=n,this.newest_=n),n.value_}remove(e){let t=this.entries_[e];return zn(t!==void 0,"Tried to get a value for a key that does not exist in the cache"),t===this.newest_?(this.newest_=t.older,this.newest_&&(this.newest_.newer=null)):t===this.oldest_?(this.oldest_=t.newer,this.oldest_&&(this.oldest_.older=null)):(t.newer.older=t.older,t.older.newer=t.newer),delete this.entries_[e],--this.count_,t.value_}getCount(){return this.count_}getKeys(){let e=new Array(this.count_),t=0,n;for(n=this.newest_;n;n=n.older)e[t++]=n.key_;return e}getValues(){let e=new Array(this.count_),t=0,n;for(n=this.newest_;n;n=n.older)e[t++]=n.value_;return e}peekLast(){return this.oldest_.value_}peekLastKey(){return this.oldest_.key_}peekFirstKey(){return this.newest_.key_}peek(e){return this.entries_[e]?.value_}pop(){let e=this.oldest_;return delete this.entries_[e.key_],e.newer&&(e.newer.older=null),this.oldest_=e.newer,this.oldest_||(this.newest_=null),--this.count_,e.value_}replace(e,t){this.get(e),this.entries_[e].value_=t}set(e,t){zn(!(e in this.entries_),"Tried to set a value for a key that is used already");let n={key_:e,newer:null,older:this.newest_,value_:t};this.newest_?this.newest_.newer=n:this.oldest_=n,this.newest_=n,this.entries_[e]=n,++this.count_}setSize(e){this.highWaterMark=e}},v5=y5;var b5=class{constructor(){this.instructions_=[],this.zIndex=0,this.offset_=0,this.pendingMethod_,this.context_=new Proxy(mx(),{get:(e,t)=>{if(typeof e[t]=="function")return this.pendingMethod_=t,this.pushMethodArgs_},set:(e,t,n)=>(this.push_(t,n),!0)})}push_(...e){let t=this.instructions_,n=this.zIndex+this.offset_;t[n]||(t[n]=[]),t[n].push(...e)}pushMethodArgs_=(...e)=>{this.push_(this.pendingMethod_,e)};pushFunction(e){this.push_(e)}getContext(){return this.context_}draw(e){this.instructions_.forEach(t=>{for(let n=0,r=t.length;n<r;++n){let s=t[n];if(typeof s=="function"){s(e);continue}let o=t[++n];typeof e[s]=="function"?e[s](...o):typeof o=="function"?e[s]=o(e):e[s]=o}})}clear(){this.instructions_.length=0,this.zIndex=0,this.offset_=0}offset(){this.offset_=this.instructions_.length,this.zIndex=0}},MS=b5;var dle=5,w5=class extends Ew{constructor(e){super(),this.ready=!0,this.boundHandleImageChange_=this.handleImageChange_.bind(this),this.layer_=e,this.staleKeys_=new Array,this.maxStaleKeys=dle,this.renderedSourceKey_}getStaleKeys(){return this.staleKeys_}prependStaleKey(e){this.staleKeys_.unshift(e),this.staleKeys_.length>this.maxStaleKeys&&(this.staleKeys_.length=this.maxStaleKeys)}updateStaleKeys(e){this.renderedSourceKey_?this.renderedSourceKey_!==e&&(this.prependStaleKey(this.renderedSourceKey_),this.renderedSourceKey_=e):this.renderedSourceKey_=e}getFeatures(e){return $n()}getData(e){return null}prepareFrame(e){return $n()}renderFrame(e,t){return $n()}forEachFeatureAtCoordinate(e,t,n,r,s){}getLayer(){return this.layer_}handleFontsChanged(){}handleImageChange_(e){let t=e.target;(t.getState()===Mn.LOADED||t.getState()===Mn.ERROR)&&this.renderIfReadyAndVisible()}loadImage(e){let t=e.getState();return t!=Mn.LOADED&&t!=Mn.ERROR&&e.addEventListener(Jt.CHANGE,this.boundHandleImageChange_),t==Mn.IDLE&&(e.load(),t=e.getState()),t==Mn.LOADED}renderIfReadyAndVisible(){let e=this.getLayer();e&&e.getVisible()&&e.getSourceState()==="ready"&&e.changed()}renderDeferred(e){}disposeInternal(){delete this.layer_,super.disposeInternal()}},xq=w5;var T5=[],kg=null;function ple(){kg=Si(1,1,void 0,{willReadFrequently:!0})}var S5=class extends xq{constructor(e){super(e),this.container=null,this.renderedResolution,this.tempTransform=Xs(),this.pixelTransform=Xs(),this.inversePixelTransform=Xs(),this.context=null,this.deferredContext_=null,this.containerReused=!1,this.frameState=null}getImageData(e,t,n){kg||ple(),kg.clearRect(0,0,1,1);let r;try{kg.drawImage(e,t,n,1,1,0,0,1,1),r=kg.getImageData(0,0,1,1).data}catch{return kg=null,null}return r}getBackground(e){let n=this.getLayer().getBackground();return typeof n=="function"&&(n=n(e.viewState.resolution)),n||void 0}useContainer(e,t,n,r,s){if(ll(e)&&this.pixelTransform[1]===0&&this.pixelTransform[2]===0&&this.pixelTransform[4]===0&&this.pixelTransform[5]===0&&e.width===r&&e.height===s){let c=e,u=c.getContext("2d");if(u){this.container=e,this.context=u,this.containerReused=!0,n&&(u.fillStyle=n,u.fillRect(0,0,c.width,c.height));return}}let o=this.getLayer().getClassName(),a,l;if(e&&e.className===o&&(!n||e&&e.style.backgroundColor&&Po(Hl(e.style.backgroundColor),Hl(n)))){let c=e.firstElementChild;ll(c)&&(l=c.getContext("2d"))}if(l&&VG(l.canvas.style.transform,t)?(this.container=e,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=Ns?vw():document.createElement("div"),a.className=o;let c=a.style;c.position="absolute",c.width="100%",c.height="100%",l=Si();let u=l.canvas;a.appendChild(u),c=u.style,c.position="absolute",c.left="0",c.transformOrigin="top left",this.container=a,this.context=l}!this.containerReused&&n&&!this.container.style.backgroundColor&&(this.container.style.backgroundColor=n)}clipUnrotated(e,t,n){let r=Gl(n),s=ig(n),o=ng(n),a=tg(n);Mr(t.coordinateToPixelTransform,r),Mr(t.coordinateToPixelTransform,s),Mr(t.coordinateToPixelTransform,o),Mr(t.coordinateToPixelTransform,a);let l=this.inversePixelTransform;Mr(l,r),Mr(l,s),Mr(l,o),Mr(l,a),e.save(),e.beginPath(),e.moveTo(Math.round(r[0]),Math.round(r[1])),e.lineTo(Math.round(s[0]),Math.round(s[1])),e.lineTo(Math.round(o[0]),Math.round(o[1])),e.lineTo(Math.round(a[0]),Math.round(a[1])),e.clip()}prepareContainer(e,t){let n=e.extent,r=e.viewState.resolution,s=e.viewState.rotation,o=e.pixelRatio,a=Math.round(Wn(n)/r*o),l=Math.round(gr(n)/r*o);ao(this.pixelTransform,e.size[0]/2,e.size[1]/2,1/o,1/o,s,-a/2,-l/2),Sw(this.inversePixelTransform,this.pixelTransform);let c=zG(this.pixelTransform),u=this.getBackground(e);if(this.useContainer(t,c,u,a,l),!this.containerReused){let f=this.context.canvas;f.width!=a||f.height!=l?(f.width=a,f.height=l):this.context.clearRect(0,0,a,l),c!==f.style.transform&&(f.style.transform=c)}}dispatchRenderEvent_(e,t,n){let r=this.getLayer();if(r.hasListener(e)){let s=new TS(e,this.inversePixelTransform,n,t);r.dispatchEvent(s)}}preRender(e,t){this.frameState=t,!t.declutter&&this.dispatchRenderEvent_(uo.PRERENDER,e,t)}postRender(e,t){t.declutter||this.dispatchRenderEvent_(uo.POSTRENDER,e,t)}renderDeferredInternal(e){}getRenderContext(e){return e.declutter&&!this.deferredContext_&&(this.deferredContext_=new MS),e.declutter?this.deferredContext_.getContext():this.context}renderDeferred(e){e.declutter&&(this.dispatchRenderEvent_(uo.PRERENDER,this.context,e),e.declutter&&this.deferredContext_&&(this.deferredContext_.draw(this.context),this.deferredContext_.clear()),this.renderDeferredInternal(e),this.dispatchRenderEvent_(uo.POSTRENDER,this.context,e))}getRenderTransform(e,t,n,r,s,o,a){let l=s/2,c=o/2,u=r/t,f=-u,p=-e[0]+a,x=-e[1];return ao(this.tempTransform,l,c,u,f,-n,p,x)}disposeInternal(){delete this.frameState,super.disposeInternal()}},CS=S5;function E5(i,e,t){if(!(t in i))return i[t]=new Set([e]),!0;let n=i[t],r=n.has(e);return r||n.add(e),!r}function Ale(i,e,t){let n=i[t];return n?n.delete(e):!1}function yq(i,e){let t=i.layerStatesArray[i.layerIndex];t.extent&&(e=Au(e,Sc(t.extent,i.viewState.projection)));let n=t.layer.getRenderSource();if(!n.getWrapX()){let r=n.getTileGridForProjection(i.viewState.projection).getExtent();r&&(e=Au(e,r))}return e}var M5=class extends CS{constructor(e,t){super(e),t=t||{},this.extentChanged=!0,this.renderComplete=!1,this.renderedExtent_=null,this.renderedPixelRatio,this.renderedProjection=null,this.renderedTiles=[],this.renderedSourceRevision_,this.tempExtent=Er(),this.tempTileRange_=new Aw(0,0,0,0),this.tempTileCoord_=fg(0,0,0);let n=t.cacheSize!==void 0?t.cacheSize:512;this.tileCache_=new v5(n),this.sourceTileCache_=null,this.layerExtent=null,this.maxStaleKeys=n*.5}getTileCache(){return this.tileCache_}getSourceTileCache(){return this.sourceTileCache_||(this.sourceTileCache_=new v5(512)),this.sourceTileCache_}getOrCreateTile(e,t,n,r){let s=this.tileCache_,a=this.getLayer().getSource(),l=dg(a,a.getKey(),e,t,n),c;if(s.containsKey(l))c=s.get(l);else{let u=r.viewState.projection,f=a.getProjection();if(c=a.getTile(e,t,n,r.pixelRatio,u,!f||cg(f,u)?void 0:this.getSourceTileCache()),!c)return null;s.set(l,c)}return c}getTile(e,t,n,r){let s=this.getOrCreateTile(e,t,n,r);return s||null}getData(e){let t=this.frameState;if(!t)return null;let n=this.getLayer(),r=Mr(t.pixelToCoordinateTransform,e.slice()),s=n.getExtent();if(s&&!_c(s,r))return null;let o=t.viewState,a=n.getRenderSource(),l=a.getTileGridForProjection(o.projection),c=a.getTilePixelRatio(t.pixelRatio);for(let u=l.getZForResolution(o.resolution);u>=l.getMinZoom();--u){let f=l.getTileCoordForCoordAndZ(r,u),p=this.getTile(u,f[1],f[2],t);if(!p||p.getState()!==rn.LOADED)continue;let x=l.getOrigin(u),b=Vr(l.getTileSize(u)),w=l.getResolution(u),S;if(p instanceof bw||p instanceof Tw)S=p.getImage();else if(p instanceof x5){if(S=ES(p.getData()),!S)continue}else continue;let T=Math.floor(c*((r[0]-x[0])/w-f[1]*b[0])),P=Math.floor(c*((x[1]-r[1])/w-f[2]*b[1])),R=Math.round(c*a.getGutterForProjection(o.projection));return this.getImageData(S,T+R,P+R)}return null}prepareFrame(e){this.renderedProjection?e.viewState.projection!==this.renderedProjection&&(this.tileCache_.clear(),this.renderedProjection=e.viewState.projection):this.renderedProjection=e.viewState.projection;let t=this.getLayer().getSource();if(!t)return!1;let n=t.getRevision();return this.renderedSourceRevision_?this.renderedSourceRevision_!==n&&(this.renderedSourceRevision_=n,this.renderedSourceKey_===t.getKey()&&(this.tileCache_.clear(),this.sourceTileCache_?.clear())):this.renderedSourceRevision_=n,!0}enqueueTilesForNextExtent(){return!0}enqueueTiles(e,t,n,r,s){let o=e.viewState,a=this.getLayer(),l=a.getRenderSource(),c=l.getTileGridForProjection(o.projection),u=Nn(l);u in e.wantedTiles||(e.wantedTiles[u]={});let f=e.wantedTiles[u],p=a.getMapInternal(),x=Math.max(n-s,c.getMinZoom(),c.getZForResolution(Math.min(a.getMaxResolution(),p?p.getView().getResolutionForZoom(Math.max(a.getMinZoom(),0)):c.getResolution(0)),l.zDirection)),b=o.rotation,w=b?O4(o.center,o.resolution,b,e.size):void 0;for(let S=n;S>=x;--S){let T=c.getTileRangeForExtentAndZ(t,S,this.tempTileRange_),P=c.getResolution(S);for(let R=T.minX;R<=T.maxX;++R)for(let C=T.minY;C<=T.maxY;++C){if(b&&!c.tileCoordIntersectsViewport([S,R,C],w))continue;let L=this.getTile(S,R,C,e);if(!L||!E5(r,L,S))continue;let F=L.getKey();if(f[F]=!0,L.getState()===rn.IDLE&&!e.tileQueue.isKeyQueued(F)){let N=fg(S,R,C,this.tempTileCoord_);e.tileQueue.enqueue([L,u,c.getTileCoordCenter(N),P])}}}}findStaleTile_(e,t){let n=this.tileCache_,r=e[0],s=e[1],o=e[2],a=this.getStaleKeys();for(let l=0;l<a.length;++l){let c=dg(this.getLayer().getSource(),a[l],r,s,o);if(n.containsKey(c)){let u=n.peek(c);if(u.getState()===rn.LOADED)return u.endTransition(Nn(this)),E5(t,u,r),!0}}return!1}findAltTiles_(e,t,n,r){let s=e.getTileRangeForTileCoordAndZ(t,n,this.tempTileRange_);if(!s)return!1;let o=!0,a=this.tileCache_,l=this.getLayer().getRenderSource(),c=l.getKey();for(let u=s.minX;u<=s.maxX;++u)for(let f=s.minY;f<=s.maxY;++f){let p=dg(l,c,n,u,f),x=!1;if(a.containsKey(p)){let b=a.peek(p);b.getState()===rn.LOADED&&(E5(r,b,n),x=!0)}x||(o=!1)}return o}renderFrame(e,t){this.renderComplete=!0;let n=e.layerStatesArray[e.layerIndex],r=e.viewState,s=r.projection,o=r.resolution,a=r.center,l=e.pixelRatio,c=this.getLayer(),u=c.getSource(),f=u.getTileGridForProjection(s),p=f.getZForResolution(o,u.zDirection),x=f.getResolution(p);this.updateStaleKeys(u.getKey());let b=e.extent,w=u.getTilePixelRatio(l);this.prepareContainer(e,t);let S=this.context.canvas.width,T=this.context.canvas.height;this.layerExtent=n.extent?Sc(n.extent,s):null,this.layerExtent&&(b=Au(b,this.layerExtent));let P=x*S/2/w,R=x*T/2/w,C=[a[0]-P,a[1]-R,a[0]+P,a[1]+R],L={};this.renderedTiles.length=0;let D=c.getPreload();if(e.nextExtent&&this.enqueueTilesForNextExtent()){let K=f.getZForResolution(r.nextResolution,u.zDirection),ee=yq(e,e.nextExtent);this.enqueueTiles(e,ee,K,L,D)}let F=yq(e,b);if(this.enqueueTiles(e,F,p,L,0),D>0&&setTimeout(()=>{this.enqueueTiles(e,F,p-1,L,D-1)},0),!(p in L))return this.container;let N=Nn(this),B=e.time;for(let K of L[p]){let ee=K.getState();if(ee===rn.EMPTY)continue;let ae=K.tileCoord;if(ee===rn.LOADED&&K.getAlpha(N,B)===1){K.endTransition(N);continue}if(ee!==rn.ERROR&&(this.renderComplete=!1),this.findStaleTile_(ae,L)){Ale(L,K,p),e.animate=!0;continue}if(this.findAltTiles_(f,ae,p+1,L))continue;let ve=f.getMinZoom();for(let Ie=p-1;Ie>=ve&&!this.findAltTiles_(f,ae,Ie,L);--Ie);}let z=x/o*l/w,V=this.getRenderContext(e);ao(this.tempTransform,S/2,T/2,z,z,0,-S/2,-T/2),this.layerExtent&&this.clipUnrotated(V,e,this.layerExtent),u.getInterpolate()||(V.imageSmoothingEnabled=!1),this.preRender(V,e);let H=Object.keys(L).map(Number);H.sort(Ba);let Z=[],J=[],j=[];for(let K=H.length-1;K>=0;--K){let ee=H[K],ae=u.getTilePixelSize(ee,l,s),de=f.getResolution(ee)/x,ve=ae[0]*de*z,Ie=ae[1]*de*z,Qe=f.getTileCoordForCoordAndZ(Gl(C),ee),Ue=f.getTileCoordExtent(Qe),mt=Mr(this.tempTransform,[w*(Ue[0]-C[0])/x,w*(C[3]-Ue[3])/x]),Me=w*u.getGutterForProjection(s);for(let ze of L[ee]){if(ze.getState()!==rn.LOADED)continue;let $e=ze.tileCoord,Et=Qe[1]-$e[1],Tt=Math.round(mt[0]-(Et-1)*ve),Ct=Qe[2]-$e[2],un=Math.round(mt[1]-(Ct-1)*Ie),Gt=Math.round(mt[0]-Et*ve),Xe=Math.round(mt[1]-Ct*Ie),st=Tt-Gt,tt=un-Xe,vt=ee===p;if(vt&&ze.inTransition(N)){j.push({tile:ze,x:Gt,y:Xe,w:st,h:tt,gutter:Me}),this.renderedTiles.unshift(ze),this.updateUsedTiles(e.usedTiles,u,ze);continue}let yt=[Gt,Xe,Gt+st,Xe+tt],ln=[];for(let Qt=0,xn=Z.length;Qt<xn;++Qt)ee<J[Qt]&&_r(yt,Z[Qt])&&ln.push(Z[Qt]);let Kt;ln.length>0&&(Kt=B9(yt,ln)),Z.push(yt),J.push(ee),this.drawTile(ze,e,Gt,Xe,st,tt,Me,vt,Kt),this.renderedTiles.unshift(ze),this.updateUsedTiles(e.usedTiles,u,ze)}}for(let K=0,ee=j.length;K<ee;++K){let{tile:ae,x:ce,y:de,w:ve,h:Ie,gutter:Qe}=j[K];this.drawTile(ae,e,ce,de,ve,Ie,Qe,!0,void 0)}if(this.renderedResolution=x,this.extentChanged=!this.renderedExtent_||!I0(this.renderedExtent_,C),this.renderedExtent_=C,this.renderedPixelRatio=l,this.postRender(this.context,e),this.layerExtent&&V.restore(),V.imageSmoothingEnabled=!0,this.renderComplete){let K=(ee,ae)=>{let ce=Nn(u),de=ae.wantedTiles[ce],ve=de?Object.keys(de).length:0;this.updateCacheSize(ve),this.tileCache_.expireCache(),this.sourceTileCache_?.expireCache()};e.postRenderFunctions.push(K)}return this.container}updateCacheSize(e){this.tileCache_.highWaterMark=Math.max(this.tileCache_.highWaterMark,e*2)}drawTile(e,t,n,r,s,o,a,l,c){let u;if(e instanceof x5){if(u=ES(e.getData()),!u)throw new Error("Rendering array data is not yet supported")}else u=this.getTileImage(e);if(!u)return;let f=this.getRenderContext(t),p=Nn(this),x=t.layerStatesArray[t.layerIndex],b=x.opacity*(l?e.getAlpha(p,t.time):1),w=b!==f.globalAlpha;w&&(f.save(),f.globalAlpha=b);let S=u.width-2*a,T=u.height-2*a;if(c){let P=S/s,R=T/o;for(let C=0,L=c.length;C<L;++C){let D=c[C],F=D[0],N=D[1],B=D[2]-D[0],z=D[3]-D[1];f.drawImage(u,a+(F-n)*P,a+(N-r)*R,B*P,z*R,F,N,B,z)}}else f.drawImage(u,a,a,S,T,n,r,s,o);w&&f.restore(),b!==x.opacity?t.animate=!0:l&&e.endTransition(p)}getImage(){let e=this.context;return e?e.canvas:null}getTileImage(e){return e.getImage()}updateUsedTiles(e,t,n){let r=Nn(t);r in e||(e[r]={}),e[r][n.getKey()]=!0}},vq=M5;var Zx={PRELOAD:"preload",USE_INTERIM_TILES_ON_ERROR:"useInterimTilesOnError"};var C5=class extends Q0{constructor(e){e=e||{};let t=Object.assign({},e),n=e.cacheSize;delete e.cacheSize,delete t.preload,delete t.useInterimTilesOnError,super(t),this.on,this.once,this.un,this.cacheSize_=n,this.setPreload(e.preload!==void 0?e.preload:0),this.setUseInterimTilesOnError(e.useInterimTilesOnError!==void 0?e.useInterimTilesOnError:!0)}getCacheSize(){return this.cacheSize_}getPreload(){return this.get(Zx.PRELOAD)}setPreload(e){this.set(Zx.PRELOAD,e)}getUseInterimTilesOnError(){return this.get(Zx.USE_INTERIM_TILES_ON_ERROR)}setUseInterimTilesOnError(e){this.set(Zx.USE_INTERIM_TILES_ON_ERROR,e)}getData(e){return super.getData(e)}},bq=C5;var R5=class extends bq{constructor(e){super(e)}createRenderer(){return new vq(this,{cacheSize:this.getCacheSize()})}},P5=R5;var I5=class{drawCustom(e,t,n,r,s){}drawGeometry(e){}setStyle(e){}drawCircle(e,t,n){}drawFeature(e,t,n){}drawGeometryCollection(e,t,n){}drawLineString(e,t,n){}drawMultiLineString(e,t,n){}drawMultiPoint(e,t,n){}drawMultiPolygon(e,t,n){}drawPoint(e,t,n){}drawPolygon(e,t,n){}drawText(e,t,n){}setFillStrokeStyle(e,t){}setImageStyle(e,t){}setTextStyle(e,t){}},RS=I5;var Kx={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},Qx=[Kx.FILL],Iu=[Kx.STROKE],hf=[Kx.BEGIN_PATH],N5=[Kx.CLOSE_PATH],An=Kx;var L5=class extends RS{constructor(e,t,n,r){super(),this.tolerance=e,this.maxExtent=t,this.pixelRatio=r,this.maxLineWidth=0,this.resolution=n,this.beginGeometryInstruction1_=null,this.beginGeometryInstruction2_=null,this.bufferedMaxExtent_=null,this.instructions=[],this.coordinates=[],this.tmpCoordinate_=[],this.hitDetectionInstructions=[],this.state={}}applyPixelRatio(e){let t=this.pixelRatio;return t==1?e:e.map(function(n){return n*t})}appendFlatPointCoordinates(e,t){let n=this.getBufferedMaxExtent(),r=this.tmpCoordinate_,s=this.coordinates,o=s.length;for(let a=0,l=e.length;a<l;a+=t)r[0]=e[a],r[1]=e[a+1],_c(n,r)&&(s[o++]=r[0],s[o++]=r[1]);return o}appendFlatLineCoordinates(e,t,n,r,s,o){let a=this.coordinates,l=a.length,c=this.getBufferedMaxExtent();o&&(t+=r);let u=e[t],f=e[t+1],p=this.tmpCoordinate_,x=!0,b,w,S;for(b=t+r;b<n;b+=r)p[0]=e[b],p[1]=e[b+1],S=Kb(c,p),S!==w?(x&&(a[l++]=u,a[l++]=f,x=!1),a[l++]=p[0],a[l++]=p[1]):S===ps.INTERSECTING?(a[l++]=p[0],a[l++]=p[1],x=!1):x=!0,u=p[0],f=p[1],w=S;return(s&&x||b===t+r)&&(a[l++]=u,a[l++]=f),l}drawCustomCoordinates_(e,t,n,r,s){for(let o=0,a=n.length;o<a;++o){let l=n[o],c=this.appendFlatLineCoordinates(e,t,l,r,!1,!1);s.push(c),t=l}return t}drawCustom(e,t,n,r,s){this.beginGeometry(e,t,s);let o=e.getType(),a=e.getStride(),l=this.coordinates.length,c,u,f,p,x;switch(o){case"MultiPolygon":c=e.getOrientedFlatCoordinates(),p=[];let b=e.getEndss();x=0;for(let w=0,S=b.length;w<S;++w){let T=[];x=this.drawCustomCoordinates_(c,x,b[w],a,T),p.push(T)}this.instructions.push([An.CUSTOM,l,p,e,n,_x,s]),this.hitDetectionInstructions.push([An.CUSTOM,l,p,e,r||n,_x,s]);break;case"Polygon":case"MultiLineString":f=[],c=o=="Polygon"?e.getOrientedFlatCoordinates():e.getFlatCoordinates(),x=this.drawCustomCoordinates_(c,0,e.getEnds(),a,f),this.instructions.push([An.CUSTOM,l,f,e,n,yg,s]),this.hitDetectionInstructions.push([An.CUSTOM,l,f,e,r||n,yg,s]);break;case"LineString":case"Circle":c=e.getFlatCoordinates(),u=this.appendFlatLineCoordinates(c,0,c.length,a,!1,!1),this.instructions.push([An.CUSTOM,l,u,e,n,yu,s]),this.hitDetectionInstructions.push([An.CUSTOM,l,u,e,r||n,yu,s]);break;case"MultiPoint":c=e.getFlatCoordinates(),u=this.appendFlatPointCoordinates(c,a),u>l&&(this.instructions.push([An.CUSTOM,l,u,e,n,yu,s]),this.hitDetectionInstructions.push([An.CUSTOM,l,u,e,r||n,yu,s]));break;case"Point":c=e.getFlatCoordinates(),this.coordinates.push(c[0],c[1]),u=this.coordinates.length,this.instructions.push([An.CUSTOM,l,u,e,n,void 0,s]),this.hitDetectionInstructions.push([An.CUSTOM,l,u,e,r||n,void 0,s]);break;default:}this.endGeometry(t)}beginGeometry(e,t,n){this.beginGeometryInstruction1_=[An.BEGIN_GEOMETRY,t,0,e,n],this.instructions.push(this.beginGeometryInstruction1_),this.beginGeometryInstruction2_=[An.BEGIN_GEOMETRY,t,0,e,n],this.hitDetectionInstructions.push(this.beginGeometryInstruction2_)}finish(){return{instructions:this.instructions,hitDetectionInstructions:this.hitDetectionInstructions,coordinates:this.coordinates}}reverseHitDetectionInstructions(){let e=this.hitDetectionInstructions;e.reverse();let t,n=e.length,r,s,o=-1;for(t=0;t<n;++t)r=e[t],s=r[0],s==An.END_GEOMETRY?o=t:s==An.BEGIN_GEOMETRY&&(r[2]=t,AG(this.hitDetectionInstructions,o,t),o=-1)}fillStyleToState(e,t={}){if(e){let n=e.getColor();t.fillPatternScale=n&&typeof n=="object"&&"src"in n?this.pixelRatio:1,t.fillStyle=ka(n||Ls)??void 0}else t.fillStyle=void 0;return t}strokeStyleToState(e,t={}){if(e){let n=e.getColor();t.strokeStyle=ka(n||No);let r=e.getLineCap();t.lineCap=r!==void 0?r:Tu;let s=e.getLineDash();t.lineDash=s?s.slice():Ga;let o=e.getLineDashOffset();t.lineDashOffset=o||za;let a=e.getLineJoin();t.lineJoin=a!==void 0?a:Eu;let l=e.getWidth();t.lineWidth=l!==void 0?l:rf;let c=e.getMiterLimit();t.miterLimit=c!==void 0?c:tf;let u=e.getOffset();t.strokeOffset=u??Fz,t.lineWidth>this.maxLineWidth&&(this.maxLineWidth=t.lineWidth,this.bufferedMaxExtent_=null)}else t.strokeStyle=void 0,t.lineCap=void 0,t.lineDash=null,t.lineDashOffset=void 0,t.lineJoin=void 0,t.lineWidth=void 0,t.miterLimit=void 0,t.strokeOffset=void 0;return t}setFillStrokeStyle(e,t){let n=this.state;this.fillStyleToState(e,n),this.strokeStyleToState(t,n)}createFill(e){let t=e.fillStyle,n=[An.SET_FILL_STYLE,t];return typeof t!="string"&&n.push(e.fillPatternScale),n}applyStroke(e){this.instructions.push(this.createStroke(e))}createStroke(e){return[An.SET_STROKE_STYLE,e.strokeStyle,e.lineWidth*this.pixelRatio,e.lineCap,e.lineJoin,e.miterLimit,e.lineDash?this.applyPixelRatio(e.lineDash):null,e.lineDashOffset*this.pixelRatio]}updateFillStyle(e,t){let n=e.fillStyle;(n!==void 0&&typeof n!="string"||e.currentFillStyle!=n)&&(this.instructions.push(t.call(this,e)),e.currentFillStyle=n)}updateStrokeStyle(e,t){let n=e.strokeStyle,r=e.lineCap,s=e.lineDash,o=e.lineDashOffset,a=e.lineJoin,l=e.lineWidth,c=e.miterLimit,u=e.strokeOffset;(e.currentStrokeStyle!=n||e.currentLineCap!=r||s!=e.currentLineDash&&!Po(e.currentLineDash,s)||e.currentLineDashOffset!=o||e.currentLineJoin!=a||e.currentLineWidth!=l||e.currentMiterLimit!=c||e.currentStrokeOffset!=u)&&(t.call(this,e),e.currentStrokeStyle=n,e.currentLineCap=r,e.currentLineDash=s,e.currentLineDashOffset=o,e.currentLineJoin=a,e.currentLineWidth=l,e.currentMiterLimit=c,e.currentStrokeOffset=u)}endGeometry(e){this.beginGeometryInstruction1_[2]=this.instructions.length,this.beginGeometryInstruction1_=null,this.beginGeometryInstruction2_[2]=this.hitDetectionInstructions.length,this.beginGeometryInstruction2_=null;let t=[An.END_GEOMETRY,e];this.instructions.push(t),this.hitDetectionInstructions.push(t)}getBufferedMaxExtent(){if(!this.bufferedMaxExtent_&&(this.bufferedMaxExtent_=Qb(this.maxExtent),this.maxLineWidth>0)){let e=this.resolution*(this.maxLineWidth+1)/2;Jm(this.bufferedMaxExtent_,e,this.bufferedMaxExtent_)}return this.bufferedMaxExtent_}},Nu=L5;var D5=class extends Nu{constructor(e,t,n,r){super(e,t,n,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(e,t,n){if(!this.image_||this.maxExtent&&!_c(this.maxExtent,e.getFlatCoordinates()))return;this.beginGeometry(e,t,n);let r=e.getFlatCoordinates(),s=e.getStride(),o=this.coordinates.length,a=this.appendFlatPointCoordinates(r,s);this.instructions.push([An.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([An.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(t)}drawMultiPoint(e,t,n){if(!this.image_)return;this.beginGeometry(e,t,n);let r=e.getFlatCoordinates(),s=[];for(let l=0,c=r.length;l<c;l+=e.getStride())(!this.maxExtent||_c(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([An.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([An.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(t)}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(e,t){let n=e.getAnchor(),r=e.getSize(),s=e.getOrigin();this.imagePixelRatio_=e.getPixelRatio(this.pixelRatio),this.anchorX_=n[0],this.anchorY_=n[1],this.hitDetectionImage_=e.getHitDetectionImage(),this.image_=e.getImage(this.pixelRatio),this.height_=r[1],this.opacity_=e.getOpacity(),this.originX_=s[0],this.originY_=s[1],this.rotateWithView_=e.getRotateWithView(),this.rotation_=e.getRotation(),this.scale_=e.getScaleArray(),this.width_=r[0],this.declutterMode_=e.getDeclutterMode(),this.declutterImageWithText_=t}},wq=D5;var F5=class extends Nu{constructor(e,t,n,r){super(e,t,n,r)}drawFlatCoordinates_(e,t,n,r,s){let o=this.coordinates.length,a=this.appendFlatLineCoordinates(e,t,n,r,!1,!1);return this.instructions.push([An.MOVE_TO_LINE_TO,o,a,s*this.pixelRatio]),this.hitDetectionInstructions.push([An.MOVE_TO_LINE_TO,o,a,s]),n}drawLineString(e,t,n){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(e,t,n),this.hitDetectionInstructions.push([An.SET_STROKE_STYLE,No,r.lineWidth,r.lineCap,r.lineJoin,r.miterLimit,Ga,za],hf);let l=e.getFlatCoordinates(),c=e.getStride();this.drawFlatCoordinates_(l,0,l.length,c,a),this.hitDetectionInstructions.push(Iu),this.endGeometry(t)}drawMultiLineString(e,t,n){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(e,t,n),this.hitDetectionInstructions.push([An.SET_STROKE_STYLE,No,r.lineWidth,r.lineCap,r.lineJoin,r.miterLimit,Ga,za],hf);let l=e.getEnds(),c=e.getFlatCoordinates(),u=e.getStride(),f=0;for(let p=0,x=l.length;p<x;++p)f=this.drawFlatCoordinates_(c,f,l[p],u,a);this.hitDetectionInstructions.push(Iu),this.endGeometry(t)}finish(){let e=this.state;return e.lastStroke!=null&&e.lastStroke!=this.coordinates.length&&this.instructions.push(Iu),this.reverseHitDetectionInstructions(),this.state=null,super.finish()}applyStroke(e){e.lastStroke!=null&&e.lastStroke!=this.coordinates.length&&(this.instructions.push(Iu),e.lastStroke=this.coordinates.length),e.lastStroke=0,super.applyStroke(e),this.instructions.push(hf)}},Sq=F5;var O5=class extends Nu{constructor(e,t,n,r){super(e,t,n,r)}drawFlatCoordinatess_(e,t,n,r,s){let o=this.state,a=o.fillStyle!==void 0,l=o.strokeStyle!==void 0,c=n.length;this.instructions.push(hf),this.hitDetectionInstructions.push(hf);for(let u=0;u<c;++u){let f=n[u],p=this.coordinates.length,x=this.appendFlatLineCoordinates(e,t,f,r,!0,!l);this.instructions.push([An.MOVE_TO_LINE_TO,p,x,s*this.pixelRatio,!0]),this.hitDetectionInstructions.push([An.MOVE_TO_LINE_TO,p,x,s,!0]),l&&(this.instructions.push(N5),this.hitDetectionInstructions.push(N5)),t=f}return a&&(this.instructions.push(Qx),this.hitDetectionInstructions.push(Qx)),l&&(this.instructions.push(Iu),this.hitDetectionInstructions.push(Iu)),t}drawCircle(e,t,n){let r=this.state,s=r.fillStyle,o=r.strokeStyle,a=r.strokeOffset;if(s===void 0&&o===void 0||this.handleStrokeOffset_(()=>this.drawCircle(e,t,n)))return;this.setFillStrokeStyles_(),this.beginGeometry(e,t,n),r.fillStyle!==void 0&&this.hitDetectionInstructions.push([An.SET_FILL_STYLE,Ls]),r.strokeStyle!==void 0&&this.hitDetectionInstructions.push([An.SET_STROKE_STYLE,No,r.lineWidth,r.lineCap,r.lineJoin,r.miterLimit,Ga,za]);let l=e.getFlatCoordinates(),c=e.getStride(),u=this.coordinates.length;this.appendFlatLineCoordinates(l,0,l.length,c,!1,!1);let f=[An.CIRCLE,u,a];this.instructions.push(hf,f),this.hitDetectionInstructions.push(hf,f),r.fillStyle!==void 0&&(this.instructions.push(Qx),this.hitDetectionInstructions.push(Qx)),r.strokeStyle!==void 0&&(this.instructions.push(Iu),this.hitDetectionInstructions.push(Iu)),this.endGeometry(t)}drawPolygon(e,t,n){let r=this.state,s=r.fillStyle,o=r.strokeStyle,a=r.strokeOffset;if(s===void 0&&o===void 0||this.handleStrokeOffset_(()=>this.drawPolygon(e,t,n)))return;this.setFillStrokeStyles_(),this.beginGeometry(e,t,n),r.fillStyle!==void 0&&this.hitDetectionInstructions.push([An.SET_FILL_STYLE,Ls]),r.strokeStyle!==void 0&&this.hitDetectionInstructions.push([An.SET_STROKE_STYLE,No,r.lineWidth,r.lineCap,r.lineJoin,r.miterLimit,Ga,za]);let l=e.getEnds(),c=e.getOrientedFlatCoordinates(),u=e.getStride();this.drawFlatCoordinatess_(c,0,l,u,a),this.endGeometry(t)}drawMultiPolygon(e,t,n){let r=this.state,s=r.fillStyle,o=r.strokeStyle,a=r.strokeOffset;if(s===void 0&&o===void 0||this.handleStrokeOffset_(()=>this.drawMultiPolygon(e,t,n)))return;this.setFillStrokeStyles_(),this.beginGeometry(e,t,n),r.fillStyle!==void 0&&this.hitDetectionInstructions.push([An.SET_FILL_STYLE,Ls]),r.strokeStyle!==void 0&&this.hitDetectionInstructions.push([An.SET_STROKE_STYLE,No,r.lineWidth,r.lineCap,r.lineJoin,r.miterLimit,Ga,za]);let l=e.getEndss(),c=e.getOrientedFlatCoordinates(),u=e.getStride(),f=0;for(let p=0,x=l.length;p<x;++p)f=this.drawFlatCoordinatess_(c,f,l[p],u,a);this.endGeometry(t)}finish(){this.reverseHitDetectionInstructions(),this.state=null;let e=this.tolerance;if(e!==0){let t=this.coordinates;for(let n=0,r=t.length;n<r;++n)t[n]=_d(t[n],e)}return super.finish()}setFillStrokeStyles_(){let e=this.state;this.updateFillStyle(e,this.createFill),this.updateStrokeStyle(e,this.applyStroke)}handleStrokeOffset_(e){let t=this.state,n=t.fillStyle,r=t.strokeStyle,s=t.strokeOffset;return Math.abs(s)>0&&n!==void 0&&r!==void 0?(t.strokeStyle=void 0,t.strokeOffset=0,e(),t.fillStyle=void 0,t.strokeStyle=r,t.strokeOffset=s,e(),t.fillStyle=n,!0):!1}},B5=O5;var U5=0,k5=1;function mle(i,e,t,n,r,s,o,a){let l=o-r,c=a-s,u=0,f=1;if(l===0){if(r<i||r>t)return!1}else{let p=(i-r)/l,x=(t-r)/l;if(p>x){let b=p;p=x,x=b}if(p>u&&(u=p),x<f&&(f=x),u>f)return!1}if(c===0){if(s<e||s>n)return!1}else{let p=(e-s)/c,x=(n-s)/c;if(p>x){let b=p;p=x,x=b}if(p>u&&(u=p),x<f&&(f=x),u>f)return!1}return U5=u,k5=f,!0}function Tq(i,e,t,n){let r=n[0],s=n[1],o=n[2],a=n[3],l=[],c=[],u=!1,f,p,x=0;for(let b=0,w=e.length;b<w;++b){let S=e[b],T=i[x],P=i[x+1],R=!1;for(let C=x+t;C<S;C+=t){let L=i[C],D=i[C+1];if(mle(r,s,o,a,T,P,L,D)){let F=L-T,N=D-P,B=T+U5*F,z=P+U5*N,V=T+k5*F,H=P+k5*N;u&&R&&B===f&&z===p?l.push(V,H):(u&&c.push(l.length),l.push(B,z,V,H),u=!0),f=V,p=H,R=!0}T=L,P=D}x=S}return u&&c.push(l.length),{flatCoordinates:l,ends:c}}function Eq(i,e,t,n,r){let s=[],o=t,a=0,l=e.slice(t,2);for(;a<i&&o+r<n;){let[c,u]=l.slice(-2),f=e[o+r],p=e[o+r+1],x=Math.sqrt((f-c)*(f-c)+(p-u)*(p-u));if(a+=x,a>=i){let b=(i-a+x)/x,w=Ro(c,f,b),S=Ro(u,p,b);l.push(w,S),s.push(l),l=[w,S],a==i&&(o+=r),a=0}else if(a<i)l.push(e[o+r],e[o+r+1]),o+=r;else{let b=x-a,w=Ro(c,f,b/x),S=Ro(u,p,b/x);l.push(w,S),s.push(l),l=[w,S],a=0,o+=r}}return a>0&&s.push(l),s}function Mq(i,e,t,n,r){let s=t,o=t,a=0,l=0,c=t,u,f,p,x,b,w,S,T,P,R;for(f=t;f<n;f+=r){let C=e[f],L=e[f+1];b!==void 0&&(P=C-b,R=L-w,x=Math.sqrt(P*P+R*R),S!==void 0&&(l+=p,u=Math.acos((S*P+T*R)/(p*x)),u>i&&(l>a&&(a=l,s=c,o=f),l=0,c=f-r)),p=x,S=P,T=R),b=C,w=L}return l+=x,l>a?[c,f]:[s,o]}var Jx={left:0,center:.5,right:1,top:0,middle:.5,hanging:.2,alphabetic:.8,ideographic:.8,bottom:1},G5=class extends Nu{constructor(e,t,n,r){super(e,t,n,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[Ls]={fillStyle:Ls},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 e=super.finish();return e.textStates=this.textStates,e.fillStates=this.fillStates,e.strokeStates=this.strokeStates,e}drawText(e,t,n){let r=this.textFillState_,s=this.textStrokeState_,o=this.textState_;if(this.text_===""||!o||!r&&!s)return;let a=this.coordinates,l=a.length,c=e.getType(),u=null,f=e.getStride();if(o.placement==="line"&&(c=="LineString"||c=="MultiLineString"||c=="Polygon"||c=="MultiPolygon")){let p=e.getExtent();if(!_r(this.maxExtent,p))return;let x;if(u=e.getFlatCoordinates(),c=="LineString")x=[u.length];else if(c=="MultiLineString")x=e.getEnds();else if(c=="Polygon")x=e.getEnds().slice(0,1);else if(c=="MultiPolygon"){let T=e.getEndss();x=[];for(let P=0,R=T.length;P<R;++P)x.push(T[P][0])}if((c=="LineString"||c=="MultiLineString")&&!pu(this.getBufferedMaxExtent(),p)){let T=Tq(u,x,f,this.getBufferedMaxExtent());if(u=T.flatCoordinates,x=T.ends,f=2,x.length===0)return}this.beginGeometry(e,t,n);let b=o.repeat,w=b?void 0:o.textAlign,S=0;for(let T=0,P=x.length;T<P;++T){let R;b?R=Eq(b*this.resolution,u,S,x[T],f):R=[u.slice(S,x[T])];for(let C=0,L=R.length;C<L;++C){let D=R[C],F=0,N=D.length;if(w==null){let z=Mq(o.maxAngle,D,0,D.length,2);F=z[0],N=z[1]}for(let z=F;z<N;z+=f)a.push(D[z],D[z+1]);let B=a.length;S=x[T],this.drawChars_(l,B),l=B}}this.endGeometry(t)}else{let p=o.overflow?null:[];switch(c){case"Point":case"MultiPoint":u=e.getFlatCoordinates();break;case"LineString":u=e.getFlatMidpoint();break;case"Circle":u=e.getCenter();break;case"MultiLineString":u=e.getFlatMidpoints(),f=2;break;case"Polygon":u=e.getFlatInteriorPoint(),o.overflow||p.push(u[2]/this.resolution),f=3;break;case"MultiPolygon":let C=e.getFlatInteriorPoints();u=[];for(let L=0,D=C.length;L<D;L+=3)o.overflow||p.push(C[L+2]/this.resolution),u.push(C[L],C[L+1]);if(u.length===0)return;f=2;break;default:}let x=this.appendFlatPointCoordinates(u,f);if(x===l)return;if(p&&(x-l)/2!==u.length/f){let C=l/2;p=p.filter((L,D)=>{let F=a[(C+D)*2]===u[D*f]&&a[(C+D)*2+1]===u[D*f+1];return F||--C,F})}this.saveTextStates_();let b=o.backgroundFill?this.createFill(this.fillStyleToState(o.backgroundFill)):null,w=o.backgroundStroke?this.createStroke(this.strokeStyleToState(o.backgroundStroke)):null;this.beginGeometry(e,t,n);let S=o.padding;if(S!=nf&&(o.scale[0]<0||o.scale[1]<0)){let C=o.padding[0],L=o.padding[1],D=o.padding[2],F=o.padding[3];o.scale[0]<0&&(L=-L,F=-F),o.scale[1]<0&&(C=-C,D=-D),S=[C,L,D,F]}let T=this.pixelRatio;this.instructions.push([An.DRAW_IMAGE,l,x,null,NaN,NaN,NaN,1,0,0,this.textRotateWithView_,this.textRotation_,[1,1],NaN,this.declutterMode_,this.declutterImageWithText_,S==nf?nf:S.map(function(C){return C*T}),b,w,this.text_,this.textKey_,this.strokeKey_,this.fillKey_,this.textOffsetX_,this.textOffsetY_,p]);let P=1/T,R=b?b.slice(0):null;R&&(R[1]=Ls),this.hitDetectionInstructions.push([An.DRAW_IMAGE,l,x,null,NaN,NaN,NaN,1,0,0,this.textRotateWithView_,this.textRotation_,[P,P],NaN,this.declutterMode_,this.declutterImageWithText_,S,R,w,this.text_,this.textKey_,this.strokeKey_,this.fillKey_?Ls:this.fillKey_,this.textOffsetX_,this.textOffsetY_,p]),this.endGeometry(t)}}saveTextStates_(){let e=this.textStrokeState_,t=this.textState_,n=this.textFillState_,r=this.strokeKey_;e&&(r in this.strokeStates||(this.strokeStates[r]={strokeStyle:e.strokeStyle,lineCap:e.lineCap,lineDashOffset:e.lineDashOffset,lineWidth:e.lineWidth,lineJoin:e.lineJoin,miterLimit:e.miterLimit,lineDash:e.lineDash}));let s=this.textKey_;s in this.textStates||(this.textStates[s]={font:t.font,textAlign:t.textAlign||wd,justify:t.justify,textBaseline:t.textBaseline||X0,scale:t.scale});let o=this.fillKey_;n&&(o in this.fillStates||(this.fillStates[o]={fillStyle:n.fillStyle}))}drawChars_(e,t){let n=this.textStrokeState_,r=this.textState_,s=this.strokeKey_,o=this.textKey_,a=this.fillKey_;this.saveTextStates_();let l=this.pixelRatio,c=Jx[r.textBaseline],u=this.textOffsetX_*l,f=this.textOffsetY_*l,p=this.text_,x=n?n.lineWidth*Math.abs(r.scale[0])/2:0;this.instructions.push([An.DRAW_CHARS,e,t,c,r.overflow,a,r.maxAngle,l,f,s,x*l,p,o,1,this.declutterMode_,this.textKeepUpright_,u]),this.hitDetectionInstructions.push([An.DRAW_CHARS,e,t,c,r.overflow,a&&Ls,r.maxAngle,l,f,s,x*l,p,o,1/l,this.declutterMode_,this.textKeepUpright_,u])}setTextStyle(e,t){let n,r,s;if(!e)this.text_="";else{let o=e.getFill();o?(r=this.textFillState_,r||(r={},this.textFillState_=r),r.fillStyle=ka(o.getColor()||Ls)):(r=null,this.textFillState_=r);let a=e.getStroke();if(!a)s=null,this.textStrokeState_=s;else{s=this.textStrokeState_,s||(s={},this.textStrokeState_=s);let w=a.getLineDash(),S=a.getLineDashOffset(),T=a.getWidth(),P=a.getMiterLimit();s.lineCap=a.getLineCap()||Tu,s.lineDash=w?w.slice():Ga,s.lineDashOffset=S===void 0?za:S,s.lineJoin=a.getLineJoin()||Eu,s.lineWidth=T===void 0?rf:T,s.miterLimit=P===void 0?tf:P,s.strokeStyle=ka(a.getColor()||No)}n=this.textState_;let l=e.getFont()||jw;Oz(l);let c=e.getScaleArray();n.overflow=e.getOverflow(),n.font=l,n.maxAngle=e.getMaxAngle(),n.placement=e.getPlacement(),n.textAlign=e.getTextAlign(),n.repeat=e.getRepeat(),n.justify=e.getJustify(),n.textBaseline=e.getTextBaseline()||X0,n.backgroundFill=e.getBackgroundFill(),n.backgroundStroke=e.getBackgroundStroke(),n.padding=e.getPadding()||nf,n.scale=c===void 0?[1,1]:c;let u=e.getOffsetX(),f=e.getOffsetY(),p=e.getRotateWithView(),x=e.getKeepUpright(),b=e.getRotation();this.text_=e.getText()||"",this.textOffsetX_=u===void 0?0:u,this.textOffsetY_=f===void 0?0:f,this.textRotateWithView_=p===void 0?!1:p,this.textKeepUpright_=x===void 0?!0:x,this.textRotation_=b===void 0?0:b,this.strokeKey_=s?(typeof s.strokeStyle=="string"?s.strokeStyle:Nn(s.strokeStyle))+s.lineCap+s.lineDashOffset+"|"+s.lineWidth+s.lineJoin+s.miterLimit+"["+s.lineDash.join()+"]":"",this.textKey_=n.font+n.scale+(n.textAlign||"?")+(n.repeat||"?")+(n.justify||"?")+(n.textBaseline||"?"),this.fillKey_=r&&r.fillStyle?typeof r.fillStyle=="string"?r.fillStyle:"|"+Nn(r.fillStyle):""}this.declutterMode_=e.getDeclutterMode(),this.declutterImageWithText_=t}},Cq=G5;var gle={Circle:B5,Default:Nu,Image:wq,LineString:Sq,Polygon:B5,Text:Cq},z5=class{constructor(e,t,n,r){this.tolerance_=e,this.maxExtent_=t,this.pixelRatio_=r,this.resolution_=n,this.buildersByZIndex_={}}finish(){let e={};for(let t in this.buildersByZIndex_){e[t]=e[t]||{};let n=this.buildersByZIndex_[t];for(let r in n){let s=n[r].finish();e[t][r]=s}}return e}getBuilder(e,t){let n=e!==void 0?e.toString():"0",r=this.buildersByZIndex_[n];r===void 0&&(r={},this.buildersByZIndex_[n]=r);let s=r[t];if(s===void 0){let o=gle[t];s=new o(this.tolerance_,this.maxExtent_,this.resolution_,this.pixelRatio_),r[t]=s}return s}},Rq=z5;function Pq(i,e,t,n){let r=i[e],s=i[e+1],o=0;for(let a=e+n;a<t;a+=n){let l=i[a],c=i[a+1];o+=Math.sqrt((l-r)*(l-r)+(c-s)*(c-s)),r=l,s=c}return o}function PS(i,e,t,n,r,s,o,a){o=o??[],a=a??n;let l=i[e+n],c=i[e+n+1],u=i[t-2*n],f=i[t-2*n+1],p,x,b,w,S,T,P,R,C=0;for(let L=e;L<t;L+=n){b=p,w=x,S=void 0,T=void 0,L+n<t&&(S=i[L+n],T=i[L+n+1]),s&&L===e&&(b=u,w=f),s&&L===t-n&&(S=l,T=c),p=i[L],x=i[L+1],[P,R]=_le(p,x,b,w,S,T,r),o[C++]=P,o[C++]=R;for(let D=2;D<a;D++)o[C++]=i[L+D]}return o.length!=C&&(o.length=C),o}function _le(i,e,t,n,r,s,o){let a,l;t!==void 0&&n!==void 0?(a=i-t,l=e-n):r!==void 0&&s!==void 0?(a=r-i,l=s-e):(a=1,l=0);let c=Math.hypot(a,l),u=a/c,f=l/c;if(a=-f,l=u,t===void 0||n===void 0)return[i+a*o,e+l*o];if(r===void 0||s===void 0)return[i+a*o,e+l*o];let p=H9([i,e],[t,n],[r,s]);if(Math.cos(p)>.998)return[i+u*o,e+f*o];let x=Math.cos(p/2),b=Math.sin(p/2),w=b*a+x*l,S=-x*a+b*l,T=w*(1/b),P=S*(1/b);return[i+T*o,e+P*o]}function IS(i,e,t=!1){for(let n=0,r=i.length-2;n<r;n+=e){let s=t&&n===0?i.length-3*e:i.length-2*e;for(let o=s;o>n+e;o-=e){let a=i[n],l=i[n+1],c=i[n+e],u=i[n+e+1],f=i[o],p=i[o+1],x=i[o+e],b=i[o+e+1],w=(b-p)*(c-a)-(x-f)*(u-l);if(w===0)continue;let S=((x-f)*(l-p)-(b-p)*(a-f))/w,T=((c-a)*(l-p)-(u-l)*(a-f))/w;if(S>0&&S<1&&T>0&&T<1){let P=a+S*(c-a),R=l+S*(u-l);i[n+e]=P,i[n+e+1]=R,i.splice(n+2*e,o-n-e);break}}}return i}var V5;function xle(){return V5||(V5=new Intl.Segmenter(void 0,{granularity:"grapheme"})),V5}function Iq(i,e,t,n,r,s,o,a,l,c,u,f,p=!0){let x=i[e],b=i[e+1],w=0,S=0,T=0,P=0;function R(){w=x,S=b,e+=n,x=i[e],b=i[e+1],P+=T,T=Math.sqrt((x-w)*(x-w)+(b-S)*(b-S))}do R();while(e<t-n&&P+T<s);let C=T===0?0:(s-P)/T,L=Ro(w,x,C),D=Ro(S,b,C),F=e-n,N=P,B=s+a*l(c,r,u);for(;e<t-n&&P+T<B;)R();C=T===0?0:(B-P)/T;let z=Ro(w,x,C),V=Ro(S,b,C),H=!1;if(p)if(f){let ae=[L,D,z,V];Iw(ae,0,4,2,f,ae,ae),H=ae[0]>ae[2]}else H=L>z;let Z=Math.PI,J=[],j=F+n===e;e=F,T=0,P=N,x=i[e],b=i[e+1];let K;if(j){R(),K=Math.atan2(b-S,x-w),H&&(K+=K>0?-Z:Z);let ae=(z+L)/2,ce=(V+D)/2;return J[0]=[ae,ce,(B-s)/2,K,r],J}r=r.replace(/\n/g," ");let ee=Array.from(xle().segment(r),ae=>ae.segment);for(let ae=0,ce=ee.length;ae<ce;){R();let de=Math.atan2(b-S,x-w);if(H&&(de+=de>0?-Z:Z),K!==void 0){let Me=de-K;if(Me+=Me>Z?-2*Z:Me<-Z?2*Z:0,Math.abs(Me)>o)return null}K=de;let ve=ae,Ie=0;for(;ae<ce;++ae){let Me=H?ce-ae-1:ae,ze=a*l(c,ee[Me],u);if(e+n<t&&P+T<s+Ie+ze/2)break;Ie+=ze}if(ae===ve)continue;let Qe=(H?ee.slice(ce-ae,ce-ve):ee.slice(ve,ae)).join("");C=T===0?0:(s+Ie/2-P)/T;let Ue=Ro(w,x,C),mt=Ro(S,b,C);J.push([Ue,mt,Ie/2,de,Qe]),s+=Ie}return J}var Gg=Er(),Cd=[],ff=[],df=[],Rd=[];function Nq(i){return i[3].declutterBox}var Lq=new RegExp("[\u0591-\u08FF\uFB1D-\uFDFF\uFE70-\uFEFC\u0800-\u0FFF\uE800-\uEFFF]");function q5(i,e){return e==="start"?e=Lq.test(i)?"right":"left":e==="end"&&(e=Lq.test(i)?"left":"right"),Jx[e]}function yle(i,e,t){return t>0&&i.push(`7+`,""),i.push(e,""),i}function vle(i,e,t){return t%2===0&&(i+=e),i}var H5=class{constructor(e,t,n,r,s){this.overlaps=n,this.pixelRatio=t,this.resolution=e,this.alignAndScaleFill_,this.instructions=r.instructions,this.coordinates=r.coordinates,this.coordinateCache_={},this.renderedTransform_=Xs(),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 MS:null}getZIndexContext(){return this.zIndexContext_}createLabel(e,t,n,r){let s=e+t+n+r;if(this.labels_[s])return this.labels_[s];let o=r?this.strokeStates[r]:null,a=n?this.fillStates[n]:null,l=this.textStates[t],c=this.pixelRatio,u=[l.scale[0]*c,l.scale[1]*c],f=l.justify?Jx[l.justify]:q5(Array.isArray(e)?e[0]:e,l.textAlign||wd),p=r&&o.lineWidth?o.lineWidth:0,x=Array.isArray(e)?e:String(e).split(`8+`).reduce(yle,[]),{width:b,height:w,widths:S,heights:T,lineWidths:P}=kz(l,x),R=b+p,C=[],L=(R+2)*u[0],D=(w+p)*u[1],F={width:L<0?Math.floor(L):Math.ceil(L),height:D<0?Math.floor(D):Math.ceil(D),contextInstructions:C};(u[0]!=1||u[1]!=1)&&C.push("scale",u),r&&(C.push("strokeStyle",o.strokeStyle),C.push("lineWidth",p),C.push("lineCap",o.lineCap),C.push("lineJoin",o.lineJoin),C.push("miterLimit",o.miterLimit),C.push("setLineDash",[o.lineDash]),C.push("lineDashOffset",o.lineDashOffset)),n&&C.push("fillStyle",a.fillStyle),C.push("textBaseline","middle"),C.push("textAlign","center");let N=.5-f,B=f*R+N*p,z=[],V=[],H=0,Z=0,J=0,j=0,K;for(let ee=0,ae=x.length;ee<ae;ee+=2){let ce=x[ee];if(ce===`9+`){Z+=H,H=0,B=f*R+N*p,++j;continue}let de=x[ee+1]||l.font;de!==K&&(r&&z.push("font",de),n&&V.push("font",de),K=de),H=Math.max(H,T[J]);let ve=[ce,B+N*S[J]+f*(S[J]-P[j]),.5*(p+H)+Z];B+=S[J],r&&z.push("strokeText",ve),n&&V.push("fillText",ve),++J}return Array.prototype.push.apply(C,z),Array.prototype.push.apply(C,V),this.labels_[s]=F,F}replayTextBackground_(e,t,n,r,s,o,a){e.beginPath(),e.moveTo.apply(e,t),e.lineTo.apply(e,n),e.lineTo.apply(e,r),e.lineTo.apply(e,s),e.lineTo.apply(e,t),o&&(this.alignAndScaleFill_=o[2],e.fillStyle=o[1],this.fill_(e)),a&&(this.setStrokeStyle_(e,a),e.stroke())}calculateImageOrLabelDimensions_(e,t,n,r,s,o,a,l,c,u,f,p,x,b,w,S){a*=p[0],l*=p[1];let T=n-a,P=r-l,R=s+c>e?e-c:s,C=o+u>t?t-u:o,L=b[3]+R*p[0]+b[1],D=b[0]+C*p[1]+b[2],F=T-b[3],N=P-b[0];(w||f!==0)&&(Cd[0]=F,Rd[0]=F,Cd[1]=N,ff[1]=N,ff[0]=F+L,df[0]=ff[0],df[1]=N+D,Rd[1]=df[1]);let B;return f!==0?(B=ao(Xs(),n,r,1,1,f,-n,-r),Mr(B,Cd),Mr(B,ff),Mr(B,df),Mr(B,Rd),al(Math.min(Cd[0],ff[0],df[0],Rd[0]),Math.min(Cd[1],ff[1],df[1],Rd[1]),Math.max(Cd[0],ff[0],df[0],Rd[0]),Math.max(Cd[1],ff[1],df[1],Rd[1]),Gg)):al(Math.min(F,F+L),Math.min(N,N+D),Math.max(F,F+L),Math.max(N,N+D),Gg),x&&(T=Math.round(T),P=Math.round(P)),{drawImageX:T,drawImageY:P,drawImageW:R,drawImageH:C,originX:c,originY:u,declutterBox:{minX:Gg[0],minY:Gg[1],maxX:Gg[2],maxY:Gg[3],value:S},canvasTransform:B,scale:p}}replayImageOrLabel_(e,t,n,r,s,o,a){let l=!!(o||a),c=r.declutterBox,u=a?a[2]*r.scale[0]/2:0;return c.minX-u<=t[0]&&c.maxX+u>=0&&c.minY-u<=t[1]&&c.maxY+u>=0&&(l&&this.replayTextBackground_(e,Cd,ff,df,Rd,o,a),Gz(e,r.canvasTransform,s,n,r.originX,r.originY,r.drawImageW,r.drawImageH,r.drawImageX,r.drawImageY,r.scale)),!0}fill_(e){let t=this.alignAndScaleFill_;if(t){let n=Mr(this.renderedTransform_,[0,0]),r=512*this.pixelRatio;e.save(),e.translate(n[0]%r,n[1]%r),t!==1&&e.scale(t,t)}e.fill(),t&&e.restore()}setStrokeStyle_(e,t){e.strokeStyle=t[1],t[1]&&(e.lineWidth=t[2],e.lineCap=t[3],e.lineJoin=t[4],e.miterLimit=t[5],e.lineDashOffset=t[7],e.setLineDash(t[6]))}drawLabelWithPointPlacement_(e,t,n,r){let s=this.textStates[t],o=this.createLabel(e,t,r,n),a=this.strokeStates[n],l=this.pixelRatio,c=q5(Array.isArray(e)?e[0]:e,s.textAlign||wd),u=Jx[s.textBaseline||X0],f=a&&a.lineWidth?a.lineWidth:0,p=o.width/l-2*s.scale[0],x=c*p+2*(.5-c)*f,b=u*o.height/l+2*(.5-u)*f;return{label:o,anchorX:x,anchorY:b}}execute_(e,t,n,r,s,o,a,l){let c=this.zIndexContext_,u;this.pixelCoordinates_&&Po(n,this.renderedTransform_)?u=this.pixelCoordinates_:(this.pixelCoordinates_||(this.pixelCoordinates_=[]),u=Ua(this.coordinates,0,this.coordinates.length,2,n,this.pixelCoordinates_),GG(this.renderedTransform_,n));let f=0,p=r.length,x=0,b,w=[],S,T,P,R,C,L,D,F,N,B,z,V,H,Z=0,J=0,j=this.coordinateCache_,K=this.viewRotation_,ee=Math.round(Math.atan2(-n[1],n[0])*1e12)/1e12,ae={context:e,pixelRatio:this.pixelRatio,resolution:this.resolution,rotation:K},ce=this.instructions!=r||this.overlaps?0:200,de,ve,Ie,Qe;for(;f<p;){let Ue=r[f];switch(Ue[0]){case An.BEGIN_GEOMETRY:de=Ue[1],Qe=Ue[3],de.getGeometry()?a!==void 0&&!_r(a,Qe.getExtent())?f=Ue[2]+1:++f:f=Ue[2],c&&(c.zIndex=Ue[4]);break;case An.BEGIN_PATH:Z>ce&&(this.fill_(e),Z=0),J>ce&&(e.stroke(),J=0),!Z&&!J&&(e.beginPath(),C=NaN,L=NaN),++f;break;case An.CIRCLE:x=Ue[1],P=Ue[2]??0;let Me=u[x],ze=u[x+1],$e=u[x+2]-P,Et=u[x+3]-P,Tt=$e-Me,Ct=Et-ze,un=Math.sqrt(Tt*Tt+Ct*Ct);e.moveTo(Me+un,ze),e.arc(Me,ze,un,0,2*Math.PI,!0),++f;break;case An.CLOSE_PATH:e.closePath(),++f;break;case An.CUSTOM:x=Ue[1],b=Ue[2];let Gt=Ue[3],Xe=Ue[4],st=Ue[5];ae.geometry=Gt,ae.feature=de,f in j||(j[f]=[]);let tt=j[f];st?st(u,x,b,2,tt):(tt[0]=u[x],tt[1]=u[x+1],tt.length=2),c&&(c.zIndex=Ue[6]),Xe(tt,ae),++f;break;case An.DRAW_IMAGE:x=Ue[1],b=Ue[2],N=Ue[3],S=Ue[4],T=Ue[5];let vt=Ue[6],yt=Ue[7],ln=Ue[8],Kt=Ue[9],Qt=Ue[10],xn=Ue[11],ge=Ue[12],di=Ue[13];R=Ue[14]||"declutter";let On=Ue[15];if(!N&&Ue.length>=20){B=Ue[19],z=Ue[20],V=Ue[21],H=Ue[22];let In=this.drawLabelWithPointPlacement_(B,z,V,H);N=In.label,Ue[3]=N;let Ur=Ue[23];S=(In.anchorX-Ur)*this.pixelRatio,Ue[4]=S;let mr=Ue[24];T=(In.anchorY-mr)*this.pixelRatio,Ue[5]=T,vt=N.height,Ue[6]=vt,di=N.width,Ue[13]=di}let le;Ue.length>25&&(le=Ue[25]);let X,Te,Pe;Ue.length>17?(X=Ue[16],Te=Ue[17],Pe=Ue[18]):(X=nf,Te=null,Pe=null),Qt&&ee?xn+=K:!Qt&&!ee&&(xn-=K);let Ve=0;for(;x<b;x+=2){if(le&&le[Ve++]<di/this.pixelRatio)continue;let In=this.calculateImageOrLabelDimensions_(N.width,N.height,u[x],u[x+1],di,vt,S,T,ln,Kt,xn,ge,s,X,!!Te||!!Pe,de),Ur=[e,t,N,In,yt,Te,Pe];if(l){let mr,nl,Jo;if(On){let sr=b-x;if(!On[sr]){On[sr]={args:Ur,declutterMode:R};continue}let Cs=On[sr];mr=Cs.args,nl=Cs.declutterMode,delete On[sr],Jo=Nq(mr)}let il,Pa;if(mr&&(nl!=="declutter"||!l.collides(Jo))&&(il=!0),(R!=="declutter"||!l.collides(In.declutterBox))&&(Pa=!0),nl==="declutter"&&R==="declutter"){let sr=il&&Pa;il=sr,Pa=sr}il&&(nl!=="none"&&l.insert(Jo),this.replayImageOrLabel_.apply(this,mr)),Pa&&(R!=="none"&&l.insert(In.declutterBox),this.replayImageOrLabel_.apply(this,Ur))}else this.replayImageOrLabel_.apply(this,Ur)}++f;break;case An.DRAW_CHARS:let gt=Ue[1],St=Ue[2],qe=Ue[3],Ke=Ue[4];H=Ue[5];let Rt=Ue[6],en=Ue[7],Pt=Ue[8];V=Ue[9];let Mt=Ue[10];B=Ue[11],Array.isArray(B)&&(B=B.reduce(vle,"")),z=Ue[12];let cn=[Ue[13],Ue[13]];R=Ue[14]||"declutter";let yn=Ue[15],Rn=Ue[16],xe=this.textStates[z],bt=xe.font,Ye=[xe.scale[0]*en,xe.scale[1]*en],wt;bt in this.widths_?wt=this.widths_[bt]:(wt={},this.widths_[bt]=wt);let Dt=Pq(u,gt,St,2),ct=Math.abs(Ye[0])*tI(bt,B,wt);if(Ke||ct<=Dt){let In=this.textStates[z].textAlign,Ur=(Dt-ct)*q5(B,In),mr=Iq(u,gt,St,2,B,Ur,Rt,Math.abs(Ye[0]),tI,bt,wt,ee?0:this.viewRotation_,yn);e:if(mr){let nl=[],Jo,il,Pa,sr,Cs;if(V)for(Jo=0,il=mr.length;Jo<il;++Jo){Cs=mr[Jo],Pa=Cs[4],sr=this.createLabel(Pa,z,"",V),S=Cs[2]+(Ye[0]<0?-Mt:Mt)-Rn,T=qe*sr.height+(.5-qe)*2*Mt*Ye[1]/Ye[0]-Pt;let rl=this.calculateImageOrLabelDimensions_(sr.width,sr.height,Cs[0],Cs[1],sr.width,sr.height,S,T,0,0,Cs[3],cn,!1,nf,!1,de);if(l&&R==="declutter"&&l.collides(rl.declutterBox))break e;nl.push([e,t,sr,rl,1,null,null])}if(H)for(Jo=0,il=mr.length;Jo<il;++Jo){Cs=mr[Jo],Pa=Cs[4],sr=this.createLabel(Pa,z,H,""),S=Cs[2]-Rn,T=qe*sr.height-Pt;let rl=this.calculateImageOrLabelDimensions_(sr.width,sr.height,Cs[0],Cs[1],sr.width,sr.height,S,T,0,0,Cs[3],cn,!1,nf,!1,de);if(l&&R==="declutter"&&l.collides(rl.declutterBox))break e;nl.push([e,t,sr,rl,1,null,null])}l&&R!=="none"&&l.load(nl.map(Nq));for(let rl=0,hu=nl.length;rl<hu;++rl)this.replayImageOrLabel_.apply(this,nl[rl])}}++f;break;case An.END_GEOMETRY:if(o!==void 0){de=Ue[1];let In=o(de,Qe,R);if(In)return In}++f;break;case An.FILL:ce?Z++:this.fill_(e),++f;break;case An.MOVE_TO_LINE_TO:x=Ue[1],b=Ue[2],P=Ue[3];let Ce,jt,qi;if(P){let Ur=(Ue[4]??!1)||Math.abs(u[x]-u[b-2])<1e-6&&Math.abs(u[x+1]-u[b-1])<1e-6;PS(u,x,b,2,P,Ur,w),IS(w,2,Ur),Ce=w,jt=0,qi=Ce.length}else Ce=u,jt=x,qi=b;ve=Ce[jt],Ie=Ce[jt+1],e.moveTo(ve,Ie),C=ve+.5|0,L=Ie+.5|0;for(let In=jt+2;In<qi;In+=2)ve=Ce[In],Ie=Ce[In+1],D=ve+.5|0,F=Ie+.5|0,(In==qi-2||D!==C||F!==L)&&(e.lineTo(ve,Ie),C=D,L=F);++f;break;case An.SET_FILL_STYLE:this.alignAndScaleFill_=Ue[2],Z?(this.fill_(e),Z=0,J&&(e.stroke(),J=0)):J&&Ue[1]&&(e.stroke(),J=0),e.fillStyle=Ue[1],++f;break;case An.SET_STROKE_STYLE:Z&&Ue[1]&&(this.fill_(e),Z=0),J&&(e.stroke(),J=0),this.setStrokeStyle_(e,Ue),++f;break;case An.STROKE:ce?J++:e.stroke(),++f;break;default:++f;break}}Z&&this.fill_(e),J&&e.stroke()}execute(e,t,n,r,s,o){this.viewRotation_=r,this.execute_(e,t,n,this.instructions,s,void 0,void 0,o)}executeHitDetection(e,t,n,r,s){return this.viewRotation_=n,this.execute_(e,[e.canvas.width,e.canvas.height],t,this.hitDetectionInstructions,!0,r,s)}},Dq=H5;var Pd=["Polygon","Circle","LineString","Image","Text","Default"],X5=["Image","Text"],Fq=Pd.filter(i=>!X5.includes(i)),Oq=!1,Bq=!1;function ble(){let i=0,e=n=>{let r=Si(1,1,null,{willReadFrequently:n}),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 i=s>i?s:i,s};Oq={[e(!0)]:!0,[e(!1)]:!1,[e(void 0)]:void 0}[i],Bq=!0}var j5=class{constructor(e,t,n,r,s,o,a){this.maxExtent_=e,this.overlaps_=r,this.pixelRatio_=n,this.resolution_=t,this.renderBuffer_=o,this.executorsByZIndex_={},this.hitDetectionContext_=null,this.hitDetectionTransform_=Xs(),this.renderedContext_=null,this.deferredZIndexContexts_={},this.createExecutors_(s,a)}clip(e,t){let n=this.getClipCoords(t);e.beginPath(),e.moveTo(n[0],n[1]),e.lineTo(n[2],n[3]),e.lineTo(n[4],n[5]),e.lineTo(n[6],n[7]),e.clip()}createExecutors_(e,t){for(let n in e){let r=this.executorsByZIndex_[n];r===void 0&&(r={},this.executorsByZIndex_[n]=r);let s=e[n];for(let o in s){let a=s[o];r[o]=new Dq(this.resolution_,this.pixelRatio_,this.overlaps_,a,t)}}}hasExecutors(e){for(let t in this.executorsByZIndex_){let n=this.executorsByZIndex_[t];for(let r=0,s=e.length;r<s;++r)if(e[r]in n)return!0}return!1}forEachFeatureAtCoordinate(e,t,n,r,s,o){Bq===!1&&ble(),r=Math.round(r);let a=r*2+1,l=ao(this.hitDetectionTransform_,r+.5,r+.5,1/t,-1/t,-n,-e[0],-e[1]),c=!this.hitDetectionContext_;c&&(this.hitDetectionContext_=Si(a,a,null,{willReadFrequently:Oq}));let u=this.hitDetectionContext_;u.canvas.width!==a||u.canvas.height!==a?(u.canvas.width=a,u.canvas.height=a):c||u.clearRect(0,0,a,a);let f;this.renderBuffer_!==void 0&&(f=Er(),N0(f,e),Jm(f,t*(this.renderBuffer_+r),f));let p=wle(r),x;function b(L,D,F){let N=u.getImageData(0,0,a,a).data;for(let B=0,z=p.length;B<z;B++)if(N[p[B]]>0){if(!o||F==="none"||x!=="Image"&&x!=="Text"||o.includes(L)){let V=(p[B]-3)/4,H=r-V%a,Z=r-(V/a|0),J=s(L,D,H*H+Z*Z);if(J)return J}u.clearRect(0,0,a,a);break}}let w=Object.keys(this.executorsByZIndex_).map(Number);w.sort(Ba);let S,T,P,R,C;for(S=w.length-1;S>=0;--S){let L=w[S].toString();for(P=this.executorsByZIndex_[L],T=Pd.length-1;T>=0;--T)if(x=Pd[T],R=P[x],R!==void 0&&(C=R.executeHitDetection(u,l,n,b,f),C))return C}}getClipCoords(e){let t=this.maxExtent_;if(!t)return null;let n=t[0],r=t[1],s=t[2],o=t[3],a=[n,r,n,o,s,o,s,r];return Ua(a,0,8,2,e,a),a}isEmpty(){return vc(this.executorsByZIndex_)}execute(e,t,n,r,s,o,a){let l=Object.keys(this.executorsByZIndex_).map(Number);l.sort(a?pG:Ba),o=o||Pd;let c=Pd.length;for(let u=0,f=l.length;u<f;++u){let p=l[u].toString(),x=this.executorsByZIndex_[p];for(let b=0,w=o.length;b<w;++b){let S=o[b],T=x[S];if(T!==void 0){let P=a===null?void 0:T.getZIndexContext(),R=P?P.getContext():e,C=this.maxExtent_&&S!=="Image"&&S!=="Text";if(C&&(R.save(),this.clip(R,n)),!P||S==="Text"||S==="Image"?T.execute(R,t,n,r,s,a):P.pushFunction(L=>T.execute(L,t,n,r,s,a)),C&&R.restore(),P){P.offset();let L=l[u]*c+Pd.indexOf(S);this.deferredZIndexContexts_[L]||(this.deferredZIndexContexts_[L]=[]),this.deferredZIndexContexts_[L].push(P)}}}}this.renderedContext_=e}getDeferredZIndexContexts(){return this.deferredZIndexContexts_}getRenderedContext(){return this.renderedContext_}renderDeferred(){let e=this.deferredZIndexContexts_,t=Object.keys(e).map(Number).sort(Ba);for(let n=0,r=t.length;n<r;++n)e[t[n]].forEach(s=>{s.draw(this.renderedContext_),s.clear()}),e[t[n]].length=0}},W5={};function wle(i){if(W5[i]!==void 0)return W5[i];let e=i*2+1,t=i*i,n=new Array(t+1);for(let s=0;s<=i;++s)for(let o=0;o<=i;++o){let a=s*s+o*o;if(a>t)break;let l=n[a];l||(l=[],n[a]=l),l.push(((i+s)*e+(i+o))*4+3),s>0&&l.push(((i-s)*e+(i+o))*4+3),o>0&&(l.push(((i+s)*e+(i-o))*4+3),s>0&&l.push(((i-s)*e+(i-o))*4+3))}let r=[];for(let s=0,o=n.length;s<o;++s)n[s]&&r.push(...n[s]);return W5[i]=r,r}var Uq=j5;var $5=class extends RS{constructor(e,t,n,r,s,o,a){super(),this.context_=e,this.pixelRatio_=t,this.extent_=n,this.transform_=r,this.transformRotation_=r?L0(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_=Xs()}drawImages_(e,t,n,r){if(!this.image_)return;let s=Ua(e,t,n,r,this.transform_,this.pixelCoordinates_),o=this.context_,a=this.tmpLocalTransform_,l=o.globalAlpha;this.imageOpacity_!=1&&(o.globalAlpha=l*this.imageOpacity_);let c=this.imageRotation_;this.transformRotation_===0&&(c-=this.viewRotation_),this.imageRotateWithView_&&(c+=this.viewRotation_);for(let u=0,f=s.length;u<f;u+=2){let p=s[u]-this.imageAnchorX_,x=s[u+1]-this.imageAnchorY_;if(c!==0||this.imageScale_[0]!=1||this.imageScale_[1]!=1){let b=p+this.imageAnchorX_,w=x+this.imageAnchorY_;ao(a,b,w,1,1,c,-b,-w),o.save(),o.transform.apply(o,a),o.translate(b,w),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_,p,x,this.imageWidth_,this.imageHeight_)}this.imageOpacity_!=1&&(o.globalAlpha=l)}drawText_(e,t,n,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=Ua(e,t,n,r,this.transform_,this.pixelCoordinates_),o=this.context_,a=this.textRotation_;for(this.transformRotation_===0&&(a-=this.viewRotation_),this.textRotateWithView_&&(a+=this.viewRotation_);t<n;t+=r){let l=s[t]+this.textOffsetX_,c=s[t+1]+this.textOffsetY_;a!==0||this.textScale_[0]!=1||this.textScale_[1]!=1?(o.save(),o.translate(l-this.textOffsetX_,c-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,c),this.textFillState_&&o.fillText(this.text_,l,c))}}moveToLineTo_(e,t,n,r,s,o){let a=this.context_,l=Ua(e,t,n,r,this.transform_,this.pixelCoordinates_);if(Math.abs(o)>0){let u=l.length,f=s||Math.abs(l[0]-l[u-2])<1e-6&&Math.abs(l[1]-l[u-1])<1e-6;l=PS(l,0,u,2,o,f,l),IS(l,2,f)}a.moveTo(l[0],l[1]);let c=l.length;s&&(c-=2);for(let u=2;u<c;u+=2)a.lineTo(l[u],l[u+1]);return s&&a.closePath(),n}drawRings_(e,t,n,r,s){for(let o=0,a=n.length;o<a;++o)t=this.moveToLineTo_(e,t,n[o],r,!0,s);return t}drawCircle(e){if(this.squaredTolerance_&&(e=e.simplifyTransformed(this.squaredTolerance_,this.userTransform_)),!!_r(this.extent_,e.getExtent())){if(this.fillState_||this.strokeState_){this.fillState_&&this.setContextFillState_(this.fillState_),this.strokeState_&&this.setContextStrokeState_(this.strokeState_);let t=oz(e,this.transform_,this.pixelCoordinates_),n=t[2]-t[0],r=t[3]-t[1],s=Math.sqrt(n*n+r*r),o=this.context_;o.beginPath(),o.arc(t[0],t[1],s,0,2*Math.PI),this.fillState_&&o.fill(),this.strokeState_&&o.stroke()}this.text_!==""&&this.drawText_(e.getCenter(),0,2,2)}}setStyle(e){this.setFillStrokeStyle(e.getFill(),e.getStroke()),this.setImageStyle(e.getImage()),this.setTextStyle(e.getText())}setTransform(e){this.transform_=e}drawGeometry(e){switch(e.getType()){case"Point":this.drawPoint(e);break;case"LineString":this.drawLineString(e);break;case"Polygon":this.drawPolygon(e);break;case"MultiPoint":this.drawMultiPoint(e);break;case"MultiLineString":this.drawMultiLineString(e);break;case"MultiPolygon":this.drawMultiPolygon(e);break;case"GeometryCollection":this.drawGeometryCollection(e);break;case"Circle":this.drawCircle(e);break;default:}}drawFeature(e,t){let n=t.getGeometryFunction()(e);n&&(this.setStyle(t),this.drawGeometry(n))}drawGeometryCollection(e){let t=e.getGeometriesArray();for(let n=0,r=t.length;n<r;++n)this.drawGeometry(t[n])}drawPoint(e){this.squaredTolerance_&&(e=e.simplifyTransformed(this.squaredTolerance_,this.userTransform_));let t=e.getFlatCoordinates(),n=e.getStride();this.image_&&this.drawImages_(t,0,t.length,n),this.text_!==""&&this.drawText_(t,0,t.length,n)}drawMultiPoint(e){this.squaredTolerance_&&(e=e.simplifyTransformed(this.squaredTolerance_,this.userTransform_));let t=e.getFlatCoordinates(),n=e.getStride();this.image_&&this.drawImages_(t,0,t.length,n),this.text_!==""&&this.drawText_(t,0,t.length,n)}drawLineString(e){if(this.squaredTolerance_&&(e=e.simplifyTransformed(this.squaredTolerance_,this.userTransform_)),!!_r(this.extent_,e.getExtent())){if(this.strokeState_){this.setContextStrokeState_(this.strokeState_);let t=this.context_,n=e.getFlatCoordinates();t.beginPath(),this.moveToLineTo_(n,0,n.length,e.getStride(),!1,this.strokeState_.strokeOffset),t.stroke()}if(this.text_!==""){let t=e.getFlatMidpoint();this.drawText_(t,0,2,2)}}}drawMultiLineString(e){this.squaredTolerance_&&(e=e.simplifyTransformed(this.squaredTolerance_,this.userTransform_));let t=e.getExtent();if(_r(this.extent_,t)){if(this.strokeState_){this.setContextStrokeState_(this.strokeState_);let n=this.context_,r=e.getFlatCoordinates(),s=0,o=e.getEnds(),a=e.getStride();n.beginPath();for(let l=0,c=o.length;l<c;++l)s=this.moveToLineTo_(r,s,o[l],a,!1,this.strokeState_.strokeOffset);n.stroke()}if(this.text_!==""){let n=e.getFlatMidpoints();this.drawText_(n,0,n.length,2)}}}drawPolygon(e){if(this.squaredTolerance_&&(e=e.simplifyTransformed(this.squaredTolerance_,this.userTransform_)),!!_r(this.extent_,e.getExtent())){if(this.strokeState_||this.fillState_){this.fillState_&&this.setContextFillState_(this.fillState_),this.strokeState_&&this.setContextStrokeState_(this.strokeState_);let t=this.context_;t.beginPath(),this.drawRings_(e.getOrientedFlatCoordinates(),0,e.getEnds(),e.getStride(),this.strokeState_?.strokeOffset),this.fillState_&&t.fill(),this.strokeState_&&t.stroke()}if(this.text_!==""){let t=e.getFlatInteriorPoint();this.drawText_(t,0,2,2)}}}drawMultiPolygon(e){if(this.squaredTolerance_&&(e=e.simplifyTransformed(this.squaredTolerance_,this.userTransform_)),!!_r(this.extent_,e.getExtent())){if(this.strokeState_||this.fillState_){this.fillState_&&this.setContextFillState_(this.fillState_),this.strokeState_&&this.setContextStrokeState_(this.strokeState_);let t=this.context_,n=e.getOrientedFlatCoordinates(),r=0,s=e.getEndss(),o=e.getStride();t.beginPath();for(let a=0,l=s.length;a<l;++a){let c=s[a];r=this.drawRings_(n,r,c,o,this.strokeState_?.strokeOffset)}this.fillState_&&t.fill(),this.strokeState_&&t.stroke()}if(this.text_!==""){let t=e.getFlatInteriorPoints();this.drawText_(t,0,t.length,2)}}}setContextFillState_(e){let t=this.context_,n=this.contextFillState_;n?n.fillStyle!=e.fillStyle&&(n.fillStyle=e.fillStyle,t.fillStyle=e.fillStyle):(t.fillStyle=e.fillStyle,this.contextFillState_={fillStyle:e.fillStyle})}setContextStrokeState_(e){let t=this.context_,n=this.contextStrokeState_;n?(n.lineCap!=e.lineCap&&(n.lineCap=e.lineCap,t.lineCap=e.lineCap),Po(n.lineDash,e.lineDash)||t.setLineDash(n.lineDash=e.lineDash),n.lineDashOffset!=e.lineDashOffset&&(n.lineDashOffset=e.lineDashOffset,t.lineDashOffset=e.lineDashOffset),n.lineJoin!=e.lineJoin&&(n.lineJoin=e.lineJoin,t.lineJoin=e.lineJoin),n.lineWidth!=e.lineWidth&&(n.lineWidth=e.lineWidth,t.lineWidth=e.lineWidth),n.miterLimit!=e.miterLimit&&(n.miterLimit=e.miterLimit,t.miterLimit=e.miterLimit),n.strokeStyle!=e.strokeStyle&&(n.strokeStyle=e.strokeStyle,t.strokeStyle=e.strokeStyle)):(t.lineCap=e.lineCap,t.setLineDash(e.lineDash),t.lineDashOffset=e.lineDashOffset,t.lineJoin=e.lineJoin,t.lineWidth=e.lineWidth,t.miterLimit=e.miterLimit,t.strokeStyle=e.strokeStyle,this.contextStrokeState_={lineCap:e.lineCap,lineDash:e.lineDash,lineDashOffset:e.lineDashOffset,lineJoin:e.lineJoin,lineWidth:e.lineWidth,miterLimit:e.miterLimit,strokeStyle:e.strokeStyle})}setContextTextState_(e){let t=this.context_,n=this.contextTextState_,r=e.textAlign?e.textAlign:wd;n?(n.font!=e.font&&(n.font=e.font,t.font=e.font),n.textAlign!=r&&(n.textAlign=r,t.textAlign=r),n.textBaseline!=e.textBaseline&&(n.textBaseline=e.textBaseline,t.textBaseline=e.textBaseline)):(t.font=e.font,t.textAlign=r,t.textBaseline=e.textBaseline,this.contextTextState_={font:e.font,textAlign:r,textBaseline:e.textBaseline})}setFillStrokeStyle(e,t){if(!e)this.fillState_=null;else{let n=e.getColor();this.fillState_={fillStyle:ka(n||Ls)}}if(!t)this.strokeState_=null;else{let n=t.getColor(),r=t.getLineCap(),s=t.getLineDash(),o=t.getLineDashOffset(),a=t.getLineJoin(),l=t.getWidth(),c=t.getMiterLimit(),u=s||Ga,f=t.getOffset();this.strokeState_={lineCap:r!==void 0?r:Tu,lineDash:this.pixelRatio_===1?u:u.map(p=>p*this.pixelRatio_),lineDashOffset:(o||za)*this.pixelRatio_,lineJoin:a!==void 0?a:Eu,lineWidth:(l!==void 0?l:rf)*this.pixelRatio_,miterLimit:c!==void 0?c:tf,strokeStyle:ka(n||No),strokeOffset:(f??0)*this.pixelRatio_}}}setImageStyle(e){let t;if(!e||!(t=e.getSize())){this.image_=null;return}let n=e.getPixelRatio(this.pixelRatio_),r=e.getAnchor(),s=e.getOrigin();this.image_=e.getImage(this.pixelRatio_),this.imageAnchorX_=r[0]*n,this.imageAnchorY_=r[1]*n,this.imageHeight_=t[1]*n,this.imageOpacity_=e.getOpacity(),this.imageOriginX_=s[0],this.imageOriginY_=s[1],this.imageRotateWithView_=e.getRotateWithView(),this.imageRotation_=e.getRotation();let o=e.getScaleArray();this.imageScale_=[o[0]*this.pixelRatio_/n,o[1]*this.pixelRatio_/n],this.imageWidth_=t[0]*n}setTextStyle(e){if(!e)this.text_="";else{let t=e.getFill();if(!t)this.textFillState_=null;else{let x=t.getColor();this.textFillState_={fillStyle:ka(x||Ls)}}let n=e.getStroke();if(!n)this.textStrokeState_=null;else{let x=n.getColor(),b=n.getLineCap(),w=n.getLineDash(),S=n.getLineDashOffset(),T=n.getLineJoin(),P=n.getWidth(),R=n.getMiterLimit();this.textStrokeState_={lineCap:b!==void 0?b:Tu,lineDash:w||Ga,lineDashOffset:S||za,lineJoin:T!==void 0?T:Eu,lineWidth:P!==void 0?P:rf,miterLimit:R!==void 0?R:tf,strokeStyle:ka(x||No)}}let r=e.getFont(),s=e.getOffsetX(),o=e.getOffsetY(),a=e.getRotateWithView(),l=e.getRotation(),c=e.getScaleArray(),u=e.getText(),f=e.getTextAlign(),p=e.getTextBaseline();this.textState_={font:r!==void 0?r:jw,textAlign:f!==void 0?f:wd,textBaseline:p!==void 0?p:X0},this.text_=u!==void 0?Array.isArray(u)?u.reduce((x,b,w)=>x+=w%2?" ":b,""):u:"",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_*c[0],this.pixelRatio_*c[1]]}}},kq=$5;var Fc=.5;function Gq(i,e,t,n,r,s,o,a,l){let c=l?fd(r,l):r,u=i[0]*Fc,f=i[1]*Fc,p=Si(u,f);p.imageSmoothingEnabled=!1;let x=p.canvas,b=new kq(p,Fc,r,null,o,a,l?O0(U0(),l):null),w=t.length,S=Math.floor((256*256*256-1)/w),T={};for(let R=1;R<=w;++R){let C=t[R-1],L=C.getStyleFunction()||n;if(!L)continue;let D=L(C,s);if(!D)continue;Array.isArray(D)||(D=[D]);let N=(R*S).toString(16).padStart(7,"#00000");for(let B=0,z=D.length;B<z;++B){let V=D[B],H=V.getGeometryFunction()(C);if(!H||!_r(c,H.getExtent()))continue;let Z=V.clone(),J=Z.getFill();J&&J.setColor(N);let j=Z.getStroke();j&&(j.setColor(N),j.setLineDash(null)),Z.setText(void 0);let K=V.getImage();if(K){let de=K.getImageSize();if(!de)continue;let ve=Si(de[0],de[1],void 0,{alpha:!1}),Ie=ve.canvas;ve.fillStyle=N,ve.fillRect(0,0,Ie.width,Ie.height),Z.setImage(new $0({img:Ie,anchor:K.getAnchor(),anchorXUnits:"pixels",anchorYUnits:"pixels",offset:K.getOrigin(),opacity:1,size:K.getSize(),scale:K.getScale(),rotation:K.getRotation(),rotateWithView:K.getRotateWithView()}))}let ee=Z.getZIndex()||0,ae=T[ee];ae||(ae={},T[ee]=ae,ae.Polygon=[],ae.Circle=[],ae.LineString=[],ae.Point=[]);let ce=H.getType();if(ce==="GeometryCollection"){let de=H.getGeometriesArrayRecursive();for(let ve=0,Ie=de.length;ve<Ie;++ve){let Qe=de[ve];ae[Qe.getType().replace("Multi","")].push(Qe,Z)}}else ae[ce.replace("Multi","")].push(H,Z)}}let P=Object.keys(T).map(Number).sort(Ba);for(let R=0,C=P.length;R<C;++R){let L=T[P[R]];for(let D in L){let F=L[D];for(let N=0,B=F.length;N<B;N+=2){b.setStyle(F[N+1]);for(let z=0,V=e.length;z<V;++z)b.setTransform(e[z]),b.drawGeometry(F[N])}}}return p.getImageData(0,0,x.width,x.height)}function zq(i,e,t){let n=[];if(t){let r=Math.floor(Math.round(i[0])*Fc),s=Math.floor(Math.round(i[1])*Fc),o=(_i(r,0,t.width-1)+_i(s,0,t.height-1)*t.width)*4,a=t.data[o],l=t.data[o+1],u=t.data[o+2]+256*(l+256*a),f=Math.floor((256*256*256-1)/e.length);u&&u%f===0&&n.push(e[u/f-1])}return n}var Sle=.5,Vq={Point:Ile,LineString:Cle,Polygon:Lle,MultiPoint:Nle,MultiLineString:Rle,MultiPolygon:Ple,GeometryCollection:Mle,Circle:Tle};function qq(i,e){return parseInt(Nn(i),10)-parseInt(Nn(e),10)}function Y5(i,e){let t=Z5(i,e);return t*t}function Z5(i,e){return Sle*i/e}function Tle(i,e,t,n,r){let s=t.getFill(),o=t.getStroke();if(s||o){let l=i.getBuilder(t.getZIndex(),"Circle");l.setFillStrokeStyle(s,o),l.drawCircle(e,n,r)}let a=t.getText();if(a&&a.getText()){let l=i.getBuilder(t.getZIndex(),"Text");l.setTextStyle(a),l.drawText(e,n,r)}}function K5(i,e,t,n,r,s,o,a){let l=[],c=t.getImage();if(c){let p=!0,x=c.getImageState();x==Mn.LOADED||x==Mn.ERROR?p=!1:x==Mn.IDLE&&c.load(),p&&l.push(c.ready())}let u=t.getFill();u&&u.loading()&&l.push(u.ready());let f=l.length>0;return f&&Promise.all(l).then(()=>r(null)),Ele(i,e,t,n,s,o,a),f}function Ele(i,e,t,n,r,s,o){let a=t.getGeometryFunction()(e);if(!a)return;let l=a.simplifyTransformed(n,r);if(t.getRenderer())Hq(i,l,t,e,o);else{let u=Vq[l.getType()];u(i,l,t,e,o,s)}}function Hq(i,e,t,n,r){if(e.getType()=="GeometryCollection"){let o=e.getGeometries();for(let a=0,l=o.length;a<l;++a)Hq(i,o[a],t,n,r);return}i.getBuilder(t.getZIndex(),"Default").drawCustom(e,n,t.getRenderer(),t.getHitDetectionRenderer(),r)}function Mle(i,e,t,n,r,s){let o=e.getGeometriesArray(),a,l;for(a=0,l=o.length;a<l;++a){let c=Vq[o[a].getType()];c(i,o[a],t,n,r,s)}}function Cle(i,e,t,n,r){let s=t.getStroke();if(s){let a=i.getBuilder(t.getZIndex(),"LineString");a.setFillStrokeStyle(null,s),a.drawLineString(e,n,r)}let o=t.getText();if(o&&o.getText()){let a=i.getBuilder(t.getZIndex(),"Text");a.setTextStyle(o),a.drawText(e,n,r)}}function Rle(i,e,t,n,r){let s=t.getStroke();if(s){let a=i.getBuilder(t.getZIndex(),"LineString");a.setFillStrokeStyle(null,s),a.drawMultiLineString(e,n,r)}let o=t.getText();if(o&&o.getText()){let a=i.getBuilder(t.getZIndex(),"Text");a.setTextStyle(o),a.drawText(e,n,r)}}function Ple(i,e,t,n,r){let s=t.getFill(),o=t.getStroke();if(o||s){let l=i.getBuilder(t.getZIndex(),"Polygon");l.setFillStrokeStyle(s,o),l.drawMultiPolygon(e,n,r)}let a=t.getText();if(a&&a.getText()){let l=i.getBuilder(t.getZIndex(),"Text");l.setTextStyle(a),l.drawText(e,n,r)}}function Ile(i,e,t,n,r,s){let o=t.getImage(),a=t.getText(),l=a&&a.getText(),c=s&&o&&l?{}:void 0;if(o){if(o.getImageState()!=Mn.LOADED)return;let u=i.getBuilder(t.getZIndex(),"Image");u.setImageStyle(o,c),u.drawPoint(e,n,r)}if(l){let u=i.getBuilder(t.getZIndex(),"Text");u.setTextStyle(a,c),u.drawText(e,n,r)}}function Nle(i,e,t,n,r,s){let o=t.getImage(),a=o&&o.getOpacity()!==0,l=t.getText(),c=l&&l.getText(),u=s&&a&&c?{}:void 0;if(a){if(o.getImageState()!=Mn.LOADED)return;let f=i.getBuilder(t.getZIndex(),"Image");f.setImageStyle(o,u),f.drawMultiPoint(e,n,r)}if(c){let f=i.getBuilder(t.getZIndex(),"Text");f.setTextStyle(l,u),f.drawText(e,n,r)}}function Lle(i,e,t,n,r){let s=t.getFill(),o=t.getStroke();if(s||o){let l=i.getBuilder(t.getZIndex(),"Polygon");l.setFillStrokeStyle(s,o),l.drawPolygon(e,n,r)}let a=t.getText();if(a&&a.getText()){let l=i.getBuilder(t.getZIndex(),"Text");l.setTextStyle(a),l.drawText(e,n,r)}}var Q5=class extends CS{constructor(e){super(e),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_=Er(),this.wrappedRenderedExtent_=Er(),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(e,t,n){let r=t.extent,s=t.viewState,o=s.center,a=s.resolution,l=s.projection,c=s.rotation,u=l.getExtent(),f=this.getLayer().getSource(),p=this.getLayer().getDeclutter(),x=t.pixelRatio,b=t.viewHints,w=!(b[Fs.ANIMATING]||b[Fs.INTERACTING]),S=this.context,T=Math.round(Wn(r)/a*x),P=Math.round(gr(r)/a*x),R=f.getWrapX()&&l.canWrapX(),C=R?Wn(u):null,L=R?Math.ceil((r[2]-u[2])/C)+(this.extendX_?2:1):1,D=R?Math.floor((r[0]-u[0])/C)-(this.extendX_?1:0):0;do{let F=this.getRenderTransform(o,a,0,x,T,P,D*C);t.declutter&&(F=F.slice(0)),e.execute(S,[S.canvas.width,S.canvas.height],F,c,w,n===void 0?Pd:n?X5:Fq,n?p&&t.declutter[p]:void 0)}while(++D<L)}setDrawContext_(){this.opacity_!==1&&(this.targetContext_=this.context,this.context=Si(this.context.canvas.width,this.context.canvas.height,T5))}resetDrawContext_(){if(this.opacity_!==1&&this.targetContext_){let e=this.targetContext_.globalAlpha;this.targetContext_.globalAlpha=this.opacity_,this.targetContext_.drawImage(this.context.canvas,0,0),this.targetContext_.globalAlpha=e,z0(this.context),T5.push(this.context.canvas),this.context=this.targetContext_,this.targetContext_=null}}renderDeclutter(e){!this.replayGroup_||!this.getLayer().getDeclutter()||this.renderWorlds(this.replayGroup_,e,!0)}renderDeferredInternal(e){this.replayGroup_&&(this.clipExtent_&&this.clipUnrotated(this.context,e,this.clipExtent_),this.replayGroup_.renderDeferred(),this.clipExtent_&&(this.context.restore(),this.clipExtent_=null),this.resetDrawContext_())}renderFrame(e,t){let n=e.layerStatesArray[e.layerIndex];this.opacity_=n.opacity;let r=e.viewState;this.prepareContainer(e,t);let s=this.context,o=this.replayGroup_,a=o&&!o.isEmpty();if(!a&&!(this.getLayer().hasListener(uo.PRERENDER)||this.getLayer().hasListener(uo.POSTRENDER)))return this.container;this.setDrawContext_(),this.preRender(s,e);let l=r.projection;this.clipExtent_=null;let c=!1;if(a&&n.extent&&this.clipping){let u=Sc(n.extent,l);a=_r(u,e.extent),a&&!pu(u,e.extent)&&(e.declutter?this.clipExtent_=u:(this.clipUnrotated(s,e,u),c=!0))}return a&&this.renderWorlds(o,e,this.getLayer().getDeclutter()?!1:void 0),c&&s.restore(),this.postRender(s,e),this.renderedRotation_!==r.rotation&&(this.renderedRotation_=r.rotation,this.hitDetectionImageData_=null),e.declutter||this.resetDrawContext_(),this.container}getFeatures(e){return new Promise(t=>{if(this.frameState&&!this.hitDetectionImageData_&&!this.animatingOrInteracting_){let n=this.frameState.size.slice(),r=this.renderedCenter_,s=this.renderedResolution_,o=this.renderedRotation_,a=this.renderedProjection_,l=this.wrappedRenderedExtent_,c=this.getLayer(),u=[],f=n[0]*Fc,p=n[1]*Fc;u.push(this.getRenderTransform(r,s,o,Fc,f,p,0).slice());let x=c.getSource(),b=a.getExtent();if(x.getWrapX()&&a.canWrapX()&&!pu(b,l)){let S=l[0],T=Wn(b),P=0,R;for(;S<b[0];)--P,R=T*P,u.push(this.getRenderTransform(r,s,o,Fc,f,p,R).slice()),S+=T;for(P=0,S=l[2];S>b[2];)++P,R=T*P,u.push(this.getRenderTransform(r,s,o,Fc,f,p,R).slice()),S-=T}let w=U0();this.hitDetectionImageData_=Gq(n,u,this.renderedFeatures_,c.getStyleFunction(),l,s,o,Y5(s,this.renderedPixelRatio_),w?a:null)}t(zq(e,this.renderedFeatures_,this.hitDetectionImageData_))})}forEachFeatureAtCoordinate(e,t,n,r,s){if(!this.replayGroup_)return;let o=t.viewState.resolution,a=t.viewState.rotation,l=this.getLayer(),c={},u=function(p,x,b){let w=Nn(p),S=c[w];if(S){if(S!==!0&&b<S.distanceSq){if(b===0)return c[w]=!0,s.splice(s.lastIndexOf(S),1),r(p,l,x);S.geometry=x,S.distanceSq=b}}else{if(b===0)return c[w]=!0,r(p,l,x);s.push(c[w]={feature:p,layer:l,geometry:x,distanceSq:b,callback:r})}},f=this.getLayer().getDeclutter();return this.replayGroup_.forEachFeatureAtCoordinate(e,o,a,n,u,f?t.declutter?.[f]?.all().map(p=>p.value):null)}handleFontsChanged(){let e=this.getLayer();e.getVisible()&&this.replayGroup_&&e.changed()}handleStyleImageChange_(e){this.renderIfReadyAndVisible()}prepareFrame(e){let t=this.getLayer(),n=t.getSource();if(!n)return!1;let r=e.viewHints[Fs.ANIMATING],s=e.viewHints[Fs.INTERACTING],o=t.getUpdateWhileAnimating(),a=t.getUpdateWhileInteracting();if(this.ready&&!o&&r||!a&&s)return this.animatingOrInteracting_=!0,!0;this.animatingOrInteracting_=!1;let l=e.extent,c=e.viewState,u=c.projection,f=c.resolution,p=e.pixelRatio,x=t.getRevision(),b=t.getRenderBuffer(),w=t.getRenderOrder();w===void 0&&(w=qq);let S=c.center.slice(),T=Jm(l,b*f),P=T.slice(),R=[T.slice()],C=u.getExtent(),L=n.getWrapX()&&u.canWrapX();if(this.extendX_=!1,L){let K=n.getExtent();K&&!mu(K)&&(this.extendX_=K[0]<C[0]||K[2]>C[2])}if(L&&(!pu(C,e.extent)||this.extendX_)){let K=Wn(C),ee=Math.max(Wn(T)/2,K),ae=C[0],ce=C[2];this.extendX_&&(ae-=K,ce+=K),T[0]=ae-ee,T[2]=ce+ee,ow(S,u);let de=U4(R[0],u);de[0]<C[0]&&de[2]<C[2]?R.push([de[0]+K,de[1],de[2]+K,de[3]]):de[0]>C[0]&&de[2]>C[2]&&R.push([de[0]-K,de[1],de[2]-K,de[3]])}if(this.ready&&this.renderedResolution_==f&&this.renderedPixelRatio_===p&&this.renderedRevision_==x&&this.renderedRenderOrder_==w&&this.renderedFrameDeclutter_===!!e.declutter&&pu(this.wrappedRenderedExtent_,T))return Po(this.renderedExtent_,P)||(this.hitDetectionImageData_=null,this.renderedExtent_=P),this.renderedCenter_=S,this.replayGroupChanged=!1,!0;this.replayGroup_=null;let D=new Rq(Z5(f,p),T,f,p),F=U0(),N;if(F){for(let K=0,ee=R.length;K<ee;++K){let ae=R[K],ce=fd(ae,u);n.loadFeatures(ce,hG(f,u),F)}N=O0(F,u)}else for(let K=0,ee=R.length;K<ee;++K)n.loadFeatures(R[K],f,u);let B=Y5(f,p),z=!0,V=(K,ee)=>{let ae,ce=K.getStyleFunction()||t.getStyleFunction();if(ce&&(ae=ce(K,f)),ae){let de=this.renderFeature(K,B,ae,D,N,this.getLayer().getDeclutter(),ee);z=z&&!de}},H=fd(T,u),Z=n.getFeaturesInExtent(H);w&&Z.sort(w);for(let K=0,ee=Z.length;K<ee;++K)V(Z[K],K);this.renderedFeatures_=Z,this.ready=z;let J=D.finish(),j=new Uq(T,f,p,n.getOverlaps(),J,t.getRenderBuffer(),!!e.declutter);return this.renderedResolution_=f,this.renderedRevision_=x,this.renderedRenderOrder_=w,this.renderedFrameDeclutter_=!!e.declutter,this.renderedExtent_=P,this.wrappedRenderedExtent_=T,this.renderedCenter_=S,this.renderedProjection_=u,this.renderedPixelRatio_=p,this.replayGroup_=j,this.hitDetectionImageData_=null,this.replayGroupChanged=!0,!0}renderFeature(e,t,n,r,s,o,a){if(!n)return!1;let l=!1;if(Array.isArray(n))for(let c=0,u=n.length;c<u;++c)l=K5(r,e,n[c],t,this.boundHandleStyleImageChange_,s,o,a)||l;else l=K5(r,e,n,t,this.boundHandleStyleImageChange_,s,o,a);return l}},Wq=Q5;var J5=class extends SS{constructor(e){super(e)}createRenderer(){return new Wq(this)}},jq=J5;var Dle=!1;function Fle(i,e,t,n,r,s,o){let a=new XMLHttpRequest;a.open("GET",typeof i=="function"?i(t,n,r):i,!0),e.getType()=="arraybuffer"&&(a.responseType="arraybuffer"),a.withCredentials=Dle,a.onload=function(l){if(!a.status||a.status>=200&&a.status<300){let c=e.getType();try{let u;c=="text"||c=="json"?u=a.responseText:c=="xml"?u=a.responseXML||a.responseText:c=="arraybuffer"&&(u=a.response),u?s(e.readFeatures(u,{extent:t,featureProjection:r}),e.readProjection(u)):o()}catch{o()}}else o()},a.onerror=o,a.send()}function eN(i,e){return function(t,n,r,s,o){Fle(i,e,t,n,r,(a,l)=>{this.addFeatures(a),s!==void 0&&s(a)},()=>{this.changed(),o!==void 0&&o()})}}function Xq(i,e){return[[-1/0,-1/0,1/0,1/0]]}function tN(i,e,t,n,r,s,o){let a,l,c=(t-e)/n;if(c===1)a=e;else if(c===2)a=e,l=r;else if(c!==0){let u=i[e],f=i[e+1],p=0,x=[0];for(let S=e+n;S<t;S+=n){let T=i[S],P=i[S+1];p+=Math.sqrt((T-u)*(T-u)+(P-f)*(P-f)),x.push(p),u=T,f=P}let b=r*p,w=dG(x,b);w<0?(l=(b-x[-w-2])/(x[-w-1]-x[-w-2]),a=e+(-w-2)*n):a=e+w*n}o=o>1?o:2,s=s||new Array(o);for(let u=0;u<o;++u)s[u]=a===void 0?NaN:l===void 0?i[a+u]:Ro(i[a+u],i[a+n+u],l);return s}var $q=Xs(),ey=class i{constructor(e,t,n,r,s,o){this.styleFunction,this.extent_,this.id_=o,this.type_=e,this.flatCoordinates_=t,this.flatInteriorPoints_=null,this.flatMidpoints_=null,this.ends_=n||null,this.properties_=s,this.squaredTolerance_,this.stride_=r,this.simplifiedGeometry_}get(e){return this.properties_[e]}getExtent(){return this.extent_||(this.extent_=this.type_==="Point"?Jb(this.flatCoordinates_):eg(this.flatCoordinates_,0,this.flatCoordinates_.length,this.stride_)),this.extent_}getFlatInteriorPoint(){if(!this.flatInteriorPoints_){let e=Oa(this.getExtent());this.flatInteriorPoints_=vx(this.flatCoordinates_,0,this.ends_,this.stride_,e,0)}return this.flatInteriorPoints_}getFlatInteriorPoints(){if(!this.flatInteriorPoints_){let e=gz(this.flatCoordinates_,this.ends_),t=Kw(this.flatCoordinates_,0,e,this.stride_);this.flatInteriorPoints_=Nw(this.flatCoordinates_,0,e,this.stride_,t)}return this.flatInteriorPoints_}getFlatMidpoint(){return this.flatMidpoints_||(this.flatMidpoints_=tN(this.flatCoordinates_,0,this.flatCoordinates_.length,this.stride_,.5)),this.flatMidpoints_}getFlatMidpoints(){if(!this.flatMidpoints_){this.flatMidpoints_=[];let e=this.flatCoordinates_,t=0,n=this.ends_;for(let r=0,s=n.length;r<s;++r){let o=n[r],a=tN(e,t,o,this.stride_,.5);Tc(this.flatMidpoints_,a),t=o}}return this.flatMidpoints_}getId(){return this.id_}getOrientedFlatCoordinates(){return this.flatCoordinates_}getGeometry(){return this}getSimplifiedGeometry(e){return this}simplifyTransformed(e,t){return this}getProperties(){return this.properties_}getPropertiesInternal(){return this.properties_}getStride(){return this.stride_}getStyleFunction(){return this.styleFunction}getType(){return this.type_}transform(e){e=As(e);let t=e.getExtent(),n=e.getWorldExtent();if(t&&n){let r=gr(n)/gr(t);ao($q,n[0],n[3],r,-r,0,0,0),Ua(this.flatCoordinates_,0,this.flatCoordinates_.length,this.stride_,$q,this.flatCoordinates_)}}applyTransform(e){e(this.flatCoordinates_,this.flatCoordinates_,this.stride_)}clone(){return new i(this.type_,this.flatCoordinates_.slice(),this.ends_?.slice(),this.stride_,Object.assign({},this.properties_),this.id_)}getEnds(){return this.ends_}enableSimplifyTransformed(){return this.simplifyTransformed=xw((e,t)=>{if(e===this.squaredTolerance_)return this.simplifiedGeometry_;this.simplifiedGeometry_=this.clone(),t&&this.simplifiedGeometry_.applyTransform(t);let n=this.simplifiedGeometry_.getFlatCoordinates(),r;switch(this.type_){case"LineString":n.length=xx(n,0,this.simplifiedGeometry_.flatCoordinates_.length,this.simplifiedGeometry_.stride_,e,n,0),r=[n.length];break;case"MultiLineString":r=[],n.length=dz(n,0,this.simplifiedGeometry_.ends_,this.simplifiedGeometry_.stride_,e,n,0,r);break;case"Polygon":r=[],n.length=yx(n,0,this.simplifiedGeometry_.ends_,this.simplifiedGeometry_.stride_,Math.sqrt(e),n,0,r);break;default:}return r&&(this.simplifiedGeometry_=new i(this.type_,n,r,this.stride_,this.properties_,this.id_)),this.squaredTolerance_=e,this.simplifiedGeometry_}),this}};ey.prototype.getFlatCoordinates=ey.prototype.getOrientedFlatCoordinates;var nA=ey;var nN=class{constructor(e){this.rbush_=new J0(e),this.items_={}}insert(e,t){let n={minX:e[0],minY:e[1],maxX:e[2],maxY:e[3],value:t};this.rbush_.insert(n),this.items_[Nn(t)]=n}load(e,t){let n=new Array(t.length);for(let r=0,s=t.length;r<s;r++){let o=e[r],a=t[r],l={minX:o[0],minY:o[1],maxX:o[2],maxY:o[3],value:a};n[r]=l,this.items_[Nn(a)]=l}this.rbush_.load(n)}remove(e){let t=Nn(e),n=this.items_[t];return delete this.items_[t],this.rbush_.remove(n)!==null}update(e,t){let n=this.items_[Nn(t)],r=[n.minX,n.minY,n.maxX,n.maxY];I0(r,e)||(this.remove(t),this.insert(e,t))}getAll(){return this.rbush_.all().map(function(t){return t.value})}getInExtent(e){let t={minX:e[0],minY:e[1],maxX:e[2],maxY:e[3]};return this.rbush_.search(t).map(function(r){return r.value})}forEach(e){return this.forEach_(this.getAll(),e)}forEachInExtent(e,t){return this.forEach_(this.getInExtent(e),t)}forEach_(e,t){let n;for(let r=0,s=e.length;r<s;r++)if(n=t(e[r]),n)return n;return n}isEmpty(){return vc(this.items_)}clear(){this.rbush_.clear(),this.items_={}}getExtent(e){let t=this.rbush_.toJSON();return al(t.minX,t.minY,t.maxX,t.maxY,e)}concat(e){this.rbush_.load(e.rbush_.all());for(let t in e.items_)this.items_[t]=e.items_[t]}},iN=nN;var ul={ADDFEATURE:"addfeature",CHANGEFEATURE:"changefeature",CLEAR:"clear",REMOVEFEATURE:"removefeature",FEATURESLOADSTART:"featuresloadstart",FEATURESLOADEND:"featuresloadend",FEATURESLOADERROR:"featuresloaderror"};var Lu=class extends js{constructor(e,t,n){super(e),this.feature=t,this.features=n}},rN=class extends Cw{constructor(e){e=e||{},super({attributions:e.attributions,interpolate:!0,projection:void 0,state:"ready",wrapX:e.wrapX!==void 0?e.wrapX:!0}),this.on,this.once,this.un,this.loader_=Kh,this.format_=e.format||null,this.overlaps_=e.overlaps===void 0?!0:e.overlaps,this.url_=e.url,e.loader!==void 0?this.loader_=e.loader:this.url_!==void 0&&(zn(this.format_,"`format` must be set when `url` is set"),this.loader_=eN(this.url_,this.format_)),this.strategy_=e.strategy!==void 0?e.strategy:Xq;let t=e.useSpatialIndex!==void 0?e.useSpatialIndex:!0;this.featuresRtree_=t?new iN:null,this.loadedExtentsRtree_=new iN,this.nullGeometryFeatures_={},this.idIndex_={},this.uidIndex_={},this.featureChangeKeys_={},this.featuresCollection_=null;let n,r;Array.isArray(e.features)?r=e.features:e.features&&(n=e.features,r=n.getArray()),!t&&n===void 0&&(n=new lo(r)),r!==void 0&&this.addFeaturesInternal(r),n!==void 0&&this.bindFeaturesCollection_(n)}addFeature(e){this.addFeatureInternal(e),this.changed()}addFeatureInternal(e){let t=Nn(e);if(!this.addToIndex_(t,e)){this.featuresCollection_&&this.featuresCollection_.remove(e);return}this.setupChangeEvents_(t,e);let n=e.getGeometry();if(n){let r=n.getExtent();this.featuresRtree_&&this.featuresRtree_.insert(r,e)}else this.nullGeometryFeatures_[t]=e;this.dispatchEvent(new Lu(ul.ADDFEATURE,e))}setupChangeEvents_(e,t){t instanceof nA||(this.featureChangeKeys_[e]=[Un(t,Jt.CHANGE,this.handleFeatureChange_,this),Un(t,Ec.PROPERTYCHANGE,this.handleFeatureChange_,this)])}addToIndex_(e,t){let n=!0;if(t.getId()!==void 0){let r=String(t.getId());if(!(r in this.idIndex_))this.idIndex_[r]=t;else if(t instanceof nA){let s=this.idIndex_[r];s instanceof nA?Array.isArray(s)?s.push(t):this.idIndex_[r]=[s,t]:n=!1}else n=!1}return n&&(zn(!(e in this.uidIndex_),"The passed `feature` was already added to the source"),this.uidIndex_[e]=t),n}addFeatures(e){this.addFeaturesInternal(e),this.changed()}addFeaturesInternal(e){let t=[],n=[],r=[];for(let s=0,o=e.length;s<o;s++){let a=e[s],l=Nn(a);this.addToIndex_(l,a)&&n.push(a)}for(let s=0,o=n.length;s<o;s++){let a=n[s],l=Nn(a);this.setupChangeEvents_(l,a);let c=a.getGeometry();if(c){let u=c.getExtent();t.push(u),r.push(a)}else this.nullGeometryFeatures_[l]=a}if(this.featuresRtree_&&this.featuresRtree_.load(t,r),this.hasListener(ul.ADDFEATURE))for(let s=0,o=n.length;s<o;s++)this.dispatchEvent(new Lu(ul.ADDFEATURE,n[s]))}bindFeaturesCollection_(e){let t=!1;this.addEventListener(ul.ADDFEATURE,function(n){t||(t=!0,e.push(n.feature),t=!1)}),this.addEventListener(ul.REMOVEFEATURE,function(n){t||(t=!0,e.remove(n.feature),t=!1)}),e.addEventListener(Ys.ADD,n=>{t||(t=!0,this.addFeature(n.element),t=!1)}),e.addEventListener(Ys.REMOVE,n=>{t||(t=!0,this.removeFeature(n.element),t=!1)}),this.featuresCollection_=e}clear(e){if(e){for(let n in this.featureChangeKeys_)this.featureChangeKeys_[n].forEach(ii);this.featuresCollection_||(this.featureChangeKeys_={},this.idIndex_={},this.uidIndex_={})}else if(this.featuresRtree_){this.featuresRtree_.forEach(n=>{this.removeFeatureInternal(n)});for(let n in this.nullGeometryFeatures_)this.removeFeatureInternal(this.nullGeometryFeatures_[n])}this.featuresCollection_&&this.featuresCollection_.clear(),this.featuresRtree_&&this.featuresRtree_.clear(),this.nullGeometryFeatures_={};let t=new Lu(ul.CLEAR);this.dispatchEvent(t),this.changed()}forEachFeature(e){if(this.featuresRtree_)return this.featuresRtree_.forEach(e);this.featuresCollection_&&this.featuresCollection_.forEach(e)}forEachFeatureAtCoordinateDirect(e,t){let n=[e[0],e[1],e[0],e[1]];return this.forEachFeatureInExtent(n,function(r){let s=r.getGeometry();if(s instanceof nA||s.intersectsCoordinate(e))return t(r)})}forEachFeatureInExtent(e,t){if(this.featuresRtree_)return this.featuresRtree_.forEachInExtent(e,t);this.featuresCollection_&&this.featuresCollection_.forEach(t)}forEachFeatureIntersectingExtent(e,t){return this.forEachFeatureInExtent(e,function(n){let r=n.getGeometry();if(r instanceof nA||r.intersectsExtent(e)){let s=t(n);if(s)return s}})}getFeaturesCollection(){return this.featuresCollection_}getFeatures(){let e;return this.featuresCollection_?e=this.featuresCollection_.getArray().slice(0):this.featuresRtree_&&(e=this.featuresRtree_.getAll(),vc(this.nullGeometryFeatures_)||Tc(e,Object.values(this.nullGeometryFeatures_))),e}getFeaturesAtCoordinate(e){let t=[];return this.forEachFeatureAtCoordinateDirect(e,function(n){t.push(n)}),t}getFeaturesInExtent(e,t){if(this.featuresRtree_){if(!(t&&t.canWrapX()&&this.getWrapX()))return this.featuresRtree_.getInExtent(e);let r=nw(e,t);return[].concat(...r.map(s=>this.featuresRtree_.getInExtent(s)))}return this.featuresCollection_?this.featuresCollection_.getArray().slice(0):[]}getClosestFeatureToCoordinate(e,t){let n=e[0],r=e[1],s=null,o=[NaN,NaN],a=1/0,l=[-1/0,-1/0,1/0,1/0];return t=t||Yh,this.featuresRtree_.forEachInExtent(l,function(c){if(t(c)){let u=c.getGeometry(),f=a;if(a=u instanceof nA?0:u.closestPointXY(n,r,o,a),a<f){s=c;let p=Math.sqrt(a);l[0]=n-p,l[1]=r-p,l[2]=n+p,l[3]=r+p}}}),s}getExtent(e){return this.featuresRtree_?.getExtent(e)??null}getFeatureById(e){let t=this.idIndex_[e.toString()];return t!==void 0?t:null}getFeatureByUid(e){let t=this.uidIndex_[e];return t!==void 0?t:null}getFormat(){return this.format_}getOverlaps(){return this.overlaps_}getUrl(){return this.url_}handleFeatureChange_(e){let t=e.target,n=Nn(t),r=t.getGeometry();if(!r)n in this.nullGeometryFeatures_||(this.featuresRtree_&&this.featuresRtree_.remove(t),this.nullGeometryFeatures_[n]=t);else{let o=r.getExtent();n in this.nullGeometryFeatures_?(delete this.nullGeometryFeatures_[n],this.featuresRtree_&&this.featuresRtree_.insert(o,t)):this.featuresRtree_&&this.featuresRtree_.update(o,t)}let s=t.getId();if(s!==void 0){let o=s.toString();this.idIndex_[o]!==t&&(this.removeFromIdIndex_(t),this.idIndex_[o]=t)}else this.removeFromIdIndex_(t),this.uidIndex_[n]=t;this.changed(),this.dispatchEvent(new Lu(ul.CHANGEFEATURE,t))}hasFeature(e){let t=e.getId();if(t!==void 0){let n=this.idIndex_[String(t)];return Array.isArray(n)?n.includes(e):n===e}return Nn(e)in this.uidIndex_}isEmpty(){return this.featuresRtree_?this.featuresRtree_.isEmpty()&&vc(this.nullGeometryFeatures_):this.featuresCollection_?this.featuresCollection_.getLength()===0:!0}loadFeatures(e,t,n){let r=this.loadedExtentsRtree_,s=this.strategy_(e,t,n);for(let o=0,a=s.length;o<a;++o){let l=s[o];if(!r.forEachInExtent(l,function(u){return pu(u.extent,l)})){this.loading=Number(this.loading)+1,this.dispatchEvent(new Lu(ul.FEATURESLOADSTART));let u=b=>{this.loading=Number(this.loading)-1,this.dispatchEvent(new Lu(ul.FEATURESLOADEND,void 0,b))},f=()=>{this.changed(),this.loading=Number(this.loading)-1,this.dispatchEvent(new Lu(ul.FEATURESLOADERROR))},p=!1,x=this.loader_.call(this,l,t,n,b=>p||u(b),()=>p||f());x instanceof Promise?(p=!0,x.then(b=>{this.addFeatures(b),u(b)}).catch(f)):this.loader_.length<4&&(this.loading=!1),r.insert(l,{extent:l.slice()})}}}refresh(){this.clear(!0),this.loadedExtentsRtree_.clear(),super.refresh()}removeLoadedExtent(e){let t=this.loadedExtentsRtree_,n=[];t.forEachInExtent(e,function(r){n.push(r)}),n.forEach(r=>{t.remove(r);let s=B4(r.extent,e);for(let o of s)t.insert(o,{extent:o})})}removeFeatures(e){let t=!1;for(let n=0,r=e.length;n<r;++n)t=this.removeFeatureInternal(e[n])||t;t&&this.changed()}removeFeature(e){if(!e)return;this.removeFeatureInternal(e)&&this.changed()}removeFeatureInternal(e){let t=Nn(e);if(!(t in this.uidIndex_))return!1;t in this.nullGeometryFeatures_?delete this.nullGeometryFeatures_[t]:this.featuresRtree_&&this.featuresRtree_.remove(e),this.featureChangeKeys_[t]?.forEach(ii),delete this.featureChangeKeys_[t];let r=e.getId();if(r!==void 0){let s=r.toString(),o=this.idIndex_[s];o===e?delete this.idIndex_[s]:Array.isArray(o)&&(o.splice(o.indexOf(e),1),o.length===1&&(this.idIndex_[s]=o[0]))}return delete this.uidIndex_[t],this.hasListener(ul.REMOVEFEATURE)&&this.dispatchEvent(new Lu(ul.REMOVEFEATURE,e)),!0}removeFromIdIndex_(e){for(let t in this.idIndex_)if(this.idIndex_[t]===e){delete this.idIndex_[t];break}}setLoader(e){this.loader_=e}setUrl(e){zn(this.format_,"`format` must be set when `url` is set"),this.url_=e,this.setLoader(eN(e,this.format_))}setOverlaps(e){this.overlaps_=e,this.changed()}},pf=rN;function Yq(){let i=k.variant,e=we.overviewCanvas,t=e.getContext("2d"),n=Jh(),r=k.game.tileGrid.size,s=k.game.tileGrid.tileSize,o=n[2]-n[0],a=n[3]-n[1],l=0;for(;l<i.fullZoom&&Math.max(o,a)/r*s*2**l<168;)l++;let c=s*2**l/r;e.width=Math.max(1,Math.round(o*c)),e.height=Math.max(1,Math.round(a*c)),t.clearRect(0,0,e.width,e.height),i.background&&(t.fillStyle=i.background,t.fillRect(0,0,e.width,e.height));let u=++k.overviewRun,f=i.formats[l],p=Math.floor(n[0]/r*2**l),x=Math.ceil(n[2]/r*2**l),b=Math.floor(-n[3]/r*2**l),w=Math.ceil(-n[1]/r*2**l);for(let S=b;S<w;S++)for(let T=p;T<x;T++){if(!f||!LS(i,l,T,S))continue;let P=new Image;P.onload=()=>{k.overviewRun===u&&t.drawImage(P,T*s-n[0]*c,S*s+n[3]*c,s,s)},P.src=`${k.game.base}/tiles/${encodeURIComponent(i.tiles)}/${l}/${T}/${S}.${f}`}ty()}function ty(){let i=k.engine?.getView();if(!i||!k.variant)return;let e=Jh(),t=i.calculateExtent(k.engine.getSize()),n=e[2]-e[0],r=e[3]-e[1],s=(i.getResolution()||0)*4,o=t[0]<=e[0]+s&&t[1]<=e[1]+s&&t[2]>=e[2]-s&&t[3]>=e[3]-s,a=o?"hidden":t.map(Math.round).join(",");if(a===k.overviewKey||(k.overviewKey=a,we.overviewShelf.hidden=o,o))return;let l=we.overviewCanvas,c=Ic((t[0]-e[0])/n,0,1),u=Ic((t[2]-e[0])/n,0,1),f=Ic((e[3]-t[3])/r,0,1),p=Ic((e[3]-t[1])/r,0,1),x=we.overviewViewport.style;x.left=`${c*l.width}px`,x.top=`${f*l.height}px`,x.width=`${Math.max(8,(u-c)*l.width)}px`,x.height=`${Math.max(8,(p-f)*l.height)}px`}function NS(i,e=!0){k.overviewDocked=i,i&&k.overviewPointer!==null&&(k.overviewPointer=null,zg()),we.overviewShelf.classList.toggle("is-docked",i),we.overviewDock.setAttribute("aria-expanded",String(!i));let t=i?"Bring the overview back":"Put the overview away";we.overviewDock.setAttribute("aria-label",t),we.overviewDock.title=t,e&&Mc()}function sN(i,e){let t=k.engine?.getView();if(!t||!k.variant)return;let n=we.overviewCanvas.getBoundingClientRect(),r=Jh(),s=(a,l,c)=>Ic((a-l)/(c-l),0,1),o=[r[0]+s(i.clientX,n.left,n.right)*(r[2]-r[0]),r[3]-s(i.clientY,n.top,n.bottom)*(r[3]-r[1])];if(e){t.animate({center:o,duration:180});return}t.cancelAnimations(),t.setCenter(o)}function hl(i){return new jq({updateWhileAnimating:!0,...i})}function Zq(){let i=k.game.tileGrid.size,e=[0,-i,i,0];k.projection=new ud({code:"ATLAS:PIXELS",units:"pixels",extent:e}),k.sources={grid:new pf({wrapX:!1}),gridContext:new pf({wrapX:!1}),zoneScrim:new pf({wrapX:!1}),zones:new pf({wrapX:!1}),zoneTitles:new pf({wrapX:!1}),text:new pf({wrapX:!1}),pins:new pf({wrapX:!1}),priority:new pf({wrapX:!1})},k.layers={raster:new P5({zIndex:0}),rasterDetail:new P5({zIndex:1}),grid:hl({source:k.sources.grid,style:fI,renderOrder:Wl,renderBuffer:40,zIndex:5}),zoneScrim:hl({source:k.sources.zoneScrim,style:tV,zIndex:6}),zones:hl({source:k.sources.zones,style:nV,renderBuffer:32,zIndex:10}),zoneTitles:hl({source:k.sources.zoneTitles,style:iV,renderOrder:Wl,renderBuffer:160,zIndex:20}),zoneTitleDetail:hl({source:k.sources.zoneTitles,style:rV,renderOrder:Wl,renderBuffer:160,zIndex:44}),text:hl({source:k.sources.text,style:Yz,renderOrder:Wl,renderBuffer:220,zIndex:30}),textDetail:hl({source:k.sources.text,style:Zz,renderOrder:Wl,renderBuffer:220,zIndex:45}),zoneText:hl({source:k.sources.text,style:Kz,renderOrder:Wl,renderBuffer:220,zIndex:41}),pins:hl({source:k.sources.pins,style:jz,renderOrder:Wl,renderBuffer:48,zIndex:40}),zonePins:hl({source:k.sources.pins,style:Xz,renderOrder:Wl,renderBuffer:48,zIndex:42}),pinLabels:hl({source:k.sources.pins,style:$z,renderOrder:Wl,renderBuffer:180,zIndex:45}),gridContext:hl({source:k.sources.gridContext,style:fI,renderOrder:Wl,renderBuffer:40,zIndex:48}),priority:hl({source:k.sources.priority,style:Qz,renderOrder:Wl,renderBuffer:220,zIndex:50})},k.engine=new _q({target:we.viewport,layers:Object.values(k.layers),controls:iS({attribution:!1,rotate:!1,zoom:!1}),interactions:cS({onFocusOnly:!1}),view:oN(5)}),k.engine.on("movestart",()=>{k.engine.getViewport().classList.add("is-dragging")}),k.engine.on("moveend",()=>{k.engine.getViewport().classList.remove("is-dragging"),k.overviewPointer===null&&zg()}),k.engine.on("postrender",ty),we.viewport.addEventListener("wheel",()=>{document.activeElement!==we.viewport&&we.viewport.focus({preventScroll:!0})},{capture:!0,passive:!0}),k.engine.on("singleclick",t=>{if(k.gridEnabled){let r=k.engine.forEachFeatureAtPixel(t.pixel,s=>{let o=s.get("gridCell");return o&&o.role!=="leaf"&&o.role!=="scope"?o:null},{hitTolerance:1,layerFilter:s=>s===k.layers.grid||s===k.layers.gridContext});if(r){wx(r.hash);return}}let n=k.engine.forEachFeatureAtPixel(t.pixel,(r,s)=>DS(s)&&r.get("pin")||null,{hitTolerance:5,layerFilter:DS});n&&Sx(n)}),k.engine.on("pointermove",t=>{if(t.dragging){Cg(null);return}let n=k.engine.forEachFeatureAtPixel(t.pixel,(o,a)=>DS(a)&&o.get("pin")||null,{hitTolerance:4,layerFilter:DS}),r=n&&Su(n.category)==="text"?null:n;Cg(r||null);let s=k.gridEnabled&&k.engine.hasFeatureAtPixel(t.pixel,{layerFilter:o=>o===k.layers.grid||o===k.layers.gridContext});k.engine.getTargetElement().style.cursor=n||s?"pointer":""}),k.engine.getViewport().addEventListener("pointerleave",()=>Cg(null))}function DS(i){return i===k.layers.pins||i===k.layers.zonePins||i===k.layers.pinLabels||i===k.layers.priority||i===k.layers.text||i===k.layers.textDetail||i===k.layers.zoneText}function oN(i){let e=k.game.tileGrid.size;return new cl({projection:k.projection,center:[e/2,-e/2],resolutions:aN(i),minZoom:0,maxZoom:i,extent:[0,-e,e,0],constrainResolution:!1,smoothResolutionConstraint:!1,showFullExtent:!0,zoom:0})}function aN(i){let e=k.game.tileGrid.size/k.game.tileGrid.tileSize;return Array.from({length:i+1},(t,n)=>e/2**n)}var pa={LEFT:0,MIDDLE:1,RIGHT:2,ROTATE:0,DOLLY:1,PAN:2},Qd={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},GT=0,Yy=1,zT=2;var YN=0,Jd=1,VT=2,Zl=3,po=0,ui=1,ir=2,Xr=0,rs=1,Gu=2,zu=3,Vu=4,If=5,Zy=6,Os=100,Ky=101,Qy=102,qT=103,HT=104,qc=200,Jy=201,e2=202,t2=203,Ud=204,kd=205,n2=206,i2=207,r2=208,s2=209,o2=210,kH=211,GH=212,zH=213,VH=214,aA=0,lA=1,cA=2,Ou=3,uA=4,hA=5,fA=6,dA=7,RA=0,WT=1,jT=2,Us=0,a2=1,l2=2,c2=3,u2=4,ZN=5,h2=6,f2=7;var d2=300,gl=301,Kl=302,ep=303,tp=304,qu=306,Sf=1e3,Bo=1001,Tf=1002,xi=1003,p2=1004;var Ql=1005;var vi=1006,np=1007;var mo=1008,KN=1008,Gi=1009,Hu=1010,Wu=1011,Ha=1012,Ir=1013,pi=1014,Yi=1015,Li=1016,PA=1017,IA=1018,ko=1020,NA=35902,LA=35899,S_=1021,Nf=1022,xr=1023,xs=1026,Ks=1027,Lf=1028,ju=1029,ws=1030,Xu=1031,A2=1032,ip=1033,$u=33776,Yu=33777,Zu=33778,Ku=33779,DA=35840,FA=35841,OA=35842,BA=35843,rp=36196,sp=37492,op=37496,ap=37488,lp=37489,Qu=37490,cp=37491,up=37808,hp=37809,fp=37810,dp=37811,pp=37812,Ap=37813,mp=37814,gp=37815,_p=37816,xp=37817,yp=37818,vp=37819,bp=37820,wp=37821,Sp=36492,Tp=36494,Ep=36495,Mp=36283,Cp=36284,Ju=36285,Rp=36286;var Ay=2300,pT=2301,fT=2302,ON=2303,BN=2400,UN=2401,kN=2402;var QN=0,JN=1,XT=2,qH=3200;var _l=0,$T=1,Go="",Wr="srgb",Gd="srgb-linear",zd="linear",Bt="srgb",m2="",YT="rg",eL="ga",tL=0,yf=7680,nL=7681,iL=7682,rL=7683,sL=34055,oL=34056,aL=5386,lL=512,cL=513,uL=514,hL=515,fL=516,dL=517,pL=518,my=519,g2=512,T_=513,_2=514,eh=515,UA=516,x2=517,Hc=518,y2=519,Vd=35044,kA=35048;var AL="300 es",fo=2e3,Va=2001,Jl={COMPUTE:"compute",RENDER:"render"};var Df={TEXTURE_COMPARE:"depthTextureCompare"};function Ble(i){for(let e=i.length-1;e>=0;--e)if(i[e]>=65535)return!0;return!1}function E_(i){return ArrayBuffer.isView(i)&&!(i instanceof DataView)}function l_(i){return document.createElementNS("http://www.w3.org/1999/xhtml",i)}function ZT(){let i=l_("canvas");return i.style.display="block",i}var Kq={},c_=null;function pA(...i){let e="THREE."+i.shift();c_?c_("log",e,...i):console.log(e,...i)}function HH(i){let e=i[0];if(typeof e=="string"&&e.startsWith("TSL:")){let t=i[1];t&&t.isStackTrace?i[0]+=" "+t.getLocation():i[1]='Stack trace not available. Enable "THREE.Node.captureStackTrace" to capture stack traces.'}return i}function je(...i){i=HH(i);let e="THREE."+i.shift();if(c_)c_("warn",e,...i);else{let t=i[0];t&&t.isStackTrace?console.warn(t.getError(e)):console.warn(e,...i)}}function Ge(...i){i=HH(i);let e="THREE."+i.shift();if(c_)c_("error",e,...i);else{let t=i[0];t&&t.isStackTrace?console.error(t.getError(e)):console.error(e,...i)}}function Zn(...i){let e=i.join(" ");e in Kq||(Kq[e]=!0,je(...i))}function mL(){return typeof self<"u"&&typeof self.scheduler<"u"&&typeof self.scheduler.yield<"u"?self.scheduler.yield():new Promise(i=>{requestAnimationFrame(i)})}function WH(i,e,t){return new Promise(function(n,r){function s(){switch(i.clientWaitSync(e,i.SYNC_FLUSH_COMMANDS_BIT,0)){case i.WAIT_FAILED:r();break;case i.TIMEOUT_EXPIRED:setTimeout(s,t);break;default:n()}}setTimeout(s,t)})}var v2={[aA]:lA,[cA]:fA,[uA]:dA,[Ou]:hA,[lA]:aA,[fA]:cA,[dA]:uA,[hA]:Ou},Uo=class{addEventListener(e,t){this._listeners===void 0&&(this._listeners={});let n=this._listeners;n[e]===void 0&&(n[e]=[]),n[e].indexOf(t)===-1&&n[e].push(t)}hasEventListener(e,t){let n=this._listeners;return n===void 0?!1:n[e]!==void 0&&n[e].indexOf(t)!==-1}removeEventListener(e,t){let n=this._listeners;if(n===void 0)return;let r=n[e];if(r!==void 0){let s=r.indexOf(t);s!==-1&&r.splice(s,1)}}dispatchEvent(e){let t=this._listeners;if(t===void 0)return;let n=t[e.type];if(n!==void 0){e.target=this;let r=n.slice(0);for(let s=0,o=r.length;s<o;s++)r[s].call(this,e);e.target=null}}},Fo=["00","01","02","03","04","05","06","07","08","09","0a","0b","0c","0d","0e","0f","10","11","12","13","14","15","16","17","18","19","1a","1b","1c","1d","1e","1f","20","21","22","23","24","25","26","27","28","29","2a","2b","2c","2d","2e","2f","30","31","32","33","34","35","36","37","38","39","3a","3b","3c","3d","3e","3f","40","41","42","43","44","45","46","47","48","49","4a","4b","4c","4d","4e","4f","50","51","52","53","54","55","56","57","58","59","5a","5b","5c","5d","5e","5f","60","61","62","63","64","65","66","67","68","69","6a","6b","6c","6d","6e","6f","70","71","72","73","74","75","76","77","78","79","7a","7b","7c","7d","7e","7f","80","81","82","83","84","85","86","87","88","89","8a","8b","8c","8d","8e","8f","90","91","92","93","94","95","96","97","98","99","9a","9b","9c","9d","9e","9f","a0","a1","a2","a3","a4","a5","a6","a7","a8","a9","aa","ab","ac","ad","ae","af","b0","b1","b2","b3","b4","b5","b6","b7","b8","b9","ba","bb","bc","bd","be","bf","c0","c1","c2","c3","c4","c5","c6","c7","c8","c9","ca","cb","cc","cd","ce","cf","d0","d1","d2","d3","d4","d5","d6","d7","d8","d9","da","db","dc","dd","de","df","e0","e1","e2","e3","e4","e5","e6","e7","e8","e9","ea","eb","ec","ed","ee","ef","f0","f1","f2","f3","f4","f5","f6","f7","f8","f9","fa","fb","fc","fd","fe","ff"],Qq=1234567,hy=Math.PI/180,Ef=180/Math.PI;function Fu(){let i=Math.random()*4294967295|0,e=Math.random()*4294967295|0,t=Math.random()*4294967295|0,n=Math.random()*4294967295|0;return(Fo[i&255]+Fo[i>>8&255]+Fo[i>>16&255]+Fo[i>>24&255]+"-"+Fo[e&255]+Fo[e>>8&255]+"-"+Fo[e>>16&15|64]+Fo[e>>24&255]+"-"+Fo[t&63|128]+Fo[t>>8&255]+"-"+Fo[t>>16&255]+Fo[t>>24&255]+Fo[n&255]+Fo[n>>8&255]+Fo[n>>16&255]+Fo[n>>24&255]).toLowerCase()}function Pn(i,e,t){return Math.max(e,Math.min(t,i))}function gL(i,e){return(i%e+e)%e}function Ule(i,e,t,n,r){return n+(i-e)*(r-n)/(t-e)}function kle(i,e,t){return i!==e?(t-i)/(e-i):0}function fy(i,e,t){return(1-t)*i+t*e}function Gle(i,e,t,n){return fy(i,e,1-Math.exp(-t*n))}function zle(i,e=1){return e-Math.abs(gL(i,e*2)-e)}function Vle(i,e,t){return i<=e?0:i>=t?1:(i=(i-e)/(t-e),i*i*(3-2*i))}function qle(i,e,t){return i<=e?0:i>=t?1:(i=(i-e)/(t-e),i*i*i*(i*(i*6-15)+10))}function Hle(i,e){return i+Math.floor(Math.random()*(e-i+1))}function Wle(i,e){return i+Math.random()*(e-i)}function jle(i){return i*(.5-Math.random())}function Xle(i){i!==void 0&&(Qq=i);let e=Qq+=1831565813;return e=Math.imul(e^e>>>15,e|1),e^=e+Math.imul(e^e>>>7,e|61),((e^e>>>14)>>>0)/4294967296}function $le(i){return i*hy}function Yle(i){return i*Ef}function Zle(i){return(i&i-1)===0&&i!==0}function Kle(i){return Math.pow(2,Math.ceil(Math.log(i)/Math.LN2))}function Qle(i){return Math.pow(2,Math.floor(Math.log(i)/Math.LN2))}function Jle(i,e,t,n,r){let s=Math.cos,o=Math.sin,a=s(t/2),l=o(t/2),c=s((e+n)/2),u=o((e+n)/2),f=s((e-n)/2),p=o((e-n)/2),x=s((n-e)/2),b=o((n-e)/2);switch(r){case"XYX":i.set(a*u,l*f,l*p,a*c);break;case"YZY":i.set(l*p,a*u,l*f,a*c);break;case"ZXZ":i.set(l*f,l*p,a*u,a*c);break;case"XZX":i.set(a*u,l*b,l*x,a*c);break;case"YXY":i.set(l*x,a*u,l*b,a*c);break;case"ZYZ":i.set(l*b,l*x,a*u,a*c);break;default:je("MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+r)}}function oa(i,e){switch(e.constructor){case Float32Array:return i;case Uint32Array:return i/4294967295;case Uint16Array:return i/65535;case Uint8Array:return i/255;case Int32Array:return Math.max(i/2147483647,-1);case Int16Array:return Math.max(i/32767,-1);case Int8Array:return Math.max(i/127,-1);default:throw new Error("THREE.MathUtils: Invalid component type.")}}function qn(i,e){switch(e.constructor){case Float32Array:return i;case Uint32Array:return Math.round(i*4294967295);case Uint16Array:return Math.round(i*65535);case Uint8Array:return Math.round(i*255);case Int32Array:return Math.round(i*2147483647);case Int16Array:return Math.round(i*32767);case Int8Array:return Math.round(i*127);default:throw new Error("THREE.MathUtils: Invalid component type.")}}var Wc={DEG2RAD:hy,RAD2DEG:Ef,generateUUID:Fu,clamp:Pn,euclideanModulo:gL,mapLinear:Ule,inverseLerp:kle,lerp:fy,damp:Gle,pingpong:zle,smoothstep:Vle,smootherstep:qle,randInt:Hle,randFloat:Wle,randFloatSpread:jle,seededRandom:Xle,degToRad:$le,radToDeg:Yle,isPowerOfTwo:Zle,ceilPowerOfTwo:Kle,floorPowerOfTwo:Qle,setQuaternionFromProperEuler:Jle,normalize:qn,denormalize:oa},bL=class bL{constructor(e=0,t=0){this.x=e,this.y=t}get width(){return this.x}set width(e){this.x=e}get height(){return this.y}set height(e){this.y=e}set(e,t){return this.x=e,this.y=t,this}setScalar(e){return this.x=e,this.y=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;default:throw new Error("THREE.Vector2: index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw new Error("THREE.Vector2: index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y)}copy(e){return this.x=e.x,this.y=e.y,this}add(e){return this.x+=e.x,this.y+=e.y,this}addScalar(e){return this.x+=e,this.y+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this}subScalar(e){return this.x-=e,this.y-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this}multiply(e){return this.x*=e.x,this.y*=e.y,this}multiplyScalar(e){return this.x*=e,this.y*=e,this}divide(e){return this.x/=e.x,this.y/=e.y,this}divideScalar(e){return this.multiplyScalar(1/e)}applyMatrix3(e){let t=this.x,n=this.y,r=e.elements;return this.x=r[0]*t+r[3]*n+r[6],this.y=r[1]*t+r[4]*n+r[7],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this}clamp(e,t){return this.x=Pn(this.x,e.x,t.x),this.y=Pn(this.y,e.y,t.y),this}clampScalar(e,t){return this.x=Pn(this.x,e,t),this.y=Pn(this.y,e,t),this}clampLength(e,t){let n=this.length();return this.divideScalar(n||1).multiplyScalar(Pn(n,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(e){return this.x*e.x+this.y*e.y}cross(e){return this.x*e.y-this.y*e.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}angleTo(e){let t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;let n=this.dot(e)/t;return Math.acos(Pn(n,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){let t=this.x-e.x,n=this.y-e.y;return t*t+n*n}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this}equals(e){return e.x===this.x&&e.y===this.y}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this}rotateAround(e,t){let n=Math.cos(t),r=Math.sin(t),s=this.x-e.x,o=this.y-e.y;return this.x=s*n-o*r+e.x,this.y=s*r+o*n+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}};bL.prototype.isVector2=!0;var Oe=bL,ys=class{constructor(e=0,t=0,n=0,r=1){this.isQuaternion=!0,this._x=e,this._y=t,this._z=n,this._w=r}static slerpFlat(e,t,n,r,s,o,a){let l=n[r+0],c=n[r+1],u=n[r+2],f=n[r+3],p=s[o+0],x=s[o+1],b=s[o+2],w=s[o+3];if(f!==w||l!==p||c!==x||u!==b){let S=l*p+c*x+u*b+f*w;S<0&&(p=-p,x=-x,b=-b,w=-w,S=-S);let T=1-a;if(S<.9995){let P=Math.acos(S),R=Math.sin(P);T=Math.sin(T*P)/R,a=Math.sin(a*P)/R,l=l*T+p*a,c=c*T+x*a,u=u*T+b*a,f=f*T+w*a}else{l=l*T+p*a,c=c*T+x*a,u=u*T+b*a,f=f*T+w*a;let P=1/Math.sqrt(l*l+c*c+u*u+f*f);l*=P,c*=P,u*=P,f*=P}}e[t]=l,e[t+1]=c,e[t+2]=u,e[t+3]=f}static multiplyQuaternionsFlat(e,t,n,r,s,o){let a=n[r],l=n[r+1],c=n[r+2],u=n[r+3],f=s[o],p=s[o+1],x=s[o+2],b=s[o+3];return e[t]=a*b+u*f+l*x-c*p,e[t+1]=l*b+u*p+c*f-a*x,e[t+2]=c*b+u*x+a*p-l*f,e[t+3]=u*b-a*f-l*p-c*x,e}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get w(){return this._w}set w(e){this._w=e,this._onChangeCallback()}set(e,t,n,r){return this._x=e,this._y=t,this._z=n,this._w=r,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this._onChangeCallback(),this}setFromEuler(e,t=!0){let n=e._x,r=e._y,s=e._z,o=e._order,a=Math.cos,l=Math.sin,c=a(n/2),u=a(r/2),f=a(s/2),p=l(n/2),x=l(r/2),b=l(s/2);switch(o){case"XYZ":this._x=p*u*f+c*x*b,this._y=c*x*f-p*u*b,this._z=c*u*b+p*x*f,this._w=c*u*f-p*x*b;break;case"YXZ":this._x=p*u*f+c*x*b,this._y=c*x*f-p*u*b,this._z=c*u*b-p*x*f,this._w=c*u*f+p*x*b;break;case"ZXY":this._x=p*u*f-c*x*b,this._y=c*x*f+p*u*b,this._z=c*u*b+p*x*f,this._w=c*u*f-p*x*b;break;case"ZYX":this._x=p*u*f-c*x*b,this._y=c*x*f+p*u*b,this._z=c*u*b-p*x*f,this._w=c*u*f+p*x*b;break;case"YZX":this._x=p*u*f+c*x*b,this._y=c*x*f+p*u*b,this._z=c*u*b-p*x*f,this._w=c*u*f-p*x*b;break;case"XZY":this._x=p*u*f-c*x*b,this._y=c*x*f-p*u*b,this._z=c*u*b+p*x*f,this._w=c*u*f+p*x*b;break;default:je("Quaternion: .setFromEuler() encountered an unknown order: "+o)}return t===!0&&this._onChangeCallback(),this}setFromAxisAngle(e,t){let n=t/2,r=Math.sin(n);return this._x=e.x*r,this._y=e.y*r,this._z=e.z*r,this._w=Math.cos(n),this._onChangeCallback(),this}setFromRotationMatrix(e){let t=e.elements,n=t[0],r=t[4],s=t[8],o=t[1],a=t[5],l=t[9],c=t[2],u=t[6],f=t[10],p=n+a+f;if(p>0){let x=.5/Math.sqrt(p+1);this._w=.25/x,this._x=(u-l)*x,this._y=(s-c)*x,this._z=(o-r)*x}else if(n>a&&n>f){let x=2*Math.sqrt(1+n-a-f);this._w=(u-l)/x,this._x=.25*x,this._y=(r+o)/x,this._z=(s+c)/x}else if(a>f){let x=2*Math.sqrt(1+a-n-f);this._w=(s-c)/x,this._x=(r+o)/x,this._y=.25*x,this._z=(l+u)/x}else{let x=2*Math.sqrt(1+f-n-a);this._w=(o-r)/x,this._x=(s+c)/x,this._y=(l+u)/x,this._z=.25*x}return this._onChangeCallback(),this}setFromUnitVectors(e,t){let n=e.dot(t)+1;return n<1e-8?(n=0,Math.abs(e.x)>Math.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=n):(this._x=0,this._y=-e.z,this._z=e.y,this._w=n)):(this._x=e.y*t.z-e.z*t.y,this._y=e.z*t.x-e.x*t.z,this._z=e.x*t.y-e.y*t.x,this._w=n),this.normalize()}angleTo(e){return 2*Math.acos(Math.abs(Pn(this.dot(e),-1,1)))}rotateTowards(e,t){let n=this.angleTo(e);if(n===0)return this;let r=Math.min(1,t/n);return this.slerp(e,r),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let e=this.length();return e===0?(this._x=0,this._y=0,this._z=0,this._w=1):(e=1/e,this._x=this._x*e,this._y=this._y*e,this._z=this._z*e,this._w=this._w*e),this._onChangeCallback(),this}multiply(e){return this.multiplyQuaternions(this,e)}premultiply(e){return this.multiplyQuaternions(e,this)}multiplyQuaternions(e,t){let n=e._x,r=e._y,s=e._z,o=e._w,a=t._x,l=t._y,c=t._z,u=t._w;return this._x=n*u+o*a+r*c-s*l,this._y=r*u+o*l+s*a-n*c,this._z=s*u+o*c+n*l-r*a,this._w=o*u-n*a-r*l-s*c,this._onChangeCallback(),this}slerp(e,t){let n=e._x,r=e._y,s=e._z,o=e._w,a=this.dot(e);a<0&&(n=-n,r=-r,s=-s,o=-o,a=-a);let l=1-t;if(a<.9995){let c=Math.acos(a),u=Math.sin(c);l=Math.sin(l*c)/u,t=Math.sin(t*c)/u,this._x=this._x*l+n*t,this._y=this._y*l+r*t,this._z=this._z*l+s*t,this._w=this._w*l+o*t,this._onChangeCallback()}else this._x=this._x*l+n*t,this._y=this._y*l+r*t,this._z=this._z*l+s*t,this._w=this._w*l+o*t,this.normalize();return this}slerpQuaternions(e,t,n){return this.copy(e).slerp(t,n)}random(){let e=2*Math.PI*Math.random(),t=2*Math.PI*Math.random(),n=Math.random(),r=Math.sqrt(1-n),s=Math.sqrt(n);return this.set(r*Math.sin(e),r*Math.cos(e),s*Math.sin(t),s*Math.cos(t))}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w}fromArray(e,t=0){return this._x=e[t],this._y=e[t+1],this._z=e[t+2],this._w=e[t+3],this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._w,e}fromBufferAttribute(e,t){return this._x=e.getX(t),this._y=e.getY(t),this._z=e.getZ(t),this._w=e.getW(t),this._onChangeCallback(),this}toJSON(){return this.toArray()}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}},wL=class wL{constructor(e=0,t=0,n=0){this.x=e,this.y=t,this.z=n}set(e,t,n){return n===void 0&&(n=this.z),this.x=e,this.y=t,this.z=n,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;default:throw new Error("THREE.Vector3: index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("THREE.Vector3: index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this}multiplyVectors(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this.z=e.z*t.z,this}applyEuler(e){return this.applyQuaternion(Jq.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(Jq.setFromAxisAngle(e,t))}applyMatrix3(e){let t=this.x,n=this.y,r=this.z,s=e.elements;return this.x=s[0]*t+s[3]*n+s[6]*r,this.y=s[1]*t+s[4]*n+s[7]*r,this.z=s[2]*t+s[5]*n+s[8]*r,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){let t=this.x,n=this.y,r=this.z,s=e.elements,o=1/(s[3]*t+s[7]*n+s[11]*r+s[15]);return this.x=(s[0]*t+s[4]*n+s[8]*r+s[12])*o,this.y=(s[1]*t+s[5]*n+s[9]*r+s[13])*o,this.z=(s[2]*t+s[6]*n+s[10]*r+s[14])*o,this}applyQuaternion(e){let t=this.x,n=this.y,r=this.z,s=e.x,o=e.y,a=e.z,l=e.w,c=2*(o*r-a*n),u=2*(a*t-s*r),f=2*(s*n-o*t);return this.x=t+l*c+o*f-a*u,this.y=n+l*u+a*c-s*f,this.z=r+l*f+s*u-o*c,this}project(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)}unproject(e){return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)}transformDirection(e){let t=this.x,n=this.y,r=this.z,s=e.elements;return this.x=s[0]*t+s[4]*n+s[8]*r,this.y=s[1]*t+s[5]*n+s[9]*r,this.z=s[2]*t+s[6]*n+s[10]*r,this.normalize()}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this}divideScalar(e){return this.multiplyScalar(1/e)}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this}clamp(e,t){return this.x=Pn(this.x,e.x,t.x),this.y=Pn(this.y,e.y,t.y),this.z=Pn(this.z,e.z,t.z),this}clampScalar(e,t){return this.x=Pn(this.x,e,t),this.y=Pn(this.y,e,t),this.z=Pn(this.z,e,t),this}clampLength(e,t){let n=this.length();return this.divideScalar(n||1).multiplyScalar(Pn(n,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this}cross(e){return this.crossVectors(this,e)}crossVectors(e,t){let n=e.x,r=e.y,s=e.z,o=t.x,a=t.y,l=t.z;return this.x=r*l-s*a,this.y=s*o-n*l,this.z=n*a-r*o,this}projectOnVector(e){let t=e.lengthSq();if(t===0)return this.set(0,0,0);let n=e.dot(this)/t;return this.copy(e).multiplyScalar(n)}projectOnPlane(e){return lN.copy(this).projectOnVector(e),this.sub(lN)}reflect(e){return this.sub(lN.copy(e).multiplyScalar(2*this.dot(e)))}angleTo(e){let t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;let n=this.dot(e)/t;return Math.acos(Pn(n,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){let t=this.x-e.x,n=this.y-e.y,r=this.z-e.z;return t*t+n*n+r*r}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)}setFromSpherical(e){return this.setFromSphericalCoords(e.radius,e.phi,e.theta)}setFromSphericalCoords(e,t,n){let r=Math.sin(t)*e;return this.x=r*Math.sin(n),this.y=Math.cos(t)*e,this.z=r*Math.cos(n),this}setFromCylindrical(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)}setFromCylindricalCoords(e,t,n){return this.x=e*Math.sin(t),this.y=n,this.z=e*Math.cos(t),this}setFromMatrixPosition(e){let t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this}setFromMatrixScale(e){let t=this.setFromMatrixColumn(e,0).length(),n=this.setFromMatrixColumn(e,1).length(),r=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=n,this.z=r,this}setFromMatrixColumn(e,t){return this.fromArray(e.elements,t*4)}setFromMatrix3Column(e,t){return this.fromArray(e.elements,t*3)}setFromEuler(e){return this.x=e._x,this.y=e._y,this.z=e._z,this}setFromColor(e){return this.x=e.r,this.y=e.g,this.z=e.b,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){let e=Math.random()*Math.PI*2,t=Math.random()*2-1,n=Math.sqrt(1-t*t);return this.x=n*Math.cos(e),this.y=t,this.z=n*Math.sin(e),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}};wL.prototype.isVector3=!0;var ie=wL,lN=new ie,Jq=new ys,SL=class SL{constructor(e,t,n,r,s,o,a,l,c){this.elements=[1,0,0,0,1,0,0,0,1],e!==void 0&&this.set(e,t,n,r,s,o,a,l,c)}set(e,t,n,r,s,o,a,l,c){let u=this.elements;return u[0]=e,u[1]=r,u[2]=a,u[3]=t,u[4]=s,u[5]=l,u[6]=n,u[7]=o,u[8]=c,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){let t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],this}extractBasis(e,t,n){return e.setFromMatrix3Column(this,0),t.setFromMatrix3Column(this,1),n.setFromMatrix3Column(this,2),this}setFromMatrix4(e){let t=e.elements;return this.set(t[0],t[4],t[8],t[1],t[5],t[9],t[2],t[6],t[10]),this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){let n=e.elements,r=t.elements,s=this.elements,o=n[0],a=n[3],l=n[6],c=n[1],u=n[4],f=n[7],p=n[2],x=n[5],b=n[8],w=r[0],S=r[3],T=r[6],P=r[1],R=r[4],C=r[7],L=r[2],D=r[5],F=r[8];return s[0]=o*w+a*P+l*L,s[3]=o*S+a*R+l*D,s[6]=o*T+a*C+l*F,s[1]=c*w+u*P+f*L,s[4]=c*S+u*R+f*D,s[7]=c*T+u*C+f*F,s[2]=p*w+x*P+b*L,s[5]=p*S+x*R+b*D,s[8]=p*T+x*C+b*F,this}multiplyScalar(e){let t=this.elements;return t[0]*=e,t[3]*=e,t[6]*=e,t[1]*=e,t[4]*=e,t[7]*=e,t[2]*=e,t[5]*=e,t[8]*=e,this}determinant(){let e=this.elements,t=e[0],n=e[1],r=e[2],s=e[3],o=e[4],a=e[5],l=e[6],c=e[7],u=e[8];return t*o*u-t*a*c-n*s*u+n*a*l+r*s*c-r*o*l}invert(){let e=this.elements,t=e[0],n=e[1],r=e[2],s=e[3],o=e[4],a=e[5],l=e[6],c=e[7],u=e[8],f=u*o-a*c,p=a*l-u*s,x=c*s-o*l,b=t*f+n*p+r*x;if(b===0)return this.set(0,0,0,0,0,0,0,0,0);let w=1/b;return e[0]=f*w,e[1]=(r*c-u*n)*w,e[2]=(a*n-r*o)*w,e[3]=p*w,e[4]=(u*t-r*l)*w,e[5]=(r*s-a*t)*w,e[6]=x*w,e[7]=(n*l-c*t)*w,e[8]=(o*t-n*s)*w,this}transpose(){let e,t=this.elements;return e=t[1],t[1]=t[3],t[3]=e,e=t[2],t[2]=t[6],t[6]=e,e=t[5],t[5]=t[7],t[7]=e,this}getNormalMatrix(e){return this.setFromMatrix4(e).invert().transpose()}transposeIntoArray(e){let t=this.elements;return e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8],this}setUvTransform(e,t,n,r,s,o,a){let l=Math.cos(s),c=Math.sin(s);return this.set(n*l,n*c,-n*(l*o+c*a)+o+e,-r*c,r*l,-r*(-c*o+l*a)+a+t,0,0,1),this}scale(e,t){return Zn("Matrix3: .scale() is deprecated. Use .makeScale() instead."),this.premultiply(cN.makeScale(e,t)),this}rotate(e){return Zn("Matrix3: .rotate() is deprecated. Use .makeRotation() instead."),this.premultiply(cN.makeRotation(-e)),this}translate(e,t){return Zn("Matrix3: .translate() is deprecated. Use .makeTranslation() instead."),this.premultiply(cN.makeTranslation(e,t)),this}makeTranslation(e,t){return e.isVector2?this.set(1,0,e.x,0,1,e.y,0,0,1):this.set(1,0,e,0,1,t,0,0,1),this}makeRotation(e){let t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,n,t,0,0,0,1),this}makeScale(e,t){return this.set(e,0,0,0,t,0,0,0,1),this}equals(e){let t=this.elements,n=e.elements;for(let r=0;r<9;r++)if(t[r]!==n[r])return!1;return!0}fromArray(e,t=0){for(let n=0;n<9;n++)this.elements[n]=e[n+t];return this}toArray(e=[],t=0){let n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e}clone(){return new this.constructor().fromArray(this.elements)}};SL.prototype.isMatrix3=!0;var Sn=SL,cN=new Sn,eH=new Sn().set(.4123908,.3575843,.1804808,.212639,.7151687,.0721923,.0193308,.1191948,.9505322),tH=new Sn().set(3.2409699,-1.5373832,-.4986108,-.9692436,1.8759675,.0415551,.0556301,-.203977,1.0569715);function ece(){let i={enabled:!0,workingColorSpace:Gd,spaces:{},convert:function(r,s,o){return this.enabled===!1||s===o||!s||!o||(this.spaces[s].transfer===Bt&&(r.r=wf(r.r),r.g=wf(r.g),r.b=wf(r.b)),this.spaces[s].primaries!==this.spaces[o].primaries&&(r.applyMatrix3(this.spaces[s].toXYZ),r.applyMatrix3(this.spaces[o].fromXYZ)),this.spaces[o].transfer===Bt&&(r.r=a_(r.r),r.g=a_(r.g),r.b=a_(r.b))),r},workingToColorSpace:function(r,s){return this.convert(r,this.workingColorSpace,s)},colorSpaceToWorking:function(r,s){return this.convert(r,s,this.workingColorSpace)},getPrimaries:function(r){return this.spaces[r].primaries},getTransfer:function(r){return r===Go?zd:this.spaces[r].transfer},getToneMappingMode:function(r){return this.spaces[r].outputColorSpaceConfig.toneMappingMode||"standard"},getLuminanceCoefficients:function(r,s=this.workingColorSpace){return r.fromArray(this.spaces[s].luminanceCoefficients)},define:function(r){Object.assign(this.spaces,r)},_getMatrix:function(r,s,o){return r.copy(this.spaces[s].toXYZ).multiply(this.spaces[o].fromXYZ)},_getDrawingBufferColorSpace:function(r){return this.spaces[r].outputColorSpaceConfig.drawingBufferColorSpace},_getUnpackColorSpace:function(r=this.workingColorSpace){return this.spaces[r].workingColorSpaceConfig.unpackColorSpace},fromWorkingColorSpace:function(r,s){return Zn("ColorManagement: .fromWorkingColorSpace() has been renamed to .workingToColorSpace()."),i.workingToColorSpace(r,s)},toWorkingColorSpace:function(r,s){return Zn("ColorManagement: .toWorkingColorSpace() has been renamed to .colorSpaceToWorking()."),i.colorSpaceToWorking(r,s)}},e=[.64,.33,.3,.6,.15,.06],t=[.2126,.7152,.0722],n=[.3127,.329];return i.define({[Gd]:{primaries:e,whitePoint:n,transfer:zd,toXYZ:eH,fromXYZ:tH,luminanceCoefficients:t,workingColorSpaceConfig:{unpackColorSpace:Wr},outputColorSpaceConfig:{drawingBufferColorSpace:Wr}},[Wr]:{primaries:e,whitePoint:n,transfer:Bt,toXYZ:eH,fromXYZ:tH,luminanceCoefficients:t,outputColorSpaceConfig:{drawingBufferColorSpace:Wr}}}),i}var sn=ece();function wf(i){return i<.04045?i*.0773993808:Math.pow(i*.9478672986+.0521327014,2.4)}function a_(i){return i<.0031308?i*12.92:1.055*Math.pow(i,.41666)-.055}var Vg,AT=class{static getDataURL(e,t="image/png"){if(/^data:/i.test(e.src)||typeof HTMLCanvasElement>"u")return e.src;let n;if(e instanceof HTMLCanvasElement)n=e;else{Vg===void 0&&(Vg=l_("canvas")),Vg.width=e.width,Vg.height=e.height;let r=Vg.getContext("2d");e instanceof ImageData?r.putImageData(e,0,0):r.drawImage(e,0,0,e.width,e.height),n=Vg}return n.toDataURL(t)}static sRGBToLinear(e){if(typeof HTMLImageElement<"u"&&e instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&e instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&e instanceof ImageBitmap){let t=l_("canvas");t.width=e.width,t.height=e.height;let n=t.getContext("2d");n.drawImage(e,0,0,e.width,e.height);let r=n.getImageData(0,0,e.width,e.height),s=r.data;for(let o=0;o<s.length;o++)s[o]=wf(s[o]/255)*255;return n.putImageData(r,0,0),t}else if(e.data){let t=e.data.slice(0);for(let n=0;n<t.length;n++)t instanceof Uint8Array||t instanceof Uint8ClampedArray?t[n]=Math.floor(wf(t[n]/255)*255):t[n]=wf(t[n]);return{data:t,width:e.width,height:e.height}}else return je("ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied."),e}},tce=0,u_=class{constructor(e=null){this.isSource=!0,Object.defineProperty(this,"id",{value:tce++}),this.uuid=Fu(),this.data=e,this.dataReady=!0,this.version=0}getSize(e){let t=this.data;return typeof HTMLVideoElement<"u"&&t instanceof HTMLVideoElement?e.set(t.videoWidth,t.videoHeight,0):typeof VideoFrame<"u"&&t instanceof VideoFrame?e.set(t.displayWidth,t.displayHeight,0):t!==null?e.set(t.width,t.height,t.depth||0):e.set(0,0,0),e}set needsUpdate(e){e===!0&&this.version++}toJSON(e){let t=e===void 0||typeof e=="string";if(!t&&e.images[this.uuid]!==void 0)return e.images[this.uuid];let n={uuid:this.uuid,url:""},r=this.data;if(r!==null){let s;if(Array.isArray(r)){s=[];for(let o=0,a=r.length;o<a;o++)r[o].isDataTexture?s.push(uN(r[o].image)):s.push(uN(r[o]))}else s=uN(r);n.url=s}return t||(e.images[this.uuid]=n),n}};function uN(i){return typeof HTMLImageElement<"u"&&i instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&i instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&i instanceof ImageBitmap?AT.getDataURL(i):i.data?{data:Array.from(i.data),width:i.width,height:i.height,type:i.data.constructor.name}:(je("Texture: Unable to serialize Texture."),{})}var nce=0,hN=new ie,vs=class i extends Uo{constructor(e=i.DEFAULT_IMAGE,t=i.DEFAULT_MAPPING,n=Bo,r=Bo,s=vi,o=mo,a=xr,l=Gi,c=i.DEFAULT_ANISOTROPY,u=Go){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:nce++}),this.uuid=Fu(),this.name="",this.source=new u_(e),this.mipmaps=[],this.mapping=t,this.channel=0,this.wrapS=n,this.wrapT=r,this.magFilter=s,this.minFilter=o,this.anisotropy=c,this.format=a,this.internalFormat=null,this.type=l,this.offset=new Oe(0,0),this.repeat=new Oe(1,1),this.center=new Oe(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new Sn,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.colorSpace=u,this.userData={},this.updateRanges=[],this.version=0,this.onUpdate=null,this.renderTarget=null,this.isRenderTargetTexture=!1,this.isArrayTexture=!!(e&&e.depth&&e.depth>1),this.pmremVersion=0,this.normalized=!1}get width(){return this.source.getSize(hN).x}get height(){return this.source.getSize(hN).y}get depth(){return this.source.getSize(hN).z}get image(){return this.source.data}set image(e){this.source.data=e}updateMatrix(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}clone(){return new this.constructor().copy(this)}copy(e){return this.name=e.name,this.source=e.source,this.mipmaps=e.mipmaps.slice(0),this.mapping=e.mapping,this.channel=e.channel,this.wrapS=e.wrapS,this.wrapT=e.wrapT,this.magFilter=e.magFilter,this.minFilter=e.minFilter,this.anisotropy=e.anisotropy,this.format=e.format,this.internalFormat=e.internalFormat,this.type=e.type,this.normalized=e.normalized,this.offset.copy(e.offset),this.repeat.copy(e.repeat),this.center.copy(e.center),this.rotation=e.rotation,this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrix.copy(e.matrix),this.generateMipmaps=e.generateMipmaps,this.premultiplyAlpha=e.premultiplyAlpha,this.flipY=e.flipY,this.unpackAlignment=e.unpackAlignment,this.colorSpace=e.colorSpace,this.renderTarget=e.renderTarget,this.isRenderTargetTexture=e.isRenderTargetTexture,this.isArrayTexture=e.isArrayTexture,this.userData=JSON.parse(JSON.stringify(e.userData)),this.needsUpdate=!0,this}setValues(e){for(let t in e){let n=e[t];if(n===void 0){je(`Texture.setValues(): parameter '${t}' has value of undefined.`);continue}let r=this[t];if(r===void 0){je(`Texture.setValues(): property '${t}' does not exist.`);continue}r&&n&&r.isVector2&&n.isVector2||r&&n&&r.isVector3&&n.isVector3||r&&n&&r.isMatrix3&&n.isMatrix3?r.copy(n):this[t]=n}}toJSON(e){let t=e===void 0||typeof e=="string";if(!t&&e.textures[this.uuid]!==void 0)return e.textures[this.uuid];let n={metadata:{version:4.7,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,image:this.source.toJSON(e).uuid,mapping:this.mapping,channel:this.channel,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],center:[this.center.x,this.center.y],rotation:this.rotation,wrap:[this.wrapS,this.wrapT],format:this.format,internalFormat:this.internalFormat,type:this.type,normalized:this.normalized,colorSpace:this.colorSpace,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,generateMipmaps:this.generateMipmaps,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};return Object.keys(this.userData).length>0&&(n.userData=this.userData),t||(e.textures[this.uuid]=n),n}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(e){if(this.mapping!==d2)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case Sf:e.x=e.x-Math.floor(e.x);break;case Bo:e.x=e.x<0?0:1;break;case Tf:Math.abs(Math.floor(e.x)%2)===1?e.x=Math.ceil(e.x)-e.x:e.x=e.x-Math.floor(e.x);break}if(e.y<0||e.y>1)switch(this.wrapT){case Sf:e.y=e.y-Math.floor(e.y);break;case Bo:e.y=e.y<0?0:1;break;case Tf:Math.abs(Math.floor(e.y)%2)===1?e.y=Math.ceil(e.y)-e.y:e.y=e.y-Math.floor(e.y);break}return this.flipY&&(e.y=1-e.y),e}set needsUpdate(e){e===!0&&(this.version++,this.source.needsUpdate=!0)}set needsPMREMUpdate(e){e===!0&&this.pmremVersion++}};vs.DEFAULT_IMAGE=null;vs.DEFAULT_MAPPING=d2;vs.DEFAULT_ANISOTROPY=1;var TL=class TL{constructor(e=0,t=0,n=0,r=1){this.x=e,this.y=t,this.z=n,this.w=r}get width(){return this.z}set width(e){this.z=e}get height(){return this.w}set height(e){this.w=e}set(e,t,n,r){return this.x=e,this.y=t,this.z=n,this.w=r,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this.w=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setW(e){return this.w=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;case 3:this.w=t;break;default:throw new Error("THREE.Vector4: index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("THREE.Vector4: index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=e.w!==void 0?e.w:1,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this.w+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this.w=e.w+t.w,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this.w+=e.w*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this.w-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this.w=e.w-t.w,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this.w*=e.w,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this}applyMatrix4(e){let t=this.x,n=this.y,r=this.z,s=this.w,o=e.elements;return this.x=o[0]*t+o[4]*n+o[8]*r+o[12]*s,this.y=o[1]*t+o[5]*n+o[9]*r+o[13]*s,this.z=o[2]*t+o[6]*n+o[10]*r+o[14]*s,this.w=o[3]*t+o[7]*n+o[11]*r+o[15]*s,this}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this.w/=e.w,this}divideScalar(e){return this.multiplyScalar(1/e)}setAxisAngleFromQuaternion(e){this.w=2*Math.acos(e.w);let t=Math.sqrt(1-e.w*e.w);return t<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=e.x/t,this.y=e.y/t,this.z=e.z/t),this}setAxisAngleFromRotationMatrix(e){let t,n,r,s,l=e.elements,c=l[0],u=l[4],f=l[8],p=l[1],x=l[5],b=l[9],w=l[2],S=l[6],T=l[10];if(Math.abs(u-p)<.01&&Math.abs(f-w)<.01&&Math.abs(b-S)<.01){if(Math.abs(u+p)<.1&&Math.abs(f+w)<.1&&Math.abs(b+S)<.1&&Math.abs(c+x+T-3)<.1)return this.set(1,0,0,0),this;t=Math.PI;let R=(c+1)/2,C=(x+1)/2,L=(T+1)/2,D=(u+p)/4,F=(f+w)/4,N=(b+S)/4;return R>C&&R>L?R<.01?(n=0,r=.707106781,s=.707106781):(n=Math.sqrt(R),r=D/n,s=F/n):C>L?C<.01?(n=.707106781,r=0,s=.707106781):(r=Math.sqrt(C),n=D/r,s=N/r):L<.01?(n=.707106781,r=.707106781,s=0):(s=Math.sqrt(L),n=F/s,r=N/s),this.set(n,r,s,t),this}let P=Math.sqrt((S-b)*(S-b)+(f-w)*(f-w)+(p-u)*(p-u));return Math.abs(P)<.001&&(P=1),this.x=(S-b)/P,this.y=(f-w)/P,this.z=(p-u)/P,this.w=Math.acos((c+x+T-1)/2),this}setFromMatrixPosition(e){let t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this.w=t[15],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this.w=Math.min(this.w,e.w),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this.w=Math.max(this.w,e.w),this}clamp(e,t){return this.x=Pn(this.x,e.x,t.x),this.y=Pn(this.y,e.y,t.y),this.z=Pn(this.z,e.z,t.z),this.w=Pn(this.w,e.w,t.w),this}clampScalar(e,t){return this.x=Pn(this.x,e,t),this.y=Pn(this.y,e,t),this.z=Pn(this.z,e,t),this.w=Pn(this.w,e,t),this}clampLength(e,t){let n=this.length();return this.divideScalar(n||1).multiplyScalar(Pn(n,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this.w=Math.trunc(this.w),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z+this.w*e.w}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this.w+=(e.w-this.w)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this.w=e.w+(t.w-e.w)*n,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z&&e.w===this.w}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this.w=e[t+3],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e[t+3]=this.w,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this.w=e.getW(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z,yield this.w}};TL.prototype.isVector4=!0;var gn=TL,aa=class extends Uo{constructor(e=1,t=1,n={}){super(),n=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:vi,depthBuffer:!0,stencilBuffer:!1,resolveDepthBuffer:!0,resolveStencilBuffer:!0,depthTexture:null,samples:0,count:1,depth:1,multiview:!1,useArrayDepthTexture:!1},n),this.isRenderTarget=!0,this.width=e,this.height=t,this.depth=n.depth,this.scissor=new gn(0,0,e,t),this.scissorTest=!1,this.viewport=new gn(0,0,e,t),this.textures=[];let r={width:e,height:t,depth:n.depth},s=new vs(r),o=n.count;for(let a=0;a<o;a++)this.textures[a]=s.clone(),this.textures[a].isRenderTargetTexture=!0,this.textures[a].renderTarget=this;this._setTextureOptions(n),this.depthBuffer=n.depthBuffer,this.stencilBuffer=n.stencilBuffer,this.resolveDepthBuffer=n.resolveDepthBuffer,this.resolveStencilBuffer=n.resolveStencilBuffer,this._depthTexture=null,this.depthTexture=n.depthTexture,this.samples=n.samples,this.multiview=n.multiview,this.useArrayDepthTexture=n.useArrayDepthTexture}_setTextureOptions(e={}){let t={minFilter:vi,generateMipmaps:!1,flipY:!1,internalFormat:null};e.mapping!==void 0&&(t.mapping=e.mapping),e.wrapS!==void 0&&(t.wrapS=e.wrapS),e.wrapT!==void 0&&(t.wrapT=e.wrapT),e.wrapR!==void 0&&(t.wrapR=e.wrapR),e.magFilter!==void 0&&(t.magFilter=e.magFilter),e.minFilter!==void 0&&(t.minFilter=e.minFilter),e.format!==void 0&&(t.format=e.format),e.type!==void 0&&(t.type=e.type),e.anisotropy!==void 0&&(t.anisotropy=e.anisotropy),e.colorSpace!==void 0&&(t.colorSpace=e.colorSpace),e.flipY!==void 0&&(t.flipY=e.flipY),e.generateMipmaps!==void 0&&(t.generateMipmaps=e.generateMipmaps),e.internalFormat!==void 0&&(t.internalFormat=e.internalFormat);for(let n=0;n<this.textures.length;n++)this.textures[n].setValues(t)}get texture(){return this.textures[0]}set texture(e){this.textures[0]=e}set depthTexture(e){this._depthTexture!==null&&(this._depthTexture.renderTarget=null),e!==null&&(e.renderTarget=this),this._depthTexture=e}get depthTexture(){return this._depthTexture}setSize(e,t,n=1){if(this.width!==e||this.height!==t||this.depth!==n){this.width=e,this.height=t,this.depth=n;for(let r=0,s=this.textures.length;r<s;r++)this.textures[r].image.width=e,this.textures[r].image.height=t,this.textures[r].image.depth=n,this.textures[r].isData3DTexture!==!0&&(this.textures[r].isArrayTexture=this.textures[r].image.depth>1);this.dispose()}this.viewport.set(0,0,e,t),this.scissor.set(0,0,e,t)}clone(){return new this.constructor().copy(this)}copy(e){this.width=e.width,this.height=e.height,this.depth=e.depth,this.scissor.copy(e.scissor),this.scissorTest=e.scissorTest,this.viewport.copy(e.viewport),this.textures.length=0;for(let t=0,n=e.textures.length;t<n;t++){this.textures[t]=e.textures[t].clone(),this.textures[t].isRenderTargetTexture=!0,this.textures[t].renderTarget=this;let r=Object.assign({},e.textures[t].image);this.textures[t].source=new u_(r)}return this.depthBuffer=e.depthBuffer,this.stencilBuffer=e.stencilBuffer,this.resolveDepthBuffer=e.resolveDepthBuffer,this.resolveStencilBuffer=e.resolveStencilBuffer,e.depthTexture!==null&&(this.depthTexture=e.depthTexture.clone()),this.samples=e.samples,this.multiview=e.multiview,this.useArrayDepthTexture=e.useArrayDepthTexture,this}dispose(){this.dispatchEvent({type:"dispose"})}},la=class extends aa{constructor(e=1,t=1,n={}){super(e,t,n),this.isWebGLRenderTarget=!0}},AA=class extends vs{constructor(e=null,t=1,n=1,r=1){super(null),this.isDataArrayTexture=!0,this.image={data:e,width:t,height:n,depth:r},this.magFilter=xi,this.minFilter=xi,this.wrapR=Bo,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.layerUpdates=new Set}addLayerUpdate(e){this.layerUpdates.add(e)}clearLayerUpdates(){this.layerUpdates.clear()}};var mT=class extends vs{constructor(e=null,t=1,n=1,r=1){super(null),this.isData3DTexture=!0,this.image={data:e,width:t,height:n,depth:r},this.magFilter=xi,this.minFilter=xi,this.wrapR=Bo,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}};var kT=class kT{constructor(e,t,n,r,s,o,a,l,c,u,f,p,x,b,w,S){this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],e!==void 0&&this.set(e,t,n,r,s,o,a,l,c,u,f,p,x,b,w,S)}set(e,t,n,r,s,o,a,l,c,u,f,p,x,b,w,S){let T=this.elements;return T[0]=e,T[4]=t,T[8]=n,T[12]=r,T[1]=s,T[5]=o,T[9]=a,T[13]=l,T[2]=c,T[6]=u,T[10]=f,T[14]=p,T[3]=x,T[7]=b,T[11]=w,T[15]=S,this}identity(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this}clone(){return new kT().fromArray(this.elements)}copy(e){let t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],t[9]=n[9],t[10]=n[10],t[11]=n[11],t[12]=n[12],t[13]=n[13],t[14]=n[14],t[15]=n[15],this}copyPosition(e){let t=this.elements,n=e.elements;return t[12]=n[12],t[13]=n[13],t[14]=n[14],this}setFromMatrix3(e){let t=e.elements;return this.set(t[0],t[3],t[6],0,t[1],t[4],t[7],0,t[2],t[5],t[8],0,0,0,0,1),this}extractBasis(e,t,n){return this.determinantAffine()===0?(e.set(1,0,0),t.set(0,1,0),n.set(0,0,1),this):(e.setFromMatrixColumn(this,0),t.setFromMatrixColumn(this,1),n.setFromMatrixColumn(this,2),this)}makeBasis(e,t,n){return this.set(e.x,t.x,n.x,0,e.y,t.y,n.y,0,e.z,t.z,n.z,0,0,0,0,1),this}extractRotation(e){if(e.determinantAffine()===0)return this.identity();let t=this.elements,n=e.elements,r=1/qg.setFromMatrixColumn(e,0).length(),s=1/qg.setFromMatrixColumn(e,1).length(),o=1/qg.setFromMatrixColumn(e,2).length();return t[0]=n[0]*r,t[1]=n[1]*r,t[2]=n[2]*r,t[3]=0,t[4]=n[4]*s,t[5]=n[5]*s,t[6]=n[6]*s,t[7]=0,t[8]=n[8]*o,t[9]=n[9]*o,t[10]=n[10]*o,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromEuler(e){let t=this.elements,n=e.x,r=e.y,s=e.z,o=Math.cos(n),a=Math.sin(n),l=Math.cos(r),c=Math.sin(r),u=Math.cos(s),f=Math.sin(s);if(e.order==="XYZ"){let p=o*u,x=o*f,b=a*u,w=a*f;t[0]=l*u,t[4]=-l*f,t[8]=c,t[1]=x+b*c,t[5]=p-w*c,t[9]=-a*l,t[2]=w-p*c,t[6]=b+x*c,t[10]=o*l}else if(e.order==="YXZ"){let p=l*u,x=l*f,b=c*u,w=c*f;t[0]=p+w*a,t[4]=b*a-x,t[8]=o*c,t[1]=o*f,t[5]=o*u,t[9]=-a,t[2]=x*a-b,t[6]=w+p*a,t[10]=o*l}else if(e.order==="ZXY"){let p=l*u,x=l*f,b=c*u,w=c*f;t[0]=p-w*a,t[4]=-o*f,t[8]=b+x*a,t[1]=x+b*a,t[5]=o*u,t[9]=w-p*a,t[2]=-o*c,t[6]=a,t[10]=o*l}else if(e.order==="ZYX"){let p=o*u,x=o*f,b=a*u,w=a*f;t[0]=l*u,t[4]=b*c-x,t[8]=p*c+w,t[1]=l*f,t[5]=w*c+p,t[9]=x*c-b,t[2]=-c,t[6]=a*l,t[10]=o*l}else if(e.order==="YZX"){let p=o*l,x=o*c,b=a*l,w=a*c;t[0]=l*u,t[4]=w-p*f,t[8]=b*f+x,t[1]=f,t[5]=o*u,t[9]=-a*u,t[2]=-c*u,t[6]=x*f+b,t[10]=p-w*f}else if(e.order==="XZY"){let p=o*l,x=o*c,b=a*l,w=a*c;t[0]=l*u,t[4]=-f,t[8]=c*u,t[1]=p*f+w,t[5]=o*u,t[9]=x*f-b,t[2]=b*f-x,t[6]=a*u,t[10]=w*f+p}return t[3]=0,t[7]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromQuaternion(e){return this.compose(ice,e,rce)}lookAt(e,t,n){let r=this.elements;return fl.subVectors(e,t),fl.lengthSq()===0&&(fl.z=1),fl.normalize(),Id.crossVectors(n,fl),Id.lengthSq()===0&&(Math.abs(n.z)===1?fl.x+=1e-4:fl.z+=1e-4,fl.normalize(),Id.crossVectors(n,fl)),Id.normalize(),FS.crossVectors(fl,Id),r[0]=Id.x,r[4]=FS.x,r[8]=fl.x,r[1]=Id.y,r[5]=FS.y,r[9]=fl.y,r[2]=Id.z,r[6]=FS.z,r[10]=fl.z,this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){let n=e.elements,r=t.elements,s=this.elements,o=n[0],a=n[4],l=n[8],c=n[12],u=n[1],f=n[5],p=n[9],x=n[13],b=n[2],w=n[6],S=n[10],T=n[14],P=n[3],R=n[7],C=n[11],L=n[15],D=r[0],F=r[4],N=r[8],B=r[12],z=r[1],V=r[5],H=r[9],Z=r[13],J=r[2],j=r[6],K=r[10],ee=r[14],ae=r[3],ce=r[7],de=r[11],ve=r[15];return s[0]=o*D+a*z+l*J+c*ae,s[4]=o*F+a*V+l*j+c*ce,s[8]=o*N+a*H+l*K+c*de,s[12]=o*B+a*Z+l*ee+c*ve,s[1]=u*D+f*z+p*J+x*ae,s[5]=u*F+f*V+p*j+x*ce,s[9]=u*N+f*H+p*K+x*de,s[13]=u*B+f*Z+p*ee+x*ve,s[2]=b*D+w*z+S*J+T*ae,s[6]=b*F+w*V+S*j+T*ce,s[10]=b*N+w*H+S*K+T*de,s[14]=b*B+w*Z+S*ee+T*ve,s[3]=P*D+R*z+C*J+L*ae,s[7]=P*F+R*V+C*j+L*ce,s[11]=P*N+R*H+C*K+L*de,s[15]=P*B+R*Z+C*ee+L*ve,this}multiplyScalar(e){let t=this.elements;return t[0]*=e,t[4]*=e,t[8]*=e,t[12]*=e,t[1]*=e,t[5]*=e,t[9]*=e,t[13]*=e,t[2]*=e,t[6]*=e,t[10]*=e,t[14]*=e,t[3]*=e,t[7]*=e,t[11]*=e,t[15]*=e,this}determinant(){let e=this.elements,t=e[0],n=e[4],r=e[8],s=e[12],o=e[1],a=e[5],l=e[9],c=e[13],u=e[2],f=e[6],p=e[10],x=e[14],b=e[3],w=e[7],S=e[11],T=e[15],P=l*x-c*p,R=a*x-c*f,C=a*p-l*f,L=o*x-c*u,D=o*p-l*u,F=o*f-a*u;return t*(w*P-S*R+T*C)-n*(b*P-S*L+T*D)+r*(b*R-w*L+T*F)-s*(b*C-w*D+S*F)}determinantAffine(){let e=this.elements,t=e[0],n=e[4],r=e[8],s=e[1],o=e[5],a=e[9],l=e[2],c=e[6],u=e[10];return t*(o*u-a*c)-n*(s*u-a*l)+r*(s*c-o*l)}transpose(){let e=this.elements,t;return t=e[1],e[1]=e[4],e[4]=t,t=e[2],e[2]=e[8],e[8]=t,t=e[6],e[6]=e[9],e[9]=t,t=e[3],e[3]=e[12],e[12]=t,t=e[7],e[7]=e[13],e[13]=t,t=e[11],e[11]=e[14],e[14]=t,this}setPosition(e,t,n){let r=this.elements;return e.isVector3?(r[12]=e.x,r[13]=e.y,r[14]=e.z):(r[12]=e,r[13]=t,r[14]=n),this}invert(){let e=this.elements,t=e[0],n=e[1],r=e[2],s=e[3],o=e[4],a=e[5],l=e[6],c=e[7],u=e[8],f=e[9],p=e[10],x=e[11],b=e[12],w=e[13],S=e[14],T=e[15],P=t*a-n*o,R=t*l-r*o,C=t*c-s*o,L=n*l-r*a,D=n*c-s*a,F=r*c-s*l,N=u*w-f*b,B=u*S-p*b,z=u*T-x*b,V=f*S-p*w,H=f*T-x*w,Z=p*T-x*S,J=P*Z-R*H+C*V+L*z-D*B+F*N;if(J===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);let j=1/J;return e[0]=(a*Z-l*H+c*V)*j,e[1]=(r*H-n*Z-s*V)*j,e[2]=(w*F-S*D+T*L)*j,e[3]=(p*D-f*F-x*L)*j,e[4]=(l*z-o*Z-c*B)*j,e[5]=(t*Z-r*z+s*B)*j,e[6]=(S*C-b*F-T*R)*j,e[7]=(u*F-p*C+x*R)*j,e[8]=(o*H-a*z+c*N)*j,e[9]=(n*z-t*H-s*N)*j,e[10]=(b*D-w*C+T*P)*j,e[11]=(f*C-u*D-x*P)*j,e[12]=(a*B-o*V-l*N)*j,e[13]=(t*V-n*B+r*N)*j,e[14]=(w*R-b*L-S*P)*j,e[15]=(u*L-f*R+p*P)*j,this}scale(e){let t=this.elements,n=e.x,r=e.y,s=e.z;return t[0]*=n,t[4]*=r,t[8]*=s,t[1]*=n,t[5]*=r,t[9]*=s,t[2]*=n,t[6]*=r,t[10]*=s,t[3]*=n,t[7]*=r,t[11]*=s,this}getMaxScaleOnAxis(){let e=this.elements,t=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],n=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],r=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(t,n,r))}makeTranslation(e,t,n){return e.isVector3?this.set(1,0,0,e.x,0,1,0,e.y,0,0,1,e.z,0,0,0,1):this.set(1,0,0,e,0,1,0,t,0,0,1,n,0,0,0,1),this}makeRotationX(e){let t=Math.cos(e),n=Math.sin(e);return this.set(1,0,0,0,0,t,-n,0,0,n,t,0,0,0,0,1),this}makeRotationY(e){let t=Math.cos(e),n=Math.sin(e);return this.set(t,0,n,0,0,1,0,0,-n,0,t,0,0,0,0,1),this}makeRotationZ(e){let t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,0,n,t,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(e,t){let n=Math.cos(t),r=Math.sin(t),s=1-n,o=e.x,a=e.y,l=e.z,c=s*o,u=s*a;return this.set(c*o+n,c*a-r*l,c*l+r*a,0,c*a+r*l,u*a+n,u*l-r*o,0,c*l-r*a,u*l+r*o,s*l*l+n,0,0,0,0,1),this}makeScale(e,t,n){return this.set(e,0,0,0,0,t,0,0,0,0,n,0,0,0,0,1),this}makeShear(e,t,n,r,s,o){return this.set(1,n,s,0,e,1,o,0,t,r,1,0,0,0,0,1),this}compose(e,t,n){let r=this.elements,s=t._x,o=t._y,a=t._z,l=t._w,c=s+s,u=o+o,f=a+a,p=s*c,x=s*u,b=s*f,w=o*u,S=o*f,T=a*f,P=l*c,R=l*u,C=l*f,L=n.x,D=n.y,F=n.z;return r[0]=(1-(w+T))*L,r[1]=(x+C)*L,r[2]=(b-R)*L,r[3]=0,r[4]=(x-C)*D,r[5]=(1-(p+T))*D,r[6]=(S+P)*D,r[7]=0,r[8]=(b+R)*F,r[9]=(S-P)*F,r[10]=(1-(p+w))*F,r[11]=0,r[12]=e.x,r[13]=e.y,r[14]=e.z,r[15]=1,this}decompose(e,t,n){let r=this.elements;e.x=r[12],e.y=r[13],e.z=r[14];let s=this.determinantAffine();if(s===0)return n.set(1,1,1),t.identity(),this;let o=qg.set(r[0],r[1],r[2]).length(),a=qg.set(r[4],r[5],r[6]).length(),l=qg.set(r[8],r[9],r[10]).length();s<0&&(o=-o),Oc.copy(this);let c=1/o,u=1/a,f=1/l;return Oc.elements[0]*=c,Oc.elements[1]*=c,Oc.elements[2]*=c,Oc.elements[4]*=u,Oc.elements[5]*=u,Oc.elements[6]*=u,Oc.elements[8]*=f,Oc.elements[9]*=f,Oc.elements[10]*=f,t.setFromRotationMatrix(Oc),n.x=o,n.y=a,n.z=l,this}makePerspective(e,t,n,r,s,o,a=fo,l=!1){let c=this.elements,u=2*s/(t-e),f=2*s/(n-r),p=(t+e)/(t-e),x=(n+r)/(n-r),b,w;if(l)b=s/(o-s),w=o*s/(o-s);else if(a===fo)b=-(o+s)/(o-s),w=-2*o*s/(o-s);else if(a===Va)b=-o/(o-s),w=-o*s/(o-s);else throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+a);return c[0]=u,c[4]=0,c[8]=p,c[12]=0,c[1]=0,c[5]=f,c[9]=x,c[13]=0,c[2]=0,c[6]=0,c[10]=b,c[14]=w,c[3]=0,c[7]=0,c[11]=-1,c[15]=0,this}makeOrthographic(e,t,n,r,s,o,a=fo,l=!1){let c=this.elements,u=2/(t-e),f=2/(n-r),p=-(t+e)/(t-e),x=-(n+r)/(n-r),b,w;if(l)b=1/(o-s),w=o/(o-s);else if(a===fo)b=-2/(o-s),w=-(o+s)/(o-s);else if(a===Va)b=-1/(o-s),w=-s/(o-s);else throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+a);return c[0]=u,c[4]=0,c[8]=0,c[12]=p,c[1]=0,c[5]=f,c[9]=0,c[13]=x,c[2]=0,c[6]=0,c[10]=b,c[14]=w,c[3]=0,c[7]=0,c[11]=0,c[15]=1,this}equals(e){let t=this.elements,n=e.elements;for(let r=0;r<16;r++)if(t[r]!==n[r])return!1;return!0}fromArray(e,t=0){for(let n=0;n<16;n++)this.elements[n]=e[n+t];return this}toArray(e=[],t=0){let n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e[t+9]=n[9],e[t+10]=n[10],e[t+11]=n[11],e[t+12]=n[12],e[t+13]=n[13],e[t+14]=n[14],e[t+15]=n[15],e}};kT.prototype.isMatrix4=!0;var on=kT,qg=new ie,Oc=new on,ice=new ie(0,0,0),rce=new ie(1,1,1),Id=new ie,FS=new ie,fl=new ie,nH=new on,iH=new ys,ca=class i{constructor(e=0,t=0,n=0,r=i.DEFAULT_ORDER){this.isEuler=!0,this._x=e,this._y=t,this._z=n,this._order=r}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get order(){return this._order}set order(e){this._order=e,this._onChangeCallback()}set(e,t,n,r=this._order){return this._x=e,this._y=t,this._z=n,this._order=r,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(e){return this._x=e._x,this._y=e._y,this._z=e._z,this._order=e._order,this._onChangeCallback(),this}setFromRotationMatrix(e,t=this._order,n=!0){let r=e.elements,s=r[0],o=r[4],a=r[8],l=r[1],c=r[5],u=r[9],f=r[2],p=r[6],x=r[10];switch(t){case"XYZ":this._y=Math.asin(Pn(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(-u,x),this._z=Math.atan2(-o,s)):(this._x=Math.atan2(p,c),this._z=0);break;case"YXZ":this._x=Math.asin(-Pn(u,-1,1)),Math.abs(u)<.9999999?(this._y=Math.atan2(a,x),this._z=Math.atan2(l,c)):(this._y=Math.atan2(-f,s),this._z=0);break;case"ZXY":this._x=Math.asin(Pn(p,-1,1)),Math.abs(p)<.9999999?(this._y=Math.atan2(-f,x),this._z=Math.atan2(-o,c)):(this._y=0,this._z=Math.atan2(l,s));break;case"ZYX":this._y=Math.asin(-Pn(f,-1,1)),Math.abs(f)<.9999999?(this._x=Math.atan2(p,x),this._z=Math.atan2(l,s)):(this._x=0,this._z=Math.atan2(-o,c));break;case"YZX":this._z=Math.asin(Pn(l,-1,1)),Math.abs(l)<.9999999?(this._x=Math.atan2(-u,c),this._y=Math.atan2(-f,s)):(this._x=0,this._y=Math.atan2(a,x));break;case"XZY":this._z=Math.asin(-Pn(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(p,c),this._y=Math.atan2(a,s)):(this._x=Math.atan2(-u,x),this._y=0);break;default:je("Euler: .setFromRotationMatrix() encountered an unknown order: "+t)}return this._order=t,n===!0&&this._onChangeCallback(),this}setFromQuaternion(e,t,n){return nH.makeRotationFromQuaternion(e),this.setFromRotationMatrix(nH,t,n)}setFromVector3(e,t=this._order){return this.set(e.x,e.y,e.z,t)}reorder(e){return iH.setFromEuler(this),this.setFromQuaternion(iH,e)}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._order===this._order}fromArray(e){return this._x=e[0],this._y=e[1],this._z=e[2],e[3]!==void 0&&(this._order=e[3]),this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._order,e}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._order}};ca.DEFAULT_ORDER="XYZ";var h_=class{constructor(){this.mask=1}set(e){this.mask=(1<<e|0)>>>0}enable(e){this.mask|=1<<e|0}enableAll(){this.mask=-1}toggle(e){this.mask^=1<<e|0}disable(e){this.mask&=~(1<<e|0)}disableAll(){this.mask=0}test(e){return(this.mask&e.mask)!==0}isEnabled(e){return(this.mask&(1<<e|0))!==0}},sce=0,rH=new ie,Hg=new ys,Af=new on,OS=new ie,ny=new ie,oce=new ie,ace=new ys,sH=new ie(1,0,0),oH=new ie(0,1,0),aH=new ie(0,0,1),lH={type:"added"},lce={type:"removed"},Wg={type:"childadded",child:null},fN={type:"childremoved",child:null},$i=class i extends Uo{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:sce++}),this.uuid=Fu(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=i.DEFAULT_UP.clone();let e=new ie,t=new ca,n=new ys,r=new ie(1,1,1);function s(){n.setFromEuler(t,!1)}function o(){t.setFromQuaternion(n,void 0,!1)}t._onChange(s),n._onChange(o),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:e},rotation:{configurable:!0,enumerable:!0,value:t},quaternion:{configurable:!0,enumerable:!0,value:n},scale:{configurable:!0,enumerable:!0,value:r},modelViewMatrix:{value:new on},normalMatrix:{value:new Sn}}),this.matrix=new on,this.matrixWorld=new on,this.matrixAutoUpdate=i.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldAutoUpdate=i.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.layers=new h_,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.animations=[],this.customDepthMaterial=void 0,this.customDistanceMaterial=void 0,this.static=!1,this.userData={},this.pivot=null}onBeforeShadow(){}onAfterShadow(){}onBeforeRender(){}onAfterRender(){}applyMatrix4(e){this.matrixAutoUpdate&&this.updateMatrix(),this.matrix.premultiply(e),this.matrix.decompose(this.position,this.quaternion,this.scale)}applyQuaternion(e){return this.quaternion.premultiply(e),this}setRotationFromAxisAngle(e,t){this.quaternion.setFromAxisAngle(e,t)}setRotationFromEuler(e){this.quaternion.setFromEuler(e,!0)}setRotationFromMatrix(e){this.quaternion.setFromRotationMatrix(e)}setRotationFromQuaternion(e){this.quaternion.copy(e)}rotateOnAxis(e,t){return Hg.setFromAxisAngle(e,t),this.quaternion.multiply(Hg),this}rotateOnWorldAxis(e,t){return Hg.setFromAxisAngle(e,t),this.quaternion.premultiply(Hg),this}rotateX(e){return this.rotateOnAxis(sH,e)}rotateY(e){return this.rotateOnAxis(oH,e)}rotateZ(e){return this.rotateOnAxis(aH,e)}translateOnAxis(e,t){return rH.copy(e).applyQuaternion(this.quaternion),this.position.add(rH.multiplyScalar(t)),this}translateX(e){return this.translateOnAxis(sH,e)}translateY(e){return this.translateOnAxis(oH,e)}translateZ(e){return this.translateOnAxis(aH,e)}localToWorld(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(this.matrixWorld)}worldToLocal(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(Af.copy(this.matrixWorld).invert())}lookAt(e,t,n){e.isVector3?OS.copy(e):OS.set(e,t,n);let r=this.parent;this.updateWorldMatrix(!0,!1),ny.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?Af.lookAt(ny,OS,this.up):Af.lookAt(OS,ny,this.up),this.quaternion.setFromRotationMatrix(Af),r&&(Af.extractRotation(r.matrixWorld),Hg.setFromRotationMatrix(Af),this.quaternion.premultiply(Hg.invert()))}add(e){if(arguments.length>1){for(let t=0;t<arguments.length;t++)this.add(arguments[t]);return this}return e===this?(Ge("Object3D.add: object can't be added as a child of itself.",e),this):(e&&e.isObject3D?(e.removeFromParent(),e.parent=this,this.children.push(e),e.dispatchEvent(lH),Wg.child=e,this.dispatchEvent(Wg),Wg.child=null):Ge("Object3D.add: object not an instance of THREE.Object3D.",e),this)}remove(e){if(arguments.length>1){for(let n=0;n<arguments.length;n++)this.remove(arguments[n]);return this}let t=this.children.indexOf(e);return t!==-1&&(e.parent=null,this.children.splice(t,1),e.dispatchEvent(lce),fN.child=e,this.dispatchEvent(fN),fN.child=null),this}removeFromParent(){let e=this.parent;return e!==null&&e.remove(this),this}clear(){return this.remove(...this.children)}attach(e){return this.updateWorldMatrix(!0,!1),Af.copy(this.matrixWorld).invert(),e.parent!==null&&(e.parent.updateWorldMatrix(!0,!1),Af.multiply(e.parent.matrixWorld)),e.applyMatrix4(Af),e.removeFromParent(),e.parent=this,this.children.push(e),e.updateWorldMatrix(!1,!0),e.dispatchEvent(lH),Wg.child=e,this.dispatchEvent(Wg),Wg.child=null,this}getObjectById(e){return this.getObjectByProperty("id",e)}getObjectByName(e){return this.getObjectByProperty("name",e)}getObjectByProperty(e,t){if(this[e]===t)return this;for(let n=0,r=this.children.length;n<r;n++){let o=this.children[n].getObjectByProperty(e,t);if(o!==void 0)return o}}getObjectsByProperty(e,t,n=[]){this[e]===t&&n.push(this);let r=this.children;for(let s=0,o=r.length;s<o;s++)r[s].getObjectsByProperty(e,t,n);return n}getWorldPosition(e){return this.updateWorldMatrix(!0,!1),e.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(ny,e,oce),e}getWorldScale(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(ny,ace,e),e}getWorldDirection(e){this.updateWorldMatrix(!0,!1);let t=this.matrixWorld.elements;return e.set(t[8],t[9],t[10]).normalize()}raycast(){}traverse(e){e(this);let t=this.children;for(let n=0,r=t.length;n<r;n++)t[n].traverse(e)}traverseVisible(e){if(this.visible===!1)return;e(this);let t=this.children;for(let n=0,r=t.length;n<r;n++)t[n].traverseVisible(e)}traverseAncestors(e){let t=this.parent;t!==null&&(e(t),t.traverseAncestors(e))}updateMatrix(){this.matrix.compose(this.position,this.quaternion,this.scale);let e=this.pivot;if(e!==null){let t=e.x,n=e.y,r=e.z,s=this.matrix.elements;s[12]+=t-s[0]*t-s[4]*n-s[8]*r,s[13]+=n-s[1]*t-s[5]*n-s[9]*r,s[14]+=r-s[2]*t-s[6]*n-s[10]*r}this.matrixWorldNeedsUpdate=!0}updateMatrixWorld(e){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||e)&&(this.matrixWorldAutoUpdate===!0&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),this.matrixWorldNeedsUpdate=!1,e=!0);let t=this.children;for(let n=0,r=t.length;n<r;n++)t[n].updateMatrixWorld(e)}updateWorldMatrix(e,t,n=!1){let r=this.parent;if(e===!0&&r!==null&&r.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||n)&&(this.matrixWorldAutoUpdate===!0&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),this.matrixWorldNeedsUpdate=!1,n=!0),t===!0){let s=this.children;for(let o=0,a=s.length;o<a;o++)s[o].updateWorldMatrix(!1,!0,n)}}toJSON(e){let t=e===void 0||typeof e=="string",n={};t&&(e={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{},nodes:{}},n.metadata={version:4.7,type:"Object",generator:"Object3D.toJSON"});let r={};r.uuid=this.uuid,r.type=this.type,this.name!==""&&(r.name=this.name),this.castShadow===!0&&(r.castShadow=!0),this.receiveShadow===!0&&(r.receiveShadow=!0),this.visible===!1&&(r.visible=!1),this.frustumCulled===!1&&(r.frustumCulled=!1),this.renderOrder!==0&&(r.renderOrder=this.renderOrder),this.static!==!1&&(r.static=this.static),Object.keys(this.userData).length>0&&(r.userData=this.userData),r.layers=this.layers.mask,r.matrix=this.matrix.toArray(),r.up=this.up.toArray(),this.pivot!==null&&(r.pivot=this.pivot.toArray()),this.matrixAutoUpdate===!1&&(r.matrixAutoUpdate=!1),this.morphTargetDictionary!==void 0&&(r.morphTargetDictionary=Object.assign({},this.morphTargetDictionary)),this.morphTargetInfluences!==void 0&&(r.morphTargetInfluences=this.morphTargetInfluences.slice()),this.isInstancedMesh&&(r.type="InstancedMesh",r.count=this.count,r.instanceMatrix=this.instanceMatrix.toJSON(),this.instanceColor!==null&&(r.instanceColor=this.instanceColor.toJSON())),this.isBatchedMesh&&(r.type="BatchedMesh",r.perObjectFrustumCulled=this.perObjectFrustumCulled,r.sortObjects=this.sortObjects,r.drawRanges=this._drawRanges,r.reservedRanges=this._reservedRanges,r.geometryInfo=this._geometryInfo.map(a=>({...a,boundingBox:a.boundingBox?a.boundingBox.toJSON():void 0,boundingSphere:a.boundingSphere?a.boundingSphere.toJSON():void 0})),r.instanceInfo=this._instanceInfo.map(a=>({...a})),r.availableInstanceIds=this._availableInstanceIds.slice(),r.availableGeometryIds=this._availableGeometryIds.slice(),r.nextIndexStart=this._nextIndexStart,r.nextVertexStart=this._nextVertexStart,r.geometryCount=this._geometryCount,r.maxInstanceCount=this._maxInstanceCount,r.maxVertexCount=this._maxVertexCount,r.maxIndexCount=this._maxIndexCount,r.geometryInitialized=this._geometryInitialized,r.matricesTexture=this._matricesTexture.toJSON(e),r.indirectTexture=this._indirectTexture.toJSON(e),this._colorsTexture!==null&&(r.colorsTexture=this._colorsTexture.toJSON(e)),this.boundingSphere!==null&&(r.boundingSphere=this.boundingSphere.toJSON()),this.boundingBox!==null&&(r.boundingBox=this.boundingBox.toJSON()));function s(a,l){return a[l.uuid]===void 0&&(a[l.uuid]=l.toJSON(e)),l.uuid}if(this.isScene)this.background&&(this.background.isColor?r.background=this.background.toJSON():this.background.isTexture&&(r.background=this.background.toJSON(e).uuid)),this.environment&&this.environment.isTexture&&this.environment.isRenderTargetTexture!==!0&&(r.environment=this.environment.toJSON(e).uuid);else if(this.isMesh||this.isLine||this.isPoints){r.geometry=s(e.geometries,this.geometry);let a=this.geometry.parameters;if(a!==void 0&&a.shapes!==void 0){let l=a.shapes;if(Array.isArray(l))for(let c=0,u=l.length;c<u;c++){let f=l[c];s(e.shapes,f)}else s(e.shapes,l)}}if(this.isSkinnedMesh&&(r.bindMode=this.bindMode,r.bindMatrix=this.bindMatrix.toArray(),this.skeleton!==void 0&&(s(e.skeletons,this.skeleton),r.skeleton=this.skeleton.uuid)),this.material!==void 0)if(Array.isArray(this.material)){let a=[];for(let l=0,c=this.material.length;l<c;l++)a.push(s(e.materials,this.material[l]));r.material=a}else r.material=s(e.materials,this.material);if(this.children.length>0){r.children=[];for(let a=0;a<this.children.length;a++)r.children.push(this.children[a].toJSON(e).object)}if(this.animations.length>0){r.animations=[];for(let a=0;a<this.animations.length;a++){let l=this.animations[a];r.animations.push(s(e.animations,l))}}if(t){let a=o(e.geometries),l=o(e.materials),c=o(e.textures),u=o(e.images),f=o(e.shapes),p=o(e.skeletons),x=o(e.animations),b=o(e.nodes);a.length>0&&(n.geometries=a),l.length>0&&(n.materials=l),c.length>0&&(n.textures=c),u.length>0&&(n.images=u),f.length>0&&(n.shapes=f),p.length>0&&(n.skeletons=p),x.length>0&&(n.animations=x),b.length>0&&(n.nodes=b)}return n.object=r,n;function o(a){let l=[];for(let c in a){let u=a[c];delete u.metadata,l.push(u)}return l}}clone(e){return new this.constructor().copy(this,e)}copy(e,t=!0){if(this.name=e.name,this.up.copy(e.up),this.position.copy(e.position),this.rotation.order=e.rotation.order,this.quaternion.copy(e.quaternion),this.scale.copy(e.scale),this.pivot=e.pivot!==null?e.pivot.clone():null,this.matrix.copy(e.matrix),this.matrixWorld.copy(e.matrixWorld),this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrixWorldAutoUpdate=e.matrixWorldAutoUpdate,this.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,this.layers.mask=e.layers.mask,this.visible=e.visible,this.castShadow=e.castShadow,this.receiveShadow=e.receiveShadow,this.frustumCulled=e.frustumCulled,this.renderOrder=e.renderOrder,this.static=e.static,this.animations=e.animations.slice(),this.userData=JSON.parse(JSON.stringify(e.userData)),t===!0)for(let n=0;n<e.children.length;n++){let r=e.children[n];this.add(r.clone())}return this}};$i.DEFAULT_UP=new ie(0,1,0);$i.DEFAULT_MATRIX_AUTO_UPDATE=!0;$i.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;var _s=class extends $i{constructor(){super(),this.isGroup=!0,this.type="Group"}},cce={type:"move"},qd=class{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new _s,this._hand.matrixAutoUpdate=!1,this._hand.visible=!1,this._hand.joints={},this._hand.inputState={pinching:!1}),this._hand}getTargetRaySpace(){return this._targetRay===null&&(this._targetRay=new _s,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new ie,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new ie),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new _s,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new ie,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new ie,this._grip.eventsEnabled=!1),this._grip}dispatchEvent(e){return this._targetRay!==null&&this._targetRay.dispatchEvent(e),this._grip!==null&&this._grip.dispatchEvent(e),this._hand!==null&&this._hand.dispatchEvent(e),this}connect(e){if(e&&e.hand){let t=this._hand;if(t)for(let n of e.hand.values())this._getHandJoint(t,n)}return this.dispatchEvent({type:"connected",data:e}),this}disconnect(e){return this.dispatchEvent({type:"disconnected",data:e}),this._targetRay!==null&&(this._targetRay.visible=!1),this._grip!==null&&(this._grip.visible=!1),this._hand!==null&&(this._hand.visible=!1),this}update(e,t,n){let r=null,s=null,o=null,a=this._targetRay,l=this._grip,c=this._hand;if(e&&t.session.visibilityState!=="visible-blurred"){if(c&&e.hand){o=!0;for(let w of e.hand.values()){let S=t.getJointPose(w,n),T=this._getHandJoint(c,w);S!==null&&(T.matrix.fromArray(S.transform.matrix),T.matrix.decompose(T.position,T.rotation,T.scale),T.matrixWorldNeedsUpdate=!0,T.jointRadius=S.radius),T.visible=S!==null}let u=c.joints["index-finger-tip"],f=c.joints["thumb-tip"],p=u.position.distanceTo(f.position),x=.02,b=.005;c.inputState.pinching&&p>x+b?(c.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!c.inputState.pinching&&p<=x-b&&(c.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this}))}else l!==null&&e.gripSpace&&(s=t.getPose(e.gripSpace,n),s!==null&&(l.matrix.fromArray(s.transform.matrix),l.matrix.decompose(l.position,l.rotation,l.scale),l.matrixWorldNeedsUpdate=!0,s.linearVelocity?(l.hasLinearVelocity=!0,l.linearVelocity.copy(s.linearVelocity)):l.hasLinearVelocity=!1,s.angularVelocity?(l.hasAngularVelocity=!0,l.angularVelocity.copy(s.angularVelocity)):l.hasAngularVelocity=!1,l.eventsEnabled&&l.dispatchEvent({type:"gripUpdated",data:e,target:this})));a!==null&&(r=t.getPose(e.targetRaySpace,n),r===null&&s!==null&&(r=s),r!==null&&(a.matrix.fromArray(r.transform.matrix),a.matrix.decompose(a.position,a.rotation,a.scale),a.matrixWorldNeedsUpdate=!0,r.linearVelocity?(a.hasLinearVelocity=!0,a.linearVelocity.copy(r.linearVelocity)):a.hasLinearVelocity=!1,r.angularVelocity?(a.hasAngularVelocity=!0,a.angularVelocity.copy(r.angularVelocity)):a.hasAngularVelocity=!1,this.dispatchEvent(cce)))}return a!==null&&(a.visible=r!==null),l!==null&&(l.visible=s!==null),c!==null&&(c.visible=o!==null),this}_getHandJoint(e,t){if(e.joints[t.jointName]===void 0){let n=new _s;n.matrixAutoUpdate=!1,n.visible=!1,e.joints[t.jointName]=n,e.add(n)}return e.joints[t.jointName]}},jH={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074},Nd={h:0,s:0,l:0},BS={h:0,s:0,l:0};function dN(i,e,t){return t<0&&(t+=1),t>1&&(t-=1),t<1/6?i+(e-i)*6*t:t<1/2?e:t<2/3?i+(e-i)*6*(2/3-t):i}var Ut=class{constructor(e,t,n){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(e,t,n)}set(e,t,n){if(t===void 0&&n===void 0){let r=e;r&&r.isColor?this.copy(r):typeof r=="number"?this.setHex(r):typeof r=="string"&&this.setStyle(r)}else this.setRGB(e,t,n);return this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e,t=Wr){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,sn.colorSpaceToWorking(this,t),this}setRGB(e,t,n,r=sn.workingColorSpace){return this.r=e,this.g=t,this.b=n,sn.colorSpaceToWorking(this,r),this}setHSL(e,t,n,r=sn.workingColorSpace){if(e=gL(e,1),t=Pn(t,0,1),n=Pn(n,0,1),t===0)this.r=this.g=this.b=n;else{let s=n<=.5?n*(1+t):n+t-n*t,o=2*n-s;this.r=dN(o,s,e+1/3),this.g=dN(o,s,e),this.b=dN(o,s,e-1/3)}return sn.colorSpaceToWorking(this,r),this}setStyle(e,t=Wr){function n(s){s!==void 0&&parseFloat(s)<1&&je("Color: Alpha component of "+e+" will be ignored.")}let r;if(r=/^(\w+)\(([^\)]*)\)/.exec(e)){let s,o=r[1],a=r[2];switch(o){case"rgb":case"rgba":if(s=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return n(s[4]),this.setRGB(Math.min(255,parseInt(s[1],10))/255,Math.min(255,parseInt(s[2],10))/255,Math.min(255,parseInt(s[3],10))/255,t);if(s=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return n(s[4]),this.setRGB(Math.min(100,parseInt(s[1],10))/100,Math.min(100,parseInt(s[2],10))/100,Math.min(100,parseInt(s[3],10))/100,t);break;case"hsl":case"hsla":if(s=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return n(s[4]),this.setHSL(parseFloat(s[1])/360,parseFloat(s[2])/100,parseFloat(s[3])/100,t);break;default:je("Color: Unknown color model "+e)}}else if(r=/^\#([A-Fa-f\d]+)$/.exec(e)){let s=r[1],o=s.length;if(o===3)return this.setRGB(parseInt(s.charAt(0),16)/15,parseInt(s.charAt(1),16)/15,parseInt(s.charAt(2),16)/15,t);if(o===6)return this.setHex(parseInt(s,16),t);je("Color: Invalid hex color "+e)}else if(e&&e.length>0)return this.setColorName(e,t);return this}setColorName(e,t=Wr){let n=jH[e.toLowerCase()];return n!==void 0?this.setHex(n,t):je("Color: Unknown color "+e),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(e){return this.r=e.r,this.g=e.g,this.b=e.b,this}copySRGBToLinear(e){return this.r=wf(e.r),this.g=wf(e.g),this.b=wf(e.b),this}copyLinearToSRGB(e){return this.r=a_(e.r),this.g=a_(e.g),this.b=a_(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=Wr){return sn.workingToColorSpace(Oo.copy(this),e),Math.round(Pn(Oo.r*255,0,255))*65536+Math.round(Pn(Oo.g*255,0,255))*256+Math.round(Pn(Oo.b*255,0,255))}getHexString(e=Wr){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=sn.workingColorSpace){sn.workingToColorSpace(Oo.copy(this),t);let n=Oo.r,r=Oo.g,s=Oo.b,o=Math.max(n,r,s),a=Math.min(n,r,s),l,c,u=(a+o)/2;if(a===o)l=0,c=0;else{let f=o-a;switch(c=u<=.5?f/(o+a):f/(2-o-a),o){case n:l=(r-s)/f+(r<s?6:0);break;case r:l=(s-n)/f+2;break;case s:l=(n-r)/f+4;break}l/=6}return e.h=l,e.s=c,e.l=u,e}getRGB(e,t=sn.workingColorSpace){return sn.workingToColorSpace(Oo.copy(this),t),e.r=Oo.r,e.g=Oo.g,e.b=Oo.b,e}getStyle(e=Wr){sn.workingToColorSpace(Oo.copy(this),e);let t=Oo.r,n=Oo.g,r=Oo.b;return e!==Wr?`color(${e} ${t.toFixed(3)} ${n.toFixed(3)} ${r.toFixed(3)})`:`rgb(${Math.round(t*255)},${Math.round(n*255)},${Math.round(r*255)})`}offsetHSL(e,t,n){return this.getHSL(Nd),this.setHSL(Nd.h+e,Nd.s+t,Nd.l+n)}add(e){return this.r+=e.r,this.g+=e.g,this.b+=e.b,this}addColors(e,t){return this.r=e.r+t.r,this.g=e.g+t.g,this.b=e.b+t.b,this}addScalar(e){return this.r+=e,this.g+=e,this.b+=e,this}sub(e){return this.r=Math.max(0,this.r-e.r),this.g=Math.max(0,this.g-e.g),this.b=Math.max(0,this.b-e.b),this}multiply(e){return this.r*=e.r,this.g*=e.g,this.b*=e.b,this}multiplyScalar(e){return this.r*=e,this.g*=e,this.b*=e,this}lerp(e,t){return this.r+=(e.r-this.r)*t,this.g+=(e.g-this.g)*t,this.b+=(e.b-this.b)*t,this}lerpColors(e,t,n){return this.r=e.r+(t.r-e.r)*n,this.g=e.g+(t.g-e.g)*n,this.b=e.b+(t.b-e.b)*n,this}lerpHSL(e,t){this.getHSL(Nd),e.getHSL(BS);let n=fy(Nd.h,BS.h,t),r=fy(Nd.s,BS.s,t),s=fy(Nd.l,BS.l,t);return this.setHSL(n,r,s),this}setFromVector3(e){return this.r=e.x,this.g=e.y,this.b=e.z,this}applyMatrix3(e){let t=this.r,n=this.g,r=this.b,s=e.elements;return this.r=s[0]*t+s[3]*n+s[6]*r,this.g=s[1]*t+s[4]*n+s[7]*r,this.b=s[2]*t+s[5]*n+s[8]*r,this}equals(e){return e.r===this.r&&e.g===this.g&&e.b===this.b}fromArray(e,t=0){return this.r=e[t],this.g=e[t+1],this.b=e[t+2],this}toArray(e=[],t=0){return e[t]=this.r,e[t+1]=this.g,e[t+2]=this.b,e}fromBufferAttribute(e,t){return this.r=e.getX(t),this.g=e.getY(t),this.b=e.getZ(t),this}toJSON(){return this.getHex()}*[Symbol.iterator](){yield this.r,yield this.g,yield this.b}},Oo=new Ut;Ut.NAMES=jH;var Hd=class extends $i{constructor(){super(),this.isScene=!0,this.type="Scene",this.background=null,this.environment=null,this.fog=null,this.backgroundBlurriness=0,this.backgroundIntensity=1,this.backgroundRotation=new ca,this.environmentIntensity=1,this.environmentRotation=new ca,this.overrideMaterial=null,typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(e,t){return super.copy(e,t),e.background!==null&&(this.background=e.background.clone()),e.environment!==null&&(this.environment=e.environment.clone()),e.fog!==null&&(this.fog=e.fog.clone()),this.backgroundBlurriness=e.backgroundBlurriness,this.backgroundIntensity=e.backgroundIntensity,this.backgroundRotation.copy(e.backgroundRotation),this.environmentIntensity=e.environmentIntensity,this.environmentRotation.copy(e.environmentRotation),e.overrideMaterial!==null&&(this.overrideMaterial=e.overrideMaterial.clone()),this.matrixAutoUpdate=e.matrixAutoUpdate,this}toJSON(e){let t=super.toJSON(e);return this.fog!==null&&(t.object.fog=this.fog.toJSON()),this.backgroundBlurriness>0&&(t.object.backgroundBlurriness=this.backgroundBlurriness),this.backgroundIntensity!==1&&(t.object.backgroundIntensity=this.backgroundIntensity),t.object.backgroundRotation=this.backgroundRotation.toArray(),this.environmentIntensity!==1&&(t.object.environmentIntensity=this.environmentIntensity),t.object.environmentRotation=this.environmentRotation.toArray(),t}},Bc=new ie,mf=new ie,pN=new ie,gf=new ie,jg=new ie,Xg=new ie,cH=new ie,AN=new ie,mN=new ie,gN=new ie,_N=new gn,xN=new gn,yN=new gn,vf=class i{constructor(e=new ie,t=new ie,n=new ie){this.a=e,this.b=t,this.c=n}static getNormal(e,t,n,r){r.subVectors(n,t),Bc.subVectors(e,t),r.cross(Bc);let s=r.lengthSq();return s>0?r.multiplyScalar(1/Math.sqrt(s)):r.set(0,0,0)}static getBarycoord(e,t,n,r,s){Bc.subVectors(r,t),mf.subVectors(n,t),pN.subVectors(e,t);let o=Bc.dot(Bc),a=Bc.dot(mf),l=Bc.dot(pN),c=mf.dot(mf),u=mf.dot(pN),f=o*c-a*a;if(f===0)return s.set(0,0,0),null;let p=1/f,x=(c*l-a*u)*p,b=(o*u-a*l)*p;return s.set(1-x-b,b,x)}static containsPoint(e,t,n,r){return this.getBarycoord(e,t,n,r,gf)===null?!1:gf.x>=0&&gf.y>=0&&gf.x+gf.y<=1}static getInterpolation(e,t,n,r,s,o,a,l){return this.getBarycoord(e,t,n,r,gf)===null?(l.x=0,l.y=0,"z"in l&&(l.z=0),"w"in l&&(l.w=0),null):(l.setScalar(0),l.addScaledVector(s,gf.x),l.addScaledVector(o,gf.y),l.addScaledVector(a,gf.z),l)}static getInterpolatedAttribute(e,t,n,r,s,o){return _N.setScalar(0),xN.setScalar(0),yN.setScalar(0),_N.fromBufferAttribute(e,t),xN.fromBufferAttribute(e,n),yN.fromBufferAttribute(e,r),o.setScalar(0),o.addScaledVector(_N,s.x),o.addScaledVector(xN,s.y),o.addScaledVector(yN,s.z),o}static isFrontFacing(e,t,n,r){return Bc.subVectors(n,t),mf.subVectors(e,t),Bc.cross(mf).dot(r)<0}set(e,t,n){return this.a.copy(e),this.b.copy(t),this.c.copy(n),this}setFromPointsAndIndices(e,t,n,r){return this.a.copy(e[t]),this.b.copy(e[n]),this.c.copy(e[r]),this}setFromAttributeAndIndices(e,t,n,r){return this.a.fromBufferAttribute(e,t),this.b.fromBufferAttribute(e,n),this.c.fromBufferAttribute(e,r),this}clone(){return new this.constructor().copy(this)}copy(e){return this.a.copy(e.a),this.b.copy(e.b),this.c.copy(e.c),this}getArea(){return Bc.subVectors(this.c,this.b),mf.subVectors(this.a,this.b),Bc.cross(mf).length()*.5}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return i.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,t){return i.getBarycoord(e,this.a,this.b,this.c,t)}getInterpolation(e,t,n,r,s){return i.getInterpolation(e,this.a,this.b,this.c,t,n,r,s)}containsPoint(e){return i.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return i.isFrontFacing(this.a,this.b,this.c,e)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,t){let n=this.a,r=this.b,s=this.c,o,a;jg.subVectors(r,n),Xg.subVectors(s,n),AN.subVectors(e,n);let l=jg.dot(AN),c=Xg.dot(AN);if(l<=0&&c<=0)return t.copy(n);mN.subVectors(e,r);let u=jg.dot(mN),f=Xg.dot(mN);if(u>=0&&f<=u)return t.copy(r);let p=l*f-u*c;if(p<=0&&l>=0&&u<=0)return o=l/(l-u),t.copy(n).addScaledVector(jg,o);gN.subVectors(e,s);let x=jg.dot(gN),b=Xg.dot(gN);if(b>=0&&x<=b)return t.copy(s);let w=x*c-l*b;if(w<=0&&c>=0&&b<=0)return a=c/(c-b),t.copy(n).addScaledVector(Xg,a);let S=u*b-x*f;if(S<=0&&f-u>=0&&x-b>=0)return cH.subVectors(s,r),a=(f-u)/(f-u+(x-b)),t.copy(r).addScaledVector(cH,a);let T=1/(S+w+p);return o=w*T,a=p*T,t.copy(n).addScaledVector(jg,o).addScaledVector(Xg,a)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}},ua=class{constructor(e=new ie(1/0,1/0,1/0),t=new ie(-1/0,-1/0,-1/0)){this.isBox3=!0,this.min=e,this.max=t}set(e,t){return this.min.copy(e),this.max.copy(t),this}setFromArray(e){this.makeEmpty();for(let t=0,n=e.length;t<n;t+=3)this.expandByPoint(Uc.fromArray(e,t));return this}setFromBufferAttribute(e){this.makeEmpty();for(let t=0,n=e.count;t<n;t++)this.expandByPoint(Uc.fromBufferAttribute(e,t));return this}setFromPoints(e){this.makeEmpty();for(let t=0,n=e.length;t<n;t++)this.expandByPoint(e[t]);return this}setFromCenterAndSize(e,t){let n=Uc.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(n),this.max.copy(e).add(n),this}setFromObject(e,t=!1){return this.makeEmpty(),this.expandByObject(e,t)}clone(){return new this.constructor().copy(this)}copy(e){return this.min.copy(e.min),this.max.copy(e.max),this}makeEmpty(){return this.min.x=this.min.y=this.min.z=1/0,this.max.x=this.max.y=this.max.z=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z}getCenter(e){return this.isEmpty()?e.set(0,0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(e){return this.isEmpty()?e.set(0,0,0):e.subVectors(this.max,this.min)}expandByPoint(e){return this.min.min(e),this.max.max(e),this}expandByVector(e){return this.min.sub(e),this.max.add(e),this}expandByScalar(e){return this.min.addScalar(-e),this.max.addScalar(e),this}expandByObject(e,t=!1){e.updateWorldMatrix(!1,!1);let n=e.geometry;if(n!==void 0){let s=n.getAttribute("position");if(t===!0&&s!==void 0&&e.isInstancedMesh!==!0)for(let o=0,a=s.count;o<a;o++)e.isMesh===!0?e.getVertexPosition(o,Uc):Uc.fromBufferAttribute(s,o),Uc.applyMatrix4(e.matrixWorld),this.expandByPoint(Uc);else e.boundingBox!==void 0?(e.boundingBox===null&&e.computeBoundingBox(),US.copy(e.boundingBox)):(n.boundingBox===null&&n.computeBoundingBox(),US.copy(n.boundingBox)),US.applyMatrix4(e.matrixWorld),this.union(US)}let r=e.children;for(let s=0,o=r.length;s<o;s++)this.expandByObject(r[s],t);return this}containsPoint(e){return e.x>=this.min.x&&e.x<=this.max.x&&e.y>=this.min.y&&e.y<=this.max.y&&e.z>=this.min.z&&e.z<=this.max.z}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y&&this.min.z<=e.min.z&&e.max.z<=this.max.z}getParameter(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y),(e.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(e){return e.max.x>=this.min.x&&e.min.x<=this.max.x&&e.max.y>=this.min.y&&e.min.y<=this.max.y&&e.max.z>=this.min.z&&e.min.z<=this.max.z}intersectsSphere(e){return this.clampPoint(e.center,Uc),Uc.distanceToSquared(e.center)<=e.radius*e.radius}intersectsPlane(e){let t,n;return e.normal.x>0?(t=e.normal.x*this.min.x,n=e.normal.x*this.max.x):(t=e.normal.x*this.max.x,n=e.normal.x*this.min.x),e.normal.y>0?(t+=e.normal.y*this.min.y,n+=e.normal.y*this.max.y):(t+=e.normal.y*this.max.y,n+=e.normal.y*this.min.y),e.normal.z>0?(t+=e.normal.z*this.min.z,n+=e.normal.z*this.max.z):(t+=e.normal.z*this.max.z,n+=e.normal.z*this.min.z),t<=-e.constant&&n>=-e.constant}intersectsTriangle(e){if(this.isEmpty())return!1;this.getCenter(iy),kS.subVectors(this.max,iy),$g.subVectors(e.a,iy),Yg.subVectors(e.b,iy),Zg.subVectors(e.c,iy),Ld.subVectors(Yg,$g),Dd.subVectors(Zg,Yg),iA.subVectors($g,Zg);let t=[0,-Ld.z,Ld.y,0,-Dd.z,Dd.y,0,-iA.z,iA.y,Ld.z,0,-Ld.x,Dd.z,0,-Dd.x,iA.z,0,-iA.x,-Ld.y,Ld.x,0,-Dd.y,Dd.x,0,-iA.y,iA.x,0];return!vN(t,$g,Yg,Zg,kS)||(t=[1,0,0,0,1,0,0,0,1],!vN(t,$g,Yg,Zg,kS))?!1:(GS.crossVectors(Ld,Dd),t=[GS.x,GS.y,GS.z],vN(t,$g,Yg,Zg,kS))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,Uc).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=this.getSize(Uc).length()*.5),e}intersect(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this}union(e){return this.min.min(e.min),this.max.max(e.max),this}applyMatrix4(e){return this.isEmpty()?this:(_f[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),_f[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),_f[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),_f[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),_f[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),_f[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),_f[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),_f[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(_f),this)}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}toJSON(){return{min:this.min.toArray(),max:this.max.toArray()}}fromJSON(e){return this.min.fromArray(e.min),this.max.fromArray(e.max),this}},_f=[new ie,new ie,new ie,new ie,new ie,new ie,new ie,new ie],Uc=new ie,US=new ua,$g=new ie,Yg=new ie,Zg=new ie,Ld=new ie,Dd=new ie,iA=new ie,iy=new ie,kS=new ie,GS=new ie,rA=new ie;function vN(i,e,t,n,r){for(let s=0,o=i.length-3;s<=o;s+=3){rA.fromArray(i,s);let a=r.x*Math.abs(rA.x)+r.y*Math.abs(rA.y)+r.z*Math.abs(rA.z),l=e.dot(rA),c=t.dot(rA),u=n.dot(rA);if(Math.max(-Math.max(l,c,u),Math.min(l,c,u))>a)return!1}return!0}var bf=uce();function uce(){let i=new ArrayBuffer(4),e=new Float32Array(i),t=new Uint32Array(i),n=new Uint32Array(512),r=new Uint32Array(512);for(let l=0;l<256;++l){let c=l-127;c<-27?(n[l]=0,n[l|256]=32768,r[l]=24,r[l|256]=24):c<-14?(n[l]=1024>>-c-14,n[l|256]=1024>>-c-14|32768,r[l]=-c-1,r[l|256]=-c-1):c<=15?(n[l]=c+15<<10,n[l|256]=c+15<<10|32768,r[l]=13,r[l|256]=13):c<128?(n[l]=31744,n[l|256]=64512,r[l]=24,r[l|256]=24):(n[l]=31744,n[l|256]=64512,r[l]=13,r[l|256]=13)}let s=new Uint32Array(2048),o=new Uint32Array(64),a=new Uint32Array(64);for(let l=1;l<1024;++l){let c=l<<13,u=0;for(;(c&8388608)===0;)c<<=1,u-=8388608;c&=-8388609,u+=947912704,s[l]=c|u}for(let l=1024;l<2048;++l)s[l]=939524096+(l-1024<<13);for(let l=1;l<31;++l)o[l]=l<<23;o[31]=1199570944,o[32]=2147483648;for(let l=33;l<63;++l)o[l]=2147483648+(l-32<<23);o[63]=3347054592;for(let l=1;l<64;++l)l!==32&&(a[l]=1024);return{floatView:e,uint32View:t,baseTable:n,shiftTable:r,mantissaTable:s,exponentTable:o,offsetTable:a}}function dl(i){Math.abs(i)>65504&&je("DataUtils.toHalfFloat(): Value out of range."),i=Pn(i,-65504,65504),bf.floatView[0]=i;let e=bf.uint32View[0],t=e>>23&511;return bf.baseTable[t]+((e&8388607)>>bf.shiftTable[t])}function zS(i){let e=i>>10;return bf.uint32View[0]=bf.mantissaTable[bf.offsetTable[e]+(i&1023)]+bf.exponentTable[e],bf.floatView[0]}var gs=new ie,VS=new Oe,hce=0,Ni=class extends Uo{constructor(e,t,n=!1){if(super(),Array.isArray(e))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,Object.defineProperty(this,"id",{value:hce++}),this.name="",this.array=e,this.itemSize=t,this.count=e!==void 0?e.length/t:0,this.normalized=n,this.usage=Vd,this.updateRanges=[],this.gpuType=Yi,this.version=0}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}setUsage(e){return this.usage=e,this}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}copy(e){return this.name=e.name,this.array=new e.array.constructor(e.array),this.itemSize=e.itemSize,this.count=e.count,this.normalized=e.normalized,this.usage=e.usage,this.gpuType=e.gpuType,this}copyAt(e,t,n){e*=this.itemSize,n*=t.itemSize;for(let r=0,s=this.itemSize;r<s;r++)this.array[e+r]=t.array[n+r];return this}copyArray(e){return this.array.set(e),this}applyMatrix3(e){if(this.itemSize===2)for(let t=0,n=this.count;t<n;t++)VS.fromBufferAttribute(this,t),VS.applyMatrix3(e),this.setXY(t,VS.x,VS.y);else if(this.itemSize===3)for(let t=0,n=this.count;t<n;t++)gs.fromBufferAttribute(this,t),gs.applyMatrix3(e),this.setXYZ(t,gs.x,gs.y,gs.z);return this}applyMatrix4(e){for(let t=0,n=this.count;t<n;t++)gs.fromBufferAttribute(this,t),gs.applyMatrix4(e),this.setXYZ(t,gs.x,gs.y,gs.z);return this}applyNormalMatrix(e){for(let t=0,n=this.count;t<n;t++)gs.fromBufferAttribute(this,t),gs.applyNormalMatrix(e),this.setXYZ(t,gs.x,gs.y,gs.z);return this}transformDirection(e){for(let t=0,n=this.count;t<n;t++)gs.fromBufferAttribute(this,t),gs.transformDirection(e),this.setXYZ(t,gs.x,gs.y,gs.z);return this}set(e,t=0){return this.array.set(e,t),this}getComponent(e,t){let n=this.array[e*this.itemSize+t];return this.normalized&&(n=oa(n,this.array)),n}setComponent(e,t,n){return this.normalized&&(n=qn(n,this.array)),this.array[e*this.itemSize+t]=n,this}getX(e){let t=this.array[e*this.itemSize];return this.normalized&&(t=oa(t,this.array)),t}setX(e,t){return this.normalized&&(t=qn(t,this.array)),this.array[e*this.itemSize]=t,this}getY(e){let t=this.array[e*this.itemSize+1];return this.normalized&&(t=oa(t,this.array)),t}setY(e,t){return this.normalized&&(t=qn(t,this.array)),this.array[e*this.itemSize+1]=t,this}getZ(e){let t=this.array[e*this.itemSize+2];return this.normalized&&(t=oa(t,this.array)),t}setZ(e,t){return this.normalized&&(t=qn(t,this.array)),this.array[e*this.itemSize+2]=t,this}getW(e){let t=this.array[e*this.itemSize+3];return this.normalized&&(t=oa(t,this.array)),t}setW(e,t){return this.normalized&&(t=qn(t,this.array)),this.array[e*this.itemSize+3]=t,this}setXY(e,t,n){return e*=this.itemSize,this.normalized&&(t=qn(t,this.array),n=qn(n,this.array)),this.array[e+0]=t,this.array[e+1]=n,this}setXYZ(e,t,n,r){return e*=this.itemSize,this.normalized&&(t=qn(t,this.array),n=qn(n,this.array),r=qn(r,this.array)),this.array[e+0]=t,this.array[e+1]=n,this.array[e+2]=r,this}setXYZW(e,t,n,r,s){return e*=this.itemSize,this.normalized&&(t=qn(t,this.array),n=qn(n,this.array),r=qn(r,this.array),s=qn(s,this.array)),this.array[e+0]=t,this.array[e+1]=n,this.array[e+2]=r,this.array[e+3]=s,this}onUpload(e){return this.onUploadCallback=e,this}clone(){return new this.constructor(this.array,this.itemSize).copy(this)}toJSON(){let e={itemSize:this.itemSize,type:this.array.constructor.name,array:Array.from(this.array),normalized:this.normalized};return this.name!==""&&(e.name=this.name),this.usage!==Vd&&(e.usage=this.usage),e}dispose(){this.dispatchEvent({type:"dispose"})}};var mA=class extends Ni{constructor(e,t,n){super(new Uint16Array(e),t,n)}};var gA=class extends Ni{constructor(e,t,n){super(new Uint32Array(e),t,n)}},f_=class extends Ni{constructor(e,t,n){super(new Uint16Array(e),t,n),this.isFloat16BufferAttribute=!0}getX(e){let t=zS(this.array[e*this.itemSize]);return this.normalized&&(t=oa(t,this.array)),t}setX(e,t){return this.normalized&&(t=qn(t,this.array)),this.array[e*this.itemSize]=dl(t),this}getY(e){let t=zS(this.array[e*this.itemSize+1]);return this.normalized&&(t=oa(t,this.array)),t}setY(e,t){return this.normalized&&(t=qn(t,this.array)),this.array[e*this.itemSize+1]=dl(t),this}getZ(e){let t=zS(this.array[e*this.itemSize+2]);return this.normalized&&(t=oa(t,this.array)),t}setZ(e,t){return this.normalized&&(t=qn(t,this.array)),this.array[e*this.itemSize+2]=dl(t),this}getW(e){let t=zS(this.array[e*this.itemSize+3]);return this.normalized&&(t=oa(t,this.array)),t}setW(e,t){return this.normalized&&(t=qn(t,this.array)),this.array[e*this.itemSize+3]=dl(t),this}setXY(e,t,n){return e*=this.itemSize,this.normalized&&(t=qn(t,this.array),n=qn(n,this.array)),this.array[e+0]=dl(t),this.array[e+1]=dl(n),this}setXYZ(e,t,n,r){return e*=this.itemSize,this.normalized&&(t=qn(t,this.array),n=qn(n,this.array),r=qn(r,this.array)),this.array[e+0]=dl(t),this.array[e+1]=dl(n),this.array[e+2]=dl(r),this}setXYZW(e,t,n,r,s){return e*=this.itemSize,this.normalized&&(t=qn(t,this.array),n=qn(n,this.array),r=qn(r,this.array),s=qn(s,this.array)),this.array[e+0]=dl(t),this.array[e+1]=dl(n),this.array[e+2]=dl(r),this.array[e+3]=dl(s),this}},kn=class extends Ni{constructor(e,t,n){super(new Float32Array(e),t,n)}},fce=new ua,ry=new ie,bN=new ie,qa=class{constructor(e=new ie,t=-1){this.isSphere=!0,this.center=e,this.radius=t}set(e,t){return this.center.copy(e),this.radius=t,this}setFromPoints(e,t){let n=this.center;t!==void 0?n.copy(t):fce.setFromPoints(e).getCenter(n);let r=0;for(let s=0,o=e.length;s<o;s++)r=Math.max(r,n.distanceToSquared(e[s]));return this.radius=Math.sqrt(r),this}copy(e){return this.center.copy(e.center),this.radius=e.radius,this}isEmpty(){return this.radius<0}makeEmpty(){return this.center.set(0,0,0),this.radius=-1,this}containsPoint(e){return e.distanceToSquared(this.center)<=this.radius*this.radius}distanceToPoint(e){return e.distanceTo(this.center)-this.radius}intersectsSphere(e){let t=this.radius+e.radius;return e.center.distanceToSquared(this.center)<=t*t}intersectsBox(e){return e.intersectsSphere(this)}intersectsPlane(e){return Math.abs(e.distanceToPoint(this.center))<=this.radius}clampPoint(e,t){let n=this.center.distanceToSquared(e);return t.copy(e),n>this.radius*this.radius&&(t.sub(this.center).normalize(),t.multiplyScalar(this.radius).add(this.center)),t}getBoundingBox(e){return this.isEmpty()?(e.makeEmpty(),e):(e.set(this.center,this.center),e.expandByScalar(this.radius),e)}applyMatrix4(e){return this.center.applyMatrix4(e),this.radius=this.radius*e.getMaxScaleOnAxis(),this}translate(e){return this.center.add(e),this}expandByPoint(e){if(this.isEmpty())return this.center.copy(e),this.radius=0,this;ry.subVectors(e,this.center);let t=ry.lengthSq();if(t>this.radius*this.radius){let n=Math.sqrt(t),r=(n-this.radius)*.5;this.center.addScaledVector(ry,r/n),this.radius+=r}return this}union(e){return e.isEmpty()?this:this.isEmpty()?(this.copy(e),this):(this.center.equals(e.center)===!0?this.radius=Math.max(this.radius,e.radius):(bN.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(ry.copy(e.center).add(bN)),this.expandByPoint(ry.copy(e.center).sub(bN))),this)}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return new this.constructor().copy(this)}toJSON(){return{radius:this.radius,center:this.center.toArray()}}fromJSON(e){return this.radius=e.radius,this.center.fromArray(e.center),this}},dce=0,$l=new on,wN=new $i,Kg=new ie,pl=new ua,sy=new ua,Zs=new ie,Kn=class i extends Uo{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:dce++}),this.uuid=Fu(),this.name="",this.type="BufferGeometry",this.index=null,this.indirect=null,this.indirectOffset=0,this.attributes={},this.morphAttributes={},this.morphTargetsRelative=!1,this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.drawRange={start:0,count:1/0},this.userData={},this._transformed=!1}getIndex(){return this.index}setIndex(e){return Array.isArray(e)?this.index=new(Ble(e)?gA:mA)(e,1):this.index=e,this}setIndirect(e,t=0){return this.indirect=e,this.indirectOffset=t,this}getIndirect(){return this.indirect}getAttribute(e){return this.attributes[e]}setAttribute(e,t){return this.attributes[e]=t,this}deleteAttribute(e){return delete this.attributes[e],this}hasAttribute(e){return this.attributes[e]!==void 0}addGroup(e,t,n=0){this.groups.push({start:e,count:t,materialIndex:n})}clearGroups(){this.groups=[]}setDrawRange(e,t){this.drawRange.start=e,this.drawRange.count=t}applyMatrix4(e){let t=this.attributes.position;t!==void 0&&(t.applyMatrix4(e),t.needsUpdate=!0);let n=this.attributes.normal;if(n!==void 0){let s=new Sn().getNormalMatrix(e);n.applyNormalMatrix(s),n.needsUpdate=!0}let r=this.attributes.tangent;return r!==void 0&&(r.transformDirection(e),r.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this._transformed=!0,this}applyQuaternion(e){return $l.makeRotationFromQuaternion(e),this.applyMatrix4($l),this}rotateX(e){return $l.makeRotationX(e),this.applyMatrix4($l),this}rotateY(e){return $l.makeRotationY(e),this.applyMatrix4($l),this}rotateZ(e){return $l.makeRotationZ(e),this.applyMatrix4($l),this}translate(e,t,n){return $l.makeTranslation(e,t,n),this.applyMatrix4($l),this}scale(e,t,n){return $l.makeScale(e,t,n),this.applyMatrix4($l),this}lookAt(e){return wN.lookAt(e),wN.updateMatrix(),this.applyMatrix4(wN.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(Kg).negate(),this.translate(Kg.x,Kg.y,Kg.z),this}setFromPoints(e){let t=this.getAttribute("position");if(t===void 0){let n=[];for(let r=0,s=e.length;r<s;r++){let o=e[r];n.push(o.x,o.y,o.z||0)}this.setAttribute("position",new kn(n,3))}else{let n=Math.min(e.length,t.count);for(let r=0;r<n;r++){let s=e[r];t.setXYZ(r,s.x,s.y,s.z||0)}e.length>t.count&&je("BufferGeometry: Buffer size too small for points data. Use .dispose() and create a new geometry."),t.needsUpdate=!0}return this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new ua);let e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){Ge("BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box.",this),this.boundingBox.set(new ie(-1/0,-1/0,-1/0),new ie(1/0,1/0,1/0));return}if(e!==void 0){if(this.boundingBox.setFromBufferAttribute(e),t)for(let n=0,r=t.length;n<r;n++){let s=t[n];pl.setFromBufferAttribute(s),this.morphTargetsRelative?(Zs.addVectors(this.boundingBox.min,pl.min),this.boundingBox.expandByPoint(Zs),Zs.addVectors(this.boundingBox.max,pl.max),this.boundingBox.expandByPoint(Zs)):(this.boundingBox.expandByPoint(pl.min),this.boundingBox.expandByPoint(pl.max))}}else this.boundingBox.makeEmpty();(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&Ge('BufferGeometry.computeBoundingBox(): Computed min/max have NaN values. The "position" attribute is likely to have NaN values.',this)}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new qa);let e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){Ge("BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere.",this),this.boundingSphere.set(new ie,1/0);return}if(e){let n=this.boundingSphere.center;if(pl.setFromBufferAttribute(e),t)for(let s=0,o=t.length;s<o;s++){let a=t[s];sy.setFromBufferAttribute(a),this.morphTargetsRelative?(Zs.addVectors(pl.min,sy.min),pl.expandByPoint(Zs),Zs.addVectors(pl.max,sy.max),pl.expandByPoint(Zs)):(pl.expandByPoint(sy.min),pl.expandByPoint(sy.max))}pl.getCenter(n);let r=0;for(let s=0,o=e.count;s<o;s++)Zs.fromBufferAttribute(e,s),r=Math.max(r,n.distanceToSquared(Zs));if(t)for(let s=0,o=t.length;s<o;s++){let a=t[s],l=this.morphTargetsRelative;for(let c=0,u=a.count;c<u;c++)Zs.fromBufferAttribute(a,c),l&&(Kg.fromBufferAttribute(e,c),Zs.add(Kg)),r=Math.max(r,n.distanceToSquared(Zs))}this.boundingSphere.radius=Math.sqrt(r),isNaN(this.boundingSphere.radius)&&Ge('BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this)}}computeTangents(){let e=this.index,t=this.attributes;if(e===null||t.position===void 0||t.normal===void 0||t.uv===void 0){Ge("BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)");return}let n=t.position,r=t.normal,s=t.uv,o=this.getAttribute("tangent");(o===void 0||o.count!==n.count)&&(o=new Ni(new Float32Array(4*n.count),4),this.setAttribute("tangent",o));let a=[],l=[];for(let N=0;N<n.count;N++)a[N]=new ie,l[N]=new ie;let c=new ie,u=new ie,f=new ie,p=new Oe,x=new Oe,b=new Oe,w=new ie,S=new ie;function T(N,B,z){c.fromBufferAttribute(n,N),u.fromBufferAttribute(n,B),f.fromBufferAttribute(n,z),p.fromBufferAttribute(s,N),x.fromBufferAttribute(s,B),b.fromBufferAttribute(s,z),u.sub(c),f.sub(c),x.sub(p),b.sub(p);let V=1/(x.x*b.y-b.x*x.y);isFinite(V)&&(w.copy(u).multiplyScalar(b.y).addScaledVector(f,-x.y).multiplyScalar(V),S.copy(f).multiplyScalar(x.x).addScaledVector(u,-b.x).multiplyScalar(V),a[N].add(w),a[B].add(w),a[z].add(w),l[N].add(S),l[B].add(S),l[z].add(S))}let P=this.groups;P.length===0&&(P=[{start:0,count:e.count}]);for(let N=0,B=P.length;N<B;++N){let z=P[N],V=z.start,H=z.count;for(let Z=V,J=V+H;Z<J;Z+=3)T(e.getX(Z+0),e.getX(Z+1),e.getX(Z+2))}let R=new ie,C=new ie,L=new ie,D=new ie;function F(N){L.fromBufferAttribute(r,N),D.copy(L);let B=a[N];R.copy(B),R.sub(L.multiplyScalar(L.dot(B))).normalize(),C.crossVectors(D,B);let V=C.dot(l[N])<0?-1:1;o.setXYZW(N,R.x,R.y,R.z,V)}for(let N=0,B=P.length;N<B;++N){let z=P[N],V=z.start,H=z.count;for(let Z=V,J=V+H;Z<J;Z+=3)F(e.getX(Z+0)),F(e.getX(Z+1)),F(e.getX(Z+2))}this._transformed=!0}computeVertexNormals(){let e=this.index,t=this.getAttribute("position");if(t!==void 0){let n=this.getAttribute("normal");if(n===void 0||n.count!==t.count)n=new Ni(new Float32Array(t.count*3),3),this.setAttribute("normal",n);else for(let p=0,x=n.count;p<x;p++)n.setXYZ(p,0,0,0);let r=new ie,s=new ie,o=new ie,a=new ie,l=new ie,c=new ie,u=new ie,f=new ie;if(e)for(let p=0,x=e.count;p<x;p+=3){let b=e.getX(p+0),w=e.getX(p+1),S=e.getX(p+2);r.fromBufferAttribute(t,b),s.fromBufferAttribute(t,w),o.fromBufferAttribute(t,S),u.subVectors(o,s),f.subVectors(r,s),u.cross(f),a.fromBufferAttribute(n,b),l.fromBufferAttribute(n,w),c.fromBufferAttribute(n,S),a.add(u),l.add(u),c.add(u),n.setXYZ(b,a.x,a.y,a.z),n.setXYZ(w,l.x,l.y,l.z),n.setXYZ(S,c.x,c.y,c.z)}else for(let p=0,x=t.count;p<x;p+=3)r.fromBufferAttribute(t,p+0),s.fromBufferAttribute(t,p+1),o.fromBufferAttribute(t,p+2),u.subVectors(o,s),f.subVectors(r,s),u.cross(f),n.setXYZ(p+0,u.x,u.y,u.z),n.setXYZ(p+1,u.x,u.y,u.z),n.setXYZ(p+2,u.x,u.y,u.z);this.normalizeNormals(),n.needsUpdate=!0}}normalizeNormals(){let e=this.attributes.normal;for(let t=0,n=e.count;t<n;t++)Zs.fromBufferAttribute(e,t),Zs.normalize(),e.setXYZ(t,Zs.x,Zs.y,Zs.z)}toNonIndexed(){function e(a,l){let c=a.array,u=a.itemSize,f=a.normalized,p=new c.constructor(l.length*u),x=0,b=0;for(let w=0,S=l.length;w<S;w++){a.isInterleavedBufferAttribute?x=l[w]*a.data.stride+a.offset:x=l[w]*u;for(let T=0;T<u;T++)p[b++]=c[x++]}return new Ni(p,u,f)}if(this.index===null)return je("BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;let t=new i,n=this.index.array,r=this.attributes;for(let a in r){let l=r[a],c=e(l,n);t.setAttribute(a,c)}let s=this.morphAttributes;for(let a in s){let l=[],c=s[a];for(let u=0,f=c.length;u<f;u++){let p=c[u],x=e(p,n);l.push(x)}t.morphAttributes[a]=l}t.morphTargetsRelative=this.morphTargetsRelative;let o=this.groups;for(let a=0,l=o.length;a<l;a++){let c=o[a];t.addGroup(c.start,c.count,c.materialIndex)}return t}toJSON(){let e={metadata:{version:4.7,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};if(e.uuid=this.uuid,e.type=this.parameters!==void 0&&this._transformed===!0?"BufferGeometry":this.type,this.name!==""&&(e.name=this.name),Object.keys(this.userData).length>0&&(e.userData=this.userData),this.parameters!==void 0&&this._transformed!==!0){let l=this.parameters;for(let c in l)l[c]!==void 0&&(e[c]=l[c]);return e}e.data={attributes:{}};let t=this.index;t!==null&&(e.data.index={type:t.array.constructor.name,array:Array.prototype.slice.call(t.array)});let n=this.attributes;for(let l in n){let c=n[l];e.data.attributes[l]=c.toJSON(e.data)}let r={},s=!1;for(let l in this.morphAttributes){let c=this.morphAttributes[l],u=[];for(let f=0,p=c.length;f<p;f++){let x=c[f];u.push(x.toJSON(e.data))}u.length>0&&(r[l]=u,s=!0)}s&&(e.data.morphAttributes=r,e.data.morphTargetsRelative=this.morphTargetsRelative);let o=this.groups;o.length>0&&(e.data.groups=JSON.parse(JSON.stringify(o)));let a=this.boundingSphere;return a!==null&&(e.data.boundingSphere=a.toJSON()),e}clone(){return new this.constructor().copy(this)}copy(e){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;let t={};this.name=e.name;let n=e.index;n!==null&&this.setIndex(n.clone());let r=e.attributes;for(let c in r){let u=r[c];this.setAttribute(c,u.clone(t))}let s=e.morphAttributes;for(let c in s){let u=[],f=s[c];for(let p=0,x=f.length;p<x;p++)u.push(f[p].clone(t));this.morphAttributes[c]=u}this.morphTargetsRelative=e.morphTargetsRelative;let o=e.groups;for(let c=0,u=o.length;c<u;c++){let f=o[c];this.addGroup(f.start,f.count,f.materialIndex)}let a=e.boundingBox;a!==null&&(this.boundingBox=a.clone());let l=e.boundingSphere;return l!==null&&(this.boundingSphere=l.clone()),this.drawRange.start=e.drawRange.start,this.drawRange.count=e.drawRange.count,this.userData=e.userData,this._transformed=e._transformed,this}dispose(){this.dispatchEvent({type:"dispose"})}},Mf=class{constructor(e,t){this.isInterleavedBuffer=!0,this.array=e,this.stride=t,this.count=e!==void 0?e.length/t:0,this.usage=Vd,this.updateRanges=[],this.version=0,this.uuid=Fu()}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}setUsage(e){return this.usage=e,this}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}copy(e){return this.array=new e.array.constructor(e.array),this.count=e.count,this.stride=e.stride,this.usage=e.usage,this}copyAt(e,t,n){e*=this.stride,n*=t.stride;for(let r=0,s=this.stride;r<s;r++)this.array[e+r]=t.array[n+r];return this}set(e,t=0){return this.array.set(e,t),this}clone(e){e.arrayBuffers===void 0&&(e.arrayBuffers={}),this.array.buffer._uuid===void 0&&(this.array.buffer._uuid=Fu()),e.arrayBuffers[this.array.buffer._uuid]===void 0&&(e.arrayBuffers[this.array.buffer._uuid]=this.array.slice(0).buffer);let t=new this.array.constructor(e.arrayBuffers[this.array.buffer._uuid]),n=new this.constructor(t,this.stride);return n.setUsage(this.usage),n}onUpload(e){return this.onUploadCallback=e,this}toJSON(e){return e.arrayBuffers===void 0&&(e.arrayBuffers={}),this.array.buffer._uuid===void 0&&(this.array.buffer._uuid=Fu()),e.arrayBuffers[this.array.buffer._uuid]===void 0&&(e.arrayBuffers[this.array.buffer._uuid]=Array.from(new Uint32Array(this.array.buffer))),{uuid:this.uuid,buffer:this.array.buffer._uuid,type:this.array.constructor.name,stride:this.stride}}},ra=new ie,Ao=class i{constructor(e,t,n,r=!1){this.isInterleavedBufferAttribute=!0,this.name="",this.data=e,this.itemSize=t,this.offset=n,this.normalized=r}get count(){return this.data.count}get array(){return this.data.array}set needsUpdate(e){this.data.needsUpdate=e}applyMatrix4(e){for(let t=0,n=this.data.count;t<n;t++)ra.fromBufferAttribute(this,t),ra.applyMatrix4(e),this.setXYZ(t,ra.x,ra.y,ra.z);return this}applyNormalMatrix(e){for(let t=0,n=this.count;t<n;t++)ra.fromBufferAttribute(this,t),ra.applyNormalMatrix(e),this.setXYZ(t,ra.x,ra.y,ra.z);return this}transformDirection(e){for(let t=0,n=this.count;t<n;t++)ra.fromBufferAttribute(this,t),ra.transformDirection(e),this.setXYZ(t,ra.x,ra.y,ra.z);return this}getComponent(e,t){let n=this.array[e*this.data.stride+this.offset+t];return this.normalized&&(n=oa(n,this.array)),n}setComponent(e,t,n){return this.normalized&&(n=qn(n,this.array)),this.data.array[e*this.data.stride+this.offset+t]=n,this}setX(e,t){return this.normalized&&(t=qn(t,this.array)),this.data.array[e*this.data.stride+this.offset]=t,this}setY(e,t){return this.normalized&&(t=qn(t,this.array)),this.data.array[e*this.data.stride+this.offset+1]=t,this}setZ(e,t){return this.normalized&&(t=qn(t,this.array)),this.data.array[e*this.data.stride+this.offset+2]=t,this}setW(e,t){return this.normalized&&(t=qn(t,this.array)),this.data.array[e*this.data.stride+this.offset+3]=t,this}getX(e){let t=this.data.array[e*this.data.stride+this.offset];return this.normalized&&(t=oa(t,this.array)),t}getY(e){let t=this.data.array[e*this.data.stride+this.offset+1];return this.normalized&&(t=oa(t,this.array)),t}getZ(e){let t=this.data.array[e*this.data.stride+this.offset+2];return this.normalized&&(t=oa(t,this.array)),t}getW(e){let t=this.data.array[e*this.data.stride+this.offset+3];return this.normalized&&(t=oa(t,this.array)),t}setXY(e,t,n){return e=e*this.data.stride+this.offset,this.normalized&&(t=qn(t,this.array),n=qn(n,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=n,this}setXYZ(e,t,n,r){return e=e*this.data.stride+this.offset,this.normalized&&(t=qn(t,this.array),n=qn(n,this.array),r=qn(r,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=n,this.data.array[e+2]=r,this}setXYZW(e,t,n,r,s){return e=e*this.data.stride+this.offset,this.normalized&&(t=qn(t,this.array),n=qn(n,this.array),r=qn(r,this.array),s=qn(s,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=n,this.data.array[e+2]=r,this.data.array[e+3]=s,this}clone(e){if(e===void 0){pA("InterleavedBufferAttribute.clone(): Cloning an interleaved buffer attribute will de-interleave buffer data.");let t=[];for(let n=0;n<this.count;n++){let r=n*this.data.stride+this.offset;for(let s=0;s<this.itemSize;s++)t.push(this.data.array[r+s])}return new Ni(new this.array.constructor(t),this.itemSize,this.normalized)}else return e.interleavedBuffers===void 0&&(e.interleavedBuffers={}),e.interleavedBuffers[this.data.uuid]===void 0&&(e.interleavedBuffers[this.data.uuid]=this.data.clone(e)),new i(e.interleavedBuffers[this.data.uuid],this.itemSize,this.offset,this.normalized)}toJSON(e){if(e===void 0){pA("InterleavedBufferAttribute.toJSON(): Serializing an interleaved buffer attribute will de-interleave buffer data.");let t=[];for(let n=0;n<this.count;n++){let r=n*this.data.stride+this.offset;for(let s=0;s<this.itemSize;s++)t.push(this.data.array[r+s])}return{itemSize:this.itemSize,type:this.array.constructor.name,array:t,normalized:this.normalized}}else return e.interleavedBuffers===void 0&&(e.interleavedBuffers={}),e.interleavedBuffers[this.data.uuid]===void 0&&(e.interleavedBuffers[this.data.uuid]=this.data.toJSON(e)),{isInterleavedBufferAttribute:!0,itemSize:this.itemSize,data:this.data.uuid,offset:this.offset,normalized:this.normalized}}},pce=0,bs=class extends Uo{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:pce++}),this.uuid=Fu(),this.name="",this.type="Material",this.blending=rs,this.side=po,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.alphaHash=!1,this.blendSrc=Ud,this.blendDst=kd,this.blendEquation=Os,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.blendColor=new Ut(0,0,0),this.blendAlpha=0,this.depthFunc=Ou,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=my,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=yf,this.stencilZFail=yf,this.stencilZPass=yf,this.stencilWrite=!1,this.clippingPlanes=null,this.clipIntersection=!1,this.clipShadows=!1,this.shadowSide=null,this.colorWrite=!0,this.precision=null,this.polygonOffset=!1,this.polygonOffsetFactor=0,this.polygonOffsetUnits=0,this.dithering=!1,this.alphaToCoverage=!1,this.premultipliedAlpha=!1,this.forceSinglePass=!1,this.allowOverride=!0,this.visible=!0,this.toneMapped=!0,this.userData={},this.version=0,this._alphaTest=0}get alphaTest(){return this._alphaTest}set alphaTest(e){this._alphaTest>0!=e>0&&this.version++,this._alphaTest=e}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(e){if(e!==void 0)for(let t in e){let n=e[t];if(n===void 0){je(`Material: parameter '${t}' has value of undefined.`);continue}let r=this[t];if(r===void 0){je(`Material: '${t}' is not a property of THREE.${this.type}.`);continue}r&&r.isColor?r.set(n):r&&r.isVector2&&n&&n.isVector2||r&&r.isEuler&&n&&n.isEuler||r&&r.isVector3&&n&&n.isVector3?r.copy(n):this[t]=n}}toJSON(e){let t=e===void 0||typeof e=="string";t&&(e={textures:{},images:{}});let n={metadata:{version:4.7,type:"Material",generator:"Material.toJSON"}};n.uuid=this.uuid,n.type=this.type,this.name!==""&&(n.name=this.name),this.color&&this.color.isColor&&(n.color=this.color.getHex()),this.roughness!==void 0&&(n.roughness=this.roughness),this.metalness!==void 0&&(n.metalness=this.metalness),this.sheen!==void 0&&(n.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(n.sheenColor=this.sheenColor.getHex()),this.sheenRoughness!==void 0&&(n.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(n.emissive=this.emissive.getHex()),this.emissiveIntensity!==void 0&&this.emissiveIntensity!==1&&(n.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(n.specular=this.specular.getHex()),this.specularIntensity!==void 0&&(n.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(n.specularColor=this.specularColor.getHex()),this.shininess!==void 0&&(n.shininess=this.shininess),this.clearcoat!==void 0&&(n.clearcoat=this.clearcoat),this.clearcoatRoughness!==void 0&&(n.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(n.clearcoatMap=this.clearcoatMap.toJSON(e).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(n.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(e).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(n.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(e).uuid,n.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.sheenColorMap&&this.sheenColorMap.isTexture&&(n.sheenColorMap=this.sheenColorMap.toJSON(e).uuid),this.sheenRoughnessMap&&this.sheenRoughnessMap.isTexture&&(n.sheenRoughnessMap=this.sheenRoughnessMap.toJSON(e).uuid),this.dispersion!==void 0&&(n.dispersion=this.dispersion),this.iridescence!==void 0&&(n.iridescence=this.iridescence),this.iridescenceIOR!==void 0&&(n.iridescenceIOR=this.iridescenceIOR),this.iridescenceThicknessRange!==void 0&&(n.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(n.iridescenceMap=this.iridescenceMap.toJSON(e).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(n.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(e).uuid),this.anisotropy!==void 0&&(n.anisotropy=this.anisotropy),this.anisotropyRotation!==void 0&&(n.anisotropyRotation=this.anisotropyRotation),this.anisotropyMap&&this.anisotropyMap.isTexture&&(n.anisotropyMap=this.anisotropyMap.toJSON(e).uuid),this.map&&this.map.isTexture&&(n.map=this.map.toJSON(e).uuid),this.matcap&&this.matcap.isTexture&&(n.matcap=this.matcap.toJSON(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(n.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(n.lightMap=this.lightMap.toJSON(e).uuid,n.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(n.aoMap=this.aoMap.toJSON(e).uuid,n.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(n.bumpMap=this.bumpMap.toJSON(e).uuid,n.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(n.normalMap=this.normalMap.toJSON(e).uuid,n.normalMapType=this.normalMapType,n.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(n.displacementMap=this.displacementMap.toJSON(e).uuid,n.displacementScale=this.displacementScale,n.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(n.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(n.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(n.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(n.specularMap=this.specularMap.toJSON(e).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(n.specularIntensityMap=this.specularIntensityMap.toJSON(e).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(n.specularColorMap=this.specularColorMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(n.envMap=this.envMap.toJSON(e).uuid,this.combine!==void 0&&(n.combine=this.combine)),this.envMapRotation!==void 0&&(n.envMapRotation=this.envMapRotation.toArray()),this.envMapIntensity!==void 0&&(n.envMapIntensity=this.envMapIntensity),this.reflectivity!==void 0&&(n.reflectivity=this.reflectivity),this.refractionRatio!==void 0&&(n.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(n.gradientMap=this.gradientMap.toJSON(e).uuid),this.transmission!==void 0&&(n.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(n.transmissionMap=this.transmissionMap.toJSON(e).uuid),this.thickness!==void 0&&(n.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(n.thicknessMap=this.thicknessMap.toJSON(e).uuid),this.attenuationDistance!==void 0&&this.attenuationDistance!==1/0&&(n.attenuationDistance=this.attenuationDistance),this.attenuationColor!==void 0&&(n.attenuationColor=this.attenuationColor.getHex()),this.size!==void 0&&(n.size=this.size),this.shadowSide!==null&&(n.shadowSide=this.shadowSide),this.sizeAttenuation!==void 0&&(n.sizeAttenuation=this.sizeAttenuation),this.blending!==rs&&(n.blending=this.blending),this.side!==po&&(n.side=this.side),this.vertexColors===!0&&(n.vertexColors=!0),this.opacity<1&&(n.opacity=this.opacity),this.transparent===!0&&(n.transparent=!0),this.blendSrc!==Ud&&(n.blendSrc=this.blendSrc),this.blendDst!==kd&&(n.blendDst=this.blendDst),this.blendEquation!==Os&&(n.blendEquation=this.blendEquation),this.blendSrcAlpha!==null&&(n.blendSrcAlpha=this.blendSrcAlpha),this.blendDstAlpha!==null&&(n.blendDstAlpha=this.blendDstAlpha),this.blendEquationAlpha!==null&&(n.blendEquationAlpha=this.blendEquationAlpha),this.blendColor&&this.blendColor.isColor&&(n.blendColor=this.blendColor.getHex()),this.blendAlpha!==0&&(n.blendAlpha=this.blendAlpha),this.depthFunc!==Ou&&(n.depthFunc=this.depthFunc),this.depthTest===!1&&(n.depthTest=this.depthTest),this.depthWrite===!1&&(n.depthWrite=this.depthWrite),this.colorWrite===!1&&(n.colorWrite=this.colorWrite),this.stencilWriteMask!==255&&(n.stencilWriteMask=this.stencilWriteMask),this.stencilFunc!==my&&(n.stencilFunc=this.stencilFunc),this.stencilRef!==0&&(n.stencilRef=this.stencilRef),this.stencilFuncMask!==255&&(n.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==yf&&(n.stencilFail=this.stencilFail),this.stencilZFail!==yf&&(n.stencilZFail=this.stencilZFail),this.stencilZPass!==yf&&(n.stencilZPass=this.stencilZPass),this.stencilWrite===!0&&(n.stencilWrite=this.stencilWrite),this.rotation!==void 0&&this.rotation!==0&&(n.rotation=this.rotation),this.polygonOffset===!0&&(n.polygonOffset=!0),this.polygonOffsetFactor!==0&&(n.polygonOffsetFactor=this.polygonOffsetFactor),this.polygonOffsetUnits!==0&&(n.polygonOffsetUnits=this.polygonOffsetUnits),this.linewidth!==void 0&&this.linewidth!==1&&(n.linewidth=this.linewidth),this.dashSize!==void 0&&(n.dashSize=this.dashSize),this.gapSize!==void 0&&(n.gapSize=this.gapSize),this.scale!==void 0&&(n.scale=this.scale),this.dithering===!0&&(n.dithering=!0),this.alphaTest>0&&(n.alphaTest=this.alphaTest),this.alphaHash===!0&&(n.alphaHash=!0),this.alphaToCoverage===!0&&(n.alphaToCoverage=!0),this.premultipliedAlpha===!0&&(n.premultipliedAlpha=!0),this.forceSinglePass===!0&&(n.forceSinglePass=!0),this.allowOverride===!1&&(n.allowOverride=!1),this.wireframe===!0&&(n.wireframe=!0),this.wireframeLinewidth>1&&(n.wireframeLinewidth=this.wireframeLinewidth),this.wireframeLinecap!=="round"&&(n.wireframeLinecap=this.wireframeLinecap),this.wireframeLinejoin!=="round"&&(n.wireframeLinejoin=this.wireframeLinejoin),this.flatShading===!0&&(n.flatShading=!0),this.visible===!1&&(n.visible=!1),this.toneMapped===!1&&(n.toneMapped=!1),this.fog===!1&&(n.fog=!1),Object.keys(this.userData).length>0&&(n.userData=this.userData);function r(s){let o=[];for(let a in s){let l=s[a];delete l.metadata,o.push(l)}return o}if(t){let s=r(e.textures),o=r(e.images);s.length>0&&(n.textures=s),o.length>0&&(n.images=o)}return n}fromJSON(e,t){if(e.uuid!==void 0&&(this.uuid=e.uuid),e.name!==void 0&&(this.name=e.name),e.color!==void 0&&this.color!==void 0&&this.color.setHex(e.color),e.roughness!==void 0&&(this.roughness=e.roughness),e.metalness!==void 0&&(this.metalness=e.metalness),e.sheen!==void 0&&(this.sheen=e.sheen),e.sheenColor!==void 0&&(this.sheenColor=new Ut().setHex(e.sheenColor)),e.sheenRoughness!==void 0&&(this.sheenRoughness=e.sheenRoughness),e.emissive!==void 0&&this.emissive!==void 0&&this.emissive.setHex(e.emissive),e.specular!==void 0&&this.specular!==void 0&&this.specular.setHex(e.specular),e.specularIntensity!==void 0&&(this.specularIntensity=e.specularIntensity),e.specularColor!==void 0&&this.specularColor!==void 0&&this.specularColor.setHex(e.specularColor),e.shininess!==void 0&&(this.shininess=e.shininess),e.clearcoat!==void 0&&(this.clearcoat=e.clearcoat),e.clearcoatRoughness!==void 0&&(this.clearcoatRoughness=e.clearcoatRoughness),e.dispersion!==void 0&&(this.dispersion=e.dispersion),e.iridescence!==void 0&&(this.iridescence=e.iridescence),e.iridescenceIOR!==void 0&&(this.iridescenceIOR=e.iridescenceIOR),e.iridescenceThicknessRange!==void 0&&(this.iridescenceThicknessRange=e.iridescenceThicknessRange),e.transmission!==void 0&&(this.transmission=e.transmission),e.thickness!==void 0&&(this.thickness=e.thickness),e.attenuationDistance!==void 0&&(this.attenuationDistance=e.attenuationDistance),e.attenuationColor!==void 0&&this.attenuationColor!==void 0&&this.attenuationColor.setHex(e.attenuationColor),e.anisotropy!==void 0&&(this.anisotropy=e.anisotropy),e.anisotropyRotation!==void 0&&(this.anisotropyRotation=e.anisotropyRotation),e.fog!==void 0&&(this.fog=e.fog),e.flatShading!==void 0&&(this.flatShading=e.flatShading),e.blending!==void 0&&(this.blending=e.blending),e.combine!==void 0&&(this.combine=e.combine),e.side!==void 0&&(this.side=e.side),e.shadowSide!==void 0&&(this.shadowSide=e.shadowSide),e.opacity!==void 0&&(this.opacity=e.opacity),e.transparent!==void 0&&(this.transparent=e.transparent),e.alphaTest!==void 0&&(this.alphaTest=e.alphaTest),e.alphaHash!==void 0&&(this.alphaHash=e.alphaHash),e.depthFunc!==void 0&&(this.depthFunc=e.depthFunc),e.depthTest!==void 0&&(this.depthTest=e.depthTest),e.depthWrite!==void 0&&(this.depthWrite=e.depthWrite),e.colorWrite!==void 0&&(this.colorWrite=e.colorWrite),e.blendSrc!==void 0&&(this.blendSrc=e.blendSrc),e.blendDst!==void 0&&(this.blendDst=e.blendDst),e.blendEquation!==void 0&&(this.blendEquation=e.blendEquation),e.blendSrcAlpha!==void 0&&(this.blendSrcAlpha=e.blendSrcAlpha),e.blendDstAlpha!==void 0&&(this.blendDstAlpha=e.blendDstAlpha),e.blendEquationAlpha!==void 0&&(this.blendEquationAlpha=e.blendEquationAlpha),e.blendColor!==void 0&&this.blendColor!==void 0&&this.blendColor.setHex(e.blendColor),e.blendAlpha!==void 0&&(this.blendAlpha=e.blendAlpha),e.stencilWriteMask!==void 0&&(this.stencilWriteMask=e.stencilWriteMask),e.stencilFunc!==void 0&&(this.stencilFunc=e.stencilFunc),e.stencilRef!==void 0&&(this.stencilRef=e.stencilRef),e.stencilFuncMask!==void 0&&(this.stencilFuncMask=e.stencilFuncMask),e.stencilFail!==void 0&&(this.stencilFail=e.stencilFail),e.stencilZFail!==void 0&&(this.stencilZFail=e.stencilZFail),e.stencilZPass!==void 0&&(this.stencilZPass=e.stencilZPass),e.stencilWrite!==void 0&&(this.stencilWrite=e.stencilWrite),e.wireframe!==void 0&&(this.wireframe=e.wireframe),e.wireframeLinewidth!==void 0&&(this.wireframeLinewidth=e.wireframeLinewidth),e.wireframeLinecap!==void 0&&(this.wireframeLinecap=e.wireframeLinecap),e.wireframeLinejoin!==void 0&&(this.wireframeLinejoin=e.wireframeLinejoin),e.rotation!==void 0&&(this.rotation=e.rotation),e.linewidth!==void 0&&(this.linewidth=e.linewidth),e.dashSize!==void 0&&(this.dashSize=e.dashSize),e.gapSize!==void 0&&(this.gapSize=e.gapSize),e.scale!==void 0&&(this.scale=e.scale),e.polygonOffset!==void 0&&(this.polygonOffset=e.polygonOffset),e.polygonOffsetFactor!==void 0&&(this.polygonOffsetFactor=e.polygonOffsetFactor),e.polygonOffsetUnits!==void 0&&(this.polygonOffsetUnits=e.polygonOffsetUnits),e.dithering!==void 0&&(this.dithering=e.dithering),e.alphaToCoverage!==void 0&&(this.alphaToCoverage=e.alphaToCoverage),e.premultipliedAlpha!==void 0&&(this.premultipliedAlpha=e.premultipliedAlpha),e.forceSinglePass!==void 0&&(this.forceSinglePass=e.forceSinglePass),e.allowOverride!==void 0&&(this.allowOverride=e.allowOverride),e.visible!==void 0&&(this.visible=e.visible),e.toneMapped!==void 0&&(this.toneMapped=e.toneMapped),e.userData!==void 0&&(this.userData=e.userData),e.vertexColors!==void 0&&(typeof e.vertexColors=="number"?this.vertexColors=e.vertexColors>0:this.vertexColors=e.vertexColors),e.size!==void 0&&(this.size=e.size),e.sizeAttenuation!==void 0&&(this.sizeAttenuation=e.sizeAttenuation),e.map!==void 0&&(this.map=t[e.map]||null),e.matcap!==void 0&&(this.matcap=t[e.matcap]||null),e.alphaMap!==void 0&&(this.alphaMap=t[e.alphaMap]||null),e.bumpMap!==void 0&&(this.bumpMap=t[e.bumpMap]||null),e.bumpScale!==void 0&&(this.bumpScale=e.bumpScale),e.normalMap!==void 0&&(this.normalMap=t[e.normalMap]||null),e.normalMapType!==void 0&&(this.normalMapType=e.normalMapType),e.normalScale!==void 0){let n=e.normalScale;Array.isArray(n)===!1&&(n=[n,n]),this.normalScale=new Oe().fromArray(n)}return e.displacementMap!==void 0&&(this.displacementMap=t[e.displacementMap]||null),e.displacementScale!==void 0&&(this.displacementScale=e.displacementScale),e.displacementBias!==void 0&&(this.displacementBias=e.displacementBias),e.roughnessMap!==void 0&&(this.roughnessMap=t[e.roughnessMap]||null),e.metalnessMap!==void 0&&(this.metalnessMap=t[e.metalnessMap]||null),e.emissiveMap!==void 0&&(this.emissiveMap=t[e.emissiveMap]||null),e.emissiveIntensity!==void 0&&(this.emissiveIntensity=e.emissiveIntensity),e.specularMap!==void 0&&(this.specularMap=t[e.specularMap]||null),e.specularIntensityMap!==void 0&&(this.specularIntensityMap=t[e.specularIntensityMap]||null),e.specularColorMap!==void 0&&(this.specularColorMap=t[e.specularColorMap]||null),e.envMap!==void 0&&(this.envMap=t[e.envMap]||null),e.envMapRotation!==void 0&&this.envMapRotation.fromArray(e.envMapRotation),e.envMapIntensity!==void 0&&(this.envMapIntensity=e.envMapIntensity),e.reflectivity!==void 0&&(this.reflectivity=e.reflectivity),e.refractionRatio!==void 0&&(this.refractionRatio=e.refractionRatio),e.lightMap!==void 0&&(this.lightMap=t[e.lightMap]||null),e.lightMapIntensity!==void 0&&(this.lightMapIntensity=e.lightMapIntensity),e.aoMap!==void 0&&(this.aoMap=t[e.aoMap]||null),e.aoMapIntensity!==void 0&&(this.aoMapIntensity=e.aoMapIntensity),e.gradientMap!==void 0&&(this.gradientMap=t[e.gradientMap]||null),e.clearcoatMap!==void 0&&(this.clearcoatMap=t[e.clearcoatMap]||null),e.clearcoatRoughnessMap!==void 0&&(this.clearcoatRoughnessMap=t[e.clearcoatRoughnessMap]||null),e.clearcoatNormalMap!==void 0&&(this.clearcoatNormalMap=t[e.clearcoatNormalMap]||null),e.clearcoatNormalScale!==void 0&&(this.clearcoatNormalScale=new Oe().fromArray(e.clearcoatNormalScale)),e.iridescenceMap!==void 0&&(this.iridescenceMap=t[e.iridescenceMap]||null),e.iridescenceThicknessMap!==void 0&&(this.iridescenceThicknessMap=t[e.iridescenceThicknessMap]||null),e.transmissionMap!==void 0&&(this.transmissionMap=t[e.transmissionMap]||null),e.thicknessMap!==void 0&&(this.thicknessMap=t[e.thicknessMap]||null),e.anisotropyMap!==void 0&&(this.anisotropyMap=t[e.anisotropyMap]||null),e.sheenColorMap!==void 0&&(this.sheenColorMap=t[e.sheenColorMap]||null),e.sheenRoughnessMap!==void 0&&(this.sheenRoughnessMap=t[e.sheenRoughnessMap]||null),this}clone(){return new this.constructor().copy(this)}copy(e){this.name=e.name,this.blending=e.blending,this.side=e.side,this.vertexColors=e.vertexColors,this.opacity=e.opacity,this.transparent=e.transparent,this.blendSrc=e.blendSrc,this.blendDst=e.blendDst,this.blendEquation=e.blendEquation,this.blendSrcAlpha=e.blendSrcAlpha,this.blendDstAlpha=e.blendDstAlpha,this.blendEquationAlpha=e.blendEquationAlpha,this.blendColor.copy(e.blendColor),this.blendAlpha=e.blendAlpha,this.depthFunc=e.depthFunc,this.depthTest=e.depthTest,this.depthWrite=e.depthWrite,this.stencilWriteMask=e.stencilWriteMask,this.stencilFunc=e.stencilFunc,this.stencilRef=e.stencilRef,this.stencilFuncMask=e.stencilFuncMask,this.stencilFail=e.stencilFail,this.stencilZFail=e.stencilZFail,this.stencilZPass=e.stencilZPass,this.stencilWrite=e.stencilWrite;let t=e.clippingPlanes,n=null;if(t!==null){let r=t.length;n=new Array(r);for(let s=0;s!==r;++s)n[s]=t[s].clone()}return this.clippingPlanes=n,this.clipIntersection=e.clipIntersection,this.clipShadows=e.clipShadows,this.shadowSide=e.shadowSide,this.colorWrite=e.colorWrite,this.precision=e.precision,this.polygonOffset=e.polygonOffset,this.polygonOffsetFactor=e.polygonOffsetFactor,this.polygonOffsetUnits=e.polygonOffsetUnits,this.dithering=e.dithering,this.alphaTest=e.alphaTest,this.alphaHash=e.alphaHash,this.alphaToCoverage=e.alphaToCoverage,this.premultipliedAlpha=e.premultipliedAlpha,this.forceSinglePass=e.forceSinglePass,this.allowOverride=e.allowOverride,this.visible=e.visible,this.toneMapped=e.toneMapped,this.userData=JSON.parse(JSON.stringify(e.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(e){e===!0&&this.version++}},Wd=class extends bs{constructor(e){super(),this.isSpriteMaterial=!0,this.type="SpriteMaterial",this.color=new Ut(16777215),this.map=null,this.alphaMap=null,this.rotation=0,this.sizeAttenuation=!0,this.transparent=!0,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.alphaMap=e.alphaMap,this.rotation=e.rotation,this.sizeAttenuation=e.sizeAttenuation,this.fog=e.fog,this}},Qg,oy=new ie,Jg=new ie,e_=new ie,t_=new Oe,ay=new Oe,XH=new on,qS=new ie,ly=new ie,HS=new ie,uH=new Oe,SN=new Oe,hH=new Oe,gy=class extends $i{constructor(e=new Wd){if(super(),this.isSprite=!0,this.type="Sprite",Qg===void 0){Qg=new Kn;let t=new Float32Array([-.5,-.5,0,0,0,.5,-.5,0,1,0,.5,.5,0,1,1,-.5,.5,0,0,1]),n=new Mf(t,5);Qg.setIndex([0,1,2,0,2,3]),Qg.setAttribute("position",new Ao(n,3,0,!1)),Qg.setAttribute("uv",new Ao(n,2,3,!1))}this.geometry=Qg,this.material=e,this.center=new Oe(.5,.5),this.count=1}raycast(e,t){e.camera===null&&Ge('Sprite: "Raycaster.camera" needs to be set in order to raycast against sprites.'),Jg.setFromMatrixScale(this.matrixWorld),XH.copy(e.camera.matrixWorld),this.modelViewMatrix.multiplyMatrices(e.camera.matrixWorldInverse,this.matrixWorld),e_.setFromMatrixPosition(this.modelViewMatrix),e.camera.isPerspectiveCamera&&this.material.sizeAttenuation===!1&&Jg.multiplyScalar(-e_.z);let n=this.material.rotation,r,s;n!==0&&(s=Math.cos(n),r=Math.sin(n));let o=this.center;WS(qS.set(-.5,-.5,0),e_,o,Jg,r,s),WS(ly.set(.5,-.5,0),e_,o,Jg,r,s),WS(HS.set(.5,.5,0),e_,o,Jg,r,s),uH.set(0,0),SN.set(1,0),hH.set(1,1);let a=e.ray.intersectTriangle(qS,ly,HS,!1,oy);if(a===null&&(WS(ly.set(-.5,.5,0),e_,o,Jg,r,s),SN.set(0,1),a=e.ray.intersectTriangle(qS,HS,ly,!1,oy),a===null))return;let l=e.ray.origin.distanceTo(oy);l<e.near||l>e.far||t.push({distance:l,point:oy.clone(),uv:vf.getInterpolation(oy,qS,ly,HS,uH,SN,hH,new Oe),face:null,object:this})}copy(e,t){return super.copy(e,t),e.center!==void 0&&this.center.copy(e.center),this.material=e.material,this}};function WS(i,e,t,n,r,s){t_.subVectors(i,t).addScalar(.5).multiply(n),r!==void 0?(ay.x=s*t_.x-r*t_.y,ay.y=r*t_.x+s*t_.y):ay.copy(t_),i.copy(e),i.x+=ay.x,i.y+=ay.y,i.applyMatrix4(XH)}var xf=new ie,TN=new ie,jS=new ie,Fd=new ie,EN=new ie,XS=new ie,MN=new ie,Cf=class{constructor(e=new ie,t=new ie(0,0,-1)){this.origin=e,this.direction=t}set(e,t){return this.origin.copy(e),this.direction.copy(t),this}copy(e){return this.origin.copy(e.origin),this.direction.copy(e.direction),this}at(e,t){return t.copy(this.origin).addScaledVector(this.direction,e)}lookAt(e){return this.direction.copy(e).sub(this.origin).normalize(),this}recast(e){return this.origin.copy(this.at(e,xf)),this}closestPointToPoint(e,t){t.subVectors(e,this.origin);let n=t.dot(this.direction);return n<0?t.copy(this.origin):t.copy(this.origin).addScaledVector(this.direction,n)}distanceToPoint(e){return Math.sqrt(this.distanceSqToPoint(e))}distanceSqToPoint(e){let t=xf.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(xf.copy(this.origin).addScaledVector(this.direction,t),xf.distanceToSquared(e))}distanceSqToSegment(e,t,n,r){TN.copy(e).add(t).multiplyScalar(.5),jS.copy(t).sub(e).normalize(),Fd.copy(this.origin).sub(TN);let s=e.distanceTo(t)*.5,o=-this.direction.dot(jS),a=Fd.dot(this.direction),l=-Fd.dot(jS),c=Fd.lengthSq(),u=Math.abs(1-o*o),f,p,x,b;if(u>0)if(f=o*l-a,p=o*a-l,b=s*u,f>=0)if(p>=-b)if(p<=b){let w=1/u;f*=w,p*=w,x=f*(f+o*p+2*a)+p*(o*f+p+2*l)+c}else p=s,f=Math.max(0,-(o*p+a)),x=-f*f+p*(p+2*l)+c;else p=-s,f=Math.max(0,-(o*p+a)),x=-f*f+p*(p+2*l)+c;else p<=-b?(f=Math.max(0,-(-o*s+a)),p=f>0?-s:Math.min(Math.max(-s,-l),s),x=-f*f+p*(p+2*l)+c):p<=b?(f=0,p=Math.min(Math.max(-s,-l),s),x=p*(p+2*l)+c):(f=Math.max(0,-(o*s+a)),p=f>0?s:Math.min(Math.max(-s,-l),s),x=-f*f+p*(p+2*l)+c);else p=o>0?-s:s,f=Math.max(0,-(o*p+a)),x=-f*f+p*(p+2*l)+c;return n&&n.copy(this.origin).addScaledVector(this.direction,f),r&&r.copy(TN).addScaledVector(jS,p),x}intersectSphere(e,t){xf.subVectors(e.center,this.origin);let n=xf.dot(this.direction),r=xf.dot(xf)-n*n,s=e.radius*e.radius;if(r>s)return null;let o=Math.sqrt(s-r),a=n-o,l=n+o;return l<0?null:a<0?this.at(l,t):this.at(a,t)}intersectsSphere(e){return e.radius<0?!1:this.distanceSqToPoint(e.center)<=e.radius*e.radius}distanceToPlane(e){let t=e.normal.dot(this.direction);if(t===0)return e.distanceToPoint(this.origin)===0?0:null;let n=-(this.origin.dot(e.normal)+e.constant)/t;return n>=0?n:null}intersectPlane(e,t){let n=this.distanceToPlane(e);return n===null?null:this.at(n,t)}intersectsPlane(e){let t=e.distanceToPoint(this.origin);return t===0||e.normal.dot(this.direction)*t<0}intersectBox(e,t){let n,r,s,o,a,l,c=1/this.direction.x,u=1/this.direction.y,f=1/this.direction.z,p=this.origin;return c>=0?(n=(e.min.x-p.x)*c,r=(e.max.x-p.x)*c):(n=(e.max.x-p.x)*c,r=(e.min.x-p.x)*c),u>=0?(s=(e.min.y-p.y)*u,o=(e.max.y-p.y)*u):(s=(e.max.y-p.y)*u,o=(e.min.y-p.y)*u),n>o||s>r||((s>n||isNaN(n))&&(n=s),(o<r||isNaN(r))&&(r=o),f>=0?(a=(e.min.z-p.z)*f,l=(e.max.z-p.z)*f):(a=(e.max.z-p.z)*f,l=(e.min.z-p.z)*f),n>l||a>r)||((a>n||n!==n)&&(n=a),(l<r||r!==r)&&(r=l),r<0)?null:this.at(n>=0?n:r,t)}intersectsBox(e){return this.intersectBox(e,xf)!==null}intersectTriangle(e,t,n,r,s){EN.subVectors(t,e),XS.subVectors(n,e),MN.crossVectors(EN,XS);let o=this.direction.dot(MN),a;if(o>0){if(r)return null;a=1}else if(o<0)a=-1,o=-o;else return null;Fd.subVectors(this.origin,e);let l=a*this.direction.dot(XS.crossVectors(Fd,XS));if(l<0)return null;let c=a*this.direction.dot(EN.cross(Fd));if(c<0||l+c>o)return null;let u=-a*Fd.dot(MN);return u<0?null:this.at(u/o,s)}applyMatrix4(e){return this.origin.applyMatrix4(e),this.direction.transformDirection(e),this}equals(e){return e.origin.equals(this.origin)&&e.direction.equals(this.direction)}clone(){return new this.constructor().copy(this)}},Bs=class extends bs{constructor(e){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new Ut(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new ca,this.combine=RA,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.fog=e.fog,this}},fH=new on,sA=new Cf,$S=new qa,dH=new ie,YS=new ie,ZS=new ie,KS=new ie,CN=new ie,QS=new ie,pH=new ie,JS=new ie,Hn=class extends $i{constructor(e=new Kn,t=new Bs){super(),this.isMesh=!0,this.type="Mesh",this.geometry=e,this.material=t,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.count=1,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),e.morphTargetInfluences!==void 0&&(this.morphTargetInfluences=e.morphTargetInfluences.slice()),e.morphTargetDictionary!==void 0&&(this.morphTargetDictionary=Object.assign({},e.morphTargetDictionary)),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}updateMorphTargets(){let t=this.geometry.morphAttributes,n=Object.keys(t);if(n.length>0){let r=t[n[0]];if(r!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,o=r.length;s<o;s++){let a=r[s].name||String(s);this.morphTargetInfluences.push(0),this.morphTargetDictionary[a]=s}}}}getVertexPosition(e,t){let n=this.geometry,r=n.attributes.position,s=n.morphAttributes.position,o=n.morphTargetsRelative;t.fromBufferAttribute(r,e);let a=this.morphTargetInfluences;if(s&&a){QS.set(0,0,0);for(let l=0,c=s.length;l<c;l++){let u=a[l],f=s[l];u!==0&&(CN.fromBufferAttribute(f,e),o?QS.addScaledVector(CN,u):QS.addScaledVector(CN.sub(t),u))}t.add(QS)}return t}raycast(e,t){let n=this.geometry,r=this.material,s=this.matrixWorld;r!==void 0&&(n.boundingSphere===null&&n.computeBoundingSphere(),$S.copy(n.boundingSphere),$S.applyMatrix4(s),sA.copy(e.ray).recast(e.near),!($S.containsPoint(sA.origin)===!1&&(sA.intersectSphere($S,dH)===null||sA.origin.distanceToSquared(dH)>(e.far-e.near)**2))&&(fH.copy(s).invert(),sA.copy(e.ray).applyMatrix4(fH),!(n.boundingBox!==null&&sA.intersectsBox(n.boundingBox)===!1)&&this._computeIntersections(e,t,sA)))}_computeIntersections(e,t,n){let r,s=this.geometry,o=this.material,a=s.index,l=s.attributes.position,c=s.attributes.uv,u=s.attributes.uv1,f=s.attributes.normal,p=s.groups,x=s.drawRange;if(a!==null)if(Array.isArray(o))for(let b=0,w=p.length;b<w;b++){let S=p[b],T=o[S.materialIndex],P=Math.max(S.start,x.start),R=Math.min(a.count,Math.min(S.start+S.count,x.start+x.count));for(let C=P,L=R;C<L;C+=3){let D=a.getX(C),F=a.getX(C+1),N=a.getX(C+2);r=eT(this,T,e,n,c,u,f,D,F,N),r&&(r.faceIndex=Math.floor(C/3),r.face.materialIndex=S.materialIndex,t.push(r))}}else{let b=Math.max(0,x.start),w=Math.min(a.count,x.start+x.count);for(let S=b,T=w;S<T;S+=3){let P=a.getX(S),R=a.getX(S+1),C=a.getX(S+2);r=eT(this,o,e,n,c,u,f,P,R,C),r&&(r.faceIndex=Math.floor(S/3),t.push(r))}}else if(l!==void 0)if(Array.isArray(o))for(let b=0,w=p.length;b<w;b++){let S=p[b],T=o[S.materialIndex],P=Math.max(S.start,x.start),R=Math.min(l.count,Math.min(S.start+S.count,x.start+x.count));for(let C=P,L=R;C<L;C+=3){let D=C,F=C+1,N=C+2;r=eT(this,T,e,n,c,u,f,D,F,N),r&&(r.faceIndex=Math.floor(C/3),r.face.materialIndex=S.materialIndex,t.push(r))}}else{let b=Math.max(0,x.start),w=Math.min(l.count,x.start+x.count);for(let S=b,T=w;S<T;S+=3){let P=S,R=S+1,C=S+2;r=eT(this,o,e,n,c,u,f,P,R,C),r&&(r.faceIndex=Math.floor(S/3),t.push(r))}}}};function Ace(i,e,t,n,r,s,o,a){let l;if(e.side===ui?l=n.intersectTriangle(o,s,r,!0,a):l=n.intersectTriangle(r,s,o,e.side===po,a),l===null)return null;JS.copy(a),JS.applyMatrix4(i.matrixWorld);let c=t.ray.origin.distanceTo(JS);return c<t.near||c>t.far?null:{distance:c,point:JS.clone(),object:i}}function eT(i,e,t,n,r,s,o,a,l,c){i.getVertexPosition(a,YS),i.getVertexPosition(l,ZS),i.getVertexPosition(c,KS);let u=Ace(i,e,t,n,YS,ZS,KS,pH);if(u){let f=new ie;vf.getBarycoord(pH,YS,ZS,KS,f),r&&(u.uv=vf.getInterpolatedAttribute(r,a,l,c,f,new Oe)),s&&(u.uv1=vf.getInterpolatedAttribute(s,a,l,c,f,new Oe)),o&&(u.normal=vf.getInterpolatedAttribute(o,a,l,c,f,new ie),u.normal.dot(n.direction)>0&&u.normal.multiplyScalar(-1));let p={a,b:l,c,normal:new ie,materialIndex:0};vf.getNormal(YS,ZS,KS,p.normal),u.face=p,u.barycoord=f}return u}var _A=class extends vs{constructor(e=null,t=1,n=1,r,s,o,a,l,c=xi,u=xi,f,p){super(null,o,a,l,c,u,r,s,f,p),this.isDataTexture=!0,this.image={data:e,width:t,height:n},this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}};var Al=class extends Ni{constructor(e,t,n,r=1){super(e,t,n),this.isInstancedBufferAttribute=!0,this.meshPerAttribute=r}copy(e){return super.copy(e),this.meshPerAttribute=e.meshPerAttribute,this}toJSON(){let e=super.toJSON();return e.meshPerAttribute=this.meshPerAttribute,e.isInstancedBufferAttribute=!0,e}};var RN=new ie,mce=new ie,gce=new Sn,sa=class{constructor(e=new ie(1,0,0),t=0){this.isPlane=!0,this.normal=e,this.constant=t}set(e,t){return this.normal.copy(e),this.constant=t,this}setComponents(e,t,n,r){return this.normal.set(e,t,n),this.constant=r,this}setFromNormalAndCoplanarPoint(e,t){return this.normal.copy(e),this.constant=-t.dot(this.normal),this}setFromCoplanarPoints(e,t,n){let r=RN.subVectors(n,t).cross(mce.subVectors(e,t)).normalize();return this.setFromNormalAndCoplanarPoint(r,e),this}copy(e){return this.normal.copy(e.normal),this.constant=e.constant,this}normalize(){let e=1/this.normal.length();return this.normal.multiplyScalar(e),this.constant*=e,this}negate(){return this.constant*=-1,this.normal.negate(),this}distanceToPoint(e){return this.normal.dot(e)+this.constant}distanceToSphere(e){return this.distanceToPoint(e.center)-e.radius}projectPoint(e,t){return t.copy(e).addScaledVector(this.normal,-this.distanceToPoint(e))}intersectLine(e,t,n=!0){let r=e.delta(RN),s=this.normal.dot(r);if(s===0)return this.distanceToPoint(e.start)===0?t.copy(e.start):null;let o=-(e.start.dot(this.normal)+this.constant)/s;return n===!0&&(o<0||o>1)?null:t.copy(e.start).addScaledVector(r,o)}intersectsLine(e){let t=this.distanceToPoint(e.start),n=this.distanceToPoint(e.end);return t<0&&n>0||n<0&&t>0}intersectsBox(e){return e.intersectsPlane(this)}intersectsSphere(e){return e.intersectsPlane(this)}coplanarPoint(e){return e.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(e,t){let n=t||gce.getNormalMatrix(e),r=this.coplanarPoint(RN).applyMatrix4(e),s=this.normal.applyMatrix3(n).normalize();return this.constant=-r.dot(s),this}translate(e){return this.constant-=e.dot(this.normal),this}equals(e){return e.normal.equals(this.normal)&&e.constant===this.constant}clone(){return new this.constructor().copy(this)}},oA=new qa,_ce=new Oe(.5,.5),tT=new ie,Yl=class{constructor(e=new sa,t=new sa,n=new sa,r=new sa,s=new sa,o=new sa){this.planes=[e,t,n,r,s,o]}set(e,t,n,r,s,o){let a=this.planes;return a[0].copy(e),a[1].copy(t),a[2].copy(n),a[3].copy(r),a[4].copy(s),a[5].copy(o),this}copy(e){let t=this.planes;for(let n=0;n<6;n++)t[n].copy(e.planes[n]);return this}setFromProjectionMatrix(e,t=fo,n=!1){let r=this.planes,s=e.elements,o=s[0],a=s[1],l=s[2],c=s[3],u=s[4],f=s[5],p=s[6],x=s[7],b=s[8],w=s[9],S=s[10],T=s[11],P=s[12],R=s[13],C=s[14],L=s[15];if(r[0].setComponents(c-o,x-u,T-b,L-P).normalize(),r[1].setComponents(c+o,x+u,T+b,L+P).normalize(),r[2].setComponents(c+a,x+f,T+w,L+R).normalize(),r[3].setComponents(c-a,x-f,T-w,L-R).normalize(),n)r[4].setComponents(l,p,S,C).normalize(),r[5].setComponents(c-l,x-p,T-S,L-C).normalize();else if(r[4].setComponents(c-l,x-p,T-S,L-C).normalize(),t===fo)r[5].setComponents(c+l,x+p,T+S,L+C).normalize();else if(t===Va)r[5].setComponents(l,p,S,C).normalize();else throw new Error("THREE.Frustum.setFromProjectionMatrix(): Invalid coordinate system: "+t);return this}intersectsObject(e){if(e.boundingSphere!==void 0)e.boundingSphere===null&&e.computeBoundingSphere(),oA.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);else{let t=e.geometry;t.boundingSphere===null&&t.computeBoundingSphere(),oA.copy(t.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere(oA)}intersectsSprite(e){oA.center.set(0,0,0);let t=_ce.distanceTo(e.center);return oA.radius=.7071067811865476+t,oA.applyMatrix4(e.matrixWorld),this.intersectsSphere(oA)}intersectsSphere(e){let t=this.planes,n=e.center,r=-e.radius;for(let s=0;s<6;s++)if(t[s].distanceToPoint(n)<r)return!1;return!0}intersectsBox(e){let t=this.planes;for(let n=0;n<6;n++){let r=t[n];if(tT.x=r.normal.x>0?e.max.x:e.min.x,tT.y=r.normal.y>0?e.max.y:e.min.y,tT.z=r.normal.z>0?e.max.z:e.min.z,r.distanceToPoint(tT)<0)return!1}return!0}containsPoint(e){let t=this.planes;for(let n=0;n<6;n++)if(t[n].distanceToPoint(e)<0)return!1;return!0}clone(){return new this.constructor().copy(this)}},AH=new on,_y=class i{constructor(){this.coordinateSystem=fo,this._frustums=[],this._count=0}setFromArrayCamera(e){let t=e.cameras,n=this._frustums;for(let r=0;r<t.length;r++){let s=t[r];AH.multiplyMatrices(s.projectionMatrix,s.matrixWorldInverse),n[r]===void 0&&(n[r]=new Yl),n[r].setFromProjectionMatrix(AH,s.coordinateSystem,s.reversedDepth)}return this._count=t.length,this}intersectsObject(e){let t=this._frustums;for(let n=0;n<this._count;n++)if(t[n].intersectsObject(e))return!0;return!1}intersectsSprite(e){let t=this._frustums;for(let n=0;n<this._count;n++)if(t[n].intersectsSprite(e))return!0;return!1}intersectsSphere(e){let t=this._frustums;for(let n=0;n<this._count;n++)if(t[n].intersectsSphere(e))return!0;return!1}intersectsBox(e){let t=this._frustums;for(let n=0;n<this._count;n++)if(t[n].intersectsBox(e))return!0;return!1}containsPoint(e){let t=this._frustums;for(let n=0;n<this._count;n++)if(t[n].containsPoint(e))return!0;return!1}copy(e){this.coordinateSystem=e.coordinateSystem;let t=this._frustums,n=e._frustums;for(let r=0;r<e._count;r++)t[r]===void 0&&(t[r]=new Yl),t[r].copy(n[r]);return this._count=e._count,this}clone(){return new i().copy(this)}};var kc=class extends bs{constructor(e){super(),this.isLineBasicMaterial=!0,this.type="LineBasicMaterial",this.color=new Ut(16777215),this.map=null,this.linewidth=1,this.linecap="round",this.linejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.linewidth=e.linewidth,this.linecap=e.linecap,this.linejoin=e.linejoin,this.fog=e.fog,this}},gT=new ie,_T=new ie,mH=new on,cy=new Cf,nT=new qa,PN=new ie,gH=new ie,jd=class extends $i{constructor(e=new Kn,t=new kc){super(),this.isLine=!0,this.type="Line",this.geometry=e,this.material=t,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}computeLineDistances(){let e=this.geometry;if(e.index===null){let t=e.attributes.position,n=[0];for(let r=1,s=t.count;r<s;r++)gT.fromBufferAttribute(t,r-1),_T.fromBufferAttribute(t,r),n[r]=n[r-1],n[r]+=gT.distanceTo(_T);e.setAttribute("lineDistance",new kn(n,1))}else je("Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}raycast(e,t){let n=this.geometry,r=this.matrixWorld,s=e.params.Line.threshold,o=n.drawRange;if(n.boundingSphere===null&&n.computeBoundingSphere(),nT.copy(n.boundingSphere),nT.applyMatrix4(r),nT.radius+=s,e.ray.intersectsSphere(nT)===!1)return;mH.copy(r).invert(),cy.copy(e.ray).applyMatrix4(mH);let a=s/((this.scale.x+this.scale.y+this.scale.z)/3),l=a*a,c=this.isLineSegments?2:1,u=n.index,p=n.attributes.position;if(u!==null){let x=Math.max(0,o.start),b=Math.min(u.count,o.start+o.count);for(let w=x,S=b-1;w<S;w+=c){let T=u.getX(w),P=u.getX(w+1),R=iT(this,e,cy,l,T,P,w);R&&t.push(R)}if(this.isLineLoop){let w=u.getX(b-1),S=u.getX(x),T=iT(this,e,cy,l,w,S,b-1);T&&t.push(T)}}else{let x=Math.max(0,o.start),b=Math.min(p.count,o.start+o.count);for(let w=x,S=b-1;w<S;w+=c){let T=iT(this,e,cy,l,w,w+1,w);T&&t.push(T)}if(this.isLineLoop){let w=iT(this,e,cy,l,b-1,x,b-1);w&&t.push(w)}}}updateMorphTargets(){let t=this.geometry.morphAttributes,n=Object.keys(t);if(n.length>0){let r=t[n[0]];if(r!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,o=r.length;s<o;s++){let a=r[s].name||String(s);this.morphTargetInfluences.push(0),this.morphTargetDictionary[a]=s}}}}};function iT(i,e,t,n,r,s,o){let a=i.geometry.attributes.position;if(gT.fromBufferAttribute(a,r),_T.fromBufferAttribute(a,s),t.distanceSqToSegment(gT,_T,PN,gH)>n)return;PN.applyMatrix4(i.matrixWorld);let c=e.ray.origin.distanceTo(PN);if(!(c<e.near||c>e.far))return{distance:c,point:gH.clone().applyMatrix4(i.matrixWorld),index:o,face:null,faceIndex:null,barycoord:null,object:i}}var _H=new ie,xH=new ie,d_=class extends jd{constructor(e,t){super(e,t),this.isLineSegments=!0,this.type="LineSegments"}computeLineDistances(){let e=this.geometry;if(e.index===null){let t=e.attributes.position,n=[];for(let r=0,s=t.count;r<s;r+=2)_H.fromBufferAttribute(t,r),xH.fromBufferAttribute(t,r+1),n[r]=r===0?0:n[r-1],n[r+1]=n[r]+_H.distanceTo(xH);e.setAttribute("lineDistance",new kn(n,1))}else je("LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}};var Xd=class extends bs{constructor(e){super(),this.isPointsMaterial=!0,this.type="PointsMaterial",this.color=new Ut(16777215),this.map=null,this.alphaMap=null,this.size=1,this.sizeAttenuation=!0,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.alphaMap=e.alphaMap,this.size=e.size,this.sizeAttenuation=e.sizeAttenuation,this.fog=e.fog,this}},yH=new on,GN=new Cf,rT=new qa,sT=new ie,xy=class extends $i{constructor(e=new Kn,t=new Xd){super(),this.isPoints=!0,this.type="Points",this.geometry=e,this.material=t,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}raycast(e,t){let n=this.geometry,r=this.matrixWorld,s=e.params.Points.threshold,o=n.drawRange;if(n.boundingSphere===null&&n.computeBoundingSphere(),rT.copy(n.boundingSphere),rT.applyMatrix4(r),rT.radius+=s,e.ray.intersectsSphere(rT)===!1)return;yH.copy(r).invert(),GN.copy(e.ray).applyMatrix4(yH);let a=s/((this.scale.x+this.scale.y+this.scale.z)/3),l=a*a,c=n.index,f=n.attributes.position;if(c!==null){let p=Math.max(0,o.start),x=Math.min(c.count,o.start+o.count);for(let b=p,w=x;b<w;b++){let S=c.getX(b);sT.fromBufferAttribute(f,S),vH(sT,S,l,r,e,t,this)}}else{let p=Math.max(0,o.start),x=Math.min(f.count,o.start+o.count);for(let b=p,w=x;b<w;b++)sT.fromBufferAttribute(f,b),vH(sT,b,l,r,e,t,this)}}updateMorphTargets(){let t=this.geometry.morphAttributes,n=Object.keys(t);if(n.length>0){let r=t[n[0]];if(r!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,o=r.length;s<o;s++){let a=r[s].name||String(s);this.morphTargetInfluences.push(0),this.morphTargetDictionary[a]=s}}}}};function vH(i,e,t,n,r,s,o){let a=GN.distanceSqToPoint(i);if(a<t){let l=new ie;GN.closestPointToPoint(i,l),l.applyMatrix4(n);let c=r.ray.origin.distanceTo(l);if(c<r.near||c>r.far)return;s.push({distance:c,distanceToRay:Math.sqrt(a),point:l,index:e,face:null,faceIndex:null,barycoord:null,object:o})}}var xA=class extends vs{constructor(e,t){super({width:e,height:t}),this.isFramebufferTexture=!0,this.magFilter=xi,this.minFilter=xi,this.generateMipmaps=!1,this.needsUpdate=!0}};var Bu=class extends vs{constructor(e=[],t=gl,n,r,s,o,a,l,c,u){super(e,t,n,r,s,o,a,l,c,u),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(e){this.image=e}};var ss=class extends vs{constructor(e,t,n=pi,r,s,o,a=xi,l=xi,c,u=xs,f=1){if(u!==xs&&u!==Ks)throw new Error("THREE.DepthTexture: format must be either THREE.DepthFormat or THREE.DepthStencilFormat");let p={width:e,height:t,depth:f};super(p,r,s,o,a,l,u,n,c),this.isDepthTexture=!0,this.flipY=!1,this.generateMipmaps=!1,this.compareFunction=null}copy(e){return super.copy(e),this.source=new u_(Object.assign({},e.image)),this.compareFunction=e.compareFunction,this}toJSON(e){let t=super.toJSON(e);return this.compareFunction!==null&&(t.compareFunction=this.compareFunction),t}},p_=class extends ss{constructor(e,t=pi,n=gl,r,s,o=xi,a=xi,l,c=xs){let u={width:e,height:e,depth:1},f=[u,u,u,u,u,u];super(e,e,t,n,r,s,o,a,l,c),this.image=f,this.isCubeDepthTexture=!0,this.isCubeTexture=!0}get images(){return this.image}set images(e){this.image=e}},yy=class extends vs{constructor(e=null){super(),this.sourceTexture=e,this.isExternalTexture=!0}copy(e){return super.copy(e),this.sourceTexture=e.sourceTexture,this}},Gc=class i extends Kn{constructor(e=1,t=1,n=1,r=1,s=1,o=1){super(),this.type="BoxGeometry",this.parameters={width:e,height:t,depth:n,widthSegments:r,heightSegments:s,depthSegments:o};let a=this;r=Math.floor(r),s=Math.floor(s),o=Math.floor(o);let l=[],c=[],u=[],f=[],p=0,x=0;b("z","y","x",-1,-1,n,t,e,o,s,0),b("z","y","x",1,-1,n,t,-e,o,s,1),b("x","z","y",1,1,e,n,t,r,o,2),b("x","z","y",1,-1,e,n,-t,r,o,3),b("x","y","z",1,-1,e,t,n,r,s,4),b("x","y","z",-1,-1,e,t,-n,r,s,5),this.setIndex(l),this.setAttribute("position",new kn(c,3)),this.setAttribute("normal",new kn(u,3)),this.setAttribute("uv",new kn(f,2));function b(w,S,T,P,R,C,L,D,F,N,B){let z=C/F,V=L/N,H=C/2,Z=L/2,J=D/2,j=F+1,K=N+1,ee=0,ae=0,ce=new ie;for(let de=0;de<K;de++){let ve=de*V-Z;for(let Ie=0;Ie<j;Ie++){let Qe=Ie*z-H;ce[w]=Qe*P,ce[S]=ve*R,ce[T]=J,c.push(ce.x,ce.y,ce.z),ce[w]=0,ce[S]=0,ce[T]=D>0?1:-1,u.push(ce.x,ce.y,ce.z),f.push(Ie/F),f.push(1-de/N),ee+=1}}for(let de=0;de<N;de++)for(let ve=0;ve<F;ve++){let Ie=p+ve+j*de,Qe=p+ve+j*(de+1),Ue=p+(ve+1)+j*(de+1),mt=p+(ve+1)+j*de;l.push(Ie,Qe,mt),l.push(Qe,Ue,mt),ae+=6}a.addGroup(x,ae,B),x+=ae,p+=ee}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new i(e.width,e.height,e.depth,e.widthSegments,e.heightSegments,e.depthSegments)}};var A_=class i extends Kn{constructor(e=1,t=32,n=0,r=Math.PI*2){super(),this.type="CircleGeometry",this.parameters={radius:e,segments:t,thetaStart:n,thetaLength:r},t=Math.max(3,t);let s=[],o=[],a=[],l=[],c=new ie,u=new Oe;o.push(0,0,0),a.push(0,0,1),l.push(.5,.5);for(let f=0,p=3;f<=t;f++,p+=3){let x=n+f/t*r;c.x=e*Math.cos(x),c.y=e*Math.sin(x),o.push(c.x,c.y,c.z),a.push(0,0,1),u.x=(o[p]/e+1)/2,u.y=(o[p+1]/e+1)/2,l.push(u.x,u.y)}for(let f=1;f<=t;f++)s.push(f,f+1,0);this.setIndex(s),this.setAttribute("position",new kn(o,3)),this.setAttribute("normal",new kn(a,3)),this.setAttribute("uv",new kn(l,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new i(e.radius,e.segments,e.thetaStart,e.thetaLength)}},yA=class i extends Kn{constructor(e=1,t=1,n=1,r=32,s=1,o=!1,a=0,l=Math.PI*2){super(),this.type="CylinderGeometry",this.parameters={radiusTop:e,radiusBottom:t,height:n,radialSegments:r,heightSegments:s,openEnded:o,thetaStart:a,thetaLength:l};let c=this;r=Math.floor(r),s=Math.floor(s);let u=[],f=[],p=[],x=[],b=0,w=[],S=n/2,T=0;P(),o===!1&&(e>0&&R(!0),t>0&&R(!1)),this.setIndex(u),this.setAttribute("position",new kn(f,3)),this.setAttribute("normal",new kn(p,3)),this.setAttribute("uv",new kn(x,2));function P(){let C=new ie,L=new ie,D=0,F=(t-e)/n;for(let N=0;N<=s;N++){let B=[],z=N/s,V=z*(t-e)+e;for(let H=0;H<=r;H++){let Z=H/r,J=Z*l+a,j=Math.sin(J),K=Math.cos(J);L.x=V*j,L.y=-z*n+S,L.z=V*K,f.push(L.x,L.y,L.z),C.set(j,F,K).normalize(),p.push(C.x,C.y,C.z),x.push(Z,1-z),B.push(b++)}w.push(B)}for(let N=0;N<r;N++)for(let B=0;B<s;B++){let z=w[B][N],V=w[B+1][N],H=w[B+1][N+1],Z=w[B][N+1];(e>0||B!==0)&&(u.push(z,V,Z),D+=3),(t>0||B!==s-1)&&(u.push(V,H,Z),D+=3)}c.addGroup(T,D,0),T+=D}function R(C){let L=b,D=new Oe,F=new ie,N=0,B=C===!0?e:t,z=C===!0?1:-1;for(let H=1;H<=r;H++)f.push(0,S*z,0),p.push(0,z,0),x.push(.5,.5),b++;let V=b;for(let H=0;H<=r;H++){let J=H/r*l+a,j=Math.cos(J),K=Math.sin(J);F.x=B*K,F.y=S*z,F.z=B*j,f.push(F.x,F.y,F.z),p.push(0,z,0),D.x=j*.5+.5,D.y=K*.5*z+.5,x.push(D.x,D.y),b++}for(let H=0;H<r;H++){let Z=L+H,J=V+H;C===!0?u.push(J,J+1,Z):u.push(J+1,J,Z),N+=3}c.addGroup(T,N,C===!0?1:2),T+=N}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new i(e.radiusTop,e.radiusBottom,e.height,e.radialSegments,e.heightSegments,e.openEnded,e.thetaStart,e.thetaLength)}};var ha=class{constructor(){this.type="Curve",this.arcLengthDivisions=200,this.needsUpdate=!1,this.cacheArcLengths=null}getPoint(){je("Curve: .getPoint() not implemented.")}getPointAt(e,t){let n=this.getUtoTmapping(e);return this.getPoint(n,t)}getPoints(e=5){let t=[];for(let n=0;n<=e;n++)t.push(this.getPoint(n/e));return t}getSpacedPoints(e=5){let t=[];for(let n=0;n<=e;n++)t.push(this.getPointAt(n/e));return t}getLength(){let e=this.getLengths();return e[e.length-1]}getLengths(e=this.arcLengthDivisions){if(this.cacheArcLengths&&this.cacheArcLengths.length===e+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;let t=[],n,r=this.getPoint(0),s=0;t.push(0);for(let o=1;o<=e;o++)n=this.getPoint(o/e),s+=n.distanceTo(r),t.push(s),r=n;return this.cacheArcLengths=t,t}updateArcLengths(){this.needsUpdate=!0,this.getLengths()}getUtoTmapping(e,t=null){let n=this.getLengths(),r=0,s=n.length,o;t?o=t:o=e*n[s-1];let a=0,l=s-1,c;for(;a<=l;)if(r=Math.floor(a+(l-a)/2),c=n[r]-o,c<0)a=r+1;else if(c>0)l=r-1;else{l=r;break}if(r=l,n[r]===o)return r/(s-1);let u=n[r],p=n[r+1]-u,x=(o-u)/p;return(r+x)/(s-1)}getTangent(e,t){let r=e-1e-4,s=e+1e-4;r<0&&(r=0),s>1&&(s=1);let o=this.getPoint(r),a=this.getPoint(s),l=t||(o.isVector2?new Oe:new ie);return l.copy(a).sub(o).normalize(),l}getTangentAt(e,t){let n=this.getUtoTmapping(e);return this.getTangent(n,t)}computeFrenetFrames(e,t=!1){let n=new ie,r=[],s=[],o=[],a=new ie,l=new on;for(let x=0;x<=e;x++){let b=x/e;r[x]=this.getTangentAt(b,new ie)}s[0]=new ie,o[0]=new ie;let c=Number.MAX_VALUE,u=Math.abs(r[0].x),f=Math.abs(r[0].y),p=Math.abs(r[0].z);u<=c&&(c=u,n.set(1,0,0)),f<=c&&(c=f,n.set(0,1,0)),p<=c&&n.set(0,0,1),a.crossVectors(r[0],n).normalize(),s[0].crossVectors(r[0],a),o[0].crossVectors(r[0],s[0]);for(let x=1;x<=e;x++){if(s[x]=s[x-1].clone(),o[x]=o[x-1].clone(),a.crossVectors(r[x-1],r[x]),a.length()>Number.EPSILON){a.normalize();let b=Math.acos(Pn(r[x-1].dot(r[x]),-1,1));s[x].applyMatrix4(l.makeRotationAxis(a,b))}o[x].crossVectors(r[x],s[x])}if(t===!0){let x=Math.acos(Pn(s[0].dot(s[e]),-1,1));x/=e,r[0].dot(a.crossVectors(s[0],s[e]))>0&&(x=-x);for(let b=1;b<=e;b++)s[b].applyMatrix4(l.makeRotationAxis(r[b],x*b)),o[b].crossVectors(r[b],s[b])}return{tangents:r,normals:s,binormals:o}}clone(){return new this.constructor().copy(this)}copy(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}toJSON(){let e={metadata:{version:4.7,type:"Curve",generator:"Curve.toJSON"}};return e.arcLengthDivisions=this.arcLengthDivisions,e.type=this.type,e}fromJSON(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}},m_=class extends ha{constructor(e=0,t=0,n=1,r=1,s=0,o=Math.PI*2,a=!1,l=0){super(),this.isEllipseCurve=!0,this.type="EllipseCurve",this.aX=e,this.aY=t,this.xRadius=n,this.yRadius=r,this.aStartAngle=s,this.aEndAngle=o,this.aClockwise=a,this.aRotation=l}getPoint(e,t=new Oe){let n=t,r=Math.PI*2,s=this.aEndAngle-this.aStartAngle,o=Math.abs(s)<Number.EPSILON;for(;s<0;)s+=r;for(;s>r;)s-=r;s<Number.EPSILON&&(o?s=0:s=r),this.aClockwise===!0&&!o&&(s===r?s=-r:s=s-r);let a=this.aStartAngle+e*s,l=this.aX+this.xRadius*Math.cos(a),c=this.aY+this.yRadius*Math.sin(a);if(this.aRotation!==0){let u=Math.cos(this.aRotation),f=Math.sin(this.aRotation),p=l-this.aX,x=c-this.aY;l=p*u-x*f+this.aX,c=p*f+x*u+this.aY}return n.set(l,c)}copy(e){return super.copy(e),this.aX=e.aX,this.aY=e.aY,this.xRadius=e.xRadius,this.yRadius=e.yRadius,this.aStartAngle=e.aStartAngle,this.aEndAngle=e.aEndAngle,this.aClockwise=e.aClockwise,this.aRotation=e.aRotation,this}toJSON(){let e=super.toJSON();return e.aX=this.aX,e.aY=this.aY,e.xRadius=this.xRadius,e.yRadius=this.yRadius,e.aStartAngle=this.aStartAngle,e.aEndAngle=this.aEndAngle,e.aClockwise=this.aClockwise,e.aRotation=this.aRotation,e}fromJSON(e){return super.fromJSON(e),this.aX=e.aX,this.aY=e.aY,this.xRadius=e.xRadius,this.yRadius=e.yRadius,this.aStartAngle=e.aStartAngle,this.aEndAngle=e.aEndAngle,this.aClockwise=e.aClockwise,this.aRotation=e.aRotation,this}},xT=class extends m_{constructor(e,t,n,r,s,o){super(e,t,n,n,r,s,o),this.isArcCurve=!0,this.type="ArcCurve"}};function _L(){let i=0,e=0,t=0,n=0;function r(s,o,a,l){i=s,e=a,t=-3*s+3*o-2*a-l,n=2*s-2*o+a+l}return{initCatmullRom:function(s,o,a,l,c){r(o,a,c*(a-s),c*(l-o))},initNonuniformCatmullRom:function(s,o,a,l,c,u,f){let p=(o-s)/c-(a-s)/(c+u)+(a-o)/u,x=(a-o)/u-(l-o)/(u+f)+(l-a)/f;p*=u,x*=u,r(o,a,p,x)},calc:function(s){let o=s*s,a=o*s;return i+e*s+t*o+n*a}}}var bH=new ie,wH=new ie,IN=new _L,NN=new _L,LN=new _L,yT=class extends ha{constructor(e=[],t=!1,n="centripetal",r=.5){super(),this.isCatmullRomCurve3=!0,this.type="CatmullRomCurve3",this.points=e,this.closed=t,this.curveType=n,this.tension=r}getPoint(e,t=new ie){let n=t,r=this.points,s=r.length,o=(s-(this.closed?0:1))*e,a=Math.floor(o),l=o-a;this.closed?a+=a>0?0:(Math.floor(Math.abs(a)/s)+1)*s:l===0&&a===s-1&&(a=s-2,l=1);let c,u;this.closed||a>0?c=r[(a-1)%s]:(wH.subVectors(r[0],r[1]).add(r[0]),c=wH);let f=r[a%s],p=r[(a+1)%s];if(this.closed||a+2<s?u=r[(a+2)%s]:(bH.subVectors(r[s-1],r[s-2]).add(r[s-1]),u=bH),this.curveType==="centripetal"||this.curveType==="chordal"){let x=this.curveType==="chordal"?.5:.25,b=Math.pow(c.distanceToSquared(f),x),w=Math.pow(f.distanceToSquared(p),x),S=Math.pow(p.distanceToSquared(u),x);w<1e-4&&(w=1),b<1e-4&&(b=w),S<1e-4&&(S=w),IN.initNonuniformCatmullRom(c.x,f.x,p.x,u.x,b,w,S),NN.initNonuniformCatmullRom(c.y,f.y,p.y,u.y,b,w,S),LN.initNonuniformCatmullRom(c.z,f.z,p.z,u.z,b,w,S)}else this.curveType==="catmullrom"&&(IN.initCatmullRom(c.x,f.x,p.x,u.x,this.tension),NN.initCatmullRom(c.y,f.y,p.y,u.y,this.tension),LN.initCatmullRom(c.z,f.z,p.z,u.z,this.tension));return n.set(IN.calc(l),NN.calc(l),LN.calc(l)),n}copy(e){super.copy(e),this.points=[];for(let t=0,n=e.points.length;t<n;t++){let r=e.points[t];this.points.push(r.clone())}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this}toJSON(){let e=super.toJSON();e.points=[];for(let t=0,n=this.points.length;t<n;t++){let r=this.points[t];e.points.push(r.toArray())}return e.closed=this.closed,e.curveType=this.curveType,e.tension=this.tension,e}fromJSON(e){super.fromJSON(e),this.points=[];for(let t=0,n=e.points.length;t<n;t++){let r=e.points[t];this.points.push(new ie().fromArray(r))}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this}};function SH(i,e,t,n,r){let s=(n-e)*.5,o=(r-t)*.5,a=i*i,l=i*a;return(2*t-2*n+s+o)*l+(-3*t+3*n-2*s-o)*a+s*i+t}function xce(i,e){let t=1-i;return t*t*e}function yce(i,e){return 2*(1-i)*i*e}function vce(i,e){return i*i*e}function dy(i,e,t,n){return xce(i,e)+yce(i,t)+vce(i,n)}function bce(i,e){let t=1-i;return t*t*t*e}function wce(i,e){let t=1-i;return 3*t*t*i*e}function Sce(i,e){return 3*(1-i)*i*i*e}function Tce(i,e){return i*i*i*e}function py(i,e,t,n,r){return bce(i,e)+wce(i,t)+Sce(i,n)+Tce(i,r)}var vy=class extends ha{constructor(e=new Oe,t=new Oe,n=new Oe,r=new Oe){super(),this.isCubicBezierCurve=!0,this.type="CubicBezierCurve",this.v0=e,this.v1=t,this.v2=n,this.v3=r}getPoint(e,t=new Oe){let n=t,r=this.v0,s=this.v1,o=this.v2,a=this.v3;return n.set(py(e,r.x,s.x,o.x,a.x),py(e,r.y,s.y,o.y,a.y)),n}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this.v3.copy(e.v3),this}toJSON(){let e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e.v3=this.v3.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this.v3.fromArray(e.v3),this}},g_=class extends ha{constructor(e=new ie,t=new ie,n=new ie,r=new ie){super(),this.isCubicBezierCurve3=!0,this.type="CubicBezierCurve3",this.v0=e,this.v1=t,this.v2=n,this.v3=r}getPoint(e,t=new ie){let n=t,r=this.v0,s=this.v1,o=this.v2,a=this.v3;return n.set(py(e,r.x,s.x,o.x,a.x),py(e,r.y,s.y,o.y,a.y),py(e,r.z,s.z,o.z,a.z)),n}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this.v3.copy(e.v3),this}toJSON(){let e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e.v3=this.v3.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this.v3.fromArray(e.v3),this}},by=class extends ha{constructor(e=new Oe,t=new Oe){super(),this.isLineCurve=!0,this.type="LineCurve",this.v1=e,this.v2=t}getPoint(e,t=new Oe){let n=t;return e===1?n.copy(this.v2):(n.copy(this.v2).sub(this.v1),n.multiplyScalar(e).add(this.v1)),n}getPointAt(e,t){return this.getPoint(e,t)}getTangent(e,t=new Oe){return t.subVectors(this.v2,this.v1).normalize()}getTangentAt(e,t){return this.getTangent(e,t)}copy(e){return super.copy(e),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){let e=super.toJSON();return e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}},vT=class extends ha{constructor(e=new ie,t=new ie){super(),this.isLineCurve3=!0,this.type="LineCurve3",this.v1=e,this.v2=t}getPoint(e,t=new ie){let n=t;return e===1?n.copy(this.v2):(n.copy(this.v2).sub(this.v1),n.multiplyScalar(e).add(this.v1)),n}getPointAt(e,t){return this.getPoint(e,t)}getTangent(e,t=new ie){return t.subVectors(this.v2,this.v1).normalize()}getTangentAt(e,t){return this.getTangent(e,t)}copy(e){return super.copy(e),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){let e=super.toJSON();return e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}},wy=class extends ha{constructor(e=new Oe,t=new Oe,n=new Oe){super(),this.isQuadraticBezierCurve=!0,this.type="QuadraticBezierCurve",this.v0=e,this.v1=t,this.v2=n}getPoint(e,t=new Oe){let n=t,r=this.v0,s=this.v1,o=this.v2;return n.set(dy(e,r.x,s.x,o.x),dy(e,r.y,s.y,o.y)),n}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){let e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}},Sy=class extends ha{constructor(e=new ie,t=new ie,n=new ie){super(),this.isQuadraticBezierCurve3=!0,this.type="QuadraticBezierCurve3",this.v0=e,this.v1=t,this.v2=n}getPoint(e,t=new ie){let n=t,r=this.v0,s=this.v1,o=this.v2;return n.set(dy(e,r.x,s.x,o.x),dy(e,r.y,s.y,o.y),dy(e,r.z,s.z,o.z)),n}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){let e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}},Ty=class extends ha{constructor(e=[]){super(),this.isSplineCurve=!0,this.type="SplineCurve",this.points=e}getPoint(e,t=new Oe){let n=t,r=this.points,s=(r.length-1)*e,o=Math.floor(s),a=s-o,l=r[o===0?o:o-1],c=r[o],u=r[o>r.length-2?r.length-1:o+1],f=r[o>r.length-3?r.length-1:o+2];return n.set(SH(a,l.x,c.x,u.x,f.x),SH(a,l.y,c.y,u.y,f.y)),n}copy(e){super.copy(e),this.points=[];for(let t=0,n=e.points.length;t<n;t++){let r=e.points[t];this.points.push(r.clone())}return this}toJSON(){let e=super.toJSON();e.points=[];for(let t=0,n=this.points.length;t<n;t++){let r=this.points[t];e.points.push(r.toArray())}return e}fromJSON(e){super.fromJSON(e),this.points=[];for(let t=0,n=e.points.length;t<n;t++){let r=e.points[t];this.points.push(new Oe().fromArray(r))}return this}},bT=Object.freeze({__proto__:null,ArcCurve:xT,CatmullRomCurve3:yT,CubicBezierCurve:vy,CubicBezierCurve3:g_,EllipseCurve:m_,LineCurve:by,LineCurve3:vT,QuadraticBezierCurve:wy,QuadraticBezierCurve3:Sy,SplineCurve:Ty}),wT=class extends ha{constructor(){super(),this.type="CurvePath",this.curves=[],this.autoClose=!1}add(e){this.curves.push(e)}closePath(){let e=this.curves[0].getPoint(0),t=this.curves[this.curves.length-1].getPoint(1);if(!e.equals(t)){let n=e.isVector2===!0?"LineCurve":"LineCurve3";this.curves.push(new bT[n](t,e))}return this}getPoint(e,t){let n=e*this.getLength(),r=this.getCurveLengths(),s=0;for(;s<r.length;){if(r[s]>=n){let o=r[s]-n,a=this.curves[s],l=a.getLength(),c=l===0?0:1-o/l;return a.getPointAt(c,t)}s++}return null}getLength(){let e=this.getCurveLengths();return e[e.length-1]}updateArcLengths(){this.needsUpdate=!0,this.cacheLengths=null,this.getCurveLengths()}getCurveLengths(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;let e=[],t=0;for(let n=0,r=this.curves.length;n<r;n++)t+=this.curves[n].getLength(),e.push(t);return this.cacheLengths=e,e}getSpacedPoints(e=40){let t=[];for(let n=0;n<=e;n++)t.push(this.getPoint(n/e));return this.autoClose&&t.push(t[0]),t}getPoints(e=12){let t=[],n;for(let r=0,s=this.curves;r<s.length;r++){let o=s[r],a=o.isEllipseCurve?e*2:o.isLineCurve||o.isLineCurve3?1:o.isSplineCurve?e*o.points.length:e,l=o.getPoints(a);for(let c=0;c<l.length;c++){let u=l[c];n&&n.equals(u)||(t.push(u),n=u)}}return this.autoClose&&t.length>1&&!t[t.length-1].equals(t[0])&&t.push(t[0]),t}copy(e){super.copy(e),this.curves=[];for(let t=0,n=e.curves.length;t<n;t++){let r=e.curves[t];this.curves.push(r.clone())}return this.autoClose=e.autoClose,this}toJSON(){let e=super.toJSON();e.autoClose=this.autoClose,e.curves=[];for(let t=0,n=this.curves.length;t<n;t++){let r=this.curves[t];e.curves.push(r.toJSON())}return e}fromJSON(e){super.fromJSON(e),this.autoClose=e.autoClose,this.curves=[];for(let t=0,n=e.curves.length;t<n;t++){let r=e.curves[t];this.curves.push(new bT[r.type]().fromJSON(r))}return this}},vA=class extends wT{constructor(e){super(),this.type="Path",this.currentPoint=new Oe,e&&this.setFromPoints(e)}setFromPoints(e){this.moveTo(e[0].x,e[0].y);for(let t=1,n=e.length;t<n;t++)this.lineTo(e[t].x,e[t].y);return this}moveTo(e,t){return this.currentPoint.set(e,t),this}lineTo(e,t){let n=new by(this.currentPoint.clone(),new Oe(e,t));return this.curves.push(n),this.currentPoint.set(e,t),this}quadraticCurveTo(e,t,n,r){let s=new wy(this.currentPoint.clone(),new Oe(e,t),new Oe(n,r));return this.curves.push(s),this.currentPoint.set(n,r),this}bezierCurveTo(e,t,n,r,s,o){let a=new vy(this.currentPoint.clone(),new Oe(e,t),new Oe(n,r),new Oe(s,o));return this.curves.push(a),this.currentPoint.set(s,o),this}splineThru(e){let t=[this.currentPoint.clone()].concat(e),n=new Ty(t);return this.curves.push(n),this.currentPoint.copy(e[e.length-1]),this}arc(e,t,n,r,s,o){let a=this.currentPoint.x,l=this.currentPoint.y;return this.absarc(e+a,t+l,n,r,s,o),this}absarc(e,t,n,r,s,o){return this.absellipse(e,t,n,n,r,s,o),this}ellipse(e,t,n,r,s,o,a,l){let c=this.currentPoint.x,u=this.currentPoint.y;return this.absellipse(e+c,t+u,n,r,s,o,a,l),this}absellipse(e,t,n,r,s,o,a,l){let c=new m_(e,t,n,r,s,o,a,l);if(this.curves.length>0){let f=c.getPoint(0);f.equals(this.currentPoint)||this.lineTo(f.x,f.y)}this.curves.push(c);let u=c.getPoint(1);return this.currentPoint.copy(u),this}copy(e){return super.copy(e),this.currentPoint.copy(e.currentPoint),this}toJSON(){let e=super.toJSON();return e.currentPoint=this.currentPoint.toArray(),e}fromJSON(e){return super.fromJSON(e),this.currentPoint.fromArray(e.currentPoint),this}},Ey=class extends vA{constructor(e){super(e),this.uuid=Fu(),this.type="Shape",this.holes=[]}getPointsHoles(e){let t=[];for(let n=0,r=this.holes.length;n<r;n++)t[n]=this.holes[n].getPoints(e);return t}extractPoints(e){return{shape:this.getPoints(e),holes:this.getPointsHoles(e)}}copy(e){super.copy(e),this.holes=[];for(let t=0,n=e.holes.length;t<n;t++){let r=e.holes[t];this.holes.push(r.clone())}return this}toJSON(){let e=super.toJSON();e.uuid=this.uuid,e.holes=[];for(let t=0,n=this.holes.length;t<n;t++){let r=this.holes[t];e.holes.push(r.toJSON())}return e}fromJSON(e){super.fromJSON(e),this.uuid=e.uuid,this.holes=[];for(let t=0,n=e.holes.length;t<n;t++){let r=e.holes[t];this.holes.push(new vA().fromJSON(r))}return this}};function Ece(i,e,t=2){let n=e&&e.length,r=n?e[0]*t:i.length,s=$H(i,0,r,t,!0),o=[];if(!s||s.next===s.prev)return o;let a,l,c;if(n&&(s=Ice(i,e,s,t)),i.length>80*t){a=i[0],l=i[1];let u=a,f=l;for(let p=t;p<r;p+=t){let x=i[p],b=i[p+1];x<a&&(a=x),b<l&&(l=b),x>u&&(u=x),b>f&&(f=b)}c=Math.max(u-a,f-l),c=c!==0?32767/c:0}return My(s,o,t,a,l,c,0),o}function $H(i,e,t,n,r){let s;if(r===Vce(i,e,t,n)>0)for(let o=e;o<t;o+=n)s=TH(o/n|0,i[o],i[o+1],s);else for(let o=t-n;o>=e;o-=n)s=TH(o/n|0,i[o],i[o+1],s);return s&&__(s,s.next)&&(Ry(s),s=s.next),s}function bA(i,e){if(!i)return i;e||(e=i);let t=i,n;do if(n=!1,!t.steiner&&(__(t,t.next)||Pr(t.prev,t,t.next)===0)){if(Ry(t),t=e=t.prev,t===t.next)break;n=!0}else t=t.next;while(n||t!==e);return e}function My(i,e,t,n,r,s,o){if(!i)return;!o&&s&&Oce(i,n,r,s);let a=i;for(;i.prev!==i.next;){let l=i.prev,c=i.next;if(s?Cce(i,n,r,s):Mce(i)){e.push(l.i,i.i,c.i),Ry(i),i=c.next,a=c.next;continue}if(i=c,i===a){o?o===1?(i=Rce(bA(i),e),My(i,e,t,n,r,s,2)):o===2&&Pce(i,e,t,n,r,s):My(bA(i),e,t,n,r,s,1);break}}}function Mce(i){let e=i.prev,t=i,n=i.next;if(Pr(e,t,n)>=0)return!1;let r=e.x,s=t.x,o=n.x,a=e.y,l=t.y,c=n.y,u=Math.min(r,s,o),f=Math.min(a,l,c),p=Math.max(r,s,o),x=Math.max(a,l,c),b=n.next;for(;b!==e;){if(b.x>=u&&b.x<=p&&b.y>=f&&b.y<=x&&uy(r,a,s,l,o,c,b.x,b.y)&&Pr(b.prev,b,b.next)>=0)return!1;b=b.next}return!0}function Cce(i,e,t,n){let r=i.prev,s=i,o=i.next;if(Pr(r,s,o)>=0)return!1;let a=r.x,l=s.x,c=o.x,u=r.y,f=s.y,p=o.y,x=Math.min(a,l,c),b=Math.min(u,f,p),w=Math.max(a,l,c),S=Math.max(u,f,p),T=zN(x,b,e,t,n),P=zN(w,S,e,t,n),R=i.prevZ,C=i.nextZ;for(;R&&R.z>=T&&C&&C.z<=P;){if(R.x>=x&&R.x<=w&&R.y>=b&&R.y<=S&&R!==r&&R!==o&&uy(a,u,l,f,c,p,R.x,R.y)&&Pr(R.prev,R,R.next)>=0||(R=R.prevZ,C.x>=x&&C.x<=w&&C.y>=b&&C.y<=S&&C!==r&&C!==o&&uy(a,u,l,f,c,p,C.x,C.y)&&Pr(C.prev,C,C.next)>=0))return!1;C=C.nextZ}for(;R&&R.z>=T;){if(R.x>=x&&R.x<=w&&R.y>=b&&R.y<=S&&R!==r&&R!==o&&uy(a,u,l,f,c,p,R.x,R.y)&&Pr(R.prev,R,R.next)>=0)return!1;R=R.prevZ}for(;C&&C.z<=P;){if(C.x>=x&&C.x<=w&&C.y>=b&&C.y<=S&&C!==r&&C!==o&&uy(a,u,l,f,c,p,C.x,C.y)&&Pr(C.prev,C,C.next)>=0)return!1;C=C.nextZ}return!0}function Rce(i,e){let t=i;do{let n=t.prev,r=t.next.next;!__(n,r)&&ZH(n,t,t.next,r)&&Cy(n,r)&&Cy(r,n)&&(e.push(n.i,t.i,r.i),Ry(t),Ry(t.next),t=i=r),t=t.next}while(t!==i);return bA(t)}function Pce(i,e,t,n,r,s){let o=i;do{let a=o.next.next;for(;a!==o.prev;){if(o.i!==a.i&&kce(o,a)){let l=KH(o,a);o=bA(o,o.next),l=bA(l,l.next),My(o,e,t,n,r,s,0),My(l,e,t,n,r,s,0);return}a=a.next}o=o.next}while(o!==i)}function Ice(i,e,t,n){let r=[];for(let s=0,o=e.length;s<o;s++){let a=e[s]*n,l=s<o-1?e[s+1]*n:i.length,c=$H(i,a,l,n,!1);c===c.next&&(c.steiner=!0),r.push(Uce(c))}r.sort(Nce);for(let s=0;s<r.length;s++)t=Lce(r[s],t);return t}function Nce(i,e){let t=i.x-e.x;if(t===0&&(t=i.y-e.y,t===0)){let n=(i.next.y-i.y)/(i.next.x-i.x),r=(e.next.y-e.y)/(e.next.x-e.x);t=n-r}return t}function Lce(i,e){let t=Dce(i,e);if(!t)return e;let n=KH(t,i);return bA(n,n.next),bA(t,t.next)}function Dce(i,e){let t=e,n=i.x,r=i.y,s=-1/0,o;if(__(i,t))return t;do{if(__(i,t.next))return t.next;if(r<=t.y&&r>=t.next.y&&t.next.y!==t.y){let f=t.x+(r-t.y)*(t.next.x-t.x)/(t.next.y-t.y);if(f<=n&&f>s&&(s=f,o=t.x<t.next.x?t:t.next,f===n))return o}t=t.next}while(t!==e);if(!o)return null;let a=o,l=o.x,c=o.y,u=1/0;t=o;do{if(n>=t.x&&t.x>=l&&n!==t.x&&YH(r<c?n:s,r,l,c,r<c?s:n,r,t.x,t.y)){let f=Math.abs(r-t.y)/(n-t.x);Cy(t,i)&&(f<u||f===u&&(t.x>o.x||t.x===o.x&&Fce(o,t)))&&(o=t,u=f)}t=t.next}while(t!==a);return o}function Fce(i,e){return Pr(i.prev,i,e.prev)<0&&Pr(e.next,i,i.next)<0}function Oce(i,e,t,n){let r=i;do r.z===0&&(r.z=zN(r.x,r.y,e,t,n)),r.prevZ=r.prev,r.nextZ=r.next,r=r.next;while(r!==i);r.prevZ.nextZ=null,r.prevZ=null,Bce(r)}function Bce(i){let e,t=1;do{let n=i,r;i=null;let s=null;for(e=0;n;){e++;let o=n,a=0;for(let c=0;c<t&&(a++,o=o.nextZ,!!o);c++);let l=t;for(;a>0||l>0&&o;)a!==0&&(l===0||!o||n.z<=o.z)?(r=n,n=n.nextZ,a--):(r=o,o=o.nextZ,l--),s?s.nextZ=r:i=r,r.prevZ=s,s=r;n=o}s.nextZ=null,t*=2}while(e>1);return i}function zN(i,e,t,n,r){return i=(i-t)*r|0,e=(e-n)*r|0,i=(i|i<<8)&16711935,i=(i|i<<4)&252645135,i=(i|i<<2)&858993459,i=(i|i<<1)&1431655765,e=(e|e<<8)&16711935,e=(e|e<<4)&252645135,e=(e|e<<2)&858993459,e=(e|e<<1)&1431655765,i|e<<1}function Uce(i){let e=i,t=i;do(e.x<t.x||e.x===t.x&&e.y<t.y)&&(t=e),e=e.next;while(e!==i);return t}function YH(i,e,t,n,r,s,o,a){return(r-o)*(e-a)>=(i-o)*(s-a)&&(i-o)*(n-a)>=(t-o)*(e-a)&&(t-o)*(s-a)>=(r-o)*(n-a)}function uy(i,e,t,n,r,s,o,a){return!(i===o&&e===a)&&YH(i,e,t,n,r,s,o,a)}function kce(i,e){return i.next.i!==e.i&&i.prev.i!==e.i&&!Gce(i,e)&&(Cy(i,e)&&Cy(e,i)&&zce(i,e)&&(Pr(i.prev,i,e.prev)||Pr(i,e.prev,e))||__(i,e)&&Pr(i.prev,i,i.next)>0&&Pr(e.prev,e,e.next)>0)}function Pr(i,e,t){return(e.y-i.y)*(t.x-e.x)-(e.x-i.x)*(t.y-e.y)}function __(i,e){return i.x===e.x&&i.y===e.y}function ZH(i,e,t,n){let r=aT(Pr(i,e,t)),s=aT(Pr(i,e,n)),o=aT(Pr(t,n,i)),a=aT(Pr(t,n,e));return!!(r!==s&&o!==a||r===0&&oT(i,t,e)||s===0&&oT(i,n,e)||o===0&&oT(t,i,n)||a===0&&oT(t,e,n))}function oT(i,e,t){return e.x<=Math.max(i.x,t.x)&&e.x>=Math.min(i.x,t.x)&&e.y<=Math.max(i.y,t.y)&&e.y>=Math.min(i.y,t.y)}function aT(i){return i>0?1:i<0?-1:0}function Gce(i,e){let t=i;do{if(t.i!==i.i&&t.next.i!==i.i&&t.i!==e.i&&t.next.i!==e.i&&ZH(t,t.next,i,e))return!0;t=t.next}while(t!==i);return!1}function Cy(i,e){return Pr(i.prev,i,i.next)<0?Pr(i,e,i.next)>=0&&Pr(i,i.prev,e)>=0:Pr(i,e,i.prev)<0||Pr(i,i.next,e)<0}function zce(i,e){let t=i,n=!1,r=(i.x+e.x)/2,s=(i.y+e.y)/2;do t.y>s!=t.next.y>s&&t.next.y!==t.y&&r<(t.next.x-t.x)*(s-t.y)/(t.next.y-t.y)+t.x&&(n=!n),t=t.next;while(t!==i);return n}function KH(i,e){let t=VN(i.i,i.x,i.y),n=VN(e.i,e.x,e.y),r=i.next,s=e.prev;return i.next=e,e.prev=i,t.next=r,r.prev=t,n.next=t,t.prev=n,s.next=n,n.prev=s,n}function TH(i,e,t,n){let r=VN(i,e,t);return n?(r.next=n.next,r.prev=n,n.next.prev=r,n.next=r):(r.prev=r,r.next=r),r}function Ry(i){i.next.prev=i.prev,i.prev.next=i.next,i.prevZ&&(i.prevZ.nextZ=i.nextZ),i.nextZ&&(i.nextZ.prevZ=i.prevZ)}function VN(i,e,t){return{i,x:e,y:t,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}function Vce(i,e,t,n){let r=0;for(let s=e,o=t-n;s<t;s+=n)r+=(i[o]-i[s])*(i[s+1]+i[o+1]),o=s;return r}var qN=class{static triangulate(e,t,n=2){return Ece(e,t,n)}},Bd=class i{static area(e){let t=e.length,n=0;for(let r=t-1,s=0;s<t;r=s++)n+=e[r].x*e[s].y-e[s].x*e[r].y;return n*.5}static isClockWise(e){return i.area(e)<0}static triangulateShape(e,t){let n=[],r=[],s=[];EH(e),MH(n,e);let o=e.length;t.forEach(EH);for(let l=0;l<t.length;l++)r.push(o),o+=t[l].length,MH(n,t[l]);let a=qN.triangulate(n,r);for(let l=0;l<a.length;l+=3)s.push(a.slice(l,l+3));return s}};function EH(i){let e=i.length;e>2&&i[e-1].equals(i[0])&&i.pop()}function MH(i,e){for(let t=0;t<e.length;t++)i.push(e[t].x),i.push(e[t].y)}var Py=class i extends Kn{constructor(e=new Ey([new Oe(.5,.5),new Oe(-.5,.5),new Oe(-.5,-.5),new Oe(.5,-.5)]),t={}){super(),this.type="ExtrudeGeometry",this.parameters={shapes:e,options:t},e=Array.isArray(e)?e:[e];let n=this,r=[],s=[];for(let a=0,l=e.length;a<l;a++){let c=e[a];o(c)}this.setAttribute("position",new kn(r,3)),this.setAttribute("uv",new kn(s,2)),this.computeVertexNormals();function o(a){let l=[],c=t.curveSegments!==void 0?t.curveSegments:12,u=t.steps!==void 0?t.steps:1,f=t.depth!==void 0?t.depth:1,p=t.bevelEnabled!==void 0?t.bevelEnabled:!0,x=t.bevelThickness!==void 0?t.bevelThickness:.2,b=t.bevelSize!==void 0?t.bevelSize:x-.1,w=t.bevelOffset!==void 0?t.bevelOffset:0,S=t.bevelSegments!==void 0?t.bevelSegments:3,T=t.extrudePath,P=t.UVGenerator!==void 0?t.UVGenerator:qce,R,C=!1,L,D,F,N;if(T){R=T.getSpacedPoints(u),C=!0,p=!1;let Xe=T.isCatmullRomCurve3?T.closed:!1;L=T.computeFrenetFrames(u,Xe),D=new ie,F=new ie,N=new ie}p||(S=0,x=0,b=0,w=0);let B=a.extractPoints(c),z=B.shape,V=B.holes;if(!Bd.isClockWise(z)){z=z.reverse();for(let Xe=0,st=V.length;Xe<st;Xe++){let tt=V[Xe];Bd.isClockWise(tt)&&(V[Xe]=tt.reverse())}}function Z(Xe){let tt=10000000000000001e-36,vt=Xe[0];for(let yt=1;yt<=Xe.length;yt++){let ln=yt%Xe.length,Kt=Xe[ln],Qt=Kt.x-vt.x,xn=Kt.y-vt.y,ge=Qt*Qt+xn*xn,di=Math.max(Math.abs(Kt.x),Math.abs(Kt.y),Math.abs(vt.x),Math.abs(vt.y)),On=tt*di*di;if(ge<=On){Xe.splice(ln,1),yt--;continue}vt=Kt}}Z(z),V.forEach(Z);let J=V.length,j=z;for(let Xe=0;Xe<J;Xe++){let st=V[Xe];z=z.concat(st)}function K(Xe,st,tt){return st||Ge("ExtrudeGeometry: vec does not exist"),Xe.clone().addScaledVector(st,tt)}let ee=z.length;function ae(Xe,st,tt){let vt,yt,ln,Kt=Xe.x-st.x,Qt=Xe.y-st.y,xn=tt.x-Xe.x,ge=tt.y-Xe.y,di=Kt*Kt+Qt*Qt,On=Kt*ge-Qt*xn;if(Math.abs(On)>Number.EPSILON){let le=Math.sqrt(di),X=Math.sqrt(xn*xn+ge*ge),Te=st.x-Qt/le,Pe=st.y+Kt/le,Ve=tt.x-ge/X,gt=tt.y+xn/X,St=((Ve-Te)*ge-(gt-Pe)*xn)/(Kt*ge-Qt*xn);vt=Te+Kt*St-Xe.x,yt=Pe+Qt*St-Xe.y;let qe=vt*vt+yt*yt;if(qe<=2)return new Oe(vt,yt);ln=Math.sqrt(qe/2)}else{let le=!1;Kt>Number.EPSILON?xn>Number.EPSILON&&(le=!0):Kt<-Number.EPSILON?xn<-Number.EPSILON&&(le=!0):Math.sign(Qt)===Math.sign(ge)&&(le=!0),le?(vt=-Qt,yt=Kt,ln=Math.sqrt(di)):(vt=Kt,yt=Qt,ln=Math.sqrt(di/2))}return new Oe(vt/ln,yt/ln)}let ce=[];for(let Xe=0,st=j.length,tt=st-1,vt=Xe+1;Xe<st;Xe++,tt++,vt++)tt===st&&(tt=0),vt===st&&(vt=0),ce[Xe]=ae(j[Xe],j[tt],j[vt]);let de=[],ve,Ie=ce.concat();for(let Xe=0,st=J;Xe<st;Xe++){let tt=V[Xe];ve=[];for(let vt=0,yt=tt.length,ln=yt-1,Kt=vt+1;vt<yt;vt++,ln++,Kt++)ln===yt&&(ln=0),Kt===yt&&(Kt=0),ve[vt]=ae(tt[vt],tt[ln],tt[Kt]);de.push(ve),Ie=Ie.concat(ve)}let Qe;if(S===0)Qe=Bd.triangulateShape(j,V);else{let Xe=[],st=[];for(let tt=0;tt<S;tt++){let vt=tt/S,yt=x*Math.cos(vt*Math.PI/2),ln=b*Math.sin(vt*Math.PI/2)+w;for(let Kt=0,Qt=j.length;Kt<Qt;Kt++){let xn=K(j[Kt],ce[Kt],ln);Et(xn.x,xn.y,-yt),vt===0&&Xe.push(xn)}for(let Kt=0,Qt=J;Kt<Qt;Kt++){let xn=V[Kt];ve=de[Kt];let ge=[];for(let di=0,On=xn.length;di<On;di++){let le=K(xn[di],ve[di],ln);Et(le.x,le.y,-yt),vt===0&&ge.push(le)}vt===0&&st.push(ge)}}Qe=Bd.triangulateShape(Xe,st)}let Ue=Qe.length,mt=b+w;for(let Xe=0;Xe<ee;Xe++){let st=p?K(z[Xe],Ie[Xe],mt):z[Xe];C?(F.copy(L.normals[0]).multiplyScalar(st.x),D.copy(L.binormals[0]).multiplyScalar(st.y),N.copy(R[0]).add(F).add(D),Et(N.x,N.y,N.z)):Et(st.x,st.y,0)}for(let Xe=1;Xe<=u;Xe++)for(let st=0;st<ee;st++){let tt=p?K(z[st],Ie[st],mt):z[st];C?(F.copy(L.normals[Xe]).multiplyScalar(tt.x),D.copy(L.binormals[Xe]).multiplyScalar(tt.y),N.copy(R[Xe]).add(F).add(D),Et(N.x,N.y,N.z)):Et(tt.x,tt.y,f/u*Xe)}for(let Xe=S-1;Xe>=0;Xe--){let st=Xe/S,tt=x*Math.cos(st*Math.PI/2),vt=b*Math.sin(st*Math.PI/2)+w;for(let yt=0,ln=j.length;yt<ln;yt++){let Kt=K(j[yt],ce[yt],vt);Et(Kt.x,Kt.y,f+tt)}for(let yt=0,ln=V.length;yt<ln;yt++){let Kt=V[yt];ve=de[yt];for(let Qt=0,xn=Kt.length;Qt<xn;Qt++){let ge=K(Kt[Qt],ve[Qt],vt);C?Et(ge.x,ge.y+R[u-1].y,R[u-1].x+tt):Et(ge.x,ge.y,f+tt)}}}Me(),ze();function Me(){let Xe=r.length/3;if(p){let st=0,tt=ee*st;for(let vt=0;vt<Ue;vt++){let yt=Qe[vt];Tt(yt[2]+tt,yt[1]+tt,yt[0]+tt)}st=u+S*2,tt=ee*st;for(let vt=0;vt<Ue;vt++){let yt=Qe[vt];Tt(yt[0]+tt,yt[1]+tt,yt[2]+tt)}}else{for(let st=0;st<Ue;st++){let tt=Qe[st];Tt(tt[2],tt[1],tt[0])}for(let st=0;st<Ue;st++){let tt=Qe[st];Tt(tt[0]+ee*u,tt[1]+ee*u,tt[2]+ee*u)}}n.addGroup(Xe,r.length/3-Xe,0)}function ze(){let Xe=r.length/3,st=0;$e(j,st),st+=j.length;for(let tt=0,vt=V.length;tt<vt;tt++){let yt=V[tt];$e(yt,st),st+=yt.length}n.addGroup(Xe,r.length/3-Xe,1)}function $e(Xe,st){let tt=Xe.length;for(;--tt>=0;){let vt=tt,yt=tt-1;yt<0&&(yt=Xe.length-1);for(let ln=0,Kt=u+S*2;ln<Kt;ln++){let Qt=ee*ln,xn=ee*(ln+1),ge=st+vt+Qt,di=st+yt+Qt,On=st+yt+xn,le=st+vt+xn;Ct(ge,di,On,le)}}}function Et(Xe,st,tt){l.push(Xe),l.push(st),l.push(tt)}function Tt(Xe,st,tt){un(Xe),un(st),un(tt);let vt=r.length/3,yt=P.generateTopUV(n,r,vt-3,vt-2,vt-1);Gt(yt[0]),Gt(yt[1]),Gt(yt[2])}function Ct(Xe,st,tt,vt){un(Xe),un(st),un(vt),un(st),un(tt),un(vt);let yt=r.length/3,ln=P.generateSideWallUV(n,r,yt-6,yt-3,yt-2,yt-1);Gt(ln[0]),Gt(ln[1]),Gt(ln[3]),Gt(ln[1]),Gt(ln[2]),Gt(ln[3])}function un(Xe){r.push(l[Xe*3+0]),r.push(l[Xe*3+1]),r.push(l[Xe*3+2])}function Gt(Xe){s.push(Xe.x),s.push(Xe.y)}}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}toJSON(){let e=super.toJSON(),t=this.parameters.shapes,n=this.parameters.options;return Hce(t,n,e)}static fromJSON(e,t){let n=[];for(let s=0,o=e.shapes.length;s<o;s++){let a=t[e.shapes[s]];n.push(a)}let r=e.options.extrudePath;return r!==void 0&&(e.options.extrudePath=new bT[r.type]().fromJSON(r)),new i(n,e.options)}},qce={generateTopUV:function(i,e,t,n,r){let s=e[t*3],o=e[t*3+1],a=e[n*3],l=e[n*3+1],c=e[r*3],u=e[r*3+1];return[new Oe(s,o),new Oe(a,l),new Oe(c,u)]},generateSideWallUV:function(i,e,t,n,r,s){let o=e[t*3],a=e[t*3+1],l=e[t*3+2],c=e[n*3],u=e[n*3+1],f=e[n*3+2],p=e[r*3],x=e[r*3+1],b=e[r*3+2],w=e[s*3],S=e[s*3+1],T=e[s*3+2];return Math.abs(a-u)<Math.abs(o-c)?[new Oe(o,1-l),new Oe(c,1-f),new Oe(p,1-b),new Oe(w,1-T)]:[new Oe(a,1-l),new Oe(u,1-f),new Oe(x,1-b),new Oe(S,1-T)]}};function Hce(i,e,t){if(t.shapes=[],Array.isArray(i))for(let n=0,r=i.length;n<r;n++){let s=i[n];t.shapes.push(s.uuid)}else t.shapes.push(i.uuid);return t.options=Object.assign({},e),e.extrudePath!==void 0&&(t.options.extrudePath=e.extrudePath.toJSON()),t}var wA=class i extends Kn{constructor(e=1,t=1,n=1,r=1){super(),this.type="PlaneGeometry",this.parameters={width:e,height:t,widthSegments:n,heightSegments:r};let s=e/2,o=t/2,a=Math.floor(n),l=Math.floor(r),c=a+1,u=l+1,f=e/a,p=t/l,x=[],b=[],w=[],S=[];for(let T=0;T<u;T++){let P=T*p-o;for(let R=0;R<c;R++){let C=R*f-s;b.push(C,-P,0),w.push(0,0,1),S.push(R/a),S.push(1-T/l)}}for(let T=0;T<l;T++)for(let P=0;P<a;P++){let R=P+c*T,C=P+c*(T+1),L=P+1+c*(T+1),D=P+1+c*T;x.push(R,C,D),x.push(C,L,D)}this.setIndex(x),this.setAttribute("position",new kn(b,3)),this.setAttribute("normal",new kn(w,3)),this.setAttribute("uv",new kn(S,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new i(e.width,e.height,e.widthSegments,e.heightSegments)}};var fa=class i extends Kn{constructor(e=1,t=32,n=16,r=0,s=Math.PI*2,o=0,a=Math.PI){super(),this.type="SphereGeometry",this.parameters={radius:e,widthSegments:t,heightSegments:n,phiStart:r,phiLength:s,thetaStart:o,thetaLength:a},t=Math.max(3,Math.floor(t)),n=Math.max(2,Math.floor(n));let l=Math.min(o+a,Math.PI),c=0,u=[],f=new ie,p=new ie,x=[],b=[],w=[],S=[];for(let T=0;T<=n;T++){let P=[],R=T/n,C=o+R*a,L=e*Math.cos(C),D=Math.sqrt(e*e-L*L),F=0;T===0&&o===0?F=.5/t:T===n&&l===Math.PI&&(F=-.5/t);for(let N=0;N<=t;N++){let B=N/t,z=r+B*s;f.x=-D*Math.cos(z),f.y=L,f.z=D*Math.sin(z),b.push(f.x,f.y,f.z),p.copy(f).normalize(),w.push(p.x,p.y,p.z),S.push(B+F,1-R),P.push(c++)}u.push(P)}for(let T=0;T<n;T++)for(let P=0;P<t;P++){let R=u[T][P+1],C=u[T][P],L=u[T+1][P],D=u[T+1][P+1];(T!==0||o>0)&&x.push(R,C,D),(T!==n-1||l<Math.PI)&&x.push(C,L,D)}this.setIndex(x),this.setAttribute("position",new kn(b,3)),this.setAttribute("normal",new kn(w,3)),this.setAttribute("uv",new kn(S,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new i(e.radius,e.widthSegments,e.heightSegments,e.phiStart,e.phiLength,e.thetaStart,e.thetaLength)}};var Iy=class i extends Kn{constructor(e=new Sy(new ie(-1,-1,0),new ie(-1,1,0),new ie(1,1,0)),t=64,n=1,r=8,s=!1){super(),this.type="TubeGeometry",this.parameters={path:e,tubularSegments:t,radius:n,radialSegments:r,closed:s};let o=e.computeFrenetFrames(t,s);this.tangents=o.tangents,this.normals=o.normals,this.binormals=o.binormals;let a=new ie,l=new ie,c=new Oe,u=new ie,f=[],p=[],x=[],b=[];w(),this.setIndex(b),this.setAttribute("position",new kn(f,3)),this.setAttribute("normal",new kn(p,3)),this.setAttribute("uv",new kn(x,2));function w(){for(let R=0;R<t;R++)S(R);S(s===!1?t:0),P(),T()}function S(R){u=e.getPointAt(R/t,u);let C=o.normals[R],L=o.binormals[R];for(let D=0;D<=r;D++){let F=D/r*Math.PI*2,N=Math.sin(F),B=-Math.cos(F);l.x=B*C.x+N*L.x,l.y=B*C.y+N*L.y,l.z=B*C.z+N*L.z,l.normalize(),p.push(l.x,l.y,l.z),a.x=u.x+n*l.x,a.y=u.y+n*l.y,a.z=u.z+n*l.z,f.push(a.x,a.y,a.z)}}function T(){for(let R=1;R<=t;R++)for(let C=1;C<=r;C++){let L=(r+1)*(R-1)+(C-1),D=(r+1)*R+(C-1),F=(r+1)*R+C,N=(r+1)*(R-1)+C;b.push(L,D,N),b.push(D,F,N)}}function P(){for(let R=0;R<=t;R++)for(let C=0;C<=r;C++)c.x=R/t,c.y=C/r,x.push(c.x,c.y)}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}toJSON(){let e=super.toJSON();return e.path=this.parameters.path.toJSON(),e}static fromJSON(e){return new i(new bT[e.path.type]().fromJSON(e.path),e.tubularSegments,e.radius,e.radialSegments,e.closed)}},Ny=class extends Kn{constructor(e=null){if(super(),this.type="WireframeGeometry",this.parameters={geometry:e},e!==null){let t=[],n=new Set,r=new ie,s=new ie;if(e.index!==null){let o=e.attributes.position,a=e.index,l=e.groups;l.length===0&&(l=[{start:0,count:a.count,materialIndex:0}]);for(let c=0,u=l.length;c<u;++c){let f=l[c],p=f.start,x=f.count;for(let b=p,w=p+x;b<w;b+=3)for(let S=0;S<3;S++){let T=a.getX(b+S),P=a.getX(b+(S+1)%3);r.fromBufferAttribute(o,T),s.fromBufferAttribute(o,P),CH(r,s,n)===!0&&(t.push(r.x,r.y,r.z),t.push(s.x,s.y,s.z))}}}else{let o=e.attributes.position;for(let a=0,l=o.count/3;a<l;a++)for(let c=0;c<3;c++){let u=3*a+c,f=3*a+(c+1)%3;r.fromBufferAttribute(o,u),s.fromBufferAttribute(o,f),CH(r,s,n)===!0&&(t.push(r.x,r.y,r.z),t.push(s.x,s.y,s.z))}}this.setAttribute("position",new kn(t,3))}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}};function CH(i,e,t){let n=`${i.x},${i.y},${i.z}-${e.x},${e.y},${e.z}`,r=`${e.x},${e.y},${e.z}-${i.x},${i.y},${i.z}`;return t.has(n)===!0||t.has(r)===!0?!1:(t.add(n),t.add(r),!0)}var Ly=class extends bs{constructor(e){super(),this.isShadowMaterial=!0,this.type="ShadowMaterial",this.color=new Ut(0),this.transparent=!0,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.fog=e.fog,this}};function GA(i){let e={};for(let t in i){e[t]={};for(let n in i[t]){let r=i[t][n];if(RH(r))r.isRenderTargetTexture?(je("UniformsUtils: Textures of render targets cannot be cloned via cloneUniforms() or mergeUniforms()."),e[t][n]=null):e[t][n]=r.clone();else if(Array.isArray(r))if(RH(r[0])){let s=[];for(let o=0,a=r.length;o<a;o++)s[o]=r[o].clone();e[t][n]=s}else e[t][n]=r.slice();else e[t][n]=r}}return e}function zo(i){let e={};for(let t=0;t<i.length;t++){let n=GA(i[t]);for(let r in n)e[r]=n[r]}return e}function RH(i){return i&&(i.isColor||i.isMatrix3||i.isMatrix4||i.isVector2||i.isVector3||i.isVector4||i.isTexture||i.isQuaternion)}function Wce(i){let e=[];for(let t=0;t<i.length;t++)e.push(i[t].clone());return e}function xL(i){let e=i.getRenderTarget();return e===null?i.outputColorSpace:e.isXRRenderTarget===!0?e.texture.colorSpace:sn.workingColorSpace}var zA={clone:GA,merge:zo},jce=`void main() {10+ gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );11+}`,Xce=`void main() {12+ gl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );13+}`,jr=class extends bs{constructor(e){super(),this.isShaderMaterial=!0,this.type="ShaderMaterial",this.defines={},this.uniforms={},this.uniformsGroups=[],this.vertexShader=jce,this.fragmentShader=Xce,this.linewidth=1,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.clipping=!1,this.forceSinglePass=!0,this.extensions={clipCullDistance:!1,multiDraw:!1},this.defaultAttributeValues={color:[1,1,1],uv:[0,0],uv1:[0,0]},this.index0AttributeName=void 0,this.uniformsNeedUpdate=!1,this.glslVersion=null,e!==void 0&&this.setValues(e)}copy(e){return super.copy(e),this.fragmentShader=e.fragmentShader,this.vertexShader=e.vertexShader,this.uniforms=GA(e.uniforms),this.uniformsGroups=Wce(e.uniformsGroups),this.defines=Object.assign({},e.defines),this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.fog=e.fog,this.lights=e.lights,this.clipping=e.clipping,this.extensions=Object.assign({},e.extensions),this.glslVersion=e.glslVersion,this.defaultAttributeValues=Object.assign({},e.defaultAttributeValues),this.index0AttributeName=e.index0AttributeName,this.uniformsNeedUpdate=e.uniformsNeedUpdate,this}toJSON(e){let t=super.toJSON(e);t.glslVersion=this.glslVersion,t.uniforms={};for(let r in this.uniforms){let o=this.uniforms[r].value;o&&o.isTexture?t.uniforms[r]={type:"t",value:o.toJSON(e).uuid}:o&&o.isColor?t.uniforms[r]={type:"c",value:o.getHex()}:o&&o.isVector2?t.uniforms[r]={type:"v2",value:o.toArray()}:o&&o.isVector3?t.uniforms[r]={type:"v3",value:o.toArray()}:o&&o.isVector4?t.uniforms[r]={type:"v4",value:o.toArray()}:o&&o.isMatrix3?t.uniforms[r]={type:"m3",value:o.toArray()}:o&&o.isMatrix4?t.uniforms[r]={type:"m4",value:o.toArray()}:t.uniforms[r]={value:o}}Object.keys(this.defines).length>0&&(t.defines=this.defines),t.vertexShader=this.vertexShader,t.fragmentShader=this.fragmentShader,t.lights=this.lights,t.clipping=this.clipping;let n={};for(let r in this.extensions)this.extensions[r]===!0&&(n[r]=!0);return Object.keys(n).length>0&&(t.extensions=n),t}fromJSON(e,t){if(super.fromJSON(e,t),e.uniforms!==void 0)for(let n in e.uniforms){let r=e.uniforms[n];switch(this.uniforms[n]={},r.type){case"t":this.uniforms[n].value=t[r.value]||null;break;case"c":this.uniforms[n].value=new Ut().setHex(r.value);break;case"v2":this.uniforms[n].value=new Oe().fromArray(r.value);break;case"v3":this.uniforms[n].value=new ie().fromArray(r.value);break;case"v4":this.uniforms[n].value=new gn().fromArray(r.value);break;case"m3":this.uniforms[n].value=new Sn().fromArray(r.value);break;case"m4":this.uniforms[n].value=new on().fromArray(r.value);break;default:this.uniforms[n].value=r.value}}if(e.defines!==void 0&&(this.defines=e.defines),e.vertexShader!==void 0&&(this.vertexShader=e.vertexShader),e.fragmentShader!==void 0&&(this.fragmentShader=e.fragmentShader),e.glslVersion!==void 0&&(this.glslVersion=e.glslVersion),e.extensions!==void 0)for(let n in e.extensions)this.extensions[n]=e.extensions[n];return e.lights!==void 0&&(this.lights=e.lights),e.clipping!==void 0&&(this.clipping=e.clipping),this}},ST=class extends jr{constructor(e){super(e),this.isRawShaderMaterial=!0,this.type="RawShaderMaterial"}},x_=class extends bs{constructor(e){super(),this.isMeshStandardMaterial=!0,this.type="MeshStandardMaterial",this.defines={STANDARD:""},this.color=new Ut(16777215),this.roughness=1,this.metalness=0,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Ut(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=_l,this.normalScale=new Oe(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.roughnessMap=null,this.metalnessMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new ca,this.envMapIntensity=1,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.defines={STANDARD:""},this.color.copy(e.color),this.roughness=e.roughness,this.metalness=e.metalness,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.roughnessMap=e.roughnessMap,this.metalnessMap=e.metalnessMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.envMapIntensity=e.envMapIntensity,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}},Dy=class extends x_{constructor(e){super(),this.isMeshPhysicalMaterial=!0,this.defines={STANDARD:"",PHYSICAL:""},this.type="MeshPhysicalMaterial",this.anisotropyRotation=0,this.anisotropyMap=null,this.clearcoatMap=null,this.clearcoatRoughness=0,this.clearcoatRoughnessMap=null,this.clearcoatNormalScale=new Oe(1,1),this.clearcoatNormalMap=null,this.ior=1.5,Object.defineProperty(this,"reflectivity",{get:function(){return Pn(2.5*(this.ior-1)/(this.ior+1),0,1)},set:function(t){this.ior=(1+.4*t)/(1-.4*t)}}),this.iridescenceMap=null,this.iridescenceIOR=1.3,this.iridescenceThicknessRange=[100,400],this.iridescenceThicknessMap=null,this.sheenColor=new Ut(0),this.sheenColorMap=null,this.sheenRoughness=1,this.sheenRoughnessMap=null,this.transmissionMap=null,this.thickness=0,this.thicknessMap=null,this.attenuationDistance=1/0,this.attenuationColor=new Ut(1,1,1),this.specularIntensity=1,this.specularIntensityMap=null,this.specularColor=new Ut(1,1,1),this.specularColorMap=null,this._anisotropy=0,this._clearcoat=0,this._dispersion=0,this._iridescence=0,this._sheen=0,this._transmission=0,this.setValues(e)}get anisotropy(){return this._anisotropy}set anisotropy(e){this._anisotropy>0!=e>0&&this.version++,this._anisotropy=e}get clearcoat(){return this._clearcoat}set clearcoat(e){this._clearcoat>0!=e>0&&this.version++,this._clearcoat=e}get iridescence(){return this._iridescence}set iridescence(e){this._iridescence>0!=e>0&&this.version++,this._iridescence=e}get dispersion(){return this._dispersion}set dispersion(e){this._dispersion>0!=e>0&&this.version++,this._dispersion=e}get sheen(){return this._sheen}set sheen(e){this._sheen>0!=e>0&&this.version++,this._sheen=e}get transmission(){return this._transmission}set transmission(e){this._transmission>0!=e>0&&this.version++,this._transmission=e}copy(e){return super.copy(e),this.defines={STANDARD:"",PHYSICAL:""},this.anisotropy=e.anisotropy,this.anisotropyRotation=e.anisotropyRotation,this.anisotropyMap=e.anisotropyMap,this.clearcoat=e.clearcoat,this.clearcoatMap=e.clearcoatMap,this.clearcoatRoughness=e.clearcoatRoughness,this.clearcoatRoughnessMap=e.clearcoatRoughnessMap,this.clearcoatNormalMap=e.clearcoatNormalMap,this.clearcoatNormalScale.copy(e.clearcoatNormalScale),this.dispersion=e.dispersion,this.ior=e.ior,this.iridescence=e.iridescence,this.iridescenceMap=e.iridescenceMap,this.iridescenceIOR=e.iridescenceIOR,this.iridescenceThicknessRange=[...e.iridescenceThicknessRange],this.iridescenceThicknessMap=e.iridescenceThicknessMap,this.sheen=e.sheen,this.sheenColor.copy(e.sheenColor),this.sheenColorMap=e.sheenColorMap,this.sheenRoughness=e.sheenRoughness,this.sheenRoughnessMap=e.sheenRoughnessMap,this.transmission=e.transmission,this.transmissionMap=e.transmissionMap,this.thickness=e.thickness,this.thicknessMap=e.thicknessMap,this.attenuationDistance=e.attenuationDistance,this.attenuationColor.copy(e.attenuationColor),this.specularIntensity=e.specularIntensity,this.specularIntensityMap=e.specularIntensityMap,this.specularColor.copy(e.specularColor),this.specularColorMap=e.specularColorMap,this}},SA=class extends bs{constructor(e){super(),this.isMeshPhongMaterial=!0,this.type="MeshPhongMaterial",this.color=new Ut(16777215),this.specular=new Ut(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Ut(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=_l,this.normalScale=new Oe(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new ca,this.combine=RA,this.reflectivity=1,this.envMapIntensity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.specular.copy(e.specular),this.shininess=e.shininess,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.envMapIntensity=e.envMapIntensity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}},Fy=class extends bs{constructor(e){super(),this.isMeshToonMaterial=!0,this.defines={TOON:""},this.type="MeshToonMaterial",this.color=new Ut(16777215),this.map=null,this.gradientMap=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Ut(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=_l,this.normalScale=new Oe(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.gradientMap=e.gradientMap,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.alphaMap=e.alphaMap,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.fog=e.fog,this}},Oy=class extends bs{constructor(e){super(),this.isMeshNormalMaterial=!0,this.type="MeshNormalMaterial",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=_l,this.normalScale=new Oe(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.flatShading=!1,this.setValues(e)}copy(e){return super.copy(e),this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.flatShading=e.flatShading,this}},da=class extends bs{constructor(e){super(),this.isMeshLambertMaterial=!0,this.type="MeshLambertMaterial",this.color=new Ut(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Ut(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=_l,this.normalScale=new Oe(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new ca,this.combine=RA,this.reflectivity=1,this.envMapIntensity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.envMapIntensity=e.envMapIntensity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}},TT=class extends bs{constructor(e){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=qH,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.setValues(e)}copy(e){return super.copy(e),this.depthPacking=e.depthPacking,this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this}},ET=class extends bs{constructor(e){super(),this.isMeshDistanceMaterial=!0,this.type="MeshDistanceMaterial",this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.setValues(e)}copy(e){return super.copy(e),this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this}},By=class extends bs{constructor(e){super(),this.isMeshMatcapMaterial=!0,this.defines={MATCAP:""},this.type="MeshMatcapMaterial",this.color=new Ut(16777215),this.matcap=null,this.map=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=_l,this.normalScale=new Oe(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.wireframe=!1,this.wireframeLinewidth=1,this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.defines={MATCAP:""},this.color.copy(e.color),this.matcap=e.matcap,this.map=e.map,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.alphaMap=e.alphaMap,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.flatShading=e.flatShading,this.fog=e.fog,this}},Uy=class extends kc{constructor(e){super(),this.isLineDashedMaterial=!0,this.type="LineDashedMaterial",this.scale=1,this.dashSize=3,this.gapSize=1,this.setValues(e)}copy(e){return super.copy(e),this.scale=e.scale,this.dashSize=e.dashSize,this.gapSize=e.gapSize,this}};function lT(i,e){return!i||i.constructor===e?i:typeof e.BYTES_PER_ELEMENT=="number"?new e(i):Array.prototype.slice.call(i)}var $d=class{constructor(e,t,n,r){this.parameterPositions=e,this._cachedIndex=0,this.resultBuffer=r!==void 0?r:new t.constructor(n),this.sampleValues=t,this.valueSize=n,this.settings=null,this.DefaultSettings_={}}evaluate(e){let t=this.parameterPositions,n=this._cachedIndex,r=t[n],s=t[n-1];e:{t:{let o;n:{i:if(!(e<r)){for(let a=n+2;;){if(r===void 0){if(e<s)break i;return n=t.length,this._cachedIndex=n,this.copySampleValue_(n-1)}if(n===a)break;if(s=r,r=t[++n],e<r)break t}o=t.length;break n}if(!(e>=s)){let a=t[1];e<a&&(n=2,s=a);for(let l=n-2;;){if(s===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(n===l)break;if(r=s,s=t[--n-1],e>=s)break t}o=n,n=0;break n}break e}for(;n<o;){let a=n+o>>>1;e<t[a]?o=a:n=a+1}if(r=t[n],s=t[n-1],s===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(r===void 0)return n=t.length,this._cachedIndex=n,this.copySampleValue_(n-1)}this._cachedIndex=n,this.intervalChanged_(n,s,r)}return this.interpolate_(n,s,e,r)}getSettings_(){return this.settings||this.DefaultSettings_}copySampleValue_(e){let t=this.resultBuffer,n=this.sampleValues,r=this.valueSize,s=e*r;for(let o=0;o!==r;++o)t[o]=n[s+o];return t}interpolate_(){throw new Error("THREE.Interpolant: Call to abstract method.")}intervalChanged_(){}},MT=class extends $d{constructor(e,t,n,r){super(e,t,n,r),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0,this.DefaultSettings_={endingStart:BN,endingEnd:BN}}intervalChanged_(e,t,n){let r=this.parameterPositions,s=e-2,o=e+1,a=r[s],l=r[o];if(a===void 0)switch(this.getSettings_().endingStart){case UN:s=e,a=2*t-n;break;case kN:s=r.length-2,a=t+r[s]-r[s+1];break;default:s=e,a=n}if(l===void 0)switch(this.getSettings_().endingEnd){case UN:o=e,l=2*n-t;break;case kN:o=1,l=n+r[1]-r[0];break;default:o=e-1,l=t}let c=(n-t)*.5,u=this.valueSize;this._weightPrev=c/(t-a),this._weightNext=c/(l-n),this._offsetPrev=s*u,this._offsetNext=o*u}interpolate_(e,t,n,r){let s=this.resultBuffer,o=this.sampleValues,a=this.valueSize,l=e*a,c=l-a,u=this._offsetPrev,f=this._offsetNext,p=this._weightPrev,x=this._weightNext,b=(n-t)/(r-t),w=b*b,S=w*b,T=-p*S+2*p*w-p*b,P=(1+p)*S+(-1.5-2*p)*w+(-.5+p)*b+1,R=(-1-x)*S+(1.5+x)*w+.5*b,C=x*S-x*w;for(let L=0;L!==a;++L)s[L]=T*o[u+L]+P*o[c+L]+R*o[l+L]+C*o[f+L];return s}},CT=class extends $d{constructor(e,t,n,r){super(e,t,n,r)}interpolate_(e,t,n,r){let s=this.resultBuffer,o=this.sampleValues,a=this.valueSize,l=e*a,c=l-a,u=(n-t)/(r-t),f=1-u;for(let p=0;p!==a;++p)s[p]=o[c+p]*f+o[l+p]*u;return s}},RT=class extends $d{constructor(e,t,n,r){super(e,t,n,r)}interpolate_(e){return this.copySampleValue_(e-1)}},PT=class extends $d{interpolate_(e,t,n,r){let s=this.resultBuffer,o=this.sampleValues,a=this.valueSize,l=e*a,c=l-a,u=this.inTangents,f=this.outTangents;if(!u||!f){let b=(n-t)/(r-t),w=1-b;for(let S=0;S!==a;++S)s[S]=o[c+S]*w+o[l+S]*b;return s}let p=a*2,x=e-1;for(let b=0;b!==a;++b){let w=o[c+b],S=o[l+b],T=x*p+b*2,P=f[T],R=f[T+1],C=e*p+b*2,L=u[C],D=u[C+1],F=(n-t)/(r-t),N,B,z,V,H;for(let Z=0;Z<8;Z++){N=F*F,B=N*F,z=1-F,V=z*z,H=V*z;let j=H*t+3*V*F*P+3*z*N*L+B*r-n;if(Math.abs(j)<1e-10)break;let K=3*V*(P-t)+6*z*F*(L-P)+3*N*(r-L);if(Math.abs(K)<1e-10)break;F=F-j/K,F=Math.max(0,Math.min(1,F))}s[b]=H*w+3*V*F*R+3*z*N*D+B*S}return s}},ml=class{constructor(e,t,n,r){if(e===void 0)throw new Error("THREE.KeyframeTrack: track name is undefined");if(t===void 0||t.length===0)throw new Error("THREE.KeyframeTrack: no keyframes in track named "+e);this.name=e,this.times=lT(t,this.TimeBufferType),this.values=lT(n,this.ValueBufferType),this.setInterpolation(r||this.DefaultInterpolation)}static toJSON(e){let t=e.constructor,n;if(t.toJSON!==this.toJSON)n=t.toJSON(e);else{n={name:e.name,times:lT(e.times,Array),values:lT(e.values,Array)};let r=e.getInterpolation();r!==e.DefaultInterpolation&&(n.interpolation=r)}return n.type=e.ValueTypeName,n}InterpolantFactoryMethodDiscrete(e){return new RT(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodLinear(e){return new CT(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodSmooth(e){return new MT(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodBezier(e){let t=new PT(this.times,this.values,this.getValueSize(),e);return this.settings&&(t.inTangents=this.settings.inTangents,t.outTangents=this.settings.outTangents),t}setInterpolation(e){let t;switch(e){case Ay:t=this.InterpolantFactoryMethodDiscrete;break;case pT:t=this.InterpolantFactoryMethodLinear;break;case fT:t=this.InterpolantFactoryMethodSmooth;break;case ON:t=this.InterpolantFactoryMethodBezier;break}if(t===void 0){let n="unsupported interpolation for "+this.ValueTypeName+" keyframe track named "+this.name;if(this.createInterpolant===void 0)if(e!==this.DefaultInterpolation)this.setInterpolation(this.DefaultInterpolation);else throw new Error(n);return je("KeyframeTrack:",n),this}return this.createInterpolant=t,this}getInterpolation(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return Ay;case this.InterpolantFactoryMethodLinear:return pT;case this.InterpolantFactoryMethodSmooth:return fT;case this.InterpolantFactoryMethodBezier:return ON}}getValueSize(){return this.values.length/this.times.length}shift(e){if(e!==0){let t=this.times;for(let n=0,r=t.length;n!==r;++n)t[n]+=e}return this}scale(e){if(e!==1){let t=this.times;for(let n=0,r=t.length;n!==r;++n)t[n]*=e}return this}trim(e,t){let n=this.times,r=n.length,s=0,o=r-1;for(;s!==r&&n[s]<e;)++s;for(;o!==-1&&n[o]>t;)--o;if(++o,s!==0||o!==r){s>=o&&(o=Math.max(o,1),s=o-1);let a=this.getValueSize();this.times=n.slice(s,o),this.values=this.values.slice(s*a,o*a)}return this}validate(){let e=!0,t=this.getValueSize();t-Math.floor(t)!==0&&(Ge("KeyframeTrack: Invalid value size in track.",this),e=!1);let n=this.times,r=this.values,s=n.length;s===0&&(Ge("KeyframeTrack: Track is empty.",this),e=!1);let o=null;for(let a=0;a!==s;a++){let l=n[a];if(typeof l=="number"&&isNaN(l)){Ge("KeyframeTrack: Time is not a valid number.",this,a,l),e=!1;break}if(o!==null&&o>l){Ge("KeyframeTrack: Out of order keys.",this,a,l,o),e=!1;break}o=l}if(r!==void 0&&E_(r))for(let a=0,l=r.length;a!==l;++a){let c=r[a];if(isNaN(c)){Ge("KeyframeTrack: Value is not a valid number.",this,a,c),e=!1;break}}return e}optimize(){let e=this.times.slice(),t=this.values.slice(),n=this.getValueSize(),r=this.getInterpolation()===fT,s=e.length-1,o=1;for(let a=1;a<s;++a){let l=!1,c=e[a],u=e[a+1];if(c!==u&&(a!==1||c!==e[0]))if(r)l=!0;else{let f=a*n,p=f-n,x=f+n;for(let b=0;b!==n;++b){let w=t[f+b];if(w!==t[p+b]||w!==t[x+b]){l=!0;break}}}if(l){if(a!==o){e[o]=e[a];let f=a*n,p=o*n;for(let x=0;x!==n;++x)t[p+x]=t[f+x]}++o}}if(s>0){e[o]=e[s];for(let a=s*n,l=o*n,c=0;c!==n;++c)t[l+c]=t[a+c];++o}return o!==e.length?(this.times=e.slice(0,o),this.values=t.slice(0,o*n)):(this.times=e,this.values=t),this}clone(){let e=this.times.slice(),t=this.values.slice(),n=this.constructor,r=new n(this.name,e,t);return r.createInterpolant=this.createInterpolant,r}};ml.prototype.ValueTypeName="";ml.prototype.TimeBufferType=Float32Array;ml.prototype.ValueBufferType=Float32Array;ml.prototype.DefaultInterpolation=pT;var Yd=class extends ml{constructor(e,t,n){super(e,t,n)}};Yd.prototype.ValueTypeName="bool";Yd.prototype.ValueBufferType=Array;Yd.prototype.DefaultInterpolation=Ay;Yd.prototype.InterpolantFactoryMethodLinear=void 0;Yd.prototype.InterpolantFactoryMethodSmooth=void 0;var IT=class extends ml{constructor(e,t,n,r){super(e,t,n,r)}};IT.prototype.ValueTypeName="color";var NT=class extends ml{constructor(e,t,n,r){super(e,t,n,r)}};NT.prototype.ValueTypeName="number";var LT=class extends $d{constructor(e,t,n,r){super(e,t,n,r)}interpolate_(e,t,n,r){let s=this.resultBuffer,o=this.sampleValues,a=this.valueSize,l=(n-t)/(r-t),c=e*a;for(let u=c+a;c!==u;c+=4)ys.slerpFlat(s,0,o,c-a,o,c,l);return s}},ky=class extends ml{constructor(e,t,n,r){super(e,t,n,r)}InterpolantFactoryMethodLinear(e){return new LT(this.times,this.values,this.getValueSize(),e)}};ky.prototype.ValueTypeName="quaternion";ky.prototype.InterpolantFactoryMethodSmooth=void 0;var Zd=class extends ml{constructor(e,t,n){super(e,t,n)}};Zd.prototype.ValueTypeName="string";Zd.prototype.ValueBufferType=Array;Zd.prototype.DefaultInterpolation=Ay;Zd.prototype.InterpolantFactoryMethodLinear=void 0;Zd.prototype.InterpolantFactoryMethodSmooth=void 0;var DT=class extends ml{constructor(e,t,n,r){super(e,t,n,r)}};DT.prototype.ValueTypeName="vector";var dT={enabled:!1,files:{},add:function(i,e){this.enabled!==!1&&(PH(i)||(this.files[i]=e))},get:function(i){if(this.enabled!==!1&&!PH(i))return this.files[i]},remove:function(i){delete this.files[i]},clear:function(){this.files={}}};function PH(i){try{let e=i.slice(i.indexOf(":")+1);return new URL(e).protocol==="blob:"}catch{return!1}}var FT=class{constructor(e,t,n){let r=this,s=!1,o=0,a=0,l,c=[];this.onStart=void 0,this.onLoad=e,this.onProgress=t,this.onError=n,this._abortController=null,this.itemStart=function(u){a++,s===!1&&r.onStart!==void 0&&r.onStart(u,o,a),s=!0},this.itemEnd=function(u){o++,r.onProgress!==void 0&&r.onProgress(u,o,a),o===a&&(s=!1,r.onLoad!==void 0&&r.onLoad())},this.itemError=function(u){r.onError!==void 0&&r.onError(u)},this.resolveURL=function(u){return u=u.normalize("NFC"),l?l(u):u},this.setURLModifier=function(u){return l=u,this},this.addHandler=function(u,f){return c.push(u,f),this},this.removeHandler=function(u){let f=c.indexOf(u);return f!==-1&&c.splice(f,2),this},this.getHandler=function(u){for(let f=0,p=c.length;f<p;f+=2){let x=c[f],b=c[f+1];if(x.global&&(x.lastIndex=0),x.test(u))return b}return null},this.abort=function(){return this.abortController.abort(),this._abortController=null,this}}get abortController(){return this._abortController||(this._abortController=new AbortController),this._abortController}},QH=new FT,Kd=class{constructor(e){this.manager=e!==void 0?e:QH,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={},typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}load(){}loadAsync(e,t){let n=this;return new Promise(function(r,s){n.load(e,r,t,s)})}parse(){}setCrossOrigin(e){return this.crossOrigin=e,this}setWithCredentials(e){return this.withCredentials=e,this}setPath(e){return this.path=e,this}setResourcePath(e){return this.resourcePath=e,this}setRequestHeader(e){return this.requestHeader=e,this}abort(){return this}};Kd.DEFAULT_MATERIAL_NAME="__DEFAULT";var n_=new WeakMap,OT=class extends Kd{constructor(e){super(e)}load(e,t,n,r){this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);let s=this,o=dT.get(`image:${e}`);if(o!==void 0){if(o.complete===!0)s.manager.itemStart(e),setTimeout(function(){t&&t(o),s.manager.itemEnd(e)},0);else{let f=n_.get(o);f===void 0&&(f=[],n_.set(o,f)),f.push({onLoad:t,onError:r})}return o}let a=l_("img");function l(){u(),t&&t(this);let f=n_.get(this)||[];for(let p=0;p<f.length;p++){let x=f[p];x.onLoad&&x.onLoad(this)}n_.delete(this),s.manager.itemEnd(e)}function c(f){u(),r&&r(f),dT.remove(`image:${e}`);let p=n_.get(this)||[];for(let x=0;x<p.length;x++){let b=p[x];b.onError&&b.onError(f)}n_.delete(this),s.manager.itemError(e),s.manager.itemEnd(e)}function u(){a.removeEventListener("load",l,!1),a.removeEventListener("error",c,!1)}return a.addEventListener("load",l,!1),a.addEventListener("error",c,!1),e.slice(0,5)!=="data:"&&this.crossOrigin!==void 0&&(a.crossOrigin=this.crossOrigin),dT.add(`image:${e}`,a),s.manager.itemStart(e),a.src=e,a}};var zc=class extends Kd{constructor(e){super(e)}load(e,t,n,r){let s=new vs,o=new OT(this.manager);return o.setCrossOrigin(this.crossOrigin),o.setPath(this.path),o.load(e,function(a){s.image=a,s.needsUpdate=!0,t!==void 0&&t(s)},n,r),s}},Uu=class extends $i{constructor(e,t=1){super(),this.isLight=!0,this.type="Light",this.color=new Ut(e),this.intensity=t}dispose(){this.dispatchEvent({type:"dispose"})}copy(e,t){return super.copy(e,t),this.color.copy(e.color),this.intensity=e.intensity,this}toJSON(e){let t=super.toJSON(e);return t.object.color=this.color.getHex(),t.object.intensity=this.intensity,t}},Gy=class extends Uu{constructor(e,t,n){super(e,n),this.isHemisphereLight=!0,this.type="HemisphereLight",this.position.copy($i.DEFAULT_UP),this.updateMatrix(),this.groundColor=new Ut(t)}copy(e,t){return super.copy(e,t),this.groundColor.copy(e.groundColor),this}toJSON(e){let t=super.toJSON(e);return t.object.groundColor=this.groundColor.getHex(),t}},DN=new on,IH=new ie,NH=new ie,zy=class{constructor(e){this.camera=e,this.intensity=1,this.bias=0,this.biasNode=null,this.normalBias=0,this.radius=1,this.blurSamples=8,this.mapSize=new Oe(512,512),this.mapType=Gi,this.map=null,this.mapPass=null,this.matrix=new on,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new Yl,this._frameExtents=new Oe(1,1),this._viewportCount=1,this._viewports=[new gn(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(e){let t=this.camera,n=this.matrix;IH.setFromMatrixPosition(e.matrixWorld),t.position.copy(IH),NH.setFromMatrixPosition(e.target.matrixWorld),t.lookAt(NH),t.updateMatrixWorld(),DN.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),this._frustum.setFromProjectionMatrix(DN,t.coordinateSystem,t.reversedDepth),t.coordinateSystem===Va||t.reversedDepth?n.set(.5,0,0,.5,0,.5,0,.5,0,0,1,0,0,0,0,1):n.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),n.multiply(DN)}getViewport(e){return this._viewports[e]}getFrameExtents(){return this._frameExtents}dispose(){this.map&&this.map.dispose(),this.mapPass&&this.mapPass.dispose()}copy(e){return this.camera=e.camera.clone(),this.intensity=e.intensity,this.bias=e.bias,this.radius=e.radius,this.autoUpdate=e.autoUpdate,this.needsUpdate=e.needsUpdate,this.normalBias=e.normalBias,this.blurSamples=e.blurSamples,this.mapSize.copy(e.mapSize),this.biasNode=e.biasNode,this}clone(){return new this.constructor().copy(this)}toJSON(){let e={};return this.intensity!==1&&(e.intensity=this.intensity),this.bias!==0&&(e.bias=this.bias),this.normalBias!==0&&(e.normalBias=this.normalBias),this.radius!==1&&(e.radius=this.radius),(this.mapSize.x!==512||this.mapSize.y!==512)&&(e.mapSize=this.mapSize.toArray()),e.camera=this.camera.toJSON(!1).object,delete e.camera.matrix,e}},cT=new ie,uT=new ys,Du=new ie,Rf=class extends $i{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new on,this.projectionMatrix=new on,this.projectionMatrixInverse=new on,this.coordinateSystem=fo,this._reversedDepth=!1}get reversedDepth(){return this._reversedDepth}copy(e,t){return super.copy(e,t),this.matrixWorldInverse.copy(e.matrixWorldInverse),this.projectionMatrix.copy(e.projectionMatrix),this.projectionMatrixInverse.copy(e.projectionMatrixInverse),this.coordinateSystem=e.coordinateSystem,this}getWorldDirection(e){return super.getWorldDirection(e).negate()}updateMatrixWorld(e){super.updateMatrixWorld(e),this.matrixWorld.decompose(cT,uT,Du),Du.x===1&&Du.y===1&&Du.z===1?this.matrixWorldInverse.copy(this.matrixWorld).invert():this.matrixWorldInverse.compose(cT,uT,Du.set(1,1,1)).invert()}updateWorldMatrix(e,t,n=!1){super.updateWorldMatrix(e,t,n),this.matrixWorld.decompose(cT,uT,Du),Du.x===1&&Du.y===1&&Du.z===1?this.matrixWorldInverse.copy(this.matrixWorld).invert():this.matrixWorldInverse.compose(cT,uT,Du.set(1,1,1)).invert()}clone(){return new this.constructor().copy(this)}},Od=new ie,LH=new Oe,DH=new Oe,Rr=class extends Rf{constructor(e=50,t=1,n=.1,r=2e3){super(),this.isPerspectiveCamera=!0,this.type="PerspectiveCamera",this.fov=e,this.zoom=1,this.near=n,this.far=r,this.focus=10,this.aspect=t,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.fov=e.fov,this.zoom=e.zoom,this.near=e.near,this.far=e.far,this.focus=e.focus,this.aspect=e.aspect,this.view=e.view===null?null:Object.assign({},e.view),this.filmGauge=e.filmGauge,this.filmOffset=e.filmOffset,this}setFocalLength(e){let t=.5*this.getFilmHeight()/e;this.fov=Ef*2*Math.atan(t),this.updateProjectionMatrix()}getFocalLength(){let e=Math.tan(hy*.5*this.fov);return .5*this.getFilmHeight()/e}getEffectiveFOV(){return Ef*2*Math.atan(Math.tan(hy*.5*this.fov)/this.zoom)}getFilmWidth(){return this.filmGauge*Math.min(this.aspect,1)}getFilmHeight(){return this.filmGauge/Math.max(this.aspect,1)}getViewBounds(e,t,n){Od.set(-1,-1,.5).applyMatrix4(this.projectionMatrixInverse),t.set(Od.x,Od.y).multiplyScalar(-e/Od.z),Od.set(1,1,.5).applyMatrix4(this.projectionMatrixInverse),n.set(Od.x,Od.y).multiplyScalar(-e/Od.z)}getViewSize(e,t){return this.getViewBounds(e,LH,DH),t.subVectors(DH,LH)}setViewOffset(e,t,n,r,s,o){this.aspect=e/t,this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=n,this.view.offsetY=r,this.view.width=s,this.view.height=o,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){let e=this.near,t=e*Math.tan(hy*.5*this.fov)/this.zoom,n=2*t,r=this.aspect*n,s=-.5*r,o=this.view;if(this.view!==null&&this.view.enabled){let l=o.fullWidth,c=o.fullHeight;s+=o.offsetX*r/l,t-=o.offsetY*n/c,r*=o.width/l,n*=o.height/c}let a=this.filmOffset;a!==0&&(s+=e*a/this.getFilmWidth()),this.projectionMatrix.makePerspective(s,s+r,t,t-n,e,this.far,this.coordinateSystem,this.reversedDepth),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){let t=super.toJSON(e);return t.object.fov=this.fov,t.object.zoom=this.zoom,t.object.near=this.near,t.object.far=this.far,t.object.focus=this.focus,t.object.aspect=this.aspect,this.view!==null&&(t.object.view=Object.assign({},this.view)),t.object.filmGauge=this.filmGauge,t.object.filmOffset=this.filmOffset,t}},HN=class extends zy{constructor(){super(new Rr(50,1,.5,500)),this.isSpotLightShadow=!0,this.focus=1,this.aspect=1}updateMatrices(e){let t=this.camera,n=Ef*2*e.angle*this.focus,r=this.mapSize.width/this.mapSize.height*this.aspect,s=e.distance||t.far;(n!==t.fov||r!==t.aspect||s!==t.far)&&(t.fov=n,t.aspect=r,t.far=s,t.updateProjectionMatrix()),super.updateMatrices(e)}copy(e){return super.copy(e),this.focus=e.focus,this}},TA=class extends Uu{constructor(e,t,n=0,r=Math.PI/3,s=0,o=2){super(e,t),this.isSpotLight=!0,this.type="SpotLight",this.position.copy($i.DEFAULT_UP),this.updateMatrix(),this.target=new $i,this.distance=n,this.angle=r,this.penumbra=s,this.decay=o,this.map=null,this.shadow=new HN}get power(){return this.intensity*Math.PI}set power(e){this.intensity=e/Math.PI}dispose(){super.dispose(),this.shadow.dispose()}copy(e,t){return super.copy(e,t),this.distance=e.distance,this.angle=e.angle,this.penumbra=e.penumbra,this.decay=e.decay,this.target=e.target.clone(),this.map=e.map,this.shadow=e.shadow.clone(),this}toJSON(e){let t=super.toJSON(e);return t.object.distance=this.distance,t.object.angle=this.angle,t.object.decay=this.decay,t.object.penumbra=this.penumbra,t.object.target=this.target.uuid,this.map&&this.map.isTexture&&(t.object.map=this.map.toJSON(e).uuid),t.object.shadow=this.shadow.toJSON(),t}},WN=class extends zy{constructor(){super(new Rr(90,1,.5,500)),this.isPointLightShadow=!0}},Vy=class extends Uu{constructor(e,t,n=0,r=2){super(e,t),this.isPointLight=!0,this.type="PointLight",this.distance=n,this.decay=r,this.shadow=new WN}get power(){return this.intensity*4*Math.PI}set power(e){this.intensity=e/(4*Math.PI)}dispose(){super.dispose(),this.shadow.dispose()}copy(e,t){return super.copy(e,t),this.distance=e.distance,this.decay=e.decay,this.shadow=e.shadow.clone(),this}toJSON(e){let t=super.toJSON(e);return t.object.distance=this.distance,t.object.decay=this.decay,t.object.shadow=this.shadow.toJSON(),t}},Vc=class extends Rf{constructor(e=-1,t=1,n=1,r=-1,s=.1,o=2e3){super(),this.isOrthographicCamera=!0,this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=e,this.right=t,this.top=n,this.bottom=r,this.near=s,this.far=o,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.left=e.left,this.right=e.right,this.top=e.top,this.bottom=e.bottom,this.near=e.near,this.far=e.far,this.zoom=e.zoom,this.view=e.view===null?null:Object.assign({},e.view),this}setViewOffset(e,t,n,r,s,o){this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=n,this.view.offsetY=r,this.view.width=s,this.view.height=o,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){let e=(this.right-this.left)/(2*this.zoom),t=(this.top-this.bottom)/(2*this.zoom),n=(this.right+this.left)/2,r=(this.top+this.bottom)/2,s=n-e,o=n+e,a=r+t,l=r-t;if(this.view!==null&&this.view.enabled){let c=(this.right-this.left)/this.view.fullWidth/this.zoom,u=(this.top-this.bottom)/this.view.fullHeight/this.zoom;s+=c*this.view.offsetX,o=s+c*this.view.width,a-=u*this.view.offsetY,l=a-u*this.view.height}this.projectionMatrix.makeOrthographic(s,o,a,l,this.near,this.far,this.coordinateSystem,this.reversedDepth),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){let t=super.toJSON(e);return t.object.zoom=this.zoom,t.object.left=this.left,t.object.right=this.right,t.object.top=this.top,t.object.bottom=this.bottom,t.object.near=this.near,t.object.far=this.far,this.view!==null&&(t.object.view=Object.assign({},this.view)),t}},jN=class extends zy{constructor(){super(new Vc(-5,5,5,-5,.5,500)),this.isDirectionalLightShadow=!0}},EA=class extends Uu{constructor(e,t){super(e,t),this.isDirectionalLight=!0,this.type="DirectionalLight",this.position.copy($i.DEFAULT_UP),this.updateMatrix(),this.target=new $i,this.shadow=new jN}dispose(){super.dispose(),this.shadow.dispose()}copy(e){return super.copy(e),this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}toJSON(e){let t=super.toJSON(e);return t.object.shadow=this.shadow.toJSON(),t.object.target=this.target.uuid,t}},MA=class extends Uu{constructor(e,t){super(e,t),this.isAmbientLight=!0,this.type="AmbientLight"}},qy=class extends Uu{constructor(e,t,n=10,r=10){super(e,t),this.isRectAreaLight=!0,this.type="RectAreaLight",this.width=n,this.height=r}get power(){return this.intensity*this.width*this.height*Math.PI}set power(e){this.intensity=e/(this.width*this.height*Math.PI)}copy(e){return super.copy(e),this.width=e.width,this.height=e.height,this}toJSON(e){let t=super.toJSON(e);return t.object.width=this.width,t.object.height=this.height,t}},BT=class{constructor(){this.isSphericalHarmonics3=!0,this.coefficients=[];for(let e=0;e<9;e++)this.coefficients.push(new ie)}set(e){for(let t=0;t<9;t++)this.coefficients[t].copy(e[t]);return this}zero(){for(let e=0;e<9;e++)this.coefficients[e].set(0,0,0);return this}getAt(e,t){let n=e.x,r=e.y,s=e.z,o=this.coefficients;return t.copy(o[0]).multiplyScalar(.282095),t.addScaledVector(o[1],.488603*r),t.addScaledVector(o[2],.488603*s),t.addScaledVector(o[3],.488603*n),t.addScaledVector(o[4],1.092548*(n*r)),t.addScaledVector(o[5],1.092548*(r*s)),t.addScaledVector(o[6],.315392*(3*s*s-1)),t.addScaledVector(o[7],1.092548*(n*s)),t.addScaledVector(o[8],.546274*(n*n-r*r)),t}getIrradianceAt(e,t){let n=e.x,r=e.y,s=e.z,o=this.coefficients;return t.copy(o[0]).multiplyScalar(.886227),t.addScaledVector(o[1],2*.511664*r),t.addScaledVector(o[2],2*.511664*s),t.addScaledVector(o[3],2*.511664*n),t.addScaledVector(o[4],2*.429043*n*r),t.addScaledVector(o[5],2*.429043*r*s),t.addScaledVector(o[6],.743125*s*s-.247708),t.addScaledVector(o[7],2*.429043*n*s),t.addScaledVector(o[8],.429043*(n*n-r*r)),t}add(e){for(let t=0;t<9;t++)this.coefficients[t].add(e.coefficients[t]);return this}addScaledSH(e,t){for(let n=0;n<9;n++)this.coefficients[n].addScaledVector(e.coefficients[n],t);return this}scale(e){for(let t=0;t<9;t++)this.coefficients[t].multiplyScalar(e);return this}lerp(e,t){for(let n=0;n<9;n++)this.coefficients[n].lerp(e.coefficients[n],t);return this}equals(e){for(let t=0;t<9;t++)if(!this.coefficients[t].equals(e.coefficients[t]))return!1;return!0}copy(e){return this.set(e.coefficients)}clone(){return new this.constructor().copy(this)}fromArray(e,t=0){let n=this.coefficients;for(let r=0;r<9;r++)n[r].fromArray(e,t+r*3);return this}toArray(e=[],t=0){let n=this.coefficients;for(let r=0;r<9;r++)n[r].toArray(e,t+r*3);return e}static getBasisAt(e,t){let n=e.x,r=e.y,s=e.z;t[0]=.282095,t[1]=.488603*r,t[2]=.488603*s,t[3]=.488603*n,t[4]=1.092548*n*r,t[5]=1.092548*r*s,t[6]=.315392*(3*s*s-1),t[7]=1.092548*n*s,t[8]=.546274*(n*n-r*r)}},Hy=class extends Uu{constructor(e=new BT,t=1){super(void 0,t),this.isLightProbe=!0,this.sh=e}copy(e){return super.copy(e),this.sh.copy(e.sh),this}toJSON(e){let t=super.toJSON(e);return t.object.sh=this.sh.toArray(),t}};var Wy=class extends Kn{constructor(){super(),this.isInstancedBufferGeometry=!0,this.type="InstancedBufferGeometry",this.instanceCount=1/0}copy(e){return super.copy(e),this.instanceCount=e.instanceCount,this}toJSON(){let e=super.toJSON();return e.instanceCount=this.instanceCount,e.isInstancedBufferGeometry=!0,e}};var i_=-90,r_=1,y_=class extends $i{constructor(e,t,n){super(),this.type="CubeCamera",this.renderTarget=n,this.coordinateSystem=null,this.activeMipmapLevel=0;let r=new Rr(i_,r_,e,t);r.layers=this.layers,this.add(r);let s=new Rr(i_,r_,e,t);s.layers=this.layers,this.add(s);let o=new Rr(i_,r_,e,t);o.layers=this.layers,this.add(o);let a=new Rr(i_,r_,e,t);a.layers=this.layers,this.add(a);let l=new Rr(i_,r_,e,t);l.layers=this.layers,this.add(l);let c=new Rr(i_,r_,e,t);c.layers=this.layers,this.add(c)}updateCoordinateSystem(){let e=this.coordinateSystem,t=this.children.concat(),[n,r,s,o,a,l]=t;for(let c of t)this.remove(c);if(e===fo)n.up.set(0,1,0),n.lookAt(1,0,0),r.up.set(0,1,0),r.lookAt(-1,0,0),s.up.set(0,0,-1),s.lookAt(0,1,0),o.up.set(0,0,1),o.lookAt(0,-1,0),a.up.set(0,1,0),a.lookAt(0,0,1),l.up.set(0,1,0),l.lookAt(0,0,-1);else if(e===Va)n.up.set(0,-1,0),n.lookAt(-1,0,0),r.up.set(0,-1,0),r.lookAt(1,0,0),s.up.set(0,0,1),s.lookAt(0,1,0),o.up.set(0,0,-1),o.lookAt(0,-1,0),a.up.set(0,-1,0),a.lookAt(0,0,1),l.up.set(0,-1,0),l.lookAt(0,0,-1);else throw new Error("THREE.CubeCamera.updateCoordinateSystem(): Invalid coordinate system: "+e);for(let c of t)this.add(c),c.updateMatrixWorld()}update(e,t){this.parent===null&&this.updateMatrixWorld();let{renderTarget:n,activeMipmapLevel:r}=this;this.coordinateSystem!==e.coordinateSystem&&(this.coordinateSystem=e.coordinateSystem,this.updateCoordinateSystem());let[s,o,a,l,c,u]=this.children,f=e.getRenderTarget(),p=e.getActiveCubeFace(),x=e.getActiveMipmapLevel(),b=e.xr.enabled;e.xr.enabled=!1;let w=n.texture.generateMipmaps;n.texture.generateMipmaps=!1;let S=!1;e.isWebGLRenderer===!0?S=e.state.buffers.depth.getReversed():S=e.reversedDepthBuffer,e.setRenderTarget(n,0,r),S&&e.autoClear===!1&&e.clearDepth(),e.render(t,s),e.setRenderTarget(n,1,r),S&&e.autoClear===!1&&e.clearDepth(),e.render(t,o),e.setRenderTarget(n,2,r),S&&e.autoClear===!1&&e.clearDepth(),e.render(t,a),e.setRenderTarget(n,3,r),S&&e.autoClear===!1&&e.clearDepth(),e.render(t,l),e.setRenderTarget(n,4,r),S&&e.autoClear===!1&&e.clearDepth(),e.render(t,c),n.texture.generateMipmaps=w,e.setRenderTarget(n,5,r),S&&e.autoClear===!1&&e.clearDepth(),e.render(t,u),e.setRenderTarget(f,p,x),e.xr.enabled=b,n.texture.needsPMREMUpdate=!0}},v_=class extends Rr{constructor(e=[]){super(),this.isArrayCamera=!0,this.isMultiViewCamera=!1,this.cameras=e}},CA=class{constructor(){this._previousTime=0,this._currentTime=0,this._startTime=performance.now(),this._delta=0,this._elapsed=0,this._timescale=1,this._document=null,this._pageVisibilityHandler=null}connect(e){this._document=e,e.hidden!==void 0&&(this._pageVisibilityHandler=$ce.bind(this),e.addEventListener("visibilitychange",this._pageVisibilityHandler,!1))}disconnect(){this._pageVisibilityHandler!==null&&(this._document.removeEventListener("visibilitychange",this._pageVisibilityHandler),this._pageVisibilityHandler=null),this._document=null}getDelta(){return this._delta/1e3}getElapsed(){return this._elapsed/1e3}getTimescale(){return this._timescale}setTimescale(e){return this._timescale=e,this}reset(){return this._currentTime=performance.now()-this._startTime,this}dispose(){this.disconnect()}update(e){return this._pageVisibilityHandler!==null&&this._document.hidden===!0?this._delta=0:(this._previousTime=this._currentTime,this._currentTime=(e!==void 0?e:performance.now())-this._startTime,this._delta=(this._currentTime-this._previousTime)*this._timescale,this._elapsed+=this._delta),this}};function $ce(){this._document.hidden===!1&&this.reset()}var yL="\\[\\]\\.:\\/",Yce=new RegExp("["+yL+"]","g"),vL="[^"+yL+"]",Zce="[^"+yL.replace("\\.","")+"]",Kce=/((?:WC+[\/:])*)/.source.replace("WC",vL),Qce=/(WCOD+)?/.source.replace("WCOD",Zce),Jce=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",vL),eue=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",vL),tue=new RegExp("^"+Kce+Qce+Jce+eue+"$"),nue=["material","materials","bones","map"],XN=class{constructor(e,t,n){let r=n||cr.parseTrackName(t);this._targetGroup=e,this._bindings=e.subscribe_(t,r)}getValue(e,t){this.bind();let n=this._targetGroup.nCachedObjects_,r=this._bindings[n];r!==void 0&&r.getValue(e,t)}setValue(e,t){let n=this._bindings;for(let r=this._targetGroup.nCachedObjects_,s=n.length;r!==s;++r)n[r].setValue(e,t)}bind(){let e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,n=e.length;t!==n;++t)e[t].bind()}unbind(){let e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,n=e.length;t!==n;++t)e[t].unbind()}},cr=class i{constructor(e,t,n){this.path=t,this.parsedPath=n||i.parseTrackName(t),this.node=i.findNode(e,this.parsedPath.nodeName),this.rootNode=e,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(e,t,n){return e&&e.isAnimationObjectGroup?new i.Composite(e,t,n):new i(e,t,n)}static sanitizeNodeName(e){return e.replace(/\s/g,"_").replace(Yce,"")}static parseTrackName(e){let t=tue.exec(e);if(t===null)throw new Error("THREE.PropertyBinding: Cannot parse trackName: "+e);let n={nodeName:t[2],objectName:t[3],objectIndex:t[4],propertyName:t[5],propertyIndex:t[6]},r=n.nodeName&&n.nodeName.lastIndexOf(".");if(r!==void 0&&r!==-1){let s=n.nodeName.substring(r+1);nue.indexOf(s)!==-1&&(n.nodeName=n.nodeName.substring(0,r),n.objectName=s)}if(n.propertyName===null||n.propertyName.length===0)throw new Error("THREE.PropertyBinding: can not parse propertyName from trackName: "+e);return n}static findNode(e,t){if(t===void 0||t===""||t==="."||t===-1||t===e.name||t===e.uuid)return e;if(e.skeleton){let n=e.skeleton.getBoneByName(t);if(n!==void 0)return n}if(e.children){let n=function(s){for(let o=0;o<s.length;o++){let a=s[o];if(a.name===t||a.uuid===t)return a;let l=n(a.children);if(l)return l}return null},r=n(e.children);if(r)return r}return null}_getValue_unavailable(){}_setValue_unavailable(){}_getValue_direct(e,t){e[t]=this.targetObject[this.propertyName]}_getValue_array(e,t){let n=this.resolvedProperty;for(let r=0,s=n.length;r!==s;++r)e[t++]=n[r]}_getValue_arrayElement(e,t){e[t]=this.resolvedProperty[this.propertyIndex]}_getValue_toArray(e,t){this.resolvedProperty.toArray(e,t)}_setValue_direct(e,t){this.targetObject[this.propertyName]=e[t]}_setValue_direct_setNeedsUpdate(e,t){this.targetObject[this.propertyName]=e[t],this.targetObject.needsUpdate=!0}_setValue_direct_setMatrixWorldNeedsUpdate(e,t){this.targetObject[this.propertyName]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_array(e,t){let n=this.resolvedProperty;for(let r=0,s=n.length;r!==s;++r)n[r]=e[t++]}_setValue_array_setNeedsUpdate(e,t){let n=this.resolvedProperty;for(let r=0,s=n.length;r!==s;++r)n[r]=e[t++];this.targetObject.needsUpdate=!0}_setValue_array_setMatrixWorldNeedsUpdate(e,t){let n=this.resolvedProperty;for(let r=0,s=n.length;r!==s;++r)n[r]=e[t++];this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_arrayElement(e,t){this.resolvedProperty[this.propertyIndex]=e[t]}_setValue_arrayElement_setNeedsUpdate(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.needsUpdate=!0}_setValue_arrayElement_setMatrixWorldNeedsUpdate(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_fromArray(e,t){this.resolvedProperty.fromArray(e,t)}_setValue_fromArray_setNeedsUpdate(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.needsUpdate=!0}_setValue_fromArray_setMatrixWorldNeedsUpdate(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.matrixWorldNeedsUpdate=!0}_getValue_unbound(e,t){this.bind(),this.getValue(e,t)}_setValue_unbound(e,t){this.bind(),this.setValue(e,t)}bind(){let e=this.node,t=this.parsedPath,n=t.objectName,r=t.propertyName,s=t.propertyIndex;if(e||(e=i.findNode(this.rootNode,t.nodeName),this.node=e),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,!e){je("PropertyBinding: No target node found for track: "+this.path+".");return}if(n){let c=t.objectIndex;switch(n){case"materials":if(!e.material){Ge("PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!e.material.materials){Ge("PropertyBinding: Can not bind to material.materials as node.material does not have a materials array.",this);return}e=e.material.materials;break;case"bones":if(!e.skeleton){Ge("PropertyBinding: Can not bind to bones as node does not have a skeleton.",this);return}e=e.skeleton.bones;for(let u=0;u<e.length;u++)if(e[u].name===c){c=u;break}break;case"map":if("map"in e){e=e.map;break}if(!e.material){Ge("PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!e.material.map){Ge("PropertyBinding: Can not bind to material.map as node.material does not have a map.",this);return}e=e.material.map;break;default:if(e[n]===void 0){Ge("PropertyBinding: Can not bind to objectName of node undefined.",this);return}e=e[n]}if(c!==void 0){if(e[c]===void 0){Ge("PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.",this,e);return}e=e[c]}}let o=e[r];if(o===void 0){let c=t.nodeName;Ge("PropertyBinding: Trying to update property for track: "+c+"."+r+" but it wasn't found.",e);return}let a=this.Versioning.None;this.targetObject=e,e.isMaterial===!0?a=this.Versioning.NeedsUpdate:e.isObject3D===!0&&(a=this.Versioning.MatrixWorldNeedsUpdate);let l=this.BindingType.Direct;if(s!==void 0){if(r==="morphTargetInfluences"){if(!e.geometry){Ge("PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.",this);return}if(!e.geometry.morphAttributes){Ge("PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphAttributes.",this);return}e.morphTargetDictionary[s]!==void 0&&(s=e.morphTargetDictionary[s])}l=this.BindingType.ArrayElement,this.resolvedProperty=o,this.propertyIndex=s}else o.fromArray!==void 0&&o.toArray!==void 0?(l=this.BindingType.HasFromToArray,this.resolvedProperty=o):Array.isArray(o)?(l=this.BindingType.EntireArray,this.resolvedProperty=o):this.propertyName=r;this.getValue=this.GetterByBindingType[l],this.setValue=this.SetterByBindingTypeAndVersioning[l][a]}unbind(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}};cr.Composite=XN;cr.prototype.BindingType={Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3};cr.prototype.Versioning={None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2};cr.prototype.GetterByBindingType=[cr.prototype._getValue_direct,cr.prototype._getValue_array,cr.prototype._getValue_arrayElement,cr.prototype._getValue_toArray];cr.prototype.SetterByBindingTypeAndVersioning=[[cr.prototype._setValue_direct,cr.prototype._setValue_direct_setNeedsUpdate,cr.prototype._setValue_direct_setMatrixWorldNeedsUpdate],[cr.prototype._setValue_array,cr.prototype._setValue_array_setNeedsUpdate,cr.prototype._setValue_array_setMatrixWorldNeedsUpdate],[cr.prototype._setValue_arrayElement,cr.prototype._setValue_arrayElement_setNeedsUpdate,cr.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate],[cr.prototype._setValue_fromArray,cr.prototype._setValue_fromArray_setNeedsUpdate,cr.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate]];var Vze=new Float32Array(1);var ku=class extends Mf{constructor(e,t,n=1){super(e,t),this.isInstancedInterleavedBuffer=!0,this.meshPerAttribute=n}copy(e){return super.copy(e),this.meshPerAttribute=e.meshPerAttribute,this}clone(e){let t=super.clone(e);return t.meshPerAttribute=this.meshPerAttribute,t}toJSON(e){let t=super.toJSON(e);return t.isInstancedInterleavedBuffer=!0,t.meshPerAttribute=this.meshPerAttribute,t}};var FH=new on,jy=class{constructor(e,t,n=0,r=1/0){this.ray=new Cf(e,t),this.near=n,this.far=r,this.camera=null,this.layers=new h_,this.params={Mesh:{},Line:{threshold:1},LOD:{},Points:{threshold:1},Sprite:{}}}set(e,t){this.ray.set(e,t)}setFromCamera(e,t){t.isPerspectiveCamera?(this.ray.origin.setFromMatrixPosition(t.matrixWorld),this.ray.direction.set(e.x,e.y,.5).unproject(t).sub(this.ray.origin).normalize(),this.camera=t):t.isOrthographicCamera?(this.ray.origin.set(e.x,e.y,t.projectionMatrix.elements[14]).unproject(t),this.ray.direction.set(0,0,-1).transformDirection(t.matrixWorld),this.camera=t):Ge("Raycaster: Unsupported camera type: "+t.type)}setFromXRController(e){return FH.identity().extractRotation(e.matrixWorld),this.ray.origin.setFromMatrixPosition(e.matrixWorld),this.ray.direction.set(0,0,-1).applyMatrix4(FH),this}intersectObject(e,t=!0,n=[]){return $N(e,this,n,t),n.sort(OH),n}intersectObjects(e,t=!0,n=[]){for(let r=0,s=e.length;r<s;r++)$N(e[r],this,n,t);return n.sort(OH),n}};function OH(i,e){return i.distance-e.distance}function $N(i,e,t,n){let r=!0;if(i.layers.test(e.layers)&&i.raycast(e,t)===!1&&(r=!1),r===!0&&n===!0){let s=i.children;for(let o=0,a=s.length;o<a;o++)$N(s[o],e,t,!0)}}var b_=class{constructor(e=1,t=0,n=0){this.radius=e,this.phi=t,this.theta=n}set(e,t,n){return this.radius=e,this.phi=t,this.theta=n,this}copy(e){return this.radius=e.radius,this.phi=e.phi,this.theta=e.theta,this}makeSafe(){return this.phi=Pn(this.phi,1e-6,Math.PI-1e-6),this}setFromVector3(e){return this.setFromCartesianCoords(e.x,e.y,e.z)}setFromCartesianCoords(e,t,n){return this.radius=Math.sqrt(e*e+t*t+n*n),this.radius===0?(this.theta=0,this.phi=0):(this.theta=Math.atan2(e,n),this.phi=Math.acos(Pn(t/this.radius,-1,1))),this}clone(){return new this.constructor().copy(this)}};var EL=class EL{constructor(e,t,n,r){this.elements=[1,0,0,1],e!==void 0&&this.set(e,t,n,r)}identity(){return this.set(1,0,0,1),this}fromArray(e,t=0){for(let n=0;n<4;n++)this.elements[n]=e[n+t];return this}set(e,t,n,r){let s=this.elements;return s[0]=e,s[2]=t,s[1]=n,s[3]=r,this}};EL.prototype.isMatrix2=!0;var w_=EL,BH=new Oe,UT=class{constructor(e=new Oe(1/0,1/0),t=new Oe(-1/0,-1/0)){this.isBox2=!0,this.min=e,this.max=t}set(e,t){return this.min.copy(e),this.max.copy(t),this}setFromPoints(e){this.makeEmpty();for(let t=0,n=e.length;t<n;t++)this.expandByPoint(e[t]);return this}setFromCenterAndSize(e,t){let n=BH.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(n),this.max.copy(e).add(n),this}clone(){return new this.constructor().copy(this)}copy(e){return this.min.copy(e.min),this.max.copy(e.max),this}makeEmpty(){return this.min.x=this.min.y=1/0,this.max.x=this.max.y=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y}getCenter(e){return this.isEmpty()?e.set(0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(e){return this.isEmpty()?e.set(0,0):e.subVectors(this.max,this.min)}expandByPoint(e){return this.min.min(e),this.max.max(e),this}expandByVector(e){return this.min.sub(e),this.max.add(e),this}expandByScalar(e){return this.min.addScalar(-e),this.max.addScalar(e),this}containsPoint(e){return e.x>=this.min.x&&e.x<=this.max.x&&e.y>=this.min.y&&e.y<=this.max.y}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y}getParameter(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y))}intersectsBox(e){return e.max.x>=this.min.x&&e.min.x<=this.max.x&&e.max.y>=this.min.y&&e.min.y<=this.max.y}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,BH).distanceTo(e)}intersect(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this}union(e){return this.min.min(e.min),this.max.max(e.max),this}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}},UH=new ie,hT=new ie,s_=new ie,o_=new ie,FN=new ie,iue=new ie,rue=new ie,Xy=class{constructor(e=new ie,t=new ie){this.start=e,this.end=t}set(e,t){return this.start.copy(e),this.end.copy(t),this}copy(e){return this.start.copy(e.start),this.end.copy(e.end),this}getCenter(e){return e.addVectors(this.start,this.end).multiplyScalar(.5)}delta(e){return e.subVectors(this.end,this.start)}distanceSq(){return this.start.distanceToSquared(this.end)}distance(){return this.start.distanceTo(this.end)}at(e,t){return this.delta(t).multiplyScalar(e).add(this.start)}closestPointToPointParameter(e,t){UH.subVectors(e,this.start),hT.subVectors(this.end,this.start);let n=hT.dot(hT);if(n===0)return 0;let s=hT.dot(UH)/n;return t&&(s=Pn(s,0,1)),s}closestPointToPoint(e,t,n){let r=this.closestPointToPointParameter(e,t);return this.delta(n).multiplyScalar(r).add(this.start)}distanceSqToLine3(e,t=iue,n=rue){let r=10000000000000001e-32,s,o,a=this.start,l=e.start,c=this.end,u=e.end;s_.subVectors(c,a),o_.subVectors(u,l),FN.subVectors(a,l);let f=s_.dot(s_),p=o_.dot(o_),x=o_.dot(FN);if(f<=r&&p<=r)return t.copy(a),n.copy(l),t.sub(n),t.dot(t);if(f<=r)s=0,o=x/p,o=Pn(o,0,1);else{let b=s_.dot(FN);if(p<=r)o=0,s=Pn(-b/f,0,1);else{let w=s_.dot(o_),S=f*p-w*w;S!==0?s=Pn((w*x-b*p)/S,0,1):s=0,o=(w*s+x)/p,o<0?(o=0,s=Pn(-b/f,0,1)):o>1&&(o=1,s=Pn((w-b)/f,0,1))}}return t.copy(a).addScaledVector(s_,s),n.copy(l).addScaledVector(o_,o),t.distanceToSquared(n)}applyMatrix4(e){return this.start.applyMatrix4(e),this.end.applyMatrix4(e),this}equals(e){return e.start.equals(this.start)&&e.end.equals(this.end)}clone(){return new this.constructor().copy(this)}};var $y=class{constructor(){this.type="ShapePath",this.color=new Ut,this.subPaths=[],this.currentPath=null,this.userData={}}moveTo(e,t){return this.currentPath=new vA,this.subPaths.push(this.currentPath),this.currentPath.moveTo(e,t),this}lineTo(e,t){return this.currentPath.lineTo(e,t),this}quadraticCurveTo(e,t,n,r){return this.currentPath.quadraticCurveTo(e,t,n,r),this}bezierCurveTo(e,t,n,r,s,o){return this.currentPath.bezierCurveTo(e,t,n,r,s,o),this}splineThru(e){return this.currentPath.splineThru(e),this}toShapes(){function e(l,c){let u=!1,f=c.length;for(let p=0,x=f-1;p<f;x=p++){let b=c[p],w=c[x];b.y>l.y!=w.y>l.y&&l.x<(w.x-b.x)*(l.y-b.y)/(w.y-b.y)+b.x&&(u=!u)}return u}function t(l,c){let u=c.getCenter(new Oe);if(e(u,l))return u;let f=u.y,p=[],x=l.length;for(let b=0;b<x;b++){let w=l[b],S=l[(b+1)%x];if(w.y>f!=S.y>f){let T=w.x+(f-w.y)*(S.x-w.x)/(S.y-w.y);p.push(T)}}return p.length>1&&(p.sort((b,w)=>b-w),u.x=(p[0]+p[1])/2),u}let n=this.userData.style&&this.userData.style.fillRule||"nonzero";n!=="nonzero"&&n!=="evenodd"&&(je('Fill-rule "'+n+'" is not supported, falling back to "nonzero".'),n="nonzero");let r=n==="nonzero"?(l=>l!==0):(l=>(l&1)!==0),s=[];for(let l of this.subPaths){let c=l.getPoints();if(c.length<3)continue;let u=Bd.area(c);if(u===0)continue;let f=new UT;for(let p=0;p<c.length;p++)f.expandByPoint(c[p]);s.push({subPath:l,points:c,boundingBox:f,interiorPoint:t(c,f),absArea:Math.abs(u),winding:u<0?-1:1,container:null,exclude:!1,role:null})}s.sort((l,c)=>c.absArea-l.absArea);for(let l=0;l<s.length;l++){let c=s[l],u=0;for(let f=l-1;f>=0;f--){let p=s[f];if(p.boundingBox.containsBox(c.boundingBox)&&e(c.interiorPoint,p.points)){c.container=p.exclude?p.container:p,u=p.winding,c.winding+=u;break}}r(c.winding)===r(u)&&(c.exclude=!0)}for(let l of s)l.exclude||(l.role=l.container===null||l.container.role==="hole"?"outer":"hole");let o=[],a=new Map;for(let l of s){if(l.exclude||l.role!=="outer")continue;let c=new Ey;c.curves=l.subPath.curves,o.push(c),a.set(l,c)}for(let l of s){if(l.exclude||l.role!=="hole")continue;let c=a.get(l.container);if(!c)continue;let u=new vA;u.curves=l.subPath.curves,c.holes.push(u)}return o}},Pf=class extends Uo{constructor(e,t=null){super(),this.object=e,this.domElement=t,this.enabled=!0,this.state=-1,this.keys={},this.mouseButtons={LEFT:null,MIDDLE:null,RIGHT:null},this.touches={ONE:null,TWO:null}}connect(e){if(e===void 0){je("Controls: connect() now requires an element.");return}this.domElement!==null&&this.disconnect(),this.domElement=e}disconnect(){}dispose(){}update(){}};function b2(i,e,t,n){let r=sue(n);switch(t){case S_:return i*e;case Lf:return i*e/r.components*r.byteLength;case ju:return i*e/r.components*r.byteLength;case ws:return i*e*2/r.components*r.byteLength;case Xu:return i*e*2/r.components*r.byteLength;case Nf:return i*e*3/r.components*r.byteLength;case xr:return i*e*4/r.components*r.byteLength;case ip:return i*e*4/r.components*r.byteLength;case $u:case Yu:return Math.floor((i+3)/4)*Math.floor((e+3)/4)*8;case Zu:case Ku:return Math.floor((i+3)/4)*Math.floor((e+3)/4)*16;case FA:case BA:return Math.max(i,16)*Math.max(e,8)/4;case DA:case OA:return Math.max(i,8)*Math.max(e,8)/2;case rp:case sp:case ap:case lp:return Math.floor((i+3)/4)*Math.floor((e+3)/4)*8;case op:case Qu:case cp:return Math.floor((i+3)/4)*Math.floor((e+3)/4)*16;case up:return Math.floor((i+3)/4)*Math.floor((e+3)/4)*16;case hp:return Math.floor((i+4)/5)*Math.floor((e+3)/4)*16;case fp:return Math.floor((i+4)/5)*Math.floor((e+4)/5)*16;case dp:return Math.floor((i+5)/6)*Math.floor((e+4)/5)*16;case pp:return Math.floor((i+5)/6)*Math.floor((e+5)/6)*16;case Ap:return Math.floor((i+7)/8)*Math.floor((e+4)/5)*16;case mp:return Math.floor((i+7)/8)*Math.floor((e+5)/6)*16;case gp:return Math.floor((i+7)/8)*Math.floor((e+7)/8)*16;case _p:return Math.floor((i+9)/10)*Math.floor((e+4)/5)*16;case xp:return Math.floor((i+9)/10)*Math.floor((e+5)/6)*16;case yp:return Math.floor((i+9)/10)*Math.floor((e+7)/8)*16;case vp:return Math.floor((i+9)/10)*Math.floor((e+9)/10)*16;case bp:return Math.floor((i+11)/12)*Math.floor((e+9)/10)*16;case wp:return Math.floor((i+11)/12)*Math.floor((e+11)/12)*16;case Sp:case Tp:case Ep:return Math.ceil(i/4)*Math.ceil(e/4)*16;case Mp:case Cp:return Math.ceil(i/4)*Math.ceil(e/4)*8;case Ju:case Rp:return Math.ceil(i/4)*Math.ceil(e/4)*16}throw new Error(`Unable to determine texture byte length for ${t} format.`)}function sue(i){switch(i){case Gi:case Hu:return{byteLength:1,components:1};case Ha:case Wu:case Li:return{byteLength:2,components:1};case PA:case IA:return{byteLength:2,components:4};case pi:case Ir:case Yi:return{byteLength:4,components:1};case NA:case LA:return{byteLength:4,components:3}}throw new Error(`THREE.TextureUtils: Unknown texture type ${i}.`)}typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:"185"}}));typeof window<"u"&&(window.__THREE__?je("WARNING: Multiple instances of Three.js being imported."):window.__THREE__="185");function bW(){let i=null,e=!1,t=null,n=null;function r(s,o){t(s,o),n=i.requestAnimationFrame(r)}return{start:function(){e!==!0&&t!==null&&i!==null&&(n=i.requestAnimationFrame(r),e=!0)},stop:function(){i!==null&&i.cancelAnimationFrame(n),e=!1},setAnimationLoop:function(s){t=s},setContext:function(s){i=s}}}function lue(i){let e=new WeakMap;function t(a,l){let c=a.array,u=a.usage,f=c.byteLength,p=i.createBuffer();i.bindBuffer(l,p),i.bufferData(l,c,u),a.onUploadCallback();let x;if(c instanceof Float32Array)x=i.FLOAT;else if(typeof Float16Array<"u"&&c instanceof Float16Array)x=i.HALF_FLOAT;else if(c instanceof Uint16Array)a.isFloat16BufferAttribute?x=i.HALF_FLOAT:x=i.UNSIGNED_SHORT;else if(c instanceof Int16Array)x=i.SHORT;else if(c instanceof Uint32Array)x=i.UNSIGNED_INT;else if(c instanceof Int32Array)x=i.INT;else if(c instanceof Int8Array)x=i.BYTE;else if(c instanceof Uint8Array)x=i.UNSIGNED_BYTE;else if(c instanceof Uint8ClampedArray)x=i.UNSIGNED_BYTE;else throw new Error("THREE.WebGLAttributes: Unsupported buffer data format: "+c);return{buffer:p,type:x,bytesPerElement:c.BYTES_PER_ELEMENT,version:a.version,size:f}}function n(a,l,c){let u=l.array,f=l.updateRanges;if(i.bindBuffer(c,a),f.length===0)i.bufferSubData(c,0,u);else{f.sort((x,b)=>x.start-b.start);let p=0;for(let x=1;x<f.length;x++){let b=f[p],w=f[x];w.start<=b.start+b.count+1?b.count=Math.max(b.count,w.start+w.count-b.start):(++p,f[p]=w)}f.length=p+1;for(let x=0,b=f.length;x<b;x++){let w=f[x];i.bufferSubData(c,w.start*u.BYTES_PER_ELEMENT,u,w.start,w.count)}l.clearUpdateRanges()}l.onUploadCallback()}function r(a){return a.isInterleavedBufferAttribute&&(a=a.data),e.get(a)}function s(a){a.isInterleavedBufferAttribute&&(a=a.data);let l=e.get(a);l&&(i.deleteBuffer(l.buffer),e.delete(a))}function o(a,l){if(a.isInterleavedBufferAttribute&&(a=a.data),a.isGLBufferAttribute){let u=e.get(a);(!u||u.version<a.version)&&e.set(a,{buffer:a.buffer,type:a.type,bytesPerElement:a.elementSize,version:a.version});return}let c=e.get(a);if(c===void 0)e.set(a,t(a,l));else if(c.version<a.version){if(c.size!==a.array.byteLength)throw new Error("THREE.WebGLAttributes: The size of the buffer attribute's array buffer does not match the original size. Resizing buffer attributes is not supported.");n(c.buffer,a,l),c.version=a.version}}return{get:r,remove:s,update:o}}var cue=`#ifdef USE_ALPHAHASH14+ if ( diffuseColor.a < getAlphaHashThreshold( vPosition ) ) discard;15+#endif`,uue=`#ifdef USE_ALPHAHASH16+ const float ALPHA_HASH_SCALE = 0.05;17+ float hash2D( vec2 value ) {18+ return fract( 1.0e4 * sin( 17.0 * value.x + 0.1 * value.y ) * ( 0.1 + abs( sin( 13.0 * value.y + value.x ) ) ) );19+ }20+ float hash3D( vec3 value ) {21+ return hash2D( vec2( hash2D( value.xy ), value.z ) );22+ }23+ float getAlphaHashThreshold( vec3 position ) {24+ float maxDeriv = max(25+ length( dFdx( position.xyz ) ),26+ length( dFdy( position.xyz ) )27+ );28+ float pixScale = 1.0 / ( ALPHA_HASH_SCALE * maxDeriv );29+ vec2 pixScales = vec2(30+ exp2( floor( log2( pixScale ) ) ),31+ exp2( ceil( log2( pixScale ) ) )32+ );33+ vec2 alpha = vec2(34+ hash3D( floor( pixScales.x * position.xyz ) ),35+ hash3D( floor( pixScales.y * position.xyz ) )36+ );37+ float lerpFactor = fract( log2( pixScale ) );38+ float x = ( 1.0 - lerpFactor ) * alpha.x + lerpFactor * alpha.y;39+ float a = min( lerpFactor, 1.0 - lerpFactor );40+ vec3 cases = vec3(41+ x * x / ( 2.0 * a * ( 1.0 - a ) ),42+ ( x - 0.5 * a ) / ( 1.0 - a ),43+ 1.0 - ( ( 1.0 - x ) * ( 1.0 - x ) / ( 2.0 * a * ( 1.0 - a ) ) )44+ );45+ float threshold = ( x < ( 1.0 - a ) )46+ ? ( ( x < a ) ? cases.x : cases.y )47+ : cases.z;48+ return clamp( threshold , 1.0e-6, 1.0 );49+ }50+#endif`,hue=`#ifdef USE_ALPHAMAP51+ diffuseColor.a *= texture2D( alphaMap, vAlphaMapUv ).g;52+#endif`,fue=`#ifdef USE_ALPHAMAP53+ uniform sampler2D alphaMap;54+#endif`,due=`#ifdef USE_ALPHATEST55+ #ifdef ALPHA_TO_COVERAGE56+ diffuseColor.a = smoothstep( alphaTest, alphaTest + fwidth( diffuseColor.a ), diffuseColor.a );57+ if ( diffuseColor.a == 0.0 ) discard;58+ #else59+ if ( diffuseColor.a < alphaTest ) discard;60+ #endif61+#endif`,pue=`#ifdef USE_ALPHATEST62+ uniform float alphaTest;63+#endif`,Aue=`#ifdef USE_AOMAP64+ float ambientOcclusion = ( texture2D( aoMap, vAoMapUv ).r - 1.0 ) * aoMapIntensity + 1.0;65+ reflectedLight.indirectDiffuse *= ambientOcclusion;66+ #if defined( USE_CLEARCOAT ) 67+ clearcoatSpecularIndirect *= ambientOcclusion;68+ #endif69+ #if defined( USE_SHEEN ) 70+ sheenSpecularIndirect *= ambientOcclusion;71+ #endif72+ #if defined( USE_ENVMAP ) && defined( STANDARD )73+ float dotNV = saturate( dot( geometryNormal, geometryViewDir ) );74+ reflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.roughness );75+ #endif76+#endif`,mue=`#ifdef USE_AOMAP77+ uniform sampler2D aoMap;78+ uniform float aoMapIntensity;79+#endif`,gue=`#ifdef USE_BATCHING80+ #if ! defined( GL_ANGLE_multi_draw )81+ #define gl_DrawID _gl_DrawID82+ uniform int _gl_DrawID;83+ #endif84+ uniform highp sampler2D batchingTexture;85+ uniform highp usampler2D batchingIdTexture;86+ mat4 getBatchingMatrix( const in float i ) {87+ int size = textureSize( batchingTexture, 0 ).x;88+ int j = int( i ) * 4;89+ int x = j % size;90+ int y = j / size;91+ vec4 v1 = texelFetch( batchingTexture, ivec2( x, y ), 0 );92+ vec4 v2 = texelFetch( batchingTexture, ivec2( x + 1, y ), 0 );93+ vec4 v3 = texelFetch( batchingTexture, ivec2( x + 2, y ), 0 );94+ vec4 v4 = texelFetch( batchingTexture, ivec2( x + 3, y ), 0 );95+ return mat4( v1, v2, v3, v4 );96+ }97+ float getIndirectIndex( const in int i ) {98+ int size = textureSize( batchingIdTexture, 0 ).x;99+ int x = i % size;100+ int y = i / size;101+ return float( texelFetch( batchingIdTexture, ivec2( x, y ), 0 ).r );102+ }103+#endif104+#ifdef USE_BATCHING_COLOR105+ uniform sampler2D batchingColorTexture;106+ vec4 getBatchingColor( const in float i ) {107+ int size = textureSize( batchingColorTexture, 0 ).x;108+ int j = int( i );109+ int x = j % size;110+ int y = j / size;111+ return texelFetch( batchingColorTexture, ivec2( x, y ), 0 );112+ }113+#endif`,_ue=`#ifdef USE_BATCHING114+ mat4 batchingMatrix = getBatchingMatrix( getIndirectIndex( gl_DrawID ) );115+#endif`,xue=`vec3 transformed = vec3( position );116+#ifdef USE_ALPHAHASH117+ vPosition = vec3( position );118+#endif`,yue=`vec3 objectNormal = vec3( normal );119+#ifdef USE_TANGENT120+ vec3 objectTangent = vec3( tangent.xyz );121+#endif`,vue=`float G_BlinnPhong_Implicit( ) {122+ return 0.25;123+}124+float D_BlinnPhong( const in float shininess, const in float dotNH ) {125+ return RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess );126+}127+vec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float shininess ) {128+ vec3 halfDir = normalize( lightDir + viewDir );129+ float dotNH = saturate( dot( normal, halfDir ) );130+ float dotVH = saturate( dot( viewDir, halfDir ) );131+ vec3 F = F_Schlick( specularColor, 1.0, dotVH );132+ float G = G_BlinnPhong_Implicit( );133+ float D = D_BlinnPhong( shininess, dotNH );134+ return F * ( G * D );135+} // validated`,bue=`#ifdef USE_IRIDESCENCE136+ const mat3 XYZ_TO_REC709 = mat3(137+ 3.2404542, -0.9692660, 0.0556434,138+ -1.5371385, 1.8760108, -0.2040259,139+ -0.4985314, 0.0415560, 1.0572252140+ );141+ vec3 Fresnel0ToIor( vec3 fresnel0 ) {142+ vec3 sqrtF0 = sqrt( fresnel0 );143+ return ( vec3( 1.0 ) + sqrtF0 ) / ( vec3( 1.0 ) - sqrtF0 );144+ }145+ vec3 IorToFresnel0( vec3 transmittedIor, float incidentIor ) {146+ return pow2( ( transmittedIor - vec3( incidentIor ) ) / ( transmittedIor + vec3( incidentIor ) ) );147+ }148+ float IorToFresnel0( float transmittedIor, float incidentIor ) {149+ return pow2( ( transmittedIor - incidentIor ) / ( transmittedIor + incidentIor ));150+ }151+ vec3 evalSensitivity( float OPD, vec3 shift ) {152+ float phase = 2.0 * PI * OPD * 1.0e-9;153+ vec3 val = vec3( 5.4856e-13, 4.4201e-13, 5.2481e-13 );154+ vec3 pos = vec3( 1.6810e+06, 1.7953e+06, 2.2084e+06 );155+ vec3 var = vec3( 4.3278e+09, 9.3046e+09, 6.6121e+09 );156+ vec3 xyz = val * sqrt( 2.0 * PI * var ) * cos( pos * phase + shift ) * exp( - pow2( phase ) * var );157+ xyz.x += 9.7470e-14 * sqrt( 2.0 * PI * 4.5282e+09 ) * cos( 2.2399e+06 * phase + shift[ 0 ] ) * exp( - 4.5282e+09 * pow2( phase ) );158+ xyz /= 1.0685e-7;159+ vec3 rgb = XYZ_TO_REC709 * xyz;160+ return rgb;161+ }162+ vec3 evalIridescence( float outsideIOR, float eta2, float cosTheta1, float thinFilmThickness, vec3 baseF0 ) {163+ vec3 I;164+ float iridescenceIOR = mix( outsideIOR, eta2, smoothstep( 0.0, 0.03, thinFilmThickness ) );165+ float sinTheta2Sq = pow2( outsideIOR / iridescenceIOR ) * ( 1.0 - pow2( cosTheta1 ) );166+ float cosTheta2Sq = 1.0 - sinTheta2Sq;167+ if ( cosTheta2Sq < 0.0 ) {168+ return vec3( 1.0 );169+ }170+ float cosTheta2 = sqrt( cosTheta2Sq );171+ float R0 = IorToFresnel0( iridescenceIOR, outsideIOR );172+ float R12 = F_Schlick( R0, 1.0, cosTheta1 );173+ float T121 = 1.0 - R12;174+ float phi12 = 0.0;175+ if ( iridescenceIOR < outsideIOR ) phi12 = PI;176+ float phi21 = PI - phi12;177+ vec3 baseIOR = Fresnel0ToIor( clamp( baseF0, 0.0, 0.9999 ) ); vec3 R1 = IorToFresnel0( baseIOR, iridescenceIOR );178+ vec3 R23 = F_Schlick( R1, 1.0, cosTheta2 );179+ vec3 phi23 = vec3( 0.0 );180+ if ( baseIOR[ 0 ] < iridescenceIOR ) phi23[ 0 ] = PI;181+ if ( baseIOR[ 1 ] < iridescenceIOR ) phi23[ 1 ] = PI;182+ if ( baseIOR[ 2 ] < iridescenceIOR ) phi23[ 2 ] = PI;183+ float OPD = 2.0 * iridescenceIOR * thinFilmThickness * cosTheta2;184+ vec3 phi = vec3( phi21 ) + phi23;185+ vec3 R123 = clamp( R12 * R23, 1e-5, 0.9999 );186+ vec3 r123 = sqrt( R123 );187+ vec3 Rs = pow2( T121 ) * R23 / ( vec3( 1.0 ) - R123 );188+ vec3 C0 = R12 + Rs;189+ I = C0;190+ vec3 Cm = Rs - T121;191+ for ( int m = 1; m <= 2; ++ m ) {192+ Cm *= r123;193+ vec3 Sm = 2.0 * evalSensitivity( float( m ) * OPD, float( m ) * phi );194+ I += Cm * Sm;195+ }196+ return max( I, vec3( 0.0 ) );197+ }198+#endif`,wue=`#ifdef USE_BUMPMAP199+ uniform sampler2D bumpMap;200+ uniform float bumpScale;201+ vec2 dHdxy_fwd() {202+ vec2 dSTdx = dFdx( vBumpMapUv );203+ vec2 dSTdy = dFdy( vBumpMapUv );204+ float Hll = bumpScale * texture2D( bumpMap, vBumpMapUv ).x;205+ float dBx = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdx ).x - Hll;206+ float dBy = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdy ).x - Hll;207+ return vec2( dBx, dBy );208+ }209+ vec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy, float faceDirection ) {210+ vec3 vSigmaX = normalize( dFdx( surf_pos.xyz ) );211+ vec3 vSigmaY = normalize( dFdy( surf_pos.xyz ) );212+ vec3 vN = surf_norm;213+ vec3 R1 = cross( vSigmaY, vN );214+ vec3 R2 = cross( vN, vSigmaX );215+ float fDet = dot( vSigmaX, R1 ) * faceDirection;216+ vec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );217+ return normalize( abs( fDet ) * surf_norm - vGrad );218+ }219+#endif`,Sue=`#if NUM_CLIPPING_PLANES > 0220+ vec4 plane;221+ #ifdef ALPHA_TO_COVERAGE222+ float distanceToPlane, distanceGradient;223+ float clipOpacity = 1.0;224+ #pragma unroll_loop_start225+ for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {226+ plane = clippingPlanes[ i ];227+ distanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w;228+ distanceGradient = fwidth( distanceToPlane ) / 2.0;229+ clipOpacity *= smoothstep( - distanceGradient, distanceGradient, distanceToPlane );230+ if ( clipOpacity == 0.0 ) discard;231+ }232+ #pragma unroll_loop_end233+ #if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES234+ float unionClipOpacity = 1.0;235+ #pragma unroll_loop_start236+ for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {237+ plane = clippingPlanes[ i ];238+ distanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w;239+ distanceGradient = fwidth( distanceToPlane ) / 2.0;240+ unionClipOpacity *= 1.0 - smoothstep( - distanceGradient, distanceGradient, distanceToPlane );241+ }242+ #pragma unroll_loop_end243+ clipOpacity *= 1.0 - unionClipOpacity;244+ #endif245+ diffuseColor.a *= clipOpacity;246+ if ( diffuseColor.a == 0.0 ) discard;247+ #else248+ #pragma unroll_loop_start249+ for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {250+ plane = clippingPlanes[ i ];251+ if ( dot( vClipPosition, plane.xyz ) > plane.w ) discard;252+ }253+ #pragma unroll_loop_end254+ #if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES255+ bool clipped = true;256+ #pragma unroll_loop_start257+ for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {258+ plane = clippingPlanes[ i ];259+ clipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped;260+ }261+ #pragma unroll_loop_end262+ if ( clipped ) discard;263+ #endif264+ #endif265+#endif`,Tue=`#if NUM_CLIPPING_PLANES > 0266+ varying vec3 vClipPosition;267+ uniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];268+#endif`,Eue=`#if NUM_CLIPPING_PLANES > 0269+ varying vec3 vClipPosition;270+#endif`,Mue=`#if NUM_CLIPPING_PLANES > 0271+ vClipPosition = - mvPosition.xyz;272+#endif`,Cue=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA )273+ diffuseColor *= vColor;274+#endif`,Rue=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA )275+ varying vec4 vColor;276+#endif`,Pue=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )277+ varying vec4 vColor;278+#endif`,Iue=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )279+ vColor = vec4( 1.0 );280+#endif281+#ifdef USE_COLOR_ALPHA282+ vColor *= color;283+#elif defined( USE_COLOR )284+ vColor.rgb *= color;285+#endif286+#ifdef USE_INSTANCING_COLOR287+ vColor.rgb *= instanceColor.rgb;288+#endif289+#ifdef USE_BATCHING_COLOR290+ vColor *= getBatchingColor( getIndirectIndex( gl_DrawID ) );291+#endif`,Nue=`#define PI 3.141592653589793292+#define PI2 6.283185307179586293+#define PI_HALF 1.5707963267948966294+#define RECIPROCAL_PI 0.3183098861837907295+#define RECIPROCAL_PI2 0.15915494309189535296+#define EPSILON 1e-6297+#ifndef saturate298+#define saturate( a ) clamp( a, 0.0, 1.0 )299+#endif300+#define whiteComplement( a ) ( 1.0 - saturate( a ) )301+float pow2( const in float x ) { return x*x; }302+vec3 pow2( const in vec3 x ) { return x*x; }303+float pow3( const in float x ) { return x*x*x; }304+float pow4( const in float x ) { float x2 = x*x; return x2*x2; }305+float max3( const in vec3 v ) { return max( max( v.x, v.y ), v.z ); }306+float average( const in vec3 v ) { return dot( v, vec3( 0.3333333 ) ); }307+highp float rand( const in vec2 uv ) {308+ const highp float a = 12.9898, b = 78.233, c = 43758.5453;309+ highp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );310+ return fract( sin( sn ) * c );311+}312+#ifdef HIGH_PRECISION313+ float precisionSafeLength( vec3 v ) { return length( v ); }314+#else315+ float precisionSafeLength( vec3 v ) {316+ float maxComponent = max3( abs( v ) );317+ return length( v / maxComponent ) * maxComponent;318+ }319+#endif320+struct IncidentLight {321+ vec3 color;322+ vec3 direction;323+ bool visible;324+};325+struct ReflectedLight {326+ vec3 directDiffuse;327+ vec3 directSpecular;328+ vec3 indirectDiffuse;329+ vec3 indirectSpecular;330+};331+#ifdef USE_ALPHAHASH332+ varying vec3 vPosition;333+#endif334+vec3 transformDirection( in vec3 dir, in mat4 matrix ) {335+ return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );336+}337+#define inverseTransformDirection transformDirectionByInverseViewMatrix338+vec3 transformNormalByInverseViewMatrix( in vec3 normal, in mat4 viewMatrix ) {339+ return normalize( ( vec4( normal, 0.0 ) * viewMatrix ).xyz );340+}341+vec3 transformDirectionByInverseViewMatrix( in vec3 dir, in mat4 viewMatrix ) {342+ return normalize( ( vec4( dir, 0.0 ) * viewMatrix ).xyz );343+}344+bool isPerspectiveMatrix( mat4 m ) {345+ return m[ 2 ][ 3 ] == - 1.0;346+}347+vec2 equirectUv( in vec3 dir ) {348+ float u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5;349+ float v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;350+ return vec2( u, v );351+}352+vec3 BRDF_Lambert( const in vec3 diffuseColor ) {353+ return RECIPROCAL_PI * diffuseColor;354+}355+vec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) {356+ float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );357+ return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );358+}359+float F_Schlick( const in float f0, const in float f90, const in float dotVH ) {360+ float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );361+ return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );362+} // validated`,Lue=`#ifdef ENVMAP_TYPE_CUBE_UV363+ #define cubeUV_minMipLevel 4.0364+ #define cubeUV_minTileSize 16.0365+ float getFace( vec3 direction ) {366+ vec3 absDirection = abs( direction );367+ float face = - 1.0;368+ if ( absDirection.x > absDirection.z ) {369+ if ( absDirection.x > absDirection.y )370+ face = direction.x > 0.0 ? 0.0 : 3.0;371+ else372+ face = direction.y > 0.0 ? 1.0 : 4.0;373+ } else {374+ if ( absDirection.z > absDirection.y )375+ face = direction.z > 0.0 ? 2.0 : 5.0;376+ else377+ face = direction.y > 0.0 ? 1.0 : 4.0;378+ }379+ return face;380+ }381+ vec2 getUV( vec3 direction, float face ) {382+ vec2 uv;383+ if ( face == 0.0 ) {384+ uv = vec2( direction.z, direction.y ) / abs( direction.x );385+ } else if ( face == 1.0 ) {386+ uv = vec2( - direction.x, - direction.z ) / abs( direction.y );387+ } else if ( face == 2.0 ) {388+ uv = vec2( - direction.x, direction.y ) / abs( direction.z );389+ } else if ( face == 3.0 ) {390+ uv = vec2( - direction.z, direction.y ) / abs( direction.x );391+ } else if ( face == 4.0 ) {392+ uv = vec2( - direction.x, direction.z ) / abs( direction.y );393+ } else {394+ uv = vec2( direction.x, direction.y ) / abs( direction.z );395+ }396+ return 0.5 * ( uv + 1.0 );397+ }398+ vec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) {399+ float face = getFace( direction );400+ float filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 );401+ mipInt = max( mipInt, cubeUV_minMipLevel );402+ float faceSize = exp2( mipInt );403+ highp vec2 uv = getUV( direction, face ) * ( faceSize - 2.0 ) + 1.0;404+ if ( face > 2.0 ) {405+ uv.y += faceSize;406+ face -= 3.0;407+ }408+ uv.x += face * faceSize;409+ uv.x += filterInt * 3.0 * cubeUV_minTileSize;410+ uv.y += 4.0 * ( exp2( CUBEUV_MAX_MIP ) - faceSize );411+ uv.x *= CUBEUV_TEXEL_WIDTH;412+ uv.y *= CUBEUV_TEXEL_HEIGHT;413+ #ifdef texture2DGradEXT414+ return texture2DGradEXT( envMap, uv, vec2( 0.0 ), vec2( 0.0 ) ).rgb;415+ #else416+ return texture2D( envMap, uv ).rgb;417+ #endif418+ }419+ #define cubeUV_r0 1.0420+ #define cubeUV_m0 - 2.0421+ #define cubeUV_r1 0.8422+ #define cubeUV_m1 - 1.0423+ #define cubeUV_r4 0.4424+ #define cubeUV_m4 2.0425+ #define cubeUV_r5 0.305426+ #define cubeUV_m5 3.0427+ #define cubeUV_r6 0.21428+ #define cubeUV_m6 4.0429+ float roughnessToMip( float roughness ) {430+ float mip = 0.0;431+ if ( roughness >= cubeUV_r1 ) {432+ mip = ( cubeUV_r0 - roughness ) * ( cubeUV_m1 - cubeUV_m0 ) / ( cubeUV_r0 - cubeUV_r1 ) + cubeUV_m0;433+ } else if ( roughness >= cubeUV_r4 ) {434+ mip = ( cubeUV_r1 - roughness ) * ( cubeUV_m4 - cubeUV_m1 ) / ( cubeUV_r1 - cubeUV_r4 ) + cubeUV_m1;435+ } else if ( roughness >= cubeUV_r5 ) {436+ mip = ( cubeUV_r4 - roughness ) * ( cubeUV_m5 - cubeUV_m4 ) / ( cubeUV_r4 - cubeUV_r5 ) + cubeUV_m4;437+ } else if ( roughness >= cubeUV_r6 ) {438+ mip = ( cubeUV_r5 - roughness ) * ( cubeUV_m6 - cubeUV_m5 ) / ( cubeUV_r5 - cubeUV_r6 ) + cubeUV_m5;439+ } else {440+ mip = - 2.0 * log2( 1.16 * roughness ); }441+ return mip;442+ }443+ vec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) {444+ float mip = clamp( roughnessToMip( roughness ), cubeUV_m0, CUBEUV_MAX_MIP );445+ float mipF = fract( mip );446+ float mipInt = floor( mip );447+ vec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt );448+ if ( mipF == 0.0 ) {449+ return vec4( color0, 1.0 );450+ } else {451+ vec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 );452+ return vec4( mix( color0, color1, mipF ), 1.0 );453+ }454+ }455+#endif`,Due=`vec3 transformedNormal = objectNormal;456+#ifdef USE_TANGENT457+ vec3 transformedTangent = objectTangent;458+#endif459+#ifdef USE_BATCHING460+ mat3 bm = mat3( batchingMatrix );461+ transformedNormal /= vec3( dot( bm[ 0 ], bm[ 0 ] ), dot( bm[ 1 ], bm[ 1 ] ), dot( bm[ 2 ], bm[ 2 ] ) );462+ transformedNormal = bm * transformedNormal;463+ #ifdef USE_TANGENT464+ transformedTangent = bm * transformedTangent;465+ #endif466+#endif467+#ifdef USE_INSTANCING468+ mat3 im = mat3( instanceMatrix );469+ transformedNormal /= vec3( dot( im[ 0 ], im[ 0 ] ), dot( im[ 1 ], im[ 1 ] ), dot( im[ 2 ], im[ 2 ] ) );470+ transformedNormal = im * transformedNormal;471+ #ifdef USE_TANGENT472+ transformedTangent = im * transformedTangent;473+ #endif474+#endif475+transformedNormal = normalMatrix * transformedNormal;476+#ifdef FLIP_SIDED477+ transformedNormal = - transformedNormal;478+#endif479+#ifdef USE_TANGENT480+ transformedTangent = ( modelViewMatrix * vec4( transformedTangent, 0.0 ) ).xyz;481+#endif`,Fue=`#ifdef USE_DISPLACEMENTMAP482+ uniform sampler2D displacementMap;483+ uniform float displacementScale;484+ uniform float displacementBias;485+#endif`,Oue=`#ifdef USE_DISPLACEMENTMAP486+ transformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + displacementBias );487+#endif`,Bue=`#ifdef USE_EMISSIVEMAP488+ vec4 emissiveColor = texture2D( emissiveMap, vEmissiveMapUv );489+ #ifdef DECODE_VIDEO_TEXTURE_EMISSIVE490+ emissiveColor = sRGBTransferEOTF( emissiveColor );491+ #endif492+ totalEmissiveRadiance *= emissiveColor.rgb;493+#endif`,Uue=`#ifdef USE_EMISSIVEMAP494+ uniform sampler2D emissiveMap;495+#endif`,kue="gl_FragColor = linearToOutputTexel( gl_FragColor );",Gue=`vec4 LinearTransferOETF( in vec4 value ) {496+ return value;497+}498+vec4 sRGBTransferEOTF( in vec4 value ) {499+ return vec4( mix( pow( value.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), value.rgb * 0.0773993808, vec3( lessThanEqual( value.rgb, vec3( 0.04045 ) ) ) ), value.a );500+}501+vec4 sRGBTransferOETF( in vec4 value ) {502+ return vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.a );503+}`,zue=`#ifdef USE_ENVMAP504+ #ifdef ENV_WORLDPOS505+ vec3 cameraToFrag;506+ if ( isOrthographic ) {507+ cameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );508+ } else {509+ cameraToFrag = normalize( vWorldPosition - cameraPosition );510+ }511+ vec3 worldNormal = transformNormalByInverseViewMatrix( normal, viewMatrix );512+ #ifdef ENVMAP_MODE_REFLECTION513+ vec3 reflectVec = reflect( cameraToFrag, worldNormal );514+ #else515+ vec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio );516+ #endif517+ #else518+ vec3 reflectVec = vReflect;519+ #endif520+ #ifdef ENVMAP_TYPE_CUBE521+ vec4 envColor = textureCube( envMap, envMapRotation * reflectVec );522+ #ifdef ENVMAP_BLENDING_MULTIPLY523+ outgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );524+ #elif defined( ENVMAP_BLENDING_MIX )525+ outgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );526+ #elif defined( ENVMAP_BLENDING_ADD )527+ outgoingLight += envColor.xyz * specularStrength * reflectivity;528+ #endif529+ #endif530+#endif`,Vue=`#ifdef USE_ENVMAP531+ uniform float envMapIntensity;532+ uniform mat3 envMapRotation;533+ #ifdef ENVMAP_TYPE_CUBE534+ uniform samplerCube envMap;535+ #else536+ uniform sampler2D envMap;537+ #endif538+#endif`,que=`#ifdef USE_ENVMAP539+ uniform float reflectivity;540+ #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )541+ #define ENV_WORLDPOS542+ #endif543+ #ifdef ENV_WORLDPOS544+ varying vec3 vWorldPosition;545+ uniform float refractionRatio;546+ #else547+ varying vec3 vReflect;548+ #endif549+#endif`,Hue=`#ifdef USE_ENVMAP550+ #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )551+ #define ENV_WORLDPOS552+ #endif553+ #ifdef ENV_WORLDPOS554+ 555+ varying vec3 vWorldPosition;556+ #else557+ varying vec3 vReflect;558+ uniform float refractionRatio;559+ #endif560+#endif`,Wue=`#ifdef USE_ENVMAP561+ #ifdef ENV_WORLDPOS562+ vWorldPosition = worldPosition.xyz;563+ #else564+ vec3 cameraToVertex;565+ if ( isOrthographic ) {566+ cameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );567+ } else {568+ cameraToVertex = normalize( worldPosition.xyz - cameraPosition );569+ }570+ vec3 worldNormal = transformNormalByInverseViewMatrix( transformedNormal, viewMatrix );571+ #ifdef ENVMAP_MODE_REFLECTION572+ vReflect = reflect( cameraToVertex, worldNormal );573+ #else574+ vReflect = refract( cameraToVertex, worldNormal, refractionRatio );575+ #endif576+ #endif577+#endif`,jue=`#ifdef USE_FOG578+ vFogDepth = - mvPosition.z;579+#endif`,Xue=`#ifdef USE_FOG580+ varying float vFogDepth;581+#endif`,$ue=`#ifdef USE_FOG582+ #ifdef FOG_EXP2583+ float fogFactor = 1.0 - exp( - fogDensity * fogDensity * vFogDepth * vFogDepth );584+ #else585+ float fogFactor = smoothstep( fogNear, fogFar, vFogDepth );586+ #endif587+ gl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );588+#endif`,Yue=`#ifdef USE_FOG589+ uniform vec3 fogColor;590+ varying float vFogDepth;591+ #ifdef FOG_EXP2592+ uniform float fogDensity;593+ #else594+ uniform float fogNear;595+ uniform float fogFar;596+ #endif597+#endif`,Zue=`#ifdef USE_GRADIENTMAP598+ uniform sampler2D gradientMap;599+#endif600+vec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {601+ float dotNL = dot( normal, lightDirection );602+ vec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 );603+ #ifdef USE_GRADIENTMAP604+ return vec3( texture2D( gradientMap, coord ).r );605+ #else606+ vec2 fw = fwidth( coord ) * 0.5;607+ return mix( vec3( 0.7 ), vec3( 1.0 ), smoothstep( 0.7 - fw.x, 0.7 + fw.x, coord.x ) );608+ #endif609+}`,Kue=`#ifdef USE_LIGHTMAP610+ uniform sampler2D lightMap;611+ uniform float lightMapIntensity;612+#endif`,Que=`LambertMaterial material;613+material.diffuseColor = diffuseColor.rgb;614+material.specularStrength = specularStrength;`,Jue=`varying vec3 vViewPosition;615+struct LambertMaterial {616+ vec3 diffuseColor;617+ float specularStrength;618+};619+void RE_Direct_Lambert( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) {620+ float dotNL = saturate( dot( geometryNormal, directLight.direction ) );621+ vec3 irradiance = dotNL * directLight.color;622+ reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );623+}624+void RE_IndirectDiffuse_Lambert( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) {625+ reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );626+}627+#define RE_Direct RE_Direct_Lambert628+#define RE_IndirectDiffuse RE_IndirectDiffuse_Lambert`,ehe=`uniform bool receiveShadow;629+uniform vec3 ambientLightColor;630+#if defined( USE_LIGHT_PROBES )631+ uniform vec3 lightProbe[ 9 ];632+#endif633+vec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) {634+ float x = normal.x, y = normal.y, z = normal.z;635+ vec3 result = shCoefficients[ 0 ] * 0.886227;636+ result += shCoefficients[ 1 ] * 2.0 * 0.511664 * y;637+ result += shCoefficients[ 2 ] * 2.0 * 0.511664 * z;638+ result += shCoefficients[ 3 ] * 2.0 * 0.511664 * x;639+ result += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y;640+ result += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z;641+ result += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 );642+ result += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z;643+ result += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y );644+ return result;645+}646+vec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in vec3 normal ) {647+ vec3 worldNormal = transformNormalByInverseViewMatrix( normal, viewMatrix );648+ vec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe );649+ return irradiance;650+}651+vec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {652+ vec3 irradiance = ambientLightColor;653+ return irradiance;654+}655+float getDistanceAttenuation( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {656+ float distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );657+ if ( cutoffDistance > 0.0 ) {658+ distanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );659+ }660+ return distanceFalloff;661+}662+float getSpotAttenuation( const in float coneCosine, const in float penumbraCosine, const in float angleCosine ) {663+ return smoothstep( coneCosine, penumbraCosine, angleCosine );664+}665+#if NUM_DIR_LIGHTS > 0666+ struct DirectionalLight {667+ vec3 direction;668+ vec3 color;669+ };670+ uniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];671+ void getDirectionalLightInfo( const in DirectionalLight directionalLight, out IncidentLight light ) {672+ light.color = directionalLight.color;673+ light.direction = directionalLight.direction;674+ light.visible = true;675+ }676+#endif677+#if NUM_POINT_LIGHTS > 0678+ struct PointLight {679+ vec3 position;680+ vec3 color;681+ float distance;682+ float decay;683+ };684+ uniform PointLight pointLights[ NUM_POINT_LIGHTS ];685+ void getPointLightInfo( const in PointLight pointLight, const in vec3 geometryPosition, out IncidentLight light ) {686+ vec3 lVector = pointLight.position - geometryPosition;687+ light.direction = normalize( lVector );688+ float lightDistance = length( lVector );689+ light.color = pointLight.color;690+ light.color *= getDistanceAttenuation( lightDistance, pointLight.distance, pointLight.decay );691+ light.visible = ( light.color != vec3( 0.0 ) );692+ }693+#endif694+#if NUM_SPOT_LIGHTS > 0695+ struct SpotLight {696+ vec3 position;697+ vec3 direction;698+ vec3 color;699+ float distance;700+ float decay;701+ float coneCos;702+ float penumbraCos;703+ };704+ uniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];705+ void getSpotLightInfo( const in SpotLight spotLight, const in vec3 geometryPosition, out IncidentLight light ) {706+ vec3 lVector = spotLight.position - geometryPosition;707+ light.direction = normalize( lVector );708+ float angleCos = dot( light.direction, spotLight.direction );709+ float spotAttenuation = getSpotAttenuation( spotLight.coneCos, spotLight.penumbraCos, angleCos );710+ if ( spotAttenuation > 0.0 ) {711+ float lightDistance = length( lVector );712+ light.color = spotLight.color * spotAttenuation;713+ light.color *= getDistanceAttenuation( lightDistance, spotLight.distance, spotLight.decay );714+ light.visible = ( light.color != vec3( 0.0 ) );715+ } else {716+ light.color = vec3( 0.0 );717+ light.visible = false;718+ }719+ }720+#endif721+#if NUM_RECT_AREA_LIGHTS > 0722+ struct RectAreaLight {723+ vec3 color;724+ vec3 position;725+ vec3 halfWidth;726+ vec3 halfHeight;727+ };728+ uniform sampler2D ltc_1; uniform sampler2D ltc_2;729+ uniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ];730+#endif731+#if NUM_HEMI_LIGHTS > 0732+ struct HemisphereLight {733+ vec3 direction;734+ vec3 skyColor;735+ vec3 groundColor;736+ };737+ uniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];738+ vec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in vec3 normal ) {739+ float dotNL = dot( normal, hemiLight.direction );740+ float hemiDiffuseWeight = 0.5 * dotNL + 0.5;741+ vec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );742+ return irradiance;743+ }744+#endif745+#include <lightprobes_pars_fragment>`,the=`#ifdef USE_ENVMAP746+ vec3 getIBLIrradiance( const in vec3 normal ) {747+ #ifdef ENVMAP_TYPE_CUBE_UV748+ vec3 worldNormal = transformNormalByInverseViewMatrix( normal, viewMatrix );749+ vec4 envMapColor = textureCubeUV( envMap, envMapRotation * worldNormal, 1.0 );750+ return PI * envMapColor.rgb * envMapIntensity;751+ #else752+ return vec3( 0.0 );753+ #endif754+ }755+ vec3 getIBLRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness ) {756+ #ifdef ENVMAP_TYPE_CUBE_UV757+ vec3 reflectVec = reflect( - viewDir, normal );758+ reflectVec = normalize( mix( reflectVec, normal, pow4( roughness ) ) );759+ reflectVec = transformDirectionByInverseViewMatrix( reflectVec, viewMatrix );760+ vec4 envMapColor = textureCubeUV( envMap, envMapRotation * reflectVec, roughness );761+ return envMapColor.rgb * envMapIntensity;762+ #else763+ return vec3( 0.0 );764+ #endif765+ }766+ #ifdef USE_ANISOTROPY767+ vec3 getIBLAnisotropyRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness, const in vec3 bitangent, const in float anisotropy ) {768+ #ifdef ENVMAP_TYPE_CUBE_UV769+ vec3 bentNormal = cross( bitangent, viewDir );770+ bentNormal = normalize( cross( bentNormal, bitangent ) );771+ bentNormal = normalize( mix( bentNormal, normal, pow2( pow2( 1.0 - anisotropy * ( 1.0 - roughness ) ) ) ) );772+ return getIBLRadiance( viewDir, bentNormal, roughness );773+ #else774+ return vec3( 0.0 );775+ #endif776+ }777+ #endif778+#endif`,nhe=`ToonMaterial material;779+material.diffuseColor = diffuseColor.rgb;`,ihe=`varying vec3 vViewPosition;780+struct ToonMaterial {781+ vec3 diffuseColor;782+};783+void RE_Direct_Toon( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {784+ vec3 irradiance = getGradientIrradiance( geometryNormal, directLight.direction ) * directLight.color;785+ reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );786+}787+void RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {788+ reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );789+}790+#define RE_Direct RE_Direct_Toon791+#define RE_IndirectDiffuse RE_IndirectDiffuse_Toon`,rhe=`BlinnPhongMaterial material;792+material.diffuseColor = diffuseColor.rgb;793+material.specularColor = specular;794+material.specularShininess = shininess;795+material.specularStrength = specularStrength;`,she=`varying vec3 vViewPosition;796+struct BlinnPhongMaterial {797+ vec3 diffuseColor;798+ vec3 specularColor;799+ float specularShininess;800+ float specularStrength;801+};802+void RE_Direct_BlinnPhong( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {803+ float dotNL = saturate( dot( geometryNormal, directLight.direction ) );804+ vec3 irradiance = dotNL * directLight.color;805+ reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );806+ reflectedLight.directSpecular += irradiance * BRDF_BlinnPhong( directLight.direction, geometryViewDir, geometryNormal, material.specularColor, material.specularShininess ) * material.specularStrength;807+}808+void RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {809+ reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );810+}811+#define RE_Direct RE_Direct_BlinnPhong812+#define RE_IndirectDiffuse RE_IndirectDiffuse_BlinnPhong`,ohe=`PhysicalMaterial material;813+material.diffuseColor = diffuseColor.rgb;814+material.diffuseContribution = diffuseColor.rgb * ( 1.0 - metalnessFactor );815+material.metalness = metalnessFactor;816+vec3 dxy = max( abs( dFdx( nonPerturbedNormal ) ), abs( dFdy( nonPerturbedNormal ) ) );817+float geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );818+material.roughness = max( roughnessFactor, 0.0525 );material.roughness += geometryRoughness;819+material.roughness = min( material.roughness, 1.0 );820+#ifdef IOR821+ material.ior = ior;822+ #ifdef USE_SPECULAR823+ float specularIntensityFactor = specularIntensity;824+ vec3 specularColorFactor = specularColor;825+ #ifdef USE_SPECULAR_COLORMAP826+ specularColorFactor *= texture2D( specularColorMap, vSpecularColorMapUv ).rgb;827+ #endif828+ #ifdef USE_SPECULAR_INTENSITYMAP829+ specularIntensityFactor *= texture2D( specularIntensityMap, vSpecularIntensityMapUv ).a;830+ #endif831+ material.specularF90 = mix( specularIntensityFactor, 1.0, metalnessFactor );832+ #else833+ float specularIntensityFactor = 1.0;834+ vec3 specularColorFactor = vec3( 1.0 );835+ material.specularF90 = 1.0;836+ #endif837+ material.specularColor = min( pow2( ( material.ior - 1.0 ) / ( material.ior + 1.0 ) ) * specularColorFactor, vec3( 1.0 ) ) * specularIntensityFactor;838+ material.specularColorBlended = mix( material.specularColor, diffuseColor.rgb, metalnessFactor );839+#else840+ material.specularColor = vec3( 0.04 );841+ material.specularColorBlended = mix( material.specularColor, diffuseColor.rgb, metalnessFactor );842+ material.specularF90 = 1.0;843+#endif844+#ifdef USE_CLEARCOAT845+ material.clearcoat = clearcoat;846+ material.clearcoatRoughness = clearcoatRoughness;847+ material.clearcoatF0 = vec3( 0.04 );848+ material.clearcoatF90 = 1.0;849+ #ifdef USE_CLEARCOATMAP850+ material.clearcoat *= texture2D( clearcoatMap, vClearcoatMapUv ).x;851+ #endif852+ #ifdef USE_CLEARCOAT_ROUGHNESSMAP853+ material.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vClearcoatRoughnessMapUv ).y;854+ #endif855+ material.clearcoat = saturate( material.clearcoat ); material.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 );856+ material.clearcoatRoughness += geometryRoughness;857+ material.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 );858+#endif859+#ifdef USE_DISPERSION860+ material.dispersion = dispersion;861+#endif862+#ifdef USE_IRIDESCENCE863+ material.iridescence = iridescence;864+ material.iridescenceIOR = iridescenceIOR;865+ #ifdef USE_IRIDESCENCEMAP866+ material.iridescence *= texture2D( iridescenceMap, vIridescenceMapUv ).r;867+ #endif868+ #ifdef USE_IRIDESCENCE_THICKNESSMAP869+ material.iridescenceThickness = (iridescenceThicknessMaximum - iridescenceThicknessMinimum) * texture2D( iridescenceThicknessMap, vIridescenceThicknessMapUv ).g + iridescenceThicknessMinimum;870+ #else871+ material.iridescenceThickness = iridescenceThicknessMaximum;872+ #endif873+#endif874+#ifdef USE_SHEEN875+ material.sheenColor = sheenColor;876+ #ifdef USE_SHEEN_COLORMAP877+ material.sheenColor *= texture2D( sheenColorMap, vSheenColorMapUv ).rgb;878+ #endif879+ material.sheenRoughness = clamp( sheenRoughness, 0.0001, 1.0 );880+ #ifdef USE_SHEEN_ROUGHNESSMAP881+ material.sheenRoughness *= texture2D( sheenRoughnessMap, vSheenRoughnessMapUv ).a;882+ #endif883+#endif884+#ifdef USE_ANISOTROPY885+ #ifdef USE_ANISOTROPYMAP886+ mat2 anisotropyMat = mat2( anisotropyVector.x, anisotropyVector.y, - anisotropyVector.y, anisotropyVector.x );887+ vec3 anisotropyPolar = texture2D( anisotropyMap, vAnisotropyMapUv ).rgb;888+ vec2 anisotropyV = anisotropyMat * normalize( 2.0 * anisotropyPolar.rg - vec2( 1.0 ) ) * anisotropyPolar.b;889+ #else890+ vec2 anisotropyV = anisotropyVector;891+ #endif892+ material.anisotropy = length( anisotropyV );893+ if( material.anisotropy == 0.0 ) {894+ anisotropyV = vec2( 1.0, 0.0 );895+ } else {896+ anisotropyV /= material.anisotropy;897+ material.anisotropy = saturate( material.anisotropy );898+ }899+ material.alphaT = mix( pow2( material.roughness ), 1.0, pow2( material.anisotropy ) );900+ material.anisotropyT = tbn[ 0 ] * anisotropyV.x + tbn[ 1 ] * anisotropyV.y;901+ material.anisotropyB = tbn[ 1 ] * anisotropyV.x - tbn[ 0 ] * anisotropyV.y;902+#endif`,ahe=`uniform sampler2D dfgLUT;903+struct PhysicalMaterial {904+ vec3 diffuseColor;905+ vec3 diffuseContribution;906+ vec3 specularColor;907+ vec3 specularColorBlended;908+ float roughness;909+ float metalness;910+ float specularF90;911+ float dispersion;912+ #ifdef USE_CLEARCOAT913+ float clearcoat;914+ float clearcoatRoughness;915+ vec3 clearcoatF0;916+ float clearcoatF90;917+ #endif918+ #ifdef USE_IRIDESCENCE919+ float iridescence;920+ float iridescenceIOR;921+ float iridescenceThickness;922+ vec3 iridescenceFresnel;923+ vec3 iridescenceF0;924+ vec3 iridescenceFresnelDielectric;925+ vec3 iridescenceFresnelMetallic;926+ #endif927+ #ifdef USE_SHEEN928+ vec3 sheenColor;929+ float sheenRoughness;930+ #endif931+ #ifdef IOR932+ float ior;933+ #endif934+ #ifdef USE_TRANSMISSION935+ float transmission;936+ float transmissionAlpha;937+ float thickness;938+ float attenuationDistance;939+ vec3 attenuationColor;940+ #endif941+ #ifdef USE_ANISOTROPY942+ float anisotropy;943+ float alphaT;944+ vec3 anisotropyT;945+ vec3 anisotropyB;946+ #endif947+};948+vec3 clearcoatSpecularDirect = vec3( 0.0 );949+vec3 clearcoatSpecularIndirect = vec3( 0.0 );950+vec3 sheenSpecularDirect = vec3( 0.0 );951+vec3 sheenSpecularIndirect = vec3(0.0 );952+vec3 Schlick_to_F0( const in vec3 f, const in float f90, const in float dotVH ) {953+ float x = clamp( 1.0 - dotVH, 0.0, 1.0 );954+ float x2 = x * x;955+ float x5 = clamp( x * x2 * x2, 0.0, 0.9999 );956+ return ( f - vec3( f90 ) * x5 ) / ( 1.0 - x5 );957+}958+float V_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {959+ float a2 = pow2( alpha );960+ float gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );961+ float gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );962+ return 0.5 / max( gv + gl, EPSILON );963+}964+float D_GGX( const in float alpha, const in float dotNH ) {965+ float a2 = pow2( alpha );966+ float denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;967+ return RECIPROCAL_PI * a2 / pow2( denom );968+}969+#ifdef USE_ANISOTROPY970+ float V_GGX_SmithCorrelated_Anisotropic( const in float alphaT, const in float alphaB, const in float dotTV, const in float dotBV, const in float dotTL, const in float dotBL, const in float dotNV, const in float dotNL ) {971+ float gv = dotNL * length( vec3( alphaT * dotTV, alphaB * dotBV, dotNV ) );972+ float gl = dotNV * length( vec3( alphaT * dotTL, alphaB * dotBL, dotNL ) );973+ return 0.5 / max( gv + gl, EPSILON );974+ }975+ float D_GGX_Anisotropic( const in float alphaT, const in float alphaB, const in float dotNH, const in float dotTH, const in float dotBH ) {976+ float a2 = alphaT * alphaB;977+ highp vec3 v = vec3( alphaB * dotTH, alphaT * dotBH, a2 * dotNH );978+ highp float v2 = dot( v, v );979+ float w2 = a2 / v2;980+ return RECIPROCAL_PI * a2 * pow2 ( w2 );981+ }982+#endif983+#ifdef USE_CLEARCOAT984+ vec3 BRDF_GGX_Clearcoat( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material) {985+ vec3 f0 = material.clearcoatF0;986+ float f90 = material.clearcoatF90;987+ float roughness = material.clearcoatRoughness;988+ float alpha = pow2( roughness );989+ vec3 halfDir = normalize( lightDir + viewDir );990+ float dotNL = saturate( dot( normal, lightDir ) );991+ float dotNV = saturate( dot( normal, viewDir ) );992+ float dotNH = saturate( dot( normal, halfDir ) );993+ float dotVH = saturate( dot( viewDir, halfDir ) );994+ vec3 F = F_Schlick( f0, f90, dotVH );995+ float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );996+ float D = D_GGX( alpha, dotNH );997+ return F * ( V * D );998+ }999+#endif1000+vec3 BRDF_GGX( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) {1001+ vec3 f0 = material.specularColorBlended;1002+ float f90 = material.specularF90;1003+ float roughness = material.roughness;1004+ float alpha = pow2( roughness );1005+ vec3 halfDir = normalize( lightDir + viewDir );1006+ float dotNL = saturate( dot( normal, lightDir ) );1007+ float dotNV = saturate( dot( normal, viewDir ) );1008+ float dotNH = saturate( dot( normal, halfDir ) );1009+ float dotVH = saturate( dot( viewDir, halfDir ) );1010+ vec3 F = F_Schlick( f0, f90, dotVH );1011+ #ifdef USE_IRIDESCENCE1012+ F = mix( F, material.iridescenceFresnel, material.iridescence );1013+ #endif1014+ #ifdef USE_ANISOTROPY1015+ float dotTL = dot( material.anisotropyT, lightDir );1016+ float dotTV = dot( material.anisotropyT, viewDir );1017+ float dotTH = dot( material.anisotropyT, halfDir );1018+ float dotBL = dot( material.anisotropyB, lightDir );1019+ float dotBV = dot( material.anisotropyB, viewDir );1020+ float dotBH = dot( material.anisotropyB, halfDir );1021+ float V = V_GGX_SmithCorrelated_Anisotropic( material.alphaT, alpha, dotTV, dotBV, dotTL, dotBL, dotNV, dotNL );1022+ float D = D_GGX_Anisotropic( material.alphaT, alpha, dotNH, dotTH, dotBH );1023+ #else1024+ float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );1025+ float D = D_GGX( alpha, dotNH );1026+ #endif1027+ return F * ( V * D );1028+}1029+vec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) {1030+ const float LUT_SIZE = 64.0;1031+ const float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;1032+ const float LUT_BIAS = 0.5 / LUT_SIZE;1033+ float dotNV = saturate( dot( N, V ) );1034+ vec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) );1035+ uv = uv * LUT_SCALE + LUT_BIAS;1036+ return uv;1037+}1038+float LTC_ClippedSphereFormFactor( const in vec3 f ) {1039+ float l = length( f );1040+ return max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 );1041+}1042+vec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) {1043+ float x = dot( v1, v2 );1044+ float y = abs( x );1045+ float a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y;1046+ float b = 3.4175940 + ( 4.1616724 + y ) * y;1047+ float v = a / b;1048+ float theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v;1049+ return cross( v1, v2 ) * theta_sintheta;1050+}1051+vec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) {1052+ vec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ];1053+ vec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ];1054+ vec3 lightNormal = cross( v1, v2 );1055+ if( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 );1056+ vec3 T1, T2;1057+ T1 = normalize( V - N * dot( V, N ) );1058+ T2 = - cross( N, T1 );1059+ mat3 mat = mInv * transpose( mat3( T1, T2, N ) );1060+ vec3 coords[ 4 ];1061+ coords[ 0 ] = mat * ( rectCoords[ 0 ] - P );1062+ coords[ 1 ] = mat * ( rectCoords[ 1 ] - P );1063+ coords[ 2 ] = mat * ( rectCoords[ 2 ] - P );1064+ coords[ 3 ] = mat * ( rectCoords[ 3 ] - P );1065+ coords[ 0 ] = normalize( coords[ 0 ] );1066+ coords[ 1 ] = normalize( coords[ 1 ] );1067+ coords[ 2 ] = normalize( coords[ 2 ] );1068+ coords[ 3 ] = normalize( coords[ 3 ] );1069+ vec3 vectorFormFactor = vec3( 0.0 );1070+ vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] );1071+ vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] );1072+ vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] );1073+ vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] );1074+ float result = LTC_ClippedSphereFormFactor( vectorFormFactor );1075+ return vec3( result );1076+}1077+#if defined( USE_SHEEN )1078+float D_Charlie( float roughness, float dotNH ) {1079+ float alpha = pow2( roughness );1080+ float invAlpha = 1.0 / alpha;1081+ float cos2h = dotNH * dotNH;1082+ float sin2h = max( 1.0 - cos2h, 0.0078125 );1083+ return ( 2.0 + invAlpha ) * pow( sin2h, invAlpha * 0.5 ) / ( 2.0 * PI );1084+}1085+float V_Neubelt( float dotNV, float dotNL ) {1086+ return saturate( 1.0 / ( 4.0 * ( dotNL + dotNV - dotNL * dotNV ) ) );1087+}1088+vec3 BRDF_Sheen( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, vec3 sheenColor, const in float sheenRoughness ) {1089+ vec3 halfDir = normalize( lightDir + viewDir );1090+ float dotNL = saturate( dot( normal, lightDir ) );1091+ float dotNV = saturate( dot( normal, viewDir ) );1092+ float dotNH = saturate( dot( normal, halfDir ) );1093+ float D = D_Charlie( sheenRoughness, dotNH );1094+ float V = V_Neubelt( dotNV, dotNL );1095+ return sheenColor * ( D * V );1096+}1097+#endif1098+float IBLSheenBRDF( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {1099+ float dotNV = saturate( dot( normal, viewDir ) );1100+ float r2 = roughness * roughness;1101+ float rInv = 1.0 / ( roughness + 0.1 );1102+ float a = -1.9362 + 1.0678 * roughness + 0.4573 * r2 - 0.8469 * rInv;1103+ float b = -0.6014 + 0.5538 * roughness - 0.4670 * r2 - 0.1255 * rInv;1104+ float DG = exp( a * dotNV + b );1105+ return saturate( DG );1106+}1107+vec3 EnvironmentBRDF( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness ) {1108+ float dotNV = saturate( dot( normal, viewDir ) );1109+ vec2 fab = texture2D( dfgLUT, vec2( roughness, dotNV ) ).rg;1110+ return specularColor * fab.x + specularF90 * fab.y;1111+}1112+#ifdef USE_IRIDESCENCE1113+void computeMultiscatteringIridescence( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float iridescence, const in vec3 iridescenceF0, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {1114+#else1115+void computeMultiscattering( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {1116+#endif1117+ float dotNV = saturate( dot( normal, viewDir ) );1118+ vec2 fab = texture2D( dfgLUT, vec2( roughness, dotNV ) ).rg;1119+ #ifdef USE_IRIDESCENCE1120+ vec3 Fr = mix( specularColor, iridescenceF0, iridescence );1121+ #else1122+ vec3 Fr = specularColor;1123+ #endif1124+ vec3 FssEss = Fr * fab.x + specularF90 * fab.y;1125+ float Ess = fab.x + fab.y;1126+ float Ems = 1.0 - Ess;1127+ vec3 Favg = Fr + ( 1.0 - Fr ) * 0.047619; vec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg );1128+ singleScatter += FssEss;1129+ multiScatter += Fms * Ems;1130+}1131+vec3 BRDF_GGX_Multiscatter( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) {1132+ vec3 singleScatter = BRDF_GGX( lightDir, viewDir, normal, material );1133+ float dotNL = saturate( dot( normal, lightDir ) );1134+ float dotNV = saturate( dot( normal, viewDir ) );1135+ vec2 dfgV = texture2D( dfgLUT, vec2( material.roughness, dotNV ) ).rg;1136+ vec2 dfgL = texture2D( dfgLUT, vec2( material.roughness, dotNL ) ).rg;1137+ vec3 FssEss_V = material.specularColorBlended * dfgV.x + material.specularF90 * dfgV.y;1138+ vec3 FssEss_L = material.specularColorBlended * dfgL.x + material.specularF90 * dfgL.y;1139+ float Ess_V = dfgV.x + dfgV.y;1140+ float Ess_L = dfgL.x + dfgL.y;1141+ float Ems_V = 1.0 - Ess_V;1142+ float Ems_L = 1.0 - Ess_L;1143+ vec3 Favg = material.specularColorBlended + ( 1.0 - material.specularColorBlended ) * 0.047619;1144+ vec3 Fms = FssEss_V * FssEss_L * Favg / ( 1.0 - Ems_V * Ems_L * Favg + EPSILON );1145+ float compensationFactor = Ems_V * Ems_L;1146+ vec3 multiScatter = Fms * compensationFactor;1147+ return singleScatter + multiScatter;1148+}1149+#if NUM_RECT_AREA_LIGHTS > 01150+ void RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {1151+ vec3 normal = geometryNormal;1152+ vec3 viewDir = geometryViewDir;1153+ vec3 position = geometryPosition;1154+ vec3 lightPos = rectAreaLight.position;1155+ vec3 halfWidth = rectAreaLight.halfWidth;1156+ vec3 halfHeight = rectAreaLight.halfHeight;1157+ vec3 lightColor = rectAreaLight.color;1158+ float roughness = material.roughness;1159+ vec3 rectCoords[ 4 ];1160+ rectCoords[ 0 ] = lightPos + halfWidth - halfHeight; rectCoords[ 1 ] = lightPos - halfWidth - halfHeight;1161+ rectCoords[ 2 ] = lightPos - halfWidth + halfHeight;1162+ rectCoords[ 3 ] = lightPos + halfWidth + halfHeight;1163+ vec2 uv = LTC_Uv( normal, viewDir, roughness );1164+ vec4 t1 = texture2D( ltc_1, uv );1165+ vec4 t2 = texture2D( ltc_2, uv );1166+ mat3 mInv = mat3(1167+ vec3( t1.x, 0, t1.y ),1168+ vec3( 0, 1, 0 ),1169+ vec3( t1.z, 0, t1.w )1170+ );1171+ vec3 fresnel = ( material.specularColorBlended * t2.x + ( material.specularF90 - material.specularColorBlended ) * t2.y );1172+ reflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );1173+ reflectedLight.directDiffuse += lightColor * material.diffuseContribution * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords );1174+ #ifdef USE_CLEARCOAT1175+ vec3 Ncc = geometryClearcoatNormal;1176+ vec2 uvClearcoat = LTC_Uv( Ncc, viewDir, material.clearcoatRoughness );1177+ vec4 t1Clearcoat = texture2D( ltc_1, uvClearcoat );1178+ vec4 t2Clearcoat = texture2D( ltc_2, uvClearcoat );1179+ mat3 mInvClearcoat = mat3(1180+ vec3( t1Clearcoat.x, 0, t1Clearcoat.y ),1181+ vec3( 0, 1, 0 ),1182+ vec3( t1Clearcoat.z, 0, t1Clearcoat.w )1183+ );1184+ vec3 fresnelClearcoat = material.clearcoatF0 * t2Clearcoat.x + ( material.clearcoatF90 - material.clearcoatF0 ) * t2Clearcoat.y;1185+ clearcoatSpecularDirect += lightColor * fresnelClearcoat * LTC_Evaluate( Ncc, viewDir, position, mInvClearcoat, rectCoords );1186+ #endif1187+ }1188+#endif1189+void RE_Direct_Physical( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {1190+ float dotNL = saturate( dot( geometryNormal, directLight.direction ) );1191+ vec3 irradiance = dotNL * directLight.color;1192+ #ifdef USE_CLEARCOAT1193+ float dotNLcc = saturate( dot( geometryClearcoatNormal, directLight.direction ) );1194+ vec3 ccIrradiance = dotNLcc * directLight.color;1195+ clearcoatSpecularDirect += ccIrradiance * BRDF_GGX_Clearcoat( directLight.direction, geometryViewDir, geometryClearcoatNormal, material );1196+ #endif1197+ #ifdef USE_SHEEN1198+ 1199+ sheenSpecularDirect += irradiance * BRDF_Sheen( directLight.direction, geometryViewDir, geometryNormal, material.sheenColor, material.sheenRoughness );1200+ 1201+ float sheenAlbedoV = IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness );1202+ float sheenAlbedoL = IBLSheenBRDF( geometryNormal, directLight.direction, material.sheenRoughness );1203+ 1204+ float sheenEnergyComp = 1.0 - max3( material.sheenColor ) * max( sheenAlbedoV, sheenAlbedoL );1205+ 1206+ irradiance *= sheenEnergyComp;1207+ 1208+ #endif1209+ reflectedLight.directSpecular += irradiance * BRDF_GGX_Multiscatter( directLight.direction, geometryViewDir, geometryNormal, material );1210+ reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseContribution );1211+}1212+void RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {1213+ vec3 diffuse = irradiance * BRDF_Lambert( material.diffuseContribution );1214+ #ifdef USE_SHEEN1215+ float sheenAlbedo = IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness );1216+ float sheenEnergyComp = 1.0 - max3( material.sheenColor ) * sheenAlbedo;1217+ diffuse *= sheenEnergyComp;1218+ #endif1219+ reflectedLight.indirectDiffuse += diffuse;1220+}1221+void RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradiance, const in vec3 clearcoatRadiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) {1222+ #ifdef USE_CLEARCOAT1223+ clearcoatSpecularIndirect += clearcoatRadiance * EnvironmentBRDF( geometryClearcoatNormal, geometryViewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness );1224+ #endif1225+ #ifdef USE_SHEEN1226+ sheenSpecularIndirect += irradiance * material.sheenColor * IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness ) * RECIPROCAL_PI;1227+ #endif1228+ vec3 singleScatteringDielectric = vec3( 0.0 );1229+ vec3 multiScatteringDielectric = vec3( 0.0 );1230+ vec3 singleScatteringMetallic = vec3( 0.0 );1231+ vec3 multiScatteringMetallic = vec3( 0.0 );1232+ #ifdef USE_IRIDESCENCE1233+ computeMultiscatteringIridescence( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnelDielectric, material.roughness, singleScatteringDielectric, multiScatteringDielectric );1234+ computeMultiscatteringIridescence( geometryNormal, geometryViewDir, material.diffuseColor, material.specularF90, material.iridescence, material.iridescenceFresnelMetallic, material.roughness, singleScatteringMetallic, multiScatteringMetallic );1235+ #else1236+ computeMultiscattering( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.roughness, singleScatteringDielectric, multiScatteringDielectric );1237+ computeMultiscattering( geometryNormal, geometryViewDir, material.diffuseColor, material.specularF90, material.roughness, singleScatteringMetallic, multiScatteringMetallic );1238+ #endif1239+ vec3 singleScattering = mix( singleScatteringDielectric, singleScatteringMetallic, material.metalness );1240+ vec3 multiScattering = mix( multiScatteringDielectric, multiScatteringMetallic, material.metalness );1241+ vec3 totalScatteringDielectric = singleScatteringDielectric + multiScatteringDielectric;1242+ vec3 diffuse = material.diffuseContribution * ( 1.0 - totalScatteringDielectric );1243+ vec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;1244+ vec3 indirectSpecular = radiance * singleScattering;1245+ indirectSpecular += multiScattering * cosineWeightedIrradiance;1246+ vec3 indirectDiffuse = diffuse * cosineWeightedIrradiance;1247+ #ifdef USE_SHEEN1248+ float sheenAlbedo = IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness );1249+ float sheenEnergyComp = 1.0 - max3( material.sheenColor ) * sheenAlbedo;1250+ indirectSpecular *= sheenEnergyComp;1251+ indirectDiffuse *= sheenEnergyComp;1252+ #endif1253+ reflectedLight.indirectSpecular += indirectSpecular;1254+ reflectedLight.indirectDiffuse += indirectDiffuse;1255+}1256+#define RE_Direct RE_Direct_Physical1257+#define RE_Direct_RectArea RE_Direct_RectArea_Physical1258+#define RE_IndirectDiffuse RE_IndirectDiffuse_Physical1259+#define RE_IndirectSpecular RE_IndirectSpecular_Physical1260+float computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {1261+ return saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );1262+}`,lhe=`1263+vec3 geometryPosition = - vViewPosition;1264+vec3 geometryNormal = normal;1265+vec3 geometryViewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );1266+vec3 geometryClearcoatNormal = vec3( 0.0 );1267+#ifdef USE_CLEARCOAT1268+ geometryClearcoatNormal = clearcoatNormal;1269+#endif1270+#ifdef USE_IRIDESCENCE1271+ float dotNVi = saturate( dot( normal, geometryViewDir ) );1272+ if ( material.iridescenceThickness == 0.0 ) {1273+ material.iridescence = 0.0;1274+ } else {1275+ material.iridescence = saturate( material.iridescence );1276+ }1277+ if ( material.iridescence > 0.0 ) {1278+ material.iridescenceFresnelDielectric = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.specularColor );1279+ material.iridescenceFresnelMetallic = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.diffuseColor );1280+ material.iridescenceFresnel = mix( material.iridescenceFresnelDielectric, material.iridescenceFresnelMetallic, material.metalness );1281+ material.iridescenceF0 = Schlick_to_F0( material.iridescenceFresnel, 1.0, dotNVi );1282+ }1283+#endif1284+IncidentLight directLight;1285+#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )1286+ PointLight pointLight;1287+ #if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 01288+ PointLightShadow pointLightShadow;1289+ #endif1290+ #pragma unroll_loop_start1291+ for ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {1292+ pointLight = pointLights[ i ];1293+ getPointLightInfo( pointLight, geometryPosition, directLight );1294+ #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS ) && ( defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_BASIC ) )1295+ pointLightShadow = pointLightShadows[ i ];1296+ directLight.color *= ( directLight.visible && receiveShadow ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowIntensity, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0;1297+ #endif1298+ RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );1299+ }1300+ #pragma unroll_loop_end1301+#endif1302+#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )1303+ SpotLight spotLight;1304+ vec4 spotColor;1305+ vec3 spotLightCoord;1306+ bool inSpotLightMap;1307+ #if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 01308+ SpotLightShadow spotLightShadow;1309+ #endif1310+ #pragma unroll_loop_start1311+ for ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {1312+ spotLight = spotLights[ i ];1313+ getSpotLightInfo( spotLight, geometryPosition, directLight );1314+ #if ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )1315+ #define SPOT_LIGHT_MAP_INDEX UNROLLED_LOOP_INDEX1316+ #elif ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )1317+ #define SPOT_LIGHT_MAP_INDEX NUM_SPOT_LIGHT_MAPS1318+ #else1319+ #define SPOT_LIGHT_MAP_INDEX ( UNROLLED_LOOP_INDEX - NUM_SPOT_LIGHT_SHADOWS + NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )1320+ #endif1321+ #if ( SPOT_LIGHT_MAP_INDEX < NUM_SPOT_LIGHT_MAPS )1322+ spotLightCoord = vSpotLightCoord[ i ].xyz / vSpotLightCoord[ i ].w;1323+ inSpotLightMap = all( lessThan( abs( spotLightCoord * 2. - 1. ), vec3( 1.0 ) ) );1324+ spotColor = texture2D( spotLightMap[ SPOT_LIGHT_MAP_INDEX ], spotLightCoord.xy );1325+ directLight.color = inSpotLightMap ? directLight.color * spotColor.rgb : directLight.color;1326+ #endif1327+ #undef SPOT_LIGHT_MAP_INDEX1328+ #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )1329+ spotLightShadow = spotLightShadows[ i ];1330+ directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowIntensity, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;1331+ #endif1332+ RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );1333+ }1334+ #pragma unroll_loop_end1335+#endif1336+#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )1337+ DirectionalLight directionalLight;1338+ #if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 01339+ DirectionalLightShadow directionalLightShadow;1340+ #endif1341+ #pragma unroll_loop_start1342+ for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {1343+ directionalLight = directionalLights[ i ];1344+ getDirectionalLightInfo( directionalLight, directLight );1345+ #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )1346+ directionalLightShadow = directionalLightShadows[ i ];1347+ directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowIntensity, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;1348+ #endif1349+ RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );1350+ }1351+ #pragma unroll_loop_end1352+#endif1353+#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )1354+ RectAreaLight rectAreaLight;1355+ #pragma unroll_loop_start1356+ for ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {1357+ rectAreaLight = rectAreaLights[ i ];1358+ RE_Direct_RectArea( rectAreaLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );1359+ }1360+ #pragma unroll_loop_end1361+#endif1362+#if defined( RE_IndirectDiffuse )1363+ vec3 iblIrradiance = vec3( 0.0 );1364+ vec3 irradiance = getAmbientLightIrradiance( ambientLightColor );1365+ #if defined( USE_LIGHT_PROBES )1366+ irradiance += getLightProbeIrradiance( lightProbe, geometryNormal );1367+ #endif1368+ #if ( NUM_HEMI_LIGHTS > 0 )1369+ #pragma unroll_loop_start1370+ for ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {1371+ irradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometryNormal );1372+ }1373+ #pragma unroll_loop_end1374+ #endif1375+ #ifdef USE_LIGHT_PROBES_GRID1376+ vec3 probeWorldPos = ( ( vec4( geometryPosition, 1.0 ) - viewMatrix[ 3 ] ) * viewMatrix ).xyz;1377+ vec3 probeWorldNormal = transformNormalByInverseViewMatrix( geometryNormal, viewMatrix );1378+ irradiance += getLightProbeGridIrradiance( probeWorldPos, probeWorldNormal );1379+ #endif1380+#endif1381+#if defined( RE_IndirectSpecular )1382+ vec3 radiance = vec3( 0.0 );1383+ vec3 clearcoatRadiance = vec3( 0.0 );1384+#endif`,che=`#if defined( RE_IndirectDiffuse )1385+ #ifdef USE_LIGHTMAP1386+ vec4 lightMapTexel = texture2D( lightMap, vLightMapUv );1387+ vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;1388+ irradiance += lightMapIrradiance;1389+ #endif1390+ #if defined( USE_ENVMAP ) && defined( ENVMAP_TYPE_CUBE_UV )1391+ #if defined( STANDARD ) || defined( LAMBERT ) || defined( PHONG )1392+ iblIrradiance += getIBLIrradiance( geometryNormal );1393+ #endif1394+ #endif1395+#endif1396+#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )1397+ #ifdef USE_ANISOTROPY1398+ radiance += getIBLAnisotropyRadiance( geometryViewDir, geometryNormal, material.roughness, material.anisotropyB, material.anisotropy );1399+ #else1400+ radiance += getIBLRadiance( geometryViewDir, geometryNormal, material.roughness );1401+ #endif1402+ #ifdef USE_CLEARCOAT1403+ clearcoatRadiance += getIBLRadiance( geometryViewDir, geometryClearcoatNormal, material.clearcoatRoughness );1404+ #endif1405+#endif`,uhe=`#if defined( RE_IndirectDiffuse )1406+ #if defined( LAMBERT ) || defined( PHONG )1407+ irradiance += iblIrradiance;1408+ #endif1409+ RE_IndirectDiffuse( irradiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );1410+#endif1411+#if defined( RE_IndirectSpecular )1412+ RE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );1413+#endif`,hhe=`#ifdef USE_LIGHT_PROBES_GRID1414+uniform highp sampler3D probesSH;1415+uniform vec3 probesMin;1416+uniform vec3 probesMax;1417+uniform vec3 probesResolution;1418+vec3 getLightProbeGridIrradiance( vec3 worldPos, vec3 worldNormal ) {1419+ vec3 res = probesResolution;1420+ vec3 gridRange = probesMax - probesMin;1421+ vec3 resMinusOne = res - 1.0;1422+ vec3 probeSpacing = gridRange / resMinusOne;1423+ vec3 samplePos = worldPos + worldNormal * probeSpacing * 0.5;1424+ vec3 uvw = clamp( ( samplePos - probesMin ) / gridRange, 0.0, 1.0 );1425+ uvw = uvw * resMinusOne / res + 0.5 / res;1426+ float nz = res.z;1427+ float paddedSlices = nz + 2.0;1428+ float atlasDepth = 7.0 * paddedSlices;1429+ float uvZBase = uvw.z * nz + 1.0;1430+ vec4 s0 = texture( probesSH, vec3( uvw.xy, ( uvZBase ) / atlasDepth ) );1431+ vec4 s1 = texture( probesSH, vec3( uvw.xy, ( uvZBase + paddedSlices ) / atlasDepth ) );1432+ vec4 s2 = texture( probesSH, vec3( uvw.xy, ( uvZBase + 2.0 * paddedSlices ) / atlasDepth ) );1433+ vec4 s3 = texture( probesSH, vec3( uvw.xy, ( uvZBase + 3.0 * paddedSlices ) / atlasDepth ) );1434+ vec4 s4 = texture( probesSH, vec3( uvw.xy, ( uvZBase + 4.0 * paddedSlices ) / atlasDepth ) );1435+ vec4 s5 = texture( probesSH, vec3( uvw.xy, ( uvZBase + 5.0 * paddedSlices ) / atlasDepth ) );1436+ vec4 s6 = texture( probesSH, vec3( uvw.xy, ( uvZBase + 6.0 * paddedSlices ) / atlasDepth ) );1437+ vec3 c0 = s0.xyz;1438+ vec3 c1 = vec3( s0.w, s1.xy );1439+ vec3 c2 = vec3( s1.zw, s2.x );1440+ vec3 c3 = s2.yzw;1441+ vec3 c4 = s3.xyz;1442+ vec3 c5 = vec3( s3.w, s4.xy );1443+ vec3 c6 = vec3( s4.zw, s5.x );1444+ vec3 c7 = s5.yzw;1445+ vec3 c8 = s6.xyz;1446+ float x = worldNormal.x, y = worldNormal.y, z = worldNormal.z;1447+ vec3 result = c0 * 0.886227;1448+ result += c1 * 2.0 * 0.511664 * y;1449+ result += c2 * 2.0 * 0.511664 * z;1450+ result += c3 * 2.0 * 0.511664 * x;1451+ result += c4 * 2.0 * 0.429043 * x * y;1452+ result += c5 * 2.0 * 0.429043 * y * z;1453+ result += c6 * ( 0.743125 * z * z - 0.247708 );1454+ result += c7 * 2.0 * 0.429043 * x * z;1455+ result += c8 * 0.429043 * ( x * x - y * y );1456+ return max( result, vec3( 0.0 ) );1457+}1458+#endif`,fhe=`#if defined( USE_LOGARITHMIC_DEPTH_BUFFER )1459+ gl_FragDepth = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;1460+#endif`,dhe=`#if defined( USE_LOGARITHMIC_DEPTH_BUFFER )1461+ uniform float logDepthBufFC;1462+ varying float vFragDepth;1463+ varying float vIsPerspective;1464+#endif`,phe=`#ifdef USE_LOGARITHMIC_DEPTH_BUFFER1465+ varying float vFragDepth;1466+ varying float vIsPerspective;1467+#endif`,Ahe=`#ifdef USE_LOGARITHMIC_DEPTH_BUFFER1468+ vFragDepth = 1.0 + gl_Position.w;1469+ vIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );1470+#endif`,mhe=`#ifdef USE_MAP1471+ vec4 sampledDiffuseColor = texture2D( map, vMapUv );1472+ #ifdef DECODE_VIDEO_TEXTURE1473+ sampledDiffuseColor = sRGBTransferEOTF( sampledDiffuseColor );1474+ #endif1475+ diffuseColor *= sampledDiffuseColor;1476+#endif`,ghe=`#ifdef USE_MAP1477+ uniform sampler2D map;1478+#endif`,_he=`#if defined( USE_MAP ) || defined( USE_ALPHAMAP )1479+ #if defined( USE_POINTS_UV )1480+ vec2 uv = vUv;1481+ #else1482+ vec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy;1483+ #endif1484+#endif1485+#ifdef USE_MAP1486+ diffuseColor *= texture2D( map, uv );1487+#endif1488+#ifdef USE_ALPHAMAP1489+ diffuseColor.a *= texture2D( alphaMap, uv ).g;1490+#endif`,xhe=`#if defined( USE_POINTS_UV )1491+ varying vec2 vUv;1492+#else1493+ #if defined( USE_MAP ) || defined( USE_ALPHAMAP )1494+ uniform mat3 uvTransform;1495+ #endif1496+#endif1497+#ifdef USE_MAP1498+ uniform sampler2D map;1499+#endif1500+#ifdef USE_ALPHAMAP1501+ uniform sampler2D alphaMap;1502+#endif`,yhe=`float metalnessFactor = metalness;1503+#ifdef USE_METALNESSMAP1504+ vec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv );1505+ metalnessFactor *= texelMetalness.b;1506+#endif`,vhe=`#ifdef USE_METALNESSMAP1507+ uniform sampler2D metalnessMap;1508+#endif`,bhe=`#ifdef USE_INSTANCING_MORPH1509+ float morphTargetInfluences[ MORPHTARGETS_COUNT ];1510+ float morphTargetBaseInfluence = texelFetch( morphTexture, ivec2( 0, gl_InstanceID ), 0 ).r;1511+ for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {1512+ morphTargetInfluences[i] = texelFetch( morphTexture, ivec2( i + 1, gl_InstanceID ), 0 ).r;1513+ }1514+#endif`,whe=`#if defined( USE_MORPHCOLORS )1515+ vColor *= morphTargetBaseInfluence;1516+ for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {1517+ #if defined( USE_COLOR_ALPHA )1518+ if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ) * morphTargetInfluences[ i ];1519+ #elif defined( USE_COLOR )1520+ if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ).rgb * morphTargetInfluences[ i ];1521+ #endif1522+ }1523+#endif`,She=`#ifdef USE_MORPHNORMALS1524+ objectNormal *= morphTargetBaseInfluence;1525+ for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {1526+ if ( morphTargetInfluences[ i ] != 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1 ).xyz * morphTargetInfluences[ i ];1527+ }1528+#endif`,The=`#ifdef USE_MORPHTARGETS1529+ #ifndef USE_INSTANCING_MORPH1530+ uniform float morphTargetBaseInfluence;1531+ uniform float morphTargetInfluences[ MORPHTARGETS_COUNT ];1532+ #endif1533+ uniform sampler2DArray morphTargetsTexture;1534+ uniform ivec2 morphTargetsTextureSize;1535+ vec4 getMorph( const in int vertexIndex, const in int morphTargetIndex, const in int offset ) {1536+ int texelIndex = vertexIndex * MORPHTARGETS_TEXTURE_STRIDE + offset;1537+ int y = texelIndex / morphTargetsTextureSize.x;1538+ int x = texelIndex - y * morphTargetsTextureSize.x;1539+ ivec3 morphUV = ivec3( x, y, morphTargetIndex );1540+ return texelFetch( morphTargetsTexture, morphUV, 0 );1541+ }1542+#endif`,Ehe=`#ifdef USE_MORPHTARGETS1543+ transformed *= morphTargetBaseInfluence;1544+ for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {1545+ if ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0 ).xyz * morphTargetInfluences[ i ];1546+ }1547+#endif`,Mhe=`float faceDirection = gl_FrontFacing ? 1.0 : - 1.0;1548+#ifdef FLAT_SHADED1549+ vec3 fdx = dFdx( vViewPosition );1550+ vec3 fdy = dFdy( vViewPosition );1551+ vec3 normal = normalize( cross( fdx, fdy ) );1552+#else1553+ vec3 normal = normalize( vNormal );1554+ #ifdef DOUBLE_SIDED1555+ normal *= faceDirection;1556+ #endif1557+#endif1558+#if defined( USE_NORMALMAP_TANGENTSPACE ) || defined( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY )1559+ #ifdef USE_TANGENT1560+ mat3 tbn = mat3( normalize( vTangent ), normalize( vBitangent ), normal );1561+ #else1562+ mat3 tbn = getTangentFrame( - vViewPosition, normal,1563+ #if defined( USE_NORMALMAP )1564+ vNormalMapUv1565+ #elif defined( USE_CLEARCOAT_NORMALMAP )1566+ vClearcoatNormalMapUv1567+ #else1568+ vUv1569+ #endif1570+ );1571+ #endif1572+ #ifdef DOUBLE_SIDED1573+ tbn[0] *= faceDirection;1574+ tbn[1] *= faceDirection;1575+ #endif1576+#endif1577+#ifdef USE_CLEARCOAT_NORMALMAP1578+ #ifdef USE_TANGENT1579+ mat3 tbn2 = mat3( normalize( vTangent ), normalize( vBitangent ), normal );1580+ #else1581+ mat3 tbn2 = getTangentFrame( - vViewPosition, normal, vClearcoatNormalMapUv );1582+ #endif1583+ #ifdef DOUBLE_SIDED1584+ tbn2[0] *= faceDirection;1585+ tbn2[1] *= faceDirection;1586+ #endif1587+#endif1588+vec3 nonPerturbedNormal = normal;`,Che=`#ifdef USE_NORMALMAP_OBJECTSPACE1589+ normal = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;1590+ #ifdef FLIP_SIDED1591+ normal = - normal;1592+ #endif1593+ #ifdef DOUBLE_SIDED1594+ normal = normal * faceDirection;1595+ #endif1596+ normal = normalize( normalMatrix * normal );1597+#elif defined( USE_NORMALMAP_TANGENTSPACE )1598+ vec3 mapN = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;1599+ #if defined( USE_PACKED_NORMALMAP )1600+ mapN = vec3( mapN.xy, sqrt( saturate( 1.0 - dot( mapN.xy, mapN.xy ) ) ) );1601+ #endif1602+ mapN.xy *= normalScale;1603+ normal = normalize( tbn * mapN );1604+#elif defined( USE_BUMPMAP )1605+ normal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection );1606+#endif`,Rhe=`#ifndef FLAT_SHADED1607+ varying vec3 vNormal;1608+ #ifdef USE_TANGENT1609+ varying vec3 vTangent;1610+ varying vec3 vBitangent;1611+ #endif1612+#endif`,Phe=`#ifndef FLAT_SHADED1613+ varying vec3 vNormal;1614+ #ifdef USE_TANGENT1615+ varying vec3 vTangent;1616+ varying vec3 vBitangent;1617+ #endif1618+#endif`,Ihe=`#ifndef FLAT_SHADED1619+ vNormal = normalize( transformedNormal );1620+ #ifdef USE_TANGENT1621+ vTangent = normalize( transformedTangent );1622+ vBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );1623+ #ifdef FLIP_SIDED1624+ vBitangent = - vBitangent;1625+ #endif1626+ #endif1627+#endif`,Nhe=`#ifdef USE_NORMALMAP1628+ uniform sampler2D normalMap;1629+ uniform vec2 normalScale;1630+#endif1631+#ifdef USE_NORMALMAP_OBJECTSPACE1632+ uniform mat3 normalMatrix;1633+#endif1634+#if ! defined ( USE_TANGENT ) && ( defined ( USE_NORMALMAP_TANGENTSPACE ) || defined ( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY ) )1635+ mat3 getTangentFrame( vec3 eye_pos, vec3 surf_norm, vec2 uv ) {1636+ vec3 q0 = dFdx( eye_pos.xyz );1637+ vec3 q1 = dFdy( eye_pos.xyz );1638+ vec2 st0 = dFdx( uv.st );1639+ vec2 st1 = dFdy( uv.st );1640+ vec3 N = surf_norm;1641+ vec3 q1perp = cross( q1, N );1642+ vec3 q0perp = cross( N, q0 );1643+ vec3 T = q1perp * st0.x + q0perp * st1.x;1644+ vec3 B = q1perp * st0.y + q0perp * st1.y;1645+ float det = max( dot( T, T ), dot( B, B ) );1646+ float scale = ( det == 0.0 ) ? 0.0 : inversesqrt( det );1647+ return mat3( T * scale, B * scale, N );1648+ }1649+#endif`,Lhe=`#ifdef USE_CLEARCOAT1650+ vec3 clearcoatNormal = nonPerturbedNormal;1651+#endif`,Dhe=`#ifdef USE_CLEARCOAT_NORMALMAP1652+ vec3 clearcoatMapN = texture2D( clearcoatNormalMap, vClearcoatNormalMapUv ).xyz * 2.0 - 1.0;1653+ clearcoatMapN.xy *= clearcoatNormalScale;1654+ clearcoatNormal = normalize( tbn2 * clearcoatMapN );1655+#endif`,Fhe=`#ifdef USE_CLEARCOATMAP1656+ uniform sampler2D clearcoatMap;1657+#endif1658+#ifdef USE_CLEARCOAT_NORMALMAP1659+ uniform sampler2D clearcoatNormalMap;1660+ uniform vec2 clearcoatNormalScale;1661+#endif1662+#ifdef USE_CLEARCOAT_ROUGHNESSMAP1663+ uniform sampler2D clearcoatRoughnessMap;1664+#endif`,Ohe=`#ifdef USE_IRIDESCENCEMAP1665+ uniform sampler2D iridescenceMap;1666+#endif1667+#ifdef USE_IRIDESCENCE_THICKNESSMAP1668+ uniform sampler2D iridescenceThicknessMap;1669+#endif`,Bhe=`#ifdef OPAQUE1670+diffuseColor.a = 1.0;1671+#endif1672+#ifdef USE_TRANSMISSION1673+diffuseColor.a *= material.transmissionAlpha;1674+#endif1675+gl_FragColor = vec4( outgoingLight, diffuseColor.a );`,Uhe=`vec3 packNormalToRGB( const in vec3 normal ) {1676+ return normalize( normal ) * 0.5 + 0.5;1677+}1678+vec3 unpackRGBToNormal( const in vec3 rgb ) {1679+ return 2.0 * rgb.xyz - 1.0;1680+}1681+const float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;const float ShiftRight8 = 1. / 256.;1682+const float Inv255 = 1. / 255.;1683+const vec4 PackFactors = vec4( 1.0, 256.0, 256.0 * 256.0, 256.0 * 256.0 * 256.0 );1684+const vec2 UnpackFactors2 = vec2( UnpackDownscale, 1.0 / PackFactors.g );1685+const vec3 UnpackFactors3 = vec3( UnpackDownscale / PackFactors.rg, 1.0 / PackFactors.b );1686+const vec4 UnpackFactors4 = vec4( UnpackDownscale / PackFactors.rgb, 1.0 / PackFactors.a );1687+vec4 packDepthToRGBA( const in float v ) {1688+ if( v <= 0.0 )1689+ return vec4( 0., 0., 0., 0. );1690+ if( v >= 1.0 )1691+ return vec4( 1., 1., 1., 1. );1692+ float vuf;1693+ float af = modf( v * PackFactors.a, vuf );1694+ float bf = modf( vuf * ShiftRight8, vuf );1695+ float gf = modf( vuf * ShiftRight8, vuf );1696+ return vec4( vuf * Inv255, gf * PackUpscale, bf * PackUpscale, af );1697+}1698+vec3 packDepthToRGB( const in float v ) {1699+ if( v <= 0.0 )1700+ return vec3( 0., 0., 0. );1701+ if( v >= 1.0 )1702+ return vec3( 1., 1., 1. );1703+ float vuf;1704+ float bf = modf( v * PackFactors.b, vuf );1705+ float gf = modf( vuf * ShiftRight8, vuf );1706+ return vec3( vuf * Inv255, gf * PackUpscale, bf );1707+}1708+vec2 packDepthToRG( const in float v ) {1709+ if( v <= 0.0 )1710+ return vec2( 0., 0. );1711+ if( v >= 1.0 )1712+ return vec2( 1., 1. );1713+ float vuf;1714+ float gf = modf( v * 256., vuf );1715+ return vec2( vuf * Inv255, gf );1716+}1717+float unpackRGBAToDepth( const in vec4 v ) {1718+ return dot( v, UnpackFactors4 );1719+}1720+float unpackRGBToDepth( const in vec3 v ) {1721+ return dot( v, UnpackFactors3 );1722+}1723+float unpackRGToDepth( const in vec2 v ) {1724+ return v.r * UnpackFactors2.r + v.g * UnpackFactors2.g;1725+}1726+vec4 pack2HalfToRGBA( const in vec2 v ) {1727+ vec4 r = vec4( v.x, fract( v.x * 255.0 ), v.y, fract( v.y * 255.0 ) );1728+ return vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w );1729+}1730+vec2 unpackRGBATo2Half( const in vec4 v ) {1731+ return vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) );1732+}1733+float viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) {1734+ return ( viewZ + near ) / ( near - far );1735+}1736+float orthographicDepthToViewZ( const in float depth, const in float near, const in float far ) {1737+ #ifdef USE_REVERSED_DEPTH_BUFFER1738+ 1739+ return depth * ( far - near ) - far;1740+ #else1741+ return depth * ( near - far ) - near;1742+ #endif1743+}1744+float viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) {1745+ return ( ( near + viewZ ) * far ) / ( ( far - near ) * viewZ );1746+}1747+float perspectiveDepthToViewZ( const in float depth, const in float near, const in float far ) {1748+ 1749+ #ifdef USE_REVERSED_DEPTH_BUFFER1750+ return ( near * far ) / ( ( near - far ) * depth - near );1751+ #else1752+ return ( near * far ) / ( ( far - near ) * depth - far );1753+ #endif1754+}`,khe=`#ifdef PREMULTIPLIED_ALPHA1755+ gl_FragColor.rgb *= gl_FragColor.a;1756+#endif`,Ghe=`vec4 mvPosition = vec4( transformed, 1.0 );1757+#ifdef USE_BATCHING1758+ mvPosition = batchingMatrix * mvPosition;1759+#endif1760+#ifdef USE_INSTANCING1761+ mvPosition = instanceMatrix * mvPosition;1762+#endif1763+mvPosition = modelViewMatrix * mvPosition;1764+gl_Position = projectionMatrix * mvPosition;`,zhe=`#ifdef DITHERING1765+ gl_FragColor.rgb = dithering( gl_FragColor.rgb );1766+#endif`,Vhe=`#ifdef DITHERING1767+ vec3 dithering( vec3 color ) {1768+ float grid_position = rand( gl_FragCoord.xy );1769+ vec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 );1770+ dither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position );1771+ return color + dither_shift_RGB;1772+ }1773+#endif`,qhe=`float roughnessFactor = roughness;1774+#ifdef USE_ROUGHNESSMAP1775+ vec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv );1776+ roughnessFactor *= texelRoughness.g;1777+#endif`,Hhe=`#ifdef USE_ROUGHNESSMAP1778+ uniform sampler2D roughnessMap;1779+#endif`,Whe=`#if NUM_SPOT_LIGHT_COORDS > 01780+ varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];1781+#endif1782+#if NUM_SPOT_LIGHT_MAPS > 01783+ uniform sampler2D spotLightMap[ NUM_SPOT_LIGHT_MAPS ];1784+#endif1785+#ifdef USE_SHADOWMAP1786+ #if NUM_DIR_LIGHT_SHADOWS > 01787+ #if defined( SHADOWMAP_TYPE_PCF )1788+ uniform sampler2DShadow directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];1789+ #else1790+ uniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];1791+ #endif1792+ varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];1793+ struct DirectionalLightShadow {1794+ float shadowIntensity;1795+ float shadowBias;1796+ float shadowNormalBias;1797+ float shadowRadius;1798+ vec2 shadowMapSize;1799+ };1800+ uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];1801+ #endif1802+ #if NUM_SPOT_LIGHT_SHADOWS > 01803+ #if defined( SHADOWMAP_TYPE_PCF )1804+ uniform sampler2DShadow spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];1805+ #else1806+ uniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];1807+ #endif1808+ struct SpotLightShadow {1809+ float shadowIntensity;1810+ float shadowBias;1811+ float shadowNormalBias;1812+ float shadowRadius;1813+ vec2 shadowMapSize;1814+ };1815+ uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];1816+ #endif1817+ #if NUM_POINT_LIGHT_SHADOWS > 01818+ #if defined( SHADOWMAP_TYPE_PCF )1819+ uniform samplerCubeShadow pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];1820+ #elif defined( SHADOWMAP_TYPE_BASIC )1821+ uniform samplerCube pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];1822+ #endif1823+ varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];1824+ struct PointLightShadow {1825+ float shadowIntensity;1826+ float shadowBias;1827+ float shadowNormalBias;1828+ float shadowRadius;1829+ vec2 shadowMapSize;1830+ float shadowCameraNear;1831+ float shadowCameraFar;1832+ };1833+ uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];1834+ #endif1835+ #if defined( SHADOWMAP_TYPE_PCF )1836+ float interleavedGradientNoise( vec2 position ) {1837+ return fract( 52.9829189 * fract( dot( position, vec2( 0.06711056, 0.00583715 ) ) ) );1838+ }1839+ vec2 vogelDiskSample( int sampleIndex, int samplesCount, float phi ) {1840+ const float goldenAngle = 2.399963229728653;1841+ float r = sqrt( ( float( sampleIndex ) + 0.5 ) / float( samplesCount ) );1842+ float theta = float( sampleIndex ) * goldenAngle + phi;1843+ return vec2( cos( theta ), sin( theta ) ) * r;1844+ }1845+ #endif1846+ #if defined( SHADOWMAP_TYPE_PCF )1847+ float getShadow( sampler2DShadow shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) {1848+ float shadow = 1.0;1849+ shadowCoord.xyz /= shadowCoord.w;1850+ shadowCoord.z += shadowBias;1851+ bool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0;1852+ bool frustumTest = inFrustum && shadowCoord.z <= 1.0;1853+ if ( frustumTest ) {1854+ vec2 texelSize = vec2( 1.0 ) / shadowMapSize;1855+ float radius = shadowRadius * texelSize.x;1856+ float phi = interleavedGradientNoise( gl_FragCoord.xy ) * PI2;1857+ shadow = (1858+ texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 0, 5, phi ) * radius, shadowCoord.z ) ) +1859+ texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 1, 5, phi ) * radius, shadowCoord.z ) ) +1860+ texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 2, 5, phi ) * radius, shadowCoord.z ) ) +1861+ texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 3, 5, phi ) * radius, shadowCoord.z ) ) +1862+ texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 4, 5, phi ) * radius, shadowCoord.z ) )1863+ ) * 0.2;1864+ }1865+ return mix( 1.0, shadow, shadowIntensity );1866+ }1867+ #elif defined( SHADOWMAP_TYPE_VSM )1868+ float getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) {1869+ float shadow = 1.0;1870+ shadowCoord.xyz /= shadowCoord.w;1871+ #ifdef USE_REVERSED_DEPTH_BUFFER1872+ shadowCoord.z -= shadowBias;1873+ #else1874+ shadowCoord.z += shadowBias;1875+ #endif1876+ bool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0;1877+ bool frustumTest = inFrustum && shadowCoord.z <= 1.0;1878+ if ( frustumTest ) {1879+ vec2 distribution = texture2D( shadowMap, shadowCoord.xy ).rg;1880+ float mean = distribution.x;1881+ float variance = distribution.y * distribution.y;1882+ #ifdef USE_REVERSED_DEPTH_BUFFER1883+ float hard_shadow = step( mean, shadowCoord.z );1884+ #else1885+ float hard_shadow = step( shadowCoord.z, mean );1886+ #endif1887+ 1888+ if ( hard_shadow == 1.0 ) {1889+ shadow = 1.0;1890+ } else {1891+ variance = max( variance, 0.0000001 );1892+ float d = shadowCoord.z - mean;1893+ float p_max = variance / ( variance + d * d );1894+ p_max = clamp( ( p_max - 0.3 ) / 0.65, 0.0, 1.0 );1895+ shadow = max( hard_shadow, p_max );1896+ }1897+ }1898+ return mix( 1.0, shadow, shadowIntensity );1899+ }1900+ #else1901+ float getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) {1902+ float shadow = 1.0;1903+ shadowCoord.xyz /= shadowCoord.w;1904+ #ifdef USE_REVERSED_DEPTH_BUFFER1905+ shadowCoord.z -= shadowBias;1906+ #else1907+ shadowCoord.z += shadowBias;1908+ #endif1909+ bool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0;1910+ bool frustumTest = inFrustum && shadowCoord.z <= 1.0;1911+ if ( frustumTest ) {1912+ float depth = texture2D( shadowMap, shadowCoord.xy ).r;1913+ #ifdef USE_REVERSED_DEPTH_BUFFER1914+ shadow = step( depth, shadowCoord.z );1915+ #else1916+ shadow = step( shadowCoord.z, depth );1917+ #endif1918+ }1919+ return mix( 1.0, shadow, shadowIntensity );1920+ }1921+ #endif1922+ #if NUM_POINT_LIGHT_SHADOWS > 01923+ #if defined( SHADOWMAP_TYPE_PCF )1924+ float getPointShadow( samplerCubeShadow shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {1925+ float shadow = 1.0;1926+ vec3 lightToPosition = shadowCoord.xyz;1927+ vec3 bd3D = normalize( lightToPosition );1928+ vec3 absVec = abs( lightToPosition );1929+ float viewSpaceZ = max( max( absVec.x, absVec.y ), absVec.z );1930+ if ( viewSpaceZ - shadowCameraFar <= 0.0 && viewSpaceZ - shadowCameraNear >= 0.0 ) {1931+ #ifdef USE_REVERSED_DEPTH_BUFFER1932+ float dp = ( shadowCameraNear * ( shadowCameraFar - viewSpaceZ ) ) / ( viewSpaceZ * ( shadowCameraFar - shadowCameraNear ) );1933+ dp -= shadowBias;1934+ #else1935+ float dp = ( shadowCameraFar * ( viewSpaceZ - shadowCameraNear ) ) / ( viewSpaceZ * ( shadowCameraFar - shadowCameraNear ) );1936+ dp += shadowBias;1937+ #endif1938+ float texelSize = shadowRadius / shadowMapSize.x;1939+ vec3 absDir = abs( bd3D );1940+ vec3 tangent = absDir.x > absDir.z ? vec3( 0.0, 1.0, 0.0 ) : vec3( 1.0, 0.0, 0.0 );1941+ tangent = normalize( cross( bd3D, tangent ) );1942+ vec3 bitangent = cross( bd3D, tangent );1943+ float phi = interleavedGradientNoise( gl_FragCoord.xy ) * PI2;1944+ vec2 sample0 = vogelDiskSample( 0, 5, phi );1945+ vec2 sample1 = vogelDiskSample( 1, 5, phi );1946+ vec2 sample2 = vogelDiskSample( 2, 5, phi );1947+ vec2 sample3 = vogelDiskSample( 3, 5, phi );1948+ vec2 sample4 = vogelDiskSample( 4, 5, phi );1949+ shadow = (1950+ texture( shadowMap, vec4( bd3D + ( tangent * sample0.x + bitangent * sample0.y ) * texelSize, dp ) ) +1951+ texture( shadowMap, vec4( bd3D + ( tangent * sample1.x + bitangent * sample1.y ) * texelSize, dp ) ) +1952+ texture( shadowMap, vec4( bd3D + ( tangent * sample2.x + bitangent * sample2.y ) * texelSize, dp ) ) +1953+ texture( shadowMap, vec4( bd3D + ( tangent * sample3.x + bitangent * sample3.y ) * texelSize, dp ) ) +1954+ texture( shadowMap, vec4( bd3D + ( tangent * sample4.x + bitangent * sample4.y ) * texelSize, dp ) )1955+ ) * 0.2;1956+ }1957+ return mix( 1.0, shadow, shadowIntensity );1958+ }1959+ #elif defined( SHADOWMAP_TYPE_BASIC )1960+ float getPointShadow( samplerCube shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {1961+ float shadow = 1.0;1962+ vec3 lightToPosition = shadowCoord.xyz;1963+ vec3 absVec = abs( lightToPosition );1964+ float viewSpaceZ = max( max( absVec.x, absVec.y ), absVec.z );1965+ if ( viewSpaceZ - shadowCameraFar <= 0.0 && viewSpaceZ - shadowCameraNear >= 0.0 ) {1966+ float dp = ( shadowCameraFar * ( viewSpaceZ - shadowCameraNear ) ) / ( viewSpaceZ * ( shadowCameraFar - shadowCameraNear ) );1967+ dp += shadowBias;1968+ vec3 bd3D = normalize( lightToPosition );1969+ float depth = textureCube( shadowMap, bd3D ).r;1970+ #ifdef USE_REVERSED_DEPTH_BUFFER1971+ depth = 1.0 - depth;1972+ #endif1973+ shadow = step( dp, depth );1974+ }1975+ return mix( 1.0, shadow, shadowIntensity );1976+ }1977+ #endif1978+ #endif1979+#endif`,jhe=`#if NUM_SPOT_LIGHT_COORDS > 01980+ uniform mat4 spotLightMatrix[ NUM_SPOT_LIGHT_COORDS ];1981+ varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];1982+#endif1983+#ifdef USE_SHADOWMAP1984+ #if NUM_DIR_LIGHT_SHADOWS > 01985+ uniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ];1986+ varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];1987+ struct DirectionalLightShadow {1988+ float shadowIntensity;1989+ float shadowBias;1990+ float shadowNormalBias;1991+ float shadowRadius;1992+ vec2 shadowMapSize;1993+ };1994+ uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];1995+ #endif1996+ #if NUM_SPOT_LIGHT_SHADOWS > 01997+ struct SpotLightShadow {1998+ float shadowIntensity;1999+ float shadowBias;2000+ float shadowNormalBias;2001+ float shadowRadius;2002+ vec2 shadowMapSize;2003+ };2004+ uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];2005+ #endif2006+ #if NUM_POINT_LIGHT_SHADOWS > 02007+ uniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ];2008+ varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];2009+ struct PointLightShadow {2010+ float shadowIntensity;2011+ float shadowBias;2012+ float shadowNormalBias;2013+ float shadowRadius;2014+ vec2 shadowMapSize;2015+ float shadowCameraNear;2016+ float shadowCameraFar;2017+ };2018+ uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];2019+ #endif2020+#endif`,Xhe=`#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 )2021+ #ifdef HAS_NORMAL2022+ vec3 shadowWorldNormal = transformNormalByInverseViewMatrix( transformedNormal, viewMatrix );2023+ #else2024+ vec3 shadowWorldNormal = vec3( 0.0 );2025+ #endif2026+ vec4 shadowWorldPosition;2027+#endif2028+#if defined( USE_SHADOWMAP )2029+ #if NUM_DIR_LIGHT_SHADOWS > 02030+ #pragma unroll_loop_start2031+ for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {2032+ shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 );2033+ vDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition;2034+ }2035+ #pragma unroll_loop_end2036+ #endif2037+ #if NUM_POINT_LIGHT_SHADOWS > 02038+ #pragma unroll_loop_start2039+ for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {2040+ shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 );2041+ vPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition;2042+ }2043+ #pragma unroll_loop_end2044+ #endif2045+#endif2046+#if NUM_SPOT_LIGHT_COORDS > 02047+ #pragma unroll_loop_start2048+ for ( int i = 0; i < NUM_SPOT_LIGHT_COORDS; i ++ ) {2049+ shadowWorldPosition = worldPosition;2050+ #if ( defined( USE_SHADOWMAP ) && UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )2051+ shadowWorldPosition.xyz += shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias;2052+ #endif2053+ vSpotLightCoord[ i ] = spotLightMatrix[ i ] * shadowWorldPosition;2054+ }2055+ #pragma unroll_loop_end2056+#endif`,$he=`float getShadowMask() {2057+ float shadow = 1.0;2058+ #ifdef USE_SHADOWMAP2059+ #if NUM_DIR_LIGHT_SHADOWS > 02060+ DirectionalLightShadow directionalLight;2061+ #pragma unroll_loop_start2062+ for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {2063+ directionalLight = directionalLightShadows[ i ];2064+ shadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowIntensity, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;2065+ }2066+ #pragma unroll_loop_end2067+ #endif2068+ #if NUM_SPOT_LIGHT_SHADOWS > 02069+ SpotLightShadow spotLight;2070+ #pragma unroll_loop_start2071+ for ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {2072+ spotLight = spotLightShadows[ i ];2073+ shadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowIntensity, spotLight.shadowBias, spotLight.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;2074+ }2075+ #pragma unroll_loop_end2076+ #endif2077+ #if NUM_POINT_LIGHT_SHADOWS > 0 && ( defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_BASIC ) )2078+ PointLightShadow pointLight;2079+ #pragma unroll_loop_start2080+ for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {2081+ pointLight = pointLightShadows[ i ];2082+ shadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowIntensity, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;2083+ }2084+ #pragma unroll_loop_end2085+ #endif2086+ #endif2087+ return shadow;2088+}`,Yhe=`#ifdef USE_SKINNING2089+ mat4 boneMatX = getBoneMatrix( skinIndex.x );2090+ mat4 boneMatY = getBoneMatrix( skinIndex.y );2091+ mat4 boneMatZ = getBoneMatrix( skinIndex.z );2092+ mat4 boneMatW = getBoneMatrix( skinIndex.w );2093+#endif`,Zhe=`#ifdef USE_SKINNING2094+ uniform mat4 bindMatrix;2095+ uniform mat4 bindMatrixInverse;2096+ uniform highp sampler2D boneTexture;2097+ mat4 getBoneMatrix( const in float i ) {2098+ int size = textureSize( boneTexture, 0 ).x;2099+ int j = int( i ) * 4;2100+ int x = j % size;2101+ int y = j / size;2102+ vec4 v1 = texelFetch( boneTexture, ivec2( x, y ), 0 );2103+ vec4 v2 = texelFetch( boneTexture, ivec2( x + 1, y ), 0 );2104+ vec4 v3 = texelFetch( boneTexture, ivec2( x + 2, y ), 0 );2105+ vec4 v4 = texelFetch( boneTexture, ivec2( x + 3, y ), 0 );2106+ return mat4( v1, v2, v3, v4 );2107+ }2108+#endif`,Khe=`#ifdef USE_SKINNING2109+ vec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );2110+ vec4 skinned = vec4( 0.0 );2111+ skinned += boneMatX * skinVertex * skinWeight.x;2112+ skinned += boneMatY * skinVertex * skinWeight.y;2113+ skinned += boneMatZ * skinVertex * skinWeight.z;2114+ skinned += boneMatW * skinVertex * skinWeight.w;2115+ transformed = ( bindMatrixInverse * skinned ).xyz;2116+#endif`,Qhe=`#ifdef USE_SKINNING2117+ mat4 skinMatrix = mat4( 0.0 );2118+ skinMatrix += skinWeight.x * boneMatX;2119+ skinMatrix += skinWeight.y * boneMatY;2120+ skinMatrix += skinWeight.z * boneMatZ;2121+ skinMatrix += skinWeight.w * boneMatW;2122+ skinMatrix = bindMatrixInverse * skinMatrix * bindMatrix;2123+ objectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz;2124+ #ifdef USE_TANGENT2125+ objectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz;2126+ #endif2127+#endif`,Jhe=`float specularStrength;2128+#ifdef USE_SPECULARMAP2129+ vec4 texelSpecular = texture2D( specularMap, vSpecularMapUv );2130+ specularStrength = texelSpecular.r;2131+#else2132+ specularStrength = 1.0;2133+#endif`,efe=`#ifdef USE_SPECULARMAP2134+ uniform sampler2D specularMap;2135+#endif`,tfe=`#if defined( TONE_MAPPING )2136+ gl_FragColor.rgb = toneMapping( gl_FragColor.rgb );2137+#endif`,nfe=`#ifndef saturate2138+#define saturate( a ) clamp( a, 0.0, 1.0 )2139+#endif2140+uniform float toneMappingExposure;2141+vec3 LinearToneMapping( vec3 color ) {2142+ return saturate( toneMappingExposure * color );2143+}2144+vec3 ReinhardToneMapping( vec3 color ) {2145+ color *= toneMappingExposure;2146+ return saturate( color / ( vec3( 1.0 ) + color ) );2147+}2148+vec3 CineonToneMapping( vec3 color ) {2149+ color *= toneMappingExposure;2150+ color = max( vec3( 0.0 ), color - 0.004 );2151+ return pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );2152+}2153+vec3 RRTAndODTFit( vec3 v ) {2154+ vec3 a = v * ( v + 0.0245786 ) - 0.000090537;2155+ vec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081;2156+ return a / b;2157+}2158+vec3 ACESFilmicToneMapping( vec3 color ) {2159+ const mat3 ACESInputMat = mat3(2160+ vec3( 0.59719, 0.07600, 0.02840 ), vec3( 0.35458, 0.90834, 0.13383 ),2161+ vec3( 0.04823, 0.01566, 0.83777 )2162+ );2163+ const mat3 ACESOutputMat = mat3(2164+ vec3( 1.60475, -0.10208, -0.00327 ), vec3( -0.53108, 1.10813, -0.07276 ),2165+ vec3( -0.07367, -0.00605, 1.07602 )2166+ );2167+ color *= toneMappingExposure / 0.6;2168+ color = ACESInputMat * color;2169+ color = RRTAndODTFit( color );2170+ color = ACESOutputMat * color;2171+ return saturate( color );2172+}2173+const mat3 LINEAR_REC2020_TO_LINEAR_SRGB = mat3(2174+ vec3( 1.6605, - 0.1246, - 0.0182 ),2175+ vec3( - 0.5876, 1.1329, - 0.1006 ),2176+ vec3( - 0.0728, - 0.0083, 1.1187 )2177+);2178+const mat3 LINEAR_SRGB_TO_LINEAR_REC2020 = mat3(2179+ vec3( 0.6274, 0.0691, 0.0164 ),2180+ vec3( 0.3293, 0.9195, 0.0880 ),2181+ vec3( 0.0433, 0.0113, 0.8956 )2182+);2183+vec3 agxDefaultContrastApprox( vec3 x ) {2184+ vec3 x2 = x * x;2185+ vec3 x4 = x2 * x2;2186+ return + 15.5 * x4 * x22187+ - 40.14 * x4 * x2188+ + 31.96 * x42189+ - 6.868 * x2 * x2190+ + 0.4298 * x22191+ + 0.1191 * x2192+ - 0.00232;2193+}2194+vec3 AgXToneMapping( vec3 color ) {2195+ const mat3 AgXInsetMatrix = mat3(2196+ vec3( 0.856627153315983, 0.137318972929847, 0.11189821299995 ),2197+ vec3( 0.0951212405381588, 0.761241990602591, 0.0767994186031903 ),2198+ vec3( 0.0482516061458583, 0.101439036467562, 0.811302368396859 )2199+ );2200+ const mat3 AgXOutsetMatrix = mat3(2201+ vec3( 1.1271005818144368, - 0.1413297634984383, - 0.14132976349843826 ),2202+ vec3( - 0.11060664309660323, 1.157823702216272, - 0.11060664309660294 ),2203+ vec3( - 0.016493938717834573, - 0.016493938717834257, 1.2519364065950405 )2204+ );2205+ const float AgxMinEv = - 12.47393; const float AgxMaxEv = 4.026069;2206+ color *= toneMappingExposure;2207+ color = LINEAR_SRGB_TO_LINEAR_REC2020 * color;2208+ color = AgXInsetMatrix * color;2209+ color = max( color, 1e-10 ); color = log2( color );2210+ color = ( color - AgxMinEv ) / ( AgxMaxEv - AgxMinEv );2211+ color = clamp( color, 0.0, 1.0 );2212+ color = agxDefaultContrastApprox( color );2213+ color = AgXOutsetMatrix * color;2214+ color = pow( max( vec3( 0.0 ), color ), vec3( 2.2 ) );2215+ color = LINEAR_REC2020_TO_LINEAR_SRGB * color;2216+ color = clamp( color, 0.0, 1.0 );2217+ return color;2218+}2219+vec3 NeutralToneMapping( vec3 color ) {2220+ const float StartCompression = 0.8 - 0.04;2221+ const float Desaturation = 0.15;2222+ color *= toneMappingExposure;2223+ float x = min( color.r, min( color.g, color.b ) );2224+ float offset = x < 0.08 ? x - 6.25 * x * x : 0.04;2225+ color -= offset;2226+ float peak = max( color.r, max( color.g, color.b ) );2227+ if ( peak < StartCompression ) return color;2228+ float d = 1. - StartCompression;2229+ float newPeak = 1. - d * d / ( peak + d - StartCompression );2230+ color *= newPeak / peak;2231+ float g = 1. - 1. / ( Desaturation * ( peak - newPeak ) + 1. );2232+ return mix( color, vec3( newPeak ), g );2233+}2234+vec3 CustomToneMapping( vec3 color ) { return color; }`,ife=`#ifdef USE_TRANSMISSION2235+ material.transmission = transmission;2236+ material.transmissionAlpha = 1.0;2237+ material.thickness = thickness;2238+ material.attenuationDistance = attenuationDistance;2239+ material.attenuationColor = attenuationColor;2240+ #ifdef USE_TRANSMISSIONMAP2241+ material.transmission *= texture2D( transmissionMap, vTransmissionMapUv ).r;2242+ #endif2243+ #ifdef USE_THICKNESSMAP2244+ material.thickness *= texture2D( thicknessMap, vThicknessMapUv ).g;2245+ #endif2246+ vec3 pos = vWorldPosition;2247+ vec3 v = normalize( cameraPosition - pos );2248+ vec3 n = transformNormalByInverseViewMatrix( normal, viewMatrix );2249+ vec4 transmitted = getIBLVolumeRefraction(2250+ n, v, material.roughness, material.diffuseContribution, material.specularColorBlended, material.specularF90,2251+ pos, modelMatrix, viewMatrix, projectionMatrix, material.dispersion, material.ior, material.thickness,2252+ material.attenuationColor, material.attenuationDistance );2253+ material.transmissionAlpha = mix( material.transmissionAlpha, transmitted.a, material.transmission );2254+ totalDiffuse = mix( totalDiffuse, transmitted.rgb, material.transmission );2255+#endif`,rfe=`#ifdef USE_TRANSMISSION2256+ uniform float transmission;2257+ uniform float thickness;2258+ uniform float attenuationDistance;2259+ uniform vec3 attenuationColor;2260+ #ifdef USE_TRANSMISSIONMAP2261+ uniform sampler2D transmissionMap;2262+ #endif2263+ #ifdef USE_THICKNESSMAP2264+ uniform sampler2D thicknessMap;2265+ #endif2266+ uniform vec2 transmissionSamplerSize;2267+ uniform sampler2D transmissionSamplerMap;2268+ uniform mat4 modelMatrix;2269+ uniform mat4 projectionMatrix;2270+ varying vec3 vWorldPosition;2271+ float w0( float a ) {2272+ return ( 1.0 / 6.0 ) * ( a * ( a * ( - a + 3.0 ) - 3.0 ) + 1.0 );2273+ }2274+ float w1( float a ) {2275+ return ( 1.0 / 6.0 ) * ( a * a * ( 3.0 * a - 6.0 ) + 4.0 );2276+ }2277+ float w2( float a ){2278+ return ( 1.0 / 6.0 ) * ( a * ( a * ( - 3.0 * a + 3.0 ) + 3.0 ) + 1.0 );2279+ }2280+ float w3( float a ) {2281+ return ( 1.0 / 6.0 ) * ( a * a * a );2282+ }2283+ float g0( float a ) {2284+ return w0( a ) + w1( a );2285+ }2286+ float g1( float a ) {2287+ return w2( a ) + w3( a );2288+ }2289+ float h0( float a ) {2290+ return - 1.0 + w1( a ) / ( w0( a ) + w1( a ) );2291+ }2292+ float h1( float a ) {2293+ return 1.0 + w3( a ) / ( w2( a ) + w3( a ) );2294+ }2295+ vec4 bicubic( sampler2D tex, vec2 uv, vec4 texelSize, float lod ) {2296+ uv = uv * texelSize.zw + 0.5;2297+ vec2 iuv = floor( uv );2298+ vec2 fuv = fract( uv );2299+ float g0x = g0( fuv.x );2300+ float g1x = g1( fuv.x );2301+ float h0x = h0( fuv.x );2302+ float h1x = h1( fuv.x );2303+ float h0y = h0( fuv.y );2304+ float h1y = h1( fuv.y );2305+ vec2 p0 = ( vec2( iuv.x + h0x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;2306+ vec2 p1 = ( vec2( iuv.x + h1x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;2307+ vec2 p2 = ( vec2( iuv.x + h0x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;2308+ vec2 p3 = ( vec2( iuv.x + h1x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;2309+ return g0( fuv.y ) * ( g0x * textureLod( tex, p0, lod ) + g1x * textureLod( tex, p1, lod ) ) +2310+ g1( fuv.y ) * ( g0x * textureLod( tex, p2, lod ) + g1x * textureLod( tex, p3, lod ) );2311+ }2312+ vec4 textureBicubic( sampler2D sampler, vec2 uv, float lod ) {2313+ vec2 fLodSize = vec2( textureSize( sampler, int( lod ) ) );2314+ vec2 cLodSize = vec2( textureSize( sampler, int( lod + 1.0 ) ) );2315+ vec2 fLodSizeInv = 1.0 / fLodSize;2316+ vec2 cLodSizeInv = 1.0 / cLodSize;2317+ vec4 fSample = bicubic( sampler, uv, vec4( fLodSizeInv, fLodSize ), floor( lod ) );2318+ vec4 cSample = bicubic( sampler, uv, vec4( cLodSizeInv, cLodSize ), ceil( lod ) );2319+ return mix( fSample, cSample, fract( lod ) );2320+ }2321+ vec3 getVolumeTransmissionRay( const in vec3 n, const in vec3 v, const in float thickness, const in float ior, const in mat4 modelMatrix ) {2322+ vec3 refractionVector = refract( - v, normalize( n ), 1.0 / ior );2323+ vec3 modelScale;2324+ modelScale.x = length( vec3( modelMatrix[ 0 ].xyz ) );2325+ modelScale.y = length( vec3( modelMatrix[ 1 ].xyz ) );2326+ modelScale.z = length( vec3( modelMatrix[ 2 ].xyz ) );2327+ return normalize( refractionVector ) * thickness * modelScale;2328+ }2329+ float applyIorToRoughness( const in float roughness, const in float ior ) {2330+ return roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 );2331+ }2332+ vec4 getTransmissionSample( const in vec2 fragCoord, const in float roughness, const in float ior ) {2333+ float lod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior );2334+ return textureBicubic( transmissionSamplerMap, fragCoord.xy, lod );2335+ }2336+ vec3 volumeAttenuation( const in float transmissionDistance, const in vec3 attenuationColor, const in float attenuationDistance ) {2337+ if ( isinf( attenuationDistance ) ) {2338+ return vec3( 1.0 );2339+ } else {2340+ vec3 attenuationCoefficient = -log( attenuationColor ) / attenuationDistance;2341+ vec3 transmittance = exp( - attenuationCoefficient * transmissionDistance ); return transmittance;2342+ }2343+ }2344+ vec4 getIBLVolumeRefraction( const in vec3 n, const in vec3 v, const in float roughness, const in vec3 diffuseColor,2345+ const in vec3 specularColor, const in float specularF90, const in vec3 position, const in mat4 modelMatrix,2346+ const in mat4 viewMatrix, const in mat4 projMatrix, const in float dispersion, const in float ior, const in float thickness,2347+ const in vec3 attenuationColor, const in float attenuationDistance ) {2348+ vec4 transmittedLight;2349+ vec3 transmittance;2350+ #ifdef USE_DISPERSION2351+ float halfSpread = ( ior - 1.0 ) * 0.025 * dispersion;2352+ vec3 iors = vec3( ior - halfSpread, ior, ior + halfSpread );2353+ for ( int i = 0; i < 3; i ++ ) {2354+ vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, iors[ i ], modelMatrix );2355+ vec3 refractedRayExit = position + transmissionRay;2356+ vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );2357+ vec2 refractionCoords = ndcPos.xy / ndcPos.w;2358+ refractionCoords += 1.0;2359+ refractionCoords /= 2.0;2360+ vec4 transmissionSample = getTransmissionSample( refractionCoords, roughness, iors[ i ] );2361+ transmittedLight[ i ] = transmissionSample[ i ];2362+ transmittedLight.a += transmissionSample.a;2363+ transmittance[ i ] = diffuseColor[ i ] * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance )[ i ];2364+ }2365+ transmittedLight.a /= 3.0;2366+ #else2367+ vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, ior, modelMatrix );2368+ vec3 refractedRayExit = position + transmissionRay;2369+ vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );2370+ vec2 refractionCoords = ndcPos.xy / ndcPos.w;2371+ refractionCoords += 1.0;2372+ refractionCoords /= 2.0;2373+ transmittedLight = getTransmissionSample( refractionCoords, roughness, ior );2374+ transmittance = diffuseColor * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance );2375+ #endif2376+ vec3 attenuatedColor = transmittance * transmittedLight.rgb;2377+ vec3 F = EnvironmentBRDF( n, v, specularColor, specularF90, roughness );2378+ float transmittanceFactor = ( transmittance.r + transmittance.g + transmittance.b ) / 3.0;2379+ return vec4( ( 1.0 - F ) * attenuatedColor, 1.0 - ( 1.0 - transmittedLight.a ) * transmittanceFactor );2380+ }2381+#endif`,sfe=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )2382+ varying vec2 vUv;2383+#endif2384+#ifdef USE_MAP2385+ varying vec2 vMapUv;2386+#endif2387+#ifdef USE_ALPHAMAP2388+ varying vec2 vAlphaMapUv;2389+#endif2390+#ifdef USE_LIGHTMAP2391+ varying vec2 vLightMapUv;2392+#endif2393+#ifdef USE_AOMAP2394+ varying vec2 vAoMapUv;2395+#endif2396+#ifdef USE_BUMPMAP2397+ varying vec2 vBumpMapUv;2398+#endif2399+#ifdef USE_NORMALMAP2400+ varying vec2 vNormalMapUv;2401+#endif2402+#ifdef USE_EMISSIVEMAP2403+ varying vec2 vEmissiveMapUv;2404+#endif2405+#ifdef USE_METALNESSMAP2406+ varying vec2 vMetalnessMapUv;2407+#endif2408+#ifdef USE_ROUGHNESSMAP2409+ varying vec2 vRoughnessMapUv;2410+#endif2411+#ifdef USE_ANISOTROPYMAP2412+ varying vec2 vAnisotropyMapUv;2413+#endif2414+#ifdef USE_CLEARCOATMAP2415+ varying vec2 vClearcoatMapUv;2416+#endif2417+#ifdef USE_CLEARCOAT_NORMALMAP2418+ varying vec2 vClearcoatNormalMapUv;2419+#endif2420+#ifdef USE_CLEARCOAT_ROUGHNESSMAP2421+ varying vec2 vClearcoatRoughnessMapUv;2422+#endif2423+#ifdef USE_IRIDESCENCEMAP2424+ varying vec2 vIridescenceMapUv;2425+#endif2426+#ifdef USE_IRIDESCENCE_THICKNESSMAP2427+ varying vec2 vIridescenceThicknessMapUv;2428+#endif2429+#ifdef USE_SHEEN_COLORMAP2430+ varying vec2 vSheenColorMapUv;2431+#endif2432+#ifdef USE_SHEEN_ROUGHNESSMAP2433+ varying vec2 vSheenRoughnessMapUv;2434+#endif2435+#ifdef USE_SPECULARMAP2436+ varying vec2 vSpecularMapUv;2437+#endif2438+#ifdef USE_SPECULAR_COLORMAP2439+ varying vec2 vSpecularColorMapUv;2440+#endif2441+#ifdef USE_SPECULAR_INTENSITYMAP2442+ varying vec2 vSpecularIntensityMapUv;2443+#endif2444+#ifdef USE_TRANSMISSIONMAP2445+ uniform mat3 transmissionMapTransform;2446+ varying vec2 vTransmissionMapUv;2447+#endif2448+#ifdef USE_THICKNESSMAP2449+ uniform mat3 thicknessMapTransform;2450+ varying vec2 vThicknessMapUv;2451+#endif`,ofe=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )2452+ varying vec2 vUv;2453+#endif2454+#ifdef USE_MAP2455+ uniform mat3 mapTransform;2456+ varying vec2 vMapUv;2457+#endif2458+#ifdef USE_ALPHAMAP2459+ uniform mat3 alphaMapTransform;2460+ varying vec2 vAlphaMapUv;2461+#endif2462+#ifdef USE_LIGHTMAP2463+ uniform mat3 lightMapTransform;2464+ varying vec2 vLightMapUv;2465+#endif2466+#ifdef USE_AOMAP2467+ uniform mat3 aoMapTransform;2468+ varying vec2 vAoMapUv;2469+#endif2470+#ifdef USE_BUMPMAP2471+ uniform mat3 bumpMapTransform;2472+ varying vec2 vBumpMapUv;2473+#endif2474+#ifdef USE_NORMALMAP2475+ uniform mat3 normalMapTransform;2476+ varying vec2 vNormalMapUv;2477+#endif2478+#ifdef USE_DISPLACEMENTMAP2479+ uniform mat3 displacementMapTransform;2480+ varying vec2 vDisplacementMapUv;2481+#endif2482+#ifdef USE_EMISSIVEMAP2483+ uniform mat3 emissiveMapTransform;2484+ varying vec2 vEmissiveMapUv;2485+#endif2486+#ifdef USE_METALNESSMAP2487+ uniform mat3 metalnessMapTransform;2488+ varying vec2 vMetalnessMapUv;2489+#endif2490+#ifdef USE_ROUGHNESSMAP2491+ uniform mat3 roughnessMapTransform;2492+ varying vec2 vRoughnessMapUv;2493+#endif2494+#ifdef USE_ANISOTROPYMAP2495+ uniform mat3 anisotropyMapTransform;2496+ varying vec2 vAnisotropyMapUv;2497+#endif2498+#ifdef USE_CLEARCOATMAP2499+ uniform mat3 clearcoatMapTransform;2500+ varying vec2 vClearcoatMapUv;2501+#endif2502+#ifdef USE_CLEARCOAT_NORMALMAP2503+ uniform mat3 clearcoatNormalMapTransform;2504+ varying vec2 vClearcoatNormalMapUv;2505+#endif2506+#ifdef USE_CLEARCOAT_ROUGHNESSMAP2507+ uniform mat3 clearcoatRoughnessMapTransform;2508+ varying vec2 vClearcoatRoughnessMapUv;2509+#endif2510+#ifdef USE_SHEEN_COLORMAP2511+ uniform mat3 sheenColorMapTransform;2512+ varying vec2 vSheenColorMapUv;2513+#endif2514+#ifdef USE_SHEEN_ROUGHNESSMAP2515+ uniform mat3 sheenRoughnessMapTransform;2516+ varying vec2 vSheenRoughnessMapUv;2517+#endif2518+#ifdef USE_IRIDESCENCEMAP2519+ uniform mat3 iridescenceMapTransform;2520+ varying vec2 vIridescenceMapUv;2521+#endif2522+#ifdef USE_IRIDESCENCE_THICKNESSMAP2523+ uniform mat3 iridescenceThicknessMapTransform;2524+ varying vec2 vIridescenceThicknessMapUv;2525+#endif2526+#ifdef USE_SPECULARMAP2527+ uniform mat3 specularMapTransform;2528+ varying vec2 vSpecularMapUv;2529+#endif2530+#ifdef USE_SPECULAR_COLORMAP2531+ uniform mat3 specularColorMapTransform;2532+ varying vec2 vSpecularColorMapUv;2533+#endif2534+#ifdef USE_SPECULAR_INTENSITYMAP2535+ uniform mat3 specularIntensityMapTransform;2536+ varying vec2 vSpecularIntensityMapUv;2537+#endif2538+#ifdef USE_TRANSMISSIONMAP2539+ uniform mat3 transmissionMapTransform;2540+ varying vec2 vTransmissionMapUv;2541+#endif2542+#ifdef USE_THICKNESSMAP2543+ uniform mat3 thicknessMapTransform;2544+ varying vec2 vThicknessMapUv;2545+#endif`,afe=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )2546+ vUv = vec3( uv, 1 ).xy;2547+#endif2548+#ifdef USE_MAP2549+ vMapUv = ( mapTransform * vec3( MAP_UV, 1 ) ).xy;2550+#endif2551+#ifdef USE_ALPHAMAP2552+ vAlphaMapUv = ( alphaMapTransform * vec3( ALPHAMAP_UV, 1 ) ).xy;2553+#endif2554+#ifdef USE_LIGHTMAP2555+ vLightMapUv = ( lightMapTransform * vec3( LIGHTMAP_UV, 1 ) ).xy;2556+#endif2557+#ifdef USE_AOMAP2558+ vAoMapUv = ( aoMapTransform * vec3( AOMAP_UV, 1 ) ).xy;2559+#endif2560+#ifdef USE_BUMPMAP2561+ vBumpMapUv = ( bumpMapTransform * vec3( BUMPMAP_UV, 1 ) ).xy;2562+#endif2563+#ifdef USE_NORMALMAP2564+ vNormalMapUv = ( normalMapTransform * vec3( NORMALMAP_UV, 1 ) ).xy;2565+#endif2566+#ifdef USE_DISPLACEMENTMAP2567+ vDisplacementMapUv = ( displacementMapTransform * vec3( DISPLACEMENTMAP_UV, 1 ) ).xy;2568+#endif2569+#ifdef USE_EMISSIVEMAP2570+ vEmissiveMapUv = ( emissiveMapTransform * vec3( EMISSIVEMAP_UV, 1 ) ).xy;2571+#endif2572+#ifdef USE_METALNESSMAP2573+ vMetalnessMapUv = ( metalnessMapTransform * vec3( METALNESSMAP_UV, 1 ) ).xy;2574+#endif2575+#ifdef USE_ROUGHNESSMAP2576+ vRoughnessMapUv = ( roughnessMapTransform * vec3( ROUGHNESSMAP_UV, 1 ) ).xy;2577+#endif2578+#ifdef USE_ANISOTROPYMAP2579+ vAnisotropyMapUv = ( anisotropyMapTransform * vec3( ANISOTROPYMAP_UV, 1 ) ).xy;2580+#endif2581+#ifdef USE_CLEARCOATMAP2582+ vClearcoatMapUv = ( clearcoatMapTransform * vec3( CLEARCOATMAP_UV, 1 ) ).xy;2583+#endif2584+#ifdef USE_CLEARCOAT_NORMALMAP2585+ vClearcoatNormalMapUv = ( clearcoatNormalMapTransform * vec3( CLEARCOAT_NORMALMAP_UV, 1 ) ).xy;2586+#endif2587+#ifdef USE_CLEARCOAT_ROUGHNESSMAP2588+ vClearcoatRoughnessMapUv = ( clearcoatRoughnessMapTransform * vec3( CLEARCOAT_ROUGHNESSMAP_UV, 1 ) ).xy;2589+#endif2590+#ifdef USE_IRIDESCENCEMAP2591+ vIridescenceMapUv = ( iridescenceMapTransform * vec3( IRIDESCENCEMAP_UV, 1 ) ).xy;2592+#endif2593+#ifdef USE_IRIDESCENCE_THICKNESSMAP2594+ vIridescenceThicknessMapUv = ( iridescenceThicknessMapTransform * vec3( IRIDESCENCE_THICKNESSMAP_UV, 1 ) ).xy;2595+#endif2596+#ifdef USE_SHEEN_COLORMAP2597+ vSheenColorMapUv = ( sheenColorMapTransform * vec3( SHEEN_COLORMAP_UV, 1 ) ).xy;2598+#endif2599+#ifdef USE_SHEEN_ROUGHNESSMAP2600+ vSheenRoughnessMapUv = ( sheenRoughnessMapTransform * vec3( SHEEN_ROUGHNESSMAP_UV, 1 ) ).xy;2601+#endif2602+#ifdef USE_SPECULARMAP2603+ vSpecularMapUv = ( specularMapTransform * vec3( SPECULARMAP_UV, 1 ) ).xy;2604+#endif2605+#ifdef USE_SPECULAR_COLORMAP2606+ vSpecularColorMapUv = ( specularColorMapTransform * vec3( SPECULAR_COLORMAP_UV, 1 ) ).xy;2607+#endif2608+#ifdef USE_SPECULAR_INTENSITYMAP2609+ vSpecularIntensityMapUv = ( specularIntensityMapTransform * vec3( SPECULAR_INTENSITYMAP_UV, 1 ) ).xy;2610+#endif2611+#ifdef USE_TRANSMISSIONMAP2612+ vTransmissionMapUv = ( transmissionMapTransform * vec3( TRANSMISSIONMAP_UV, 1 ) ).xy;2613+#endif2614+#ifdef USE_THICKNESSMAP2615+ vThicknessMapUv = ( thicknessMapTransform * vec3( THICKNESSMAP_UV, 1 ) ).xy;2616+#endif`,lfe=`#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 02617+ vec4 worldPosition = vec4( transformed, 1.0 );2618+ #ifdef USE_BATCHING2619+ worldPosition = batchingMatrix * worldPosition;2620+ #endif2621+ #ifdef USE_INSTANCING2622+ worldPosition = instanceMatrix * worldPosition;2623+ #endif2624+ worldPosition = modelMatrix * worldPosition;2625+#endif`,cfe=`varying vec2 vUv;2626+uniform mat3 uvTransform;2627+void main() {2628+ vUv = ( uvTransform * vec3( uv, 1 ) ).xy;2629+ gl_Position = vec4( position.xy, 1.0, 1.0 );2630+}`,ufe=`uniform sampler2D t2D;2631+uniform float backgroundIntensity;2632+varying vec2 vUv;2633+void main() {2634+ vec4 texColor = texture2D( t2D, vUv );2635+ #ifdef DECODE_VIDEO_TEXTURE2636+ texColor = vec4( mix( pow( texColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), texColor.rgb * 0.0773993808, vec3( lessThanEqual( texColor.rgb, vec3( 0.04045 ) ) ) ), texColor.w );2637+ #endif2638+ texColor.rgb *= backgroundIntensity;2639+ gl_FragColor = texColor;2640+ #include <tonemapping_fragment>2641+ #include <colorspace_fragment>2642+}`,hfe=`varying vec3 vWorldDirection;2643+#include <common>2644+void main() {2645+ vWorldDirection = transformDirection( position, modelMatrix );2646+ #include <begin_vertex>2647+ #include <project_vertex>2648+ gl_Position.z = gl_Position.w;2649+}`,ffe=`#ifdef ENVMAP_TYPE_CUBE2650+ uniform samplerCube envMap;2651+#elif defined( ENVMAP_TYPE_CUBE_UV )2652+ uniform sampler2D envMap;2653+#endif2654+uniform float backgroundBlurriness;2655+uniform float backgroundIntensity;2656+uniform mat3 backgroundRotation;2657+varying vec3 vWorldDirection;2658+#include <cube_uv_reflection_fragment>2659+void main() {2660+ #ifdef ENVMAP_TYPE_CUBE2661+ vec4 texColor = textureCube( envMap, backgroundRotation * vWorldDirection );2662+ #elif defined( ENVMAP_TYPE_CUBE_UV )2663+ vec4 texColor = textureCubeUV( envMap, backgroundRotation * vWorldDirection, backgroundBlurriness );2664+ #else2665+ vec4 texColor = vec4( 0.0, 0.0, 0.0, 1.0 );2666+ #endif2667+ texColor.rgb *= backgroundIntensity;2668+ gl_FragColor = texColor;2669+ #include <tonemapping_fragment>2670+ #include <colorspace_fragment>2671+}`,dfe=`varying vec3 vWorldDirection;2672+#include <common>2673+void main() {2674+ vWorldDirection = transformDirection( position, modelMatrix );2675+ #include <begin_vertex>2676+ #include <project_vertex>2677+ gl_Position.z = gl_Position.w;2678+}`,pfe=`uniform samplerCube tCube;2679+uniform float tFlip;2680+uniform float opacity;2681+varying vec3 vWorldDirection;2682+void main() {2683+ vec4 texColor = textureCube( tCube, vec3( tFlip * vWorldDirection.x, vWorldDirection.yz ) );2684+ gl_FragColor = texColor;2685+ gl_FragColor.a *= opacity;2686+ #include <tonemapping_fragment>2687+ #include <colorspace_fragment>2688+}`,Afe=`#include <common>2689+#include <batching_pars_vertex>2690+#include <uv_pars_vertex>2691+#include <displacementmap_pars_vertex>2692+#include <morphtarget_pars_vertex>2693+#include <skinning_pars_vertex>2694+#include <logdepthbuf_pars_vertex>2695+#include <clipping_planes_pars_vertex>2696+varying vec2 vHighPrecisionZW;2697+void main() {2698+ #include <uv_vertex>2699+ #include <batching_vertex>2700+ #include <skinbase_vertex>2701+ #include <morphinstance_vertex>2702+ #ifdef USE_DISPLACEMENTMAP2703+ #include <beginnormal_vertex>2704+ #include <morphnormal_vertex>2705+ #include <skinnormal_vertex>2706+ #endif2707+ #include <begin_vertex>2708+ #include <morphtarget_vertex>2709+ #include <skinning_vertex>2710+ #include <displacementmap_vertex>2711+ #include <project_vertex>2712+ #include <logdepthbuf_vertex>2713+ #include <clipping_planes_vertex>2714+ vHighPrecisionZW = gl_Position.zw;2715+}`,mfe=`#if DEPTH_PACKING == 32002716+ uniform float opacity;2717+#endif2718+#include <common>2719+#include <packing>2720+#include <uv_pars_fragment>2721+#include <map_pars_fragment>2722+#include <alphamap_pars_fragment>2723+#include <alphatest_pars_fragment>2724+#include <alphahash_pars_fragment>2725+#include <logdepthbuf_pars_fragment>2726+#include <clipping_planes_pars_fragment>2727+varying vec2 vHighPrecisionZW;2728+void main() {2729+ vec4 diffuseColor = vec4( 1.0 );2730+ #include <clipping_planes_fragment>2731+ #if DEPTH_PACKING == 32002732+ diffuseColor.a = opacity;2733+ #endif2734+ #include <map_fragment>2735+ #include <alphamap_fragment>2736+ #include <alphatest_fragment>2737+ #include <alphahash_fragment>2738+ #include <logdepthbuf_fragment>2739+ #ifdef USE_REVERSED_DEPTH_BUFFER2740+ float fragCoordZ = vHighPrecisionZW[ 0 ] / vHighPrecisionZW[ 1 ];2741+ #else2742+ float fragCoordZ = 0.5 * vHighPrecisionZW[ 0 ] / vHighPrecisionZW[ 1 ] + 0.5;2743+ #endif2744+ #if DEPTH_PACKING == 32002745+ gl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity );2746+ #elif DEPTH_PACKING == 32012747+ gl_FragColor = packDepthToRGBA( fragCoordZ );2748+ #elif DEPTH_PACKING == 32022749+ gl_FragColor = vec4( packDepthToRGB( fragCoordZ ), 1.0 );2750+ #elif DEPTH_PACKING == 32032751+ gl_FragColor = vec4( packDepthToRG( fragCoordZ ), 0.0, 1.0 );2752+ #endif2753+}`,gfe=`#define DISTANCE2754+varying vec3 vWorldPosition;2755+#include <common>2756+#include <batching_pars_vertex>2757+#include <uv_pars_vertex>2758+#include <displacementmap_pars_vertex>2759+#include <morphtarget_pars_vertex>2760+#include <skinning_pars_vertex>2761+#include <clipping_planes_pars_vertex>2762+void main() {2763+ #include <uv_vertex>2764+ #include <batching_vertex>2765+ #include <skinbase_vertex>2766+ #include <morphinstance_vertex>2767+ #ifdef USE_DISPLACEMENTMAP2768+ #include <beginnormal_vertex>2769+ #include <morphnormal_vertex>2770+ #include <skinnormal_vertex>2771+ #endif2772+ #include <begin_vertex>2773+ #include <morphtarget_vertex>2774+ #include <skinning_vertex>2775+ #include <displacementmap_vertex>2776+ #include <project_vertex>2777+ #include <worldpos_vertex>2778+ #include <clipping_planes_vertex>2779+ vWorldPosition = worldPosition.xyz;2780+}`,_fe=`#define DISTANCE2781+uniform vec3 referencePosition;2782+uniform float nearDistance;2783+uniform float farDistance;2784+varying vec3 vWorldPosition;2785+#include <common>2786+#include <uv_pars_fragment>2787+#include <map_pars_fragment>2788+#include <alphamap_pars_fragment>2789+#include <alphatest_pars_fragment>2790+#include <alphahash_pars_fragment>2791+#include <clipping_planes_pars_fragment>2792+void main() {2793+ vec4 diffuseColor = vec4( 1.0 );2794+ #include <clipping_planes_fragment>2795+ #include <map_fragment>2796+ #include <alphamap_fragment>2797+ #include <alphatest_fragment>2798+ #include <alphahash_fragment>2799+ float dist = length( vWorldPosition - referencePosition );2800+ dist = ( dist - nearDistance ) / ( farDistance - nearDistance );2801+ dist = saturate( dist );2802+ gl_FragColor = vec4( dist, 0.0, 0.0, 1.0 );2803+}`,xfe=`varying vec3 vWorldDirection;2804+#include <common>2805+void main() {2806+ vWorldDirection = transformDirection( position, modelMatrix );2807+ #include <begin_vertex>2808+ #include <project_vertex>2809+}`,yfe=`uniform sampler2D tEquirect;2810+varying vec3 vWorldDirection;2811+#include <common>2812+void main() {2813+ vec3 direction = normalize( vWorldDirection );2814+ vec2 sampleUV = equirectUv( direction );2815+ gl_FragColor = texture2D( tEquirect, sampleUV );2816+ #include <tonemapping_fragment>2817+ #include <colorspace_fragment>2818+}`,vfe=`uniform float scale;2819+attribute float lineDistance;2820+varying float vLineDistance;2821+#include <common>2822+#include <uv_pars_vertex>2823+#include <color_pars_vertex>2824+#include <fog_pars_vertex>2825+#include <morphtarget_pars_vertex>2826+#include <logdepthbuf_pars_vertex>2827+#include <clipping_planes_pars_vertex>2828+void main() {2829+ vLineDistance = scale * lineDistance;2830+ #include <uv_vertex>2831+ #include <color_vertex>2832+ #include <morphinstance_vertex>2833+ #include <morphcolor_vertex>2834+ #include <begin_vertex>2835+ #include <morphtarget_vertex>2836+ #include <project_vertex>2837+ #include <logdepthbuf_vertex>2838+ #include <clipping_planes_vertex>2839+ #include <fog_vertex>2840+}`,bfe=`uniform vec3 diffuse;2841+uniform float opacity;2842+uniform float dashSize;2843+uniform float totalSize;2844+varying float vLineDistance;2845+#include <common>2846+#include <color_pars_fragment>2847+#include <uv_pars_fragment>2848+#include <map_pars_fragment>2849+#include <fog_pars_fragment>2850+#include <logdepthbuf_pars_fragment>2851+#include <clipping_planes_pars_fragment>2852+void main() {2853+ vec4 diffuseColor = vec4( diffuse, opacity );2854+ #include <clipping_planes_fragment>2855+ if ( mod( vLineDistance, totalSize ) > dashSize ) {2856+ discard;2857+ }2858+ vec3 outgoingLight = vec3( 0.0 );2859+ #include <logdepthbuf_fragment>2860+ #include <map_fragment>2861+ #include <color_fragment>2862+ outgoingLight = diffuseColor.rgb;2863+ #include <opaque_fragment>2864+ #include <tonemapping_fragment>2865+ #include <colorspace_fragment>2866+ #include <fog_fragment>2867+ #include <premultiplied_alpha_fragment>2868+}`,wfe=`#include <common>2869+#include <batching_pars_vertex>2870+#include <uv_pars_vertex>2871+#include <envmap_pars_vertex>2872+#include <color_pars_vertex>2873+#include <fog_pars_vertex>2874+#include <morphtarget_pars_vertex>2875+#include <skinning_pars_vertex>2876+#include <logdepthbuf_pars_vertex>2877+#include <clipping_planes_pars_vertex>2878+void main() {2879+ #include <uv_vertex>2880+ #include <color_vertex>2881+ #include <morphinstance_vertex>2882+ #include <morphcolor_vertex>2883+ #include <batching_vertex>2884+ #if defined ( USE_ENVMAP ) || defined ( USE_SKINNING )2885+ #include <beginnormal_vertex>2886+ #include <morphnormal_vertex>2887+ #include <skinbase_vertex>2888+ #include <skinnormal_vertex>2889+ #include <defaultnormal_vertex>2890+ #endif2891+ #include <begin_vertex>2892+ #include <morphtarget_vertex>2893+ #include <skinning_vertex>2894+ #include <project_vertex>2895+ #include <logdepthbuf_vertex>2896+ #include <clipping_planes_vertex>2897+ #include <worldpos_vertex>2898+ #include <envmap_vertex>2899+ #include <fog_vertex>2900+}`,Sfe=`uniform vec3 diffuse;2901+uniform float opacity;2902+#ifndef FLAT_SHADED2903+ varying vec3 vNormal;2904+#endif2905+#include <common>2906+#include <dithering_pars_fragment>2907+#include <color_pars_fragment>2908+#include <uv_pars_fragment>2909+#include <map_pars_fragment>2910+#include <alphamap_pars_fragment>2911+#include <alphatest_pars_fragment>2912+#include <alphahash_pars_fragment>2913+#include <aomap_pars_fragment>2914+#include <lightmap_pars_fragment>2915+#include <envmap_common_pars_fragment>2916+#include <envmap_pars_fragment>2917+#include <fog_pars_fragment>2918+#include <specularmap_pars_fragment>2919+#include <logdepthbuf_pars_fragment>2920+#include <clipping_planes_pars_fragment>2921+void main() {2922+ vec4 diffuseColor = vec4( diffuse, opacity );2923+ #include <clipping_planes_fragment>2924+ #include <logdepthbuf_fragment>2925+ #include <map_fragment>2926+ #include <color_fragment>2927+ #include <alphamap_fragment>2928+ #include <alphatest_fragment>2929+ #include <alphahash_fragment>2930+ #include <specularmap_fragment>2931+ ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );2932+ #ifdef USE_LIGHTMAP2933+ vec4 lightMapTexel = texture2D( lightMap, vLightMapUv );2934+ reflectedLight.indirectDiffuse += lightMapTexel.rgb * lightMapIntensity * RECIPROCAL_PI;2935+ #else2936+ reflectedLight.indirectDiffuse += vec3( 1.0 );2937+ #endif2938+ #include <aomap_fragment>2939+ reflectedLight.indirectDiffuse *= diffuseColor.rgb;2940+ vec3 outgoingLight = reflectedLight.indirectDiffuse;2941+ #include <envmap_fragment>2942+ #include <opaque_fragment>2943+ #include <tonemapping_fragment>2944+ #include <colorspace_fragment>2945+ #include <fog_fragment>2946+ #include <premultiplied_alpha_fragment>2947+ #include <dithering_fragment>2948+}`,Tfe=`#define LAMBERT2949+varying vec3 vViewPosition;2950+#include <common>2951+#include <batching_pars_vertex>2952+#include <uv_pars_vertex>2953+#include <displacementmap_pars_vertex>2954+#include <envmap_pars_vertex>2955+#include <color_pars_vertex>2956+#include <fog_pars_vertex>2957+#include <normal_pars_vertex>2958+#include <morphtarget_pars_vertex>2959+#include <skinning_pars_vertex>2960+#include <shadowmap_pars_vertex>2961+#include <logdepthbuf_pars_vertex>2962+#include <clipping_planes_pars_vertex>2963+void main() {2964+ #include <uv_vertex>2965+ #include <color_vertex>2966+ #include <morphinstance_vertex>2967+ #include <morphcolor_vertex>2968+ #include <batching_vertex>2969+ #include <beginnormal_vertex>2970+ #include <morphnormal_vertex>2971+ #include <skinbase_vertex>2972+ #include <skinnormal_vertex>2973+ #include <defaultnormal_vertex>2974+ #include <normal_vertex>2975+ #include <begin_vertex>2976+ #include <morphtarget_vertex>2977+ #include <skinning_vertex>2978+ #include <displacementmap_vertex>2979+ #include <project_vertex>2980+ #include <logdepthbuf_vertex>2981+ #include <clipping_planes_vertex>2982+ vViewPosition = - mvPosition.xyz;2983+ #include <worldpos_vertex>2984+ #include <envmap_vertex>2985+ #include <shadowmap_vertex>2986+ #include <fog_vertex>2987+}`,Efe=`#define LAMBERT2988+uniform vec3 diffuse;2989+uniform vec3 emissive;2990+uniform float opacity;2991+#include <common>diff truncated
@@ -30,6 +30,10 @@
3030 <span>Layer</span>3131 <select id="variant-select" aria-label="Map layer"></select>3232 </label>33+ <button class="icon-button globe-toggle" id="globe-toggle" type="button" hidden34+ aria-pressed="false" aria-label="View as globe" title="View as globe">35+ <svg viewBox="0 0 24 24"><circle cx="12" cy="12" r="9"/><path d="M3 12h18M12 3c2.8 2.6 4 5.6 4 9s-1.2 6.4-4 9c-2.8-2.6-4-5.6-4-9s1.2-6.4 4-9Z"/></svg>36+ </button>3337 <button class="icon-button add-bundles" id="add-bundles" type="button"3438 aria-label="Add game bundles" title="Add .atlas game bundles">3539 <svg viewBox="0 0 24 24"><path d="M12 5v14M5 12h14"/></svg>@@ -96,6 +100,7 @@
96100 </aside>97101 98102 <main class="map-panel">103+ <div id="globe" class="globe" hidden aria-label="Interactive globe"></div>99104 <div id="map" class="map" tabindex="0" autofocus aria-label="Interactive game map">100105 <div class="map-loading" id="map-loading">101106 <span class="spinner"></span>@@ -0,0 +1,18 @@
1+/* The globe pane sits exactly where the chart does, one toggle apart. The2+ canvas inside is sized by the renderer, so the pane only has to hold the3+ space and stay dark to its edges. */4+.globe {5+ position: absolute;6+ inset: 0;7+ background: #0b0e12;8+ overflow: hidden;9+}10+11+.globe[hidden] {12+ display: none;13+}14+15+.globe-toggle[aria-pressed="true"] {16+ color: var(--accent, #d98a4b);17+ border-color: currentColor;18+}@@ -8,12 +8,23 @@
88 "name": "atlas-frontend",99 "version": "0.0.0",1010 "dependencies": {11- "ol": "10.10.0"11+ "globe.gl": "2.46.1",12+ "ol": "10.10.0",13+ "three": "0.185.1"1214 },1315 "devDependencies": {1416 "esbuild": "0.28.1"1517 }1618 },19+ "node_modules/@babel/runtime": {20+ "version": "7.29.7",21+ "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.29.7.tgz",22+ "integrity": "sha512-Nq8OhGWiZIZGV6hLHoyAKLLcJihP/xFeBMGJoUrxTX2psI8dCifzLhZISFb+VWS3wFMRDmCGw5R+dOySCqPLhw==",23+ "license": "MIT",24+ "engines": {25+ "node": ">=6.9.0"26+ }27+ },1728 "node_modules/@esbuild/aix-ppc64": {1829 "version": "0.28.1",1930 "resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.28.1.tgz",@@ -462,6 +473,61 @@
462473 "integrity": "sha512-8awtpHXCx/bNpFt4mt2xdkgtgVvKqty8VbjHI/WWWQuEw+KLzFot3f4+LkQY9YmOtq7A5GdOnqoIC8Pdygjk2g==",463474 "license": "MIT"464475 },476+ "node_modules/@turf/boolean-point-in-polygon": {477+ "version": "7.3.5",478+ "resolved": "https://registry.npmjs.org/@turf/boolean-point-in-polygon/-/boolean-point-in-polygon-7.3.5.tgz",479+ "integrity": "sha512-ba7+B0wzaS9GtERZOoXUZ6oW8IcIJHNQZf3c+tiD9ESjcsPO1Q/4qIJGTKl92nBLhhracHJxMWBM/U6hAVkaRg==",480+ "license": "MIT",481+ "dependencies": {482+ "@turf/helpers": "7.3.5",483+ "@turf/invariant": "7.3.5",484+ "@types/geojson": "^7946.0.10",485+ "point-in-polygon-hao": "^1.1.0",486+ "tslib": "^2.8.1"487+ },488+ "funding": {489+ "url": "https://opencollective.com/turf"490+ }491+ },492+ "node_modules/@turf/helpers": {493+ "version": "7.3.5",494+ "resolved": "https://registry.npmjs.org/@turf/helpers/-/helpers-7.3.5.tgz",495+ "integrity": "sha512-E/NMGV5MwbjjP7AJXBtsanC3yY8N2MQ87IGdIgkB2ji5AtBpwnH4L3gEqpYN4RlCJJWbLbzO91BbKv2waUd0eg==",496+ "license": "MIT",497+ "dependencies": {498+ "@types/geojson": "^7946.0.10",499+ "tslib": "^2.8.1"500+ },501+ "funding": {502+ "url": "https://opencollective.com/turf"503+ }504+ },505+ "node_modules/@turf/invariant": {506+ "version": "7.3.5",507+ "resolved": "https://registry.npmjs.org/@turf/invariant/-/invariant-7.3.5.tgz",508+ "integrity": "sha512-ZVIvsBvjr8lO7WxC5zYNjRsjSDvyGvWkJMjuWaJjTU8x+1tmfNnw3gDX/TI2Sit83gcRYLYkNo23lB/udqx/Hg==",509+ "license": "MIT",510+ "dependencies": {511+ "@turf/helpers": "7.3.5",512+ "@types/geojson": "^7946.0.10",513+ "tslib": "^2.8.1"514+ },515+ "funding": {516+ "url": "https://opencollective.com/turf"517+ }518+ },519+ "node_modules/@tweenjs/tween.js": {520+ "version": "25.0.0",521+ "resolved": "https://registry.npmjs.org/@tweenjs/tween.js/-/tween.js-25.0.0.tgz",522+ "integrity": "sha512-XKLA6syeBUaPzx4j3qwMqzzq+V4uo72BnlbOjmuljLrRqdsd3qnzvZZoxvMHZ23ndsRS4aufU6JOZYpCbU6T1A==",523+ "license": "MIT"524+ },525+ "node_modules/@types/geojson": {526+ "version": "7946.0.16",527+ "resolved": "https://registry.npmjs.org/@types/geojson/-/geojson-7946.0.16.tgz",528+ "integrity": "sha512-6C8nqWur3j98U6+lXDfTUWIfgvZU+EumvpHKcYjujKH7woYyLj2sUmff0tRhrqM7BohUw7Pz3ZB1jj2gW9Fvmg==",529+ "license": "MIT"530+ },465531 "node_modules/@types/rbush": {466532 "version": "4.0.0",467533 "resolved": "https://registry.npmjs.org/@types/rbush/-/rbush-4.0.0.tgz",@@ -478,6 +544,198 @@
478544 "unzipit": "2.0.0"479545 }480546 },547+ "node_modules/accessor-fn": {548+ "version": "1.5.3",549+ "resolved": "https://registry.npmjs.org/accessor-fn/-/accessor-fn-1.5.3.tgz",550+ "integrity": "sha512-rkAofCwe/FvYFUlMB0v0gWmhqtfAtV1IUkdPbfhTUyYniu5LrC0A0UJkTH0Jv3S8SvwkmfuAlY+mQIJATdocMA==",551+ "license": "MIT",552+ "engines": {553+ "node": ">=12"554+ }555+ },556+ "node_modules/d3-array": {557+ "version": "3.2.4",558+ "resolved": "https://registry.npmjs.org/d3-array/-/d3-array-3.2.4.tgz",559+ "integrity": "sha512-tdQAmyA18i4J7wprpYq8ClcxZy3SC31QMeByyCFyRt7BVHdREQZ5lpzoe5mFEYZUWe+oq8HBvk9JjpibyEV4Jg==",560+ "license": "ISC",561+ "dependencies": {562+ "internmap": "1 - 2"563+ },564+ "engines": {565+ "node": ">=12"566+ }567+ },568+ "node_modules/d3-color": {569+ "version": "3.1.0",570+ "resolved": "https://registry.npmjs.org/d3-color/-/d3-color-3.1.0.tgz",571+ "integrity": "sha512-zg/chbXyeBtMQ1LbD/WSoW2DpC3I0mpmPdW+ynRTj/x2DAWYrIY7qeZIHidozwV24m4iavr15lNwIwLxRmOxhA==",572+ "license": "ISC",573+ "engines": {574+ "node": ">=12"575+ }576+ },577+ "node_modules/d3-delaunay": {578+ "version": "6.0.4",579+ "resolved": "https://registry.npmjs.org/d3-delaunay/-/d3-delaunay-6.0.4.tgz",580+ "integrity": "sha512-mdjtIZ1XLAM8bm/hx3WwjfHt6Sggek7qH043O8KEjDXN40xi3vx/6pYSVTwLjEgiXQTbvaouWKynLBiUZ6SK6A==",581+ "license": "ISC",582+ "dependencies": {583+ "delaunator": "5"584+ },585+ "engines": {586+ "node": ">=12"587+ }588+ },589+ "node_modules/d3-format": {590+ "version": "3.1.2",591+ "resolved": "https://registry.npmjs.org/d3-format/-/d3-format-3.1.2.tgz",592+ "integrity": "sha512-AJDdYOdnyRDV5b6ArilzCPPwc1ejkHcoyFarqlPqT7zRYjhavcT3uSrqcMvsgh2CgoPbK3RCwyHaVyxYcP2Arg==",593+ "license": "ISC",594+ "engines": {595+ "node": ">=12"596+ }597+ },598+ "node_modules/d3-geo": {599+ "version": "3.1.1",600+ "resolved": "https://registry.npmjs.org/d3-geo/-/d3-geo-3.1.1.tgz",601+ "integrity": "sha512-637ln3gXKXOwhalDzinUgY83KzNWZRKbYubaG+fGVuc/dxO64RRljtCTnf5ecMyE1RIdtqpkVcq0IbtU2S8j2Q==",602+ "license": "ISC",603+ "dependencies": {604+ "d3-array": "2.5.0 - 3"605+ },606+ "engines": {607+ "node": ">=12"608+ }609+ },610+ "node_modules/d3-geo-voronoi": {611+ "version": "2.1.0",612+ "resolved": "https://registry.npmjs.org/d3-geo-voronoi/-/d3-geo-voronoi-2.1.0.tgz",613+ "integrity": "sha512-kqE4yYuOjPbKdBXG0xztCacPwkVSK2REF1opSNrnqqtXJmNcM++UbwQ8SxvwP6IQTj9RvIjjK4qeiVsEfj0Z2Q==",614+ "license": "ISC",615+ "dependencies": {616+ "d3-array": "3",617+ "d3-delaunay": "6",618+ "d3-geo": "3",619+ "d3-tricontour": "1"620+ },621+ "engines": {622+ "node": ">=12"623+ }624+ },625+ "node_modules/d3-interpolate": {626+ "version": "3.0.1",627+ "resolved": "https://registry.npmjs.org/d3-interpolate/-/d3-interpolate-3.0.1.tgz",628+ "integrity": "sha512-3bYs1rOD33uo8aqJfKP3JWPAibgw8Zm2+L9vBKEHJ2Rg+viTR7o5Mmv5mZcieN+FRYaAOWX5SJATX6k1PWz72g==",629+ "license": "ISC",630+ "dependencies": {631+ "d3-color": "1 - 3"632+ },633+ "engines": {634+ "node": ">=12"635+ }636+ },637+ "node_modules/d3-octree": {638+ "version": "1.1.0",639+ "resolved": "https://registry.npmjs.org/d3-octree/-/d3-octree-1.1.0.tgz",640+ "integrity": "sha512-F8gPlqpP+HwRPMO/8uOu5wjH110+6q4cgJvgJT6vlpy3BEaDIKlTZrgHKZSp/i1InRpVfh4puY/kvL6MxK930A==",641+ "license": "MIT"642+ },643+ "node_modules/d3-scale": {644+ "version": "4.0.2",645+ "resolved": "https://registry.npmjs.org/d3-scale/-/d3-scale-4.0.2.tgz",646+ "integrity": "sha512-GZW464g1SH7ag3Y7hXjf8RoUuAFIqklOAq3MRl4OaWabTFJY9PN/E1YklhXLh+OQ3fM9yS2nOkCoS+WLZ6kvxQ==",647+ "license": "ISC",648+ "dependencies": {649+ "d3-array": "2.10.0 - 3",650+ "d3-format": "1 - 3",651+ "d3-interpolate": "1.2.0 - 3",652+ "d3-time": "2.1.1 - 3",653+ "d3-time-format": "2 - 4"654+ },655+ "engines": {656+ "node": ">=12"657+ }658+ },659+ "node_modules/d3-scale-chromatic": {660+ "version": "3.1.0",661+ "resolved": "https://registry.npmjs.org/d3-scale-chromatic/-/d3-scale-chromatic-3.1.0.tgz",662+ "integrity": "sha512-A3s5PWiZ9YCXFye1o246KoscMWqf8BsD9eRiJ3He7C9OBaxKhAd5TFCdEx/7VbKtxxTsu//1mMJFrEt572cEyQ==",663+ "license": "ISC",664+ "dependencies": {665+ "d3-color": "1 - 3",666+ "d3-interpolate": "1 - 3"667+ },668+ "engines": {669+ "node": ">=12"670+ }671+ },672+ "node_modules/d3-selection": {673+ "version": "3.0.0",674+ "resolved": "https://registry.npmjs.org/d3-selection/-/d3-selection-3.0.0.tgz",675+ "integrity": "sha512-fmTRWbNMmsmWq6xJV8D19U/gw/bwrHfNXxrIN+HfZgnzqTHp9jOmKMhsTUjXOJnZOdZY9Q28y4yebKzqDKlxlQ==",676+ "license": "ISC",677+ "engines": {678+ "node": ">=12"679+ }680+ },681+ "node_modules/d3-time": {682+ "version": "3.1.0",683+ "resolved": "https://registry.npmjs.org/d3-time/-/d3-time-3.1.0.tgz",684+ "integrity": "sha512-VqKjzBLejbSMT4IgbmVgDjpkYrNWUYJnbCGo874u7MMKIWsILRX+OpX/gTk8MqjpT1A/c6HY2dCA77ZN0lkQ2Q==",685+ "license": "ISC",686+ "dependencies": {687+ "d3-array": "2 - 3"688+ },689+ "engines": {690+ "node": ">=12"691+ }692+ },693+ "node_modules/d3-time-format": {694+ "version": "4.1.0",695+ "resolved": "https://registry.npmjs.org/d3-time-format/-/d3-time-format-4.1.0.tgz",696+ "integrity": "sha512-dJxPBlzC7NugB2PDLwo9Q8JiTR3M3e4/XANkreKSUxF8vvXKqm1Yfq4Q5dl8budlunRVlUUaDUgFt7eA8D6NLg==",697+ "license": "ISC",698+ "dependencies": {699+ "d3-time": "1 - 3"700+ },701+ "engines": {702+ "node": ">=12"703+ }704+ },705+ "node_modules/d3-tricontour": {706+ "version": "1.1.0",707+ "resolved": "https://registry.npmjs.org/d3-tricontour/-/d3-tricontour-1.1.0.tgz",708+ "integrity": "sha512-G7gHKj89n2owmkGb6WX6ixcnQ0Kf/0wpa9VIh9DGdbHu8wdrlaHU4ir3/bFNERl8N8nn4G7e7qbtBG8N9caihQ==",709+ "license": "ISC",710+ "dependencies": {711+ "d3-delaunay": "6",712+ "d3-scale": "4"713+ },714+ "engines": {715+ "node": ">=12"716+ }717+ },718+ "node_modules/data-bind-mapper": {719+ "version": "1.0.3",720+ "resolved": "https://registry.npmjs.org/data-bind-mapper/-/data-bind-mapper-1.0.3.tgz",721+ "integrity": "sha512-QmU3lyEnbENQPo0M1F9BMu4s6cqNNp8iJA+b/HP2sSb7pf3dxwF3+EP1eO69rwBfH9kFJ1apmzrtogAmVt2/Xw==",722+ "license": "MIT",723+ "dependencies": {724+ "accessor-fn": "1"725+ },726+ "engines": {727+ "node": ">=12"728+ }729+ },730+ "node_modules/delaunator": {731+ "version": "5.1.0",732+ "resolved": "https://registry.npmjs.org/delaunator/-/delaunator-5.1.0.tgz",733+ "integrity": "sha512-AGrQ4QSgssa1NGmWmLPqN5NY2KajF5MqxetNEO+o0n3ZwZZeTmt7bBnvzHWrmkZFxGgr4HdyFgelzgi06otLuQ==",734+ "license": "ISC",735+ "dependencies": {736+ "robust-predicates": "^3.0.2"737+ }738+ },481739 "node_modules/earcut": {482740 "version": "3.2.3",483741 "resolved": "https://registry.npmjs.org/earcut/-/earcut-3.2.3.tgz",@@ -532,6 +790,29 @@
532790 "integrity": "sha512-tbZNuJrLwGUp3zshBtdy4W+ORxZuIh8a5ilyIEQDC5rY1f3U20JMry0Ll3WBzU58EZKsEuJFXhb5gwv8CsPvgA==",533791 "license": "MIT"534792 },793+ "node_modules/float-tooltip": {794+ "version": "1.7.5",795+ "resolved": "https://registry.npmjs.org/float-tooltip/-/float-tooltip-1.7.5.tgz",796+ "integrity": "sha512-/kXzuDnnBqyyWyhDMH7+PfP8J/oXiAavGzcRxASOMRHFuReDtofizLLJsf7nnDLAfEaMW4pVWaXrAjtnglpEkg==",797+ "license": "MIT",798+ "dependencies": {799+ "d3-selection": "2 - 3",800+ "kapsule": "^1.16",801+ "preact": "10"802+ },803+ "engines": {804+ "node": ">=12"805+ }806+ },807+ "node_modules/frame-ticker": {808+ "version": "1.0.3",809+ "resolved": "https://registry.npmjs.org/frame-ticker/-/frame-ticker-1.0.3.tgz",810+ "integrity": "sha512-E0X2u2JIvbEMrqEg5+4BpTqaD22OwojJI63K7MdKHdncjtAhGRbCR8nJCr2vwEt9NWBPCPcu70X9smPviEBy8Q==",811+ "license": "MIT",812+ "dependencies": {813+ "simplesignal": "^2.1.6"814+ }815+ },535816 "node_modules/geotiff": {536817 "version": "3.1.0-beta.0",537818 "resolved": "https://registry.npmjs.org/geotiff/-/geotiff-3.1.0-beta.0.tgz",@@ -551,12 +832,76 @@
551832 "node": ">=10.19"552833 }553834 },835+ "node_modules/globe.gl": {836+ "version": "2.46.1",837+ "resolved": "https://registry.npmjs.org/globe.gl/-/globe.gl-2.46.1.tgz",838+ "integrity": "sha512-h+OvX52EBIPLtM0/2JkM+JZ9gPAhPJ4y3+hxUwD5Ey/O0Zk2ockuTiJ71bZbnNBGmNiIZzA5Vr3TMT0b3d35IQ==",839+ "license": "MIT",840+ "dependencies": {841+ "@tweenjs/tween.js": "18 - 25",842+ "accessor-fn": "1",843+ "kapsule": "^1.16",844+ "three": ">=0.179 <1",845+ "three-globe": "^2.45",846+ "three-render-objects": "^1.41"847+ },848+ "engines": {849+ "node": ">=12"850+ }851+ },852+ "node_modules/h3-js": {853+ "version": "4.5.0",854+ "resolved": "https://registry.npmjs.org/h3-js/-/h3-js-4.5.0.tgz",855+ "integrity": "sha512-uKmdPc+DuarnR+XqZxEuWOMw7KzzKROrx3MLeJpFnMOs78S9M5eZ+X5RieS9UcSFQqbeXzbfWuX/W9Pyajinqw==",856+ "license": "Apache-2.0",857+ "engines": {858+ "node": ">=4",859+ "npm": ">=3",860+ "yarn": ">=1.3.0"861+ }862+ },863+ "node_modules/index-array-by": {864+ "version": "1.4.2",865+ "resolved": "https://registry.npmjs.org/index-array-by/-/index-array-by-1.4.2.tgz",866+ "integrity": "sha512-SP23P27OUKzXWEC/TOyWlwLviofQkCSCKONnc62eItjp69yCZZPqDQtr3Pw5gJDnPeUMqExmKydNZaJO0FU9pw==",867+ "license": "MIT",868+ "engines": {869+ "node": ">=12"870+ }871+ },872+ "node_modules/internmap": {873+ "version": "2.0.3",874+ "resolved": "https://registry.npmjs.org/internmap/-/internmap-2.0.3.tgz",875+ "integrity": "sha512-5Hh7Y1wQbvY5ooGgPbDaL5iYLAPzMTUrjMulskHLH6wnv/A+1q5rgEaiuqEjB+oxGXIVZs1FF+R/KPN3ZSQYYg==",876+ "license": "ISC",877+ "engines": {878+ "node": ">=12"879+ }880+ },881+ "node_modules/kapsule": {882+ "version": "1.16.3",883+ "resolved": "https://registry.npmjs.org/kapsule/-/kapsule-1.16.3.tgz",884+ "integrity": "sha512-4+5mNNf4vZDSwPhKprKwz3330iisPrb08JyMgbsdFrimBCKNHecua/WBwvVg3n7vwx0C1ARjfhwIpbrbd9n5wg==",885+ "license": "MIT",886+ "dependencies": {887+ "lodash-es": "4"888+ },889+ "engines": {890+ "node": ">=12"891+ }892+ },554893 "node_modules/lerc": {555894 "version": "3.0.0",556895 "resolved": "https://registry.npmjs.org/lerc/-/lerc-3.0.0.tgz",557896 "integrity": "sha512-Rm4J/WaHhRa93nCN2mwWDZFoRVF18G1f47C+kvQWyHGEZxFpTUi73p7lMVSAndyxGt6lJ2/CFbOcf9ra5p8aww==",558897 "license": "Apache-2.0"559898 },899+ "node_modules/lodash-es": {900+ "version": "4.18.1",901+ "resolved": "https://registry.npmjs.org/lodash-es/-/lodash-es-4.18.1.tgz",902+ "integrity": "sha512-J8xewKD/Gk22OZbhpOVSwcs60zhd95ESDwezOFuA3/099925PdHJ7OFHNTGtajL3AlZkykD32HykiMo+BIBI8A==",903+ "license": "MIT"904+ },560905 "node_modules/numcodecs": {561906 "version": "0.3.2",562907 "resolved": "https://registry.npmjs.org/numcodecs/-/numcodecs-0.3.2.tgz",@@ -618,6 +963,45 @@
618963 "pbf": "bin/pbf"619964 }620965 },966+ "node_modules/point-in-polygon-hao": {967+ "version": "1.2.4",968+ "resolved": "https://registry.npmjs.org/point-in-polygon-hao/-/point-in-polygon-hao-1.2.4.tgz",969+ "integrity": "sha512-x2pcvXeqhRHlNRdhLs/tgFapAbSSe86wa/eqmj1G6pWftbEs5aVRJhRGM6FYSUERKu0PjekJzMq0gsI2XyiclQ==",970+ "license": "MIT",971+ "dependencies": {972+ "robust-predicates": "^3.0.2"973+ }974+ },975+ "node_modules/polished": {976+ "version": "4.3.1",977+ "resolved": "https://registry.npmjs.org/polished/-/polished-4.3.1.tgz",978+ "integrity": "sha512-OBatVyC/N7SCW/FaDHrSd+vn0o5cS855TOmYi4OkdWUMSJCET/xip//ch8xGUvtr3i44X9LVyWwQlRMTN3pwSA==",979+ "license": "MIT",980+ "dependencies": {981+ "@babel/runtime": "^7.17.8"982+ },983+ "engines": {984+ "node": ">=10"985+ }986+ },987+ "node_modules/preact": {988+ "version": "10.29.8",989+ "resolved": "https://registry.npmjs.org/preact/-/preact-10.29.8.tgz",990+ "integrity": "sha512-ej2aVZ+vZ8WO7tvlQWRM9N63A0KzF9q4mWJfDUHgYaIofWY9hu74QdnQrjoPMmZi2/nZ5gN0bJCQF49xQqx09Q==",991+ "license": "MIT",992+ "funding": {993+ "type": "opencollective",994+ "url": "https://opencollective.com/preact"995+ },996+ "peerDependencies": {997+ "preact-render-to-string": ">=5"998+ },999+ "peerDependenciesMeta": {1000+ "preact-render-to-string": {1001+ "optional": true1002+ }1003+ }1004+ },6211005 "node_modules/protocol-buffers-schema": {6221006 "version": "3.6.1",6231007 "resolved": "https://registry.npmjs.org/protocol-buffers-schema/-/protocol-buffers-schema-3.6.1.tgz",@@ -666,6 +1050,141 @@
6661050 "protocol-buffers-schema": "^3.3.1"6671051 }6681052 },1053+ "node_modules/robust-predicates": {1054+ "version": "3.0.3",1055+ "resolved": "https://registry.npmjs.org/robust-predicates/-/robust-predicates-3.0.3.tgz",1056+ "integrity": "sha512-NS3levdsRIUOmiJ8FZWCP7LG3QpJyrs/TE0Zpf1yvZu8cAJJ6QMW92H1c7kWpdIHo8RvmLxN/o2JXTKHp74lUA==",1057+ "license": "Unlicense"1058+ },1059+ "node_modules/simplesignal": {1060+ "version": "2.1.7",1061+ "resolved": "https://registry.npmjs.org/simplesignal/-/simplesignal-2.1.7.tgz",1062+ "integrity": "sha512-PEo2qWpUke7IMhlqiBxrulIFvhJRLkl1ih52Rwa+bPjzhJepcd4GIjn2RiQmFSx3dQvsEAgF0/lXMwMN7vODaA==",1063+ "license": "MIT"1064+ },1065+ "node_modules/three": {1066+ "version": "0.185.1",1067+ "resolved": "https://registry.npmjs.org/three/-/three-0.185.1.tgz",1068+ "integrity": "sha512-5aojFCXKwnjBRZvUnt3WFfEcvUJgkN5LlijRFN95hMy8WVkG4I0QNcJE+OuWvuJ0bOdStrbfXn0pkd6/QyiAlg==",1069+ "license": "MIT"1070+ },1071+ "node_modules/three-conic-polygon-geometry": {1072+ "version": "2.1.3",1073+ "resolved": "https://registry.npmjs.org/three-conic-polygon-geometry/-/three-conic-polygon-geometry-2.1.3.tgz",1074+ "integrity": "sha512-7KYcgd7rYg91L8AnCEddeyhw4qlv9+8NAI0luHq7QGt26icWUGNCsvLyD+u6FPKjP+un3zGBi4JGzqgGpmBSWA==",1075+ "license": "MIT",1076+ "dependencies": {1077+ "@turf/boolean-point-in-polygon": "^7.2",1078+ "d3-array": "1 - 3",1079+ "d3-geo": "1 - 3",1080+ "d3-geo-voronoi": "2",1081+ "d3-scale": "1 - 4",1082+ "delaunator": "5",1083+ "earcut": "3"1084+ },1085+ "engines": {1086+ "node": ">=12"1087+ },1088+ "peerDependencies": {1089+ "three": ">=0.72.0"1090+ }1091+ },1092+ "node_modules/three-geojson-geometry": {1093+ "version": "2.1.1",1094+ "resolved": "https://registry.npmjs.org/three-geojson-geometry/-/three-geojson-geometry-2.1.1.tgz",1095+ "integrity": "sha512-dC7bF3ri1goDcihYhzACHOBQqu7YNNazYLa2bSydVIiJUb3jDFojKSy+gNj2pMkqZNSVjssSmdY9zlmnhEpr1w==",1096+ "license": "MIT",1097+ "dependencies": {1098+ "d3-geo": "1 - 3",1099+ "d3-interpolate": "1 - 3",1100+ "earcut": "3"1101+ },1102+ "engines": {1103+ "node": ">=12"1104+ },1105+ "peerDependencies": {1106+ "three": ">=0.72.0"1107+ }1108+ },1109+ "node_modules/three-globe": {1110+ "version": "2.45.2",1111+ "resolved": "https://registry.npmjs.org/three-globe/-/three-globe-2.45.2.tgz",1112+ "integrity": "sha512-3qJE2LAdyHsUPt02mgMRc+PG3j9kGEA0fUYrwKPGIVtvMR1XjDn9hCXu31AWocdgHOFcXkrRVz7jJZzTIvR0eQ==",1113+ "license": "MIT",1114+ "dependencies": {1115+ "@tweenjs/tween.js": "18 - 25",1116+ "accessor-fn": "1",1117+ "d3-array": "3",1118+ "d3-color": "3",1119+ "d3-geo": "3",1120+ "d3-interpolate": "3",1121+ "d3-scale": "4",1122+ "d3-scale-chromatic": "3",1123+ "data-bind-mapper": "1",1124+ "frame-ticker": "1",1125+ "h3-js": "4",1126+ "index-array-by": "1",1127+ "kapsule": "^1.16",1128+ "three-conic-polygon-geometry": "2",1129+ "three-geojson-geometry": "2",1130+ "three-slippy-map-globe": "1",1131+ "tinycolor2": "1"1132+ },1133+ "engines": {1134+ "node": ">=12"1135+ },1136+ "peerDependencies": {1137+ "three": ">=0.154"1138+ }1139+ },1140+ "node_modules/three-render-objects": {1141+ "version": "1.42.0",1142+ "resolved": "https://registry.npmjs.org/three-render-objects/-/three-render-objects-1.42.0.tgz",1143+ "integrity": "sha512-KYfkPrYGEbIK8ChFocWqOF1aAN80FBUBWVYB8mB2oBpVuVN+52FvvngVYB5ieFANQu7Rt21rPYZ/xKaAgVWWRQ==",1144+ "license": "MIT",1145+ "dependencies": {1146+ "@tweenjs/tween.js": "18 - 25",1147+ "accessor-fn": "1",1148+ "float-tooltip": "^1.7",1149+ "kapsule": "^1.16",1150+ "polished": "4"1151+ },1152+ "engines": {1153+ "node": ">=12"1154+ },1155+ "peerDependencies": {1156+ "three": ">=0.179"1157+ }1158+ },1159+ "node_modules/three-slippy-map-globe": {1160+ "version": "1.0.6",1161+ "resolved": "https://registry.npmjs.org/three-slippy-map-globe/-/three-slippy-map-globe-1.0.6.tgz",1162+ "integrity": "sha512-PCUR+X+1kYFYtQBf8+b/ct8xBHtnkeu7FItRYBeFxyIe3ksnGuLi0H9RAxAfVSSUsZVbKIKNz9q1atEjynrrkg==",1163+ "license": "MIT",1164+ "dependencies": {1165+ "d3-geo": "1 - 3",1166+ "d3-octree": "^1.1",1167+ "d3-scale": "1 - 4"1168+ },1169+ "engines": {1170+ "node": ">=12"1171+ },1172+ "peerDependencies": {1173+ "three": ">=0.154"1174+ }1175+ },1176+ "node_modules/tinycolor2": {1177+ "version": "1.6.0",1178+ "resolved": "https://registry.npmjs.org/tinycolor2/-/tinycolor2-1.6.0.tgz",1179+ "integrity": "sha512-XPaBkWQJdsf3pLKJV9p4qN/S+fm2Oj8AIPo1BTUhg5oxkvm9+SVEGFdhyOz7tTdUTfvxMiAs4sp6/eZO2Ew+pw==",1180+ "license": "MIT"1181+ },1182+ "node_modules/tslib": {1183+ "version": "2.8.1",1184+ "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.8.1.tgz",1185+ "integrity": "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==",1186+ "license": "0BSD"1187+ },6691188 "node_modules/unzipit": {6701189 "version": "2.0.0",6711190 "resolved": "https://registry.npmjs.org/unzipit/-/unzipit-2.0.0.tgz",@@ -19,6 +19,9 @@ export function revealPin(pin) {
1919 2020 export function showPin(pin, focus = false) {2121 state.selectedPin = pin;22+ // Anything else drawing the selection -- the globe -- hears about it the23+ // same moment the chart's layers do.24+ document.dispatchEvent(new Event("atlas:selection"));2225 refreshPrioritySource();2326 state.layers.pins.changed();2427 state.layers.pinLabels.changed();@@ -130,6 +133,7 @@ export function renderDetailLinks(pin) {
130133 export function closeDetail() {131134 const hadSelection = state.selectedPin !== null;132135 state.selectedPin = null;136+ document.dispatchEvent(new Event("atlas:selection"));133137 if (state.sources) {134138 refreshPrioritySource();135139 state.layers.pins.changed();@@ -14,6 +14,8 @@ export const elements = {
1414 dockRailName: $("#dock-rail-name"),1515 visibleCount: $("#visible-count"),1616 viewport: $("#map"),17+ globe: $("#globe"),18+ globeToggle: $("#globe-toggle"),1719 layers: $("#layers"),1820 zoneToggle: $("#zone-toggle"),1921 zoneCount: $("#zone-count"),@@ -18,6 +18,7 @@ import {
1818 toggleSection,1919 } from "./legend.js";2020 import { applyPinFilters, setLabelsHeld } from "./pins.js";21+import { refreshGlobe, resizeGlobe, toggleGlobe } from "./globe.js";2122 import { jumpToZone, setZonesVisible, toggleZoneHighlight } from "./zones.js";2223 import { foldDockByHand, revealDock } from "./search.js";2324 import { importBundles } from "./library.js";@@ -42,7 +43,11 @@ export function bindUIEvents() {
4243 elements.map.addEventListener("change", () => { void selectMap(elements.map.value); });4344 elements.addBundles.addEventListener("click", () => { void importBundles(); });4445 elements.emptyOpen.addEventListener("click", () => { void importBundles(); });45- elements.variant.addEventListener("change", () => selectVariant(Number(elements.variant.value)));46+ elements.variant.addEventListener("change", () => {47+ selectVariant(Number(elements.variant.value));48+ refreshGlobe();49+ });50+ elements.globeToggle.addEventListener("click", () => toggleGlobe());4651 4752 elements.legend.addEventListener("change", (event) => {4853 const input = event.target;@@ -254,6 +259,7 @@ export function bindUIEvents() {
254259 window.addEventListener("resize", () => {255260 state.engine?.updateSize();256261 updateOverviewViewport();262+ resizeGlobe();257263 });258264 // Holding the pointer down steers the map: a reader crossing the world drags259265 // the locator there in one sweep instead of clicking their way across it.@@ -0,0 +1,263 @@
1+// The globe: a map that declares itself a sphere can be looked at as one.2+// The renderer is globe.gl -- three.js with the community's globe work3+// already done -- fed entirely from the bundle: the texture is composited4+// from the map's own equirectangular tiles, which drape a sphere with no5+// reprojection at all (u is x over width, v is y over height, exactly), and6+// every pin's position comes from running its packed synthetic coordinates7+// backward through the mapping the map declares. Pins stand off the surface8+// as billboards wearing the same haloed category icons the chart draws, the9+// selected one ringed and raised so it reads as chosen, and a click opens10+// the same card it opens on the chart. The chart never goes away: this is a11+// second way of seeing the same bundle, a toggle apart.12+import Globe from "globe.gl";13+import { Sprite, SpriteMaterial, TextureLoader } from "three";14+15+import { showPin } from "./detail.js";16+import { elements } from "./dom.js";17+import { equirectMapping, mapSurface } from "./semconv.js";18+import { state } from "./state.js";19+import { markerIconKey } from "./styles.js";20+import { categoryColor, iconOutsetColor, initials } from "./theme.js";21+import { project } from "./zones.js";22+23+// textureZoom picks the pyramid level the sphere wears: deep enough to read,24+// shallow enough that one canvas holds it everywhere (level 4 is a25+// 4096x2048 texture).26+const textureZoom = 4;27+28+let globe = null;29+let texturedFor = "";30+// The sprites standing on the sphere right now, by pin, so a selection or31+// filter change restyles them in place instead of rebuilding two thousand.32+const sprites = new Map();33+const placed = new Map();34+const materials = new Map();35+36+// syncGlobe is called whenever a map arrives or leaves: it puts the toggle37+// up only for maps that declare a sphere with a mapping the viewer can38+// invert, and always returns the reader to the chart, which is where every39+// map opens.40+export function syncGlobe() {41+ const offered = mapSurface(state.map) === "sphere" && equirectMapping(state.map) !== null;42+ elements.globeToggle.hidden = !offered;43+ leaveGlobe();44+ if (!offered && globe) {45+ globe._destructor();46+ globe = null;47+ texturedFor = "";48+ elements.globe.replaceChildren();49+ }50+}51+52+export function toggleGlobe() {53+ if (state.globeActive) leaveGlobe();54+ else void enterGlobe();55+}56+57+function leaveGlobe() {58+ state.globeActive = false;59+ elements.globe.hidden = true;60+ elements.globeToggle.setAttribute("aria-pressed", "false");61+ elements.viewport.hidden = false;62+}63+64+async function enterGlobe() {65+ const mapping = equirectMapping(state.map);66+ if (!mapping) return;67+ state.globeActive = true;68+ elements.viewport.hidden = true;69+ elements.globe.hidden = false;70+ elements.globeToggle.setAttribute("aria-pressed", "true");71+72+ if (!globe) {73+ globe = Globe({ animateIn: false })(elements.globe)74+ .backgroundColor("#0b0e12")75+ .showAtmosphere(true)76+ .atmosphereColor("#8a6f5b")77+ .atmosphereAltitude(0.12)78+ .objectLat((point) => point.lat)79+ .objectLng((point) => point.lng)80+ .objectAltitude((point) => (point.pin === state.selectedPin ? 0.03 : 0.014))81+ .objectThreeObject((point) => spriteFor(point.pin))82+ .objectLabel((point) => point.pin.location.title)83+ .onObjectClick((point) => showPin(point.pin))84+ .onObjectHover((point) => {85+ elements.globe.style.cursor = point ? "pointer" : "";86+ });87+ globe.pointOfView({ lat: 10, lng: 0, altitude: 2.2 });88+ document.addEventListener("atlas:selection", syncSelection);89+ document.addEventListener("atlas:filters", syncFilters);90+ }91+ resizeGlobe();92+93+ const variant = state.variant || state.map.variants[0];94+ const key = `${state.game.stamp}:${state.map.slug}:${variant.tiles}`;95+ if (texturedFor !== key) {96+ texturedFor = key;97+ const texture = await composeTexture(variant);98+ if (texture && texturedFor === key) {99+ globe.globeImageUrl(texture);100+ }101+ }102+ sprites.clear();103+ placed.clear();104+ globe.objectsData(spherePins(mapping));105+ syncFilters();106+}107+108+// syncSelection restyles the sprites a selection change touched: the chosen109+// pin grows, takes its ring, lifts a little higher off the ground -- and110+// the globe turns to face it, because a ring on the far side of a planet111+// selects nothing anyone can see.112+function syncSelection() {113+ if (!globe || !state.globeActive) return;114+ for (const [pin, sprite] of sprites) {115+ const selected = pin === state.selectedPin;116+ sprite.material = material(pin.category, selected);117+ const size = selected ? 9 : 5;118+ sprite.scale.set(size, size, 1);119+ }120+ // Altitude rides the accessor, so re-declaring it reseats the two that121+ // moved along with everyone else -- cheap at this scale.122+ globe.objectAltitude((point) => (point.pin === state.selectedPin ? 0.03 : 0.014));123+ const stood = placed.get(state.selectedPin);124+ if (stood) {125+ const altitude = globe.pointOfView().altitude;126+ globe.pointOfView({ lat: stood.lat, lng: stood.lng, altitude }, 600);127+ }128+}129+130+// syncFilters shows and hides sprites as the legend and the search decide,131+// the same visibility the chart draws from.132+function syncFilters() {133+ if (!globe || !state.globeActive) return;134+ for (const [pin, sprite] of sprites) {135+ sprite.visible = !pin.filteredHidden && !state.hiddenCategories.has(pin.category.id);136+ }137+}138+139+// spriteFor stands one pin up as a billboard wearing its category's icon --140+// the same haloed, tinted raster the chart composes -- so what a marker is141+// reads the same on the sphere as on the sheet.142+function spriteFor(pin) {143+ const sprite = new Sprite(material(pin.category, pin === state.selectedPin));144+ const size = pin === state.selectedPin ? 9 : 5;145+ sprite.scale.set(size, size, 1);146+ sprites.set(pin, sprite);147+ return sprite;148+}149+150+// material caches one sprite material per category and selection state. The151+// icon raster is the chart's own when it has arrived; a category still152+// waiting, or one with no artwork at all, wears its initials the same way153+// the chart's fallback draws them.154+function material(category, selected) {155+ const key = `${markerIconKey(category)}:${selected ? "ringed" : "plain"}`;156+ let held = materials.get(key);157+ if (held) return held;158+ held = new SpriteMaterial({ depthWrite: false });159+ materials.set(key, held);160+ const icon = state.markerIcons.get(markerIconKey(category));161+ const finish = (image) => {162+ const canvas = document.createElement("canvas");163+ canvas.width = 80;164+ canvas.height = 80;165+ const context = canvas.getContext("2d");166+ if (image) {167+ context.drawImage(image, 8, 8, 64, 64);168+ } else {169+ context.font = "900 26px Inter, system-ui, sans-serif";170+ context.textAlign = "center";171+ context.textBaseline = "middle";172+ context.lineWidth = 6;173+ context.strokeStyle = iconOutsetColor();174+ context.strokeText(initials(category.title), 40, 41);175+ context.fillStyle = categoryColor(category);176+ context.fillText(initials(category.title), 40, 41);177+ }178+ if (selected) {179+ context.beginPath();180+ context.arc(40, 40, 36, 0, Math.PI * 2);181+ context.lineWidth = 5;182+ context.strokeStyle = "#ffffff";183+ context.stroke();184+ }185+ new TextureLoader().load(canvas.toDataURL("image/png"), (texture) => {186+ held.map = texture;187+ held.needsUpdate = true;188+ });189+ };190+ if (icon) {191+ const image = new Image();192+ image.onload = () => finish(image);193+ image.onerror = () => finish(null);194+ image.src = icon;195+ } else {196+ finish(null);197+ }198+ return held;199+}200+201+// refreshGlobe re-enters the globe when what it shows has moved underneath202+// it: another raster variant chosen, a category switched in the legend.203+export function refreshGlobe() {204+ if (state.globeActive) void enterGlobe();205+}206+207+// resizeGlobe keeps the canvas the size of its pane; globe.gl sizes once at208+// construction and must be told when the pane moves.209+export function resizeGlobe() {210+ if (!globe || elements.globe.hidden) return;211+ globe.width(elements.globe.clientWidth).height(elements.globe.clientHeight);212+}213+214+// spherePins stands every visible pin on the planet: packed synthetic215+// coordinates, through the viewer's own projection to world pixels, then216+// backward through the declared mapping to true latitude and longitude.217+function spherePins(mapping) {218+ const points = [];219+ for (const pin of state.pins) {220+ const [x, negY] = project(pin.location.lat, pin.location.lng);221+ const [lat, lng] = mapping.toLatLng(x, -negY);222+ points.push({ lat, lng, pin });223+ placed.set(pin, { lat, lng });224+ }225+ return points;226+}227+228+// composeTexture stitches the sphere's skin from the bundle's own tiles at229+// one fixed level: the full width of the pyramid and the top half of its230+// rows, which is the whole planet by the declared mapping. The result rides231+// as a data URL, so the globe asks the app for nothing it has not already232+// been given.233+async function composeTexture(variant) {234+ const zoom = Math.min(textureZoom, variant.maxZoom);235+ const format = variant.formats[zoom];236+ if (!format) return null;237+ const columns = 2 ** zoom;238+ const rows = columns / 2;239+ const canvas = document.createElement("canvas");240+ canvas.width = columns * 256;241+ canvas.height = rows * 256;242+ const context = canvas.getContext("2d");243+ const jobs = [];244+ for (let y = 0; y < rows; y++) {245+ for (let x = 0; x < columns; x++) {246+ const url = `${state.game.base}/tiles/${variant.tiles}/${zoom}/${x}/${y}.${format}`;247+ jobs.push(loadTile(url).then((image) => {248+ if (image) context.drawImage(image, x * 256, y * 256, 256, 256);249+ }));250+ }251+ }252+ await Promise.all(jobs);253+ return canvas.toDataURL("image/jpeg", 0.92);254+}255+256+function loadTile(url) {257+ return new Promise((resolve) => {258+ const image = new Image();259+ image.onload = () => resolve(image);260+ image.onerror = () => resolve(null);261+ image.src = url;262+ });263+}@@ -11,6 +11,7 @@ import { createView, initializeMap, resolutions } from "./engine.js";
1111 import { renderOverview, setOverviewDocked } from "./overview.js";1212 import { setDockFolded } from "./search.js";1313 import { renderGrid } from "./grid.js";14+import { syncGlobe } from "./globe.js";1415 import { renderZones } from "./zones.js";1516 import { renderLegend } from "./legend.js";1617 import {@@ -102,6 +103,9 @@ export async function selectMap(slug) {
102103 renderZones();103104 buildPins();104105 selectVariant(restore ? clamp(restore.variant, 0, state.map.variants.length - 1) : 0, true);106+ // A map that declares itself a sphere offers the globe; every map opens107+ // on the chart either way.108+ syncGlobe();105109 // The remembered arrangement has been spent. Kept, it would be read again by106110 // the next thing that asks: a variant swap would drop the reader back where107111 // the session opened, and switching to another game would hand that game the@@ -57,6 +57,9 @@ export function applyPinFilters() {
5757 refreshPinRendering();5858 if (state.selectedPin?.filteredHidden) closeDetail();5959 renderSearchResults();60+ // Anything else drawing the pins -- the globe -- filters the same moment61+ // the chart does.62+ document.dispatchEvent(new Event("atlas:filters"));6063 }6164 6265 export function updateZonePinFocus() {@@ -17,3 +17,30 @@ export function renderAs(category) {
1717 export function mapSurface(map) {1818 return map?.attrs?.["atlas.geometry.surface"] || "plane";1919 }20+21+// equirectMapping reads the flattening a spherical map declares: the raster22+// window it fills in world pixels and the ground that window pictures in23+// degrees. It returns an inverter from world pixels back to true latitude24+// and longitude -- the whole story any reader needs to stand a packed pin25+// on the sphere -- or null when the declaration is absent or malformed,26+// which a validated bundle never is.27+export function equirectMapping(map) {28+ const attrs = map?.attrs || {};29+ if (attrs["atlas.geometry.projection"] !== "equirect") return null;30+ const px = (attrs["atlas.geometry.equirect.px"] || "").split(",").map(Number);31+ const deg = (attrs["atlas.geometry.equirect.deg"] || "").split(",").map(Number);32+ if (px.length !== 4 || deg.length !== 4 || px.some(Number.isNaN) || deg.some(Number.isNaN)) {33+ return null;34+ }35+ const [x, y, w, h] = px;36+ const [west, north, east, south] = deg;37+ if (!w || !h || north === south || west === east) return null;38+ return {39+ toLatLng(worldX, worldY) {40+ return [41+ north - ((worldY - y) / h) * (north - south),42+ west + ((worldX - x) / w) * (east - west),43+ ];44+ },45+ };46+}@@ -15,6 +15,9 @@ export const state = {
1515 hoveredPin: null,1616 labelsHeld: false,1717 gridEnabled: false,18+ // Whether the reader is looking at the planet instead of the chart: only19+ // a map that declares itself a sphere can turn this on.20+ globeActive: false,1821 // Whether the cells are drawn, which is a separate question from whether one1922 // of them is holding the map to a place.2023 subgridVisible: true,