clone

an offline map explorer where each world, from a game map to a city's open data, ships as one .atlas file

feat: speak volume, world, and lens

Dami committed 8cc56a0
The format's words were borrowed from its first subject: everything
was a "game", every ground a "map", every raster a "variant" --
and a city's dated revisions had to squat in vocabulary that was
never theirs. The concepts are now named for what they hold. A
library holds volumes: one .atlas file, one subject -- a game, a
planet, a city. A volume holds worlds: the distinct grounds a reader
stands on, which for a game are its maps and for a captured city are
its dated revisions. A world is seen through lenses: the rasters
that picture it -- alternate art, floors, elevation beside
photograph, a rendered basemap.

The rename runs through the wire format as version 2 -- manifest and
payload keys, worlds/ entries, the catalog, the serving routes --
with no compatibility shim, because every .atlas ever made came from
this archive and rebuilds in a breath. The crawl archive and the
mgdoc intermediate keep speaking MapGenie's game shape deliberately:
they mirror upstream, and the translation into Atlas's own words
happens where bundles are composed. Readers, workbench, and shell
follow: Volume, World and Lens pickers, /data/v/ serving, cartograph
volume pages, and the semantic conventions' world entity.
commit
8cc56a05cc42bab5b0ca3574913b7dff4154d30d
parent
b07f03b5ec06554be1a832f4ecbfd5d1cbf7fdc4
author
Dami <dami.etoile@gmail.com>
69 files changed, +901 -892
Massets/app.css2+-
Massets/app.js10+-
Massets/index.html26++--
Mcmd/cartograph/diff.go2+-
Mcmd/cartograph/diff_test.go10+-
Mcmd/cartograph/library.go34+++---
Mcmd/cartograph/measure_test.go16+-
Mcmd/cartograph/server.go28++--
Mcmd/cartograph/server_test.go10+-
Mcmd/cartograph/sources.go14+-
Mcmd/cartograph/ui/collection.tmpl10+-
Mcmd/cartograph/ui/diff.tmpl6+-
Mcmd/cartograph/ui/sources.tmpl2+-
Rcmd/cartograph/ui/game.tmpl → cmd/cartograph/ui/volume.tmpl18+-
Mfrontend/css/map-pickers.css4+-
Mfrontend/src/boot.js14+-
Mfrontend/src/catalog.js16+-
Mfrontend/src/cellsystems/geohash.js4+-
Mfrontend/src/cellsystems/index.js8+-
Mfrontend/src/constants.js4+-
Mfrontend/src/detail.js12+-
Mfrontend/src/diagnostics.js12+-
Mfrontend/src/dom.js8+-
Mfrontend/src/engine.js6+-
Mfrontend/src/events.js20++--
Mfrontend/src/globe.js52++++----
Mfrontend/src/grid.js10+-
Mfrontend/src/legend.js20++--
Mfrontend/src/library.js42+++---
Mfrontend/src/navigation.js134+++++++++++-----------
Mfrontend/src/overview.js30++--
Mfrontend/src/pins.js6+-
Mfrontend/src/search.js2+-
Mfrontend/src/semconv.js4+-
Mfrontend/src/session.js38+++---
Mfrontend/src/state.js14+-
Mfrontend/src/styles.js2+-
Mfrontend/src/theme.js8+-
Mfrontend/src/zones.js12+-
Mfrontend/test/cellsystems.test.mjs8+-
Minternal/arcgismap/arcgismap.go9+-
Minternal/arcgismap/arcgismap_test.go2+-
Minternal/bundle/bundle.go98++++++++-------
Minternal/bundle/bundle_test.go54++++----
Minternal/bundle/bundletest/bundletest.go30++--
Minternal/bundle/locations.go2+-
Minternal/bundle/read.go75++++++------
Minternal/bundle/registry.go86+++++++-------
Minternal/bundle/registry_test.go24++--
Minternal/bundle/stamp.go12+-
Minternal/measure/measure.go62+++++-----
Minternal/semconv/REGISTRY.md18+-
Minternal/semconv/semconv.go20++--
Minternal/semconv/semconv_test.go12+-
Minternal/trekmap/trekmap.go3+-
Mmain.go8+-
Mroutes.go12+-
Mroutes_test.go64+++++-----
Mtools/generate/bundles.go74++++++------
Mtools/generate/main.go190+++++++++++++++---------------
Mtools/generate/main_test.go32+++---
Mtools/generate/merge.go82++++++------
Mtools/generate/shard.go54++++----
Mtools/generate/split.go16+-
Mtools/maturity/main.go10+-
Mtools/tiles/main.go44+++---
Mtools/tiles/stamp.go6+-
Mtools/tiles/stamp_test.go2+-
Mtools/tiles/warp.go14+-
M assets/app.css +1 -1
@@ -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}.globe{position:absolute;inset:0;background:#0b0e12;overflow:hidden}.globe[hidden],.map-pickers .globe-toggle[hidden]{display:none}.map-pickers .globe-toggle{display:grid;width:30px;height:30px;margin-left:auto;padding:0;place-items:center;border:0;border-radius:7px;background:transparent;color:var(--muted);cursor:pointer}.map-pickers .globe-toggle svg{width:15px;height:15px;fill:none;stroke:currentColor;stroke-linecap:round;stroke-width:1.8}.map-pickers .globe-toggle:hover{background:#ffffff0d;color:var(--text-strong)}.map-pickers .globe-toggle:focus-visible{box-shadow:0 0 0 2px #3aa5c999;outline:none}.map-pickers .globe-toggle[aria-pressed=true]{background:var(--accent-wash);color:var(--accent)}.map-pickers .globe-toggle:not([hidden])~.add-bundles{margin-left:6px}.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}#lens-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],.map-pickers .globe-toggle[hidden]{display:none}.map-pickers .globe-toggle{display:grid;width:30px;height:30px;margin-left:auto;padding:0;place-items:center;border:0;border-radius:7px;background:transparent;color:var(--muted);cursor:pointer}.map-pickers .globe-toggle svg{width:15px;height:15px;fill:none;stroke:currentColor;stroke-linecap:round;stroke-width:1.8}.map-pickers .globe-toggle:hover{background:#ffffff0d;color:var(--text-strong)}.map-pickers .globe-toggle:focus-visible{box-shadow:0 0 0 2px #3aa5c999;outline:none}.map-pickers .globe-toggle[aria-pressed=true]{background:var(--accent-wash);color:var(--accent)}.map-pickers .globe-toggle:not([hidden])~.add-bundles{margin-left:6px}.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))}}
M assets/app.js +5 -5
@@ -1,9 +1,9 @@
1-(()=>{var Jse=Object.create;var eP=Object.defineProperty;var eoe=Object.getOwnPropertyDescriptor;var toe=Object.getOwnPropertyNames;var noe=Object.getPrototypeOf,ioe=Object.prototype.hasOwnProperty;var roe=(i,e)=>()=>{try{return e||i((e={exports:{}}).exports,e),e.exports}catch(t){throw e=0,t}},soe=(i,e)=>{for(var t in e)eP(i,t,{get:e[t],enumerable:!0})},ooe=(i,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of toe(e))!ioe.call(i,r)&&r!==t&&eP(i,r,{get:()=>e[r],enumerable:!(n=eoe(e,r))||n.enumerable});return i};var aoe=(i,e,t)=>(t=i!=null?Jse(noe(i)):{},ooe(e||!i||!i.__esModule?eP(t,"default",{value:i,enumerable:!0}):t,i));var j$=roe((yv,H6)=>{(function(i,e){typeof yv=="object"&&typeof H6=="object"?H6.exports=e():typeof define=="function"&&define.amd?define("FrameTicker",[],e):typeof yv=="object"?yv.FrameTicker=e():i.FrameTicker=e()})(yv,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 lG=i=>new Promise(e=>setTimeout(e,i)),ls=i=>document.querySelector(i);async function loe(){for(let i=0;i<300&&!(window.__atlasDebug&&!ls("#map-loading")?.checkVisibility?.());i+=1)await lG(100)}async function coe(){let i="";for(let e=0;e<100;e+=1){await lG(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 md(i,e={}){window.dispatchEvent(new KeyboardEvent("keydown",{key:i,bubbles:!0,cancelable:!0,...e}))}function uoe(i,e={}){window.dispatchEvent(new KeyboardEvent("keyup",{key:i,bubbles:!0,cancelable:!0,...e}))}function hoe(i){ls("#map").dispatchEvent(new KeyboardEvent("keydown",{key:i,bubbles:!0,cancelable:!0}))}function O0(i,e){i.value=e,i.dispatchEvent(new Event("change",{bubbles:!0}))}function tP(i,e){let t=ls(i);t.value=e,t.dispatchEvent(new Event("input",{bubbles:!0}))}function nP(i,e=!1){let t=ls("#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 foe(){let i=[],e=async p=>{await coe(),i.push({name:p,snapshot:JSON.parse(window.render_game_to_text())})};await loe(),localStorage.clear();let t=ls("#game-select"),n=t.options[0].value;O0(t,n),await e("initial"),tP("#pin-search","a"),await e("search-a");let r=ls(".search-result");r&&(r.click(),await e("search-select-first"),ls("#close-detail").click(),await e("detail-closed")),tP("#pin-search",""),await e("search-cleared");let s=ls(".category-row input");s&&(s.click(),await e("category-hidden"),s.click(),await e("category-restored"));let o=ls(".only-button");if(o){o.click(),await e("solo-first");let p=ls("#solo-chip");p&&!p.hidden&&p.click(),await e("solo-cleared")}let a=ls("#legend .layer-title");a&&(a.click(),await e("section-folded"),ls("#expand-all").click(),await e("sections-unfolded")),ls("#hide-all").click(),await e("all-hidden"),ls("#show-all").click(),await e("all-shown");let l=ls(".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")),md("g"),await e("grid-open"),tP("#grid-input","m"),await e("grid-descended"),md(" "),await e("subgrid-hidden"),md(" "),md("Escape"),await e("grid-ascended"),md("Escape"),await e("grid-closed"),md("z"),await e("labels-on"),uoe("z"),await e("labels-off"),md("b",{metaKey:!0}),await e("sidebar-collapsed"),md("b",{metaKey:!0}),await e("sidebar-restored"),ls("#zoom-in").click(),await e("zoomed-in");let c=ls("#overview-dock");c&&!ls("#overview-shelf").hidden&&(c.click(),await e("overview-docked"),c.click(),await e("overview-undocked")),ls("#zoom-out").click(),await e("zoomed-out"),hoe("Escape"),await e("viewport-escape");let u=ls("#variant-select");u.options.length>1&&(O0(u,u.options[1].value),await e("variant-second"),O0(u,u.options[0].value),await e("variant-first"));let f=ls("#map-select");return f.options.length>1&&(O0(f,f.options[1].value),await e("map-second"),O0(f,f.options[0].value),await e("map-first")),t.options.length>1&&(O0(t,t.options[1].value),await e("game-second"),O0(t,n),await e("game-first")),localStorage.clear(),{viewport:[window.innerWidth,window.innerHeight],steps:i}}var iP=!1;async function cG(){if(!iP){iP=!0,nP("parity tour running\u2026");try{let i=await foe(),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}`);nP(`parity tour complete \u2713 ${i.steps.length} steps`),console.log("parity tour saved to",t)}catch(i){nP(`parity tour failed: ${i}`,!0),console.error("parity tour failed",i)}finally{iP=!1}}}window.__atlasTour=cG;window.addEventListener("keydown",i=>{i.key==="F9"&&cG()});var nn=i=>document.querySelector(i),ye={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 B0(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 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,gridSystem:"geohash",globeActive:!1,subgridVisible:!0,gridCell:"",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 U0=["#4fb3d5","#c9924b","#82b56a","#c96a6a","#9581cc","#4bc9a9","#d4b04a","#6a92c9","#b08a5a","#8fb3a2"],k0="0123456789bcdefghjkmnpqrstuvwxyz";var rP="atlas.session";var uG={light:"rgba(255, 255, 255, 0.96)",dark:"rgba(7, 9, 7, 0.98)"},Li={labelSizePx:11,neighborLabelSizePx:10,labelInsetPx:5,labelFont:"ui-monospace, SFMono-Regular, Menlo, monospace",prefixAlpha:.55,chip:"rgba(12, 15, 22, 0.76)",neighborChip:"rgba(8, 11, 18, 0.88)",lineWhite:"#ffffff",widths:{leaf:2.5,scope:2.5,scopeBare:1.8,child:1.4,neighbor:1},childLineAlpha:.82,neighborLineAlpha:.44,leafFillAlpha:.14,childFillAlpha:.055,neighborTextAlpha:.72,dimColor:"#050810",dimBase:.3,dimStep:.06,dimCap:.52};function fw(i){let e=[...cg()],t=!0;for(let n of i){let r=k0.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 oP(i,e){let t=[...cg()],[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+=k0[l]}return o}var sP={key:null,extent:null};function doe(i){let t=`${cg().join(",")}|${i}`;return sP.key!==t&&(sP={key:t,extent:fw(i)}),sP.extent}var aP={slug:"geohash",name:"Geohash",appliesTo(){return!0},maxLevel(){return 3},inputLength(){return 3},level(i){return i.length},parent(i){return i.slice(0,-1)},children(i){return[...k0].map(e=>i+e)},childIndex(i){return Math.max(0,k0.indexOf(i[i.length-1]))},contains(i,e){let t=doe(i),[n,r]=e;return n>=t[0]&&n<=t[2]&&r>=t[1]&&r<=t[3]},descendTarget(i,e){return oP(e,i.length+1)},bbox:fw,center(i){let e=fw(i);return[(e[0]+e[2])/2,(e[1]+e[3])/2]},ring(i){let[e,t,n,r]=fw(i);return[[e,t],[e,r],[n,r],[n,t],[e,t]]},poleContained(){return null},label(i){return{context:i.slice(0,-1),principal:i.slice(-1)}},colorKey(i){return Math.max(0,k0.indexOf(i[i.length-1]))%U0.length},normalizeInput(i){return[...i.toLocaleLowerCase()].filter(e=>k0.includes(e)).slice(0,3).join("")},parseInput(i){return i},locate(i){let e=oP(i,3);return e?{label:"Geohash",value:e}:null}};function hG(i,e=3){return oP(i,e)}function cg(){let i=U.variant?.surface;if(i)return[i.x,-(i.y+i.height),i.x+i.width,-i.y];let e=U.game?.tileGrid.size??0,t=U.variant?.bounds||{x:0,y:0,width:e,height:e};return[t.x,-(t.y+t.height),t.x+t.width,-t.y]}var poe=[aP];function uo(){return poe.find(i=>i.slug===U.gridSystem)||aP}function fG(i,e,t){let n=i[0]===i[i.length-1]||Aoe(i[0],i[i.length-1])?i.slice(0,-1):[...i];for(let[r,s]of[[e,([o])=>o>=e],[t,([o])=>o<=t]]){let o=[];for(let a=0;a<n.length;a++){let l=n[a],c=n[(a+n.length-1)%n.length],u=s(l),f=s(c);if(u!==f){let p=(r-c[0])/(l[0]-c[0]);o.push([r,c[1]+p*(l[1]-c[1])])}u&&o.push(l)}if(n=o,n.length===0)return[]}return[...n,n[0]]}function Aoe(i,e){return i[0]===e[0]&&i[1]===e[1]}var ys={UNKNOWN:0,INTERSECTING:1,ABOVE:2,RIGHT:4,BELOW:8,LEFT:16};function lP(i){let e=Pr();for(let t=0,n=i.length;t<n;++t)V0(e,i[t]);return e}function moe(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 dl(n,r,s,o,t)}function ug(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 pw(i,e){return e?(e[0]=i[0],e[1]=i[1],e[2]=i[2],e[3]=i[3],e):i.slice()}function gd(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 wc(i,e){return vx(i,e[0],e[1])}function xu(i,e){return i[0]<=e[0]&&e[2]<=i[2]&&i[1]<=e[1]&&e[3]<=i[3]}function vx(i,e,t){return i[0]<=e&&e<=i[2]&&i[1]<=t&&t<=i[3]}function dw(i,e){let t=i[0],n=i[1],r=i[2],s=i[3],o=e[0],a=e[1],l=ys.UNKNOWN;return o<t?l=l|ys.LEFT:o>r&&(l=l|ys.RIGHT),a<n?l=l|ys.BELOW:a>s&&(l=l|ys.ABOVE),l===ys.UNKNOWN&&(l=ys.INTERSECTING),l}function Pr(){return[1/0,1/0,-1/0,-1/0]}function dl(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 G0(i){return dl(1/0,1/0,-1/0,-1/0,i)}function Aw(i,e){let t=i[0],n=i[1];return dl(t,n,t,n,e)}function hg(i,e,t,n,r){let s=G0(r);return cP(s,i,e,t,n)}function z0(i,e){return i[0]==e[0]&&i[2]==e[2]&&i[1]==e[1]&&i[3]==e[3]}function mw(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 V0(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 cP(i,e,t,n,r){for(;t<n;t+=r)goe(i,e[t],e[t+1]);return i}function goe(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 gw(i,e){let t;return t=e(fg(i)),t||(t=e(dg(i)),t)||(t=e(pg(i)),t)||(t=e(Wl(i)),t)?t:!1}function bx(i){let e=0;return vu(i)||(e=jn(i)*xr(i)),e}function fg(i){return[i[0],i[1]]}function dg(i){return[i[2],i[1]]}function za(i){return[(i[0]+i[2])/2,(i[1]+i[3])/2]}function dG(i,e){let t;if(e==="bottom-left")t=fg(i);else if(e==="bottom-right")t=dg(i);else if(e==="top-left")t=Wl(i);else if(e==="top-right")t=pg(i);else throw new Error("Invalid corner");return t}function wx(i,e,t,n,r){let[s,o,a,l,c,u,f,p]=uP(i,e,t,n);return dl(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 uP(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 xr(i){return i[3]-i[1]}function yu(i,e,t){let n=t||Pr();return yr(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]):G0(n),n}function hP(i,e){if(!yr(i,e))return[i.slice()];if(xu(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 Wl(i){return[i[0],i[3]]}function pg(i){return[i[2],i[3]]}function jn(i){return i[2]-i[0]}function yr(i,e){return i[0]<=e[2]&&i[2]>=e[0]&&i[1]<=e[3]&&i[3]>=e[1]}function vu(i){return i[2]<i[0]||i[3]<i[1]}function pG(i,e){return e?(e[0]=i[0],e[1]=i[1],e[2]=i[2],e[3]=i[3],e):i}function AG(i,e,t){let n=!1,r=dw(i,e),s=dw(i,t);if(r===ys.INTERSECTING||s===ys.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],v=(x-f)/(p-u),w,S;s&ys.ABOVE&&!(r&ys.ABOVE)&&(w=p-(x-c)/v,n=w>=o&&w<=l),!n&&s&ys.RIGHT&&!(r&ys.RIGHT)&&(S=x-(p-l)*v,n=S>=a&&S<=c),!n&&s&ys.BELOW&&!(r&ys.BELOW)&&(w=p-(x-a)/v,n=w>=o&&w<=l),!n&&s&ys.LEFT&&!(r&ys.LEFT)&&(S=x-(p-o)*v,n=S>=a&&S<=c)}return n}function mG(i,e,t,n){if(vu(i))return G0(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 moe(s,o,t)}function fP(i,e){let t=e.getExtent(),n=za(i);if(e.canWrapX()&&(n[0]<t[0]||n[0]>=t[2])){let r=jn(t),o=Math.floor((n[0]-t[0])/r)*r;i[0]-=o,i[2]-=o}return i}function _w(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]]];fP(i,e);let r=jn(n);if(jn(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 gG(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(...hP(t[o],e[n]));t=s}return t}var _G={info:1,warn:2,error:3,none:4},_oe=_G.info;function xw(...i){_oe>_G.warn||console.warn(...i)}function xi(i,e,t){return Math.min(Math.max(i,e),t)}function xG(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 Sc(i,e,t,n)}function Sc(i,e,t,n){let r=t-i,s=n-e;return r*r+s*s}function yG(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 yw(i){return i*180/Math.PI}function Tc(i){return i*Math.PI/180}function bu(i,e){let t=i%e;return t*e<0?t+e:t}function Fo(i,e,t){return i+t*(e-i)}function q0(i,e){let t=Math.pow(10,e);return Math.round(i*t)/t}function Sx(i,e){return Math.floor(q0(i,e))}function Tx(i,e){return Math.ceil(q0(i,e))}function vw(i,e,t){if(i>=e&&i<t)return i;let n=t-e;return((i-e)%n+n)%n+e}function vG(i,e){return i[0]+=+e[0],i[1]+=+e[1],i}function H0(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 Ag(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 bG(i,e){return i[0]*=e,i[1]*=e,i}function bw(i,e){if(e.canWrapX()){let t=jn(e.getExtent()),n=wG(i,e,t);n&&(i[0]-=n*t)}return i}function wG(i,e,t){let n=e.getExtent(),r=0;return e.canWrapX()&&(i[0]<n[0]||i[0]>n[2])&&(t=t||jn(n),r=Math.floor((i[0]-n[0])/t)),r}function SG(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(xi(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 tf={radians:6370997/(2*Math.PI),degrees:2*Math.PI*6370997/360,ft:.3048,m:1,"us-ft":1200/3937};var dP=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_||tf[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_}},_d=dP;var Ex=6378137,mg=Math.PI*Ex,xoe=[-mg,-mg,mg,mg],yoe=[-180,-85,180,85],ww=Ex*Math.log(Math.tan(Math.PI/2)),xd=class extends _d{constructor(e){super({code:e,units:"m",extent:xoe,global:!0,worldExtent:yoe,getPointResolution:function(t,n){return t/Math.cosh(n[1]/Ex)}})}},pP=[new xd("EPSG:3857"),new xd("EPSG:102100"),new xd("EPSG:102113"),new xd("EPSG:900913"),new xd("http://www.opengis.net/def/crs/EPSG/0/3857"),new xd("http://www.opengis.net/gml/srs/epsg.xml#3857")];function TG(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]=mg*i[s]/180;let o=Ex*Math.log(Math.tan(Math.PI*(+i[s+1]+90)/360));o>ww?o=ww:o<-ww&&(o=-ww),e[s+1]=o}return e}function EG(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]/mg,e[s+1]=360*Math.atan(Math.exp(i[s+1]/Ex))/Math.PI-90;return e}var voe=6378137,MG=[-180,-90,180,90],boe=Math.PI*voe/180,nf=class extends _d{constructor(e,t){super({code:e,units:"degrees",extent:MG,axisOrientation:t,global:!0,metersPerUnit:boe,worldExtent:MG})}},AP=[new nf("CRS:84"),new nf("EPSG:4326","neu"),new nf("urn:ogc:def:crs:OGC:1.3:CRS84"),new nf("urn:ogc:def:crs:OGC:2:84"),new nf("http://www.opengis.net/def/crs/OGC/1.3/CRS84"),new nf("http://www.opengis.net/gml/srs/epsg.xml#4326","neu"),new nf("http://www.opengis.net/def/crs/EPSG/0/4326","neu")];var mP={};function CG(i){return mP[i]||mP[i.replace(/urn:(x-)?ogc:def:crs:EPSG:(.*:)?(\w+)$/,"EPSG:$3")]||null}function RG(i,e){mP[i]=e}function wu(i){for(let e in i)delete i[e]}function Ec(i){let e;for(e in i)return!1;return!e}var gg={};function _g(i,e,t){let n=i.getCode(),r=e.getCode();n in gg||(gg[n]={}),gg[n][r]=t}function Sw(i,e){return i in gg&&e in gg[i]?gg[i][e]:null}var Tw=.9996,jl=.00669438,Mw=jl*jl,Cw=Mw*jl,W0=jl/(1-jl),PG=Math.sqrt(1-jl),xg=(1-PG)/(1+PG),DG=xg*xg,gP=DG*xg,_P=gP*xg,FG=_P*xg,OG=1-jl/4-3*Mw/64-5*Cw/256,woe=3*jl/8+3*Mw/32+45*Cw/1024,Soe=15*Mw/256+45*Cw/1024,Toe=35*Cw/3072,Eoe=3/2*xg-27/32*gP+269/512*FG,Moe=21/16*DG-55/32*_P,Coe=151/96*gP-417/128*FG,Roe=1097/512*_P,Ew=6378137;function Poe(i,e,t){let n=i-5e5,o=(t.north?e:e-1e7)/Tw/(Ew*OG),a=o+Eoe*Math.sin(2*o)+Moe*Math.sin(4*o)+Coe*Math.sin(6*o)+Roe*Math.sin(8*o),l=Math.sin(a),c=l*l,u=Math.cos(a),f=l/u,p=f*f,x=p*p,v=1-jl*c,w=Math.sqrt(1-jl*c),S=Ew/w,T=(1-jl)/v,R=W0*u**2,P=R*R,C=n/(S*Tw),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*R-4*P-9*W0))+B/720*(61+90*p+298*R+45*x-252*W0-3*P),V=(C-D/6*(1+2*p+R)+N/120*(5-2*R+28*p-3*P+8*W0+24*x))/u;return V=vw(V+Tc(BG(t.number)),-Math.PI,Math.PI),[yw(V),yw(z)]}var IG=-80,NG=84,Ioe=-180,Noe=180;function Loe(i,e,t){i=vw(i,Ioe,Noe),e<IG?e=IG:e>NG&&(e=NG);let n=Tc(e),r=Math.sin(n),s=Math.cos(n),o=r/s,a=o*o,l=a*a,c=Tc(i),u=BG(t.number),f=Tc(u),p=Ew/Math.sqrt(1-jl*r**2),x=W0*s**2,v=s*vw(c-f,-Math.PI,Math.PI),w=v*v,S=w*v,T=S*v,R=T*v,P=R*v,C=Ew*(OG*n-woe*Math.sin(2*n)+Soe*Math.sin(4*n)-Toe*Math.sin(6*n)),L=Tw*p*(v+S/6*(1-a+x)+R/120*(5-18*a+l+72*x-58*W0))+5e5,D=Tw*(C+p*o*(w/2+T/24*(5-a+9*x+4*x**2)+P/720*(61-58*a+l+600*x-330*W0)));return t.north||(D+=1e7),[L,D]}function BG(i){return(i-1)*6-180+3}var Doe=[/^EPSG:(\d+)$/,/^urn:ogc:def:crs:EPSG::(\d+)$/,/^http:\/\/www\.opengis\.net\/def\/crs\/EPSG\/0\/(\d+)$/];function UG(i){let e=0;for(let r of Doe){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 LG(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 kG(i){return UG(i)?new _d({code:i,units:"m"}):null}function GG(i){let e=UG(i.getCode());return e?{forward:LG(Loe,e),inverse:LG(Poe,e)}:null}var Foe=63710088e-1;function xP(i,e,t){t=t||Foe;let n=Tc(i[1]),r=Tc(e[1]),s=(r-n)/2,o=Tc(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 Ooe=[GG],Boe=[kG];var vP=!0;function VG(i){vP=!(i===void 0?!0:i)}function wP(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 bP(i){RG(i.getCode(),i),_g(i,i,wP)}function Uoe(i){i.forEach(bP)}function vs(i){if(typeof i!="string")return i;let e=CG(i);if(e)return e;for(let t of Boe){let n=t(i);if(n)return n}return null}function SP(i,e,t,n){i=vs(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/tf[n])}}else{let o=i.getUnits();if(o=="degrees"&&!n||n=="degrees")r=e;else{let a=j0(i,vs("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=xP(c.slice(0,2),c.slice(2,4)),f=xP(c.slice(4,6),c.slice(6,8));r=(u+f)/2}let l=n?tf[n]:i.getMetersPerUnit();l!==void 0&&(r/=l)}}return r}function zG(i){Uoe(i),i.forEach(function(e){i.forEach(function(t){e!==t&&_g(e,t,wP)})})}function koe(i,e,t,n){i.forEach(function(r){e.forEach(function(s){_g(r,s,t),_g(s,r,n)})})}function Rw(i,e){return i?typeof i=="string"?vs(i):i:vs(e)}function qG(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 yg(i,e){if(i===e)return!0;let t=i.getUnits()===e.getUnits();return(i.getCode()===e.getCode()||j0(i,e)===wP)&&t}function j0(i,e){let t=i.getCode(),n=e.getCode(),r=Sw(t,n);if(r)return r;let s=null,o=null;for(let l of Ooe)s||(s=l(i)),o||(o=l(e));if(!s&&!o)return null;let a="EPSG:4326";if(o)if(s)r=yP(s.inverse,o.forward);else{let l=Sw(t,a);l&&(r=yP(l,o.forward))}else{let l=Sw(a,n);l&&(r=yP(s.inverse,l))}return r&&(bP(i),bP(e),_g(i,e,r)),r}function yP(i,e){return function(t,n,r,s){return n=i(t,n,r,s),e(n,n,r,s)}}function X0(i,e){let t=vs(i),n=vs(e);return j0(t,n)}function vg(i,e,t){let n=X0(e,t);if(!n){let r=vs(e).getCode(),s=vs(t).getCode();throw new Error(`No transform available between ${r} and ${s}`)}return n(i,void 0,i.length)}function HG(i,e,t,n){let r=X0(e,t);return mG(i,r,void 0,n)}var Mc=null;function $0(){return Mc}function Mx(i,e){return Mc?vg(i,e,Mc):i}function Cc(i,e){return Mc?vg(i,Mc,e):(vP&&!H0(i,[0,0])&&i[0]>=-180&&i[0]<=180&&i[1]>=-90&&i[1]<=90&&(vP=!1,xw("Call useGeographic() from ol/proj once to work with [longitude, latitude] coordinates.")),i)}function yd(i,e){return Mc?HG(i,e,Mc):i}function Rc(i,e){return Mc?HG(i,Mc,e):i}function WG(i,e){if(!Mc)return i;let t=vs(e).getMetersPerUnit(),n=Mc.getMetersPerUnit();return t&&n?i*t/n:i}function Goe(){zG(pP),zG(AP),koe(AP,pP,TG,EG)}Goe();function TP(i){return i[0]>0&&i[1]>0}function jG(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 jr(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 Y0(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 Iw=Pw;function XG(i,e,t){let n,r;t=t||Va;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 Va(i,e){return i>e?1:i<e?-1:0}function $G(i,e){return i<e?1:i>e?-1:0}function bg(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 YG(i,e,t){for(;e<t;){let n=i[e];i[e]=i[t],i[t]=n,++e,--t}}function Pc(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 Oo(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 KG(i,e,t){let n=e||Va;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 Vn(i,e){if(!i)throw new Error(e)}function ZG(i,e,t,n,r){return!gw(r,function(o){return!vd(i,e,t,n,o[0],o[1])})}function vd(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 Cx(i,e,t,n,r,s){if(t.length===0||!vd(i,e,t[0],n,r,s))return!1;for(let o=1,a=t.length;o<a;++o)if(vd(i,t[o-1],t[o],n,r,s))return!1;return!0}function QG(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(Cx(i,e,l,n,r,s))return!0;e=l[l.length-1]}return!1}function JG(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 Nw(i,e,t,n,r,s){return s=s??cP(Pr(),i,e,t,n),yr(r,s)?s[0]>=r[0]&&s[2]<=r[2]||s[1]>=r[1]&&s[3]<=r[3]?!0:JG(i,e,t,n,function(o,a){return AG(r,o,a)}):!1}function EP(i,e,t,n,r){return!!(Nw(i,e,t,n,r)||vd(i,e,t,n,r[0],r[1])||vd(i,e,t,n,r[0],r[3])||vd(i,e,t,n,r[2],r[1])||vd(i,e,t,n,r[2],r[3]))}function MP(i,e,t,n,r){if(!EP(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(ZG(i,t[s-1],t[s],n,r)&&!Nw(i,t[s-1],t[s],n,r))return!1;return!0}function ez(i,e,t,n,r){for(let s=0,o=t.length;s<o;++s){let a=t[s];if(MP(i,e,a,n,r))return!0;e=a[a.length-1]}return!1}function Kn(){throw new Error("Unimplemented abstract method.")}var zoe=0;function Ln(i){return i.ol_uid||(i.ol_uid=String(++zoe))}function wg(i,e,t,n){return n!==void 0?(n[0]=i,n[1]=e,n[2]=t,n):[i,e,t]}function Voe(i,e,t){return i+"/"+e+"/"+t}function Sg(i,e,t,n,r){return`${Ln(i)},${e},${Voe(t,n,r)}`}function tz(i){return qoe(i[0],i[1],i[2])}function qoe(i,e,t){return(e<<i)+t}function nz(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 Tg=[0,0,0],bd=5,CP=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,Vn(KG(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,Vn(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_=Wl(s)),Vn(!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,Vn(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,Vn(!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 Iw(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=Y0(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 Y0(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 Y0(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 Y0(c,c,u,u,n);let f=Math.floor(l*(s+1))-1,p=Math.floor(l*(o+1))-1;return Y0(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,Tg);let r=Tg[1],s=Tg[2];this.getTileCoordForXYAndZ_(e[2],e[1],t,!0,Tg);let o=Tg[1],a=Tg[2];return Y0(r,o,s,a,n)}getTileCoordCenter(e){let t=this.getOrigin(e[0]),n=this.getResolution(e[0]),r=jr(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=jr(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 dl(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=jr(this.getTileSize(o),this.tmpSize_),u=a*(e-l[0])/n/c[0],f=a*(l[1]-t)/n/c[1];return r?(u=Tx(u,bd)-1,f=Tx(f,bd)-1):(u=Sx(u,bd),f=Sx(f,bd)),wg(o,u,f,s)}getTileCoordForXYAndZ_(e,t,n,r,s){let o=this.getOrigin(n),a=this.getResolution(n),l=jr(this.getTileSize(n),this.tmpSize_),c=(e-o[0])/a/l[0],u=(o[1]-t)/a/l[1];return r?(c=Tx(c,bd)-1,u=Tx(u,bd)-1):(c=Sx(c,bd),u=Sx(u,bd)),wg(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=bg(this.resolutions_,e,t||0);return xi(n,this.minZoom,this.maxZoom)}tileCoordIntersectsViewport(e,t){return EP(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}},Rx=CP;function Lw(i){let e=i.getDefaultTileGrid();return e||(e=Woe(i),i.setDefaultTileGrid(e)),e}function rz(i,e,t){let n=e[0],r=i.getTileCoordCenter(e),s=Dw(t);if(!wc(s,r)){let o=jn(s),a=Math.ceil((s[0]-r[0])/o);return r[0]+=o*a,i.getTileCoordForCoordAndZ(r,n)}return e}function Hoe(i,e,t,n){n=n!==void 0?n:"top-left";let r=oz(i,e,t);return new Rx({extent:i,origin:dG(i,n),resolutions:r,tileSize:t})}function sz(i){let e=i||{},t=e.extent||vs("EPSG:3857").getExtent(),n={extent:t,minZoom:e.minZoom,tileSize:e.tileSize,resolutions:oz(t,e.maxZoom,e.tileSize,e.maxResolution)};return new Rx(n)}function oz(i,e,t,n){e=e!==void 0?e:42,t=jr(t!==void 0?t:256);let r=xr(i),s=jn(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 Woe(i,e,t,n){let r=Dw(i);return Hoe(r,e,t,n)}function Dw(i){i=vs(i);let e=i.getExtent();if(!e){let t=180*tf.degrees/i.getMetersPerUnit();e=dl(-t,-t,t,t)}return e}var Mn={IDLE:0,LOADING:1,LOADED:2,ERROR:3,EMPTY:4};function kn(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 Eg(i,e,t,n){return kn(i,e,t,n,!0)}function ri(i){i&&i.target&&(i.target.removeEventListener(i.type,i.listener),wu(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 RP=class{constructor(){this.disposed=!1}dispose(){this.disposed||(this.disposed=!0,this.disposeInternal())}disposeInternal(){}},wd=RP;function rf(){return!0}function sf(){return!1}function of(){}function Fw(i){let e,t,n;return function(){let r=Array.prototype.slice.call(arguments);return(!t||this!==n||!Oo(r,t))&&(n=this,t=r,e=i.apply(this,arguments)),e}}function az(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 PP=class{constructor(e){this.propagationStopped,this.defaultPrevented,this.type=e,this.target=null}preventDefault(){this.defaultPrevented=!0}stopPropagation(){this.propagationStopped=!0}};var Ks=PP;var IP=class extends wd{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 Ks(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,of);delete o[n]}return l}disposeInternal(){this.listeners_&&wu(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]=of,++this.pendingRemovals_[e]):(n.splice(r,1),n.length===0&&delete this.listeners_[e]))}},Sd=IP;var K0=typeof navigator<"u"&&typeof navigator.userAgent<"u"?navigator.userAgent.toLowerCase():"",joe=K0.includes("safari")&&!K0.includes("chrom"),R5e=joe&&(K0.includes("version/15.4")||/cpu (os|iphone os) 15_4 like mac os x/.test(K0)),lz=K0.includes("webkit")&&!K0.includes("edge"),NP=K0.includes("macintosh"),cz=typeof devicePixelRatio<"u"?devicePixelRatio:1,Us=typeof WorkerGlobalScope<"u"&&typeof OffscreenCanvas<"u"&&self instanceof WorkerGlobalScope,LP=typeof Image<"u"&&Image.prototype.decode;var Ow=(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 uz(i,e,t){let n=i,r=!0,s=!1,o=!1,a=[Eg(n,Jt.LOAD,function(){o=!0,s||e()})];return n.src&&LP?(s=!0,n.decode().then(function(){r&&e()}).catch(function(l){r&&(o?e():t())})):a.push(Eg(n,Jt.ERROR,t)),function(){r=!1,a.forEach(ri)}}function Xoe(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 hz(i,e){return e&&(i.src=e),i.src&&LP?new Promise((t,n)=>i.decode().then(()=>t(i)).catch(r=>i.complete&&i.width?t(i):n(r))):Xoe(i)}var rn={IDLE:0,LOADING:1,LOADED:2,ERROR:3,EMPTY:4};function DP(i){return Math.pow(i,3)}function Xl(i){return 1-DP(1-i)}function fz(i){return 3*i*i-2*i*i*i}function dz(i){return i}var FP=class extends Sd{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(){Kn()}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:DP(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=FP;function Ti(i,e,t,n){let r;return t&&t.length?r=t.shift():Us?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 OP;function Px(){return OP||(OP=Ti(1,1)),OP}function Z0(i){let e=i.canvas;e.width=1,e.height=1,i.clearRect(0,0,1,1)}function BP(i,e){let t=e.parentNode;t&&t.replaceChild(i,e)}function pz(i){for(;i.lastChild;)i.lastChild.remove()}function Az(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 Bw(){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 pl(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_,Us?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_=$oe(),this.changed()}handleImageLoad_(){if(Us)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_=uz(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 $oe(){let i=Ti(1,1);return i.fillStyle="rgba(0,0,0,0)",i.fillRect(0,0,1,1),i.canvas}var Uw=UP;var kP,Q0=[];function mz(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 GP(i,e){return Math.abs(i[e*4]-210)>2||Math.abs(i[e*4+3]-.75*255)>2}function Yoe(){if(kP===void 0){let i=Ti(6,6,Q0);i.globalCompositeOperation="lighter",i.fillStyle="rgba(210, 0, 0, 0.75)",mz(i,4,5,4,0),mz(i,4,5,0,5);let e=i.getImageData(0,0,3,3).data;kP=GP(e,0)||GP(e,4)||GP(e,8),Z0(i),Q0.push(i.canvas)}return kP}function gz(i,e,t,n){let r=vg(t,e,i),s=SP(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||wc(l,r)){let c=SP(i,s,r)/s;isFinite(c)&&c>0&&(s/=c)}return s}function _z(i,e,t,n){let r=za(t),s=gz(i,e,r,n);return(!isFinite(s)||s<=0)&&gw(t,function(o){return s=gz(i,e,o,n),isFinite(s)&&s>0}),s}function xz(i,e,t,n,r,s,o,a,l,c,u,f,p,x){let v=Ti(Math.round(t*i),Math.round(t*e),Q0);if(f||(v.imageSmoothingEnabled=!1),l.length===0)return v.canvas;v.scale(t,t);function w(L){return Math.round(L*t)/t}v.globalCompositeOperation="lighter";let S=Pr();l.forEach(function(L,D,F){mw(S,L.extent)});let T,R=t/n,P=(f?1:1+Math.pow(2,-24))/R;if(!p||l.length!==1||c!==0){if(T=Ti(Math.round(jn(S)*R),Math.round(xr(S)*R),Q0),f||(T.imageSmoothingEnabled=!1),r&&x){let L=(r[0]-S[0])*R,D=-(r[3]-S[3])*R,F=jn(r)*R,N=xr(r)*R;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])*R,K=-(L.clipExtent[3]-S[3])*R,J=jn(L.clipExtent)*R,j=xr(L.clipExtent)*R;T.rect(f?H:Math.round(H),f?K:Math.round(K),f?J:Math.round(H+J)-Math.round(H),f?j:Math.round(K+j)-Math.round(K)),T.clip()}let N=(L.extent[0]-S[0])*R,B=-(L.extent[3]-S[3])*R,z=jn(L.extent)*R,V=xr(L.extent)*R;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=Wl(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],K=N[1][1],J=N[2][0],j=N[2][1],Z=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),be=w(-(B[2][1]-C[1])/s),Ie=z,Qe=V;z=0,V=0,H-=Ie,K-=Qe,J-=Ie,j-=Qe;let Ue=[[H,K,0,0,ae-Z],[J,j,0,0,de-Z],[0,0,H,K,ce-ee],[0,0,J,j,be-ee]],mt=yG(Ue);if(!mt)return;if(v.save(),v.beginPath(),Yoe()||!f){v.moveTo(ae,ce);let ze=4,$e=Z-ae,Et=ee-ce;for(let Tt=0;Tt<ze;Tt++)v.lineTo(ae+w((Tt+1)*$e/ze),ce+w(Tt*Et/(ze-1))),Tt!=ze-1&&v.lineTo(ae+w((Tt+1)*$e/ze),ce+w((Tt+1)*Et/(ze-1)));v.lineTo(de,be)}else v.moveTo(ae,ce),v.lineTo(Z,ee),v.lineTo(de,be);v.clip(),v.transform(mt[0],mt[2],mt[1],mt[3],Z,ee),v.translate(S[0]-Ie,S[3]-Qe);let Me;if(T)Me=T.canvas,v.scale(P,-P);else{let ze=l[0],$e=ze.extent;Me=ze.image,v.scale(jn($e)/Me.width,-xr($e)/Me.height)}v.drawImage(Me,0,0),v.restore()}),T&&(Z0(T),Q0.push(T.canvas)),u&&(v.save(),v.globalCompositeOperation="source-over",v.strokeStyle="black",v.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,K=(N[2][0]-C[0])/s,J=-(N[2][1]-C[1])/s;v.beginPath(),v.moveTo(V,H),v.lineTo(B,z),v.lineTo(K,J),v.closePath(),v.stroke()}),v.restore()),v.canvas}var Koe=[1,0,0,1,0,0],sNe=new Array(6);function Zs(){return Koe.slice(0)}function yz(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 Ir(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 ho(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 Gw(i,e){let t=Zoe(e);Vn(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 Zoe(i){return i[0]*i[3]-i[1]*i[2]}var Qoe=[1e5,1e5,1e5,1e5,2,2];function vz(i){return"matrix("+i.join(", ")+")"}function kw(i){return i.substring(7,i.length-1).split(",").map(parseFloat)}function bz(i,e){let t=kw(i),n=kw(e);for(let r=0;r<6;++r)if(Math.round((t[r]-n[r])*Qoe[r])!==0)return!1;return!0}var Joe=10,wz=.25,zP=class{constructor(e,t,n,r,s,o,a){this.sourceProj_=e,this.targetProj_=t;let l={},c=a?qG(P=>Ir(a,vg(P,this.targetProj_,this.sourceProj_))):X0(this.targetProj_,this.sourceProj_);this.transformInv_=function(P){let C=P[0]+"/"+P[1];return l[C]||(l[C]=c(P)),l[C]},this.maxSourceExtent_=r,this.errorThresholdSquared_=s*s,this.triangles_=[],this.wrapsXInSource_=!1,this.canWrapXInSource_=this.sourceProj_.canWrapX()&&!!r&&!!this.sourceProj_.getExtent()&&jn(r)>=jn(this.sourceProj_.getExtent()),this.sourceWorldWidth_=this.sourceProj_.getExtent()?jn(this.sourceProj_.getExtent()):null,this.targetWorldWidth_=this.targetProj_.getExtent()?jn(this.targetProj_.getExtent()):null;let u=Wl(n),f=pg(n),p=dg(n),x=fg(n),v=this.transformInv_(u),w=this.transformInv_(f),S=this.transformInv_(p),T=this.transformInv_(x),R=Joe+(o?Math.max(0,Math.ceil(Math.log2(bx(n)/(o*o*256*256)))):0);if(this.addQuad_(u,f,p,x,v,w,S,T,R),this.wrapsXInSource_){let P=1/0;this.triangles_.forEach(function(C,L,D){P=Math.min(P,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])-P>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]-P>this.sourceWorldWidth_/2&&(L[0][0]-=this.sourceWorldWidth_),L[1][0]-P>this.sourceWorldWidth_/2&&(L[1][0]-=this.sourceWorldWidth_),L[2][0]-P>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=lP([s,o,a,l]),f=this.sourceWorldWidth_?jn(u)/this.sourceWorldWidth_:null,p=this.sourceWorldWidth_,x=this.sourceProj_.canWrapX()&&f>.5&&f<1,v=!1;if(c>0){if(this.targetProj_.isGlobal()&&this.targetWorldWidth_){let S=lP([e,t,n,r]);v=jn(S)/this.targetWorldWidth_>wz||v}!x&&this.sourceProj_.isGlobal()&&f&&(v=f>wz||v)}if(!v&&this.maxSourceExtent_&&isFinite(u[0])&&isFinite(u[1])&&isFinite(u[2])&&isFinite(u[3])&&!yr(u,this.maxSourceExtent_))return;let w=0;if(!v&&(!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)v=!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(!v){let S=[(e[0]+n[0])/2,(e[1]+n[1])/2],T=this.transformInv_(S),R;x?R=(bu(s[0],p)+bu(a[0],p))/2-bu(T[0],p):R=(s[0]+a[0])/2-T[0];let P=(s[1]+a[1])/2-T[1];v=R*R+P*P>this.errorThresholdSquared_}if(v){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),R=[(r[0]+e[0])/2,(r[1]+e[1])/2],P=this.transformInv_(R);this.addQuad_(e,t,S,R,s,o,T,P,c-1),this.addQuad_(R,S,n,r,P,T,a,l,c-1)}else{let S=[(e[0]+t[0])/2,(e[1]+t[1])/2],T=this.transformInv_(S),R=[(n[0]+r[0])/2,(n[1]+r[1])/2],P=this.transformInv_(R);this.addQuad_(e,S,R,r,s,T,P,l,c-1),this.addQuad_(S,t,n,R,T,o,a,P,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=Pr();return this.triangles_.forEach(function(t,n,r){let s=t.source;V0(e,s[0]),V0(e,s[1]),V0(e,s[2])}),e}getTriangles(){return this.triangles_}},Sz=zP;var VP=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_),v=this.targetTileGrid_.getExtent(),w=this.sourceTileGrid_.getExtent(),S=v?yu(x,v):x;if(bx(S)===0){this.state=rn.EMPTY;return}let T=e.getExtent();T&&(w?w=yu(w,T):w=T);let R=r.getResolution(this.wrappedTileCoord_[0]),P=_z(e,n,S,R);if(!isFinite(P)||P<=0){this.state=rn.EMPTY;return}let C=u!==void 0?u:.5;if(this.triangulation_=new Sz(e,n,S,w,P*C,R),this.triangulation_.getTriangles().length===0){this.state=rn.EMPTY;return}this.sourceZ_=t.getZForResolution(P);let L=this.triangulation_.calculateSourceExtent();if(w&&(e.canWrapX()?(L[1]=xi(L[1],w[1],w[3]),L[3]=xi(L[3],w[1],w[3])):L=yu(L,w)),!bx(L))this.state=rn.EMPTY;else{let D=0,F=0;e.canWrapX()&&(D=jn(T),F=Math.floor((L[0]-T[0])/D)),_w(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 K=F*D;this.sourceTiles_.push({getTile:()=>c(this.sourceZ_,V,H,a),offset:K})}++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_=xz(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=kn(t,Jt.CHANGE,s=>{let o=t.getState();(o==rn.LOADED||o==rn.ERROR||o==rn.EMPTY)&&(ri(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(ri),this.sourcesListenerKeys_=null}release(){this.canvas_&&(Z0(this.canvas_.getContext("2d")),Q0.push(this.canvas_),this.canvas_=null),this.sourceTiles_.length=0,super.release()}},zw=VP;var eae=/\{z\}/g,tae=/\{x\}/g,nae=/\{y\}/g,iae=/\{-y\}/g;function Tz(i,e,t,n,r){return i.replace(eae,e.toString()).replace(tae,t.toString()).replace(nae,n.toString()).replace(iae,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 Ez(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 rae(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 Tz(i,o,t[1],t[2],s)})}function Mz(i,e){let t=i.length,n=new Array(t);for(let r=0;r<t;++r)n[r]=rae(i[r],e);return sae(n)}function sae(i){return i.length===1?i[0]:(function(e,t,n){if(!e)return;let r=tz(e),s=bu(r,i.length);return i[s](e,t,n)})}var Ic={PROPERTYCHANGE:"propertychange"};var Cg=class extends Sd{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]=kn(this,e[s],t);return r}return kn(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]=Eg(this,e[s],t)}else n=Eg(this,e,t);return t.ol_key=n,n}unInternal(e,t){let n=t.ol_key;if(n)oae(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)}};Cg.prototype.on;Cg.prototype.once;Cg.prototype.un;function oae(i){if(Array.isArray(i))for(let e=0,t=i.length;e<t;++e)ri(i[e]);else ri(i)}var Vw=Cg;var qw=class extends Ks{constructor(e,t,n){super(e),this.key=t,this.oldValue=n}},qP=class extends Vw{constructor(e){super(),this.on,this.once,this.un,Ln(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 qw(n,e,t)),n=Ic.PROPERTYCHANGE,this.hasListener(n)&&this.dispatchEvent(new qw(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],Ec(this.values_)&&(this.values_=null),t||this.notify(e,n)}}},bs=qP;var HP=class extends bs{constructor(e){super(),this.projection=vs(e.projection),this.attributions_=Cz(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_=Cz(e),this.changed()}setState(e){this.state_=e,this.changed()}};function Cz(i){return i?typeof i=="function"?i:(Array.isArray(i)||(i=[i]),e=>i):null}var Hw=HP;var WP=class extends Hw{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&&jr(this.tileGrid.getTileSize(this.tileGrid.getMinZoom()),t),this.tmpSize=[0,0],this.key_=e.key||Ln(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 Kn()}getTileGrid(){return this.tileGrid}getTileGridForProjection(e){return this.tileGrid?this.tileGrid:Lw(e)}getTilePixelRatio(e){return this.tilePixelRatio_}getTilePixelSize(e,t,n){let r=this.getTileGridForProjection(n),s=this.getTilePixelRatio(t),o=jr(r.getTileSize(e),this.tmpSize);return s==1?o:jG(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=rz(r,e,n)),nz(e,r)?e:null}clear(){}refresh(){this.clear(),super.refresh()}},Ww=class extends Ks{constructor(e,t){super(e),this.tile=t}},Rz=WP;var jw={TILELOADSTART:"tileloadstart",TILELOADEND:"tileloadend",TILELOADERROR:"tileloaderror"};var jP=class i extends Rz{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=Ln(t),r=t.getState(),s;r==rn.LOADING?(this.tileLoadingKeys_[n]=!0,s=jw.TILELOADSTART):n in this.tileLoadingKeys_&&(delete this.tileLoadingKeys_[n],s=r==rn.ERROR?jw.TILELOADERROR:r==rn.LOADED?jw.TILELOADEND:void 0),s!=null&&this.dispatchEvent(new Ww(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=Ez(e);this.urls=t,this.setUrls(t)}setUrls(e){this.urls=e;let t=e.join(`2-`);this.generateTileUrlFunction_?this.setTileUrlFunction(Mz(e,this.tileGrid),t):this.setKey(t)}tileUrlFunction(e,t,n){}},Pz=jP;var XP=class extends Pz{constructor(e){super({attributions:e.attributions,cacheSize:e.cacheSize,projection:e.projection,state:e.state,tileGrid:e.tileGrid,tileLoadFunction:e.tileLoadFunction?e.tileLoadFunction:aae,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:Uw,this.tileGridForProjection={},this.reprojectionErrorThreshold_=e.reprojectionErrorThreshold,this.renderReprojectionEdges_=!1}getGutterForProjection(e){return this.getProjection()&&e&&!yg(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||yg(t,e)))return this.tileGrid;let n=Ln(e);return n in this.tileGridForProjection||(this.tileGridForProjection[n]=Lw(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||yg(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 zw(a,u,s,f,l,p,this.getTilePixelRatio(r),this.getGutter(),(v,w,S,T)=>this.getTileInternal(v,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=Sg(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=vs(e);if(n){let r=Ln(n);r in this.tileGridForProjection||(this.tileGridForProjection[r]=t)}}};function aae(i,e){if(Us){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 Iz=XP;var $P=class extends Iz{constructor(e){e=e||{};let t=e.projection!==void 0?e.projection:"EPSG:3857",n=e.tileGrid!==void 0?e.tileGrid:sz({extent:Dw(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_}},Nz=$P;function Nc(){if(!U.map||!U.variant||U.settling)return;let i=U.engine?.getView();try{let e=Lz();e.last=U.game.slug,e.games[U.game.slug]={game:U.game.slug,map:U.map.slug,variant:U.map.variants.indexOf(U.variant),center:i?.getCenter(),zoom:i?.getZoom(),hidden:[...U.hiddenCategories],collapsed:[...U.collapsedSections],overviewDocked:U.overviewDocked,dockFolded:U.dockFolded,dockDismissed:U.dockDismissed},localStorage.setItem(rP,JSON.stringify(e))}catch{}}function Lz(){try{let i=JSON.parse(localStorage.getItem(rP)||"null");if(i&&i.games)return i}catch{}return{last:"",games:{}}}function Rg(i){let e=Lz(),t=i||e.last,n=t&&e.games[t];return n&&n.game&&n.map?n:null}function Pg(){let[i,e]=decodeURIComponent(location.hash.replace(/^#\/?/,"")).split("/").map(t=>t.trim());return{game:i,map:e}}function Dz(){if(!U.game||!U.map)return;let i=`#${U.game.slug}/${U.map.slug}`;location.hash!==i&&history.replaceState(null,"",i)}var YP=class i extends bs{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_&&(ri(this.geometryChangeKey_),this.geometryChangeKey_=null);let e=this.getGeometry();e&&(this.geometryChangeKey_=kn(e,Jt.CHANGE,this.handleGeometryChange_,this)),this.changed()}setGeometry(e){this.set(this.geometryName_,e)}setStyle(e){this.style_=e,this.styleFunction_=e?lae(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 lae(i){if(typeof i=="function")return i;let e;return Array.isArray(i)?e=i:(Vn(typeof i.getZIndex=="function","Expected an `ol/style/Style` or an array of `ol/style/Style.js`"),e=[i]),function(){return e}}var Td=YP;function qa(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 Xw(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,v=i[p+1]-u;o[f++]=c+x*a-v*l,o[f++]=u+x*l+v*a;for(let w=p+2;w<p+n;++w)o[f++]=i[w]}return o&&o.length!=f&&(o.length=f),o}function Fz(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 v=f+2;v<f+n;++v)a[u++]=i[v]}return a&&a.length!=u&&(a.length=u),a}function Oz(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 Bz=Zs(),cae=[NaN,NaN],KP=class extends bs{constructor(){super(),this.extent_=Pr(),this.extentRevision_=-1,this.simplifiedGeometryMaxMinSquaredTolerance=0,this.simplifiedGeometryRevision=0,this.simplifyTransformedInternal=Fw((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 Kn()}closestPointXY(e,t,n,r){return Kn()}containsXY(e,t){return this.closestPointXY(e,t,cae,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 Kn()}getExtent(e){if(this.extentRevision_!=this.getRevision()){let t=this.computeExtent(this.extent_);(isNaN(t[0])||isNaN(t[1]))&&G0(t),this.extentRevision_=this.getRevision()}return pG(this.extent_,e)}rotate(e,t){Kn()}scale(e,t,n){Kn()}simplify(e){return this.getSimplifiedGeometry(e*e)}getSimplifiedGeometry(e){return Kn()}getType(){return Kn()}applyTransform(e){Kn()}intersectsExtent(e){return Kn()}translate(e,t){Kn()}transform(e,t){let n=vs(e),r=n.getUnits()=="tile-pixels"?function(s,o,a){let l=n.getExtent(),c=n.getWorldExtent(),u=xr(c)/xr(l);ho(Bz,c[0],c[3],u,-u,0,0,0);let f=qa(s,0,s.length,a,Bz,o),p=X0(n,t);return p?p(f,f,a):f}:X0(n,t);return this.applyTransform(r),this}},Uz=KP;var ZP=class extends Uz{constructor(){super(),this.layout="XY",this.stride=2,this.flatCoordinates}computeExtent(e){return hg(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,e)}getCoordinates(){return Kn()}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=kz(e),this.layout=e,this.flatCoordinates=t}setCoordinates(e,t){Kn()}setLayout(e,t,n){let r;if(e)r=kz(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=uae(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();Xw(n,0,n.length,r,e,t,n),this.changed()}}scale(e,t,n){t===void 0&&(t=e),n||(n=za(this.getExtent()));let r=this.getFlatCoordinates();if(r){let s=this.getStride();Fz(r,0,r.length,s,e,t,n,r),this.changed()}}translate(e,t){let n=this.getFlatCoordinates();if(n){let r=this.getStride();Oz(n,0,n.length,r,e,t,n),this.changed()}}};function uae(i){let e;return i==2?e="XY":i==3?e="XYZ":i==4&&(e="XYZM"),e}function kz(i){let e;return i=="XY"?e=2:i=="XYZ"||i=="XYM"?e=3:i=="XYZM"&&(e=4),e}function Gz(i,e,t){let n=i.getFlatCoordinates();if(!n)return null;let r=i.getStride();return qa(n,0,n.length,r,e,t)}var Su=ZP;function zz(i,e,t,n){for(let r=0,s=t.length;r<s;++r)i[e++]=t[r];return e}function Ix(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 QP(i,e,t,n,r){r=r||[];let s=0;for(let o=0,a=t.length;o<a;++o){let l=Ix(i,e,t[o],n);r[s++]=l,e=l}return r.length=s,r}function Vz(i,e,t,n,r){r=r||[];let s=0;for(let o=0,a=t.length;o<a;++o){let l=QP(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 JP=class i extends Su{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=Sc(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 Aw(this.flatCoordinates,e)}getType(){return"Point"}intersectsExtent(e){return vx(e,this.flatCoordinates[0],this.flatCoordinates[1])}setCoordinates(e,t){this.setLayout(t,e,0),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=zz(this.flatCoordinates,0,e,this.stride),this.changed()}},Lc=JP;function J0(){return uG[U.map?.iconOutset==="dark"?"dark":"light"]}function hae(i){let e=U.map?.iconOutset==="dark",t=dae(i);return(e?t>.3:t<.88)?i:fae(i,e?.74:.42)}function fae(i,e){let t=String(i).replace("#","");if(t.length!==6)return i;let[n,r,s]=[0,2,4].map(P=>parseInt(t.slice(P,P+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)),v=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],R=P=>Math.round((P+v)*255).toString(16).padStart(2,"0");return`#${R(w)}${R(S)}${R(T)}`}function dae(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 $w(i){let e=Math.abs(Number(i)||0);return U0[(Math.imul(e,2654435761)>>>0)%U0.length]}function af(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 Ig(i,e){i.style.setProperty("--pin-color",eA(e))}function eA(i){return hae(i.color||$w(i.id))}function Ng(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("${eI(e.iconAsset)}")`),i.classList.add("has-source-icon")}function eI(i){let e=i.split("/").map(t=>encodeURIComponent(t)).join("/");return`${U.game.base}/icons/${e}`}function Dc(i){return i.split(/\s+/).slice(0,2).map(e=>e[0]||"").join("")}function qz(i){return Math.imul(Number(i)||0,2654435761)>>>0}function Hz(i){return String(i||"").replace(/\[([^\]]+)\]\([^)]+\)/g,"$1").replace(/[*_`>#]/g,"").replace(/\r/g,"").replace(/\n{3,}/g,`1+(()=>{var Jse=Object.create;var eP=Object.defineProperty;var eoe=Object.getOwnPropertyDescriptor;var toe=Object.getOwnPropertyNames;var noe=Object.getPrototypeOf,ioe=Object.prototype.hasOwnProperty;var roe=(i,e)=>()=>{try{return e||i((e={exports:{}}).exports,e),e.exports}catch(t){throw e=0,t}},soe=(i,e)=>{for(var t in e)eP(i,t,{get:e[t],enumerable:!0})},ooe=(i,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of toe(e))!ioe.call(i,r)&&r!==t&&eP(i,r,{get:()=>e[r],enumerable:!(n=eoe(e,r))||n.enumerable});return i};var aoe=(i,e,t)=>(t=i!=null?Jse(noe(i)):{},ooe(e||!i||!i.__esModule?eP(t,"default",{value:i,enumerable:!0}):t,i));var j$=roe((yv,H6)=>{(function(i,e){typeof yv=="object"&&typeof H6=="object"?H6.exports=e():typeof define=="function"&&define.amd?define("FrameTicker",[],e):typeof yv=="object"?yv.FrameTicker=e():i.FrameTicker=e()})(yv,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 lG=i=>new Promise(e=>setTimeout(e,i)),ls=i=>document.querySelector(i);async function loe(){for(let i=0;i<300&&!(window.__atlasDebug&&!ls("#map-loading")?.checkVisibility?.());i+=1)await lG(100)}async function coe(){let i="";for(let e=0;e<100;e+=1){await lG(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 md(i,e={}){window.dispatchEvent(new KeyboardEvent("keydown",{key:i,bubbles:!0,cancelable:!0,...e}))}function uoe(i,e={}){window.dispatchEvent(new KeyboardEvent("keyup",{key:i,bubbles:!0,cancelable:!0,...e}))}function hoe(i){ls("#map").dispatchEvent(new KeyboardEvent("keydown",{key:i,bubbles:!0,cancelable:!0}))}function O0(i,e){i.value=e,i.dispatchEvent(new Event("change",{bubbles:!0}))}function tP(i,e){let t=ls(i);t.value=e,t.dispatchEvent(new Event("input",{bubbles:!0}))}function nP(i,e=!1){let t=ls("#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 foe(){let i=[],e=async p=>{await coe(),i.push({name:p,snapshot:JSON.parse(window.render_game_to_text())})};await loe(),localStorage.clear();let t=ls("#game-select"),n=t.options[0].value;O0(t,n),await e("initial"),tP("#pin-search","a"),await e("search-a");let r=ls(".search-result");r&&(r.click(),await e("search-select-first"),ls("#close-detail").click(),await e("detail-closed")),tP("#pin-search",""),await e("search-cleared");let s=ls(".category-row input");s&&(s.click(),await e("category-hidden"),s.click(),await e("category-restored"));let o=ls(".only-button");if(o){o.click(),await e("solo-first");let p=ls("#solo-chip");p&&!p.hidden&&p.click(),await e("solo-cleared")}let a=ls("#legend .layer-title");a&&(a.click(),await e("section-folded"),ls("#expand-all").click(),await e("sections-unfolded")),ls("#hide-all").click(),await e("all-hidden"),ls("#show-all").click(),await e("all-shown");let l=ls(".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")),md("g"),await e("grid-open"),tP("#grid-input","m"),await e("grid-descended"),md(" "),await e("subgrid-hidden"),md(" "),md("Escape"),await e("grid-ascended"),md("Escape"),await e("grid-closed"),md("z"),await e("labels-on"),uoe("z"),await e("labels-off"),md("b",{metaKey:!0}),await e("sidebar-collapsed"),md("b",{metaKey:!0}),await e("sidebar-restored"),ls("#zoom-in").click(),await e("zoomed-in");let c=ls("#overview-dock");c&&!ls("#overview-shelf").hidden&&(c.click(),await e("overview-docked"),c.click(),await e("overview-undocked")),ls("#zoom-out").click(),await e("zoomed-out"),hoe("Escape"),await e("viewport-escape");let u=ls("#variant-select");u.options.length>1&&(O0(u,u.options[1].value),await e("variant-second"),O0(u,u.options[0].value),await e("variant-first"));let f=ls("#map-select");return f.options.length>1&&(O0(f,f.options[1].value),await e("map-second"),O0(f,f.options[0].value),await e("map-first")),t.options.length>1&&(O0(t,t.options[1].value),await e("game-second"),O0(t,n),await e("game-first")),localStorage.clear(),{viewport:[window.innerWidth,window.innerHeight],steps:i}}var iP=!1;async function cG(){if(!iP){iP=!0,nP("parity tour running\u2026");try{let i=await foe(),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}`);nP(`parity tour complete \u2713 ${i.steps.length} steps`),console.log("parity tour saved to",t)}catch(i){nP(`parity tour failed: ${i}`,!0),console.error("parity tour failed",i)}finally{iP=!1}}}window.__atlasTour=cG;window.addEventListener("keydown",i=>{i.key==="F9"&&cG()});var nn=i=>document.querySelector(i),ye={volume:nn("#volume-select"),world:nn("#world-select"),lens:nn("#lens-select"),lensField:nn("#lens-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 B0(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 U={catalog:null,volume:null,world:null,lens: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,gridSystem:"geohash",globeActive:!1,subgridVisible:!0,gridCell:"",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 U0=["#4fb3d5","#c9924b","#82b56a","#c96a6a","#9581cc","#4bc9a9","#d4b04a","#6a92c9","#b08a5a","#8fb3a2"],k0="0123456789bcdefghjkmnpqrstuvwxyz";var rP="atlas.session";var uG={light:"rgba(255, 255, 255, 0.96)",dark:"rgba(7, 9, 7, 0.98)"},Li={labelSizePx:11,neighborLabelSizePx:10,labelInsetPx:5,labelFont:"ui-monospace, SFMono-Regular, Menlo, monospace",prefixAlpha:.55,chip:"rgba(12, 15, 22, 0.76)",neighborChip:"rgba(8, 11, 18, 0.88)",lineWhite:"#ffffff",widths:{leaf:2.5,scope:2.5,scopeBare:1.8,child:1.4,neighbor:1},childLineAlpha:.82,neighborLineAlpha:.44,leafFillAlpha:.14,childFillAlpha:.055,neighborTextAlpha:.72,dimColor:"#050810",dimBase:.3,dimStep:.06,dimCap:.52};function fw(i){let e=[...cg()],t=!0;for(let n of i){let r=k0.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 oP(i,e){let t=[...cg()],[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+=k0[l]}return o}var sP={key:null,extent:null};function doe(i){let t=`${cg().join(",")}|${i}`;return sP.key!==t&&(sP={key:t,extent:fw(i)}),sP.extent}var aP={slug:"geohash",name:"Geohash",appliesTo(){return!0},maxLevel(){return 3},inputLength(){return 3},level(i){return i.length},parent(i){return i.slice(0,-1)},children(i){return[...k0].map(e=>i+e)},childIndex(i){return Math.max(0,k0.indexOf(i[i.length-1]))},contains(i,e){let t=doe(i),[n,r]=e;return n>=t[0]&&n<=t[2]&&r>=t[1]&&r<=t[3]},descendTarget(i,e){return oP(e,i.length+1)},bbox:fw,center(i){let e=fw(i);return[(e[0]+e[2])/2,(e[1]+e[3])/2]},ring(i){let[e,t,n,r]=fw(i);return[[e,t],[e,r],[n,r],[n,t],[e,t]]},poleContained(){return null},label(i){return{context:i.slice(0,-1),principal:i.slice(-1)}},colorKey(i){return Math.max(0,k0.indexOf(i[i.length-1]))%U0.length},normalizeInput(i){return[...i.toLocaleLowerCase()].filter(e=>k0.includes(e)).slice(0,3).join("")},parseInput(i){return i},locate(i){let e=oP(i,3);return e?{label:"Geohash",value:e}:null}};function hG(i,e=3){return oP(i,e)}function cg(){let i=U.lens?.surface;if(i)return[i.x,-(i.y+i.height),i.x+i.width,-i.y];let e=U.volume?.tileGrid.size??0,t=U.lens?.bounds||{x:0,y:0,width:e,height:e};return[t.x,-(t.y+t.height),t.x+t.width,-t.y]}var poe=[aP];function uo(){return poe.find(i=>i.slug===U.gridSystem)||aP}function fG(i,e,t){let n=i[0]===i[i.length-1]||Aoe(i[0],i[i.length-1])?i.slice(0,-1):[...i];for(let[r,s]of[[e,([o])=>o>=e],[t,([o])=>o<=t]]){let o=[];for(let a=0;a<n.length;a++){let l=n[a],c=n[(a+n.length-1)%n.length],u=s(l),f=s(c);if(u!==f){let p=(r-c[0])/(l[0]-c[0]);o.push([r,c[1]+p*(l[1]-c[1])])}u&&o.push(l)}if(n=o,n.length===0)return[]}return[...n,n[0]]}function Aoe(i,e){return i[0]===e[0]&&i[1]===e[1]}var ys={UNKNOWN:0,INTERSECTING:1,ABOVE:2,RIGHT:4,BELOW:8,LEFT:16};function lP(i){let e=Pr();for(let t=0,n=i.length;t<n;++t)V0(e,i[t]);return e}function moe(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 dl(n,r,s,o,t)}function ug(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 pw(i,e){return e?(e[0]=i[0],e[1]=i[1],e[2]=i[2],e[3]=i[3],e):i.slice()}function gd(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 wc(i,e){return vx(i,e[0],e[1])}function xu(i,e){return i[0]<=e[0]&&e[2]<=i[2]&&i[1]<=e[1]&&e[3]<=i[3]}function vx(i,e,t){return i[0]<=e&&e<=i[2]&&i[1]<=t&&t<=i[3]}function dw(i,e){let t=i[0],n=i[1],r=i[2],s=i[3],o=e[0],a=e[1],l=ys.UNKNOWN;return o<t?l=l|ys.LEFT:o>r&&(l=l|ys.RIGHT),a<n?l=l|ys.BELOW:a>s&&(l=l|ys.ABOVE),l===ys.UNKNOWN&&(l=ys.INTERSECTING),l}function Pr(){return[1/0,1/0,-1/0,-1/0]}function dl(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 G0(i){return dl(1/0,1/0,-1/0,-1/0,i)}function Aw(i,e){let t=i[0],n=i[1];return dl(t,n,t,n,e)}function hg(i,e,t,n,r){let s=G0(r);return cP(s,i,e,t,n)}function z0(i,e){return i[0]==e[0]&&i[2]==e[2]&&i[1]==e[1]&&i[3]==e[3]}function mw(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 V0(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 cP(i,e,t,n,r){for(;t<n;t+=r)goe(i,e[t],e[t+1]);return i}function goe(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 gw(i,e){let t;return t=e(fg(i)),t||(t=e(dg(i)),t)||(t=e(pg(i)),t)||(t=e(Wl(i)),t)?t:!1}function bx(i){let e=0;return vu(i)||(e=jn(i)*xr(i)),e}function fg(i){return[i[0],i[1]]}function dg(i){return[i[2],i[1]]}function za(i){return[(i[0]+i[2])/2,(i[1]+i[3])/2]}function dG(i,e){let t;if(e==="bottom-left")t=fg(i);else if(e==="bottom-right")t=dg(i);else if(e==="top-left")t=Wl(i);else if(e==="top-right")t=pg(i);else throw new Error("Invalid corner");return t}function wx(i,e,t,n,r){let[s,o,a,l,c,u,f,p]=uP(i,e,t,n);return dl(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 uP(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 xr(i){return i[3]-i[1]}function yu(i,e,t){let n=t||Pr();return yr(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]):G0(n),n}function hP(i,e){if(!yr(i,e))return[i.slice()];if(xu(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 Wl(i){return[i[0],i[3]]}function pg(i){return[i[2],i[3]]}function jn(i){return i[2]-i[0]}function yr(i,e){return i[0]<=e[2]&&i[2]>=e[0]&&i[1]<=e[3]&&i[3]>=e[1]}function vu(i){return i[2]<i[0]||i[3]<i[1]}function pG(i,e){return e?(e[0]=i[0],e[1]=i[1],e[2]=i[2],e[3]=i[3],e):i}function AG(i,e,t){let n=!1,r=dw(i,e),s=dw(i,t);if(r===ys.INTERSECTING||s===ys.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],v=(x-f)/(p-u),w,S;s&ys.ABOVE&&!(r&ys.ABOVE)&&(w=p-(x-c)/v,n=w>=o&&w<=l),!n&&s&ys.RIGHT&&!(r&ys.RIGHT)&&(S=x-(p-l)*v,n=S>=a&&S<=c),!n&&s&ys.BELOW&&!(r&ys.BELOW)&&(w=p-(x-a)/v,n=w>=o&&w<=l),!n&&s&ys.LEFT&&!(r&ys.LEFT)&&(S=x-(p-o)*v,n=S>=a&&S<=c)}return n}function mG(i,e,t,n){if(vu(i))return G0(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 moe(s,o,t)}function fP(i,e){let t=e.getExtent(),n=za(i);if(e.canWrapX()&&(n[0]<t[0]||n[0]>=t[2])){let r=jn(t),o=Math.floor((n[0]-t[0])/r)*r;i[0]-=o,i[2]-=o}return i}function _w(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]]];fP(i,e);let r=jn(n);if(jn(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 gG(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(...hP(t[o],e[n]));t=s}return t}var _G={info:1,warn:2,error:3,none:4},_oe=_G.info;function xw(...i){_oe>_G.warn||console.warn(...i)}function xi(i,e,t){return Math.min(Math.max(i,e),t)}function xG(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 Sc(i,e,t,n)}function Sc(i,e,t,n){let r=t-i,s=n-e;return r*r+s*s}function yG(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 yw(i){return i*180/Math.PI}function Tc(i){return i*Math.PI/180}function bu(i,e){let t=i%e;return t*e<0?t+e:t}function Fo(i,e,t){return i+t*(e-i)}function q0(i,e){let t=Math.pow(10,e);return Math.round(i*t)/t}function Sx(i,e){return Math.floor(q0(i,e))}function Tx(i,e){return Math.ceil(q0(i,e))}function vw(i,e,t){if(i>=e&&i<t)return i;let n=t-e;return((i-e)%n+n)%n+e}function vG(i,e){return i[0]+=+e[0],i[1]+=+e[1],i}function H0(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 Ag(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 bG(i,e){return i[0]*=e,i[1]*=e,i}function bw(i,e){if(e.canWrapX()){let t=jn(e.getExtent()),n=wG(i,e,t);n&&(i[0]-=n*t)}return i}function wG(i,e,t){let n=e.getExtent(),r=0;return e.canWrapX()&&(i[0]<n[0]||i[0]>n[2])&&(t=t||jn(n),r=Math.floor((i[0]-n[0])/t)),r}function SG(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(xi(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 tf={radians:6370997/(2*Math.PI),degrees:2*Math.PI*6370997/360,ft:.3048,m:1,"us-ft":1200/3937};var dP=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_||tf[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_}},_d=dP;var Ex=6378137,mg=Math.PI*Ex,xoe=[-mg,-mg,mg,mg],yoe=[-180,-85,180,85],ww=Ex*Math.log(Math.tan(Math.PI/2)),xd=class extends _d{constructor(e){super({code:e,units:"m",extent:xoe,global:!0,worldExtent:yoe,getPointResolution:function(t,n){return t/Math.cosh(n[1]/Ex)}})}},pP=[new xd("EPSG:3857"),new xd("EPSG:102100"),new xd("EPSG:102113"),new xd("EPSG:900913"),new xd("http://www.opengis.net/def/crs/EPSG/0/3857"),new xd("http://www.opengis.net/gml/srs/epsg.xml#3857")];function TG(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]=mg*i[s]/180;let o=Ex*Math.log(Math.tan(Math.PI*(+i[s+1]+90)/360));o>ww?o=ww:o<-ww&&(o=-ww),e[s+1]=o}return e}function EG(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]/mg,e[s+1]=360*Math.atan(Math.exp(i[s+1]/Ex))/Math.PI-90;return e}var voe=6378137,MG=[-180,-90,180,90],boe=Math.PI*voe/180,nf=class extends _d{constructor(e,t){super({code:e,units:"degrees",extent:MG,axisOrientation:t,global:!0,metersPerUnit:boe,worldExtent:MG})}},AP=[new nf("CRS:84"),new nf("EPSG:4326","neu"),new nf("urn:ogc:def:crs:OGC:1.3:CRS84"),new nf("urn:ogc:def:crs:OGC:2:84"),new nf("http://www.opengis.net/def/crs/OGC/1.3/CRS84"),new nf("http://www.opengis.net/gml/srs/epsg.xml#4326","neu"),new nf("http://www.opengis.net/def/crs/EPSG/0/4326","neu")];var mP={};function CG(i){return mP[i]||mP[i.replace(/urn:(x-)?ogc:def:crs:EPSG:(.*:)?(\w+)$/,"EPSG:$3")]||null}function RG(i,e){mP[i]=e}function wu(i){for(let e in i)delete i[e]}function Ec(i){let e;for(e in i)return!1;return!e}var gg={};function _g(i,e,t){let n=i.getCode(),r=e.getCode();n in gg||(gg[n]={}),gg[n][r]=t}function Sw(i,e){return i in gg&&e in gg[i]?gg[i][e]:null}var Tw=.9996,jl=.00669438,Mw=jl*jl,Cw=Mw*jl,W0=jl/(1-jl),PG=Math.sqrt(1-jl),xg=(1-PG)/(1+PG),DG=xg*xg,gP=DG*xg,_P=gP*xg,FG=_P*xg,OG=1-jl/4-3*Mw/64-5*Cw/256,woe=3*jl/8+3*Mw/32+45*Cw/1024,Soe=15*Mw/256+45*Cw/1024,Toe=35*Cw/3072,Eoe=3/2*xg-27/32*gP+269/512*FG,Moe=21/16*DG-55/32*_P,Coe=151/96*gP-417/128*FG,Roe=1097/512*_P,Ew=6378137;function Poe(i,e,t){let n=i-5e5,o=(t.north?e:e-1e7)/Tw/(Ew*OG),a=o+Eoe*Math.sin(2*o)+Moe*Math.sin(4*o)+Coe*Math.sin(6*o)+Roe*Math.sin(8*o),l=Math.sin(a),c=l*l,u=Math.cos(a),f=l/u,p=f*f,x=p*p,v=1-jl*c,w=Math.sqrt(1-jl*c),S=Ew/w,T=(1-jl)/v,R=W0*u**2,P=R*R,C=n/(S*Tw),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*R-4*P-9*W0))+B/720*(61+90*p+298*R+45*x-252*W0-3*P),V=(C-D/6*(1+2*p+R)+N/120*(5-2*R+28*p-3*P+8*W0+24*x))/u;return V=vw(V+Tc(BG(t.number)),-Math.PI,Math.PI),[yw(V),yw(z)]}var IG=-80,NG=84,Ioe=-180,Noe=180;function Loe(i,e,t){i=vw(i,Ioe,Noe),e<IG?e=IG:e>NG&&(e=NG);let n=Tc(e),r=Math.sin(n),s=Math.cos(n),o=r/s,a=o*o,l=a*a,c=Tc(i),u=BG(t.number),f=Tc(u),p=Ew/Math.sqrt(1-jl*r**2),x=W0*s**2,v=s*vw(c-f,-Math.PI,Math.PI),w=v*v,S=w*v,T=S*v,R=T*v,P=R*v,C=Ew*(OG*n-woe*Math.sin(2*n)+Soe*Math.sin(4*n)-Toe*Math.sin(6*n)),L=Tw*p*(v+S/6*(1-a+x)+R/120*(5-18*a+l+72*x-58*W0))+5e5,D=Tw*(C+p*o*(w/2+T/24*(5-a+9*x+4*x**2)+P/720*(61-58*a+l+600*x-330*W0)));return t.north||(D+=1e7),[L,D]}function BG(i){return(i-1)*6-180+3}var Doe=[/^EPSG:(\d+)$/,/^urn:ogc:def:crs:EPSG::(\d+)$/,/^http:\/\/www\.opengis\.net\/def\/crs\/EPSG\/0\/(\d+)$/];function UG(i){let e=0;for(let r of Doe){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 LG(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 kG(i){return UG(i)?new _d({code:i,units:"m"}):null}function GG(i){let e=UG(i.getCode());return e?{forward:LG(Loe,e),inverse:LG(Poe,e)}:null}var Foe=63710088e-1;function xP(i,e,t){t=t||Foe;let n=Tc(i[1]),r=Tc(e[1]),s=(r-n)/2,o=Tc(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 Ooe=[GG],Boe=[kG];var vP=!0;function VG(i){vP=!(i===void 0?!0:i)}function wP(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 bP(i){RG(i.getCode(),i),_g(i,i,wP)}function Uoe(i){i.forEach(bP)}function vs(i){if(typeof i!="string")return i;let e=CG(i);if(e)return e;for(let t of Boe){let n=t(i);if(n)return n}return null}function SP(i,e,t,n){i=vs(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/tf[n])}}else{let o=i.getUnits();if(o=="degrees"&&!n||n=="degrees")r=e;else{let a=j0(i,vs("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=xP(c.slice(0,2),c.slice(2,4)),f=xP(c.slice(4,6),c.slice(6,8));r=(u+f)/2}let l=n?tf[n]:i.getMetersPerUnit();l!==void 0&&(r/=l)}}return r}function zG(i){Uoe(i),i.forEach(function(e){i.forEach(function(t){e!==t&&_g(e,t,wP)})})}function koe(i,e,t,n){i.forEach(function(r){e.forEach(function(s){_g(r,s,t),_g(s,r,n)})})}function Rw(i,e){return i?typeof i=="string"?vs(i):i:vs(e)}function qG(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 yg(i,e){if(i===e)return!0;let t=i.getUnits()===e.getUnits();return(i.getCode()===e.getCode()||j0(i,e)===wP)&&t}function j0(i,e){let t=i.getCode(),n=e.getCode(),r=Sw(t,n);if(r)return r;let s=null,o=null;for(let l of Ooe)s||(s=l(i)),o||(o=l(e));if(!s&&!o)return null;let a="EPSG:4326";if(o)if(s)r=yP(s.inverse,o.forward);else{let l=Sw(t,a);l&&(r=yP(l,o.forward))}else{let l=Sw(a,n);l&&(r=yP(s.inverse,l))}return r&&(bP(i),bP(e),_g(i,e,r)),r}function yP(i,e){return function(t,n,r,s){return n=i(t,n,r,s),e(n,n,r,s)}}function X0(i,e){let t=vs(i),n=vs(e);return j0(t,n)}function vg(i,e,t){let n=X0(e,t);if(!n){let r=vs(e).getCode(),s=vs(t).getCode();throw new Error(`No transform available between ${r} and ${s}`)}return n(i,void 0,i.length)}function HG(i,e,t,n){let r=X0(e,t);return mG(i,r,void 0,n)}var Mc=null;function $0(){return Mc}function Mx(i,e){return Mc?vg(i,e,Mc):i}function Cc(i,e){return Mc?vg(i,Mc,e):(vP&&!H0(i,[0,0])&&i[0]>=-180&&i[0]<=180&&i[1]>=-90&&i[1]<=90&&(vP=!1,xw("Call useGeographic() from ol/proj once to work with [longitude, latitude] coordinates.")),i)}function yd(i,e){return Mc?HG(i,e,Mc):i}function Rc(i,e){return Mc?HG(i,Mc,e):i}function WG(i,e){if(!Mc)return i;let t=vs(e).getMetersPerUnit(),n=Mc.getMetersPerUnit();return t&&n?i*t/n:i}function Goe(){zG(pP),zG(AP),koe(AP,pP,TG,EG)}Goe();function TP(i){return i[0]>0&&i[1]>0}function jG(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 jr(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 Y0(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 Iw=Pw;function XG(i,e,t){let n,r;t=t||Va;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 Va(i,e){return i>e?1:i<e?-1:0}function $G(i,e){return i<e?1:i>e?-1:0}function bg(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 YG(i,e,t){for(;e<t;){let n=i[e];i[e]=i[t],i[t]=n,++e,--t}}function Pc(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 Oo(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 KG(i,e,t){let n=e||Va;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 Vn(i,e){if(!i)throw new Error(e)}function ZG(i,e,t,n,r){return!gw(r,function(o){return!vd(i,e,t,n,o[0],o[1])})}function vd(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 Cx(i,e,t,n,r,s){if(t.length===0||!vd(i,e,t[0],n,r,s))return!1;for(let o=1,a=t.length;o<a;++o)if(vd(i,t[o-1],t[o],n,r,s))return!1;return!0}function QG(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(Cx(i,e,l,n,r,s))return!0;e=l[l.length-1]}return!1}function JG(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 Nw(i,e,t,n,r,s){return s=s??cP(Pr(),i,e,t,n),yr(r,s)?s[0]>=r[0]&&s[2]<=r[2]||s[1]>=r[1]&&s[3]<=r[3]?!0:JG(i,e,t,n,function(o,a){return AG(r,o,a)}):!1}function EP(i,e,t,n,r){return!!(Nw(i,e,t,n,r)||vd(i,e,t,n,r[0],r[1])||vd(i,e,t,n,r[0],r[3])||vd(i,e,t,n,r[2],r[1])||vd(i,e,t,n,r[2],r[3]))}function MP(i,e,t,n,r){if(!EP(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(ZG(i,t[s-1],t[s],n,r)&&!Nw(i,t[s-1],t[s],n,r))return!1;return!0}function ez(i,e,t,n,r){for(let s=0,o=t.length;s<o;++s){let a=t[s];if(MP(i,e,a,n,r))return!0;e=a[a.length-1]}return!1}function Kn(){throw new Error("Unimplemented abstract method.")}var zoe=0;function Ln(i){return i.ol_uid||(i.ol_uid=String(++zoe))}function wg(i,e,t,n){return n!==void 0?(n[0]=i,n[1]=e,n[2]=t,n):[i,e,t]}function Voe(i,e,t){return i+"/"+e+"/"+t}function Sg(i,e,t,n,r){return`${Ln(i)},${e},${Voe(t,n,r)}`}function tz(i){return qoe(i[0],i[1],i[2])}function qoe(i,e,t){return(e<<i)+t}function nz(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 Tg=[0,0,0],bd=5,CP=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,Vn(KG(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,Vn(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_=Wl(s)),Vn(!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,Vn(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,Vn(!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 Iw(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=Y0(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 Y0(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 Y0(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 Y0(c,c,u,u,n);let f=Math.floor(l*(s+1))-1,p=Math.floor(l*(o+1))-1;return Y0(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,Tg);let r=Tg[1],s=Tg[2];this.getTileCoordForXYAndZ_(e[2],e[1],t,!0,Tg);let o=Tg[1],a=Tg[2];return Y0(r,o,s,a,n)}getTileCoordCenter(e){let t=this.getOrigin(e[0]),n=this.getResolution(e[0]),r=jr(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=jr(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 dl(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=jr(this.getTileSize(o),this.tmpSize_),u=a*(e-l[0])/n/c[0],f=a*(l[1]-t)/n/c[1];return r?(u=Tx(u,bd)-1,f=Tx(f,bd)-1):(u=Sx(u,bd),f=Sx(f,bd)),wg(o,u,f,s)}getTileCoordForXYAndZ_(e,t,n,r,s){let o=this.getOrigin(n),a=this.getResolution(n),l=jr(this.getTileSize(n),this.tmpSize_),c=(e-o[0])/a/l[0],u=(o[1]-t)/a/l[1];return r?(c=Tx(c,bd)-1,u=Tx(u,bd)-1):(c=Sx(c,bd),u=Sx(u,bd)),wg(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=bg(this.resolutions_,e,t||0);return xi(n,this.minZoom,this.maxZoom)}tileCoordIntersectsViewport(e,t){return EP(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}},Rx=CP;function Lw(i){let e=i.getDefaultTileGrid();return e||(e=Woe(i),i.setDefaultTileGrid(e)),e}function rz(i,e,t){let n=e[0],r=i.getTileCoordCenter(e),s=Dw(t);if(!wc(s,r)){let o=jn(s),a=Math.ceil((s[0]-r[0])/o);return r[0]+=o*a,i.getTileCoordForCoordAndZ(r,n)}return e}function Hoe(i,e,t,n){n=n!==void 0?n:"top-left";let r=oz(i,e,t);return new Rx({extent:i,origin:dG(i,n),resolutions:r,tileSize:t})}function sz(i){let e=i||{},t=e.extent||vs("EPSG:3857").getExtent(),n={extent:t,minZoom:e.minZoom,tileSize:e.tileSize,resolutions:oz(t,e.maxZoom,e.tileSize,e.maxResolution)};return new Rx(n)}function oz(i,e,t,n){e=e!==void 0?e:42,t=jr(t!==void 0?t:256);let r=xr(i),s=jn(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 Woe(i,e,t,n){let r=Dw(i);return Hoe(r,e,t,n)}function Dw(i){i=vs(i);let e=i.getExtent();if(!e){let t=180*tf.degrees/i.getMetersPerUnit();e=dl(-t,-t,t,t)}return e}var Mn={IDLE:0,LOADING:1,LOADED:2,ERROR:3,EMPTY:4};function kn(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 Eg(i,e,t,n){return kn(i,e,t,n,!0)}function ri(i){i&&i.target&&(i.target.removeEventListener(i.type,i.listener),wu(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 RP=class{constructor(){this.disposed=!1}dispose(){this.disposed||(this.disposed=!0,this.disposeInternal())}disposeInternal(){}},wd=RP;function rf(){return!0}function sf(){return!1}function of(){}function Fw(i){let e,t,n;return function(){let r=Array.prototype.slice.call(arguments);return(!t||this!==n||!Oo(r,t))&&(n=this,t=r,e=i.apply(this,arguments)),e}}function az(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 PP=class{constructor(e){this.propagationStopped,this.defaultPrevented,this.type=e,this.target=null}preventDefault(){this.defaultPrevented=!0}stopPropagation(){this.propagationStopped=!0}};var Ks=PP;var IP=class extends wd{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 Ks(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,of);delete o[n]}return l}disposeInternal(){this.listeners_&&wu(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]=of,++this.pendingRemovals_[e]):(n.splice(r,1),n.length===0&&delete this.listeners_[e]))}},Sd=IP;var K0=typeof navigator<"u"&&typeof navigator.userAgent<"u"?navigator.userAgent.toLowerCase():"",joe=K0.includes("safari")&&!K0.includes("chrom"),R5e=joe&&(K0.includes("version/15.4")||/cpu (os|iphone os) 15_4 like mac os x/.test(K0)),lz=K0.includes("webkit")&&!K0.includes("edge"),NP=K0.includes("macintosh"),cz=typeof devicePixelRatio<"u"?devicePixelRatio:1,Us=typeof WorkerGlobalScope<"u"&&typeof OffscreenCanvas<"u"&&self instanceof WorkerGlobalScope,LP=typeof Image<"u"&&Image.prototype.decode;var Ow=(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 uz(i,e,t){let n=i,r=!0,s=!1,o=!1,a=[Eg(n,Jt.LOAD,function(){o=!0,s||e()})];return n.src&&LP?(s=!0,n.decode().then(function(){r&&e()}).catch(function(l){r&&(o?e():t())})):a.push(Eg(n,Jt.ERROR,t)),function(){r=!1,a.forEach(ri)}}function Xoe(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 hz(i,e){return e&&(i.src=e),i.src&&LP?new Promise((t,n)=>i.decode().then(()=>t(i)).catch(r=>i.complete&&i.width?t(i):n(r))):Xoe(i)}var rn={IDLE:0,LOADING:1,LOADED:2,ERROR:3,EMPTY:4};function DP(i){return Math.pow(i,3)}function Xl(i){return 1-DP(1-i)}function fz(i){return 3*i*i-2*i*i*i}function dz(i){return i}var FP=class extends Sd{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(){Kn()}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:DP(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=FP;function Ti(i,e,t,n){let r;return t&&t.length?r=t.shift():Us?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 OP;function Px(){return OP||(OP=Ti(1,1)),OP}function Z0(i){let e=i.canvas;e.width=1,e.height=1,i.clearRect(0,0,1,1)}function BP(i,e){let t=e.parentNode;t&&t.replaceChild(i,e)}function pz(i){for(;i.lastChild;)i.lastChild.remove()}function Az(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 Bw(){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 pl(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_,Us?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_=$oe(),this.changed()}handleImageLoad_(){if(Us)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_=uz(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 $oe(){let i=Ti(1,1);return i.fillStyle="rgba(0,0,0,0)",i.fillRect(0,0,1,1),i.canvas}var Uw=UP;var kP,Q0=[];function mz(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 GP(i,e){return Math.abs(i[e*4]-210)>2||Math.abs(i[e*4+3]-.75*255)>2}function Yoe(){if(kP===void 0){let i=Ti(6,6,Q0);i.globalCompositeOperation="lighter",i.fillStyle="rgba(210, 0, 0, 0.75)",mz(i,4,5,4,0),mz(i,4,5,0,5);let e=i.getImageData(0,0,3,3).data;kP=GP(e,0)||GP(e,4)||GP(e,8),Z0(i),Q0.push(i.canvas)}return kP}function gz(i,e,t,n){let r=vg(t,e,i),s=SP(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||wc(l,r)){let c=SP(i,s,r)/s;isFinite(c)&&c>0&&(s/=c)}return s}function _z(i,e,t,n){let r=za(t),s=gz(i,e,r,n);return(!isFinite(s)||s<=0)&&gw(t,function(o){return s=gz(i,e,o,n),isFinite(s)&&s>0}),s}function xz(i,e,t,n,r,s,o,a,l,c,u,f,p,x){let v=Ti(Math.round(t*i),Math.round(t*e),Q0);if(f||(v.imageSmoothingEnabled=!1),l.length===0)return v.canvas;v.scale(t,t);function w(L){return Math.round(L*t)/t}v.globalCompositeOperation="lighter";let S=Pr();l.forEach(function(L,D,F){mw(S,L.extent)});let T,R=t/n,P=(f?1:1+Math.pow(2,-24))/R;if(!p||l.length!==1||c!==0){if(T=Ti(Math.round(jn(S)*R),Math.round(xr(S)*R),Q0),f||(T.imageSmoothingEnabled=!1),r&&x){let L=(r[0]-S[0])*R,D=-(r[3]-S[3])*R,F=jn(r)*R,N=xr(r)*R;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])*R,K=-(L.clipExtent[3]-S[3])*R,J=jn(L.clipExtent)*R,j=xr(L.clipExtent)*R;T.rect(f?H:Math.round(H),f?K:Math.round(K),f?J:Math.round(H+J)-Math.round(H),f?j:Math.round(K+j)-Math.round(K)),T.clip()}let N=(L.extent[0]-S[0])*R,B=-(L.extent[3]-S[3])*R,z=jn(L.extent)*R,V=xr(L.extent)*R;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=Wl(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],K=N[1][1],J=N[2][0],j=N[2][1],Z=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),be=w(-(B[2][1]-C[1])/s),Ie=z,Qe=V;z=0,V=0,H-=Ie,K-=Qe,J-=Ie,j-=Qe;let Ue=[[H,K,0,0,ae-Z],[J,j,0,0,de-Z],[0,0,H,K,ce-ee],[0,0,J,j,be-ee]],mt=yG(Ue);if(!mt)return;if(v.save(),v.beginPath(),Yoe()||!f){v.moveTo(ae,ce);let ze=4,$e=Z-ae,Et=ee-ce;for(let Tt=0;Tt<ze;Tt++)v.lineTo(ae+w((Tt+1)*$e/ze),ce+w(Tt*Et/(ze-1))),Tt!=ze-1&&v.lineTo(ae+w((Tt+1)*$e/ze),ce+w((Tt+1)*Et/(ze-1)));v.lineTo(de,be)}else v.moveTo(ae,ce),v.lineTo(Z,ee),v.lineTo(de,be);v.clip(),v.transform(mt[0],mt[2],mt[1],mt[3],Z,ee),v.translate(S[0]-Ie,S[3]-Qe);let Me;if(T)Me=T.canvas,v.scale(P,-P);else{let ze=l[0],$e=ze.extent;Me=ze.image,v.scale(jn($e)/Me.width,-xr($e)/Me.height)}v.drawImage(Me,0,0),v.restore()}),T&&(Z0(T),Q0.push(T.canvas)),u&&(v.save(),v.globalCompositeOperation="source-over",v.strokeStyle="black",v.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,K=(N[2][0]-C[0])/s,J=-(N[2][1]-C[1])/s;v.beginPath(),v.moveTo(V,H),v.lineTo(B,z),v.lineTo(K,J),v.closePath(),v.stroke()}),v.restore()),v.canvas}var Koe=[1,0,0,1,0,0],sNe=new Array(6);function Zs(){return Koe.slice(0)}function yz(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 Ir(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 ho(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 Gw(i,e){let t=Zoe(e);Vn(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 Zoe(i){return i[0]*i[3]-i[1]*i[2]}var Qoe=[1e5,1e5,1e5,1e5,2,2];function vz(i){return"matrix("+i.join(", ")+")"}function kw(i){return i.substring(7,i.length-1).split(",").map(parseFloat)}function bz(i,e){let t=kw(i),n=kw(e);for(let r=0;r<6;++r)if(Math.round((t[r]-n[r])*Qoe[r])!==0)return!1;return!0}var Joe=10,wz=.25,zP=class{constructor(e,t,n,r,s,o,a){this.sourceProj_=e,this.targetProj_=t;let l={},c=a?qG(P=>Ir(a,vg(P,this.targetProj_,this.sourceProj_))):X0(this.targetProj_,this.sourceProj_);this.transformInv_=function(P){let C=P[0]+"/"+P[1];return l[C]||(l[C]=c(P)),l[C]},this.maxSourceExtent_=r,this.errorThresholdSquared_=s*s,this.triangles_=[],this.wrapsXInSource_=!1,this.canWrapXInSource_=this.sourceProj_.canWrapX()&&!!r&&!!this.sourceProj_.getExtent()&&jn(r)>=jn(this.sourceProj_.getExtent()),this.sourceWorldWidth_=this.sourceProj_.getExtent()?jn(this.sourceProj_.getExtent()):null,this.targetWorldWidth_=this.targetProj_.getExtent()?jn(this.targetProj_.getExtent()):null;let u=Wl(n),f=pg(n),p=dg(n),x=fg(n),v=this.transformInv_(u),w=this.transformInv_(f),S=this.transformInv_(p),T=this.transformInv_(x),R=Joe+(o?Math.max(0,Math.ceil(Math.log2(bx(n)/(o*o*256*256)))):0);if(this.addQuad_(u,f,p,x,v,w,S,T,R),this.wrapsXInSource_){let P=1/0;this.triangles_.forEach(function(C,L,D){P=Math.min(P,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])-P>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]-P>this.sourceWorldWidth_/2&&(L[0][0]-=this.sourceWorldWidth_),L[1][0]-P>this.sourceWorldWidth_/2&&(L[1][0]-=this.sourceWorldWidth_),L[2][0]-P>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=lP([s,o,a,l]),f=this.sourceWorldWidth_?jn(u)/this.sourceWorldWidth_:null,p=this.sourceWorldWidth_,x=this.sourceProj_.canWrapX()&&f>.5&&f<1,v=!1;if(c>0){if(this.targetProj_.isGlobal()&&this.targetWorldWidth_){let S=lP([e,t,n,r]);v=jn(S)/this.targetWorldWidth_>wz||v}!x&&this.sourceProj_.isGlobal()&&f&&(v=f>wz||v)}if(!v&&this.maxSourceExtent_&&isFinite(u[0])&&isFinite(u[1])&&isFinite(u[2])&&isFinite(u[3])&&!yr(u,this.maxSourceExtent_))return;let w=0;if(!v&&(!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)v=!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(!v){let S=[(e[0]+n[0])/2,(e[1]+n[1])/2],T=this.transformInv_(S),R;x?R=(bu(s[0],p)+bu(a[0],p))/2-bu(T[0],p):R=(s[0]+a[0])/2-T[0];let P=(s[1]+a[1])/2-T[1];v=R*R+P*P>this.errorThresholdSquared_}if(v){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),R=[(r[0]+e[0])/2,(r[1]+e[1])/2],P=this.transformInv_(R);this.addQuad_(e,t,S,R,s,o,T,P,c-1),this.addQuad_(R,S,n,r,P,T,a,l,c-1)}else{let S=[(e[0]+t[0])/2,(e[1]+t[1])/2],T=this.transformInv_(S),R=[(n[0]+r[0])/2,(n[1]+r[1])/2],P=this.transformInv_(R);this.addQuad_(e,S,R,r,s,T,P,l,c-1),this.addQuad_(S,t,n,R,T,o,a,P,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=Pr();return this.triangles_.forEach(function(t,n,r){let s=t.source;V0(e,s[0]),V0(e,s[1]),V0(e,s[2])}),e}getTriangles(){return this.triangles_}},Sz=zP;var VP=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_),v=this.targetTileGrid_.getExtent(),w=this.sourceTileGrid_.getExtent(),S=v?yu(x,v):x;if(bx(S)===0){this.state=rn.EMPTY;return}let T=e.getExtent();T&&(w?w=yu(w,T):w=T);let R=r.getResolution(this.wrappedTileCoord_[0]),P=_z(e,n,S,R);if(!isFinite(P)||P<=0){this.state=rn.EMPTY;return}let C=u!==void 0?u:.5;if(this.triangulation_=new Sz(e,n,S,w,P*C,R),this.triangulation_.getTriangles().length===0){this.state=rn.EMPTY;return}this.sourceZ_=t.getZForResolution(P);let L=this.triangulation_.calculateSourceExtent();if(w&&(e.canWrapX()?(L[1]=xi(L[1],w[1],w[3]),L[3]=xi(L[3],w[1],w[3])):L=yu(L,w)),!bx(L))this.state=rn.EMPTY;else{let D=0,F=0;e.canWrapX()&&(D=jn(T),F=Math.floor((L[0]-T[0])/D)),_w(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 K=F*D;this.sourceTiles_.push({getTile:()=>c(this.sourceZ_,V,H,a),offset:K})}++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_=xz(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=kn(t,Jt.CHANGE,s=>{let o=t.getState();(o==rn.LOADED||o==rn.ERROR||o==rn.EMPTY)&&(ri(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(ri),this.sourcesListenerKeys_=null}release(){this.canvas_&&(Z0(this.canvas_.getContext("2d")),Q0.push(this.canvas_),this.canvas_=null),this.sourceTiles_.length=0,super.release()}},zw=VP;var eae=/\{z\}/g,tae=/\{x\}/g,nae=/\{y\}/g,iae=/\{-y\}/g;function Tz(i,e,t,n,r){return i.replace(eae,e.toString()).replace(tae,t.toString()).replace(nae,n.toString()).replace(iae,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 Ez(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 rae(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 Tz(i,o,t[1],t[2],s)})}function Mz(i,e){let t=i.length,n=new Array(t);for(let r=0;r<t;++r)n[r]=rae(i[r],e);return sae(n)}function sae(i){return i.length===1?i[0]:(function(e,t,n){if(!e)return;let r=tz(e),s=bu(r,i.length);return i[s](e,t,n)})}var Ic={PROPERTYCHANGE:"propertychange"};var Cg=class extends Sd{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]=kn(this,e[s],t);return r}return kn(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]=Eg(this,e[s],t)}else n=Eg(this,e,t);return t.ol_key=n,n}unInternal(e,t){let n=t.ol_key;if(n)oae(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)}};Cg.prototype.on;Cg.prototype.once;Cg.prototype.un;function oae(i){if(Array.isArray(i))for(let e=0,t=i.length;e<t;++e)ri(i[e]);else ri(i)}var Vw=Cg;var qw=class extends Ks{constructor(e,t,n){super(e),this.key=t,this.oldValue=n}},qP=class extends Vw{constructor(e){super(),this.on,this.once,this.un,Ln(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 qw(n,e,t)),n=Ic.PROPERTYCHANGE,this.hasListener(n)&&this.dispatchEvent(new qw(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],Ec(this.values_)&&(this.values_=null),t||this.notify(e,n)}}},bs=qP;var HP=class extends bs{constructor(e){super(),this.projection=vs(e.projection),this.attributions_=Cz(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_=Cz(e),this.changed()}setState(e){this.state_=e,this.changed()}};function Cz(i){return i?typeof i=="function"?i:(Array.isArray(i)||(i=[i]),e=>i):null}var Hw=HP;var WP=class extends Hw{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&&jr(this.tileGrid.getTileSize(this.tileGrid.getMinZoom()),t),this.tmpSize=[0,0],this.key_=e.key||Ln(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 Kn()}getTileGrid(){return this.tileGrid}getTileGridForProjection(e){return this.tileGrid?this.tileGrid:Lw(e)}getTilePixelRatio(e){return this.tilePixelRatio_}getTilePixelSize(e,t,n){let r=this.getTileGridForProjection(n),s=this.getTilePixelRatio(t),o=jr(r.getTileSize(e),this.tmpSize);return s==1?o:jG(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=rz(r,e,n)),nz(e,r)?e:null}clear(){}refresh(){this.clear(),super.refresh()}},Ww=class extends Ks{constructor(e,t){super(e),this.tile=t}},Rz=WP;var jw={TILELOADSTART:"tileloadstart",TILELOADEND:"tileloadend",TILELOADERROR:"tileloaderror"};var jP=class i extends Rz{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=Ln(t),r=t.getState(),s;r==rn.LOADING?(this.tileLoadingKeys_[n]=!0,s=jw.TILELOADSTART):n in this.tileLoadingKeys_&&(delete this.tileLoadingKeys_[n],s=r==rn.ERROR?jw.TILELOADERROR:r==rn.LOADED?jw.TILELOADEND:void 0),s!=null&&this.dispatchEvent(new Ww(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=Ez(e);this.urls=t,this.setUrls(t)}setUrls(e){this.urls=e;let t=e.join(`2+`);this.generateTileUrlFunction_?this.setTileUrlFunction(Mz(e,this.tileGrid),t):this.setKey(t)}tileUrlFunction(e,t,n){}},Pz=jP;var XP=class extends Pz{constructor(e){super({attributions:e.attributions,cacheSize:e.cacheSize,projection:e.projection,state:e.state,tileGrid:e.tileGrid,tileLoadFunction:e.tileLoadFunction?e.tileLoadFunction:aae,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:Uw,this.tileGridForProjection={},this.reprojectionErrorThreshold_=e.reprojectionErrorThreshold,this.renderReprojectionEdges_=!1}getGutterForProjection(e){return this.getProjection()&&e&&!yg(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||yg(t,e)))return this.tileGrid;let n=Ln(e);return n in this.tileGridForProjection||(this.tileGridForProjection[n]=Lw(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||yg(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 zw(a,u,s,f,l,p,this.getTilePixelRatio(r),this.getGutter(),(v,w,S,T)=>this.getTileInternal(v,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=Sg(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=vs(e);if(n){let r=Ln(n);r in this.tileGridForProjection||(this.tileGridForProjection[r]=t)}}};function aae(i,e){if(Us){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 Iz=XP;var $P=class extends Iz{constructor(e){e=e||{};let t=e.projection!==void 0?e.projection:"EPSG:3857",n=e.tileGrid!==void 0?e.tileGrid:sz({extent:Dw(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_}},Nz=$P;function Nc(){if(!U.world||!U.lens||U.settling)return;let i=U.engine?.getView();try{let e=Lz();e.last=U.volume.slug,e.volumes[U.volume.slug]={volume:U.volume.slug,world:U.world.slug,lens:U.world.lenses.indexOf(U.lens),center:i?.getCenter(),zoom:i?.getZoom(),hidden:[...U.hiddenCategories],collapsed:[...U.collapsedSections],overviewDocked:U.overviewDocked,dockFolded:U.dockFolded,dockDismissed:U.dockDismissed},localStorage.setItem(rP,JSON.stringify(e))}catch{}}function Lz(){try{let i=JSON.parse(localStorage.getItem(rP)||"null");if(i&&i.volumes)return i}catch{}return{last:"",volumes:{}}}function Rg(i){let e=Lz(),t=i||e.last,n=t&&e.volumes[t];return n&&n.volume&&n.world?n:null}function Pg(){let[i,e]=decodeURIComponent(location.hash.replace(/^#\/?/,"")).split("/").map(t=>t.trim());return{volume:i,world:e}}function Dz(){if(!U.volume||!U.world)return;let i=`#${U.volume.slug}/${U.world.slug}`;location.hash!==i&&history.replaceState(null,"",i)}var YP=class i extends bs{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_&&(ri(this.geometryChangeKey_),this.geometryChangeKey_=null);let e=this.getGeometry();e&&(this.geometryChangeKey_=kn(e,Jt.CHANGE,this.handleGeometryChange_,this)),this.changed()}setGeometry(e){this.set(this.geometryName_,e)}setStyle(e){this.style_=e,this.styleFunction_=e?lae(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 lae(i){if(typeof i=="function")return i;let e;return Array.isArray(i)?e=i:(Vn(typeof i.getZIndex=="function","Expected an `ol/style/Style` or an array of `ol/style/Style.js`"),e=[i]),function(){return e}}var Td=YP;function qa(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 Xw(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,v=i[p+1]-u;o[f++]=c+x*a-v*l,o[f++]=u+x*l+v*a;for(let w=p+2;w<p+n;++w)o[f++]=i[w]}return o&&o.length!=f&&(o.length=f),o}function Fz(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 v=f+2;v<f+n;++v)a[u++]=i[v]}return a&&a.length!=u&&(a.length=u),a}function Oz(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 Bz=Zs(),cae=[NaN,NaN],KP=class extends bs{constructor(){super(),this.extent_=Pr(),this.extentRevision_=-1,this.simplifiedGeometryMaxMinSquaredTolerance=0,this.simplifiedGeometryRevision=0,this.simplifyTransformedInternal=Fw((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 Kn()}closestPointXY(e,t,n,r){return Kn()}containsXY(e,t){return this.closestPointXY(e,t,cae,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 Kn()}getExtent(e){if(this.extentRevision_!=this.getRevision()){let t=this.computeExtent(this.extent_);(isNaN(t[0])||isNaN(t[1]))&&G0(t),this.extentRevision_=this.getRevision()}return pG(this.extent_,e)}rotate(e,t){Kn()}scale(e,t,n){Kn()}simplify(e){return this.getSimplifiedGeometry(e*e)}getSimplifiedGeometry(e){return Kn()}getType(){return Kn()}applyTransform(e){Kn()}intersectsExtent(e){return Kn()}translate(e,t){Kn()}transform(e,t){let n=vs(e),r=n.getUnits()=="tile-pixels"?function(s,o,a){let l=n.getExtent(),c=n.getWorldExtent(),u=xr(c)/xr(l);ho(Bz,c[0],c[3],u,-u,0,0,0);let f=qa(s,0,s.length,a,Bz,o),p=X0(n,t);return p?p(f,f,a):f}:X0(n,t);return this.applyTransform(r),this}},Uz=KP;var ZP=class extends Uz{constructor(){super(),this.layout="XY",this.stride=2,this.flatCoordinates}computeExtent(e){return hg(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,e)}getCoordinates(){return Kn()}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=kz(e),this.layout=e,this.flatCoordinates=t}setCoordinates(e,t){Kn()}setLayout(e,t,n){let r;if(e)r=kz(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=uae(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();Xw(n,0,n.length,r,e,t,n),this.changed()}}scale(e,t,n){t===void 0&&(t=e),n||(n=za(this.getExtent()));let r=this.getFlatCoordinates();if(r){let s=this.getStride();Fz(r,0,r.length,s,e,t,n,r),this.changed()}}translate(e,t){let n=this.getFlatCoordinates();if(n){let r=this.getStride();Oz(n,0,n.length,r,e,t,n),this.changed()}}};function uae(i){let e;return i==2?e="XY":i==3?e="XYZ":i==4&&(e="XYZM"),e}function kz(i){let e;return i=="XY"?e=2:i=="XYZ"||i=="XYM"?e=3:i=="XYZM"&&(e=4),e}function Gz(i,e,t){let n=i.getFlatCoordinates();if(!n)return null;let r=i.getStride();return qa(n,0,n.length,r,e,t)}var Su=ZP;function zz(i,e,t,n){for(let r=0,s=t.length;r<s;++r)i[e++]=t[r];return e}function Ix(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 QP(i,e,t,n,r){r=r||[];let s=0;for(let o=0,a=t.length;o<a;++o){let l=Ix(i,e,t[o],n);r[s++]=l,e=l}return r.length=s,r}function Vz(i,e,t,n,r){r=r||[];let s=0;for(let o=0,a=t.length;o<a;++o){let l=QP(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 JP=class i extends Su{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=Sc(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 Aw(this.flatCoordinates,e)}getType(){return"Point"}intersectsExtent(e){return vx(e,this.flatCoordinates[0],this.flatCoordinates[1])}setCoordinates(e,t){this.setLayout(t,e,0),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=zz(this.flatCoordinates,0,e,this.stride),this.changed()}},Lc=JP;function J0(){return uG[U.world?.iconOutset==="dark"?"dark":"light"]}function hae(i){let e=U.world?.iconOutset==="dark",t=dae(i);return(e?t>.3:t<.88)?i:fae(i,e?.74:.42)}function fae(i,e){let t=String(i).replace("#","");if(t.length!==6)return i;let[n,r,s]=[0,2,4].map(P=>parseInt(t.slice(P,P+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)),v=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],R=P=>Math.round((P+v)*255).toString(16).padStart(2,"0");return`#${R(w)}${R(S)}${R(T)}`}function dae(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 $w(i){let e=Math.abs(Number(i)||0);return U0[(Math.imul(e,2654435761)>>>0)%U0.length]}function af(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 Ig(i,e){i.style.setProperty("--pin-color",eA(e))}function eA(i){return hae(i.color||$w(i.id))}function Ng(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("${eI(e.iconAsset)}")`),i.classList.add("has-source-icon")}function eI(i){let e=i.split("/").map(t=>encodeURIComponent(t)).join("/");return`${U.volume.base}/icons/${e}`}function Dc(i){return i.split(/\s+/).slice(0,2).map(e=>e[0]||"").join("")}function qz(i){return Math.imul(Number(i)||0,2654435761)>>>0}function Hz(i){return String(i||"").replace(/\[([^\]]+)\]\([^)]+\)/g,"$1").replace(/[*_`>#]/g,"").replace(/\r/g,"").replace(/\n{3,}/g,`33 4-`).trim()}function Fc(i){return new Intl.NumberFormat().format(i)}function Xr(i,e,t){return Math.min(t,Math.max(e,i))}function Yw(i){return i instanceof HTMLElement&&(i.matches("input, textarea, select")||i.isContentEditable)}var pae=100;function Ed(){if(!ye.searchResults)return;let i=U.pins.filter(n=>!n.filteredHidden).sort((n,r)=>n.location.title.localeCompare(r.location.title)),e=i.slice(0,pae),t=document.createDocumentFragment();if(!e.length){let n=document.createElement("p");n.className="search-empty",n.textContent=U.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",U.selectedPin===n&&r.classList.add("is-selected"),r.dataset.location=String(n.location.id),Ig(r,n.category);let s=document.createElement("span");s.className="result-dot",Ng(s,n.category,Dc(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 ${Fc(i.length)} \u2014 search or filter to narrow the list.`,t.append(n)}ye.searchResults.replaceChildren(t),mae(i.length),Aae()}var Wz=28;function Aae(){let i=U.selectedPin?.location.title||"",e=i.length>Wz?`${i.slice(0,Wz-1).trimEnd()}\u2026`:i;ye.dockRailName.textContent=e?` \xB7 ${e}`:"",ye.dockRailName.hidden=!e}function mae(i){ye.dockCount.textContent=`${Fc(i)} ${i===1?"location":"locations"}`,U.search?(ye.dockFlag.textContent=`\u201C${U.search}\u201D`,ye.dockFlag.hidden=!1):U.hiddenCategories.size>0?(ye.dockFlag.textContent="filtered",ye.dockFlag.hidden=!1):ye.dockFlag.hidden=!0}function Kw(){!U.dockFolded||U.dockDismissed||Zw(!1)}function tI(i){U.dockDismissed=i,Zw(i)}function Zw(i,e=!0){U.dockFolded=i,ye.dock.classList.toggle("is-folded",i),ye.dockFold.setAttribute("aria-expanded",String(!i));let t=i?"Bring the panel back (\u2318\u2325B)":"Put the panel away (\u2318\u2325B)";ye.dockFold.setAttribute("aria-label",t),ye.dockFold.setAttribute("title",t),e&&Nc()}function nI(i){U.hiddenCategories.delete(i.category.id),Lx(),$l(),Md(),Nx(i,!0)}function Nx(i,e=!1){U.selectedPin=i,document.dispatchEvent(new Event("atlas:selection")),Tu(),U.layers.pins.changed(),U.layers.pinLabels.changed(),U.layers.text.changed(),U.layers.textDetail.changed(),U.layers.priority.changed(),ye.detailTitle.textContent=i.location.title,ye.detailCategory.textContent=`${i.group.title} / ${i.category.title}`,ye.detailDescription.textContent="",ye.detailLinks.hidden=!0,_ae(i),ye.detailID.textContent=String(i.location.id),ye.detailCoordinates.textContent=`${i.location.lat.toFixed(6)}, ${i.location.lng.toFixed(6)}`;let t=hG(i.coordinate);ye.detailCell.textContent=t,ye.detailCellField.hidden=!t;let n=gae(i);if(ye.detailSource.textContent=n,ye.detailSourceField.hidden=!n,Ig(ye.detailDot,i.category),Ng(ye.detailDot,i.category,Dc(i.category.title)),ye.detail.hidden=!1,Kw(),Ed(),e){let r=U.engine.getView();r.animate({center:i.coordinate,zoom:Math.min(Eu(U.variant),Math.max(r.getZoom()||0,4)),duration:220})}}function gae(i){let e=U.map?.merged;if(!e?.length)return"";let t=e.find(n=>n.origin)?.source||"";if(U.pinSourceIndex?.map!==U.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)}}U.pinSourceIndex={map:U.map,byID:n}}for(let n of e)if(!n.origin&&i.group.title===n.source)return n.source;return U.pinSourceIndex.byID.get(i.location.id)||t}async function _ae(i){let e=await jz();if(U.selectedPin!==i)return;let t=e[String(i.location.id)]||{};i.location.description=t.d||"",i.location.links=t.l||[],ye.detailDescription.textContent=Hz(t.d)||"No description is included in the archive.",xae(i)}function xae(i){let e=(i.location.links||[]).filter(n=>U.pinByID.has(n.locationId));if(ye.detailLinks.hidden=e.length===0,!e.length){ye.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)}ye.detailLinks.replaceChildren(t)}function Oc(){let i=U.selectedPin!==null;U.selectedPin=null,document.dispatchEvent(new Event("atlas:selection")),U.sources&&(Tu(),U.layers.pins.changed(),U.layers.pinLabels.changed(),U.layers.text.changed(),U.layers.textDetail.changed(),U.layers.priority.changed()),ye.detail.hidden=!0,i&&Ed()}function Mu(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 Lg(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++]=Mu(i,e,l,n,r[s]),e=l}return r.length=s,r}function Dx(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?[]:Lg(i,e,l,n,r[s]),e=l[l.length-1]}return r.length=s,r}var iI=class i extends Su{constructor(e,t){super(),t&&!Array.isArray(e[0])?this.setFlatCoordinates(t,e):this.setCoordinates(e,t)}appendPoint(e){Pc(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<gd(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=Sc(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 Mu(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getPoint(e){let t=this.flatCoordinates.length/this.stride;return e<0||t<=e?null:new Lc(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 Lc(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(vx(e,o,a))return!0}return!1}setCoordinates(e,t){this.setLayout(t,e,1),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=Ix(this.flatCoordinates,0,e,this.stride),this.changed()}},Xz=iI;function rI(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 sI(i,e,t,n){let r=0;for(let s=0,o=t.length;s<o;++s){let a=t[s];r+=rI(i,e,a,n),e=a}return r}function $z(i,e,t,n){let r=0;for(let s=0,o=t.length;s<o;++s){let a=t[s];r+=sI(i,e,a,n),e=a[a.length-1]}return r}function Yz(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]=Fo(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 oI(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=Sc(s,o,a,l);c>r&&(r=c),s=a,o=l}return r}function aI(i,e,t,n,r){for(let s=0,o=t.length;s<o;++s){let a=t[s];r=oI(i,e,a,n,r),e=a}return r}function Kz(i,e,t,n,r){for(let s=0,o=t.length;s<o;++s){let a=t[s];r=aI(i,e,a,n,r),e=a[a.length-1]}return r}function lI(i,e,t,n,r,s,o,a,l,c,u){if(e==t)return c;let f,p;if(r===0){if(p=Sc(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(Yz(i,x-n,x,n,o,a,u),p=Sc(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&&(Yz(i,t-n,e,n,o,a,u),p=Sc(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 cI(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=lI(i,e,x,n,r,s,o,a,l,c,u),e=x}return c}function Zz(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=cI(i,e,x,n,r,s,o,a,l,c,u),e=x[x.length-1]}return c}function Fx(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,v=i[p],w=i[p+1],S=i[f],T=i[f+1];for(let R=p+n;R<f;R+=n){let P=i[R],C=i[R+1],L=xG(P,C,v,w,S,T);L>x&&(u=R,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 Qz(i,e,t,n,r,s,o,a){for(let l=0,c=t.length;l<c;++l){let u=t[l];o=Fx(i,e,u,n,r,s,o),a.push(o),e=u}return o}function Cd(i,e){return e*Math.round(i/e)}function yae(i,e,t,n,r,s,o){if(e==t)return o;let a=Cd(i[e],r),l=Cd(i[e+1],r);e+=n,s[o++]=a,s[o++]=l;let c,u;do if(c=Cd(i[e],r),u=Cd(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=Cd(i[e],r),p=Cd(i[e+1],r);if(e+=n,f==c&&p==u)continue;let x=c-a,v=u-l,w=f-a,S=p-l;if(x*S==v*w&&(x<0&&w<x||x==w||x>0&&w>x)&&(v<0&&S<v||v==S||v>0&&S>v)){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 Ox(i,e,t,n,r,s,o,a){for(let l=0,c=t.length;l<c;++l){let u=t[l];o=yae(i,e,u,n,r,s,o),a.push(o),e=u}return o}function Jz(i,e,t,n,r,s,o,a){for(let l=0,c=t.length;l<c;++l){let u=t[l],f=[];o=Ox(i,e,u,n,r,s,o,f),a.push(f),e=u[u.length-1]}return o}var uI=class i extends Su{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<gd(this.getExtent(),e,t)?r:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(oI(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),lI(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,this.maxDelta_,!0,e,t,n,r))}getArea(){return rI(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getCoordinates(){return Mu(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getSimplifiedGeometryInternal(e){let t=[];return t.length=Fx(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,e,t,0),new i(t,"XY")}getType(){return"LinearRing"}intersectsExtent(e){return Nw(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,e)}setCoordinates(e,t){this.setLayout(t,e,1),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=Ix(this.flatCoordinates,0,e,this.stride),this.changed()}},hI=uI;function Bx(i,e,t,n,r,s,o){let a,l,c,u,f,p,x,v=r[s+1],w=[];for(let R=0,P=t.length;R<P;++R){let C=t[R];for(u=i[C-n],p=i[C-n+1],a=e;a<C;a+=n)f=i[a],x=i[a+1],(v<=p&&x<=v||p<=v&&v<=x)&&(c=(v-p)/(x-p)*(f-u)+u,w.push(c)),u=f,p=x}let S=NaN,T=-1/0;for(w.sort(Va),u=w[0],a=1,l=w.length;a<l;++a){f=w[a];let R=Math.abs(f-u);R>T&&(c=(u+f)/2,Cx(i,e,t,n,c,v)&&(S=c,T=R)),u=f}return isNaN(S)&&(S=r[s]),o?(o.push(S,v,T),o):[S,v,T]}function Qw(i,e,t,n,r){let s=[];for(let o=0,a=t.length;o<a;++o){let l=t[o];s=Bx(i,e,l,n,r,2*o,s),e=l[l.length-1]}return s}function eV(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 fI(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 dI(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=fI(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 tV(i,e,t,n,r){for(let s=0,o=t.length;s<o;++s){let a=t[s];if(!dI(i,e,a,n,r))return!1;a.length&&(e=a[a.length-1])}return!0}function Jw(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=fI(i,e,a,n);(s===0?r&&l||!r&&!l:r&&!l||!r&&l)&&eV(i,e,a,n),e=a}return e}function pI(i,e,t,n,r){for(let s=0,o=t.length;s<o;++s)e=Jw(i,e,t[s],n,r);return e}function nV(i,e){let t=[],n=0,r=0,s;for(let o=0,a=e.length;o<a;++o){let l=e[o],c=fI(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 eS=class i extends Su{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?Pc(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<gd(this.getExtent(),e,t)?r:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(aI(this.flatCoordinates,0,this.ends_,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),cI(this.flatCoordinates,0,this.ends_,this.stride,this.maxDelta_,!0,e,t,n,r))}containsXY(e,t){return Cx(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,e,t)}getArea(){return sI(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride)}getCoordinates(e){let t;return e!==void 0?(t=this.getOrientedFlatCoordinates().slice(),Jw(t,0,this.ends_,this.stride,e)):t=this.flatCoordinates,Lg(t,0,this.ends_,this.stride)}getEnds(){return this.ends_}getFlatInteriorPoint(){if(this.flatInteriorPointRevision_!=this.getRevision()){let e=za(this.getExtent());this.flatInteriorPoint_=Bx(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,e,0),this.flatInteriorPointRevision_=this.getRevision()}return this.flatInteriorPoint_}getInteriorPoint(){return new Lc(this.getFlatInteriorPoint(),"XYM")}getLinearRingCount(){return this.ends_.length}getLinearRing(e){return e<0||this.ends_.length<=e?null:new hI(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 hI(t.slice(s,l),e);r.push(c),s=l}return r}getOrientedFlatCoordinates(){if(this.orientedRevision_!=this.getRevision()){let e=this.flatCoordinates;dI(e,0,this.ends_,this.stride)?this.orientedFlatCoordinates_=e:(this.orientedFlatCoordinates_=e.slice(),this.orientedFlatCoordinates_.length=Jw(this.orientedFlatCoordinates_,0,this.ends_,this.stride)),this.orientedRevision_=this.getRevision()}return this.orientedFlatCoordinates_}getSimplifiedGeometryInternal(e){let t=[],n=[];return t.length=Ox(this.flatCoordinates,0,this.ends_,this.stride,Math.sqrt(e),t,0,n),new i(t,"XY",n)}getType(){return"Polygon"}intersectsExtent(e){return MP(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,e)}setCoordinates(e,t){this.setLayout(t,e,2),this.flatCoordinates||(this.flatCoordinates=[]);let n=QP(this.flatCoordinates,0,e,this.stride,this.ends_);this.flatCoordinates.length=n.length===0?0:n[n.length-1],this.changed()}},Cu=eS;function AI(i){if(vu(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 eS(s,"XY",[s.length])}function tS(i,e,t,n){let r=[],s=Pr();for(let o=0,a=t.length;o<a;++o){let l=t[o];s=hg(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 mI=class i extends Su{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;Pc(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;Pc(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<gd(this.getExtent(),e,t)?r:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(Kz(this.flatCoordinates,0,this.endss_,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),Zz(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,this.maxDelta_,!0,e,t,n,r))}containsXY(e,t){return QG(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,e,t)}getArea(){return $z(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride)}getCoordinates(e){let t;return e!==void 0?(t=this.getOrientedFlatCoordinates().slice(),pI(t,0,this.endss_,this.stride,e)):t=this.flatCoordinates,Dx(t,0,this.endss_,this.stride)}getEndss(){return this.endss_}getFlatInteriorPoints(){if(this.flatInteriorPointsRevision_!=this.getRevision()){let e=tS(this.flatCoordinates,0,this.endss_,this.stride);this.flatInteriorPoints_=Qw(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,e),this.flatInteriorPointsRevision_=this.getRevision()}return this.flatInteriorPoints_}getInteriorPoints(){return new Xz(this.getFlatInteriorPoints().slice(),"XYM")}getOrientedFlatCoordinates(){if(this.orientedRevision_!=this.getRevision()){let e=this.flatCoordinates;tV(e,0,this.endss_,this.stride)?this.orientedFlatCoordinates_=e:(this.orientedFlatCoordinates_=e.slice(),this.orientedFlatCoordinates_.length=pI(this.orientedFlatCoordinates_,0,this.endss_,this.stride)),this.orientedRevision_=this.getRevision()}return this.orientedFlatCoordinates_}getSimplifiedGeometryInternal(e){let t=[],n=[];return t.length=Jz(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 Cu(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 Cu(t.slice(s,c),e,l);r.push(u),s=c}return r}getType(){return"MultiPolygon"}intersectsExtent(e){return ez(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,e)}setCoordinates(e,t){this.setLayout(t,e,3),this.flatCoordinates||(this.flatCoordinates=[]);let n=Vz(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()}},nS=mI;function iV(i){return i.key.toLocaleLowerCase()==="g"?(i.preventDefault(),rV(),U.gridEnabled?(ye.gridInput.focus(),ye.gridInput.select()):ye.viewport.focus({preventScroll:!0}),!0):i.key===" "&&U.gridEnabled&&i.target!==ye.subgridToggle?(i.preventDefault(),Ux(!U.subgridVisible),!0):i.key==="Escape"&&U.gridEnabled?(i.preventDefault(),gI(),!0):!1}function rV(i=!U.gridEnabled){U.gridEnabled=i,i&&Ux(!0),rS(),Tu(),U.layers.pins.changed(),U.layers.text.changed(),U.layers.priority.changed()}function Ux(i){U.subgridVisible=i,U.layers.grid.changed(),U.layers.gridContext.changed(),ye.subgridToggle.setAttribute("aria-pressed",String(i)),ye.subgridToggle.setAttribute("aria-label",i?"Hide the subgrid":"Show the subgrid"),sV(),document.dispatchEvent(new Event("atlas:grid"))}function sV(){if(!U.gridEnabled){ye.gridHint.textContent="G \xB7 grid off";return}ye.gridHint.textContent=`G-${U.gridCell||"root"}`+(U.subgridVisible?"":" no subgrid")}function tA(i){let e=uo(),t=e.parseInput(e.normalizeInput(i));if(t===null)return;let n=t!==U.gridCell;U.gridCell=t,U.gridEnabled||(U.gridEnabled=!0),rS(),Tu(),U.layers.pins.changed(),U.layers.text.changed(),U.layers.priority.changed(),n&&(Oc(),U.engine.getView().fit(_I(),{size:U.engine.getSize(),padding:[52,52,52,52],maxZoom:Eu(U.variant),duration:180}))}function gI(){if(U.gridEnabled){if(!U.gridCell){rV(!1);return}tA(uo().parent(U.gridCell))}}function rS(){if(U.sources){if(U.sources.grid.clear(),U.sources.gridContext.clear(),ye.gridNavigator.hidden=!U.gridEnabled,sV(),U.gridEnabled&&U.variant){let i=uo();ye.gridInput.maxLength=i.inputLength(U.map),ye.gridInput.value=U.gridCell,ye.gridBack.title=U.gridCell?`Back one ${i.slug} level`:`Close ${i.slug} grid`;for(let e of oS())wae(e)}document.dispatchEvent(new Event("atlas:grid"))}}function vae(i){return U0[uo().colorKey(i)]}function sS(i,{subgridVisible:e,labelled:t}){let{role:n,contextDistance:r}=i;if(n==="child"&&(!t||!e))return null;let s=vae(i.hash),o=n==="leaf"||n==="scope",a=n==="scope"&&e,l={color:o?Li.lineWhite:s,opacity:n==="neighbor"?Li.neighborLineAlpha:n==="child"?Li.childLineAlpha:1,widthPx:a?Li.widths.scopeBare:Li.widths[n]},c=null;n==="neighbor"?c={color:Li.dimColor,opacity:Math.min(Li.dimCap,Li.dimBase+r*Li.dimStep)}:n==="leaf"?c={color:s,opacity:Li.leafFillAlpha}:n==="child"&&(c={color:s,opacity:Li.childFillAlpha});let u=null;if(t&&!a){let{context:f,principal:p}=uo().label(i.hash);u={prefix:f,final:p,color:o?Li.lineWhite:s,textAlpha:n==="neighbor"?Li.neighborTextAlpha:1,chip:n==="neighbor"?Li.neighborChip:Li.chip,sizePx:n==="neighbor"?Li.neighborLabelSizePx:Li.labelSizePx}}return{line:l,fill:c,label:u,bare:a}}function oS(){let i=uo(),e=[],t=bae(i,U.gridCell);for(let n=0;n<t.length-1;n++){let r=t[n+1];for(let s of i.children(t[n]))s!==r&&e.push(iS(i,s,"neighbor",t.length-1-n))}if(U.gridCell&&i.level(U.gridCell)>=i.maxLevel(U.map))return e.push(iS(i,U.gridCell,"leaf",0)),e;U.gridCell&&e.push(iS(i,U.gridCell,"scope",0));for(let n of i.children(U.gridCell))e.push(iS(i,n,"child",0));return e}function bae(i,e){let t=[e],n=e;for(;n;)n=i.parent(n),t.unshift(n);return t}function iS(i,e,t,n){return{hash:e,extent:i.bbox(e),ring:i.ring(e),pole:i.poleContained(e),childIndex:i.childIndex(e),role:t,contextDistance:n}}function wae(i){let e=uo(),t=U.pins.filter(s=>!s.filteredHidden&&e.contains(i.hash,s.coordinate)).length,n=new Td({geometry:Sae(i),gridCell:{hash:i.hash,extent:i.extent,role:i.role,count:t,contextDistance:i.contextDistance},priority:i.role==="neighbor"?-i.contextDistance*100+i.childIndex:i.childIndex});(i.role==="neighbor"?U.sources.gridContext:U.sources.grid).addFeature(n)}function Sae(i){let e=cg(),t=i.ring;if(i.pole){let o=i.pole==="north"?e[3]:e[1],a=t.slice(0,-1);t=[...a,[a[a.length-1][0],o],[a[0][0],o],a[0]]}if(t.every(([o])=>o>=e[0]&&o<=e[2]))return new Cu([t]);let r=e[2]-e[0],s=[];for(let o of[0,-r,r]){let a=fG(t.map(([l,c])=>[l+o,c]),e[0],e[2]);a.length>=4&&s.push([a])}return new nS(s)}function _I(){return uo().bbox(U.gridCell)}function oV(){return uo().maxLevel(U.map)}function Rd(i){return!U.gridEnabled||!U.gridCell?!1:uo().contains(U.gridCell,i.coordinate)}function Ru(i){let e=i.attrs?.["atlas.render.as"];return e||(i.displayType==="text"?"text":"pin")}function aV(i){return i?.attrs?.["atlas.geometry.surface"]||"plane"}function lf(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)]},toWorld(p,x){return[r+(x-l)/(u-l)*o,s+(c-p)/(c-f)*a]}}}var lS=[NaN,NaN,NaN,0],xI;function Tae(){return xI||(xI=Ti(1,1,void 0,{willReadFrequently:!0,desynchronized:!0})),xI}var Eae=/^rgba?\(\s*(\d+%?)\s+(\d+%?)\s+(\d+%?)(?:\s*\/\s*(\d+%|\d*\.\d+|[01]))?\s*\)$/i,Mae=/^rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)(?:\s*,\s*(\d+%|\d*\.\d+|[01]))?\s*\)$/i,Cae=/^rgba?\(\s*(\d+%)\s*,\s*(\d+%)\s*,\s*(\d+%)(?:\s*,\s*(\d+%|\d*\.\d+|[01]))?\s*\)$/i,Rae=/^#([\da-f]{3,4}|[\da-f]{6}|[\da-f]{8})$/i;function aS(i,e){return i.endsWith("%")?Number(i.substring(0,i.length-1))/e:Number(i)}function Gx(i){throw new Error('failed to parse "'+i+'" as color')}function lV(i){if(i.toLowerCase().startsWith("rgb")){let s=i.match(Mae)||i.match(Eae)||i.match(Cae);if(s){let o=s[4],a=100/255;return[xi(aS(s[1],a)+.5|0,0,255),xi(aS(s[2],a)+.5|0,0,255),xi(aS(s[3],a)+.5|0,0,255),o!==void 0?xi(aS(o,100),0,1):1]}Gx(i)}if(i.startsWith("#")){if(Rae.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}Gx(i)}let e=Tae();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&&Gx(i));let n=e.fillStyle;if(n.startsWith("#")||n.startsWith("rgba"))return lV(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]=q0(r[3]/255,3),r}function cV(i){return typeof i=="string"?i:Vx(i)}var Pae=1024,kx={},yI=0;function uV(i){if(i.length===4)return i;let e=i.slice();return e[3]=1,e}function vI(i){return i>.0031308?Math.pow(i,1/2.4)*269.025-14.025:i*3294.6}function bI(i){return i>.2068965?Math.pow(i,3):(i-4/29)*(108/841)}function wI(i){return i>10.314724?Math.pow((i+14.025)/269.025,2.4):i/3294.6}function SI(i){return i>.0088564?Math.pow(i,1/3):i/(108/841)+4/29}function TI(i){let e=wI(i[0]),t=wI(i[1]),n=wI(i[2]),r=SI(e*.222488403+t*.716873169+n*.06060791),s=500*(SI(e*.452247074+t*.399439023+n*.148375274)-r),o=200*(r-SI(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 hV(i){let e=(i[0]+16)/116,t=i[1],n=i[2]*Math.PI/180,r=bI(e),s=bI(e+t/500*Math.cos(n)),o=bI(e-t/200*Math.sin(n)),a=vI(s*3.021973625-r*1.617392459-o*.404875592),l=vI(s*-.943766287+r*1.916279586+o*.027607165),c=vI(s*.069407491-r*.22898585+o*1.159737864);return[xi(a+.5|0,0,255),xi(l+.5|0,0,255),xi(c+.5|0,0,255),i[3]]}function zx(i){if(i==="none")return lS;if(kx.hasOwnProperty(i))return kx[i];if(yI>=Pae){let t=0;for(let n in kx)(t++&3)===0&&(delete kx[n],--yI)}let e=lV(i);e.length!==4&&Gx(i);for(let t of e)isNaN(t)&&Gx(i);return kx[i]=e,++yI,e}function Yl(i){return Array.isArray(i)?i:zx(i)}function Vx(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 MI=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=EI(e,t);return n in this.cache_?this.cache_[n]:null}getPattern(e,t){let n=EI(e,t);return n in this.patternCache_?this.patternCache_[n]:null}set(e,t,n,r){let s=EI(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]=Px().createPattern(n.getImage(1),"repeat")}):this.patternCache_[s]=Px().createPattern(n.getImage(1),"repeat")),o||++this.cacheSize_}setSize(e){this.maxCacheSize_=e,this.expire()}};function EI(i,e){let t=e?Yl(e):"null";return i+":"+t}var Bo=new MI;var qx=null,cS=class extends Sd{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){qx||(qx=Ti(1,1,void 0,{willReadFrequently:!0})),qx.drawImage(this.image_,0,0);try{qx.getImageData(0,0,1,1),this.tainted_=!1}catch{qx=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=Ti(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&&hz(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=Ti(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=cV(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 Pd(i,e,t,n,r,s){let o=e===void 0?void 0:Bo.get(e,r);return o||(o=new cS(i,i&&"src"in i?i.src||void 0:e,t,n,r),Bo.set(e,r,o,s)),s&&o&&!Bo.getPattern(e,r)&&Bo.set(e,r,o,s),o}var fV=cS;function Ha(i){return i?Array.isArray(i)?Vx(i):typeof i=="object"&&"src"in i?Iae(i):i:null}function Iae(i){if(!i.offset||!i.size)return Bo.getPattern(i.src,i.color);let e=i.src+":"+i.offset,t=Bo.getPattern(e,i.color);if(t)return t;let n=Bo.get(i.src,null);if(n.getImageState()!==Mn.LOADED)return null;let r=Ti(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]),Pd(r.canvas,e,void 0,Mn.LOADED,i.color,!0),Bo.getPattern(e,i.color)}var Hx="ol-hidden";var Id="ol-unselectable";var Dg="ol-control",CI="ol-collapsed",Nae=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"),dV=["style","variant","weight","size","lineHeight","family"],uS={normal:400,bold:700},hS=function(i){let e=i.match(Nae);if(!e)return null;let t={lineHeight:"normal",size:"1.2em",style:"normal",weight:"400",variant:"normal"};for(let n=0,r=dV.length;n<r;++n){let s=e[n+1];s!==void 0&&(t[dV[n]]=typeof s=="string"?s.trim():s)}return isNaN(Number(t.weight))&&t.weight in uS&&(t.weight=uS[t.weight]),t.families=t.family.split(/,\s?/).map(n=>n.trim().replace(/^['"]|['"]$/g,"")),t};var fS="10px sans-serif",ks="#000",Pu="round",Wa=[],ja=0,Iu="round",cf=10,AV=0,Uo="#000",Nd="center",iA="middle",uf=[0,0,0,0],hf=1,nA=new bs,Wx=null,pV,RI={},Lae=new Set(["serif","sans-serif","monospace","cursive","fantasy","system-ui","ui-serif","ui-sans-serif","ui-monospace","ui-rounded","emoji","math","fangsong"]);function Dae(i,e,t){return`${i} ${e} 16px "${t}"`}var mV=(function(){let e,t;async function n(s){await t.ready;let o=hS(s),a=o.families[0].toLowerCase(),l=o.weight,c=[];return t.forEach(f=>{let p=f.family.replace(/^['"]|['"]$/g,"").toLowerCase(),x=uS[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=nA.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)?(wu(RI),nA.set(c,100)):(u+=10,nA.set(c,u,!0),u<100&&(s=!1)))}e=void 0,s||(e=setTimeout(r,100))}return async function(s){t||(t=Us?self.fonts:document.fonts);let o=hS(s);if(!o)return;let a=o.families,l=!1;for(let c of a){if(Lae.has(c))continue;let u=Dae(o.style,o.weight,c);nA.get(u)===void 0&&(nA.set(u,0,!0),l=!0)}l&&(clearTimeout(e),e=setTimeout(r,100))}})(),Fae=(function(){let i;return function(e){let t=RI[e];if(t==null){if(Us){let n=hS(e),r=gV(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);RI[e]=t}return t}})();function gV(i,e){return Wx||(Wx=Ti(1,1)),i!=pV&&(Wx.font=i,pV=Wx.font),Wx.measureText(e)}function _V(i,e){return gV(i,e).width}function PI(i,e,t){if(e in t)return t[e];let n=e.split(`4+`).trim()}function Fc(i){return new Intl.NumberFormat().format(i)}function Xr(i,e,t){return Math.min(t,Math.max(e,i))}function Yw(i){return i instanceof HTMLElement&&(i.matches("input, textarea, select")||i.isContentEditable)}var pae=100;function Ed(){if(!ye.searchResults)return;let i=U.pins.filter(n=>!n.filteredHidden).sort((n,r)=>n.location.title.localeCompare(r.location.title)),e=i.slice(0,pae),t=document.createDocumentFragment();if(!e.length){let n=document.createElement("p");n.className="search-empty",n.textContent=U.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",U.selectedPin===n&&r.classList.add("is-selected"),r.dataset.location=String(n.location.id),Ig(r,n.category);let s=document.createElement("span");s.className="result-dot",Ng(s,n.category,Dc(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 ${Fc(i.length)} \u2014 search or filter to narrow the list.`,t.append(n)}ye.searchResults.replaceChildren(t),mae(i.length),Aae()}var Wz=28;function Aae(){let i=U.selectedPin?.location.title||"",e=i.length>Wz?`${i.slice(0,Wz-1).trimEnd()}\u2026`:i;ye.dockRailName.textContent=e?` \xB7 ${e}`:"",ye.dockRailName.hidden=!e}function mae(i){ye.dockCount.textContent=`${Fc(i)} ${i===1?"location":"locations"}`,U.search?(ye.dockFlag.textContent=`\u201C${U.search}\u201D`,ye.dockFlag.hidden=!1):U.hiddenCategories.size>0?(ye.dockFlag.textContent="filtered",ye.dockFlag.hidden=!1):ye.dockFlag.hidden=!0}function Kw(){!U.dockFolded||U.dockDismissed||Zw(!1)}function tI(i){U.dockDismissed=i,Zw(i)}function Zw(i,e=!0){U.dockFolded=i,ye.dock.classList.toggle("is-folded",i),ye.dockFold.setAttribute("aria-expanded",String(!i));let t=i?"Bring the panel back (\u2318\u2325B)":"Put the panel away (\u2318\u2325B)";ye.dockFold.setAttribute("aria-label",t),ye.dockFold.setAttribute("title",t),e&&Nc()}function nI(i){U.hiddenCategories.delete(i.category.id),Lx(),$l(),Md(),Nx(i,!0)}function Nx(i,e=!1){U.selectedPin=i,document.dispatchEvent(new Event("atlas:selection")),Tu(),U.layers.pins.changed(),U.layers.pinLabels.changed(),U.layers.text.changed(),U.layers.textDetail.changed(),U.layers.priority.changed(),ye.detailTitle.textContent=i.location.title,ye.detailCategory.textContent=`${i.group.title} / ${i.category.title}`,ye.detailDescription.textContent="",ye.detailLinks.hidden=!0,_ae(i),ye.detailID.textContent=String(i.location.id),ye.detailCoordinates.textContent=`${i.location.lat.toFixed(6)}, ${i.location.lng.toFixed(6)}`;let t=hG(i.coordinate);ye.detailCell.textContent=t,ye.detailCellField.hidden=!t;let n=gae(i);if(ye.detailSource.textContent=n,ye.detailSourceField.hidden=!n,Ig(ye.detailDot,i.category),Ng(ye.detailDot,i.category,Dc(i.category.title)),ye.detail.hidden=!1,Kw(),Ed(),e){let r=U.engine.getView();r.animate({center:i.coordinate,zoom:Math.min(Eu(U.lens),Math.max(r.getZoom()||0,4)),duration:220})}}function gae(i){let e=U.world?.merged;if(!e?.length)return"";let t=e.find(n=>n.origin)?.source||"";if(U.pinSourceIndex?.world!==U.world){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)}}U.pinSourceIndex={world:U.world,byID:n}}for(let n of e)if(!n.origin&&i.group.title===n.source)return n.source;return U.pinSourceIndex.byID.get(i.location.id)||t}async function _ae(i){let e=await jz();if(U.selectedPin!==i)return;let t=e[String(i.location.id)]||{};i.location.description=t.d||"",i.location.links=t.l||[],ye.detailDescription.textContent=Hz(t.d)||"No description is included in the archive.",xae(i)}function xae(i){let e=(i.location.links||[]).filter(n=>U.pinByID.has(n.locationId));if(ye.detailLinks.hidden=e.length===0,!e.length){ye.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)}ye.detailLinks.replaceChildren(t)}function Oc(){let i=U.selectedPin!==null;U.selectedPin=null,document.dispatchEvent(new Event("atlas:selection")),U.sources&&(Tu(),U.layers.pins.changed(),U.layers.pinLabels.changed(),U.layers.text.changed(),U.layers.textDetail.changed(),U.layers.priority.changed()),ye.detail.hidden=!0,i&&Ed()}function Mu(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 Lg(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++]=Mu(i,e,l,n,r[s]),e=l}return r.length=s,r}function Dx(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?[]:Lg(i,e,l,n,r[s]),e=l[l.length-1]}return r.length=s,r}var iI=class i extends Su{constructor(e,t){super(),t&&!Array.isArray(e[0])?this.setFlatCoordinates(t,e):this.setCoordinates(e,t)}appendPoint(e){Pc(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<gd(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=Sc(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 Mu(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getPoint(e){let t=this.flatCoordinates.length/this.stride;return e<0||t<=e?null:new Lc(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 Lc(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(vx(e,o,a))return!0}return!1}setCoordinates(e,t){this.setLayout(t,e,1),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=Ix(this.flatCoordinates,0,e,this.stride),this.changed()}},Xz=iI;function rI(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 sI(i,e,t,n){let r=0;for(let s=0,o=t.length;s<o;++s){let a=t[s];r+=rI(i,e,a,n),e=a}return r}function $z(i,e,t,n){let r=0;for(let s=0,o=t.length;s<o;++s){let a=t[s];r+=sI(i,e,a,n),e=a[a.length-1]}return r}function Yz(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]=Fo(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 oI(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=Sc(s,o,a,l);c>r&&(r=c),s=a,o=l}return r}function aI(i,e,t,n,r){for(let s=0,o=t.length;s<o;++s){let a=t[s];r=oI(i,e,a,n,r),e=a}return r}function Kz(i,e,t,n,r){for(let s=0,o=t.length;s<o;++s){let a=t[s];r=aI(i,e,a,n,r),e=a[a.length-1]}return r}function lI(i,e,t,n,r,s,o,a,l,c,u){if(e==t)return c;let f,p;if(r===0){if(p=Sc(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(Yz(i,x-n,x,n,o,a,u),p=Sc(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&&(Yz(i,t-n,e,n,o,a,u),p=Sc(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 cI(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=lI(i,e,x,n,r,s,o,a,l,c,u),e=x}return c}function Zz(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=cI(i,e,x,n,r,s,o,a,l,c,u),e=x[x.length-1]}return c}function Fx(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,v=i[p],w=i[p+1],S=i[f],T=i[f+1];for(let R=p+n;R<f;R+=n){let P=i[R],C=i[R+1],L=xG(P,C,v,w,S,T);L>x&&(u=R,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 Qz(i,e,t,n,r,s,o,a){for(let l=0,c=t.length;l<c;++l){let u=t[l];o=Fx(i,e,u,n,r,s,o),a.push(o),e=u}return o}function Cd(i,e){return e*Math.round(i/e)}function yae(i,e,t,n,r,s,o){if(e==t)return o;let a=Cd(i[e],r),l=Cd(i[e+1],r);e+=n,s[o++]=a,s[o++]=l;let c,u;do if(c=Cd(i[e],r),u=Cd(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=Cd(i[e],r),p=Cd(i[e+1],r);if(e+=n,f==c&&p==u)continue;let x=c-a,v=u-l,w=f-a,S=p-l;if(x*S==v*w&&(x<0&&w<x||x==w||x>0&&w>x)&&(v<0&&S<v||v==S||v>0&&S>v)){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 Ox(i,e,t,n,r,s,o,a){for(let l=0,c=t.length;l<c;++l){let u=t[l];o=yae(i,e,u,n,r,s,o),a.push(o),e=u}return o}function Jz(i,e,t,n,r,s,o,a){for(let l=0,c=t.length;l<c;++l){let u=t[l],f=[];o=Ox(i,e,u,n,r,s,o,f),a.push(f),e=u[u.length-1]}return o}var uI=class i extends Su{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<gd(this.getExtent(),e,t)?r:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(oI(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),lI(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,this.maxDelta_,!0,e,t,n,r))}getArea(){return rI(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getCoordinates(){return Mu(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getSimplifiedGeometryInternal(e){let t=[];return t.length=Fx(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,e,t,0),new i(t,"XY")}getType(){return"LinearRing"}intersectsExtent(e){return Nw(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,e)}setCoordinates(e,t){this.setLayout(t,e,1),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=Ix(this.flatCoordinates,0,e,this.stride),this.changed()}},hI=uI;function Bx(i,e,t,n,r,s,o){let a,l,c,u,f,p,x,v=r[s+1],w=[];for(let R=0,P=t.length;R<P;++R){let C=t[R];for(u=i[C-n],p=i[C-n+1],a=e;a<C;a+=n)f=i[a],x=i[a+1],(v<=p&&x<=v||p<=v&&v<=x)&&(c=(v-p)/(x-p)*(f-u)+u,w.push(c)),u=f,p=x}let S=NaN,T=-1/0;for(w.sort(Va),u=w[0],a=1,l=w.length;a<l;++a){f=w[a];let R=Math.abs(f-u);R>T&&(c=(u+f)/2,Cx(i,e,t,n,c,v)&&(S=c,T=R)),u=f}return isNaN(S)&&(S=r[s]),o?(o.push(S,v,T),o):[S,v,T]}function Qw(i,e,t,n,r){let s=[];for(let o=0,a=t.length;o<a;++o){let l=t[o];s=Bx(i,e,l,n,r,2*o,s),e=l[l.length-1]}return s}function eV(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 fI(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 dI(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=fI(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 tV(i,e,t,n,r){for(let s=0,o=t.length;s<o;++s){let a=t[s];if(!dI(i,e,a,n,r))return!1;a.length&&(e=a[a.length-1])}return!0}function Jw(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=fI(i,e,a,n);(s===0?r&&l||!r&&!l:r&&!l||!r&&l)&&eV(i,e,a,n),e=a}return e}function pI(i,e,t,n,r){for(let s=0,o=t.length;s<o;++s)e=Jw(i,e,t[s],n,r);return e}function nV(i,e){let t=[],n=0,r=0,s;for(let o=0,a=e.length;o<a;++o){let l=e[o],c=fI(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 eS=class i extends Su{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?Pc(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<gd(this.getExtent(),e,t)?r:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(aI(this.flatCoordinates,0,this.ends_,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),cI(this.flatCoordinates,0,this.ends_,this.stride,this.maxDelta_,!0,e,t,n,r))}containsXY(e,t){return Cx(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,e,t)}getArea(){return sI(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride)}getCoordinates(e){let t;return e!==void 0?(t=this.getOrientedFlatCoordinates().slice(),Jw(t,0,this.ends_,this.stride,e)):t=this.flatCoordinates,Lg(t,0,this.ends_,this.stride)}getEnds(){return this.ends_}getFlatInteriorPoint(){if(this.flatInteriorPointRevision_!=this.getRevision()){let e=za(this.getExtent());this.flatInteriorPoint_=Bx(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,e,0),this.flatInteriorPointRevision_=this.getRevision()}return this.flatInteriorPoint_}getInteriorPoint(){return new Lc(this.getFlatInteriorPoint(),"XYM")}getLinearRingCount(){return this.ends_.length}getLinearRing(e){return e<0||this.ends_.length<=e?null:new hI(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 hI(t.slice(s,l),e);r.push(c),s=l}return r}getOrientedFlatCoordinates(){if(this.orientedRevision_!=this.getRevision()){let e=this.flatCoordinates;dI(e,0,this.ends_,this.stride)?this.orientedFlatCoordinates_=e:(this.orientedFlatCoordinates_=e.slice(),this.orientedFlatCoordinates_.length=Jw(this.orientedFlatCoordinates_,0,this.ends_,this.stride)),this.orientedRevision_=this.getRevision()}return this.orientedFlatCoordinates_}getSimplifiedGeometryInternal(e){let t=[],n=[];return t.length=Ox(this.flatCoordinates,0,this.ends_,this.stride,Math.sqrt(e),t,0,n),new i(t,"XY",n)}getType(){return"Polygon"}intersectsExtent(e){return MP(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,e)}setCoordinates(e,t){this.setLayout(t,e,2),this.flatCoordinates||(this.flatCoordinates=[]);let n=QP(this.flatCoordinates,0,e,this.stride,this.ends_);this.flatCoordinates.length=n.length===0?0:n[n.length-1],this.changed()}},Cu=eS;function AI(i){if(vu(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 eS(s,"XY",[s.length])}function tS(i,e,t,n){let r=[],s=Pr();for(let o=0,a=t.length;o<a;++o){let l=t[o];s=hg(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 mI=class i extends Su{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;Pc(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;Pc(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<gd(this.getExtent(),e,t)?r:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(Kz(this.flatCoordinates,0,this.endss_,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),Zz(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,this.maxDelta_,!0,e,t,n,r))}containsXY(e,t){return QG(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,e,t)}getArea(){return $z(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride)}getCoordinates(e){let t;return e!==void 0?(t=this.getOrientedFlatCoordinates().slice(),pI(t,0,this.endss_,this.stride,e)):t=this.flatCoordinates,Dx(t,0,this.endss_,this.stride)}getEndss(){return this.endss_}getFlatInteriorPoints(){if(this.flatInteriorPointsRevision_!=this.getRevision()){let e=tS(this.flatCoordinates,0,this.endss_,this.stride);this.flatInteriorPoints_=Qw(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,e),this.flatInteriorPointsRevision_=this.getRevision()}return this.flatInteriorPoints_}getInteriorPoints(){return new Xz(this.getFlatInteriorPoints().slice(),"XYM")}getOrientedFlatCoordinates(){if(this.orientedRevision_!=this.getRevision()){let e=this.flatCoordinates;tV(e,0,this.endss_,this.stride)?this.orientedFlatCoordinates_=e:(this.orientedFlatCoordinates_=e.slice(),this.orientedFlatCoordinates_.length=pI(this.orientedFlatCoordinates_,0,this.endss_,this.stride)),this.orientedRevision_=this.getRevision()}return this.orientedFlatCoordinates_}getSimplifiedGeometryInternal(e){let t=[],n=[];return t.length=Jz(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 Cu(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 Cu(t.slice(s,c),e,l);r.push(u),s=c}return r}getType(){return"MultiPolygon"}intersectsExtent(e){return ez(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,e)}setCoordinates(e,t){this.setLayout(t,e,3),this.flatCoordinates||(this.flatCoordinates=[]);let n=Vz(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()}},nS=mI;function iV(i){return i.key.toLocaleLowerCase()==="g"?(i.preventDefault(),rV(),U.gridEnabled?(ye.gridInput.focus(),ye.gridInput.select()):ye.viewport.focus({preventScroll:!0}),!0):i.key===" "&&U.gridEnabled&&i.target!==ye.subgridToggle?(i.preventDefault(),Ux(!U.subgridVisible),!0):i.key==="Escape"&&U.gridEnabled?(i.preventDefault(),gI(),!0):!1}function rV(i=!U.gridEnabled){U.gridEnabled=i,i&&Ux(!0),rS(),Tu(),U.layers.pins.changed(),U.layers.text.changed(),U.layers.priority.changed()}function Ux(i){U.subgridVisible=i,U.layers.grid.changed(),U.layers.gridContext.changed(),ye.subgridToggle.setAttribute("aria-pressed",String(i)),ye.subgridToggle.setAttribute("aria-label",i?"Hide the subgrid":"Show the subgrid"),sV(),document.dispatchEvent(new Event("atlas:grid"))}function sV(){if(!U.gridEnabled){ye.gridHint.textContent="G \xB7 grid off";return}ye.gridHint.textContent=`G-${U.gridCell||"root"}`+(U.subgridVisible?"":" no subgrid")}function tA(i){let e=uo(),t=e.parseInput(e.normalizeInput(i));if(t===null)return;let n=t!==U.gridCell;U.gridCell=t,U.gridEnabled||(U.gridEnabled=!0),rS(),Tu(),U.layers.pins.changed(),U.layers.text.changed(),U.layers.priority.changed(),n&&(Oc(),U.engine.getView().fit(_I(),{size:U.engine.getSize(),padding:[52,52,52,52],maxZoom:Eu(U.lens),duration:180}))}function gI(){if(U.gridEnabled){if(!U.gridCell){rV(!1);return}tA(uo().parent(U.gridCell))}}function rS(){if(U.sources){if(U.sources.grid.clear(),U.sources.gridContext.clear(),ye.gridNavigator.hidden=!U.gridEnabled,sV(),U.gridEnabled&&U.lens){let i=uo();ye.gridInput.maxLength=i.inputLength(U.world),ye.gridInput.value=U.gridCell,ye.gridBack.title=U.gridCell?`Back one ${i.slug} level`:`Close ${i.slug} grid`;for(let e of oS())wae(e)}document.dispatchEvent(new Event("atlas:grid"))}}function vae(i){return U0[uo().colorKey(i)]}function sS(i,{subgridVisible:e,labelled:t}){let{role:n,contextDistance:r}=i;if(n==="child"&&(!t||!e))return null;let s=vae(i.hash),o=n==="leaf"||n==="scope",a=n==="scope"&&e,l={color:o?Li.lineWhite:s,opacity:n==="neighbor"?Li.neighborLineAlpha:n==="child"?Li.childLineAlpha:1,widthPx:a?Li.widths.scopeBare:Li.widths[n]},c=null;n==="neighbor"?c={color:Li.dimColor,opacity:Math.min(Li.dimCap,Li.dimBase+r*Li.dimStep)}:n==="leaf"?c={color:s,opacity:Li.leafFillAlpha}:n==="child"&&(c={color:s,opacity:Li.childFillAlpha});let u=null;if(t&&!a){let{context:f,principal:p}=uo().label(i.hash);u={prefix:f,final:p,color:o?Li.lineWhite:s,textAlpha:n==="neighbor"?Li.neighborTextAlpha:1,chip:n==="neighbor"?Li.neighborChip:Li.chip,sizePx:n==="neighbor"?Li.neighborLabelSizePx:Li.labelSizePx}}return{line:l,fill:c,label:u,bare:a}}function oS(){let i=uo(),e=[],t=bae(i,U.gridCell);for(let n=0;n<t.length-1;n++){let r=t[n+1];for(let s of i.children(t[n]))s!==r&&e.push(iS(i,s,"neighbor",t.length-1-n))}if(U.gridCell&&i.level(U.gridCell)>=i.maxLevel(U.world))return e.push(iS(i,U.gridCell,"leaf",0)),e;U.gridCell&&e.push(iS(i,U.gridCell,"scope",0));for(let n of i.children(U.gridCell))e.push(iS(i,n,"child",0));return e}function bae(i,e){let t=[e],n=e;for(;n;)n=i.parent(n),t.unshift(n);return t}function iS(i,e,t,n){return{hash:e,extent:i.bbox(e),ring:i.ring(e),pole:i.poleContained(e),childIndex:i.childIndex(e),role:t,contextDistance:n}}function wae(i){let e=uo(),t=U.pins.filter(s=>!s.filteredHidden&&e.contains(i.hash,s.coordinate)).length,n=new Td({geometry:Sae(i),gridCell:{hash:i.hash,extent:i.extent,role:i.role,count:t,contextDistance:i.contextDistance},priority:i.role==="neighbor"?-i.contextDistance*100+i.childIndex:i.childIndex});(i.role==="neighbor"?U.sources.gridContext:U.sources.grid).addFeature(n)}function Sae(i){let e=cg(),t=i.ring;if(i.pole){let o=i.pole==="north"?e[3]:e[1],a=t.slice(0,-1);t=[...a,[a[a.length-1][0],o],[a[0][0],o],a[0]]}if(t.every(([o])=>o>=e[0]&&o<=e[2]))return new Cu([t]);let r=e[2]-e[0],s=[];for(let o of[0,-r,r]){let a=fG(t.map(([l,c])=>[l+o,c]),e[0],e[2]);a.length>=4&&s.push([a])}return new nS(s)}function _I(){return uo().bbox(U.gridCell)}function oV(){return uo().maxLevel(U.world)}function Rd(i){return!U.gridEnabled||!U.gridCell?!1:uo().contains(U.gridCell,i.coordinate)}function Ru(i){let e=i.attrs?.["atlas.render.as"];return e||(i.displayType==="text"?"text":"pin")}function aV(i){return i?.attrs?.["atlas.geometry.surface"]||"plane"}function lf(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)]},toWorld(p,x){return[r+(x-l)/(u-l)*o,s+(c-p)/(c-f)*a]}}}var lS=[NaN,NaN,NaN,0],xI;function Tae(){return xI||(xI=Ti(1,1,void 0,{willReadFrequently:!0,desynchronized:!0})),xI}var Eae=/^rgba?\(\s*(\d+%?)\s+(\d+%?)\s+(\d+%?)(?:\s*\/\s*(\d+%|\d*\.\d+|[01]))?\s*\)$/i,Mae=/^rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)(?:\s*,\s*(\d+%|\d*\.\d+|[01]))?\s*\)$/i,Cae=/^rgba?\(\s*(\d+%)\s*,\s*(\d+%)\s*,\s*(\d+%)(?:\s*,\s*(\d+%|\d*\.\d+|[01]))?\s*\)$/i,Rae=/^#([\da-f]{3,4}|[\da-f]{6}|[\da-f]{8})$/i;function aS(i,e){return i.endsWith("%")?Number(i.substring(0,i.length-1))/e:Number(i)}function Gx(i){throw new Error('failed to parse "'+i+'" as color')}function lV(i){if(i.toLowerCase().startsWith("rgb")){let s=i.match(Mae)||i.match(Eae)||i.match(Cae);if(s){let o=s[4],a=100/255;return[xi(aS(s[1],a)+.5|0,0,255),xi(aS(s[2],a)+.5|0,0,255),xi(aS(s[3],a)+.5|0,0,255),o!==void 0?xi(aS(o,100),0,1):1]}Gx(i)}if(i.startsWith("#")){if(Rae.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}Gx(i)}let e=Tae();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&&Gx(i));let n=e.fillStyle;if(n.startsWith("#")||n.startsWith("rgba"))return lV(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]=q0(r[3]/255,3),r}function cV(i){return typeof i=="string"?i:Vx(i)}var Pae=1024,kx={},yI=0;function uV(i){if(i.length===4)return i;let e=i.slice();return e[3]=1,e}function vI(i){return i>.0031308?Math.pow(i,1/2.4)*269.025-14.025:i*3294.6}function bI(i){return i>.2068965?Math.pow(i,3):(i-4/29)*(108/841)}function wI(i){return i>10.314724?Math.pow((i+14.025)/269.025,2.4):i/3294.6}function SI(i){return i>.0088564?Math.pow(i,1/3):i/(108/841)+4/29}function TI(i){let e=wI(i[0]),t=wI(i[1]),n=wI(i[2]),r=SI(e*.222488403+t*.716873169+n*.06060791),s=500*(SI(e*.452247074+t*.399439023+n*.148375274)-r),o=200*(r-SI(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 hV(i){let e=(i[0]+16)/116,t=i[1],n=i[2]*Math.PI/180,r=bI(e),s=bI(e+t/500*Math.cos(n)),o=bI(e-t/200*Math.sin(n)),a=vI(s*3.021973625-r*1.617392459-o*.404875592),l=vI(s*-.943766287+r*1.916279586+o*.027607165),c=vI(s*.069407491-r*.22898585+o*1.159737864);return[xi(a+.5|0,0,255),xi(l+.5|0,0,255),xi(c+.5|0,0,255),i[3]]}function zx(i){if(i==="none")return lS;if(kx.hasOwnProperty(i))return kx[i];if(yI>=Pae){let t=0;for(let n in kx)(t++&3)===0&&(delete kx[n],--yI)}let e=lV(i);e.length!==4&&Gx(i);for(let t of e)isNaN(t)&&Gx(i);return kx[i]=e,++yI,e}function Yl(i){return Array.isArray(i)?i:zx(i)}function Vx(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 MI=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=EI(e,t);return n in this.cache_?this.cache_[n]:null}getPattern(e,t){let n=EI(e,t);return n in this.patternCache_?this.patternCache_[n]:null}set(e,t,n,r){let s=EI(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]=Px().createPattern(n.getImage(1),"repeat")}):this.patternCache_[s]=Px().createPattern(n.getImage(1),"repeat")),o||++this.cacheSize_}setSize(e){this.maxCacheSize_=e,this.expire()}};function EI(i,e){let t=e?Yl(e):"null";return i+":"+t}var Bo=new MI;var qx=null,cS=class extends Sd{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){qx||(qx=Ti(1,1,void 0,{willReadFrequently:!0})),qx.drawImage(this.image_,0,0);try{qx.getImageData(0,0,1,1),this.tainted_=!1}catch{qx=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=Ti(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&&hz(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=Ti(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=cV(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 Pd(i,e,t,n,r,s){let o=e===void 0?void 0:Bo.get(e,r);return o||(o=new cS(i,i&&"src"in i?i.src||void 0:e,t,n,r),Bo.set(e,r,o,s)),s&&o&&!Bo.getPattern(e,r)&&Bo.set(e,r,o,s),o}var fV=cS;function Ha(i){return i?Array.isArray(i)?Vx(i):typeof i=="object"&&"src"in i?Iae(i):i:null}function Iae(i){if(!i.offset||!i.size)return Bo.getPattern(i.src,i.color);let e=i.src+":"+i.offset,t=Bo.getPattern(e,i.color);if(t)return t;let n=Bo.get(i.src,null);if(n.getImageState()!==Mn.LOADED)return null;let r=Ti(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]),Pd(r.canvas,e,void 0,Mn.LOADED,i.color,!0),Bo.getPattern(e,i.color)}var Hx="ol-hidden";var Id="ol-unselectable";var Dg="ol-control",CI="ol-collapsed",Nae=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"),dV=["style","variant","weight","size","lineHeight","family"],uS={normal:400,bold:700},hS=function(i){let e=i.match(Nae);if(!e)return null;let t={lineHeight:"normal",size:"1.2em",style:"normal",weight:"400",variant:"normal"};for(let n=0,r=dV.length;n<r;++n){let s=e[n+1];s!==void 0&&(t[dV[n]]=typeof s=="string"?s.trim():s)}return isNaN(Number(t.weight))&&t.weight in uS&&(t.weight=uS[t.weight]),t.families=t.family.split(/,\s?/).map(n=>n.trim().replace(/^['"]|['"]$/g,"")),t};var fS="10px sans-serif",ks="#000",Pu="round",Wa=[],ja=0,Iu="round",cf=10,AV=0,Uo="#000",Nd="center",iA="middle",uf=[0,0,0,0],hf=1,nA=new bs,Wx=null,pV,RI={},Lae=new Set(["serif","sans-serif","monospace","cursive","fantasy","system-ui","ui-serif","ui-sans-serif","ui-monospace","ui-rounded","emoji","math","fangsong"]);function Dae(i,e,t){return`${i} ${e} 16px "${t}"`}var mV=(function(){let e,t;async function n(s){await t.ready;let o=hS(s),a=o.families[0].toLowerCase(),l=o.weight,c=[];return t.forEach(f=>{let p=f.family.replace(/^['"]|['"]$/g,"").toLowerCase(),x=uS[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=nA.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)?(wu(RI),nA.set(c,100)):(u+=10,nA.set(c,u,!0),u<100&&(s=!1)))}e=void 0,s||(e=setTimeout(r,100))}return async function(s){t||(t=Us?self.fonts:document.fonts);let o=hS(s);if(!o)return;let a=o.families,l=!1;for(let c of a){if(Lae.has(c))continue;let u=Dae(o.style,o.weight,c);nA.get(u)===void 0&&(nA.set(u,0,!0),l=!0)}l&&(clearTimeout(e),e=setTimeout(r,100))}})(),Fae=(function(){let i;return function(e){let t=RI[e];if(t==null){if(Us){let n=hS(e),r=gV(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);RI[e]=t}return t}})();function gV(i,e){return Wx||(Wx=Ti(1,1)),i!=pV&&(Wx.font=i,pV=Wx.font),Wx.measureText(e)}function _V(i,e){return gV(i,e).width}function PI(i,e,t){if(e in t)return t[e];let n=e.split(`55 `).reduce((r,s)=>Math.max(r,_V(i,s)),0);return t[e]=n,n}function xV(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=_V(p,f);t.push(x),o+=x;let v=Fae(p);n.push(v),l=Math.max(l,v)}return{width:s,height:a,widths:t,heights:n,lineWidths:r}}function yV(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]),Oae(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 Oae(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 II=class i{constructor(e){this.opacity_=e.opacity,this.rotateWithView_=e.rotateWithView,this.rotation_=e.rotation,this.scale_=e.scale,this.scaleArray_=jr(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 Kn()}getImage(e){return Kn()}getHitDetectionImage(){return Kn()}getPixelRatio(e){return 1}getImageState(){return Kn()}getImageSize(){return Kn()}getOrigin(){return Kn()}getSize(){return Kn()}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_=jr(e)}listenImageChange(e){Kn()}load(){Kn()}unlistenImageChange(e){Kn()}ready(){return Promise.resolve()}},dS=II;var NI=class i extends dS{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=Bo.get(n,null)?.getImage(1);if(!r){let s=this.renderOptions_,o=Math.ceil(s.size*e),a=Ti(o,o);this.draw_(s,a,e),r=a.canvas;let l=new fV(r,void 0,null,Mn.LOADED,null);Bo.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,v=t/2*(u/f),S=Math.sqrt((r+x)*(r+x)+v*v)-r;if(this.radius2_===void 0||e==="bevel")return S*2;let T=r*Math.sin(a),R=Math.sqrt(r*r-T*T),P=s-R,L=Math.sqrt(T*T+P*P)/T;if(L<=n){let D=L*t/2-s-r;return 2*Math.max(S,D)}return S*2}createRenderOptions(){let e=Pu,t=Iu,n=0,r=null,s=0,o,a=0;this.stroke_&&(o=Ha(this.stroke_.getColor()??Uo),a=this.stroke_.getWidth()??hf,r=this.stroke_.getLineDash(),s=this.stroke_.getLineDashOffset()??0,t=this.stroke_.getLineJoin()??Iu,e=this.stroke_.getLineCap()??Pu,n=this.stroke_.getMiterLimit()??cf);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=ks),t.fillStyle=Ha(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=Yl(n)),n===null?r=1:Array.isArray(n)&&(r=n.length===4?n[3]:1),r===0&&(t=Ti(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=ks,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()}},pS=NI;var LI=class i extends pS{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}},AS=LI;var DI=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=Pd(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?Ln(e):typeof e=="object"&&"src"in e?e.src+":"+e.offset:Yl(e).toString():""}loading(){return!!this.patternImage_}ready(){return this.patternImage_?this.patternImage_.ready():Promise.resolve()}},$r=DI;function vV(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 FI=class i extends dS{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;Vn(!(a!==void 0&&o),"`image` and `src` cannot be provided at the same time"),(a===void 0||a.length===0)&&o&&(a=o.src||Ln(o)),Vn(a!==void 0&&a.length>0,"A defined and non-empty `src` or `image` must be provided"),Vn(!((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?Yl(e.color):null,this.iconImage_=Pd(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(vV(x[0],x[1],e.width,e.height))};this.listenImageChange(p);return}}c!==void 0&&this.setScale(vV(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?Yl(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_=Pd(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_=Pd(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()}},rA=FI;var OI=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}},fo=OI;var mS=class i{constructor(e){e=e||{},this.geometry_=null,this.geometryFunction_=bV,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_=bV,this.geometry_=e}setZIndex(e){this.zIndex_=e}};function wV(i){let e;if(typeof i=="function")e=i;else{let t;Array.isArray(i)?t=i:(Vn(typeof i.getZIndex=="function","Expected an `Style` or an array of `Style`"),t=[i]),e=function(){return t}}return e}var BI=null;function UI(i,e){if(!BI){let t=new $r({color:"rgba(255,255,255,0.4)"}),n=new fo({color:"#3399CC",width:1.25});BI=[new mS({image:new AS({fill:t,stroke:n,radius:5}),fill:t,stroke:n})]}return BI}function bV(i){return i.getGeometry()}var ws=mS;var Bae="#333",kI=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_=jr(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 $r({color:Bae}),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 $r?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_=jr(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}},ff=kI;function Kl(i,e){return(i.get("priority")||0)-(e.get("priority")||0)}function EV(i){let e=i.get("pin");return!e||Zl(e)||e.insideHighlightedZone||Fg(e)?null:GI(e,!1)}function MV(i){let e=i.get("pin");return!e||!U.highlightedZones.size||!e.insideHighlightedZone||Zl(e)||Fg(e)?null:GI(e,!1)}function CV(i){let e=i.get("pin");return!e||Zl(e)||!U.labelsHeld?null:LV(e)}function RV(i){let e=i.get("pin");if(!e||Zl(e)||e.insideHighlightedZone||Fg(e)||$x())return null;if(U.labelsHeld)return jx(e,!1);let t=U.fitZoom+Math.log2(zV(e.category));return(U.engine.getView().getZoom()||0)<t?null:jx(e,!1)}function PV(i){let e=i.get("pin");return!e||Zl(e)||e.insideHighlightedZone||Fg(e)||!$x()?null:jx(e,!1)}function IV(i){let e=i.get("pin");return!e||!U.highlightedZones.size||!e.insideHighlightedZone||Zl(e)||Fg(e)?null:jx(e,!1)}function NV(i){let e=i.get("pin");if(!e||Zl(e))return null;if(Ru(e.category)==="text")return jx(e,e===U.selectedPin);let t=GI(e,e===U.selectedPin);return e===U.hoveredPin||e===U.selectedPin?[t,LV(e)]:t}function GI(i,e){let t=`marker:${i.category.id}:${e?1:0}`;if(U.styleCache.has(t))return U.styleCache.get(t);let n=eA(i.category),r=e?2e7:i.priority,s=U.markerIcons.get(Xx(i.category)),o;return s?o=new ws({image:new rA({src:s,width:e?36:31,height:e?36:31}),zIndex:r}):o=new ws({text:new ff({text:Dc(i.category.title),font:`900 ${e?15:13}px Inter, sans-serif`,fill:new $r({color:n}),stroke:new fo({color:J0(),width:e?4:3})}),zIndex:r}),U.styleCache.set(t,o),o}function LV(i){let e=`marker-label:${i.location.id}`;if(U.styleCache.has(e))return U.styleCache.get(e);let t=new ws({text:new ff({text:i.location.title,offsetY:21,font:'700 10px "Arial Narrow", "Roboto Condensed", sans-serif',fill:new $r({color:"#f2ece0"}),stroke:new fo({color:"rgba(0,0,0,0.98)",width:3}),backgroundFill:new $r({color:"rgba(10,12,17,0.72)"}),padding:[2,4,2,4],overflow:!0}),zIndex:i.priority});return U.styleCache.set(e,t),t}function DV(i){if(!i.iconAsset)return;let e=Xx(i);if(U.markerIcons.has(e))return;U.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=eA(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=J0(),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),U.markerIcons.set(e,n.toDataURL("image/png")),Uae(),U.layers.pins.changed(),U.layers.zonePins.changed(),U.layers.priority.changed()},t.onerror=()=>U.markerIcons.set(e,!1),t.src=eI(i.iconAsset)}function Uae(){for(let i of U.styleCache.keys())i.startsWith("marker:")&&U.styleCache.delete(i)}function Xx(i){return`${i.iconAsset||""}:${eA(i)}:${U.map?.iconOutset||"light"}`}function jx(i,e){let t=`text:${i.location.id}:${e?1:0}`;if(U.styleCache.has(t))return U.styleCache.get(t);let r=[new ws({text:new ff({text:i.location.title,font:`${e?"900":"800"} 14px "Arial Narrow", "Roboto Condensed", sans-serif`,fill:new $r({color:e?"#7fd0ea":"#f2ece0"}),stroke:new fo({color:"rgba(0,0,0,0.95)",width:4}),backgroundFill:new $r({color:e?"rgba(13,16,23,0.9)":"rgba(10,12,17,0.58)"}),backgroundStroke:e?new fo({color:"#3aa5c9",width:1}):void 0,padding:[3,6,3,6],overflow:!0}),zIndex:e?2e7:i.priority+3e6})];return U.styleCache.set(t,r),r}function gS(i,e){return`${i} ${e}px ${Li.labelFont}`}function zI(i,e){let t=i.get("gridCell");if(!t)return null;let n=t.role==="neighbor",r=n?Li.neighborLabelSizePx:Li.labelSizePx,s=gS(900,r),o=n?[2,4,2,4]:[3,5,3,5],a=kae(t,s,r,o,e),l=sS(t,{subgridVisible:U.subgridVisible,labelled:a});if(!l)return null;let c=`grid:${t.hash}:${t.role}:${t.contextDistance}:${a?1:0}:${l.bare?1:0}`;if(U.styleCache.has(c))return U.styleCache.get(c);let u=t.role==="leaf"||t.role==="scope"?100:i.get("priority"),f=[new ws({fill:l.fill?new $r({color:af(l.fill.color,l.fill.opacity)}):void 0,stroke:new fo({color:af(l.line.color,l.line.opacity),width:l.line.widthPx}),zIndex:u})];if(l.label){let p=l.label.prefix?[l.label.prefix,gS(500,r),l.label.final,gS(900,r)]:l.label.final,x=Li.labelInsetPx*e;f.push(new ws({geometry:new Lc([t.extent[2]-x,t.extent[1]+x]),text:new ff({text:p,font:gS(900,r),textAlign:"right",textBaseline:"bottom",fill:new $r({color:af(l.label.color,l.label.textAlpha)}),backgroundFill:new $r({color:l.label.chip}),padding:o,overflow:!0}),zIndex:u+1}))}return U.styleCache.set(c,f),f}function kae(i,e,t,n,r){if(!r)return!0;let s=VI(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 SV=document.createElement("canvas").getContext("2d"),TV=new Map;function VI(i,e){let t=`${e}|${i}`,n=TV.get(t);return n===void 0&&(SV.font=e,n=SV.measureText(i).width,TV.set(t,n)),n}var Gae=new ws({fill:new $r({color:"rgba(5, 8, 16, 0.62)"})});function FV(){return U.zonesVisible?Gae:null}function OV(i){if(!U.zonesVisible)return null;let e=i.get("zone"),t=i.get("child"),n=U.highlightedZones.has(e.id),r=GV(e.id),s=`zone:${e.id}:${t?1:0}:${n?1:r?2:0}`;if(U.styleCache.has(s))return U.styleCache.get(s);let o=i.get("color");if(r){let c=new ws({stroke:new fo({color:af(o,t?.34:.44),width:t?1:1.3,lineDash:t?[3,4]:[7,5]}),zIndex:t?101:100});return U.styleCache.set(s,c),c}let a=new ws({fill:new $r({color:af(o,t?.035:.07)}),stroke:new fo({color:af(o,t?.5:.72),width:t?1.2:1.8,lineDash:t?[3,4]:[7,5]})});if(!n)return U.styleCache.set(s,a),a;let l=[new ws({stroke:new fo({color:"rgba(255,255,255,0.94)",width:5}),zIndex:9e3}),new ws({fill:new $r({color:af(o,.22)}),stroke:new fo({color:o,width:2.6}),zIndex:9001})];return U.styleCache.set(s,l),l}function BV(i){if(!U.zonesVisible||$x())return null;let e=i.get("child"),t=U.highlightedZones.has(i.get("zone").id),n=U.engine.getView().getZoom()||0;if(!t&&e&&n<U.fitZoom+3)return null;let r=i.get("span")/U.engine.getView().getResolution();return!t&&U.zoneTitleCount>40&&r<52?null:kV(i)}function UV(i){return!U.zonesVisible||!$x()?null:kV(i)}function kV(i){let e=i.get("child"),t=i.get("zone"),n=U.highlightedZones.has(t.id),r=GV(t.id),s=`zone-title:${t.id}:${e?1:0}:${n?1:r?2:0}`;if(U.styleCache.has(s))return U.styleCache.get(s);let o=i.get("color"),a=new ws({text:new ff({text:t.title.toLocaleUpperCase(),font:`${e?"700 12px":"800 14px"} "Arial Narrow", "Roboto Condensed", sans-serif`,fill:new $r({color:n?"#10131a":r?"rgba(196,191,177,0.56)":e?"#c8c2b4":"#f2ece0"}),stroke:new fo({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 $r({color:n?o:r?"rgba(8,11,18,0.84)":"rgba(13,16,23,0.72)"}),backgroundStroke:new fo({color:n?"#ffffff":af(o,r?.24:.55),width:n?2:1}),padding:[5,8,5,8],overflow:!0}),zIndex:n?91e5:i.get("priority")});return U.styleCache.set(s,a),a}function GV(i){if(!U.highlightedZones.size||U.highlightedZones.has(i))return!1;for(let e of U.highlightedZones)if(zae(i,e))return!1;return!0}function zae(i,e){let t=new Set,n=U.zoneRecords.get(e)?.zone.parentRegionId;for(;n!=null&&!t.has(n);){if(n===i)return!0;t.add(n),n=U.zoneRecords.get(n)?.zone.parentRegionId}return!1}function qI(){let i=(U.map.zones||[]).filter(jI);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,_S(!0),ye.zoneIndex.hidden=i.length===0,ye.zoneCount.textContent=Fc(i.length);for(let e of i){let t=Pr(),n=[],r=!1;for(let l of e.features||[]){let c=Hae(l);c&&(r=!0,n.push(c),mw(t,c.getExtent()),U.sources.zones.addFeature(new Td({geometry:c,zone:e,color:$w(e.id),child:e.parentRegionId!=null})))}if(!r)continue;let s=$w(e.id),o=e.center?Og(e.center.lat,e.center.lng):za(t),a=Math.max(t[2]-t[0],t[3]-t[1]);U.sources.zoneTitles.addFeature(new Td({geometry:new Lc(o),zone:e,color:s,child:e.parentRegionId!=null,span:a,priority:(e.parentRegionId==null?2e6:1e6)+Math.round(a)})),U.zoneRecords.set(e.id,{zone:e,extent:t.slice(),geometries:n,color:s})}U.zoneTitleCount=U.sources.zoneTitles.getFeatures().length,qV(),Vae()}function qV(){if(U.sources.zoneScrim.clear(),!U.highlightedZones.size)return;let[i,e,t,n]=U.projection.getExtent(),r=[VV([[i,e],[t,e],[t,n],[i,n],[i,e]],!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((c,u)=>{r.push(VV(c.getCoordinates(),u>0))})}U.sources.zoneScrim.addFeature(new Td({geometry:new Cu(r)}))}function VV(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 Vae(){let i=document.createDocumentFragment();for(let{zone:e,depth:t}of qae()){let n=U.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)}ye.zoneList.replaceChildren(i),ye.zoneIndex.hidden=U.zoneRecords.size===0}function qae(){let i=[...U.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 _S(i){U.zonesVisible=i,ye.zoneToggle.checked=i,U.layers.zoneScrim.setVisible(i),U.layers.zones.setVisible(i),U.layers.zoneTitles.setVisible(i),U.layers.zoneTitleDetail.setVisible(i)}function HV(i){let e=U.zoneRecords.get(i);e&&(U.focusedZoneID=i,jV(),Oc(),U.engine.getView().fit(e.extent,{size:U.engine.getSize(),padding:[54,54,54,54],maxZoom:Eu(U.variant),duration:220}),ye.sidebar.classList.remove("is-open"),ye.mobileLegend.setAttribute("aria-expanded","false"))}function WV(i){U.zoneRecords.has(i)&&(U.highlightedZones.has(i)?U.highlightedZones.delete(i):(U.highlightedZones.add(i),_S(!0)),U.hoveredPin=null,HI(),WI(),jV(),qV(),U.layers.zones.changed(),U.layers.zoneTitles.changed(),U.layers.zoneTitleDetail.changed())}function jV(){ye.zoneIndex.classList.toggle("has-highlights",U.highlightedZones.size>0);for(let i of ye.zoneList.querySelectorAll("[data-zone]")){let e=Number(i.dataset.zone),t=U.highlightedZones.has(e);i.classList.toggle("is-highlighted",t),i.classList.toggle("is-current",U.focusedZoneID===e),i.setAttribute("aria-pressed",String(t))}}function Hae(i){if(!i?.coordinates)return null;let e=([t,n])=>Og(n,t);return i.type==="Polygon"?new Cu(i.coordinates.map(t=>t.map(e))):i.type==="MultiPolygon"?new nS(i.coordinates.map(t=>t.map(n=>n.map(e)))):null}function Og(i,e){let t=Wae(),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 Wae(){let i=U.game.tileGrid,e=U.map?.grid;return e?{...i,...e}:i}function XV(){U.sources.pins.clear(),U.sources.text.clear(),U.sources.priority.clear(),U.pins=[],U.pinByID.clear();for(let i of U.map.groups)for(let e of i.categories){Ru(e)!=="text"&&DV(e);for(let t of e.locations){let n={location:t,category:e,group:i,coordinate:Og(t.lat,t.lng),filteredHidden:!1,priority:Yae(e,t),feature:null};n.feature=new Td({geometry:new Lc(n.coordinate),pin:n,priority:n.priority}),U.pins.push(n),U.pinByID.set(t.id,n),Ru(e)==="text"?U.sources.text.addFeature(n.feature):U.sources.pins.addFeature(n.feature)}}$l()}function $l(){for(let i of U.pins){let e=U.hiddenCategories.has(i.category.id),t=U.search&&!i.location.title.toLocaleLowerCase().includes(U.search);i.filteredHidden=!!(e||t)}HI(),WI(),U.selectedPin?.filteredHidden&&Oc(),Ed(),document.dispatchEvent(new Event("atlas:filters"))}function HI(){if(!U.highlightedZones.size){for(let e of U.pins)e.insideHighlightedZone=!1;return}let i=[...U.highlightedZones].map(e=>U.zoneRecords.get(e)).filter(Boolean);for(let e of U.pins)e.insideHighlightedZone=i.some(t=>t.geometries.some(n=>jae(n,e.coordinate)))}function jae(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 WI(){U.eligibleLocations=U.pins.filter(i=>!Zl(i)).length,Tu(),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(),sA()}function Tu(){U.sources.priority.clear();for(let i of U.pins){if(Zl(i))continue;let e=!!U.search&&i.location.title.toLocaleLowerCase().includes(U.search);(i===U.selectedPin||i===U.hoveredPin||e||Rd(i))&&U.sources.priority.addFeature(i.feature)}}function Bg(i){U.hoveredPin!==i&&(U.hoveredPin=i,U.sources&&(Tu(),U.layers.pins.changed(),U.layers.priority.changed()))}function xS(i){U.labelsHeld!==i&&(U.labelsHeld=i,ye.labelsHint.textContent=i?"Z \xB7 labels shown":"Z \xB7 hold for labels",U.layers.pinLabels.changed(),U.layers.text.changed(),document.dispatchEvent(new Event("atlas:labels")))}function Fg(i){return i===U.selectedPin||i===U.hoveredPin||Rd(i)||!!U.search&&i.location.title.toLocaleLowerCase().includes(U.search)}function Zl(i){return i.filteredHidden||Xae(i)||$ae(i)||!jI(i.location)}function jI(i){let e=U.variant?.shard;return!e||!i.shard||i.shard===e}function Xae(i){return!U.highlightedZones.size||i.insideHighlightedZone||i===U.selectedPin?!1:!(U.search&&i.location.title.toLocaleLowerCase().includes(U.search))}function $ae(i){return!U.gridEnabled||!U.gridCell||Rd(i)||i===U.selectedPin?!1:!(U.search&&i.location.title.toLocaleLowerCase().includes(U.search))}function Yae(i,e){return Math.max(0,1e6-Math.min(i.locations.length,999)*1e3)+qz(e.id)%1e3}function zV(i){return i.locations.length>200?4:i.locations.length>75?2.5:1}function $x(){return(U.engine?.getView().getZoom()||0)>=(U.variant?.maxZoom||0)-.05}function $V(i){let e=[],t=[];for(let n of i){let r=[];for(let s of n.categories)(Ru(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 YV(){let i=document.createDocumentFragment();for(let e of U.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(Kae(e.key,e.title,n));let r=document.createElement("div");r.className="category-toggles";for(let s of e.categories)r.append(Zae(s));t.append(r),i.append(t)}ye.legend.replaceChildren(i),yS(),Md()}function Kae(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=Fc(t),r.append(s,o,a);let l=KV(`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 KV(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 Zae(i){let e=Ru(i)==="text",t=document.createElement("label");t.className="category-row",Ig(t,i);let n=document.createElement("input");n.type="checkbox",n.dataset.category=String(i.id),n.checked=!U.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",Ng(r,i,Dc(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=Fc(i.locations.length);let a=KV(`Show only ${i.title}`);return a.dataset.onlyCategory=String(i.id),t.append(n,r,s,a,o),t}function XI(i){if(U.collapsedSections.clear(),i)for(let e of ye.layers.querySelectorAll("[data-section]"))U.collapsedSections.add(e.dataset.section);yS()}function yS(){for(let i of ye.layers.querySelectorAll("[data-section]")){let e=U.collapsedSections.has(i.dataset.section);i.setAttribute("aria-expanded",String(!e)),i.closest(".layer-section").classList.toggle("is-collapsed",e)}Nc()}function Yx(i){if(U.hiddenCategories.clear(),!i)for(let e of U.map.groups)for(let t of e.categories)U.hiddenCategories.add(t.id);Lx(),$l(),Ed(),Md()}function Lx(){for(let i of document.querySelectorAll("[data-category]"))i.checked=!U.hiddenCategories.has(Number(i.dataset.category))}function ZV(i){let e=U.map.sections.find(n=>n.key===i);if(!e)return;let t=e.categories.some(n=>!U.hiddenCategories.has(n.id));for(let n of e.categories)t?U.hiddenCategories.add(n.id):U.hiddenCategories.delete(n.id);Lx(),$l(),Md()}function QV(i){if(U.map){if(Qae(i)){Yx(!0);return}U.hiddenCategories.clear();for(let e of U.map.sections){let t=i.section===e.key;for(let n of e.categories)!t&&i.category!==n.id&&U.hiddenCategories.add(n.id)}Lx(),$l(),Ed(),Md()}}function Qae(i){for(let e of U.map.sections)for(let t of e.categories)if((i.section===e.key||i.category===t.id)===U.hiddenCategories.has(t.id))return!1;return!0}function Jae(){let i=ye.soloChip;if(!U.map){i.hidden=!0;return}let e=null,t=0,n=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++,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 Md(){if(U.map){for(let i of U.map.sections){let e=ye.legend.querySelector(`input[data-section-toggle="${i.key}"]`);e&&(e.checked=i.categories.some(t=>!U.hiddenCategories.has(t.id)))}Jae(),Nc()}}async function JV(i){let[e,t]=await Promise.all([fetch(`${U.game.base}/maps/${i.slug}.json`),fetch(`${U.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 ele(r,s),{...i,grid:n.grid,variants:n.variants,groups:n.groups,zones:n.zones||[],attrs:n.attrs||{},merged:n.merged||[],sections:$V(n.groups)}}function ele(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),v=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(v.subarray(p[S],p[S+1])),lat:l[S],lng:c[S],regionId:u[S]||void 0,shard:f[S]||void 0})}async function jz(){let i=`${U.game.base}/${U.map.slug}`;return U.textByMap.has(i)||U.textByMap.set(i,fetch(`${U.game.base}/maps/${U.map.slug}.text`).then(e=>e.json()).catch(()=>({}))),U.textByMap.get(i)}var vS=null;function oA(){return vS||(vS=tle().finally(()=>{vS=null})),vS}async function tle(){let i=await fetch("/data/catalog.json");if(!i.ok)return;let e=U.game;if(U.catalog=await i.json(),B0(ye.game,U.catalog.games,"title"),$I(),!U.catalog.games.length)return;let t=e&&U.catalog.games.find(n=>n.slug===e.slug);if(!t){let n=Pg();await df(n.game||Rg()?.game||U.catalog.games[0].slug,n.game?n.map:void 0);return}if(t.stamp!==e.stamp){for(let r of U.textByMap.keys())r.startsWith(e.base+"/")&&U.textByMap.delete(r);let n=U.engine?.getView();U.restore={game:t.slug,map:U.map?.slug,variant:U.map?U.map.variants.indexOf(U.variant):0,center:n?.getCenter(),zoom:n?.getZoom(),hidden:[...U.hiddenCategories],collapsed:[...U.collapsedSections],overviewDocked:U.overviewDocked,dockFolded:U.dockFolded,dockDismissed:U.dockDismissed},await df(t.slug,U.map?.slug);return}U.game=t,ye.game.value=t.slug}function $I(){let i=!U.catalog?.games?.length;ye.emptyState.hidden=!i,U.catalog?.bundlesDir&&(ye.emptyPath.textContent=U.catalog.bundlesDir)}async function YI(){for(let i of[ye.emptyOpen,ye.addBundles])i.disabled=!0;try{let e=await(await fetch("/data/bundles/import",{method:"POST"})).json().catch(()=>({}));await oA();let t=e.imported?.[0];t&&U.catalog.games.some(n=>n.slug===t)&&await df(t)}finally{for(let i of[ye.emptyOpen,ye.addBundles])i.disabled=!1}}var Qs={ADD:"add",REMOVE:"remove"};var eq={LENGTH:"length"},Ug=class extends Ks{constructor(e,t,n){super(e),this.element=t,this.index=n}},KI=class extends bs{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(eq.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 Ug(Qs.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 Ug(Qs.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 Ug(Qs.REMOVE,r,e)),this.dispatchEvent(new Ug(Qs.ADD,t,e))}updateLength_(){this.set(eq.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")}},po=KI;var ZI=class extends Ks{constructor(e,t,n){super(e),this.map=t,this.frameState=n!==void 0?n:null}},Ld=ZI;var QI=class extends Ld{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()}},Nu=QI;var rr={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 Kx={POINTERMOVE:"pointermove",POINTERDOWN:"pointerdown",POINTERUP:"pointerup",POINTEROVER:"pointerover",POINTEROUT:"pointerout",POINTERENTER:"pointerenter",POINTERLEAVE:"pointerleave",POINTERCANCEL:"pointercancel"};var JI=class extends Sd{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_=kn(n,Kx.POINTERDOWN,this.handlePointerDown_,this),this.originalPointerMoveEvent_,this.relayedListenerKey_=kn(n,Kx.POINTERMOVE,this.relayMoveEvent_,this),this.boundHandleTouchMove_=this.handleTouchMove_.bind(this),this.element_.addEventListener(Jt.TOUCHMOVE,this.boundHandleTouchMove_,Ow?{passive:!1}:!1)}emulateClick_(e){let t=new Nu(rr.CLICK,this.map_,e);this.dispatchEvent(t),this.clickTimeoutId_!==void 0?(clearTimeout(this.clickTimeoutId_),this.clickTimeoutId_=void 0,t=new Nu(rr.DBLCLICK,this.map_,e),this.dispatchEvent(t)):this.clickTimeoutId_=setTimeout(()=>{this.clickTimeoutId_=void 0;let n=new Nu(rr.SINGLECLICK,this.map_,e);this.dispatchEvent(n)},250)}updateActivePointers_(e){let t=e,n=t.pointerId;if(t.type==rr.POINTERUP||t.type==rr.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==rr.POINTERDOWN||t.type==rr.POINTERMOVE)&&(this.trackedTouches_[n]=t);this.activePointers_=Object.values(this.trackedTouches_)}handlePointerUp_(e){this.updateActivePointers_(e);let t=new Nu(rr.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(ri),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 Nu(rr.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(kn(n,rr.POINTERMOVE,this.handlePointerMove_,this),kn(n,rr.POINTERUP,this.handlePointerUp_,this),kn(this.element_,rr.POINTERCANCEL,this.handlePointerUp_,this)),this.element_.getRootNode&&this.element_.getRootNode()!==n&&this.dragListenerKeys_.push(kn(this.element_.getRootNode(),rr.POINTERUP,this.handlePointerUp_,this))}}handlePointerMove_(e){if(this.isMoving_(e)){this.updateActivePointers_(e),this.dragging_=!0;let t=new Nu(rr.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 Nu(rr.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_&&(ri(this.relayedListenerKey_),this.relayedListenerKey_=null),this.element_.removeEventListener(Jt.TOUCHMOVE,this.boundHandleTouchMove_),this.pointerdownListenerKey_&&(ri(this.pointerdownListenerKey_),this.pointerdownListenerKey_=null),this.dragListenerKeys_.forEach(ri),this.dragListenerKeys_.length=0,this.element_=null,super.disposeInternal()}},tq=JI;var Lu={POSTRENDER:"postrender",MOVESTART:"movestart",MOVEEND:"moveend",LOADSTART:"loadstart",LOADEND:"loadend"};var Ao={LAYERGROUP:"layergroup",SIZE:"size",TARGET:"target",VIEW:"view"};var Zx=1/0,e5=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,wu(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){Vn(!(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!=Zx?(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==Zx?delete this.queuedElements_[this.keyFunction_(o)]:(n[r]=l,t[r++]=o);t.length=r,n.length=r,this.heapify_()}},nq=e5;var t5=class extends nq{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())}}},iq=t5;function rq(i,e,t,n,r){if(!i||!(t in i.wantedTiles))return Zx;if(!i.wantedTiles[t][e.getKey()])return Zx;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 Gs={ANIMATING:0,INTERACTING:1};var Ql={CENTER:"center",RESOLUTION:"resolution",ROTATION:"rotation"};function n5(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,v=i[1]+c/2+f,w=i[3]-c/2+f;p>x&&(p=(x+p)/2,x=p),v>w&&(v=(w+v)/2,w=v);let S=xi(n[0],p,x),T=xi(n[1],v,w);if(o&&t&&r){let R=30*r;S+=-R*Math.log(1+Math.max(0,p-n[0])/R)+R*Math.log(1+Math.max(0,n[0]-x)/R),T+=-R*Math.log(1+Math.max(0,v-n[1])/R)+R*Math.log(1+Math.max(0,n[1]-w)/R)}return[S,T]})}function sq(i){return i}function i5(i,e,t,n){let r=jn(e)/t[0],s=xr(e)/t[1];return n?Math.min(i,Math.max(r,s)):Math.min(i,Math.min(r,s))}function r5(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),xi(n,t/2,e*2)}function oq(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?i5(l,t,o,n):l;if(a)return e?r5(r,u,c):xi(r,c,u);let f=Math.min(u,r),p=Math.floor(bg(i,f,s));return i[p]>u&&p<i.length-1?i[p+1]:i[p]}})}function aq(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?i5(e,r,l,s):e;if(c)return n?r5(o,u,t):xi(o,t,u);let f=1e-9,p=Math.ceil(Math.log(e/u)/Math.log(i)-f),x=-a*(.5-f)+.5,v=Math.min(u,o),w=Math.floor(Math.log(e/v)/Math.log(i)+x),S=Math.max(p,w),T=e/Math.pow(i,S);return xi(T,t,u)}})}function s5(i,e,t,n,r){return t=t!==void 0?t:!0,(function(s,o,a,l){if(s!==void 0){let c=n?i5(i,n,a,r):i;return!t||!l?xi(s,e,c):r5(s,c,e)}})}function kg(i){if(i!==void 0)return 0}function o5(i){if(i!==void 0)return i}function lq(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 cq(i){let e=i===void 0?Tc(5):i;return(function(t,n){return n||t===void 0?t:Math.abs(t)<=e?0:t})}var a5=0,c5=class extends bs{constructor(e){super(),this.on,this.once,this.un,e=Object.assign({},e),this.hints_=[0,0],this.animations_=[],this.updateAnimationKey_,this.projection_=Rw(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&&VG(),e.center&&(e.center=Cc(e.center,this.projection_)),e.extent&&(e.extent=Rc(e.extent,this.projection_)),this.applyOptions_(e)}applyOptions_(e){let t=Object.assign({},e);for(let a in Ql)delete t[a];this.setProperties(t,!0);let n=ile(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=nle(e),s=n.constraint,o=rle(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=Cc(r.center,this.getProjection())),r.anchor&&(r=Object.assign({},r),r.anchor=Cc(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&&bS(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||fz,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=bu(u.rotation-l+Math.PI,2*Math.PI)-Math.PI;f.targetRotation=l+p,l=f.targetRotation}sle(f)?f.complete=!0:s+=f.duration,c.push(f)}this.animations_.push(c),this.setHint(Gs.ANIMATING,1),this.updateAnimations_()}getAnimating(){return this.hints_[Gs.ANIMATING]>0}getInteracting(){return this.hints_[Gs.INTERACTING]>0}cancelAnimations(){this.setHint(Gs.ANIMATING,-this.hints_[Gs.ANIMATING]);let e;for(let t=0,n=this.animations_.length;t<n;++t){let r=this.animations_[t];if(r[0].callback&&bS(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],v=l.targetCenter[0],w=l.targetCenter[1];this.nextCenter_=l.targetCenter;let S=p+f*(v-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()),v=this.constraints_.resolution(p,0,x,!0);this.targetCenter_=this.calculateCenterZoom(v,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?bu(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(Gs.ANIMATING,-1),this.nextCenter_=null,this.nextResolution_=NaN,this.nextRotation_=NaN;let o=r[0].callback;o&&bS(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]],Ag(n,e-this.getRotation()),vG(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&&Mx(e,this.getProjection())}getCenterInternal(){return this.get(Ql.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 yd(t,this.getProjection())}calculateExtentInternal(e){e=e||this.getViewportSizeMinusPadding_();let t=this.getCenterInternal();Vn(t,"The view center is not defined");let n=this.getResolution();Vn(n!==void 0,"The view resolution is not defined");let r=this.getRotation();return Vn(r!==void 0,"The view rotation is not defined"),wx(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(Ql.RESOLUTION)}getResolutions(){return this.resolutions_}getResolutionForExtent(e,t){return this.getResolutionForExtentInternal(Rc(e,this.getProjection()),t)}getResolutionForExtentInternal(e,t){t=t||this.getViewportSizeMinusPadding_();let n=jn(e)/t[0],r=xr(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(Ql.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=l5(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=bg(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=xi(Math.floor(e),0,this.resolutions_.length-2),n=this.resolutions_[t]/this.resolutions_[t+1];return this.resolutions_[t]/Math.pow(n,xi(e-t,0,1))}return this.maxResolution_/Math.pow(this.zoomFactor_,e-this.minZoom_)}fit(e,t){let n;if(Vn(Array.isArray(e)||typeof e.getSimplifiedGeometry=="function","Invalid extent or geometry provided as `geometry`"),Array.isArray(e)){Vn(!vu(e),"Cannot fit empty extent provided as `geometry`");let r=Rc(e,this.getProjection());n=AI(r)}else if(e.getType()==="Circle"){let r=Rc(e.getExtent(),this.getProjection());n=AI(r),n.rotate(this.getRotation(),za(r))}else{let r=$0();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,v=s[f]*r+s[f+1]*n;a=Math.min(a,x),l=Math.min(l,v),c=Math.max(c,x),u=Math.max(u,v)}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=za(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,v=p[1]*f+p[0]*u,w=this.getConstrainedCenter([x,v],l),S=t.callback?t.callback:of;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),bS(S,!0))}centerOn(e,t,n){this.centerOnInternal(Cc(e,this.getProjection()),t,n)}centerOnInternal(e,t,n){this.setCenterInternal(l5(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=l5(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=Mx(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&&Cc(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=Cc(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&&Cc(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(Ql.ROTATION)!==r&&this.set(Ql.ROTATION,r),this.get(Ql.RESOLUTION)!==o&&(this.set(Ql.RESOLUTION,o),this.set("zoom",this.getZoom(),!0)),(!a||!this.get(Ql.CENTER)||!H0(this.get(Ql.CENTER),a))&&this.set(Ql.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()||!H0(this.getCenterInternal(),l))&&(this.getAnimating()&&this.cancelAnimations(),this.animateInternal({rotation:s,center:l,resolution:a,duration:e,easing:Xl,anchor:n}))}beginInteraction(){this.resolveConstraints(0),this.setHint(Gs.INTERACTING,1)}endInteraction(e,t,n){n=n&&Cc(n,this.getProjection()),this.endInteractionInternal(e,t,n)}endInteractionInternal(e,t,n){this.getInteracting()&&(this.setHint(Gs.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 bS(i,e){setTimeout(function(){i(e)},0)}function nle(i){if(i.extent!==void 0){let t=i.smoothExtentConstraint!==void 0?i.smoothExtentConstraint:!0;return n5(i.extent,i.constrainOnlyCenter,t)}let e=Rw(i.projection,"EPSG:3857");if(i.multiWorld!==!0&&e.isGlobal()){let t=e.getExtent().slice();return t[0]=-1/0,t[2]=1/0,n5(t,!1,!1)}return sq}function ile(i){let e,t,n,o=i.minZoom!==void 0?i.minZoom:a5,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=Rw(i.projection,"EPSG:3857"),x=p.getExtent(),v=i.constrainOnlyCenter,w=i.extent;if(!c&&!w&&p.isGlobal()&&(v=!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=oq(S,u,!v&&w,f):e=s5(t,n,u,!v&&w,f)}else{let T=(x?Math.max(jn(x),xr(x)):360*tf.degrees/p.getMetersPerUnit())/256/Math.pow(2,a5),R=T/Math.pow(2,28-a5);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=R),a=o+Math.floor(Math.log(t/n)/Math.log(l)),n=t/Math.pow(l,a-o),i.constrainResolution?e=aq(l,t,n,u,!v&&w,f):e=s5(t,n,u,!v&&w,f)}return{constraint:e,maxResolution:t,minResolution:n,minZoom:o,zoomFactor:l}}function rle(i){if(i.enableRotation!==void 0?i.enableRotation:!0){let t=i.constrainRotation;return t===void 0||t===!0?cq():t===!1?o5:typeof t=="number"?lq(t):o5}return kg}function sle(i){return!(i.sourceCenter&&i.targetCenter&&!H0(i.sourceCenter,i.targetCenter)||i.sourceResolution!==i.targetResolution||i.sourceRotation!==i.targetRotation)}function l5(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 Al=c5;var u5=class extends bs{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)ri(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!==of&&this.listenerKeys.push(kn(e,Lu.POSTRENDER,this.render,this)),e.render()}}render(e){}setTarget(e){this.target_=typeof e=="string"?document.getElementById(e):e}},Gg=u5;var h5=class extends Gg{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+" "+Id+" "+Dg+(this.collapsed_&&this.collapsible_?" "+CI:"")+(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=>az(()=>r))),n=t.length>0;if(this.renderedVisible_!=n&&(this.element.style.display=n?"":"none",this.renderedVisible_=n),!Oo(t,this.renderedAttributions_)){pz(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(CI),this.collapsed_?BP(this.collapseLabel_,this.label_):BP(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)}},uq=h5;var f5=class extends Gg{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+" "+Id+" "+Dg,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(Hx)}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:Xl}):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(Hx);!s&&n===0?this.element.classList.add(Hx):s&&n!==0&&this.element.classList.remove(Hx)}this.label_.style.transform=r}this.rotation_=n}},hq=f5;var d5=class extends Gg{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+" "+Id+" "+Dg,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:Xl})):n.setZoom(s)}}},fq=d5;function wS(i){i=i||{};let e=new po;return(i.zoom===void 0||i.zoom)&&e.push(new fq(i.zoomOptions)),(i.rotate===void 0||i.rotate)&&e.push(new hq(i.rotateOptions)),(i.attribution===void 0||i.attribution)&&e.push(new uq(i.attributionOptions)),e}var p5=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_}},dq=p5;var A5={ACTIVE:"active"};var m5=class extends bs{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(A5.ACTIVE)}getMap(){return this.map_}handleEvent(e){return!0}setActive(e){this.set(A5.ACTIVE,e)}setMap(e){this.map_=e}};function pq(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:dz,center:i.getConstrainedCenter(r)})}}function zg(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:Xl})}var Du=m5;var g5=class extends Du{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==rr.DBLCLICK){let n=e.originalEvent,r=e.map,s=e.coordinate,o=n.shiftKey?-this.delta_:this.delta_,a=r.getView();zg(a,o,s,this.duration_),n.preventDefault(),t=!0}return!t}},Aq=g5;function Qx(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 mq=function(i){let e=i.originalEvent;return e.altKey&&!(e.metaKey||e.ctrlKey)&&e.shiftKey},ole=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)},SS=function(i){let e=i.map.getTargetElement(),t=e.getRootNode();return(t instanceof ShadowRoot?t.host:e).hasAttribute("tabindex")?ole(i):!0},gq=rf;var TS=function(i){let e=i.originalEvent;return"pointerId"in e&&e.button==0&&!(lz&&NP&&e.ctrlKey)};var ES=function(i){let e=i.originalEvent;return!e.altKey&&!(e.metaKey||e.ctrlKey)&&!e.shiftKey};var _q=function(i){let e=i.originalEvent;return NP?e.metaKey:e.ctrlKey},xq=function(i){let e=i.originalEvent;return!e.altKey&&!(e.metaKey||e.ctrlKey)&&e.shiftKey},MS=function(i){let e=i.originalEvent,t=e.target.tagName;return t!=="INPUT"&&t!=="SELECT"&&t!=="TEXTAREA"&&!e.target.isContentEditable},CS=function(i){let e=i.originalEvent;return"pointerId"in e&&e.pointerType=="mouse"};var yq=function(i){let e=i.originalEvent;return"pointerId"in e&&e.isPrimary&&e.button===0};var _5=class extends Du{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==rr.POINTERDRAG)this.handleDragEvent(e),e.originalEvent.preventDefault();else if(e.type==rr.POINTERUP){let n=this.handleUpEvent(e);this.handlingDownUpSequence=n&&this.targetPointers.length>0}}else if(e.type==rr.POINTERDOWN){let n=this.handleDownEvent(e);this.handlingDownUpSequence=n,t=this.stopDown(n)}else e.type==rr.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 Vg(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 Fu=_5;var x5=class extends Fu{constructor(e){super({stopDown:sf}),e=e||{},this.kinetic_=e.kinetic,this.lastCentroid=null,this.lastPointersCount_,this.panning_=!1;let t=e.condition?e.condition:Qx(ES,yq);this.condition_=e.onFocusOnly?Qx(SS,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(Vg(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();bG(s,a.getResolution()),Ag(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:Xl})}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}},vq=x5;var y5=class extends Fu{constructor(e){e=e||{},super({stopDown:sf}),this.condition_=e.condition?e.condition:mq,this.lastAngle_=void 0,this.duration_=e.duration!==void 0?e.duration:250}handleDragEvent(e){if(!CS(e))return;let t=e.map,n=t.getView();if(n.getConstraints().rotation===kg)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 CS(e)?(e.map.getView().endInteraction(this.duration_),!1):!0}handleDownEvent(e){return CS(e)&&TS(e)&&this.condition_(e)?(e.map.getView().beginInteraction(),this.lastAngle_=void 0,!0):!1}},bq=y5;var v5=class extends wd{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 Cu([r])}getGeometry(){return this.geometry_}},wq=v5;var qg={BOXSTART:"boxstart",BOXDRAG:"boxdrag",BOXEND:"boxend",BOXCANCEL:"boxcancel"},aA=class extends Ks{constructor(e,t,n){super(e),this.coordinate=t,this.mapBrowserEvent=n}},b5=class extends Fu{constructor(e){super(),this.on,this.once,this.un,e=e??{},this.box_=new wq(e.className||"ol-dragbox"),this.minArea_=e.minArea??64,e.onBoxEnd&&(this.onBoxEnd=e.onBoxEnd),this.startPixel_=null,this.condition_=e.condition??TS,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 aA(qg.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 aA(t?qg.BOXEND:qg.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 aA(qg.BOXSTART,e.coordinate,e)),!0):!1}onBoxEnd(e){}setActive(e){e||(this.box_.setMap(null),this.startPixel_&&(this.dispatchEvent(new aA(qg.BOXCANCEL,this.startPixel_,null)),this.startPixel_=null)),super.setActive(e)}setMap(e){this.getMap()&&(this.box_.setMap(null),this.startPixel_&&(this.dispatchEvent(new aA(qg.BOXCANCEL,this.startPixel_,null)),this.startPixel_=null)),super.setMap(e)}},Sq=b5;var w5=class extends Sq{constructor(e){e=e||{};let t=e.condition?e.condition:xq;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:Xl})}},Tq=w5;var Dd={LEFT:"ArrowLeft",UP:"ArrowUp",RIGHT:"ArrowRight",DOWN:"ArrowDown"};var S5=class extends Du{constructor(e){super(),e=e||{},this.defaultCondition_=function(t){return ES(t)&&MS(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==Dd.DOWN||r==Dd.LEFT||r==Dd.RIGHT||r==Dd.UP)){let o=e.map.getView(),a=o.getResolution()*this.pixelDelta_,l=0,c=0;r==Dd.DOWN?c=-a:r==Dd.LEFT?l=-a:r==Dd.RIGHT?l=a:c=a;let u=[l,c];Ag(u,o.getRotation()),pq(o,u,this.duration_),n.preventDefault(),t=!0}}return!t}},Eq=S5;var T5=class extends Du{constructor(e){super(),e=e||{},this.condition_=e.condition?e.condition:function(t){return!_q(t)&&MS(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();zg(a,o,void 0,this.duration_),n.preventDefault(),t=!0}}return!t}},Mq=T5;var ale=40,lle=300,cle=3,E5=class extends Du{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:gq;this.condition_=e.onFocusOnly?Qx(SS,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(ri),this.ctrlKeyListenerKeys_.length=0,this.ctrlKeyPressed_=!1,super.setMap(e),e){let t=e.getOwnerDocument();this.ctrlKeyListenerKeys_.push(kn(t,"keydown",n=>{n.key==="Control"&&(this.ctrlKeyPressed_=!0)}),kn(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*=ale;break;case WheelEvent.DOM_DELTA_PAGE:o*=lle;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*cle),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=-xi(this.totalDelta_,-this.maxDelta_*this.deltaPerZoom_,this.maxDelta_*this.deltaPerZoom_)/this.deltaPerZoom_;(t.getConstrainResolution()||this.constrainResolution_)&&(n=n?n>0?1:-1:0),zg(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)}},Cq=E5;var M5=class extends Fu{constructor(e){e=e||{};let t=e;t.stopDown||(t.stopDown=sf),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!==kg&&(this.anchor_=o.getCoordinateFromPixelInternal(o.getEventPixel(Vg(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}},Rq=M5;var C5=class extends Fu{constructor(e){e=e||{};let t=e;t.stopDown||(t.stopDown=sf),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(Vg(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}},Pq=C5;function RS(i){i=i||{};let e=new po,t=new dq(-.005,.05,100);return(i.altShiftDragRotate===void 0||i.altShiftDragRotate)&&e.push(new bq),(i.doubleClickZoom===void 0||i.doubleClickZoom)&&e.push(new Aq({delta:i.zoomDelta,duration:i.zoomDuration})),(i.dragPan===void 0||i.dragPan)&&e.push(new vq({onFocusOnly:i.onFocusOnly,kinetic:t})),(i.pinchRotate===void 0||i.pinchRotate)&&e.push(new Rq),(i.pinchZoom===void 0||i.pinchZoom)&&e.push(new Pq({duration:i.zoomDuration})),(i.keyboard===void 0||i.keyboard)&&(e.push(new Eq),e.push(new Mq({delta:i.zoomDelta,duration:i.zoomDuration}))),(i.mouseWheelZoom===void 0||i.mouseWheelZoom)&&e.push(new Cq({onFocusOnly:i.onFocusOnly,duration:i.zoomDuration})),(i.shiftDragZoom===void 0||i.shiftDragZoom)&&e.push(new Tq({duration:i.zoomDuration})),e}var Ei={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 R5=class extends bs{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[Ei.OPACITY]=e.opacity!==void 0?e.opacity:1,Vn(typeof t[Ei.OPACITY]=="number","Layer opacity must be a number"),t[Ei.VISIBLE]=e.visible!==void 0?e.visible:!0,t[Ei.Z_INDEX]=e.zIndex,t[Ei.MAX_RESOLUTION]=e.maxResolution!==void 0?e.maxResolution:1/0,t[Ei.MIN_RESOLUTION]=e.minResolution!==void 0?e.minResolution:0,t[Ei.MIN_ZOOM]=e.minZoom!==void 0?e.minZoom:-1/0,t[Ei.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=xi(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 Kn()}getLayerStatesArray(e){return Kn()}getExtent(){return this.get(Ei.EXTENT)}getMaxResolution(){return this.get(Ei.MAX_RESOLUTION)}getMinResolution(){return this.get(Ei.MIN_RESOLUTION)}getMinZoom(){return this.get(Ei.MIN_ZOOM)}getMaxZoom(){return this.get(Ei.MAX_ZOOM)}getOpacity(){return this.get(Ei.OPACITY)}getSourceState(){return Kn()}getVisible(){return this.get(Ei.VISIBLE)}getZIndex(){return this.get(Ei.Z_INDEX)}setBackground(e){this.background_=e,this.changed()}setExtent(e){this.set(Ei.EXTENT,e)}setMaxResolution(e){this.set(Ei.MAX_RESOLUTION,e)}setMinResolution(e){this.set(Ei.MIN_RESOLUTION,e)}setMaxZoom(e){this.set(Ei.MAX_ZOOM,e)}setMinZoom(e){this.set(Ei.MIN_ZOOM,e)}setOpacity(e){Vn(typeof e=="number","Layer opacity must be a number"),this.set(Ei.OPACITY,e)}setVisible(e){this.set(Ei.VISIBLE,e)}setZIndex(e){this.set(Ei.Z_INDEX,e)}disposeInternal(){this.state_&&(this.state_.layer=null,this.state_=null),super.disposeInternal()}},PS=R5;var Fd={ADDLAYER:"addlayer",REMOVELAYER:"removelayer"},Bc=class extends Ks{constructor(e,t){super(e),this.layer=t}},P5={LAYERS:"layers"},I5=class i extends PS{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(P5.LAYERS,this.handleLayersChanged_),n?Array.isArray(n)?n=new po(n.slice(),{unique:!0}):Vn(typeof n.getArray=="function","Expected `layers` to be an array or a `Collection`"):n=new po(void 0,{unique:!0}),this.setLayers(n)}handleLayerChange_(){this.changed()}handleLayersChanged_(){this.layersListenerKeys_.forEach(ri),this.layersListenerKeys_.length=0;let e=this.getLayers();this.layersListenerKeys_.push(kn(e,Qs.ADD,this.handleLayersAdd_,this),kn(e,Qs.REMOVE,this.handleLayersRemove_,this));for(let n in this.listenerKeys_)this.listenerKeys_[n].forEach(ri);wu(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 Bc(Fd.ADDLAYER,s))}this.changed()}registerLayerListeners_(e){let t=[kn(e,Ic.PROPERTYCHANGE,this.handleLayerChange_,this),kn(e,Jt.CHANGE,this.handleLayerChange_,this)];e instanceof i&&t.push(kn(e,Fd.ADDLAYER,this.handleLayerGroupAdd_,this),kn(e,Fd.REMOVELAYER,this.handleLayerGroupRemove_,this)),this.listenerKeys_[Ln(e)]=t}handleLayerGroupAdd_(e){this.dispatchEvent(new Bc(Fd.ADDLAYER,e.layer))}handleLayerGroupRemove_(e){this.dispatchEvent(new Bc(Fd.REMOVELAYER,e.layer))}handleLayersAdd_(e){let t=e.element;this.registerLayerListeners_(t),this.dispatchEvent(new Bc(Fd.ADDLAYER,t)),this.changed()}handleLayersRemove_(e){let t=e.element,n=Ln(t);this.listenerKeys_[n].forEach(ri),delete this.listenerKeys_[n],this.dispatchEvent(new Bc(Fd.REMOVELAYER,t)),this.changed()}getLayers(){return this.get(P5.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 Bc(Fd.REMOVELAYER,n[r]))}this.set(P5.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=yu(l.extent,r.extent):l.extent=r.extent),l.zIndex===void 0&&(l.zIndex=s)}return t}getSourceState(){return"ready"}},Jx=I5;var mo={PRERENDER:"prerender",POSTRENDER:"postrender",PRECOMPOSE:"precompose",POSTCOMPOSE:"postcompose",RENDERCOMPLETE:"rendercomplete"};var N5=class extends PS{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(Ei.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(Ei.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_&&(ri(this.sourceChangeKey_),this.sourceChangeKey_=null),this.sourceReady_=!1;let e=this.getSource();e&&(this.sourceChangeKey_=kn(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 Al?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 ey(r,t.viewState)&&(!s||yr(s,t.extent))}getAttributions(e){if(!this.isVisible(e))return[];let t=this.getSource()?.getAttributions();if(!t)return[];let n=e instanceof Al?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(Ei.MAP,e)}getMapInternal(){return this.get(Ei.MAP)}setMap(e){this.mapPrecomposeKey_&&(ri(this.mapPrecomposeKey_),this.mapPrecomposeKey_=null),e||this.changed(),this.mapRenderKey_&&(ri(this.mapRenderKey_),this.mapRenderKey_=null),e&&(this.mapPrecomposeKey_=kn(e,mo.PRECOMPOSE,this.handlePrecompose_,this),this.mapRenderKey_=kn(this,Jt.CHANGE,e.render,e),this.changed())}handlePrecompose_(e){let t=e.frameState.layerStatesArray,n=this.getLayerState(!1);Vn(!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(Ei.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 ey(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 lA=N5;function IS(i,e,t=0,n=i.length-1,r=ule){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)),v=Math.min(n,Math.floor(e+(l-c)*f/l+p));IS(i,e,x,v,r)}let s=i[e],o=t,a=n;for(ty(i,t,e),r(i[n],s)>0&&ty(i,t,n);o<a;){for(ty(i,o,a),o++,a--;r(i[o],s)<0;)o++;for(;r(i[a],s)>0;)a--}r(i[t],s)===0?ty(i,t,a):(a++,ty(i,a,n)),a<=e&&(t=a+1),e<=a&&(n=a-1)}}function ty(i,e,t){let n=i[e];i[e]=i[t],i[t]=n}function ule(i,e){return i<e?-1:i>e?1:0}var cA=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(!LS(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;LS(e,l)&&(t.leaf?n.push(a):D5(e,l)?this._all(a,n):s.push(a))}t=s.pop()}return n}collides(e){let t=this.data;if(!LS(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(LS(e,o)){if(t.leaf||D5(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=Wg([]),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=hle(e,n.children,t);if(u!==-1)return n.children.splice(u,1),s.push(n),this._condense(s),this}!c&&!n.leaf&&D5(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=Wg(e.slice(t,n+1)),Hg(a,this.toBBox),a;r||(r=Math.ceil(Math.log(s)/Math.log(o)),o=Math.ceil(s/Math.pow(o,r-1))),a=Wg([]),a.leaf=!1,a.height=r;let l=Math.ceil(s/o),c=l*Math.ceil(Math.sqrt(o));Iq(e,t,n,c,this.compareMinX);for(let u=t;u<=n;u+=c){let f=Math.min(u+c-1,n);Iq(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 Hg(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=L5(c),f=ple(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),iy(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=Wg(n.children.splice(o,n.children.length-o));a.height=n.height,a.leaf=n.leaf,Hg(n,this.toBBox),Hg(a,this.toBBox),t?e[t-1].children.push(a):this._splitRoot(n,a)}_splitRoot(e,t){this.data=Wg([e,t]),this.data.height=e.height+1,this.data.leaf=!1,Hg(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=ny(e,0,a,this.toBBox),c=ny(e,a,n,this.toBBox),u=Ale(l,c),f=L5(l)+L5(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:fle,s=e.leaf?this.compareMinY:dle,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=ny(e,0,t,s),a=ny(e,n-t,n,s),l=NS(o)+NS(a);for(let c=t;c<n-t;c++){let u=e.children[c];iy(o,e.leaf?s(u):u),l+=NS(o)}for(let c=n-t-1;c>=t;c--){let u=e.children[c];iy(a,e.leaf?s(u):u),l+=NS(a)}return l}_adjustParentBBoxes(e,t,n){for(let r=n;r>=0;r--)iy(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():Hg(e[t],this.toBBox)}};function hle(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 Hg(i,e){ny(i,0,i.children.length,e,i)}function ny(i,e,t,n,r){r||(r=Wg(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];iy(r,i.leaf?n(o):o)}return r}function iy(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 fle(i,e){return i.minX-e.minX}function dle(i,e){return i.minY-e.minY}function L5(i){return(i.maxX-i.minX)*(i.maxY-i.minY)}function NS(i){return i.maxX-i.minX+(i.maxY-i.minY)}function ple(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 Ale(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 D5(i,e){return i.minX<=e.minX&&i.minY<=e.minY&&e.maxX<=i.maxX&&e.maxY<=i.maxY}function LS(i,e){return e.minX<=i.maxX&&e.minY<=i.maxY&&e.maxX>=i.minX&&e.maxY>=i.minY}function Wg(i){return{children:i,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function Iq(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;IS(i,o,e,t,r),s.push(e,o,o,t)}}var hA=0,FS=0,ko=1<<hA++,si=1<<hA++,Go=1<<hA++,ca=1<<hA++,Af=1<<hA++,uA=1<<hA++,OS=Math.pow(2,hA)-1,O5={[ko]:"boolean",[si]:"number",[Go]:"string",[ca]:"color",[Af]:"number[]",[uA]:"size"},mle=Object.keys(O5).map(Number).sort(Va);function gle(i){return i in O5}function pf(i){let e=[];for(let t of mle)ry(i,t)&&e.push(O5[t]);return e.length===0?"untyped":e.length<3?e.join(" or "):e.slice(0,-1).join(", ")+", or "+e[e.length-1]}function ry(i,e){return(i&e)===e}function DS(i,e){return!!(i&e)}function Od(i,e){return i===e}var Nr=class{constructor(e,t){if(!gle(e))throw new Error(`literal expressions must have a specific type, got ${pf(e)}`);this.type=e,this.value=t}},BS=class{constructor(e,t,...n){this.type=e,this.operator=t,this.args=n}};function US(i){return{variables:new Map,properties:new Map,featureId:!1,geometryType:!1,mCoordinate:!1,mapState:!1,inputVariables:i}}function Yr(i,e,t){switch(typeof i){case"boolean":{if(Od(e,Go))return new Nr(Go,i?"true":"false");if(!ry(e,ko))throw new Error(`got a boolean, but expected ${pf(e)}`);return new Nr(ko,i)}case"number":{if(Od(e,uA))return new Nr(uA,jr(i));if(Od(e,ko))return new Nr(ko,!!i);if(Od(e,Go))return new Nr(Go,i.toString());if(!ry(e,si))throw new Error(`got a number, but expected ${pf(e)}`);return new Nr(si,i)}case"string":{if(Od(e,ca))return new Nr(ca,zx(i));if(Od(e,ko))return new Nr(ko,!!i);if(!ry(e,Go))throw new Error(`got a string, but expected ${pf(e)}`);return new Nr(Go,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 Rle(i,e,t);for(let n of i)if(typeof n!="number")throw new Error("expected an array of numbers");if(Od(e,uA)){if(i.length!==2)throw new Error(`expected an array of two values for a size, got ${i.length}`);return new Nr(uA,i)}if(Od(e,ca)){if(i.length===3)return new Nr(ca,[...i,1]);if(i.length===4)return new Nr(ca,i);throw new Error(`expected an array of 3 or 4 values for a color, got ${i.length}`)}if(!ry(e,Af))throw new Error(`got an array of numbers, but expected ${pf(e)}`);return new Nr(Af,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"},_le={[Je.Get]:Fn(Zn(1,1/0),Nq),[Je.Var]:xle(),[Je.Has]:Fn(Zn(1,1/0),Nq),[Je.Id]:Fn(yle,jg),[Je.Concat]:Fn(Zn(2,1/0),zi(Go)),[Je.GeometryType]:Fn(vle,jg),[Je.LineMetric]:Fn(ble,jg),[Je.Resolution]:Fn(F5,jg),[Je.Zoom]:Fn(F5,jg),[Je.Time]:Fn(F5,jg),[Je.Any]:Fn(Zn(2,1/0),zi(ko)),[Je.All]:Fn(Zn(2,1/0),zi(ko)),[Je.Not]:Fn(Zn(1,1),zi(ko)),[Je.Equal]:Fn(Zn(2,2),Dq()),[Je.NotEqual]:Fn(Zn(2,2),Dq()),[Je.GreaterThan]:Fn(Zn(2,2),zi(si)),[Je.GreaterThanOrEqualTo]:Fn(Zn(2,2),zi(si)),[Je.LessThan]:Fn(Zn(2,2),zi(si)),[Je.LessThanOrEqualTo]:Fn(Zn(2,2),zi(si)),[Je.Multiply]:Fn(Zn(2,1/0),Lq),[Je.Coalesce]:Fn(Zn(2,1/0),Lq),[Je.Divide]:Fn(Zn(2,2),zi(si)),[Je.Add]:Fn(Zn(2,1/0),zi(si)),[Je.Subtract]:Fn(Zn(2,2),zi(si)),[Je.Clamp]:Fn(Zn(3,3),zi(si)),[Je.Mod]:Fn(Zn(2,2),zi(si)),[Je.Pow]:Fn(Zn(2,2),zi(si)),[Je.Abs]:Fn(Zn(1,1),zi(si)),[Je.Floor]:Fn(Zn(1,1),zi(si)),[Je.Ceil]:Fn(Zn(1,1),zi(si)),[Je.Round]:Fn(Zn(1,1),zi(si)),[Je.Sin]:Fn(Zn(1,1),zi(si)),[Je.Cos]:Fn(Zn(1,1),zi(si)),[Je.Atan]:Fn(Zn(1,2),zi(si)),[Je.Sqrt]:Fn(Zn(1,1),zi(si)),[Je.Match]:Fn(Zn(4,1/0),Fq,Sle),[Je.Between]:Fn(Zn(3,3),zi(si)),[Je.Interpolate]:Fn(Zn(6,1/0),Fq,Tle),[Je.Case]:Fn(Zn(3,1/0),wle,Ele),[Je.In]:Fn(Zn(2,2),Mle),[Je.Number]:Fn(Zn(1,1/0),zi(OS)),[Je.String]:Fn(Zn(1,1/0),zi(OS)),[Je.Array]:Fn(Zn(1,1/0),zi(si)),[Je.Color]:Fn(Zn(1,4),zi(si)),[Je.Band]:Fn(Zn(1,3),zi(si)),[Je.Palette]:Fn(Zn(2,2),Cle),[Je.ToString]:Fn(Zn(1,1),zi(ko|si|Go|ca))};function Nq(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 Nr(si,o);break}case"string":{r[s]=new Nr(Go,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 xle(){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=Yr(s,OS,t);if(!(o instanceof Nr))throw new Error(`style variables should only be literal values (no expressions!), variable name: ${n}`);let a=o.type;if(typeof s=="string"&&DS(r,ca)&&!DS(r,Go)?a=ca:Array.isArray(s)&&s.length===2&&DS(r,uA)&&!DS(r,Af)&&(a=uA),r&=a,r===FS)throw new Error(`the type expected from the var operator (${pf(e)}) did not have any overlap with the type of the corresponding style variables (${pf(a)}), variable name: ${n}`)}if(t.variables.has(n)){let o=t.variables.get(n);if(r&=o,r===FS)throw new Error(`a new type expected from the var operator (${pf(e)}) did not have any overlap with the previous type expected for it (${pf(o)}), variable name: ${n}`)}return t.variables.set(n,r),new BS(r,"var",new Nr(Go,n))}}function yle(i,e,t){t.featureId=!0}function vle(i,e,t){t.geometryType=!0}function ble(i,e,t){t.mCoordinate=!0}function F5(i,e,t){t.mapState=!0}function jg(i,e,t){let n=i[0];if(i.length!==1)throw new Error(`expected no arguments for ${n} operation`);return[]}function Zn(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 Lq(i,e,t){let n=i.length-1,r=new Array(n);for(let s=0;s<n;++s){let o=Yr(i[s+1],e,t);r[s]=o}return r}function zi(i){return function(e,t,n){let r=e.length-1,s=new Array(r);for(let o=0;o<r;++o){let a=Yr(e[o+1],i,n);s[o]=a}return s}}function Dq(){return function(i,e,t){let n=i[0],r=i.length-1,s=new Array(r),o=OS;for(let a=0;a<r;++a){let l=Yr(i[a+1],o,t);o&=l.type}if(o===FS)throw new Error(`no common type was found among the arguments of ${n}`);for(let a=0;a<r;++a){let l=Yr(i[a+1],o,t);s[a]=l}return s}}function wle(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 Fq(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 Sle(i,e,t){let n=i.length-1,r=Yr(i[i.length-1],e,t),s=Go|si|ko,o=new Array(n-2);for(let l=0;l<n-2;l+=2){try{let c=Yr(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===FS)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=Yr(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=Yr(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[Yr(i[1],s,t),...o,r]}function Tle(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 Nr(si,r),o;try{o=Yr(i[2],si,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=Yr(i[l+3],si,t);a[l]=c}catch(c){throw new Error(`failed to parse argument ${l+2} for interpolate expression: ${c.message}`)}try{let c=Yr(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 Ele(i,e,t){let n=Yr(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=Yr(i[s+1],ko,t);r[s]=o}catch(o){throw new Error(`failed to parse argument ${s} of case expression: ${o.message}`)}try{let o=Yr(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 Mle(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=Go:r=si;let s=new Array(n.length);for(let a=0;a<s.length;a++)try{let l=Yr(n[a],r,t);s[a]=l}catch(l){throw new Error(`failed to parse haystack item ${a} for "in" expression: ${l.message}`)}return[Yr(i[1],r,t),...s]}function Cle(i,e,t){let n;try{n=Yr(i[1],si,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=Yr(r[o],ca,t)}catch(l){throw new Error(`failed to parse color at index ${o} in palette expression: ${l.message}`)}if(!(a instanceof Nr))throw new Error(`the palette color at index ${o} must be a literal value`);s[o]=a}return[n,...s]}function Fn(...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 BS(t,r,...s)}}function Rle(i,e,t){let n=i[0],r=_le[n];if(!r)throw new Error(`unknown operator: ${n}`);return r(i,e,t)}function kS(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 kS(i.getGeometries()[0]);default:return""}}function B5(){return{variables:{},properties:{},resolution:NaN,featureId:null,geometryType:""}}function kc(i,e,t){let n=Yr(i,e,t);return Uc(n,t)}function Uc(i,e){if(i instanceof Nr){if(i.type===ca&&typeof i.value=="string"){let n=zx(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 Ple(i,e);case Je.Get:case Je.Var:case Je.Has:return Ile(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=>Uc(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 Lle(i,e);case Je.Equal:case Je.NotEqual:case Je.LessThan:case Je.LessThanOrEqualTo:case Je.GreaterThan:case Je.GreaterThanOrEqualTo:return Nle(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 Dle(i,e);case Je.Case:return Fle(i,e);case Je.Match:return Ole(i,e);case Je.Interpolate:return Ble(i,e);case Je.ToString:return Ule(i,e);default:throw new Error(`Unsupported operator ${t}`)}}function Ple(i,e){let t=i.operator,n=i.args.length,r=new Array(n);for(let s=0;s<n;++s)r[s]=Uc(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 Ile(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 Nle(i,e){let t=i.operator,n=Uc(i.args[0],e),r=Uc(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 Lle(i,e){let t=i.operator,n=i.args.length,r=new Array(n);for(let s=0;s<n;++s)r[s]=Uc(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 Dle(i,e){let t=i.operator,n=i.args.length,r=new Array(n);for(let s=0;s<n;++s)r[s]=Uc(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 Fle(i,e){let t=i.args.length,n=new Array(t);for(let r=0;r<t;++r)n[r]=Uc(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 Ole(i,e){let t=i.args.length,n=new Array(t);for(let r=0;r<t;++r)n[r]=Uc(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 Ble(i,e){let t=i.args.length,n=new Array(t);for(let r=0;r<t;++r)n[r]=Uc(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=uV(f)),u>=o)return c===2?f:p?kle(s,o,a,l,u,f):sy(s,o,a,l,u,f);a=u,l=f}return l}}function Ule(i,e){let t=i.operator,n=i.args.length,r=new Array(n);for(let s=0;s<n;++s)r[s]=Uc(i.args[s],e);if(t===Je.ToString)return s=>{let o=r[0](s);return i.args[0].type===ca?Vx(o):o.toString()};throw new Error(`Unsupported convert operator ${t}`)}function sy(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 kle(i,e,t,n,r,s){if(r-t===0)return n;let a=TI(n),l=TI(s),c=l[2]-a[2];c>180?c-=360:c<-180&&(c+=360);let u=[sy(i,e,t,a[0],r,l[0]),sy(i,e,t,a[1],r,l[1]),a[2]+sy(i,e,t,0,r,c),sy(i,e,t,n[3],r,s[3])];return hV(u)}function Gle(i){return!0}function zle(i,e){e=e??US();let t=Vle(i,e),n=B5();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=kS(r.getGeometry())),t(n)}}function Oq(i,e){e=e??US();let t=i.length,n=new Array(t);for(let o=0;o<t;++o)n[o]=U5(i[o],e);let r=B5(),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=kS(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 Gq(i,e){if(e=e??US(),!Array.isArray(i))return Oq([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 zle(s,e)}return Oq(i,e)}function Vle(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?kc(s.filter,ko,e):Gle,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=oy(i,"",e),n=ay(i,"",e),r=qle(i,e),s=Hle(i,e),o=go(i,"z-index",e);if(!t&&!n&&!r&&!s&&!Ec(i))throw new Error("No fill, stroke, point, or text symbolizer properties in style: "+JSON.stringify(i));let a=new ws;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 oy(i,e,t){let n;if(e+"fill-pattern-src"in i)n=$le(i,e+"fill-",t);else{if(i[e+"fill-color"]==="none")return s=>null;n=zS(i,e+"fill-color",t)}if(!n)return null;let r=new $r;return function(s){let o=n(s);return o===lS?null:(r.setColor(o),r)}}function ay(i,e,t){let n=go(i,e+"stroke-width",t),r=zS(i,e+"stroke-color",t);if(!n&&!r)return null;let s=mf(i,e+"stroke-line-cap",t),o=mf(i,e+"stroke-line-join",t),a=zq(i,e+"stroke-line-dash",t),l=go(i,e+"stroke-line-dash-offset",t),c=go(i,e+"stroke-miter-limit",t),u=go(i,e+"stroke-offset",t),f=new fo;return function(p){if(r){let x=r(p);if(x===lS)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 qle(i,e){let t="text-",n=mf(i,t+"value",e);if(!n)return null;let r=oy(i,t,e),s=oy(i,t+"background-",e),o=ay(i,t,e),a=ay(i,t+"background-",e),l=mf(i,t+"font",e),c=go(i,t+"max-angle",e),u=go(i,t+"offset-x",e),f=go(i,t+"offset-y",e),p=Xg(i,t+"overflow",e),x=mf(i,t+"placement",e),v=go(i,t+"repeat",e),w=VS(i,t+"scale",e),S=Xg(i,t+"rotate-with-view",e),T=go(i,t+"rotation",e),R=mf(i,t+"align",e),P=mf(i,t+"justify",e),C=mf(i,t+"baseline",e),L=Xg(i,t+"keep-upright",e),D=zq(i,t+"padding",e),F=qS(i,t+"declutter-mode"),N=new ff({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(v&&N.setRepeat(v(B)),w&&N.setScale(w(B)),S&&N.setRotateWithView(S(B)),T&&N.setRotation(T(B)),R){let z=R(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(P){let z=P(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 Hle(i,e){return"icon-src"in i?Wle(i,e):"shape-points"in i?jle(i,e):"circle-radius"in i?Xle(i,e):null}function Wle(i,e){let t="icon-",n=t+"src",r=Vq(i[n],n),s=GS(i,t+"anchor",e),o=VS(i,t+"scale",e),a=go(i,t+"opacity",e),l=GS(i,t+"displacement",e),c=go(i,t+"rotation",e),u=Xg(i,t+"rotate-with-view",e),f=Uq(i,t+"anchor-origin"),p=kq(i,t+"anchor-x-units"),x=kq(i,t+"anchor-y-units"),v=gf(i,t+"color"),w,S=null;v!==void 0&&(Array.isArray(v)&&v.length>0&&typeof v[0]=="string"?S=zS(i,t+"color",e):w=qq(v,t+"color"));let T=Kle(i,t+"cross-origin"),R=Zle(i,t+"offset"),P=Uq(i,t+"offset-origin"),C=k5(i,t+"width"),L=k5(i,t+"height"),D=Yle(i,t+"size"),F=qS(i,t+"declutter-mode"),N={src:r,anchorOrigin:f,anchorXUnits:p,anchorYUnits:x,crossOrigin:T,offset:R,offsetOrigin:P,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 rA(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 jle(i,e){let t="shape-",n=t+"points",r=t+"radius",s=G5(i[n],n);if(!(r in i))throw new Error(`Expected a number for ${r}`);let o=go(i,r,e),a=typeof i[r]=="number"?i[r]:5,l=t+"radius2",c=go(i,l,e),u=typeof i[l]=="number"?i[l]:void 0,f=oy(i,t,e),p=ay(i,t,e),x=VS(i,t+"scale",e),v=GS(i,t+"displacement",e),w=go(i,t+"rotation",e),S=Xg(i,t+"rotate-with-view",e),T=k5(i,t+"angle"),R=qS(i,t+"declutter-mode"),P=new pS({points:s,radius:a,radius2:u,angle:T,declutterMode:R});return function(C){return o&&P.setRadius(o(C)),c&&P.setRadius2(c(C)),f&&P.setFill(f(C)),p&&P.setStroke(p(C)),v&&P.setDisplacement(v(C)),w&&P.setRotation(w(C)),S&&P.setRotateWithView(S(C)),x&&P.setScale(x(C)),P}}function Xle(i,e){let t="circle-",n=oy(i,t,e),r=ay(i,t,e),s=go(i,t+"radius",e),o=VS(i,t+"scale",e),a=GS(i,t+"displacement",e),l=go(i,t+"rotation",e),c=Xg(i,t+"rotate-with-view",e),u=qS(i,t+"declutter-mode"),f=new AS({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 gf(i,e){if(!(e in i))return;let t=i[e];return t===void 0?void 0:t}function go(i,e,t){let n=gf(i,e);if(n===void 0)return;let r=kc(n,si,t);return function(s){return G5(r(s),e)}}function mf(i,e,t){let n=gf(i,e);if(n===void 0)return null;let r=kc(n,Go,t);return function(s){return Vq(r(s),e)}}function $le(i,e,t){let n=mf(i,e+"pattern-src",t),r=Bq(i,e+"pattern-offset",t),s=Bq(i,e+"pattern-size",t),o=zS(i,e+"color",t);return function(a){return{src:n(a),offset:r&&r(a),size:s&&s(a),color:o&&o(a)}}}function Xg(i,e,t){let n=gf(i,e);if(n===void 0)return null;let r=kc(n,ko,t);return function(s){let o=r(s);if(typeof o!="boolean")throw new Error(`Expected a boolean for ${e}`);return o}}function zS(i,e,t){let n=gf(i,e);if(n===void 0)return null;let r=kc(n,ca,t);return function(s){return qq(r(s),e)}}function zq(i,e,t){let n=gf(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=kc(o,si,t);return function(c){return G5(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=kc(n,Af,t);return function(s){return ly(r(s),e)}}function GS(i,e,t){let n=gf(i,e);if(n===void 0)return null;let r=kc(n,Af,t);return function(s){let o=ly(r(s),e);if(o.length!==2)throw new Error(`Expected two numbers for ${e}`);return o}}function Bq(i,e,t){let n=gf(i,e);if(n===void 0)return null;let r=kc(n,Af,t);return function(s){return Hq(r(s),e)}}function VS(i,e,t){let n=gf(i,e);if(n===void 0)return null;let r=kc(n,Af|si,t);return function(s){return Qle(r(s),e)}}function k5(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 Yle(i,e){let t=i[e];if(t!==void 0){if(typeof t=="number")return jr(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 Kle(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 Uq(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 kq(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 Zle(i,e){let t=i[e];if(t!==void 0)return ly(t,e)}function qS(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 ly(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 Vq(i,e){if(typeof i!="string")throw new Error(`Expected a string for ${e}`);return i}function G5(i,e){if(typeof i!="number")throw new Error(`Expected a number for ${e}`);return i}function qq(i,e){if(typeof i=="string")return i;let t=ly(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 Hq(i,e){let t=ly(i,e);if(t.length!==2)throw new Error(`Expected an array of two numbers for ${e}`);return t}function Qle(i,e){return typeof i=="number"?i:Hq(i,e)}var Wq={RENDER_ORDER:"renderOrder"},z5=class extends lA{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(Wq.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 cA(9)),this.getRenderer().renderDeclutter(e,t)}setRenderOrder(e){this.set(Wq.RENDER_ORDER,e)}setStyle(e){this.style_=e===void 0?UI:e;let t=Jle(e);this.styleFunction_=e===null?void 0:wV(t),this.changed()}setDeclutter(e){this.declutter_=e?String(e):void 0,this.changed()}};function Jle(i){if(i===void 0)return UI;if(!i)return null;if(typeof i=="function"||i instanceof ws)return i;if(Array.isArray(i)&&i.length===0)return[];if(Array.isArray(i)&&i[0]instanceof ws){let t=i.length,n=new Array(t);for(let r=0;r<t;++r){let s=i[r];if(!(s instanceof ws))throw new Error("Expected a list of style instances");n[r]=s}return n}return Gq(i)}var HS=z5;var V5=class extends Ks{constructor(e,t,n,r){super(e),this.inversePixelTransform=t,this.frameState=n,this.context=r}},WS=V5;var q5=class extends wd{constructor(e){super(),this.map_=e}dispatchRenderEvent(e,t){Kn()}calculateMatrices2D(e){let t=e.viewState,n=e.coordinateToPixelTransform,r=e.pixelToCoordinateTransform;ho(n,e.size[0]/2,e.size[1]/2,1/t.resolution,-1/t.resolution,-t.rotation,-t.center[0],-t.center[1]),Gw(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=bw(e.slice(),p),v=[[0,0]];if(p.canWrapX()&&r){let C=p.getExtent(),L=jn(C);v.push([-L,0],[L,0])}let w=t.layerStatesArray,S=w.length,T=[],R=[];for(let C=0;C<v.length;C++)for(let L=S-1;L>=0;--L){let D=w[L],F=D.layer;if(F.hasRenderer()&&ey(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);R[0]=z[0]+v[C][0],R[1]=z[1]+v[C][1],c=N.forEachFeatureAtCoordinate(R,t,n,V,T)}if(c)return c}}if(T.length===0)return;let P=1/T.length;return T.forEach((C,L)=>C.distanceSq+=L*P),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,rf,this,s,o)!==void 0}getMap(){return this.map_}renderFrame(e){Kn()}scheduleExpireIconCache(e){Bo.canExpireCache()&&e.postRenderFunctions.push(ece)}};function ece(i,e){Bo.expire()}var jq=q5;var H5=class extends jq{constructor(e){super(e),this.fontChangeListenerKey_=kn(nA,Ic.PROPERTYCHANGE,e.redrawText,e),this.element_=Us?Bw():document.createElement("div");let t=this.element_.style;t.position="absolute",t.width="100%",t.height="100%",t.zIndex="0",this.element_.className=Id+" 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 WS(e,void 0,t);n.dispatchEvent(r)}}disposeInternal(){ri(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(mo.PRECOMPOSE,e);let t=e.layerStatesArray.sort((u,f)=>u.zIndex-f.zIndex);t.some(u=>u.layer instanceof HS&&u.layer.getDeclutter())&&(e.declutter={});let r=e.viewState;this.children_.length=0;let o=this.getMap().getTargetElement(),a;pl(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,v=x.getSourceState();if(!ey(p,r)||v!="ready"&&v!="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),Az(this.element_,this.children_);for(let u of a?this.children_:[]){let f=u.firstElementChild||u,p=u.style.backgroundColor;if(p&&(!pl(f)||f.width>0)&&(a.fillStyle=p,a.fillRect(0,0,a.canvas.width,a.canvas.height)),!pl(f)||f.width===0)continue;a.save();let x=u.style.opacity||f.style.opacity;a.globalAlpha=x===""?1:Number(x);let v=f.style.transform;if(v)a.transform(...kw(v));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(mo.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))}}},Xq=H5;function $q(i){if(i instanceof lA){i.setMapInternal(null);return}i instanceof Jx&&i.getLayers().forEach($q)}function Yq(i,e){if(i instanceof lA){i.setMapInternal(e);return}if(i instanceof Jx){let t=i.getLayers().getArray();for(let n=0,r=t.length;n<r;++n)Yq(t[n],e)}}var W5=class extends bs{constructor(e){super(),e=e||{},this.on,this.once,this.un;let t=tce(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:cz,this.postRenderTimeoutHandle_,this.animationDelayKey_,this.animationDelay_=this.animationDelay_.bind(this),this.coordinateToPixelTransform_=Zs(),this.pixelToCoordinateTransform_=Zs(),this.frameIndex_=0,this.frameState_=null,this.previousExtent_=null,this.viewPropertyListenerKey_=null,this.viewChangeListenerKey_=null,this.layerGroupPropertyListenerKeys_=null,Us||(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,Us||(this.resizeObserver_=new ResizeObserver(()=>this.updateSize())),this.controls=t.controls||(Us?new po:wS()),this.interactions=t.interactions||(Us?new po:RS({onFocusOnly:!0})),this.overlays_=t.overlays,this.overlayIdIndex_={},this.renderer_=null,this.postRenderFunctions_=[],this.tileQueue_=new iq(this.getTilePriority.bind(this),this.handleTileChange_.bind(this)),this.addChangeListener(Ao.LAYERGROUP,this.handleLayerGroupChanged_),this.addChangeListener(Ao.VIEW,this.handleViewChanged_),this.addChangeListener(Ao.SIZE,this.handleSizeChanged_),this.addChangeListener(Ao.TARGET,this.handleTargetChanged_),this.setProperties(t.values);let n=this;e.view&&!(e.view instanceof Al)&&e.view.then(function(r){n.setView(new Al(r))}),this.controls.addEventListener(Qs.ADD,r=>{r.element.setMap(this)}),this.controls.addEventListener(Qs.REMOVE,r=>{r.element.setMap(null)}),this.interactions.addEventListener(Qs.ADD,r=>{r.element.setMap(this)}),this.interactions.addEventListener(Qs.REMOVE,r=>{r.element.setMap(null)}),this.overlays_.addEventListener(Qs.ADD,r=>{this.addOverlayInternal_(r.element)}),this.overlays_.addEventListener(Qs.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){Yq(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:rf,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 Jx?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:rf,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(Ao.TARGET)}getTargetElement(){return this.targetElement_}getCoordinateFromPixel(e){return Mx(this.getCoordinateFromPixelInternal(e),this.getView().getProjection())}getCoordinateFromPixelInternal(e){let t=this.frameState_;return t?Ir(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(Ao.LAYERGROUP)}setLayers(e){let t=this.getLayerGroup();if(e instanceof po){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=Cc(e,this.getView().getProjection());return this.getPixelFromCoordinateInternal(t)}getPixelFromCoordinateInternal(e){let t=this.frameState_;return t?Ir(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(Ao.SIZE)}getView(){return this.get(Ao.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 rq(this.frameState_,e,t,n,r)}handleBrowserEvent(e,t){t=t||e.type;let n=new Nu(t,this,e);this.handleMapBrowserEvent(n)}handleMapBrowserEvent(e){if(!this.frameState_)return;let t=e.originalEvent,n=t.type;if(n===Kx.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[Gs.ANIMATING]||o[Gs.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(mo.RENDERCOMPLETE)&&this.renderer_.dispatchRenderEvent(mo.RENDERCOMPLETE,e),this.loaded_===!1&&(this.loaded_=!0,this.dispatchEvent(new Ld(Lu.LOADEND,this,e)))):this.loaded_===!0&&(this.loaded_=!1,this.dispatchEvent(new Ld(Lu.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)ri(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_&&!pl(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(pl(t)||t.appendChild(this.viewport_),this.renderer_||(this.renderer_=new Xq(this)),!pl(t)){this.mapBrowserEventHandler_=new tq(this,this.moveTolerance_);for(let r in rr)this.mapBrowserEventHandler_.addEventListener(rr[r],this.handleMapBrowserEvent.bind(this));this.viewport_.addEventListener(Jt.CONTEXTMENU,this.boundHandleBrowserEvent_,!1),this.viewport_.addEventListener(Jt.WHEEL,this.boundHandleBrowserEvent_,Ow?{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_=[kn(n,Jt.KEYDOWN,this.handleBrowserEvent,this),kn(n,Jt.KEYPRESS,this.handleBrowserEvent,this)],!pl(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_&&(ri(this.viewPropertyListenerKey_),this.viewPropertyListenerKey_=null),this.viewChangeListenerKey_&&(ri(this.viewChangeListenerKey_),this.viewChangeListenerKey_=null);let e=this.getView();e&&(this.updateViewportSize_(this.getSize()),this.viewPropertyListenerKey_=kn(e,Ic.PROPERTYCHANGE,this.handleViewPropertyChanged_,this),this.viewChangeListenerKey_=kn(e,Jt.CHANGE,this.handleViewPropertyChanged_,this),e.resolveConstraints(0)),this.render()}handleLayerGroupChanged_(){this.layerGroupPropertyListenerKeys_&&(this.layerGroupPropertyListenerKeys_.forEach(ri),this.layerGroupPropertyListenerKeys_=null);let e=this.getLayerGroup();e&&(this.handleLayerAdd_(new Bc("addlayer",e)),this.layerGroupPropertyListenerKeys_=[kn(e,Ic.PROPERTYCHANGE,this.render,this),kn(e,Jt.CHANGE,this.render,this),kn(e,"addlayer",this.handleLayerAdd_,this),kn(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){$q(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&&TP(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:wx(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:Ln(this),renderTargets:{}},a.nextCenter&&a.nextResolution){let l=isNaN(a.nextRotation)?a.rotation:a.nextRotation;s.nextExtent=wx(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_||!vu(this.previousExtent_)&&!z0(s.extent,this.previousExtent_))&&(this.dispatchEvent(new Ld(Lu.MOVESTART,this,r)),this.previousExtent_=G0(this.previousExtent_)),this.previousExtent_&&!s.viewHints[Gs.ANIMATING]&&!s.viewHints[Gs.INTERACTING]&&!z0(s.extent,this.previousExtent_)&&(this.dispatchEvent(new Ld(Lu.MOVEEND,this,s)),pw(s.extent,this.previousExtent_))),this.dispatchEvent(new Ld(Lu.POSTRENDER,this,s)),this.renderComplete_=(this.hasListener(Lu.LOADSTART)||this.hasListener(Lu.LOADEND)||this.hasListener(mo.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 Bc("removelayer",t)),this.set(Ao.LAYERGROUP,e)}setSize(e){this.set(Ao.SIZE,e)}setTarget(e){this.set(Ao.TARGET,e)}setView(e){if(!e||e instanceof Al){this.set(Ao.VIEW,e);return}this.set(Ao.VIEW,new Al);let t=this;e.then(function(n){t.setView(new Al(n))})}updateSize(){let e=this.getTargetElement(),t;if(e){let r,s;if(pl(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)],!TP(t)&&(e.offsetWidth||e.offsetHeight||e.getClientRects().length)&&xw("No map visible because the map container's width or height are 0."))}let n=this.getSize();t&&(!n||!Oo(t,n))&&(this.updateViewportSize_(t),this.setSize(t))}updateViewportSize_(e){let t=this.getView();t&&t.setViewportSize(e)}};function tce(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 Jx({layers:i.layers});t[Ao.LAYERGROUP]=n,t[Ao.TARGET]=i.target,t[Ao.VIEW]=i.view instanceof Al?i.view:new Al;let r;i.controls!==void 0&&(Array.isArray(i.controls)?r=new po(i.controls.slice()):(Vn(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 po(i.interactions.slice()):(Vn(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 po(i.overlays.slice()):(Vn(typeof i.overlays.getArray=="function","Expected `overlays` to be an array or an `ol/Collection.js`"),o=i.overlays):o=new po,{controls:r,interactions:s,keyboardEventTarget:e,overlays:o,values:t}}var Kq=W5;function jS(i){return i instanceof Image||i instanceof HTMLCanvasElement||i instanceof HTMLVideoElement||i instanceof ImageBitmap?i:null}var nce=new Error("disposed");var ice=[256,256],j5=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=jS(this.data_);return e?[e.width,e.height]:ice}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(nce),this.controller_=null),super.disposeInternal()}},X5=j5;var $5=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 wd&&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 Vn(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 Vn(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){Vn(!(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}},Y5=$5;var K5=class{constructor(){this.instructions_=[],this.zIndex=0,this.offset_=0,this.pendingMethod_,this.context_=new Proxy(Px(),{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}},XS=K5;var rce=5,Z5=class extends Vw{constructor(e){super(),this.ready=!0,this.boundHandleImageChange_=this.handleImageChange_.bind(this),this.layer_=e,this.staleKeys_=new Array,this.maxStaleKeys=rce,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 Kn()}getData(e){return null}prepareFrame(e){return Kn()}renderFrame(e,t){return Kn()}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()}},Zq=Z5;var J5=[],$g=null;function sce(){$g=Ti(1,1,void 0,{willReadFrequently:!0})}var Q5=class extends Zq{constructor(e){super(e),this.container=null,this.renderedResolution,this.tempTransform=Zs(),this.pixelTransform=Zs(),this.inversePixelTransform=Zs(),this.context=null,this.deferredContext_=null,this.containerReused=!1,this.frameState=null}getImageData(e,t,n){$g||sce(),$g.clearRect(0,0,1,1);let r;try{$g.drawImage(e,t,n,1,1,0,0,1,1),r=$g.getImageData(0,0,1,1).data}catch{return $g=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(pl(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&&Oo(Yl(e.style.backgroundColor),Yl(n)))){let c=e.firstElementChild;pl(c)&&(l=c.getContext("2d"))}if(l&&bz(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=Us?Bw():document.createElement("div"),a.className=o;let c=a.style;c.position="absolute",c.width="100%",c.height="100%",l=Ti();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=Wl(n),s=pg(n),o=dg(n),a=fg(n);Ir(t.coordinateToPixelTransform,r),Ir(t.coordinateToPixelTransform,s),Ir(t.coordinateToPixelTransform,o),Ir(t.coordinateToPixelTransform,a);let l=this.inversePixelTransform;Ir(l,r),Ir(l,s),Ir(l,o),Ir(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(jn(n)/r*o),l=Math.round(xr(n)/r*o);ho(this.pixelTransform,e.size[0]/2,e.size[1]/2,1/o,1/o,s,-a/2,-l/2),Gw(this.inversePixelTransform,this.pixelTransform);let c=vz(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 WS(e,this.inversePixelTransform,n,t);r.dispatchEvent(s)}}preRender(e,t){this.frameState=t,!t.declutter&&this.dispatchRenderEvent_(mo.PRERENDER,e,t)}postRender(e,t){t.declutter||this.dispatchRenderEvent_(mo.POSTRENDER,e,t)}renderDeferredInternal(e){}getRenderContext(e){return e.declutter&&!this.deferredContext_&&(this.deferredContext_=new XS),e.declutter?this.deferredContext_.getContext():this.context}renderDeferred(e){e.declutter&&(this.dispatchRenderEvent_(mo.PRERENDER,this.context,e),e.declutter&&this.deferredContext_&&(this.deferredContext_.draw(this.context),this.deferredContext_.clear()),this.renderDeferredInternal(e),this.dispatchRenderEvent_(mo.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 ho(this.tempTransform,l,c,u,f,-n,p,x)}disposeInternal(){delete this.frameState,super.disposeInternal()}},$S=Q5;function eN(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 oce(i,e,t){let n=i[t];return n?n.delete(e):!1}function Qq(i,e){let t=i.layerStatesArray[i.layerIndex];t.extent&&(e=yu(e,Rc(t.extent,i.viewState.projection)));let n=t.layer.getRenderSource();if(!n.getWrapX()){let r=n.getTileGridForProjection(i.viewState.projection).getExtent();r&&(e=yu(e,r))}return e}var tN=class extends $S{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=Pr(),this.tempTileRange_=new Iw(0,0,0,0),this.tempTileCoord_=wg(0,0,0);let n=t.cacheSize!==void 0?t.cacheSize:512;this.tileCache_=new Y5(n),this.sourceTileCache_=null,this.layerExtent=null,this.maxStaleKeys=n*.5}getTileCache(){return this.tileCache_}getSourceTileCache(){return this.sourceTileCache_||(this.sourceTileCache_=new Y5(512)),this.sourceTileCache_}getOrCreateTile(e,t,n,r){let s=this.tileCache_,a=this.getLayer().getSource(),l=Sg(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||yg(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=Ir(t.pixelToCoordinateTransform,e.slice()),s=n.getExtent();if(s&&!wc(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),v=jr(l.getTileSize(u)),w=l.getResolution(u),S;if(p instanceof Uw||p instanceof zw)S=p.getImage();else if(p instanceof X5){if(S=jS(p.getData()),!S)continue}else continue;let T=Math.floor(c*((r[0]-x[0])/w-f[1]*v[0])),R=Math.floor(c*((x[1]-r[1])/w-f[2]*v[1])),P=Math.round(c*a.getGutterForProjection(o.projection));return this.getImageData(S,T+P,R+P)}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=Ln(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)),v=o.rotation,w=v?uP(o.center,o.resolution,v,e.size):void 0;for(let S=n;S>=x;--S){let T=c.getTileRangeForExtentAndZ(t,S,this.tempTileRange_),R=c.getResolution(S);for(let P=T.minX;P<=T.maxX;++P)for(let C=T.minY;C<=T.maxY;++C){if(v&&!c.tileCoordIntersectsViewport([S,P,C],w))continue;let L=this.getTile(S,P,C,e);if(!L||!eN(r,L,S))continue;let F=L.getKey();if(f[F]=!0,L.getState()===rn.IDLE&&!e.tileQueue.isKeyQueued(F)){let N=wg(S,P,C,this.tempTileCoord_);e.tileQueue.enqueue([L,u,c.getTileCoordCenter(N),R])}}}}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=Sg(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(Ln(this)),eN(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=Sg(l,c,n,u,f),x=!1;if(a.containsKey(p)){let v=a.peek(p);v.getState()===rn.LOADED&&(eN(r,v,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 v=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?Rc(n.extent,s):null,this.layerExtent&&(v=yu(v,this.layerExtent));let R=x*S/2/w,P=x*T/2/w,C=[a[0]-R,a[1]-P,a[0]+R,a[1]+P],L={};this.renderedTiles.length=0;let D=c.getPreload();if(e.nextExtent&&this.enqueueTilesForNextExtent()){let Z=f.getZForResolution(r.nextResolution,u.zDirection),ee=Qq(e,e.nextExtent);this.enqueueTiles(e,ee,Z,L,D)}let F=Qq(e,v);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=Ln(this),B=e.time;for(let Z of L[p]){let ee=Z.getState();if(ee===rn.EMPTY)continue;let ae=Z.tileCoord;if(ee===rn.LOADED&&Z.getAlpha(N,B)===1){Z.endTransition(N);continue}if(ee!==rn.ERROR&&(this.renderComplete=!1),this.findStaleTile_(ae,L)){oce(L,Z,p),e.animate=!0;continue}if(this.findAltTiles_(f,ae,p+1,L))continue;let be=f.getMinZoom();for(let Ie=p-1;Ie>=be&&!this.findAltTiles_(f,ae,Ie,L);--Ie);}let z=x/o*l/w,V=this.getRenderContext(e);ho(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(Va);let K=[],J=[],j=[];for(let Z=H.length-1;Z>=0;--Z){let ee=H[Z],ae=u.getTilePixelSize(ee,l,s),de=f.getResolution(ee)/x,be=ae[0]*de*z,Ie=ae[1]*de*z,Qe=f.getTileCoordForCoordAndZ(Wl(C),ee),Ue=f.getTileCoordExtent(Qe),mt=Ir(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)*be),Ct=Qe[2]-$e[2],un=Math.round(mt[1]-(Ct-1)*Ie),Gt=Math.round(mt[0]-Et*be),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=K.length;Qt<xn;++Qt)ee<J[Qt]&&yr(yt,K[Qt])&&ln.push(K[Qt]);let Zt;ln.length>0&&(Zt=gG(yt,ln)),K.push(yt),J.push(ee),this.drawTile(ze,e,Gt,Xe,st,tt,Me,vt,Zt),this.renderedTiles.unshift(ze),this.updateUsedTiles(e.usedTiles,u,ze)}}for(let Z=0,ee=j.length;Z<ee;++Z){let{tile:ae,x:ce,y:de,w:be,h:Ie,gutter:Qe}=j[Z];this.drawTile(ae,e,ce,de,be,Ie,Qe,!0,void 0)}if(this.renderedResolution=x,this.extentChanged=!this.renderedExtent_||!z0(this.renderedExtent_,C),this.renderedExtent_=C,this.renderedPixelRatio=l,this.postRender(this.context,e),this.layerExtent&&V.restore(),V.imageSmoothingEnabled=!0,this.renderComplete){let Z=(ee,ae)=>{let ce=Ln(u),de=ae.wantedTiles[ce],be=de?Object.keys(de).length:0;this.updateCacheSize(be),this.tileCache_.expireCache(),this.sourceTileCache_?.expireCache()};e.postRenderFunctions.push(Z)}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=jS(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=Ln(this),x=t.layerStatesArray[t.layerIndex],v=x.opacity*(l?e.getAlpha(p,t.time):1),w=v!==f.globalAlpha;w&&(f.save(),f.globalAlpha=v);let S=u.width-2*a,T=u.height-2*a;if(c){let R=S/s,P=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)*R,a+(N-r)*P,B*R,z*P,F,N,B,z)}}else f.drawImage(u,a,a,S,T,n,r,s,o);w&&f.restore(),v!==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=Ln(t);r in e||(e[r]={}),e[r][n.getKey()]=!0}},Jq=tN;var cy={PRELOAD:"preload",USE_INTERIM_TILES_ON_ERROR:"useInterimTilesOnError"};var nN=class extends lA{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(cy.PRELOAD)}setPreload(e){this.set(cy.PRELOAD,e)}getUseInterimTilesOnError(){return this.get(cy.USE_INTERIM_TILES_ON_ERROR)}setUseInterimTilesOnError(e){this.set(cy.USE_INTERIM_TILES_ON_ERROR,e)}getData(e){return super.getData(e)}},eH=nN;var iN=class extends eH{constructor(e){super(e)}createRenderer(){return new Jq(this,{cacheSize:this.getCacheSize()})}},rN=iN;var sN=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){}},YS=sN;var uy={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},hy=[uy.FILL],Ou=[uy.STROKE],_f=[uy.BEGIN_PATH],oN=[uy.CLOSE_PATH],An=uy;var aN=class extends YS{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],wc(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,v,w,S;for(v=t+r;v<n;v+=r)p[0]=e[v],p[1]=e[v+1],S=dw(c,p),S!==w?(x&&(a[l++]=u,a[l++]=f,x=!1),a[l++]=p[0],a[l++]=p[1]):S===ys.INTERSECTING?(a[l++]=p[0],a[l++]=p[1],x=!1):x=!0,u=p[0],f=p[1],w=S;return(s&&x||v===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 v=e.getEndss();x=0;for(let w=0,S=v.length;w<S;++w){let T=[];x=this.drawCustomCoordinates_(c,x,v[w],a,T),p.push(T)}this.instructions.push([An.CUSTOM,l,p,e,n,Dx,s]),this.hitDetectionInstructions.push([An.CUSTOM,l,p,e,r||n,Dx,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,Lg,s]),this.hitDetectionInstructions.push([An.CUSTOM,l,f,e,r||n,Lg,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,Mu,s]),this.hitDetectionInstructions.push([An.CUSTOM,l,u,e,r||n,Mu,s]);break;case"MultiPoint":c=e.getFlatCoordinates(),u=this.appendFlatPointCoordinates(c,a),u>l&&(this.instructions.push([An.CUSTOM,l,u,e,n,Mu,s]),this.hitDetectionInstructions.push([An.CUSTOM,l,u,e,r||n,Mu,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,YG(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=Ha(n||ks)??void 0}else t.fillStyle=void 0;return t}strokeStyleToState(e,t={}){if(e){let n=e.getColor();t.strokeStyle=Ha(n||Uo);let r=e.getLineCap();t.lineCap=r!==void 0?r:Pu;let s=e.getLineDash();t.lineDash=s?s.slice():Wa;let o=e.getLineDashOffset();t.lineDashOffset=o||ja;let a=e.getLineJoin();t.lineJoin=a!==void 0?a:Iu;let l=e.getWidth();t.lineWidth=l!==void 0?l:hf;let c=e.getMiterLimit();t.miterLimit=c!==void 0?c:cf;let u=e.getOffset();t.strokeOffset=u??AV,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&&!Oo(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_=pw(this.maxExtent),this.maxLineWidth>0)){let e=this.resolution*(this.maxLineWidth+1)/2;ug(this.bufferedMaxExtent_,e,this.bufferedMaxExtent_)}return this.bufferedMaxExtent_}},Bu=aN;var lN=class extends Bu{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&&!wc(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||wc(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}},tH=lN;var cN=class extends Bu{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,Uo,r.lineWidth,r.lineCap,r.lineJoin,r.miterLimit,Wa,ja],_f);let l=e.getFlatCoordinates(),c=e.getStride();this.drawFlatCoordinates_(l,0,l.length,c,a),this.hitDetectionInstructions.push(Ou),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,Uo,r.lineWidth,r.lineCap,r.lineJoin,r.miterLimit,Wa,ja],_f);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(Ou),this.endGeometry(t)}finish(){let e=this.state;return e.lastStroke!=null&&e.lastStroke!=this.coordinates.length&&this.instructions.push(Ou),this.reverseHitDetectionInstructions(),this.state=null,super.finish()}applyStroke(e){e.lastStroke!=null&&e.lastStroke!=this.coordinates.length&&(this.instructions.push(Ou),e.lastStroke=this.coordinates.length),e.lastStroke=0,super.applyStroke(e),this.instructions.push(_f)}},nH=cN;var uN=class extends Bu{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(_f),this.hitDetectionInstructions.push(_f);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(oN),this.hitDetectionInstructions.push(oN)),t=f}return a&&(this.instructions.push(hy),this.hitDetectionInstructions.push(hy)),l&&(this.instructions.push(Ou),this.hitDetectionInstructions.push(Ou)),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,ks]),r.strokeStyle!==void 0&&this.hitDetectionInstructions.push([An.SET_STROKE_STYLE,Uo,r.lineWidth,r.lineCap,r.lineJoin,r.miterLimit,Wa,ja]);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(_f,f),this.hitDetectionInstructions.push(_f,f),r.fillStyle!==void 0&&(this.instructions.push(hy),this.hitDetectionInstructions.push(hy)),r.strokeStyle!==void 0&&(this.instructions.push(Ou),this.hitDetectionInstructions.push(Ou)),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,ks]),r.strokeStyle!==void 0&&this.hitDetectionInstructions.push([An.SET_STROKE_STYLE,Uo,r.lineWidth,r.lineCap,r.lineJoin,r.miterLimit,Wa,ja]);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,ks]),r.strokeStyle!==void 0&&this.hitDetectionInstructions.push([An.SET_STROKE_STYLE,Uo,r.lineWidth,r.lineCap,r.lineJoin,r.miterLimit,Wa,ja]);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]=Cd(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}},hN=uN;var fN=0,dN=1;function ace(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 v=p;p=x,x=v}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 v=p;p=x,x=v}if(p>u&&(u=p),x<f&&(f=x),u>f)return!1}return fN=u,dN=f,!0}function iH(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 v=0,w=e.length;v<w;++v){let S=e[v],T=i[x],R=i[x+1],P=!1;for(let C=x+t;C<S;C+=t){let L=i[C],D=i[C+1];if(ace(r,s,o,a,T,R,L,D)){let F=L-T,N=D-R,B=T+fN*F,z=R+fN*N,V=T+dN*F,H=R+dN*N;u&&P&&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,P=!0}T=L,R=D}x=S}return u&&c.push(l.length),{flatCoordinates:l,ends:c}}function rH(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 v=(i-a+x)/x,w=Fo(c,f,v),S=Fo(u,p,v);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 v=x-a,w=Fo(c,f,v/x),S=Fo(u,p,v/x);l.push(w,S),s.push(l),l=[w,S],a=0,o+=r}}return a>0&&s.push(l),s}function sH(i,e,t,n,r){let s=t,o=t,a=0,l=0,c=t,u,f,p,x,v,w,S,T,R,P;for(f=t;f<n;f+=r){let C=e[f],L=e[f+1];v!==void 0&&(R=C-v,P=L-w,x=Math.sqrt(R*R+P*P),S!==void 0&&(l+=p,u=Math.acos((S*R+T*P)/(p*x)),u>i&&(l>a&&(a=l,s=c,o=f),l=0,c=f-r)),p=x,S=R,T=P),v=C,w=L}return l+=x,l>a?[c,f]:[s,o]}var fy={left:0,center:.5,right:1,top:0,middle:.5,hanging:.2,alphabetic:.8,ideographic:.8,bottom:1},pN=class extends Bu{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[ks]={fillStyle:ks},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(!yr(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 R=0,P=T.length;R<P;++R)x.push(T[R][0])}if((c=="LineString"||c=="MultiLineString")&&!xu(this.getBufferedMaxExtent(),p)){let T=iH(u,x,f,this.getBufferedMaxExtent());if(u=T.flatCoordinates,x=T.ends,f=2,x.length===0)return}this.beginGeometry(e,t,n);let v=o.repeat,w=v?void 0:o.textAlign,S=0;for(let T=0,R=x.length;T<R;++T){let P;v?P=rH(v*this.resolution,u,S,x[T],f):P=[u.slice(S,x[T])];for(let C=0,L=P.length;C<L;++C){let D=P[C],F=0,N=D.length;if(w==null){let z=sH(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 v=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!=uf&&(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==uf?uf:S.map(function(C){return C*T}),v,w,this.text_,this.textKey_,this.strokeKey_,this.fillKey_,this.textOffsetX_,this.textOffsetY_,p]);let R=1/T,P=v?v.slice(0):null;P&&(P[1]=ks),this.hitDetectionInstructions.push([An.DRAW_IMAGE,l,x,null,NaN,NaN,NaN,1,0,0,this.textRotateWithView_,this.textRotation_,[R,R],NaN,this.declutterMode_,this.declutterImageWithText_,S,P,w,this.text_,this.textKey_,this.strokeKey_,this.fillKey_?ks: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||Nd,justify:t.justify,textBaseline:t.textBaseline||iA,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=fy[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&&ks,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=Ha(o.getColor()||ks)):(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(),R=a.getMiterLimit();s.lineCap=a.getLineCap()||Pu,s.lineDash=w?w.slice():Wa,s.lineDashOffset=S===void 0?ja:S,s.lineJoin=a.getLineJoin()||Iu,s.lineWidth=T===void 0?hf:T,s.miterLimit=R===void 0?cf:R,s.strokeStyle=Ha(a.getColor()||Uo)}n=this.textState_;let l=e.getFont()||fS;mV(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()||iA,n.backgroundFill=e.getBackgroundFill(),n.backgroundStroke=e.getBackgroundStroke(),n.padding=e.getPadding()||uf,n.scale=c===void 0?[1,1]:c;let u=e.getOffsetX(),f=e.getOffsetY(),p=e.getRotateWithView(),x=e.getKeepUpright(),v=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_=v===void 0?0:v,this.strokeKey_=s?(typeof s.strokeStyle=="string"?s.strokeStyle:Ln(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:"|"+Ln(r.fillStyle):""}this.declutterMode_=e.getDeclutterMode(),this.declutterImageWithText_=t}},oH=pN;var lce={Circle:hN,Default:Bu,Image:tH,LineString:nH,Polygon:hN,Text:oH},AN=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=lce[t];s=new o(this.tolerance_,this.maxExtent_,this.resolution_,this.pixelRatio_),r[t]=s}return s}},aH=AN;function lH(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 KS(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,v,w,S,T,R,P,C=0;for(let L=e;L<t;L+=n){v=p,w=x,S=void 0,T=void 0,L+n<t&&(S=i[L+n],T=i[L+n+1]),s&&L===e&&(v=u,w=f),s&&L===t-n&&(S=l,T=c),p=i[L],x=i[L+1],[R,P]=cce(p,x,v,w,S,T,r),o[C++]=R,o[C++]=P;for(let D=2;D<a;D++)o[C++]=i[L+D]}return o.length!=C&&(o.length=C),o}function cce(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=SG([i,e],[t,n],[r,s]);if(Math.cos(p)>.998)return[i+u*o,e+f*o];let x=Math.cos(p/2),v=Math.sin(p/2),w=v*a+x*l,S=-x*a+v*l,T=w*(1/v),R=S*(1/v);return[i+T*o,e+R*o]}function ZS(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],v=i[o+e+1],w=(v-p)*(c-a)-(x-f)*(u-l);if(w===0)continue;let S=((x-f)*(l-p)-(v-p)*(a-f))/w,T=((c-a)*(l-p)-(u-l)*(a-f))/w;if(S>0&&S<1&&T>0&&T<1){let R=a+S*(c-a),P=l+S*(u-l);i[n+e]=R,i[n+e+1]=P,i.splice(n+2*e,o-n-e);break}}}return i}var mN;function uce(){return mN||(mN=new Intl.Segmenter(void 0,{granularity:"grapheme"})),mN}function cH(i,e,t,n,r,s,o,a,l,c,u,f,p=!0){let x=i[e],v=i[e+1],w=0,S=0,T=0,R=0;function P(){w=x,S=v,e+=n,x=i[e],v=i[e+1],R+=T,T=Math.sqrt((x-w)*(x-w)+(v-S)*(v-S))}do P();while(e<t-n&&R+T<s);let C=T===0?0:(s-R)/T,L=Fo(w,x,C),D=Fo(S,v,C),F=e-n,N=R,B=s+a*l(c,r,u);for(;e<t-n&&R+T<B;)P();C=T===0?0:(B-R)/T;let z=Fo(w,x,C),V=Fo(S,v,C),H=!1;if(p)if(f){let ae=[L,D,z,V];Xw(ae,0,4,2,f,ae,ae),H=ae[0]>ae[2]}else H=L>z;let K=Math.PI,J=[],j=F+n===e;e=F,T=0,R=N,x=i[e],v=i[e+1];let Z;if(j){P(),Z=Math.atan2(v-S,x-w),H&&(Z+=Z>0?-K:K);let ae=(z+L)/2,ce=(V+D)/2;return J[0]=[ae,ce,(B-s)/2,Z,r],J}r=r.replace(/\n/g," ");let ee=Array.from(uce().segment(r),ae=>ae.segment);for(let ae=0,ce=ee.length;ae<ce;){P();let de=Math.atan2(v-S,x-w);if(H&&(de+=de>0?-K:K),Z!==void 0){let Me=de-Z;if(Me+=Me>K?-2*K:Me<-K?2*K:0,Math.abs(Me)>o)return null}Z=de;let be=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&&R+T<s+Ie+ze/2)break;Ie+=ze}if(ae===be)continue;let Qe=(H?ee.slice(ce-ae,ce-be):ee.slice(be,ae)).join("");C=T===0?0:(s+Ie/2-R)/T;let Ue=Fo(w,x,C),mt=Fo(S,v,C);J.push([Ue,mt,Ie/2,de,Qe]),s+=Ie}return J}var Yg=Pr(),Bd=[],xf=[],yf=[],Ud=[];function uH(i){return i[3].declutterBox}var hH=new RegExp("[\u0591-\u08FF\uFB1D-\uFDFF\uFE70-\uFEFC\u0800-\u0FFF\uE800-\uEFFF]");function gN(i,e){return e==="start"?e=hH.test(i)?"right":"left":e==="end"&&(e=hH.test(i)?"left":"right"),fy[e]}function hce(i,e,t){return t>0&&i.push(`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=_V(p,f);t.push(x),o+=x;let v=Fae(p);n.push(v),l=Math.max(l,v)}return{width:s,height:a,widths:t,heights:n,lineWidths:r}}function yV(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]),Oae(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 Oae(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 II=class i{constructor(e){this.opacity_=e.opacity,this.rotateWithView_=e.rotateWithView,this.rotation_=e.rotation,this.scale_=e.scale,this.scaleArray_=jr(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 Kn()}getImage(e){return Kn()}getHitDetectionImage(){return Kn()}getPixelRatio(e){return 1}getImageState(){return Kn()}getImageSize(){return Kn()}getOrigin(){return Kn()}getSize(){return Kn()}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_=jr(e)}listenImageChange(e){Kn()}load(){Kn()}unlistenImageChange(e){Kn()}ready(){return Promise.resolve()}},dS=II;var NI=class i extends dS{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=Bo.get(n,null)?.getImage(1);if(!r){let s=this.renderOptions_,o=Math.ceil(s.size*e),a=Ti(o,o);this.draw_(s,a,e),r=a.canvas;let l=new fV(r,void 0,null,Mn.LOADED,null);Bo.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,v=t/2*(u/f),S=Math.sqrt((r+x)*(r+x)+v*v)-r;if(this.radius2_===void 0||e==="bevel")return S*2;let T=r*Math.sin(a),R=Math.sqrt(r*r-T*T),P=s-R,L=Math.sqrt(T*T+P*P)/T;if(L<=n){let D=L*t/2-s-r;return 2*Math.max(S,D)}return S*2}createRenderOptions(){let e=Pu,t=Iu,n=0,r=null,s=0,o,a=0;this.stroke_&&(o=Ha(this.stroke_.getColor()??Uo),a=this.stroke_.getWidth()??hf,r=this.stroke_.getLineDash(),s=this.stroke_.getLineDashOffset()??0,t=this.stroke_.getLineJoin()??Iu,e=this.stroke_.getLineCap()??Pu,n=this.stroke_.getMiterLimit()??cf);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=ks),t.fillStyle=Ha(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=Yl(n)),n===null?r=1:Array.isArray(n)&&(r=n.length===4?n[3]:1),r===0&&(t=Ti(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=ks,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()}},pS=NI;var LI=class i extends pS{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}},AS=LI;var DI=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=Pd(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?Ln(e):typeof e=="object"&&"src"in e?e.src+":"+e.offset:Yl(e).toString():""}loading(){return!!this.patternImage_}ready(){return this.patternImage_?this.patternImage_.ready():Promise.resolve()}},$r=DI;function vV(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 FI=class i extends dS{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;Vn(!(a!==void 0&&o),"`image` and `src` cannot be provided at the same time"),(a===void 0||a.length===0)&&o&&(a=o.src||Ln(o)),Vn(a!==void 0&&a.length>0,"A defined and non-empty `src` or `image` must be provided"),Vn(!((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?Yl(e.color):null,this.iconImage_=Pd(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(vV(x[0],x[1],e.width,e.height))};this.listenImageChange(p);return}}c!==void 0&&this.setScale(vV(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?Yl(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_=Pd(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_=Pd(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()}},rA=FI;var OI=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}},fo=OI;var mS=class i{constructor(e){e=e||{},this.geometry_=null,this.geometryFunction_=bV,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_=bV,this.geometry_=e}setZIndex(e){this.zIndex_=e}};function wV(i){let e;if(typeof i=="function")e=i;else{let t;Array.isArray(i)?t=i:(Vn(typeof i.getZIndex=="function","Expected an `Style` or an array of `Style`"),t=[i]),e=function(){return t}}return e}var BI=null;function UI(i,e){if(!BI){let t=new $r({color:"rgba(255,255,255,0.4)"}),n=new fo({color:"#3399CC",width:1.25});BI=[new mS({image:new AS({fill:t,stroke:n,radius:5}),fill:t,stroke:n})]}return BI}function bV(i){return i.getGeometry()}var ws=mS;var Bae="#333",kI=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_=jr(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 $r({color:Bae}),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 $r?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_=jr(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}},ff=kI;function Kl(i,e){return(i.get("priority")||0)-(e.get("priority")||0)}function EV(i){let e=i.get("pin");return!e||Zl(e)||e.insideHighlightedZone||Fg(e)?null:GI(e,!1)}function MV(i){let e=i.get("pin");return!e||!U.highlightedZones.size||!e.insideHighlightedZone||Zl(e)||Fg(e)?null:GI(e,!1)}function CV(i){let e=i.get("pin");return!e||Zl(e)||!U.labelsHeld?null:LV(e)}function RV(i){let e=i.get("pin");if(!e||Zl(e)||e.insideHighlightedZone||Fg(e)||$x())return null;if(U.labelsHeld)return jx(e,!1);let t=U.fitZoom+Math.log2(zV(e.category));return(U.engine.getView().getZoom()||0)<t?null:jx(e,!1)}function PV(i){let e=i.get("pin");return!e||Zl(e)||e.insideHighlightedZone||Fg(e)||!$x()?null:jx(e,!1)}function IV(i){let e=i.get("pin");return!e||!U.highlightedZones.size||!e.insideHighlightedZone||Zl(e)||Fg(e)?null:jx(e,!1)}function NV(i){let e=i.get("pin");if(!e||Zl(e))return null;if(Ru(e.category)==="text")return jx(e,e===U.selectedPin);let t=GI(e,e===U.selectedPin);return e===U.hoveredPin||e===U.selectedPin?[t,LV(e)]:t}function GI(i,e){let t=`marker:${i.category.id}:${e?1:0}`;if(U.styleCache.has(t))return U.styleCache.get(t);let n=eA(i.category),r=e?2e7:i.priority,s=U.markerIcons.get(Xx(i.category)),o;return s?o=new ws({image:new rA({src:s,width:e?36:31,height:e?36:31}),zIndex:r}):o=new ws({text:new ff({text:Dc(i.category.title),font:`900 ${e?15:13}px Inter, sans-serif`,fill:new $r({color:n}),stroke:new fo({color:J0(),width:e?4:3})}),zIndex:r}),U.styleCache.set(t,o),o}function LV(i){let e=`marker-label:${i.location.id}`;if(U.styleCache.has(e))return U.styleCache.get(e);let t=new ws({text:new ff({text:i.location.title,offsetY:21,font:'700 10px "Arial Narrow", "Roboto Condensed", sans-serif',fill:new $r({color:"#f2ece0"}),stroke:new fo({color:"rgba(0,0,0,0.98)",width:3}),backgroundFill:new $r({color:"rgba(10,12,17,0.72)"}),padding:[2,4,2,4],overflow:!0}),zIndex:i.priority});return U.styleCache.set(e,t),t}function DV(i){if(!i.iconAsset)return;let e=Xx(i);if(U.markerIcons.has(e))return;U.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=eA(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=J0(),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),U.markerIcons.set(e,n.toDataURL("image/png")),Uae(),U.layers.pins.changed(),U.layers.zonePins.changed(),U.layers.priority.changed()},t.onerror=()=>U.markerIcons.set(e,!1),t.src=eI(i.iconAsset)}function Uae(){for(let i of U.styleCache.keys())i.startsWith("marker:")&&U.styleCache.delete(i)}function Xx(i){return`${i.iconAsset||""}:${eA(i)}:${U.world?.iconOutset||"light"}`}function jx(i,e){let t=`text:${i.location.id}:${e?1:0}`;if(U.styleCache.has(t))return U.styleCache.get(t);let r=[new ws({text:new ff({text:i.location.title,font:`${e?"900":"800"} 14px "Arial Narrow", "Roboto Condensed", sans-serif`,fill:new $r({color:e?"#7fd0ea":"#f2ece0"}),stroke:new fo({color:"rgba(0,0,0,0.95)",width:4}),backgroundFill:new $r({color:e?"rgba(13,16,23,0.9)":"rgba(10,12,17,0.58)"}),backgroundStroke:e?new fo({color:"#3aa5c9",width:1}):void 0,padding:[3,6,3,6],overflow:!0}),zIndex:e?2e7:i.priority+3e6})];return U.styleCache.set(t,r),r}function gS(i,e){return`${i} ${e}px ${Li.labelFont}`}function zI(i,e){let t=i.get("gridCell");if(!t)return null;let n=t.role==="neighbor",r=n?Li.neighborLabelSizePx:Li.labelSizePx,s=gS(900,r),o=n?[2,4,2,4]:[3,5,3,5],a=kae(t,s,r,o,e),l=sS(t,{subgridVisible:U.subgridVisible,labelled:a});if(!l)return null;let c=`grid:${t.hash}:${t.role}:${t.contextDistance}:${a?1:0}:${l.bare?1:0}`;if(U.styleCache.has(c))return U.styleCache.get(c);let u=t.role==="leaf"||t.role==="scope"?100:i.get("priority"),f=[new ws({fill:l.fill?new $r({color:af(l.fill.color,l.fill.opacity)}):void 0,stroke:new fo({color:af(l.line.color,l.line.opacity),width:l.line.widthPx}),zIndex:u})];if(l.label){let p=l.label.prefix?[l.label.prefix,gS(500,r),l.label.final,gS(900,r)]:l.label.final,x=Li.labelInsetPx*e;f.push(new ws({geometry:new Lc([t.extent[2]-x,t.extent[1]+x]),text:new ff({text:p,font:gS(900,r),textAlign:"right",textBaseline:"bottom",fill:new $r({color:af(l.label.color,l.label.textAlpha)}),backgroundFill:new $r({color:l.label.chip}),padding:o,overflow:!0}),zIndex:u+1}))}return U.styleCache.set(c,f),f}function kae(i,e,t,n,r){if(!r)return!0;let s=VI(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 SV=document.createElement("canvas").getContext("2d"),TV=new Map;function VI(i,e){let t=`${e}|${i}`,n=TV.get(t);return n===void 0&&(SV.font=e,n=SV.measureText(i).width,TV.set(t,n)),n}var Gae=new ws({fill:new $r({color:"rgba(5, 8, 16, 0.62)"})});function FV(){return U.zonesVisible?Gae:null}function OV(i){if(!U.zonesVisible)return null;let e=i.get("zone"),t=i.get("child"),n=U.highlightedZones.has(e.id),r=GV(e.id),s=`zone:${e.id}:${t?1:0}:${n?1:r?2:0}`;if(U.styleCache.has(s))return U.styleCache.get(s);let o=i.get("color");if(r){let c=new ws({stroke:new fo({color:af(o,t?.34:.44),width:t?1:1.3,lineDash:t?[3,4]:[7,5]}),zIndex:t?101:100});return U.styleCache.set(s,c),c}let a=new ws({fill:new $r({color:af(o,t?.035:.07)}),stroke:new fo({color:af(o,t?.5:.72),width:t?1.2:1.8,lineDash:t?[3,4]:[7,5]})});if(!n)return U.styleCache.set(s,a),a;let l=[new ws({stroke:new fo({color:"rgba(255,255,255,0.94)",width:5}),zIndex:9e3}),new ws({fill:new $r({color:af(o,.22)}),stroke:new fo({color:o,width:2.6}),zIndex:9001})];return U.styleCache.set(s,l),l}function BV(i){if(!U.zonesVisible||$x())return null;let e=i.get("child"),t=U.highlightedZones.has(i.get("zone").id),n=U.engine.getView().getZoom()||0;if(!t&&e&&n<U.fitZoom+3)return null;let r=i.get("span")/U.engine.getView().getResolution();return!t&&U.zoneTitleCount>40&&r<52?null:kV(i)}function UV(i){return!U.zonesVisible||!$x()?null:kV(i)}function kV(i){let e=i.get("child"),t=i.get("zone"),n=U.highlightedZones.has(t.id),r=GV(t.id),s=`zone-title:${t.id}:${e?1:0}:${n?1:r?2:0}`;if(U.styleCache.has(s))return U.styleCache.get(s);let o=i.get("color"),a=new ws({text:new ff({text:t.title.toLocaleUpperCase(),font:`${e?"700 12px":"800 14px"} "Arial Narrow", "Roboto Condensed", sans-serif`,fill:new $r({color:n?"#10131a":r?"rgba(196,191,177,0.56)":e?"#c8c2b4":"#f2ece0"}),stroke:new fo({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 $r({color:n?o:r?"rgba(8,11,18,0.84)":"rgba(13,16,23,0.72)"}),backgroundStroke:new fo({color:n?"#ffffff":af(o,r?.24:.55),width:n?2:1}),padding:[5,8,5,8],overflow:!0}),zIndex:n?91e5:i.get("priority")});return U.styleCache.set(s,a),a}function GV(i){if(!U.highlightedZones.size||U.highlightedZones.has(i))return!1;for(let e of U.highlightedZones)if(zae(i,e))return!1;return!0}function zae(i,e){let t=new Set,n=U.zoneRecords.get(e)?.zone.parentRegionId;for(;n!=null&&!t.has(n);){if(n===i)return!0;t.add(n),n=U.zoneRecords.get(n)?.zone.parentRegionId}return!1}function qI(){let i=(U.world.zones||[]).filter(jI);U.renderedShard=U.lens?.shard||0,U.sources.zones.clear(),U.sources.zoneTitles.clear(),U.zoneRecords.clear(),U.highlightedZones.clear(),U.focusedZoneID=null,U.zoneTitleCount=0,_S(!0),ye.zoneIndex.hidden=i.length===0,ye.zoneCount.textContent=Fc(i.length);for(let e of i){let t=Pr(),n=[],r=!1;for(let l of e.features||[]){let c=Hae(l);c&&(r=!0,n.push(c),mw(t,c.getExtent()),U.sources.zones.addFeature(new Td({geometry:c,zone:e,color:$w(e.id),child:e.parentRegionId!=null})))}if(!r)continue;let s=$w(e.id),o=e.center?Og(e.center.lat,e.center.lng):za(t),a=Math.max(t[2]-t[0],t[3]-t[1]);U.sources.zoneTitles.addFeature(new Td({geometry:new Lc(o),zone:e,color:s,child:e.parentRegionId!=null,span:a,priority:(e.parentRegionId==null?2e6:1e6)+Math.round(a)})),U.zoneRecords.set(e.id,{zone:e,extent:t.slice(),geometries:n,color:s})}U.zoneTitleCount=U.sources.zoneTitles.getFeatures().length,qV(),Vae()}function qV(){if(U.sources.zoneScrim.clear(),!U.highlightedZones.size)return;let[i,e,t,n]=U.projection.getExtent(),r=[VV([[i,e],[t,e],[t,n],[i,n],[i,e]],!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((c,u)=>{r.push(VV(c.getCoordinates(),u>0))})}U.sources.zoneScrim.addFeature(new Td({geometry:new Cu(r)}))}function VV(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 Vae(){let i=document.createDocumentFragment();for(let{zone:e,depth:t}of qae()){let n=U.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)}ye.zoneList.replaceChildren(i),ye.zoneIndex.hidden=U.zoneRecords.size===0}function qae(){let i=[...U.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 _S(i){U.zonesVisible=i,ye.zoneToggle.checked=i,U.layers.zoneScrim.setVisible(i),U.layers.zones.setVisible(i),U.layers.zoneTitles.setVisible(i),U.layers.zoneTitleDetail.setVisible(i)}function HV(i){let e=U.zoneRecords.get(i);e&&(U.focusedZoneID=i,jV(),Oc(),U.engine.getView().fit(e.extent,{size:U.engine.getSize(),padding:[54,54,54,54],maxZoom:Eu(U.lens),duration:220}),ye.sidebar.classList.remove("is-open"),ye.mobileLegend.setAttribute("aria-expanded","false"))}function WV(i){U.zoneRecords.has(i)&&(U.highlightedZones.has(i)?U.highlightedZones.delete(i):(U.highlightedZones.add(i),_S(!0)),U.hoveredPin=null,HI(),WI(),jV(),qV(),U.layers.zones.changed(),U.layers.zoneTitles.changed(),U.layers.zoneTitleDetail.changed())}function jV(){ye.zoneIndex.classList.toggle("has-highlights",U.highlightedZones.size>0);for(let i of ye.zoneList.querySelectorAll("[data-zone]")){let e=Number(i.dataset.zone),t=U.highlightedZones.has(e);i.classList.toggle("is-highlighted",t),i.classList.toggle("is-current",U.focusedZoneID===e),i.setAttribute("aria-pressed",String(t))}}function Hae(i){if(!i?.coordinates)return null;let e=([t,n])=>Og(n,t);return i.type==="Polygon"?new Cu(i.coordinates.map(t=>t.map(e))):i.type==="MultiPolygon"?new nS(i.coordinates.map(t=>t.map(n=>n.map(e)))):null}function Og(i,e){let t=Wae(),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 Wae(){let i=U.volume.tileGrid,e=U.world?.grid;return e?{...i,...e}:i}function XV(){U.sources.pins.clear(),U.sources.text.clear(),U.sources.priority.clear(),U.pins=[],U.pinByID.clear();for(let i of U.world.groups)for(let e of i.categories){Ru(e)!=="text"&&DV(e);for(let t of e.locations){let n={location:t,category:e,group:i,coordinate:Og(t.lat,t.lng),filteredHidden:!1,priority:Yae(e,t),feature:null};n.feature=new Td({geometry:new Lc(n.coordinate),pin:n,priority:n.priority}),U.pins.push(n),U.pinByID.set(t.id,n),Ru(e)==="text"?U.sources.text.addFeature(n.feature):U.sources.pins.addFeature(n.feature)}}$l()}function $l(){for(let i of U.pins){let e=U.hiddenCategories.has(i.category.id),t=U.search&&!i.location.title.toLocaleLowerCase().includes(U.search);i.filteredHidden=!!(e||t)}HI(),WI(),U.selectedPin?.filteredHidden&&Oc(),Ed(),document.dispatchEvent(new Event("atlas:filters"))}function HI(){if(!U.highlightedZones.size){for(let e of U.pins)e.insideHighlightedZone=!1;return}let i=[...U.highlightedZones].map(e=>U.zoneRecords.get(e)).filter(Boolean);for(let e of U.pins)e.insideHighlightedZone=i.some(t=>t.geometries.some(n=>jae(n,e.coordinate)))}function jae(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 WI(){U.eligibleLocations=U.pins.filter(i=>!Zl(i)).length,Tu(),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(),sA()}function Tu(){U.sources.priority.clear();for(let i of U.pins){if(Zl(i))continue;let e=!!U.search&&i.location.title.toLocaleLowerCase().includes(U.search);(i===U.selectedPin||i===U.hoveredPin||e||Rd(i))&&U.sources.priority.addFeature(i.feature)}}function Bg(i){U.hoveredPin!==i&&(U.hoveredPin=i,U.sources&&(Tu(),U.layers.pins.changed(),U.layers.priority.changed()))}function xS(i){U.labelsHeld!==i&&(U.labelsHeld=i,ye.labelsHint.textContent=i?"Z \xB7 labels shown":"Z \xB7 hold for labels",U.layers.pinLabels.changed(),U.layers.text.changed(),document.dispatchEvent(new Event("atlas:labels")))}function Fg(i){return i===U.selectedPin||i===U.hoveredPin||Rd(i)||!!U.search&&i.location.title.toLocaleLowerCase().includes(U.search)}function Zl(i){return i.filteredHidden||Xae(i)||$ae(i)||!jI(i.location)}function jI(i){let e=U.lens?.shard;return!e||!i.shard||i.shard===e}function Xae(i){return!U.highlightedZones.size||i.insideHighlightedZone||i===U.selectedPin?!1:!(U.search&&i.location.title.toLocaleLowerCase().includes(U.search))}function $ae(i){return!U.gridEnabled||!U.gridCell||Rd(i)||i===U.selectedPin?!1:!(U.search&&i.location.title.toLocaleLowerCase().includes(U.search))}function Yae(i,e){return Math.max(0,1e6-Math.min(i.locations.length,999)*1e3)+qz(e.id)%1e3}function zV(i){return i.locations.length>200?4:i.locations.length>75?2.5:1}function $x(){return(U.engine?.getView().getZoom()||0)>=(U.lens?.maxZoom||0)-.05}function $V(i){let e=[],t=[];for(let n of i){let r=[];for(let s of n.categories)(Ru(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 YV(){let i=document.createDocumentFragment();for(let e of U.world.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(Kae(e.key,e.title,n));let r=document.createElement("div");r.className="category-toggles";for(let s of e.categories)r.append(Zae(s));t.append(r),i.append(t)}ye.legend.replaceChildren(i),yS(),Md()}function Kae(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=Fc(t),r.append(s,o,a);let l=KV(`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 KV(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 Zae(i){let e=Ru(i)==="text",t=document.createElement("label");t.className="category-row",Ig(t,i);let n=document.createElement("input");n.type="checkbox",n.dataset.category=String(i.id),n.checked=!U.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",Ng(r,i,Dc(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=Fc(i.locations.length);let a=KV(`Show only ${i.title}`);return a.dataset.onlyCategory=String(i.id),t.append(n,r,s,a,o),t}function XI(i){if(U.collapsedSections.clear(),i)for(let e of ye.layers.querySelectorAll("[data-section]"))U.collapsedSections.add(e.dataset.section);yS()}function yS(){for(let i of ye.layers.querySelectorAll("[data-section]")){let e=U.collapsedSections.has(i.dataset.section);i.setAttribute("aria-expanded",String(!e)),i.closest(".layer-section").classList.toggle("is-collapsed",e)}Nc()}function Yx(i){if(U.hiddenCategories.clear(),!i)for(let e of U.world.groups)for(let t of e.categories)U.hiddenCategories.add(t.id);Lx(),$l(),Ed(),Md()}function Lx(){for(let i of document.querySelectorAll("[data-category]"))i.checked=!U.hiddenCategories.has(Number(i.dataset.category))}function ZV(i){let e=U.world.sections.find(n=>n.key===i);if(!e)return;let t=e.categories.some(n=>!U.hiddenCategories.has(n.id));for(let n of e.categories)t?U.hiddenCategories.add(n.id):U.hiddenCategories.delete(n.id);Lx(),$l(),Md()}function QV(i){if(U.world){if(Qae(i)){Yx(!0);return}U.hiddenCategories.clear();for(let e of U.world.sections){let t=i.section===e.key;for(let n of e.categories)!t&&i.category!==n.id&&U.hiddenCategories.add(n.id)}Lx(),$l(),Ed(),Md()}}function Qae(i){for(let e of U.world.sections)for(let t of e.categories)if((i.section===e.key||i.category===t.id)===U.hiddenCategories.has(t.id))return!1;return!0}function Jae(){let i=ye.soloChip;if(!U.world){i.hidden=!0;return}let e=null,t=0,n=null,r=0;for(let o of U.world.sections){let a=0;for(let l of o.categories)U.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 Md(){if(U.world){for(let i of U.world.sections){let e=ye.legend.querySelector(`input[data-section-toggle="${i.key}"]`);e&&(e.checked=i.categories.some(t=>!U.hiddenCategories.has(t.id)))}Jae(),Nc()}}async function JV(i){let[e,t]=await Promise.all([fetch(`${U.volume.base}/worlds/${i.slug}.json`),fetch(`${U.volume.base}/worlds/${i.slug}.bin`)]);if(!e.ok||!t.ok)throw new Error(`world ${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 ele(r,s),{...i,grid:n.grid,lenses:n.lenses,groups:n.groups,zones:n.zones||[],attrs:n.attrs||{},merged:n.merged||[],sections:$V(n.groups)}}function ele(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),v=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(v.subarray(p[S],p[S+1])),lat:l[S],lng:c[S],regionId:u[S]||void 0,shard:f[S]||void 0})}async function jz(){let i=`${U.volume.base}/${U.world.slug}`;return U.textByMap.has(i)||U.textByMap.set(i,fetch(`${U.volume.base}/worlds/${U.world.slug}.text`).then(e=>e.json()).catch(()=>({}))),U.textByMap.get(i)}var vS=null;function oA(){return vS||(vS=tle().finally(()=>{vS=null})),vS}async function tle(){let i=await fetch("/data/catalog.json");if(!i.ok)return;let e=U.volume;if(U.catalog=await i.json(),B0(ye.volume,U.catalog.volumes,"title"),$I(),!U.catalog.volumes.length)return;let t=e&&U.catalog.volumes.find(n=>n.slug===e.slug);if(!t){let n=Pg();await df(n.volume||Rg()?.volume||U.catalog.volumes[0].slug,n.volume?n.world:void 0);return}if(t.stamp!==e.stamp){for(let r of U.textByMap.keys())r.startsWith(e.base+"/")&&U.textByMap.delete(r);let n=U.engine?.getView();U.restore={volume:t.slug,world:U.world?.slug,lens:U.world?U.world.lenses.indexOf(U.lens):0,center:n?.getCenter(),zoom:n?.getZoom(),hidden:[...U.hiddenCategories],collapsed:[...U.collapsedSections],overviewDocked:U.overviewDocked,dockFolded:U.dockFolded,dockDismissed:U.dockDismissed},await df(t.slug,U.world?.slug);return}U.volume=t,ye.volume.value=t.slug}function $I(){let i=!U.catalog?.volumes?.length;ye.emptyState.hidden=!i,U.catalog?.bundlesDir&&(ye.emptyPath.textContent=U.catalog.bundlesDir)}async function YI(){for(let i of[ye.emptyOpen,ye.addBundles])i.disabled=!0;try{let e=await(await fetch("/data/bundles/import",{method:"POST"})).json().catch(()=>({}));await oA();let t=e.imported?.[0];t&&U.catalog.volumes.some(n=>n.slug===t)&&await df(t)}finally{for(let i of[ye.emptyOpen,ye.addBundles])i.disabled=!1}}var Qs={ADD:"add",REMOVE:"remove"};var eq={LENGTH:"length"},Ug=class extends Ks{constructor(e,t,n){super(e),this.element=t,this.index=n}},KI=class extends bs{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(eq.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 Ug(Qs.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 Ug(Qs.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 Ug(Qs.REMOVE,r,e)),this.dispatchEvent(new Ug(Qs.ADD,t,e))}updateLength_(){this.set(eq.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")}},po=KI;var ZI=class extends Ks{constructor(e,t,n){super(e),this.map=t,this.frameState=n!==void 0?n:null}},Ld=ZI;var QI=class extends Ld{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()}},Nu=QI;var rr={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 Kx={POINTERMOVE:"pointermove",POINTERDOWN:"pointerdown",POINTERUP:"pointerup",POINTEROVER:"pointerover",POINTEROUT:"pointerout",POINTERENTER:"pointerenter",POINTERLEAVE:"pointerleave",POINTERCANCEL:"pointercancel"};var JI=class extends Sd{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_=kn(n,Kx.POINTERDOWN,this.handlePointerDown_,this),this.originalPointerMoveEvent_,this.relayedListenerKey_=kn(n,Kx.POINTERMOVE,this.relayMoveEvent_,this),this.boundHandleTouchMove_=this.handleTouchMove_.bind(this),this.element_.addEventListener(Jt.TOUCHMOVE,this.boundHandleTouchMove_,Ow?{passive:!1}:!1)}emulateClick_(e){let t=new Nu(rr.CLICK,this.map_,e);this.dispatchEvent(t),this.clickTimeoutId_!==void 0?(clearTimeout(this.clickTimeoutId_),this.clickTimeoutId_=void 0,t=new Nu(rr.DBLCLICK,this.map_,e),this.dispatchEvent(t)):this.clickTimeoutId_=setTimeout(()=>{this.clickTimeoutId_=void 0;let n=new Nu(rr.SINGLECLICK,this.map_,e);this.dispatchEvent(n)},250)}updateActivePointers_(e){let t=e,n=t.pointerId;if(t.type==rr.POINTERUP||t.type==rr.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==rr.POINTERDOWN||t.type==rr.POINTERMOVE)&&(this.trackedTouches_[n]=t);this.activePointers_=Object.values(this.trackedTouches_)}handlePointerUp_(e){this.updateActivePointers_(e);let t=new Nu(rr.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(ri),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 Nu(rr.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(kn(n,rr.POINTERMOVE,this.handlePointerMove_,this),kn(n,rr.POINTERUP,this.handlePointerUp_,this),kn(this.element_,rr.POINTERCANCEL,this.handlePointerUp_,this)),this.element_.getRootNode&&this.element_.getRootNode()!==n&&this.dragListenerKeys_.push(kn(this.element_.getRootNode(),rr.POINTERUP,this.handlePointerUp_,this))}}handlePointerMove_(e){if(this.isMoving_(e)){this.updateActivePointers_(e),this.dragging_=!0;let t=new Nu(rr.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 Nu(rr.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_&&(ri(this.relayedListenerKey_),this.relayedListenerKey_=null),this.element_.removeEventListener(Jt.TOUCHMOVE,this.boundHandleTouchMove_),this.pointerdownListenerKey_&&(ri(this.pointerdownListenerKey_),this.pointerdownListenerKey_=null),this.dragListenerKeys_.forEach(ri),this.dragListenerKeys_.length=0,this.element_=null,super.disposeInternal()}},tq=JI;var Lu={POSTRENDER:"postrender",MOVESTART:"movestart",MOVEEND:"moveend",LOADSTART:"loadstart",LOADEND:"loadend"};var Ao={LAYERGROUP:"layergroup",SIZE:"size",TARGET:"target",VIEW:"view"};var Zx=1/0,e5=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,wu(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){Vn(!(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!=Zx?(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==Zx?delete this.queuedElements_[this.keyFunction_(o)]:(n[r]=l,t[r++]=o);t.length=r,n.length=r,this.heapify_()}},nq=e5;var t5=class extends nq{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())}}},iq=t5;function rq(i,e,t,n,r){if(!i||!(t in i.wantedTiles))return Zx;if(!i.wantedTiles[t][e.getKey()])return Zx;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 Gs={ANIMATING:0,INTERACTING:1};var Ql={CENTER:"center",RESOLUTION:"resolution",ROTATION:"rotation"};function n5(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,v=i[1]+c/2+f,w=i[3]-c/2+f;p>x&&(p=(x+p)/2,x=p),v>w&&(v=(w+v)/2,w=v);let S=xi(n[0],p,x),T=xi(n[1],v,w);if(o&&t&&r){let R=30*r;S+=-R*Math.log(1+Math.max(0,p-n[0])/R)+R*Math.log(1+Math.max(0,n[0]-x)/R),T+=-R*Math.log(1+Math.max(0,v-n[1])/R)+R*Math.log(1+Math.max(0,n[1]-w)/R)}return[S,T]})}function sq(i){return i}function i5(i,e,t,n){let r=jn(e)/t[0],s=xr(e)/t[1];return n?Math.min(i,Math.max(r,s)):Math.min(i,Math.min(r,s))}function r5(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),xi(n,t/2,e*2)}function oq(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?i5(l,t,o,n):l;if(a)return e?r5(r,u,c):xi(r,c,u);let f=Math.min(u,r),p=Math.floor(bg(i,f,s));return i[p]>u&&p<i.length-1?i[p+1]:i[p]}})}function aq(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?i5(e,r,l,s):e;if(c)return n?r5(o,u,t):xi(o,t,u);let f=1e-9,p=Math.ceil(Math.log(e/u)/Math.log(i)-f),x=-a*(.5-f)+.5,v=Math.min(u,o),w=Math.floor(Math.log(e/v)/Math.log(i)+x),S=Math.max(p,w),T=e/Math.pow(i,S);return xi(T,t,u)}})}function s5(i,e,t,n,r){return t=t!==void 0?t:!0,(function(s,o,a,l){if(s!==void 0){let c=n?i5(i,n,a,r):i;return!t||!l?xi(s,e,c):r5(s,c,e)}})}function kg(i){if(i!==void 0)return 0}function o5(i){if(i!==void 0)return i}function lq(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 cq(i){let e=i===void 0?Tc(5):i;return(function(t,n){return n||t===void 0?t:Math.abs(t)<=e?0:t})}var a5=0,c5=class extends bs{constructor(e){super(),this.on,this.once,this.un,e=Object.assign({},e),this.hints_=[0,0],this.animations_=[],this.updateAnimationKey_,this.projection_=Rw(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&&VG(),e.center&&(e.center=Cc(e.center,this.projection_)),e.extent&&(e.extent=Rc(e.extent,this.projection_)),this.applyOptions_(e)}applyOptions_(e){let t=Object.assign({},e);for(let a in Ql)delete t[a];this.setProperties(t,!0);let n=ile(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=nle(e),s=n.constraint,o=rle(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=Cc(r.center,this.getProjection())),r.anchor&&(r=Object.assign({},r),r.anchor=Cc(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&&bS(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||fz,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=bu(u.rotation-l+Math.PI,2*Math.PI)-Math.PI;f.targetRotation=l+p,l=f.targetRotation}sle(f)?f.complete=!0:s+=f.duration,c.push(f)}this.animations_.push(c),this.setHint(Gs.ANIMATING,1),this.updateAnimations_()}getAnimating(){return this.hints_[Gs.ANIMATING]>0}getInteracting(){return this.hints_[Gs.INTERACTING]>0}cancelAnimations(){this.setHint(Gs.ANIMATING,-this.hints_[Gs.ANIMATING]);let e;for(let t=0,n=this.animations_.length;t<n;++t){let r=this.animations_[t];if(r[0].callback&&bS(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],v=l.targetCenter[0],w=l.targetCenter[1];this.nextCenter_=l.targetCenter;let S=p+f*(v-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()),v=this.constraints_.resolution(p,0,x,!0);this.targetCenter_=this.calculateCenterZoom(v,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?bu(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(Gs.ANIMATING,-1),this.nextCenter_=null,this.nextResolution_=NaN,this.nextRotation_=NaN;let o=r[0].callback;o&&bS(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]],Ag(n,e-this.getRotation()),vG(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&&Mx(e,this.getProjection())}getCenterInternal(){return this.get(Ql.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 yd(t,this.getProjection())}calculateExtentInternal(e){e=e||this.getViewportSizeMinusPadding_();let t=this.getCenterInternal();Vn(t,"The view center is not defined");let n=this.getResolution();Vn(n!==void 0,"The view resolution is not defined");let r=this.getRotation();return Vn(r!==void 0,"The view rotation is not defined"),wx(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(Ql.RESOLUTION)}getResolutions(){return this.resolutions_}getResolutionForExtent(e,t){return this.getResolutionForExtentInternal(Rc(e,this.getProjection()),t)}getResolutionForExtentInternal(e,t){t=t||this.getViewportSizeMinusPadding_();let n=jn(e)/t[0],r=xr(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(Ql.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=l5(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=bg(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=xi(Math.floor(e),0,this.resolutions_.length-2),n=this.resolutions_[t]/this.resolutions_[t+1];return this.resolutions_[t]/Math.pow(n,xi(e-t,0,1))}return this.maxResolution_/Math.pow(this.zoomFactor_,e-this.minZoom_)}fit(e,t){let n;if(Vn(Array.isArray(e)||typeof e.getSimplifiedGeometry=="function","Invalid extent or geometry provided as `geometry`"),Array.isArray(e)){Vn(!vu(e),"Cannot fit empty extent provided as `geometry`");let r=Rc(e,this.getProjection());n=AI(r)}else if(e.getType()==="Circle"){let r=Rc(e.getExtent(),this.getProjection());n=AI(r),n.rotate(this.getRotation(),za(r))}else{let r=$0();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,v=s[f]*r+s[f+1]*n;a=Math.min(a,x),l=Math.min(l,v),c=Math.max(c,x),u=Math.max(u,v)}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=za(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,v=p[1]*f+p[0]*u,w=this.getConstrainedCenter([x,v],l),S=t.callback?t.callback:of;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),bS(S,!0))}centerOn(e,t,n){this.centerOnInternal(Cc(e,this.getProjection()),t,n)}centerOnInternal(e,t,n){this.setCenterInternal(l5(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=l5(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=Mx(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&&Cc(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=Cc(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&&Cc(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(Ql.ROTATION)!==r&&this.set(Ql.ROTATION,r),this.get(Ql.RESOLUTION)!==o&&(this.set(Ql.RESOLUTION,o),this.set("zoom",this.getZoom(),!0)),(!a||!this.get(Ql.CENTER)||!H0(this.get(Ql.CENTER),a))&&this.set(Ql.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()||!H0(this.getCenterInternal(),l))&&(this.getAnimating()&&this.cancelAnimations(),this.animateInternal({rotation:s,center:l,resolution:a,duration:e,easing:Xl,anchor:n}))}beginInteraction(){this.resolveConstraints(0),this.setHint(Gs.INTERACTING,1)}endInteraction(e,t,n){n=n&&Cc(n,this.getProjection()),this.endInteractionInternal(e,t,n)}endInteractionInternal(e,t,n){this.getInteracting()&&(this.setHint(Gs.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 bS(i,e){setTimeout(function(){i(e)},0)}function nle(i){if(i.extent!==void 0){let t=i.smoothExtentConstraint!==void 0?i.smoothExtentConstraint:!0;return n5(i.extent,i.constrainOnlyCenter,t)}let e=Rw(i.projection,"EPSG:3857");if(i.multiWorld!==!0&&e.isGlobal()){let t=e.getExtent().slice();return t[0]=-1/0,t[2]=1/0,n5(t,!1,!1)}return sq}function ile(i){let e,t,n,o=i.minZoom!==void 0?i.minZoom:a5,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=Rw(i.projection,"EPSG:3857"),x=p.getExtent(),v=i.constrainOnlyCenter,w=i.extent;if(!c&&!w&&p.isGlobal()&&(v=!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=oq(S,u,!v&&w,f):e=s5(t,n,u,!v&&w,f)}else{let T=(x?Math.max(jn(x),xr(x)):360*tf.degrees/p.getMetersPerUnit())/256/Math.pow(2,a5),R=T/Math.pow(2,28-a5);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=R),a=o+Math.floor(Math.log(t/n)/Math.log(l)),n=t/Math.pow(l,a-o),i.constrainResolution?e=aq(l,t,n,u,!v&&w,f):e=s5(t,n,u,!v&&w,f)}return{constraint:e,maxResolution:t,minResolution:n,minZoom:o,zoomFactor:l}}function rle(i){if(i.enableRotation!==void 0?i.enableRotation:!0){let t=i.constrainRotation;return t===void 0||t===!0?cq():t===!1?o5:typeof t=="number"?lq(t):o5}return kg}function sle(i){return!(i.sourceCenter&&i.targetCenter&&!H0(i.sourceCenter,i.targetCenter)||i.sourceResolution!==i.targetResolution||i.sourceRotation!==i.targetRotation)}function l5(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 Al=c5;var u5=class extends bs{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)ri(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!==of&&this.listenerKeys.push(kn(e,Lu.POSTRENDER,this.render,this)),e.render()}}render(e){}setTarget(e){this.target_=typeof e=="string"?document.getElementById(e):e}},Gg=u5;var h5=class extends Gg{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+" "+Id+" "+Dg+(this.collapsed_&&this.collapsible_?" "+CI:"")+(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=>az(()=>r))),n=t.length>0;if(this.renderedVisible_!=n&&(this.element.style.display=n?"":"none",this.renderedVisible_=n),!Oo(t,this.renderedAttributions_)){pz(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(CI),this.collapsed_?BP(this.collapseLabel_,this.label_):BP(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)}},uq=h5;var f5=class extends Gg{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+" "+Id+" "+Dg,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(Hx)}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:Xl}):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(Hx);!s&&n===0?this.element.classList.add(Hx):s&&n!==0&&this.element.classList.remove(Hx)}this.label_.style.transform=r}this.rotation_=n}},hq=f5;var d5=class extends Gg{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+" "+Id+" "+Dg,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:Xl})):n.setZoom(s)}}},fq=d5;function wS(i){i=i||{};let e=new po;return(i.zoom===void 0||i.zoom)&&e.push(new fq(i.zoomOptions)),(i.rotate===void 0||i.rotate)&&e.push(new hq(i.rotateOptions)),(i.attribution===void 0||i.attribution)&&e.push(new uq(i.attributionOptions)),e}var p5=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_}},dq=p5;var A5={ACTIVE:"active"};var m5=class extends bs{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(A5.ACTIVE)}getMap(){return this.map_}handleEvent(e){return!0}setActive(e){this.set(A5.ACTIVE,e)}setMap(e){this.map_=e}};function pq(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:dz,center:i.getConstrainedCenter(r)})}}function zg(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:Xl})}var Du=m5;var g5=class extends Du{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==rr.DBLCLICK){let n=e.originalEvent,r=e.map,s=e.coordinate,o=n.shiftKey?-this.delta_:this.delta_,a=r.getView();zg(a,o,s,this.duration_),n.preventDefault(),t=!0}return!t}},Aq=g5;function Qx(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 mq=function(i){let e=i.originalEvent;return e.altKey&&!(e.metaKey||e.ctrlKey)&&e.shiftKey},ole=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)},SS=function(i){let e=i.map.getTargetElement(),t=e.getRootNode();return(t instanceof ShadowRoot?t.host:e).hasAttribute("tabindex")?ole(i):!0},gq=rf;var TS=function(i){let e=i.originalEvent;return"pointerId"in e&&e.button==0&&!(lz&&NP&&e.ctrlKey)};var ES=function(i){let e=i.originalEvent;return!e.altKey&&!(e.metaKey||e.ctrlKey)&&!e.shiftKey};var _q=function(i){let e=i.originalEvent;return NP?e.metaKey:e.ctrlKey},xq=function(i){let e=i.originalEvent;return!e.altKey&&!(e.metaKey||e.ctrlKey)&&e.shiftKey},MS=function(i){let e=i.originalEvent,t=e.target.tagName;return t!=="INPUT"&&t!=="SELECT"&&t!=="TEXTAREA"&&!e.target.isContentEditable},CS=function(i){let e=i.originalEvent;return"pointerId"in e&&e.pointerType=="mouse"};var yq=function(i){let e=i.originalEvent;return"pointerId"in e&&e.isPrimary&&e.button===0};var _5=class extends Du{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==rr.POINTERDRAG)this.handleDragEvent(e),e.originalEvent.preventDefault();else if(e.type==rr.POINTERUP){let n=this.handleUpEvent(e);this.handlingDownUpSequence=n&&this.targetPointers.length>0}}else if(e.type==rr.POINTERDOWN){let n=this.handleDownEvent(e);this.handlingDownUpSequence=n,t=this.stopDown(n)}else e.type==rr.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 Vg(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 Fu=_5;var x5=class extends Fu{constructor(e){super({stopDown:sf}),e=e||{},this.kinetic_=e.kinetic,this.lastCentroid=null,this.lastPointersCount_,this.panning_=!1;let t=e.condition?e.condition:Qx(ES,yq);this.condition_=e.onFocusOnly?Qx(SS,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(Vg(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();bG(s,a.getResolution()),Ag(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:Xl})}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}},vq=x5;var y5=class extends Fu{constructor(e){e=e||{},super({stopDown:sf}),this.condition_=e.condition?e.condition:mq,this.lastAngle_=void 0,this.duration_=e.duration!==void 0?e.duration:250}handleDragEvent(e){if(!CS(e))return;let t=e.map,n=t.getView();if(n.getConstraints().rotation===kg)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 CS(e)?(e.map.getView().endInteraction(this.duration_),!1):!0}handleDownEvent(e){return CS(e)&&TS(e)&&this.condition_(e)?(e.map.getView().beginInteraction(),this.lastAngle_=void 0,!0):!1}},bq=y5;var v5=class extends wd{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 Cu([r])}getGeometry(){return this.geometry_}},wq=v5;var qg={BOXSTART:"boxstart",BOXDRAG:"boxdrag",BOXEND:"boxend",BOXCANCEL:"boxcancel"},aA=class extends Ks{constructor(e,t,n){super(e),this.coordinate=t,this.mapBrowserEvent=n}},b5=class extends Fu{constructor(e){super(),this.on,this.once,this.un,e=e??{},this.box_=new wq(e.className||"ol-dragbox"),this.minArea_=e.minArea??64,e.onBoxEnd&&(this.onBoxEnd=e.onBoxEnd),this.startPixel_=null,this.condition_=e.condition??TS,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 aA(qg.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 aA(t?qg.BOXEND:qg.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 aA(qg.BOXSTART,e.coordinate,e)),!0):!1}onBoxEnd(e){}setActive(e){e||(this.box_.setMap(null),this.startPixel_&&(this.dispatchEvent(new aA(qg.BOXCANCEL,this.startPixel_,null)),this.startPixel_=null)),super.setActive(e)}setMap(e){this.getMap()&&(this.box_.setMap(null),this.startPixel_&&(this.dispatchEvent(new aA(qg.BOXCANCEL,this.startPixel_,null)),this.startPixel_=null)),super.setMap(e)}},Sq=b5;var w5=class extends Sq{constructor(e){e=e||{};let t=e.condition?e.condition:xq;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:Xl})}},Tq=w5;var Dd={LEFT:"ArrowLeft",UP:"ArrowUp",RIGHT:"ArrowRight",DOWN:"ArrowDown"};var S5=class extends Du{constructor(e){super(),e=e||{},this.defaultCondition_=function(t){return ES(t)&&MS(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==Dd.DOWN||r==Dd.LEFT||r==Dd.RIGHT||r==Dd.UP)){let o=e.map.getView(),a=o.getResolution()*this.pixelDelta_,l=0,c=0;r==Dd.DOWN?c=-a:r==Dd.LEFT?l=-a:r==Dd.RIGHT?l=a:c=a;let u=[l,c];Ag(u,o.getRotation()),pq(o,u,this.duration_),n.preventDefault(),t=!0}}return!t}},Eq=S5;var T5=class extends Du{constructor(e){super(),e=e||{},this.condition_=e.condition?e.condition:function(t){return!_q(t)&&MS(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();zg(a,o,void 0,this.duration_),n.preventDefault(),t=!0}}return!t}},Mq=T5;var ale=40,lle=300,cle=3,E5=class extends Du{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:gq;this.condition_=e.onFocusOnly?Qx(SS,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(ri),this.ctrlKeyListenerKeys_.length=0,this.ctrlKeyPressed_=!1,super.setMap(e),e){let t=e.getOwnerDocument();this.ctrlKeyListenerKeys_.push(kn(t,"keydown",n=>{n.key==="Control"&&(this.ctrlKeyPressed_=!0)}),kn(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*=ale;break;case WheelEvent.DOM_DELTA_PAGE:o*=lle;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*cle),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=-xi(this.totalDelta_,-this.maxDelta_*this.deltaPerZoom_,this.maxDelta_*this.deltaPerZoom_)/this.deltaPerZoom_;(t.getConstrainResolution()||this.constrainResolution_)&&(n=n?n>0?1:-1:0),zg(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)}},Cq=E5;var M5=class extends Fu{constructor(e){e=e||{};let t=e;t.stopDown||(t.stopDown=sf),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!==kg&&(this.anchor_=o.getCoordinateFromPixelInternal(o.getEventPixel(Vg(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}},Rq=M5;var C5=class extends Fu{constructor(e){e=e||{};let t=e;t.stopDown||(t.stopDown=sf),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(Vg(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}},Pq=C5;function RS(i){i=i||{};let e=new po,t=new dq(-.005,.05,100);return(i.altShiftDragRotate===void 0||i.altShiftDragRotate)&&e.push(new bq),(i.doubleClickZoom===void 0||i.doubleClickZoom)&&e.push(new Aq({delta:i.zoomDelta,duration:i.zoomDuration})),(i.dragPan===void 0||i.dragPan)&&e.push(new vq({onFocusOnly:i.onFocusOnly,kinetic:t})),(i.pinchRotate===void 0||i.pinchRotate)&&e.push(new Rq),(i.pinchZoom===void 0||i.pinchZoom)&&e.push(new Pq({duration:i.zoomDuration})),(i.keyboard===void 0||i.keyboard)&&(e.push(new Eq),e.push(new Mq({delta:i.zoomDelta,duration:i.zoomDuration}))),(i.mouseWheelZoom===void 0||i.mouseWheelZoom)&&e.push(new Cq({onFocusOnly:i.onFocusOnly,duration:i.zoomDuration})),(i.shiftDragZoom===void 0||i.shiftDragZoom)&&e.push(new Tq({duration:i.zoomDuration})),e}var Ei={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 R5=class extends bs{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[Ei.OPACITY]=e.opacity!==void 0?e.opacity:1,Vn(typeof t[Ei.OPACITY]=="number","Layer opacity must be a number"),t[Ei.VISIBLE]=e.visible!==void 0?e.visible:!0,t[Ei.Z_INDEX]=e.zIndex,t[Ei.MAX_RESOLUTION]=e.maxResolution!==void 0?e.maxResolution:1/0,t[Ei.MIN_RESOLUTION]=e.minResolution!==void 0?e.minResolution:0,t[Ei.MIN_ZOOM]=e.minZoom!==void 0?e.minZoom:-1/0,t[Ei.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=xi(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 Kn()}getLayerStatesArray(e){return Kn()}getExtent(){return this.get(Ei.EXTENT)}getMaxResolution(){return this.get(Ei.MAX_RESOLUTION)}getMinResolution(){return this.get(Ei.MIN_RESOLUTION)}getMinZoom(){return this.get(Ei.MIN_ZOOM)}getMaxZoom(){return this.get(Ei.MAX_ZOOM)}getOpacity(){return this.get(Ei.OPACITY)}getSourceState(){return Kn()}getVisible(){return this.get(Ei.VISIBLE)}getZIndex(){return this.get(Ei.Z_INDEX)}setBackground(e){this.background_=e,this.changed()}setExtent(e){this.set(Ei.EXTENT,e)}setMaxResolution(e){this.set(Ei.MAX_RESOLUTION,e)}setMinResolution(e){this.set(Ei.MIN_RESOLUTION,e)}setMaxZoom(e){this.set(Ei.MAX_ZOOM,e)}setMinZoom(e){this.set(Ei.MIN_ZOOM,e)}setOpacity(e){Vn(typeof e=="number","Layer opacity must be a number"),this.set(Ei.OPACITY,e)}setVisible(e){this.set(Ei.VISIBLE,e)}setZIndex(e){this.set(Ei.Z_INDEX,e)}disposeInternal(){this.state_&&(this.state_.layer=null,this.state_=null),super.disposeInternal()}},PS=R5;var Fd={ADDLAYER:"addlayer",REMOVELAYER:"removelayer"},Bc=class extends Ks{constructor(e,t){super(e),this.layer=t}},P5={LAYERS:"layers"},I5=class i extends PS{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(P5.LAYERS,this.handleLayersChanged_),n?Array.isArray(n)?n=new po(n.slice(),{unique:!0}):Vn(typeof n.getArray=="function","Expected `layers` to be an array or a `Collection`"):n=new po(void 0,{unique:!0}),this.setLayers(n)}handleLayerChange_(){this.changed()}handleLayersChanged_(){this.layersListenerKeys_.forEach(ri),this.layersListenerKeys_.length=0;let e=this.getLayers();this.layersListenerKeys_.push(kn(e,Qs.ADD,this.handleLayersAdd_,this),kn(e,Qs.REMOVE,this.handleLayersRemove_,this));for(let n in this.listenerKeys_)this.listenerKeys_[n].forEach(ri);wu(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 Bc(Fd.ADDLAYER,s))}this.changed()}registerLayerListeners_(e){let t=[kn(e,Ic.PROPERTYCHANGE,this.handleLayerChange_,this),kn(e,Jt.CHANGE,this.handleLayerChange_,this)];e instanceof i&&t.push(kn(e,Fd.ADDLAYER,this.handleLayerGroupAdd_,this),kn(e,Fd.REMOVELAYER,this.handleLayerGroupRemove_,this)),this.listenerKeys_[Ln(e)]=t}handleLayerGroupAdd_(e){this.dispatchEvent(new Bc(Fd.ADDLAYER,e.layer))}handleLayerGroupRemove_(e){this.dispatchEvent(new Bc(Fd.REMOVELAYER,e.layer))}handleLayersAdd_(e){let t=e.element;this.registerLayerListeners_(t),this.dispatchEvent(new Bc(Fd.ADDLAYER,t)),this.changed()}handleLayersRemove_(e){let t=e.element,n=Ln(t);this.listenerKeys_[n].forEach(ri),delete this.listenerKeys_[n],this.dispatchEvent(new Bc(Fd.REMOVELAYER,t)),this.changed()}getLayers(){return this.get(P5.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 Bc(Fd.REMOVELAYER,n[r]))}this.set(P5.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=yu(l.extent,r.extent):l.extent=r.extent),l.zIndex===void 0&&(l.zIndex=s)}return t}getSourceState(){return"ready"}},Jx=I5;var mo={PRERENDER:"prerender",POSTRENDER:"postrender",PRECOMPOSE:"precompose",POSTCOMPOSE:"postcompose",RENDERCOMPLETE:"rendercomplete"};var N5=class extends PS{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(Ei.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(Ei.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_&&(ri(this.sourceChangeKey_),this.sourceChangeKey_=null),this.sourceReady_=!1;let e=this.getSource();e&&(this.sourceChangeKey_=kn(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 Al?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 ey(r,t.viewState)&&(!s||yr(s,t.extent))}getAttributions(e){if(!this.isVisible(e))return[];let t=this.getSource()?.getAttributions();if(!t)return[];let n=e instanceof Al?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(Ei.MAP,e)}getMapInternal(){return this.get(Ei.MAP)}setMap(e){this.mapPrecomposeKey_&&(ri(this.mapPrecomposeKey_),this.mapPrecomposeKey_=null),e||this.changed(),this.mapRenderKey_&&(ri(this.mapRenderKey_),this.mapRenderKey_=null),e&&(this.mapPrecomposeKey_=kn(e,mo.PRECOMPOSE,this.handlePrecompose_,this),this.mapRenderKey_=kn(this,Jt.CHANGE,e.render,e),this.changed())}handlePrecompose_(e){let t=e.frameState.layerStatesArray,n=this.getLayerState(!1);Vn(!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(Ei.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 ey(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 lA=N5;function IS(i,e,t=0,n=i.length-1,r=ule){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)),v=Math.min(n,Math.floor(e+(l-c)*f/l+p));IS(i,e,x,v,r)}let s=i[e],o=t,a=n;for(ty(i,t,e),r(i[n],s)>0&&ty(i,t,n);o<a;){for(ty(i,o,a),o++,a--;r(i[o],s)<0;)o++;for(;r(i[a],s)>0;)a--}r(i[t],s)===0?ty(i,t,a):(a++,ty(i,a,n)),a<=e&&(t=a+1),e<=a&&(n=a-1)}}function ty(i,e,t){let n=i[e];i[e]=i[t],i[t]=n}function ule(i,e){return i<e?-1:i>e?1:0}var cA=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(!LS(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;LS(e,l)&&(t.leaf?n.push(a):D5(e,l)?this._all(a,n):s.push(a))}t=s.pop()}return n}collides(e){let t=this.data;if(!LS(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(LS(e,o)){if(t.leaf||D5(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=Wg([]),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=hle(e,n.children,t);if(u!==-1)return n.children.splice(u,1),s.push(n),this._condense(s),this}!c&&!n.leaf&&D5(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=Wg(e.slice(t,n+1)),Hg(a,this.toBBox),a;r||(r=Math.ceil(Math.log(s)/Math.log(o)),o=Math.ceil(s/Math.pow(o,r-1))),a=Wg([]),a.leaf=!1,a.height=r;let l=Math.ceil(s/o),c=l*Math.ceil(Math.sqrt(o));Iq(e,t,n,c,this.compareMinX);for(let u=t;u<=n;u+=c){let f=Math.min(u+c-1,n);Iq(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 Hg(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=L5(c),f=ple(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),iy(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=Wg(n.children.splice(o,n.children.length-o));a.height=n.height,a.leaf=n.leaf,Hg(n,this.toBBox),Hg(a,this.toBBox),t?e[t-1].children.push(a):this._splitRoot(n,a)}_splitRoot(e,t){this.data=Wg([e,t]),this.data.height=e.height+1,this.data.leaf=!1,Hg(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=ny(e,0,a,this.toBBox),c=ny(e,a,n,this.toBBox),u=Ale(l,c),f=L5(l)+L5(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:fle,s=e.leaf?this.compareMinY:dle,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=ny(e,0,t,s),a=ny(e,n-t,n,s),l=NS(o)+NS(a);for(let c=t;c<n-t;c++){let u=e.children[c];iy(o,e.leaf?s(u):u),l+=NS(o)}for(let c=n-t-1;c>=t;c--){let u=e.children[c];iy(a,e.leaf?s(u):u),l+=NS(a)}return l}_adjustParentBBoxes(e,t,n){for(let r=n;r>=0;r--)iy(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():Hg(e[t],this.toBBox)}};function hle(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 Hg(i,e){ny(i,0,i.children.length,e,i)}function ny(i,e,t,n,r){r||(r=Wg(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];iy(r,i.leaf?n(o):o)}return r}function iy(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 fle(i,e){return i.minX-e.minX}function dle(i,e){return i.minY-e.minY}function L5(i){return(i.maxX-i.minX)*(i.maxY-i.minY)}function NS(i){return i.maxX-i.minX+(i.maxY-i.minY)}function ple(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 Ale(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 D5(i,e){return i.minX<=e.minX&&i.minY<=e.minY&&e.maxX<=i.maxX&&e.maxY<=i.maxY}function LS(i,e){return e.minX<=i.maxX&&e.minY<=i.maxY&&e.maxX>=i.minX&&e.maxY>=i.minY}function Wg(i){return{children:i,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function Iq(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;IS(i,o,e,t,r),s.push(e,o,o,t)}}var hA=0,FS=0,ko=1<<hA++,si=1<<hA++,Go=1<<hA++,ca=1<<hA++,Af=1<<hA++,uA=1<<hA++,OS=Math.pow(2,hA)-1,O5={[ko]:"boolean",[si]:"number",[Go]:"string",[ca]:"color",[Af]:"number[]",[uA]:"size"},mle=Object.keys(O5).map(Number).sort(Va);function gle(i){return i in O5}function pf(i){let e=[];for(let t of mle)ry(i,t)&&e.push(O5[t]);return e.length===0?"untyped":e.length<3?e.join(" or "):e.slice(0,-1).join(", ")+", or "+e[e.length-1]}function ry(i,e){return(i&e)===e}function DS(i,e){return!!(i&e)}function Od(i,e){return i===e}var Nr=class{constructor(e,t){if(!gle(e))throw new Error(`literal expressions must have a specific type, got ${pf(e)}`);this.type=e,this.value=t}},BS=class{constructor(e,t,...n){this.type=e,this.operator=t,this.args=n}};function US(i){return{variables:new Map,properties:new Map,featureId:!1,geometryType:!1,mCoordinate:!1,mapState:!1,inputVariables:i}}function Yr(i,e,t){switch(typeof i){case"boolean":{if(Od(e,Go))return new Nr(Go,i?"true":"false");if(!ry(e,ko))throw new Error(`got a boolean, but expected ${pf(e)}`);return new Nr(ko,i)}case"number":{if(Od(e,uA))return new Nr(uA,jr(i));if(Od(e,ko))return new Nr(ko,!!i);if(Od(e,Go))return new Nr(Go,i.toString());if(!ry(e,si))throw new Error(`got a number, but expected ${pf(e)}`);return new Nr(si,i)}case"string":{if(Od(e,ca))return new Nr(ca,zx(i));if(Od(e,ko))return new Nr(ko,!!i);if(!ry(e,Go))throw new Error(`got a string, but expected ${pf(e)}`);return new Nr(Go,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 Rle(i,e,t);for(let n of i)if(typeof n!="number")throw new Error("expected an array of numbers");if(Od(e,uA)){if(i.length!==2)throw new Error(`expected an array of two values for a size, got ${i.length}`);return new Nr(uA,i)}if(Od(e,ca)){if(i.length===3)return new Nr(ca,[...i,1]);if(i.length===4)return new Nr(ca,i);throw new Error(`expected an array of 3 or 4 values for a color, got ${i.length}`)}if(!ry(e,Af))throw new Error(`got an array of numbers, but expected ${pf(e)}`);return new Nr(Af,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"},_le={[Je.Get]:Fn(Zn(1,1/0),Nq),[Je.Var]:xle(),[Je.Has]:Fn(Zn(1,1/0),Nq),[Je.Id]:Fn(yle,jg),[Je.Concat]:Fn(Zn(2,1/0),zi(Go)),[Je.GeometryType]:Fn(vle,jg),[Je.LineMetric]:Fn(ble,jg),[Je.Resolution]:Fn(F5,jg),[Je.Zoom]:Fn(F5,jg),[Je.Time]:Fn(F5,jg),[Je.Any]:Fn(Zn(2,1/0),zi(ko)),[Je.All]:Fn(Zn(2,1/0),zi(ko)),[Je.Not]:Fn(Zn(1,1),zi(ko)),[Je.Equal]:Fn(Zn(2,2),Dq()),[Je.NotEqual]:Fn(Zn(2,2),Dq()),[Je.GreaterThan]:Fn(Zn(2,2),zi(si)),[Je.GreaterThanOrEqualTo]:Fn(Zn(2,2),zi(si)),[Je.LessThan]:Fn(Zn(2,2),zi(si)),[Je.LessThanOrEqualTo]:Fn(Zn(2,2),zi(si)),[Je.Multiply]:Fn(Zn(2,1/0),Lq),[Je.Coalesce]:Fn(Zn(2,1/0),Lq),[Je.Divide]:Fn(Zn(2,2),zi(si)),[Je.Add]:Fn(Zn(2,1/0),zi(si)),[Je.Subtract]:Fn(Zn(2,2),zi(si)),[Je.Clamp]:Fn(Zn(3,3),zi(si)),[Je.Mod]:Fn(Zn(2,2),zi(si)),[Je.Pow]:Fn(Zn(2,2),zi(si)),[Je.Abs]:Fn(Zn(1,1),zi(si)),[Je.Floor]:Fn(Zn(1,1),zi(si)),[Je.Ceil]:Fn(Zn(1,1),zi(si)),[Je.Round]:Fn(Zn(1,1),zi(si)),[Je.Sin]:Fn(Zn(1,1),zi(si)),[Je.Cos]:Fn(Zn(1,1),zi(si)),[Je.Atan]:Fn(Zn(1,2),zi(si)),[Je.Sqrt]:Fn(Zn(1,1),zi(si)),[Je.Match]:Fn(Zn(4,1/0),Fq,Sle),[Je.Between]:Fn(Zn(3,3),zi(si)),[Je.Interpolate]:Fn(Zn(6,1/0),Fq,Tle),[Je.Case]:Fn(Zn(3,1/0),wle,Ele),[Je.In]:Fn(Zn(2,2),Mle),[Je.Number]:Fn(Zn(1,1/0),zi(OS)),[Je.String]:Fn(Zn(1,1/0),zi(OS)),[Je.Array]:Fn(Zn(1,1/0),zi(si)),[Je.Color]:Fn(Zn(1,4),zi(si)),[Je.Band]:Fn(Zn(1,3),zi(si)),[Je.Palette]:Fn(Zn(2,2),Cle),[Je.ToString]:Fn(Zn(1,1),zi(ko|si|Go|ca))};function Nq(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 Nr(si,o);break}case"string":{r[s]=new Nr(Go,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 xle(){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=Yr(s,OS,t);if(!(o instanceof Nr))throw new Error(`style variables should only be literal values (no expressions!), variable name: ${n}`);let a=o.type;if(typeof s=="string"&&DS(r,ca)&&!DS(r,Go)?a=ca:Array.isArray(s)&&s.length===2&&DS(r,uA)&&!DS(r,Af)&&(a=uA),r&=a,r===FS)throw new Error(`the type expected from the var operator (${pf(e)}) did not have any overlap with the type of the corresponding style variables (${pf(a)}), variable name: ${n}`)}if(t.variables.has(n)){let o=t.variables.get(n);if(r&=o,r===FS)throw new Error(`a new type expected from the var operator (${pf(e)}) did not have any overlap with the previous type expected for it (${pf(o)}), variable name: ${n}`)}return t.variables.set(n,r),new BS(r,"var",new Nr(Go,n))}}function yle(i,e,t){t.featureId=!0}function vle(i,e,t){t.geometryType=!0}function ble(i,e,t){t.mCoordinate=!0}function F5(i,e,t){t.mapState=!0}function jg(i,e,t){let n=i[0];if(i.length!==1)throw new Error(`expected no arguments for ${n} operation`);return[]}function Zn(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 Lq(i,e,t){let n=i.length-1,r=new Array(n);for(let s=0;s<n;++s){let o=Yr(i[s+1],e,t);r[s]=o}return r}function zi(i){return function(e,t,n){let r=e.length-1,s=new Array(r);for(let o=0;o<r;++o){let a=Yr(e[o+1],i,n);s[o]=a}return s}}function Dq(){return function(i,e,t){let n=i[0],r=i.length-1,s=new Array(r),o=OS;for(let a=0;a<r;++a){let l=Yr(i[a+1],o,t);o&=l.type}if(o===FS)throw new Error(`no common type was found among the arguments of ${n}`);for(let a=0;a<r;++a){let l=Yr(i[a+1],o,t);s[a]=l}return s}}function wle(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 Fq(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 Sle(i,e,t){let n=i.length-1,r=Yr(i[i.length-1],e,t),s=Go|si|ko,o=new Array(n-2);for(let l=0;l<n-2;l+=2){try{let c=Yr(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===FS)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=Yr(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=Yr(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[Yr(i[1],s,t),...o,r]}function Tle(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 Nr(si,r),o;try{o=Yr(i[2],si,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=Yr(i[l+3],si,t);a[l]=c}catch(c){throw new Error(`failed to parse argument ${l+2} for interpolate expression: ${c.message}`)}try{let c=Yr(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 Ele(i,e,t){let n=Yr(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=Yr(i[s+1],ko,t);r[s]=o}catch(o){throw new Error(`failed to parse argument ${s} of case expression: ${o.message}`)}try{let o=Yr(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 Mle(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=Go:r=si;let s=new Array(n.length);for(let a=0;a<s.length;a++)try{let l=Yr(n[a],r,t);s[a]=l}catch(l){throw new Error(`failed to parse haystack item ${a} for "in" expression: ${l.message}`)}return[Yr(i[1],r,t),...s]}function Cle(i,e,t){let n;try{n=Yr(i[1],si,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=Yr(r[o],ca,t)}catch(l){throw new Error(`failed to parse color at index ${o} in palette expression: ${l.message}`)}if(!(a instanceof Nr))throw new Error(`the palette color at index ${o} must be a literal value`);s[o]=a}return[n,...s]}function Fn(...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 BS(t,r,...s)}}function Rle(i,e,t){let n=i[0],r=_le[n];if(!r)throw new Error(`unknown operator: ${n}`);return r(i,e,t)}function kS(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 kS(i.getGeometries()[0]);default:return""}}function B5(){return{variables:{},properties:{},resolution:NaN,featureId:null,geometryType:""}}function kc(i,e,t){let n=Yr(i,e,t);return Uc(n,t)}function Uc(i,e){if(i instanceof Nr){if(i.type===ca&&typeof i.value=="string"){let n=zx(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 Ple(i,e);case Je.Get:case Je.Var:case Je.Has:return Ile(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=>Uc(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 Lle(i,e);case Je.Equal:case Je.NotEqual:case Je.LessThan:case Je.LessThanOrEqualTo:case Je.GreaterThan:case Je.GreaterThanOrEqualTo:return Nle(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 Dle(i,e);case Je.Case:return Fle(i,e);case Je.Match:return Ole(i,e);case Je.Interpolate:return Ble(i,e);case Je.ToString:return Ule(i,e);default:throw new Error(`Unsupported operator ${t}`)}}function Ple(i,e){let t=i.operator,n=i.args.length,r=new Array(n);for(let s=0;s<n;++s)r[s]=Uc(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 Ile(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 Nle(i,e){let t=i.operator,n=Uc(i.args[0],e),r=Uc(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 Lle(i,e){let t=i.operator,n=i.args.length,r=new Array(n);for(let s=0;s<n;++s)r[s]=Uc(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 Dle(i,e){let t=i.operator,n=i.args.length,r=new Array(n);for(let s=0;s<n;++s)r[s]=Uc(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 Fle(i,e){let t=i.args.length,n=new Array(t);for(let r=0;r<t;++r)n[r]=Uc(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 Ole(i,e){let t=i.args.length,n=new Array(t);for(let r=0;r<t;++r)n[r]=Uc(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 Ble(i,e){let t=i.args.length,n=new Array(t);for(let r=0;r<t;++r)n[r]=Uc(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=uV(f)),u>=o)return c===2?f:p?kle(s,o,a,l,u,f):sy(s,o,a,l,u,f);a=u,l=f}return l}}function Ule(i,e){let t=i.operator,n=i.args.length,r=new Array(n);for(let s=0;s<n;++s)r[s]=Uc(i.args[s],e);if(t===Je.ToString)return s=>{let o=r[0](s);return i.args[0].type===ca?Vx(o):o.toString()};throw new Error(`Unsupported convert operator ${t}`)}function sy(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 kle(i,e,t,n,r,s){if(r-t===0)return n;let a=TI(n),l=TI(s),c=l[2]-a[2];c>180?c-=360:c<-180&&(c+=360);let u=[sy(i,e,t,a[0],r,l[0]),sy(i,e,t,a[1],r,l[1]),a[2]+sy(i,e,t,0,r,c),sy(i,e,t,n[3],r,s[3])];return hV(u)}function Gle(i){return!0}function zle(i,e){e=e??US();let t=Vle(i,e),n=B5();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=kS(r.getGeometry())),t(n)}}function Oq(i,e){e=e??US();let t=i.length,n=new Array(t);for(let o=0;o<t;++o)n[o]=U5(i[o],e);let r=B5(),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=kS(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 Gq(i,e){if(e=e??US(),!Array.isArray(i))return Oq([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 zle(s,e)}return Oq(i,e)}function Vle(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?kc(s.filter,ko,e):Gle,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=oy(i,"",e),n=ay(i,"",e),r=qle(i,e),s=Hle(i,e),o=go(i,"z-index",e);if(!t&&!n&&!r&&!s&&!Ec(i))throw new Error("No fill, stroke, point, or text symbolizer properties in style: "+JSON.stringify(i));let a=new ws;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 oy(i,e,t){let n;if(e+"fill-pattern-src"in i)n=$le(i,e+"fill-",t);else{if(i[e+"fill-color"]==="none")return s=>null;n=zS(i,e+"fill-color",t)}if(!n)return null;let r=new $r;return function(s){let o=n(s);return o===lS?null:(r.setColor(o),r)}}function ay(i,e,t){let n=go(i,e+"stroke-width",t),r=zS(i,e+"stroke-color",t);if(!n&&!r)return null;let s=mf(i,e+"stroke-line-cap",t),o=mf(i,e+"stroke-line-join",t),a=zq(i,e+"stroke-line-dash",t),l=go(i,e+"stroke-line-dash-offset",t),c=go(i,e+"stroke-miter-limit",t),u=go(i,e+"stroke-offset",t),f=new fo;return function(p){if(r){let x=r(p);if(x===lS)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 qle(i,e){let t="text-",n=mf(i,t+"value",e);if(!n)return null;let r=oy(i,t,e),s=oy(i,t+"background-",e),o=ay(i,t,e),a=ay(i,t+"background-",e),l=mf(i,t+"font",e),c=go(i,t+"max-angle",e),u=go(i,t+"offset-x",e),f=go(i,t+"offset-y",e),p=Xg(i,t+"overflow",e),x=mf(i,t+"placement",e),v=go(i,t+"repeat",e),w=VS(i,t+"scale",e),S=Xg(i,t+"rotate-with-view",e),T=go(i,t+"rotation",e),R=mf(i,t+"align",e),P=mf(i,t+"justify",e),C=mf(i,t+"baseline",e),L=Xg(i,t+"keep-upright",e),D=zq(i,t+"padding",e),F=qS(i,t+"declutter-mode"),N=new ff({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(v&&N.setRepeat(v(B)),w&&N.setScale(w(B)),S&&N.setRotateWithView(S(B)),T&&N.setRotation(T(B)),R){let z=R(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(P){let z=P(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 Hle(i,e){return"icon-src"in i?Wle(i,e):"shape-points"in i?jle(i,e):"circle-radius"in i?Xle(i,e):null}function Wle(i,e){let t="icon-",n=t+"src",r=Vq(i[n],n),s=GS(i,t+"anchor",e),o=VS(i,t+"scale",e),a=go(i,t+"opacity",e),l=GS(i,t+"displacement",e),c=go(i,t+"rotation",e),u=Xg(i,t+"rotate-with-view",e),f=Uq(i,t+"anchor-origin"),p=kq(i,t+"anchor-x-units"),x=kq(i,t+"anchor-y-units"),v=gf(i,t+"color"),w,S=null;v!==void 0&&(Array.isArray(v)&&v.length>0&&typeof v[0]=="string"?S=zS(i,t+"color",e):w=qq(v,t+"color"));let T=Kle(i,t+"cross-origin"),R=Zle(i,t+"offset"),P=Uq(i,t+"offset-origin"),C=k5(i,t+"width"),L=k5(i,t+"height"),D=Yle(i,t+"size"),F=qS(i,t+"declutter-mode"),N={src:r,anchorOrigin:f,anchorXUnits:p,anchorYUnits:x,crossOrigin:T,offset:R,offsetOrigin:P,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 rA(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 jle(i,e){let t="shape-",n=t+"points",r=t+"radius",s=G5(i[n],n);if(!(r in i))throw new Error(`Expected a number for ${r}`);let o=go(i,r,e),a=typeof i[r]=="number"?i[r]:5,l=t+"radius2",c=go(i,l,e),u=typeof i[l]=="number"?i[l]:void 0,f=oy(i,t,e),p=ay(i,t,e),x=VS(i,t+"scale",e),v=GS(i,t+"displacement",e),w=go(i,t+"rotation",e),S=Xg(i,t+"rotate-with-view",e),T=k5(i,t+"angle"),R=qS(i,t+"declutter-mode"),P=new pS({points:s,radius:a,radius2:u,angle:T,declutterMode:R});return function(C){return o&&P.setRadius(o(C)),c&&P.setRadius2(c(C)),f&&P.setFill(f(C)),p&&P.setStroke(p(C)),v&&P.setDisplacement(v(C)),w&&P.setRotation(w(C)),S&&P.setRotateWithView(S(C)),x&&P.setScale(x(C)),P}}function Xle(i,e){let t="circle-",n=oy(i,t,e),r=ay(i,t,e),s=go(i,t+"radius",e),o=VS(i,t+"scale",e),a=GS(i,t+"displacement",e),l=go(i,t+"rotation",e),c=Xg(i,t+"rotate-with-view",e),u=qS(i,t+"declutter-mode"),f=new AS({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 gf(i,e){if(!(e in i))return;let t=i[e];return t===void 0?void 0:t}function go(i,e,t){let n=gf(i,e);if(n===void 0)return;let r=kc(n,si,t);return function(s){return G5(r(s),e)}}function mf(i,e,t){let n=gf(i,e);if(n===void 0)return null;let r=kc(n,Go,t);return function(s){return Vq(r(s),e)}}function $le(i,e,t){let n=mf(i,e+"pattern-src",t),r=Bq(i,e+"pattern-offset",t),s=Bq(i,e+"pattern-size",t),o=zS(i,e+"color",t);return function(a){return{src:n(a),offset:r&&r(a),size:s&&s(a),color:o&&o(a)}}}function Xg(i,e,t){let n=gf(i,e);if(n===void 0)return null;let r=kc(n,ko,t);return function(s){let o=r(s);if(typeof o!="boolean")throw new Error(`Expected a boolean for ${e}`);return o}}function zS(i,e,t){let n=gf(i,e);if(n===void 0)return null;let r=kc(n,ca,t);return function(s){return qq(r(s),e)}}function zq(i,e,t){let n=gf(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=kc(o,si,t);return function(c){return G5(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=kc(n,Af,t);return function(s){return ly(r(s),e)}}function GS(i,e,t){let n=gf(i,e);if(n===void 0)return null;let r=kc(n,Af,t);return function(s){let o=ly(r(s),e);if(o.length!==2)throw new Error(`Expected two numbers for ${e}`);return o}}function Bq(i,e,t){let n=gf(i,e);if(n===void 0)return null;let r=kc(n,Af,t);return function(s){return Hq(r(s),e)}}function VS(i,e,t){let n=gf(i,e);if(n===void 0)return null;let r=kc(n,Af|si,t);return function(s){return Qle(r(s),e)}}function k5(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 Yle(i,e){let t=i[e];if(t!==void 0){if(typeof t=="number")return jr(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 Kle(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 Uq(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 kq(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 Zle(i,e){let t=i[e];if(t!==void 0)return ly(t,e)}function qS(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 ly(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 Vq(i,e){if(typeof i!="string")throw new Error(`Expected a string for ${e}`);return i}function G5(i,e){if(typeof i!="number")throw new Error(`Expected a number for ${e}`);return i}function qq(i,e){if(typeof i=="string")return i;let t=ly(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 Hq(i,e){let t=ly(i,e);if(t.length!==2)throw new Error(`Expected an array of two numbers for ${e}`);return t}function Qle(i,e){return typeof i=="number"?i:Hq(i,e)}var Wq={RENDER_ORDER:"renderOrder"},z5=class extends lA{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(Wq.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 cA(9)),this.getRenderer().renderDeclutter(e,t)}setRenderOrder(e){this.set(Wq.RENDER_ORDER,e)}setStyle(e){this.style_=e===void 0?UI:e;let t=Jle(e);this.styleFunction_=e===null?void 0:wV(t),this.changed()}setDeclutter(e){this.declutter_=e?String(e):void 0,this.changed()}};function Jle(i){if(i===void 0)return UI;if(!i)return null;if(typeof i=="function"||i instanceof ws)return i;if(Array.isArray(i)&&i.length===0)return[];if(Array.isArray(i)&&i[0]instanceof ws){let t=i.length,n=new Array(t);for(let r=0;r<t;++r){let s=i[r];if(!(s instanceof ws))throw new Error("Expected a list of style instances");n[r]=s}return n}return Gq(i)}var HS=z5;var V5=class extends Ks{constructor(e,t,n,r){super(e),this.inversePixelTransform=t,this.frameState=n,this.context=r}},WS=V5;var q5=class extends wd{constructor(e){super(),this.map_=e}dispatchRenderEvent(e,t){Kn()}calculateMatrices2D(e){let t=e.viewState,n=e.coordinateToPixelTransform,r=e.pixelToCoordinateTransform;ho(n,e.size[0]/2,e.size[1]/2,1/t.resolution,-1/t.resolution,-t.rotation,-t.center[0],-t.center[1]),Gw(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=bw(e.slice(),p),v=[[0,0]];if(p.canWrapX()&&r){let C=p.getExtent(),L=jn(C);v.push([-L,0],[L,0])}let w=t.layerStatesArray,S=w.length,T=[],R=[];for(let C=0;C<v.length;C++)for(let L=S-1;L>=0;--L){let D=w[L],F=D.layer;if(F.hasRenderer()&&ey(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);R[0]=z[0]+v[C][0],R[1]=z[1]+v[C][1],c=N.forEachFeatureAtCoordinate(R,t,n,V,T)}if(c)return c}}if(T.length===0)return;let P=1/T.length;return T.forEach((C,L)=>C.distanceSq+=L*P),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,rf,this,s,o)!==void 0}getMap(){return this.map_}renderFrame(e){Kn()}scheduleExpireIconCache(e){Bo.canExpireCache()&&e.postRenderFunctions.push(ece)}};function ece(i,e){Bo.expire()}var jq=q5;var H5=class extends jq{constructor(e){super(e),this.fontChangeListenerKey_=kn(nA,Ic.PROPERTYCHANGE,e.redrawText,e),this.element_=Us?Bw():document.createElement("div");let t=this.element_.style;t.position="absolute",t.width="100%",t.height="100%",t.zIndex="0",this.element_.className=Id+" 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 WS(e,void 0,t);n.dispatchEvent(r)}}disposeInternal(){ri(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(mo.PRECOMPOSE,e);let t=e.layerStatesArray.sort((u,f)=>u.zIndex-f.zIndex);t.some(u=>u.layer instanceof HS&&u.layer.getDeclutter())&&(e.declutter={});let r=e.viewState;this.children_.length=0;let o=this.getMap().getTargetElement(),a;pl(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,v=x.getSourceState();if(!ey(p,r)||v!="ready"&&v!="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),Az(this.element_,this.children_);for(let u of a?this.children_:[]){let f=u.firstElementChild||u,p=u.style.backgroundColor;if(p&&(!pl(f)||f.width>0)&&(a.fillStyle=p,a.fillRect(0,0,a.canvas.width,a.canvas.height)),!pl(f)||f.width===0)continue;a.save();let x=u.style.opacity||f.style.opacity;a.globalAlpha=x===""?1:Number(x);let v=f.style.transform;if(v)a.transform(...kw(v));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(mo.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))}}},Xq=H5;function $q(i){if(i instanceof lA){i.setMapInternal(null);return}i instanceof Jx&&i.getLayers().forEach($q)}function Yq(i,e){if(i instanceof lA){i.setMapInternal(e);return}if(i instanceof Jx){let t=i.getLayers().getArray();for(let n=0,r=t.length;n<r;++n)Yq(t[n],e)}}var W5=class extends bs{constructor(e){super(),e=e||{},this.on,this.once,this.un;let t=tce(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:cz,this.postRenderTimeoutHandle_,this.animationDelayKey_,this.animationDelay_=this.animationDelay_.bind(this),this.coordinateToPixelTransform_=Zs(),this.pixelToCoordinateTransform_=Zs(),this.frameIndex_=0,this.frameState_=null,this.previousExtent_=null,this.viewPropertyListenerKey_=null,this.viewChangeListenerKey_=null,this.layerGroupPropertyListenerKeys_=null,Us||(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,Us||(this.resizeObserver_=new ResizeObserver(()=>this.updateSize())),this.controls=t.controls||(Us?new po:wS()),this.interactions=t.interactions||(Us?new po:RS({onFocusOnly:!0})),this.overlays_=t.overlays,this.overlayIdIndex_={},this.renderer_=null,this.postRenderFunctions_=[],this.tileQueue_=new iq(this.getTilePriority.bind(this),this.handleTileChange_.bind(this)),this.addChangeListener(Ao.LAYERGROUP,this.handleLayerGroupChanged_),this.addChangeListener(Ao.VIEW,this.handleViewChanged_),this.addChangeListener(Ao.SIZE,this.handleSizeChanged_),this.addChangeListener(Ao.TARGET,this.handleTargetChanged_),this.setProperties(t.values);let n=this;e.view&&!(e.view instanceof Al)&&e.view.then(function(r){n.setView(new Al(r))}),this.controls.addEventListener(Qs.ADD,r=>{r.element.setMap(this)}),this.controls.addEventListener(Qs.REMOVE,r=>{r.element.setMap(null)}),this.interactions.addEventListener(Qs.ADD,r=>{r.element.setMap(this)}),this.interactions.addEventListener(Qs.REMOVE,r=>{r.element.setMap(null)}),this.overlays_.addEventListener(Qs.ADD,r=>{this.addOverlayInternal_(r.element)}),this.overlays_.addEventListener(Qs.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){Yq(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:rf,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 Jx?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:rf,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(Ao.TARGET)}getTargetElement(){return this.targetElement_}getCoordinateFromPixel(e){return Mx(this.getCoordinateFromPixelInternal(e),this.getView().getProjection())}getCoordinateFromPixelInternal(e){let t=this.frameState_;return t?Ir(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(Ao.LAYERGROUP)}setLayers(e){let t=this.getLayerGroup();if(e instanceof po){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=Cc(e,this.getView().getProjection());return this.getPixelFromCoordinateInternal(t)}getPixelFromCoordinateInternal(e){let t=this.frameState_;return t?Ir(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(Ao.SIZE)}getView(){return this.get(Ao.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 rq(this.frameState_,e,t,n,r)}handleBrowserEvent(e,t){t=t||e.type;let n=new Nu(t,this,e);this.handleMapBrowserEvent(n)}handleMapBrowserEvent(e){if(!this.frameState_)return;let t=e.originalEvent,n=t.type;if(n===Kx.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[Gs.ANIMATING]||o[Gs.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(mo.RENDERCOMPLETE)&&this.renderer_.dispatchRenderEvent(mo.RENDERCOMPLETE,e),this.loaded_===!1&&(this.loaded_=!0,this.dispatchEvent(new Ld(Lu.LOADEND,this,e)))):this.loaded_===!0&&(this.loaded_=!1,this.dispatchEvent(new Ld(Lu.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)ri(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_&&!pl(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(pl(t)||t.appendChild(this.viewport_),this.renderer_||(this.renderer_=new Xq(this)),!pl(t)){this.mapBrowserEventHandler_=new tq(this,this.moveTolerance_);for(let r in rr)this.mapBrowserEventHandler_.addEventListener(rr[r],this.handleMapBrowserEvent.bind(this));this.viewport_.addEventListener(Jt.CONTEXTMENU,this.boundHandleBrowserEvent_,!1),this.viewport_.addEventListener(Jt.WHEEL,this.boundHandleBrowserEvent_,Ow?{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_=[kn(n,Jt.KEYDOWN,this.handleBrowserEvent,this),kn(n,Jt.KEYPRESS,this.handleBrowserEvent,this)],!pl(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_&&(ri(this.viewPropertyListenerKey_),this.viewPropertyListenerKey_=null),this.viewChangeListenerKey_&&(ri(this.viewChangeListenerKey_),this.viewChangeListenerKey_=null);let e=this.getView();e&&(this.updateViewportSize_(this.getSize()),this.viewPropertyListenerKey_=kn(e,Ic.PROPERTYCHANGE,this.handleViewPropertyChanged_,this),this.viewChangeListenerKey_=kn(e,Jt.CHANGE,this.handleViewPropertyChanged_,this),e.resolveConstraints(0)),this.render()}handleLayerGroupChanged_(){this.layerGroupPropertyListenerKeys_&&(this.layerGroupPropertyListenerKeys_.forEach(ri),this.layerGroupPropertyListenerKeys_=null);let e=this.getLayerGroup();e&&(this.handleLayerAdd_(new Bc("addlayer",e)),this.layerGroupPropertyListenerKeys_=[kn(e,Ic.PROPERTYCHANGE,this.render,this),kn(e,Jt.CHANGE,this.render,this),kn(e,"addlayer",this.handleLayerAdd_,this),kn(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){$q(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&&TP(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:wx(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:Ln(this),renderTargets:{}},a.nextCenter&&a.nextResolution){let l=isNaN(a.nextRotation)?a.rotation:a.nextRotation;s.nextExtent=wx(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_||!vu(this.previousExtent_)&&!z0(s.extent,this.previousExtent_))&&(this.dispatchEvent(new Ld(Lu.MOVESTART,this,r)),this.previousExtent_=G0(this.previousExtent_)),this.previousExtent_&&!s.viewHints[Gs.ANIMATING]&&!s.viewHints[Gs.INTERACTING]&&!z0(s.extent,this.previousExtent_)&&(this.dispatchEvent(new Ld(Lu.MOVEEND,this,s)),pw(s.extent,this.previousExtent_))),this.dispatchEvent(new Ld(Lu.POSTRENDER,this,s)),this.renderComplete_=(this.hasListener(Lu.LOADSTART)||this.hasListener(Lu.LOADEND)||this.hasListener(mo.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 Bc("removelayer",t)),this.set(Ao.LAYERGROUP,e)}setSize(e){this.set(Ao.SIZE,e)}setTarget(e){this.set(Ao.TARGET,e)}setView(e){if(!e||e instanceof Al){this.set(Ao.VIEW,e);return}this.set(Ao.VIEW,new Al);let t=this;e.then(function(n){t.setView(new Al(n))})}updateSize(){let e=this.getTargetElement(),t;if(e){let r,s;if(pl(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)],!TP(t)&&(e.offsetWidth||e.offsetHeight||e.getClientRects().length)&&xw("No map visible because the map container's width or height are 0."))}let n=this.getSize();t&&(!n||!Oo(t,n))&&(this.updateViewportSize_(t),this.setSize(t))}updateViewportSize_(e){let t=this.getView();t&&t.setViewportSize(e)}};function tce(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 Jx({layers:i.layers});t[Ao.LAYERGROUP]=n,t[Ao.TARGET]=i.target,t[Ao.VIEW]=i.view instanceof Al?i.view:new Al;let r;i.controls!==void 0&&(Array.isArray(i.controls)?r=new po(i.controls.slice()):(Vn(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 po(i.interactions.slice()):(Vn(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 po(i.overlays.slice()):(Vn(typeof i.overlays.getArray=="function","Expected `overlays` to be an array or an `ol/Collection.js`"),o=i.overlays):o=new po,{controls:r,interactions:s,keyboardEventTarget:e,overlays:o,values:t}}var Kq=W5;function jS(i){return i instanceof Image||i instanceof HTMLCanvasElement||i instanceof HTMLVideoElement||i instanceof ImageBitmap?i:null}var nce=new Error("disposed");var ice=[256,256],j5=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=jS(this.data_);return e?[e.width,e.height]:ice}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(nce),this.controller_=null),super.disposeInternal()}},X5=j5;var $5=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 wd&&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 Vn(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 Vn(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){Vn(!(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}},Y5=$5;var K5=class{constructor(){this.instructions_=[],this.zIndex=0,this.offset_=0,this.pendingMethod_,this.context_=new Proxy(Px(),{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}},XS=K5;var rce=5,Z5=class extends Vw{constructor(e){super(),this.ready=!0,this.boundHandleImageChange_=this.handleImageChange_.bind(this),this.layer_=e,this.staleKeys_=new Array,this.maxStaleKeys=rce,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 Kn()}getData(e){return null}prepareFrame(e){return Kn()}renderFrame(e,t){return Kn()}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()}},Zq=Z5;var J5=[],$g=null;function sce(){$g=Ti(1,1,void 0,{willReadFrequently:!0})}var Q5=class extends Zq{constructor(e){super(e),this.container=null,this.renderedResolution,this.tempTransform=Zs(),this.pixelTransform=Zs(),this.inversePixelTransform=Zs(),this.context=null,this.deferredContext_=null,this.containerReused=!1,this.frameState=null}getImageData(e,t,n){$g||sce(),$g.clearRect(0,0,1,1);let r;try{$g.drawImage(e,t,n,1,1,0,0,1,1),r=$g.getImageData(0,0,1,1).data}catch{return $g=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(pl(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&&Oo(Yl(e.style.backgroundColor),Yl(n)))){let c=e.firstElementChild;pl(c)&&(l=c.getContext("2d"))}if(l&&bz(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=Us?Bw():document.createElement("div"),a.className=o;let c=a.style;c.position="absolute",c.width="100%",c.height="100%",l=Ti();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=Wl(n),s=pg(n),o=dg(n),a=fg(n);Ir(t.coordinateToPixelTransform,r),Ir(t.coordinateToPixelTransform,s),Ir(t.coordinateToPixelTransform,o),Ir(t.coordinateToPixelTransform,a);let l=this.inversePixelTransform;Ir(l,r),Ir(l,s),Ir(l,o),Ir(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(jn(n)/r*o),l=Math.round(xr(n)/r*o);ho(this.pixelTransform,e.size[0]/2,e.size[1]/2,1/o,1/o,s,-a/2,-l/2),Gw(this.inversePixelTransform,this.pixelTransform);let c=vz(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 WS(e,this.inversePixelTransform,n,t);r.dispatchEvent(s)}}preRender(e,t){this.frameState=t,!t.declutter&&this.dispatchRenderEvent_(mo.PRERENDER,e,t)}postRender(e,t){t.declutter||this.dispatchRenderEvent_(mo.POSTRENDER,e,t)}renderDeferredInternal(e){}getRenderContext(e){return e.declutter&&!this.deferredContext_&&(this.deferredContext_=new XS),e.declutter?this.deferredContext_.getContext():this.context}renderDeferred(e){e.declutter&&(this.dispatchRenderEvent_(mo.PRERENDER,this.context,e),e.declutter&&this.deferredContext_&&(this.deferredContext_.draw(this.context),this.deferredContext_.clear()),this.renderDeferredInternal(e),this.dispatchRenderEvent_(mo.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 ho(this.tempTransform,l,c,u,f,-n,p,x)}disposeInternal(){delete this.frameState,super.disposeInternal()}},$S=Q5;function eN(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 oce(i,e,t){let n=i[t];return n?n.delete(e):!1}function Qq(i,e){let t=i.layerStatesArray[i.layerIndex];t.extent&&(e=yu(e,Rc(t.extent,i.viewState.projection)));let n=t.layer.getRenderSource();if(!n.getWrapX()){let r=n.getTileGridForProjection(i.viewState.projection).getExtent();r&&(e=yu(e,r))}return e}var tN=class extends $S{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=Pr(),this.tempTileRange_=new Iw(0,0,0,0),this.tempTileCoord_=wg(0,0,0);let n=t.cacheSize!==void 0?t.cacheSize:512;this.tileCache_=new Y5(n),this.sourceTileCache_=null,this.layerExtent=null,this.maxStaleKeys=n*.5}getTileCache(){return this.tileCache_}getSourceTileCache(){return this.sourceTileCache_||(this.sourceTileCache_=new Y5(512)),this.sourceTileCache_}getOrCreateTile(e,t,n,r){let s=this.tileCache_,a=this.getLayer().getSource(),l=Sg(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||yg(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=Ir(t.pixelToCoordinateTransform,e.slice()),s=n.getExtent();if(s&&!wc(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),v=jr(l.getTileSize(u)),w=l.getResolution(u),S;if(p instanceof Uw||p instanceof zw)S=p.getImage();else if(p instanceof X5){if(S=jS(p.getData()),!S)continue}else continue;let T=Math.floor(c*((r[0]-x[0])/w-f[1]*v[0])),R=Math.floor(c*((x[1]-r[1])/w-f[2]*v[1])),P=Math.round(c*a.getGutterForProjection(o.projection));return this.getImageData(S,T+P,R+P)}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=Ln(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)),v=o.rotation,w=v?uP(o.center,o.resolution,v,e.size):void 0;for(let S=n;S>=x;--S){let T=c.getTileRangeForExtentAndZ(t,S,this.tempTileRange_),R=c.getResolution(S);for(let P=T.minX;P<=T.maxX;++P)for(let C=T.minY;C<=T.maxY;++C){if(v&&!c.tileCoordIntersectsViewport([S,P,C],w))continue;let L=this.getTile(S,P,C,e);if(!L||!eN(r,L,S))continue;let F=L.getKey();if(f[F]=!0,L.getState()===rn.IDLE&&!e.tileQueue.isKeyQueued(F)){let N=wg(S,P,C,this.tempTileCoord_);e.tileQueue.enqueue([L,u,c.getTileCoordCenter(N),R])}}}}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=Sg(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(Ln(this)),eN(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=Sg(l,c,n,u,f),x=!1;if(a.containsKey(p)){let v=a.peek(p);v.getState()===rn.LOADED&&(eN(r,v,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 v=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?Rc(n.extent,s):null,this.layerExtent&&(v=yu(v,this.layerExtent));let R=x*S/2/w,P=x*T/2/w,C=[a[0]-R,a[1]-P,a[0]+R,a[1]+P],L={};this.renderedTiles.length=0;let D=c.getPreload();if(e.nextExtent&&this.enqueueTilesForNextExtent()){let Z=f.getZForResolution(r.nextResolution,u.zDirection),ee=Qq(e,e.nextExtent);this.enqueueTiles(e,ee,Z,L,D)}let F=Qq(e,v);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=Ln(this),B=e.time;for(let Z of L[p]){let ee=Z.getState();if(ee===rn.EMPTY)continue;let ae=Z.tileCoord;if(ee===rn.LOADED&&Z.getAlpha(N,B)===1){Z.endTransition(N);continue}if(ee!==rn.ERROR&&(this.renderComplete=!1),this.findStaleTile_(ae,L)){oce(L,Z,p),e.animate=!0;continue}if(this.findAltTiles_(f,ae,p+1,L))continue;let be=f.getMinZoom();for(let Ie=p-1;Ie>=be&&!this.findAltTiles_(f,ae,Ie,L);--Ie);}let z=x/o*l/w,V=this.getRenderContext(e);ho(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(Va);let K=[],J=[],j=[];for(let Z=H.length-1;Z>=0;--Z){let ee=H[Z],ae=u.getTilePixelSize(ee,l,s),de=f.getResolution(ee)/x,be=ae[0]*de*z,Ie=ae[1]*de*z,Qe=f.getTileCoordForCoordAndZ(Wl(C),ee),Ue=f.getTileCoordExtent(Qe),mt=Ir(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)*be),Ct=Qe[2]-$e[2],un=Math.round(mt[1]-(Ct-1)*Ie),Gt=Math.round(mt[0]-Et*be),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=K.length;Qt<xn;++Qt)ee<J[Qt]&&yr(yt,K[Qt])&&ln.push(K[Qt]);let Zt;ln.length>0&&(Zt=gG(yt,ln)),K.push(yt),J.push(ee),this.drawTile(ze,e,Gt,Xe,st,tt,Me,vt,Zt),this.renderedTiles.unshift(ze),this.updateUsedTiles(e.usedTiles,u,ze)}}for(let Z=0,ee=j.length;Z<ee;++Z){let{tile:ae,x:ce,y:de,w:be,h:Ie,gutter:Qe}=j[Z];this.drawTile(ae,e,ce,de,be,Ie,Qe,!0,void 0)}if(this.renderedResolution=x,this.extentChanged=!this.renderedExtent_||!z0(this.renderedExtent_,C),this.renderedExtent_=C,this.renderedPixelRatio=l,this.postRender(this.context,e),this.layerExtent&&V.restore(),V.imageSmoothingEnabled=!0,this.renderComplete){let Z=(ee,ae)=>{let ce=Ln(u),de=ae.wantedTiles[ce],be=de?Object.keys(de).length:0;this.updateCacheSize(be),this.tileCache_.expireCache(),this.sourceTileCache_?.expireCache()};e.postRenderFunctions.push(Z)}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=jS(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=Ln(this),x=t.layerStatesArray[t.layerIndex],v=x.opacity*(l?e.getAlpha(p,t.time):1),w=v!==f.globalAlpha;w&&(f.save(),f.globalAlpha=v);let S=u.width-2*a,T=u.height-2*a;if(c){let R=S/s,P=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)*R,a+(N-r)*P,B*R,z*P,F,N,B,z)}}else f.drawImage(u,a,a,S,T,n,r,s,o);w&&f.restore(),v!==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=Ln(t);r in e||(e[r]={}),e[r][n.getKey()]=!0}},Jq=tN;var cy={PRELOAD:"preload",USE_INTERIM_TILES_ON_ERROR:"useInterimTilesOnError"};var nN=class extends lA{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(cy.PRELOAD)}setPreload(e){this.set(cy.PRELOAD,e)}getUseInterimTilesOnError(){return this.get(cy.USE_INTERIM_TILES_ON_ERROR)}setUseInterimTilesOnError(e){this.set(cy.USE_INTERIM_TILES_ON_ERROR,e)}getData(e){return super.getData(e)}},eH=nN;var iN=class extends eH{constructor(e){super(e)}createRenderer(){return new Jq(this,{cacheSize:this.getCacheSize()})}},rN=iN;var sN=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){}},YS=sN;var uy={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},hy=[uy.FILL],Ou=[uy.STROKE],_f=[uy.BEGIN_PATH],oN=[uy.CLOSE_PATH],An=uy;var aN=class extends YS{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],wc(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,v,w,S;for(v=t+r;v<n;v+=r)p[0]=e[v],p[1]=e[v+1],S=dw(c,p),S!==w?(x&&(a[l++]=u,a[l++]=f,x=!1),a[l++]=p[0],a[l++]=p[1]):S===ys.INTERSECTING?(a[l++]=p[0],a[l++]=p[1],x=!1):x=!0,u=p[0],f=p[1],w=S;return(s&&x||v===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 v=e.getEndss();x=0;for(let w=0,S=v.length;w<S;++w){let T=[];x=this.drawCustomCoordinates_(c,x,v[w],a,T),p.push(T)}this.instructions.push([An.CUSTOM,l,p,e,n,Dx,s]),this.hitDetectionInstructions.push([An.CUSTOM,l,p,e,r||n,Dx,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,Lg,s]),this.hitDetectionInstructions.push([An.CUSTOM,l,f,e,r||n,Lg,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,Mu,s]),this.hitDetectionInstructions.push([An.CUSTOM,l,u,e,r||n,Mu,s]);break;case"MultiPoint":c=e.getFlatCoordinates(),u=this.appendFlatPointCoordinates(c,a),u>l&&(this.instructions.push([An.CUSTOM,l,u,e,n,Mu,s]),this.hitDetectionInstructions.push([An.CUSTOM,l,u,e,r||n,Mu,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,YG(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=Ha(n||ks)??void 0}else t.fillStyle=void 0;return t}strokeStyleToState(e,t={}){if(e){let n=e.getColor();t.strokeStyle=Ha(n||Uo);let r=e.getLineCap();t.lineCap=r!==void 0?r:Pu;let s=e.getLineDash();t.lineDash=s?s.slice():Wa;let o=e.getLineDashOffset();t.lineDashOffset=o||ja;let a=e.getLineJoin();t.lineJoin=a!==void 0?a:Iu;let l=e.getWidth();t.lineWidth=l!==void 0?l:hf;let c=e.getMiterLimit();t.miterLimit=c!==void 0?c:cf;let u=e.getOffset();t.strokeOffset=u??AV,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&&!Oo(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_=pw(this.maxExtent),this.maxLineWidth>0)){let e=this.resolution*(this.maxLineWidth+1)/2;ug(this.bufferedMaxExtent_,e,this.bufferedMaxExtent_)}return this.bufferedMaxExtent_}},Bu=aN;var lN=class extends Bu{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&&!wc(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||wc(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}},tH=lN;var cN=class extends Bu{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,Uo,r.lineWidth,r.lineCap,r.lineJoin,r.miterLimit,Wa,ja],_f);let l=e.getFlatCoordinates(),c=e.getStride();this.drawFlatCoordinates_(l,0,l.length,c,a),this.hitDetectionInstructions.push(Ou),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,Uo,r.lineWidth,r.lineCap,r.lineJoin,r.miterLimit,Wa,ja],_f);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(Ou),this.endGeometry(t)}finish(){let e=this.state;return e.lastStroke!=null&&e.lastStroke!=this.coordinates.length&&this.instructions.push(Ou),this.reverseHitDetectionInstructions(),this.state=null,super.finish()}applyStroke(e){e.lastStroke!=null&&e.lastStroke!=this.coordinates.length&&(this.instructions.push(Ou),e.lastStroke=this.coordinates.length),e.lastStroke=0,super.applyStroke(e),this.instructions.push(_f)}},nH=cN;var uN=class extends Bu{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(_f),this.hitDetectionInstructions.push(_f);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(oN),this.hitDetectionInstructions.push(oN)),t=f}return a&&(this.instructions.push(hy),this.hitDetectionInstructions.push(hy)),l&&(this.instructions.push(Ou),this.hitDetectionInstructions.push(Ou)),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,ks]),r.strokeStyle!==void 0&&this.hitDetectionInstructions.push([An.SET_STROKE_STYLE,Uo,r.lineWidth,r.lineCap,r.lineJoin,r.miterLimit,Wa,ja]);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(_f,f),this.hitDetectionInstructions.push(_f,f),r.fillStyle!==void 0&&(this.instructions.push(hy),this.hitDetectionInstructions.push(hy)),r.strokeStyle!==void 0&&(this.instructions.push(Ou),this.hitDetectionInstructions.push(Ou)),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,ks]),r.strokeStyle!==void 0&&this.hitDetectionInstructions.push([An.SET_STROKE_STYLE,Uo,r.lineWidth,r.lineCap,r.lineJoin,r.miterLimit,Wa,ja]);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,ks]),r.strokeStyle!==void 0&&this.hitDetectionInstructions.push([An.SET_STROKE_STYLE,Uo,r.lineWidth,r.lineCap,r.lineJoin,r.miterLimit,Wa,ja]);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]=Cd(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}},hN=uN;var fN=0,dN=1;function ace(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 v=p;p=x,x=v}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 v=p;p=x,x=v}if(p>u&&(u=p),x<f&&(f=x),u>f)return!1}return fN=u,dN=f,!0}function iH(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 v=0,w=e.length;v<w;++v){let S=e[v],T=i[x],R=i[x+1],P=!1;for(let C=x+t;C<S;C+=t){let L=i[C],D=i[C+1];if(ace(r,s,o,a,T,R,L,D)){let F=L-T,N=D-R,B=T+fN*F,z=R+fN*N,V=T+dN*F,H=R+dN*N;u&&P&&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,P=!0}T=L,R=D}x=S}return u&&c.push(l.length),{flatCoordinates:l,ends:c}}function rH(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 v=(i-a+x)/x,w=Fo(c,f,v),S=Fo(u,p,v);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 v=x-a,w=Fo(c,f,v/x),S=Fo(u,p,v/x);l.push(w,S),s.push(l),l=[w,S],a=0,o+=r}}return a>0&&s.push(l),s}function sH(i,e,t,n,r){let s=t,o=t,a=0,l=0,c=t,u,f,p,x,v,w,S,T,R,P;for(f=t;f<n;f+=r){let C=e[f],L=e[f+1];v!==void 0&&(R=C-v,P=L-w,x=Math.sqrt(R*R+P*P),S!==void 0&&(l+=p,u=Math.acos((S*R+T*P)/(p*x)),u>i&&(l>a&&(a=l,s=c,o=f),l=0,c=f-r)),p=x,S=R,T=P),v=C,w=L}return l+=x,l>a?[c,f]:[s,o]}var fy={left:0,center:.5,right:1,top:0,middle:.5,hanging:.2,alphabetic:.8,ideographic:.8,bottom:1},pN=class extends Bu{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[ks]={fillStyle:ks},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(!yr(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 R=0,P=T.length;R<P;++R)x.push(T[R][0])}if((c=="LineString"||c=="MultiLineString")&&!xu(this.getBufferedMaxExtent(),p)){let T=iH(u,x,f,this.getBufferedMaxExtent());if(u=T.flatCoordinates,x=T.ends,f=2,x.length===0)return}this.beginGeometry(e,t,n);let v=o.repeat,w=v?void 0:o.textAlign,S=0;for(let T=0,R=x.length;T<R;++T){let P;v?P=rH(v*this.resolution,u,S,x[T],f):P=[u.slice(S,x[T])];for(let C=0,L=P.length;C<L;++C){let D=P[C],F=0,N=D.length;if(w==null){let z=sH(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 v=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!=uf&&(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==uf?uf:S.map(function(C){return C*T}),v,w,this.text_,this.textKey_,this.strokeKey_,this.fillKey_,this.textOffsetX_,this.textOffsetY_,p]);let R=1/T,P=v?v.slice(0):null;P&&(P[1]=ks),this.hitDetectionInstructions.push([An.DRAW_IMAGE,l,x,null,NaN,NaN,NaN,1,0,0,this.textRotateWithView_,this.textRotation_,[R,R],NaN,this.declutterMode_,this.declutterImageWithText_,S,P,w,this.text_,this.textKey_,this.strokeKey_,this.fillKey_?ks: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||Nd,justify:t.justify,textBaseline:t.textBaseline||iA,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=fy[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&&ks,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=Ha(o.getColor()||ks)):(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(),R=a.getMiterLimit();s.lineCap=a.getLineCap()||Pu,s.lineDash=w?w.slice():Wa,s.lineDashOffset=S===void 0?ja:S,s.lineJoin=a.getLineJoin()||Iu,s.lineWidth=T===void 0?hf:T,s.miterLimit=R===void 0?cf:R,s.strokeStyle=Ha(a.getColor()||Uo)}n=this.textState_;let l=e.getFont()||fS;mV(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()||iA,n.backgroundFill=e.getBackgroundFill(),n.backgroundStroke=e.getBackgroundStroke(),n.padding=e.getPadding()||uf,n.scale=c===void 0?[1,1]:c;let u=e.getOffsetX(),f=e.getOffsetY(),p=e.getRotateWithView(),x=e.getKeepUpright(),v=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_=v===void 0?0:v,this.strokeKey_=s?(typeof s.strokeStyle=="string"?s.strokeStyle:Ln(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:"|"+Ln(r.fillStyle):""}this.declutterMode_=e.getDeclutterMode(),this.declutterImageWithText_=t}},oH=pN;var lce={Circle:hN,Default:Bu,Image:tH,LineString:nH,Polygon:hN,Text:oH},AN=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=lce[t];s=new o(this.tolerance_,this.maxExtent_,this.resolution_,this.pixelRatio_),r[t]=s}return s}},aH=AN;function lH(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 KS(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,v,w,S,T,R,P,C=0;for(let L=e;L<t;L+=n){v=p,w=x,S=void 0,T=void 0,L+n<t&&(S=i[L+n],T=i[L+n+1]),s&&L===e&&(v=u,w=f),s&&L===t-n&&(S=l,T=c),p=i[L],x=i[L+1],[R,P]=cce(p,x,v,w,S,T,r),o[C++]=R,o[C++]=P;for(let D=2;D<a;D++)o[C++]=i[L+D]}return o.length!=C&&(o.length=C),o}function cce(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=SG([i,e],[t,n],[r,s]);if(Math.cos(p)>.998)return[i+u*o,e+f*o];let x=Math.cos(p/2),v=Math.sin(p/2),w=v*a+x*l,S=-x*a+v*l,T=w*(1/v),R=S*(1/v);return[i+T*o,e+R*o]}function ZS(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],v=i[o+e+1],w=(v-p)*(c-a)-(x-f)*(u-l);if(w===0)continue;let S=((x-f)*(l-p)-(v-p)*(a-f))/w,T=((c-a)*(l-p)-(u-l)*(a-f))/w;if(S>0&&S<1&&T>0&&T<1){let R=a+S*(c-a),P=l+S*(u-l);i[n+e]=R,i[n+e+1]=P,i.splice(n+2*e,o-n-e);break}}}return i}var mN;function uce(){return mN||(mN=new Intl.Segmenter(void 0,{granularity:"grapheme"})),mN}function cH(i,e,t,n,r,s,o,a,l,c,u,f,p=!0){let x=i[e],v=i[e+1],w=0,S=0,T=0,R=0;function P(){w=x,S=v,e+=n,x=i[e],v=i[e+1],R+=T,T=Math.sqrt((x-w)*(x-w)+(v-S)*(v-S))}do P();while(e<t-n&&R+T<s);let C=T===0?0:(s-R)/T,L=Fo(w,x,C),D=Fo(S,v,C),F=e-n,N=R,B=s+a*l(c,r,u);for(;e<t-n&&R+T<B;)P();C=T===0?0:(B-R)/T;let z=Fo(w,x,C),V=Fo(S,v,C),H=!1;if(p)if(f){let ae=[L,D,z,V];Xw(ae,0,4,2,f,ae,ae),H=ae[0]>ae[2]}else H=L>z;let K=Math.PI,J=[],j=F+n===e;e=F,T=0,R=N,x=i[e],v=i[e+1];let Z;if(j){P(),Z=Math.atan2(v-S,x-w),H&&(Z+=Z>0?-K:K);let ae=(z+L)/2,ce=(V+D)/2;return J[0]=[ae,ce,(B-s)/2,Z,r],J}r=r.replace(/\n/g," ");let ee=Array.from(uce().segment(r),ae=>ae.segment);for(let ae=0,ce=ee.length;ae<ce;){P();let de=Math.atan2(v-S,x-w);if(H&&(de+=de>0?-K:K),Z!==void 0){let Me=de-Z;if(Me+=Me>K?-2*K:Me<-K?2*K:0,Math.abs(Me)>o)return null}Z=de;let be=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&&R+T<s+Ie+ze/2)break;Ie+=ze}if(ae===be)continue;let Qe=(H?ee.slice(ce-ae,ce-be):ee.slice(be,ae)).join("");C=T===0?0:(s+Ie/2-R)/T;let Ue=Fo(w,x,C),mt=Fo(S,v,C);J.push([Ue,mt,Ie/2,de,Qe]),s+=Ie}return J}var Yg=Pr(),Bd=[],xf=[],yf=[],Ud=[];function uH(i){return i[3].declutterBox}var hH=new RegExp("[\u0591-\u08FF\uFB1D-\uFDFF\uFE70-\uFEFC\u0800-\u0FFF\uE800-\uEFFF]");function gN(i,e){return e==="start"?e=hH.test(i)?"right":"left":e==="end"&&(e=hH.test(i)?"left":"right"),fy[e]}function hce(i,e,t){return t>0&&i.push(`77 `,""),i.push(e,""),i}function fce(i,e,t){return t%2===0&&(i+=e),i}var _N=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_=Zs(),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 XS: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?fy[l.justify]:gN(Array.isArray(e)?e[0]:e,l.textAlign||Nd),p=r&&o.lineWidth?o.lineWidth:0,x=Array.isArray(e)?e:String(e).split(`88 `).reduce(hce,[]),{width:v,height:w,widths:S,heights:T,lineWidths:R}=xV(l,x),P=v+p,C=[],L=(P+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*P+N*p,z=[],V=[],H=0,K=0,J=0,j=0,Z;for(let ee=0,ae=x.length;ee<ae;ee+=2){let ce=x[ee];if(ce===`99 `){K+=H,H=0,B=f*P+N*p,++j;continue}let de=x[ee+1]||l.font;de!==Z&&(r&&z.push("font",de),n&&V.push("font",de),Z=de),H=Math.max(H,T[J]);let be=[ce,B+N*S[J]+f*(S[J]-R[j]),.5*(p+H)+K];B+=S[J],r&&z.push("strokeText",be),n&&V.push("fillText",be),++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,v,w,S){a*=p[0],l*=p[1];let T=n-a,R=r-l,P=s+c>e?e-c:s,C=o+u>t?t-u:o,L=v[3]+P*p[0]+v[1],D=v[0]+C*p[1]+v[2],F=T-v[3],N=R-v[0];(w||f!==0)&&(Bd[0]=F,Ud[0]=F,Bd[1]=N,xf[1]=N,xf[0]=F+L,yf[0]=xf[0],yf[1]=N+D,Ud[1]=yf[1]);let B;return f!==0?(B=ho(Zs(),n,r,1,1,f,-n,-r),Ir(B,Bd),Ir(B,xf),Ir(B,yf),Ir(B,Ud),dl(Math.min(Bd[0],xf[0],yf[0],Ud[0]),Math.min(Bd[1],xf[1],yf[1],Ud[1]),Math.max(Bd[0],xf[0],yf[0],Ud[0]),Math.max(Bd[1],xf[1],yf[1],Ud[1]),Yg)):dl(Math.min(F,F+L),Math.min(N,N+D),Math.max(F,F+L),Math.max(N,N+D),Yg),x&&(T=Math.round(T),R=Math.round(R)),{drawImageX:T,drawImageY:R,drawImageW:P,drawImageH:C,originX:c,originY:u,declutterBox:{minX:Yg[0],minY:Yg[1],maxX:Yg[2],maxY:Yg[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,Bd,xf,yf,Ud,o,a),yV(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=Ir(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=gN(Array.isArray(e)?e[0]:e,s.textAlign||Nd),u=fy[s.textBaseline||iA],f=a&&a.lineWidth?a.lineWidth:0,p=o.width/l-2*s.scale[0],x=c*p+2*(.5-c)*f,v=u*o.height/l+2*(.5-u)*f;return{label:o,anchorX:x,anchorY:v}}execute_(e,t,n,r,s,o,a,l){let c=this.zIndexContext_,u;this.pixelCoordinates_&&Oo(n,this.renderedTransform_)?u=this.pixelCoordinates_:(this.pixelCoordinates_||(this.pixelCoordinates_=[]),u=qa(this.coordinates,0,this.coordinates.length,2,n,this.pixelCoordinates_),yz(this.renderedTransform_,n));let f=0,p=r.length,x=0,v,w=[],S,T,R,P,C,L,D,F,N,B,z,V,H,K=0,J=0,j=this.coordinateCache_,Z=this.viewRotation_,ee=Math.round(Math.atan2(-n[1],n[0])*1e12)/1e12,ae={context:e,pixelRatio:this.pixelRatio,resolution:this.resolution,rotation:Z},ce=this.instructions!=r||this.overlaps?0:200,de,be,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&&!yr(a,Qe.getExtent())?f=Ue[2]+1:++f:f=Ue[2],c&&(c.zIndex=Ue[4]);break;case An.BEGIN_PATH:K>ce&&(this.fill_(e),K=0),J>ce&&(e.stroke(),J=0),!K&&!J&&(e.beginPath(),C=NaN,L=NaN),++f;break;case An.CIRCLE:x=Ue[1],R=Ue[2]??0;let Me=u[x],ze=u[x+1],$e=u[x+2]-R,Et=u[x+3]-R,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],v=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,v,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],v=Ue[2],N=Ue[3],S=Ue[4],T=Ue[5];let vt=Ue[6],yt=Ue[7],ln=Ue[8],Zt=Ue[9],Qt=Ue[10],xn=Ue[11],ge=Ue[12],pi=Ue[13];P=Ue[14]||"declutter";let Bn=Ue[15];if(!N&&Ue.length>=20){B=Ue[19],z=Ue[20],V=Ue[21],H=Ue[22];let Nn=this.drawLabelWithPointPlacement_(B,z,V,H);N=Nn.label,Ue[3]=N;let Vr=Ue[23];S=(Nn.anchorX-Vr)*this.pixelRatio,Ue[4]=S;let _r=Ue[24];T=(Nn.anchorY-_r)*this.pixelRatio,Ue[5]=T,vt=N.height,Ue[6]=vt,pi=N.width,Ue[13]=pi}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=uf,Te=null,Pe=null),Qt&&ee?xn+=Z:!Qt&&!ee&&(xn-=Z);let Ve=0;for(;x<v;x+=2){if(le&&le[Ve++]<pi/this.pixelRatio)continue;let Nn=this.calculateImageOrLabelDimensions_(N.width,N.height,u[x],u[x+1],pi,vt,S,T,ln,Zt,xn,ge,s,X,!!Te||!!Pe,de),Vr=[e,t,N,Nn,yt,Te,Pe];if(l){let _r,ll,sa;if(Bn){let ar=v-x;if(!Bn[ar]){Bn[ar]={args:Vr,declutterMode:P};continue}let Ds=Bn[ar];_r=Ds.args,ll=Ds.declutterMode,delete Bn[ar],sa=uH(_r)}let cl,Fa;if(_r&&(ll!=="declutter"||!l.collides(sa))&&(cl=!0),(P!=="declutter"||!l.collides(Nn.declutterBox))&&(Fa=!0),ll==="declutter"&&P==="declutter"){let ar=cl&&Fa;cl=ar,Fa=ar}cl&&(ll!=="none"&&l.insert(sa),this.replayImageOrLabel_.apply(this,_r)),Fa&&(P!=="none"&&l.insert(Nn.declutterBox),this.replayImageOrLabel_.apply(this,Vr))}else this.replayImageOrLabel_.apply(this,Vr)}++f;break;case An.DRAW_CHARS:let gt=Ue[1],St=Ue[2],qe=Ue[3],Ze=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(fce,"")),z=Ue[12];let cn=[Ue[13],Ue[13]];P=Ue[14]||"declutter";let yn=Ue[15],Pn=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=lH(u,gt,St,2),ct=Math.abs(Ye[0])*PI(bt,B,wt);if(Ze||ct<=Dt){let Nn=this.textStates[z].textAlign,Vr=(Dt-ct)*gN(B,Nn),_r=cH(u,gt,St,2,B,Vr,Rt,Math.abs(Ye[0]),PI,bt,wt,ee?0:this.viewRotation_,yn);e:if(_r){let ll=[],sa,cl,Fa,ar,Ds;if(V)for(sa=0,cl=_r.length;sa<cl;++sa){Ds=_r[sa],Fa=Ds[4],ar=this.createLabel(Fa,z,"",V),S=Ds[2]+(Ye[0]<0?-Mt:Mt)-Pn,T=qe*ar.height+(.5-qe)*2*Mt*Ye[1]/Ye[0]-Pt;let ul=this.calculateImageOrLabelDimensions_(ar.width,ar.height,Ds[0],Ds[1],ar.width,ar.height,S,T,0,0,Ds[3],cn,!1,uf,!1,de);if(l&&P==="declutter"&&l.collides(ul.declutterBox))break e;ll.push([e,t,ar,ul,1,null,null])}if(H)for(sa=0,cl=_r.length;sa<cl;++sa){Ds=_r[sa],Fa=Ds[4],ar=this.createLabel(Fa,z,H,""),S=Ds[2]-Pn,T=qe*ar.height-Pt;let ul=this.calculateImageOrLabelDimensions_(ar.width,ar.height,Ds[0],Ds[1],ar.width,ar.height,S,T,0,0,Ds[3],cn,!1,uf,!1,de);if(l&&P==="declutter"&&l.collides(ul.declutterBox))break e;ll.push([e,t,ar,ul,1,null,null])}l&&P!=="none"&&l.load(ll.map(uH));for(let ul=0,mu=ll.length;ul<mu;++ul)this.replayImageOrLabel_.apply(this,ll[ul])}}++f;break;case An.END_GEOMETRY:if(o!==void 0){de=Ue[1];let Nn=o(de,Qe,P);if(Nn)return Nn}++f;break;case An.FILL:ce?K++:this.fill_(e),++f;break;case An.MOVE_TO_LINE_TO:x=Ue[1],v=Ue[2],R=Ue[3];let Ce,jt,Wi;if(R){let Vr=(Ue[4]??!1)||Math.abs(u[x]-u[v-2])<1e-6&&Math.abs(u[x+1]-u[v-1])<1e-6;KS(u,x,v,2,R,Vr,w),ZS(w,2,Vr),Ce=w,jt=0,Wi=Ce.length}else Ce=u,jt=x,Wi=v;be=Ce[jt],Ie=Ce[jt+1],e.moveTo(be,Ie),C=be+.5|0,L=Ie+.5|0;for(let Nn=jt+2;Nn<Wi;Nn+=2)be=Ce[Nn],Ie=Ce[Nn+1],D=be+.5|0,F=Ie+.5|0,(Nn==Wi-2||D!==C||F!==L)&&(e.lineTo(be,Ie),C=D,L=F);++f;break;case An.SET_FILL_STYLE:this.alignAndScaleFill_=Ue[2],K?(this.fill_(e),K=0,J&&(e.stroke(),J=0)):J&&Ue[1]&&(e.stroke(),J=0),e.fillStyle=Ue[1],++f;break;case An.SET_STROKE_STYLE:K&&Ue[1]&&(this.fill_(e),K=0),J&&(e.stroke(),J=0),this.setStrokeStyle_(e,Ue),++f;break;case An.STROKE:ce?J++:e.stroke(),++f;break;default:++f;break}}K&&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)}},fH=_N;var kd=["Polygon","Circle","LineString","Image","Text","Default"],vN=["Image","Text"],dH=kd.filter(i=>!vN.includes(i)),pH=!1,AH=!1;function dce(){let i=0,e=n=>{let r=Ti(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};pH={[e(!0)]:!0,[e(!1)]:!1,[e(void 0)]:void 0}[i],AH=!0}var yN=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_=Zs(),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 fH(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){AH===!1&&dce(),r=Math.round(r);let a=r*2+1,l=ho(this.hitDetectionTransform_,r+.5,r+.5,1/t,-1/t,-n,-e[0],-e[1]),c=!this.hitDetectionContext_;c&&(this.hitDetectionContext_=Ti(a,a,null,{willReadFrequently:pH}));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=Pr(),V0(f,e),ug(f,t*(this.renderBuffer_+r),f));let p=pce(r),x;function v(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,K=r-(V/a|0),J=s(L,D,H*H+K*K);if(J)return J}u.clearRect(0,0,a,a);break}}let w=Object.keys(this.executorsByZIndex_).map(Number);w.sort(Va);let S,T,R,P,C;for(S=w.length-1;S>=0;--S){let L=w[S].toString();for(R=this.executorsByZIndex_[L],T=kd.length-1;T>=0;--T)if(x=kd[T],P=R[x],P!==void 0&&(C=P.executeHitDetection(u,l,n,v,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 qa(a,0,8,2,e,a),a}isEmpty(){return Ec(this.executorsByZIndex_)}execute(e,t,n,r,s,o,a){let l=Object.keys(this.executorsByZIndex_).map(Number);l.sort(a?$G:Va),o=o||kd;let c=kd.length;for(let u=0,f=l.length;u<f;++u){let p=l[u].toString(),x=this.executorsByZIndex_[p];for(let v=0,w=o.length;v<w;++v){let S=o[v],T=x[S];if(T!==void 0){let R=a===null?void 0:T.getZIndexContext(),P=R?R.getContext():e,C=this.maxExtent_&&S!=="Image"&&S!=="Text";if(C&&(P.save(),this.clip(P,n)),!R||S==="Text"||S==="Image"?T.execute(P,t,n,r,s,a):R.pushFunction(L=>T.execute(L,t,n,r,s,a)),C&&P.restore(),R){R.offset();let L=l[u]*c+kd.indexOf(S);this.deferredZIndexContexts_[L]||(this.deferredZIndexContexts_[L]=[]),this.deferredZIndexContexts_[L].push(R)}}}}this.renderedContext_=e}getDeferredZIndexContexts(){return this.deferredZIndexContexts_}getRenderedContext(){return this.renderedContext_}renderDeferred(){let e=this.deferredZIndexContexts_,t=Object.keys(e).map(Number).sort(Va);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}},xN={};function pce(i){if(xN[i]!==void 0)return xN[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 xN[i]=r,r}var mH=yN;var bN=class extends YS{constructor(e,t,n,r,s,o,a){super(),this.context_=e,this.pixelRatio_=t,this.extent_=n,this.transform_=r,this.transformRotation_=r?q0(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_=Zs()}drawImages_(e,t,n,r){if(!this.image_)return;let s=qa(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 v=p+this.imageAnchorX_,w=x+this.imageAnchorY_;ho(a,v,w,1,1,c,-v,-w),o.save(),o.transform.apply(o,a),o.translate(v,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=qa(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=qa(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=KS(l,0,u,2,o,f,l),ZS(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_)),!!yr(this.extent_,e.getExtent())){if(this.fillState_||this.strokeState_){this.fillState_&&this.setContextFillState_(this.fillState_),this.strokeState_&&this.setContextStrokeState_(this.strokeState_);let t=Gz(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_)),!!yr(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(yr(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_)),!!yr(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_)),!!yr(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),Oo(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:Nd;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:Ha(n||ks)}}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||Wa,f=t.getOffset();this.strokeState_={lineCap:r!==void 0?r:Pu,lineDash:this.pixelRatio_===1?u:u.map(p=>p*this.pixelRatio_),lineDashOffset:(o||ja)*this.pixelRatio_,lineJoin:a!==void 0?a:Iu,lineWidth:(l!==void 0?l:hf)*this.pixelRatio_,miterLimit:c!==void 0?c:cf,strokeStyle:Ha(n||Uo),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:Ha(x||ks)}}let n=e.getStroke();if(!n)this.textStrokeState_=null;else{let x=n.getColor(),v=n.getLineCap(),w=n.getLineDash(),S=n.getLineDashOffset(),T=n.getLineJoin(),R=n.getWidth(),P=n.getMiterLimit();this.textStrokeState_={lineCap:v!==void 0?v:Pu,lineDash:w||Wa,lineDashOffset:S||ja,lineJoin:T!==void 0?T:Iu,lineWidth:R!==void 0?R:hf,miterLimit:P!==void 0?P:cf,strokeStyle:Ha(x||Uo)}}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:fS,textAlign:f!==void 0?f:Nd,textBaseline:p!==void 0?p:iA},this.text_=u!==void 0?Array.isArray(u)?u.reduce((x,v,w)=>x+=w%2?" ":v,""):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]]}}},gH=bN;var Gc=.5;function _H(i,e,t,n,r,s,o,a,l){let c=l?yd(r,l):r,u=i[0]*Gc,f=i[1]*Gc,p=Ti(u,f);p.imageSmoothingEnabled=!1;let x=p.canvas,v=new gH(p,Gc,r,null,o,a,l?j0($0(),l):null),w=t.length,S=Math.floor((256*256*256-1)/w),T={};for(let P=1;P<=w;++P){let C=t[P-1],L=C.getStyleFunction()||n;if(!L)continue;let D=L(C,s);if(!D)continue;Array.isArray(D)||(D=[D]);let N=(P*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||!yr(c,H.getExtent()))continue;let K=V.clone(),J=K.getFill();J&&J.setColor(N);let j=K.getStroke();j&&(j.setColor(N),j.setLineDash(null)),K.setText(void 0);let Z=V.getImage();if(Z){let de=Z.getImageSize();if(!de)continue;let be=Ti(de[0],de[1],void 0,{alpha:!1}),Ie=be.canvas;be.fillStyle=N,be.fillRect(0,0,Ie.width,Ie.height),K.setImage(new rA({img:Ie,anchor:Z.getAnchor(),anchorXUnits:"pixels",anchorYUnits:"pixels",offset:Z.getOrigin(),opacity:1,size:Z.getSize(),scale:Z.getScale(),rotation:Z.getRotation(),rotateWithView:Z.getRotateWithView()}))}let ee=K.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 be=0,Ie=de.length;be<Ie;++be){let Qe=de[be];ae[Qe.getType().replace("Multi","")].push(Qe,K)}}else ae[ce.replace("Multi","")].push(H,K)}}let R=Object.keys(T).map(Number).sort(Va);for(let P=0,C=R.length;P<C;++P){let L=T[R[P]];for(let D in L){let F=L[D];for(let N=0,B=F.length;N<B;N+=2){v.setStyle(F[N+1]);for(let z=0,V=e.length;z<V;++z)v.setTransform(e[z]),v.drawGeometry(F[N])}}}return p.getImageData(0,0,x.width,x.height)}function xH(i,e,t){let n=[];if(t){let r=Math.floor(Math.round(i[0])*Gc),s=Math.floor(Math.round(i[1])*Gc),o=(xi(r,0,t.width-1)+xi(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 Ace=.5,yH={Point:bce,LineString:xce,Polygon:Sce,MultiPoint:wce,MultiLineString:yce,MultiPolygon:vce,GeometryCollection:_ce,Circle:mce};function vH(i,e){return parseInt(Ln(i),10)-parseInt(Ln(e),10)}function wN(i,e){let t=SN(i,e);return t*t}function SN(i,e){return Ace*i/e}function mce(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 TN(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)),gce(i,e,t,n,s,o,a),f}function gce(i,e,t,n,r,s,o){let a=t.getGeometryFunction()(e);if(!a)return;let l=a.simplifyTransformed(n,r);if(t.getRenderer())bH(i,l,t,e,o);else{let u=yH[l.getType()];u(i,l,t,e,o,s)}}function bH(i,e,t,n,r){if(e.getType()=="GeometryCollection"){let o=e.getGeometries();for(let a=0,l=o.length;a<l;++a)bH(i,o[a],t,n,r);return}i.getBuilder(t.getZIndex(),"Default").drawCustom(e,n,t.getRenderer(),t.getHitDetectionRenderer(),r)}function _ce(i,e,t,n,r,s){let o=e.getGeometriesArray(),a,l;for(a=0,l=o.length;a<l;++a){let c=yH[o[a].getType()];c(i,o[a],t,n,r,s)}}function xce(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 yce(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 vce(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 bce(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 wce(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 Sce(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 EN=class extends $S{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_=Pr(),this.wrappedRenderedExtent_=Pr(),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,v=t.viewHints,w=!(v[Gs.ANIMATING]||v[Gs.INTERACTING]),S=this.context,T=Math.round(jn(r)/a*x),R=Math.round(xr(r)/a*x),P=f.getWrapX()&&l.canWrapX(),C=P?jn(u):null,L=P?Math.ceil((r[2]-u[2])/C)+(this.extendX_?2:1):1,D=P?Math.floor((r[0]-u[0])/C)-(this.extendX_?1:0):0;do{let F=this.getRenderTransform(o,a,0,x,T,R,D*C);t.declutter&&(F=F.slice(0)),e.execute(S,[S.canvas.width,S.canvas.height],F,c,w,n===void 0?kd:n?vN:dH,n?p&&t.declutter[p]:void 0)}while(++D<L)}setDrawContext_(){this.opacity_!==1&&(this.targetContext_=this.context,this.context=Ti(this.context.canvas.width,this.context.canvas.height,J5))}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),J5.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(mo.PRERENDER)||this.getLayer().hasListener(mo.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=Rc(n.extent,l);a=yr(u,e.extent),a&&!xu(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]*Gc,p=n[1]*Gc;u.push(this.getRenderTransform(r,s,o,Gc,f,p,0).slice());let x=c.getSource(),v=a.getExtent();if(x.getWrapX()&&a.canWrapX()&&!xu(v,l)){let S=l[0],T=jn(v),R=0,P;for(;S<v[0];)--R,P=T*R,u.push(this.getRenderTransform(r,s,o,Gc,f,p,P).slice()),S+=T;for(R=0,S=l[2];S>v[2];)++R,P=T*R,u.push(this.getRenderTransform(r,s,o,Gc,f,p,P).slice()),S-=T}let w=$0();this.hitDetectionImageData_=_H(n,u,this.renderedFeatures_,c.getStyleFunction(),l,s,o,wN(s,this.renderedPixelRatio_),w?a:null)}t(xH(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,v){let w=Ln(p),S=c[w];if(S){if(S!==!0&&v<S.distanceSq){if(v===0)return c[w]=!0,s.splice(s.lastIndexOf(S),1),r(p,l,x);S.geometry=x,S.distanceSq=v}}else{if(v===0)return c[w]=!0,r(p,l,x);s.push(c[w]={feature:p,layer:l,geometry:x,distanceSq:v,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[Gs.ANIMATING],s=e.viewHints[Gs.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(),v=t.getRenderBuffer(),w=t.getRenderOrder();w===void 0&&(w=vH);let S=c.center.slice(),T=ug(l,v*f),R=T.slice(),P=[T.slice()],C=u.getExtent(),L=n.getWrapX()&&u.canWrapX();if(this.extendX_=!1,L){let Z=n.getExtent();Z&&!vu(Z)&&(this.extendX_=Z[0]<C[0]||Z[2]>C[2])}if(L&&(!xu(C,e.extent)||this.extendX_)){let Z=jn(C),ee=Math.max(jn(T)/2,Z),ae=C[0],ce=C[2];this.extendX_&&(ae-=Z,ce+=Z),T[0]=ae-ee,T[2]=ce+ee,bw(S,u);let de=fP(P[0],u);de[0]<C[0]&&de[2]<C[2]?P.push([de[0]+Z,de[1],de[2]+Z,de[3]]):de[0]>C[0]&&de[2]>C[2]&&P.push([de[0]-Z,de[1],de[2]-Z,de[3]])}if(this.ready&&this.renderedResolution_==f&&this.renderedPixelRatio_===p&&this.renderedRevision_==x&&this.renderedRenderOrder_==w&&this.renderedFrameDeclutter_===!!e.declutter&&xu(this.wrappedRenderedExtent_,T))return Oo(this.renderedExtent_,R)||(this.hitDetectionImageData_=null,this.renderedExtent_=R),this.renderedCenter_=S,this.replayGroupChanged=!1,!0;this.replayGroup_=null;let D=new aH(SN(f,p),T,f,p),F=$0(),N;if(F){for(let Z=0,ee=P.length;Z<ee;++Z){let ae=P[Z],ce=yd(ae,u);n.loadFeatures(ce,WG(f,u),F)}N=j0(F,u)}else for(let Z=0,ee=P.length;Z<ee;++Z)n.loadFeatures(P[Z],f,u);let B=wN(f,p),z=!0,V=(Z,ee)=>{let ae,ce=Z.getStyleFunction()||t.getStyleFunction();if(ce&&(ae=ce(Z,f)),ae){let de=this.renderFeature(Z,B,ae,D,N,this.getLayer().getDeclutter(),ee);z=z&&!de}},H=yd(T,u),K=n.getFeaturesInExtent(H);w&&K.sort(w);for(let Z=0,ee=K.length;Z<ee;++Z)V(K[Z],Z);this.renderedFeatures_=K,this.ready=z;let J=D.finish(),j=new mH(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_=R,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=TN(r,e,n[c],t,this.boundHandleStyleImageChange_,s,o,a)||l;else l=TN(r,e,n,t,this.boundHandleStyleImageChange_,s,o,a);return l}},wH=EN;var MN=class extends HS{constructor(e){super(e)}createRenderer(){return new wH(this)}},SH=MN;var Tce=!1;function Ece(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=Tce,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 CN(i,e){return function(t,n,r,s,o){Ece(i,e,t,n,r,(a,l)=>{this.addFeatures(a),s!==void 0&&s(a)},()=>{this.changed(),o!==void 0&&o()})}}function TH(i,e){return[[-1/0,-1/0,1/0,1/0]]}function RN(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],R=i[S+1];p+=Math.sqrt((T-u)*(T-u)+(R-f)*(R-f)),x.push(p),u=T,f=R}let v=r*p,w=XG(x,v);w<0?(l=(v-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]:Fo(i[a+u],i[a+n+u],l);return s}var EH=Zs(),dy=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"?Aw(this.flatCoordinates_):hg(this.flatCoordinates_,0,this.flatCoordinates_.length,this.stride_)),this.extent_}getFlatInteriorPoint(){if(!this.flatInteriorPoints_){let e=za(this.getExtent());this.flatInteriorPoints_=Bx(this.flatCoordinates_,0,this.ends_,this.stride_,e,0)}return this.flatInteriorPoints_}getFlatInteriorPoints(){if(!this.flatInteriorPoints_){let e=nV(this.flatCoordinates_,this.ends_),t=tS(this.flatCoordinates_,0,e,this.stride_);this.flatInteriorPoints_=Qw(this.flatCoordinates_,0,e,this.stride_,t)}return this.flatInteriorPoints_}getFlatMidpoint(){return this.flatMidpoints_||(this.flatMidpoints_=RN(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=RN(e,t,o,this.stride_,.5);Pc(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=vs(e);let t=e.getExtent(),n=e.getWorldExtent();if(t&&n){let r=xr(n)/xr(t);ho(EH,n[0],n[3],r,-r,0,0,0),qa(this.flatCoordinates_,0,this.flatCoordinates_.length,this.stride_,EH,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=Fw((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=Fx(n,0,this.simplifiedGeometry_.flatCoordinates_.length,this.simplifiedGeometry_.stride_,e,n,0),r=[n.length];break;case"MultiLineString":r=[],n.length=Qz(n,0,this.simplifiedGeometry_.ends_,this.simplifiedGeometry_.stride_,e,n,0,r);break;case"Polygon":r=[],n.length=Ox(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}};dy.prototype.getFlatCoordinates=dy.prototype.getOrientedFlatCoordinates;var fA=dy;var PN=class{constructor(e){this.rbush_=new cA(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_[Ln(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_[Ln(a)]=l}this.rbush_.load(n)}remove(e){let t=Ln(e),n=this.items_[t];return delete this.items_[t],this.rbush_.remove(n)!==null}update(e,t){let n=this.items_[Ln(t)],r=[n.minX,n.minY,n.maxX,n.maxY];z0(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 Ec(this.items_)}clear(){this.rbush_.clear(),this.items_={}}getExtent(e){let t=this.rbush_.toJSON();return dl(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=PN;var ml={ADDFEATURE:"addfeature",CHANGEFEATURE:"changefeature",CLEAR:"clear",REMOVEFEATURE:"removefeature",FEATURESLOADSTART:"featuresloadstart",FEATURESLOADEND:"featuresloadend",FEATURESLOADERROR:"featuresloaderror"};var Uu=class extends Ks{constructor(e,t,n){super(e),this.feature=t,this.features=n}},NN=class extends Hw{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_=of,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&&(Vn(this.format_,"`format` must be set when `url` is set"),this.loader_=CN(this.url_,this.format_)),this.strategy_=e.strategy!==void 0?e.strategy:TH;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 po(r)),r!==void 0&&this.addFeaturesInternal(r),n!==void 0&&this.bindFeaturesCollection_(n)}addFeature(e){this.addFeatureInternal(e),this.changed()}addFeatureInternal(e){let t=Ln(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 Uu(ml.ADDFEATURE,e))}setupChangeEvents_(e,t){t instanceof fA||(this.featureChangeKeys_[e]=[kn(t,Jt.CHANGE,this.handleFeatureChange_,this),kn(t,Ic.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 fA){let s=this.idIndex_[r];s instanceof fA?Array.isArray(s)?s.push(t):this.idIndex_[r]=[s,t]:n=!1}else n=!1}return n&&(Vn(!(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=Ln(a);this.addToIndex_(l,a)&&n.push(a)}for(let s=0,o=n.length;s<o;s++){let a=n[s],l=Ln(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(ml.ADDFEATURE))for(let s=0,o=n.length;s<o;s++)this.dispatchEvent(new Uu(ml.ADDFEATURE,n[s]))}bindFeaturesCollection_(e){let t=!1;this.addEventListener(ml.ADDFEATURE,function(n){t||(t=!0,e.push(n.feature),t=!1)}),this.addEventListener(ml.REMOVEFEATURE,function(n){t||(t=!0,e.remove(n.feature),t=!1)}),e.addEventListener(Qs.ADD,n=>{t||(t=!0,this.addFeature(n.element),t=!1)}),e.addEventListener(Qs.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(ri);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 Uu(ml.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 fA||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 fA||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(),Ec(this.nullGeometryFeatures_)||Pc(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=_w(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||rf,this.featuresRtree_.forEachInExtent(l,function(c){if(t(c)){let u=c.getGeometry(),f=a;if(a=u instanceof fA?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=Ln(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 Uu(ml.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 Ln(e)in this.uidIndex_}isEmpty(){return this.featuresRtree_?this.featuresRtree_.isEmpty()&&Ec(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 xu(u.extent,l)})){this.loading=Number(this.loading)+1,this.dispatchEvent(new Uu(ml.FEATURESLOADSTART));let u=v=>{this.loading=Number(this.loading)-1,this.dispatchEvent(new Uu(ml.FEATURESLOADEND,void 0,v))},f=()=>{this.changed(),this.loading=Number(this.loading)-1,this.dispatchEvent(new Uu(ml.FEATURESLOADERROR))},p=!1,x=this.loader_.call(this,l,t,n,v=>p||u(v),()=>p||f());x instanceof Promise?(p=!0,x.then(v=>{this.addFeatures(v),u(v)}).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=hP(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=Ln(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(ri),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(ml.REMOVEFEATURE)&&this.dispatchEvent(new Uu(ml.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){Vn(this.format_,"`format` must be set when `url` is set"),this.url_=e,this.setLoader(CN(e,this.format_))}setOverlaps(e){this.overlaps_=e,this.changed()}},vf=NN;var ya={LEFT:0,MIDDLE:1,RIGHT:2,ROTATE:0,DOLLY:1,PAN:2},op={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},i3=0,o2=1,r3=2;var yL=0,ap=1,s3=2,tc=3,xo=0,hi=1,sr=2,Qr=0,cs=1,ju=2,Xu=3,$u=4,Uf=5,a2=6,zs=100,l2=101,c2=102,o3=103,a3=104,Xc=200,u2=201,h2=202,f2=203,Xd=204,$d=205,d2=206,p2=207,A2=208,m2=209,g2=210,AW=211,mW=212,gW=213,_W=214,gA=0,_A=1,xA=2,zu=3,yA=4,vA=5,bA=6,wA=7,GA=0,l3=1,c3=2,Vs=0,_2=1,x2=2,y2=3,v2=4,vL=5,b2=6,w2=7;var S2=300,bl=301,nc=302,lp=303,cp=304,Yu=306,If=1e3,qo=1001,Nf=1002,yi=1003,T2=1004;var ic=1005;var bi=1006,up=1007;var vo=1008,bL=1008,Vi=1009,Ku=1010,Zu=1011,Ka=1012,Fr=1013,Ai=1014,Zi=1015,Fi=1016,zA=1017,VA=1018,Wo=1020,qA=35902,HA=35899,N_=1021,kf=1022,wr=1023,Ts=1026,eo=1027,Gf=1028,Qu=1029,Rs=1030,Ju=1031,E2=1032,hp=1033,eh=33776,th=33777,nh=33778,ih=33779,WA=35840,jA=35841,XA=35842,$A=35843,fp=36196,dp=37492,pp=37496,Ap=37488,mp=37489,rh=37490,gp=37491,_p=37808,xp=37809,yp=37810,vp=37811,bp=37812,wp=37813,Sp=37814,Tp=37815,Ep=37816,Mp=37817,Cp=37818,Rp=37819,Pp=37820,Ip=37821,Np=36492,Lp=36494,Dp=36495,Fp=36283,Op=36284,sh=36285,Bp=36286;var My=2300,IT=2301,RT=2302,aL=2303,lL=2400,cL=2401,uL=2402;var wL=0,SL=1,u3=2,xW=3200;var wl=0,h3=1,jo="",vr="srgb",Yd="srgb-linear",Kd="linear",Bt="srgb",M2="",f3="rg",TL="ga",EL=0,Mf=7680,ML=7681,CL=7682,RL=7683,PL=34055,IL=34056,NL=5386,LL=512,DL=513,FL=514,OL=515,BL=516,UL=517,kL=518,Cy=519,C2=512,L_=513,R2=514,oh=515,YA=516,P2=517,$c=518,I2=519,Zd=35044,KA=35048;var GL="300 es",_o=2e3,Xa=2001,rc={COMPUTE:"compute",RENDER:"render"};var zf={TEXTURE_COMPARE:"depthTextureCompare"};function Mce(i){for(let e=i.length-1;e>=0;--e)if(i[e]>=65535)return!0;return!1}function D_(i){return ArrayBuffer.isView(i)&&!(i instanceof DataView)}function m_(i){return document.createElementNS("http://www.w3.org/1999/xhtml",i)}function d3(){let i=m_("canvas");return i.style.display="block",i}var MH={},g_=null;function SA(...i){let e="THREE."+i.shift();g_?g_("log",e,...i):console.log(e,...i)}function yW(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=yW(i);let e="THREE."+i.shift();if(g_)g_("warn",e,...i);else{let t=i[0];t&&t.isStackTrace?console.warn(t.getError(e)):console.warn(e,...i)}}function Ge(...i){i=yW(i);let e="THREE."+i.shift();if(g_)g_("error",e,...i);else{let t=i[0];t&&t.isStackTrace?console.error(t.getError(e)):console.error(e,...i)}}function Qn(...i){let e=i.join(" ");e in MH||(MH[e]=!0,je(...i))}function zL(){return typeof self<"u"&&typeof self.scheduler<"u"&&typeof self.scheduler.yield<"u"?self.scheduler.yield():new Promise(i=>{requestAnimationFrame(i)})}function vW(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 N2={[gA]:_A,[xA]:bA,[yA]:wA,[zu]:vA,[_A]:gA,[bA]:xA,[wA]:yA,[vA]:zu},Ho=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}}},zo=["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"],CH=1234567,wy=Math.PI/180,Lf=180/Math.PI;function Gu(){let i=Math.random()*4294967295|0,e=Math.random()*4294967295|0,t=Math.random()*4294967295|0,n=Math.random()*4294967295|0;return(zo[i&255]+zo[i>>8&255]+zo[i>>16&255]+zo[i>>24&255]+"-"+zo[e&255]+zo[e>>8&255]+"-"+zo[e>>16&15|64]+zo[e>>24&255]+"-"+zo[t&63|128]+zo[t>>8&255]+"-"+zo[t>>16&255]+zo[t>>24&255]+zo[n&255]+zo[n>>8&255]+zo[n>>16&255]+zo[n>>24&255]).toLowerCase()}function In(i,e,t){return Math.max(e,Math.min(t,i))}function VL(i,e){return(i%e+e)%e}function Cce(i,e,t,n,r){return n+(i-e)*(r-n)/(t-e)}function Rce(i,e,t){return i!==e?(t-i)/(e-i):0}function Sy(i,e,t){return(1-t)*i+t*e}function Pce(i,e,t,n){return Sy(i,e,1-Math.exp(-t*n))}function Ice(i,e=1){return e-Math.abs(VL(i,e*2)-e)}function Nce(i,e,t){return i<=e?0:i>=t?1:(i=(i-e)/(t-e),i*i*(3-2*i))}function Lce(i,e,t){return i<=e?0:i>=t?1:(i=(i-e)/(t-e),i*i*i*(i*(i*6-15)+10))}function Dce(i,e){return i+Math.floor(Math.random()*(e-i+1))}function Fce(i,e){return i+Math.random()*(e-i)}function Oce(i){return i*(.5-Math.random())}function Bce(i){i!==void 0&&(CH=i);let e=CH+=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 Uce(i){return i*wy}function kce(i){return i*Lf}function Gce(i){return(i&i-1)===0&&i!==0}function zce(i){return Math.pow(2,Math.ceil(Math.log(i)/Math.LN2))}function Vce(i){return Math.pow(2,Math.floor(Math.log(i)/Math.LN2))}function qce(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),v=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*v,l*x,a*c);break;case"YXY":i.set(l*x,a*u,l*v,a*c);break;case"ZYZ":i.set(l*v,l*x,a*u,a*c);break;default:je("MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+r)}}function fa(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 Wn(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 Yc={DEG2RAD:wy,RAD2DEG:Lf,generateUUID:Gu,clamp:In,euclideanModulo:VL,mapLinear:Cce,inverseLerp:Rce,lerp:Sy,damp:Pce,pingpong:Ice,smoothstep:Nce,smootherstep:Lce,randInt:Dce,randFloat:Fce,randFloatSpread:Oce,seededRandom:Bce,degToRad:Uce,radToDeg:kce,isPowerOfTwo:Gce,ceilPowerOfTwo:zce,floorPowerOfTwo:Vce,setQuaternionFromProperEuler:qce,normalize:Wn,denormalize:fa},XL=class XL{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=In(this.x,e.x,t.x),this.y=In(this.y,e.y,t.y),this}clampScalar(e,t){return this.x=In(this.x,e,t),this.y=In(this.y,e,t),this}clampLength(e,t){let n=this.length();return this.divideScalar(n||1).multiplyScalar(In(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(In(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}};XL.prototype.isVector2=!0;var Oe=XL,Es=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],v=s[o+2],w=s[o+3];if(f!==w||l!==p||c!==x||u!==v){let S=l*p+c*x+u*v+f*w;S<0&&(p=-p,x=-x,v=-v,w=-w,S=-S);let T=1-a;if(S<.9995){let R=Math.acos(S),P=Math.sin(R);T=Math.sin(T*R)/P,a=Math.sin(a*R)/P,l=l*T+p*a,c=c*T+x*a,u=u*T+v*a,f=f*T+w*a}else{l=l*T+p*a,c=c*T+x*a,u=u*T+v*a,f=f*T+w*a;let R=1/Math.sqrt(l*l+c*c+u*u+f*f);l*=R,c*=R,u*=R,f*=R}}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],v=s[o+3];return e[t]=a*v+u*f+l*x-c*p,e[t+1]=l*v+u*p+c*f-a*x,e[t+2]=c*v+u*x+a*p-l*f,e[t+3]=u*v-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),v=l(s/2);switch(o){case"XYZ":this._x=p*u*f+c*x*v,this._y=c*x*f-p*u*v,this._z=c*u*v+p*x*f,this._w=c*u*f-p*x*v;break;case"YXZ":this._x=p*u*f+c*x*v,this._y=c*x*f-p*u*v,this._z=c*u*v-p*x*f,this._w=c*u*f+p*x*v;break;case"ZXY":this._x=p*u*f-c*x*v,this._y=c*x*f+p*u*v,this._z=c*u*v+p*x*f,this._w=c*u*f-p*x*v;break;case"ZYX":this._x=p*u*f-c*x*v,this._y=c*x*f+p*u*v,this._z=c*u*v-p*x*f,this._w=c*u*f+p*x*v;break;case"YZX":this._x=p*u*f+c*x*v,this._y=c*x*f+p*u*v,this._z=c*u*v-p*x*f,this._w=c*u*f-p*x*v;break;case"XZY":this._x=p*u*f-c*x*v,this._y=c*x*f-p*u*v,this._z=c*u*v+p*x*f,this._w=c*u*f+p*x*v;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(In(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}},$L=class $L{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(RH.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(RH.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=In(this.x,e.x,t.x),this.y=In(this.y,e.y,t.y),this.z=In(this.z,e.z,t.z),this}clampScalar(e,t){return this.x=In(this.x,e,t),this.y=In(this.y,e,t),this.z=In(this.z,e,t),this}clampLength(e,t){let n=this.length();return this.divideScalar(n||1).multiplyScalar(In(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(In(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}};$L.prototype.isVector3=!0;var ie=$L,LN=new ie,RH=new Es,YL=class YL{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],v=n[8],w=r[0],S=r[3],T=r[6],R=r[1],P=r[4],C=r[7],L=r[2],D=r[5],F=r[8];return s[0]=o*w+a*R+l*L,s[3]=o*S+a*P+l*D,s[6]=o*T+a*C+l*F,s[1]=c*w+u*R+f*L,s[4]=c*S+u*P+f*D,s[7]=c*T+u*C+f*F,s[2]=p*w+x*R+v*L,s[5]=p*S+x*P+v*D,s[8]=p*T+x*C+v*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,v=t*f+n*p+r*x;if(v===0)return this.set(0,0,0,0,0,0,0,0,0);let w=1/v;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 Qn("Matrix3: .scale() is deprecated. Use .makeScale() instead."),this.premultiply(DN.makeScale(e,t)),this}rotate(e){return Qn("Matrix3: .rotate() is deprecated. Use .makeRotation() instead."),this.premultiply(DN.makeRotation(-e)),this}translate(e,t){return Qn("Matrix3: .translate() is deprecated. Use .makeTranslation() instead."),this.premultiply(DN.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)}};YL.prototype.isMatrix3=!0;var Sn=YL,DN=new Sn,PH=new Sn().set(.4123908,.3575843,.1804808,.212639,.7151687,.0721923,.0193308,.1191948,.9505322),IH=new Sn().set(3.2409699,-1.5373832,-.4986108,-.9692436,1.8759675,.0415551,.0556301,-.203977,1.0569715);function Hce(){let i={enabled:!0,workingColorSpace:Yd,spaces:{},convert:function(r,s,o){return this.enabled===!1||s===o||!s||!o||(this.spaces[s].transfer===Bt&&(r.r=Pf(r.r),r.g=Pf(r.g),r.b=Pf(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===jo?Kd: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 Qn("ColorManagement: .fromWorkingColorSpace() has been renamed to .workingToColorSpace()."),i.workingToColorSpace(r,s)},toWorkingColorSpace:function(r,s){return Qn("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({[Yd]:{primaries:e,whitePoint:n,transfer:Kd,toXYZ:PH,fromXYZ:IH,luminanceCoefficients:t,workingColorSpaceConfig:{unpackColorSpace:vr},outputColorSpaceConfig:{drawingBufferColorSpace:vr}},[vr]:{primaries:e,whitePoint:n,transfer:Bt,toXYZ:PH,fromXYZ:IH,luminanceCoefficients:t,outputColorSpaceConfig:{drawingBufferColorSpace:vr}}}),i}var sn=Hce();function Pf(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 Kg,NT=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{Kg===void 0&&(Kg=m_("canvas")),Kg.width=e.width,Kg.height=e.height;let r=Kg.getContext("2d");e instanceof ImageData?r.putImageData(e,0,0):r.drawImage(e,0,0,e.width,e.height),n=Kg}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=m_("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]=Pf(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(Pf(t[n]/255)*255):t[n]=Pf(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}},Wce=0,__=class{constructor(e=null){this.isSource=!0,Object.defineProperty(this,"id",{value:Wce++}),this.uuid=Gu(),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(FN(r[o].image)):s.push(FN(r[o]))}else s=FN(r);n.url=s}return t||(e.images[this.uuid]=n),n}};function FN(i){return typeof HTMLImageElement<"u"&&i instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&i instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&i instanceof ImageBitmap?NT.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 jce=0,ON=new ie,Ms=class i extends Ho{constructor(e=i.DEFAULT_IMAGE,t=i.DEFAULT_MAPPING,n=qo,r=qo,s=bi,o=vo,a=wr,l=Vi,c=i.DEFAULT_ANISOTROPY,u=jo){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:jce++}),this.uuid=Gu(),this.name="",this.source=new __(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(ON).x}get height(){return this.source.getSize(ON).y}get depth(){return this.source.getSize(ON).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!==S2)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case If:e.x=e.x-Math.floor(e.x);break;case qo:e.x=e.x<0?0:1;break;case Nf: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 If:e.y=e.y-Math.floor(e.y);break;case qo:e.y=e.y<0?0:1;break;case Nf: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++}};Ms.DEFAULT_IMAGE=null;Ms.DEFAULT_MAPPING=S2;Ms.DEFAULT_ANISOTROPY=1;var KL=class KL{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],v=l[9],w=l[2],S=l[6],T=l[10];if(Math.abs(u-p)<.01&&Math.abs(f-w)<.01&&Math.abs(v-S)<.01){if(Math.abs(u+p)<.1&&Math.abs(f+w)<.1&&Math.abs(v+S)<.1&&Math.abs(c+x+T-3)<.1)return this.set(1,0,0,0),this;t=Math.PI;let P=(c+1)/2,C=(x+1)/2,L=(T+1)/2,D=(u+p)/4,F=(f+w)/4,N=(v+S)/4;return P>C&&P>L?P<.01?(n=0,r=.707106781,s=.707106781):(n=Math.sqrt(P),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 R=Math.sqrt((S-v)*(S-v)+(f-w)*(f-w)+(p-u)*(p-u));return Math.abs(R)<.001&&(R=1),this.x=(S-v)/R,this.y=(f-w)/R,this.z=(p-u)/R,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=In(this.x,e.x,t.x),this.y=In(this.y,e.y,t.y),this.z=In(this.z,e.z,t.z),this.w=In(this.w,e.w,t.w),this}clampScalar(e,t){return this.x=In(this.x,e,t),this.y=In(this.y,e,t),this.z=In(this.z,e,t),this.w=In(this.w,e,t),this}clampLength(e,t){let n=this.length();return this.divideScalar(n||1).multiplyScalar(In(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}};KL.prototype.isVector4=!0;var gn=KL,da=class extends Ho{constructor(e=1,t=1,n={}){super(),n=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:bi,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 Ms(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:bi,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 __(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"})}},pa=class extends da{constructor(e=1,t=1,n={}){super(e,t,n),this.isWebGLRenderTarget=!0}},TA=class extends Ms{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=yi,this.minFilter=yi,this.wrapR=qo,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.layerUpdates=new Set}addLayerUpdate(e){this.layerUpdates.add(e)}clearLayerUpdates(){this.layerUpdates.clear()}};var LT=class extends Ms{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=yi,this.minFilter=yi,this.wrapR=qo,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}};var n3=class n3{constructor(e,t,n,r,s,o,a,l,c,u,f,p,x,v,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,v,w,S)}set(e,t,n,r,s,o,a,l,c,u,f,p,x,v,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]=v,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 n3().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/Zg.setFromMatrixColumn(e,0).length(),s=1/Zg.setFromMatrixColumn(e,1).length(),o=1/Zg.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,v=a*u,w=a*f;t[0]=l*u,t[4]=-l*f,t[8]=c,t[1]=x+v*c,t[5]=p-w*c,t[9]=-a*l,t[2]=w-p*c,t[6]=v+x*c,t[10]=o*l}else if(e.order==="YXZ"){let p=l*u,x=l*f,v=c*u,w=c*f;t[0]=p+w*a,t[4]=v*a-x,t[8]=o*c,t[1]=o*f,t[5]=o*u,t[9]=-a,t[2]=x*a-v,t[6]=w+p*a,t[10]=o*l}else if(e.order==="ZXY"){let p=l*u,x=l*f,v=c*u,w=c*f;t[0]=p-w*a,t[4]=-o*f,t[8]=v+x*a,t[1]=x+v*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,v=a*u,w=a*f;t[0]=l*u,t[4]=v*c-x,t[8]=p*c+w,t[1]=l*f,t[5]=w*c+p,t[9]=x*c-v,t[2]=-c,t[6]=a*l,t[10]=o*l}else if(e.order==="YZX"){let p=o*l,x=o*c,v=a*l,w=a*c;t[0]=l*u,t[4]=w-p*f,t[8]=v*f+x,t[1]=f,t[5]=o*u,t[9]=-a*u,t[2]=-c*u,t[6]=x*f+v,t[10]=p-w*f}else if(e.order==="XZY"){let p=o*l,x=o*c,v=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-v,t[2]=v*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(Xce,e,$ce)}lookAt(e,t,n){let r=this.elements;return gl.subVectors(e,t),gl.lengthSq()===0&&(gl.z=1),gl.normalize(),Gd.crossVectors(n,gl),Gd.lengthSq()===0&&(Math.abs(n.z)===1?gl.x+=1e-4:gl.z+=1e-4,gl.normalize(),Gd.crossVectors(n,gl)),Gd.normalize(),QS.crossVectors(gl,Gd),r[0]=Gd.x,r[4]=QS.x,r[8]=gl.x,r[1]=Gd.y,r[5]=QS.y,r[9]=gl.y,r[2]=Gd.z,r[6]=QS.z,r[10]=gl.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],v=n[2],w=n[6],S=n[10],T=n[14],R=n[3],P=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],K=r[13],J=r[2],j=r[6],Z=r[10],ee=r[14],ae=r[3],ce=r[7],de=r[11],be=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*Z+c*de,s[12]=o*B+a*K+l*ee+c*be,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*Z+x*de,s[13]=u*B+f*K+p*ee+x*be,s[2]=v*D+w*z+S*J+T*ae,s[6]=v*F+w*V+S*j+T*ce,s[10]=v*N+w*H+S*Z+T*de,s[14]=v*B+w*K+S*ee+T*be,s[3]=R*D+P*z+C*J+L*ae,s[7]=R*F+P*V+C*j+L*ce,s[11]=R*N+P*H+C*Z+L*de,s[15]=R*B+P*K+C*ee+L*be,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],v=e[3],w=e[7],S=e[11],T=e[15],R=l*x-c*p,P=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*R-S*P+T*C)-n*(v*R-S*L+T*D)+r*(v*P-w*L+T*F)-s*(v*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],v=e[12],w=e[13],S=e[14],T=e[15],R=t*a-n*o,P=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*v,B=u*S-p*v,z=u*T-x*v,V=f*S-p*w,H=f*T-x*w,K=p*T-x*S,J=R*K-P*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*K-l*H+c*V)*j,e[1]=(r*H-n*K-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*K-c*B)*j,e[5]=(t*K-r*z+s*B)*j,e[6]=(S*C-v*F-T*P)*j,e[7]=(u*F-p*C+x*P)*j,e[8]=(o*H-a*z+c*N)*j,e[9]=(n*z-t*H-s*N)*j,e[10]=(v*D-w*C+T*R)*j,e[11]=(f*C-u*D-x*R)*j,e[12]=(a*B-o*V-l*N)*j,e[13]=(t*V-n*B+r*N)*j,e[14]=(w*P-v*L-S*R)*j,e[15]=(u*L-f*P+p*R)*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,v=s*f,w=o*u,S=o*f,T=a*f,R=l*c,P=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]=(v-P)*L,r[3]=0,r[4]=(x-C)*D,r[5]=(1-(p+T))*D,r[6]=(S+R)*D,r[7]=0,r[8]=(v+P)*F,r[9]=(S-R)*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=Zg.set(r[0],r[1],r[2]).length(),a=Zg.set(r[4],r[5],r[6]).length(),l=Zg.set(r[8],r[9],r[10]).length();s<0&&(o=-o),zc.copy(this);let c=1/o,u=1/a,f=1/l;return zc.elements[0]*=c,zc.elements[1]*=c,zc.elements[2]*=c,zc.elements[4]*=u,zc.elements[5]*=u,zc.elements[6]*=u,zc.elements[8]*=f,zc.elements[9]*=f,zc.elements[10]*=f,t.setFromRotationMatrix(zc),n.x=o,n.y=a,n.z=l,this}makePerspective(e,t,n,r,s,o,a=_o,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),v,w;if(l)v=s/(o-s),w=o*s/(o-s);else if(a===_o)v=-(o+s)/(o-s),w=-2*o*s/(o-s);else if(a===Xa)v=-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]=v,c[14]=w,c[3]=0,c[7]=0,c[11]=-1,c[15]=0,this}makeOrthographic(e,t,n,r,s,o,a=_o,l=!1){let c=this.elements,u=2/(t-e),f=2/(n-r),p=-(t+e)/(t-e),x=-(n+r)/(n-r),v,w;if(l)v=1/(o-s),w=o/(o-s);else if(a===_o)v=-2/(o-s),w=-(o+s)/(o-s);else if(a===Xa)v=-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]=v,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}};n3.prototype.isMatrix4=!0;var on=n3,Zg=new ie,zc=new on,Xce=new ie(0,0,0),$ce=new ie(1,1,1),Gd=new ie,QS=new ie,gl=new ie,NH=new on,LH=new Es,Aa=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(In(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(-In(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(In(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(-In(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(In(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(-In(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 LH.setFromEuler(this),this.setFromQuaternion(LH,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}};Aa.DEFAULT_ORDER="XYZ";var x_=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}},Yce=0,DH=new ie,Qg=new Es,bf=new on,JS=new ie,py=new ie,Kce=new ie,Zce=new Es,FH=new ie(1,0,0),OH=new ie(0,1,0),BH=new ie(0,0,1),UH={type:"added"},Qce={type:"removed"},Jg={type:"childadded",child:null},BN={type:"childremoved",child:null},Ki=class i extends Ho{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:Yce++}),this.uuid=Gu(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=i.DEFAULT_UP.clone();let e=new ie,t=new Aa,n=new Es,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 x_,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 Qg.setFromAxisAngle(e,t),this.quaternion.multiply(Qg),this}rotateOnWorldAxis(e,t){return Qg.setFromAxisAngle(e,t),this.quaternion.premultiply(Qg),this}rotateX(e){return this.rotateOnAxis(FH,e)}rotateY(e){return this.rotateOnAxis(OH,e)}rotateZ(e){return this.rotateOnAxis(BH,e)}translateOnAxis(e,t){return DH.copy(e).applyQuaternion(this.quaternion),this.position.add(DH.multiplyScalar(t)),this}translateX(e){return this.translateOnAxis(FH,e)}translateY(e){return this.translateOnAxis(OH,e)}translateZ(e){return this.translateOnAxis(BH,e)}localToWorld(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(this.matrixWorld)}worldToLocal(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(bf.copy(this.matrixWorld).invert())}lookAt(e,t,n){e.isVector3?JS.copy(e):JS.set(e,t,n);let r=this.parent;this.updateWorldMatrix(!0,!1),py.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?bf.lookAt(py,JS,this.up):bf.lookAt(JS,py,this.up),this.quaternion.setFromRotationMatrix(bf),r&&(bf.extractRotation(r.matrixWorld),Qg.setFromRotationMatrix(bf),this.quaternion.premultiply(Qg.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(UH),Jg.child=e,this.dispatchEvent(Jg),Jg.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(Qce),BN.child=e,this.dispatchEvent(BN),BN.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),bf.copy(this.matrixWorld).invert(),e.parent!==null&&(e.parent.updateWorldMatrix(!0,!1),bf.multiply(e.parent.matrixWorld)),e.applyMatrix4(bf),e.removeFromParent(),e.parent=this,this.children.push(e),e.updateWorldMatrix(!1,!0),e.dispatchEvent(UH),Jg.child=e,this.dispatchEvent(Jg),Jg.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(py,e,Kce),e}getWorldScale(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(py,Zce,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),v=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),v.length>0&&(n.nodes=v)}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}};Ki.DEFAULT_UP=new ie(0,1,0);Ki.DEFAULT_MATRIX_AUTO_UPDATE=!0;Ki.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;var br=class extends Ki{constructor(){super(),this.isGroup=!0,this.type="Group"}},Jce={type:"move"},Qd=class{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new br,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 br,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 br,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,v=.005;c.inputState.pinching&&p>x+v?(c.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!c.inputState.pinching&&p<=x-v&&(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(Jce)))}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 br;n.matrixAutoUpdate=!1,n.visible=!1,e.joints[t.jointName]=n,e.add(n)}return e.joints[t.jointName]}},bW={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},zd={h:0,s:0,l:0},eT={h:0,s:0,l:0};function UN(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=vr){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=VL(e,1),t=In(t,0,1),n=In(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=UN(o,s,e+1/3),this.g=UN(o,s,e),this.b=UN(o,s,e-1/3)}return sn.colorSpaceToWorking(this,r),this}setStyle(e,t=vr){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=vr){let n=bW[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=Pf(e.r),this.g=Pf(e.g),this.b=Pf(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=vr){return sn.workingToColorSpace(Vo.copy(this),e),Math.round(In(Vo.r*255,0,255))*65536+Math.round(In(Vo.g*255,0,255))*256+Math.round(In(Vo.b*255,0,255))}getHexString(e=vr){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=sn.workingColorSpace){sn.workingToColorSpace(Vo.copy(this),t);let n=Vo.r,r=Vo.g,s=Vo.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(Vo.copy(this),t),e.r=Vo.r,e.g=Vo.g,e.b=Vo.b,e}getStyle(e=vr){sn.workingToColorSpace(Vo.copy(this),e);let t=Vo.r,n=Vo.g,r=Vo.b;return e!==vr?`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(zd),this.setHSL(zd.h+e,zd.s+t,zd.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(zd),e.getHSL(eT);let n=Sy(zd.h,eT.h,t),r=Sy(zd.s,eT.s,t),s=Sy(zd.l,eT.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}},Vo=new Ut;Ut.NAMES=bW;var Jd=class extends Ki{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 Aa,this.environmentIntensity=1,this.environmentRotation=new Aa,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}},Vc=new ie,wf=new ie,kN=new ie,Sf=new ie,e_=new ie,t_=new ie,kH=new ie,GN=new ie,zN=new ie,VN=new ie,qN=new gn,HN=new gn,WN=new gn,Cf=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),Vc.subVectors(e,t),r.cross(Vc);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){Vc.subVectors(r,t),wf.subVectors(n,t),kN.subVectors(e,t);let o=Vc.dot(Vc),a=Vc.dot(wf),l=Vc.dot(kN),c=wf.dot(wf),u=wf.dot(kN),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,v=(o*u-a*l)*p;return s.set(1-x-v,v,x)}static containsPoint(e,t,n,r){return this.getBarycoord(e,t,n,r,Sf)===null?!1:Sf.x>=0&&Sf.y>=0&&Sf.x+Sf.y<=1}static getInterpolation(e,t,n,r,s,o,a,l){return this.getBarycoord(e,t,n,r,Sf)===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,Sf.x),l.addScaledVector(o,Sf.y),l.addScaledVector(a,Sf.z),l)}static getInterpolatedAttribute(e,t,n,r,s,o){return qN.setScalar(0),HN.setScalar(0),WN.setScalar(0),qN.fromBufferAttribute(e,t),HN.fromBufferAttribute(e,n),WN.fromBufferAttribute(e,r),o.setScalar(0),o.addScaledVector(qN,s.x),o.addScaledVector(HN,s.y),o.addScaledVector(WN,s.z),o}static isFrontFacing(e,t,n,r){return Vc.subVectors(n,t),wf.subVectors(e,t),Vc.cross(wf).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 Vc.subVectors(this.c,this.b),wf.subVectors(this.a,this.b),Vc.cross(wf).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;e_.subVectors(r,n),t_.subVectors(s,n),GN.subVectors(e,n);let l=e_.dot(GN),c=t_.dot(GN);if(l<=0&&c<=0)return t.copy(n);zN.subVectors(e,r);let u=e_.dot(zN),f=t_.dot(zN);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(e_,o);VN.subVectors(e,s);let x=e_.dot(VN),v=t_.dot(VN);if(v>=0&&x<=v)return t.copy(s);let w=x*c-l*v;if(w<=0&&c>=0&&v<=0)return a=c/(c-v),t.copy(n).addScaledVector(t_,a);let S=u*v-x*f;if(S<=0&&f-u>=0&&x-v>=0)return kH.subVectors(s,r),a=(f-u)/(f-u+(x-v)),t.copy(r).addScaledVector(kH,a);let T=1/(S+w+p);return o=w*T,a=p*T,t.copy(n).addScaledVector(e_,o).addScaledVector(t_,a)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}},ma=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(qc.fromArray(e,t));return this}setFromBufferAttribute(e){this.makeEmpty();for(let t=0,n=e.count;t<n;t++)this.expandByPoint(qc.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=qc.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,qc):qc.fromBufferAttribute(s,o),qc.applyMatrix4(e.matrixWorld),this.expandByPoint(qc);else e.boundingBox!==void 0?(e.boundingBox===null&&e.computeBoundingBox(),tT.copy(e.boundingBox)):(n.boundingBox===null&&n.computeBoundingBox(),tT.copy(n.boundingBox)),tT.applyMatrix4(e.matrixWorld),this.union(tT)}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,qc),qc.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(Ay),nT.subVectors(this.max,Ay),n_.subVectors(e.a,Ay),i_.subVectors(e.b,Ay),r_.subVectors(e.c,Ay),Vd.subVectors(i_,n_),qd.subVectors(r_,i_),dA.subVectors(n_,r_);let t=[0,-Vd.z,Vd.y,0,-qd.z,qd.y,0,-dA.z,dA.y,Vd.z,0,-Vd.x,qd.z,0,-qd.x,dA.z,0,-dA.x,-Vd.y,Vd.x,0,-qd.y,qd.x,0,-dA.y,dA.x,0];return!jN(t,n_,i_,r_,nT)||(t=[1,0,0,0,1,0,0,0,1],!jN(t,n_,i_,r_,nT))?!1:(iT.crossVectors(Vd,qd),t=[iT.x,iT.y,iT.z],jN(t,n_,i_,r_,nT))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,qc).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=this.getSize(qc).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:(Tf[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),Tf[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),Tf[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),Tf[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),Tf[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),Tf[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),Tf[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),Tf[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(Tf),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}},Tf=[new ie,new ie,new ie,new ie,new ie,new ie,new ie,new ie],qc=new ie,tT=new ma,n_=new ie,i_=new ie,r_=new ie,Vd=new ie,qd=new ie,dA=new ie,Ay=new ie,nT=new ie,iT=new ie,pA=new ie;function jN(i,e,t,n,r){for(let s=0,o=i.length-3;s<=o;s+=3){pA.fromArray(i,s);let a=r.x*Math.abs(pA.x)+r.y*Math.abs(pA.y)+r.z*Math.abs(pA.z),l=e.dot(pA),c=t.dot(pA),u=n.dot(pA);if(Math.max(-Math.max(l,c,u),Math.min(l,c,u))>a)return!1}return!0}var Rf=eue();function eue(){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 _l(i){Math.abs(i)>65504&&je("DataUtils.toHalfFloat(): Value out of range."),i=In(i,-65504,65504),Rf.floatView[0]=i;let e=Rf.uint32View[0],t=e>>23&511;return Rf.baseTable[t]+((e&8388607)>>Rf.shiftTable[t])}function rT(i){let e=i>>10;return Rf.uint32View[0]=Rf.mantissaTable[Rf.offsetTable[e]+(i&1023)]+Rf.exponentTable[e],Rf.floatView[0]}var Ss=new ie,sT=new Oe,tue=0,Di=class extends Ho{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:tue++}),this.name="",this.array=e,this.itemSize=t,this.count=e!==void 0?e.length/t:0,this.normalized=n,this.usage=Zd,this.updateRanges=[],this.gpuType=Zi,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++)sT.fromBufferAttribute(this,t),sT.applyMatrix3(e),this.setXY(t,sT.x,sT.y);else if(this.itemSize===3)for(let t=0,n=this.count;t<n;t++)Ss.fromBufferAttribute(this,t),Ss.applyMatrix3(e),this.setXYZ(t,Ss.x,Ss.y,Ss.z);return this}applyMatrix4(e){for(let t=0,n=this.count;t<n;t++)Ss.fromBufferAttribute(this,t),Ss.applyMatrix4(e),this.setXYZ(t,Ss.x,Ss.y,Ss.z);return this}applyNormalMatrix(e){for(let t=0,n=this.count;t<n;t++)Ss.fromBufferAttribute(this,t),Ss.applyNormalMatrix(e),this.setXYZ(t,Ss.x,Ss.y,Ss.z);return this}transformDirection(e){for(let t=0,n=this.count;t<n;t++)Ss.fromBufferAttribute(this,t),Ss.transformDirection(e),this.setXYZ(t,Ss.x,Ss.y,Ss.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=fa(n,this.array)),n}setComponent(e,t,n){return this.normalized&&(n=Wn(n,this.array)),this.array[e*this.itemSize+t]=n,this}getX(e){let t=this.array[e*this.itemSize];return this.normalized&&(t=fa(t,this.array)),t}setX(e,t){return this.normalized&&(t=Wn(t,this.array)),this.array[e*this.itemSize]=t,this}getY(e){let t=this.array[e*this.itemSize+1];return this.normalized&&(t=fa(t,this.array)),t}setY(e,t){return this.normalized&&(t=Wn(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=fa(t,this.array)),t}setZ(e,t){return this.normalized&&(t=Wn(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=fa(t,this.array)),t}setW(e,t){return this.normalized&&(t=Wn(t,this.array)),this.array[e*this.itemSize+3]=t,this}setXY(e,t,n){return e*=this.itemSize,this.normalized&&(t=Wn(t,this.array),n=Wn(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=Wn(t,this.array),n=Wn(n,this.array),r=Wn(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=Wn(t,this.array),n=Wn(n,this.array),r=Wn(r,this.array),s=Wn(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!==Zd&&(e.usage=this.usage),e}dispose(){this.dispatchEvent({type:"dispose"})}};var EA=class extends Di{constructor(e,t,n){super(new Uint16Array(e),t,n)}};var MA=class extends Di{constructor(e,t,n){super(new Uint32Array(e),t,n)}},y_=class extends Di{constructor(e,t,n){super(new Uint16Array(e),t,n),this.isFloat16BufferAttribute=!0}getX(e){let t=rT(this.array[e*this.itemSize]);return this.normalized&&(t=fa(t,this.array)),t}setX(e,t){return this.normalized&&(t=Wn(t,this.array)),this.array[e*this.itemSize]=_l(t),this}getY(e){let t=rT(this.array[e*this.itemSize+1]);return this.normalized&&(t=fa(t,this.array)),t}setY(e,t){return this.normalized&&(t=Wn(t,this.array)),this.array[e*this.itemSize+1]=_l(t),this}getZ(e){let t=rT(this.array[e*this.itemSize+2]);return this.normalized&&(t=fa(t,this.array)),t}setZ(e,t){return this.normalized&&(t=Wn(t,this.array)),this.array[e*this.itemSize+2]=_l(t),this}getW(e){let t=rT(this.array[e*this.itemSize+3]);return this.normalized&&(t=fa(t,this.array)),t}setW(e,t){return this.normalized&&(t=Wn(t,this.array)),this.array[e*this.itemSize+3]=_l(t),this}setXY(e,t,n){return e*=this.itemSize,this.normalized&&(t=Wn(t,this.array),n=Wn(n,this.array)),this.array[e+0]=_l(t),this.array[e+1]=_l(n),this}setXYZ(e,t,n,r){return e*=this.itemSize,this.normalized&&(t=Wn(t,this.array),n=Wn(n,this.array),r=Wn(r,this.array)),this.array[e+0]=_l(t),this.array[e+1]=_l(n),this.array[e+2]=_l(r),this}setXYZW(e,t,n,r,s){return e*=this.itemSize,this.normalized&&(t=Wn(t,this.array),n=Wn(n,this.array),r=Wn(r,this.array),s=Wn(s,this.array)),this.array[e+0]=_l(t),this.array[e+1]=_l(n),this.array[e+2]=_l(r),this.array[e+3]=_l(s),this}},Rn=class extends Di{constructor(e,t,n){super(new Float32Array(e),t,n)}},nue=new ma,my=new ie,XN=new ie,$a=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):nue.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;my.subVectors(e,this.center);let t=my.lengthSq();if(t>this.radius*this.radius){let n=Math.sqrt(t),r=(n-this.radius)*.5;this.center.addScaledVector(my,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):(XN.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(my.copy(e.center).add(XN)),this.expandByPoint(my.copy(e.center).sub(XN))),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}},iue=0,Jl=new on,$N=new Ki,s_=new ie,xl=new ma,gy=new ma,Js=new ie,qn=class i extends Ho{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:iue++}),this.uuid=Gu(),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(Mce(e)?MA:EA)(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 Jl.makeRotationFromQuaternion(e),this.applyMatrix4(Jl),this}rotateX(e){return Jl.makeRotationX(e),this.applyMatrix4(Jl),this}rotateY(e){return Jl.makeRotationY(e),this.applyMatrix4(Jl),this}rotateZ(e){return Jl.makeRotationZ(e),this.applyMatrix4(Jl),this}translate(e,t,n){return Jl.makeTranslation(e,t,n),this.applyMatrix4(Jl),this}scale(e,t,n){return Jl.makeScale(e,t,n),this.applyMatrix4(Jl),this}lookAt(e){return $N.lookAt(e),$N.updateMatrix(),this.applyMatrix4($N.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(s_).negate(),this.translate(s_.x,s_.y,s_.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 Rn(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 ma);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];xl.setFromBufferAttribute(s),this.morphTargetsRelative?(Js.addVectors(this.boundingBox.min,xl.min),this.boundingBox.expandByPoint(Js),Js.addVectors(this.boundingBox.max,xl.max),this.boundingBox.expandByPoint(Js)):(this.boundingBox.expandByPoint(xl.min),this.boundingBox.expandByPoint(xl.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 $a);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(xl.setFromBufferAttribute(e),t)for(let s=0,o=t.length;s<o;s++){let a=t[s];gy.setFromBufferAttribute(a),this.morphTargetsRelative?(Js.addVectors(xl.min,gy.min),xl.expandByPoint(Js),Js.addVectors(xl.max,gy.max),xl.expandByPoint(Js)):(xl.expandByPoint(gy.min),xl.expandByPoint(gy.max))}xl.getCenter(n);let r=0;for(let s=0,o=e.count;s<o;s++)Js.fromBufferAttribute(e,s),r=Math.max(r,n.distanceToSquared(Js));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++)Js.fromBufferAttribute(a,c),l&&(s_.fromBufferAttribute(e,c),Js.add(s_)),r=Math.max(r,n.distanceToSquared(Js))}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 Di(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,v=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),v.fromBufferAttribute(s,z),u.sub(c),f.sub(c),x.sub(p),v.sub(p);let V=1/(x.x*v.y-v.x*x.y);isFinite(V)&&(w.copy(u).multiplyScalar(v.y).addScaledVector(f,-x.y).multiplyScalar(V),S.copy(f).multiplyScalar(x.x).addScaledVector(u,-v.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 R=this.groups;R.length===0&&(R=[{start:0,count:e.count}]);for(let N=0,B=R.length;N<B;++N){let z=R[N],V=z.start,H=z.count;for(let K=V,J=V+H;K<J;K+=3)T(e.getX(K+0),e.getX(K+1),e.getX(K+2))}let P=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];P.copy(B),P.sub(L.multiplyScalar(L.dot(B))).normalize(),C.crossVectors(D,B);let V=C.dot(l[N])<0?-1:1;o.setXYZW(N,P.x,P.y,P.z,V)}for(let N=0,B=R.length;N<B;++N){let z=R[N],V=z.start,H=z.count;for(let K=V,J=V+H;K<J;K+=3)F(e.getX(K+0)),F(e.getX(K+1)),F(e.getX(K+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 Di(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 v=e.getX(p+0),w=e.getX(p+1),S=e.getX(p+2);r.fromBufferAttribute(t,v),s.fromBufferAttribute(t,w),o.fromBufferAttribute(t,S),u.subVectors(o,s),f.subVectors(r,s),u.cross(f),a.fromBufferAttribute(n,v),l.fromBufferAttribute(n,w),c.fromBufferAttribute(n,S),a.add(u),l.add(u),c.add(u),n.setXYZ(v,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++)Js.fromBufferAttribute(e,t),Js.normalize(),e.setXYZ(t,Js.x,Js.y,Js.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,v=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[v++]=c[x++]}return new Di(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"})}},Df=class{constructor(e,t){this.isInterleavedBuffer=!0,this.array=e,this.stride=t,this.count=e!==void 0?e.length/t:0,this.usage=Zd,this.updateRanges=[],this.version=0,this.uuid=Gu()}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=Gu()),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=Gu()),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}}},ua=new ie,yo=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++)ua.fromBufferAttribute(this,t),ua.applyMatrix4(e),this.setXYZ(t,ua.x,ua.y,ua.z);return this}applyNormalMatrix(e){for(let t=0,n=this.count;t<n;t++)ua.fromBufferAttribute(this,t),ua.applyNormalMatrix(e),this.setXYZ(t,ua.x,ua.y,ua.z);return this}transformDirection(e){for(let t=0,n=this.count;t<n;t++)ua.fromBufferAttribute(this,t),ua.transformDirection(e),this.setXYZ(t,ua.x,ua.y,ua.z);return this}getComponent(e,t){let n=this.array[e*this.data.stride+this.offset+t];return this.normalized&&(n=fa(n,this.array)),n}setComponent(e,t,n){return this.normalized&&(n=Wn(n,this.array)),this.data.array[e*this.data.stride+this.offset+t]=n,this}setX(e,t){return this.normalized&&(t=Wn(t,this.array)),this.data.array[e*this.data.stride+this.offset]=t,this}setY(e,t){return this.normalized&&(t=Wn(t,this.array)),this.data.array[e*this.data.stride+this.offset+1]=t,this}setZ(e,t){return this.normalized&&(t=Wn(t,this.array)),this.data.array[e*this.data.stride+this.offset+2]=t,this}setW(e,t){return this.normalized&&(t=Wn(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=fa(t,this.array)),t}getY(e){let t=this.data.array[e*this.data.stride+this.offset+1];return this.normalized&&(t=fa(t,this.array)),t}getZ(e){let t=this.data.array[e*this.data.stride+this.offset+2];return this.normalized&&(t=fa(t,this.array)),t}getW(e){let t=this.data.array[e*this.data.stride+this.offset+3];return this.normalized&&(t=fa(t,this.array)),t}setXY(e,t,n){return e=e*this.data.stride+this.offset,this.normalized&&(t=Wn(t,this.array),n=Wn(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=Wn(t,this.array),n=Wn(n,this.array),r=Wn(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=Wn(t,this.array),n=Wn(n,this.array),r=Wn(r,this.array),s=Wn(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){SA("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 Di(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){SA("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}}},rue=0,Cs=class extends Ho{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:rue++}),this.uuid=Gu(),this.name="",this.type="Material",this.blending=cs,this.side=xo,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.alphaHash=!1,this.blendSrc=Xd,this.blendDst=$d,this.blendEquation=zs,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.blendColor=new Ut(0,0,0),this.blendAlpha=0,this.depthFunc=zu,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=Cy,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=Mf,this.stencilZFail=Mf,this.stencilZPass=Mf,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!==cs&&(n.blending=this.blending),this.side!==xo&&(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!==Xd&&(n.blendSrc=this.blendSrc),this.blendDst!==$d&&(n.blendDst=this.blendDst),this.blendEquation!==zs&&(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!==zu&&(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!==Cy&&(n.stencilFunc=this.stencilFunc),this.stencilRef!==0&&(n.stencilRef=this.stencilRef),this.stencilFuncMask!==255&&(n.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==Mf&&(n.stencilFail=this.stencilFail),this.stencilZFail!==Mf&&(n.stencilZFail=this.stencilZFail),this.stencilZPass!==Mf&&(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++}},Vu=class extends Cs{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}},o_,_y=new ie,a_=new ie,l_=new ie,c_=new Oe,xy=new Oe,wW=new on,oT=new ie,yy=new ie,aT=new ie,GH=new Oe,YN=new Oe,zH=new Oe,CA=class extends Ki{constructor(e=new Vu){if(super(),this.isSprite=!0,this.type="Sprite",o_===void 0){o_=new qn;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 Df(t,5);o_.setIndex([0,1,2,0,2,3]),o_.setAttribute("position",new yo(n,3,0,!1)),o_.setAttribute("uv",new yo(n,2,3,!1))}this.geometry=o_,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.'),a_.setFromMatrixScale(this.matrixWorld),wW.copy(e.camera.matrixWorld),this.modelViewMatrix.multiplyMatrices(e.camera.matrixWorldInverse,this.matrixWorld),l_.setFromMatrixPosition(this.modelViewMatrix),e.camera.isPerspectiveCamera&&this.material.sizeAttenuation===!1&&a_.multiplyScalar(-l_.z);let n=this.material.rotation,r,s;n!==0&&(s=Math.cos(n),r=Math.sin(n));let o=this.center;lT(oT.set(-.5,-.5,0),l_,o,a_,r,s),lT(yy.set(.5,-.5,0),l_,o,a_,r,s),lT(aT.set(.5,.5,0),l_,o,a_,r,s),GH.set(0,0),YN.set(1,0),zH.set(1,1);let a=e.ray.intersectTriangle(oT,yy,aT,!1,_y);if(a===null&&(lT(yy.set(-.5,.5,0),l_,o,a_,r,s),YN.set(0,1),a=e.ray.intersectTriangle(oT,aT,yy,!1,_y),a===null))return;let l=e.ray.origin.distanceTo(_y);l<e.near||l>e.far||t.push({distance:l,point:_y.clone(),uv:Cf.getInterpolation(_y,oT,yy,aT,GH,YN,zH,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 lT(i,e,t,n,r,s){c_.subVectors(i,t).addScalar(.5).multiply(n),r!==void 0?(xy.x=s*c_.x-r*c_.y,xy.y=r*c_.x+s*c_.y):xy.copy(c_),i.copy(e),i.x+=xy.x,i.y+=xy.y,i.applyMatrix4(wW)}var Ef=new ie,KN=new ie,cT=new ie,Hd=new ie,ZN=new ie,uT=new ie,QN=new ie,Ff=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,Ef)),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=Ef.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(Ef.copy(this.origin).addScaledVector(this.direction,t),Ef.distanceToSquared(e))}distanceSqToSegment(e,t,n,r){KN.copy(e).add(t).multiplyScalar(.5),cT.copy(t).sub(e).normalize(),Hd.copy(this.origin).sub(KN);let s=e.distanceTo(t)*.5,o=-this.direction.dot(cT),a=Hd.dot(this.direction),l=-Hd.dot(cT),c=Hd.lengthSq(),u=Math.abs(1-o*o),f,p,x,v;if(u>0)if(f=o*l-a,p=o*a-l,v=s*u,f>=0)if(p>=-v)if(p<=v){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<=-v?(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<=v?(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(KN).addScaledVector(cT,p),x}intersectSphere(e,t){Ef.subVectors(e.center,this.origin);let n=Ef.dot(this.direction),r=Ef.dot(Ef)-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,Ef)!==null}intersectTriangle(e,t,n,r,s){ZN.subVectors(t,e),uT.subVectors(n,e),QN.crossVectors(ZN,uT);let o=this.direction.dot(QN),a;if(o>0){if(r)return null;a=1}else if(o<0)a=-1,o=-o;else return null;Hd.subVectors(this.origin,e);let l=a*this.direction.dot(uT.crossVectors(Hd,uT));if(l<0)return null;let c=a*this.direction.dot(ZN.cross(Hd));if(c<0||l+c>o)return null;let u=-a*Hd.dot(QN);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)}},Kr=class extends Cs{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 Aa,this.combine=GA,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}},VH=new on,AA=new Ff,hT=new $a,qH=new ie,fT=new ie,dT=new ie,pT=new ie,JN=new ie,AT=new ie,HH=new ie,mT=new ie,Gn=class extends Ki{constructor(e=new qn,t=new Kr){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){AT.set(0,0,0);for(let l=0,c=s.length;l<c;l++){let u=a[l],f=s[l];u!==0&&(JN.fromBufferAttribute(f,e),o?AT.addScaledVector(JN,u):AT.addScaledVector(JN.sub(t),u))}t.add(AT)}return t}raycast(e,t){let n=this.geometry,r=this.material,s=this.matrixWorld;r!==void 0&&(n.boundingSphere===null&&n.computeBoundingSphere(),hT.copy(n.boundingSphere),hT.applyMatrix4(s),AA.copy(e.ray).recast(e.near),!(hT.containsPoint(AA.origin)===!1&&(AA.intersectSphere(hT,qH)===null||AA.origin.distanceToSquared(qH)>(e.far-e.near)**2))&&(VH.copy(s).invert(),AA.copy(e.ray).applyMatrix4(VH),!(n.boundingBox!==null&&AA.intersectsBox(n.boundingBox)===!1)&&this._computeIntersections(e,t,AA)))}_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 v=0,w=p.length;v<w;v++){let S=p[v],T=o[S.materialIndex],R=Math.max(S.start,x.start),P=Math.min(a.count,Math.min(S.start+S.count,x.start+x.count));for(let C=R,L=P;C<L;C+=3){let D=a.getX(C),F=a.getX(C+1),N=a.getX(C+2);r=gT(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 v=Math.max(0,x.start),w=Math.min(a.count,x.start+x.count);for(let S=v,T=w;S<T;S+=3){let R=a.getX(S),P=a.getX(S+1),C=a.getX(S+2);r=gT(this,o,e,n,c,u,f,R,P,C),r&&(r.faceIndex=Math.floor(S/3),t.push(r))}}else if(l!==void 0)if(Array.isArray(o))for(let v=0,w=p.length;v<w;v++){let S=p[v],T=o[S.materialIndex],R=Math.max(S.start,x.start),P=Math.min(l.count,Math.min(S.start+S.count,x.start+x.count));for(let C=R,L=P;C<L;C+=3){let D=C,F=C+1,N=C+2;r=gT(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 v=Math.max(0,x.start),w=Math.min(l.count,x.start+x.count);for(let S=v,T=w;S<T;S+=3){let R=S,P=S+1,C=S+2;r=gT(this,o,e,n,c,u,f,R,P,C),r&&(r.faceIndex=Math.floor(S/3),t.push(r))}}}};function sue(i,e,t,n,r,s,o,a){let l;if(e.side===hi?l=n.intersectTriangle(o,s,r,!0,a):l=n.intersectTriangle(r,s,o,e.side===xo,a),l===null)return null;mT.copy(a),mT.applyMatrix4(i.matrixWorld);let c=t.ray.origin.distanceTo(mT);return c<t.near||c>t.far?null:{distance:c,point:mT.clone(),object:i}}function gT(i,e,t,n,r,s,o,a,l,c){i.getVertexPosition(a,fT),i.getVertexPosition(l,dT),i.getVertexPosition(c,pT);let u=sue(i,e,t,n,fT,dT,pT,HH);if(u){let f=new ie;Cf.getBarycoord(HH,fT,dT,pT,f),r&&(u.uv=Cf.getInterpolatedAttribute(r,a,l,c,f,new Oe)),s&&(u.uv1=Cf.getInterpolatedAttribute(s,a,l,c,f,new Oe)),o&&(u.normal=Cf.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};Cf.getNormal(fT,dT,pT,p.normal),u.face=p,u.barycoord=f}return u}var RA=class extends Ms{constructor(e=null,t=1,n=1,r,s,o,a,l,c=yi,u=yi,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 yl=class extends Di{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 eL=new ie,oue=new ie,aue=new Sn,ha=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=eL.subVectors(n,t).cross(oue.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(eL),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||aue.getNormalMatrix(e),r=this.coplanarPoint(eL).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)}},mA=new $a,lue=new Oe(.5,.5),_T=new ie,ec=class{constructor(e=new ha,t=new ha,n=new ha,r=new ha,s=new ha,o=new ha){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=_o,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],v=s[8],w=s[9],S=s[10],T=s[11],R=s[12],P=s[13],C=s[14],L=s[15];if(r[0].setComponents(c-o,x-u,T-v,L-R).normalize(),r[1].setComponents(c+o,x+u,T+v,L+R).normalize(),r[2].setComponents(c+a,x+f,T+w,L+P).normalize(),r[3].setComponents(c-a,x-f,T-w,L-P).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===_o)r[5].setComponents(c+l,x+p,T+S,L+C).normalize();else if(t===Xa)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(),mA.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);else{let t=e.geometry;t.boundingSphere===null&&t.computeBoundingSphere(),mA.copy(t.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere(mA)}intersectsSprite(e){mA.center.set(0,0,0);let t=lue.distanceTo(e.center);return mA.radius=.7071067811865476+t,mA.applyMatrix4(e.matrixWorld),this.intersectsSphere(mA)}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(_T.x=r.normal.x>0?e.max.x:e.min.x,_T.y=r.normal.y>0?e.max.y:e.min.y,_T.z=r.normal.z>0?e.max.z:e.min.z,r.distanceToPoint(_T)<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)}},WH=new on,Ry=class i{constructor(){this.coordinateSystem=_o,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];WH.multiplyMatrices(s.projectionMatrix,s.matrixWorldInverse),n[r]===void 0&&(n[r]=new ec),n[r].setFromProjectionMatrix(WH,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 ec),t[r].copy(n[r]);return this._count=e._count,this}clone(){return new i().copy(this)}};var Hc=class extends Cs{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}},DT=new ie,FT=new ie,jH=new on,vy=new Ff,xT=new $a,tL=new ie,XH=new ie,ep=class extends Ki{constructor(e=new qn,t=new Hc){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++)DT.fromBufferAttribute(t,r-1),FT.fromBufferAttribute(t,r),n[r]=n[r-1],n[r]+=DT.distanceTo(FT);e.setAttribute("lineDistance",new Rn(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(),xT.copy(n.boundingSphere),xT.applyMatrix4(r),xT.radius+=s,e.ray.intersectsSphere(xT)===!1)return;jH.copy(r).invert(),vy.copy(e.ray).applyMatrix4(jH);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),v=Math.min(u.count,o.start+o.count);for(let w=x,S=v-1;w<S;w+=c){let T=u.getX(w),R=u.getX(w+1),P=yT(this,e,vy,l,T,R,w);P&&t.push(P)}if(this.isLineLoop){let w=u.getX(v-1),S=u.getX(x),T=yT(this,e,vy,l,w,S,v-1);T&&t.push(T)}}else{let x=Math.max(0,o.start),v=Math.min(p.count,o.start+o.count);for(let w=x,S=v-1;w<S;w+=c){let T=yT(this,e,vy,l,w,w+1,w);T&&t.push(T)}if(this.isLineLoop){let w=yT(this,e,vy,l,v-1,x,v-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 yT(i,e,t,n,r,s,o){let a=i.geometry.attributes.position;if(DT.fromBufferAttribute(a,r),FT.fromBufferAttribute(a,s),t.distanceSqToSegment(DT,FT,tL,XH)>n)return;tL.applyMatrix4(i.matrixWorld);let c=e.ray.origin.distanceTo(tL);if(!(c<e.near||c>e.far))return{distance:c,point:XH.clone().applyMatrix4(i.matrixWorld),index:o,face:null,faceIndex:null,barycoord:null,object:i}}var $H=new ie,YH=new ie,v_=class extends ep{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),YH.fromBufferAttribute(t,r+1),n[r]=r===0?0:n[r-1],n[r+1]=n[r]+$H.distanceTo(YH);e.setAttribute("lineDistance",new Rn(n,1))}else je("LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}};var tp=class extends Cs{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}},KH=new on,hL=new Ff,vT=new $a,bT=new ie,Py=class extends Ki{constructor(e=new qn,t=new tp){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(),vT.copy(n.boundingSphere),vT.applyMatrix4(r),vT.radius+=s,e.ray.intersectsSphere(vT)===!1)return;KH.copy(r).invert(),hL.copy(e.ray).applyMatrix4(KH);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 v=p,w=x;v<w;v++){let S=c.getX(v);bT.fromBufferAttribute(f,S),ZH(bT,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 v=p,w=x;v<w;v++)bT.fromBufferAttribute(f,v),ZH(bT,v,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 ZH(i,e,t,n,r,s,o){let a=hL.distanceSqToPoint(i);if(a<t){let l=new ie;hL.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 PA=class extends Ms{constructor(e,t){super({width:e,height:t}),this.isFramebufferTexture=!0,this.magFilter=yi,this.minFilter=yi,this.generateMipmaps=!1,this.needsUpdate=!0}};var qu=class extends Ms{constructor(e=[],t=bl,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 us=class extends Ms{constructor(e,t,n=Ai,r,s,o,a=yi,l=yi,c,u=Ts,f=1){if(u!==Ts&&u!==eo)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 __(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}},b_=class extends us{constructor(e,t=Ai,n=bl,r,s,o=yi,a=yi,l,c=Ts){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}},Iy=class extends Ms{constructor(e=null){super(),this.sourceTexture=e,this.isExternalTexture=!0}copy(e){return super.copy(e),this.sourceTexture=e.sourceTexture,this}},Wc=class i extends qn{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;v("z","y","x",-1,-1,n,t,e,o,s,0),v("z","y","x",1,-1,n,t,-e,o,s,1),v("x","z","y",1,1,e,n,t,r,o,2),v("x","z","y",1,-1,e,n,-t,r,o,3),v("x","y","z",1,-1,e,t,n,r,s,4),v("x","y","z",-1,-1,e,t,-n,r,s,5),this.setIndex(l),this.setAttribute("position",new Rn(c,3)),this.setAttribute("normal",new Rn(u,3)),this.setAttribute("uv",new Rn(f,2));function v(w,S,T,R,P,C,L,D,F,N,B){let z=C/F,V=L/N,H=C/2,K=L/2,J=D/2,j=F+1,Z=N+1,ee=0,ae=0,ce=new ie;for(let de=0;de<Z;de++){let be=de*V-K;for(let Ie=0;Ie<j;Ie++){let Qe=Ie*z-H;ce[w]=Qe*R,ce[S]=be*P,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 be=0;be<F;be++){let Ie=p+be+j*de,Qe=p+be+j*(de+1),Ue=p+(be+1)+j*(de+1),mt=p+(be+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 w_=class i extends qn{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 Rn(o,3)),this.setAttribute("normal",new Rn(a,3)),this.setAttribute("uv",new Rn(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)}},IA=class i extends qn{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=[],v=0,w=[],S=n/2,T=0;R(),o===!1&&(e>0&&P(!0),t>0&&P(!1)),this.setIndex(u),this.setAttribute("position",new Rn(f,3)),this.setAttribute("normal",new Rn(p,3)),this.setAttribute("uv",new Rn(x,2));function R(){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 K=H/r,J=K*l+a,j=Math.sin(J),Z=Math.cos(J);L.x=V*j,L.y=-z*n+S,L.z=V*Z,f.push(L.x,L.y,L.z),C.set(j,F,Z).normalize(),p.push(C.x,C.y,C.z),x.push(K,1-z),B.push(v++)}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],K=w[B][N+1];(e>0||B!==0)&&(u.push(z,V,K),D+=3),(t>0||B!==s-1)&&(u.push(V,H,K),D+=3)}c.addGroup(T,D,0),T+=D}function P(C){let L=v,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),v++;let V=v;for(let H=0;H<=r;H++){let J=H/r*l+a,j=Math.cos(J),Z=Math.sin(J);F.x=B*Z,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=Z*.5*z+.5,x.push(D.x,D.y),v++}for(let H=0;H<r;H++){let K=L+H,J=V+H;C===!0?u.push(J,J+1,K):u.push(J+1,J,K),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 ga=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 v=x/e;r[x]=this.getTangentAt(v,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 v=Math.acos(In(r[x-1].dot(r[x]),-1,1));s[x].applyMatrix4(l.makeRotationAxis(a,v))}o[x].crossVectors(r[x],s[x])}if(t===!0){let x=Math.acos(In(s[0].dot(s[e]),-1,1));x/=e,r[0].dot(a.crossVectors(s[0],s[e]))>0&&(x=-x);for(let v=1;v<=e;v++)s[v].applyMatrix4(l.makeRotationAxis(r[v],x*v)),o[v].crossVectors(r[v],s[v])}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}},S_=class extends ga{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}},OT=class extends S_{constructor(e,t,n,r,s,o){super(e,t,n,n,r,s,o),this.isArcCurve=!0,this.type="ArcCurve"}};function qL(){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 QH=new ie,JH=new ie,nL=new qL,iL=new qL,rL=new qL,BT=class extends ga{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]:(JH.subVectors(r[0],r[1]).add(r[0]),c=JH);let f=r[a%s],p=r[(a+1)%s];if(this.closed||a+2<s?u=r[(a+2)%s]:(QH.subVectors(r[s-1],r[s-2]).add(r[s-1]),u=QH),this.curveType==="centripetal"||this.curveType==="chordal"){let x=this.curveType==="chordal"?.5:.25,v=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),v<1e-4&&(v=w),S<1e-4&&(S=w),nL.initNonuniformCatmullRom(c.x,f.x,p.x,u.x,v,w,S),iL.initNonuniformCatmullRom(c.y,f.y,p.y,u.y,v,w,S),rL.initNonuniformCatmullRom(c.z,f.z,p.z,u.z,v,w,S)}else this.curveType==="catmullrom"&&(nL.initCatmullRom(c.x,f.x,p.x,u.x,this.tension),iL.initCatmullRom(c.y,f.y,p.y,u.y,this.tension),rL.initCatmullRom(c.z,f.z,p.z,u.z,this.tension));return n.set(nL.calc(l),iL.calc(l),rL.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 eW(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 cue(i,e){let t=1-i;return t*t*e}function uue(i,e){return 2*(1-i)*i*e}function hue(i,e){return i*i*e}function Ty(i,e,t,n){return cue(i,e)+uue(i,t)+hue(i,n)}function fue(i,e){let t=1-i;return t*t*t*e}function due(i,e){let t=1-i;return 3*t*t*i*e}function pue(i,e){return 3*(1-i)*i*i*e}function Aue(i,e){return i*i*i*e}function Ey(i,e,t,n,r){return fue(i,e)+due(i,t)+pue(i,n)+Aue(i,r)}var Ny=class extends ga{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(Ey(e,r.x,s.x,o.x,a.x),Ey(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}},T_=class extends ga{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(Ey(e,r.x,s.x,o.x,a.x),Ey(e,r.y,s.y,o.y,a.y),Ey(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}},Ly=class extends ga{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}},UT=class extends ga{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}},Dy=class extends ga{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(Ty(e,r.x,s.x,o.x),Ty(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}},Fy=class extends ga{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(Ty(e,r.x,s.x,o.x),Ty(e,r.y,s.y,o.y),Ty(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}},Oy=class extends ga{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(eW(a,l.x,c.x,u.x,f.x),eW(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}},kT=Object.freeze({__proto__:null,ArcCurve:OT,CatmullRomCurve3:BT,CubicBezierCurve:Ny,CubicBezierCurve3:T_,EllipseCurve:S_,LineCurve:Ly,LineCurve3:UT,QuadraticBezierCurve:Dy,QuadraticBezierCurve3:Fy,SplineCurve:Oy}),GT=class extends ga{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 kT[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 kT[r.type]().fromJSON(r))}return this}},NA=class extends GT{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 Ly(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 Dy(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 Ny(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 Oy(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 S_(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}},By=class extends NA{constructor(e){super(e),this.uuid=Gu(),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 NA().fromJSON(r))}return this}};function mue(i,e,t=2){let n=e&&e.length,r=n?e[0]*t:i.length,s=SW(i,0,r,t,!0),o=[];if(!s||s.next===s.prev)return o;let a,l,c;if(n&&(s=vue(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],v=i[p+1];x<a&&(a=x),v<l&&(l=v),x>u&&(u=x),v>f&&(f=v)}c=Math.max(u-a,f-l),c=c!==0?32767/c:0}return Uy(s,o,t,a,l,c,0),o}function SW(i,e,t,n,r){let s;if(r===Nue(i,e,t,n)>0)for(let o=e;o<t;o+=n)s=tW(o/n|0,i[o],i[o+1],s);else for(let o=t-n;o>=e;o-=n)s=tW(o/n|0,i[o],i[o+1],s);return s&&E_(s,s.next)&&(Gy(s),s=s.next),s}function LA(i,e){if(!i)return i;e||(e=i);let t=i,n;do if(n=!1,!t.steiner&&(E_(t,t.next)||Dr(t.prev,t,t.next)===0)){if(Gy(t),t=e=t.prev,t===t.next)break;n=!0}else t=t.next;while(n||t!==e);return e}function Uy(i,e,t,n,r,s,o){if(!i)return;!o&&s&&Eue(i,n,r,s);let a=i;for(;i.prev!==i.next;){let l=i.prev,c=i.next;if(s?_ue(i,n,r,s):gue(i)){e.push(l.i,i.i,c.i),Gy(i),i=c.next,a=c.next;continue}if(i=c,i===a){o?o===1?(i=xue(LA(i),e),Uy(i,e,t,n,r,s,2)):o===2&&yue(i,e,t,n,r,s):Uy(LA(i),e,t,n,r,s,1);break}}}function gue(i){let e=i.prev,t=i,n=i.next;if(Dr(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),v=n.next;for(;v!==e;){if(v.x>=u&&v.x<=p&&v.y>=f&&v.y<=x&&by(r,a,s,l,o,c,v.x,v.y)&&Dr(v.prev,v,v.next)>=0)return!1;v=v.next}return!0}function _ue(i,e,t,n){let r=i.prev,s=i,o=i.next;if(Dr(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),v=Math.min(u,f,p),w=Math.max(a,l,c),S=Math.max(u,f,p),T=fL(x,v,e,t,n),R=fL(w,S,e,t,n),P=i.prevZ,C=i.nextZ;for(;P&&P.z>=T&&C&&C.z<=R;){if(P.x>=x&&P.x<=w&&P.y>=v&&P.y<=S&&P!==r&&P!==o&&by(a,u,l,f,c,p,P.x,P.y)&&Dr(P.prev,P,P.next)>=0||(P=P.prevZ,C.x>=x&&C.x<=w&&C.y>=v&&C.y<=S&&C!==r&&C!==o&&by(a,u,l,f,c,p,C.x,C.y)&&Dr(C.prev,C,C.next)>=0))return!1;C=C.nextZ}for(;P&&P.z>=T;){if(P.x>=x&&P.x<=w&&P.y>=v&&P.y<=S&&P!==r&&P!==o&&by(a,u,l,f,c,p,P.x,P.y)&&Dr(P.prev,P,P.next)>=0)return!1;P=P.prevZ}for(;C&&C.z<=R;){if(C.x>=x&&C.x<=w&&C.y>=v&&C.y<=S&&C!==r&&C!==o&&by(a,u,l,f,c,p,C.x,C.y)&&Dr(C.prev,C,C.next)>=0)return!1;C=C.nextZ}return!0}function xue(i,e){let t=i;do{let n=t.prev,r=t.next.next;!E_(n,r)&&EW(n,t,t.next,r)&&ky(n,r)&&ky(r,n)&&(e.push(n.i,t.i,r.i),Gy(t),Gy(t.next),t=i=r),t=t.next}while(t!==i);return LA(t)}function yue(i,e,t,n,r,s){let o=i;do{let a=o.next.next;for(;a!==o.prev;){if(o.i!==a.i&&Rue(o,a)){let l=MW(o,a);o=LA(o,o.next),l=LA(l,l.next),Uy(o,e,t,n,r,s,0),Uy(l,e,t,n,r,s,0);return}a=a.next}o=o.next}while(o!==i)}function vue(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=SW(i,a,l,n,!1);c===c.next&&(c.steiner=!0),r.push(Cue(c))}r.sort(bue);for(let s=0;s<r.length;s++)t=wue(r[s],t);return t}function bue(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 wue(i,e){let t=Sue(i,e);if(!t)return e;let n=MW(t,i);return LA(n,n.next),LA(t,t.next)}function Sue(i,e){let t=e,n=i.x,r=i.y,s=-1/0,o;if(E_(i,t))return t;do{if(E_(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&&TW(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);ky(t,i)&&(f<u||f===u&&(t.x>o.x||t.x===o.x&&Tue(o,t)))&&(o=t,u=f)}t=t.next}while(t!==a);return o}function Tue(i,e){return Dr(i.prev,i,e.prev)<0&&Dr(e.next,i,i.next)<0}function Eue(i,e,t,n){let r=i;do r.z===0&&(r.z=fL(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,Mue(r)}function Mue(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 fL(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 Cue(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 TW(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 by(i,e,t,n,r,s,o,a){return!(i===o&&e===a)&&TW(i,e,t,n,r,s,o,a)}function Rue(i,e){return i.next.i!==e.i&&i.prev.i!==e.i&&!Pue(i,e)&&(ky(i,e)&&ky(e,i)&&Iue(i,e)&&(Dr(i.prev,i,e.prev)||Dr(i,e.prev,e))||E_(i,e)&&Dr(i.prev,i,i.next)>0&&Dr(e.prev,e,e.next)>0)}function Dr(i,e,t){return(e.y-i.y)*(t.x-e.x)-(e.x-i.x)*(t.y-e.y)}function E_(i,e){return i.x===e.x&&i.y===e.y}function EW(i,e,t,n){let r=ST(Dr(i,e,t)),s=ST(Dr(i,e,n)),o=ST(Dr(t,n,i)),a=ST(Dr(t,n,e));return!!(r!==s&&o!==a||r===0&&wT(i,t,e)||s===0&&wT(i,n,e)||o===0&&wT(t,i,n)||a===0&&wT(t,e,n))}function wT(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 ST(i){return i>0?1:i<0?-1:0}function Pue(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&&EW(t,t.next,i,e))return!0;t=t.next}while(t!==i);return!1}function ky(i,e){return Dr(i.prev,i,i.next)<0?Dr(i,e,i.next)>=0&&Dr(i,i.prev,e)>=0:Dr(i,e,i.prev)<0||Dr(i,i.next,e)<0}function Iue(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 MW(i,e){let t=dL(i.i,i.x,i.y),n=dL(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 tW(i,e,t,n){let r=dL(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 Gy(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 dL(i,e,t){return{i,x:e,y:t,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}function Nue(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 pL=class{static triangulate(e,t,n=2){return mue(e,t,n)}},jd=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=[];nW(e),iW(n,e);let o=e.length;t.forEach(nW);for(let l=0;l<t.length;l++)r.push(o),o+=t[l].length,iW(n,t[l]);let a=pL.triangulate(n,r);for(let l=0;l<a.length;l+=3)s.push(a.slice(l,l+3));return s}};function nW(i){let e=i.length;e>2&&i[e-1].equals(i[0])&&i.pop()}function iW(i,e){for(let t=0;t<e.length;t++)i.push(e[t].x),i.push(e[t].y)}var zy=class i extends qn{constructor(e=new By([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 Rn(r,3)),this.setAttribute("uv",new Rn(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,v=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,R=t.UVGenerator!==void 0?t.UVGenerator:Lue,P,C=!1,L,D,F,N;if(T){P=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,v=0,w=0);let B=a.extractPoints(c),z=B.shape,V=B.holes;if(!jd.isClockWise(z)){z=z.reverse();for(let Xe=0,st=V.length;Xe<st;Xe++){let tt=V[Xe];jd.isClockWise(tt)&&(V[Xe]=tt.reverse())}}function K(Xe){let tt=10000000000000001e-36,vt=Xe[0];for(let yt=1;yt<=Xe.length;yt++){let ln=yt%Xe.length,Zt=Xe[ln],Qt=Zt.x-vt.x,xn=Zt.y-vt.y,ge=Qt*Qt+xn*xn,pi=Math.max(Math.abs(Zt.x),Math.abs(Zt.y),Math.abs(vt.x),Math.abs(vt.y)),Bn=tt*pi*pi;if(ge<=Bn){Xe.splice(ln,1),yt--;continue}vt=Zt}}K(z),V.forEach(K);let J=V.length,j=z;for(let Xe=0;Xe<J;Xe++){let st=V[Xe];z=z.concat(st)}function Z(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,Zt=Xe.x-st.x,Qt=Xe.y-st.y,xn=tt.x-Xe.x,ge=tt.y-Xe.y,pi=Zt*Zt+Qt*Qt,Bn=Zt*ge-Qt*xn;if(Math.abs(Bn)>Number.EPSILON){let le=Math.sqrt(pi),X=Math.sqrt(xn*xn+ge*ge),Te=st.x-Qt/le,Pe=st.y+Zt/le,Ve=tt.x-ge/X,gt=tt.y+xn/X,St=((Ve-Te)*ge-(gt-Pe)*xn)/(Zt*ge-Qt*xn);vt=Te+Zt*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;Zt>Number.EPSILON?xn>Number.EPSILON&&(le=!0):Zt<-Number.EPSILON?xn<-Number.EPSILON&&(le=!0):Math.sign(Qt)===Math.sign(ge)&&(le=!0),le?(vt=-Qt,yt=Zt,ln=Math.sqrt(pi)):(vt=Zt,yt=Qt,ln=Math.sqrt(pi/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=[],be,Ie=ce.concat();for(let Xe=0,st=J;Xe<st;Xe++){let tt=V[Xe];be=[];for(let vt=0,yt=tt.length,ln=yt-1,Zt=vt+1;vt<yt;vt++,ln++,Zt++)ln===yt&&(ln=0),Zt===yt&&(Zt=0),be[vt]=ae(tt[vt],tt[ln],tt[Zt]);de.push(be),Ie=Ie.concat(be)}let Qe;if(S===0)Qe=jd.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=v*Math.sin(vt*Math.PI/2)+w;for(let Zt=0,Qt=j.length;Zt<Qt;Zt++){let xn=Z(j[Zt],ce[Zt],ln);Et(xn.x,xn.y,-yt),vt===0&&Xe.push(xn)}for(let Zt=0,Qt=J;Zt<Qt;Zt++){let xn=V[Zt];be=de[Zt];let ge=[];for(let pi=0,Bn=xn.length;pi<Bn;pi++){let le=Z(xn[pi],be[pi],ln);Et(le.x,le.y,-yt),vt===0&&ge.push(le)}vt===0&&st.push(ge)}}Qe=jd.triangulateShape(Xe,st)}let Ue=Qe.length,mt=v+w;for(let Xe=0;Xe<ee;Xe++){let st=p?Z(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(P[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?Z(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(P[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=v*Math.sin(st*Math.PI/2)+w;for(let yt=0,ln=j.length;yt<ln;yt++){let Zt=Z(j[yt],ce[yt],vt);Et(Zt.x,Zt.y,f+tt)}for(let yt=0,ln=V.length;yt<ln;yt++){let Zt=V[yt];be=de[yt];for(let Qt=0,xn=Zt.length;Qt<xn;Qt++){let ge=Z(Zt[Qt],be[Qt],vt);C?Et(ge.x,ge.y+P[u-1].y,P[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,Zt=u+S*2;ln<Zt;ln++){let Qt=ee*ln,xn=ee*(ln+1),ge=st+vt+Qt,pi=st+yt+Qt,Bn=st+yt+xn,le=st+vt+xn;Ct(ge,pi,Bn,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=R.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=R.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 Due(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 kT[r.type]().fromJSON(r)),new i(n,e.options)}},Lue={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],v=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-v),new Oe(w,1-T)]:[new Oe(a,1-l),new Oe(u,1-f),new Oe(x,1-v),new Oe(S,1-T)]}};function Due(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 DA=class i extends qn{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=[],v=[],w=[],S=[];for(let T=0;T<u;T++){let R=T*p-o;for(let P=0;P<c;P++){let C=P*f-s;v.push(C,-R,0),w.push(0,0,1),S.push(P/a),S.push(1-T/l)}}for(let T=0;T<l;T++)for(let R=0;R<a;R++){let P=R+c*T,C=R+c*(T+1),L=R+1+c*(T+1),D=R+1+c*T;x.push(P,C,D),x.push(C,L,D)}this.setIndex(x),this.setAttribute("position",new Rn(v,3)),this.setAttribute("normal",new Rn(w,3)),this.setAttribute("uv",new Rn(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 _a=class i extends qn{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=[],v=[],w=[],S=[];for(let T=0;T<=n;T++){let R=[],P=T/n,C=o+P*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),v.push(f.x,f.y,f.z),p.copy(f).normalize(),w.push(p.x,p.y,p.z),S.push(B+F,1-P),R.push(c++)}u.push(R)}for(let T=0;T<n;T++)for(let R=0;R<t;R++){let P=u[T][R+1],C=u[T][R],L=u[T+1][R],D=u[T+1][R+1];(T!==0||o>0)&&x.push(P,C,D),(T!==n-1||l<Math.PI)&&x.push(C,L,D)}this.setIndex(x),this.setAttribute("position",new Rn(v,3)),this.setAttribute("normal",new Rn(w,3)),this.setAttribute("uv",new Rn(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 Vy=class i extends qn{constructor(e=new Fy(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=[],v=[];w(),this.setIndex(v),this.setAttribute("position",new Rn(f,3)),this.setAttribute("normal",new Rn(p,3)),this.setAttribute("uv",new Rn(x,2));function w(){for(let P=0;P<t;P++)S(P);S(s===!1?t:0),R(),T()}function S(P){u=e.getPointAt(P/t,u);let C=o.normals[P],L=o.binormals[P];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 P=1;P<=t;P++)for(let C=1;C<=r;C++){let L=(r+1)*(P-1)+(C-1),D=(r+1)*P+(C-1),F=(r+1)*P+C,N=(r+1)*(P-1)+C;v.push(L,D,N),v.push(D,F,N)}}function R(){for(let P=0;P<=t;P++)for(let C=0;C<=r;C++)c.x=P/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 kT[e.path.type]().fromJSON(e.path),e.tubularSegments,e.radius,e.radialSegments,e.closed)}},qy=class extends qn{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 v=p,w=p+x;v<w;v+=3)for(let S=0;S<3;S++){let T=a.getX(v+S),R=a.getX(v+(S+1)%3);r.fromBufferAttribute(o,T),s.fromBufferAttribute(o,R),rW(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),rW(r,s,n)===!0&&(t.push(r.x,r.y,r.z),t.push(s.x,s.y,s.z))}}this.setAttribute("position",new Rn(t,3))}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}};function rW(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 Hy=class extends Cs{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 ZA(i){let e={};for(let t in i){e[t]={};for(let n in i[t]){let r=i[t][n];if(sW(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(sW(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 Xo(i){let e={};for(let t=0;t<i.length;t++){let n=ZA(i[t]);for(let r in n)e[r]=n[r]}return e}function sW(i){return i&&(i.isColor||i.isMatrix3||i.isMatrix4||i.isVector2||i.isVector3||i.isVector4||i.isTexture||i.isQuaternion)}function Fue(i){let e=[];for(let t=0;t<i.length;t++)e.push(i[t].clone());return e}function HL(i){let e=i.getRenderTarget();return e===null?i.outputColorSpace:e.isXRRenderTarget===!0?e.texture.colorSpace:sn.workingColorSpace}var QA={clone:ZA,merge:Xo},Oue=`void main() {
@@ -5286,4 +5286,4 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
52865286 In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function d4e(i,e){return o4e(i)||u4e(i,e)||Oie(i,e)||h4e()}function ig(i){return a4e(i)||c4e(i)||Oie(i)||f4e()}function p4e(i,e){if(typeof i!="object"||!i)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var n=t.call(i,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(i)}function A4e(i){var e=p4e(i,"string");return typeof e=="symbol"?e:e+""}function Oie(i,e){if(i){if(typeof i=="string")return Jk(i,e);var t={}.toString.call(i).slice(8,-1);return t==="Object"&&i.constructor&&(t=i.constructor.name),t==="Map"||t==="Set"?Array.from(i):t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?Jk(i,e):void 0}}var Bie=function(e){e instanceof Array?e.forEach(Bie):(e.map&&e.map.dispose(),e.dispose())},Uie=function(e){e.geometry&&e.geometry.dispose(),e.material&&Bie(e.material),e.texture&&e.texture.dispose(),e.children&&e.children.forEach(Uie)},m4e=function(e){for(;e.children.length;){var t=e.children[0];e.remove(t),Uie(t)}},Cr=window.THREE?window.THREE:{WebGLRenderer:_3,Scene:Jd,PerspectiveCamera:Lr,Raycaster:i2,SRGBColorSpace:vr,TextureLoader:Ya,Vector2:Oe,Vector3:ie,Box3:ma,Color:Ut,Mesh:Gn,SphereGeometry:_a,MeshBasicMaterial:Kr,BackSide:hi,Timer:kA},e9=Or({props:{width:{default:window.innerWidth,onChange:function(e,t,n){isNaN(e)&&(t.width=n)}},height:{default:window.innerHeight,onChange:function(e,t,n){isNaN(e)&&(t.height=n)}},viewOffset:{default:[0,0]},backgroundColor:{default:"#000011"},backgroundImageUrl:{},onBackgroundImageLoaded:{},showNavInfo:{default:!0},skyRadius:{default:5e4},objects:{default:[]},lights:{default:[]},enablePointerInteraction:{default:!0,onChange:function(e,t){t.hoverObj=null,t.tooltip&&t.tooltip.content(null)},triggerUpdate:!1},pointerRaycasterThrottleMs:{default:50,triggerUpdate:!1},lineHoverPrecision:{default:1,triggerUpdate:!1},pointsHoverPrecision:{default:1,triggerUpdate:!1},hoverOrderComparator:{triggerUpdate:!1},hoverFilter:{default:function(){return!0},triggerUpdate:!1},tooltipContent:{triggerUpdate:!1},hoverDuringDrag:{default:!1,triggerUpdate:!1},clickAfterDrag:{default:!1,triggerUpdate:!1},onHover:{default:function(){},triggerUpdate:!1},onClick:{default:function(){},triggerUpdate:!1},onRightClick:{triggerUpdate:!1}},methods:{tick:function(e){if(e.initialised){e.controls.enabled&&e.controls.update&&e.controls.update(Math.min(1,e.timer.update().getDelta())),e.postProcessingComposer?e.postProcessingComposer.render():e.renderer.render(e.scene,e.camera),e.extraRenderers.forEach(function(o){return o.render(e.scene,e.camera)});var t=+new Date;if(e.enablePointerInteraction&&t-e.lastRaycasterCheck>=e.pointerRaycasterThrottleMs){e.lastRaycasterCheck=t;var n=null;if(e.hoverDuringDrag||!e.isPointerDragging){var r=this.intersectingObjects(e.pointerPos.x,e.pointerPos.y);e.hoverOrderComparator&&r.sort(function(o,a){return e.hoverOrderComparator(o.object,a.object)});var s=r.find(function(o){return e.hoverFilter(o.object)})||null;n=s?s.object:null,e.intersection=s||null}n!==e.hoverObj&&(e.onHover(n,e.hoverObj,e.intersection),e.tooltip.content(n&&rt(e.tooltipContent)(n,e.intersection)||null),e.hoverObj=n)}e.tweenGroup.update()}return this},getPointerPos:function(e){var t=e.pointerPos,n=t.x,r=t.y;return{x:n,y:r}},cameraPosition:function(e,t,n,r){var s=e.camera;if(t&&e.initialised){var o,a,l=t,c=n||{x:0,y:0,z:0};if((o=e.povPosTween)===null||o===void 0||o.end(),(a=e.povTgtTween)===null||a===void 0||a.end(),!r)p(l),x(c);else{var u=Object.assign({},s.position),f=v();e.tweenGroup.add(e.povPosTween=new Ws(u).to(l,r).easing(Br.Quadratic.Out).onUpdate(p).onComplete(function(){e.povPosTween=void 0,e.tweenGroup.remove(this)}).start()),e.tweenGroup.add(e.povTgtTween=new Ws(f).to(c,r/3).easing(Br.Quadratic.Out).onUpdate(x).onComplete(function(){e.povTgtTween=void 0,e.tweenGroup.remove(this)}).start())}return this}return Object.assign({},s.position,{lookAt:v()});function p(w){var S=w.x,T=w.y,R=w.z;S!==void 0&&(s.position.x=S),T!==void 0&&(s.position.y=T),R!==void 0&&(s.position.z=R)}function x(w){var S=new Cr.Vector3(w.x,w.y,w.z);e.controls.enabled&&e.controls.target?e.controls.target=S:s.lookAt(S)}function v(){return Object.assign(new Cr.Vector3(0,0,-1e3).applyQuaternion(s.quaternion).add(s.position))}},zoomToFit:function(e){for(var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:10,r=arguments.length,s=new Array(r>3?r-3:0),o=3;o<r;o++)s[o-3]=arguments[o];return this.fitToBbox(this.getBbox.apply(this,s),t,n)},fitToBbox:function(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:10,s=e.camera;if(t){var o=new Cr.Vector3(0,0,0),a=Math.max.apply(Math,ig(Object.entries(t).map(function(x){var v=d4e(x,2),w=v[0],S=v[1];return Math.max.apply(Math,ig(S.map(function(T){return Math.abs(o[w]-T)})))})))*2,l=(1-r*2/e.height)*s.fov,c=a/Math.atan(l*Math.PI/180),u=c/s.aspect,f=Math.max(c,u);if(f>0){var p=o.clone().sub(s.position).normalize().multiplyScalar(-f);this.cameraPosition(p,o,n)}}return this},getBbox:function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:function(){return!0},n=new Cr.Box3(new Cr.Vector3(0,0,0),new Cr.Vector3(0,0,0)),r=e.objects.filter(t);return r.length?(r.forEach(function(s){return n.expandByObject(s)}),Object.assign.apply(Object,ig(["x","y","z"].map(function(s){return l4e({},s,[n.min[s],n.max[s]])})))):null},getScreenCoords:function(e,t,n,r){var s=new Cr.Vector3(t,n,r);return s.project(this.camera()),{x:(s.x+1)*e.width/2,y:-(s.y-1)*e.height/2}},getSceneCoords:function(e,t,n){var r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:0,s=new Cr.Vector2(t/e.width*2-1,-(n/e.height)*2+1),o=new Cr.Raycaster;return o.setFromCamera(s,e.camera),Object.assign({},o.ray.at(r,new Cr.Vector3))},intersectingObjects:function(e,t,n){var r=new Cr.Vector2(t/e.width*2-1,-(n/e.height)*2+1),s=new Cr.Raycaster;return s.params.Line.threshold=e.lineHoverPrecision,s.params.Points.threshold=e.pointsHoverPrecision,s.setFromCamera(r,e.camera),s.intersectObjects(e.objects,!0)},renderer:function(e){return e.renderer},scene:function(e){return e.scene},camera:function(e){return e.camera},postProcessingComposer:function(e){return e.postProcessingComposer},controls:function(e){return e.controls},tbControls:function(e){return e.controls},_destructor:function(e){var t,n,r;m4e(e.scene),(t=e.controls)===null||t===void 0||t.dispose(),(n=e.renderer)===null||n===void 0||n.dispose(),(r=e.postProcessingComposer)===null||r===void 0||r.dispose()}},stateInit:function(){return{scene:new Cr.Scene,camera:new Cr.PerspectiveCamera,timer:new Cr.Timer,tweenGroup:new tm,lastRaycasterCheck:0}},init:function(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},r=n.controlType,s=r===void 0?"trackball":r,o=n.useWebGPU,a=o===void 0?!1:o,l=n.rendererConfig,c=l===void 0?{}:l,u=n.extraRenderers,f=u===void 0?[]:u,p=n.waitForLoadComplete,x=p===void 0?!0:p;e.innerHTML="",e.appendChild(t.container=document.createElement("div")),t.container.className="scene-container",t.container.style.position="relative",t.container.appendChild(t.navInfo=document.createElement("div")),t.navInfo.className="scene-nav-info",t.navInfo.textContent={orbit:"Left-click: rotate, Mouse-wheel/middle-click: zoom, Right-click: pan",trackball:"Left-click: rotate, Mouse-wheel/middle-click: zoom, Right-click: pan",fly:"WASD: move, R|F: up | down, Q|E: roll, up|down: pitch, left|right: yaw"}[s]||"",t.navInfo.style.display=t.showNavInfo?null:"none",t.tooltip=new Fie(t.container),t.pointerPos=new Cr.Vector2,t.pointerPos.x=-2,t.pointerPos.y=-2,["pointermove","pointerdown"].forEach(function(v){return t.container.addEventListener(v,function(w){if(v==="pointerdown"&&(t.isPointerPressed=!0),!t.isPointerDragging&&w.type==="pointermove"&&(w.pressure>0||t.isPointerPressed)&&(w.pointerType==="mouse"||w.movementX===void 0||[w.movementX,w.movementY].some(function(R){return Math.abs(R)>1}))&&(t.isPointerDragging=!0),t.enablePointerInteraction){var S=T(t.container);t.pointerPos.x=w.pageX-S.left,t.pointerPos.y=w.pageY-S.top}function T(R){var P=R.getBoundingClientRect(),C=window.pageXOffset||document.documentElement.scrollLeft,L=window.pageYOffset||document.documentElement.scrollTop;return{top:P.top+L,left:P.left+C}}},{passive:!0})}),t.container.addEventListener("pointerup",function(v){t.isPointerPressed&&(t.isPointerPressed=!1,!(t.isPointerDragging&&(t.isPointerDragging=!1,!t.clickAfterDrag))&&requestAnimationFrame(function(){v.button===0&&t.onClick(t.hoverObj||null,v,t.intersection),v.button===2&&t.onRightClick&&t.onRightClick(t.hoverObj||null,v,t.intersection)}))},{passive:!0,capture:!0}),t.container.addEventListener("contextmenu",function(v){t.onRightClick&&v.preventDefault()}),t.renderer=new(a?V1:Cr.WebGLRenderer)(Object.assign({antialias:!0,alpha:!0},c)),t.renderer.setPixelRatio(Math.min(2,window.devicePixelRatio)),t.container.appendChild(t.renderer.domElement),t.extraRenderers=f,t.extraRenderers.forEach(function(v){v.domElement.style.position="absolute",v.domElement.style.top="0px",v.domElement.style.pointerEvents="none",t.container.appendChild(v.domElement)}),t.postProcessingComposer=new GR(t.renderer),t.postProcessingComposer.addPass(new zR(t.scene,t.camera)),t.controls=new{trackball:LR,orbit:FR,fly:OR}[s](t.camera,t.renderer.domElement),s==="fly"&&(t.controls.movementSpeed=300,t.controls.rollSpeed=Math.PI/6,t.controls.dragToLook=!0),(s==="trackball"||s==="orbit")&&(t.controls.minDistance=.1,t.controls.maxDistance=t.skyRadius,t.controls.addEventListener("start",function(){t.controlsEngaged=!0}),t.controls.addEventListener("change",function(){t.controlsEngaged&&(t.controlsDragging=!0)}),t.controls.addEventListener("end",function(){t.controlsEngaged=!1,t.controlsDragging=!1})),[t.renderer,t.postProcessingComposer].concat(ig(t.extraRenderers)).forEach(function(v){return v.setSize(t.width,t.height)}),t.camera.aspect=t.width/t.height,t.camera.updateProjectionMatrix(),t.camera.position.z=1e3,t.scene.add(t.skysphere=new Cr.Mesh),t.skysphere.visible=!1,t.loadComplete=t.scene.visible=!x,window.scene=t.scene},update:function(e,t){if(e.width&&e.height&&(t.hasOwnProperty("width")||t.hasOwnProperty("height"))){var n,r=e.width,s=e.height;e.container.style.width="".concat(r,"px"),e.container.style.height="".concat(s,"px"),[e.renderer,e.postProcessingComposer].concat(ig(e.extraRenderers)).forEach(function(x){return x.setSize(r,s)}),e.camera.aspect=r/s;var o=e.viewOffset.slice(0,2);o.some(function(x){return x})&&(n=e.camera).setViewOffset.apply(n,[r,s].concat(ig(o),[r,s])),e.camera.updateProjectionMatrix()}if(t.hasOwnProperty("viewOffset")){var a,l=e.width,c=e.height,u=e.viewOffset.slice(0,2);u.some(function(x){return x})?(a=e.camera).setViewOffset.apply(a,[l,c].concat(ig(u),[l,c])):e.camera.clearViewOffset()}if(t.hasOwnProperty("skyRadius")&&e.skyRadius&&(e.controls.hasOwnProperty("maxDistance")&&t.skyRadius&&(e.controls.maxDistance=Math.min(e.controls.maxDistance,e.skyRadius)),e.camera.far=e.skyRadius*2.5,e.camera.updateProjectionMatrix(),e.skysphere.geometry=new Cr.SphereGeometry(e.skyRadius)),t.hasOwnProperty("backgroundColor")){var f=E0(e.backgroundColor).alpha;f===void 0&&(f=1),e.renderer.setClearColor(new Cr.Color(Mne(1,e.backgroundColor)),f)}t.hasOwnProperty("backgroundImageUrl")&&(e.backgroundImageUrl?new Cr.TextureLoader().load(e.backgroundImageUrl,function(x){x.colorSpace=Cr.SRGBColorSpace,e.skysphere.material=new Cr.MeshBasicMaterial({map:x,side:Cr.BackSide}),e.skysphere.visible=!0,e.onBackgroundImageLoaded&&setTimeout(e.onBackgroundImageLoaded),!e.loadComplete&&p()}):(e.skysphere.visible=!1,e.skysphere.material.map=null,!e.loadComplete&&p())),t.hasOwnProperty("showNavInfo")&&(e.navInfo.style.display=e.showNavInfo?null:"none"),t.hasOwnProperty("lights")&&((t.lights||[]).forEach(function(x){return e.scene.remove(x)}),e.lights.forEach(function(x){return e.scene.add(x)})),t.hasOwnProperty("objects")&&((t.objects||[]).forEach(function(x){return e.scene.remove(x)}),e.objects.forEach(function(x){return e.scene.add(x)}));function p(){e.loadComplete=e.scene.visible=!0}}});function g4e(i,e){e===void 0&&(e={});var t=e.insertAt;if(!(typeof document>"u")){var n=document.head||document.getElementsByTagName("head")[0],r=document.createElement("style");r.type="text/css",t==="top"&&n.firstChild?n.insertBefore(r,n.firstChild):n.appendChild(r),r.styleSheet?r.styleSheet.cssText=i:r.appendChild(document.createTextNode(i))}}var _4e=`.scene-container .clickable {52875287 cursor: pointer;52885288 }`;g4e(_4e);function t9(i,e){(e==null||e>i.length)&&(e=i.length);for(var t=0,n=Array(e);t<e;t++)n[t]=i[t];return n}function x4e(i){if(Array.isArray(i))return t9(i)}function Wb(i,e,t){return(e=T4e(e))in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function y4e(i){if(typeof Symbol<"u"&&i[Symbol.iterator]!=null||i["@@iterator"]!=null)return Array.from(i)}function v4e(){throw new TypeError(`Invalid attempt to spread non-iterable instance.5289-In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function kie(i,e){var t=Object.keys(i);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(i);e&&(n=n.filter(function(r){return Object.getOwnPropertyDescriptor(i,r).enumerable})),t.push.apply(t,n)}return t}function rg(i){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?kie(Object(t),!0).forEach(function(n){Wb(i,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(t)):kie(Object(t)).forEach(function(n){Object.defineProperty(i,n,Object.getOwnPropertyDescriptor(t,n))})}return i}function b4e(i,e){if(i==null)return{};var t,n,r=w4e(i,e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(i);for(n=0;n<s.length;n++)t=s[n],e.indexOf(t)===-1&&{}.propertyIsEnumerable.call(i,t)&&(r[t]=i[t])}return r}function w4e(i,e){if(i==null)return{};var t={};for(var n in i)if({}.hasOwnProperty.call(i,n)){if(e.indexOf(n)!==-1)continue;t[n]=i[n]}return t}function l4(i){return x4e(i)||y4e(i)||E4e(i)||v4e()}function S4e(i,e){if(typeof i!="object"||!i)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var n=t.call(i,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(i)}function T4e(i){var e=S4e(i,"string");return typeof e=="symbol"?e:e+""}function E4e(i,e){if(i){if(typeof i=="string")return t9(i,e);var t={}.toString.call(i).slice(8,-1);return t==="Object"&&i.constructor&&(t=i.constructor.name),t==="Map"||t==="Set"?Array.from(i):t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?t9(i,e):void 0}}function Gie(i,e){var t=new e;return t._destructor&&t._destructor(),{linkProp:function(r){return{default:t[r](),onChange:function(o,a){a[i][r](o)},triggerUpdate:!1}},linkMethod:function(r){return function(s){for(var o=s[i],a=arguments.length,l=new Array(a>1?a-1:0),c=1;c<a;c++)l[c-1]=arguments[c];var u=o[r].apply(o,l);return u===o?this:u}}}}var M4e=["rendererConfig","waitForGlobeReady"],Hb=rg(rg({},window.THREE?window.THREE:{AmbientLight:UA,DirectionalLight:BA,Vector2:Oe,REVISION:"185"}),{},{CSS2DRenderer:b3}),zie=Gie("globe",bk),C4e=Object.assign.apply(Object,l4(["globeImageUrl","bumpImageUrl","globeTileEngineUrl","globeTileEngineMaxLevel","globeCurvatureResolution","showGlobe","showGraticules","showAtmosphere","atmosphereColor","atmosphereAltitude","onGlobeReady","pointsData","pointLat","pointLng","pointColor","pointAltitude","pointRadius","pointResolution","pointsMerge","pointsTransitionDuration","arcsData","arcStartLat","arcStartLng","arcStartAltitude","arcEndLat","arcEndLng","arcEndAltitude","arcColor","arcAltitude","arcAltitudeAutoScale","arcStroke","arcCurveResolution","arcCircularResolution","arcDashLength","arcDashGap","arcDashInitialGap","arcDashAnimateTime","arcsTransitionDuration","polygonsData","polygonGeoJsonGeometry","polygonCapColor","polygonCapMaterial","polygonSideColor","polygonSideMaterial","polygonStrokeColor","polygonAltitude","polygonCapCurvatureResolution","polygonsTransitionDuration","pathsData","pathPoints","pathPointLat","pathPointLng","pathPointAlt","pathResolution","pathColor","pathStroke","pathDashLength","pathDashGap","pathDashInitialGap","pathDashAnimateTime","pathTransitionDuration","heatmapsData","heatmapPoints","heatmapPointLat","heatmapPointLng","heatmapPointWeight","heatmapBandwidth","heatmapColorFn","heatmapColorSaturation","heatmapBaseAltitude","heatmapTopAltitude","heatmapsTransitionDuration","hexBinPointsData","hexBinPointLat","hexBinPointLng","hexBinPointWeight","hexBinResolution","hexMargin","hexTopCurvatureResolution","hexTopColor","hexSideColor","hexAltitude","hexBinMerge","hexTransitionDuration","hexPolygonsData","hexPolygonGeoJsonGeometry","hexPolygonColor","hexPolygonAltitude","hexPolygonResolution","hexPolygonMargin","hexPolygonUseDots","hexPolygonCurvatureResolution","hexPolygonDotResolution","hexPolygonsTransitionDuration","tilesData","tileLat","tileLng","tileAltitude","tileWidth","tileHeight","tileUseGlobeProjection","tileMaterial","tileCurvatureResolution","tilesTransitionDuration","particlesData","particlesList","particleLat","particleLng","particleAltitude","particlesSize","particlesSizeAttenuation","particlesColor","particlesTexture","ringsData","ringLat","ringLng","ringAltitude","ringColor","ringResolution","ringMaxRadius","ringPropagationSpeed","ringRepeatPeriod","labelsData","labelLat","labelLng","labelAltitude","labelRotation","labelText","labelSize","labelTypeFace","labelColor","labelResolution","labelIncludeDot","labelDotRadius","labelDotOrientation","labelsTransitionDuration","htmlElementsData","htmlLat","htmlLng","htmlAltitude","htmlElement","htmlElementVisibilityModifier","htmlTransitionDuration","objectsData","objectLat","objectLng","objectAltitude","objectRotation","objectFacesSurface","objectThreeObject","customLayerData","customThreeObject","customThreeObjectUpdate"].map(function(i){return Wb({},i,zie.linkProp(i))}))),R4e=Object.assign.apply(Object,l4(["globeMaterial","globeTileEngineClearCache","getGlobeRadius","getCoords","toGeoCoords"].map(function(i){return Wb({},i,zie.linkMethod(i))}))),Vie=Gie("renderObjs",e9),P4e=Object.assign.apply(Object,l4(["width","height","backgroundColor","backgroundImageUrl","enablePointerInteraction"].map(function(i){return Wb({},i,Vie.linkProp(i))}))),I4e=Object.assign.apply(Object,l4(["lights","postProcessingComposer"].map(function(i){return Wb({},i,Vie.linkMethod(i))}))),qie=Or({props:rg(rg({onZoom:{triggerUpdate:!1},onGlobeClick:{triggerUpdate:!1},onGlobeRightClick:{triggerUpdate:!1},pointLabel:{default:"name",triggerUpdate:!1},onPointClick:{triggerUpdate:!1},onPointRightClick:{triggerUpdate:!1},onPointHover:{triggerUpdate:!1},arcLabel:{default:"name",triggerUpdate:!1},onArcClick:{triggerUpdate:!1},onArcRightClick:{triggerUpdate:!1},onArcHover:{triggerUpdate:!1},polygonLabel:{default:"name",triggerUpdate:!1},onPolygonClick:{triggerUpdate:!1},onPolygonRightClick:{triggerUpdate:!1},onPolygonHover:{triggerUpdate:!1},pathLabel:{default:"name",triggerUpdate:!1},onPathClick:{triggerUpdate:!1},onPathRightClick:{triggerUpdate:!1},onPathHover:{triggerUpdate:!1},onHeatmapClick:{triggerUpdate:!1},onHeatmapRightClick:{triggerUpdate:!1},onHeatmapHover:{triggerUpdate:!1},hexLabel:{triggerUpdate:!1},onHexClick:{triggerUpdate:!1},onHexRightClick:{triggerUpdate:!1},onHexHover:{triggerUpdate:!1},hexPolygonLabel:{triggerUpdate:!1},onHexPolygonClick:{triggerUpdate:!1},onHexPolygonRightClick:{triggerUpdate:!1},onHexPolygonHover:{triggerUpdate:!1},tileLabel:{default:"name",triggerUpdate:!1},onTileClick:{triggerUpdate:!1},onTileRightClick:{triggerUpdate:!1},onTileHover:{triggerUpdate:!1},particleLabel:{default:"name",triggerUpdate:!1},onParticleClick:{triggerUpdate:!1},onParticleRightClick:{triggerUpdate:!1},onParticleHover:{triggerUpdate:!1},labelLabel:{triggerUpdate:!1},onLabelClick:{triggerUpdate:!1},onLabelRightClick:{triggerUpdate:!1},onLabelHover:{triggerUpdate:!1},objectLabel:{default:"name",triggerUpdate:!1},onObjectClick:{triggerUpdate:!1},onObjectRightClick:{triggerUpdate:!1},onObjectHover:{triggerUpdate:!1},customLayerLabel:{default:"name",triggerUpdate:!1},onCustomLayerClick:{triggerUpdate:!1},onCustomLayerRightClick:{triggerUpdate:!1},onCustomLayerHover:{triggerUpdate:!1},pointerEventsFilter:{default:function(){return!0},triggerUpdate:!1},lineHoverPrecision:{default:.2,triggerUpdate:!1,onChange:function(e,t){t.renderObjs.lineHoverPrecision(e),t.renderObjs.pointsHoverPrecision(e)}},showPointerCursor:{default:!0,triggerUpdate:!1},globeOffset:{default:[0,0],triggerUpdate:!1,onChange:function(e,t){return Array.isArray(e)&&e.length===2&&t.renderObjs.viewOffset(e.map(function(n){return-n}))}}},C4e),P4e),methods:rg(rg({pauseAnimation:function(e){var t;return e.animationFrameRequestId!==null&&(cancelAnimationFrame(e.animationFrameRequestId),e.animationFrameRequestId=null),(t=e.globe)===null||t===void 0||t.pauseAnimation(),this},resumeAnimation:function(e){var t;return e.animationFrameRequestId===null&&this._animationCycle(),(t=e.globe)===null||t===void 0||t.resumeAnimation(),this},_animationCycle:function(e){e.renderObjs.tick(),e.tweenGroup.update(),e.animationFrameRequestId=requestAnimationFrame(this._animationCycle)},pointOfView:function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,r=a();if(t.lat===void 0&&t.lng===void 0&&t.altitude===void 0)return r;var s,o=Object.assign({},r,t);if(["lat","lng","altitude"].forEach(function(c){return o[c]=+o[c]}),(s=e.povTween)===null||s===void 0||s.end(),!n)l(o);else{for(;r.lng-o.lng>180;)r.lng-=360;for(;r.lng-o.lng<-180;)r.lng+=360;e.tweenGroup.add(e.povTween=new Ws(r).to(o,n).easing(Br.Cubic.InOut).onUpdate(l).onComplete(function(){e.povTween=void 0,e.tweenGroup.remove(this)}).start())}return this;function a(){return e.globe.toGeoCoords(e.renderObjs.cameraPosition())}function l(c){var u=c.lat,f=c.lng,p=c.altitude;e.renderObjs.cameraPosition(e.globe.getCoords(u,f,p)),e.globe.setPointOfView(e.renderObjs.camera())}},getScreenCoords:function(e){for(var t,n=arguments.length,r=new Array(n>1?n-1:0),s=1;s<n;s++)r[s-1]=arguments[s];var o=(t=e.globe).getCoords.apply(t,r);return e.renderObjs.getScreenCoords(o.x,o.y,o.z)},toGlobeCoords:function(e,t,n){var r=e.renderObjs.intersectingObjects(t,n).find(function(l){return(l.object.__globeObjType||l.object.parent.__globeObjType)==="globe"});if(!r)return null;var s=e.globe.toGeoCoords(r.point),o=s.lat,a=s.lng;return{lat:o,lng:a}},scene:function(e){return e.renderObjs.scene()},camera:function(e){return e.renderObjs.camera()},renderer:function(e){return e.renderObjs.renderer()},controls:function(e){return e.renderObjs.controls()},_destructor:function(e){this.pauseAnimation(),this.pointsData([]),this.arcsData([]),this.polygonsData([]),this.pathsData([]),this.heatmapsData([]),this.hexBinPointsData([]),this.hexPolygonsData([]),this.tilesData([]),this.particlesData([]),this.labelsData([]),this.htmlElementsData([]),this.objectsData([]),this.customLayerData([]),e.globe._destructor(),e.renderObjs._destructor()}},R4e),I4e),stateInit:function(e){var t=e.rendererConfig,n=e.waitForGlobeReady,r=n===void 0?!0:n,s=b4e(e,M4e),o=new bk(rg({waitForGlobeReady:r},s));return{globe:o,renderObjs:e9({controlType:"orbit",rendererConfig:t,waitForLoadComplete:r,extraRenderers:[new Hb.CSS2DRenderer]}).skyRadius(o.getGlobeRadius()*500).showNavInfo(!1).objects([o]).lights([new Hb.AmbientLight(13421772,Math.PI),new Hb.DirectionalLight(16777215,.6*Math.PI)]),tweenGroup:new tm}},init:function(e,t){var n=this;e.innerHTML="",e.appendChild(t.container=document.createElement("div")),t.container.style.position="relative";var r=document.createElement("div");t.container.appendChild(r),t.renderObjs(r),t.globe.rendererSize(t.renderObjs.renderer().getSize(new Hb.Vector2)),this.pointOfView({altitude:2.5});var s=t.globe.getGlobeRadius(),o=t.renderObjs.controls();t.renderObjs.camera().near=.05,o.minDistance=s+Math.max(.001,t.renderObjs.camera().near*1.1),o.maxDistance=s*100,o.enablePan=!1,o.enableDamping=!0,o.dampingFactor=.1,o.rotateSpeed=.3,o.zoomSpeed=.3,o.zoomToCursor=!0,o.addEventListener("change",function(){o.target.setScalar(0);var c=n.pointOfView();o.rotateSpeed=c.altitude*.3,o.zoomSpeed=Math.sqrt(c.altitude)*.5,t.globe.setPointOfView(t.renderObjs.camera()),t.onZoom&&t.onZoom(c)});var a=function(u){for(var f=u;f&&!f.hasOwnProperty("__globeObjType");)f=f.parent;return f},l={point:function(u){return u},arc:function(u){return u},polygon:function(u){return u.data},path:function(u){return u},heatmap:function(u){return u},hexbin:function(u){return u},hexPolygon:function(u){return u},tile:function(u){return u},particles:function(u,f){return!f||!f.hasOwnProperty("index")||u.length<=f.index?u:u[f.index]},label:function(u){return u},object:function(u){return u},custom:function(u){return u}};Hb.REVISION<155&&(t.renderObjs.renderer().useLegacyLights=!1),t.renderObjs.hoverFilter(function(c){var u=a(c);if(!u)return!1;var f=u.__globeObjType;if(f!=="globe"&&!l.hasOwnProperty(f))return!1;var p=l.hasOwnProperty(f)&&u.__data?l[f](u.__data):null;return["points","hexBinPoints"].some(function(x){return x===f})&&Array.isArray(p)?!1:t.pointerEventsFilter(u,p)}).tooltipContent(function(c,u){var f={point:t.pointLabel,arc:t.arcLabel,polygon:t.polygonLabel,path:t.pathLabel,hexbin:t.hexLabel,hexPolygon:t.hexPolygonLabel,tile:t.tileLabel,particles:t.particleLabel,label:t.labelLabel,object:t.objectLabel,custom:t.customLayerLabel},p=a(c),x=p&&p.__globeObjType;return p&&x&&f.hasOwnProperty(x)&&l.hasOwnProperty(x)&&rt(f[x])(l[x](p.__data,u))||""}).onHover(function(c,u,f){var p={point:t.onPointHover,arc:t.onArcHover,polygon:t.onPolygonHover,path:t.onPathHover,heatmap:t.onHeatmapHover,hexbin:t.onHexHover,hexPolygon:t.onHexPolygonHover,tile:t.onTileHover,particles:t.onParticleHover,label:t.onLabelHover,object:t.onObjectHover,custom:t.onCustomLayerHover},x={globe:t.onGlobeClick,point:t.onPointClick,arc:t.onArcClick,polygon:t.onPolygonClick,path:t.onPathClick,heatmap:t.onHeatmapClick,hexbin:t.onHexClick,hexPolygon:t.onHexPolygonClick,tile:t.onTileClick,particles:t.onParticleClick,label:t.onLabelClick,object:t.onObjectClick,custom:t.onCustomLayerClick},v=a(c);if(v&&!p.hasOwnProperty(v.__globeObjType)&&(v=null),v!==t.hoverObj){var w,S=t.hoverObj?t.hoverObj.__globeObjType:null,T=t.hoverData,R=v?v.__globeObjType:null,P=(w=v)!==null&&w!==void 0&&w.__data?l[R](v.__data,f):null;S&&S!==R&&p[S]&&p[S](null,T||null),R&&p[R]&&p[R](P,S===R?T:null),t.renderObjs.renderer().domElement.classList[R&&x[R]&&rt(t.showPointerCursor)(R,P)?"add":"remove"]("clickable"),t.hoverObj=v,t.hoverData=P}}).onClick(function(c,u,f){if(c){var p={globe:t.onGlobeClick,point:t.onPointClick,arc:t.onArcClick,polygon:t.onPolygonClick,path:t.onPathClick,heatmap:t.onHeatmapClick,hexbin:t.onHexClick,hexPolygon:t.onHexPolygonClick,tile:t.onTileClick,particles:t.onParticleClick,label:t.onLabelClick,object:t.onObjectClick,custom:t.onCustomLayerClick},x=a(c),v=x.__globeObjType;if(x&&p.hasOwnProperty(v)&&p[v]){var w=[u],S=f!=null&&f.isVector3?f:f?.point;if(v==="globe"){var T=n.toGeoCoords(S),R=T.lat,P=T.lng;w.unshift({lat:R,lng:P})}else w.push(n.toGeoCoords(S));l.hasOwnProperty(v)&&w.unshift(l[v](x.__data,f)),p[v].apply(p,w)}}}).onRightClick(function(c,u,f){if(c){var p={globe:t.onGlobeRightClick,point:t.onPointRightClick,arc:t.onArcRightClick,polygon:t.onPolygonRightClick,path:t.onPathRightClick,heatmap:t.onHeatmapRightClick,hexbin:t.onHexRightClick,hexPolygon:t.onHexPolygonRightClick,tile:t.onTileRightClick,particles:t.onParticleRightClick,label:t.onLabelRightClick,object:t.onObjectRightClick,custom:t.onCustomLayerRightClick},x=a(c),v=x.__globeObjType;if(x&&p.hasOwnProperty(v)&&p[v]){var w=[u],S=f!=null&&f.isVector3?f:f?.point;if(v==="globe"){var T=n.toGeoCoords(S),R=T.lat,P=T.lng;w.unshift({lat:R,lng:P})}else w.push(n.toGeoCoords(S));l.hasOwnProperty(v)&&w.unshift(l[v](x.__data,f)),p[v].apply(p,w)}}}),this._animationCycle()}});var jie=4,Xb=100,Yb=Xb+.2,cd=8,N4e=96,Xie=.045,$ie=.08;function ix(i,e,t){let n=(90-i)*Math.PI/180,r=(90-e)*Math.PI/180;return[t*Math.sin(n)*Math.cos(r),t*Math.cos(n),t*Math.sin(n)*Math.sin(r)]}var $n=null,u4="",gs={group:null,tiles:new Map,key:"",variant:""},Do={group:null,cell:null,fitKey:""},Au={group:null,key:""},L4e=180,i9=null,rx=new Map,d4=new Map,Hie=new Map;function Yie(){let i=aV(U.map)==="sphere"&&lf(U.map)!==null;ye.globeToggle.hidden=!i,Kie(),!i&&$n&&(jb(),gs.group=null,Do.group=null,Do.cell=null,Au.group=null,Au.key="",$n._destructor(),$n=null,u4="",i9=null,ye.globe.replaceChildren())}function p4(){U.globeActive?Kie():Jie()}var $b=2.5,h4=2,sx=.08,A4=4;function D4e(i){let e=Number.isFinite(i)?i:h4;return Xr($b/2**(e-h4),sx,A4)}function s9(i){let e=Number.isFinite(i)?Math.max(i,sx/2):$b,t=(U.variant?.maxZoom??h4)+2;return Xr(h4+Math.log2($b/e),0,t)}function o9(i){if(!$n||!U.globeActive)return;let e=$n.pointOfView(),t=Xr((Number.isFinite(e.altitude)?e.altitude:$b)/2**i,sx,A4);$n.pointOfView({altitude:t},180)}function Kie(){let i=lf(U.map),e=U.engine?.getView();if($n&&U.globeActive&&i&&e){let t=$n.pointOfView(),[n,r]=i.toWorld(t.lat,t.lng);Number.isFinite(n)&&Number.isFinite(r)&&(e.cancelAnimations(),e.setCenter([n,-r]),e.setZoom(s9(t.altitude)))}U.globeActive=!1,ye.globe.hidden=!0,ye.globeToggle.setAttribute("aria-pressed","false"),ye.viewport.hidden=!1,jb(),U.overviewKey="",document.dispatchEvent(new Event("atlas:globe-camera"))}function Zie(){if(!$n||!U.globeActive)return null;let i=$n.pointOfView();return{lat:i.lat,lng:i.lng}}function Qie(i,e,t){if(!$n)return;let n=$n.pointOfView().altitude;$n.pointOfView({lat:i,lng:e,altitude:n},t?180:0)}async function Jie(){let i=lf(U.map);if(!i)return;if(U.globeActive=!0,ye.viewport.hidden=!0,ye.globe.hidden=!1,ye.globeToggle.setAttribute("aria-pressed","true"),U.overviewKey="",!$n){$n=qie({animateIn:!1})(ye.globe).backgroundColor("#0b0e12").showAtmosphere(!0).atmosphereColor("#8a6f5b").atmosphereAltitude(.12).objectLat(o=>o.lat).objectLng(o=>o.lng).objectAltitude(o=>o.pin===U.selectedPin?.03:.014).objectThreeObject(o=>j4e(o.pin)).objectLabel(o=>o.pin.location.title).onObjectClick(o=>Nx(o.pin)).onObjectHover(o=>{ye.globe.style.cursor=o?"pointer":""}).onZoom(()=>{document.dispatchEvent(new Event("atlas:globe-camera")),Wie(),c4(),X4e()}),document.addEventListener("atlas:selection",W4e),document.addEventListener("atlas:filters",n9),document.addEventListener("atlas:grid",()=>{f4(),n9(),c4()}),document.addEventListener("atlas:labels",c4),$n.onGlobeClick(({lat:o,lng:a})=>{if(!U.gridEnabled)return;let l=lf(U.map);if(!l)return;let[c,u]=l.toWorld(o,a),f=uo().descendTarget(U.gridCell,[c,-u]);f&&tA(f)});let s=$n.controls();s.minDistance=Xb*(1+sx),s.maxDistance=Xb*(1+A4),gs.group=new br,$n.scene().add(gs.group),Do.group=new br,$n.scene().add(Do.group),Au.group=new br,$n.scene().add(Au.group),window.__atlasGlobe={detail:gs,grid:Do,labels:Au,sprites:rx}}l9();let e=U.engine?.getView(),t=e?.getCenter();if(t&&Number.isFinite(t[0])&&Number.isFinite(t[1])){let[s,o]=i.toLatLng(t[0],-t[1]);$n.pointOfView({lat:s,lng:o,altitude:D4e(e.getZoom())})}else $n.pointOfView({lat:10,lng:0,altitude:$b});let n=U.variant||U.map.variants[0],r=`${U.game.stamp}:${U.map.slug}:${n.tiles}`;if(u4!==r){u4=r;let s=await Y4e(n);s&&u4===r&&$n.globeImageUrl(s)}i9!==U.pins&&(i9=U.pins,rx.clear(),d4.clear(),$n.objectsData($4e(i))),n9(),ire(),Wie(),f4(),c4(),document.dispatchEvent(new Event("atlas:globe-camera"))}function f4(){if(!$n||!Do.group)return;for(let t of[...Do.group.children])Do.group.remove(t),t.geometry?.dispose(),t.material?.map?.dispose(),t.material?.dispose();let i=U.globeActive?lf(U.map):null;if(!i||!U.gridEnabled){Do.cell=null;return}let e=uo();for(let t of oS()){let n=ere(t.ring,i),r=a9(n),s=sS(t,{subgridVisible:U.subgridVisible,labelled:B4e(t,r)});if(s){if(s.fill){let o=tre(e.center(t.hash),i);Do.group.add(U4e(n,o,s.fill))}Do.group.add(z4e(n,s.line)),s.label&&Do.group.add(V4e(s.label,r))}}Do.cell!==null&&Do.cell!==U.gridCell&&q4e(i),Do.cell=U.gridCell}function ere(i,e){return i.map(([t,n])=>e.toLatLng(t,-n))}function tre(i,e){return e.toLatLng(i[0],-i[1])}function F4e(i){let e=[];for(let t=0;t<i.length-1;t++){let[n,r]=i[t],[s,o]=i[t+1],a=Math.max(Math.abs(s-n),Math.abs(o-r)),l=Xr(Math.ceil(a/2),1,48);for(let c=0;c<l;c++){let u=c/l;e.push([n+(s-n)*u,r+(o-r)*u])}}return e}function a9(i){let e=-1/0,t=1/0,n=1/0,r=-1/0;for(let[s,o]of i)e=Math.max(e,s),t=Math.min(t,s),n=Math.min(n,o),r=Math.max(r,o);return{north:e,south:t,west:n,east:r}}function O4e(i){let e=$n.pointOfView(),t=Math.max(e.altitude,sx/2),n=50*Math.PI/180,r=2*t*Xb*Math.tan(n/2)/Math.max(1,ye.globe.clientHeight||1),s=Xb*Math.PI/180/r;return{width:Math.abs(i.east-i.west)*s,height:Math.abs(i.north-i.south)*s}}function B4e(i,e){let n=i.role==="neighbor"?Li.neighborLabelSizePx:Li.labelSizePx,r=`900 ${n}px ${Li.labelFont}`,s=O4e(e);return VI(i.hash,r)+9<=s.width&&n+6<=s.height}function U4e(i,e,t){let n=Yb+.12,r=F4e(i),s=a9(i),o=Math.max(s.east-s.west,s.north-s.south),a=Xr(Math.ceil(o/6),2,24),l=[...ix(e[0],e[1],n)],c=[];for(let w=1;w<=a;w++)for(let[S,T]of r){let R=w/a;l.push(...ix(e[0]+(S-e[0])*R,e[1]+(T-e[1])*R,n))}let u=r.length,f=(w,S)=>1+(w-1)*u+S%u;for(let w=0;w<u;w++)c.push(0,f(1,w),f(1,w+1));for(let w=1;w<a;w++)for(let S=0;S<u;S++)c.push(f(w,S),f(w+1,S),f(w,S+1)),c.push(f(w,S+1),f(w+1,S),f(w+1,S+1));let p=new qn;p.setAttribute("position",new Rn(l,3)),p.setIndex(c);let x=new Kr({color:t.color,transparent:!0,opacity:t.opacity,depthWrite:!1,side:2}),v=new Gn(p,x);return v.renderOrder=1,v}function c4(){if(!$n||!Au.group)return;let i=U.globeActive&&U.labelsHeld,e=i?$n.pointOfView():null,t=i?`${Math.round(e.lat)}:${Math.round(e.lng)}:${e.altitude.toFixed(2)}:${U.gridCell}`:"";if(t===Au.key)return;Au.key=t;for(let r of[...Au.group.children])Au.group.remove(r),r.material?.map?.dispose(),r.material?.dispose();if(!i)return;let n=[];for(let[r,s]of rx){if(!s.visible)continue;let o=d4.get(r);if(!o)continue;let a=k4e(e,o);a>85||n.push({pin:r,stood:o,distance:a})}n.sort((r,s)=>r.distance-s.distance);for(let{pin:r,stood:s}of n.slice(0,L4e))Au.group.add(G4e(r,s))}function k4e(i,e){let t=Math.PI/180,n=Math.sin(i.lat*t)*Math.sin(e.lat*t)+Math.cos(i.lat*t)*Math.cos(e.lat*t)*Math.cos((i.lng-e.lng)*t);return Math.acos(Xr(n,-1,1))*180/Math.PI}function G4e(i,e){let t=i.location.title,n=document.createElement("canvas"),r=n.getContext("2d"),s="600 26px Inter, system-ui, sans-serif";r.font=s;let o=Math.ceil(r.measureText(t).width)+24;n.width=o,n.height=40,r.font=s,r.textAlign="center",r.textBaseline="middle",r.fillStyle="rgba(10, 13, 17, 0.78)",r.fillRect(0,0,o,40),r.fillStyle="#e6ebf0",r.fillText(t,o/2,21);let a=new Vu({depthWrite:!1,sizeAttenuation:!1,transparent:!0});new Ya().load(n.toDataURL("image/png"),u=>{a.map=u,a.needsUpdate=!0});let l=new CA(a);l.position.set(...ix(e.lat,e.lng,Yb+.4));let c=.028;return l.scale.set(c*o/40,c,1),l.center.set(.5,0),l}function z4e(i,e){let t=[];for(let o=0;o<i.length-1;o++){let[a,l]=i[o],[c,u]=i[o+1],f=Math.max(Math.abs(c-a),Math.abs(u-l)),p=Xr(Math.ceil(f/2),4,48);for(let x=0;x<p;x++){let v=x/p;t.push(...ix(a+(c-a)*v,l+(u-l)*v,Yb+.25))}}t.push(...t.slice(0,3));let n=new x0;n.setPositions(t);let r=new zh({color:e.color,transparent:!0,opacity:e.opacity,linewidth:e.widthPx,depthWrite:!1});r.resolution.set(ye.globe.clientWidth||1,ye.globe.clientHeight||1);let s=new Y1(n,r);return s.computeLineDistances(),s.renderOrder=2,s}function V4e(i,e){let n=i.sizePx*2,r=`500 ${n}px ${Li.labelFont}`,s=`900 ${n}px ${Li.labelFont}`,o=document.createElement("canvas"),a=o.getContext("2d");a.font=r;let l=i.prefix?a.measureText(i.prefix).width:0;a.font=s;let c=a.measureText(i.final).width,u=10;o.width=Math.ceil(l+c+u*2),o.height=n+u*1.4,a.fillStyle=i.chip,a.fillRect(0,0,o.width,o.height),a.textBaseline="middle";let f=o.height/2+2;i.prefix&&(a.font=r,a.fillStyle=i.color,a.globalAlpha=Li.prefixAlpha*i.textAlpha,a.fillText(i.prefix,u,f)),a.font=s,a.globalAlpha=i.textAlpha,a.fillStyle=i.color,a.fillText(i.final,u+l,f),a.globalAlpha=1;let p=new Vu({depthWrite:!1,transparent:!0,sizeAttenuation:!1});new Ya().load(o.toDataURL("image/png"),R=>{p.map=R,p.needsUpdate=!0});let x=new CA(p),v=Math.abs(e.north-e.south)*.02,w=Math.abs(e.east-e.west)*.02;x.position.set(...ix(e.south+v,e.east-w,Yb+.35));let S=Math.max(1,ye.globe.clientHeight||1),T=o.height/2/S;return x.scale.set(T*o.width/o.height,T,1),x.center.set(1,0),x.renderOrder=3,x}function q4e(i){let t=oS().find(l=>l.role==="scope"||l.role==="leaf");if(!t)return;let[n,r]=tre(uo().center(t.hash),i),s=a9(ere(t.ring,i)),o=Math.max(s.east-s.west,s.north-s.south),a=Xr(o/45,sx,A4);$n.pointOfView({lat:n,lng:r,altitude:a},400)}function Wie(){if(!$n||!gs.group)return;let i=U.globeActive?U.variant||U.map.variants[0]:null;if(!i){jb();return}gs.variant!==i.tiles&&(jb(),gs.variant=i.tiles);let e=$n.pointOfView(),t=Math.min(Math.round(s9(e.altitude))+1,i.maxZoom);if(t<=jie||!i.formats[t]){jb(),gs.key="";return}let n=2**t,r=n/2,s=360/n,o=Math.acos(1/(1+e.altitude))*180/Math.PI+s,a=Math.floor(((e.lng+180)%360+360)%360/s),l=Math.floor((90-e.lat)/s),c=Math.ceil(o/s);for(;(2*c+1)**2>N4e&&c>1;)c--;let u=new Set;for(let p=-c;p<=c;p++){let x=l+p;if(!(x<0||x>=r))for(let v=-c;v<=c;v++){let w=((a+v)%n+n)%n;u.add(`${t}/${w}/${x}`)}}let f=`${i.tiles}:${[...u].sort().join(",")}`;if(f!==gs.key){gs.key=f;for(let[p,x]of gs.tiles)u.has(p)||(gs.group.remove(x),nre(x),gs.tiles.delete(p));for(let p of u){if(gs.tiles.has(p))continue;let[x,v,w]=p.split("/").map(Number),S=H4e(i,x,v,w);gs.tiles.set(p,S),gs.group.add(S)}}}function H4e(i,e,t,n){let r=360/2**e,s=-180+t*r,o=90-n*r,a=[],l=[],c=[];for(let w=0;w<=cd;w++){let S=o-w/cd*r;for(let T=0;T<=cd;T++){let R=s+T/cd*r;a.push(...ix(S,R,Yb)),l.push(T/cd,1-w/cd)}}let u=cd+1;for(let w=0;w<cd;w++)for(let S=0;S<cd;S++){let T=w*u+S;c.push(T,T+u,T+1),c.push(T+1,T+u,T+u+1)}let f=new qn;f.setAttribute("position",new Rn(a,3)),f.setAttribute("uv",new Rn(l,2)),f.setIndex(c);let p=new Kr,x=new Gn(f,p);x.visible=!1;let v=`${U.game.base}/tiles/${i.tiles}/${e}/${t}/${n}.${i.formats[e]}`;return new Ya().load(v,w=>{w.colorSpace=vr,p.map=w,p.needsUpdate=!0,x.visible=!0}),x}function jb(){if(gs.group){for(let i of gs.tiles.values())gs.group.remove(i),nre(i);gs.tiles.clear(),gs.key=""}}function nre(i){i.geometry.dispose(),i.material.map?.dispose(),i.material.dispose()}function ire(){if($n){for(let[i,e]of rx){let t=i===U.selectedPin;e.material=sre(i.category,t);let n=t?$ie:Xie;e.scale.set(n,n,1)}$n.objectAltitude(i=>i.pin===U.selectedPin?.03:.014)}}function W4e(){if(!$n||!U.globeActive)return;ire();let i=d4.get(U.selectedPin);if(i){let e=$n.pointOfView().altitude;$n.pointOfView({lat:i.lat,lng:i.lng,altitude:e},600)}}function rre(i){return!(i.filteredHidden||U.hiddenCategories.has(i.category.id)||U.gridEnabled&&U.gridCell&&!Rd(i))}function n9(){if(!(!$n||!U.globeActive))for(let[i,e]of rx)e.visible=rre(i)}function j4e(i){let e=new CA(sre(i.category,i===U.selectedPin)),t=i===U.selectedPin?$ie:Xie;return e.scale.set(t,t,1),e.visible=rre(i),rx.set(i,e),e}function sre(i,e){let t=`${Xx(i)}:${e?"ringed":"plain"}`,n=Hie.get(t);if(n)return n;n=new Vu({depthWrite:!1,sizeAttenuation:!1}),Hie.set(t,n);let r=U.markerIcons.get(Xx(i)),s=o=>{let a=document.createElement("canvas");a.width=80,a.height=80;let l=a.getContext("2d");o?l.drawImage(o,8,8,64,64):(l.font="900 26px Inter, system-ui, sans-serif",l.textAlign="center",l.textBaseline="middle",l.lineWidth=6,l.strokeStyle=J0(),l.strokeText(Dc(i.title),40,41),l.fillStyle=eA(i),l.fillText(Dc(i.title),40,41)),e&&(l.beginPath(),l.arc(40,40,36,0,Math.PI*2),l.lineWidth=5,l.strokeStyle="#ffffff",l.stroke()),new Ya().load(a.toDataURL("image/png"),c=>{n.map=c,n.needsUpdate=!0})};if(r){let o=new Image;o.onload=()=>s(o),o.onerror=()=>s(null),o.src=r}else s(null);return n}function ore(){U.globeActive&&Jie()}function l9(){!$n||ye.globe.hidden||($n.width(ye.globe.clientWidth).height(ye.globe.clientHeight),f4())}function X4e(){if(!$n||!U.globeActive||!U.gridEnabled)return;let i=$n.pointOfView(),e=`${U.gridCell}:${Math.round(s9(i.altitude)*2)}`;e!==Do.fitKey&&(Do.fitKey=e,f4())}function $4e(i){let e=[];for(let t of U.pins){let[n,r]=Og(t.location.lat,t.location.lng),[s,o]=i.toLatLng(n,-r);e.push({lat:s,lng:o,pin:t}),d4.set(t,{lat:s,lng:o})}return e}async function Y4e(i){let e=Math.min(jie,i.maxZoom),t=i.formats[e];if(!t)return null;let n=2**e,r=n/2,s=document.createElement("canvas");s.width=n*256,s.height=r*256;let o=s.getContext("2d"),a=[];for(let l=0;l<r;l++)for(let c=0;c<n;c++){let u=`${U.game.base}/tiles/${i.tiles}/${e}/${c}/${l}.${t}`;a.push(K4e(u).then(f=>{f&&o.drawImage(f,c*256,l*256,256,256)}))}return await Promise.all(a),s.toDataURL("image/jpeg",.92)}function K4e(i){return new Promise(e=>{let t=new Image;t.onload=()=>e(t),t.onerror=()=>e(null),t.src=i})}function are(){let i=U.variant,e=ye.overviewCanvas,t=e.getContext("2d"),n=Yh(),r=U.game.tileGrid.size,s=U.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=++U.overviewRun,f=i.formats[l],p=Math.floor(n[0]/r*2**l),x=Math.ceil(n[2]/r*2**l),v=Math.floor(-n[3]/r*2**l),w=Math.ceil(-n[1]/r*2**l);for(let S=v;S<w;S++)for(let T=p;T<x;T++){if(!f||!g4(i,l,T,S))continue;let R=new Image;R.onload=()=>{U.overviewRun===u&&t.drawImage(R,T*s-n[0]*c,S*s+n[3]*c,s,s)},R.src=`${U.game.base}/tiles/${encodeURIComponent(i.tiles)}/${l}/${T}/${S}.${f}`}ox()}function ox(){let i=Zie();if(i){let w=lf(U.map);if(!w||!U.variant)return;let S=Yh(),[T,R]=w.toWorld(i.lat,i.lng),P=ye.overviewCanvas,C=Xr((T-S[0])/(S[2]-S[0]),0,1),L=Xr((R+S[3])/(S[3]-S[1]),0,1);U.overviewKey="",ye.overviewShelf.hidden=!1;let D=ye.overviewViewport.style,F=22;D.left=`${C*P.width-F/2}px`,D.top=`${L*P.height-F/2}px`,D.width=`${F}px`,D.height=`${F}px`;return}let e=U.engine?.getView();if(!e||!U.variant)return;let t=Yh(),n=e.calculateExtent(U.engine.getSize()),r=t[2]-t[0],s=t[3]-t[1],o=(e.getResolution()||0)*4,a=n[0]<=t[0]+o&&n[1]<=t[1]+o&&n[2]>=t[2]-o&&n[3]>=t[3]-o,l=a?"hidden":n.map(Math.round).join(",");if(l===U.overviewKey||(U.overviewKey=l,ye.overviewShelf.hidden=a,a))return;let c=ye.overviewCanvas,u=Xr((n[0]-t[0])/r,0,1),f=Xr((n[2]-t[0])/r,0,1),p=Xr((t[3]-n[3])/s,0,1),x=Xr((t[3]-n[1])/s,0,1),v=ye.overviewViewport.style;v.left=`${u*c.width}px`,v.top=`${p*c.height}px`,v.width=`${Math.max(8,(f-u)*c.width)}px`,v.height=`${Math.max(8,(x-p)*c.height)}px`}function m4(i,e=!0){U.overviewDocked=i,i&&U.overviewPointer!==null&&(U.overviewPointer=null,ax()),ye.overviewShelf.classList.toggle("is-docked",i),ye.overviewDock.setAttribute("aria-expanded",String(!i));let t=i?"Bring the overview back":"Put the overview away";ye.overviewDock.setAttribute("aria-label",t),ye.overviewDock.title=t,e&&Nc()}function c9(i,e){let t=ye.overviewCanvas.getBoundingClientRect(),n=Yh(),r=(a,l,c)=>Xr((a-l)/(c-l),0,1);if(U.globeActive){let a=lf(U.map);if(!a)return;let l=n[0]+r(i.clientX,t.left,t.right)*(n[2]-n[0]),c=-n[3]+r(i.clientY,t.top,t.bottom)*(n[3]-n[1]),[u,f]=a.toLatLng(l,c);Qie(u,f,e);return}let s=U.engine?.getView();if(!s||!U.variant)return;let o=[n[0]+r(i.clientX,t.left,t.right)*(n[2]-n[0]),n[3]-r(i.clientY,t.top,t.bottom)*(n[3]-n[1])];if(e){s.animate({center:o,duration:180});return}s.cancelAnimations(),s.setCenter(o)}function Gl(i){return new SH({updateWhileAnimating:!0,...i})}function lre(){let i=U.game.tileGrid.size,e=[0,-i,i,0];U.projection=new _d({code:"ATLAS:PIXELS",units:"pixels",extent:e}),U.sources={grid:new vf({wrapX:!1}),gridContext:new vf({wrapX:!1}),zoneScrim:new vf({wrapX:!1}),zones:new vf({wrapX:!1}),zoneTitles:new vf({wrapX:!1}),text:new vf({wrapX:!1}),pins:new vf({wrapX:!1}),priority:new vf({wrapX:!1})},U.layers={raster:new rN({zIndex:0}),rasterDetail:new rN({zIndex:1}),grid:Gl({source:U.sources.grid,style:zI,renderOrder:Kl,renderBuffer:40,zIndex:5}),zoneScrim:Gl({source:U.sources.zoneScrim,style:FV,zIndex:6}),zones:Gl({source:U.sources.zones,style:OV,renderBuffer:32,zIndex:10}),zoneTitles:Gl({source:U.sources.zoneTitles,style:BV,renderOrder:Kl,renderBuffer:160,zIndex:20}),zoneTitleDetail:Gl({source:U.sources.zoneTitles,style:UV,renderOrder:Kl,renderBuffer:160,zIndex:44}),text:Gl({source:U.sources.text,style:RV,renderOrder:Kl,renderBuffer:220,zIndex:30}),textDetail:Gl({source:U.sources.text,style:PV,renderOrder:Kl,renderBuffer:220,zIndex:45}),zoneText:Gl({source:U.sources.text,style:IV,renderOrder:Kl,renderBuffer:220,zIndex:41}),pins:Gl({source:U.sources.pins,style:EV,renderOrder:Kl,renderBuffer:48,zIndex:40}),zonePins:Gl({source:U.sources.pins,style:MV,renderOrder:Kl,renderBuffer:48,zIndex:42}),pinLabels:Gl({source:U.sources.pins,style:CV,renderOrder:Kl,renderBuffer:180,zIndex:45}),gridContext:Gl({source:U.sources.gridContext,style:zI,renderOrder:Kl,renderBuffer:40,zIndex:48}),priority:Gl({source:U.sources.priority,style:NV,renderOrder:Kl,renderBuffer:220,zIndex:50})},U.engine=new Kq({target:ye.viewport,layers:Object.values(U.layers),controls:wS({attribution:!1,rotate:!1,zoom:!1}),interactions:RS({onFocusOnly:!1}),view:x4(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&&ax()}),U.engine.on("postrender",ox),ye.viewport.addEventListener("wheel",()=>{document.activeElement!==ye.viewport&&ye.viewport.focus({preventScroll:!0})},{capture:!0,passive:!0}),U.engine.on("singleclick",t=>{if(U.gridEnabled){let r=U.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===U.layers.grid||s===U.layers.gridContext});if(r){tA(r.hash);return}}let n=U.engine.forEachFeatureAtPixel(t.pixel,(r,s)=>_4(s)&&r.get("pin")||null,{hitTolerance:5,layerFilter:_4});n&&Nx(n)}),U.engine.on("pointermove",t=>{if(t.dragging){Bg(null);return}let n=U.engine.forEachFeatureAtPixel(t.pixel,(o,a)=>_4(a)&&o.get("pin")||null,{hitTolerance:4,layerFilter:_4}),r=n&&Ru(n.category)==="text"?null:n;Bg(r||null);let s=U.gridEnabled&&U.engine.hasFeatureAtPixel(t.pixel,{layerFilter:o=>o===U.layers.grid||o===U.layers.gridContext});U.engine.getTargetElement().style.cursor=n||s?"pointer":""}),U.engine.getViewport().addEventListener("pointerleave",()=>Bg(null))}function _4(i){return i===U.layers.pins||i===U.layers.zonePins||i===U.layers.pinLabels||i===U.layers.priority||i===U.layers.text||i===U.layers.textDetail||i===U.layers.zoneText}function x4(i,e=null){let t=U.game.tileGrid.size,n=e||[0,-t,t,0];return new Al({projection:U.projection,center:[(n[0]+n[2])/2,(n[1]+n[3])/2],resolutions:u9(i),minZoom:0,maxZoom:i,extent:n,constrainResolution:!1,smoothResolutionConstraint:!1,showFullExtent:!0,zoom:0})}function u9(i){let e=U.game.tileGrid.size/U.game.tileGrid.tileSize;return Array.from({length:i+1},(t,n)=>e/2**n)}async function df(i,e){U.game=U.catalog.games.find(r=>r.slug===i)||U.catalog.games[0],U.engine||lre(),!e&&!U.restore&&(U.restore=Rg(U.game.slug)),ye.game.value=U.game.slug,B0(ye.map,U.game.maps,"title"),ye.map.disabled=U.game.maps.length===1,ye.map.title=ye.map.disabled?"This game has one map":"Choose a map";let t=U.restore?.game===U.game.slug?U.restore:null,n=e&&U.game.maps.find(r=>r.slug===e)||t&&U.game.maps.find(r=>r.slug===t.map);await h9((n||U.game.maps[0]).slug)}async function h9(i){let e=U.game.maps.find(s=>s.slug===i)||U.game.maps[0],t=++U.mapRun;ye.loading.hidden=!1;let n;try{n=await JV(e)}catch{U.mapRun===t&&(ye.loading.hidden=!0,oA());return}if(U.mapRun!==t)return;U.settling=!0,U.map=n,document.documentElement.style.setProperty("--icon-outset-color",J0()),ye.map.value=U.map.slug,B0(ye.variant,U.map.variants,"name"),ye.variantField.hidden=U.map.variants.length<2,U.styleCache.clear(),Bg(null),U.gridCell="",U.gridSystem="geohash",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)),m4(!!U.restore?.overviewDocked,!1),Zw(U.restore?!!U.restore.dockFolded:!0,!1),U.dockDismissed=!!U.restore?.dockDismissed,U.search="",ye.search.value="",ye.dock.hidden=!1,Oc(),YV(),qI(),XV(),f9(r?Xr(r.variant,0,U.map.variants.length-1):0,!0),Yie(),U.restore=null,ye.sidebar.classList.remove("is-open"),ye.mobileLegend.setAttribute("aria-expanded","false"),Dz(),U.settling=!1,Nc()}function f9(i,e=!1){let t=U.variant;U.variant=U.map.variants[i]||U.map.variants[0];let n=U.variant,r=e?null:J4e(t,n),s=Eu(n);if(ye.variant.value=String(U.map.variants.indexOf(U.variant)),e)U.engine.setView(x4(s,Yh()));else{let w=U.engine.getView(),S=x4(s,Yh());S.setCenter(w.getCenter()),S.setZoom(w.getZoom()||0),U.engine.setView(S)}let o=++U.tileRun,a=0;U.tileStats={requested:0,loaded:0,errors:0,peakPending:0},ye.loading.hidden=!1;let l=w=>{w.on("tileloadstart",()=>{U.tileRun===o&&(a++,U.tileStats.requested++,U.tileStats.peakPending=Math.max(U.tileStats.peakPending,a))});let S=T=>{U.tileRun===o&&(a=Math.max(0,a-1),T?U.tileStats.errors++:U.tileStats.loaded++,a===0&&U.tileStats.loaded>0&&(ye.loading.hidden=!0))};return w.on("tileloadend",()=>S(!1)),w.on("tileloaderror",()=>S(!0)),w},c=(w,S)=>l(new Nz({projection:U.projection,tileGrid:new Rx({extent:[0,-U.game.tileGrid.size,U.game.tileGrid.size,0],origin:[0,0],resolutions:u9(w),tileSize:U.game.tileGrid.tileSize}),cacheSize:64,interpolate:n.interpolate,transition:0,wrapX:!1,tileUrlFunction:([T,R,P])=>{let C=n.formats[T];if(!(!C||R<0||P<0||!S(T,R,P)))return`${U.game.base}/tiles/${encodeURIComponent(n.tiles)}/${T}/${R}/${P}.${C}`}})),u=n.fullZoom??n.maxZoom,f=c(u,(w,S,T)=>g4(n,w,S,T)),p=U.layers.raster.getSource();U.layers.raster.setSource(f),U.layers.raster.setExtent(Yh()),U.layers.raster.setBackground(n.background||void 0),p?.clear();let x=U.layers.rasterDetail.getSource();n.maxZoom>u?(U.layers.rasterDetail.setSource(c(n.maxZoom,(w,S,T)=>w>u&&g4(n,w,S,T))),U.layers.rasterDetail.setExtent(Yh()),U.layers.rasterDetail.setVisible(!0)):U.layers.rasterDetail.setVisible(!1),x?.clear(),rS(),U.gridEnabled&&(Tu(),U.layers.pins.changed(),U.layers.text.changed(),U.layers.priority.changed()),U.overviewKey="",are();let v=e&&U.restore?.map===U.map.slug?U.restore:null;if(U.renderedShard!==(n.shard||0)&&(qI(),$l()),v?.center&&Number.isFinite(v.zoom)){let w=U.engine.getView();w.setCenter(v.center),w.setZoom(v.zoom),U.fitZoom=v.zoom,sA()}else e?requestAnimationFrame(ePe):(r&&U.engine.getView().animate({center:r,duration:200}),sA());Nc()}function g4(i,e,t,n){let r=i.coverage?.[e];if(!r)return!0;let s=t-r.x,o=n-r.y;if(s<0||o<0||s>=r.w||o>=r.h)return!1;let a=Q4e(i,e,r),l=o*r.w+s;return(a[l>>3]&1<<(l&7))!==0}function Q4e(i,e,t){if(!t.decoded){let n=atob(t.bits),r=new Uint8Array(n.length);for(let s=0;s<n.length;s++)r[s]=n.charCodeAt(s);t.decoded=r}return t.decoded}function Eu(i){return i.maxZoom+2}function ax(){sA(),Nc()}function J4e(i,e){if(!i||!e||!i.shard||!e.shard||i.shard===e.shard||!i.bounds||!e.bounds)return null;let n=U.engine?.getView()?.getCenter();if(!n)return null;let r=(n[0]-i.bounds.x)/i.bounds.width,s=(-n[1]-i.bounds.y)/i.bounds.height;return[e.bounds.x+Xr(r,0,1)*e.bounds.width,-(e.bounds.y+Xr(s,0,1)*e.bounds.height)]}function cre(){let e=document.querySelector(".app-shell").classList.toggle("sidebar-collapsed");ye.mobileLegend.setAttribute("aria-expanded",String(!e)),requestAnimationFrame(()=>U.engine?.updateSize())}function Yh(){let i=U.game.tileGrid.size,e=U.variant?.bounds||{x:0,y:0,width:i,height:i};return[e.x,-(e.y+e.height),e.x+e.width,-e.y]}function ePe(){if(!U.engine||!U.variant)return;let i=U.engine.getView();i.fit(Yh(),{size:U.engine.getSize(),padding:[36,36,36,36],maxZoom:U.variant.maxZoom,duration:0}),U.fitZoom=i.getZoom()||0,sA()}function Kb(i){let e=U.engine.getView(),t=e.getZoom()||0;e.animate({zoom:Xr(t+i,U.variant.minZoom,Eu(U.variant)),duration:140})}function sA(){let i=U.engine?.getView().getZoom();if(ye.viewport.dataset.zoom=Number.isFinite(i)?i.toFixed(3):"",!U.engine||!U.pins.length){ye.visibleCount.textContent="0 locations visible";return}let e=U.engine.getView().calculateExtent(U.engine.getSize()),t=0;for(let n of U.pins){if(Zl(n))continue;let[r,s]=n.coordinate;r>=e[0]&&r<=e[2]&&s>=e[1]&&s<=e[3]&&t++}ye.visibleCount.textContent=`${Fc(U.eligibleLocations)} enabled \xB7 ${Fc(t)} in view`}function ure(){ye.game.addEventListener("change",()=>{df(ye.game.value)}),ye.map.addEventListener("change",()=>{h9(ye.map.value)}),ye.addBundles.addEventListener("click",()=>{YI()}),ye.emptyOpen.addEventListener("click",()=>{YI()}),ye.variant.addEventListener("change",()=>{f9(Number(ye.variant.value)),ore()}),ye.globeToggle.addEventListener("click",()=>p4()),ye.legend.addEventListener("change",n=>{let r=n.target;if(r.dataset.sectionToggle){ZV(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),$l(),Md()});let i=null,e=()=>{for(let s of ye.layers.querySelectorAll(".is-hovered"))s.classList.remove("is-hovered");if(!i)return;let r=document.elementFromPoint(i.x,i.y)?.closest(".category-row, .layer-header");r&&ye.layers.contains(r)&&r.classList.add("is-hovered")};ye.layers.addEventListener("pointermove",n=>{i={x:n.clientX,y:n.clientY},e()},{passive:!0}),ye.layers.addEventListener("pointerleave",()=>{i=null,e()}),ye.layers.addEventListener("scroll",e,{passive:!0}),ye.layers.addEventListener("click",n=>{let r=n.target.closest("[data-only-category], [data-only-section]");if(r){n.preventDefault(),n.stopPropagation(),QV(r.dataset.onlyCategory?{category:Number(r.dataset.onlyCategory)}:{section:r.dataset.onlySection});return}let s=n.target.closest("[data-section]");if(!s)return;let o=s.dataset.section;U.collapsedSections.has(o)?U.collapsedSections.delete(o):U.collapsedSections.add(o),yS()}),ye.soloChip.addEventListener("click",()=>Yx(!0)),nn("#expand-all").addEventListener("click",()=>XI(!1)),nn("#collapse-all").addEventListener("click",()=>XI(!0)),nn("#show-all").addEventListener("click",()=>Yx(!0)),nn("#hide-all").addEventListener("click",()=>Yx(!1)),ye.zoneToggle.addEventListener("change",()=>{_S(ye.zoneToggle.checked)}),ye.zoneIndex.addEventListener("click",n=>{let r=n.target.closest("[data-zone]");r&&HV(Number(r.dataset.zone))}),ye.zoneIndex.addEventListener("contextmenu",n=>{let r=n.target.closest("[data-zone]");r&&(n.preventDefault(),WV(Number(r.dataset.zone)))}),ye.search.addEventListener("input",()=>{U.search=ye.search.value.trim().toLocaleLowerCase(),$l(),U.search&&Kw()}),ye.dockFold.addEventListener("click",()=>{tI(!U.dockFolded)}),ye.searchResults.addEventListener("click",n=>{let r=n.target.closest("[data-location]");if(!r)return;let s=U.pinByID.get(Number(r.dataset.location));s&&nI(s)}),ye.detailLinks.addEventListener("click",n=>{let r=n.target.closest("[data-location]");if(!r)return;let s=U.pinByID.get(Number(r.dataset.location));s&&nI(s)}),nn("#close-detail").addEventListener("click",Oc),nn("#zoom-in").addEventListener("click",()=>U.globeActive?o9(1):Kb(1)),nn("#zoom-out").addEventListener("click",()=>U.globeActive?o9(-1):Kb(-1)),ye.gridBack.addEventListener("click",gI),ye.gridInput.addEventListener("input",()=>{let n=uo(),r=n.normalizeInput(ye.gridInput.value);ye.gridInput.value=r,n.parseInput(r)!==null&&tA(r)}),ye.subgridToggle.addEventListener("click",()=>{Ux(!U.subgridVisible),ye.viewport.focus({preventScroll:!0})}),ye.gridInput.addEventListener("keydown",n=>{if(n.key===" "){n.preventDefault(),Ux(!U.subgridVisible);return}if(n.key==="`"){n.preventDefault(),ye.globeToggle.hidden||p4();return}n.key==="Escape"&&(n.preventDefault(),n.stopPropagation(),ye.viewport.focus({preventScroll:!0}))}),ye.viewport.addEventListener("keydown",n=>{if(!Yw(n.target)){if(n.key==="+"||n.key==="=")Kb(1);else if(n.key==="-")Kb(-1);else if(n.key==="Escape")Oc();else return;n.preventDefault()}}),window.addEventListener("contextmenu",n=>{Yw(n.target)||n.preventDefault()}),window.addEventListener("keydown",n=>{if((n.metaKey||n.ctrlKey)&&n.key.toLocaleLowerCase()==="r"){n.preventDefault(),location.reload();return}if(!Yw(n.target)){if(n.key==="`"&&!n.metaKey&&!n.ctrlKey&&!n.altKey){ye.globeToggle.hidden||(n.preventDefault(),p4());return}if((n.metaKey||n.ctrlKey)&&n.key.toLocaleLowerCase()==="k"){n.preventDefault(),ye.search.focus(),ye.search.select();return}if((n.metaKey||n.ctrlKey)&&n.altKey&&n.code==="KeyB"){n.preventDefault(),ye.dock.hidden||tI(!U.dockFolded);return}if((n.metaKey||n.ctrlKey)&&n.key.toLocaleLowerCase()==="b"){n.preventDefault(),cre();return}iV(n)||n.key.toLocaleLowerCase()==="z"&&(n.preventDefault(),n.repeat||xS(!0))}}),window.addEventListener("keyup",n=>{n.key.toLocaleLowerCase()==="z"&&xS(!1)}),window.addEventListener("blur",()=>xS(!1)),window.addEventListener("hashchange",()=>{let n=Pg();n.game===U.game?.slug&&n.map===U.map?.slug||(U.restore=null,df(n.game||U.catalog.games[0].slug,n.map))}),window.addEventListener("resize",()=>{U.engine?.updateSize(),ox(),l9()}),document.addEventListener("atlas:globe-camera",()=>ox()),ye.overview.addEventListener("pointerdown",n=>{U.overviewDocked||n.pointerType==="mouse"&&n.button!==0||(n.preventDefault(),ye.overview.setPointerCapture(n.pointerId),U.overviewPointer=n.pointerId,c9(n,!0))}),ye.overview.addEventListener("pointermove",n=>{U.overviewPointer===n.pointerId&&(n.preventDefault(),c9(n,!1))});let t=n=>{U.overviewPointer===n.pointerId&&(U.overviewPointer=null,ax())};ye.overview.addEventListener("pointerup",t),ye.overview.addEventListener("pointercancel",t),ye.overviewDock.addEventListener("click",()=>{m4(!U.overviewDocked),ye.viewport.focus({preventScroll:!0})}),ye.mobileLegend.addEventListener("click",()=>{let n=ye.sidebar.classList.toggle("is-open");ye.mobileLegend.setAttribute("aria-expanded",String(n))})}function hre(){let i=()=>({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?Eu(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:!ye.detail.hidden,detailTitle:ye.detail.hidden?null:ye.detailTitle.textContent||null,searchQuery:U.search,searchResultsVisible:!ye.searchResults.hidden,soloChip:ye.soloChip.hidden?null:ye.soloChip.textContent,visibleCountText:ye.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(e=>U.zoneRecords.get(e)?.zone.title).filter(Boolean),focusedPins:U.pins.filter(e=>!e.filteredHidden&&e.insideHighlightedZone).length},grid:{enabled:U.gridEnabled,prefix:U.gridCell,maximumDepth:oV(),extent:U.gridEnabled?_I():null,cells:[...U.sources.grid.getFeatures(),...U.sources.gridContext.getFeatures()].map(e=>e.get("gridCell")),priorityPins:U.gridCell?U.pins.filter(e=>!e.filteredHidden&&Rd(e)).length:0}});window.__atlasDebug={snapshot:i,setLayerVisible:(e,t)=>U.layers[e]?.setVisible(t),refreshCatalog:oA},window.render_game_to_text=()=>JSON.stringify({coordinateSystem:"ATLAS:PIXELS; origin top-left; x increases right; y decreases downward",...i()}),window.advanceTime=()=>U.engine?.renderSync()}async function fre(){ure();try{let i=await fetch("/data/catalog.json");if(!i.ok)throw new Error(`catalog request returned ${i.status}`);if(U.catalog=await i.json(),B0(ye.game,U.catalog.games,"title"),$I(),window.runtime?.EventsOn?.("atlas:catalog-changed",()=>{oA()}),U.catalog.games.length){let e=Pg(),t=Rg(),n=t&&(!e.game||e.game===t.game&&e.map===t.map);U.restore=n?t:null,await df(e.game||t?.game||U.catalog.games[0].slug,e.map||t?.map),U.restore=null}else ye.loading.hidden=!0;hre(),requestAnimationFrame(()=>ye.viewport.focus({preventScroll:!0}))}catch(i){ye.loading.hidden=!0,ye.fatalMessage.textContent=i instanceof Error?i.message:String(i),ye.fatal.hidden=!1}}fre();})();5289+In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function kie(i,e){var t=Object.keys(i);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(i);e&&(n=n.filter(function(r){return Object.getOwnPropertyDescriptor(i,r).enumerable})),t.push.apply(t,n)}return t}function rg(i){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?kie(Object(t),!0).forEach(function(n){Wb(i,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(t)):kie(Object(t)).forEach(function(n){Object.defineProperty(i,n,Object.getOwnPropertyDescriptor(t,n))})}return i}function b4e(i,e){if(i==null)return{};var t,n,r=w4e(i,e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(i);for(n=0;n<s.length;n++)t=s[n],e.indexOf(t)===-1&&{}.propertyIsEnumerable.call(i,t)&&(r[t]=i[t])}return r}function w4e(i,e){if(i==null)return{};var t={};for(var n in i)if({}.hasOwnProperty.call(i,n)){if(e.indexOf(n)!==-1)continue;t[n]=i[n]}return t}function l4(i){return x4e(i)||y4e(i)||E4e(i)||v4e()}function S4e(i,e){if(typeof i!="object"||!i)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var n=t.call(i,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(i)}function T4e(i){var e=S4e(i,"string");return typeof e=="symbol"?e:e+""}function E4e(i,e){if(i){if(typeof i=="string")return t9(i,e);var t={}.toString.call(i).slice(8,-1);return t==="Object"&&i.constructor&&(t=i.constructor.name),t==="Map"||t==="Set"?Array.from(i):t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?t9(i,e):void 0}}function Gie(i,e){var t=new e;return t._destructor&&t._destructor(),{linkProp:function(r){return{default:t[r](),onChange:function(o,a){a[i][r](o)},triggerUpdate:!1}},linkMethod:function(r){return function(s){for(var o=s[i],a=arguments.length,l=new Array(a>1?a-1:0),c=1;c<a;c++)l[c-1]=arguments[c];var u=o[r].apply(o,l);return u===o?this:u}}}}var M4e=["rendererConfig","waitForGlobeReady"],Hb=rg(rg({},window.THREE?window.THREE:{AmbientLight:UA,DirectionalLight:BA,Vector2:Oe,REVISION:"185"}),{},{CSS2DRenderer:b3}),zie=Gie("globe",bk),C4e=Object.assign.apply(Object,l4(["globeImageUrl","bumpImageUrl","globeTileEngineUrl","globeTileEngineMaxLevel","globeCurvatureResolution","showGlobe","showGraticules","showAtmosphere","atmosphereColor","atmosphereAltitude","onGlobeReady","pointsData","pointLat","pointLng","pointColor","pointAltitude","pointRadius","pointResolution","pointsMerge","pointsTransitionDuration","arcsData","arcStartLat","arcStartLng","arcStartAltitude","arcEndLat","arcEndLng","arcEndAltitude","arcColor","arcAltitude","arcAltitudeAutoScale","arcStroke","arcCurveResolution","arcCircularResolution","arcDashLength","arcDashGap","arcDashInitialGap","arcDashAnimateTime","arcsTransitionDuration","polygonsData","polygonGeoJsonGeometry","polygonCapColor","polygonCapMaterial","polygonSideColor","polygonSideMaterial","polygonStrokeColor","polygonAltitude","polygonCapCurvatureResolution","polygonsTransitionDuration","pathsData","pathPoints","pathPointLat","pathPointLng","pathPointAlt","pathResolution","pathColor","pathStroke","pathDashLength","pathDashGap","pathDashInitialGap","pathDashAnimateTime","pathTransitionDuration","heatmapsData","heatmapPoints","heatmapPointLat","heatmapPointLng","heatmapPointWeight","heatmapBandwidth","heatmapColorFn","heatmapColorSaturation","heatmapBaseAltitude","heatmapTopAltitude","heatmapsTransitionDuration","hexBinPointsData","hexBinPointLat","hexBinPointLng","hexBinPointWeight","hexBinResolution","hexMargin","hexTopCurvatureResolution","hexTopColor","hexSideColor","hexAltitude","hexBinMerge","hexTransitionDuration","hexPolygonsData","hexPolygonGeoJsonGeometry","hexPolygonColor","hexPolygonAltitude","hexPolygonResolution","hexPolygonMargin","hexPolygonUseDots","hexPolygonCurvatureResolution","hexPolygonDotResolution","hexPolygonsTransitionDuration","tilesData","tileLat","tileLng","tileAltitude","tileWidth","tileHeight","tileUseGlobeProjection","tileMaterial","tileCurvatureResolution","tilesTransitionDuration","particlesData","particlesList","particleLat","particleLng","particleAltitude","particlesSize","particlesSizeAttenuation","particlesColor","particlesTexture","ringsData","ringLat","ringLng","ringAltitude","ringColor","ringResolution","ringMaxRadius","ringPropagationSpeed","ringRepeatPeriod","labelsData","labelLat","labelLng","labelAltitude","labelRotation","labelText","labelSize","labelTypeFace","labelColor","labelResolution","labelIncludeDot","labelDotRadius","labelDotOrientation","labelsTransitionDuration","htmlElementsData","htmlLat","htmlLng","htmlAltitude","htmlElement","htmlElementVisibilityModifier","htmlTransitionDuration","objectsData","objectLat","objectLng","objectAltitude","objectRotation","objectFacesSurface","objectThreeObject","customLayerData","customThreeObject","customThreeObjectUpdate"].map(function(i){return Wb({},i,zie.linkProp(i))}))),R4e=Object.assign.apply(Object,l4(["globeMaterial","globeTileEngineClearCache","getGlobeRadius","getCoords","toGeoCoords"].map(function(i){return Wb({},i,zie.linkMethod(i))}))),Vie=Gie("renderObjs",e9),P4e=Object.assign.apply(Object,l4(["width","height","backgroundColor","backgroundImageUrl","enablePointerInteraction"].map(function(i){return Wb({},i,Vie.linkProp(i))}))),I4e=Object.assign.apply(Object,l4(["lights","postProcessingComposer"].map(function(i){return Wb({},i,Vie.linkMethod(i))}))),qie=Or({props:rg(rg({onZoom:{triggerUpdate:!1},onGlobeClick:{triggerUpdate:!1},onGlobeRightClick:{triggerUpdate:!1},pointLabel:{default:"name",triggerUpdate:!1},onPointClick:{triggerUpdate:!1},onPointRightClick:{triggerUpdate:!1},onPointHover:{triggerUpdate:!1},arcLabel:{default:"name",triggerUpdate:!1},onArcClick:{triggerUpdate:!1},onArcRightClick:{triggerUpdate:!1},onArcHover:{triggerUpdate:!1},polygonLabel:{default:"name",triggerUpdate:!1},onPolygonClick:{triggerUpdate:!1},onPolygonRightClick:{triggerUpdate:!1},onPolygonHover:{triggerUpdate:!1},pathLabel:{default:"name",triggerUpdate:!1},onPathClick:{triggerUpdate:!1},onPathRightClick:{triggerUpdate:!1},onPathHover:{triggerUpdate:!1},onHeatmapClick:{triggerUpdate:!1},onHeatmapRightClick:{triggerUpdate:!1},onHeatmapHover:{triggerUpdate:!1},hexLabel:{triggerUpdate:!1},onHexClick:{triggerUpdate:!1},onHexRightClick:{triggerUpdate:!1},onHexHover:{triggerUpdate:!1},hexPolygonLabel:{triggerUpdate:!1},onHexPolygonClick:{triggerUpdate:!1},onHexPolygonRightClick:{triggerUpdate:!1},onHexPolygonHover:{triggerUpdate:!1},tileLabel:{default:"name",triggerUpdate:!1},onTileClick:{triggerUpdate:!1},onTileRightClick:{triggerUpdate:!1},onTileHover:{triggerUpdate:!1},particleLabel:{default:"name",triggerUpdate:!1},onParticleClick:{triggerUpdate:!1},onParticleRightClick:{triggerUpdate:!1},onParticleHover:{triggerUpdate:!1},labelLabel:{triggerUpdate:!1},onLabelClick:{triggerUpdate:!1},onLabelRightClick:{triggerUpdate:!1},onLabelHover:{triggerUpdate:!1},objectLabel:{default:"name",triggerUpdate:!1},onObjectClick:{triggerUpdate:!1},onObjectRightClick:{triggerUpdate:!1},onObjectHover:{triggerUpdate:!1},customLayerLabel:{default:"name",triggerUpdate:!1},onCustomLayerClick:{triggerUpdate:!1},onCustomLayerRightClick:{triggerUpdate:!1},onCustomLayerHover:{triggerUpdate:!1},pointerEventsFilter:{default:function(){return!0},triggerUpdate:!1},lineHoverPrecision:{default:.2,triggerUpdate:!1,onChange:function(e,t){t.renderObjs.lineHoverPrecision(e),t.renderObjs.pointsHoverPrecision(e)}},showPointerCursor:{default:!0,triggerUpdate:!1},globeOffset:{default:[0,0],triggerUpdate:!1,onChange:function(e,t){return Array.isArray(e)&&e.length===2&&t.renderObjs.viewOffset(e.map(function(n){return-n}))}}},C4e),P4e),methods:rg(rg({pauseAnimation:function(e){var t;return e.animationFrameRequestId!==null&&(cancelAnimationFrame(e.animationFrameRequestId),e.animationFrameRequestId=null),(t=e.globe)===null||t===void 0||t.pauseAnimation(),this},resumeAnimation:function(e){var t;return e.animationFrameRequestId===null&&this._animationCycle(),(t=e.globe)===null||t===void 0||t.resumeAnimation(),this},_animationCycle:function(e){e.renderObjs.tick(),e.tweenGroup.update(),e.animationFrameRequestId=requestAnimationFrame(this._animationCycle)},pointOfView:function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,r=a();if(t.lat===void 0&&t.lng===void 0&&t.altitude===void 0)return r;var s,o=Object.assign({},r,t);if(["lat","lng","altitude"].forEach(function(c){return o[c]=+o[c]}),(s=e.povTween)===null||s===void 0||s.end(),!n)l(o);else{for(;r.lng-o.lng>180;)r.lng-=360;for(;r.lng-o.lng<-180;)r.lng+=360;e.tweenGroup.add(e.povTween=new Ws(r).to(o,n).easing(Br.Cubic.InOut).onUpdate(l).onComplete(function(){e.povTween=void 0,e.tweenGroup.remove(this)}).start())}return this;function a(){return e.globe.toGeoCoords(e.renderObjs.cameraPosition())}function l(c){var u=c.lat,f=c.lng,p=c.altitude;e.renderObjs.cameraPosition(e.globe.getCoords(u,f,p)),e.globe.setPointOfView(e.renderObjs.camera())}},getScreenCoords:function(e){for(var t,n=arguments.length,r=new Array(n>1?n-1:0),s=1;s<n;s++)r[s-1]=arguments[s];var o=(t=e.globe).getCoords.apply(t,r);return e.renderObjs.getScreenCoords(o.x,o.y,o.z)},toGlobeCoords:function(e,t,n){var r=e.renderObjs.intersectingObjects(t,n).find(function(l){return(l.object.__globeObjType||l.object.parent.__globeObjType)==="globe"});if(!r)return null;var s=e.globe.toGeoCoords(r.point),o=s.lat,a=s.lng;return{lat:o,lng:a}},scene:function(e){return e.renderObjs.scene()},camera:function(e){return e.renderObjs.camera()},renderer:function(e){return e.renderObjs.renderer()},controls:function(e){return e.renderObjs.controls()},_destructor:function(e){this.pauseAnimation(),this.pointsData([]),this.arcsData([]),this.polygonsData([]),this.pathsData([]),this.heatmapsData([]),this.hexBinPointsData([]),this.hexPolygonsData([]),this.tilesData([]),this.particlesData([]),this.labelsData([]),this.htmlElementsData([]),this.objectsData([]),this.customLayerData([]),e.globe._destructor(),e.renderObjs._destructor()}},R4e),I4e),stateInit:function(e){var t=e.rendererConfig,n=e.waitForGlobeReady,r=n===void 0?!0:n,s=b4e(e,M4e),o=new bk(rg({waitForGlobeReady:r},s));return{globe:o,renderObjs:e9({controlType:"orbit",rendererConfig:t,waitForLoadComplete:r,extraRenderers:[new Hb.CSS2DRenderer]}).skyRadius(o.getGlobeRadius()*500).showNavInfo(!1).objects([o]).lights([new Hb.AmbientLight(13421772,Math.PI),new Hb.DirectionalLight(16777215,.6*Math.PI)]),tweenGroup:new tm}},init:function(e,t){var n=this;e.innerHTML="",e.appendChild(t.container=document.createElement("div")),t.container.style.position="relative";var r=document.createElement("div");t.container.appendChild(r),t.renderObjs(r),t.globe.rendererSize(t.renderObjs.renderer().getSize(new Hb.Vector2)),this.pointOfView({altitude:2.5});var s=t.globe.getGlobeRadius(),o=t.renderObjs.controls();t.renderObjs.camera().near=.05,o.minDistance=s+Math.max(.001,t.renderObjs.camera().near*1.1),o.maxDistance=s*100,o.enablePan=!1,o.enableDamping=!0,o.dampingFactor=.1,o.rotateSpeed=.3,o.zoomSpeed=.3,o.zoomToCursor=!0,o.addEventListener("change",function(){o.target.setScalar(0);var c=n.pointOfView();o.rotateSpeed=c.altitude*.3,o.zoomSpeed=Math.sqrt(c.altitude)*.5,t.globe.setPointOfView(t.renderObjs.camera()),t.onZoom&&t.onZoom(c)});var a=function(u){for(var f=u;f&&!f.hasOwnProperty("__globeObjType");)f=f.parent;return f},l={point:function(u){return u},arc:function(u){return u},polygon:function(u){return u.data},path:function(u){return u},heatmap:function(u){return u},hexbin:function(u){return u},hexPolygon:function(u){return u},tile:function(u){return u},particles:function(u,f){return!f||!f.hasOwnProperty("index")||u.length<=f.index?u:u[f.index]},label:function(u){return u},object:function(u){return u},custom:function(u){return u}};Hb.REVISION<155&&(t.renderObjs.renderer().useLegacyLights=!1),t.renderObjs.hoverFilter(function(c){var u=a(c);if(!u)return!1;var f=u.__globeObjType;if(f!=="globe"&&!l.hasOwnProperty(f))return!1;var p=l.hasOwnProperty(f)&&u.__data?l[f](u.__data):null;return["points","hexBinPoints"].some(function(x){return x===f})&&Array.isArray(p)?!1:t.pointerEventsFilter(u,p)}).tooltipContent(function(c,u){var f={point:t.pointLabel,arc:t.arcLabel,polygon:t.polygonLabel,path:t.pathLabel,hexbin:t.hexLabel,hexPolygon:t.hexPolygonLabel,tile:t.tileLabel,particles:t.particleLabel,label:t.labelLabel,object:t.objectLabel,custom:t.customLayerLabel},p=a(c),x=p&&p.__globeObjType;return p&&x&&f.hasOwnProperty(x)&&l.hasOwnProperty(x)&&rt(f[x])(l[x](p.__data,u))||""}).onHover(function(c,u,f){var p={point:t.onPointHover,arc:t.onArcHover,polygon:t.onPolygonHover,path:t.onPathHover,heatmap:t.onHeatmapHover,hexbin:t.onHexHover,hexPolygon:t.onHexPolygonHover,tile:t.onTileHover,particles:t.onParticleHover,label:t.onLabelHover,object:t.onObjectHover,custom:t.onCustomLayerHover},x={globe:t.onGlobeClick,point:t.onPointClick,arc:t.onArcClick,polygon:t.onPolygonClick,path:t.onPathClick,heatmap:t.onHeatmapClick,hexbin:t.onHexClick,hexPolygon:t.onHexPolygonClick,tile:t.onTileClick,particles:t.onParticleClick,label:t.onLabelClick,object:t.onObjectClick,custom:t.onCustomLayerClick},v=a(c);if(v&&!p.hasOwnProperty(v.__globeObjType)&&(v=null),v!==t.hoverObj){var w,S=t.hoverObj?t.hoverObj.__globeObjType:null,T=t.hoverData,R=v?v.__globeObjType:null,P=(w=v)!==null&&w!==void 0&&w.__data?l[R](v.__data,f):null;S&&S!==R&&p[S]&&p[S](null,T||null),R&&p[R]&&p[R](P,S===R?T:null),t.renderObjs.renderer().domElement.classList[R&&x[R]&&rt(t.showPointerCursor)(R,P)?"add":"remove"]("clickable"),t.hoverObj=v,t.hoverData=P}}).onClick(function(c,u,f){if(c){var p={globe:t.onGlobeClick,point:t.onPointClick,arc:t.onArcClick,polygon:t.onPolygonClick,path:t.onPathClick,heatmap:t.onHeatmapClick,hexbin:t.onHexClick,hexPolygon:t.onHexPolygonClick,tile:t.onTileClick,particles:t.onParticleClick,label:t.onLabelClick,object:t.onObjectClick,custom:t.onCustomLayerClick},x=a(c),v=x.__globeObjType;if(x&&p.hasOwnProperty(v)&&p[v]){var w=[u],S=f!=null&&f.isVector3?f:f?.point;if(v==="globe"){var T=n.toGeoCoords(S),R=T.lat,P=T.lng;w.unshift({lat:R,lng:P})}else w.push(n.toGeoCoords(S));l.hasOwnProperty(v)&&w.unshift(l[v](x.__data,f)),p[v].apply(p,w)}}}).onRightClick(function(c,u,f){if(c){var p={globe:t.onGlobeRightClick,point:t.onPointRightClick,arc:t.onArcRightClick,polygon:t.onPolygonRightClick,path:t.onPathRightClick,heatmap:t.onHeatmapRightClick,hexbin:t.onHexRightClick,hexPolygon:t.onHexPolygonRightClick,tile:t.onTileRightClick,particles:t.onParticleRightClick,label:t.onLabelRightClick,object:t.onObjectRightClick,custom:t.onCustomLayerRightClick},x=a(c),v=x.__globeObjType;if(x&&p.hasOwnProperty(v)&&p[v]){var w=[u],S=f!=null&&f.isVector3?f:f?.point;if(v==="globe"){var T=n.toGeoCoords(S),R=T.lat,P=T.lng;w.unshift({lat:R,lng:P})}else w.push(n.toGeoCoords(S));l.hasOwnProperty(v)&&w.unshift(l[v](x.__data,f)),p[v].apply(p,w)}}}),this._animationCycle()}});var jie=4,Xb=100,Yb=Xb+.2,cd=8,N4e=96,Xie=.045,$ie=.08;function ix(i,e,t){let n=(90-i)*Math.PI/180,r=(90-e)*Math.PI/180;return[t*Math.sin(n)*Math.cos(r),t*Math.cos(n),t*Math.sin(n)*Math.sin(r)]}var $n=null,u4="",gs={group:null,tiles:new Map,key:"",lens:""},Do={group:null,cell:null,fitKey:""},Au={group:null,key:""},L4e=180,i9=null,rx=new Map,d4=new Map,Hie=new Map;function Yie(){let i=aV(U.world)==="sphere"&&lf(U.world)!==null;ye.globeToggle.hidden=!i,Kie(),!i&&$n&&(jb(),gs.group=null,Do.group=null,Do.cell=null,Au.group=null,Au.key="",$n._destructor(),$n=null,u4="",i9=null,ye.globe.replaceChildren())}function p4(){U.globeActive?Kie():Jie()}var $b=2.5,h4=2,sx=.08,A4=4;function D4e(i){let e=Number.isFinite(i)?i:h4;return Xr($b/2**(e-h4),sx,A4)}function s9(i){let e=Number.isFinite(i)?Math.max(i,sx/2):$b,t=(U.lens?.maxZoom??h4)+2;return Xr(h4+Math.log2($b/e),0,t)}function o9(i){if(!$n||!U.globeActive)return;let e=$n.pointOfView(),t=Xr((Number.isFinite(e.altitude)?e.altitude:$b)/2**i,sx,A4);$n.pointOfView({altitude:t},180)}function Kie(){let i=lf(U.world),e=U.engine?.getView();if($n&&U.globeActive&&i&&e){let t=$n.pointOfView(),[n,r]=i.toWorld(t.lat,t.lng);Number.isFinite(n)&&Number.isFinite(r)&&(e.cancelAnimations(),e.setCenter([n,-r]),e.setZoom(s9(t.altitude)))}U.globeActive=!1,ye.globe.hidden=!0,ye.globeToggle.setAttribute("aria-pressed","false"),ye.viewport.hidden=!1,jb(),U.overviewKey="",document.dispatchEvent(new Event("atlas:globe-camera"))}function Zie(){if(!$n||!U.globeActive)return null;let i=$n.pointOfView();return{lat:i.lat,lng:i.lng}}function Qie(i,e,t){if(!$n)return;let n=$n.pointOfView().altitude;$n.pointOfView({lat:i,lng:e,altitude:n},t?180:0)}async function Jie(){let i=lf(U.world);if(!i)return;if(U.globeActive=!0,ye.viewport.hidden=!0,ye.globe.hidden=!1,ye.globeToggle.setAttribute("aria-pressed","true"),U.overviewKey="",!$n){$n=qie({animateIn:!1})(ye.globe).backgroundColor("#0b0e12").showAtmosphere(!0).atmosphereColor("#8a6f5b").atmosphereAltitude(.12).objectLat(o=>o.lat).objectLng(o=>o.lng).objectAltitude(o=>o.pin===U.selectedPin?.03:.014).objectThreeObject(o=>j4e(o.pin)).objectLabel(o=>o.pin.location.title).onObjectClick(o=>Nx(o.pin)).onObjectHover(o=>{ye.globe.style.cursor=o?"pointer":""}).onZoom(()=>{document.dispatchEvent(new Event("atlas:globe-camera")),Wie(),c4(),X4e()}),document.addEventListener("atlas:selection",W4e),document.addEventListener("atlas:filters",n9),document.addEventListener("atlas:grid",()=>{f4(),n9(),c4()}),document.addEventListener("atlas:labels",c4),$n.onGlobeClick(({lat:o,lng:a})=>{if(!U.gridEnabled)return;let l=lf(U.world);if(!l)return;let[c,u]=l.toWorld(o,a),f=uo().descendTarget(U.gridCell,[c,-u]);f&&tA(f)});let s=$n.controls();s.minDistance=Xb*(1+sx),s.maxDistance=Xb*(1+A4),gs.group=new br,$n.scene().add(gs.group),Do.group=new br,$n.scene().add(Do.group),Au.group=new br,$n.scene().add(Au.group),window.__atlasGlobe={detail:gs,grid:Do,labels:Au,sprites:rx}}l9();let e=U.engine?.getView(),t=e?.getCenter();if(t&&Number.isFinite(t[0])&&Number.isFinite(t[1])){let[s,o]=i.toLatLng(t[0],-t[1]);$n.pointOfView({lat:s,lng:o,altitude:D4e(e.getZoom())})}else $n.pointOfView({lat:10,lng:0,altitude:$b});let n=U.lens||U.world.lenses[0],r=`${U.volume.stamp}:${U.world.slug}:${n.tiles}`;if(u4!==r){u4=r;let s=await Y4e(n);s&&u4===r&&$n.globeImageUrl(s)}i9!==U.pins&&(i9=U.pins,rx.clear(),d4.clear(),$n.objectsData($4e(i))),n9(),ire(),Wie(),f4(),c4(),document.dispatchEvent(new Event("atlas:globe-camera"))}function f4(){if(!$n||!Do.group)return;for(let t of[...Do.group.children])Do.group.remove(t),t.geometry?.dispose(),t.material?.map?.dispose(),t.material?.dispose();let i=U.globeActive?lf(U.world):null;if(!i||!U.gridEnabled){Do.cell=null;return}let e=uo();for(let t of oS()){let n=ere(t.ring,i),r=a9(n),s=sS(t,{subgridVisible:U.subgridVisible,labelled:B4e(t,r)});if(s){if(s.fill){let o=tre(e.center(t.hash),i);Do.group.add(U4e(n,o,s.fill))}Do.group.add(z4e(n,s.line)),s.label&&Do.group.add(V4e(s.label,r))}}Do.cell!==null&&Do.cell!==U.gridCell&&q4e(i),Do.cell=U.gridCell}function ere(i,e){return i.map(([t,n])=>e.toLatLng(t,-n))}function tre(i,e){return e.toLatLng(i[0],-i[1])}function F4e(i){let e=[];for(let t=0;t<i.length-1;t++){let[n,r]=i[t],[s,o]=i[t+1],a=Math.max(Math.abs(s-n),Math.abs(o-r)),l=Xr(Math.ceil(a/2),1,48);for(let c=0;c<l;c++){let u=c/l;e.push([n+(s-n)*u,r+(o-r)*u])}}return e}function a9(i){let e=-1/0,t=1/0,n=1/0,r=-1/0;for(let[s,o]of i)e=Math.max(e,s),t=Math.min(t,s),n=Math.min(n,o),r=Math.max(r,o);return{north:e,south:t,west:n,east:r}}function O4e(i){let e=$n.pointOfView(),t=Math.max(e.altitude,sx/2),n=50*Math.PI/180,r=2*t*Xb*Math.tan(n/2)/Math.max(1,ye.globe.clientHeight||1),s=Xb*Math.PI/180/r;return{width:Math.abs(i.east-i.west)*s,height:Math.abs(i.north-i.south)*s}}function B4e(i,e){let n=i.role==="neighbor"?Li.neighborLabelSizePx:Li.labelSizePx,r=`900 ${n}px ${Li.labelFont}`,s=O4e(e);return VI(i.hash,r)+9<=s.width&&n+6<=s.height}function U4e(i,e,t){let n=Yb+.12,r=F4e(i),s=a9(i),o=Math.max(s.east-s.west,s.north-s.south),a=Xr(Math.ceil(o/6),2,24),l=[...ix(e[0],e[1],n)],c=[];for(let w=1;w<=a;w++)for(let[S,T]of r){let R=w/a;l.push(...ix(e[0]+(S-e[0])*R,e[1]+(T-e[1])*R,n))}let u=r.length,f=(w,S)=>1+(w-1)*u+S%u;for(let w=0;w<u;w++)c.push(0,f(1,w),f(1,w+1));for(let w=1;w<a;w++)for(let S=0;S<u;S++)c.push(f(w,S),f(w+1,S),f(w,S+1)),c.push(f(w,S+1),f(w+1,S),f(w+1,S+1));let p=new qn;p.setAttribute("position",new Rn(l,3)),p.setIndex(c);let x=new Kr({color:t.color,transparent:!0,opacity:t.opacity,depthWrite:!1,side:2}),v=new Gn(p,x);return v.renderOrder=1,v}function c4(){if(!$n||!Au.group)return;let i=U.globeActive&&U.labelsHeld,e=i?$n.pointOfView():null,t=i?`${Math.round(e.lat)}:${Math.round(e.lng)}:${e.altitude.toFixed(2)}:${U.gridCell}`:"";if(t===Au.key)return;Au.key=t;for(let r of[...Au.group.children])Au.group.remove(r),r.material?.map?.dispose(),r.material?.dispose();if(!i)return;let n=[];for(let[r,s]of rx){if(!s.visible)continue;let o=d4.get(r);if(!o)continue;let a=k4e(e,o);a>85||n.push({pin:r,stood:o,distance:a})}n.sort((r,s)=>r.distance-s.distance);for(let{pin:r,stood:s}of n.slice(0,L4e))Au.group.add(G4e(r,s))}function k4e(i,e){let t=Math.PI/180,n=Math.sin(i.lat*t)*Math.sin(e.lat*t)+Math.cos(i.lat*t)*Math.cos(e.lat*t)*Math.cos((i.lng-e.lng)*t);return Math.acos(Xr(n,-1,1))*180/Math.PI}function G4e(i,e){let t=i.location.title,n=document.createElement("canvas"),r=n.getContext("2d"),s="600 26px Inter, system-ui, sans-serif";r.font=s;let o=Math.ceil(r.measureText(t).width)+24;n.width=o,n.height=40,r.font=s,r.textAlign="center",r.textBaseline="middle",r.fillStyle="rgba(10, 13, 17, 0.78)",r.fillRect(0,0,o,40),r.fillStyle="#e6ebf0",r.fillText(t,o/2,21);let a=new Vu({depthWrite:!1,sizeAttenuation:!1,transparent:!0});new Ya().load(n.toDataURL("image/png"),u=>{a.map=u,a.needsUpdate=!0});let l=new CA(a);l.position.set(...ix(e.lat,e.lng,Yb+.4));let c=.028;return l.scale.set(c*o/40,c,1),l.center.set(.5,0),l}function z4e(i,e){let t=[];for(let o=0;o<i.length-1;o++){let[a,l]=i[o],[c,u]=i[o+1],f=Math.max(Math.abs(c-a),Math.abs(u-l)),p=Xr(Math.ceil(f/2),4,48);for(let x=0;x<p;x++){let v=x/p;t.push(...ix(a+(c-a)*v,l+(u-l)*v,Yb+.25))}}t.push(...t.slice(0,3));let n=new x0;n.setPositions(t);let r=new zh({color:e.color,transparent:!0,opacity:e.opacity,linewidth:e.widthPx,depthWrite:!1});r.resolution.set(ye.globe.clientWidth||1,ye.globe.clientHeight||1);let s=new Y1(n,r);return s.computeLineDistances(),s.renderOrder=2,s}function V4e(i,e){let n=i.sizePx*2,r=`500 ${n}px ${Li.labelFont}`,s=`900 ${n}px ${Li.labelFont}`,o=document.createElement("canvas"),a=o.getContext("2d");a.font=r;let l=i.prefix?a.measureText(i.prefix).width:0;a.font=s;let c=a.measureText(i.final).width,u=10;o.width=Math.ceil(l+c+u*2),o.height=n+u*1.4,a.fillStyle=i.chip,a.fillRect(0,0,o.width,o.height),a.textBaseline="middle";let f=o.height/2+2;i.prefix&&(a.font=r,a.fillStyle=i.color,a.globalAlpha=Li.prefixAlpha*i.textAlpha,a.fillText(i.prefix,u,f)),a.font=s,a.globalAlpha=i.textAlpha,a.fillStyle=i.color,a.fillText(i.final,u+l,f),a.globalAlpha=1;let p=new Vu({depthWrite:!1,transparent:!0,sizeAttenuation:!1});new Ya().load(o.toDataURL("image/png"),R=>{p.map=R,p.needsUpdate=!0});let x=new CA(p),v=Math.abs(e.north-e.south)*.02,w=Math.abs(e.east-e.west)*.02;x.position.set(...ix(e.south+v,e.east-w,Yb+.35));let S=Math.max(1,ye.globe.clientHeight||1),T=o.height/2/S;return x.scale.set(T*o.width/o.height,T,1),x.center.set(1,0),x.renderOrder=3,x}function q4e(i){let t=oS().find(l=>l.role==="scope"||l.role==="leaf");if(!t)return;let[n,r]=tre(uo().center(t.hash),i),s=a9(ere(t.ring,i)),o=Math.max(s.east-s.west,s.north-s.south),a=Xr(o/45,sx,A4);$n.pointOfView({lat:n,lng:r,altitude:a},400)}function Wie(){if(!$n||!gs.group)return;let i=U.globeActive?U.lens||U.world.lenses[0]:null;if(!i){jb();return}gs.lens!==i.tiles&&(jb(),gs.lens=i.tiles);let e=$n.pointOfView(),t=Math.min(Math.round(s9(e.altitude))+1,i.maxZoom);if(t<=jie||!i.formats[t]){jb(),gs.key="";return}let n=2**t,r=n/2,s=360/n,o=Math.acos(1/(1+e.altitude))*180/Math.PI+s,a=Math.floor(((e.lng+180)%360+360)%360/s),l=Math.floor((90-e.lat)/s),c=Math.ceil(o/s);for(;(2*c+1)**2>N4e&&c>1;)c--;let u=new Set;for(let p=-c;p<=c;p++){let x=l+p;if(!(x<0||x>=r))for(let v=-c;v<=c;v++){let w=((a+v)%n+n)%n;u.add(`${t}/${w}/${x}`)}}let f=`${i.tiles}:${[...u].sort().join(",")}`;if(f!==gs.key){gs.key=f;for(let[p,x]of gs.tiles)u.has(p)||(gs.group.remove(x),nre(x),gs.tiles.delete(p));for(let p of u){if(gs.tiles.has(p))continue;let[x,v,w]=p.split("/").map(Number),S=H4e(i,x,v,w);gs.tiles.set(p,S),gs.group.add(S)}}}function H4e(i,e,t,n){let r=360/2**e,s=-180+t*r,o=90-n*r,a=[],l=[],c=[];for(let w=0;w<=cd;w++){let S=o-w/cd*r;for(let T=0;T<=cd;T++){let R=s+T/cd*r;a.push(...ix(S,R,Yb)),l.push(T/cd,1-w/cd)}}let u=cd+1;for(let w=0;w<cd;w++)for(let S=0;S<cd;S++){let T=w*u+S;c.push(T,T+u,T+1),c.push(T+1,T+u,T+u+1)}let f=new qn;f.setAttribute("position",new Rn(a,3)),f.setAttribute("uv",new Rn(l,2)),f.setIndex(c);let p=new Kr,x=new Gn(f,p);x.visible=!1;let v=`${U.volume.base}/tiles/${i.tiles}/${e}/${t}/${n}.${i.formats[e]}`;return new Ya().load(v,w=>{w.colorSpace=vr,p.map=w,p.needsUpdate=!0,x.visible=!0}),x}function jb(){if(gs.group){for(let i of gs.tiles.values())gs.group.remove(i),nre(i);gs.tiles.clear(),gs.key=""}}function nre(i){i.geometry.dispose(),i.material.map?.dispose(),i.material.dispose()}function ire(){if($n){for(let[i,e]of rx){let t=i===U.selectedPin;e.material=sre(i.category,t);let n=t?$ie:Xie;e.scale.set(n,n,1)}$n.objectAltitude(i=>i.pin===U.selectedPin?.03:.014)}}function W4e(){if(!$n||!U.globeActive)return;ire();let i=d4.get(U.selectedPin);if(i){let e=$n.pointOfView().altitude;$n.pointOfView({lat:i.lat,lng:i.lng,altitude:e},600)}}function rre(i){return!(i.filteredHidden||U.hiddenCategories.has(i.category.id)||U.gridEnabled&&U.gridCell&&!Rd(i))}function n9(){if(!(!$n||!U.globeActive))for(let[i,e]of rx)e.visible=rre(i)}function j4e(i){let e=new CA(sre(i.category,i===U.selectedPin)),t=i===U.selectedPin?$ie:Xie;return e.scale.set(t,t,1),e.visible=rre(i),rx.set(i,e),e}function sre(i,e){let t=`${Xx(i)}:${e?"ringed":"plain"}`,n=Hie.get(t);if(n)return n;n=new Vu({depthWrite:!1,sizeAttenuation:!1}),Hie.set(t,n);let r=U.markerIcons.get(Xx(i)),s=o=>{let a=document.createElement("canvas");a.width=80,a.height=80;let l=a.getContext("2d");o?l.drawImage(o,8,8,64,64):(l.font="900 26px Inter, system-ui, sans-serif",l.textAlign="center",l.textBaseline="middle",l.lineWidth=6,l.strokeStyle=J0(),l.strokeText(Dc(i.title),40,41),l.fillStyle=eA(i),l.fillText(Dc(i.title),40,41)),e&&(l.beginPath(),l.arc(40,40,36,0,Math.PI*2),l.lineWidth=5,l.strokeStyle="#ffffff",l.stroke()),new Ya().load(a.toDataURL("image/png"),c=>{n.map=c,n.needsUpdate=!0})};if(r){let o=new Image;o.onload=()=>s(o),o.onerror=()=>s(null),o.src=r}else s(null);return n}function ore(){U.globeActive&&Jie()}function l9(){!$n||ye.globe.hidden||($n.width(ye.globe.clientWidth).height(ye.globe.clientHeight),f4())}function X4e(){if(!$n||!U.globeActive||!U.gridEnabled)return;let i=$n.pointOfView(),e=`${U.gridCell}:${Math.round(s9(i.altitude)*2)}`;e!==Do.fitKey&&(Do.fitKey=e,f4())}function $4e(i){let e=[];for(let t of U.pins){let[n,r]=Og(t.location.lat,t.location.lng),[s,o]=i.toLatLng(n,-r);e.push({lat:s,lng:o,pin:t}),d4.set(t,{lat:s,lng:o})}return e}async function Y4e(i){let e=Math.min(jie,i.maxZoom),t=i.formats[e];if(!t)return null;let n=2**e,r=n/2,s=document.createElement("canvas");s.width=n*256,s.height=r*256;let o=s.getContext("2d"),a=[];for(let l=0;l<r;l++)for(let c=0;c<n;c++){let u=`${U.volume.base}/tiles/${i.tiles}/${e}/${c}/${l}.${t}`;a.push(K4e(u).then(f=>{f&&o.drawImage(f,c*256,l*256,256,256)}))}return await Promise.all(a),s.toDataURL("image/jpeg",.92)}function K4e(i){return new Promise(e=>{let t=new Image;t.onload=()=>e(t),t.onerror=()=>e(null),t.src=i})}function are(){let i=U.lens,e=ye.overviewCanvas,t=e.getContext("2d"),n=Yh(),r=U.volume.tileGrid.size,s=U.volume.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=++U.overviewRun,f=i.formats[l],p=Math.floor(n[0]/r*2**l),x=Math.ceil(n[2]/r*2**l),v=Math.floor(-n[3]/r*2**l),w=Math.ceil(-n[1]/r*2**l);for(let S=v;S<w;S++)for(let T=p;T<x;T++){if(!f||!g4(i,l,T,S))continue;let R=new Image;R.onload=()=>{U.overviewRun===u&&t.drawImage(R,T*s-n[0]*c,S*s+n[3]*c,s,s)},R.src=`${U.volume.base}/tiles/${encodeURIComponent(i.tiles)}/${l}/${T}/${S}.${f}`}ox()}function ox(){let i=Zie();if(i){let w=lf(U.world);if(!w||!U.lens)return;let S=Yh(),[T,R]=w.toWorld(i.lat,i.lng),P=ye.overviewCanvas,C=Xr((T-S[0])/(S[2]-S[0]),0,1),L=Xr((R+S[3])/(S[3]-S[1]),0,1);U.overviewKey="",ye.overviewShelf.hidden=!1;let D=ye.overviewViewport.style,F=22;D.left=`${C*P.width-F/2}px`,D.top=`${L*P.height-F/2}px`,D.width=`${F}px`,D.height=`${F}px`;return}let e=U.engine?.getView();if(!e||!U.lens)return;let t=Yh(),n=e.calculateExtent(U.engine.getSize()),r=t[2]-t[0],s=t[3]-t[1],o=(e.getResolution()||0)*4,a=n[0]<=t[0]+o&&n[1]<=t[1]+o&&n[2]>=t[2]-o&&n[3]>=t[3]-o,l=a?"hidden":n.map(Math.round).join(",");if(l===U.overviewKey||(U.overviewKey=l,ye.overviewShelf.hidden=a,a))return;let c=ye.overviewCanvas,u=Xr((n[0]-t[0])/r,0,1),f=Xr((n[2]-t[0])/r,0,1),p=Xr((t[3]-n[3])/s,0,1),x=Xr((t[3]-n[1])/s,0,1),v=ye.overviewViewport.style;v.left=`${u*c.width}px`,v.top=`${p*c.height}px`,v.width=`${Math.max(8,(f-u)*c.width)}px`,v.height=`${Math.max(8,(x-p)*c.height)}px`}function m4(i,e=!0){U.overviewDocked=i,i&&U.overviewPointer!==null&&(U.overviewPointer=null,ax()),ye.overviewShelf.classList.toggle("is-docked",i),ye.overviewDock.setAttribute("aria-expanded",String(!i));let t=i?"Bring the overview back":"Put the overview away";ye.overviewDock.setAttribute("aria-label",t),ye.overviewDock.title=t,e&&Nc()}function c9(i,e){let t=ye.overviewCanvas.getBoundingClientRect(),n=Yh(),r=(a,l,c)=>Xr((a-l)/(c-l),0,1);if(U.globeActive){let a=lf(U.world);if(!a)return;let l=n[0]+r(i.clientX,t.left,t.right)*(n[2]-n[0]),c=-n[3]+r(i.clientY,t.top,t.bottom)*(n[3]-n[1]),[u,f]=a.toLatLng(l,c);Qie(u,f,e);return}let s=U.engine?.getView();if(!s||!U.lens)return;let o=[n[0]+r(i.clientX,t.left,t.right)*(n[2]-n[0]),n[3]-r(i.clientY,t.top,t.bottom)*(n[3]-n[1])];if(e){s.animate({center:o,duration:180});return}s.cancelAnimations(),s.setCenter(o)}function Gl(i){return new SH({updateWhileAnimating:!0,...i})}function lre(){let i=U.volume.tileGrid.size,e=[0,-i,i,0];U.projection=new _d({code:"ATLAS:PIXELS",units:"pixels",extent:e}),U.sources={grid:new vf({wrapX:!1}),gridContext:new vf({wrapX:!1}),zoneScrim:new vf({wrapX:!1}),zones:new vf({wrapX:!1}),zoneTitles:new vf({wrapX:!1}),text:new vf({wrapX:!1}),pins:new vf({wrapX:!1}),priority:new vf({wrapX:!1})},U.layers={raster:new rN({zIndex:0}),rasterDetail:new rN({zIndex:1}),grid:Gl({source:U.sources.grid,style:zI,renderOrder:Kl,renderBuffer:40,zIndex:5}),zoneScrim:Gl({source:U.sources.zoneScrim,style:FV,zIndex:6}),zones:Gl({source:U.sources.zones,style:OV,renderBuffer:32,zIndex:10}),zoneTitles:Gl({source:U.sources.zoneTitles,style:BV,renderOrder:Kl,renderBuffer:160,zIndex:20}),zoneTitleDetail:Gl({source:U.sources.zoneTitles,style:UV,renderOrder:Kl,renderBuffer:160,zIndex:44}),text:Gl({source:U.sources.text,style:RV,renderOrder:Kl,renderBuffer:220,zIndex:30}),textDetail:Gl({source:U.sources.text,style:PV,renderOrder:Kl,renderBuffer:220,zIndex:45}),zoneText:Gl({source:U.sources.text,style:IV,renderOrder:Kl,renderBuffer:220,zIndex:41}),pins:Gl({source:U.sources.pins,style:EV,renderOrder:Kl,renderBuffer:48,zIndex:40}),zonePins:Gl({source:U.sources.pins,style:MV,renderOrder:Kl,renderBuffer:48,zIndex:42}),pinLabels:Gl({source:U.sources.pins,style:CV,renderOrder:Kl,renderBuffer:180,zIndex:45}),gridContext:Gl({source:U.sources.gridContext,style:zI,renderOrder:Kl,renderBuffer:40,zIndex:48}),priority:Gl({source:U.sources.priority,style:NV,renderOrder:Kl,renderBuffer:220,zIndex:50})},U.engine=new Kq({target:ye.viewport,layers:Object.values(U.layers),controls:wS({attribution:!1,rotate:!1,zoom:!1}),interactions:RS({onFocusOnly:!1}),view:x4(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&&ax()}),U.engine.on("postrender",ox),ye.viewport.addEventListener("wheel",()=>{document.activeElement!==ye.viewport&&ye.viewport.focus({preventScroll:!0})},{capture:!0,passive:!0}),U.engine.on("singleclick",t=>{if(U.gridEnabled){let r=U.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===U.layers.grid||s===U.layers.gridContext});if(r){tA(r.hash);return}}let n=U.engine.forEachFeatureAtPixel(t.pixel,(r,s)=>_4(s)&&r.get("pin")||null,{hitTolerance:5,layerFilter:_4});n&&Nx(n)}),U.engine.on("pointermove",t=>{if(t.dragging){Bg(null);return}let n=U.engine.forEachFeatureAtPixel(t.pixel,(o,a)=>_4(a)&&o.get("pin")||null,{hitTolerance:4,layerFilter:_4}),r=n&&Ru(n.category)==="text"?null:n;Bg(r||null);let s=U.gridEnabled&&U.engine.hasFeatureAtPixel(t.pixel,{layerFilter:o=>o===U.layers.grid||o===U.layers.gridContext});U.engine.getTargetElement().style.cursor=n||s?"pointer":""}),U.engine.getViewport().addEventListener("pointerleave",()=>Bg(null))}function _4(i){return i===U.layers.pins||i===U.layers.zonePins||i===U.layers.pinLabels||i===U.layers.priority||i===U.layers.text||i===U.layers.textDetail||i===U.layers.zoneText}function x4(i,e=null){let t=U.volume.tileGrid.size,n=e||[0,-t,t,0];return new Al({projection:U.projection,center:[(n[0]+n[2])/2,(n[1]+n[3])/2],resolutions:u9(i),minZoom:0,maxZoom:i,extent:n,constrainResolution:!1,smoothResolutionConstraint:!1,showFullExtent:!0,zoom:0})}function u9(i){let e=U.volume.tileGrid.size/U.volume.tileGrid.tileSize;return Array.from({length:i+1},(t,n)=>e/2**n)}async function df(i,e){U.volume=U.catalog.volumes.find(r=>r.slug===i)||U.catalog.volumes[0],U.engine||lre(),!e&&!U.restore&&(U.restore=Rg(U.volume.slug)),ye.volume.value=U.volume.slug,B0(ye.world,U.volume.maps,"title"),ye.world.disabled=U.volume.maps.length===1,ye.world.title=ye.world.disabled?"This volume has one world":"Choose a world";let t=U.restore?.volume===U.volume.slug?U.restore:null,n=e&&U.volume.maps.find(r=>r.slug===e)||t&&U.volume.maps.find(r=>r.slug===t.map);await h9((n||U.volume.maps[0]).slug)}async function h9(i){let e=U.volume.maps.find(s=>s.slug===i)||U.volume.maps[0],t=++U.worldRun;ye.loading.hidden=!1;let n;try{n=await JV(e)}catch{U.worldRun===t&&(ye.loading.hidden=!0,oA());return}if(U.worldRun!==t)return;U.settling=!0,U.world=n,document.documentElement.style.setProperty("--icon-outset-color",J0()),ye.world.value=U.world.slug,B0(ye.lens,U.world.lenses,"name"),ye.lensField.hidden=U.world.lenses.length<2,U.styleCache.clear(),Bg(null),U.gridCell="",U.gridSystem="geohash",U.hiddenCategories.clear(),U.collapsedSections.clear(),U.collapsedSections.add("zones");for(let s of U.world.groups)for(let o of s.categories)o.visible||U.hiddenCategories.add(o.id);let r=U.restore?.map===U.world.slug?U.restore:null;r&&(U.hiddenCategories=new Set(r.hidden),U.collapsedSections=new Set(r.collapsed)),m4(!!U.restore?.overviewDocked,!1),Zw(U.restore?!!U.restore.dockFolded:!0,!1),U.dockDismissed=!!U.restore?.dockDismissed,U.search="",ye.search.value="",ye.dock.hidden=!1,Oc(),YV(),qI(),XV(),f9(r?Xr(r.lens,0,U.world.lenses.length-1):0,!0),Yie(),U.restore=null,ye.sidebar.classList.remove("is-open"),ye.mobileLegend.setAttribute("aria-expanded","false"),Dz(),U.settling=!1,Nc()}function f9(i,e=!1){let t=U.lens;U.lens=U.world.lenses[i]||U.world.lenses[0];let n=U.lens,r=e?null:J4e(t,n),s=Eu(n);if(ye.lens.value=String(U.world.lenses.indexOf(U.lens)),e)U.engine.setView(x4(s,Yh()));else{let w=U.engine.getView(),S=x4(s,Yh());S.setCenter(w.getCenter()),S.setZoom(w.getZoom()||0),U.engine.setView(S)}let o=++U.tileRun,a=0;U.tileStats={requested:0,loaded:0,errors:0,peakPending:0},ye.loading.hidden=!1;let l=w=>{w.on("tileloadstart",()=>{U.tileRun===o&&(a++,U.tileStats.requested++,U.tileStats.peakPending=Math.max(U.tileStats.peakPending,a))});let S=T=>{U.tileRun===o&&(a=Math.max(0,a-1),T?U.tileStats.errors++:U.tileStats.loaded++,a===0&&U.tileStats.loaded>0&&(ye.loading.hidden=!0))};return w.on("tileloadend",()=>S(!1)),w.on("tileloaderror",()=>S(!0)),w},c=(w,S)=>l(new Nz({projection:U.projection,tileGrid:new Rx({extent:[0,-U.volume.tileGrid.size,U.volume.tileGrid.size,0],origin:[0,0],resolutions:u9(w),tileSize:U.volume.tileGrid.tileSize}),cacheSize:64,interpolate:n.interpolate,transition:0,wrapX:!1,tileUrlFunction:([T,R,P])=>{let C=n.formats[T];if(!(!C||R<0||P<0||!S(T,R,P)))return`${U.volume.base}/tiles/${encodeURIComponent(n.tiles)}/${T}/${R}/${P}.${C}`}})),u=n.fullZoom??n.maxZoom,f=c(u,(w,S,T)=>g4(n,w,S,T)),p=U.layers.raster.getSource();U.layers.raster.setSource(f),U.layers.raster.setExtent(Yh()),U.layers.raster.setBackground(n.background||void 0),p?.clear();let x=U.layers.rasterDetail.getSource();n.maxZoom>u?(U.layers.rasterDetail.setSource(c(n.maxZoom,(w,S,T)=>w>u&&g4(n,w,S,T))),U.layers.rasterDetail.setExtent(Yh()),U.layers.rasterDetail.setVisible(!0)):U.layers.rasterDetail.setVisible(!1),x?.clear(),rS(),U.gridEnabled&&(Tu(),U.layers.pins.changed(),U.layers.text.changed(),U.layers.priority.changed()),U.overviewKey="",are();let v=e&&U.restore?.map===U.world.slug?U.restore:null;if(U.renderedShard!==(n.shard||0)&&(qI(),$l()),v?.center&&Number.isFinite(v.zoom)){let w=U.engine.getView();w.setCenter(v.center),w.setZoom(v.zoom),U.fitZoom=v.zoom,sA()}else e?requestAnimationFrame(ePe):(r&&U.engine.getView().animate({center:r,duration:200}),sA());Nc()}function g4(i,e,t,n){let r=i.coverage?.[e];if(!r)return!0;let s=t-r.x,o=n-r.y;if(s<0||o<0||s>=r.w||o>=r.h)return!1;let a=Q4e(i,e,r),l=o*r.w+s;return(a[l>>3]&1<<(l&7))!==0}function Q4e(i,e,t){if(!t.decoded){let n=atob(t.bits),r=new Uint8Array(n.length);for(let s=0;s<n.length;s++)r[s]=n.charCodeAt(s);t.decoded=r}return t.decoded}function Eu(i){return i.maxZoom+2}function ax(){sA(),Nc()}function J4e(i,e){if(!i||!e||!i.shard||!e.shard||i.shard===e.shard||!i.bounds||!e.bounds)return null;let n=U.engine?.getView()?.getCenter();if(!n)return null;let r=(n[0]-i.bounds.x)/i.bounds.width,s=(-n[1]-i.bounds.y)/i.bounds.height;return[e.bounds.x+Xr(r,0,1)*e.bounds.width,-(e.bounds.y+Xr(s,0,1)*e.bounds.height)]}function cre(){let e=document.querySelector(".app-shell").classList.toggle("sidebar-collapsed");ye.mobileLegend.setAttribute("aria-expanded",String(!e)),requestAnimationFrame(()=>U.engine?.updateSize())}function Yh(){let i=U.volume.tileGrid.size,e=U.lens?.bounds||{x:0,y:0,width:i,height:i};return[e.x,-(e.y+e.height),e.x+e.width,-e.y]}function ePe(){if(!U.engine||!U.lens)return;let i=U.engine.getView();i.fit(Yh(),{size:U.engine.getSize(),padding:[36,36,36,36],maxZoom:U.lens.maxZoom,duration:0}),U.fitZoom=i.getZoom()||0,sA()}function Kb(i){let e=U.engine.getView(),t=e.getZoom()||0;e.animate({zoom:Xr(t+i,U.lens.minZoom,Eu(U.lens)),duration:140})}function sA(){let i=U.engine?.getView().getZoom();if(ye.viewport.dataset.zoom=Number.isFinite(i)?i.toFixed(3):"",!U.engine||!U.pins.length){ye.visibleCount.textContent="0 locations visible";return}let e=U.engine.getView().calculateExtent(U.engine.getSize()),t=0;for(let n of U.pins){if(Zl(n))continue;let[r,s]=n.coordinate;r>=e[0]&&r<=e[2]&&s>=e[1]&&s<=e[3]&&t++}ye.visibleCount.textContent=`${Fc(U.eligibleLocations)} enabled \xB7 ${Fc(t)} in view`}function ure(){ye.volume.addEventListener("change",()=>{df(ye.volume.value)}),ye.world.addEventListener("change",()=>{h9(ye.world.value)}),ye.addBundles.addEventListener("click",()=>{YI()}),ye.emptyOpen.addEventListener("click",()=>{YI()}),ye.lens.addEventListener("change",()=>{f9(Number(ye.lens.value)),ore()}),ye.globeToggle.addEventListener("click",()=>p4()),ye.legend.addEventListener("change",n=>{let r=n.target;if(r.dataset.sectionToggle){ZV(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),$l(),Md()});let i=null,e=()=>{for(let s of ye.layers.querySelectorAll(".is-hovered"))s.classList.remove("is-hovered");if(!i)return;let r=document.elementFromPoint(i.x,i.y)?.closest(".category-row, .layer-header");r&&ye.layers.contains(r)&&r.classList.add("is-hovered")};ye.layers.addEventListener("pointermove",n=>{i={x:n.clientX,y:n.clientY},e()},{passive:!0}),ye.layers.addEventListener("pointerleave",()=>{i=null,e()}),ye.layers.addEventListener("scroll",e,{passive:!0}),ye.layers.addEventListener("click",n=>{let r=n.target.closest("[data-only-category], [data-only-section]");if(r){n.preventDefault(),n.stopPropagation(),QV(r.dataset.onlyCategory?{category:Number(r.dataset.onlyCategory)}:{section:r.dataset.onlySection});return}let s=n.target.closest("[data-section]");if(!s)return;let o=s.dataset.section;U.collapsedSections.has(o)?U.collapsedSections.delete(o):U.collapsedSections.add(o),yS()}),ye.soloChip.addEventListener("click",()=>Yx(!0)),nn("#expand-all").addEventListener("click",()=>XI(!1)),nn("#collapse-all").addEventListener("click",()=>XI(!0)),nn("#show-all").addEventListener("click",()=>Yx(!0)),nn("#hide-all").addEventListener("click",()=>Yx(!1)),ye.zoneToggle.addEventListener("change",()=>{_S(ye.zoneToggle.checked)}),ye.zoneIndex.addEventListener("click",n=>{let r=n.target.closest("[data-zone]");r&&HV(Number(r.dataset.zone))}),ye.zoneIndex.addEventListener("contextmenu",n=>{let r=n.target.closest("[data-zone]");r&&(n.preventDefault(),WV(Number(r.dataset.zone)))}),ye.search.addEventListener("input",()=>{U.search=ye.search.value.trim().toLocaleLowerCase(),$l(),U.search&&Kw()}),ye.dockFold.addEventListener("click",()=>{tI(!U.dockFolded)}),ye.searchResults.addEventListener("click",n=>{let r=n.target.closest("[data-location]");if(!r)return;let s=U.pinByID.get(Number(r.dataset.location));s&&nI(s)}),ye.detailLinks.addEventListener("click",n=>{let r=n.target.closest("[data-location]");if(!r)return;let s=U.pinByID.get(Number(r.dataset.location));s&&nI(s)}),nn("#close-detail").addEventListener("click",Oc),nn("#zoom-in").addEventListener("click",()=>U.globeActive?o9(1):Kb(1)),nn("#zoom-out").addEventListener("click",()=>U.globeActive?o9(-1):Kb(-1)),ye.gridBack.addEventListener("click",gI),ye.gridInput.addEventListener("input",()=>{let n=uo(),r=n.normalizeInput(ye.gridInput.value);ye.gridInput.value=r,n.parseInput(r)!==null&&tA(r)}),ye.subgridToggle.addEventListener("click",()=>{Ux(!U.subgridVisible),ye.viewport.focus({preventScroll:!0})}),ye.gridInput.addEventListener("keydown",n=>{if(n.key===" "){n.preventDefault(),Ux(!U.subgridVisible);return}if(n.key==="`"){n.preventDefault(),ye.globeToggle.hidden||p4();return}n.key==="Escape"&&(n.preventDefault(),n.stopPropagation(),ye.viewport.focus({preventScroll:!0}))}),ye.viewport.addEventListener("keydown",n=>{if(!Yw(n.target)){if(n.key==="+"||n.key==="=")Kb(1);else if(n.key==="-")Kb(-1);else if(n.key==="Escape")Oc();else return;n.preventDefault()}}),window.addEventListener("contextmenu",n=>{Yw(n.target)||n.preventDefault()}),window.addEventListener("keydown",n=>{if((n.metaKey||n.ctrlKey)&&n.key.toLocaleLowerCase()==="r"){n.preventDefault(),location.reload();return}if(!Yw(n.target)){if(n.key==="`"&&!n.metaKey&&!n.ctrlKey&&!n.altKey){ye.globeToggle.hidden||(n.preventDefault(),p4());return}if((n.metaKey||n.ctrlKey)&&n.key.toLocaleLowerCase()==="k"){n.preventDefault(),ye.search.focus(),ye.search.select();return}if((n.metaKey||n.ctrlKey)&&n.altKey&&n.code==="KeyB"){n.preventDefault(),ye.dock.hidden||tI(!U.dockFolded);return}if((n.metaKey||n.ctrlKey)&&n.key.toLocaleLowerCase()==="b"){n.preventDefault(),cre();return}iV(n)||n.key.toLocaleLowerCase()==="z"&&(n.preventDefault(),n.repeat||xS(!0))}}),window.addEventListener("keyup",n=>{n.key.toLocaleLowerCase()==="z"&&xS(!1)}),window.addEventListener("blur",()=>xS(!1)),window.addEventListener("hashchange",()=>{let n=Pg();n.volume===U.volume?.slug&&n.world===U.world?.slug||(U.restore=null,df(n.volume||U.catalog.volumes[0].slug,n.world))}),window.addEventListener("resize",()=>{U.engine?.updateSize(),ox(),l9()}),document.addEventListener("atlas:globe-camera",()=>ox()),ye.overview.addEventListener("pointerdown",n=>{U.overviewDocked||n.pointerType==="mouse"&&n.button!==0||(n.preventDefault(),ye.overview.setPointerCapture(n.pointerId),U.overviewPointer=n.pointerId,c9(n,!0))}),ye.overview.addEventListener("pointermove",n=>{U.overviewPointer===n.pointerId&&(n.preventDefault(),c9(n,!1))});let t=n=>{U.overviewPointer===n.pointerId&&(U.overviewPointer=null,ax())};ye.overview.addEventListener("pointerup",t),ye.overview.addEventListener("pointercancel",t),ye.overviewDock.addEventListener("click",()=>{m4(!U.overviewDocked),ye.viewport.focus({preventScroll:!0})}),ye.mobileLegend.addEventListener("click",()=>{let n=ye.sidebar.classList.toggle("is-open");ye.mobileLegend.setAttribute("aria-expanded",String(n))})}function hre(){let i=()=>({volume:U.volume?.title,world:U.world?.title,lens:U.lens?.name,zoom:U.engine?.getView().getZoom(),center:U.engine?.getView().getCenter(),resolution:U.engine?.getView().getResolution(),nativeMaxZoom:U.lens?.maxZoom,maxZoom:U.lens?Eu(U.lens):null,interpolate:U.lens?.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:!ye.detail.hidden,detailTitle:ye.detail.hidden?null:ye.detailTitle.textContent||null,searchQuery:U.search,searchResultsVisible:!ye.searchResults.hidden,soloChip:ye.soloChip.hidden?null:ye.soloChip.textContent,visibleCountText:ye.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(e=>U.zoneRecords.get(e)?.zone.title).filter(Boolean),focusedPins:U.pins.filter(e=>!e.filteredHidden&&e.insideHighlightedZone).length},grid:{enabled:U.gridEnabled,prefix:U.gridCell,maximumDepth:oV(),extent:U.gridEnabled?_I():null,cells:[...U.sources.grid.getFeatures(),...U.sources.gridContext.getFeatures()].map(e=>e.get("gridCell")),priorityPins:U.gridCell?U.pins.filter(e=>!e.filteredHidden&&Rd(e)).length:0}});window.__atlasDebug={snapshot:i,setLayerVisible:(e,t)=>U.layers[e]?.setVisible(t),refreshCatalog:oA},window.render_game_to_text=()=>JSON.stringify({coordinateSystem:"ATLAS:PIXELS; origin top-left; x increases right; y decreases downward",...i()}),window.advanceTime=()=>U.engine?.renderSync()}async function fre(){ure();try{let i=await fetch("/data/catalog.json");if(!i.ok)throw new Error(`catalog request returned ${i.status}`);if(U.catalog=await i.json(),B0(ye.volume,U.catalog.volumes,"title"),$I(),window.runtime?.EventsOn?.("atlas:catalog-changed",()=>{oA()}),U.catalog.volumes.length){let e=Pg(),t=Rg(),n=t&&(!e.volume||e.volume===t.volume&&e.world===t.world);U.restore=n?t:null,await df(e.volume||t?.volume||U.catalog.volumes[0].slug,e.world||t?.world),U.restore=null}else ye.loading.hidden=!0;hre(),requestAnimationFrame(()=>ye.viewport.focus({preventScroll:!0}))}catch(i){ye.loading.hidden=!0,ye.fatalMessage.textContent=i instanceof Error?i.message:String(i),ye.fatal.hidden=!1}}fre();})();
M assets/index.html +13 -13
@@ -5,37 +5,37 @@
55 <meta name="viewport" content="width=device-width, initial-scale=1">66 <meta name="color-scheme" content="dark">77 <link rel="icon" href="data:,">8- <title>Atlas — Game Map Explorer</title>8+ <title>Atlas — World Explorer</title>99 <link rel="stylesheet" href="/static/app.css">1010 <script src="/static/app.js" defer></script>1111 </head>1212 <body>1313 <div class="app-shell">1414 <header class="topbar">15- <div class="brand" aria-label="Atlas — Game map explorer" title="Game map explorer">15+ <div class="brand" aria-label="Atlas — World explorer" title="World explorer">1616 <svg viewBox="0 0 10 10" aria-hidden="true"><path d="M5 .8 9.2 5 5 9.2.8 5Z"/></svg>1717 <strong>ATLAS</strong>1818 </div>1919 2020 <div class="map-pickers">2121 <label>22- <span>Game</span>23- <select id="game-select" aria-label="Game"></select>22+ <span>Volume</span>23+ <select id="volume-select" aria-label="Volume"></select>2424 </label>2525 <label>26- <span>Map</span>27- <select id="map-select" aria-label="Map"></select>26+ <span>World</span>27+ <select id="world-select" aria-label="World"></select>2828 </label>29- <label id="variant-field">30- <span>Layer</span>31- <select id="variant-select" aria-label="Map layer"></select>29+ <label id="lens-field">30+ <span>Lens</span>31+ <select id="lens-select" aria-label="World lens"></select>3232 </label>3333 <button class="globe-toggle" id="globe-toggle" type="button" hidden3434 aria-pressed="false" aria-label="View as globe" title="View as globe">3535 <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>3636 </button>3737 <button class="icon-button add-bundles" id="add-bundles" type="button"38- aria-label="Add game bundles" title="Add .atlas game bundles">38+ aria-label="Add volumes" title="Add .atlas volumes">3939 <svg viewBox="0 0 24 24"><path d="M12 5v14M5 12h14"/></svg>4040 </button>4141 </div>
@@ -101,7 +101,7 @@
101101 102102 <main class="map-panel">103103 <div id="globe" class="globe" hidden aria-label="Interactive globe"></div>104- <div id="map" class="map" tabindex="0" autofocus aria-label="Interactive game map">104+ <div id="map" class="map" tabindex="0" autofocus aria-label="Interactive world map">105105 <div class="map-loading" id="map-loading">106106 <span class="spinner"></span>107107 <strong>Unfolding map</strong>
@@ -192,8 +192,8 @@
192192 </div>193193 194194 <div id="empty-state" class="empty-state" hidden>195- <strong>No games installed yet</strong>196- <p>Each game is a single <code>.atlas</code> file. Drop one into</p>195+ <strong>No volumes installed yet</strong>196+ <p>Each volume is a single <code>.atlas</code> file. Drop one into</p>197197 <p><code id="empty-path"></code></p>198198 <p>and it appears here on its own — or pick files to copy in:</p>199199 <button id="empty-open" type="button">Open .atlas files…</button>
M cmd/cartograph/diff.go +1 -1
M cmd/cartograph/diff_test.go +5 -5
@@ -15,7 +15,7 @@ func diffFixture(t *testing.T) (*build, *build, map[string]map[int64]string, map
1515 dir := t.TempDir()1616 install(t, dir, "hollowmere-a.atlas", bundletest.Spec{1717 Slug: "hollowmere", Title: "Hollowmere", CreatedAt: "2026-01-01T00:00:00Z",18- Maps: []bundletest.MapSpec{{18+ Worlds: []bundletest.WorldSpec{{1919 Slug: "overworld",2020 Pins: []bundletest.Pin{2121 {Title: "Gate"}, {Title: "Well", Silent: true}, {Title: "Shrine"},
@@ -32,7 +32,7 @@ func diffFixture(t *testing.T) (*build, *build, map[string]map[int64]string, map
3232 })3333 install(t, dir, "hollowmere-b.atlas", bundletest.Spec{3434 Slug: "hollowmere", Title: "Hollowmere", CreatedAt: "2026-02-01T00:00:00Z",35- Maps: []bundletest.MapSpec{{35+ Worlds: []bundletest.WorldSpec{{3636 Slug: "overworld",3737 Pins: []bundletest.Pin{3838 {Title: "Gate", Description: "The way in."}, {Title: "Well"},
@@ -49,7 +49,7 @@ func diffFixture(t *testing.T) (*build, *build, map[string]map[int64]string, map
4949 }},5050 })5151 52- games, _, err := (&library{dir: dir}).games()52+ games, _, err := (&library{dir: dir}).volumes()5353 if err != nil {5454 t.Fatal(err)5555 }
@@ -120,7 +120,7 @@ func TestDiffPage(t *testing.T) {
120120 server, _ := testServer(t)121121 ts := newTestSite(t, server)122122 123- status, body := get(t, ts, "/game/hollowmere/diff?a=hollowmere-jan.atlas&b=hollowmere-feb.atlas")123+ status, body := get(t, ts, "/volume/hollowmere/diff?a=hollowmere-jan.atlas&b=hollowmere-feb.atlas")124124 if status != 200 {125125 t.Fatalf("diff page answered %d", status)126126 }
@@ -129,7 +129,7 @@ func TestDiffPage(t *testing.T) {
129129 t.Errorf("diff page misses %q", want)130130 }131131 }132- if status, _ := get(t, ts, "/game/hollowmere/diff?a=hollowmere-jan.atlas&b=nowhere.atlas"); status != 400 {132+ if status, _ := get(t, ts, "/volume/hollowmere/diff?a=hollowmere-jan.atlas&b=nowhere.atlas"); status != 400 {133133 t.Errorf("diff with a missing build answered %d", status)134134 }135135 }
M cmd/cartograph/library.go +17 -17
@@ -32,17 +32,17 @@ type cachedBuild struct {
3232 // game is every build of one slug, newest first: the same order the reader's3333 // registry folds by, so the first build of every game is the one the reader3434 // serves.35-type game struct {35+type volume struct {3636 Slug string3737 Title string3838 Builds []*build3939 }4040 4141 // Serving is the build the reader would pick.42-func (g *game) Serving() *build { return g.Builds[0] }42+func (g *volume) Serving() *build { return g.Builds[0] }4343 4444 // Build finds one build by file name, which is how diff URLs name them.45-func (g *game) Build(file string) *build {45+func (g *volume) Build(file string) *build {4646 for _, b := range g.Builds {4747 if b.File == file {4848 return b
@@ -54,47 +54,47 @@ func (g *game) Build(file string) *build {
5454 // games measures every bundle in the directory and groups the builds by5555 // game. A bundle that fails to measure is reported in skipped rather than5656 // failing the scan: one bad download should not take the dashboard down.57-func (l *library) games() (games []*game, skipped []string, err error) {57+func (l *library) volumes() (volumes []*volume, skipped []string, err error) {5858 paths, err := filepath.Glob(filepath.Join(l.dir, "*.atlas"))5959 if err != nil {6060 return nil, nil, err6161 }6262 sort.Strings(paths)6363 64- byGame := make(map[string]*game)64+ byVolume := make(map[string]*volume)6565 for _, path := range paths {6666 measured, err := l.measure(path)6767 if err != nil {6868 skipped = append(skipped, filepath.Base(path)+": "+err.Error())6969 continue7070 }71- held, ok := byGame[measured.GameSlug]71+ held, ok := byVolume[measured.VolumeSlug]7272 if !ok {73- held = &game{Slug: measured.GameSlug}74- byGame[measured.GameSlug] = held75- games = append(games, held)73+ held = &volume{Slug: measured.VolumeSlug}74+ byVolume[measured.VolumeSlug] = held75+ volumes = append(volumes, held)7676 }7777 held.Builds = append(held.Builds, measured)7878 }7979 80- for _, held := range byGame {80+ for _, held := range byVolume {8181 // The registry's own order, spelled once in internal/measure.8282 sort.Slice(held.Builds, func(a, b int) bool {8383 return measure.Newer(held.Builds[a], held.Builds[b])8484 })85- held.Title = held.Serving().GameTitle85+ held.Title = held.Serving().VolumeTitle8686 }87- sort.Slice(games, func(a, b int) bool { return games[a].Title < games[b].Title })88- return games, skipped, nil87+ sort.Slice(volumes, func(a, b int) bool { return volumes[a].Title < volumes[b].Title })88+ return volumes, skipped, nil8989 }9090 91-// gameBySlug scans and returns one game, or nil if the slug has no builds.92-func (l *library) gameBySlug(slug string) (*game, error) {93- games, _, err := l.games()91+// volumeBySlug scans and returns one game, or nil if the slug has no builds.92+func (l *library) volumeBySlug(slug string) (*volume, error) {93+ volumes, _, err := l.volumes()9494 if err != nil {9595 return nil, err9696 }97- for _, held := range games {97+ for _, held := range volumes {9898 if held.Slug == slug {9999 return held, nil100100 }
M cmd/cartograph/measure_test.go +8 -8
@@ -31,7 +31,7 @@ func TestMeasureBundle(t *testing.T) {
3131 Slug: "hollowmere",3232 Title: "Hollowmere",3333 CreatedAt: "2026-03-01T00:00:00Z",34- Maps: []bundletest.MapSpec{{34+ Worlds: []bundletest.WorldSpec{{3535 Slug: "overworld",3636 Pins: []bundletest.Pin{3737 {Title: "Gate", Description: "The way in."},
@@ -46,8 +46,8 @@ func TestMeasureBundle(t *testing.T) {
4646 if err != nil {4747 t.Fatal(err)4848 }49- if measured.GameSlug != "hollowmere" || measured.GameTitle != "Hollowmere" {50- t.Fatalf("identity read as %s (%s)", measured.GameTitle, measured.GameSlug)49+ if measured.VolumeSlug != "hollowmere" || measured.VolumeTitle != "Hollowmere" {50+ t.Fatalf("identity read as %s (%s)", measured.VolumeTitle, measured.VolumeSlug)5151 }5252 5353 // Annotation: three pins, two with words. The medians sort "The way in."
@@ -72,9 +72,9 @@ func TestMeasureBundle(t *testing.T) {
7272 }7373 7474 // Structure and icons: one group of one iconed marker category, one layer.75- if measured.Categories != 1 || measured.Groups != 1 || measured.Variants != 1 {75+ if measured.Categories != 1 || measured.Groups != 1 || measured.Lenses != 1 {7676 t.Errorf("structure: %d categories, %d groups, %d layers; want 1 each",77- measured.Categories, measured.Groups, measured.Variants)77+ measured.Categories, measured.Groups, measured.Lenses)7878 }7979 if measured.IconsCarried != 1 || measured.IconsWanted != 1 {8080 t.Errorf("icons: %d of %d; want 1 of 1", measured.IconsCarried, measured.IconsWanted)
@@ -132,7 +132,7 @@ func TestLibraryOrdersBuilds(t *testing.T) {
132132 })133133 134134 lib := &library{dir: dir}135- games, skipped, err := lib.games()135+ games, skipped, err := lib.volumes()136136 if err != nil {137137 t.Fatal(err)138138 }
@@ -170,7 +170,7 @@ func TestLibrarySkipsBadBundles(t *testing.T) {
170170 if err := os.WriteFile(filepath.Join(dir, "broken.atlas"), []byte("not a zip"), 0o644); err != nil {171171 t.Fatal(err)172172 }173- games, skipped, err := (&library{dir: dir}).games()173+ games, skipped, err := (&library{dir: dir}).volumes()174174 if err != nil {175175 t.Fatal(err)176176 }
@@ -182,7 +182,7 @@ func TestLibrarySkipsBadBundles(t *testing.T) {
182182 func TestLoadPins(t *testing.T) {183183 path := bundletest.Build(t, t.TempDir(), bundletest.Spec{184184 Slug: "hollowmere",185- Maps: []bundletest.MapSpec{{185+ Worlds: []bundletest.WorldSpec{{186186 Slug: "overworld",187187 Pins: []bundletest.Pin{{Title: "Gate"}, {Title: "Well"}},188188 }},
M cmd/cartograph/server.go +14 -14
@@ -23,7 +23,7 @@ type server struct {
2323 2424 func newServer(lib *library, shop *workshop) *server {2525 pages := make(map[string]*template.Template)26- for _, name := range []string{"collection", "game", "diff", "sources"} {26+ for _, name := range []string{"collection", "volume", "diff", "sources"} {2727 pages[name] = template.Must(template.ParseFS(uiFS, "ui/layout.tmpl", "ui/"+name+".tmpl"))2828 }2929 return &server{library: lib, shop: shop, pages: pages}
@@ -32,8 +32,8 @@ func newServer(lib *library, shop *workshop) *server {
3232 func (s *server) routes() http.Handler {3333 mux := http.NewServeMux()3434 mux.HandleFunc("GET /{$}", s.handleCollection)35- mux.HandleFunc("GET /game/{slug}", s.handleGame)36- mux.HandleFunc("GET /game/{slug}/diff", s.handleDiff)35+ mux.HandleFunc("GET /volume/{slug}", s.handleVolume)36+ mux.HandleFunc("GET /volume/{slug}/diff", s.handleDiff)3737 mux.HandleFunc("GET /sources", s.handleSources)3838 mux.HandleFunc("POST /ops/run", s.handleOps)3939 mux.HandleFunc("GET /static/style.css", staticFile("ui/style.css", "text/css; charset=utf-8"))
@@ -58,20 +58,20 @@ func (s *server) render(w http.ResponseWriter, page string, data any) {
5858 }5959 6060 func (s *server) handleCollection(w http.ResponseWriter, r *http.Request) {61- games, skipped, err := s.library.games()61+ volumes, skipped, err := s.library.volumes()6262 if err != nil {6363 http.Error(w, err.Error(), http.StatusInternalServerError)6464 return6565 }6666 s.render(w, "collection", struct {6767 Dir string68- Games []*game68+ Volumes []*volume6969 Skipped []string70- }{Dir: s.library.dir, Games: games, Skipped: skipped})70+ }{Dir: s.library.dir, Volumes: volumes, Skipped: skipped})7171 }7272 73-func (s *server) handleGame(w http.ResponseWriter, r *http.Request) {74- held, err := s.library.gameBySlug(r.PathValue("slug"))73+func (s *server) handleVolume(w http.ResponseWriter, r *http.Request) {74+ held, err := s.library.volumeBySlug(r.PathValue("slug"))7575 if err != nil {7676 http.Error(w, err.Error(), http.StatusInternalServerError)7777 return
@@ -80,13 +80,13 @@ func (s *server) handleGame(w http.ResponseWriter, r *http.Request) {
8080 http.NotFound(w, r)8181 return8282 }83- s.render(w, "game", struct{ Game *game }{Game: held})83+ s.render(w, "volume", struct{ Volume *volume }{Volume: held})8484 }8585 8686 // handleDiff compares two builds of one game, named by file. The packed pins8787 // are read here, on demand, because only a comparison ever needs them whole.8888 func (s *server) handleDiff(w http.ResponseWriter, r *http.Request) {89- held, err := s.library.gameBySlug(r.PathValue("slug"))89+ held, err := s.library.volumeBySlug(r.PathValue("slug"))9090 if err != nil {9191 http.Error(w, err.Error(), http.StatusInternalServerError)9292 return
@@ -97,7 +97,7 @@ func (s *server) handleDiff(w http.ResponseWriter, r *http.Request) {
9797 }9898 from, to := held.Build(r.FormValue("a")), held.Build(r.FormValue("b"))9999 if from == nil || to == nil {100- http.Error(w, "pick two builds of this game", http.StatusBadRequest)100+ http.Error(w, "pick two builds of this volume", http.StatusBadRequest)101101 return102102 }103103 pinsA, err := loadPins(from.Path, from.MapSlugs)
@@ -105,9 +105,9 @@ func (s *server) handleDiff(w http.ResponseWriter, r *http.Request) {
105105 var pinsB map[string]map[int64]string106106 if pinsB, err = loadPins(to.Path, to.MapSlugs); err == nil {107107 s.render(w, "diff", struct {108- Game *game109- Diff *buildDiff110- }{Game: held, Diff: diffBuilds(from, to, pinsA, pinsB)})108+ Volume *volume109+ Diff *buildDiff110+ }{Volume: held, Diff: diffBuilds(from, to, pinsA, pinsB)})111111 return112112 }113113 }
M cmd/cartograph/server_test.go +5 -5
M cmd/cartograph/sources.go +7 -7
M cmd/cartograph/ui/collection.tmpl +5 -5
M cmd/cartograph/ui/diff.tmpl +3 -3
M cmd/cartograph/ui/sources.tmpl +1 -1
R cmd/cartograph/ui/game.tmpl → cmd/cartograph/ui/volume.tmpl +9 -9
@@ -1,30 +1,30 @@
1-{{define "title"}}Cartograph · {{.Game.Title}}{{end}}1+{{define "title"}}Cartograph · {{.Volume.Title}}{{end}}22 {{define "content"}}33 <section class="page-head">4- <h1>{{.Game.Title}} <span class="dim">{{.Game.Slug}}</span></h1>5- <p class="dim">{{len .Game.Builds}} builds, newest first — the first is the one the reader serves.</p>4+ <h1>{{.Volume.Title}} <span class="dim">{{.Volume.Slug}}</span></h1>5+ <p class="dim">{{len .Volume.Builds}} builds, newest first — the first is the one the reader serves.</p>66 </section>7-{{if gt (len .Game.Builds) 1}}8-<form class="compare" action="/game/{{.Game.Slug}}/diff" method="get">7+{{if gt (len .Volume.Builds) 1}}8+<form class="compare" action="/volume/{{.Volume.Slug}}/diff" method="get">99 <label>compare</label>1010 <select name="a">11- {{range $at, $b := .Game.Builds}}<option value="{{$b.File}}"{{if eq $at 1}} selected{{end}}>{{$b.File}}</option>{{end}}11+ {{range $at, $b := .Volume.Builds}}<option value="{{$b.File}}"{{if eq $at 1}} selected{{end}}>{{$b.File}}</option>{{end}}1212 </select>1313 <label>against</label>1414 <select name="b">15- {{range $at, $b := .Game.Builds}}<option value="{{$b.File}}"{{if eq $at 0}} selected{{end}}>{{$b.File}}</option>{{end}}15+ {{range $at, $b := .Volume.Builds}}<option value="{{$b.File}}"{{if eq $at 0}} selected{{end}}>{{$b.File}}</option>{{end}}1616 </select>1717 <button>What moved</button>1818 </form>1919 {{end}}20-{{range $at, $b := .Game.Builds}}20+{{range $at, $b := .Volume.Builds}}2121 <section class="build{{if eq $at 0}} serving{{end}}">2222 <h2>{{$b.File}}{{if eq $at 0}} <span class="tag">serving</span>{{end}}</h2>2323 <p class="dim">captured {{$b.CreatedAt}} · revision {{$b.Revision}} · stamp {{$b.ShortStamp}}</p>2424 <dl class="axes">2525 <div><dt>annotation</dt><dd><b>{{$b.Pins}}</b> pins · {{$b.Described}} described ({{$b.DescribedPct}}) · median {{$b.MedianLength}} chars</dd></div>2626 <div><dt>cartography</dt><dd><b>{{$b.TileCount}}</b> tiles · {{$b.RasterMB}} MB unique raster · depth z{{$b.Depth}} holds {{$b.DepthTiles}} tiles</dd></div>27- <div><dt>structure</dt><dd><b>{{$b.Categories}}</b> categories in {{$b.Groups}} groups · {{$b.TextSets}} text label sets · {{$b.Zones}} zones ({{$b.Vertices}} vertices) · {{$b.Variants}} layers</dd></div>27+ <div><dt>structure</dt><dd><b>{{$b.Categories}}</b> categories in {{$b.Groups}} groups · {{$b.TextSets}} text label sets · {{$b.Zones}} zones ({{$b.Vertices}} vertices) · {{$b.Lenses}} lenses</dd></div>2828 <div><dt>icons</dt><dd><b>{{$b.IconsCarried}}</b> of {{$b.IconsWanted}} marker categories carry one ({{$b.IconPct}})</dd></div>2929 </dl>3030 {{if $b.Merges}}
M frontend/css/map-pickers.css +2 -2
M frontend/src/boot.js +7 -7
@@ -2,7 +2,7 @@ import { elements, populateSelect } from "./dom.js";
22 import { state } from "./state.js";33 import { bindUIEvents } from "./events.js";44 import { readRoute, readSession } from "./session.js";5-import { selectGame } from "./navigation.js";5+import { selectVolume } from "./navigation.js";66 import { refreshCatalog, syncEmptyState } from "./library.js";77 import { exposeDiagnostics } from "./diagnostics.js";88
@@ -12,7 +12,7 @@ export async function start() {
1212 const response = await fetch("/data/catalog.json");1313 if (!response.ok) throw new Error(`catalog request returned ${response.status}`);1414 state.catalog = await response.json();15- populateSelect(elements.game, state.catalog.games, "title");15+ populateSelect(elements.volume, state.catalog.volumes, "title");1616 syncEmptyState();1717 // The library can change while the application is open -- a bundle1818 // dropped in, replaced, or removed -- and the backend says so here.
@@ -21,17 +21,17 @@ export async function start() {
2121 window.runtime?.EventsOn?.("atlas:catalog-changed", () => {2222 void refreshCatalog();2323 });24- if (state.catalog.games.length) {24+ if (state.catalog.volumes.length) {2525 const route = readRoute();2626 const session = readSession();2727 // An address naming somewhere else was typed on purpose, so it wins and2828 // arrives clean; anything else resumes where the reader left off.2929 const resuming = session &&30- (!route.game || (route.game === session.game && route.map === session.map));30+ (!route.volume || (route.volume === session.volume && route.world === session.world));3131 state.restore = resuming ? session : null;32- await selectGame(33- route.game || session?.game || state.catalog.games[0].slug,34- route.map || session?.map,32+ await selectVolume(33+ route.volume || session?.volume || state.catalog.volumes[0].slug,34+ route.world || session?.world,3535 );3636 state.restore = null;3737 } else {
M frontend/src/catalog.js +8 -8
@@ -6,14 +6,14 @@ import { legendSections } from "./legend.js";
66 // map is opened, so the catalog can grow without the wait growing with it.77 export async function loadMap(entry) {88 const [detailResponse, packedResponse] = await Promise.all([9- fetch(`${state.game.base}/maps/${entry.slug}.json`),10- fetch(`${state.game.base}/maps/${entry.slug}.bin`),9+ fetch(`${state.volume.base}/worlds/${entry.slug}.json`),10+ fetch(`${state.volume.base}/worlds/${entry.slug}.bin`),1111 ]);1212 // A refusal here is almost always a stamp that has gone stale: the bundle1313 // was replaced between the catalog fetch and this one. The caller refetches1414 // the catalog and arrives at the new build's URLs.1515 if (!detailResponse.ok || !packedResponse.ok) {16- throw new Error(`map ${entry.slug} is not served under this catalog any more`);16+ throw new Error(`world ${entry.slug} is not served under this catalog any more`);1717 }1818 const [detail, packed] = await Promise.all([1919 detailResponse.json(),
@@ -24,7 +24,7 @@ export async function loadMap(entry) {
2424 return {2525 ...entry,2626 grid: detail.grid,27- variants: detail.variants,27+ lenses: detail.lenses,2828 groups: detail.groups,2929 zones: detail.zones || [],3030 attrs: detail.attrs || {},
@@ -69,15 +69,15 @@ export function unpackLocations(buffer, categories) {
6969 7070 // Descriptions and cross-references are half the catalog by weight and are read7171 // one pin at a time, so a map's are fetched the first time one of its pins is72-// opened, and not at all if none ever is. The cache is keyed by the game's72+// opened, and not at all if none ever is. The cache is keyed by the volume's7373 // stamped base as well as the map, so an updated bundle is never answered7474 // with the words of the build it replaced.75-export async function mapText() {76- const key = `${state.game.base}/${state.map.slug}`;75+export async function worldText() {76+ const key = `${state.volume.base}/${state.world.slug}`;7777 if (!state.textByMap.has(key)) {7878 state.textByMap.set(7979 key,80- fetch(`${state.game.base}/maps/${state.map.slug}.text`).then((r) => r.json()).catch(() => ({})),80+ fetch(`${state.volume.base}/worlds/${state.world.slug}.text`).then((r) => r.json()).catch(() => ({})),8181 );8282 }8383 return state.textByMap.get(key);
M frontend/src/cellsystems/geohash.js +2 -2
M frontend/src/cellsystems/index.js +4 -4
M frontend/src/constants.js +2 -2
M frontend/src/detail.js +6 -6
@@ -1,4 +1,4 @@
1-import { mapText } from "./catalog.js";1+import { worldText } from "./catalog.js";22 import { elements } from "./dom.js";33 import { geohashCellAt } from "./cellsystems/geohash.js";44 import { syncLegendCheckboxes, syncSectionSwitches } from "./legend.js";
@@ -59,7 +59,7 @@ export function showPin(pin, focus = false) {
5959 const view = state.engine.getView();6060 view.animate({6161 center: pin.coordinate,62- zoom: Math.min(viewMaxZoom(state.variant), Math.max(view.getZoom() || 0, 4)),62+ zoom: Math.min(viewMaxZoom(state.lens), Math.max(view.getZoom() || 0, 4)),6363 duration: 220,6464 });6565 }
@@ -71,10 +71,10 @@ export function showPin(pin, focus = false) {
7171 // every other pin is the origin's alone. The index is built once per map and7272 // thrown away with it.7373 function pinSource(pin) {74- const merged = state.map?.merged;74+ const merged = state.world?.merged;7575 if (!merged?.length) return "";7676 const origin = merged.find((account) => account.origin)?.source || "";77- if (state.pinSourceIndex?.map !== state.map) {77+ if (state.pinSourceIndex?.world !== state.world) {7878 const byID = new Map();7979 for (const account of merged) {8080 for (const adopted of account.adopted || []) {
@@ -85,7 +85,7 @@ function pinSource(pin) {
8585 byID.set(pair.w, origin ? `${origin} · ${confirmed}` : confirmed);8686 }8787 }88- state.pinSourceIndex = { map: state.map, byID };88+ state.pinSourceIndex = { world: state.world, byID };8989 }9090 for (const account of merged) {9191 if (!account.origin && pin.group.title === account.source) return account.source;
@@ -98,7 +98,7 @@ function pinSource(pin) {
9898 // is already known and fills in when they arrive; a pin closed or changed in9999 // the meantime is left alone.100100 export async function fillPinText(pin) {101- const text = await mapText();101+ const text = await worldText();102102 if (state.selectedPin !== pin) return;103103 const entry = text[String(pin.location.id)] || {};104104 pin.location.description = entry.d || "";
M frontend/src/diagnostics.js +6 -6
M frontend/src/dom.js +4 -4
M frontend/src/engine.js +3 -3
M frontend/src/events.js +10 -10
@@ -3,9 +3,9 @@ import { state } from "./state.js";
33 import { activeSystem } from "./cellsystems/index.js";44 import {55 changeZoom,6- selectGame,7- selectMap,8- selectVariant,6+ selectVolume,7+ selectWorld,8+ selectLens,99 settleView,1010 toggleSidebar,1111 } from "./navigation.js";
@@ -38,12 +38,12 @@ import {
3838 import { isEditableTarget } from "./util.js";3939 4040 export function bindUIEvents() {41- elements.game.addEventListener("change", () => { void selectGame(elements.game.value); });42- elements.map.addEventListener("change", () => { void selectMap(elements.map.value); });41+ elements.volume.addEventListener("change", () => { void selectVolume(elements.volume.value); });42+ elements.world.addEventListener("change", () => { void selectWorld(elements.world.value); });4343 elements.addBundles.addEventListener("click", () => { void importBundles(); });4444 elements.emptyOpen.addEventListener("click", () => { void importBundles(); });45- elements.variant.addEventListener("change", () => {46- selectVariant(Number(elements.variant.value));45+ elements.lens.addEventListener("change", () => {46+ selectLens(Number(elements.lens.value));4747 refreshGlobe();4848 });4949 elements.globeToggle.addEventListener("click", () => toggleGlobe());
@@ -270,11 +270,11 @@ export function bindUIEvents() {
270270 window.addEventListener("blur", () => setLabelsHeld(false));271271 window.addEventListener("hashchange", () => {272272 const route = readRoute();273- if (route.game === state.game?.slug && route.map === state.map?.slug) return;273+ if (route.volume === state.volume?.slug && route.world === state.world?.slug) return;274274 // An address typed by hand names where to go, so it overrides what the275- // game remembers.275+ // volume remembers.276276 state.restore = null;277- void selectGame(route.game || state.catalog.games[0].slug, route.map);277+ void selectVolume(route.volume || state.catalog.volumes[0].slug, route.world);278278 });279279 window.addEventListener("resize", () => {280280 state.engine?.updateSize();
M frontend/src/globe.js +26 -26
@@ -36,7 +36,7 @@ import {
3636 pinInGridCell,3737 selectGridCell,3838 } from "./grid.js";39-import { equirectMapping, mapSurface } from "./semconv.js";39+import { equirectMapping, worldSurface } from "./semconv.js";4040 import { state } from "./state.js";4141 import { markerIconKey, measureLabel } from "./styles.js";4242 import { categoryColor, iconOutsetColor, initials } from "./theme.js";
@@ -76,7 +76,7 @@ let globe = null;
7676 let texturedFor = "";7777 // The detail layer: pyramid tiles standing just off the base skin wherever7878 // the camera is close enough to want them, keyed by level/column/row.79-const detail = { group: null, tiles: new Map(), key: "", variant: "" };79+const detail = { group: null, tiles: new Map(), key: "", lens: "" };8080 // The geohash grid drawn on the sphere: cell boundaries and their letters,8181 // rebuilt from the same plan the chart tiles its cells from. fitKey coarsens8282 // the camera so the grid rebuilds only when a zoom change could move the
@@ -103,7 +103,7 @@ const materials = new Map();
103103 // invert, and always returns the reader to the chart, which is where every104104 // map opens.105105 export function syncGlobe() {106- const offered = mapSurface(state.map) === "sphere" && equirectMapping(state.map) !== null;106+ const offered = worldSurface(state.world) === "sphere" && equirectMapping(state.world) !== null;107107 elements.globeToggle.hidden = !offered;108108 leaveGlobe();109109 if (!offered && globe) {
@@ -148,7 +148,7 @@ function altitudeForZoom(zoom) {
148148 149149 function zoomForAltitude(altitude) {150150 const safe = Number.isFinite(altitude) ? Math.max(altitude, nearestAltitude / 2) : wholeDiscAltitude;151- const ceiling = (state.variant?.maxZoom ?? wholeChartZoom) + overzoomLevels;151+ const ceiling = (state.lens?.maxZoom ?? wholeChartZoom) + overzoomLevels;152152 return clamp(wholeChartZoom + Math.log2(wholeDiscAltitude / safe), 0, ceiling);153153 }154154
@@ -171,7 +171,7 @@ function leaveGlobe() {
171171 // comparable closeness, so the flip reads as turning a page, not losing172172 // one. A map change lands here too, but its mapping no longer answers173173 // and the new map's view is left alone.174- const mapping = equirectMapping(state.map);174+ const mapping = equirectMapping(state.world);175175 const view = state.engine?.getView();176176 if (globe && state.globeActive && mapping && view) {177177 const pov = globe.pointOfView();
@@ -213,7 +213,7 @@ export function aimGlobe(lat, lng, ease) {
213213 }214214 215215 async function enterGlobe() {216- const mapping = equirectMapping(state.map);216+ const mapping = equirectMapping(state.world);217217 if (!mapping) return;218218 state.globeActive = true;219219 elements.viewport.hidden = true;
@@ -257,7 +257,7 @@ async function enterGlobe() {
257257 // reverse-halving the navigator types.258258 globe.onGlobeClick(({ lat, lng }) => {259259 if (!state.gridEnabled) return;260- const held = equirectMapping(state.map);260+ const held = equirectMapping(state.world);261261 if (!held) return;262262 const [worldX, worldY] = held.toWorld(lat, lng);263263 const target = activeSystem().descendTarget(state.gridCell, [worldX, -worldY]);
@@ -292,11 +292,11 @@ async function enterGlobe() {
292292 globe.pointOfView({ lat: 10, lng: 0, altitude: wholeDiscAltitude });293293 }294294 295- const variant = state.variant || state.map.variants[0];296- const key = `${state.game.stamp}:${state.map.slug}:${variant.tiles}`;295+ const lens = state.lens || state.world.lenses[0];296+ const key = `${state.volume.stamp}:${state.world.slug}:${lens.tiles}`;297297 if (texturedFor !== key) {298298 texturedFor = key;299- const texture = await composeTexture(variant);299+ const texture = await composeTexture(lens);300300 if (texture && texturedFor === key) {301301 globe.globeImageUrl(texture);302302 }
@@ -328,7 +328,7 @@ function rebuildGlobeGrid() {
328328 child.material?.map?.dispose();329329 child.material?.dispose();330330 }331- const mapping = state.globeActive ? equirectMapping(state.map) : null;331+ const mapping = state.globeActive ? equirectMapping(state.world) : null;332332 if (!mapping || !state.gridEnabled) {333333 grid.cell = null;334334 return;
@@ -687,21 +687,21 @@ function frameGridCell(mapping) {
687687 // neighborhood being looked at.688688 function updateDetailTiles() {689689 if (!globe || !detail.group) return;690- const variant = state.globeActive ? state.variant || state.map.variants[0] : null;691- if (!variant) {690+ const lens = state.globeActive ? state.lens || state.world.lenses[0] : null;691+ if (!lens) {692692 clearDetailTiles();693693 return;694694 }695- if (detail.variant !== variant.tiles) {695+ if (detail.lens !== lens.tiles) {696696 clearDetailTiles();697- detail.variant = variant.tiles;697+ detail.lens = lens.tiles;698698 }699699 const pov = globe.pointOfView();700700 const zoom = Math.min(701701 Math.round(zoomForAltitude(pov.altitude)) + 1,702- variant.maxZoom,702+ lens.maxZoom,703703 );704- if (zoom <= textureZoom || !variant.formats[zoom]) {704+ if (zoom <= textureZoom || !lens.formats[zoom]) {705705 clearDetailTiles();706706 detail.key = "";707707 return;
@@ -727,7 +727,7 @@ function updateDetailTiles() {
727727 wanted.add(`${zoom}/${column}/${row}`);728728 }729729 }730- const key = `${variant.tiles}:${[...wanted].sort().join(",")}`;730+ const key = `${lens.tiles}:${[...wanted].sort().join(",")}`;731731 if (key === detail.key) return;732732 detail.key = key;733733
@@ -740,7 +740,7 @@ function updateDetailTiles() {
740740 for (const name of wanted) {741741 if (detail.tiles.has(name)) continue;742742 const [z, column, row] = name.split("/").map(Number);743- const mesh = tileMesh(variant, z, column, row);743+ const mesh = tileMesh(lens, z, column, row);744744 detail.tiles.set(name, mesh);745745 detail.group.add(mesh);746746 }
@@ -749,7 +749,7 @@ function updateDetailTiles() {
749749 // tileMesh drapes one pyramid tile at its place on the sphere: a grid of750750 // points through the same latitude-longitude spelling the pins stand by,751751 // wearing the tile image once it arrives.752-function tileMesh(variant, zoom, column, row) {752+function tileMesh(lens, zoom, column, row) {753753 const span = 360 / 2 ** zoom;754754 const west = -180 + column * span;755755 const north = 90 - row * span;
@@ -781,7 +781,7 @@ function tileMesh(variant, zoom, column, row) {
781781 const mesh = new Mesh(geometry, material);782782 // Invisible until its picture arrives: a black square teaches nothing.783783 mesh.visible = false;784- const url = `${state.game.base}/tiles/${variant.tiles}/${zoom}/${column}/${row}.${variant.formats[zoom]}`;784+ const url = `${state.volume.base}/tiles/${lens.tiles}/${zoom}/${column}/${row}.${lens.formats[zoom]}`;785785 new TextureLoader().load(url, (texture) => {786786 texture.colorSpace = SRGBColorSpace;787787 material.map = texture;
@@ -924,7 +924,7 @@ function material(category, selected) {
924924 }925925 926926 // refreshGlobe re-enters the globe when what it shows has moved underneath927-// it: another raster variant chosen, a category switched in the legend.927+// it: another raster lens chosen, a category switched in the legend.928928 export function refreshGlobe() {929929 if (state.globeActive) void enterGlobe();930930 }
@@ -968,9 +968,9 @@ function spherePins(mapping) {
968968 // rows, which is the whole planet by the declared mapping. The result rides969969 // as a data URL, so the globe asks the app for nothing it has not already970970 // been given.971-async function composeTexture(variant) {972- const zoom = Math.min(textureZoom, variant.maxZoom);973- const format = variant.formats[zoom];971+async function composeTexture(lens) {972+ const zoom = Math.min(textureZoom, lens.maxZoom);973+ const format = lens.formats[zoom];974974 if (!format) return null;975975 const columns = 2 ** zoom;976976 const rows = columns / 2;
@@ -981,7 +981,7 @@ async function composeTexture(variant) {
981981 const jobs = [];982982 for (let y = 0; y < rows; y++) {983983 for (let x = 0; x < columns; x++) {984- const url = `${state.game.base}/tiles/${variant.tiles}/${zoom}/${x}/${y}.${format}`;984+ const url = `${state.volume.base}/tiles/${lens.tiles}/${zoom}/${x}/${y}.${format}`;985985 jobs.push(loadTile(url).then((image) => {986986 if (image) context.drawImage(image, x * 256, y * 256, 256, 256);987987 }));
M frontend/src/grid.js +5 -5
@@ -104,7 +104,7 @@ export function selectGridCell(raw) {
104104 state.engine.getView().fit(currentGridExtent(), {105105 size: state.engine.getSize(),106106 padding: [52, 52, 52, 52],107- maxZoom: viewMaxZoom(state.variant),107+ maxZoom: viewMaxZoom(state.lens),108108 duration: 180,109109 });110110 }
@@ -124,9 +124,9 @@ export function renderGrid() {
124124 state.sources.gridContext.clear();125125 elements.gridNavigator.hidden = !state.gridEnabled;126126 updateGridHint();127- if (state.gridEnabled && state.variant) {127+ if (state.gridEnabled && state.lens) {128128 const system = activeSystem();129- elements.gridInput.maxLength = system.inputLength(state.map);129+ elements.gridInput.maxLength = system.inputLength(state.world);130130 elements.gridInput.value = state.gridCell;131131 elements.gridBack.title = state.gridCell132132 ? `Back one ${system.slug} level`
@@ -214,7 +214,7 @@ export function gridCellPlan() {
214214 cells.push(planCell(system, id, "neighbor", chain.length - 1 - depth));215215 }216216 }217- if (state.gridCell && system.level(state.gridCell) >= system.maxLevel(state.map)) {217+ if (state.gridCell && system.level(state.gridCell) >= system.maxLevel(state.world)) {218218 cells.push(planCell(system, state.gridCell, "leaf", 0));219219 return cells;220220 }
@@ -316,7 +316,7 @@ export function currentGridExtent() {
316316 }317317 318318 export function gridMaxLevel() {319- return activeSystem().maxLevel(state.map);319+ return activeSystem().maxLevel(state.world);320320 }321321 322322 export function pinInGridCell(pin) {
M frontend/src/legend.js +10 -10
@@ -31,7 +31,7 @@ export function legendSections(groups) {
3131 3232 export function renderLegend() {3333 const fragment = document.createDocumentFragment();34- for (const section of state.map.sections) {34+ for (const section of state.world.sections) {3535 const element = document.createElement("section");3636 element.className = "layer-section";3737 element.dataset.layerSection = section.key;
@@ -160,7 +160,7 @@ export function syncSectionCollapse() {
160160 export function setAllCategories(visible) {161161 state.hiddenCategories.clear();162162 if (!visible) {163- for (const group of state.map.groups) {163+ for (const group of state.world.groups) {164164 for (const category of group.categories) state.hiddenCategories.add(category.id);165165 }166166 }
@@ -177,7 +177,7 @@ export function syncLegendCheckboxes() {
177177 }178178 179179 export function toggleSection(key) {180- const section = state.map.sections.find((item) => item.key === key);180+ const section = state.world.sections.find((item) => item.key === key);181181 if (!section) return;182182 const hasVisible = section.categories.some((category) => !state.hiddenCategories.has(category.id));183183 for (const category of section.categories) {
@@ -193,7 +193,7 @@ export function toggleSection(key) {
193193 // out of a hundred and sixty categories. Everything else is hidden rather than194194 // remembered, so Show all is the single, obvious way back.195195 export function showOnly(target) {196- if (!state.map) return;196+ if (!state.world) return;197197 // Asking to isolate what is already isolated means the reader is done with198198 // it, so the same control lets them back out.199199 if (isOnly(target)) {
@@ -201,7 +201,7 @@ export function showOnly(target) {
201201 return;202202 }203203 state.hiddenCategories.clear();204- for (const section of state.map.sections) {204+ for (const section of state.world.sections) {205205 const wanted = target.section === section.key;206206 for (const category of section.categories) {207207 if (!wanted && target.category !== category.id) {
@@ -217,7 +217,7 @@ export function showOnly(target) {
217217 218218 // True when what is on screen is already exactly what this target would isolate.219219 export function isOnly(target) {220- for (const section of state.map.sections) {220+ for (const section of state.world.sections) {221221 for (const category of section.categories) {222222 const wanted = target.section === section.key || target.category === category.id;223223 if (wanted === state.hiddenCategories.has(category.id)) return false;
@@ -230,7 +230,7 @@ export function isOnly(target) {
230230 // reached -- including by switching categories off one at a time.231231 export function updateSoloChip() {232232 const chip = elements.soloChip;233- if (!state.map) {233+ if (!state.world) {234234 chip.hidden = true;235235 return;236236 }
@@ -238,7 +238,7 @@ export function updateSoloChip() {
238238 let visibleCount = 0;239239 let soleSection = null;240240 let sectionsShowing = 0;241- for (const section of state.map.sections) {241+ for (const section of state.world.sections) {242242 let shown = 0;243243 for (const category of section.categories) {244244 if (state.hiddenCategories.has(category.id)) continue;
@@ -260,8 +260,8 @@ export function updateSoloChip() {
260260 }261261 262262 export function syncSectionSwitches() {263- if (!state.map) return;264- for (const section of state.map.sections) {263+ if (!state.world) return;264+ for (const section of state.world.sections) {265265 const input = elements.legend.querySelector(`input[data-section-toggle="${section.key}"]`);266266 if (input) {267267 input.checked = section.categories.some((category) => !state.hiddenCategories.has(category.id));
M frontend/src/library.js +21 -21
@@ -1,6 +1,6 @@
11 import { elements, populateSelect } from "./dom.js";22 import { state } from "./state.js";3-import { selectGame } from "./navigation.js";3+import { selectVolume } from "./navigation.js";44 import { readRoute, readSession } from "./session.js";55 66 // The library is the set of installed bundles, and it can change under a
@@ -22,26 +22,26 @@ export function refreshCatalog() {
2222 async function reconcile() {2323 const response = await fetch("/data/catalog.json");2424 if (!response.ok) return;25- const previous = state.game;25+ const previous = state.volume;2626 state.catalog = await response.json();27- populateSelect(elements.game, state.catalog.games, "title");27+ populateSelect(elements.volume, state.catalog.volumes, "title");2828 syncEmptyState();2929 30- if (!state.catalog.games.length) return;31- const current = previous && state.catalog.games.find((game) => game.slug === previous.slug);30+ if (!state.catalog.volumes.length) return;31+ const current = previous && state.catalog.volumes.find((volume) => volume.slug === previous.slug);3232 if (!current) {33- // Nothing was open, or the open game's bundle left: land somewhere that33+ // Nothing was open, or the open volume's bundle left: land somewhere that3434 // still exists, preferring wherever the address bar or the last session3535 // points.3636 const route = readRoute();37- await selectGame(38- route.game || readSession()?.game || state.catalog.games[0].slug,39- route.game ? route.map : undefined,37+ await selectVolume(38+ route.volume || readSession()?.volume || state.catalog.volumes[0].slug,39+ route.volume ? route.world : undefined,4040 );4141 return;4242 }4343 if (current.stamp !== previous.stamp) {44- // The open game was replaced by a newer build. Reload the map that is on44+ // The open volume was replaced by a newer build. Reload the world that is on4545 // screen through the new stamped base, carrying the exact arrangement --4646 // camera, filters, panels -- across so the swap reads as the map4747 // sharpening rather than the application starting over.
@@ -50,9 +50,9 @@ async function reconcile() {
5050 }5151 const view = state.engine?.getView();5252 state.restore = {53- game: current.slug,54- map: state.map?.slug,55- variant: state.map ? state.map.variants.indexOf(state.variant) : 0,53+ volume: current.slug,54+ world: state.world?.slug,55+ lens: state.world ? state.world.lenses.indexOf(state.lens) : 0,5656 center: view?.getCenter(),5757 zoom: view?.getZoom(),5858 hidden: [...state.hiddenCategories],
@@ -61,24 +61,24 @@ async function reconcile() {
6161 dockFolded: state.dockFolded,6262 dockDismissed: state.dockDismissed,6363 };64- await selectGame(current.slug, state.map?.slug);64+ await selectVolume(current.slug, state.world?.slug);6565 return;6666 }67- // Same game, same build: only the select needed repainting, but the old67+ // Same volume, same build: only the select needed repainting, but the old6868 // catalog objects are gone, so the state points at their replacements.69- state.game = current;70- elements.game.value = current.slug;69+ state.volume = current;70+ elements.volume.value = current.slug;7171 }7272 7373 export function syncEmptyState() {74- const empty = !state.catalog?.games?.length;74+ const empty = !state.catalog?.volumes?.length;7575 elements.emptyState.hidden = !empty;7676 if (state.catalog?.bundlesDir) elements.emptyPath.textContent = state.catalog.bundlesDir;7777 }7878 7979 // importBundles asks the backend to raise the native picker and copy the8080 // chosen files in. The watcher would notice on its own; refreshing here just81-// spares the reader the debounce wait, and the first imported game is opened81+// spares the reader the debounce wait, and the first imported volume is opened8282 // so the action lands somewhere visible.8383 export async function importBundles() {8484 for (const button of [elements.emptyOpen, elements.addBundles]) button.disabled = true;
@@ -87,8 +87,8 @@ export async function importBundles() {
8787 const outcome = await response.json().catch(() => ({}));8888 await refreshCatalog();8989 const first = outcome.imported?.[0];90- if (first && state.catalog.games.some((game) => game.slug === first)) {91- await selectGame(first);90+ if (first && state.catalog.volumes.some((volume) => volume.slug === first)) {91+ await selectVolume(first);9292 }9393 } finally {9494 for (const button of [elements.emptyOpen, elements.addBundles]) button.disabled = false;
M frontend/src/navigation.js +67 -67
@@ -25,29 +25,29 @@ import { closeDetail } from "./detail.js";
2525 import { iconOutsetColor } from "./theme.js";2626 import { clamp, formatNumber } from "./util.js";2727 28-export async function selectGame(slug, mapSlug) {29- state.game = state.catalog.games.find((game) => game.slug === slug) || state.catalog.games[0];30- // The engine exists once there is a game to size its world from: every game28+export async function selectVolume(slug, mapSlug) {29+ state.volume = state.catalog.volumes.find((volume) => volume.slug === slug) || state.catalog.volumes[0];30+ // The engine exists once there is a volume to size its world square from: every volume3131 // carries its own tile grid now that each arrives in its own bundle.3232 if (!state.engine) initializeMap();33- // Only an explicitly named map overrides what this game remembers.34- if (!mapSlug && !state.restore) state.restore = readSession(state.game.slug);35- elements.game.value = state.game.slug;36- populateSelect(elements.map, state.game.maps, "title");37- elements.map.disabled = state.game.maps.length === 1;38- elements.map.title = elements.map.disabled ? "This game has one map" : "Choose a map";39- // Returning to a game returns to where it was left, so wandering off to40- // another game and back does not cost the reader their place.41- const remembered = state.restore?.game === state.game.slug ? state.restore : null;42- const wanted = (mapSlug && state.game.maps.find((item) => item.slug === mapSlug)) ||43- (remembered && state.game.maps.find((item) => item.slug === remembered.map));44- await selectMap((wanted || state.game.maps[0]).slug);33+ // Only an explicitly named world overrides what this volume remembers.34+ if (!mapSlug && !state.restore) state.restore = readSession(state.volume.slug);35+ elements.volume.value = state.volume.slug;36+ populateSelect(elements.world, state.volume.maps, "title");37+ elements.world.disabled = state.volume.maps.length === 1;38+ elements.world.title = elements.world.disabled ? "This volume has one world" : "Choose a world";39+ // Returning to a volume returns to where it was left, so wandering off to40+ // another volume and back does not cost the reader their place.41+ const remembered = state.restore?.volume === state.volume.slug ? state.restore : null;42+ const wanted = (mapSlug && state.volume.maps.find((item) => item.slug === mapSlug)) ||43+ (remembered && state.volume.maps.find((item) => item.slug === remembered.map));44+ await selectWorld((wanted || state.volume.maps[0]).slug);4545 }4646 47-export async function selectMap(slug) {48- const entry = state.game.maps.find((map) => map.slug === slug) || state.game.maps[0];47+export async function selectWorld(slug) {48+ const entry = state.volume.maps.find((map) => map.slug === slug) || state.volume.maps[0];4949 // A map opened while another is still arriving must not be overtaken by it.50- const run = ++state.mapRun;50+ const run = ++state.worldRun;5151 elements.loading.hidden = false;5252 let loaded;5353 try {
@@ -55,20 +55,20 @@ export async function selectMap(slug) {
5555 } catch {5656 // The bundle moved underneath the catalog: refetching the catalog brings5757 // the new build's URLs, and the refresh re-selects this map through them.58- if (state.mapRun === run) {58+ if (state.worldRun === run) {5959 elements.loading.hidden = true;6060 void refreshCatalog();6161 }6262 return;6363 }64- if (state.mapRun !== run) return;64+ if (state.worldRun !== run) return;6565 6666 state.settling = true;67- state.map = loaded;67+ state.world = loaded;6868 document.documentElement.style.setProperty("--icon-outset-color", iconOutsetColor());69- elements.map.value = state.map.slug;70- populateSelect(elements.variant, state.map.variants, "name");71- elements.variantField.hidden = state.map.variants.length < 2;69+ elements.world.value = state.world.slug;70+ populateSelect(elements.lens, state.world.lenses, "name");71+ elements.lensField.hidden = state.world.lenses.length < 2;7272 state.styleCache.clear();7373 setHoveredPin(null);7474 state.gridCell = "";
@@ -78,21 +78,21 @@ export async function selectMap(slug) {
7878 // drawn but fold the index away so pin groups stay above the fold.7979 state.collapsedSections.clear();8080 state.collapsedSections.add("zones");81- for (const group of state.map.groups) {81+ for (const group of state.world.groups) {8282 for (const category of group.categories) {8383 if (!category.visible) state.hiddenCategories.add(category.id);8484 }8585 }86- const restore = state.restore?.map === state.map.slug ? state.restore : null;86+ const restore = state.restore?.map === state.world.slug ? state.restore : null;8787 if (restore) {8888 state.hiddenCategories = new Set(restore.hidden);8989 state.collapsedSections = new Set(restore.collapsed);9090 }91- // Where the corner of the screen is wanted is a preference about the game91+ // Where the corner of the screen is wanted is a preference about the volume9292 // rather than about one of its maps, so it carries across them.9393 setOverviewDocked(Boolean(state.restore?.overviewDocked), false);9494 // A map opens on the map: the panel is away until a pin or a search gives it95- // something to hold. A game that remembers otherwise is a reader who has95+ // something to hold. A volume that remembers otherwise is a reader who has9696 // already said where they want it.9797 setDockFolded(state.restore ? Boolean(state.restore.dockFolded) : true, false);9898 state.dockDismissed = Boolean(state.restore?.dockDismissed);
@@ -103,15 +103,15 @@ export async function selectMap(slug) {
103103 renderLegend();104104 renderZones();105105 buildPins();106- selectVariant(restore ? clamp(restore.variant, 0, state.map.variants.length - 1) : 0, true);106+ selectLens(restore ? clamp(restore.lens, 0, state.world.lenses.length - 1) : 0, true);107107 // A map that declares itself a sphere offers the globe; every map opens108108 // on the chart either way.109109 syncGlobe();110110 // The remembered arrangement has been spent. Kept, it would be read again by111- // the next thing that asks: a variant swap would drop the reader back where112- // the session opened, and switching to another game would hand that game the113- // dock and overview this one was left with instead of its own -- selectGame114- // only reads a game's session when nothing is held here.111+ // the next thing that asks: a lens swap would drop the reader back where112+ // the session opened, and switching to another volume would hand that volume the113+ // dock and overview this one was left with instead of its own -- selectVolume114+ // only reads a volume's session when nothing is held here.115115 state.restore = null;116116 elements.sidebar.classList.remove("is-open");117117 elements.mobileLegend.setAttribute("aria-expanded", "false");
@@ -120,16 +120,16 @@ export async function selectMap(slug) {
120120 saveSession();121121 }122122 123-export function selectVariant(index, resetView = false) {124- const priorVariant = state.variant;125- state.variant = state.map.variants[index] || state.map.variants[0];126- const variant = state.variant;127- const carried = resetView ? null : carryViewAcrossShards(priorVariant, variant);128- const maxViewZoom = viewMaxZoom(variant);129- elements.variant.value = String(state.map.variants.indexOf(state.variant));123+export function selectLens(index, resetView = false) {124+ const priorLens = state.lens;125+ state.lens = state.world.lenses[index] || state.world.lenses[0];126+ const lens = state.lens;127+ const carried = resetView ? null : carryViewAcrossShards(priorLens, lens);128+ const maxViewZoom = viewMaxZoom(lens);129+ elements.lens.value = String(state.world.lenses.indexOf(state.lens));130130 if (resetView) state.engine.setView(createView(maxViewZoom, activeExtent()));131131 else {132- // The view is rebuilt around the new variant's own window -- shards do132+ // The view is rebuilt around the new lens's own window -- shards do133133 // not share one -- but keeps the place the reader was carried to.134134 const previous = state.engine.getView();135135 const held = createView(maxViewZoom, activeExtent());
@@ -164,39 +164,39 @@ export function selectVariant(index, resetView = false) {
164164 const buildSource = (maxLevel, wanted) => trackLoading(new XYZ({165165 projection: state.projection,166166 tileGrid: new TileGrid({167- extent: [0, -state.game.tileGrid.size, state.game.tileGrid.size, 0],167+ extent: [0, -state.volume.tileGrid.size, state.volume.tileGrid.size, 0],168168 origin: [0, 0],169169 // Keep the source grid native. Views may overzoom this last resolution,170170 // but no nonexistent tile level is requested.171171 resolutions: resolutions(maxLevel),172- tileSize: state.game.tileGrid.tileSize,172+ tileSize: state.volume.tileGrid.tileSize,173173 }),174174 cacheSize: 64,175- interpolate: variant.interpolate,175+ interpolate: lens.interpolate,176176 transition: 0,177177 wrapX: false,178178 tileUrlFunction: ([zoom, x, y]) => {179- const format = variant.formats[zoom];179+ const format = lens.formats[zoom];180180 if (!format || x < 0 || y < 0 || !wanted(zoom, x, y)) return undefined;181- return `${state.game.base}/tiles/${encodeURIComponent(variant.tiles)}/${zoom}/${x}/${y}.${format}`;181+ return `${state.volume.base}/tiles/${encodeURIComponent(lens.tiles)}/${zoom}/${x}/${y}.${format}`;182182 },183183 }));184184 185- const fullZoom = variant.fullZoom ?? variant.maxZoom;186- const base = buildSource(fullZoom, (zoom, x, y) => tileExists(variant, zoom, x, y));185+ const fullZoom = lens.fullZoom ?? lens.maxZoom;186+ const base = buildSource(fullZoom, (zoom, x, y) => tileExists(lens, zoom, x, y));187187 const previous = state.layers.raster.getSource();188188 state.layers.raster.setSource(base);189189 state.layers.raster.setExtent(activeExtent());190190 // Tiles matching the map's background were never written; painting that191191 // colour behind the layer makes their absence invisible.192- state.layers.raster.setBackground(variant.background || undefined);192+ state.layers.raster.setBackground(lens.background || undefined);193193 previous?.clear();194194 195195 const previousDetail = state.layers.rasterDetail.getSource();196- if (variant.maxZoom > fullZoom) {196+ if (lens.maxZoom > fullZoom) {197197 state.layers.rasterDetail.setSource(buildSource(198- variant.maxZoom,199- (zoom, x, y) => zoom > fullZoom && tileExists(variant, zoom, x, y),198+ lens.maxZoom,199+ (zoom, x, y) => zoom > fullZoom && tileExists(lens, zoom, x, y),200200 ));201201 state.layers.rasterDetail.setExtent(activeExtent());202202 state.layers.rasterDetail.setVisible(true);
@@ -213,15 +213,15 @@ export function selectVariant(index, resetView = false) {
213213 }214214 state.overviewKey = "";215215 renderOverview();216- // Only a map being opened has a view to restore. A variant is a different216+ // Only a world being opened has a view to restore. A lens is a different217217 // picture of the ground the reader is already looking at -- spring for218218 // summer, one layer of a split map for another -- so the swap is made219219 // underneath them and everything else, the view included, stays as it is.220- const resume = resetView && state.restore?.map === state.map.slug ? state.restore : null;221- // Zones and pins are built before a variant is chosen, so on a split map the220+ const resume = resetView && state.restore?.map === state.world.slug ? state.restore : null;221+ // Zones and pins are built before a lens is chosen, so on a split world the222222 // first render shows every layer at once. Comparing against what was actually223223 // rendered catches that as well as a later switch between layers.224- if (state.renderedShard !== (variant.shard || 0)) {224+ if (state.renderedShard !== (lens.shard || 0)) {225225 renderZones();226226 applyPinFilters();227227 }
@@ -248,18 +248,18 @@ export function selectVariant(index, resetView = false) {
248248 // fullZoom exist only where the capture reached. Asking for a tile that was249249 // never emitted would be a wasted request and a 404, so consult the coverage250250 // bitset first and let OpenLayers show the parent tile instead.251-export function tileExists(variant, zoom, x, y) {252- const coverage = variant.coverage?.[zoom];251+export function tileExists(lens, zoom, x, y) {252+ const coverage = lens.coverage?.[zoom];253253 if (!coverage) return true;254254 const column = x - coverage.x;255255 const row = y - coverage.y;256256 if (column < 0 || row < 0 || column >= coverage.w || row >= coverage.h) return false;257- const bits = coverageBits(variant, zoom, coverage);257+ const bits = coverageBits(lens, zoom, coverage);258258 const index = row * coverage.w + column;259259 return (bits[index >> 3] & (1 << (index & 7))) !== 0;260260 }261261 262-export function coverageBits(variant, zoom, coverage) {262+export function coverageBits(lens, zoom, coverage) {263263 if (!coverage.decoded) {264264 const binary = atob(coverage.bits);265265 const bytes = new Uint8Array(binary.length);
@@ -269,8 +269,8 @@ export function coverageBits(variant, zoom, coverage) {
269269 return coverage.decoded;270270 }271271 272-export function viewMaxZoom(variant) {273- return variant.maxZoom + overzoomLevels;272+export function viewMaxZoom(lens) {273+ return lens.maxZoom + overzoomLevels;274274 }275275 276276 // What a view owes the rest of the page once it has come to rest.
@@ -306,18 +306,18 @@ export function toggleSidebar() {
306306 }307307 308308 export function activeExtent() {309- const size = state.game.tileGrid.size;310- const bounds = state.variant?.bounds || { x: 0, y: 0, width: size, height: size };309+ const size = state.volume.tileGrid.size;310+ const bounds = state.lens?.bounds || { x: 0, y: 0, width: size, height: size };311311 return [bounds.x, -(bounds.y + bounds.height), bounds.x + bounds.width, -bounds.y];312312 }313313 314314 export function fitMap() {315- if (!state.engine || !state.variant) return;315+ if (!state.engine || !state.lens) return;316316 const view = state.engine.getView();317317 view.fit(activeExtent(), {318318 size: state.engine.getSize(),319319 padding: [36, 36, 36, 36],320- maxZoom: state.variant.maxZoom,320+ maxZoom: state.lens.maxZoom,321321 duration: 0,322322 });323323 state.fitZoom = view.getZoom() || 0;
@@ -328,7 +328,7 @@ export function changeZoom(delta) {
328328 const view = state.engine.getView();329329 const current = view.getZoom() || 0;330330 view.animate({331- zoom: clamp(current + delta, state.variant.minZoom, viewMaxZoom(state.variant)),331+ zoom: clamp(current + delta, state.lens.minZoom, viewMaxZoom(state.lens)),332332 duration: 140,333333 });334334 }
M frontend/src/overview.js +15 -15
@@ -8,17 +8,17 @@ import { state } from "./state.js";
88 import { clamp } from "./util.js";99 1010 export function renderOverview() {11- const variant = state.variant;11+ const lens = state.lens;1212 const canvas = elements.overviewCanvas;1313 const context = canvas.getContext("2d");1414 const extent = activeExtent();15- const world = state.game.tileGrid.size;16- const tileSize = state.game.tileGrid.tileSize;15+ const world = state.volume.tileGrid.size;16+ const tileSize = state.volume.tileGrid.tileSize;1717 const width = extent[2] - extent[0];1818 const height = extent[3] - extent[1];1919 2020 let level = 0;21- while (level < variant.fullZoom &&21+ while (level < lens.fullZoom &&2222 (Math.max(width, height) / world) * tileSize * (2 ** level) < overviewTargetSize) {2323 level++;2424 }
@@ -26,20 +26,20 @@ export function renderOverview() {
2626 canvas.width = Math.max(1, Math.round(width * scale));2727 canvas.height = Math.max(1, Math.round(height * scale));2828 context.clearRect(0, 0, canvas.width, canvas.height);29- if (variant.background) {30- context.fillStyle = variant.background;29+ if (lens.background) {30+ context.fillStyle = lens.background;3131 context.fillRect(0, 0, canvas.width, canvas.height);3232 }3333 3434 const run = ++state.overviewRun;35- const format = variant.formats[level];35+ const format = lens.formats[level];3636 const first = Math.floor((extent[0] / world) * (2 ** level));3737 const last = Math.ceil((extent[2] / world) * (2 ** level));3838 const top = Math.floor((-extent[3] / world) * (2 ** level));3939 const bottom = Math.ceil((-extent[1] / world) * (2 ** level));4040 for (let y = top; y < bottom; y++) {4141 for (let x = first; x < last; x++) {42- if (!format || !tileExists(variant, level, x, y)) continue;42+ if (!format || !tileExists(lens, level, x, y)) continue;4343 const image = new Image();4444 image.onload = () => {4545 if (state.overviewRun !== run) return;
@@ -51,7 +51,7 @@ export function renderOverview() {
5151 tileSize,5252 );5353 };54- image.src = `${state.game.base}/tiles/${encodeURIComponent(variant.tiles)}/${level}/${x}/${y}.${format}`;54+ image.src = `${state.volume.base}/tiles/${encodeURIComponent(lens.tiles)}/${level}/${x}/${y}.${format}`;5555 }5656 }5757 updateOverviewViewport();
@@ -65,8 +65,8 @@ export function updateOverviewViewport() {
6565 // same flat chart the corner has always drawn.6666 const camera = globeCamera();6767 if (camera) {68- const mapping = equirectMapping(state.map);69- if (!mapping || !state.variant) return;68+ const mapping = equirectMapping(state.world);69+ if (!mapping || !state.lens) return;7070 const extent = activeExtent();7171 const [worldX, worldY] = mapping.toWorld(camera.lat, camera.lng);7272 const canvas = elements.overviewCanvas;
@@ -83,7 +83,7 @@ export function updateOverviewViewport() {
8383 return;8484 }8585 const view = state.engine?.getView();86- if (!view || !state.variant) return;86+ if (!view || !state.lens) return;8787 const extent = activeExtent();8888 const visible = view.calculateExtent(state.engine.getSize());8989 const width = extent[2] - extent[0];
@@ -120,7 +120,7 @@ export function updateOverviewViewport() {
120120 // Put away rather than switched off: the overview keeps drawing, and the handle121121 // it leaves behind is the whole of the way back. A reader who wants the corner122122 // of their map usually wants it for that map's whole session, so the choice is123-// remembered with the rest of what a game is left in.123+// remembered with the rest of what a volume is left in.124124 export function setOverviewDocked(docked, remember = true) {125125 state.overviewDocked = docked;126126 // A sweep in progress ends where it is rather than following the panel out.
@@ -146,7 +146,7 @@ export function overviewNavigate(event, ease) {
146146 // The same press steers whichever pane is showing: the chart's window, or147147 // the globe turned to face the point under the finger.148148 if (state.globeActive) {149- const mapping = equirectMapping(state.map);149+ const mapping = equirectMapping(state.world);150150 if (!mapping) return;151151 const worldX = extent[0] + fraction(event.clientX, rect.left, rect.right) * (extent[2] - extent[0]);152152 const worldY = -extent[3] + fraction(event.clientY, rect.top, rect.bottom) * (extent[3] - extent[1]);
@@ -155,7 +155,7 @@ export function overviewNavigate(event, ease) {
155155 return;156156 }157157 const view = state.engine?.getView();158- if (!view || !state.variant) return;158+ if (!view || !state.lens) return;159159 const center = [160160 extent[0] + fraction(event.clientX, rect.left, rect.right) * (extent[2] - extent[0]),161161 extent[3] - fraction(event.clientY, rect.top, rect.bottom) * (extent[3] - extent[1]),
M frontend/src/pins.js +3 -3
M frontend/src/search.js +1 -1
M frontend/src/semconv.js +2 -2
M frontend/src/session.js +19 -19
@@ -1,20 +1,20 @@
11 import { sessionKey } from "./constants.js";22 import { state } from "./state.js";33 4-// Kept per game rather than as a single place, so wandering off to another5-// game and coming back does not cost the reader where they were in this one.4+// Kept per volume rather than as a single place, so wandering off to another5+// volume and coming back does not cost the reader where they were in this one.66 export function saveSession() {7- // Nothing is written while a map is being swapped in: the arrangement is7+ // Nothing is written while a world is being swapped in: the arrangement is88 // half the old one and half the new until it settles.9- if (!state.map || !state.variant || state.settling) return;9+ if (!state.world || !state.lens || state.settling) return;1010 const view = state.engine?.getView();1111 try {1212 const stored = allSessions();13- stored.last = state.game.slug;14- stored.games[state.game.slug] = {15- game: state.game.slug,16- map: state.map.slug,17- variant: state.map.variants.indexOf(state.variant),13+ stored.last = state.volume.slug;14+ stored.volumes[state.volume.slug] = {15+ volume: state.volume.slug,16+ world: state.world.slug,17+ lens: state.world.lenses.indexOf(state.lens),1818 center: view?.getCenter(),1919 zoom: view?.getZoom(),2020 hidden: [...state.hiddenCategories],
@@ -32,30 +32,30 @@ export function saveSession() {
3232 export function allSessions() {3333 try {3434 const stored = JSON.parse(localStorage.getItem(sessionKey) || "null");35- if (stored && stored.games) return stored;35+ if (stored && stored.volumes) return stored;3636 } catch {3737 // Falls through to a fresh record.3838 }39- return { last: "", games: {} };39+ return { last: "", volumes: {} };4040 }4141 42-export function readSession(gameSlug) {42+export function readSession(volumeSlug) {4343 const stored = allSessions();44- const wanted = gameSlug || stored.last;45- const entry = wanted && stored.games[wanted];46- return entry && entry.game && entry.map ? entry : null;44+ const wanted = volumeSlug || stored.last;45+ const entry = wanted && stored.volumes[wanted];46+ return entry && entry.volume && entry.world ? entry : null;4747 }4848 4949 export function readRoute() {50- const [game, map] = decodeURIComponent(location.hash.replace(/^#\/?/, ""))50+ const [volume, world] = decodeURIComponent(location.hash.replace(/^#\/?/, ""))5151 .split("/")5252 .map((part) => part.trim());53- return { game, map };53+ return { volume, world };5454 }5555 5656 export function writeRoute() {57- if (!state.game || !state.map) return;58- const route = `#${state.game.slug}/${state.map.slug}`;57+ if (!state.volume || !state.world) return;58+ const route = `#${state.volume.slug}/${state.world.slug}`;5959 if (location.hash === route) return;6060 // Replaced rather than pushed: this records a location, not a trail.6161 history.replaceState(null, "", route);
M frontend/src/state.js +7 -7
M frontend/src/styles.js +1 -1
M frontend/src/theme.js +4 -4
M frontend/src/zones.js +6 -6
@@ -13,8 +13,8 @@ import { colorFor } from "./theme.js";
1313 import { formatNumber } from "./util.js";1414 1515 export function renderZones() {16- const zones = (state.map.zones || []).filter(onActiveShard);17- state.renderedShard = state.variant?.shard || 0;16+ const zones = (state.world.zones || []).filter(onActiveShard);17+ state.renderedShard = state.lens?.shard || 0;1818 state.sources.zones.clear();1919 state.sources.zoneTitles.clear();2020 state.zoneRecords.clear();
@@ -177,7 +177,7 @@ export function jumpToZone(zoneID) {
177177 state.engine.getView().fit(record.extent, {178178 size: state.engine.getSize(),179179 padding: [54, 54, 54, 54],180- maxZoom: viewMaxZoom(state.variant),180+ maxZoom: viewMaxZoom(state.lens),181181 duration: 220,182182 });183183 elements.sidebar.classList.remove("is-open");
@@ -227,7 +227,7 @@ export function projectZoneGeometry(rawGeometry) {
227227 }228228 229229 // A pin arrives as a latitude and longitude in the source tile grid, which is230-// not the same grid for every game: most maps are cut from a 32-tile square at230+// not the same grid for every volume: most worlds are cut from a 32-tile square at231231 // zoom 13, and a map cut from a window of its own carries where that window232232 // sits. Both describe the same world square, so everything downstream of this233233 // -- the view, the overview, the geohash grid -- works in units either way.
@@ -244,7 +244,7 @@ export function project(latitude, longitude) {
244244 }245245 246246 export function mapTileGrid() {247- const shared = state.game.tileGrid;248- const own = state.map?.grid;247+ const shared = state.volume.tileGrid;248+ const own = state.world?.grid;249249 return own ? { ...shared, ...own } : shared;250250 }
M frontend/test/cellsystems.test.mjs +4 -4
M internal/arcgismap/arcgismap.go +5 -4
M internal/arcgismap/arcgismap_test.go +1 -1
M internal/bundle/bundle.go +53 -45
@@ -1,12 +1,17 @@
1-// Package bundle defines the .atlas file: one game, complete, in one zip2-// archive. A bundle carries everything the viewer needs to draw its game --3-// map payloads, tile pyramids, category icons -- behind a manifest naming what4-// is inside, so the application can list a game without reading past the1+// Package bundle defines the .atlas file: one volume, complete, in one zip2+// archive. A volume is the subject of an atlas -- a game, a planet, a city --3+// and its bundle carries everything the viewer needs to draw it: world4+// payloads, tile pyramids, category icons, behind a manifest naming what is5+// inside, so the application can list a volume without reading past the56 // manifest and can serve it without unpacking anything to disk.67 //7-// The format is Atlas's own. It carries no trace of where a game's data was8-// captured from; a producer flattens whatever its source looks like into this9-// shape, and the application only ever sees this shape.8+// The format is Atlas's own, and so are its words. A volume holds worlds --9+// the distinct grounds a reader can stand on, which for a game are its maps10+// and for a captured city are its dated revisions -- and each world is seen11+// through one or more lenses, the rasters that picture it. The format12+// carries no trace of where a volume's data was captured from; a producer13+// flattens whatever its source looks like into this shape, and the14+// application only ever sees this shape.1015 package bundle1116 1217 import (
@@ -19,8 +24,10 @@ const (
1924 // .atlas is refused by name rather than by whatever fails first.2025 Format = "atlas-bundle"2126 // FormatVersion is bumped when the layout changes shape. A reader refuses22- // versions it does not know rather than guessing at them.23- FormatVersion = 127+ // versions it does not know rather than guessing at them. Version 228+ // renamed the format's concepts -- game to volume, map to world, variant29+ // to lens -- through the manifest and payload keys alike.30+ FormatVersion = 22431 2532 // ManifestName is the entry the whole bundle is read through. The writer2633 // places it first in the archive so a listing shows it first, though the
@@ -28,8 +35,8 @@ const (
2835 ManifestName = "atlas.json"2936 )3037 31-// Manifest is what a bundle says about itself: which game it is, which build32-// of that game's data it carries, and which maps are inside.38+// Manifest is what a bundle says about itself: which volume it is, which39+// build of that volume's data it carries, and which worlds are inside.3340 //3441 // Conventions names the semantic-convention vocabulary the payloads were3542 // written against; zero is a bundle from before the conventions existed.
@@ -38,24 +45,24 @@ const (
3845 // but validation is stricter about a bundle that declares than one that3946 // does not.4047 type Manifest struct {41- Format string `json:"format"`42- FormatVersion int `json:"formatVersion"`43- Conventions int `json:"conventions,omitempty"`44- Game Game `json:"game"`45- Version Version `json:"version"`46- TileGrid TileGrid `json:"tileGrid"`47- Maps []MapEntry `json:"maps"`48+ Format string `json:"format"`49+ FormatVersion int `json:"formatVersion"`50+ Conventions int `json:"conventions,omitempty"`51+ Volume Volume `json:"volume"`52+ Version Version `json:"version"`53+ TileGrid TileGrid `json:"tileGrid"`54+ Worlds []WorldEntry `json:"worlds"`4855 }4956 50-// Game is the identity a bundle claims. The slug is the identity proper: two51-// bundles naming the same slug are two versions of the same game, however52-// their files are named.53-type Game struct {57+// Volume is the identity a bundle claims. The slug is the identity proper:58+// two bundles naming the same slug are two versions of the same volume,59+// however their files are named.60+type Volume struct {5461 Slug string `json:"slug"`5562 Title string `json:"title"`5663 }5764 58-// Version distinguishes builds of the same game. The stamp is a content65+// Version distinguishes builds of the same volume. The stamp is a content5966 // fingerprint -- two bundles with equal stamps hold the same data -- and6067 // CreatedAt orders them, so a newer bundle dropped beside an older one wins.6168 // Revision orders builds of the same capture: the data has not moved, but
@@ -68,10 +75,10 @@ type Version struct {
6875 Revision int `json:"revision,omitempty"`6976 }7077 71-// TileGrid is the window this game's maps are cut from: the zoom the source72-// was captured at, where the first tile sits, and how big a tile and the world73-// are. A map cut from a window of its own overrides part of this in its own74-// payload.78+// TileGrid is the window this volume's worlds are cut from: the zoom the79+// source was captured at, where the first tile sits, and how big a tile and80+// the world square are. A world cut from a window of its own overrides part81+// of this in its own payload.7582 type TileGrid struct {7683 SourceZoom int `json:"sourceZoom"`7784 FirstTile int `json:"firstTile"`
@@ -79,17 +86,18 @@ type TileGrid struct {
7986 Size int `json:"size"`8087 }8188 82-// Coordinate is a point in map space, in the latitude and longitude of the83-// game's own projection.89+// Coordinate is a point in world space, in the latitude and longitude of the90+// volume's own projection.8491 type Coordinate struct {8592 Lat float64 `json:"lat"`8693 Lng float64 `json:"lng"`8794 }8895 89-// MapEntry lists one map: enough to offer it and to open it, and nothing that90-// only matters once it is open. The slug names the map's payload entries --91-// maps/<slug>.json, .bin, and .text -- and is the map's identity everywhere.92-type MapEntry struct {96+// WorldEntry lists one world: enough to offer it and to open it, and nothing97+// that only matters once it is open. The slug names the world's payload98+// entries -- worlds/<slug>.json, .bin, and .text -- and is the world's99+// identity everywhere.100+type WorldEntry struct {93101 Slug string `json:"slug"`94102 Title string `json:"title"`95103 Parent string `json:"parent,omitempty"`
@@ -109,28 +117,28 @@ func (m Manifest) Validate() error {
109117 if m.FormatVersion != FormatVersion {110118 return fmt.Errorf("format version is %d, and this reads %d", m.FormatVersion, FormatVersion)111119 }112- if err := validSlug(m.Game.Slug); err != nil {113- return fmt.Errorf("game slug: %w", err)120+ if err := validSlug(m.Volume.Slug); err != nil {121+ return fmt.Errorf("volume slug: %w", err)114122 }115- if m.Game.Title == "" {116- return fmt.Errorf("game %s has no title", m.Game.Slug)123+ if m.Volume.Title == "" {124+ return fmt.Errorf("volume %s has no title", m.Volume.Slug)117125 }118126 if m.Version.Stamp == "" || m.Version.CreatedAt == "" {119- return fmt.Errorf("game %s carries no version", m.Game.Slug)127+ return fmt.Errorf("volume %s carries no version", m.Volume.Slug)120128 }121- if len(m.Maps) == 0 {122- return fmt.Errorf("game %s lists no maps", m.Game.Slug)129+ if len(m.Worlds) == 0 {130+ return fmt.Errorf("volume %s lists no worlds", m.Volume.Slug)123131 }124- seen := make(map[string]bool, len(m.Maps))125- for _, entry := range m.Maps {132+ seen := make(map[string]bool, len(m.Worlds))133+ for _, entry := range m.Worlds {126134 if err := validSlug(entry.Slug); err != nil {127- return fmt.Errorf("map slug: %w", err)135+ return fmt.Errorf("world slug: %w", err)128136 }129137 if entry.Title == "" {130- return fmt.Errorf("map %s has no title", entry.Slug)138+ return fmt.Errorf("world %s has no title", entry.Slug)131139 }132140 if seen[entry.Slug] {133- return fmt.Errorf("map slug %s is listed twice", entry.Slug)141+ return fmt.Errorf("world slug %s is listed twice", entry.Slug)134142 }135143 seen[entry.Slug] = true136144 }
M internal/bundle/bundle_test.go +27 -27
@@ -16,9 +16,9 @@ func validManifest() bundle.Manifest {
1616 return bundle.Manifest{1717 Format: bundle.Format,1818 FormatVersion: bundle.FormatVersion,19- Game: bundle.Game{Slug: "fixture", Title: "Fixture"},19+ Volume: bundle.Volume{Slug: "fixture", Title: "Fixture"},2020 Version: bundle.Version{Stamp: "abc", CreatedAt: "2026-01-01T00:00:00Z"},21- Maps: []bundle.MapEntry{{Slug: "overworld", Title: "Overworld"}},21+ Worlds: []bundle.WorldEntry{{Slug: "overworld", Title: "Overworld"}},2222 }2323 }2424
@@ -29,15 +29,15 @@ func TestManifestValidation(t *testing.T) {
2929 cases := map[string]func(*bundle.Manifest){3030 "wrong format": func(m *bundle.Manifest) { m.Format = "zip-of-things" },3131 "unknown version": func(m *bundle.Manifest) { m.FormatVersion = 99 },32- "empty game slug": func(m *bundle.Manifest) { m.Game.Slug = "" },33- "unsafe game slug": func(m *bundle.Manifest) { m.Game.Slug = "../escape" },34- "uppercase game slug": func(m *bundle.Manifest) { m.Game.Slug = "Fallout76" },35- "untitled game": func(m *bundle.Manifest) { m.Game.Title = "" },32+ "empty game slug": func(m *bundle.Manifest) { m.Volume.Slug = "" },33+ "unsafe game slug": func(m *bundle.Manifest) { m.Volume.Slug = "../escape" },34+ "uppercase game slug": func(m *bundle.Manifest) { m.Volume.Slug = "Fallout76" },35+ "untitled game": func(m *bundle.Manifest) { m.Volume.Title = "" },3636 "missing stamp": func(m *bundle.Manifest) { m.Version.Stamp = "" },3737 "missing created at": func(m *bundle.Manifest) { m.Version.CreatedAt = "" },38- "no maps": func(m *bundle.Manifest) { m.Maps = nil },39- "unsafe map slug": func(m *bundle.Manifest) { m.Maps[0].Slug = "a/b" },40- "duplicate map slugs": func(m *bundle.Manifest) { m.Maps = append(m.Maps, m.Maps[0]) },38+ "no maps": func(m *bundle.Manifest) { m.Worlds = nil },39+ "unsafe map slug": func(m *bundle.Manifest) { m.Worlds[0].Slug = "a/b" },40+ "duplicate map slugs": func(m *bundle.Manifest) { m.Worlds = append(m.Worlds, m.Worlds[0]) },4141 }4242 for name, corrupt := range cases {4343 manifest := validManifest()
@@ -53,15 +53,15 @@ func TestWriterRefusesUnsafeAndRepeatedEntries(t *testing.T) {
5353 if err != nil {5454 t.Fatal(err)5555 }56- for _, name := range []string{"", "/etc/hosts", "maps/../escape", "tiles/", bundle.ManifestName} {56+ for _, name := range []string{"", "/etc/hosts", "worlds/../escape", "tiles/", bundle.ManifestName} {5757 if err := writer.AddDeflated(name, []byte("x")); err == nil {5858 t.Errorf("entry %q is accepted", name)5959 }6060 }61- if err := writer.AddDeflated("maps/overworld.json", []byte("{}")); err != nil {61+ if err := writer.AddDeflated("worlds/overworld.json", []byte("{}")); err != nil {6262 t.Fatal(err)6363 }64- if err := writer.AddDeflated("maps/overworld.json", []byte("{}")); err == nil {64+ if err := writer.AddDeflated("worlds/overworld.json", []byte("{}")); err == nil {6565 t.Error("the same entry is accepted twice")6666 }6767 }
@@ -69,7 +69,7 @@ func TestWriterRefusesUnsafeAndRepeatedEntries(t *testing.T) {
6969 func TestOpenRoundTripsWhatBuildWrites(t *testing.T) {7070 path := bundletest.Build(t, t.TempDir(), bundletest.Spec{7171 Slug: "fixture",72- Maps: []bundletest.MapSpec{{72+ Worlds: []bundletest.WorldSpec{{7373 Slug: "overworld",7474 Pins: []bundletest.Pin{{Title: "Origin", Lat: 12.5, Lng: -3.25}, {Title: "Peak", Lat: 80, Lng: 170}},7575 }},
@@ -80,17 +80,17 @@ func TestOpenRoundTripsWhatBuildWrites(t *testing.T) {
8080 }8181 defer opened.Close()8282 83- if opened.Manifest.Game.Slug != "fixture" {84- t.Errorf("game slug = %q", opened.Manifest.Game.Slug)83+ if opened.Manifest.Volume.Slug != "fixture" {84+ t.Errorf("game slug = %q", opened.Manifest.Volume.Slug)8585 }86- if got := opened.Manifest.Maps[0].PinCount; got != 2 {86+ if got := opened.Manifest.Worlds[0].PinCount; got != 2 {8787 t.Errorf("pin count = %d, want 2", got)8888 }8989 if err := opened.Validate(); err != nil {9090 t.Errorf("a fixture bundle fails validation: %v", err)9191 }9292 93- packed, err := opened.ReadEntry("maps/overworld.bin")93+ packed, err := opened.ReadEntry("worlds/overworld.bin")9494 if err != nil {9595 t.Fatal(err)9696 }
@@ -141,7 +141,7 @@ func TestValidateCatchesBrokenPromises(t *testing.T) {
141141 142142 // The manifest promises two maps; only one is written.143143 manifest := validManifest()144- manifest.Maps = append(manifest.Maps, bundle.MapEntry{Slug: "underworld", Title: "Underworld"})144+ manifest.Worlds = append(manifest.Worlds, bundle.WorldEntry{Slug: "underworld", Title: "Underworld"})145145 path := filepath.Join(dir, "fixture.atlas")146146 file, err := os.Create(path)147147 if err != nil {
@@ -157,10 +157,10 @@ func TestValidateCatchesBrokenPromises(t *testing.T) {
157157 t.Fatal(err)158158 }159159 }160- must(writer.AddDeflated("maps/overworld.json",161- []byte(`{"variants":[{"tiles":"overworld","minZoom":0,"maxZoom":0,"formats":["jpg"]}],"groups":[]}`)))162- must(writer.AddStored("maps/overworld.bin", bytes.NewReader(bundle.PackLocations(nil))))163- must(writer.AddDeflated("maps/overworld.text", []byte(`{}`)))160+ must(writer.AddDeflated("worlds/overworld.json",161+ []byte(`{"lenses":[{"tiles":"overworld","minZoom":0,"maxZoom":0,"formats":["jpg"]}],"groups":[]}`)))162+ must(writer.AddStored("worlds/overworld.bin", bytes.NewReader(bundle.PackLocations(nil))))163+ must(writer.AddDeflated("worlds/overworld.text", []byte(`{}`)))164164 must(writer.AddStored("tiles/overworld/0/0/0.jpg", bytes.NewReader([]byte("raster"))))165165 must(writer.Close())166166 file.Close()
@@ -179,7 +179,7 @@ func TestValidateRefusesRuntimeURLsAndWrongCounts(t *testing.T) {
179179 build := func(text string, pins int) *bundle.Bundle {180180 t.Helper()181181 manifest := validManifest()182- manifest.Maps[0].PinCount = pins182+ manifest.Worlds[0].PinCount = pins183183 path := filepath.Join(t.TempDir(), "fixture.atlas")184184 file, err := os.Create(path)185185 if err != nil {
@@ -190,11 +190,11 @@ func TestValidateRefusesRuntimeURLsAndWrongCounts(t *testing.T) {
190190 t.Fatal(err)191191 }192192 steps := []error{193- writer.AddDeflated("maps/overworld.json",194- []byte(`{"variants":[{"tiles":"overworld","minZoom":0,"maxZoom":0,"formats":["jpg"]}],"groups":[]}`)),195- writer.AddStored("maps/overworld.bin",193+ writer.AddDeflated("worlds/overworld.json",194+ []byte(`{"lenses":[{"tiles":"overworld","minZoom":0,"maxZoom":0,"formats":["jpg"]}],"groups":[]}`)),195+ writer.AddStored("worlds/overworld.bin",196196 bytes.NewReader(bundle.PackLocations([]bundle.Location{{ID: 1, Title: "Origin"}}))),197- writer.AddDeflated("maps/overworld.text", []byte(text)),197+ writer.AddDeflated("worlds/overworld.text", []byte(text)),198198 writer.AddStored("tiles/overworld/0/0/0.jpg", bytes.NewReader([]byte("raster"))),199199 writer.Close(),200200 file.Close(),
M internal/bundle/bundletest/bundletest.go +15 -15
@@ -14,7 +14,7 @@ import (
1414 "github.com/FelineStateMachine/atlas/internal/bundle"1515 )1616 17-// Spec describes one fixture game. Zero values are filled with something17+// Spec describes one fixture volume. Zero values are filled with something1818 // plausible, so a test that only cares about, say, the slug states the slug1919 // and nothing else.2020 type Spec struct {
@@ -23,14 +23,14 @@ type Spec struct {
2323 CreatedAt string2424 Stamp string2525 Revision int26- Maps []MapSpec26+ Worlds []WorldSpec2727 }2828 29-// MapSpec describes one map of a fixture game: a single layer two zoom29+// WorldSpec describes one world of a fixture volume: a single layer two zoom3030 // levels deep, one category, and the given pins. Merged, when set, rides31-// into the payload's merged block verbatim, so a test can hand a map the31+// into the payload's merged block verbatim, so a test can hand a world the3232 // provenance ledger a real composition would have written.33-type MapSpec struct {33+type WorldSpec struct {3434 Slug string3535 Title string3636 Pins []Pin
@@ -60,22 +60,22 @@ func Build(t testing.TB, dir string, spec Spec) string {
6060 if spec.Stamp == "" {6161 spec.Stamp = bundle.HashBytes([]byte(spec.Slug + spec.CreatedAt))6262 }63- if len(spec.Maps) == 0 {64- spec.Maps = []MapSpec{{Slug: "overworld", Pins: []Pin{{Title: "Origin"}}}}63+ if len(spec.Worlds) == 0 {64+ spec.Worlds = []WorldSpec{{Slug: "overworld", Pins: []Pin{{Title: "Origin"}}}}6565 }6666 6767 manifest := bundle.Manifest{6868 Format: bundle.Format,6969 FormatVersion: bundle.FormatVersion,70- Game: bundle.Game{Slug: spec.Slug, Title: spec.Title},70+ Volume: bundle.Volume{Slug: spec.Slug, Title: spec.Title},7171 Version: bundle.Version{Stamp: spec.Stamp, CreatedAt: spec.CreatedAt, Revision: spec.Revision},7272 TileGrid: bundle.TileGrid{SourceZoom: 13, FirstTile: 4064, TileSize: 256, Size: 8192},7373 }74- for _, m := range spec.Maps {74+ for _, m := range spec.Worlds {7575 if m.Title == "" {7676 m.Title = m.Slug7777 }78- manifest.Maps = append(manifest.Maps, bundle.MapEntry{78+ manifest.Worlds = append(manifest.Worlds, bundle.WorldEntry{7979 Slug: m.Slug,8080 Title: m.Title,8181 PinCount: len(m.Pins),
@@ -94,9 +94,9 @@ func Build(t testing.TB, dir string, spec Spec) string {
9494 t.Fatal(err)9595 }9696 97- for _, m := range spec.Maps {97+ for _, m := range spec.Worlds {9898 detail := map[string]any{99- "variants": []map[string]any{{99+ "lenses": []map[string]any{{100100 "name": "Default",101101 "tiles": m.Slug,102102 "minZoom": 0,
@@ -121,7 +121,7 @@ func Build(t testing.TB, dir string, spec Spec) string {
121121 if err != nil {122122 t.Fatal(err)123123 }124- add(t, writer.AddDeflated("maps/"+m.Slug+".json", payload))124+ add(t, writer.AddDeflated("worlds/"+m.Slug+".json", payload))125125 126126 locations := make([]bundle.Location, len(m.Pins))127127 text := make(map[string]any)
@@ -142,12 +142,12 @@ func Build(t testing.TB, dir string, spec Spec) string {
142142 text[strconv.Itoa(index+1)] = map[string]string{"d": description}143143 }144144 packed := bundle.PackLocations(locations)145- add(t, writer.AddStored("maps/"+m.Slug+".bin", bytes.NewReader(packed)))145+ add(t, writer.AddStored("worlds/"+m.Slug+".bin", bytes.NewReader(packed)))146146 notes, err := json.Marshal(text)147147 if err != nil {148148 t.Fatal(err)149149 }150- add(t, writer.AddDeflated("maps/"+m.Slug+".text", notes))150+ add(t, writer.AddDeflated("worlds/"+m.Slug+".text", notes))151151 152152 for _, tile := range []string{"0/0/0.jpg", "1/0/0.jpg"} {153153 raster := []byte("jpeg bytes of " + m.Slug + "/" + tile)
M internal/bundle/locations.go +1 -1
M internal/bundle/read.go +37 -38
@@ -14,7 +14,7 @@ import (
1414 )1515 1616 // maxManifestSize bounds what Open will read as a manifest. A manifest lists17-// a game's maps and nothing per pin, so a megabyte is already generous; a17+// a volume's worlds and nothing per pin, so a megabyte is already generous; a1818 // larger one is some other file wearing the name.1919 const maxManifestSize = 1 << 202020
@@ -122,16 +122,16 @@ func (b *Bundle) Close() error {
122122 return b.archive.Close()123123 }124124 125-// payloadPeek is the sliver of a map payload that validation reads: which125+// payloadPeek is the sliver of a world payload that validation reads: which126126 // pyramids its layers draw from, which icons its categories name, and what127127 // the payload says of itself in the shared conventions.128128 type payloadPeek struct {129- Variants []struct {129+ Lenses []struct {130130 Tiles string `json:"tiles"`131131 MinZoom int `json:"minZoom"`132132 MaxZoom int `json:"maxZoom"`133133 Formats []string `json:"formats"`134- } `json:"variants"`134+ } `json:"lenses"`135135 Groups []struct {136136 Categories []struct {137137 IconAsset string `json:"iconAsset"`
@@ -148,9 +148,8 @@ type textPeek struct {
148148 Attrs map[string]string `json:"a"`149149 }150150 151-// Validate checks the manifest's promises against the archive: every listed152-// map has its three payloads, the packed locations agree with the advertised153-// pin count, every layer's tile levels hold tiles, every named icon exists,151+// Validate checks the manifest's promises against the archive: // world has its three payloads, the packed locations agree with the advertised152+// pin count, every lens's tile levels hold tiles, every named icon exists,154153 // and nothing carries a live URL -- Atlas runs with no network, so a URL in a155154 // bundle is dead weight at best. Producers and importers run this; opening a156155 // bundle at launch does not.
@@ -162,51 +161,51 @@ func (b *Bundle) Validate() error {
162161 }163162 }164163 165- for _, entry := range b.Manifest.Maps {166- detail, err := b.ReadEntry("maps/" + entry.Slug + ".json")164+ for _, entry := range b.Manifest.Worlds {165+ detail, err := b.ReadEntry("worlds/" + entry.Slug + ".json")167166 if err != nil {168- return fmt.Errorf("map %s: %w", entry.Slug, err)167+ return fmt.Errorf("world %s: %w", entry.Slug, err)169168 }170- text, err := b.ReadEntry("maps/" + entry.Slug + ".text")169+ text, err := b.ReadEntry("worlds/" + entry.Slug + ".text")171170 if err != nil {172- return fmt.Errorf("map %s: %w", entry.Slug, err)171+ return fmt.Errorf("world %s: %w", entry.Slug, err)173172 }174173 for _, payload := range [][]byte{detail, text} {175174 for _, scheme := range []string{"http://", "https://"} {176175 if at := strings.Index(string(payload), scheme); at >= 0 {177- return fmt.Errorf("map %s carries a runtime URL: %q",176+ return fmt.Errorf("world %s carries a runtime URL: %q",178177 entry.Slug, payload[at:min(at+120, len(payload))])179178 }180179 }181180 }182181 183- packed, err := b.ReadEntry("maps/" + entry.Slug + ".bin")182+ packed, err := b.ReadEntry("worlds/" + entry.Slug + ".bin")184183 if err != nil {185- return fmt.Errorf("map %s: %w", entry.Slug, err)184+ return fmt.Errorf("world %s: %w", entry.Slug, err)186185 }187186 locations, err := UnpackLocations(packed)188187 if err != nil {189- return fmt.Errorf("map %s: %w", entry.Slug, err)188+ return fmt.Errorf("world %s: %w", entry.Slug, err)190189 }191190 if len(locations) != entry.PinCount {192- return fmt.Errorf("map %s packs %d locations, and the manifest says %d",191+ return fmt.Errorf("world %s packs %d locations, and the manifest says %d",193192 entry.Slug, len(locations), entry.PinCount)194193 }195194 196195 var peek payloadPeek197196 if err := json.Unmarshal(detail, &peek); err != nil {198- return fmt.Errorf("map %s: decode payload: %w", entry.Slug, err)197+ return fmt.Errorf("world %s: decode payload: %w", entry.Slug, err)199198 }200- if len(peek.Variants) == 0 {201- return fmt.Errorf("map %s has no layers", entry.Slug)199+ if len(peek.Lenses) == 0 {200+ return fmt.Errorf("world %s has no lenses", entry.Slug)202201 }203- for _, variant := range peek.Variants {204- if len(variant.Formats) != variant.MaxZoom-variant.MinZoom+1 {205- return fmt.Errorf("map %s layer %s names %d tile formats for %d levels",206- entry.Slug, variant.Tiles, len(variant.Formats), variant.MaxZoom-variant.MinZoom+1)202+ for _, lens := range peek.Lenses {203+ if len(lens.Formats) != lens.MaxZoom-lens.MinZoom+1 {204+ return fmt.Errorf("world %s lens %s names %d tile formats for %d levels",205+ entry.Slug, lens.Tiles, len(lens.Formats), lens.MaxZoom-lens.MinZoom+1)207206 }208- for zoom := variant.MinZoom; zoom <= variant.MaxZoom; zoom++ {209- prefix := "tiles/" + variant.Tiles + "/" + strconv.Itoa(zoom) + "/"207+ for zoom := lens.MinZoom; zoom <= lens.MaxZoom; zoom++ {208+ prefix := "tiles/" + lens.Tiles + "/" + strconv.Itoa(zoom) + "/"210209 var held int211210 for directory, count := range levels {212211 if strings.HasPrefix(directory, prefix) {
@@ -214,15 +213,15 @@ func (b *Bundle) Validate() error {
214213 }215214 }216215 if held == 0 {217- return fmt.Errorf("map %s layer %s has an empty tile level %d",218- entry.Slug, variant.Tiles, zoom)216+ return fmt.Errorf("world %s lens %s has an empty tile level %d",217+ entry.Slug, lens.Tiles, zoom)219218 }220219 }221220 }222221 for _, group := range peek.Groups {223222 for _, category := range group.Categories {224223 if category.IconAsset != "" && !b.Has("icons/"+category.IconAsset) {225- return fmt.Errorf("map %s names a missing icon %s", entry.Slug, category.IconAsset)224+ return fmt.Errorf("world %s names a missing icon %s", entry.Slug, category.IconAsset)226225 }227226 }228227 }
@@ -242,42 +241,42 @@ func (b *Bundle) Validate() error {
242241 // A bundle that declares no conventions is not held to any -- the strictness243242 // belongs to the claim.244243 func validateConventions(slug string, peek payloadPeek, text []byte) error {245- if err := semconv.Validate(semconv.EntityMap, peek.Attrs); err != nil {246- return fmt.Errorf("map %s: %w", slug, err)244+ if err := semconv.Validate(semconv.EntityWorld, peek.Attrs); err != nil {245+ return fmt.Errorf("world %s: %w", slug, err)247246 }248247 if peek.Attrs[semconv.KeyGeometrySurface] == semconv.SurfaceSphere {249248 if peek.Attrs[semconv.KeyGeometryProjection] == "" {250- return fmt.Errorf("map %s declares a sphere with no projection", slug)249+ return fmt.Errorf("world %s declares a sphere with no projection", slug)251250 }252251 if _, err := semconv.ParseEquirect(253252 peek.Attrs[semconv.KeyGeometryEquirectPx],254253 peek.Attrs[semconv.KeyGeometryEquirectDeg]); err != nil {255- return fmt.Errorf("map %s: %w", slug, err)254+ return fmt.Errorf("world %s: %w", slug, err)256255 }257256 }258257 for _, group := range peek.Groups {259258 for _, category := range group.Categories {260259 if err := semconv.Validate(semconv.EntityCategory, category.Attrs); err != nil {261- return fmt.Errorf("map %s: %w", slug, err)260+ return fmt.Errorf("world %s: %w", slug, err)262261 }263262 if declared, ok := category.Attrs[semconv.KeyRenderAs]; ok {264263 if legacy := semconv.RenderAs(nil, category.DisplayType); declared != legacy {265- return fmt.Errorf("map %s renders a category as %s while its legacy field says %s",264+ return fmt.Errorf("world %s renders a category as %s while its legacy field says %s",266265 slug, declared, legacy)267266 }268267 }269268 if category.Attrs[semconv.KeyIconStd] != "" && category.IconAsset == "" {270- return fmt.Errorf("map %s declares a standard icon that was never resolved", slug)269+ return fmt.Errorf("world %s declares a standard icon that was never resolved", slug)271270 }272271 }273272 }274273 var entries map[string]textPeek275274 if err := json.Unmarshal(text, &entries); err != nil {276- return fmt.Errorf("map %s: decode text: %w", slug, err)275+ return fmt.Errorf("world %s: decode text: %w", slug, err)277276 }278277 for id, entry := range entries {279278 if err := semconv.Validate(semconv.EntityLocation, entry.Attrs); err != nil {280- return fmt.Errorf("map %s pin %s: %w", slug, id, err)279+ return fmt.Errorf("world %s pin %s: %w", slug, id, err)281280 }282281 }283282 return nil
M internal/bundle/registry.go +43 -43
@@ -17,10 +17,10 @@ import (
1717 "github.com/fsnotify/fsnotify"1818 )1919 20-// BasePath is the URL prefix game content is served under. It appears in the20+// BasePath is the URL prefix volume content is served under. It appears in the2121 // composed catalog so the frontend never assembles a content URL from parts2222 // it has to guess.23-const BasePath = "/data/g"23+const BasePath = "/data/v"2424 2525 // closeGrace is how long a retired bundle stays open after a rescan replaces2626 // it. A request served from the old snapshot finishes in milliseconds; the
@@ -48,30 +48,30 @@ type Registry struct {
4848 // Snapshot is the registry's world at one moment: the winning bundle per4949 // game and the catalog those winners compose.5050 type Snapshot struct {51- // Games maps each game slug to its bundle.52- Games map[string]*Bundle51+ // Volumes maps each volume slug to its bundle.52+ Volumes map[string]*Bundle5353 // Catalog is the merged /data/catalog.json body, marshaled once at scan5454 // time because every launch fetches it and it only changes here.5555 Catalog []byte5656 }5757 58-// catalogGame is one game as the composed catalog lists it. The base URL58+// catalogVolume is one volume as the composed catalog lists it. The base URL5959 // carries the version stamp, so everything beneath it may be cached as60-// immutable and a new version of the game arrives at new URLs.61-type catalogGame struct {62- Slug string `json:"slug"`63- Title string `json:"title"`64- Stamp string `json:"stamp"`65- Base string `json:"base"`66- TileGrid TileGrid `json:"tileGrid"`67- Maps []MapEntry `json:"maps"`60+// immutable and a new version of the volume arrives at new URLs.61+type catalogVolume struct {62+ Slug string `json:"slug"`63+ Title string `json:"title"`64+ Stamp string `json:"stamp"`65+ Base string `json:"base"`66+ TileGrid TileGrid `json:"tileGrid"`67+ Worlds []WorldEntry `json:"worlds"`6868 }6969 7070 // NewRegistry answers for dir, which need not exist yet: a directory that is71-// missing or empty is a catalog with no games, not an error.71+// missing or empty is a catalog with no volumes, not an error.7272 func NewRegistry(dir string) *Registry {7373 registry := &Registry{dir: dir}74- registry.snap.Store(&Snapshot{Games: map[string]*Bundle{}, Catalog: composeCatalog(dir, nil)})74+ registry.snap.Store(&Snapshot{Volumes: map[string]*Bundle{}, Catalog: composeCatalog(dir, nil)})7575 return registry7676 }7777
@@ -108,7 +108,7 @@ func (r *Registry) Rescan() error {
108108 sort.Strings(paths)109109 110110 previous := r.snap.Load()111- next := &Snapshot{Games: make(map[string]*Bundle, len(paths))}111+ next := &Snapshot{Volumes: make(map[string]*Bundle, len(paths))}112112 opened := make([]*Bundle, 0, len(paths))113113 for _, path := range paths {114114 // A bundle already serving is not reopened: the file it was opened
@@ -121,28 +121,28 @@ func (r *Registry) Rescan() error {
121121 continue122122 }123123 opened = append(opened, loaded)124- if standing, ok := next.Games[loaded.Manifest.Game.Slug]; !ok || MoreRecent(loaded, standing) {124+ if standing, ok := next.Volumes[loaded.Manifest.Volume.Slug]; !ok || MoreRecent(loaded, standing) {125125 if ok {126126 slog.Info("atlas: bundle shadowed",127- "game", loaded.Manifest.Game.Slug, "shadowed", standing.Path)127+ "volume", loaded.Manifest.Volume.Slug, "shadowed", standing.Path)128128 }129- next.Games[loaded.Manifest.Game.Slug] = loaded129+ next.Volumes[loaded.Manifest.Volume.Slug] = loaded130130 }131131 }132- next.Catalog = composeCatalog(r.dir, next.Games)132+ next.Catalog = composeCatalog(r.dir, next.Volumes)133133 r.snap.Store(next)134134 135- // What the rescan changed, by game: an arrival, a departure, or a winner135+ // What the rescan changed, by volume: an arrival, a departure, or a winner136136 // whose version stamp moved.137137 var changed []string138- for slug, winner := range next.Games {139- before, had := previous.Games[slug]138+ for slug, winner := range next.Volumes {139+ before, had := previous.Volumes[slug]140140 if !had || before.Manifest.Version.Stamp != winner.Manifest.Version.Stamp {141141 changed = append(changed, slug)142142 }143143 }144- for slug := range previous.Games {145- if _, still := next.Games[slug]; !still {144+ for slug := range previous.Volumes {145+ if _, still := next.Volumes[slug]; !still {146146 changed = append(changed, slug)147147 }148148 }
@@ -150,8 +150,8 @@ func (r *Registry) Rescan() error {
150150 151151 // Everything opened by this scan or held by the last snapshot that did152152 // not win a slug is retired together.153- serving := make(map[*Bundle]bool, len(next.Games))154- for _, winner := range next.Games {153+ serving := make(map[*Bundle]bool, len(next.Volumes))154+ for _, winner := range next.Volumes {155155 serving[winner] = true156156 }157157 var retired []*Bundle
@@ -160,7 +160,7 @@ func (r *Registry) Rescan() error {
160160 retired = append(retired, candidate)161161 }162162 }163- for _, held := range previous.Games {163+ for _, held := range previous.Volumes {164164 if !serving[held] {165165 retired = append(retired, held)166166 }
@@ -225,24 +225,24 @@ func (r *Registry) Watch(ctx context.Context) error {
225225 return nil226226 }227227 228-// Release closes the open archive behind one game so its file can be renamed229-// over on platforms that lock open files. The snapshot still lists the game228+// Release closes the open archive behind one volume so its file can be renamed229+// over on platforms that lock open files. The snapshot still lists the volume230230 // until the next rescan; a request in that window is answered with a 404,231231 // which the frontend already treats as its cue to refetch the catalog.232232 func (r *Registry) Release(slug string) {233233 r.rescan.Lock()234234 defer r.rescan.Unlock()235- if held := r.snap.Load().Games[slug]; held != nil {235+ if held := r.snap.Load().Volumes[slug]; held != nil {236236 held.Close()237237 }238238 }239239 240240 // Install copies bundle files into the directory under their versioned241-// names -- <game>-<capture-day>-<stamp>.atlas -- validating each before it241+// names -- <volume>-<capture-day>-<stamp>.atlas -- validating each before it242242 // is let in, and rescans once at the end. Versions sit side by side and the243243 // newest-wins fold serves the right one, so importing an old file can never244244 // overwrite a newer build; it just arrives already shadowed. It reports the245-// games installed and, separately, what was wrong with anything refused:245+// volumes installed and, separately, what was wrong with anything refused:246246 // one bad file does not turn the rest of a multi-selection away.247247 func (r *Registry) Install(paths []string) (installed []string, refused []string) {248248 for _, path := range paths {
@@ -270,7 +270,7 @@ func (r *Registry) installOne(path string) (string, error) {
270270 if err := opened.Validate(); err != nil {271271 return "", fmt.Errorf("%s: %w", filepath.Base(path), err)272272 }273- slug := opened.Manifest.Game.Slug273+ slug := opened.Manifest.Volume.Slug274274 275275 target := filepath.Join(r.dir, VersionedFileName(opened.Manifest))276276 if same, err := filepath.Abs(path); err == nil {
@@ -304,7 +304,7 @@ func (r *Registry) installOne(path string) (string, error) {
304304 }305305 if err := os.Rename(staged.Name(), target); err != nil {306306 // Windows refuses to rename over a file that is open. Closing the307- // game's archive first is what makes replacing an installed game307+ // volume's archive first is what makes replacing an installed volume308308 // possible there; the moment of unreadability ends at the rescan309309 // Install finishes with.310310 r.Release(slug)
@@ -318,7 +318,7 @@ func (r *Registry) installOne(path string) (string, error) {
318318 // openOrCarry reuses the already-open bundle for a path whose size and319319 // modification time have not moved, and opens the file fresh otherwise.320320 func openOrCarry(previous *Snapshot, path string) (*Bundle, error) {321- for _, held := range previous.Games {321+ for _, held := range previous.Volumes {322322 if held.Path != path {323323 continue324324 }
@@ -332,25 +332,25 @@ func openOrCarry(previous *Snapshot, path string) (*Bundle, error) {
332332 }333333 334334 func composeCatalog(dir string, games map[string]*Bundle) []byte {335- listed := make([]catalogGame, 0, len(games))335+ listed := make([]catalogVolume, 0, len(games))336336 for slug, held := range games {337337 manifest := held.Manifest338- listed = append(listed, catalogGame{338+ listed = append(listed, catalogVolume{339339 Slug: slug,340- Title: manifest.Game.Title,340+ Title: manifest.Volume.Title,341341 Stamp: manifest.Version.Stamp,342342 Base: strings.Join([]string{BasePath, slug, ShortStamp(manifest.Version.Stamp)}, "/"),343343 TileGrid: manifest.TileGrid,344- Maps: manifest.Maps,344+ Worlds: manifest.Worlds,345345 })346346 }347347 sort.Slice(listed, func(i, j int) bool { return listed[i].Title < listed[j].Title })348348 // The bundles directory rides along so an empty library can tell the349349 // reader where a bundle goes, in the words of their own machine.350350 composed, err := json.Marshal(struct {351- Games []catalogGame `json:"games"`352- BundlesDir string `json:"bundlesDir,omitempty"`353- }{Games: listed, BundlesDir: dir})351+ Volumes []catalogVolume `json:"volumes"`352+ BundlesDir string `json:"bundlesDir,omitempty"`353+ }{Volumes: listed, BundlesDir: dir})354354 if err != nil {355355 // Nothing in a validated manifest can fail to marshal; if something356356 // does, an empty catalog is a saner face than a panic.
M internal/bundle/registry_test.go +12 -12
@@ -15,12 +15,12 @@ import (
1515 func decodeCatalog(t *testing.T, snapshot *bundle.Snapshot) []map[string]any {1616 t.Helper()1717 var catalog struct {18- Games []map[string]any `json:"games"`18+ Volumes []map[string]any `json:"volumes"`1919 }2020 if err := json.Unmarshal(snapshot.Catalog, &catalog); err != nil {2121 t.Fatal(err)2222 }23- return catalog.Games23+ return catalog.Volumes2424 }2525 2626 func TestRegistryAnswersEmptyForAMissingDirectory(t *testing.T) {
@@ -75,10 +75,10 @@ func TestRegistryLetsTheNewestBundleOfAGameWin(t *testing.T) {
7575 t.Fatal(err)7676 }7777 snapshot := registry.Snapshot()78- if len(snapshot.Games) != 1 {79- t.Fatalf("games = %d, want the two files folded into one", len(snapshot.Games))78+ if len(snapshot.Volumes) != 1 {79+ t.Fatalf("games = %d, want the two files folded into one", len(snapshot.Volumes))8080 }81- if won := snapshot.Games["game"].Manifest.Game.Title; won != "New Title" {81+ if won := snapshot.Volumes["game"].Manifest.Volume.Title; won != "New Title" {8282 t.Errorf("the winning bundle is %q, want the newer one", won)8383 }8484 }
@@ -112,7 +112,7 @@ func TestRescanSeesArrivalsUpdatesAndDepartures(t *testing.T) {
112112 t.Fatal(err)113113 }114114 before := registry.Snapshot()115- if before.Games["game"].Manifest.Game.Title != "First" {115+ if before.Volumes["game"].Manifest.Volume.Title != "First" {116116 t.Fatal("an arriving bundle is not seen")117117 }118118
@@ -120,7 +120,7 @@ func TestRescanSeesArrivalsUpdatesAndDepartures(t *testing.T) {
120120 if err := registry.Rescan(); err != nil {121121 t.Fatal(err)122122 }123- if registry.Snapshot().Games["game"] != before.Games["game"] {123+ if registry.Snapshot().Volumes["game"] != before.Volumes["game"] {124124 t.Error("an untouched file was reopened")125125 }126126
@@ -135,12 +135,12 @@ func TestRescanSeesArrivalsUpdatesAndDepartures(t *testing.T) {
135135 t.Fatal(err)136136 }137137 after := registry.Snapshot()138- if after.Games["game"].Manifest.Game.Title != "Second" {138+ if after.Volumes["game"].Manifest.Volume.Title != "Second" {139139 t.Fatal("a replaced file still serves its old content")140140 }141141 // The old snapshot still reads until its grace ends, so a request that142142 // loaded it before the swap finishes cleanly.143- if _, err := before.Games["game"].ReadEntry("maps/overworld.json"); err != nil {143+ if _, err := before.Volumes["game"].ReadEntry("worlds/overworld.json"); err != nil {144144 t.Errorf("the retired bundle is already unreadable: %v", err)145145 }146146
@@ -215,7 +215,7 @@ func TestWatchSeesADroppedBundleOnItsOwn(t *testing.T) {
215215 216216 deadline := time.After(5 * time.Second)217217 for {218- if _, ok := registry.Snapshot().Games["game"]; ok {218+ if _, ok := registry.Snapshot().Volumes["game"]; ok {219219 return220220 }221221 select {
@@ -244,7 +244,7 @@ func TestInstallCopiesTheSoundAndRefusesTheBroken(t *testing.T) {
244244 }245245 // The copy lands under the build's own versioned name, whatever the246246 // source file was called, and the rescan has already made it servable.247- held, ok := registry.Snapshot().Games["game"]247+ held, ok := registry.Snapshot().Volumes["game"]248248 if !ok {249249 t.Fatal("the installed game is not being served")250250 }
@@ -274,7 +274,7 @@ func TestInstallingAnOlderBuildDoesNotDowngrade(t *testing.T) {
274274 if installed, refused := registry.Install([]string{older}); len(installed) != 1 || len(refused) != 0 {275275 t.Fatalf("installing the older build: %v / %v", installed, refused)276276 }277- if won := registry.Snapshot().Games["game"].Manifest.Game.Title; won != "Newer" {277+ if won := registry.Snapshot().Volumes["game"].Manifest.Volume.Title; won != "Newer" {278278 t.Errorf("the library serves %q after an old import, want the newer build", won)279279 }280280 }
M internal/bundle/stamp.go +6 -6
@@ -11,7 +11,7 @@ import (
1111 // bundle's bytes: a producer feeds it a hash per part -- payloads it just1212 // built, pyramid stamps its tile pipeline already computed -- and the sum is1313 // stable however the parts arrived. Equal stamps mean a rebuild would write14-// the same bundle, which is what lets an unchanged game be skipped.14+// the same bundle, which is what lets an unchanged volume be skipped.1515 type Stamp struct {1616 parts []string1717 }
@@ -36,7 +36,7 @@ func HashBytes(data []byte) string {
3636 return hex.EncodeToString(digest[:])3737 }3838 39-// MoreRecent reports whether a should shadow b when both claim the same game.39+// MoreRecent reports whether a should shadow b when both claim the same volume.4040 // Creation time decides; among builds of the same capture the newer policy4141 // revision decides; the stamp and then the path break the remaining ties, so4242 // the choice is total and two scans of the same directory always agree.
@@ -54,7 +54,7 @@ func MoreRecent(a, b *Bundle) bool {
5454 }5555 5656 // ShortStamp is the stamp as URLs and logs carry it: long enough that two57-// builds of a game will not collide, short enough to read past.57+// builds of a volume will not collide, short enough to read past.5858 func ShortStamp(stamp string) string {5959 if len(stamp) <= 12 {6060 return stamp
@@ -63,8 +63,8 @@ func ShortStamp(stamp string) string {
6363 }6464 6565 // VersionedFileName is the name a bundle carries in a registry directory:66-// the game, the day its data was captured, and enough of the stamp to tell67-// two builds of the same capture apart. Versions of a game sit side by side66+// the volume, the day its data was captured, and enough of the stamp to tell67+// two builds of the same capture apart. Versions of a volume sit side by side6868 // under these names, and the newest-wins fold is what serves the right one --6969 // the name is for people and for cheap existence checks, never for ordering.7070 func VersionedFileName(m Manifest) string {
@@ -77,7 +77,7 @@ func VersionedFileName(m Manifest) string {
7777 }7878 }7979 }80- name := m.Game.Slug80+ name := m.Volume.Slug8181 if day.Len() > 0 {8282 name += "-" + day.String()8383 }
M internal/measure/measure.go +31 -31
@@ -1,4 +1,4 @@
1-// Package measure is the one place a build of a game is judged. The1+// Package measure is the one place a build of a volume is judged. The22 // cartograph workbench and the maturity report used to each carry their own33 // copy of the same yardstick -- and the registry's ordering rule lived in44 // three places at once -- so "how good is this build" could quietly mean
@@ -28,14 +28,14 @@ import (
2828 // Build is one .atlas file measured whole: its identity, the axes, and every2929 // merge account its payloads carry.3030 type Build struct {31- Path string32- File string33- GameSlug string34- GameTitle string35- Stamp string36- CreatedAt string37- Revision int38- MapSlugs []string31+ Path string32+ File string33+ VolumeSlug string34+ VolumeTitle string35+ Stamp string36+ CreatedAt string37+ Revision int38+ MapSlugs []string3939 4040 Pins int4141 Described int
@@ -49,7 +49,7 @@ type Build struct {
4949 TextSets int5050 Zones int5151 Vertices int52- Variants int52+ Lenses int5353 IconsCarried int5454 IconsWanted int5555
@@ -67,7 +67,7 @@ type Build struct {
6767 Merges []MergeAccount6868 }6969 70-// MergeAccount is one source's account of its merge into one map, kept whole70+// MergeAccount is one source's account of its merge into one world, kept whole7171 // rather than counted: the pairs and the held pins are what a diff compares.7272 type MergeAccount struct {7373 Map string
@@ -89,7 +89,7 @@ type MatchedPair struct {
8989 Enriched bool `json:"e"`9090 }9191 92-// AdoptedPin records a donor-only pin that joined one of the serving map's92+// AdoptedPin records a donor-only pin that joined one of the serving world's9393 // own categories.9494 type AdoptedPin struct {9595 Donor int64 `json:"d"`
@@ -103,8 +103,8 @@ type HeldPin struct {
103103 Reason string `json:"why"`104104 }105105 106-// mapDetail is the sliver of a map payload measurement reads.107-type mapDetail struct {106+// worldDetail is the sliver of a world payload measurement reads.107+type worldDetail struct {108108 Attrs map[string]string `json:"attrs"`109109 Groups []struct {110110 Categories []struct {
@@ -128,10 +128,10 @@ type mapDetail struct {
128128 Coordinates json.RawMessage `json:"coordinates"`129129 } `json:"features"`130130 } `json:"zones"`131- Variants []struct {131+ Lenses []struct {132132 Name string `json:"name"`133133 MaxZoom int `json:"maxZoom"`134- } `json:"variants"`134+ } `json:"lenses"`135135 }136136 137137 // MedianMatchPx is the middle distance of the account's matched pairs: the
@@ -236,8 +236,8 @@ func MeasureBundle(path string) (*Build, error) {
236236 b := &Build{237237 Path: path,238238 File: filepath.Base(path),239- GameSlug: manifest.Game.Slug,240- GameTitle: manifest.Game.Title,239+ VolumeSlug: manifest.Volume.Slug,240+ VolumeTitle: manifest.Volume.Title,241241 Stamp: manifest.Version.Stamp,242242 CreatedAt: manifest.Version.CreatedAt,243243 Revision: manifest.Version.Revision,
@@ -247,14 +247,14 @@ func MeasureBundle(path string) (*Build, error) {
247247 248248 // Annotation: how thoroughly the locations are explained in writing.249249 var lengths []int250- for _, entry := range manifest.Maps {250+ for _, entry := range manifest.Worlds {251251 b.MapSlugs = append(b.MapSlugs, entry.Slug)252252 b.Pins += entry.PinCount253253 var text map[string]struct {254254 Description string `json:"d"`255255 Attrs map[string]string `json:"a"`256256 }257- if err := readEntry(entries, "maps/"+entry.Slug+".text", &text); err != nil {257+ if err := readEntry(entries, "worlds/"+entry.Slug+".text", &text); err != nil {258258 return nil, err259259 }260260 for _, held := range text {
@@ -270,8 +270,8 @@ func MeasureBundle(path string) (*Build, error) {
270270 lengths = append(lengths, len(cleaned))271271 }272272 273- var detail mapDetail274- if err := readEntry(entries, "maps/"+entry.Slug+".json", &detail); err != nil {273+ var detail worldDetail274+ if err := readEntry(entries, "worlds/"+entry.Slug+".json", &detail); err != nil {275275 return nil, err276276 }277277 b.UnknownAttrs += unknownAttrs(detail.Attrs)
@@ -283,9 +283,9 @@ func MeasureBundle(path string) (*Build, error) {
283283 b.Geometry = semconv.SurfacePlane284284 }285285 }286- b.Variants += len(detail.Variants)287- for _, variant := range detail.Variants {288- b.Depth = max(b.Depth, variant.MaxZoom)286+ b.Lenses += len(detail.Lenses)287+ for _, lens := range detail.Lenses {288+ b.Depth = max(b.Depth, lens.MaxZoom)289289 }290290 b.Zones += len(detail.Zones)291291 for _, zone := range detail.Zones {
@@ -372,18 +372,18 @@ func unknownAttrs(attrs map[string]string) int {
372372 return unknown373373 }374374 375-// LoadPins reads the packed locations of every map, keyed the way a diff376-// compares them: by map slug, then pin id.377-func LoadPins(path string, mapSlugs []string) (map[string]map[int64]string, error) {375+// LoadPins reads the packed locations of every world, keyed the way a diff376+// compares them: by world slug, then pin id.377+func LoadPins(path string, worldSlugs []string) (map[string]map[int64]string, error) {378378 opened, err := bundle.Open(path)379379 if err != nil {380380 return nil, err381381 }382382 defer opened.Close()383383 384- pins := make(map[string]map[int64]string, len(mapSlugs))385- for _, slug := range mapSlugs {386- packed, err := opened.ReadEntry("maps/" + slug + ".bin")384+ pins := make(map[string]map[int64]string, len(worldSlugs))385+ for _, slug := range worldSlugs {386+ packed, err := opened.ReadEntry("worlds/" + slug + ".bin")387387 if err != nil {388388 return nil, fmt.Errorf("map %s: %w", slug, err)389389 }
M internal/semconv/REGISTRY.md +9 -9
@@ -18,15 +18,15 @@ breaks; new keys arrive as `experimental` and earn `stable`.
1818 | `atlas.render.as` | category | `pin` \| `text` | stable | How the category's locations draw: markers, or floating text labels. Absent, legacy `displayType` decides; absent both, `pin`. |1919 | `atlas.icon.std` | category | `set/name`, e.g. `maki/mountain` | stable | Standard-library icon for a category without artwork. Resolved to embedded bytes at build time; the app only sees the resolved asset. |2020 | `atlas.icon.kind` | category | `glyph` \| `picture` | stable | Whether the icon asset is a monochrome glyph the viewer tints, or a picture drawn as-is. Names what the `.png` suffix used to imply. |21-| `atlas.icon.outset` | map | `light` \| `dark` | stable | The rim a map's markers wear to stay legible against its art. |22-| `atlas.geometry.surface` | map | `plane` \| `sphere` | stable | What the raster pictures. Absent means `plane` — every map before the planets. |23-| `atlas.geometry.projection` | map | `equirect` | stable | How a sphere was flattened. Required when surface is `sphere`. |24-| `atlas.geometry.equirect.px` | map | `x,y,w,h` (world px) | stable | The raster window the projection fills. |25-| `atlas.geometry.equirect.deg` | map | `west,north,east,south` (degrees) | stable | The ground that window pictures. |26-| `atlas.geometry.mercator.px` | map | `x,y,w,h` (world px) | experimental | The raster window a Web-Mercator cut fills. Where `equirect` declares y linear in degrees, `mercator` declares y linear in projected latitude — `asinh(tan lat)` — the flattening a real-world tile window actually is. |27-| `atlas.geometry.mercator.deg` | map | `west,north,east,south` (degrees) | experimental | The ground the Mercator window pictures, in degrees at its edges. |28-| `atlas.geometry.body` | map | slug, e.g. `mars` | experimental | The body pictured. |29-| `atlas.geometry.radius_km` | map | decimal string | experimental | The body's mean radius. |21+| `atlas.icon.outset` | world | `light` \| `dark` | stable | The rim a map's markers wear to stay legible against its art. |22+| `atlas.geometry.surface` | world | `plane` \| `sphere` | stable | What the raster pictures. Absent means `plane` — every map before the planets. |23+| `atlas.geometry.projection` | world | `equirect` | stable | How a sphere was flattened. Required when surface is `sphere`. |24+| `atlas.geometry.equirect.px` | world | `x,y,w,h` (world px) | stable | The raster window the projection fills. |25+| `atlas.geometry.equirect.deg` | world | `west,north,east,south` (degrees) | stable | The ground that window pictures. |26+| `atlas.geometry.mercator.px` | world | `x,y,w,h` (world px) | experimental | The raster window a Web-Mercator cut fills. Where `equirect` declares y linear in degrees, `mercator` declares y linear in projected latitude — `asinh(tan lat)` — the flattening a real-world tile window actually is. |27+| `atlas.geometry.mercator.deg` | world | `west,north,east,south` (degrees) | experimental | The ground the Mercator window pictures, in degrees at its edges. |28+| `atlas.geometry.body` | world | slug, e.g. `mars` | experimental | The body pictured. |29+| `atlas.geometry.radius_km` | world | decimal string | experimental | The body's mean radius. |3030 | `atlas.geo.lat` | location | decimal degrees | experimental | True planetary latitude as published (planetocentric). Provenance and card material; rendering derives from the map-level mapping. |3131 | `atlas.geo.lon` | location | decimal degrees | experimental | True planetary longitude as published (east-positive). |3232 | `atlas.category.key` | category | slug | experimental | A category's merge identity across sources. Absent, the icon key stands in. |
M internal/semconv/semconv.go +10 -10
@@ -36,7 +36,7 @@ type Entity string
3636 3737 const (3838 EntityBundle Entity = "bundle"39- EntityMap Entity = "map"39+ EntityWorld Entity = "world"4040 EntityCategory Entity = "category"4141 EntityLocation Entity = "location"4242 )
@@ -213,15 +213,15 @@ var registry = map[string]definition{
213213 KeyRenderAs: {EntityCategory, Stable, enum(RenderAsPin, RenderAsText)},214214 KeyIconStd: {EntityCategory, Stable, setName},215215 KeyIconKind: {EntityCategory, Stable, enum(IconKindGlyph, IconKindPicture)},216- KeyIconOutset: {EntityMap, Stable, enum(OutsetLight, OutsetDark)},217- KeyGeometrySurface: {EntityMap, Stable, enum(SurfacePlane, SurfaceSphere)},218- KeyGeometryProjection: {EntityMap, Stable, enum(ProjectionEquirect)},219- KeyGeometryEquirectPx: {EntityMap, Stable, numbers(4)},220- KeyGeometryEquirectDeg: {EntityMap, Stable, numbers(4)},221- KeyGeometryMercatorPx: {EntityMap, Experimental, numbers(4)},222- KeyGeometryMercatorDeg: {EntityMap, Experimental, numbers(4)},223- KeyGeometryBody: {EntityMap, Experimental, slug},224- KeyGeometryRadiusKM: {EntityMap, Experimental, decimal},216+ KeyIconOutset: {EntityWorld, Stable, enum(OutsetLight, OutsetDark)},217+ KeyGeometrySurface: {EntityWorld, Stable, enum(SurfacePlane, SurfaceSphere)},218+ KeyGeometryProjection: {EntityWorld, Stable, enum(ProjectionEquirect)},219+ KeyGeometryEquirectPx: {EntityWorld, Stable, numbers(4)},220+ KeyGeometryEquirectDeg: {EntityWorld, Stable, numbers(4)},221+ KeyGeometryMercatorPx: {EntityWorld, Experimental, numbers(4)},222+ KeyGeometryMercatorDeg: {EntityWorld, Experimental, numbers(4)},223+ KeyGeometryBody: {EntityWorld, Experimental, slug},224+ KeyGeometryRadiusKM: {EntityWorld, Experimental, decimal},225225 KeyGeoLat: {EntityLocation, Experimental, decimal},226226 KeyGeoLon: {EntityLocation, Experimental, decimal},227227 KeyCategoryKey: {EntityCategory, Experimental, slug},
M internal/semconv/semconv_test.go +6 -6
@@ -16,7 +16,7 @@ func TestValidateHoldsTheVocabulary(t *testing.T) {
1616 {EntityCategory, map[string]string{KeyRenderAs: "pin"}},1717 {EntityCategory, map[string]string{KeyRenderAs: "text", KeyIconStd: "maki/mountain"}},1818 {EntityCategory, map[string]string{KeyIconKind: "glyph", KeyCategoryKey: "ripperdoc"}},19- {EntityMap, map[string]string{19+ {EntityWorld, map[string]string{2020 KeyGeometrySurface: "sphere",2121 KeyGeometryProjection: "equirect",2222 KeyGeometryEquirectPx: "0,0,8192,4096",
@@ -24,7 +24,7 @@ func TestValidateHoldsTheVocabulary(t *testing.T) {
2424 KeyGeometryBody: "mars",2525 KeyGeometryRadiusKM: "3389.5",2626 }},27- {EntityMap, map[string]string{KeyIconOutset: "dark"}},27+ {EntityWorld, map[string]string{KeyIconOutset: "dark"}},2828 {EntityLocation, map[string]string{KeyGeoLat: "-42.4301", KeyGeoLon: "70.5025"}},2929 // Empty is always fine: conventions are declared, never demanded.3030 {EntityCategory, nil},
@@ -42,11 +42,11 @@ func TestValidateHoldsTheVocabulary(t *testing.T) {
4242 }{4343 {EntityCategory, map[string]string{"atlas.render.like": "pin"}, "not registered"},4444 {EntityCategory, map[string]string{KeyRenderAs: "zone"}, "not one of"},45- {EntityMap, map[string]string{KeyRenderAs: "pin"}, "attaches to"},45+ {EntityWorld, map[string]string{KeyRenderAs: "pin"}, "attaches to"},4646 {EntityCategory, map[string]string{KeyIconStd: "mountain"}, "set/name"},4747 {EntityCategory, map[string]string{KeyIconStd: "Maki/Mountain"}, "slug"},48- {EntityMap, map[string]string{KeyGeometryEquirectPx: "0,0,8192"}, "4"},49- {EntityMap, map[string]string{KeyGeometryRadiusKM: "big"}, "number"},48+ {EntityWorld, map[string]string{KeyGeometryEquirectPx: "0,0,8192"}, "4"},49+ {EntityWorld, map[string]string{KeyGeometryRadiusKM: "big"}, "number"},5050 {EntityLocation, map[string]string{KeyGeoLat: "north"}, "number"},5151 // The policy name never rides a payload.5252 {EntityLocation, map[string]string{KeyNoteText: "words"}, "not registered"},
@@ -131,7 +131,7 @@ func TestRegistryAgreesWithItsDocument(t *testing.T) {
131131 if err != nil {132132 t.Fatal(err)133133 }134- row := regexp.MustCompile("(?m)^\\| `(atlas\\.[a-z_.]+)` \\| (bundle|map|category|location) \\|.*\\| (stable|experimental) \\|")134+ row := regexp.MustCompile("(?m)^\\| `(atlas\\.[a-z_.]+)` \\| (bundle|world|category|location) \\|.*\\| (stable|experimental) \\|")135135 documented := make(map[string][2]string)136136 for _, match := range row.FindAllStringSubmatch(string(doc), -1) {137137 documented[match[1]] = [2]string{match[2], match[3]}
M internal/trekmap/trekmap.go +2 -1
M main.go +4 -4
@@ -1,5 +1,5 @@
11 // Command atlas is an offline interactive map explorer built with Allons.2-// The executable carries only the application shell; each game arrives as a2+// The executable carries only the application shell; each volume arrives as a33 // self-contained .atlas bundle dropped into the bundles directory, and the44 // application needs no network connection either way.55 package main
@@ -21,7 +21,7 @@ import (
2121 )2222 2323 // catalogChangedTopic is the event the frontend refreshes its catalog on: a24-// bundle arrived, was replaced, or left, and the games on offer moved with it.24+// bundle arrived, was replaced, or left, and the volumes on offer moved with it.2525 const catalogChangedTopic = "atlas:catalog-changed"2626 2727 // Archive capture is deliberately not a generate step: it reaches out to
@@ -67,7 +67,7 @@ func main() {
6767 },6868 },6969 &options.App{70- Title: "Atlas — Game Map Explorer",70+ Title: "Atlas — World Explorer",7171 OnStartup: func(wctx context.Context) {7272 captureWailsContext(wctx)7373 if err := registry.Watch(wctx); err != nil {
@@ -91,7 +91,7 @@ func main() {
9191 }9292 }9393 94-// bundlesDir is where installed games live: a directory of .atlas files under94+// bundlesDir is where installed volumes live: a directory of .atlas files under9595 // the application's own data directory. ATLAS_BUNDLES_DIR points elsewhere for9696 // development, so a freshly generated dist/bundles serves without being copied9797 // into the running application's library.
M routes.go +6 -6
@@ -35,18 +35,18 @@ func routes(files fs.FS, registry *bundle.Registry) http.Handler {
3535 _, _ = w.Write(registry.Snapshot().Catalog)3636 })3737 38- // Game content lives under a stamp taken from the bundle's own version,39- // so every URL names exactly one build of one game: cacheable forever,38+ // Volume content lives under a stamp taken from the bundle's own version,39+ // so every URL names exactly one build of one volume: cacheable forever,4040 // and gone -- 404, and the frontend refetches the catalog -- the moment4141 // a newer bundle takes the slug over.42- mux.HandleFunc("GET /data/g/{slug}/{stamp}/{rest...}", func(w http.ResponseWriter, r *http.Request) {43- held, ok := registry.Snapshot().Games[r.PathValue("slug")]42+ mux.HandleFunc("GET /data/v/{slug}/{stamp}/{rest...}", func(w http.ResponseWriter, r *http.Request) {43+ held, ok := registry.Snapshot().Volumes[r.PathValue("slug")]4444 if !ok || r.PathValue("stamp") != bundle.ShortStamp(held.Manifest.Version.Stamp) {4545 http.NotFound(w, r)4646 return4747 }4848 rest := r.PathValue("rest")49- if !strings.HasPrefix(rest, "maps/") && !strings.HasPrefix(rest, "tiles/") &&49+ if !strings.HasPrefix(rest, "worlds/") && !strings.HasPrefix(rest, "tiles/") &&5050 !strings.HasPrefix(rest, "icons/") {5151 http.NotFound(w, r)5252 return
@@ -73,7 +73,7 @@ func routes(files fs.FS, registry *bundle.Registry) http.Handler {
7373 _, _ = io.Copy(w, entry)7474 })7575 76- // Adding a game from inside the application: a native picker, then the76+ // Adding a volume from inside the application: a native picker, then the7777 // chosen files are validated and copied into the bundles directory, which7878 // is the same road a hand-dropped file takes.7979 mux.HandleFunc("POST /data/bundles/import", func(w http.ResponseWriter, r *http.Request) {
M routes_test.go +32 -32
@@ -102,24 +102,24 @@ func TestCatalogAnswersForInstalledBundles(t *testing.T) {
102102 t.Errorf("catalog Cache-Control = %q, want no-store", cache)103103 }104104 var catalog struct {105- Games []struct {105+ Volumes []struct {106106 Slug string `json:"slug"`107107 Title string `json:"title"`108108 Base string `json:"base"`109109 Maps []struct {110110 Slug string `json:"slug"`111- } `json:"maps"`112- } `json:"games"`111+ } `json:"worlds"`112+ } `json:"volumes"`113113 }114114 if err := json.Unmarshal(rec.Body.Bytes(), &catalog); err != nil {115115 t.Fatal(err)116116 }117- if len(catalog.Games) != 2 ||118- catalog.Games[0].Title != "Aardvark Saga" || catalog.Games[1].Title != "Zebra Quest" {119- t.Fatalf("games = %+v, want Aardvark Saga then Zebra Quest", catalog.Games)117+ if len(catalog.Volumes) != 2 ||118+ catalog.Volumes[0].Title != "Aardvark Saga" || catalog.Volumes[1].Title != "Zebra Quest" {119+ t.Fatalf("games = %+v, want Aardvark Saga then Zebra Quest", catalog.Volumes)120120 }121- if base := catalog.Games[0].Base; !strings.HasPrefix(base, "/data/g/aardvark-saga/") {122- t.Errorf("base = %q, want a stamped /data/g/aardvark-saga/ prefix", base)121+ if base := catalog.Volumes[0].Base; !strings.HasPrefix(base, "/data/v/aardvark-saga/") {122+ t.Errorf("base = %q, want a stamped /data/v/aardvark-saga/ prefix", base)123123 }124124 }125125
@@ -129,14 +129,14 @@ func TestCatalogIsEmptyRatherThanAbsentWithNoBundles(t *testing.T) {
129129 t.Fatalf("status = %d", rec.Code)130130 }131131 var catalog struct {132- Games []any `json:"games"`132+ Volumes []any `json:"volumes"`133133 BundlesDir string `json:"bundlesDir"`134134 }135135 if err := json.Unmarshal(rec.Body.Bytes(), &catalog); err != nil {136136 t.Fatal(err)137137 }138- if catalog.Games == nil || len(catalog.Games) != 0 {139- t.Errorf("games = %v, want a present, empty list", catalog.Games)138+ if catalog.Volumes == nil || len(catalog.Volumes) != 0 {139+ t.Errorf("volumes = %v, want a present, empty list", catalog.Volumes)140140 }141141 // The empty state tells the reader where bundles go, in the words of142142 // their own machine.
@@ -159,15 +159,15 @@ func TestImportWithoutAWindowIsRefused(t *testing.T) {
159159 func TestDataServesEveryKindOfBundleEntry(t *testing.T) {160160 registry := fixtureRegistry(t, bundletest.Spec{161161 Slug: "game", Title: "Game",162- Maps: []bundletest.MapSpec{{Slug: "overworld", Pins: []bundletest.Pin{{Title: "Origin"}}}},162+ Worlds: []bundletest.WorldSpec{{Slug: "overworld", Pins: []bundletest.Pin{{Title: "Origin"}}}},163163 })164164 handler := routes(assets, registry)165165 base := gameBase(t, handler, "game")166166 167167 served := []struct{ path, kind string }{168- {"/maps/overworld.json", "application/json"},169- {"/maps/overworld.text", "application/json"},170- {"/maps/overworld.bin", "application/octet-stream"},168+ {"/worlds/overworld.json", "application/json"},169+ {"/worlds/overworld.text", "application/json"},170+ {"/worlds/overworld.bin", "application/octet-stream"},171171 {"/tiles/overworld/0/0/0.jpg", "image/jpeg"},172172 {"/icons/marker.svg", "image/svg+xml"},173173 }
@@ -187,7 +187,7 @@ func TestDataServesEveryKindOfBundleEntry(t *testing.T) {
187187 }188188 }189189 190- packed := get(t, handler, base+"/maps/overworld.bin").Body.Bytes()190+ packed := get(t, handler, base+"/worlds/overworld.bin").Body.Bytes()191191 locations, err := bundle.UnpackLocations(packed)192192 if err != nil {193193 t.Fatal(err)
@@ -203,14 +203,14 @@ func TestDataRefusesWhatItDoesNotHold(t *testing.T) {
203203 base := gameBase(t, handler, "game")204204 205205 refused := []string{206- "/data/g/other-game/000000000000/maps/overworld.json",206+ "/data/v/other-volume/000000000000/worlds/overworld.json",207207 // A stale stamp is a build that has been replaced: the frontend takes208208 // the 404 as its cue to refetch the catalog.209- "/data/g/game/000000000000/maps/overworld.json",209+ "/data/v/game/000000000000/worlds/overworld.json",210210 // The manifest and anything outside the content trees stay private.211211 base + "/atlas.json",212212 base + "/maps/missing.json",213- base + "/maps/overworld",213+ base + "/worlds/overworld",214214 }215215 for _, path := range refused {216216 if rec := get(t, handler, path); rec.Code != http.StatusNotFound {
@@ -235,15 +235,15 @@ func TestDataRefusesWhatItDoesNotHold(t *testing.T) {
235235 func gameBase(t *testing.T, handler http.Handler, slug string) string {236236 t.Helper()237237 var catalog struct {238- Games []struct {238+ Volumes []struct {239239 Slug string `json:"slug"`240240 Base string `json:"base"`241- } `json:"games"`241+ } `json:"volumes"`242242 }243243 if err := json.Unmarshal(get(t, handler, "/data/catalog.json").Body.Bytes(), &catalog); err != nil {244244 t.Fatal(err)245245 }246- for _, game := range catalog.Games {246+ for _, game := range catalog.Volumes {247247 if game.Slug == slug {248248 return game.Base249249 }
@@ -273,7 +273,7 @@ func builtRegistry(t *testing.T) *bundle.Registry {
273273 274274 func builtBundles(t *testing.T) map[string]*bundle.Bundle {275275 t.Helper()276- games := builtRegistry(t).Snapshot().Games276+ games := builtRegistry(t).Snapshot().Volumes277277 if len(games) == 0 {278278 t.Skip("no built bundles in the library; run go generate first")279279 }
@@ -291,12 +291,12 @@ func builtGame(t *testing.T, games map[string]*bundle.Bundle, slug string) *bund
291291 292292 func builtMapSlug(t *testing.T, held *bundle.Bundle, title string) string {293293 t.Helper()294- for _, entry := range held.Manifest.Maps {294+ for _, entry := range held.Manifest.Worlds {295295 if entry.Title == title {296296 return entry.Slug297297 }298298 }299- t.Fatalf("%s has no map titled %q", held.Manifest.Game.Slug, title)299+ t.Fatalf("%s has no map titled %q", held.Manifest.Volume.Slug, title)300300 return ""301301 }302302
@@ -367,9 +367,9 @@ func TestBuiltBundlesKeepTheirPromises(t *testing.T) {
367367 var maps int368368 for _, held := range games {369369 if err := held.Validate(); err != nil {370- t.Errorf("%s: %v", held.Manifest.Game.Slug, err)370+ t.Errorf("%s: %v", held.Manifest.Volume.Slug, err)371371 }372- maps += len(held.Manifest.Maps)372+ maps += len(held.Manifest.Worlds)373373 }374374 if maps < 20 {375375 t.Errorf("built bundles list %d maps, want at least 20", maps)
@@ -385,7 +385,7 @@ func TestBuiltBundlesKeepTheirPromises(t *testing.T) {
385385 // starting up. It must not grow with what the bundles hold.386386 func TestComposedCatalogStaysSmall(t *testing.T) {387387 registry := builtRegistry(t)388- if len(registry.Snapshot().Games) == 0 {388+ if len(registry.Snapshot().Volumes) == 0 {389389 t.Skip("no built bundles in the library; run go generate first")390390 }391391 if size := len(registry.Snapshot().Catalog); size > 64*1024 {
@@ -591,20 +591,20 @@ func TestBuiltBundlesCarryCategoryIconsAndColors(t *testing.T) {
591591 var iconAssets int592592 var foundPokemonCenter bool593593 for _, held := range games {594- for _, entry := range held.Manifest.Maps {594+ for _, entry := range held.Manifest.Worlds {595595 for _, group := range readBuiltPayload(t, held, entry.Slug).Groups {596596 for _, category := range group.Categories {597597 if category.IconAsset != "" {598598 iconAssets++599599 if strings.Contains(category.IconAsset, "/") {600600 t.Errorf("%s names icon %q, which is not bundle-relative",601- held.Manifest.Game.Slug, category.IconAsset)601+ held.Manifest.Volume.Slug, category.IconAsset)602602 }603603 if !held.Has("icons/" + category.IconAsset) {604- t.Errorf("%s icon %q is missing", held.Manifest.Game.Slug, category.IconAsset)604+ t.Errorf("%s icon %q is missing", held.Manifest.Volume.Slug, category.IconAsset)605605 }606606 }607- if held.Manifest.Game.Slug != "pokemon-red-blue-yellow" ||607+ if held.Manifest.Volume.Slug != "pokemon-red-blue-yellow" ||608608 entry.Title != "Yellow" || category.Title != "Pokémon Center" {609609 continue610610 }
M tools/generate/bundles.go +37 -37
@@ -38,30 +38,30 @@ func writeBundles(out catalog, tiles tileManifest, tilesDir, bundleDir string) e
3838 if err := os.MkdirAll(bundleDir, 0o755); err != nil {3939 return fmt.Errorf("create bundle directory: %w", err)4040 }41- stampByAsset := make(map[string]string, len(tiles.Variants))42- for _, variant := range tiles.Variants {41+ stampByAsset := make(map[string]string, len(tiles.Lenses))42+ for _, variant := range tiles.Lenses {4343 stampByAsset[variant.AssetPath] = variant.Stamp4444 }4545 46- for _, game := range out.Games {47- if err := writeGameBundle(game, out.TileGrid, stampByAsset, tilesDir, bundleDir); err != nil {46+ for _, game := range out.Volumes {47+ if err := writeVolumeBundle(game, out.TileGrid, stampByAsset, tilesDir, bundleDir); err != nil {4848 return fmt.Errorf("%s: %w", game.Title, err)4949 }5050 }5151 return writeRegistryIndex(bundleDir)5252 }5353 54-// gamePayload is one map's three parts, built once and used for both the54+// volumePayload is one map's three parts, built once and used for both the5555 // stamp and the archive.56-type gamePayload struct {56+type volumePayload struct {5757 slug string5858 detail []byte5959 packed []byte6060 text []byte6161 }6262 63-func writeGameBundle(64- game catalogGame,63+func writeVolumeBundle(64+ game catalogVolume,6565 grid tileGrid,6666 stampByAsset map[string]string,6767 tilesDir, bundleDir string,
@@ -70,7 +70,7 @@ func writeGameBundle(
7070 Format: bundle.Format,7171 FormatVersion: bundle.FormatVersion,7272 Conventions: semconv.Version,73- Game: bundle.Game{Slug: game.Slug, Title: game.Title},73+ Volume: bundle.Volume{Slug: game.Slug, Title: game.Title},7474 Version: bundle.Version{Revision: policyRevision},7575 TileGrid: bundle.TileGrid{7676 SourceZoom: grid.SourceZoom,
@@ -83,31 +83,31 @@ func writeGameBundle(
8383 // Pyramids are shared: several pieces of a split sheet draw from the one8484 // raster, so tile sets are collected across maps and written once.8585 pyramids := make(map[string]string)86- var payloads []gamePayload86+ var payloads []volumePayload8787 var stamp bundle.Stamp88- for _, m := range game.Maps {88+ for _, m := range game.Worlds {8989 detail, packed, text := buildPayload(m)90- detail.Variants = append([]variant(nil), detail.Variants...)91- for index := range detail.Variants {92- local := localPyramidName(game.Slug, detail.Variants[index].Tiles)93- pyramids[local] = detail.Variants[index].Tiles94- detail.Variants[index].Tiles = local90+ detail.Lenses = append([]lens(nil), detail.Lenses...)91+ for index := range detail.Lenses {92+ local := localPyramidName(game.Slug, detail.Lenses[index].Tiles)93+ pyramids[local] = detail.Lenses[index].Tiles94+ detail.Lenses[index].Tiles = local9595 }9696 9797 detailJSON, err := json.Marshal(detail)9898 if err != nil {99- return fmt.Errorf("map %s: marshal payload: %w", m.Slug, err)99+ return fmt.Errorf("world %s: marshal payload: %w", m.Slug, err)100100 }101101 textJSON, err := json.Marshal(text)102102 if err != nil {103- return fmt.Errorf("map %s: marshal text: %w", m.Slug, err)103+ return fmt.Errorf("world %s: marshal text: %w", m.Slug, err)104104 }105- payloads = append(payloads, gamePayload{slug: m.Slug, detail: detailJSON, packed: packed, text: textJSON})106- stamp.Add("maps/"+m.Slug+".json", bundle.HashBytes(detailJSON))107- stamp.Add("maps/"+m.Slug+".bin", bundle.HashBytes(packed))108- stamp.Add("maps/"+m.Slug+".text", bundle.HashBytes(textJSON))105+ payloads = append(payloads, volumePayload{slug: m.Slug, detail: detailJSON, packed: packed, text: textJSON})106+ stamp.Add("worlds/"+m.Slug+".json", bundle.HashBytes(detailJSON))107+ stamp.Add("worlds/"+m.Slug+".bin", bundle.HashBytes(packed))108+ stamp.Add("worlds/"+m.Slug+".text", bundle.HashBytes(textJSON))109109 110- manifest.Maps = append(manifest.Maps, bundle.MapEntry{110+ manifest.Worlds = append(manifest.Worlds, bundle.WorldEntry{111111 Slug: m.Slug,112112 Title: m.Title,113113 Parent: m.Parent,
@@ -141,13 +141,13 @@ func writeGameBundle(
141141 // across the game's maps. Building the same archive anywhere, any time,142142 // yields the same version and the same file name, which is what lets a143143 // directory of these files stand as a registry.144- for _, m := range game.Maps {144+ for _, m := range game.Worlds {145145 if m.UpdatedAt > manifest.Version.CreatedAt {146146 manifest.Version.CreatedAt = m.UpdatedAt147147 }148148 }149149 if manifest.Version.CreatedAt == "" {150- return fmt.Errorf("no map carries a capture time to version the bundle by")150+ return fmt.Errorf("no world carries a capture time to version the bundle by")151151 }152152 153153 // This exact build already in the registry keeps its file untouched.
@@ -168,13 +168,13 @@ func writeGameBundle(
168168 return err169169 }170170 for _, payload := range payloads {171- if err := writer.AddDeflated("maps/"+payload.slug+".json", payload.detail); err != nil {171+ if err := writer.AddDeflated("worlds/"+payload.slug+".json", payload.detail); err != nil {172172 return err173173 }174- if err := writer.AddStored("maps/"+payload.slug+".bin", bytes.NewReader(payload.packed)); err != nil {174+ if err := writer.AddStored("worlds/"+payload.slug+".bin", bytes.NewReader(payload.packed)); err != nil {175175 return err176176 }177- if err := writer.AddDeflated("maps/"+payload.slug+".text", payload.text); err != nil {177+ if err := writer.AddDeflated("worlds/"+payload.slug+".text", payload.text); err != nil {178178 return err179179 }180180 }
@@ -217,11 +217,11 @@ func writeGameBundle(
217217 if err := written.Validate(); err != nil {218218 return fmt.Errorf("validate %s: %w", filepath.Base(target), err)219219 }220- fmt.Printf("bundled %s (%d maps)\n", filepath.Base(target), len(game.Maps))220+ fmt.Printf("bundled %s (%d worlds)\n", filepath.Base(target), len(game.Worlds))221221 return nil222222 }223223 224-// registryVersion is one build of one game as the registry index lists it.224+// registryVersion is one build of one volume as the registry index lists it.225225 type registryVersion struct {226226 File string `json:"file"`227227 Stamp string `json:"stamp"`
@@ -261,15 +261,15 @@ func writeRegistryIndex(bundleDir string) error {
261261 if info, err := os.Stat(path); err == nil {262262 size = info.Size()263263 }264- entry := entries[manifest.Game.Slug]264+ entry := entries[manifest.Volume.Slug]265265 if entry == nil {266- entry = &registryEntry{Slug: manifest.Game.Slug}267- entries[manifest.Game.Slug] = entry266+ entry = &registryEntry{Slug: manifest.Volume.Slug}267+ entries[manifest.Volume.Slug] = entry268268 }269269 // The newest version's title speaks for the game.270- if manifest.Version.CreatedAt >= newest[manifest.Game.Slug] {271- newest[manifest.Game.Slug] = manifest.Version.CreatedAt272- entry.Title = manifest.Game.Title270+ if manifest.Version.CreatedAt >= newest[manifest.Volume.Slug] {271+ newest[manifest.Volume.Slug] = manifest.Version.CreatedAt272+ entry.Title = manifest.Volume.Title273273 }274274 entry.Versions = append(entry.Versions, registryVersion{275275 File: filepath.Base(path),
@@ -277,7 +277,7 @@ func writeRegistryIndex(bundleDir string) error {
277277 CreatedAt: manifest.Version.CreatedAt,278278 Revision: manifest.Version.Revision,279279 Size: size,280- Maps: len(manifest.Maps),280+ Maps: len(manifest.Worlds),281281 })282282 }283283
M tools/generate/main.go +95 -95
@@ -126,7 +126,7 @@ type geometry struct {
126126 // held only long enough to be written out one bundle per game.127127 type catalog struct {128128 TileGrid tileGrid129- Games []catalogGame129+ Volumes []catalogVolume130130 }131131 132132 type tileGrid struct {
@@ -136,27 +136,27 @@ type tileGrid struct {
136136 Size int `json:"size"`137137 }138138 139-// mapGrid is where one map's world space sits in the source tile grid. Most139+// worldGrid is where one map's world space sits in the source tile grid. Most140140 // maps sit in the shared window and say nothing; a map cut from a window of its141141 // own carries the two numbers that differ, and the catalog's grid answers for142142 // the rest.143-type mapGrid struct {143+type worldGrid struct {144144 SourceZoom int `json:"sourceZoom"`145145 FirstTile int `json:"firstTile"`146146 }147147 148-type catalogGame struct {149- ID int64 `json:"id"`150- Title string `json:"title"`151- Slug string `json:"slug"`152- Maps []catalogMap `json:"maps"`148+type catalogVolume struct {149+ ID int64 `json:"id"`150+ Title string `json:"title"`151+ Slug string `json:"slug"`152+ Worlds []catalogWorld `json:"worlds"`153153 // Icons carries the game's category icons by bundle-relative name, read154154 // once from the archive so every writer -- the embedded tree today, the155155 // game's bundle -- draws on the same bytes.156156 Icons map[string][]byte `json:"-"`157157 }158158 159-type catalogMap struct {159+type catalogWorld struct {160160 ID int64 `json:"id"`161161 Title string `json:"title"`162162 Slug string `json:"slug"`
@@ -168,10 +168,10 @@ type catalogMap struct {
168168 Attrs map[string]string `json:"attrs,omitempty"`169169 // Grid is carried only by a map whose window is not the shared one, so the170170 // catalog reads the same as it did for every map that is.171- Grid *mapGrid `json:"grid,omitempty"`172- Variants []variant `json:"variants"`173- Groups []catalogGroup `json:"groups"`174- Zones []zone `json:"zones,omitempty"`171+ Grid *worldGrid `json:"grid,omitempty"`172+ Lenses []lens `json:"lenses"`173+ Groups []catalogGroup `json:"groups"`174+ Zones []zone `json:"zones,omitempty"`175175 // Parent names the map this one was split out of, so an inset sorts with176176 // the sheet it came from rather than alphabetically among unrelated maps.177177 Parent string `json:"parent,omitempty"`
@@ -188,7 +188,7 @@ type coordinate struct {
188188 Longitude float64 `json:"lng"`189189 }190190 191-type variant struct {191+type lens struct {192192 Name string `json:"name"`193193 Tiles string `json:"tiles"`194194 MinZoom int `json:"minZoom"`
@@ -224,12 +224,12 @@ type contentBounds struct {
224224 }225225 226226 type tileManifest struct {227- TileSize int `json:"tileSize"`228- Size int `json:"size"`229- Variants []tileVariantManifest `json:"variants"`227+ TileSize int `json:"tileSize"`228+ Size int `json:"size"`229+ Lenses []tileLensManifest `json:"lenses"`230230 }231231 232-type tileVariantManifest struct {232+type tileLensManifest struct {233233 SourcePath string `json:"sourcePath"`234234 AssetPath string `json:"assetPath"`235235 Stamp string `json:"stamp"`
@@ -237,7 +237,7 @@ type tileVariantManifest struct {
237237 MaxZoom int `json:"maxZoom"`238238 FullZoom int `json:"fullZoom"`239239 SourceZoom int `json:"sourceZoom"`240- Grid mapGrid `json:"grid"`240+ Grid worldGrid `json:"grid"`241241 Formats []string `json:"formats"`242242 Bounds *contentBounds `json:"bounds"`243243 Interpolate bool `json:"interpolate"`
@@ -310,27 +310,27 @@ type zone struct {
310310 Features []geometry `json:"features"`311311 }312312 313-var errMapNotReady = errors.New("map is not ready for embedding")313+var errWorldNotReady = errors.New("world is not ready for embedding")314314 315-// preferredMapOrder keeps a game's primary map ahead of secondary areas.315+// preferredWorldOrder keeps a game's primary map ahead of secondary areas.316316 // Unlisted maps follow in title order, so adding one entry is enough to curate317317 // a game without restating its complete archive.318-var preferredMapOrder = map[string][]string{318+var preferredWorldOrder = map[string][]string{319319 "fallout-new-vegas": {"mojave-wasteland"},320320 }321321 322-// newestFirstMaps marks the games whose maps are dated captures of one322+// newestFirstWorlds marks the games whose maps are dated captures of one323323 // ground: a version history. The picker's first entry is the map the viewer324324 // opens, and a version history should open on the present, so these games325325 // sort their date-titled maps newest first.326-var newestFirstMaps = map[string]bool{326+var newestFirstWorlds = map[string]bool{327327 "bend-or": true,328328 }329329 330330 // The raster beneath an icon decides which outline is legible, so this is331331 // declared rather than derived. A game whose maps are all drawn the same way332332 // says so once; a single map that differs from its game overrides it.333-var iconOutsetByGame = map[string]string{333+var iconOutsetByVolume = map[string]string{334334 "clair-obscur-expedition-33": "dark",335335 "cyberpunk-2077": "dark", // Night City's neon-on-black art, either source336336 "fallout-new-vegas": "dark", // pale Pip-Boy rasters throughout
@@ -339,16 +339,16 @@ var iconOutsetByGame = map[string]string{
339339 "sonic-frontiers": "dark",340340 }341341 342-var iconOutsetByMap = map[int64]string{342+var iconOutsetByWorld = map[int64]string{343343 3: "dark", // Skyrim344344 18: "dark", // Solstheim345345 }346346 347347 func iconOutsetFor(raw rawMap) string {348- if outset, ok := iconOutsetByMap[raw.ID]; ok {348+ if outset, ok := iconOutsetByWorld[raw.ID]; ok {349349 return outset350350 }351- return iconOutsetByGame[raw.Game.Slug]351+ return iconOutsetByVolume[raw.Game.Slug]352352 }353353 354354 func main() {
@@ -389,9 +389,9 @@ func run(source, tileManifestPath, bundleDir string) error {
389389 if err := readJSON(tileManifestPath, &tiles); err != nil {390390 return err391391 }392- tilesByPath := make(map[string]tileVariantManifest, len(tiles.Variants))393- alignedWith := make(map[string][]tileVariantManifest)394- for _, variant := range tiles.Variants {392+ tilesByPath := make(map[string]tileLensManifest, len(tiles.Lenses))393+ alignedWith := make(map[string][]tileLensManifest)394+ for _, variant := range tiles.Lenses {395395 if variant.AlignedWith != "" {396396 alignedWith[variant.AlignedWith] = append(alignedWith[variant.AlignedWith], variant)397397 continue
@@ -408,55 +408,55 @@ func run(source, tileManifestPath, bundleDir string) error {
408408 },409409 }410410 for _, gameRef := range index.Games {411- game, err := buildGame(archiveRoot, tilesByPath, alignedWith, gameRef, out.TileGrid)411+ game, err := buildVolume(archiveRoot, tilesByPath, alignedWith, gameRef, out.TileGrid)412412 if err != nil {413413 return fmt.Errorf("%s: %w", gameRef.Title, err)414414 }415- if len(game.Maps) > 0 {416- out.Games = append(out.Games, game)415+ if len(game.Worlds) > 0 {416+ out.Volumes = append(out.Volumes, game)417417 }418418 }419419 420- merged, err := mergeAcrossSources(out.Games, out.TileGrid)420+ merged, err := mergeAcrossSources(out.Volumes, out.TileGrid)421421 if err != nil {422422 return err423423 }424- out.Games = merged424+ out.Volumes = merged425425 426- for index := range out.Games {427- if err := resolveStandardIcons(&out.Games[index]); err != nil {428- return fmt.Errorf("%s: %w", out.Games[index].Slug, err)426+ for index := range out.Volumes {427+ if err := resolveStandardIcons(&out.Volumes[index]); err != nil {428+ return fmt.Errorf("%s: %w", out.Volumes[index].Slug, err)429429 }430430 }431431 432- sort.Slice(out.Games, func(i, j int) bool { return out.Games[i].Title < out.Games[j].Title })432+ sort.Slice(out.Volumes, func(i, j int) bool { return out.Volumes[i].Title < out.Volumes[j].Title })433433 return writeBundles(out, tiles, filepath.Dir(tileManifestPath), bundleDir)434434 }435435 436-func buildGame(436+func buildVolume(437437 archiveRoot string,438- tilesByPath map[string]tileVariantManifest,439- alignedWith map[string][]tileVariantManifest,438+ tilesByPath map[string]tileLensManifest,439+ alignedWith map[string][]tileLensManifest,440440 ref archiveGame,441441 grid tileGrid,442-) (catalogGame, error) {442+) (catalogVolume, error) {443443 gamePath := filepath.Join(archiveRoot, ref.Directory)444444 mapDirs, err := filepath.Glob(filepath.Join(gamePath, "maps", "*"))445445 if err != nil {446- return catalogGame{}, err446+ return catalogVolume{}, err447447 }448- game := catalogGame{ID: ref.ID, Title: ref.Title}448+ game := catalogVolume{ID: ref.ID, Title: ref.Title}449449 for _, mapDir := range mapDirs {450450 info, err := os.Stat(mapDir)451451 if err != nil || !info.IsDir() {452452 continue453453 }454- pieces, gameSlug, err := buildMap(mapDir, tilesByPath, alignedWith, grid)454+ pieces, gameSlug, err := buildWorld(mapDir, tilesByPath, alignedWith, grid)455455 if err != nil {456- if errors.Is(err, errMapNotReady) {456+ if errors.Is(err, errWorldNotReady) {457457 continue458458 }459- return catalogGame{}, err459+ return catalogVolume{}, err460460 }461461 if game.Slug == "" {462462 game.Slug = gameSlug
@@ -475,14 +475,14 @@ func buildGame(
475475 DonorPins: pieces[index].PinCount,476476 }}477477 }478- game.Maps = append(game.Maps, pieces...)478+ game.Worlds = append(game.Worlds, pieces...)479479 }480- sortGameMaps(game.Slug, game.Maps)481- if err := attachGameIcons(gamePath, &game); err != nil {482- return catalogGame{}, err480+ sortVolumeWorlds(game.Slug, game.Worlds)481+ if err := attachVolumeIcons(gamePath, &game); err != nil {482+ return catalogVolume{}, err483483 }484484 if err := speakConventions(&game); err != nil {485- return catalogGame{}, fmt.Errorf("%s: %w", game.Slug, err)485+ return catalogVolume{}, fmt.Errorf("%s: %w", game.Slug, err)486486 }487487 return game, nil488488 }
@@ -495,14 +495,14 @@ func buildGame(
495495 // to, the outset its curation chose. Then the whole game is held to the496496 // registry, so an unregistered key or a foreign value fails here, one497497 // build old, rather than riding into a bundle.498-func speakConventions(game *catalogGame) error {499- for mapIndex := range game.Maps {500- m := &game.Maps[mapIndex]498+func speakConventions(game *catalogVolume) error {499+ for mapIndex := range game.Worlds {500+ m := &game.Worlds[mapIndex]501501 if m.IconOutset != "" {502502 m.Attrs = withAttr(m.Attrs, semconv.KeyIconOutset, m.IconOutset)503503 }504- if err := semconv.Validate(semconv.EntityMap, m.Attrs); err != nil {505- return fmt.Errorf("map %s: %w", m.Slug, err)504+ if err := semconv.Validate(semconv.EntityWorld, m.Attrs); err != nil {505+ return fmt.Errorf("world %s: %w", m.Slug, err)506506 }507507 for groupIndex := range m.Groups {508508 categories := m.Groups[groupIndex].Categories
@@ -529,11 +529,11 @@ func speakConventions(game *catalogGame) error {
529529 category.Attrs = withAttr(category.Attrs, semconv.KeyIconKind, kind)530530 }531531 if err := semconv.Validate(semconv.EntityCategory, category.Attrs); err != nil {532- return fmt.Errorf("map %s category %q: %w", m.Slug, category.Title, err)532+ return fmt.Errorf("world %s category %q: %w", m.Slug, category.Title, err)533533 }534534 for _, location := range category.Locations {535535 if err := semconv.Validate(semconv.EntityLocation, location.Attrs); err != nil {536- return fmt.Errorf("map %s pin %q: %w", m.Slug, location.Title, err)536+ return fmt.Errorf("world %s pin %q: %w", m.Slug, location.Title, err)537537 }538538 }539539 }
@@ -559,9 +559,9 @@ func withAttr(attrs map[string]string, key, value string) map[string]string {
559559 // resolve too, and only where a source's own icon has not already won the560560 // slot. A declaration the library cannot answer fails the build: the561561 // promise was made in a translator, and it is kept here or heard about.562-func resolveStandardIcons(game *catalogGame) error {563- for mapIndex := range game.Maps {564- m := &game.Maps[mapIndex]562+func resolveStandardIcons(game *catalogVolume) error {563+ for mapIndex := range game.Worlds {564+ m := &game.Worlds[mapIndex]565565 for groupIndex := range m.Groups {566566 categories := m.Groups[groupIndex].Categories567567 for categoryIndex := range categories {
@@ -572,7 +572,7 @@ func resolveStandardIcons(game *catalogGame) error {
572572 }573573 data, asset, err := icons.Standard(ref)574574 if err != nil {575- return fmt.Errorf("map %s category %q: %w", m.Slug, category.Title, err)575+ return fmt.Errorf("world %s category %q: %w", m.Slug, category.Title, err)576576 }577577 if game.Icons == nil {578578 game.Icons = make(map[string][]byte)
@@ -587,15 +587,15 @@ func resolveStandardIcons(game *catalogGame) error {
587587 return nil588588 }589589 590-func sortGameMaps(gameSlug string, maps []catalogMap) {590+func sortVolumeWorlds(gameSlug string, maps []catalogWorld) {591591 order := make(map[string]int)592- for index, slug := range preferredMapOrder[gameSlug] {592+ for index, slug := range preferredWorldOrder[gameSlug] {593593 order[slug] = index594594 }595595 // A version-history game reads its date titles backward: the newest596596 // capture opens first, and the past waits one click below it.597597 after := func(a, b string) bool { return a < b }598- if newestFirstMaps[gameSlug] {598+ if newestFirstWorlds[gameSlug] {599599 after = func(a, b string) bool { return a > b }600600 }601601 titles := make(map[string]string, len(maps))
@@ -604,7 +604,7 @@ func sortGameMaps(gameSlug string, maps []catalogMap) {
604604 }605605 // Maps sort as families: an inset carries its parent's position and follows606606 // it, so a split sheet stays together in the picker.607- family := func(m catalogMap) (string, string) {607+ family := func(m catalogWorld) (string, string) {608608 if m.Parent == "" {609609 return m.Slug, m.Title610610 }
@@ -631,24 +631,24 @@ func sortGameMaps(gameSlug string, maps []catalogMap) {
631631 })632632 }633633 634-// buildMap returns one entry per map, or several when a sheet holding separate634+// buildWorld returns one entry per map, or several when a sheet holding separate635635 // places is declared for splitting.636-func buildMap(636+func buildWorld(637637 mapDir string,638- tilesByPath map[string]tileVariantManifest,639- alignedWith map[string][]tileVariantManifest,638+ tilesByPath map[string]tileLensManifest,639+ alignedWith map[string][]tileLensManifest,640640 grid tileGrid,641-) ([]catalogMap, string, error) {641+) ([]catalogWorld, string, error) {642642 var snapshots []snapshotIndex643643 indexPath := filepath.Join(mapDir, "snapshots", "index.json")644644 if err := readJSON(indexPath, &snapshots); err != nil {645645 if errors.Is(err, os.ErrNotExist) {646- return nil, "", fmt.Errorf("%w: snapshot index is missing", errMapNotReady)646+ return nil, "", fmt.Errorf("%w: snapshot index is missing", errWorldNotReady)647647 }648648 return nil, "", err649649 }650650 if len(snapshots) == 0 {651- return nil, "", fmt.Errorf("%w: snapshot index is empty", errMapNotReady)651+ return nil, "", fmt.Errorf("%w: snapshot index is empty", errWorldNotReady)652652 }653653 sort.Slice(snapshots, func(i, j int) bool { return snapshots[i].CapturedAt < snapshots[j].CapturedAt })654654 latest := snapshots[len(snapshots)-1]
@@ -676,7 +676,7 @@ func buildMap(
676676 return nil, "", err677677 }678678 679- m := catalogMap{679+ m := catalogWorld{680680 ID: raw.ID,681681 Title: raw.Title,682682 Slug: raw.Slug,
@@ -686,7 +686,7 @@ func buildMap(
686686 Attrs: raw.Attrs,687687 }688688 if len(raw.Config.TileSets) == 0 {689- return nil, "", fmt.Errorf("%w: no tile sets", errMapNotReady)689+ return nil, "", fmt.Errorf("%w: no tile sets", errWorldNotReady)690690 }691691 // The catalog's grid is the window most maps are cut from; this map's own692692 // takes its place below, and what is left of the shared one -- the size of
@@ -695,27 +695,27 @@ func buildMap(
695695 for _, set := range raw.Config.TileSets {696696 tiles, ok := tilesByPath[set.Path]697697 if !ok {698- return nil, "", fmt.Errorf("%w: tile layer %s is missing", errMapNotReady, set.Path)698+ return nil, "", fmt.Errorf("%w: tile layer %s is missing", errWorldNotReady, set.Path)699699 }700700 // Every layer of a map is a picture of the same ground, so they agree on701701 // the window it is cut from. One that does not would be a map drawn in702702 // two places at once, and no pin could be placed on it.703703 window := tiles.Grid704- if window == (mapGrid{}) {704+ if window == (worldGrid{}) {705705 // An index written before layers carried their window: the shared706706 // one is what every map in it was cut from.707- window = mapGrid{SourceZoom: shared.SourceZoom, FirstTile: shared.FirstTile}707+ window = worldGrid{SourceZoom: shared.SourceZoom, FirstTile: shared.FirstTile}708708 }709- if len(m.Variants) == 0 {709+ if len(m.Lenses) == 0 {710710 grid.SourceZoom, grid.FirstTile = window.SourceZoom, window.FirstTile711- if window != (mapGrid{SourceZoom: shared.SourceZoom, FirstTile: shared.FirstTile}) {711+ if window != (worldGrid{SourceZoom: shared.SourceZoom, FirstTile: shared.FirstTile}) {712712 m.Grid = &window713713 }714714 } else if window.SourceZoom != grid.SourceZoom || window.FirstTile != grid.FirstTile {715715 return nil, "", fmt.Errorf("%w: tile layer %s sits in a different window from %s",716- errMapNotReady, set.Path, raw.Config.TileSets[0].Path)716+ errWorldNotReady, set.Path, raw.Config.TileSets[0].Path)717717 }718- m.Variants = append(m.Variants, variant{718+ m.Lenses = append(m.Lenses, lens{719719 Name: set.Name,720720 Tiles: tiles.AssetPath,721721 MinZoom: tiles.MinZoom,
@@ -737,7 +737,7 @@ func buildMap(
737737 if aligned.Grid.SourceZoom != grid.SourceZoom || aligned.Grid.FirstTile != grid.FirstTile {738738 return nil, "", fmt.Errorf("aligned layer %s was rendered in a different window", aligned.SourcePath)739739 }740- m.Variants = append(m.Variants, variant{740+ m.Lenses = append(m.Lenses, lens{741741 Name: aligned.Name,742742 Tiles: aligned.AssetPath,743743 MinZoom: aligned.MinZoom,
@@ -817,7 +817,7 @@ func buildMap(
817817 }818818 }819819 resolveDescriptionLinks(&m)820- pieces, err := splitMap(m, raw, grid)820+ pieces, err := splitWorld(m, raw, grid)821821 if err != nil {822822 return nil, "", err823823 }
@@ -842,7 +842,7 @@ var bareURL = regexp.MustCompile(`\s*\(?\s*https?://[^\s)]+\)?`)
842842 // dead weight at best. Where the link pointed at another location in this same843843 // map, the target is kept as a structured cross-reference the viewer can844844 // navigate to instead.845-func resolveDescriptionLinks(m *catalogMap) {845+func resolveDescriptionLinks(m *catalogWorld) {846846 known := make(map[int64]bool)847847 for _, group := range m.Groups {848848 for _, category := range group.Categories {
@@ -884,15 +884,15 @@ func resolveDescriptionLinks(m *catalogMap) {
884884 }885885 }886886 887-func attachGameIcons(gamePath string, game *catalogGame) error {887+func attachVolumeIcons(gamePath string, game *catalogVolume) error {888888 if game.Slug == "" {889889 return nil890890 }891891 game.Icons = make(map[string][]byte)892892 copied := make(map[string]string)893- for mapIndex := range game.Maps {894- for groupIndex := range game.Maps[mapIndex].Groups {895- categories := game.Maps[mapIndex].Groups[groupIndex].Categories893+ for mapIndex := range game.Worlds {894+ for groupIndex := range game.Worlds[mapIndex].Groups {895+ categories := game.Worlds[mapIndex].Groups[groupIndex].Categories896896 for categoryIndex := range categories {897897 category := &categories[categoryIndex]898898 if !validIconKey(category.Icon) {
@@ -901,7 +901,7 @@ func attachGameIcons(gamePath string, game *catalogGame) error {
901901 asset, found := copied[category.Icon]902902 if !found {903903 var err error904- asset, err = readGameIcon(gamePath, game, category.Icon)904+ asset, err = readVolumeIcon(gamePath, game, category.Icon)905905 if err != nil {906906 return err907907 }
@@ -915,11 +915,11 @@ func attachGameIcons(gamePath string, game *catalogGame) error {
915915 return nil916916 }917917 918-// readGameIcon takes whichever form the archive holds. Most games publish an918+// readVolumeIcon takes whichever form the archive holds. Most games publish an919919 // icon font that renders to SVG; some publish a marker strip instead, which920920 // slices into PNG. The bytes ride the game into its bundle, named relative921921 // to the bundle's own icons tree.922-func readGameIcon(gamePath string, game *catalogGame, icon string) (string, error) {922+func readVolumeIcon(gamePath string, game *catalogVolume, icon string) (string, error) {923923 for _, candidate := range []string{".svg", ".png"} {924924 source := filepath.Join(gamePath, "icons", icon+candidate)925925 contents, err := os.ReadFile(source)
M tools/generate/main_test.go +16 -16
@@ -53,9 +53,9 @@ func TestAttachGameIcons(t *testing.T) {
5353 t.Fatal(err)5454 }5555 56- game := catalogGame{56+ game := catalogVolume{5757 Slug: "pokemon-red-blue-yellow",58- Maps: []catalogMap{{58+ Worlds: []catalogWorld{{5959 Groups: []catalogGroup{{6060 Categories: []catalogCategory{6161 {Icon: "pokemon_center"},
@@ -64,11 +64,11 @@ func TestAttachGameIcons(t *testing.T) {
6464 }},6565 }},6666 }67- if err := attachGameIcons(source, &game); err != nil {67+ if err := attachVolumeIcons(source, &game); err != nil {6868 t.Fatal(err)6969 }7070 71- categories := game.Maps[0].Groups[0].Categories71+ categories := game.Worlds[0].Groups[0].Categories7272 if got, want := categories[0].IconAsset, "pokemon_center.svg"; got != want {7373 t.Fatalf("icon asset = %q, want %q", got, want)7474 }
@@ -87,7 +87,7 @@ func TestBuildGameSkipsMapWithoutSnapshotIndex(t *testing.T) {
8787 t.Fatal(err)8888 }8989 90- game, err := buildGame(90+ game, err := buildVolume(9191 archiveRoot,9292 nil,9393 nil,
@@ -101,20 +101,20 @@ func TestBuildGameSkipsMapWithoutSnapshotIndex(t *testing.T) {
101101 if err != nil {102102 t.Fatal(err)103103 }104- if len(game.Maps) != 0 {105- t.Fatalf("maps = %d, want 0", len(game.Maps))104+ if len(game.Worlds) != 0 {105+ t.Fatalf("maps = %d, want 0", len(game.Worlds))106106 }107107 }108108 109109 func TestSortGameMapsPrefersPrimaryMap(t *testing.T) {110- maps := []catalogMap{110+ maps := []catalogWorld{111111 {Title: "Big MT", Slug: "big-mt"},112112 {Title: "Zion Canyon", Slug: "zion-canyon"},113113 {Title: "Mojave Wasteland", Slug: "mojave-wasteland"},114114 {Title: "Sierra Madre", Slug: "sierra-madre"},115115 }116116 117- sortGameMaps("fallout-new-vegas", maps)117+ sortVolumeWorlds("fallout-new-vegas", maps)118118 119119 want := []string{"mojave-wasteland", "big-mt", "sierra-madre", "zion-canyon"}120120 for index, slug := range want {
@@ -129,7 +129,7 @@ func TestSortGameMapsPrefersPrimaryMap(t *testing.T) {
129129 // this way once, and every layer's pins drew over every other.130130 func TestBuildPayloadPacksEveryColumn(t *testing.T) {131131 region := int64(77)132- m := catalogMap{Groups: []catalogGroup{{Categories: []catalogCategory{132+ m := catalogWorld{Groups: []catalogGroup{{Categories: []catalogCategory{133133 {Locations: []catalogLocation{134134 {ID: 11, Title: "Sky Mine", Latitude: 1.5, Longitude: -2.5, Shard: 1783},135135 }},
@@ -213,8 +213,8 @@ func TestMarkSurfacesMeasuresContentsNotTheWindow(t *testing.T) {
213213 }214214 }215215 window := contentBounds{X: 2000, Y: 2000, Width: 3000, Height: 3000}216- m := catalogMap{217- Variants: []variant{{Bounds: &window}},216+ m := catalogWorld{217+ Lenses: []lens{{Bounds: &window}},218218 Groups: []catalogGroup{{219219 Categories: []catalogCategory{{220220 Locations: []catalogLocation{
@@ -229,7 +229,7 @@ func TestMarkSurfacesMeasuresContentsNotTheWindow(t *testing.T) {
229229 230230 markSurfaces(&m, grid)231231 232- surface := m.Variants[0].Surface232+ surface := m.Lenses[0].Surface233233 if surface == nil {234234 t.Fatal("no surface measured")235235 }
@@ -253,8 +253,8 @@ func TestMarkSurfacesKeepsGroundAlreadyMeasured(t *testing.T) {
253253 grid := tileGrid{SourceZoom: 13, FirstTile: 4064, TileSize: 256, Size: 8192}254254 window := contentBounds{X: 2000, Y: 2000, Width: 3000, Height: 3000}255255 ground := contentBounds{X: 2500, Y: 2500, Width: 2000, Height: 2000}256- m := catalogMap{257- Variants: []variant{{Bounds: &window, Surface: &ground}},256+ m := catalogWorld{257+ Lenses: []lens{{Bounds: &window, Surface: &ground}},258258 Groups: []catalogGroup{{259259 Categories: []catalogCategory{{260260 Locations: []catalogLocation{{
@@ -267,7 +267,7 @@ func TestMarkSurfacesKeepsGroundAlreadyMeasured(t *testing.T) {
267267 268268 markSurfaces(&m, grid)269269 270- surface := m.Variants[0].Surface270+ surface := m.Lenses[0].Surface271271 if surface.X > ground.X || surface.Y > ground.Y ||272272 surface.X+surface.Width < ground.X+ground.Width ||273273 surface.Y+surface.Height < ground.Y+ground.Height {
M tools/generate/merge.go +41 -41
@@ -181,7 +181,7 @@ type heldPin struct {
181181 // bundle written per slug is the game as every source together knows it.182182 // The captures stay untouched in the archive, so recomposing under a better183183 // policy never needs anything recrawled.184-func mergeAcrossSources(games []catalogGame, shared tileGrid) ([]catalogGame, error) {184+func mergeAcrossSources(games []catalogVolume, shared tileGrid) ([]catalogVolume, error) {185185 bySlug := make(map[string][]int)186186 var order []string187187 for index, game := range games {
@@ -208,15 +208,15 @@ func mergeAcrossSources(games []catalogGame, shared tileGrid) ([]catalogGame, er
208208 if donor == winner {209209 continue210210 }211- if err := mergeGame(&games[winner], &games[donor], shared); err != nil {211+ if err := mergeVolume(&games[winner], &games[donor], shared); err != nil {212212 return nil, fmt.Errorf("merge %s: %w", slug, err)213213 }214214 absorbed[donor] = true215215 }216- sortGameMaps(games[winner].Slug, games[winner].Maps)216+ sortVolumeWorlds(games[winner].Slug, games[winner].Worlds)217217 }218218 219- composed := make([]catalogGame, 0, len(games))219+ composed := make([]catalogVolume, 0, len(games))220220 for index, game := range games {221221 if !absorbed[index] {222222 composed = append(composed, game)
@@ -225,9 +225,9 @@ func mergeAcrossSources(games []catalogGame, shared tileGrid) ([]catalogGame, er
225225 return composed, nil226226 }227227 228-func newestCapture(game catalogGame) string {228+func newestCapture(game catalogVolume) string {229229 newest := ""230- for _, m := range game.Maps {230+ for _, m := range game.Worlds {231231 if m.UpdatedAt > newest {232232 newest = m.UpdatedAt233233 }
@@ -235,13 +235,13 @@ func newestCapture(game catalogGame) string {
235235 return newest236236 }237237 238-func mergeGame(winner, donor *catalogGame, shared tileGrid) error {239- winnerMaps := make(map[string]*catalogMap, len(winner.Maps))240- for index := range winner.Maps {241- winnerMaps[winner.Maps[index].Slug] = &winner.Maps[index]238+func mergeVolume(winner, donor *catalogVolume, shared tileGrid) error {239+ winnerMaps := make(map[string]*catalogWorld, len(winner.Worlds))240+ for index := range winner.Worlds {241+ winnerMaps[winner.Worlds[index].Slug] = &winner.Worlds[index]242242 }243- for index := range donor.Maps {244- donorMap := &donor.Maps[index]243+ for index := range donor.Worlds {244+ donorMap := &donor.Worlds[index]245245 target := winnerMaps[donorMap.Slug]246246 if target == nil {247247 // Sources do not divide the world the same way: one source's
@@ -251,12 +251,12 @@ func mergeGame(winner, donor *catalogGame, shared tileGrid) error {
251251 // whether the places both name determine a transformation, so252252 // before a map is taken as new, it is tried against every map253253 // the game already draws.254- target = overlappingMap(winner, donorMap, shared)254+ target = overlappingWorld(winner, donorMap, shared)255255 }256256 if target == nil {257257 // Nothing the game draws pictures this ground: the map joins258258 // whole, as this source captured it, icons and all.259- if err := contributeMap(winner, donor, donorMap); err != nil {259+ if err := contributeWorld(winner, donor, donorMap); err != nil {260260 return err261261 }262262 fmt.Printf("merge %s: %s joins whole from %s\n",
@@ -268,28 +268,28 @@ func mergeGame(winner, donor *catalogGame, shared tileGrid) error {
268268 winner.Slug, donorMap.Slug)269269 continue270270 }271- if err := mergeMap(winner, target, donor, donorMap, shared); err != nil {271+ if err := mergeWorld(winner, target, donor, donorMap, shared); err != nil {272272 return err273273 }274274 }275275 return nil276276 }277277 278-// overlappingMap finds the winner map that pictures the same ground as a278+// overlappingWorld finds the winner map that pictures the same ground as a279279 // donor map under another slug, if any does: the one whose named places fit280280 // the donor's through an affine that closes. The fit is the compatibility281281 // test the differing projections make necessary -- coordinates cannot be282282 // compared, but the places can.283-func overlappingMap(winner *catalogGame, donorMap *catalogMap, shared tileGrid) *catalogMap {284- donorAnchors := anchorsOfMap(donorMap, gridOf(donorMap, shared))285- var best *catalogMap283+func overlappingWorld(winner *catalogVolume, donorMap *catalogWorld, shared tileGrid) *catalogWorld {284+ donorAnchors := anchorsOfWorld(donorMap, gridOf(donorMap, shared))285+ var best *catalogWorld286286 bestAnchors := 0287- for index := range winner.Maps {288- candidate := &winner.Maps[index]287+ for index := range winner.Worlds {288+ candidate := &winner.Worlds[index]289289 if candidate.Parent != "" {290290 continue291291 }292- _, report, err := blend.Fit(donorAnchors, anchorsOfMap(candidate, gridOf(candidate, shared)))292+ _, report, err := blend.Fit(donorAnchors, anchorsOfWorld(candidate, gridOf(candidate, shared)))293293 if err != nil {294294 continue295295 }
@@ -304,12 +304,12 @@ func overlappingMap(winner *catalogGame, donorMap *catalogMap, shared tileGrid)
304304 return best305305 }306306 307-// contributeMap carries one source's map into the composed game untouched:307+// contributeWorld carries one source's map into the composed game untouched:308308 // its layers, pins, and zones as captured, and its icons brought across --309309 // under their own names where those are free or already hold the same bytes,310310 // under source-prefixed names where the composed game spells something else311311 // with them.312-func contributeMap(winner, donor *catalogGame, donorMap *catalogMap) error {312+func contributeWorld(winner, donor *catalogVolume, donorMap *catalogWorld) error {313313 contributed := *donorMap314314 sourceTag := slugifyLabel(sourceLabelOf(donorMap, donor))315315 renamed := make(map[string]string)
@@ -342,21 +342,21 @@ func contributeMap(winner, donor *catalogGame, donorMap *catalogMap) error {
342342 category.IconAsset = name343343 }344344 }345- winner.Maps = append(winner.Maps, contributed)345+ winner.Worlds = append(winner.Worlds, contributed)346346 return nil347347 }348348 349-func mergeMap(350- winnerGame *catalogGame,351- winner *catalogMap,352- donorGame *catalogGame,353- donor *catalogMap,349+func mergeWorld(350+ winnerGame *catalogVolume,351+ winner *catalogWorld,352+ donorGame *catalogVolume,353+ donor *catalogWorld,354354 shared tileGrid,355355 ) error {356356 winnerGrid := gridOf(winner, shared)357357 donorGrid := gridOf(donor, shared)358358 359- affine, report, err := blend.Fit(anchorsOfMap(donor, donorGrid), anchorsOfMap(winner, winnerGrid))359+ affine, report, err := blend.Fit(anchorsOfWorld(donor, donorGrid), anchorsOfWorld(winner, winnerGrid))360360 if err != nil {361361 fmt.Printf("merge %s/%s: pins stay apart: %v\n", winnerGame.Slug, winner.Slug, err)362362 return nil
@@ -530,7 +530,7 @@ type placedPin struct {
530530 tokens map[string]bool531531 }532532 533-func indexWinner(winner *catalogMap, grid tileGrid) *winnerIndex {533+func indexWinner(winner *catalogWorld, grid tileGrid) *winnerIndex {534534 index := &winnerIndex{535535 byName: make(map[string][]int),536536 categories: make(map[string]*catalogCategory),
@@ -700,7 +700,7 @@ func tokensOf(normalized string) map[string]bool {
700700 // carryIcon brings a merged category's icon across from the donor's archive701701 // under a source-prefixed name, so it cannot displace a serving icon that702702 // shares its key.703-func carryIcon(winnerGame, donorGame *catalogGame, category *catalogCategory, sourceLabel string) error {703+func carryIcon(winnerGame, donorGame *catalogVolume, category *catalogCategory, sourceLabel string) error {704704 if category.IconAsset == "" {705705 return nil706706 }
@@ -721,7 +721,7 @@ func carryIcon(winnerGame, donorGame *catalogGame, category *catalogCategory, so
721721 722722 // mergedGroupID numbers the source's group away from every id the map723723 // already uses.724-func mergedGroupID(winner *catalogMap) int64 {724+func mergedGroupID(winner *catalogWorld) int64 {725725 used := make(map[int64]bool)726726 for _, group := range winner.Groups {727727 used[group.ID] = true
@@ -733,13 +733,13 @@ func mergedGroupID(winner *catalogMap) int64 {
733733 return id734734 }735735 736-func sourceLabelOf(donor *catalogMap, donorGame *catalogGame) string {736+func sourceLabelOf(donor *catalogWorld, donorGame *catalogVolume) string {737737 for _, account := range donor.Merged {738738 if account.Origin {739739 return account.Source740740 }741741 }742- for _, v := range donor.Variants {742+ for _, v := range donor.Lenses {743743 if v.Name != "" && v.Name != "Default" {744744 return v.Name745745 }
@@ -750,7 +750,7 @@ func sourceLabelOf(donor *catalogMap, donorGame *catalogGame) string {
750750 // sourceSlugOf reads the canonical slug off the donor's origin account. A751751 // map without one -- there should be none, every map opens its account at752752 // composition -- simply contributes no slug rather than a guessed one.753-func sourceSlugOf(donor *catalogMap) string {753+func sourceSlugOf(donor *catalogWorld) string {754754 for _, account := range donor.Merged {755755 if account.Origin {756756 return account.Slug
@@ -779,7 +779,7 @@ func slugifyLabel(label string) string {
779779 return string(out)780780 }781781 782-func gridOf(m *catalogMap, shared tileGrid) tileGrid {782+func gridOf(m *catalogWorld, shared tileGrid) tileGrid {783783 if m.Grid == nil {784784 return shared785785 }
@@ -791,7 +791,7 @@ func gridOf(m *catalogMap, shared tileGrid) tileGrid {
791791 }792792 }793793 794-func anchorsOfMap(m *catalogMap, grid tileGrid) []blend.Anchor {794+func anchorsOfWorld(m *catalogWorld, grid tileGrid) []blend.Anchor {795795 var anchors []blend.Anchor796796 for _, group := range m.Groups {797797 for _, category := range group.Categories {
@@ -821,7 +821,7 @@ func enrichedCount(merge *mergedSource) int {
821821 // match one-to-one, no identifier doubled, nothing the serving map held made822822 // worse. It fails the build rather than writing a bundle that quietly lost823823 // something -- or quietly agreed too much.824-func mergeGate(merge *mergedSource, winner *catalogMap) error {824+func mergeGate(merge *mergedSource, winner *catalogWorld) error {825825 accounted := len(merge.Matched) + merge.Added + len(merge.Held) + len(merge.Rejected)826826 if accounted != merge.DonorPins {827827 return fmt.Errorf("merge accounts for %d of %d donor pins", accounted, merge.DonorPins)
@@ -870,7 +870,7 @@ func mergeGate(merge *mergedSource, winner *catalogMap) error {
870870 }871871 }872872 if counted != winner.PinCount {873- return fmt.Errorf("map holds %d pins but claims %d", counted, winner.PinCount)873+ return fmt.Errorf("world holds %d pins but claims %d", counted, winner.PinCount)874874 }875875 return nil876876 }
M tools/generate/shard.go +27 -27
@@ -22,18 +22,18 @@ type shardMode int
2222 2323 const (2424 shardNone shardMode = iota25- // shardIntoMaps gives each piece its own entry in the map picker. Use it25+ // shardIntoWorlds gives each piece its own entry in the map picker. Use it2626 // when the pieces are unrelated places that happen to share a sheet.27- shardIntoMaps28- // shardIntoVariants keeps one map and offers the pieces as layers, so the27+ shardIntoWorlds28+ // shardIntoLenses keeps one map and offers the pieces as layers, so the2929 // view survives switching between them. Use it when the pieces are the same3030 // ground at different heights.31- shardIntoVariants31+ shardIntoLenses3232 )3333 34-var shardedMaps = map[int64]shardMode{35- 602: shardIntoMaps, // Mojave Wasteland: eight district insets in the margins36- 536: shardIntoVariants, // Hyrule: Sky, Surface and Depths of one world34+var shardedWorlds = map[int64]shardMode{35+ 602: shardIntoWorlds, // Mojave Wasteland: eight district insets in the margins36+ 536: shardIntoLenses, // Hyrule: Sky, Surface and Depths of one world3737 }3838 3939 type shard struct {
@@ -354,7 +354,7 @@ func rehomeStrays(pieces []shard, placed map[int64][2]float64) {
354354 355355 func orderShards(pieces []shard, mode shardMode) {356356 sort.Slice(pieces, func(a, b int) bool {357- if mode == shardIntoVariants {357+ if mode == shardIntoLenses {358358 if pieces[a].Bounds.Y != pieces[b].Bounds.Y {359359 return pieces[a].Bounds.Y < pieces[b].Bounds.Y360360 }
@@ -427,19 +427,19 @@ func unprojectLatitude(y float64, grid tileGrid) float64 {
427427 return math.Atan(math.Sinh(math.Pi*(1-2*yTile/worldTiles))) * 180 / math.Pi428428 }429429 430-// splitMap takes a sheet apart when one is declared for it, and otherwise430+// splitWorld takes a sheet apart when one is declared for it, and otherwise431431 // hands back the single map it was given.432-func splitMap(m catalogMap, raw rawMap, grid tileGrid) ([]catalogMap, error) {433- mode := shardedMaps[m.ID]432+func splitWorld(m catalogWorld, raw rawMap, grid tileGrid) ([]catalogWorld, error) {433+ mode := shardedWorlds[m.ID]434434 if mode == shardNone {435- return []catalogMap{m}, nil435+ return []catalogWorld{m}, nil436436 }437437 pieces, err := planShards(raw, grid, mode)438438 if err != nil {439439 return nil, fmt.Errorf("split %s: %w", m.Title, err)440440 }441- if mode == shardIntoVariants {442- return []catalogMap{asVariants(m, pieces)}, nil441+ if mode == shardIntoLenses {442+ return []catalogWorld{asVariants(m, pieces)}, nil443443 }444444 return asMaps(m, pieces), nil445445 }
@@ -447,15 +447,15 @@ func splitMap(m catalogMap, raw rawMap, grid tileGrid) ([]catalogMap, error) {
447447 // asMaps gives each piece its own map. The largest keeps the sheet's name and448448 // leads; the rest are named after it so they sort together in the picker449449 // instead of scattering among the game's standalone maps.450-func asMaps(m catalogMap, pieces []shard) []catalogMap {451- out := make([]catalogMap, 0, len(pieces))450+func asMaps(m catalogWorld, pieces []shard) []catalogWorld {451+ out := make([]catalogWorld, 0, len(pieces))452452 for index, piece := range pieces {453453 copied := m454454 copied.Groups = keepLocations(m.Groups, piece.Locations)455455 copied.Zones = keepZones(m.Zones, piece.Regions, piece.Region.ID)456456 copied.PinCount = countLocations(copied.Groups)457457 copied.Center = piece.Center458- copied.Variants = boundVariants(m.Variants, piece.Bounds, piece.Surface, 0)458+ copied.Lenses = boundVariants(m.Lenses, piece.Bounds, piece.Surface, 0)459459 if index > 0 {460460 copied.ID = piece.Region.ID461461 copied.Title = m.Title + " — " + piece.Region.Title
@@ -470,11 +470,11 @@ func asMaps(m catalogMap, pieces []shard) []catalogMap {
470470 // asVariants keeps one map and offers the pieces as layers. Locations and zones471471 // carry the piece they belong to so the viewer can show one layer at a time,472472 // and the view survives switching because the map itself never changes.473-func asVariants(m catalogMap, pieces []shard) catalogMap {474- var variants []variant473+func asVariants(m catalogWorld, pieces []shard) catalogWorld {474+ var variants []lens475475 var dropped []int64476476 for _, piece := range pieces {477- bound := boundVariants(m.Variants, piece.Bounds, piece.Surface, piece.Region.ID)477+ bound := boundVariants(m.Lenses, piece.Bounds, piece.Surface, piece.Region.ID)478478 for index := range bound {479479 bound[index].Name = piece.Region.Title480480 }
@@ -497,7 +497,7 @@ func asVariants(m catalogMap, pieces []shard) catalogMap {
497497 }498498 dropped = append(dropped, piece.Region.ID)499499 }500- m.Variants = variants500+ m.Lenses = variants501501 m.Zones = keepZones(m.Zones, nil, dropped...)502502 if len(pieces) > 0 {503503 m.Center = pieces[0].Center
@@ -509,12 +509,12 @@ func asVariants(m catalogMap, pieces []shard) catalogMap {
509509 // either way; only the window onto it changes. The ground the piece covers510510 // travels alongside the window, because they are not the same rectangle and511511 // anything measuring the map rather than drawing it wants the ground.512-func boundVariants(variants []variant, bounds, surface contentBounds, shardID int64) []variant {512+func boundVariants(variants []lens, bounds, surface contentBounds, shardID int64) []lens {513513 // Easing two pieces apart can pull a window in past the ground it grew514514 // from, and what the grid divides has to be drawn, so the ground is clipped515515 // to the window rather than reaching beyond it.516516 ground := intersectBounds(surface, bounds)517- out := make([]variant, 0, len(variants))517+ out := make([]lens, 0, len(variants))518518 for _, source := range variants {519519 clipped := source520520 clipped.Bounds = &contentBounds{
@@ -538,9 +538,9 @@ func boundVariants(variants []variant, bounds, surface contentBounds, shardID in
538538 // locations are, and the ground its regions outline. That is the archive539539 // answering for each map rather than a list of maps to treat specially, and it540540 // says the same thing about a border whether the border is solid or patterned.541-func markSurfaces(m *catalogMap, grid tileGrid) {542- for index := range m.Variants {543- variant := &m.Variants[index]541+func markSurfaces(m *catalogWorld, grid tileGrid) {542+ for index := range m.Lenses {543+ variant := &m.Lenses[index]544544 window := worldBounds(grid)545545 if variant.Bounds != nil {546546 window = *variant.Bounds
@@ -562,7 +562,7 @@ func markSurfaces(m *catalogMap, grid tileGrid) {
562562 // Anything drawn outside the window is left out of the reckoning: a few563563 // locations sit off the sheet entirely -- three of Marathon's eighty -- and one564564 // of those would stretch the ground back over everything it had just left out.565-func contentExtent(m catalogMap, shard int64, window contentBounds, grid tileGrid) (contentBounds, bool) {565+func contentExtent(m catalogWorld, shard int64, window contentBounds, grid tileGrid) (contentBounds, bool) {566566 left, top := math.Inf(1), math.Inf(1)567567 right, bottom := math.Inf(-1), math.Inf(-1)568568 found := false
M tools/generate/split.go +8 -8
@@ -21,16 +21,16 @@ import (
2121 // so they are the part most worth not loading. Locations are overwhelmingly2222 // numbers, and numbers written as text cost several times what they measure.2323 24-// mapDetail is everything needed to draw a map except its locations, which24+// worldDetail is everything needed to draw a map except its locations, which2525 // travel packed alongside.26-type mapDetail struct {26+type worldDetail struct {2727 // Grid travels with the layers it describes: a map cut from a window of its2828 // own is the only one that carries it, and it is needed exactly when the2929 // map is opened.30- Grid *mapGrid `json:"grid,omitempty"`31- Variants []variant `json:"variants"`32- Groups []catalogGroup `json:"groups"`33- Zones []zone `json:"zones,omitempty"`30+ Grid *worldGrid `json:"grid,omitempty"`31+ Lenses []lens `json:"lenses"`32+ Groups []catalogGroup `json:"groups"`33+ Zones []zone `json:"zones,omitempty"`3434 // Attrs is the map speaking the shared conventions -- its geometry, its3535 // marker outset -- for any reader that knows the vocabulary.3636 Attrs map[string]string `json:"attrs,omitempty"`
@@ -53,10 +53,10 @@ type locationText struct {
5353 // buildPayload splits one map three ways: its layers, categories and regions5454 // as a detail structure, its locations packed, and its descriptions keyed by5555 // location.56-func buildPayload(m catalogMap) (mapDetail, []byte, map[string]locationText) {56+func buildPayload(m catalogWorld) (worldDetail, []byte, map[string]locationText) {5757 // Categories keep their identity; their locations travel packed, each5858 // carrying the position of its category in this same flattened order.59- detail := mapDetail{Grid: m.Grid, Variants: m.Variants, Zones: m.Zones, Attrs: m.Attrs, Merged: m.Merged}59+ detail := worldDetail{Grid: m.Grid, Lenses: m.Lenses, Zones: m.Zones, Attrs: m.Attrs, Merged: m.Merged}6060 var locations []bundle.Location6161 text := make(map[string]locationText)6262 var ordinal uint16
M tools/maturity/main.go +5 -5
@@ -1,5 +1,5 @@
11 // Command maturity reads the library and reports how mature each build of2-// each game is, along the axes internal/measure defines -- the same2+// each volume is, along the axes internal/measure defines -- the same33 // yardstick the cartograph workbench judges by, aligned with the semantic44 // conventions the payloads speak: how thoroughly locations are explained in55 // writing, how much visual map information the rasters hold, how much
@@ -58,7 +58,7 @@ func run(dir string) error {
5858 if err != nil {5959 return fmt.Errorf("%s: %w", filepath.Base(path), err)6060 }61- byGame[build.GameSlug] = append(byGame[build.GameSlug], build)61+ byGame[build.VolumeSlug] = append(byGame[build.VolumeSlug], build)6262 }6363 6464 slugs := make([]string, 0, len(byGame))
@@ -69,9 +69,9 @@ func run(dir string) error {
6969 for _, slug := range slugs {7070 builds := byGame[slug]7171 // The registry's own order, spelled once in internal/measure, so the72- // first line of every game is the build the reader sees.72+ // first line of every volume is the build the reader sees.7373 sort.Slice(builds, func(a, b int) bool { return measure.Newer(builds[a], builds[b]) })74- fmt.Printf("%s (%s)\n", builds[0].GameTitle, slug)74+ fmt.Printf("%s (%s)\n", builds[0].VolumeTitle, slug)7575 for at, b := range builds {7676 marker := " "7777 if at == 0 {
@@ -83,7 +83,7 @@ func run(dir string) error {
8383 fmt.Printf(" cartography %5d tiles · %s MB unique raster · depth z%d holds %d tiles\n",8484 b.TileCount, b.RasterMB(), b.Depth, b.DepthTiles)8585 fmt.Printf(" structure %5d categories in %d groups · %d text label sets · %d zones (%d vertices) · %d layers\n",86- b.Categories, b.Groups, b.TextSets, b.Zones, b.Vertices, b.Variants)86+ b.Categories, b.Groups, b.TextSets, b.Zones, b.Vertices, b.Lenses)8787 fmt.Printf(" icons %5d of %d marker categories carry one (%s)\n",8888 b.IconsCarried, b.IconsWanted, b.IconPct())8989 fmt.Printf(" conventions %s\n", conventionsLine(b))
M tools/tiles/main.go +22 -22
@@ -223,12 +223,12 @@ type pendingPlan struct {
223223 }224224 225225 type manifest struct {226- TileSize int `json:"tileSize"`227- Size int `json:"size"`228- Variants []variantManifest `json:"variants"`226+ TileSize int `json:"tileSize"`227+ Size int `json:"size"`228+ Lenses []lensManifest `json:"lenses"`229229 }230230 231-type variantManifest struct {231+type lensManifest struct {232232 SourcePath string `json:"sourcePath"`233233 AssetPath string `json:"assetPath"`234234 MinZoom int `json:"minZoom"`
@@ -422,12 +422,12 @@ func run(source, output string, force bool) error {
422422 } else {423423 kept.Grid = plan.Warp.Base.Frame.grid()424424 }425- out.Variants = append(out.Variants, kept)425+ out.Lenses = append(out.Lenses, kept)426426 carried++427427 continue428428 }429429 fmt.Printf("tile %s / %s / %s\n", entry.gameTitle, entry.title, plan.SourcePath)430- var variant variantManifest430+ var variant lensManifest431431 var err error432432 if plan.Warp == nil {433433 variant, err = buildPyramid(temp, plan)
@@ -438,11 +438,11 @@ func run(source, output string, force bool) error {
438438 return fmt.Errorf("%s / %s: %w", entry.title, plan.SourcePath, err)439439 }440440 variant.Stamp = stamp441- out.Variants = append(out.Variants, variant)441+ out.Lenses = append(out.Lenses, variant)442442 derived[plan.AssetPath] = true443443 }444- sort.Slice(out.Variants, func(i, j int) bool {445- return out.Variants[i].SourcePath < out.Variants[j].SourcePath444+ sort.Slice(out.Lenses, func(i, j int) bool {445+ return out.Lenses[i].SourcePath < out.Lenses[j].SourcePath446446 })447447 if err := installPyramids(temp, output, out, derived); err != nil {448448 return err
@@ -455,21 +455,21 @@ func run(source, output string, force bool) error {
455455 // moved. Keeping one is doing nothing at all: it stays where it is, and only456456 // the layers that were derived again are installed over the top.457457 func carry(458- built map[string]variantManifest,458+ built map[string]lensManifest,459459 plan tilePlan,460460 stamp, output string,461461 force bool,462-) (variantManifest, bool) {462+) (lensManifest, bool) {463463 if force {464- return variantManifest{}, false464+ return lensManifest{}, false465465 }466466 entry, ok := built[plan.SourcePath]467467 if !ok || entry.Stamp == "" || entry.Stamp != stamp || entry.AssetPath != plan.AssetPath {468- return variantManifest{}, false468+ return lensManifest{}, false469469 }470470 if _, err := os.Stat(filepath.Join(output, plan.AssetPath)); err != nil {471471 // Whatever the last run left is not there to be kept, so derive it.472- return variantManifest{}, false472+ return lensManifest{}, false473473 }474474 return entry, true475475 }
@@ -495,8 +495,8 @@ func installPyramids(temp, output string, out manifest, derived map[string]bool)
495495 }496496 }497497 498- wanted := make(map[string]bool, len(out.Variants))499- for _, variant := range out.Variants {498+ wanted := make(map[string]bool, len(out.Lenses))499+ for _, variant := range out.Lenses {500500 wanted[variant.AssetPath] = true501501 }502502 entries, err := os.ReadDir(output)
@@ -739,7 +739,7 @@ func worldTileRange(zoom int) (int, int) {
739739 return firstTile << shift, ((firstTile + worldTilesAtReference) << shift) - 1740740 }741741 742-func buildPyramid(root string, plan tilePlan) (variantManifest, error) {742+func buildPyramid(root string, plan tilePlan) (lensManifest, error) {743743 maxZoom := plan.MaxSourceZoom - plan.Frame.BaseZoom744744 fullZoom := plan.MaxFullZoom - plan.Frame.BaseZoom745745 formats := make([]string, maxZoom+1)
@@ -754,7 +754,7 @@ func buildPyramid(root string, plan tilePlan) (variantManifest, error) {
754754 placeholder := placeholderHash(full)755755 backgroundHex, err := placeholderColor(full, placeholder)756756 if err != nil {757- return variantManifest{}, err757+ return lensManifest{}, err758758 }759759 if backgroundHex == "" {760760 placeholder = ""
@@ -768,7 +768,7 @@ func buildPyramid(root string, plan tilePlan) (variantManifest, error) {
768768 // both more consistent and never leaves a level empty.769769 format, mask, err := copyLevel(root, plan, plan.MaxFullZoom, fullZoom, full, placeholder)770770 if err != nil {771- return variantManifest{}, err771+ return lensManifest{}, err772772 }773773 formats[fullZoom] = format774774 if mask != nil {
@@ -786,7 +786,7 @@ func buildPyramid(root string, plan tilePlan) (variantManifest, error) {
786786 }787787 mask, err := deriveLevel(root, plan.AssetPath, localZoom, formats[localZoom+1], derivedFormat, !plan.Interpolate, background)788788 if err != nil {789- return variantManifest{}, err789+ return lensManifest{}, err790790 }791791 formats[localZoom] = derivedFormat792792 if mask != nil {
@@ -802,7 +802,7 @@ func buildPyramid(root string, plan tilePlan) (variantManifest, error) {
802802 sourceZoom := localZoom + plan.Frame.BaseZoom803803 format, mask, err := copyLevel(root, plan, sourceZoom, localZoom, plan.Levels[sourceZoom], placeholder)804804 if err != nil {805- return variantManifest{}, err805+ return lensManifest{}, err806806 }807807 if mask == nil {808808 maxZoom = localZoom - 1
@@ -816,7 +816,7 @@ func buildPyramid(root string, plan tilePlan) (variantManifest, error) {
816816 if len(coverage) == 0 {817817 coverage = nil818818 }819- return variantManifest{819+ return lensManifest{820820 SourcePath: plan.SourcePath,821821 AssetPath: plan.AssetPath,822822 MinZoom: 0,
M tools/tiles/stamp.go +3 -3
M tools/tiles/stamp_test.go +1 -1
M tools/tiles/warp.go +7 -7
@@ -143,7 +143,7 @@ func planWarp(base, donor *tilePlan, donorGameTitle string) (pendingPlan, bool)
143143 // buildWarpedPyramid renders the donor through the affine into the base144144 // frame at the target zoom, then folds the shallower levels down exactly as145145 // every other pyramid is folded.146-func buildWarpedPyramid(root string, plan tilePlan) (variantManifest, error) {146+func buildWarpedPyramid(root string, plan tilePlan) (lensManifest, error) {147147 warp := plan.Warp148148 donor := warp.Donor149149 donorFiles := donor.Levels[donor.MaxFullZoom]
@@ -152,13 +152,13 @@ func buildWarpedPyramid(root string, plan tilePlan) (variantManifest, error) {
152152 placeholder := placeholderHash(donorFiles)153153 backgroundHex, err := placeholderColor(donorFiles, placeholder)154154 if err != nil {155- return variantManifest{}, err155+ return lensManifest{}, err156156 }157157 background := parseHexColor(backgroundHex)158158 159159 sampler, err := newDonorSampler(donor, background)160160 if err != nil {161- return variantManifest{}, err161+ return lensManifest{}, err162162 }163163 164164 // Where the donor's content lands in the base world.
@@ -171,7 +171,7 @@ func buildWarpedPyramid(root string, plan tilePlan) (variantManifest, error) {
171171 builder := &coverageBuilder{total: (1 << targetZoom) * (1 << targetZoom)}172172 inverse, ok := warp.Affine.Invert()173173 if !ok {174- return variantManifest{}, fmt.Errorf("alignment is singular")174+ return lensManifest{}, fmt.Errorf("alignment is singular")175175 }176176 // Base world pixels per rendered pixel at the target zoom.177177 levelPixels := tileSize * (1 << targetZoom)
@@ -198,7 +198,7 @@ func buildWarpedPyramid(root string, plan tilePlan) (variantManifest, error) {
198198 }199199 path := tilePath(root, plan.AssetPath, targetZoom, tileX, tileY, "jpg")200200 if err := encodeImage(path, img, "jpg"); err != nil {201- return variantManifest{}, err201+ return lensManifest{}, err202202 }203203 builder.mark(tileX, tileY)204204 }
@@ -211,7 +211,7 @@ func buildWarpedPyramid(root string, plan tilePlan) (variantManifest, error) {
211211 for localZoom := targetZoom - 1; localZoom >= 0; localZoom-- {212212 mask, err := deriveLevel(root, plan.AssetPath, localZoom, formats[localZoom+1], "jpg", false, background)213213 if err != nil {214- return variantManifest{}, err214+ return lensManifest{}, err215215 }216216 formats[localZoom] = "jpg"217217 if mask != nil {
@@ -222,7 +222,7 @@ func buildWarpedPyramid(root string, plan tilePlan) (variantManifest, error) {
222222 coverage = nil223223 }224224 225- return variantManifest{225+ return lensManifest{226226 SourcePath: plan.SourcePath,227227 AssetPath: plan.AssetPath,228228 MinZoom: 0,