Format v3: unified features (points · paths · areas)
- commit
- 1db09072698e48445325745204d51e05feb755ea
- parent
- 81d35937855b1c811b20c19f1bc21369ea99952b
- parent
- 1f2be744601adf3ce79a807c1fd25359a5d70b6b
- author
- FelineStateMachine <dami.etoile@gmail.com>
- kind
- feat risk score 2.9 of 3, Jev's estimate
@@ -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}#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 .grid-system{color:var(--accent);font-size:10px;font-weight:800;letter-spacing:.08em;text-transform:uppercase}.grid-navigator .grid-system[hidden]{display:none}.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{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}.feature-index{padding:0 0 4px 14px}.feature-index[hidden]{display:none}.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}.feature-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 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}.collection-expand{display:flex;width:22px;height:22px;align-items:center;justify-content:center;padding:0;border:0;border-radius:3px;background:transparent;color:inherit;cursor:pointer}.collection-expand:hover{background:#ffffff0f}.collection-expand:focus-visible{outline:1px solid var(--accent);outline-offset:-1px}.collection-expand svg{fill:none;stroke:currentColor;stroke-linecap:round;stroke-linejoin:round}.collection-chevron{width:8px;flex:none;stroke-width:2.2;transition:transform .14s ease}.category-row.is-expanded .collection-chevron{transform:rotate(90deg)}.collection-kind{width:11px;flex:none;stroke-width:1.5}.collection-kind-area{stroke-width:2.6}.label-toggle{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(--muted);cursor:pointer;transition:opacity .11s ease}.category-row.is-hovered .label-toggle,.label-toggle:focus-visible{opacity:1}.label-toggle:hover{background:#3aa5c924}.label-toggle[aria-pressed=true]{color:var(--accent)}.label-toggle svg{width:12px;fill:none;stroke:currentColor;stroke-linecap:round;stroke-linejoin:round;stroke-width:1.7}.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 .grid-system{color:var(--accent);font-size:10px;font-weight:800;letter-spacing:.08em;text-transform:uppercase}.grid-navigator .grid-system[hidden]{display:none}.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,19 +1,19 @@
1-(()=>{var Fue=Object.create;var xL=Object.defineProperty;var Bue=Object.getOwnPropertyDescriptor;var Oue=Object.getOwnPropertyNames;var Uue=Object.getPrototypeOf,kue=Object.prototype.hasOwnProperty;var gq=(i,e)=>()=>{try{return e||i((e={exports:{}}).exports,e),e.exports}catch(t){throw e=0,t}},zue=(i,e)=>{for(var t in e)xL(i,t,{get:e[t],enumerable:!0})},Vue=(i,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of Oue(e))!kue.call(i,r)&&r!==t&&xL(i,r,{get:()=>e[r],enumerable:!(n=Bue(e,r))||n.enumerable});return i};var vq=(i,e,t)=>(t=i!=null?Fue(Uue(i)):{},Vue(e||!i||!i.__esModule?xL(t,"default",{value:i,enumerable:!0}):t,i));var Sq=gq((hT,wq)=>{(function(i,e){typeof hT=="object"&&typeof wq<"u"?e(hT):typeof define=="function"&&define.amd?define(["exports"],e):e(i.bigfloat={})})(hT,(function(i){"use strict";var e=Math.pow(2,32),t=Math.pow(2,-32),n=Math.log(10)/(32*Math.log(2));function r(D){return new Array(D+1).join("0")}var s=(function(){function D(L){this.base=L,this.limbDigitsExact=Math.log(e)/Math.log(this.base),this.limbDigits=~~this.limbDigitsExact,this.limbBase=Math.pow(this.base,this.limbDigits),this.pad=r(this.limbDigits)}return D.init=function(L){return D.baseTbl[L]||(D.baseTbl[L]=new D(L))},D.baseTbl={},D})();function o(D){return D.replace(/^(-?)0+([1-9a-z]|0(\.|$))/,"$1$2").replace(/(\.|(\.[0-9a-z]*[1-9a-z]))0+$/,"$2")}function a(D,L){L===void 0&&(L=10);var C=s.init(L),B=C.pad,k=C.limbBase,z="",G="",W,Y;if(isNaN(D))return"NaN";if(D<0&&(z="-",D=-D),!isFinite(D))return z+"Inf";if(D<1)G+="0";else{var H=Math.floor(D);for(D-=H;H;)W=H%k,H=(H-W)/k,Y=W.toString(L),G=Y+G,H&&(G=B.substr(Y.length)+G)}if(D>0)for(G+=".",k!=e&&(k=L,B="");D;)D*=k,W=D>>>0,D-=W,Y=W.toString(L),G+=B.substr(Y.length)+Y;return z+G.replace(/(\.[0-9a-z]*[1-9a-z])0+$/,"$1")}var l=(function(){function D(L,C){this.limbList=[],L?this.setValue(L,C):this.setZero()}return D.prototype.clone=function(){return new D().setBig(this)},D.prototype.setZero=function(){return this.sign=1,this.fractionLen=0,this.len=0,this},D.prototype.setValue=function(L,C){return typeof L=="number"?this.setNumber(L):L instanceof D?this.setBig(L):this.setString(L.toString(),C||10)},D.prototype.setBig=function(L){var C=L.len;this.sign=L.sign,this.fractionLen=L.fractionLen,this.len=C;for(var B=0;B<C;++B)this.limbList[B]=L.limbList[B];return this},D.prototype.setNumber=function(L){L<0?(L=-L,this.sign=-1):this.sign=1;for(var C=Math.floor(L),B=L-C,k=0,z=this.limbList,G,W=0;B;)B*=e,G=B>>>0,B-=G,z[W++]=G,++k;for(var Y=0;--W>Y;)G=z[Y],z[Y++]=z[W],z[W]=G;for(W+=Y+1;C;)G=C%e,C=(C-G)/e,z[W++]=G;return this.limbList=z,this.fractionLen=k,this.len=W,this},D.prototype.parseFraction=function(L,C,B,k,z,G){for(var W=this.limbList,Y=L.length,H=k-1;H;)W[--H]=0;var $=Y-((Y-B+G-1)%G+1);for(W[k-1]=parseInt(L.substr($,Y-$),C),this.divInt(Math.pow(C,Y-$),k),Y=$;Y>B;)Y-=G,W[k-1]=parseInt(L.substr(Y,G),C),this.divInt(z,k)},D.prototype.setString=function(L,C){var B=s.init(C),k=B.limbBase,z=B.limbDigits,G=B.limbDigitsExact,W=this.limbList,Y=-1,H;for(this.sign=1;;){switch(H=L.charAt(++Y),H){case"-":this.sign=-1;case"+":case"0":continue}break}var $=(L.indexOf(".",Y)+1||L.length+1)-1;if($<L.length-1){var J=~~((L.length-$-1)/G)+1;this.parseFraction(L,C,$+1,J+1,k,z),this.fractionLen=J,this.len=J,this.trimLeast()}else this.fractionLen=0,this.len=0;var te=this.fractionLen;if($>Y){var ce=Y+($-Y+z-1)%z+1;for(++this.len,W[te]=parseInt(L.substr(Y,ce-Y),C),Y=ce;Y<$;)this.mulInt(k,W,te,te,0)&&++this.len,W[te]+=parseInt(L.substr(Y,z),C),Y+=z}return this},D.prototype.trimMost=function(){for(var L=this.limbList,C=this.fractionLen,B=this.len;B>C&&!L[B-1];)--B;this.len=B},D.prototype.trimLeast=function(){for(var L=this.limbList,C=this.fractionLen,B=0;B<C&&!L[B];)++B;B&&this.truncate(C-B)},D.prototype.mulInt=function(L,C,B,k,z){if(!L)return 0;for(var G=this.limbList,W=this.len,Y,H,$=0;B<W;)Y=G[B++],$+=L*(Y&65535),H=$&65535,$=($-H)/65536,$+=L*(Y>>>16),H|=$<<16,Y=(C[k]&z)+H>>>0,C[k++]=Y,$=$/65536>>>0,$+=(H^(Y-H^H)&~(Y^H))>>>31;return $&&(C[k]=$),$},D.prototype.mulBig=function(L,C){if(this.isZero()||L.isZero())return C.setZero();var B=L.limbList,k=L.len,z=C.limbList,G=this.len+k;for(C.len=G;G--;)z[G]=0;this.mulInt(B[0],z,0,0,0);for(var W=1;W<k;++W)this.mulInt(B[W],z,0,W,4294967295);return C.sign=this.sign*L.sign,C.fractionLen=this.fractionLen+L.fractionLen,C.trimMost(),C.trimLeast(),C},D.prototype.mul=function(L,C){if(C=C||new D,typeof L=="number"&&(L=c.setNumber(L)),C==this)throw new Error("Multiplication in place is unsupported");return this.mulBig(L,C)},D.prototype.absDeltaFrom=function(L){typeof L=="number"&&(L=c.setNumber(L));for(var C=this.limbList,B=L.limbList,k=this.len,z=L.len,G=k-this.fractionLen-(z-L.fractionLen);!G&&k&&z;)G=C[--k]-B[--z];if(G)return G;if(k)do G=C[--k];while(!G&&k);else if(z)do G=-B[--z];while(!G&&z);return G},D.prototype.isZero=function(){return this.len==0},D.prototype.getSign=function(){return this.len&&this.sign},D.prototype.deltaFrom=function(L){return typeof L=="number"&&(L=c.setNumber(L)),this.len+L.len&&(this.sign-L.sign||this.absDeltaFrom(L)*this.sign)},D.prototype.addBig=function(L,C){var B=this,k=B.fractionLen,z=k-L.fractionLen;z<0&&(z=-z,k+=z,B=L,L=this),C.sign=this.sign,C.fractionLen=k;for(var G=C.limbList,W=B.limbList,Y=L.limbList,H=0,$=0,J=0,te;H<z;)G[H]=W[H],++H;var ce=L.len;for(z=B.len-H,z>ce&&(z=ce);$<z;)J+=W[H]+Y[$++],te=J>>>0,J=J-te&&1,G[H++]=te;var he=H;for(z<ce?(z=ce,B=L,H=$,W=Y):z=B.len;H<z;)J+=W[H++],te=J>>>0,J=J-te&&1,G[he++]=te;return J&&(G[he++]=J),C.len=he,C.trimLeast(),C},D.prototype.subBig=function(L,C){var B=this;C.sign=this.sign,B.absDeltaFrom(L)<0&&(B=L,L=this,C.sign=-this.sign);var k=B.fractionLen,z=k-L.fractionLen,G=C.limbList,W=B.limbList,Y=L.limbList,H=B.len,$=L.len,J=H,te=0,ce=0,he=0,ve=0,Re;if(z>=0){for(;te<z;)G[te]=W[te],++te;z+=$,z>H&&(z=H),he=te}else{for(z=-z,k+=z,J+=z;ce<z;)ve-=Y[ce],Re=ve>>>0,ve=-(ve<0),G[ce++]=Re;z+=H,z>$&&(z=$),he=ce}for(C.fractionLen=k;he<z;)ve+=W[te++]-Y[ce++],Re=ve>>>0,ve=-(ve<0),G[he++]=Re;for(;he<J;)ve+=W[te++],Re=ve>>>0,ve=-(ve<0),G[he++]=Re;return C.len=he,C.trimMost(),C.trimLeast(),C},D.prototype.addSub=function(L,C,B){if(B=B||new D,B==this)throw new Error("Addition and subtraction in place is unsupported");return typeof L=="number"&&(L=c.setNumber(L)),this.sign*L.sign*C<0?this.subBig(L,B):this.addBig(L,B)},D.prototype.add=function(L,C){return this.addSub(L,1,C)},D.prototype.sub=function(L,C){return this.addSub(L,-1,C)},D.prototype.truncate=function(L){var C=this.fractionLen-L;if(C>0){this.fractionLen=L,this.len-=C;for(var B=this.len,k=this.limbList,z=0;z<B;++z)k[z]=k[z+C]}return this},D.prototype.round=function(L){return this.truncate(1+~~(L*n))},D.prototype.divInt=function(L,C){var B=this.limbList,k,z,G,W=0;for(B[C-1]<L&&(W=B[--C],this.len=C);C--;)k=B[C],W=W*65536+(k>>>16),z=W/L>>>0,W=W-z*L,W=W*65536+(k&65535),G=W/L>>>0,W=W-G*L,B[C]=(z<<16|G)>>>0;return W},D.prototype.fractionToString=function(L,C){var B=s.init(L),k=B.pad,z=B.limbBase,G=this.limbList,W=this.fractionLen,Y=0,H;if(L&1)throw new Error("Conversion of floating point values to odd bases is unsupported");for(;Y<W&&!G[Y];)++Y;if(!(Y>=W)){C.push(".");var $=c;for($.limbList=G.slice(Y,W),$.len=W-Y,Y=0;Y<$.len;)if($.limbList[Y]){var J=$.mulInt(z,$.limbList,Y,Y,0);H=J.toString(L),C.push(k.substr(H.length)+H)}else++Y}},D.prototype.getExpansion=function(L){for(var C=this.limbList,B=this.len,k=this.sign,z=this.fractionLen;z--;)k*=t;for(;++z<B;)L[z]=C[z]*k,k*=e;return B},D.prototype.valueOf=function(){for(var L=this.limbList,C=0,B=t*this.sign,k=this.fractionLen,z=0;z<k;)C=C*t+L[z++];for(k=this.len;z<k;)C=C*t+L[z++],B*=e;return C*B},D.prototype.toString=function(L){L===void 0&&(L=10);var C=s.init(L),B=C.pad,k=C.limbBase,z=[],G=this.limbList,W;if(k!=e){var Y=c;for(Y.limbList=G.slice(this.fractionLen,this.len),Y.len=this.len-this.fractionLen;Y.len>1;)W=Y.divInt(k,Y.len).toString(L),z.push(B.substr(W.length)+W);z.push(""+(Y.limbList[0]||0)),this.sign<0&&z.push("-"),z.reverse(),this.fractionToString(L,z)}else{var H=this.len,$=this.fractionLen;for(this.sign<0&&z.push("-"),H==$&&z.push("0");H--;)W=G[H].toString(L),H==$-1&&z.push("."),z.push(B.substr(W.length)+W)}return o(z.join(""))},D})();l.prototype.cmp=l.prototype.deltaFrom;var c=new l,u=(1<<27)+1,f=Math.log(10)/(53*Math.log(2));function d(D,L,C){var B=D+L,k=B-D,z=B-k;return C[0]=D-z+(L-k),C[1]=B,C}function A(D,L){w=D*L;var C=D*u,B=C-(C-D),k=D-B,z=L*u,G=z-(z-L),W=L-G;return k*W-(w-B*G-k*G-B*W)}var y=(function(){function D(L,C){this.limbList=[],L&&this.setValue(L,C)}return D.prototype.clone=function(){return new D().setBig(this)},D.prototype.setZero=function(){return this.len=0,this},D.prototype.setValue=function(L,C){return typeof L=="number"?this.setNumber(L):L instanceof D?this.setBig(L):this.setString(L.toString(),C||10)},D.prototype.setBig=function(L){var C=L.len;this.len=C;for(var B=0;B<C;++B)this.limbList[B]=L.limbList[B];return this},D.prototype.setNumber=function(L){return this.limbList[0]=L,this.len=L&&1,this},D.prototype.setString=function(L,C){return S[0].setValue(L,C),this.len=S[0].getExpansion(this.limbList),this.normalize(),this},D.prototype.setSum=function(L,C){return this.len=2,d(L,C,this.limbList),this},D.prototype.setProduct=function(L,C){return this.len=2,this.limbList[0]=A(L,C),this.limbList[1]=w,this},D.prototype.normalize=function(){var L=this.limbList,C=this.len,B;if(C){for(var k=C-1,z=C-1,G=L[k],W=void 0;k;)B=L[--k],W=G,G+=B,W=B-(G-W),L[z]=G,z-=W&&1,G=W||G;for(L[z]=G;++z<C;)B=L[z],W=G,G+=B,W-=G-B,L[k]=W,k+=W&&1;L[k]=G,this.len=k+(G&&1)}return this},D.prototype.mulSmall=function(L,C){var B=this.limbList,k=C.limbList,z=this.len,G,W,Y,H=0,$=0;function J(ce){k[$]=ce,$+=ce&&1}J(A(B[H++],L));for(var te=w;H<z;)G=A(B[H++],L),W=te+G,Y=W-te,J(te-(W-Y)+(G-Y)),te=w+W,J(W-(te-w));return k[$]=te,C.len=$+(te&&1),C},D.prototype.mulBig=function(L,C){var B=L.limbList,k=L.len;if(!k)return C.setZero();for(--k,this.mulSmall(B[k],k?T[k&1]:C);k;)--k,this.mulSmall(B[k],C).addBig(T[~k&1],1,k?T[k&1]:C);return C},D.prototype.mul=function(L,C){if(C=C||new D,typeof L=="number")return this.mulSmall(L,C);if(C==this)throw new Error("Cannot multiply in place");return this.mulBig(L,C)},D.prototype.isZero=function(){for(var L=this.limbList,C=this.len;C--;)if(L[C])return!1;return!0},D.prototype.getSign=function(){var L=this.len;return L&&(L=this.limbList[L-1])&&(L>0?1:-1)},D.prototype.deltaFrom=function(L){var C=this.len,B=this.getSign(),k=B;if(typeof L!="number"){if(C=L.len,k-=C&&(C=L.limbList[C-1])&&(C>0?1:-1),k||!B)return k;this.addBig(L,-1,T[0])}else{if(k-=L&&(L>0?1:-1),k||!B)return k;this.addSmall(-L,T[0])}return C=T[0].len,C&&T[0].limbList[C-1]},D.prototype.addSmall=function(L,C){for(var B=this.limbList,k=C.limbList,z=this.len,G,W,Y,H,$=0,J=0;$<z;)W=B[$++],G=W+L,Y=G-W,W-=G-Y,H=W+(L-Y),k[J]=H,J+=H&&1,L=G;return k[J]=L,C.len=J+(L&&1),C},D.prototype.addBig=function(L,C,B){var k=this.limbList,z=L.limbList,G=B.limbList,W=this.len+L.len,Y=0,H=0,$=0,J=k[Y++],te=z[H++]*C,ce=J<0?-J:J,he=te<0?-te:te,ve,Re,Qe,Fe;if(!W)return B.setZero();k[this.len]=1/0,z[L.len]=1/0;function mt(){var Ve;return ce<he?(Ve=J,J=k[Y++],ce=J<0?-J:J):(Ve=te,te=z[H++]*C,he=te<0?-te:te),Ve}for(var Ee=mt();--W;)ve=mt(),Qe=Ee,Ee+=ve,Re=Ee-Qe,Fe=Qe-(Ee-Re)+(ve-Re),G[$]=Fe,$+=Fe&&1;return G[$]=Ee,B.len=$+(Ee&&1),B},D.prototype.addSub=function(L,C,B){return B=B||new D,typeof L=="number"?this.addSmall(C*L,B):this.addBig(L,C,B)},D.prototype.add=function(L,C){return this.addSub(L,1,C)},D.prototype.sub=function(L,C){return this.addSub(L,-1,C)},D.prototype.truncate=function(L){this.normalize();for(var C=this.limbList,B=this.len,k=0,z=B,G=0,W=0;k<z;)G=k+z>>1,W=C[G],W>-1&&W<1?k=G+1:z=G;if(G&&(W<=-1||W>=1)&&(W=C[--G]),G-=L-1,G>0){this.len-=G,B=this.len;for(var Y=0;Y<B;++Y)C[Y]=C[Y+G]}return this},D.prototype.round=function(L){return this.truncate(1+~~(L*f))},D.prototype.valueOf=function(){for(var L=this.limbList,C=this.len,B=0,k=0;k<C;++k)B+=L[k];return B},D.prototype.toString=function(L){var C=this.limbList,B=this.len;for(S[B&1].setZero();B--;)S[~B&1].add(C[B],S[B&1]);return S[~B&1].toString(L)},D})();y.prototype.cmp=y.prototype.deltaFrom;var w=0,S=[new l,new l],T=[new y,new y];function R(D,L){function C(){this.constructor=D}C.prototype=L.prototype,D.prototype=new C}var P=(function(){function D(L,C,B){this.real=typeof L=="object"?L:new this.Base(L,B),this.imag=typeof C=="object"?C:new this.Base(C,B)}return D.prototype.clone=function(){var L=new this.constructor(this.real.clone(),this.imag.clone());return L},D.prototype.setZero=function(){return this.real.setZero(),this.imag.setZero(),this},D.prototype.setValue=function(L){return this.real.setValue(L.real),this.imag.setValue(L.imag),this},D.prototype.mul=function(L,C){return C=C||new this.constructor,L instanceof D?(this.real.mul(L.real,this.temp1),this.imag.mul(L.imag,this.temp2),this.temp1.sub(this.temp2,C.real),this.real.mul(L.imag,this.temp1),this.imag.mul(L.real,this.temp2),this.temp1.add(this.temp2,C.imag)):(this.real.mul(L,C.real),this.imag.mul(L,C.imag)),C},D.prototype.sqr=function(L){return L=L||new this.constructor,this.real.mul(this.real,this.temp1),this.imag.mul(this.imag,this.temp2),this.temp1.sub(this.temp2,L.real),this.real.mul(this.imag,this.temp1),this.temp1.add(this.temp1,L.imag),L},D.prototype.add=function(L,C){return C=C||new this.constructor,L instanceof D?(this.real.add(L.real,C.real),this.imag.add(L.imag,C.imag)):this.real.add(L,C.real),C},D.prototype.sub=function(L,C){return C=C||new this.constructor,L instanceof D?(this.real.sub(L.real,C.real),this.imag.sub(L.imag,C.imag)):this.real.sub(L,C.real),C},D.prototype.truncate=function(L){return this.real.truncate(L),this.imag.truncate(L),this},D})(),I=(function(D){R(L,D);function L(){return D!==null&&D.apply(this,arguments)||this}return L})(P),F=(function(D){R(L,D);function L(){return D!==null&&D.apply(this,arguments)||this}return L})(P);I.prototype.Base=l,I.prototype.temp1=new l,I.prototype.temp2=new l,F.prototype.Base=y,F.prototype.temp1=new y,F.prototype.temp2=new y,i.BigFloat32=l,i.BigFloat53=y,i.BigComplex32=I,i.BigComplex53=F,i.trimNumber=o,i.numberToString=a,Object.defineProperty(i,"__esModule",{value:!0})}))});var CJ=gq((_w,QB)=>{(function(i,e){typeof _w=="object"&&typeof QB=="object"?QB.exports=e():typeof define=="function"&&define.amd?define("FrameTicker",[],e):typeof _w=="object"?_w.FrameTicker=e():i.FrameTicker=e()})(_w,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 _q=i=>new Promise(e=>setTimeout(e,i)),Ss=i=>document.querySelector(i);async function Gue(){for(let i=0;i<300&&!(window.__atlasDebug&&!Ss("#map-loading")?.checkVisibility?.());i+=1)await _q(100)}async function que(){let i="";for(let e=0;e<100;e+=1){await _q(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 lp(i,e={}){window.dispatchEvent(new KeyboardEvent("keydown",{key:i,bubbles:!0,cancelable:!0,...e}))}function Hue(i,e={}){window.dispatchEvent(new KeyboardEvent("keyup",{key:i,bubbles:!0,cancelable:!0,...e}))}function Wue(i){Ss("#map").dispatchEvent(new KeyboardEvent("keydown",{key:i,bubbles:!0,cancelable:!0}))}function Um(i,e){i.value=e,i.dispatchEvent(new Event("change",{bubbles:!0}))}function yL(i,e){let t=Ss(i);t.value=e,t.dispatchEvent(new Event("input",{bubbles:!0}))}function bL(i,e=!1){let t=Ss("#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 jue(){let i=[],e=async d=>{await que(),i.push({name:d,snapshot:JSON.parse(window.render_game_to_text())})};await Gue(),localStorage.clear();let t=Ss("#game-select"),n=t.options[0].value;Um(t,n),await e("initial"),yL("#pin-search","a"),await e("search-a");let r=Ss(".search-result");r&&(r.click(),await e("search-select-first"),Ss("#close-detail").click(),await e("detail-closed")),yL("#pin-search",""),await e("search-cleared");let s=Ss(".category-row input");s&&(s.click(),await e("category-hidden"),s.click(),await e("category-restored"));let o=Ss(".only-button");if(o){o.click(),await e("solo-first");let d=Ss("#solo-chip");d&&!d.hidden&&d.click(),await e("solo-cleared")}let a=Ss("#legend .layer-title");a&&(a.click(),await e("section-folded"),Ss("#expand-all").click(),await e("sections-unfolded")),Ss("#hide-all").click(),await e("all-hidden"),Ss("#show-all").click(),await e("all-shown");let l=Ss(".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")),lp("g"),await e("grid-open"),yL("#grid-input","m"),await e("grid-descended"),lp(" "),await e("subgrid-hidden"),lp(" "),lp("Escape"),await e("grid-ascended"),lp("Escape"),await e("grid-closed"),lp("z"),await e("labels-on"),Hue("z"),await e("labels-off"),lp("b",{metaKey:!0}),await e("sidebar-collapsed"),lp("b",{metaKey:!0}),await e("sidebar-restored"),Ss("#zoom-in").click(),await e("zoomed-in");let c=Ss("#overview-dock");c&&!Ss("#overview-shelf").hidden&&(c.click(),await e("overview-docked"),c.click(),await e("overview-undocked")),Ss("#zoom-out").click(),await e("zoomed-out"),Wue("Escape"),await e("viewport-escape");let u=Ss("#variant-select");u.options.length>1&&(Um(u,u.options[1].value),await e("variant-second"),Um(u,u.options[0].value),await e("variant-first"));let f=Ss("#map-select");return f.options.length>1&&(Um(f,f.options[1].value),await e("map-second"),Um(f,f.options[0].value),await e("map-first")),t.options.length>1&&(Um(t,t.options[1].value),await e("game-second"),Um(t,n),await e("game-first")),localStorage.clear(),{viewport:[window.innerWidth,window.innerHeight],steps:i}}var wL=!1;async function xq(){if(!wL){wL=!0,bL("parity tour running\u2026");try{let i=await jue(),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}`);bL(`parity tour complete \u2713 ${i.steps.length} steps`),console.log("parity tour saved to",t)}catch(i){bL(`parity tour failed: ${i}`,!0),console.error("parity tour failed",i)}finally{wL=!1}}}window.__atlasTour=xq;window.addEventListener("keydown",i=>{i.key==="F9"&&xq()});var en=i=>document.querySelector(i),ge={volume:en("#volume-select"),world:en("#world-select"),lens:en("#lens-select"),lensField:en("#lens-field"),legend:en("#legend"),search:en("#pin-search"),searchResults:en("#dock-results"),dock:en("#dock"),dockCount:en("#dock-count"),dockFlag:en("#dock-flag"),dockFold:en("#dock-fold"),dockRailName:en("#dock-rail-name"),visibleCount:en("#visible-count"),viewport:en("#map"),globe:en("#globe"),globeToggle:en("#globe-toggle"),layers:en("#layers"),zoneToggle:en("#zone-toggle"),zoneCount:en("#zone-count"),zoneIndex:en("#zone-index"),zoneList:en("#zone-list"),loading:en("#map-loading"),labelsHint:en("#labels-hint"),gridHint:en("#grid-hint"),soloChip:en("#solo-chip"),overview:en("#overview"),overviewShelf:en("#overview-shelf"),overviewDock:en("#overview-dock"),overviewCanvas:en("#overview-canvas"),overviewViewport:en("#overview-viewport"),gridNavigator:en("#grid-navigator"),gridSystem:en("#grid-system"),gridSystemName:en("#grid-system-name"),gridInput:en("#grid-input"),gridBack:en("#grid-back"),subgridToggle:en("#subgrid-toggle"),detail:en("#pin-detail"),detailTitle:en("#detail-title"),detailCategory:en("#detail-category"),detailDescription:en("#detail-description"),detailID:en("#detail-id"),detailCoordinates:en("#detail-coordinates"),detailCoordinatesField:en("#detail-coordinates-field"),detailCell:en("#detail-cell"),detailCellField:en("#detail-cell-field"),detailSource:en("#detail-source"),detailSourceField:en("#detail-source-field"),detailLinks:en("#detail-links"),detailDot:en("#detail-dot"),sidebar:en("#sidebar"),mobileLegend:en("#mobile-legend"),fatal:en("#fatal-error"),fatalMessage:en("#fatal-message"),emptyState:en("#empty-state"),emptyPath:en("#empty-path"),emptyOpen:en("#empty-open"),addBundles:en("#add-bundles")};function km(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,selectedZone: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,worldRun:0,textByWorld:new Map,restore:null,settling:!1,styleCache:new Map,markerIcons:new Map};var qf=["#4fb3d5","#c9924b","#82b56a","#c96a6a","#9581cc","#4bc9a9","#d4b04a","#6a92c9","#b08a5a","#8fb3a2"],zm="0123456789bcdefghjkmnpqrstuvwxyz";var SL="atlas.session";var yq={light:"rgba(255, 255, 255, 0.96)",dark:"rgba(7, 9, 7, 0.98)"},Vi={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 uT(i){let e=[...Hf()],t=!0;for(let n of i){let r=zm.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 EL(i,e){let t=[...Hf()],[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+=zm[l]}return o}var TL={key:null,extent:null};function Xue(i){let t=`${Hf().join(",")}|${i}`;return TL.key!==t&&(TL={key:t,extent:uT(i)}),TL.extent}var ML={slug:"geohash",name:"Geohash",short:"G",appliesTo(){return!0},maxLevel(){return 3},inputLength(){return 3},level(i){return i.length},parent(i){return i.slice(0,-1)},children(i){return[...zm].map(e=>i+e)},childIndex(i){return Math.max(0,zm.indexOf(i[i.length-1]))},contains(i,e){let t=Xue(i),[n,r]=e;return n>=t[0]&&n<=t[2]&&r>=t[1]&&r<=t[3]},descendTarget(i,e){return EL(e,i.length+1)},bbox:uT,center(i){let e=uT(i);return[(e[0]+e[2])/2,(e[1]+e[3])/2]},ring(i){let[e,t,n,r]=uT(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,zm.indexOf(i[i.length-1]))%qf.length},normalizeInput(i){return[...i.toLocaleLowerCase()].filter(e=>zm.includes(e)).slice(0,3).join("")},parseInput(i){return i},locate(i){let e=EL(i,3);return e?{label:"Geohash",value:e}:null}};function bq(i,e=3){return EL(i,e)}var x1=vq(Sq());function Tq(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 Jx(i,e,t){if(nH())return Reflect.construct.apply(null,arguments);var n=[null];n.push.apply(n,e);var r=new(i.bind.apply(i,n));return t&&ey(r,t.prototype),r}function Eq(i,e){for(var t=0;t<e.length;t++){var n=e[t];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(i,Kue(n.key),n)}}function $ue(i,e,t){return e&&Eq(i.prototype,e),t&&Eq(i,t),Object.defineProperty(i,"prototype",{writable:!1}),i}function Ct(i,e){var t=typeof Symbol<"u"&&i[Symbol.iterator]||i["@@iterator"];if(t)return(t=t.call(i)).next.bind(t);if(Array.isArray(i)||(t=Que(i))||e&&i&&typeof i.length=="number"){t&&(i=t);var n=0;return function(){return n>=i.length?{done:!0}:{done:!1,value:i[n++]}}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.2-In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function mT(){return mT=Object.assign?Object.assign.bind():function(i){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var n in t)({}).hasOwnProperty.call(t,n)&&(i[n]=t[n])}return i},mT.apply(null,arguments)}function OL(i){return OL=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},OL(i)}function sy(i,e){i.prototype=Object.create(e.prototype),i.prototype.constructor=i,ey(i,e)}function Yue(i){try{return Function.toString.call(i).indexOf("[native code]")!==-1}catch{return typeof i=="function"}}function nH(){try{var i=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(nH=function(){return!!i})()}function ey(i,e){return ey=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,n){return t.__proto__=n,t},ey(i,e)}function Zue(i,e){if(typeof i!="object"||!i)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var n=t.call(i,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(i)}function Kue(i){var e=Zue(i,"string");return typeof e=="symbol"?e:e+""}function Que(i,e){if(i){if(typeof i=="string")return Tq(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)?Tq(i,e):void 0}}function E1(i){var e=typeof Map=="function"?new Map:void 0;return E1=function(t){if(t===null||!Yue(t))return t;if(typeof t!="function")throw new TypeError("Super expression must either be null or a function");if(e!==void 0){if(e.has(t))return e.get(t);e.set(t,n)}function n(){return Jx(t,arguments,OL(this).constructor)}return n.prototype=Object.create(t.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),ey(n,t)},E1(i)}var Li=(function(){function i(t,n){this.lo=0,this.hi=0,this.lo=t,this.hi=n}var e=i.prototype;return e.isEmpty=function(){return this.lo>this.hi},e.equals=function(n){return this.lo==n.lo&&this.hi==n.hi||this.isEmpty()&&n.isEmpty()},e.center=function(){return .5*(this.lo+this.hi)},e.length=function(){return this.hi-this.lo},e.contains=function(n){return this.lo<=n&&n<=this.hi},e.containsInterval=function(n){return n.isEmpty()?!0:this.lo<=n.lo&&n.hi<=this.hi},e.interiorContains=function(n){return this.lo<n&&n<this.hi},e.interiorContainsInterval=function(n){return n.isEmpty()?!0:this.lo<n.lo&&n.hi<this.hi},e.intersects=function(n){return this.lo<=n.lo?n.lo<=this.hi&&n.lo<=n.hi:this.lo<=n.hi&&this.lo<=this.hi},e.interiorIntersects=function(n){return n.lo<this.hi&&this.lo<n.hi&&this.lo<this.hi&&n.lo<=n.hi},e.intersection=function(n){return new i(Math.max(this.lo,n.lo),Math.min(this.hi,n.hi))},e.union=function(n){return this.isEmpty()?n:n.isEmpty()?this:new i(Math.min(this.lo,n.lo),Math.max(this.hi,n.hi))},e.addPoint=function(n){return this.isEmpty()?new i(n,n):n<this.lo?new i(n,this.hi):n>this.hi?new i(this.lo,n):this},e.clampPoint=function(n){return Math.max(this.lo,Math.min(this.hi,n))},e.expanded=function(n){return this.isEmpty()?this:new i(this.lo-n,this.hi+n)},e.approxEqual=function(n,r){return r===void 0&&(r=1e-15),this.isEmpty()?n.length()<=2*r:n.isEmpty()?this.length()<=2*r:Math.abs(n.lo-this.lo)<=r&&Math.abs(n.hi-this.hi)<=r},e.directedHausdorffDistance=function(n){return this.isEmpty()?0:n.isEmpty()?1/0:Math.max(0,Math.max(this.hi-n.hi,n.lo-this.lo))},e.trunc=function(n){n===void 0&&(n=15);var r=+("1e"+n),s=function(a){return Math.round(a*r)/r};return new i(s(this.lo),s(this.hi))},e.toString=function(){var n=this.trunc(7);return"["+n.lo.toFixed(7)+", "+n.hi.toFixed(7)+"]"},i.empty=function(){return new i(1,0)},i.fromPoint=function(n){return new i(n,n)},i})();var Ci=(function(){function i(t,n){t===void 0&&(t=0),n===void 0&&(n=0),this.x=0,this.y=0,this.x=t,this.y=n}var e=i.prototype;return e.add=function(n){return new i(this.x+n.x,this.y+n.y)},e.sub=function(n){return new i(this.x-n.x,this.y-n.y)},e.mul=function(n){return new i(this.x*n,this.y*n)},e.ortho=function(){return new i(-this.y,this.x)},e.dot=function(n){return this.x*n.x+this.y*n.y},e.cross=function(n){return this.x*n.y-this.y*n.x},e.norm=function(){return Math.hypot(this.x,this.y)},e.normalize=function(){return this.x==0&&this.y==0?this:this.mul(1/this.norm())},e.trunc=function(n){n===void 0&&(n=15);var r=+("1e"+n),s=function(a){return Math.round(a*r)/r};return new i(s(this.x),s(this.y))},e.equals=function(n){return this.x===n.x&&this.y===n.y},e.toString=function(){var n=this.trunc(12);return"("+n.x.toFixed(12)+", "+n.y.toFixed(12)+")"},i})(),Hr=(function(){function i(t,n){t===void 0&&(t=new Li(0,0)),n===void 0&&(n=new Li(0,0)),this.x=t,this.y=n}var e=i.prototype;return e.isValid=function(){return this.x.isEmpty()==this.y.isEmpty()},e.isEmpty=function(){return this.x.isEmpty()},e.vertices=function(){return[new Ci(this.x.lo,this.y.lo),new Ci(this.x.hi,this.y.lo),new Ci(this.x.hi,this.y.hi),new Ci(this.x.lo,this.y.hi)]},e.vertexIJ=function(n,r){var s=this.x.lo;n==1&&(s=this.x.hi);var o=this.y.lo;return r==1&&(o=this.y.hi),new Ci(s,o)},e.lo=function(){return new Ci(this.x.lo,this.y.lo)},e.hi=function(){return new Ci(this.x.hi,this.y.hi)},e.center=function(){return new Ci(this.x.center(),this.y.center())},e.size=function(){return new Ci(this.x.length(),this.y.length())},e.containsPoint=function(n){return this.x.contains(n.x)&&this.y.contains(n.y)},e.interiorContainsPoint=function(n){return this.x.interiorContains(n.x)&&this.y.interiorContains(n.y)},e.contains=function(n){return this.x.containsInterval(n.x)&&this.y.containsInterval(n.y)},e.interiorContains=function(n){return this.x.interiorContainsInterval(n.x)&&this.y.interiorContainsInterval(n.y)},e.intersects=function(n){return this.x.intersects(n.x)&&this.y.intersects(n.y)},e.interiorIntersects=function(n){return this.x.interiorIntersects(n.x)&&this.y.interiorIntersects(n.y)},e.addPoint=function(n){return new i(this.x.addPoint(n.x),this.y.addPoint(n.y))},e.addRect=function(n){return new i(this.x.union(n.x),this.y.union(n.y))},e.clampPoint=function(n){return new Ci(this.x.clampPoint(n.x),this.y.clampPoint(n.y))},e.expanded=function(n){var r=this.x.expanded(n.x),s=this.y.expanded(n.y);return r.isEmpty()||s.isEmpty()?i.empty():new i(r,s)},e.expandedByMargin=function(n){return this.expanded(new Ci(n,n))},e.union=function(n){return new i(this.x.union(n.x),this.y.union(n.y))},e.intersection=function(n){var r=this.x.intersection(n.x),s=this.y.intersection(n.y);return r.isEmpty()||s.isEmpty()?i.empty():new i(r,s)},e.approxEqual=function(n){return this.x.approxEqual(n.x)&&this.y.approxEqual(n.y)},e.string=function(){return"["+this.lo().toString()+", "+this.hi.toString()+"]"},i.fromPoints=function(){for(var n=arguments.length,r=new Array(n),s=0;s<n;s++)r[s]=arguments[s];if(r.length==0)return new i;for(var o=new i(new Li(r[0].x,r[0].x),new Li(r[0].y,r[0].y)),a=1;a<r.length;a++)o=o.addPoint(r[a]);return o},i.fromCenterSize=function(n,r){return new i(new Li(n.x-r.x/2,n.x+r.x/2),new Li(n.y-r.y/2,n.y+r.y/2))},i.fromRect=function(n){return new i(new Li(n.x.lo,n.x.hi),new Li(n.y.lo,n.y.hi))},i.empty=function(){return new i(Li.empty(),Li.empty())},i})();var Wt=(function(){function i(t,n,r){this.x=0,this.y=0,this.z=0,this.x=t,this.y=n,this.z=r}var e=i.prototype;return e.approxEqual=function(n){var r=1e-16;return Math.abs(this.x-n.x)<r&&Math.abs(this.y-n.y)<r&&Math.abs(this.z-n.z)<r},e.toString=function(){return"("+this.x.toFixed(24)+", "+this.y.toFixed(24)+", "+this.z.toFixed(24)+")"},e.norm=function(){return Math.sqrt(this.dot(this))},e.norm2=function(){return this.dot(this)},e.normalize=function(){var n=this.norm2();return n==0?new i(0,0,0):this.mul(1/Math.sqrt(n))},e.isUnit=function(){var n=5e-14;return Math.abs(this.norm2()-1)<=n},e.abs=function(){return new i(Math.abs(this.x),Math.abs(this.y),Math.abs(this.z))},e.add=function(n){return new i(this.x+n.x,this.y+n.y,this.z+n.z)},e.sub=function(n){return new i(this.x-n.x,this.y-n.y,this.z-n.z)},e.mul=function(n){return new i(n*this.x,n*this.y,n*this.z)},e.dot=function(n){return this.x*n.x+this.y*n.y+this.z*n.z||0},e.cross=function(n){return new i(this.y*n.z-this.z*n.y,this.z*n.x-this.x*n.z,this.x*n.y-this.y*n.x)},e.distance=function(n){return this.sub(n).norm()},e.angle=function(n){return Math.atan2(this.cross(n).norm(),this.dot(n))},e.ortho=function(){var n=new i(0,0,0),r=this.largestComponent();return r===i.X_AXIS?n.z=1:r===i.Y_AXIS?n.x=1:n.y=1,this.cross(n).normalize()},e.largestComponent=function(){var n=this.abs();return n.x>n.y?n.x>n.z?i.X_AXIS:i.Z_AXIS:n.y>n.z?i.Y_AXIS:i.Z_AXIS},e.smallestComponent=function(){var n=this.abs();return n.x<n.y?n.x<n.z?i.X_AXIS:i.Z_AXIS:n.y<n.z?i.Y_AXIS:i.Z_AXIS},e.equals=function(n){return this.x==n.x&&this.y==n.y&&this.z==n.z},e.cmp=function(n){return this.x<n.x?-1:this.x>n.x?1:this.y<n.y?-1:this.y>n.y?1:this.z<n.z?-1:this.z>n.z?1:0},i})();Wt.X_AXIS=0;Wt.Y_AXIS=1;Wt.Z_AXIS=2;var CL=(function(){function i(t,n,r){this.x=t,this.y=n,this.z=r}i.fromVector=function(n){return new i(new x1.BigFloat32(n.x),new x1.BigFloat32(n.y),new x1.BigFloat32(n.z))};var e=i.prototype;return e.vector=function(){return new Wt(this.x.valueOf(),this.y.valueOf(),this.z.valueOf()).normalize()},e.equals=function(n){return this.x.cmp(n.x)===0&&this.y.cmp(n.y)===0&&this.z.cmp(n.z)===0},e.toString=function(){return"("+this.x.toString()+", "+this.y.toString()+", "+this.z.toString()+")"},e.norm2=function(){return this.dot(this)},e.isUnit=function(){return this.norm2().cmp(new x1.BigFloat32(1))===0},e.abs=function(){var n=this.x.mul(this.x.getSign()),r=this.y.mul(this.y.getSign()),s=this.z.mul(this.z.getSign());return new i(n,r,s)},e.add=function(n){return new i(this.x.add(n.x),this.y.add(n.y),this.z.add(n.z))},e.sub=function(n){return new i(this.x.sub(n.x),this.y.sub(n.y),this.z.sub(n.z))},e.mul=function(n){return new i(this.x.mul(n),this.y.mul(n),this.z.mul(n))},e.mulByFloat64=function(n){return this.mul(new x1.BigFloat32(n))},e.dot=function(n){return this.x.mul(n.x).add(this.y.mul(n.y).add(this.z.mul(n.z)))},e.cross=function(n){return new i(this.y.mul(n.z).sub(this.z.mul(n.y)),this.z.mul(n.x).sub(this.x.mul(n.z)),this.x.mul(n.y).sub(this.y.mul(n.x)))},e.largestComponent=function(){var n=this.abs();return n.x.cmp(n.y)>0?n.x.cmp(n.z)>0?Wt.X_AXIS:Wt.Z_AXIS:n.y.cmp(n.z)>0?Wt.Y_AXIS:Wt.Z_AXIS},e.smallestComponent=function(){var n=this.abs();return n.x.cmp(n.y)<0?n.x.cmp(n.z)<0?Wt.X_AXIS:Wt.Z_AXIS:n.y.cmp(n.z)<0?Wt.Y_AXIS:Wt.Z_AXIS},e.isZero=function(){return this.x.isZero()&&this.y.isZero()&&this.z.isZero()},i})();var UL=Math.PI/180,cp=function(e,t){if(isNaN(e)||isNaN(t)||!isFinite(e)||t===0)return NaN;var n=e/t,r=Math.round(n);Math.abs(n-r)===.5&&(r=2*Math.round(n/2));var s=e-r*t;return s||Math.sign(e)*0},iH=function(e,t){if(isNaN(e)||isNaN(t))return NaN;if(e===t)return t;if(e===0)return t>0?Number.MIN_VALUE:-Number.MIN_VALUE;var n=new ArrayBuffer(8),r=new DataView(n);r.setFloat64(0,e,!0);var s=r.getBigUint64(0,!0);return e>0==t>e?s+=1n:s-=1n,r.setBigUint64(0,s,!0),r.getFloat64(0,!0)},Jue=function(e){var t=e&-e&0xffffffffffffffffn;if(t===0n)return 64;var n=Math.clz32(Number(t&0xffffffffn));if(n<32)return 31-n;var r=Math.clz32(Number(t>>32n&0xffffffffn));return 63-r},rH=function(e){var t=e&0xffffffffffffffffn;if(t===0n)return 64;var n=Math.clz32(Number(t>>32n&0xffffffffn));if(n<32)return 63-n;var r=Math.clz32(Number(t&0xffffffffn));return 31-r},kL=function(e,t){return e*Math.pow(2,t)},Mq=function(e){return isNaN(e)?NaN:e===0?-1/0:isFinite(e)?(e=Math.abs(e),e<Number.MIN_VALUE?-1074:Math.floor(Math.log2(e))):1/0},xc=function(e){return e},sH=function(e){return e/UL||0};var ehe=function(){return 1/0},the=function(e){return e==1/0};var Cq=function(e){return sH(e).toFixed(7)},Rq=function(e,t,n){return n===void 0&&(n=1e-15),Math.abs(e-t)<=n};var AT=-1,M1=2,bc=4,nD=4,Vm=1e-15,Qx=2220446049e-25,dT=function(e){if(e<0)return AT;if(the(e))return Ec();var t=2*Math.sin(.5*Math.min(Math.PI,xc(e)));return t*t},zL=function(e){return e>nD?bc:e},ET=function(e,t){return nhe(e)?e:Math.max(0,Math.min(nD,e+t))},gT=function(e){return e<0?-1:oH(e)?ehe():2*Math.asin(.5*Math.sqrt(e))},Ec=function(){return 1/0},oH=function(e){return e==1/0},nhe=function(e){return e<0||oH(e)};var C1=function(e){return e>=nD?Ec():e<0?0:iH(e,10)};var iD=function(e){return 4.5*Qx*e+16*Qx*Qx};var $x=function(e,t){return dT(gT(e)+gT(t))},ihe=function(e,t){if(t==0)return e;if(e<=t)return 0;var n=e*(1-.25*t),r=t*(1-.25*e);return Math.max(0,n+r-2*Math.sqrt(n*r))},rhe=function(e){return Math.sqrt(aH(e))||0},aH=function(e){return e*(1-.25*e)||0};var to=(function(){function i(t,n){this.lo=t,this.hi=n}i.fromEndpoints=function(n,r){var s=new i(n,r);return n===-Math.PI&&r!==Math.PI&&(s.lo=Math.PI),r===-Math.PI&&n!==Math.PI&&(s.hi=Math.PI),s},i.fromPointPair=function(n,r){return n===-Math.PI&&(n=Math.PI),r===-Math.PI&&(r=Math.PI),i.positiveDistance(n,r)<=Math.PI?new i(n,r):new i(r,n)},i.emptyInterval=function(){return new i(Math.PI,-Math.PI)},i.fullInterval=function(){return new i(-Math.PI,Math.PI)};var e=i.prototype;return e.isValid=function(){return Math.abs(this.lo)<=Math.PI&&Math.abs(this.hi)<=Math.PI&&!(this.lo===-Math.PI&&this.hi!==Math.PI)&&!(this.hi===-Math.PI&&this.lo!==Math.PI)},e.isFull=function(){return this.lo===-Math.PI&&this.hi===Math.PI},e.isEmpty=function(){return this.lo===Math.PI&&this.hi===-Math.PI},e.isInverted=function(){return this.lo>this.hi},e.equals=function(n){return this.lo==n.lo&&this.hi==n.hi||this.isEmpty()&&n.isEmpty()},e.invert=function(){return new i(this.hi,this.lo)},e.center=function(){var n=.5*(this.lo+this.hi);return this.isInverted()?n<=0?n+Math.PI:n-Math.PI:n},e.length=function(){var n=this.hi-this.lo;return n>=0||(n+=2*Math.PI,n>0)?n:-1},e.fastContains=function(n){return this.isInverted()?(n>=this.lo||n<=this.hi)&&!this.isEmpty():n>=this.lo&&n<=this.hi},e.contains=function(n){return n===-Math.PI&&(n=Math.PI),this.fastContains(n)},e.containsInterval=function(n){return this.isInverted()?n.isInverted()?n.lo>=this.lo&&n.hi<=this.hi:(n.lo>=this.lo||n.hi<=this.hi)&&!this.isEmpty():n.isInverted()?this.isFull()||n.isEmpty():n.lo>=this.lo&&n.hi<=this.hi},e.interiorContains=function(n){return n===-Math.PI&&(n=Math.PI),this.isInverted()?n>this.lo||n<this.hi:n>this.lo&&n<this.hi||this.isFull()},e.interiorContainsInterval=function(n){return this.isInverted()?n.isInverted()?n.lo>this.lo&&n.hi<this.hi||n.isEmpty():n.lo>this.lo||n.hi<this.hi:n.isInverted()?this.isFull()||n.isEmpty():n.lo>this.lo&&n.hi<this.hi||this.isFull()},e.intersects=function(n){return this.isEmpty()||n.isEmpty()?!1:this.isInverted()?n.isInverted()||n.lo<=this.hi||n.hi>=this.lo:n.isInverted()?n.lo<=this.hi||n.hi>=this.lo:n.lo<=this.hi&&n.hi>=this.lo},e.interiorIntersects=function(n){return this.isEmpty()||n.isEmpty()||this.lo===this.hi?!1:this.isInverted()?n.isInverted()||n.lo<this.hi||n.hi>this.lo:n.isInverted()?n.lo<this.hi||n.hi>this.lo:n.lo<this.hi&&n.hi>this.lo||this.isFull()},i.positiveDistance=function(n,r){var s=r-n;return s>=0?s:r+Math.PI-(n-Math.PI)},e.union=function(n){return n.isEmpty()?this:this.fastContains(n.lo)?this.fastContains(n.hi)?this.containsInterval(n)?this:i.fullInterval():new i(this.lo,n.hi):this.fastContains(n.hi)?new i(n.lo,this.hi):this.isEmpty()||n.fastContains(this.lo)?n:i.positiveDistance(n.hi,this.lo)<i.positiveDistance(this.hi,n.lo)?new i(n.lo,this.hi):new i(this.lo,n.hi)},e.intersection=function(n){return n.isEmpty()?i.emptyInterval():this.fastContains(n.lo)?this.fastContains(n.hi)?n.length()<this.length()?n:this:new i(n.lo,this.hi):this.fastContains(n.hi)?new i(this.lo,n.hi):n.fastContains(this.lo)?this:i.emptyInterval()},e.addPoint=function(n){return Math.abs(n)>Math.PI?this:(n===-Math.PI&&(n=Math.PI),this.fastContains(n)?this:this.isEmpty()?new i(n,n):i.positiveDistance(n,this.lo)<i.positiveDistance(this.hi,n)?new i(n,this.hi):new i(this.lo,n))},e.expanded=function(n){if(n>=0){if(this.isEmpty())return this;if(this.length()+2*n+2*Qx>=2*Math.PI)return i.fullInterval()}else{if(this.isFull())return this;if(this.length()+2*n-2*Qx<=0)return i.emptyInterval()}var r=i.fromEndpoints(cp(this.lo-n,2*Math.PI),cp(this.hi+n,2*Math.PI));return r.lo<=-Math.PI&&(r.lo=Math.PI),r},e.approxEqual=function(n){return this.isEmpty()?n.length()<=2*Vm:n.isEmpty()?this.length()<=2*Vm:this.isFull()?n.length()>=2*(Math.PI-Vm):n.isFull()?this.length()>=2*(Math.PI-Vm):Math.abs(cp(n.lo-this.lo,2*Math.PI))<=Vm&&Math.abs(cp(n.hi-this.hi,2*Math.PI))<=Vm&&Math.abs(this.length()-n.length())<=2*Vm},e.toString=function(){return"["+this.lo.toFixed(7)+", "+this.hi.toFixed(7)+"]"},e.complement=function(){return this.lo===this.hi?i.fullInterval():new i(this.hi,this.lo)},e.complementCenter=function(){return this.lo!==this.hi?this.complement().center():this.hi<=0?this.hi+Math.PI:this.hi-Math.PI},e.directedHausdorffDistance=function(n){if(n.containsInterval(this))return 0;if(n.isEmpty())return Math.PI;var r=n.complementCenter();if(this.contains(r))return i.positiveDistance(n.hi,r);var s=0;i.fromEndpoints(n.hi,r).contains(this.hi)&&(s=i.positiveDistance(n.hi,this.hi));var o=0;return i.fromEndpoints(r,n.lo).contains(this.lo)&&(o=i.positiveDistance(this.lo,n.lo)),Math.max(s,o)},e.project=function(n){if(n===-Math.PI&&(n=Math.PI),this.fastContains(n))return n;var r=i.positiveDistance(n,this.lo),s=i.positiveDistance(this.hi,n);return r<s?this.lo:this.hi},i})();var cl=4,Tc=1,jf=2,she=[[0,1,3,2],[0,3,1,2],[2,3,1,0],[2,1,3,0]],rD=[[0,1,3,2],[0,2,3,1],[3,2,0,1],[3,1,0,2]],b1=[Tc,0,0,jf|Tc],lH=[],cH=[];up(0,0,0,0,0,0);up(0,0,0,Tc,0,Tc);up(0,0,0,jf,0,jf);up(0,0,0,Tc|jf,0,Tc|jf);function up(i,e,t,n,r,s){if(i==cl){var o=(e<<cl)+t;cH[(o<<2)+n]=(r<<2)+s,lH[(r<<2)+n]=(o<<2)+s;return}i++,e<<=1,t<<=1,r<<=2;var a=rD[s];up(i,e+(a[0]>>1),t+(a[0]&1),n,r,s^b1[0]),up(i,e+(a[1]>>1),t+(a[1]&1),n,r+1,s^b1[1]),up(i,e+(a[2]>>1),t+(a[2]&1),n,r+2,s^b1[2]),up(i,e+(a[3]>>1),t+(a[3]&1),n,r+3,s^b1[3])}var ohe=3,uH=6,_i=30,oy=2*_i+1,ul=Number(1n<<BigInt(_i)),dp=BigInt(uH)<<BigInt(oy),Iq=Number(BigInt(ul)<<1n),hp=function(e){return e>Iq?1:e/Iq},wc=function(e){return e>=.5?1/3*(4*e*e-1):1/3*(1-4*(1-e)*(1-e))},sh=function(e){return e>=0?.5*Math.sqrt(1+3*e):1-.5*Math.sqrt(1-3*e)},ty=function(e){var t=e.largestComponent();switch(t){case Wt.X_AXIS:e.x<0&&(t+=3);break;case Wt.Y_AXIS:e.y<0&&(t+=3);break;case Wt.Z_AXIS:e.z<0&&(t+=3);break}return t},Hm=function(e,t){switch(e){case 0:return[t.y/t.x,t.z/t.x];case 1:return[-t.x/t.y,t.z/t.y];case 2:return[-t.x/t.z,-t.y/t.z];case 3:return[t.z/t.x,t.y/t.x];case 4:return[t.z/t.y,-t.x/t.y];default:return[-t.y/t.z,-t.x/t.z]}},vT=function(e){var t=ty(e),n=Hm(t,e),r=n[0],s=n[1];return[t,r,s]},oh=function(e,t,n){switch(e){case 0:return new Wt(1,t,n);case 1:return new Wt(-t,1,n);case 2:return new Wt(-t,-n,1);case 3:return new Wt(-1,-n,-t);case 4:return new Wt(n,-1,-t);default:return new Wt(n,t,-1)}},ahe=function(e,t){switch(e){case 0:if(t.x<=0)return[0,0,!1];break;case 1:if(t.y<=0)return[0,0,!1];break;case 2:if(t.z<=0)return[0,0,!1];break;case 3:if(t.x>=0)return[0,0,!1];break;case 4:if(t.y>=0)return[0,0,!1];break;default:if(t.z>=0)return[0,0,!1];break}var n=Hm(e,t),r=n[0],s=n[1];return[r,s,!0]},pp=function(e,t){switch(e){case 0:return new Wt(t.y,t.z,t.x);case 1:return new Wt(-t.x,t.z,t.y);case 2:return new Wt(-t.x,-t.y,t.z);case 3:return new Wt(-t.z,-t.y,-t.x);case 4:return new Wt(-t.z,t.x,-t.y);default:return new Wt(t.y,t.x,-t.z)}},pT=function(e,t,n){return oh(e,wc(hp(t)),wc(hp(n)))},Pq=function(e,t){switch(e){case 0:return new Wt(t,-1,0);case 1:return new Wt(1,t,0);case 2:return new Wt(1,0,t);case 3:return new Wt(-t,0,1);case 4:return new Wt(0,-t,1);default:return new Wt(0,-1,-t)}},Lq=function(e,t){switch(e){case 0:return new Wt(-t,0,1);case 1:return new Wt(0,-t,1);case 2:return new Wt(0,-1,-t);case 3:return new Wt(t,-1,0);case 4:return new Wt(1,t,0);default:return new Wt(1,0,t)}},lhe=[[new Wt(0,1,0),new Wt(0,0,1),new Wt(1,0,0)],[new Wt(-1,0,0),new Wt(0,0,1),new Wt(0,1,0)],[new Wt(-1,0,0),new Wt(0,-1,0),new Wt(0,0,1)],[new Wt(0,0,-1),new Wt(0,-1,0),new Wt(-1,0,0)],[new Wt(0,0,-1),new Wt(1,0,0),new Wt(0,-1,0)],[new Wt(0,1,0),new Wt(1,0,0),new Wt(0,0,-1)]],che=[[[4,1],[5,2],[3,0]],[[0,3],[5,2],[4,1]],[[0,3],[1,4],[5,2]],[[2,5],[1,4],[0,3]],[[2,5],[3,0],[1,4]],[[4,1],[3,0],[2,5]]],hH=function(e,t){return lhe[e][t]},_T=function(e,t,n){return che[e][t][n]},uhe=function(e){return hH(e,0)},hhe=function(e){return hH(e,1)},VL=Math.PI/2,Dq=-VL,ar=(function(){function i(t,n){this.lat=t,this.lng=n}i.fromDegrees=function(n,r){return new i(n*UL,r*UL)},i.latitude=function(n){var r=n.vector;return Math.atan2(r.z,Math.sqrt(r.x*r.x+r.y*r.y))},i.longitude=function(n){return Math.atan2(n.vector.y,n.vector.x)},i.fromPoint=function(n){return new i(this.latitude(n),this.longitude(n))};var e=i.prototype;return e.isValid=function(){return Math.abs(this.lat)<=Math.PI/2&&Math.abs(this.lng)<=Math.PI},e.normalized=function(){var n=this.lat;n>VL?n=VL:n<Dq&&(n=Dq);var r=cp(this.lng,2*Math.PI);return new i(n,r)},e.toString=function(){return"["+Cq(this.lat)+", "+Cq(this.lng)+"]"},e.distance=function(n){var r=Math.sin(.5*(n.lat-this.lat)),s=Math.sin(.5*(n.lng-this.lng)),o=r*r+s*s*Math.cos(this.lat)*Math.cos(n.lat);return 2*Math.atan2(Math.sqrt(o),Math.sqrt(Math.max(0,1-o)))},e.approxEqual=function(n){return Rq(this.lat,n.lat)&&Rq(this.lng,n.lng)},i})(),fhe=function(e,t){return new We(e[0][t],e[1][t],e[2][t])},RL=function(e,t,n){return e[0][t]=n.x,e[1][t]=n.y,e[2][t]=n.z,e},fH=function(e,t){return new We(e[0][0]*t.x+e[0][1]*t.y+e[0][2]*t.z,e[1][0]*t.x+e[1][1]*t.y+e[1][2]*t.z,e[2][0]*t.x+e[2][1]*t.y+e[2][2]*t.z)},dhe=function(e){return[[e[0][0],e[1][0],e[2][0]],[e[0][1],e[1][1],e[2][1]],[e[0][2],e[1][2],e[2][2]]]},sD=function(e){var t=[[0,0,0],[0,0,0],[0,0,0]];return RL(t,2,e),RL(t,1,We.ortho(e)),RL(t,0,We.fromVector(fhe(t,1).vector.cross(e.vector))),t},phe=function(e,t){return fH(dhe(e),t)},mhe=function(e,t){return fH(e,t)},xT=-1,Wf=0,L1=1,dH=1e-15,Ki=2220446049250313e-31,Nq=1.8274*Ki,Ahe=3.2321*Ki,GL=function(e,t,n){return n.vector.cross(e.vector).dot(t.vector)>0},Gm=function(e,t,n){var r=qL(e,t,n);return r===Wf&&(r=HL(e,t,n)),r},ghe=function(e,t,n){var r=t.vector.sub(e.vector),s=r.norm2(),o=n.vector.sub(t.vector),a=o.norm2(),l=e.vector.sub(n.vector),c=l.norm2(),u,f,d;s>=a&&s>=c?(u=l,f=o,d=n.vector):a>=c?(u=r,f=l,d=e.vector):(u=o,f=r,d=t.vector);var A=-u.cross(f).dot(d),y=Ahe*Math.sqrt(u.norm2()*f.norm2());return A>y?L1:A<-y?xT:Wf},qL=function(e,t,n){var r=e.vector.cross(t.vector).dot(n.vector);return r>Nq?L1:r<-Nq?xT:Wf},HL=function(e,t,n){if(e.equals(t)||t.equals(n)||n.equals(e))return Wf;var r=ghe(e,t,n);return r!==Wf?r:vhe(e,t,n,!0)},vhe=function(e,t,n,r){var s=L1,o=e,a=t,l=n;if(o.vector.cmp(a.vector)>0){var c=[a,o];o=c[0],a=c[1],s=-s}if(a.vector.cmp(l.vector)>0){var u=[l,a];a=u[0],l=u[1],s=-s}if(o.vector.cmp(a.vector)>0){var f=[a,o];o=f[0],a=f[1],s=-s}var d=CL.fromVector(o.vector),A=CL.fromVector(a.vector),y=CL.fromVector(l.vector),w=A.cross(y),S=d.dot(w),T=S.getSign();return T===Wf&&r&&(T=_he(d,A,y,w)),s*T},_he=function(e,t,n,r){var s=r.z.getSign();return s!==0||(s=r.y.getSign(),s!==0)||(s=r.x.getSign(),s!==0)||(s=n.x.mul(e.y).sub(n.y.mul(e.x)).getSign(),s!==0)||(s=n.x.getSign(),s!==0)||(s=-n.y.getSign(),s!==0)||(s=n.z.mul(e.x).sub(n.x.mul(e.z)).getSign(),s!==0)||(s=n.z.getSign(),s!==0)||(s=e.x.mul(t.y).sub(e.y.mul(t.x)).getSign(),s!==0)||(s=-t.x.getSign(),s!==0)||(s=t.y.getSign(),s!==0)||(s=e.x.getSign(),s!==0)?s:L1},We=(function(){function i(t,n,r){this.vector=new Wt(t,n,r)}i.fromVector=function(n){return new i(n.x,n.y,n.z)},i.fromLatLng=function(n){var r=n.lat,s=n.lng,o=Math.cos(r);return new i(Math.cos(s)*o,Math.sin(s)*o,Math.sin(r))},i.fromCoords=function(n,r,s){return n===0&&r===0&&s===0?this.originPoint():i.fromVector(new Wt(n,r,s).normalize())},i.originPoint=function(){return new i(-.00999946643502502,.002592454260932412,.999946643502502)};var e=i.prototype;return e.pointCross=function(n){var r=this.vector.add(n.vector).cross(n.vector.sub(this.vector));return r.x===0&&r.y===0&&r.z===0&&(r=this.vector.ortho()),i.fromVector(r)},i.orderedCCW=function(n,r,s,o){var a=0;return Gm(r,o,n)!==xT&&a++,Gm(s,o,r)!==xT&&a++,Gm(n,o,s)===L1&&a++,a>=2},e.distance=function(n){return this.vector.angle(n.vector)},e.equals=function(n){return this.vector.equals(n.vector)},e.approxEqual=function(n,r){return r===void 0&&(r=dH),this.vector.angle(n.vector)<=r},e.stableAngle=function(n){return 2*Math.atan2(this.vector.sub(n.vector).norm(),this.vector.add(n.vector).norm())},i.chordAngleBetweenPoints=function(n,r){return Math.min(4,n.vector.sub(r.vector).norm2())},i.regularPoints=function(n,r,s){return this.regularPointsForFrame(sD(n),r,s)},i.regularPointsForFrame=function(n,r,s){for(var o=Math.cos(r),a=Math.sin(r),l=2*Math.PI/s,c=[],u=0;u<s;u++){var f=u*l,d=new i(a*Math.cos(f),a*Math.sin(f),o);c.push(i.fromVector(mhe(n,d).vector.normalize()))}return c},e.containsCell=function(n){return!1},e.intersectsCell=function(n){return n.containsPoint(this)},e.containsPoint=function(n){return this.contains(n)},e.cellUnionBound=function(){return[N1(this)]},e.contains=function(n){return this.equals(n)},e.referenceDir=function(){return i.ortho(this)},e.toString=function(){return this.vector.toString()},i.ortho=function(n){var r=n.vector.largestComponent(),s=new Wt(.012,.0053,.00457);return r===Wt.X_AXIS?s.z=1:r===Wt.Y_AXIS?s.x=1:s.y=1,i.fromVector(n.vector.cross(s).normalize())},i.sortPoints=function(n){n.sort(function(r,s){return r.vector.cmp(s.vector)})},$ue(i,[{key:"x",get:function(){return this.vector.x}},{key:"y",get:function(){return this.vector.y}},{key:"z",get:function(){return this.vector.z}}])})(),yT=function(e,t,n){return e<t?t:e>n?n:e},xhe=function(e){for(var t=e,n=arguments.length,r=new Array(n>1?n-1:0),s=1;s<n;s++)r[s-1]=arguments[s];for(var o=0,a=r;o<a.length;o++){var l=a[o];l>t&&(t=l)}return t},yhe=function(e){for(var t=e,n=arguments.length,r=new Array(n>1?n-1:0),s=1;s<n;s++)r[s-1]=arguments[s];for(var o=0,a=r;o<a.length;o++){var l=a[o];l<t&&(t=l)}return t},bhe=function(e){return e<0n?-e:e},WL=function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];return xhe.apply(void 0,[e].concat(n))},IL=function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];return yhe.apply(void 0,[e].concat(n))},jL=function(e,t){for(var n=0,r=e;n<r;){var s=Math.floor((n+r)/2);t(s)?r=s:n=s+1}return n},hl=(1n<<64n)-1n,uu=function(e){return Number(e>>BigInt(oy))},whe=function(e){return e&hl>>BigInt(ohe)},no=function(e){return _i-(Jue(e)>>>1)},wr=function(e,t){var n=Wm(t);return e&-n|n},oD=function(e){var t=as(e)<<2n;return e&-t|t},ay=function(e){return(e&Wm(0)-1n)===0n},ny=function(e){return typeof e!="bigint"||BigInt.asUintN(64,e)!=e?!1:uu(e)<=uH&&(as(e)&0x1555555555555555n)!=0n},aD=function(e){return(e&1n)!=0n},pH=function(e,t){return Number(e>>2n*BigInt(_i-t)+1n)&3},as=function(e){return e&-e},Wm=function(e){return 1n<<BigInt(2*(_i-e))},D1=function(e){var t=[e,e,e,e],n=as(e);return t[0]=e-n+(n>>2n),n>>=1n,t[1]=t[0]+n,t[2]=t[1]+n,t[3]=t[2]+n,t},mH=function(e,t){var n=[],r=_p(e),s=r.f,o=r.i,a=r.j,l=Ca(no(e));o&=-l,a&=-l;for(var c=Ca(t),u=-c;;u+=c){var f=void 0;if(u<0?f=a+u>=0:u>=l?f=a+u<ul:(f=!0,n.push(wr(fp(s,o+u,a-c,a-l>=0),t)),n.push(wr(fp(s,o+u,a+l,a+l<ul),t))),n.push(wr(fp(s,o-c,a+u,f&&o-l>=0),t)),n.push(wr(fp(s,o+l,a+u,f&&o+l<ul),t)),u>=l)break}return n},qi=function(e){return e-(as(e)-1n)},Gi=function(e){return e+(as(e)-1n)},qm=function(e,t){return qi(e)<=t&&t<=Gi(e)},AH=function(e,t){return qi(t)<=Gi(e)&&Gi(t)>=qi(e)},She=function(e){var t=e.toString(16).padStart(16,"0").replace(/0+$/,"");return t.length===0?"X":t},The=function(e){if(e.length>16||!/^[A-F0-9]+$/i.test(e))return 0n;var t=BigInt("0x"+e);return e.length<16&&(t=t<<BigInt(4*(16-e.length))),t},Ehe=function(e){if(!ny(e))return"Invalid: "+e.toString(16);for(var t=uu(e)+"/",n=1;n<=no(e);n++)t+=pH(e,n);return t},Mhe=function(e){var t=e.length-2;if(t<0||t>_i)return 0n;var n=parseInt(e[0],10);if(isNaN(n)||n<0||n>5||e[1]!=="/")return 0n;for(var r=Ap(n),s=2;s<e.length;s++){var o=parseInt(e[s],10);if(isNaN(o)||o<0||o>3)return 0n;r=D1(r)[o]}return r},Che=function(e,t,n){return wr((BigInt(e)<<BigInt(oy))+(t||1n),n)},Ap=function(e){return(BigInt(e)<<BigInt(oy))+Wm(0)},N1=function(e){var t=vT(e.vector),n=t[0],r=t[1],s=t[2],o=kl(sh(r)),a=kl(sh(s));return ly(n,o,a)},gH=function(e){return N1(We.fromLatLng(e))},kl=function(e){return yT(Math.floor(ul*e),0,ul-1)},Ca=function(e){return 1<<yT(_i-e,0,_i)},vH=function(e){return w1(Ca(e))},w1=function(e){return e/ul},_H=function(e){var t=lD(e),n=t.si,r=t.ti;return new Ci(wc(hp(n)),wc(hp(r)))},Rhe=function(e){var t=_p(e),n=t.i,r=t.j;return MT(n,r,no(e))},ly=function(e,t,n){for(var r=BigInt(e)<<BigInt(oy-1),s=e&Tc,o=7;o>=0;o--){var a=(1<<cl)-1;s+=(t>>o*cl&a)<<cl+2,s+=(n>>o*cl&a)<<2,s=cH[s],r|=BigInt(s>>2)<<BigInt(o*2*cl),s&=Tc|jf}return r*2n+1n},S1=function(e,t,n){t=yT(t,-1,ul),n=yT(n,-1,ul);var r=1/ul,s=iH(1,2),o=Math.max(-s,Math.min(s,r*(Number(BigInt(t)<<1n)+1-ul))),a=Math.max(-s,Math.min(s,r*(Number(BigInt(n)<<1n)+1-ul))),l=vT(oh(e,o,a));return e=l[0],o=l[1],a=l[2],ly(e,kl(.5*(o+1)),kl(.5*(a+1)))},fp=function(e,t,n,r){return r?ly(e,t,n):S1(e,t,n)},_p=function(e){for(var t=uu(e),n=t&Tc,r=_i-7*cl,s=0,o=0,a=7;a>=0;a--)n+=Number((e>>BigInt(a*2*cl+1)&(1n<<BigInt(2*r))-1n)<<2n),n=lH[n],s+=n>>cl+2<<a*cl,o+=(n>>2&(1<<cl)-1)<<a*cl,n&=Tc|jf,r=cl;return(as(e)&BigInt("0x1111111111111110"))!=0n&&(n^=Tc),{f:t,i:s,j:o,orientation:n}},lD=function(e){var t=_p(e),n=t.f,r=t.i,s=t.j,o=0;return aD(e)?o=1:((BigInt(r)^e>>2n)&1n)!=0n&&(o=2),{face:n,si:2*r+o,ti:2*s+o}},MT=function(e,t,n){var r=Ca(n),s=e&-r,o=t&-r;return new Hr(new Li(wc(w1(s)),wc(w1(s+r))),new Li(wc(w1(o)),wc(w1(o+r))))},Ihe=function(e){return e>>2n*BigInt(_i-no(e))+1n},cy=function(e){var t=lD(e),n=t.face,r=t.si,s=t.ti;return pT(n,r,s)},cD=function(e){return We.fromVector(cy(e).normalize())},Phe=function(e){return ar.fromPoint(We.fromVector(cy(e)))},Lhe=function(e){var t=no(e),n=Ca(t),r=_p(e),s=r.f,o=r.i,a=r.j;return[wr(S1(s,o,a-n),t),wr(S1(s,o+n,a),t),wr(S1(s,o,a+n),t),wr(S1(s,o-n,a),t)]},xH=function(e,t){var n=Ca(t+1),r=n<<1,s=_p(e),o=s.f,a=s.i,l=s.j,c=!1,u=!1,f=0,d=0;(a&n)!=0?(f=r,c=a+r<ul):(f=-r,c=a-r>=0),(l&n)!=0?(d=r,u=l+r<ul):(d=-r,u=l-r>=0);var A=[wr(e,t),wr(fp(o,a+f,l,c),t),wr(fp(o,a,l+d,u),t)];return(c||u)&&A.push(wr(fp(o,a+f,l+d,c&&u),t)),A},uD=function(e){var t=as(e);return e-t+(t>>2n)},uy=function(e,t){return e-as(e)+Wm(t)},yH=function(e){var t=as(e);return e+t+(t>>2n)},CT=function(e,t){return e+as(e)+Wm(t)},Ia=function(e){return e+(as(e)<<1n)&hl},bH=function(e){return e-(as(e)<<1n)&hl},Dhe=function(e){var t=Ia(e);return t<dp?t:t-dp&hl},Nhe=function(e){var t=bH(e);return t<dp?t:t+dp&hl},Fhe=function(e,t){if(t===0n)return e;var n=BigInt(2*(_i-no(e))+1);if(t<0n){var r=-(e>>n);if(t<r){var s=dp>>n;t%=s,t<r&&(t+=s)}}else{var o=dp-e>>n;if(t>o){var a=dp>>n;t%=a,t>o&&(t-=a)}}return e+(t<<bhe(n))},iy=function(e,t){var n=e^t;n<as(e)&&(n=as(e)),n<as(t)&&(n=as(t));var r=rH(n);return r>60?[0,!1]:[60-r>>1,!0]},XL=function(e,t){var n=qi(e);if(n>=qi(t))return t;if(Gi(e)>=t){for(;e=D1(e)[0],!(Gi(e)<t););return e}for(;!ay(e);){var r=oD(e);if(qi(r)!==n||Gi(r)>=t)break;e=r}return e},Bhe=function(e,t){if(t===0n)return e;var n=BigInt(2*(_i-no(e))+1);if(t<0n){var r=-(e>>n);t<r&&(t=r)}else{var s=dp+as(e)-e>>n;t>s&&(t=s)}return e+(t<<n)},$L=function(e,t){return e<t?-1:e>t?1:0},Ohe=function(e,t){return e>t?-1:e<t?1:0},Uhe={__proto__:null,SentinelCellID:hl,face:uu,pos:whe,level:no,parent:wr,immediateParent:oD,isFace:ay,valid:ny,isLeaf:aD,childPosition:pH,lsb:as,lsbForLevel:Wm,children:D1,allNeighbors:mH,rangeMin:qi,rangeMax:Gi,contains:qm,intersects:AH,toToken:She,fromToken:The,toString:Ehe,fromString:Mhe,fromFacePosLevel:Che,fromFace:Ap,fromPoint:N1,fromLatLng:gH,stToIJ:kl,sizeIJ:Ca,sizeST:vH,ijToSTMin:w1,centerUV:_H,boundUV:Rhe,fromFaceIJ:ly,fromFaceIJWrap:S1,fromFaceIJSame:fp,faceIJOrientation:_p,faceSiTi:lD,ijLevelToBoundUV:MT,distanceFromBegin:Ihe,rawPoint:cy,point:cD,latLng:Phe,edgeNeighbors:Lhe,vertexNeighbors:xH,childBegin:uD,childBeginAtLevel:uy,childEnd:yH,childEndAtLevel:CT,next:Ia,prev:bH,nextWrap:Dhe,prevWrap:Nhe,advanceWrap:Fhe,commonAncestorLevel:iy,maxTile:XL,advance:Bhe,ascending:$L,descending:Ohe},Vl=(function(){function i(t,n){var r=t.pointCross(n);this.a=t,this.b=n,this.aXb=We.fromVector(t.vector.cross(n.vector)),this.aTangent=We.fromVector(t.vector.cross(r.vector)),this.bTangent=We.fromVector(r.vector.cross(n.vector)),this.c=new We(0,0,0),this.acb=Sc}i.newChainEdgeCrosser=function(n,r,s){var o=new i(n,r);return o.restartAt(s),o};var e=i.prototype;return e.crossingSign=function(n,r){return n.equals(this.c)||this.restartAt(n),this.chainCrossingSign(r)},e.edgeOrVertexCrossing=function(n,r){return n.equals(this.c)||this.restartAt(n),this.edgeOrVertexChainCrossing(r)},e.restartAt=function(n){this.c=n,this.acb=-qL(this.a,this.b,this.c)},e.chainCrossingSign=function(n){var r=qL(this.a,this.b,n);return this.acb===-r&&r!==Wf?(this.c=n,this.acb=-r,zl):this._crossingSign(n,r)},e.edgeOrVertexChainCrossing=function(n){var r=We.fromVector(this.c.vector);switch(this.chainCrossingSign(n)){case zl:return!1;case Sc:return!0}return SH(this.a,this.b,r,n)},e._crossingSign=function(n,r){var s=(1.5+1/Math.sqrt(3))*Ki;if(this.c.vector.dot(this.aTangent.vector)>s&&n.vector.dot(this.aTangent.vector)>s||this.c.vector.dot(this.bTangent.vector)>s&&n.vector.dot(this.bTangent.vector)>s)return this.c=n,this.acb=-r,zl;if(this.a.equals(this.c)||this.a.equals(n)||this.b.equals(this.c)||this.b.equals(n))return this.c=n,this.acb=-r,bT;if(this.a.equals(this.b)||this.c.equals(n))return this.c=n,this.acb=-r,zl;if(this.acb===Wf&&(this.acb=-HL(this.a,this.b,this.c)),r===Wf&&(r=HL(this.a,this.b,n)),r!==this.acb)return this.c=n,this.acb=-r,zl;var o=-Gm(this.c,n,this.b);if(o!==this.acb)return this.c=n,this.acb=-r,zl;var a=Gm(this.c,n,this.a);return a!==this.acb?(this.c=n,this.acb=-r,zl):(this.c=n,this.acb=-r,Sc)},i})(),Sc=0,bT=1,zl=2,wH=function(e,t,n,r){var s=Vl.newChainEdgeCrosser(e,t,n);return s.chainCrossingSign(r)},SH=function(e,t,n,r){if(e.equals(t)||n.equals(r))return!1;switch(!0){case e.equals(n):return t.equals(r)||We.orderedCCW(e.referenceDir(),r,t,e);case t.equals(r):return We.orderedCCW(t.referenceDir(),n,e,t);case e.equals(r):return t.equals(n)||We.orderedCCW(e.referenceDir(),n,t,e);case t.equals(n):return We.orderedCCW(t.referenceDir(),r,e,t)}return!1},khe=function(e,t,n){return!We.orderedCCW(t.referenceDir(),n,e,t)},Ri=(function(){function i(t,n){this.lat=t,this.lng=n}i.emptyRect=function(){return new i(Li.empty(),to.emptyInterval())},i.fullRect=function(){return new i(i.validRectLatRange,i.validRectLngRange)},i.fromLatLng=function(n){return new i(new Li(xc(n.lat),xc(n.lat)),new to(xc(n.lng),xc(n.lng)))},i.fromCenterSize=function(n,r){var s=new ar(r.lat/2,r.lng/2);return i.fromLatLng(n).expanded(s)};var e=i.prototype;return e.equals=function(n){return this.lat.equals(n.lat)&&this.lng.equals(n.lng)},e.isValid=function(){return Math.abs(this.lat.lo)<=Math.PI/2&&Math.abs(this.lat.hi)<=Math.PI/2&&this.lng.isValid()&&this.lat.isEmpty()===this.lng.isEmpty()},e.isEmpty=function(){return this.lat.isEmpty()},e.isFull=function(){return this.lat.equals(i.validRectLatRange)&&this.lng.isFull()},e.isPoint=function(){return this.lat.lo===this.lat.hi&&this.lng.lo===this.lng.hi},e.vertex=function(n){var r,s;switch(n){case 0:r=this.lat.lo,s=this.lng.lo;break;case 1:r=this.lat.lo,s=this.lng.hi;break;case 2:r=this.lat.hi,s=this.lng.hi;break;default:r=this.lat.hi,s=this.lng.lo;break}return new ar(r,s)},e.lo=function(){return new ar(this.lat.lo,this.lng.lo)},e.hi=function(){return new ar(this.lat.hi,this.lng.hi)},e.center=function(){return new ar(this.lat.center(),this.lng.center())},e.size=function(){return new ar(this.lat.length(),this.lng.length())},e.area=function(){if(this.isEmpty())return 0;var n=Math.abs(Math.sin(this.lat.hi)-Math.sin(this.lat.lo));return this.lng.length()*n},e.addPoint=function(n){return n.isValid()?new i(this.lat.addPoint(xc(n.lat)),this.lng.addPoint(xc(n.lng))):this},e.expanded=function(n){var r=this.lat.expanded(xc(n.lat)),s=this.lng.expanded(xc(n.lng));return r.isEmpty()||s.isEmpty()?i.emptyRect():new i(r.intersection(i.validRectLatRange),s)},e.toString=function(){return"[Lo"+this.lo()+", Hi"+this.hi()+"]"},e.polarClosure=function(){return this.lat.lo===-Math.PI/2||this.lat.hi===Math.PI/2?new i(this.lat,to.fullInterval()):this},e.union=function(n){return new i(this.lat.union(n.lat),this.lng.union(n.lng))},e.intersection=function(n){var r=this.lat.intersection(n.lat),s=this.lng.intersection(n.lng);return r.isEmpty()||s.isEmpty()?i.emptyRect():new i(r,s)},e.intersects=function(n){return this.lat.intersects(n.lat)&&this.lng.intersects(n.lng)},e.capBound=function(){if(this.isEmpty())return mp.emptyCap();var n,r;this.lat.hi+this.lat.lo<0?(n=-1,r=Math.PI/2+this.lat.hi):(n=1,r=Math.PI/2-this.lat.lo);var s=mp.fromCenterAngle(new We(0,0,n),r);if(cp(this.lng.hi-this.lng.lo,2*Math.PI)>=0&&this.lng.hi-this.lng.lo<2*Math.PI){var o=mp.fromPoint(We.fromLatLng(this.center())).addPoint(We.fromLatLng(this.lo())).addPoint(We.fromLatLng(this.hi()));if(o.height()<s.height())return o}return s},e.rectBound=function(){return this},e.contains=function(n){return this.lat.containsInterval(n.lat)&&this.lng.containsInterval(n.lng)},e.containsCell=function(n){return this.contains(n.rectBound())},e.containsLatLng=function(n){return n.isValid()?this.lat.contains(xc(n.lat))&&this.lng.contains(xc(n.lng)):!1},e.containsPoint=function(n){return this.containsLatLng(ar.fromPoint(n))},e.cellUnionBound=function(){return this.capBound().cellUnionBound()},e.approxEqual=function(n){return this.lat.approxEqual(n.lat)&&this.lng.approxEqual(n.lng)},i.bisectorIntersection=function(n,r){r=Math.abs(r);var s=n.center(),o=new ar(s-Math.PI/2,r);s<0&&(o=new ar(-s-Math.PI/2,r-Math.PI));var a=new We(0,-1,0);return a.pointCross(We.fromLatLng(o))},e.centroid=function(){if(this.isEmpty())return new We(0,0,0);var n=Math.sin(this.lat.lo),r=Math.sin(this.lat.hi),s=Math.cos(this.lat.lo),o=Math.cos(this.lat.hi),a=.5*this.lng.length(),l=Math.sin(a)*(o*r-s*n+this.lat.length()),c=this.lng.center(),u=a*(r+n)*(r-n);return new We(l*Math.cos(c),l*Math.sin(c),u)},e.intersectsCell=function(n){if(this.isEmpty())return!1;if(this.containsPoint(We.fromVector(cy(n.id)))||n.containsPoint(We.fromLatLng(this.center())))return!0;if(!this.intersects(n.rectBound()))return!1;for(var r=[],s=[],o=0;o<4;o++){var a=n.vertex(o);r.push(a);var l=ar.fromPoint(a);if(s.push(l),this.containsLatLng(l)||n.containsPoint(We.fromLatLng(this.vertex(o))))return!0}for(var c=0;c<4;c++){var u=to.fromEndpoints(s[c].lng,s[c+1&3].lng);if(this.lng.intersects(u)){var f=r[c],d=r[c+1&3];if(u.contains(this.lng.lo)&&Bq(f,d,this.lat,this.lng.lo)||u.contains(this.lng.hi)&&Bq(f,d,this.lat,this.lng.hi)||Fq(f,d,this.lat.lo,this.lng)||Fq(f,d,this.lat.hi,this.lng))return!0}}return!1},i})();Ri.validRectLatRange=new Li(-Math.PI/2,Math.PI/2);Ri.validRectLngRange=to.fullInterval();var Fq=function(e,t,n,r){var s=e.vector.cross(t.vector).normalize();s.z<0&&(s=s.mul(-1));var o=s.cross(We.fromCoords(0,0,1).vector).normalize(),a=o.cross(s),l=Math.sin(xc(n));if(Math.abs(l)>=a.z)return!1;var c=l/a.z,u=Math.sqrt(1-c*c),f=Math.atan2(u,c),d=to.fromPointPair(Math.atan2(e.vector.dot(o),e.vector.dot(a)),Math.atan2(t.vector.dot(o),t.vector.dot(a)));if(d.contains(f)){var A=a.mul(c).add(o.mul(u));if(r.contains(Math.atan2(A.y,A.x)))return!0}if(d.contains(-f)){var y=a.mul(c).sub(o.mul(u));if(r.contains(Math.atan2(y.y,y.x)))return!0}return!1},Bq=function(e,t,n,r){return wH(e,t,We.fromLatLng(new ar(n.lo,r)),We.fromLatLng(new ar(n.hi,r)))===Sc},hD=(function(){function i(t,n){this.dim=t,this.deriv=n}var e=i.prototype;return e.value=function(n){return kL(this.deriv,-this.dim*n)},e.minLevel=function(n){if(n<=0)return _i;var r=-(Mq(n/this.deriv)>>this.dim-1);return r>_i&&(r=_i),r<0&&(r=0),r||0},e.maxLevel=function(n){if(n<=0)return _i;var r=Mq(this.deriv/n)>>this.dim-1;return r>_i&&(r=_i),r<0&&(r=0),r||0},e.closestLevel=function(n){var r=Math.SQRT2;return this.dim===2&&(r=2),this.minLevel(r*n)},i})(),YL=new hD(1,2*Math.SQRT2/3),zhe=new hD(1,1.4592137463861061),ZL=new hD(2,4*Math.PI/6),Vhe=function(e,t,n){return gT(fD(e,t,n,0,!0).dist)},hu=function(e,t,n,r){return fD(e,t,n,r,!1)},Oq=function(e,t,n,r){var s=WL(We.chordAngleBetweenPoints(e,t),We.chordAngleBetweenPoints(e,n));if(s>M1){var o=fD(We.fromVector(e.vector.mul(-1)),t,n,s,!0);s=o.dist,s=bc-s}return r<s?{dist:s,less:!0}:{dist:r,less:!1}},TH=function(e,t,n){var r=t.pointCross(n),s=e.vector.sub(r.vector.mul(e.vector.dot(r.vector)/r.vector.norm2()));return GL(r,t,We.fromVector(s))&&GL(We.fromVector(s),n,r)?We.fromVector(s.normalize()):e.vector.sub(t.vector).norm2()<=e.vector.sub(n.vector).norm2()?t:n},EH=function(e,t,n){var r=e,s=t.pointCross(n),o=s.vector.cross(t.vector);return We.fromVector(t.vector.mul(Math.cos(r)).add(o.mul(Math.sin(r)/o.norm())).normalize())},Ghe=function(e){return Math.max(qhe(e),iD(e))},qhe=function(e){if(e>=M1)return 0;var t=Math.min(1,.5*e),n=Math.sqrt(t*(2-t));return((2.5+2*Math.sqrt(3)+8.5*n)*n+(2+2*Math.sqrt(3)/3+6.5*(1-t))*t+(23+16/Math.sqrt(3))*Ki)*Ki},fD=function(e,t,n,r,s){var o=Hhe(e,t,n,r,s),a=o.dist,l=o.less;if(l)return{dist:a,less:!0};var c=e.vector.sub(t.vector).norm2(),u=e.vector.sub(n.vector).norm2(),f=Math.min(c,u);return!s&&f>=r?{dist:r,less:!1}:{dist:f,less:!0}},Hhe=function(e,t,n,r,s){var o=e.vector.sub(t.vector).norm2(),a=e.vector.sub(n.vector).norm2(),l=t.vector.sub(n.vector).norm2(),c=4.75*Ki*(o+a+l)+8*Ki*Ki;if(Math.abs(o-a)>=l+c)return{dist:r,less:!1};var u=t.pointCross(n),f=u.vector.norm2(),d=e.vector.dot(u.vector),A=d*d;if(!s&&A>f*r)return{dist:r,less:!1};var y=u.vector.cross(e.vector);if(t.vector.sub(e.vector).dot(y)>=0||n.vector.sub(e.vector).dot(y)<=0)return{dist:r,less:!1};var w=1-Math.sqrt(y.norm2()/f),S=A/f+w*w;return!s&&S>=r?{dist:r,less:!1}:{dist:S,less:!0}},Uq=We.fromCoords(1,0,0),mp=(function(){function i(t,n){this.center=t,this.rad=n}i.fromPoint=function(n){return i.fromCenterChordAngle(n,0)},i.fromCenterAngle=function(n,r){return i.fromCenterChordAngle(n,dT(r))},i.fromCenterChordAngle=function(n,r){return new i(n,r)},i.fromCenterHeight=function(n,r){return i.fromCenterChordAngle(n,zL(2*r))},i.fromCenterArea=function(n,r){return i.fromCenterChordAngle(n,zL(r/Math.PI))},i.fromCap=function(n){return new i(We.fromVector(n.center.vector),n.rad)},i.emptyCap=function(){return i.fromCenterChordAngle(Uq,AT)},i.fullCap=function(){return i.fromCenterChordAngle(Uq,bc)};var e=i.prototype;return e.isValid=function(){return this.center.vector.isUnit()&&this.rad<=bc},e.isEmpty=function(){return this.rad<0},e.isFull=function(){return this.rad==bc},e.centerPoint=function(){return this.center},e.height=function(){return .5*this.rad},e.radius=function(){return gT(this.rad)},e.area=function(){return 2*Math.PI*Math.max(0,this.height())},e.contains=function(n){return this.isFull()||n.isEmpty()?!0:this.rad>=$x(We.chordAngleBetweenPoints(this.center,n.center),n.rad)},e.intersects=function(n){return this.isEmpty()||n.isEmpty()?!1:$x(this.rad,n.rad)>=We.chordAngleBetweenPoints(this.center,n.center)},e.interiorIntersects=function(n){return this.rad<=0||n.isEmpty()?!1:$x(this.rad,n.rad)>We.chordAngleBetweenPoints(this.center,n.center)},e.intersectsCell=function(n){for(var r=[],s=0;s<4;s++)if(r[s]=n.vertex(s),this.containsPoint(r[s]))return!0;return this._intersects(n,r)},e._intersects=function(n,r){if(this.rad>=M1||this.isEmpty())return!1;if(n.containsPoint(this.center))return!0;for(var s=aH(this.rad),o=0;o<4;o++){var a=n.edge(o).vector,l=this.center.vector.dot(a);if(!(l>0)){if(l*l>s*a.norm2())return!1;var c=a.cross(this.center.vector);if(c.dot(r[o].vector)<0&&c.dot(r[o+1&3].vector)>0)return!0}}return!1},e.containsPoint=function(n){return We.chordAngleBetweenPoints(this.center,n)<=this.rad},e.containsCell=function(n){for(var r=[],s=0;s<4;s++)if(r[s]=n.vertex(s),!this.containsPoint(r[s]))return!1;return!this.complement()._intersects(n,r)},e.interiorContainsPoint=function(n){return this.isFull()||We.chordAngleBetweenPoints(this.center,n)<this.rad},e.complement=function(){return this.isFull()?i.emptyCap():this.isEmpty()?i.fullCap():i.fromCenterChordAngle(We.fromVector(this.center.vector.mul(-1)),ihe(bc,this.rad))},e.capBound=function(){return this},e.rectBound=function(){if(this.isEmpty())return Ri.emptyRect();var n=this.radius(),r=!1,s=new Li(ar.latitude(this.center)-n,ar.latitude(this.center)+n),o=to.fullInterval();if(s.lo<=-Math.PI/2&&(s.lo=-Math.PI/2,r=!0),s.hi>=Math.PI/2&&(s.hi=Math.PI/2,r=!0),!r){var a=rhe(this.rad),l=Math.cos(ar.latitude(this.center));if(a<=l){var c=Math.asin(a/l);o.lo=cp(ar.longitude(this.center)-c,Math.PI*2),o.hi=cp(ar.longitude(this.center)+c,Math.PI*2)}}return new Ri(s,o)},e.equals=function(n){return this.rad===n.rad&&this.center.equals(n.center)||this.isEmpty()&&n.isEmpty()||this.isFull()&&n.isFull()},e.approxEqual=function(n){var r=1e-14,s=this.rad,o=n.rad;return this.center.approxEqual(n.center)&&Math.abs(s-o)<=r||this.isEmpty()&&o<=r||n.isEmpty()&&s<=r||this.isFull()&&o>=2-r||n.isFull()&&s>=2-r},e.addPoint=function(n){if(this.isEmpty())return new i(n,0);var r=We.chordAngleBetweenPoints(this.center,n);return r>this.rad&&(this.rad=r),this},e.addCap=function(n){if(this.isEmpty())return n;if(n.isEmpty())return this;var r=$x(We.chordAngleBetweenPoints(this.center,n.center),n.rad),s=ET(r,Ki*r);return s>this.rad&&(this.rad=s),this},e.expanded=function(n){return this.isEmpty()?i.emptyCap():i.fromCenterChordAngle(this.center,$x(this.rad,dT(n)))},e.toString=function(){return"[Center="+this.center.vector+", Radius="+sH(this.radius())+"]"},i.radiusToHeight=function(n){return n<0?AT:n>=Math.PI?M1:.5*dT(n)},e.cellUnionBound=function(){var n=YL.maxLevel(this.radius())-1;if(n<0){for(var r=[],s=0;s<6;s++)r[s]=Ap(s);return r}return xH(N1(this.center),n)},e.centroid=function(){if(this.isEmpty())return new We(0,0,0);var n=1-.5*this.height();return We.fromVector(this.center.vector.mul(n*this.area()))},e.union=function(n){var r=this;if(r.rad<n.rad){var s=[n,r];r=s[0],n=s[1]}if(r.isFull()||n.isEmpty())return r;var o=r.radius(),a=n.radius(),l=r.center.distance(n.center);if(o>=l+a)return r;var c=.5*(l+o+a),u=EH(.5*(l-o+a),r.center,n.center);return i.fromCenterAngle(u,c)},i})(),KL=function(e,t,n){var r=t.stableAngle(n),s=n.stableAngle(e),o=e.stableAngle(t),a=.5*(r+s+o);if(a>=3e-4){var l=a-Math.max(r,s,o);if(l<.01*a*a*a*a*a){var c=Whe(e,t,n);if(l<a*.1*(c+5e-15))return c}}return 4*Math.atan(Math.sqrt(Math.max(0,Math.tan(.5*a)*Math.tan(.5*(a-r))*Math.tan(.5*(a-s))*Math.tan(.5*(a-o)))))},Whe=function(e,t,n){var r=e.pointCross(t),s=t.pointCross(n),o=e.pointCross(n),a=r.vector.angle(o.vector)-r.vector.angle(s.vector)+s.vector.angle(o.vector);return a<0&&(a=0),a},jhe=function(e,t,n){return Gm(e,t,n)*KL(e,t,n)},kq=function(e,t,n){var r=e.pointCross(t).vector.angle(t.pointCross(n).vector);return Gm(e,t,n)===L1?r:-r},zq=Math.asin(Math.sqrt(1/3))-.5*Ki,Ra=(function(){function i(t,n,r,s,o){this.face=t,this.level=n,this.orientation=r,this.id=s,this.uv=o}i.fromCellID=function(n){var r=_p(n),s=r.f,o=r.i,a=r.j,l=r.orientation,c=no(n);return new i(s,c,l,n,MT(o,a,c))},i.fromPoint=function(n){return i.fromCellID(N1(n))},i.fromLatLng=function(n){return i.fromCellID(gH(n))},i.oppositeFace=function(n){return(n+3)%6};var e=i.prototype;return e.isLeaf=function(){return this.level===_i},e.sizeIJ=function(){return Ca(this.level)},e.sizeST=function(){return vH(this.level)},e.vertex=function(n){var r=this.uv.vertices()[n];return We.fromVector(oh(this.face,r.x,r.y).normalize())},e.edge=function(n){switch(n){case 0:return We.fromVector(Lq(this.face,this.uv.y.lo).normalize());case 1:return We.fromVector(Pq(this.face,this.uv.x.hi).normalize());case 2:return We.fromVector(Lq(this.face,this.uv.y.hi).mul(-1).normalize());default:return We.fromVector(Pq(this.face,this.uv.x.lo).mul(-1).normalize())}},e.boundUV=function(){return this.uv},e.center=function(){return We.fromVector(cy(this.id).normalize())},e.children=function(){var n=[];if(aD(this.id))return n;for(var r=_H(this.id),s=uD(this.id),o=0;o<4;o++){var a=new i(this.face,this.level+1,this.orientation^b1[o],s,Hr.empty()),l=rD[this.orientation][o],c=l>>1,u=l&1;c===1?(a.uv.x.hi=this.uv.x.hi,a.uv.x.lo=r.x):(a.uv.x.lo=this.uv.x.lo,a.uv.x.hi=r.x),u===1?(a.uv.y.hi=this.uv.y.hi,a.uv.y.lo=r.y):(a.uv.y.lo=this.uv.y.lo,a.uv.y.hi=r.y),s=Ia(s),n.push(a)}return n},e.exactArea=function(){var n=this.vertex(0),r=this.vertex(1),s=this.vertex(2),o=this.vertex(3);return KL(n,r,s)+KL(n,s,o)},e.approxArea=function(){if(this.level<2)return this.averageArea();var n=.5*this.vertex(2).vector.sub(this.vertex(0).vector).cross(this.vertex(3).vector.sub(this.vertex(1).vector)).norm();return n*2/(1+Math.sqrt(1-Math.min(1/Math.PI*n,1)))},e.averageArea=function(){return ZL.value(this.level)},e.intersectsCell=function(n){return AH(this.id,n.id)},e.containsCell=function(n){return qm(this.id,n.id)},e.cellUnionBound=function(){return this.capBound().cellUnionBound()},e.latitude=function(n,r){var s,o;switch(!0){case(n===0&&r===0):s=this.uv.x.lo,o=this.uv.y.lo;break;case(n===0&&r===1):s=this.uv.x.lo,o=this.uv.y.hi;break;case(n===1&&r===0):s=this.uv.x.hi,o=this.uv.y.lo;break;case(n===1&&r===1):s=this.uv.x.hi,o=this.uv.y.hi;break;default:throw new Error("i and/or j is out of bounds")}return ar.latitude(We.fromVector(oh(this.face,s,o)))},e.longitude=function(n,r){var s,o;switch(!0){case(n===0&&r===0):s=this.uv.x.lo,o=this.uv.y.lo;break;case(n===0&&r===1):s=this.uv.x.lo,o=this.uv.y.hi;break;case(n===1&&r===0):s=this.uv.x.hi,o=this.uv.y.lo;break;case(n===1&&r===1):s=this.uv.x.hi,o=this.uv.y.hi;break;default:throw new Error("i and/or j is out of bounds")}return ar.longitude(We.fromVector(oh(this.face,s,o)))},e.rectBound=function(){if(this.level>0){var n=this.uv.x.lo+this.uv.x.hi,r=this.uv.y.lo+this.uv.y.hi,s,o;uhe(this.face).z===0?s=n<0?1:0:s=n>0?1:0,hhe(this.face).z===0?o=r<0?1:0:o=r>0?1:0;var a=Li.fromPoint(this.latitude(s,o)).addPoint(this.latitude(1-s,1-o)),l=to.emptyInterval().addPoint(this.longitude(s,1-o)).addPoint(this.longitude(1-s,o));return new Ri(a,l).expanded(new ar(2*Ki,2*Ki)).polarClosure()}var c;switch(this.face){case 0:c=new Ri(new Li(-Math.PI/4,Math.PI/4),new to(-Math.PI/4,Math.PI/4));break;case 1:c=new Ri(new Li(-Math.PI/4,Math.PI/4),new to(Math.PI/4,3*Math.PI/4));break;case 2:c=new Ri(new Li(zq,Math.PI/2),to.fullInterval());break;case 3:c=new Ri(new Li(-Math.PI/4,Math.PI/4),new to(3*Math.PI/4,-3*Math.PI/4));break;case 4:c=new Ri(new Li(-Math.PI/4,Math.PI/4),new to(-3*Math.PI/4,-Math.PI/4));break;default:c=new Ri(new Li(-Math.PI/2,-zq),to.fullInterval())}return c.expanded(new ar(Ki,0))},e.capBound=function(){for(var n=mp.fromPoint(We.fromVector(oh(this.face,this.uv.center().x,this.uv.center().y).normalize())),r=0;r<4;r++)n=n.addPoint(this.vertex(r));return n},e.containsPoint=function(n){var r=ahe(this.face,n.vector),s=r[0],o=r[1],a=r[2];return a?this.uv.expandedByMargin(Ki).containsPoint(new Ci(s,o)):!1},e.vertexChordDist2=function(n,r,s){var o=this.uv.x.lo,a=this.uv.y.lo;return r&&(o=this.uv.x.hi),s&&(a=this.uv.y.hi),We.chordAngleBetweenPoints(n,We.fromCoords(o,a,1))},e.uEdgeIsClosest=function(n,r){var s=this.uv.x.lo,o=this.uv.x.hi,a=this.uv.y.lo;r&&(a=this.uv.y.hi);var l=new Wt(a*a+1,-s*a,-s),c=new Wt(a*a+1,-o*a,-o);return n.vector.dot(l)>0&&n.vector.dot(c)<0},e.vEdgeIsClosest=function(n,r){var s=this.uv.y.lo,o=this.uv.y.hi,a=this.uv.x.lo;r&&(a=this.uv.x.hi);var l=new Wt(-a*s,a*a+1,-s),c=new Wt(-a*o,a*a+1,-o);return n.vector.dot(l)>0&&n.vector.dot(c)<0},i.edgeDistance=function(n,r){var s=n*n/(1+r*r),o=1-Math.sqrt(1-s);return zL(s+o*o)},e.distanceInternal=function(n,r){var s=We.fromVector(pp(this.face,n.vector)),o=s.x-s.z*this.uv.x.lo,a=s.x-s.z*this.uv.x.hi,l=s.y-s.z*this.uv.y.lo,c=s.y-s.z*this.uv.y.hi,u=!0;return o<0&&(u=!1,this.vEdgeIsClosest(s,!1))?i.edgeDistance(-o,this.uv.x.lo):a>0&&(u=!1,this.vEdgeIsClosest(s,!0))?i.edgeDistance(a,this.uv.x.hi):l<0&&(u=!1,this.uEdgeIsClosest(s,!1))?i.edgeDistance(-l,this.uv.y.lo):c>0&&(u=!1,this.uEdgeIsClosest(s,!0))?i.edgeDistance(c,this.uv.y.hi):u?r?0:IL(i.edgeDistance(-o,this.uv.x.lo),i.edgeDistance(a,this.uv.x.hi),i.edgeDistance(-l,this.uv.y.lo),i.edgeDistance(c,this.uv.y.hi)):IL(this.vertexChordDist2(s,!1,!1),this.vertexChordDist2(s,!0,!1),this.vertexChordDist2(s,!1,!0),this.vertexChordDist2(s,!0,!0))},e.distance=function(n){return this.distanceInternal(n,!0)},e.maxDistance=function(n){var r=We.fromVector(pp(this.face,n.vector)),s=WL(this.vertexChordDist2(r,!1,!1),this.vertexChordDist2(r,!0,!1),this.vertexChordDist2(r,!1,!0),this.vertexChordDist2(r,!0,!0));return s<=M1?s:bc-this.distance(We.fromVector(n.vector.mul(-1)))},e.boundaryDistance=function(n){return this.distanceInternal(n,!1)},e.distanceToEdge=function(n,r){var s=IL(this.distance(n),this.distance(r));if(s===0)return s;for(var o=Vl.newChainEdgeCrosser(n,r,this.vertex(3)),a=0;a<4;a++)if(o.chainCrossingSign(this.vertex(a))!==zl)return 0;for(var l=0;l<4;l++)s=hu(this.vertex(l),n,r,s).dist;return s},e.maxDistanceToEdge=function(n,r){var s=WL(this.maxDistance(n),this.maxDistance(r));return s<=M1?s:bc-this.distanceToEdge(We.fromVector(n.vector.mul(-1)),We.fromVector(r.vector.mul(-1)))},e.distanceToCell=function(n){if(this.face===n.face&&this.uv.intersects(n.uv))return 0;for(var r=[],s=[],o=0;o<4;o++)r.push(this.vertex(o)),s.push(n.vertex(o));for(var a=Ec(),l=0;l<4;l++)for(var c=0;c<4;c++)a=hu(r[l],s[c],s[c+1&3],a).dist,a=hu(s[l],r[c],r[c+1&3],a).dist;return a},e.maxDistanceToCell=function(n){var r=new Hr(n.uv.y,n.uv.x);if(this.face===i.oppositeFace(n.face)&&this.uv.intersects(r))return bc;for(var s=[],o=[],a=0;a<4;a++)s.push(this.vertex(a)),o.push(n.vertex(a));for(var l=AT,c=0;c<4;c++)for(var u=0;u<4;u++)l=Oq(s[c],o[u],o[u+1&3],l).dist,l=Oq(o[c],s[u],s[u+1&3],l).dist;return l},i})(),y1=-1,MH=(function(){function i(t,n){n===void 0&&(n=!1),this.nonEmpty=n,this.rangeNodes=t.rangeNodes,this.pos=0}var e=i.prototype;return e.startID=function(){return this.rangeNodes[this.pos].startID},e.limitID=function(){return this.rangeNodes[this.pos+1].startID},e.isEmpty=function(){return this.rangeNodes[this.pos].contents===y1},e.begin=function(){for(this.pos=0;this.nonEmpty&&this.isEmpty()&&!this.done();)this.pos++},e.internalPrev=function(){return this.pos===0?!1:(this.pos--,!0)},e.nonEmptyPrev=function(){for(;this.internalPrev();)if(!this.isEmpty())return!0;return this.isEmpty()&&!this.done()&&this.next(),!1},e.prev=function(){return this.nonEmpty?this.nonEmptyPrev():this.internalPrev()},e.next=function(){for(this.pos++;this.nonEmpty&&this.isEmpty()&&!this.done();)this.pos++},e.advance=function(n){return n>=this.rangeNodes.length-1-this.pos?!1:(this.pos+=n,!0)},e.finish=function(){this.pos=this.rangeNodes.length-1},e.done=function(){return this.pos>=this.rangeNodes.length-1},e.seek=function(n){for(var r=0,s=this.rangeNodes.length;r<s;){var o=r+s>>>1;this.rangeNodes[o].startID>n?s=o:r=o+1}for(this.pos=Math.max(r-1,0);this.nonEmpty&&this.isEmpty()&&!this.done();)this.pos++},i})(),CH=(function(){function i(t){this.cellTree=t.cellTree,this.prevStartID=0n,this.nodeCutoff=-1,this.nextNodeCutoff=-1,this.node={cellID:0n,label:y1,parent:-1}}var e=i.prototype;return e.clear=function(){this.prevStartID=0n,this.nodeCutoff=-1,this.nextNodeCutoff=-1,this.node.label=y1},e.cellID=function(){return this.node.cellID},e.label=function(){return this.node.label},e.next=function(){this.node.parent<=this.nodeCutoff?(this.nodeCutoff=this.nextNodeCutoff,this.node.label=y1):this.node=mT({},this.cellTree[this.node.parent])},e.done=function(){return this.node.label===y1},e.startUnion=function(n){n.startID()<this.prevStartID&&(this.nodeCutoff=-1),this.prevStartID=n.startID();var r=n.rangeNodes[n.pos].contents;r<=this.nodeCutoff?this.node.label=y1:this.node=mT({},this.cellTree[r]),this.nextNodeCutoff=r},i})(),Xhe=(function(){function i(){this.cellTree=[],this.rangeNodes=[]}var e=i.prototype;return e.add=function(n,r){if(r<0)throw new Error("labels must be non-negative");this.cellTree.push({cellID:n,label:r,parent:-1})},e.addCellUnion=function(n,r){if(r<0)throw new Error("labels must be non-negative");for(var s=Ct(n),o;!(o=s()).done;){var a=o.value;this.add(a,r)}},e.build=function(){for(var n=[],r=Ct(this.cellTree),s;!(s=r()).done;){var o=s.value;n.push({startID:qi(o.cellID),cellID:o.cellID,label:o.label}),n.push({startID:Ia(Gi(o.cellID)),cellID:hl,label:-1})}n.push({startID:uy(Ap(0),_i),cellID:0n,label:-1}),n.push({startID:CT(Ap(5),_i),cellID:0n,label:-1}),n.sort(function(u,f){return u.startID!==f.startID?u.startID<f.startID?-1:1:u.cellID!==f.cellID?u.cellID>f.cellID?-1:1:u.label<f.label?-1:u.label>f.label?1:0}),this.cellTree=[],this.rangeNodes=[];for(var a=-1,l=0;l<n.length;){for(var c=n[l].startID;l<n.length&&n[l].startID===c;)n[l].label>=0?(this.cellTree.push({cellID:n[l].cellID,label:n[l].label,parent:a}),a=this.cellTree.length-1):n[l].cellID===hl&&(a=this.cellTree[a].parent),l++;this.rangeNodes.push({startID:c,contents:a})}},i})(),R1=(function(i){function e(){return i.apply(this,arguments)||this}sy(e,i),e.fromRange=function(r,s){for(var o=new e,a=XL(r,s);a!==s;a=XL(Ia(a),s))o.push(a);return o},e.fromUnion=function(){for(var r=arguments.length,s=new Array(r),o=0;o<r;o++)s[o]=arguments[o];var a=Jx(e,s.flat(1));return a.normalize(),a},e.fromIntersection=function(r,s){for(var o=new e,a=0,l=0;a<r.length&&l<s.length;){var c=qi(r[a]),u=qi(s[l]);c>u?r[a]<=Gi(s[l])?(o.push(r[a]),a++):(l=s.lowerBound(l+1,s.length,c),r[a]<=Gi(s[l-1])&&l--):u>c?s[l]<=Gi(r[a])?(o.push(s[l]),l++):(a=r.lowerBound(a+1,r.length,u),s[l]<=Gi(r[a-1])&&a--):r[a]<s[l]?(o.push(r[a]),a++):(o.push(s[l]),l++)}return o.normalize(),o},e.fromIntersectionWithCellID=function(r,s){var o=new e;if(r.containsCellID(s))return o.push(s),o.normalize(),o;for(var a=Gi(s),l=r.lowerBound(0,r.length,qi(s));l<r.length&&r[l]<=a;l++)o.push(r[l]);return o.normalize(),o},e.fromDifference=function(r,s){for(var o=new e,a=Ct(r),l;!(l=a()).done;){var c=l.value;o.cellUnionDifferenceInternal(c,s)}return o};var t=e.prototype;return t.isValid=function(){for(var r=0;r<this.length;r++){var s=this[r];if(!ny(s)||r>0&&Gi(this[r-1])>=qi(s))return!1}return!0},t.isNormalized=function(){for(var r=0;r<this.length;r++){var s=this[r];if(!ny(s)||r>0&&Gi(this[r-1])>=qi(s)||r>=3&&e.areSiblings(this[r-3],this[r-2],this[r-1],s))return!1}return!0},t.normalize=function(){this.sort($L);for(var r=[],s=Ct(this),o;!(o=s()).done;){var a=o.value;if(!(r.length>0&&qm(r[r.length-1],a))){for(var l=r.length-1;l>=0&&qm(a,r[l]);)l--;for(r.length=l+1;r.length>=3&&e.areSiblings(r[r.length-3],r[r.length-2],r[r.length-1],a);)r.length-=3,a=oD(a);r.push(a)}}this.length=0,this.push.apply(this,r)},t.intersectsCellID=function(r){var s=this.lowerBound(0,this.length,r);return s!==this.length&&qi(this[s])<=Gi(r)?!0:s!==0&&Gi(this[s-1])>=qi(r)},t.containsCellID=function(r){var s=this.lowerBound(0,this.length,r);return s!==this.length&&qi(this[s])<=r?!0:s!==0&&Gi(this[s-1])>=r},t.denormalize=function(r,s){for(var o=new e,a=Ct(this),l;!(l=a()).done;){var c=l.value,u=no(c),f=u;if(f<r&&(f=r),s>1&&(f+=(_i-(f-r))%s,f>_i&&(f=_i)),f===u)o.push(c);else for(var d=CT(c,f),A=uy(c,f);A!==d;A=Ia(A))o.push(A)}this.length=0,this.push.apply(this,o)},t.rectBound=function(){for(var r=Ri.emptyRect(),s=Ct(this),o;!(o=s()).done;){var a=o.value;r=r.union(Ra.fromCellID(a).rectBound())}return r},t.capBound=function(){if(this.length===0)return mp.emptyCap();for(var r=new We(0,0,0),s=Ct(this),o;!(o=s()).done;){var a=o.value,l=ZL.value(no(a));r=We.fromVector(r.vector.add(cD(a).vector.mul(l)))}r.equals(new We(0,0,0))?r=We.fromCoords(1,0,0):r=We.fromVector(r.vector.normalize());for(var c=mp.fromPoint(r),u=Ct(this),f;!(f=u()).done;){var d=f.value;c=c.addCap(Ra.fromCellID(d).capBound())}return c},t.containsCell=function(r){return this.containsCellID(r.id)},t.intersectsCell=function(r){return this.intersectsCellID(r.id)},t.containsPoint=function(r){return this.containsCell(Ra.fromPoint(r))},t.cellUnionBound=function(){return this.capBound().cellUnionBound()},t.leafCellsCovered=function(){for(var r=0n,s=Ct(this),o;!(o=s()).done;){var a=o.value;r+=1n<<BigInt(_i-no(a)<<1)}return r},e.areSiblings=function(r,s,o,a){if((r^s^o)!==a)return!1;var l=as(a)<<1n;l=~(l+(l<<1n));var c=a&l;return(r&l)===c&&(s&l)===c&&(o&l)===c&&!ay(a)},t.contains=function(r){for(var s=Ct(r),o;!(o=s()).done;){var a=o.value;if(!this.containsCellID(a))return!1}return!0},t.intersects=function(r){for(var s=Ct(this),o;!(o=s()).done;){var a=o.value;if(r.intersectsCellID(a))return!0}return!1},t.lowerBound=function(r,s,o){for(var a=r;a<s;a++)if(this[a]>=o)return a;return s},t.cellUnionDifferenceInternal=function(r,s){if(!s.intersectsCellID(r)){this.push(r);return}if(!s.containsCellID(r))for(var o=Ct(D1(r)),a;!(a=o()).done;){var l=a.value;this.cellUnionDifferenceInternal(l,s)}},t.expandAtLevel=function(r){for(var s=new e,o=Wm(r),a=this.length-1;a>=0;a--){var l=this[a];if(as(l)<o)for(l=wr(l,r);a>0&&qm(l,this[a-1]);)a--;s.push(l),s.push.apply(s,mH(l,r))}s.sort($L),this.length=0,this.push.apply(this,s),this.normalize()},t.expandByRadius=function(r,s){for(var o=_i,a=Ct(this),l;!(l=a()).done;){var c=l.value;o=Math.min(o,no(c))}var u=YL.maxLevel(r);u===0&&r>YL.value(0)&&this.expandAtLevel(0),this.expandAtLevel(Math.min(o+s,u))},t.equals=function(r){if(this.length!==r.length)return!1;for(var s=0;s<this.length;s++)if(this[s]!==r[s])return!1;return!0},t.averageArea=function(){return ZL.value(_i)*Number(this.leafCellsCovered())},t.approxArea=function(){for(var r=0,s=Ct(this),o;!(o=s()).done;){var a=o.value;r+=Ra.fromCellID(a).approxArea()}return r},t.exactArea=function(){for(var r=0,s=Ct(this),o;!(o=s()).done;){var a=o.value;r+=Ra.fromCellID(a).exactArea()}return r},e})(E1(Array)),ah=(function(){function i(t,n){this.v0=t,this.v1=n}var e=i.prototype;return e.cmp=function(n){var r=this.v0.vector.cmp(n.v0.vector);return r!==0?r:this.v1.vector.cmp(n.v1.vector)},e.equals=function(n){return this.v0.equals(n.v0)&&this.v1.equals(n.v1)},i})(),T1=function(e,t){this.start=e,this.length=t},RT=function(e,t){this.chainID=e,this.offset=t},$he=function(e,t){this.point=e,this.contained=t},IT=function(e){return new $he(We.originPoint(),e)},RH=0,Yhe=1,Zhe=2,Khe=function(e){return e.numEdges()===0&&(e.dimension()!==2||e.numChains()===0)},Qhe=function(e){return e.numEdges()===0&&e.dimension()===2&&e.numChains()>0},Zx=(function(){function i(){}var e=i.prototype;return e.numEdges=function(){return 0},e.edge=function(n){return new ah(We.originPoint(),We.originPoint())},e.referencePoint=function(){return IT(!1)},e.numChains=function(){return 0},e.chain=function(n){return new T1(0,0)},e.chainEdge=function(n,r){return new ah(We.originPoint(),We.originPoint())},e.chainPosition=function(n){return new RT(0,0)},e.dimension=function(){return-1},e.isEmpty=function(){return!0},e.isFull=function(){return!1},e.typeTag=function(){return RH},e.privateInterface=function(){},i})(),Vq=(function(){function i(t,n){this.containsCenter=!1,this.shapeID=t,this.containsCenter=!1,this.edges=new Array(n)}var e=i.prototype;return e.numEdges=function(){return this.edges.length},e.containsEdge=function(n){for(var r=Ct(this.edges),s;!(s=r()).done;){var o=s.value;if(o===n)return!0}return!1},i})(),IH=(function(){function i(){this.shapeID=0,this.containsCenter=!1,this.edges=[]}var e=i.prototype;return e.numEdges=function(){return 0},e.containsEdge=function(n){return!1},i})(),Jhe=(function(){function i(t){this.shapes=new Array(t)}var e=i.prototype;return e.numEdges=function(){for(var n=0,r=Ct(this.shapes),s;!(s=r()).done;){var o=s.value;n+=o.numEdges()}return n},e.add=function(n){this.shapes.push(n)},e.findByShapeID=function(n){for(var r=Ct(this.shapes),s;!(s=r()).done;){var o=s.value;if(o.shapeID===n)return o}return new IH},i})(),PL=(function(){function i(){this.shapes=[]}var e=i.prototype;return e.numEdges=function(){return 0},e.add=function(n){},e.findByShapeID=function(n){return new IH},i})(),QL=0,PH=0,LL=(function(){function i(t,n){if(this.index=t,this.position=0,this.id=hl,this.cell=new PL,n!==void 0)switch(n){case QL:this.begin();break;case PH:this.end();break;default:throw new Error("unknown ShapeIndexIteratorPos value")}}var e=i.prototype;return e.clone=function(){var n=new i(this.index);return n.position=this.position,n.id=this.id,n.cell=this.cell,n},e.cellID=function(){return this.id},e.indexCell=function(){return this.cell},e.center=function(){return cD(this.cellID())},e.begin=function(){this.index.isFresh()||this.index.maybeApplyUpdates(),this.position=0,this.refresh()},e.next=function(){this.position++,this.refresh()},e.prev=function(){return this.position<=0?!1:(this.position--,this.refresh(),!0)},e.end=function(){this.position=this.index.cells.length,this.refresh()},e.done=function(){return this.id===hl},e.refresh=function(){this.position<this.index.cells.length?(this.id=this.index.cells[this.position],this.cell=this.index.cellMap.get(this.cellID())||new PL):(this.id=hl,this.cell=new PL)},e.seek=function(n){var r=this;this.position=jL(this.index.cells.length,function(s){return r.index.cells[s]>=n}),this.refresh()},e.locatePoint=function(n){var r=N1(n);return this.seek(r),!!(!this.done()&&qi(this.cellID())<=r||this.prev()&&Gi(this.cellID())>=r)},e.locateCellID=function(n){if(this.seek(qi(n)),!this.done()){if(this.cellID()>=n&&qi(this.cellID())<=n)return vp;if(this.cellID()<=Gi(n))return fy}return this.prev()&&Gi(this.cellID())>=n?vp:PT},i})(),efe=(function(){function i(){this.isActive=!1,this.a=this.b=i.trackerOrigin(),this.nextCellID=uy(Ap(0),_i),this.crosser=null,this.shapeIDs=[],this.savedIDs=[],this.drawTo(We.fromVector(oh(0,-1,-1).normalize()))}i.trackerOrigin=function(){return We.fromVector(oh(0,-1,-1).normalize())};var e=i.prototype;return e.focus=function(){return this.b},e.addShape=function(n,r){this.isActive=!0,r&&this.toggleShape(n)},e.moveTo=function(n){this.b=n},e.drawTo=function(n){this.a=this.b,this.b=n,this.crosser=new Vl(this.a,this.b)},e.testEdge=function(n,r){var s;(s=this.crosser)!=null&&s.edgeOrVertexCrossing(r.v0,r.v1)&&this.toggleShape(n)},e.setNextCellID=function(n){this.nextCellID=qi(n)},e.atCellID=function(n){return qi(n)===this.nextCellID},e.toggleShape=function(n){if(this.shapeIDs.length===0){this.shapeIDs.push(n);return}if(this.shapeIDs[0]===n){this.shapeIDs.shift();return}for(var r=0;r<this.shapeIDs.length;r++){var s=this.shapeIDs[r];if(!(s<n)){if(s===n){this.shapeIDs.splice(r,1);return}this.shapeIDs.splice(r,0,n);return}}this.shapeIDs.push(n)},e.saveAndClearStateBefore=function(n){var r=this.lowerBound(n);this.savedIDs=this.shapeIDs.slice(0,r),this.shapeIDs=this.shapeIDs.slice(r)},e.restoreStateBefore=function(n){var r=this.lowerBound(n);this.shapeIDs=this.savedIDs.concat(this.shapeIDs.slice(r)),this.savedIDs=[]},e.lowerBound=function(n){for(var r=0;r<this.shapeIDs.length;r++)if(this.shapeIDs[r]>=n)return r;return this.shapeIDs.length},i})(),Xf=1,Gq=2,gp=(function(){function i(t,n){this.index=t,this.model=n,this.iter=t.iterator()}var e=i.prototype;return e.contains=function(n){if(!this.iter.locatePoint(n))return!1;for(var r=this.iter.indexCell(),s=Ct(r.shapes),o;!(o=s()).done;){var a=o.value;if(this._shapeContains(a,this.iter.center(),n))return!0}return!1},e._shapeContains=function(n,r,s){var o=n.containsCenter,a=n.numEdges();if(a<=0)return o;var l=this.index.shape(n.shapeID);if(l.dimension()!==2){if(this.model!==Gq)return!1;for(var c=Ct(n.edges),u;!(u=c()).done;){var f=u.value,d=l.edge(f);if(d.v0.equals(s)||d.v1.equals(s))return!0}return!1}for(var A=new Vl(r,s),y=Ct(n.edges),w;!(w=y()).done;){var S=w.value,T=l.edge(S),R=A.crossingSign(T.v0,T.v1);if(R!==zl){if(R===bT){if(this.model!==Xf&&(T.v0.equals(s)||T.v1.equals(s)))return this.model===Gq;SH(A.a,A.b,T.v0,T.v1)?R=Sc:R=zl}o=o!==(R===Sc)}}return o},e.shapeContains=function(n,r){if(!n||n instanceof Zx||!this.iter.locatePoint(r))return!1;var s=this.iter.indexCell(),o=s.findByShapeID(this.index.idForShape(n));return o?this._shapeContains(o,this.iter.center(),r):!1},e.shapeVisitorFunc=function(n){return!0},e.visitContainingShapes=function(n,r){if(!this.iter.locatePoint(n))return!0;for(var s=this.iter.indexCell(),o=Ct(s.shapes),a;!(a=o()).done;){var l=a.value;if(this._shapeContains(l,this.iter.center(),n)&&!r(this.index.shape(l.shapeID)))return!1}return!0},e.containingShapes=function(n){var r=[];return this.visitContainingShapes(n,function(s){return r.push(s),!0}),r},i})(),tfe=(function(){function i(t,n){n===void 0&&(n=new gp(t,Xf)),this.index=t,this.containsQuery=n,this.iter=t.iterator()}var e=i.prototype;return e.capBound=function(){var n=Jx(R1,this.cellUnionBound());return n.capBound()},e.rectBound=function(){var n=Jx(R1,this.cellUnionBound());return n.rectBound()},e.cellUnionBound=function(){var n=[];if(this.iter.end(),!this.iter.prev())return n;var r=this.iter.cellID();if(this.iter.begin(),this.iter.cellID()!==r){var s=iy(this.iter.cellID(),r),o=s[0];o===void 0&&(o=-1),o++;for(var a=wr(r,o),l=wr(this.iter.cellID(),o);l!=a;l=Ia(l))if(!(Gi(l)<this.iter.cellID())){var c=this.iter.cellID();this.iter.seek(Ia(Gi(l))),this.iter.prev(),n.push.apply(n,this.coverRange(c,this.iter.cellID(),[])),this.iter.next()}}return this.coverRange(this.iter.cellID(),r,n)},e.coverRange=function(n,r,s){if(n==r)return s.concat([n]);var o=iy(n,r),a=o[0],l=o[1];return l||s.concat([0n]),s.concat([wr(n,a)])},i})(),nfe=2.25*Ki,ife=3*Ki,hy=9*(1/Math.SQRT2)*Ki,LH=3*Math.SQRT2*Ki,rfe=function(e,t,n){return ry(e,t,n,0)},ry=function(e,t,n,r){if(ty(e.vector)===n&&ty(t.vector)===n){var s=Hm(n,e.vector),o=s[0],a=s[1],l=Hm(n,t.vector),c=l[0],u=l[1];return[new Ci(o,a),new Ci(c,u),!0]}var f=new yc(pp(n,e.pointCross(t).vector)),d=new yc(pp(n,e.vector)),A=new yc(pp(n,t.vector)),y=1+r,w=new yc(new We(y*f.x,y*f.y,f.z));if(!w.intersectsFace())return[null,null,!1];Math.max(Math.abs(f.x),Math.max(Math.abs(f.y),Math.abs(f.z)))<kL(1,-511)&&(f=new yc(We.fromVector(f.vector.mul(kL(1,563)))));var S=new yc(We.fromVector(f.vector.normalize())),T=new yc(We.fromVector(S.vector.cross(d.vector))),R=new yc(We.fromVector(A.vector.cross(S.vector))),P=qq(A,d,new yc(We.fromVector(w.vector.mul(-1))),R,T,y),I=P[0],F=P[1],D=qq(d,A,w,T,R,y),L=D[0],C=D[1];return[I,L,F+C<3]},sfe=function(e,t,n){return e+t===n&&e===n-t&&t===n-e},DL=0,JL=1,yc=(function(i){function e(n){return i.call(this,n.x,n.y,n.z)||this}sy(e,i);var t=e.prototype;return t.intersectsFace=function(){var r=Math.abs(this.x),s=Math.abs(this.y),o=Math.abs(this.z);return s>=o-r&&r>=o-s},t.intersectsOppositeEdges=function(){var r=Math.abs(this.x),s=Math.abs(this.y),o=Math.abs(this.z);return Math.abs(r-s)!==o?Math.abs(r-s)>=o:r>=s?r-o>=s:s-o>=r},t.exitAxis=function(){if(this.intersectsOppositeEdges())return Math.abs(this.x)>=Math.abs(this.y)?JL:DL;var r=0,s=0,o=0;return Math.sign(this.x)<0&&(r=1),Math.sign(this.y)<0&&(s=1),Math.sign(this.z)<0&&(o=1),(r^s^o)===0?JL:DL},t.exitPoint=function(r){if(r===DL){var s=this.y>0?1:-1;return new Ci(s,(-s*this.x-this.z)/this.y)}var o=this.x<0?1:-1;return new Ci((-o*this.y-this.z)/this.x,o)},e})(We),qq=function(e,t,n,r,s,o){var a=1-hy;if(t.z>0){var l=new Ci(t.x/t.z,t.y/t.z);if(Math.max(Math.abs(l.x),Math.abs(l.y))<=a)return[l,0]}var c=n.exitPoint(n.exitAxis()).mul(o),u=new yc(new We(c.x,c.y,1)),f=0;return u.vector.sub(e.vector).dot(r.vector)<0?f=2:u.vector.sub(t.vector).dot(s.vector)<0&&(f=1),f>0&&(t.z<=0?f=3:c=new Ci(t.x/t.z,t.y/t.z)),[c,f]},Hq=function(e,t,n){return t?e.lo>n?[e,!1]:(e.hi>n&&(e.hi=n),[e,!0]):e.hi<n?[e,!1]:(e.lo<n&&(e.lo=n),[e,!0])},Wq=function(e,t,n,r,s,o,a,l){var c=!1;if(n.lo<l.lo){if(n.hi<l.lo)return[n,o,!1];n.lo=l.lo;var u=Hq(o,a,I1(l.lo,e,t,r,s));if(o=u[0],c=u[1],!c)return[n,o,!1]}if(n.hi>l.hi){if(n.lo>l.hi)return[n,o,!1];n.hi=l.hi;var f=Hq(o,!a,I1(l.hi,e,t,r,s));if(o=f[0],c=f[1],!c)return[n,o,!1]}return[n,o,!0]},DH=function(e,t,n){if(!n.intersects(Hr.fromPoints(e,t)))return!1;var r=t.sub(e).ortho(),s=r.x>=0?1:0,o=r.y>=0?1:0,a=r.dot(n.vertexIJ(s,o).sub(e)),l=r.dot(n.vertexIJ(1-s,1-o).sub(e));return a>=0&&l<=0},ofe=function(e,t,n){var r=Hr.fromPoints(e,t),s=afe(e,t,n,r),o=s[0],a=s[1];return a?o:Hr.empty()},afe=function(e,t,n,r){var s=e.x>t.x!=e.y>t.y,o=Wq(e.x,t.x,r.x,e.y,t.y,r.y,s,n.x),a=o[0],l=o[1],c=o[2];if(!c)return[r,!1];var u=Wq(e.y,t.y,l,e.x,t.x,a,s,n.y),f=u[0],d=u[1],A=u[2];return A?[new Hr(d,f),!0]:[new Hr(a,l),!1]},I1=function(e,t,n,r,s){return Math.abs(t-e)<=Math.abs(n-e)?r+(s-r)*(e-t)/(n-t):s+(r-s)*(e-n)/(t-n)},lfe=(function(){function i(t,n,r){this.face=t,this.a=n,this.b=r}var e=i.prototype;return e.clone=function(){return new i(this.face,new Ci(this.a.x,this.a.y),new Ci(this.b.x,this.b.y))},i})(),cfe=function(e,t){var n=new lfe(0,new Ci(0,0),new Ci(0,0)),r=vT(e.vector),s=r[0],o=r[1],a=r[2],l=vT(t.vector),c=l[0],u=l[1],f=l[2];if(n.a.x=o,n.a.y=a,n.b.x=u,n.b.y=f,s===c)return n.face=s,[n];var d=e.pointCross(t),A=jq(s,e,d,n.a),y=A[0],w=A[1],S=jq(c,t,We.fromVector(d.vector.mul(-1)),n.b),T=S[0],R=S[1];n.a=w,n.b=R;var P=[];n.face=y;for(var I=n.b,F=y;F!==T;){var D=pp(F,d.vector),L=new yc(D),C=L.exitAxis();n.b=L.exitPoint(C),P.push(n.clone());var B=oh(F,n.b.x,n.b.y);F=ufe(F,n.b,C,L,T);var k=pp(F,B);n.face=F,n.a=new Ci(k.x,k.y)}return n.b=I,P.push(n),P},jq=function(e,t,n,r){var s=1-hy;if(Math.max(Math.abs(r.x),Math.abs(r.y))<=s)return[e,r];var o=pp(e,n.vector),a=new yc(o);if(a.intersectsFace()){var l=a.exitPoint(a.exitAxis()),c=oh(e,l.x,l.y),u=n.vector.normalize().cross(t.vector);if(c.sub(t.vector).dot(u)>=-ife)return[e,r]}var f=0;Math.abs(r.x)>=Math.abs(r.y)?(r.x>0&&(f=1),e=_T(e,0,f)):(r.y>0&&(f=1),e=_T(e,1,f));var d=Hm(e,t.vector);return r.x=d[0],r.y=d[1],r.x=Math.max(-1,Math.min(1,r.x)),r.y=Math.max(-1,Math.min(1,r.y)),[e,r]},ufe=function(e,t,n,r,s){var o=t.x,a=t.y;n==JL&&(o=t.y,a=t.x);var l=0;o>0&&(l=1);var c=0;return a>0&&(c=1),Math.abs(a)===1&&_T(e,1-n,c)===s&&sfe(t.x*r.x,t.y*r.y,-r.z)?s:_T(e,n,l)},fT=1,Xq=(function(){function i(t){this.rangeMin=hl,this.rangeMax=hl,this.it=t.iterator(),this.refresh()}var e=i.prototype;return e.cellID=function(){return this.it.cellID()},e.indexCell=function(){return this.it.indexCell()},e.next=function(){this.it.next(),this.refresh()},e.done=function(){return this.it.done()},e.seekTo=function(n){this.it.seek(n.rangeMin),(this.it.done()||qi(this.it.cellID())>n.rangeMax)&&this.it.prev()&&Gi(this.it.cellID())<n.cellID()&&this.it.next(),this.refresh()},e.seekBeyond=function(n){this.it.seek(Ia(n.rangeMax)),!this.it.done()&&qi(this.it.cellID())<=n.rangeMax&&this.it.next(),this.refresh()},e.refresh=function(){this.rangeMin=qi(this.cellID()),this.rangeMax=Gi(this.cellID())},i})(),hfe=function(e,t){if(e.dimension()!==2)return!1;var n=e.referencePoint();if(n.point===t)return n.contained;for(var r=new Vl(n.point,t),s=n.contained,o=0;o<e.numEdges();o++){var a=e.edge(o);s=s!==r.edgeOrVertexCrossing(a.v0,a.v1)}return s},Ma=(function(){function i(){this.id=0n,this.padding=0,this.boundRect=Hr.empty(),this.middleRect=Hr.empty(),this.iLo=0,this.jLo=0,this.orientation=0,this.level=0}i.fromCellID=function(n,r){var s=new i;if(s.id=n,s.padding=r,s.middleRect=Hr.empty(),ay(n)){var o=r+1;return s.boundRect=new Hr(new Li(-o,o),new Li(-o,o)),s.middleRect=new Hr(new Li(-r,r),new Li(-r,r)),s.orientation=uu(n)&1,s}var a=_p(n),l=a.i,c=a.j,u=a.orientation;s.iLo=l,s.jLo=c,s.orientation=u,s.level=no(n),s.boundRect=MT(l,c,s.level).expandedByMargin(r);var f=Ca(s.level);return s.iLo&=-f,s.jLo&=-f,s},i.fromParentIJ=function(n,r,s){var o=she[n.orientation][2*r+s],a=new i;a.id=D1(n.id)[o],a.padding=n.padding,a.boundRect=Hr.fromRect(n.boundRect),a.orientation=n.orientation^b1[o],a.level=n.level+1,a.middleRect=Hr.empty();var l=Ca(a.level);a.iLo=n.iLo+r*l,a.jLo=n.jLo+s*l;var c=n.middle();return r===1?a.boundRect.x.lo=c.x.lo:a.boundRect.x.hi=c.x.hi,s===1?a.boundRect.y.lo=c.y.lo:a.boundRect.y.hi=c.y.hi,a};var e=i.prototype;return e.cellID=function(){return this.id},e.paddingValue=function(){return this.padding},e.levelValue=function(){return this.level},e.center=function(){var n=Ca(this.level),r=2*this.iLo+n,s=2*this.jLo+n;return We.fromVector(pT(uu(this.id),r,s).normalize())},e.middle=function(){if(this.middleRect.isEmpty()){var n=Ca(this.level),r=wc(hp(2*this.iLo+n)),s=wc(hp(2*this.jLo+n));this.middleRect=new Hr(new Li(r-this.padding,r+this.padding),new Li(s-this.padding,s+this.padding))}return this.middleRect},e.bound=function(){return this.boundRect},e.childIJ=function(n){var r=rD[this.orientation][n];return[r>>1,r&1]},e.entryVertex=function(){var n=this.iLo,r=this.jLo;if(this.orientation&jf){var s=Ca(this.level);n+=s,r+=s}return We.fromVector(pT(uu(this.id),2*n,2*r).normalize())},e.exitVertex=function(){var n=this.iLo,r=this.jLo,s=Ca(this.level);return this.orientation===0||this.orientation===Tc+jf?n+=s:r+=s,We.fromVector(pT(uu(this.id),2*n,2*r).normalize())},e.shrinkToFit=function(n){if(this.level===0&&(n.x.contains(0)||n.y.contains(0)))return this.id;var r=Ca(this.level);if(n.x.contains(wc(hp(2*this.iLo+r)))||n.y.contains(wc(hp(2*this.jLo+r))))return this.id;var s=n.expandedByMargin(this.padding+1.5*Ki),o=this.iLo,a=this.jLo,l=0,c=0;o<kl(sh(s.x.lo))&&(o=kl(sh(s.x.lo))),this.iLo+r-1<=kl(sh(s.x.hi))?l=o^this.iLo+r-1:l=o^kl(sh(s.x.hi)),a<kl(sh(s.y.lo))&&(a=kl(sh(s.y.lo))),this.jLo+r-1<=kl(sh(s.y.hi))?c=a^this.jLo+r-1:c=a^kl(sh(s.y.hi));var u=BigInt((l|c)<<1)+1n,f=_i-rH(u);return f<=this.level?this.id:wr(ly(uu(this.id),o,a),f)},i})(),vp=0,fy=1,PT=2,$q=0,Yx=2,_1=2*(hy+nfe),ffe=1,Yq=(function(){function i(t,n,r,s,o,a,l){t===void 0&&(t=0),n===void 0&&(n=0),r===void 0&&(r=0),s===void 0&&(s=!1),o===void 0&&(o=new Ci(0,0)),a===void 0&&(a=new Ci(0,0)),l===void 0&&(l=new ah(new We(0,0,0),new We(0,0,0))),this.shapeID=t,this.edgeID=n,this.maxLevel=r,this.hasInterior=s,this.a=o,this.b=a,this.edge=l}var e=i.prototype;return e.copy=function(){return new i(this.shapeID,this.edgeID,this.maxLevel,this.hasInterior,new Ci(this.a.x,this.a.y),new Ci(this.b.x,this.b.y),new ah(We.fromVector(this.edge.v0.vector),We.fromVector(this.edge.v1.vector)))},i})(),NL=function(e,t){this.faceEdge=e,this.bound=t},wT=(function(){function i(){var t=this;this.iterator=function(){return t.maybeApplyUpdates(),new LL(t,QL)},this.begin=function(){return t.maybeApplyUpdates(),new LL(t,QL)},this.end=function(){return t.maybeApplyUpdates(),new LL(t,PH)},this.region=function(){return new tfe(t,new gp(t,Xf))},this.len=function(){return t.shapes.size},this.reset=function(){t.shapes.clear(),t.nextID=0,t.cellMap.clear(),t.cells=[],t.status=Yx},this.numEdges=function(){var n=0;return t.shapes.forEach(function(r){n+=r.numEdges()}),n},this.numEdgesUpTo=function(n){for(var r=0,s=0;s<=t.nextID;s++){var o=t.shape(s);if(!(o instanceof Zx)&&(r+=o.numEdges(),r>=n))break}return r},this.shape=function(n){return t.shapes.get(n)||new Zx},this.idForShape=function(n){for(var r=Ct(t.shapes.entries()),s;!(s=r()).done;){var o=s.value,a=o[0],l=o[1];if(l===n)return a}return-1},this.add=function(n){return t.shapes.set(t.nextID,n),t.nextID++,t.status=$q,t.nextID-1},this.remove=function(n){var r=t.idForShape(n);if(t.shapes.has(r)&&(t.shapes.delete(r),!(r>=t.pendingAdditionsPos))){for(var s=n.numEdges(),o=new dfe(r,n.dimension()===2,n.referencePoint().contained,new Array(s)),a=0;a<s;a++)o.edges[a]=n.edge(a);t.pendingRemovals.push(o),t.status=$q}},this.build=function(){return t.maybeApplyUpdates()},this.isFresh=function(){return t.status===Yx},this.isFirstUpdate=function(){return t.pendingAdditionsPos===0},this.isShapeBeingRemoved=function(n){return n<t.pendingAdditionsPos},this.maybeApplyUpdates=function(){t.status!==Yx&&(t.applyUpdatesInternal(),t.status=Yx)},this.applyUpdatesInternal=function(){for(var n=new efe,r=Array.from({length:6},function(){return[]}),s=Ct(t.pendingRemovals),o;!(o=s()).done;){var a=o.value;t.removeShapeInternal(a,r,n)}for(var l=t.pendingAdditionsPos;l<t.shapes.size;l++)t.addShapeInternal(l,r,n);for(var c=0;c<6;c++)t.updateFaceEdges(c,r[c],n);t.pendingRemovals.length=0,t.pendingAdditionsPos=t.shapes.size},this.addShapeInternal=function(n,r,s){var o=t.shapes.get(n)||new Zx;if(!(o instanceof Zx)){var a=new Yq(n,void 0,void 0,o.dimension()===2);a.hasInterior&&s.addShape(n,hfe(o,s.focus()));for(var l=o.numEdges(),c=0;c<l;c++){var u=o.edge(c);a.edgeID=c,a.edge=u,a.maxLevel=Zq(u),t.addFaceEdge(a,r)}}},this.addFaceEdge=function(n,r){var s=n.copy(),o=ty(s.edge.v0.vector);if(o===ty(s.edge.v1.vector)){var a=Hm(o,s.edge.v0.vector),l=a[0],c=a[1];s.a=new Ci(l,c);var u=Hm(o,s.edge.v1.vector);l=u[0],c=u[1],s.b=new Ci(l,c);var f=1-_1;if(Math.abs(s.a.x)<=f&&Math.abs(s.a.y)<=f&&Math.abs(s.b.x)<=f&&Math.abs(s.b.y)<=f){r[o].push(s);return}}for(var d=0;d<6;d++){var A=ry(s.edge.v0,s.edge.v1,d,_1),y=A[0],w=A[1],S=A[2];if(S){var T=n.copy();T.a=y,T.b=w,r[d].push(T)}}},this.updateFaceEdges=function(n,r,s){var o=r.length;if(!(o===0&&s.shapeIDs.length===0)){for(var a=Array(o),l=Hr.empty(),c=0;c<o;c++){var u=new NL(r[c],Hr.fromPoints(r[c].a,r[c].b));a[c]=u,l=l.addRect(u.bound)}var f=Ap(n),d=Ma.fromCellID(f,_1),A=t.isFirstUpdate();if(o>0){var y=t.shrinkToFit(d,l);if(y!==d.id){t.skipCellRange(qi(f),qi(y),s,A),d=Ma.fromCellID(y,_1),t.updateEdges(d,a,s,A),t.skipCellRange(Ia(Gi(y)),Ia(Gi(f)),s,A);return}}t.updateEdges(d,a,s,A)}},this.shrinkToFit=function(n,r){var s=n.shrinkToFit(r);if(!t.isFirstUpdate()&&s!==n.id){var o=t.iterator();o.locateCellID(s)===vp&&(s=o.cellID())}return s},this.skipCellRange=function(n,r,s,o){if(s.shapeIDs.length!==0)for(var a=R1.fromRange(n,r),l=Ct(a),c;!(c=l()).done;){var u=c.value,f=[];t.updateEdges(Ma.fromCellID(u,_1),f,s,o)}},this.updateEdges=function(n,r,s,o){var a=!1;if(!o){var l=t.iterator(),c=l.locateCellID(n.id);c===PT?o=!0:c===vp&&(t.absorbIndexCell(n,l,r,s),a=!0,o=!0)}if(!o||!t.makeIndexCell(n,r,s)){for(var u=[[[],[]],[[],[]]],f=n.middle(),d=Ct(r),A;!(A=d()).done;){var y=A.value;if(y.bound.x.hi<=f.x.lo){var w=t.clipVAxis(y,f.y),S=w[0],T=w[1];S&&u[0][0].push(S),T&&u[0][1].push(T)}else if(y.bound.x.lo>=f.x.hi){var R=t.clipVAxis(y,f.y),P=R[0],I=R[1];P&&u[1][0].push(P),I&&u[1][1].push(I)}else if(y.bound.y.hi<=f.y.lo){var F=t.clipUBound(y,1,f.x.hi);F&&u[0][0].push(F);var D=t.clipUBound(y,0,f.x.lo);D&&u[1][0].push(D)}else if(y.bound.y.lo>=f.y.hi){var L=t.clipUBound(y,1,f.x.hi);L&&u[0][1].push(L);var C=t.clipUBound(y,0,f.x.lo);C&&u[1][1].push(C)}else{var B=t.clipUBound(y,1,f.x.hi),k=t.clipVAxis(B,f.y),z=k[0],G=k[1];z&&u[0][0].push(z),G&&u[0][1].push(G);var W=t.clipUBound(y,0,f.x.lo),Y=t.clipVAxis(W,f.y);z=Y[0],G=Y[1],z&&u[1][0].push(z),G&&u[1][1].push(G)}}for(var H=0;H<4;H++){var $=n.childIJ(H),J=$[0],te=$[1];(u[J][te].length>0||s.shapeIDs.length>0)&&t.updateEdges(Ma.fromParentIJ(n,J,te),u[J][te],s,o)}}a&&s.restoreStateBefore(t.pendingAdditionsPos)},this.makeIndexCell=function(n,r,s){if(r.length===0&&s.shapeIDs.length===0)return!0;for(var o=0,a=Ct(r),l;!(l=a()).done;){var c=l.value;if(n.level<c.faceEdge.maxLevel&&o++,o>t.maxEdgesPerCell)return!1}s.isActive&&r.length!==0&&(s.atCellID(n.id)||s.moveTo(n.entryVertex()),s.drawTo(n.center()),t.testAllEdges(r,s));for(var u=s.shapeIDs,f=t.countShapes(r,u),d=new Jhe(f),A=0,y=0,w=0;w<f;w++){var S=void 0,T=t.shapes.size,R=T;A!==r.length&&(T=r[A].faceEdge.shapeID),y<u.length&&(R=u[y]);var P=A;if(R<T)S=new Vq(R,0),S.containsCenter=!0,y++;else{for(;A<r.length&&r[A].faceEdge.shapeID===T;)A++;S=new Vq(T,A-P);for(var I=P;I<A;I++)S.edges[I-P]=r[I].faceEdge.edgeID;R===T&&(S.containsCenter=!0,y++)}d.shapes[w]=S}return t.cellMap.set(n.id,d),t.cells.push(n.id),s.isActive&&r.length!==0&&(s.drawTo(n.exitVertex()),t.testAllEdges(r,s),s.setNextCellID(Ia(n.id))),!0},this.updateBound=function(n,r,s,o,a){var l=new NL(n.faceEdge,new Hr);return r===0?(l.bound.x.lo=s,l.bound.x.hi=n.bound.x.hi):(l.bound.x.lo=n.bound.x.lo,l.bound.x.hi=s),o===0?(l.bound.y.lo=a,l.bound.y.hi=n.bound.y.hi):(l.bound.y.lo=n.bound.y.lo,l.bound.y.hi=a),l},this.clipUBound=function(n,r,s){if(r===0&&n.bound.x.lo>=s||r===1&&n.bound.x.hi<=s)return n;var o=n.faceEdge,a=n.bound.y.clampPoint(I1(s,o.a.x,o.b.x,o.a.y,o.b.y)),l=o.a.x>o.b.x==o.a.y>o.b.y,c=r===1===l?1:0;return t.updateBound(n,r,s,c,a)},this.clipVBound=function(n,r,s){if(r===0&&n.bound.y.lo>=s||r===1&&n.bound.y.hi<=s)return n;var o=n.faceEdge,a=n.bound.x.clampPoint(I1(s,o.a.y,o.b.y,o.a.x,o.b.x)),l=o.a.x>o.b.x==o.a.y>o.b.y,c=r===1===l?1:0;return t.updateBound(n,c,a,r,s)},this.clipVAxis=function(n,r){return n.bound.y.hi<=r.lo?[n,void 0]:n.bound.y.lo>=r.hi?[void 0,n]:[t.clipVBound(n,1,r.hi),t.clipVBound(n,0,r.lo)]},this.absorbIndexCell=function(n,r,s,o){if(o.isActive&&s.length!==0&&t.isShapeBeingRemoved(s[0].faceEdge.shapeID)){o.atCellID(n.id)||o.moveTo(n.entryVertex()),o.drawTo(n.exitVertex()),o.setNextCellID(Ia(n.id));for(var a=Ct(s),l;!(l=a()).done;){var c=l.value,u=c.faceEdge;if(!t.isShapeBeingRemoved(u.shapeID))break;u.hasInterior&&o.testEdge(u.shapeID,u.edge)}}o.saveAndClearStateBefore(t.pendingAdditionsPos);var f=[],d=!1,A=r.indexCell();if(A)for(var y=Ct(A.shapes),w;!(w=y()).done;){var S=w.value,T=S.shapeID,R=t.shape(T);if(R){var P=S.numEdges(),I=new Yq(T,void 0,void 0,R.dimension()===2);I.hasInterior&&(o.addShape(T,S.containsCenter),!d&&P>0&&(o.moveTo(n.center()),o.drawTo(n.entryVertex()),o.setNextCellID(n.id),d=!0));for(var F=0;F<P;F++){var D=S.edges[F];I.edgeID=D,I.edge=R.edge(D),I.maxLevel=Zq(I.edge),I.hasInterior&&o.testEdge(T,I.edge);var L=ry(I.edge.v0,I.edge.v1,uu(n.id),_1),C=L[0],B=L[1],k=L[2];if(!k)throw new Error("invariant failure in ShapeIndex");I.a=C,I.b=B,f.push(I)}}}for(var z=f.map(function(H){return new NL(H,ofe(H.a,H.b,n.bound()))}),G=Ct(s),W;!(W=G()).done;){var Y=W.value;if(!t.isShapeBeingRemoved(Y.faceEdge.shapeID)){z.push.apply(z,s.slice(s.indexOf(Y)));break}}s=z,t.cellMap.delete(n.id)},this.testAllEdges=function(n,r){for(var s=Ct(n),o;!(o=s()).done;){var a=o.value;a.faceEdge.hasInterior&&r.testEdge(a.faceEdge.shapeID,a.faceEdge.edge)}},this.countShapes=function(n,r){for(var s=0,o=-1,a=0,l=0,c=Ct(n),u;!(u=c()).done;){var f=u.value;if(f.faceEdge.shapeID!==o)for(s++,o=f.faceEdge.shapeID;l<r.length&&(a=r[l],!(a>o));)a<o&&s++,l++}return s+=r.length-l,s},this.maxEdgesPerCell=10,this.nextID=0,this.shapes=new Map,this.cellMap=new Map,this.cells=[],this.status=Yx,this.pendingAdditionsPos=0,this.pendingRemovals=[]}var e=i.prototype;return e.removeShapeInternal=function(n,r,s){},i})(),Zq=function(e){var t=e.v0.vector.sub(e.v1.vector).norm()*ffe;return zhe.minLevel(t)},dfe=function(e,t,n,r){this.shapeID=e,this.hasInterior=t,this.containsTrackerOrigin=n,this.edges=r};function pfe(){return{distance:Ec(),shapeID:-1,edgeID:-1}}function FL(i,e){return i.distance<e.distance?-1:i.distance>e.distance?1:i.shapeID<e.shapeID?-1:i.shapeID>e.shapeID?1:i.edgeID<e.edgeID?-1:i.edgeID>e.edgeID?1:0}var NH=(function(){function i(){this.maxResults=1/0,this.maxDistance=Ec(),this.maxError=0,this.includeInteriors=!0,this.useBruteForce=!1}var e=i.prototype;return e.setInclusiveMaxDistance=function(n){this.maxDistance=C1(n)},e.setConservativeMaxDistance=function(n){this.maxDistance=C1(ET(n,Ghe(n)))},e.clone=function(){var n=new i;return n.maxResults=this.maxResults,n.maxDistance=this.maxDistance,n.maxError=this.maxError,n.includeInteriors=this.includeInteriors,n.useBruteForce=this.useBruteForce,n},i})(),mfe=(function(){function i(t){this._includeInteriors=!0,this.point=t}var e=i.prototype;return e.maxBruteForceIndexSize=function(){return 120},e.updateMinDistanceToEdge=function(n,r,s){var o=hu(this.point,n,r,s);return{distance:o.dist,updated:o.less}},e.updateMinDistanceToPoint=function(n,r){var s=We.chordAngleBetweenPoints(this.point,n);return s<r?{distance:s,updated:!0}:{distance:r,updated:!1}},e.updateMinDistanceToCell=function(n,r){var s=n.distance(this.point);return s<r?{distance:s,updated:!0}:{distance:r,updated:!1}},e.includeInteriors=function(){return this._includeInteriors},e.setIncludeInteriors=function(n){this._includeInteriors=n},e.setMaxError=function(n){return!1},e.visitContainingShapeIds=function(n,r){var s=this,o=new gp(n,Xf);return o.visitContainingShapes(this.point,function(a){var l=n.idForShape(a);return l>=0?r(l,s.point):!0})},e.getCapBound=function(){return{center:this.point,radius:0}},i})(),Afe=(function(){function i(t,n){this._includeInteriors=!0,this.a=t,this.b=n}var e=i.prototype;return e.maxBruteForceIndexSize=function(){return 60},e.updateMinDistanceToEdge=function(n,r,s){return BH(this.a,this.b,n,r,s)},e.updateMinDistanceToPoint=function(n,r){var s=hu(n,this.a,this.b,r);return{distance:s.dist,updated:s.less}},e.updateMinDistanceToCell=function(n,r){var s=n.distanceToEdge(this.a,this.b);return s<r?{distance:s,updated:!0}:{distance:r,updated:!1}},e.includeInteriors=function(){return this._includeInteriors},e.setIncludeInteriors=function(n){this._includeInteriors=n},e.setMaxError=function(n){return!1},e.visitContainingShapeIds=function(n,r){for(var s=new gp(n,Xf),o=new Set,a=function(){var d=u[c],A=s.visitContainingShapes(d,function(y){var w=n.idForShape(y);return w>=0&&!o.has(w)?(o.add(w),r(w,d)):!0});if(!A)return{v:!1}},l,c=0,u=[this.a,this.b];c<u.length;c++)if(l=a(),l)return l.v;return!0},e.getCapBound=function(){var n=We.fromVector(this.a.vector.add(this.b.vector).normalize()),r=Math.max(We.chordAngleBetweenPoints(n,this.a),We.chordAngleBetweenPoints(n,this.b));return{center:n,radius:r}},i})(),gfe=(function(){function i(t){this._includeInteriors=!0,this.cell=t}var e=i.prototype;return e.maxBruteForceIndexSize=function(){return 30},e.updateMinDistanceToEdge=function(n,r,s){var o=this.cell.distanceToEdge(n,r);return o<s?{distance:o,updated:!0}:{distance:s,updated:!1}},e.updateMinDistanceToPoint=function(n,r){var s=this.cell.distance(n);return s<r?{distance:s,updated:!0}:{distance:r,updated:!1}},e.updateMinDistanceToCell=function(n,r){var s=this.cell.distanceToCell(n);return s<r?{distance:s,updated:!0}:{distance:r,updated:!1}},e.includeInteriors=function(){return this._includeInteriors},e.setIncludeInteriors=function(n){this._includeInteriors=n},e.setMaxError=function(n){return!1},e.visitContainingShapeIds=function(n,r){var s=new gp(n,Xf),o=this.cell.center();return s.visitContainingShapes(o,function(a){var l=n.idForShape(a);return l>=0?r(l,o):!0})},e.getCapBound=function(){for(var n=this.cell.center(),r=0,s=0;s<4;s++){var o=We.chordAngleBetweenPoints(n,this.cell.vertex(s));o>r&&(r=o)}return{center:n,radius:r}},i})(),FH=(function(){function i(t){this._includeInteriors=!0,this.index=t,this.query=new gp(t,Xf)}var e=i.prototype;return e.maxBruteForceIndexSize=function(){return 25},e.updateMinDistanceToEdge=function(n,r,s){if(this._includeInteriors&&(this.query.contains(n)||this.query.contains(r)))return{distance:0,updated:s>0};for(var o=!1,a=Ct(this.index.shapes),l;!(l=a()).done;){var c=l.value,u=c[1];if(u)for(var f=u.numEdges(),d=0;d<f;d++){var A=u.edge(d),y=BH(n,r,A.v0,A.v1,s);if(y.updated&&(s=y.distance,o=!0),s===0)return{distance:0,updated:o}}}return{distance:s,updated:o}},e.updateMinDistanceToPoint=function(n,r){if(this._includeInteriors&&this.query.contains(n))return{distance:0,updated:r>0};for(var s=!1,o=Ct(this.index.shapes),a;!(a=o()).done;){var l=a.value,c=l[1];if(c)for(var u=c.numEdges(),f=0;f<u;f++){var d=c.edge(f),A=hu(n,d.v0,d.v1,r);if(A.less&&(r=A.dist,s=!0),r===0)return{distance:0,updated:s}}}return{distance:r,updated:s}},e.updateMinDistanceToCell=function(n,r){if(this._includeInteriors&&this.query.contains(n.center()))return{distance:0,updated:r>0};for(var s=!1,o=Ct(this.index.shapes),a;!(a=o()).done;){var l=a.value,c=l[1];if(c)for(var u=c.numEdges(),f=0;f<u;f++){var d=c.edge(f),A=n.distanceToEdge(d.v0,d.v1);if(A<r&&(r=A,s=!0),r===0)return{distance:0,updated:s}}}return{distance:r,updated:s}},e.includeInteriors=function(){return this._includeInteriors},e.setIncludeInteriors=function(n){this._includeInteriors=n},e.setMaxError=function(n){return!1},e.visitContainingShapeIds=function(n,r){for(var s=new gp(n,Xf),o=new Set,a=Ct(this.index.shapes),l;!(l=a()).done;){var c=l.value,u=c[1];if(u){for(var f=u.numEdges(),d=0;d<f;d++)for(var A=u.edge(d),y=function(){var P=T[S],I=s.visitContainingShapes(P,function(F){var D=n.idForShape(F);return D>=0&&!o.has(D)?(o.add(D),r(D,P)):!0});if(!I)return{v:!1}},w,S=0,T=[A.v0,A.v1];S<T.length;S++)if(w=y(),w)return w.v}}return!0},e.getCapBound=function(){if(this.index.len()===0)return null;for(var n=null,r=0,s=Ct(this.index.shapes),o;!(o=s()).done;){var a=o.value,l=a[1];if(l)for(var c=l.numEdges(),u=0;u<c;u++){var f=l.edge(u);n===null&&(n=f.v0);var d=We.chordAngleBetweenPoints(n,f.v0),A=We.chordAngleBetweenPoints(n,f.v1);r=Math.max(r,d,A)}}return n===null?null:{center:n,radius:r}},i})();function BH(i,e,t,n,r){if(r===0)return{distance:0,updated:!1};if(wH(i,e,t,n)===Sc)return{distance:0,updated:!0};var s=!1,o=hu(i,t,n,r);return o.less&&(r=o.dist,s=!0),o=hu(e,t,n,r),o.less&&(r=o.dist,s=!0),o=hu(t,i,e,r),o.less&&(r=o.dist,s=!0),o=hu(n,i,e,r),o.less&&(r=o.dist,s=!0),{distance:r,updated:s}}var vfe=(function(){function i(t,n){n===void 0&&(n=new NH),this.indexNumEdges=0,this.indexNumEdgesLimit=0,this.index=t,this.options=n,this.iter=t.iterator()}var e=i.prototype;return e.reInit=function(){this.indexNumEdges=0,this.indexNumEdgesLimit=0,this.iter=this.index.iterator()},e.findClosestEdges=function(n,r){return this.findClosestEdgesInternal(n,this.options,r)},e.visitClosestEdges=function(n,r,s,o){for(var a=this.findClosestEdgesInternal(n,r,o),l=Ct(a),c;!(c=l()).done;){var u=c.value;if(!s(u))break}},e.visitClosestShapes=function(n,r,s,o){for(var a=this.findClosestEdgesInternal(n,r,o),l=new Set,c=-1,u=Ct(a),f;!(f=u()).done;){var d=f.value,A=d.shapeID;if(A!==c&&!l.has(A)&&(l.add(A),c=A,!s(d)))break}},e.findClosestEdge=function(n,r){var s=this.options.clone();s.maxResults=1;var o=this.findClosestEdgesInternal(n,s,r);return o.length===0?pfe():o[0]},e.getDistance=function(n,r){return this.findClosestEdge(n,r).distance},e.isDistanceLess=function(n,r,s){var o=this.options.clone();o.maxResults=1,o.maxDistance=r,o.maxError=bc;var a=this.findClosestEdgesInternal(n,o,s);return a.length>0},e.isDistanceLessOrEqual=function(n,r,s){var o=this.options.clone();o.maxResults=1,o.setInclusiveMaxDistance(r),o.maxError=bc;var a=this.findClosestEdgesInternal(n,o,s);return a.length>0},e.isConservativeDistanceLessOrEqual=function(n,r,s){var o=this.options.clone();o.maxResults=1,o.setConservativeMaxDistance(r),o.maxError=bc;var a=this.findClosestEdgesInternal(n,o,s);return a.length>0},e.getEdge=function(n){var r=this.index.shape(n.shapeID);return r.edge(n.edgeID)},e.project=function(n,r){if(r.edgeID<0)return n;var s=this.getEdge(r);return TH(n,s.v0,s.v1)},e.findClosestEdgesInternal=function(n,r,s){var o=r.maxDistance,a=[];if(o===0)return a;if(r.includeInteriors){var l=new Set;n.visitContainingShapeIds(this.index,function(T,R){return(!s||s(T))&&l.add(T),l.size<r.maxResults});for(var c=Ct(l),u;!(u=c()).done;){var f=u.value;a.push({distance:0,shapeID:f,edgeID:-1})}if(o===0)return a}var d=n.maxBruteForceIndexSize()+1;d>this.indexNumEdgesLimit&&this.indexNumEdges>=this.indexNumEdgesLimit&&(this.indexNumEdges=this.countEdgesUpTo(d),this.indexNumEdgesLimit=d),r.useBruteForce||this.indexNumEdges<d?this.findClosestEdgesBruteForce(n,r,s,o,a):this.findClosestEdgesOptimized(n,r,s,o,a),a.sort(FL);for(var A=[],y=0,w=a;y<w.length;y++){var S=w[y];(A.length===0||A[A.length-1].shapeID!==S.shapeID||A[A.length-1].edgeID!==S.edgeID)&&A.push(S)}return A.length>r.maxResults&&(A.length=r.maxResults),A},e.findClosestEdgesBruteForce=function(n,r,s,o,a){for(var l=Ct(this.index.shapes),c;!(c=l()).done;){var u=c.value,f=u[0],d=u[1];if(d&&!(s&&!s(f)))for(var A=d.numEdges(),y=0;y<A;y++){var w=d.edge(y),S=n.updateMinDistanceToEdge(w.v0,w.v1,o);if(S.updated){var T={distance:S.distance,shapeID:f,edgeID:y};r.maxResults===1?(a.length===0?a.push(T):a[0]=T,o=S.distance-r.maxError):r.maxResults===1/0?a.push(T):(a.push(T),a.length>r.maxResults&&(a.sort(FL),a.length=r.maxResults,o=a[a.length-1].distance-r.maxError))}}}},e.findClosestEdgesOptimized=function(n,r,s,o,a){var l=n.getCapBound();if(l){if(this.iter=this.index.iterator(),r.maxResults===1&&this.iter.locatePoint(l.center)){var c=this.iter.indexCell();if(o=this.processIndexCell(n,r,s,c,o,a),o===0)return}var u=[];for(this.iter.begin();!this.iter.done();){var f=this.iter.cellID(),d=Ra.fromCellID(f),A=n.updateMinDistanceToCell(d,o);A.distance<o&&u.push({distance:A.distance,id:f,indexCell:this.iter.indexCell()}),this.iter.next()}for(u.sort(function(C,B){return C.distance-B.distance});u.length>0;){var y=u.shift();if(y.distance>=o)break;if(y.indexCell!==null)o=this.processIndexCell(n,r,s,y.indexCell,o,a);else{console.log("HEYYYY");for(var w=D1(y.id),S=Ct(w),T;!(T=S()).done;){var R=T.value,P=this.iter.locateCellID(R);if(P===vp){var I=Ra.fromCellID(this.iter.cellID()),F=n.updateMinDistanceToCell(I,o);F.distance<o&&u.push({distance:F.distance,id:this.iter.cellID(),indexCell:this.iter.indexCell()})}else if(P===fy){var D=Ra.fromCellID(R),L=n.updateMinDistanceToCell(D,o);L.distance<o&&u.push({distance:L.distance,id:R,indexCell:null})}}u.sort(function(C,B){return C.distance-B.distance})}}}},e.processIndexCell=function(n,r,s,o,a,l){for(var c=Ct(o.shapes),u;!(u=c()).done;){var f=u.value,d=f.shapeID;if(!(s&&!s(d))){var A=this.index.shape(d);if(A)for(var y=Ct(f.edges),w;!(w=y()).done;){var S=w.value,T=A.edge(S),R=n.updateMinDistanceToEdge(T.v0,T.v1,a);if(R.updated){var P={distance:R.distance,shapeID:d,edgeID:S};r.maxResults===1?(l.length===0?l.push(P):l[0]=P,a=R.distance-r.maxError):r.maxResults===1/0?l.push(P):(l.push(P),l.length>r.maxResults&&(l.sort(FL),l.length=r.maxResults,a=l[l.length-1].distance-r.maxError))}}}}return a},e.countEdgesUpTo=function(n){for(var r=0,s=Ct(this.index.shapes),o;!(o=s()).done;){var a=o.value,l=a[1];if(l&&(r+=l.numEdges(),r>=n))break}return r},i})();function _fe(){return{distance:Ec(),cellID:0n,label:-1}}function xfe(i){return i.label<0}var OH=(function(){function i(){this.maxResults=1/0,this.maxDistance=Ec(),this.maxError=0}var e=i.prototype;return e.setInclusiveMaxDistance=function(n){this.maxDistance=C1(n)},e.setConservativeMaxDistance=function(n){this.maxDistance=C1(ET(n,this.computeMaxDistanceError(n)))},e.computeMaxDistanceError=function(n){return iD(n)},i})(),yfe=(function(){function i(t){this.point=t}var e=i.prototype;return e.maxBruteForceIndexSize=function(){return 100},e.distanceToCell=function(n){return n.distance(this.point)},e.distanceToPoint=function(n){return We.chordAngleBetweenPoints(this.point,n)},i})(),bfe=(function(){function i(t,n){this.a=t,this.b=n}var e=i.prototype;return e.maxBruteForceIndexSize=function(){return 100},e.distanceToCell=function(n){return n.distanceToEdge(this.a,this.b)},e.distanceToPoint=function(n){return hu(n,this.a,this.b,Ec()).dist},i})(),wfe=(function(){function i(t){this.cell=t}var e=i.prototype;return e.maxBruteForceIndexSize=function(){return 100},e.distanceToCell=function(n){return this.cell.distanceToCell(n)},e.distanceToPoint=function(n){return this.cell.distance(n)},i})(),Sfe=(function(){function i(t){this.cellUnion=t}var e=i.prototype;return e.maxBruteForceIndexSize=function(){return 100},e.distanceToCell=function(n){for(var r=Ec(),s=Ct(this.cellUnion),o;!(o=s()).done;){var a=o.value,l=Ra.fromCellID(a),c=l.distanceToCell(n);if(c<r&&(r=c),r===0)break}return r},e.distanceToPoint=function(n){for(var r=Ec(),s=Ct(this.cellUnion),o;!(o=s()).done;){var a=o.value,l=Ra.fromCellID(a),c=l.distance(n);if(c<r&&(r=c),r===0)break}return r},i})(),Tfe=(function(){function i(t){this.index=t,this.edgeTarget=new FH(t)}var e=i.prototype;return e.setIncludeInteriors=function(n){this.edgeTarget.setIncludeInteriors(n)},e.maxBruteForceIndexSize=function(){return this.edgeTarget.maxBruteForceIndexSize()},e.distanceToCell=function(n){var r=this.edgeTarget.updateMinDistanceToCell(n,Ec());return r.distance},e.distanceToPoint=function(n){var r=this.edgeTarget.updateMinDistanceToPoint(n,Ec());return r.distance},i})(),Efe=(function(){function i(t,n){n===void 0&&(n=new OH),this.index=t,this.options=n}var e=i.prototype;return e.findClosestCells=function(n){var r=new MH(this.index,!0),s=new CH(this.index),o=[];for(r.begin();!r.done();r.next())for(s.startUnion(r);!s.done();){var a=s.cellID(),l=s.label(),c=Ra.fromCellID(a);if(this.options.region&&!this.options.region.intersectsCell(c)){s.next();continue}var u=n.distanceToCell(c);u<this.options.maxDistance&&o.push({cellID:a,label:l,distance:u}),s.next()}o.sort(function(d,A){return d.distance-A.distance});var f=Math.min(o.length,this.options.maxResults);return o.slice(0,f)},e.findClosestCell=function(n){var r=this.options.maxResults;this.options.maxResults=1;var s=this.findClosestCells(n);return this.options.maxResults=r,s.length===0?_fe():s[0]},e.getDistance=function(n){return this.findClosestCell(n).distance},e.isDistanceLess=function(n,r){var s=this.options.maxResults,o=this.options.maxDistance;this.options.maxResults=1,this.options.maxDistance=r;var a=this.findClosestCell(n);return this.options.maxResults=s,this.options.maxDistance=o,!xfe(a)},e.isDistanceLessOrEqual=function(n,r){return this.isDistanceLess(n,C1(r))},e.isConservativeDistanceLessOrEqual=function(n,r){return this.isDistanceLess(n,C1(ET(r,iD(r))))},i})(),P1=(function(){function i(){this.a=new We(0,0,0),this.aLL=new ar(0,0),this.bound=Ri.emptyRect()}i.maxErrorForTests=function(){return new ar(10*Ki,1*Ki)};var e=i.prototype;return e.addPoint=function(n){var r=ar.fromPoint(n);if(this.bound.isEmpty()){this.a=n,this.aLL=r,this.bound=this.bound.addPoint(r);return}var s=this.a.vector.sub(n.vector).cross(this.a.vector.add(n.vector)),o=s.norm();if(o<191346e-20){this.a.vector.dot(n.vector)<0?this.bound=Ri.fullRect():this.bound=this.bound.union(Ri.fromLatLng(this.aLL).addPoint(r)),this.a=n,this.aLL=r;return}var a=to.emptyInterval().addPoint(this.aLL.lng).addPoint(r.lng);a.length()>=Math.PI-2*Ki&&(a=to.fullInterval());var l=Li.fromPoint(this.aLL.lat).addPoint(r.lat),c=s.cross(new Wt(0,0,1)),u=c.dot(this.a.vector),f=c.dot(n.vector),d=606638e-21*o+683174e-36;if(u*f<0||Math.abs(u)<=d||Math.abs(f)<=d){var A=Math.min(Math.atan2(Math.sqrt(s.x*s.x+s.y*s.y),Math.abs(s.z))+3*Ki,Math.PI/2),y=2*Math.asin(.5*this.a.vector.sub(n.vector).norm()*Math.sin(A)),w=.5*(y-l.length())+Ki;u<=d&&f>=-d&&(l.hi=Math.min(A,l.hi+w)),f<=d&&u>=-d&&(l.lo=Math.max(-A,l.lo-w))}this.a=n,this.aLL=r,this.bound=this.bound.union(new Ri(l,a))},e.rectBound=function(){return this.bound.expanded(new ar(2*Ki,0)).polarClosure()},i})();P1.expandForSubregions=function(i){if(i.isEmpty())return i;var e=Math.max(0,Math.PI-i.lng.length()-2.5*Ki),t=Math.max(i.lat.lo,-i.lat.hi),n=Math.PI/2+i.lat.lo,r=Math.PI/2-i.lat.hi;if(t>=0){if(2*t+e<1354e-18)return Ri.fullRect()}else if(e>=Math.PI/2){if(n+r<1687e-18)return Ri.fullRect()}else if(Math.max(n,r)*e<1765e-18)return Ri.fullRect();var s=9*Ki,o=0;return e<=0&&(o=Math.PI),i.expanded(new ar(s,o)).polarClosure()};var UH=function(e,t,n,r,s){return We.orderedCCW(n,s,r,t)&&We.orderedCCW(r,e,n,t)},Mfe=function(e,t,n,r,s){return!(We.orderedCCW(e,s,r,t)&&We.orderedCCW(r,n,e,t))},Cfe=(function(){function i(t){this.a=new Ci(0,0),this.b=new Ci(0,0),this.index=t,this.iter=t.iterator(),this.cells=[]}var e=i.prototype;return e.crossings=function(n,r,s,o){var a=this.candidates(n,r,s);if(a.length===0)return[];for(var l=new Vl(n,r),c=0,u=a.length,f=0;f<u;f++){var d=s.edge(a[f]),A=l.crossingSign(d.v0,d.v1);(o===fT&&(A===bT||A===Sc)||o!==fT&&A===Sc)&&(a[c]=a[f],c++)}return c<u&&(a=a.slice(0,c)),a},e.crossingsEdgeMap=function(n,r,s){var o=this.candidatesEdgeMap(n,r);if(o.size===0)return o;var a=new Vl(n,r);return o.forEach(function(l,c){for(var u=l.length,f=0,d=0;d<u;d++){var A=c.edge(l[d]),y=a.crossingSign(A.v0,A.v1);(s===fT&&(y===bT||y===Sc)||s!==fT&&y===Sc)&&(l[f]=l[d],o.set(c,l),f++)}f===0?o.delete(c):f<u&&o.set(c,o.get(c).slice(0,f))}),o},e.candidates=function(n,r,s){var o=[],a=27,l=s.numEdges();if(l<=a)return o=Array.from({length:l},function(w,S){return S}),o;if(this.getCellsForEdge(n,r),this.cells.length===0)return[];var c=-1;this.index.shapes.forEach(function(w,S){w===s&&(c=S)});for(var u=Ct(this.cells),f;!(f=u()).done;){var d,A=f.value;if(A){var y=A.findByShapeID(c);y&&(d=o).push.apply(d,y.edges)}}return this.cells.length>1&&(o=i.uniqueInts(o)),o},i.uniqueInts=function(n){for(var r=[],s={},o=Ct(n),a;!(a=o()).done;){var l=a.value;s[l]||(s[l]=!0,r.push(l))}return r.sort(function(c,u){return c-u}),r},e.candidatesEdgeMap=function(n,r){var s=new Rfe;if(this.index.shapes.size===1){var o=this.index.shape(0);return s.set(o,this.candidates(n,r,o)),s}if(this.getCellsForEdge(n,r),this.cells.length===0)return s;for(var a=Ct(this.cells),l;!(l=a()).done;)for(var c=l.value,u=Ct(c.shapes),f;!(f=u()).done;)for(var d=f.value,A=this.index.shape(d.shapeID),y=0;y<d.numEdges();y++)s.set(A,(s.get(A)||[]).concat([d.edges[y]]));return this.cells.length>1&&s.forEach(function(w,S){s.set(S,i.uniqueInts(w))}),s},e.getCells=function(n,r,s){var o=rfe(n,r,uu(s.id)),a=o[0],l=o[1],c=o[2];if(c){this.a=a,this.b=l;var u=Hr.fromPoints(this.a,this.b);s.bound().intersects(u)&&this.computeCellsIntersected(s,u)}return this.cells.length===0?[]:this.cells},e.getCellsForEdge=function(n,r){this.cells=[];for(var s=cfe(n,r),o=Ct(s),a;!(a=o()).done;){var l=a.value;this.a=l.a,this.b=l.b;var c=Hr.fromPoints(this.a,this.b),u=Ma.fromCellID(Ap(l.face),0),f=u.shrinkToFit(c),d=this.iter.locateCellID(f);d===vp?this.cells.push(this.iter.indexCell()):d===fy&&(ay(f)||(u=Ma.fromCellID(f,0)),this.computeCellsIntersected(u,c))}},e.computeCellsIntersected=function(n,r){if(this.iter.seek(qi(n.id)),!(this.iter.done()||this.iter.cellID()>Gi(n.id))){if(this.iter.cellID()===n.id){this.cells.push(this.iter.indexCell());return}var s=n.middle().lo();if(r.x.hi<s.x){this.clipVAxis(r,s.y,0,n);return}else if(r.x.lo>=s.x){this.clipVAxis(r,s.y,1,n);return}var o=this.splitUBound(r,s.x);r.y.hi<s.y?(this.computeCellsIntersected(Ma.fromParentIJ(n,0,0),o[0]),this.computeCellsIntersected(Ma.fromParentIJ(n,1,0),o[1])):r.y.lo>=s.y?(this.computeCellsIntersected(Ma.fromParentIJ(n,0,1),o[0]),this.computeCellsIntersected(Ma.fromParentIJ(n,1,1),o[1])):(this.clipVAxis(o[0],s.y,0,n),this.clipVAxis(o[1],s.y,1,n))}},e.clipVAxis=function(n,r,s,o){if(n.y.hi<r)this.computeCellsIntersected(Ma.fromParentIJ(o,s,0),n);else if(n.y.lo>=r)this.computeCellsIntersected(Ma.fromParentIJ(o,s,1),n);else{var a=this.splitVBound(n,r);this.computeCellsIntersected(Ma.fromParentIJ(o,s,0),a[0]),this.computeCellsIntersected(Ma.fromParentIJ(o,s,1),a[1])}},e.splitUBound=function(n,r){var s=n.y.clampPoint(I1(r,this.a.x,this.b.x,this.a.y,this.b.y)),o=this.a.x>this.b.x!=this.a.y>this.b.y?1:0;return this.splitBound(n,0,o,r,s)},e.splitVBound=function(n,r){var s=n.x.clampPoint(I1(r,this.a.y,this.b.y,this.a.x,this.b.x)),o=this.a.x>this.b.x!=this.a.y>this.b.y?1:0;return this.splitBound(n,o,0,s,r)},e.splitBound=function(n,r,s,o,a){var l=[Hr.fromRect(n),Hr.fromRect(n)];return r===1?(l[0].x.lo=o,l[1].x.hi=o):(l[0].x.hi=o,l[1].x.lo=o),s===1?(l[0].y.lo=a,l[1].y.hi=a):(l[0].y.hi=a,l[1].y.lo=a),l},i})(),Rfe=(function(i){function e(){return i.apply(this,arguments)||this}return sy(e,i),e})(E1(Map)),Ife=function(e,t,n){var r=1,s=t.distance(n);s!==0&&(r=s/Math.sin(s));var o=1,a=n.distance(e);a!==0&&(o=a/Math.sin(a));var l=1,c=e.distance(t);c!==0&&(l=c/Math.sin(c));var u=new Wt(e.x,t.x-e.x,n.x-e.x),f=new Wt(e.y,t.y-e.y,n.y-e.y),d=new Wt(e.z,t.z-e.z,n.z-e.z),A=new Wt(r,o-r,l-r);return We.fromVector(new Wt(f.cross(d).dot(A),d.cross(u).dot(A),u.cross(f).dot(A)).mul(.5))},Kq=new We(0,0,1),Qq=new We(0,0,-1),eD=(function(){function i(t){this.originInside=!1,this.depth=0,this.bound=Ri.emptyRect(),this.subregionBound=Ri.emptyRect(),this.vertices=t,this.index=new wT,this.initOriginAndBound()}i.fromCell=function(n){var r=[n.vertex(0),n.vertex(1),n.vertex(2),n.vertex(3)];return new i(r)},i.fromLoop=function(n){return new i(n.vertices.map(function(r){return We.fromVector(r.vector)}))},i.emptyLoop=function(){return new i([Kq])},i.fullLoop=function(){return new i([Qq])};var e=i.prototype;return e.initOriginAndBound=function(){if(this.vertices.length<3){if(!this.isEmptyOrFull()){this.originInside=!1;return}this.originInside=this.vertices[0].z<0}else{var n=this.vertices[0]!==this.vertices[1]&&this.vertices[2]!==this.vertices[1]&&khe(this.vertices[0],this.vertices[1],this.vertices[2]);this.originInside=!1,n!==this.containsPoint(this.vertices[1])&&(this.originInside=!0)}this.initBound(),this.index.add(this)},e.copyFrom=function(n){this.vertices=n.vertices,this.originInside=n.originInside,this.depth=n.depth,this.bound=n.bound,this.subregionBound=n.subregionBound,this.index=n.index},e.initBound=function(){if(this.vertices.length===0){this.copyFrom(i.emptyLoop());return}if(this.isEmptyOrFull()){this.isEmpty()?this.bound=Ri.emptyRect():this.bound=Ri.fullRect(),this.subregionBound=this.bound;return}for(var n=new P1,r=0;r<=this.vertices.length;r++)n.addPoint(this.vertex(r));var s=n.rectBound();this.containsPoint(new We(0,0,1))&&(s=new Ri(new Li(s.lat.lo,Math.PI/2),to.fullInterval())),s.lng.isFull()&&this.containsPoint(new We(0,0,-1))&&(s.lat.lo=-Math.PI/2),this.bound=s,this.subregionBound=P1.expandForSubregions(this.bound)},e.validate=function(){var n=this.findValidationErrorNoIndex();return n||null},e.findValidationErrorNoIndex=function(){for(var n=0;n<this.vertices.length;n++){var r=this.vertices[n];if(!r.vector.isUnit())return new Error("vertex "+n+" is not unit length")}if(this.vertices.length<3)return this.isEmptyOrFull()?null:new Error("non-empty, non-full loops must have at least 3 vertices");for(var s=0;s<this.vertices.length;s++){if(this.vertices[s].equals(this.vertex(s+1)))return new Error("edge "+s+" is degenerate (duplicate vertex)");var o=We.fromVector(this.vertex(s+1).vector.mul(-1));if(this.vertices[s].equals(o))return new Error("vertices "+s+" and "+(s+1)%this.vertices.length+" are antipodal")}return null},e.contains=function(n){if(!this.subregionBound.contains(n.bound))return!1;if(this.isEmptyOrFull()||n.isEmptyOrFull())return this.isFull()||n.isEmpty();var r=new Pfe;return BL(this,n,r)?!1:r.foundSharedVertex?!0:!(!this.containsPoint(n.vertex(0))||(n.subregionBound.contains(this.bound)||n.bound.union(this.bound).isFull())&&n.containsPoint(this.vertex(0)))},e.intersects=function(n){if(!this.bound.intersects(n.bound))return!1;var r=new Lfe;return BL(this,n,r)?!0:r.foundSharedVertex?!1:!!((this.subregionBound.contains(n.bound)||this.bound.union(n.bound).isFull())&&this.containsPoint(n.vertex(0))||n.subregionBound.contains(this.bound)&&n.containsPoint(this.vertex(0)))},e.equal=function(n){if(this.vertices.length!==n.vertices.length)return!1;for(var r=0;r<this.vertices.length;r++)if(this.vertices[r]!==n.vertex(r))return!1;return!0},e.boundaryEqual=function(n){if(this.vertices.length!==n.vertices.length)return!1;if(this.isEmptyOrFull())return this.isEmpty()===n.isEmpty();for(var r=0;r<this.vertices.length;r++)if(this.vertices[r].equals(n.vertex(0))){for(var s=0;s<this.vertices.length;s++)if(this.vertex(s+r)!==n.vertex(s))return!1;return!0}return!1},e.compareBoundary=function(n){if(!this.bound.intersects(n.bound))return-1;if(this.isFull())return 1;if(n.isFull())return-1;var r=new Dfe(n.isHole());return BL(this,n,r)?0:r.foundSharedVertex?r.containsEdge?1:-1:this.containsPoint(n.vertex(0))?1:-1},e.containsOrigin=function(){return this.originInside},e.referencePoint=function(){return IT(this.originInside)},e.numEdges=function(){return this.isEmptyOrFull()?0:this.vertices.length},e.edge=function(n){return new ah(this.vertex(n),this.vertex(n+1))},e.numChains=function(){return this.isEmpty()?0:1},e.chain=function(n){return new T1(0,this.numEdges())},e.chainEdge=function(n,r){return new ah(this.vertex(r),this.vertex(r+1))},e.chainPosition=function(n){return new RT(0,n)},e.dimension=function(){return 2},e.typeTag=function(){return RH},e.privateInterface=function(){},e.isEmpty=function(){return this.isEmptyOrFull()&&!this.containsOrigin()},e.isFull=function(){return this.isEmptyOrFull()&&this.containsOrigin()},e.isEmptyOrFull=function(){return this.vertices.length===1},e.rectBound=function(){return this.bound},e.capBound=function(){return this.bound.capBound()},e.vertex=function(n){return this.vertices[n%this.vertices.length]},e.orientedVertex=function(n){var r=n-this.vertices.length;return r<0&&(r=n),this.isHole()&&(r=this.vertices.length-1-r),this.vertex(r)},e.numVertices=function(){return this.vertices.length},e.bruteForceContainsPoint=function(n){for(var r=We.originPoint(),s=this.originInside,o=Vl.newChainEdgeCrosser(r,n,this.vertex(0)),a=1;a<=this.vertices.length;a++)s=s!==o.edgeOrVertexChainCrossing(this.vertex(a));return s},e.containsPoint=function(n){if(!this.index.isFresh()&&!this.bound.containsPoint(n))return!1;var r=32;if(this.index.shapes.size===0||this.vertices.length<=r)return this.bruteForceContainsPoint(n);var s=this.index.iterator();return s.locatePoint(n)?this.iteratorContainsPoint(s,n):!1},e.containsCell=function(n){var r=this.index.iterator(),s=r.locateCellID(n.id);return s!==vp||this.boundaryApproxIntersects(r,n)?!1:this.iteratorContainsPoint(r,n.center())},e.intersectsCell=function(n){var r=this.index.iterator(),s=r.locateCellID(n.id);return s===PT?!1:s===fy||r.cellID()===n.id||this.boundaryApproxIntersects(r,n)?!0:this.iteratorContainsPoint(r,n.center())},e.cellUnionBound=function(){return this.capBound().cellUnionBound()},e.boundaryApproxIntersects=function(n,r){var s=n.indexCell().findByShapeID(0);if(s.edges.length===0)return!1;if(n.cellID()===r.id)return!0;for(var o=hy+LH,a=r.boundUV().expandedByMargin(o),l=Ct(s.edges),c;!(c=l()).done;){var u=c.value,f=ry(this.vertex(u),this.vertex(u+1),r.face,o),d=f[0],A=f[1],y=f[2];if(y&&DH(d,A,a))return!0}return!1},e.iteratorContainsPoint=function(n,r){var s,o=(s=n.indexCell())==null?void 0:s.findByShapeID(0),a=o?.containsCenter||!1;if(o&&o.edges.length>0)for(var l=n.center(),c=new Vl(l,r),u=-2,f=Ct(o.edges),d;!(d=f()).done;){var A=d.value;A!==u+1&&c.restartAt(this.vertex(A)),u=A,a=a!==c.edgeOrVertexChainCrossing(this.vertex(A+1))}return a},i.regularLoop=function(n,r,s){return i.regularLoopForFrame(sD(n),r,s)},i.regularLoopForFrame=function(n,r,s){return new i(We.regularPointsForFrame(n,r,s))},e.canonicalFirstVertex=function(){for(var n=0,r=this.vertices.length,s=1;s<r;s++)this.vertex(s).vector.cmp(this.vertex(n).vector)===-1&&(n=s);return this.vertex(n+1).vector.cmp(this.vertex(n+r-1).vector)===-1?[n,1]:(n+=r,[n,-1])},e.turningAngle=function(){if(this.isEmptyOrFull())return this.containsOrigin()?-2*Math.PI:2*Math.PI;if(this.vertices.length<3)return 0;for(var n=this.canonicalFirstVertex(),r=n[0],s=n[1],o=kq(this.vertex((r+this.vertices.length-s)%this.vertices.length),this.vertex(r),this.vertex((r+s)%this.vertices.length)),a=0,l=this.vertices.length-1;l>0;l--){r+=s;var c=kq(this.vertex(r-s),this.vertex(r),this.vertex(r+s)),u=o;o+=c+a,a=u-o+c}var f=2*Math.PI-4*Ki;return Math.max(-f,Math.min(f,s*(o+a)))},e.turningAngleMaxError=function(){var n=11.25*Ki;return n*this.vertices.length},e.isHole=function(){return(this.depth&1)!==0},e.sign=function(){return this.isHole()?-1:1},e.isNormalized=function(){return this.bound.lng.length()<Math.PI?!0:this.turningAngle()>=-this.turningAngleMaxError()},e.normalize=function(){this.isNormalized()||this.invert()},e.invert=function(){if(this.index.reset(),this.isEmptyOrFull())this.vertices[0]=this.isFull()?Kq:Qq;else for(var n=Math.floor(this.vertices.length/2)-1;n>=0;n--){var r=this.vertices.length-1-n,s=[this.vertices[r],this.vertices[n]];this.vertices[n]=s[0],this.vertices[r]=s[1]}this.originInside=!this.originInside,this.bound.lat.lo>-Math.PI/2&&this.bound.lat.hi<Math.PI/2?(this.bound=Ri.fullRect(),this.subregionBound=this.bound):this.initBound(),this.index.add(this)},e.findVertex=function(n){var r=0;if(this.vertices.length<10){for(var s=1;s<=this.vertices.length;s++)if(this.vertex(s).equals(n))return[s,!0];return[r,!1]}var o=this.index.iterator();if(!o.locatePoint(n))return[r,!1];for(var a=o.indexCell().findByShapeID(0),l=a.numEdges()-1;l>=0;l--){var c=a.edges[l];if(this.vertex(c).equals(n))return c===0?[this.vertices.length,!0]:[c,!0];if(this.vertex(c+1).equals(n))return[c+1,!0]}return[r,!1]},e.containsNested=function(n){if(!this.subregionBound.contains(n.bound))return!1;if(this.isEmptyOrFull()||n.numVertices()<2)return this.isFull()||n.isEmpty();var r=this.findVertex(n.vertex(1)),s=r[0],o=r[1];return o?UH(this.vertex(s-1),this.vertex(s),this.vertex(s+1),n.vertex(0),n.vertex(2)):this.containsPoint(n.vertex(1))},e.surfaceIntegralFloat64=function(n){for(var r=Math.PI-1e-5,s=0,o=this.vertex(0),a=1;a+1<this.vertices.length;a++){if(this.vertex(a+1).vector.angle(o.vector)>r){var l=o;o.equals(this.vertex(0))?o=We.fromVector(this.vertex(0).pointCross(this.vertex(a)).vector.normalize()):this.vertex(a).vector.angle(this.vertex(0).vector)<r?o=this.vertex(0):(o=We.fromVector(this.vertex(0).vector.cross(l.vector)),s+=n(this.vertex(0),l,o)),s+=n(l,this.vertex(a),o)}s+=n(o,this.vertex(a),this.vertex(a+1))}return o!==this.vertex(0)&&(s+=n(o,this.vertex(this.vertices.length-1),this.vertex(0))),s},e.surfaceIntegralPoint=function(n){for(var r=Math.PI-1e-5,s=new We(0,0,0).vector,o=this.vertex(0),a=1;a+1<this.vertices.length;a++){if(this.vertex(a+1).vector.angle(o.vector)>r){var l=o;o.equals(this.vertex(0))?o=We.fromVector(this.vertex(0).pointCross(this.vertex(a)).vector.normalize()):this.vertex(a).vector.angle(this.vertex(0).vector)<r?o=this.vertex(0):(o=We.fromVector(this.vertex(0).vector.cross(l.vector)),s=s.add(n(this.vertex(0),l,o).vector)),s=s.add(n(l,this.vertex(a),o).vector)}s=s.add(n(o,this.vertex(a),this.vertex(a+1)).vector)}return o!==this.vertex(0)&&(s=s.add(n(o,this.vertex(this.vertices.length-1),this.vertex(0)).vector)),We.fromVector(s)},e.area=function(){if(this.isEmptyOrFull())return this.containsOrigin()?4*Math.PI:0;var n=this.surfaceIntegralFloat64(jhe),r=this.turningAngleMaxError();return n<0&&(n+=4*Math.PI),n>4*Math.PI&&(n=4*Math.PI),n<0&&(n=0),n<r&&!this.isNormalized()?4*Math.PI:n>4*Math.PI-r&&this.isNormalized()?0:n},e.centroid=function(){return this.surfaceIntegralPoint(Ife)},e.containsNonCrossingBoundary=function(n,r){if(!this.bound.intersects(n.bound))return!1;if(this.isFull())return!0;if(n.isFull())return!1;var s=this.findVertex(n.vertex(0)),o=s[0],a=s[1];return a?zH(this.vertex(o-1),this.vertex(o),this.vertex(o+1),n.vertex(1),r):this.containsPoint(n.vertex(0))},i})(),ST=function(e,t){return!e.containsCenter&&t===kH||e.containsCenter&&t===TT},BL=function(e,t,n){for(var r=new Xq(e.index),s=new Xq(t.index),o=new eH(e,t,n,!1),a=new eH(t,e,n,!0);!r.done()||!s.done();)if(r.rangeMax<s.rangeMin)r.seekTo(s);else if(s.rangeMax<r.rangeMin)s.seekTo(r);else{var l=as(r.it.cellID())-as(s.it.cellID());if(l>0){if(o.hasCrossingRelation(r,s))return!0}else if(l<0){if(a.hasCrossingRelation(s,r))return!0}else{var c=r.it.indexCell().shapes[0],u=s.it.indexCell().shapes[0];if(ST(c,o.aCrossingTarget)&&ST(u,o.bCrossingTarget)||c.numEdges()>0&&u.numEdges()>0&&o.cellCrossesCell(c,u))return!0;r.next(),s.next()}}return!1},Jq=0,kH=1,TT=2,Pfe=(function(){function i(){this.foundSharedVertex=!1}var e=i.prototype;return e.aCrossingTarget=function(){return kH},e.bCrossingTarget=function(){return TT},e.wedgesCross=function(n,r,s,o,a){return this.foundSharedVertex=!0,!UH(n,r,s,o,a)},i})(),Lfe=(function(){function i(){this.foundSharedVertex=!1}var e=i.prototype;return e.aCrossingTarget=function(){return TT},e.bCrossingTarget=function(){return TT},e.wedgesCross=function(n,r,s,o,a){return this.foundSharedVertex=!0,Mfe(n,r,s,o,a)},i})(),Dfe=(function(){function i(t){this.foundSharedVertex=!1,this.containsEdge=!1,this.excludesEdge=!1,this.reverse=t}var e=i.prototype;return e.aCrossingTarget=function(){return Jq},e.bCrossingTarget=function(){return Jq},e.wedgesCross=function(n,r,s,o,a){return this.foundSharedVertex=!0,zH(n,r,s,a,this.reverse)?this.containsEdge=!0:this.excludesEdge=!0,this.containsEdge&&this.excludesEdge},i})(),zH=function(e,t,n,r,s){return r.equals(e)||r.equals(n)?r.equals(e)===s:We.orderedCCW(e,n,r,t)},eH=(function(){function i(t,n,r,s){if(this.crosser=null,this.aj=0,this.bjPrev=-2,this.bCells=[],this.a=t,this.b=n,this.relation=r,this.swapped=s,this.aCrossingTarget=r.aCrossingTarget(),this.bCrossingTarget=r.bCrossingTarget(),this.bQuery=new Cfe(n.index),s){var o=[this.bCrossingTarget,this.aCrossingTarget];this.aCrossingTarget=o[0],this.bCrossingTarget=o[1]}}var e=i.prototype;return e.startEdge=function(n){this.crosser=new Vl(this.a.vertex(n),this.a.vertex(n+1)),this.aj=n,this.bjPrev=-2},e.edgeCrossesCell=function(n){for(var r=n.numEdges(),s=0;s<r;s++){var o,a=n.edges[s];if(a!==this.bjPrev+1){var l;(l=this.crosser)==null||l.restartAt(this.b.vertex(a))}this.bjPrev=a;var c=(o=this.crosser)==null?void 0:o.chainCrossingSign(this.b.vertex(a+1));if(c!==zl){if(c===Sc)return!0;if(this.a.vertex(this.aj+1).equals(this.b.vertex(a+1))){if(this.swapped){if(this.relation.wedgesCross(this.b.vertex(a),this.b.vertex(a+1),this.b.vertex(a+2),this.a.vertex(this.aj),this.a.vertex(this.aj+2)))return!0}else if(this.relation.wedgesCross(this.a.vertex(this.aj),this.a.vertex(this.aj+1),this.a.vertex(this.aj+2),this.b.vertex(a),this.b.vertex(a+2)))return!0}}}return!1},e.cellCrossesCell=function(n,r){for(var s=Ct(n.edges),o;!(o=s()).done;){var a=o.value;if(this.startEdge(a),this.edgeCrossesCell(r))return!0}return!1},e.cellCrossesAnySubcell=function(n,r){for(var s=Ma.fromCellID(r,0),o=Ct(n.edges),a;!(a=o()).done;){var l=a.value;if(this.bCells=this.bQuery.getCells(this.a.vertex(l),this.a.vertex(l+1),s),this.bCells.length!==0){this.startEdge(l);for(var c=Ct(this.bCells),u;!(u=c()).done;){var f=u.value;if(this.edgeCrossesCell(f.shapes[0]))return!0}}}return!1},e.hasCrossing=function(n,r){var s=20,o=0;for(this.bCells=[];;){var a=r.it.indexCell().shapes[0].numEdges();if(a>0){if(o+=a,o>=s)return this.cellCrossesAnySubcell(n.it.indexCell().shapes[0],n.cellID())?!0:(r.seekBeyond(n),!1);this.bCells.push(r.indexCell())}if(r.next(),r.cellID()>n.rangeMax)break}for(var l=Ct(this.bCells),c;!(c=l()).done;){var u=c.value;if(this.cellCrossesCell(n.it.indexCell().shapes[0],u.shapes[0]))return!0}return!1},e.hasCrossingRelation=function(n,r){var s=n.it.indexCell().shapes[0];if(s.numEdges()!==0)return this.hasCrossing(n,r)?!0:(n.next(),!1);if(ST(s,this.aCrossingTarget))return r.seekBeyond(n),n.next(),!1;for(;r.cellID()<=n.rangeMax;){var o=r.it.indexCell().shapes[0];if(ST(o,this.bCrossingTarget))return!0;r.next()}return n.next(),!1},i})(),Nfe=(function(){function i(t){var n=this;if(t===void 0&&(t=[]),this.loops=[],this.index=new wT,this.hasHoles=!1,this.numVertices=0,this.nEdges=0,this.bound=Ri.emptyRect(),this.subregionBound=Ri.emptyRect(),this.cumulativeEdges=[],this.initLoops=function(r){var s=new Array;s.push(null);for(var o=-1;s.length>0;){var a=s.pop();a!=null&&(o=a.depth,n.loops.push(a));for(var l=r.get(a)||[],c=l.length-1;c>=0;c--){var u=l[c];u.depth=o+1,s.push(u)}}},t.length===1&&t[0].isEmpty()){this.initLoopProperties();return}this.loops=t,this.initNested()}i.fromOrientedLoops=function(n){for(var r=new Map,s=Ct(n),o;!(o=s()).done;){var a=o.value;r.set(a,a.containsOrigin())}for(var l=Ct(n),c;!(c=l()).done;){var u=c.value,f=u.turningAngle();Math.abs(f)>u.turningAngleMaxError()?f<0&&u.invert():u.containsOrigin()&&u.invert()}var d=new i(n);if(d.numLoops()>0){for(var A=d.loop(0),y=!1,w=Ct(d.loops),S;!(S=w()).done;){var T=S.value;T.containsOrigin()&&(y=!y,A=T)}r.get(A)!==y&&d.invert()}return d};var e=i.prototype;return e.invert=function(){if(this.isEmpty()){Object.assign(this,i.fullPolygon()),this.initLoopProperties();return}if(this.isFull()){Object.assign(this,new i),this.initLoopProperties();return}for(var n=0,r=10,s=r,o=1;o<this.numLoops();o++)if(this.loop(o).depth===0){s===r&&(s=this.loop(n).turningAngle());var a=this.loop(o).turningAngle();(a<s||a===s&&this.compareLoops(this.loop(o),this.loop(n))<0)&&(n=o,s=a)}this.loop(n).invert();var l=[],c=this.lastDescendant(n);l.push(this.loop(n));for(var u=0;u<this.loops.length;u++)(u<n||u>c)&&(this.loop(u).depth++,l.push(this.loop(u)));for(var f=0;f<this.loops.length;f++)f>n&&f<=c&&(this.loop(f).depth--,l.push(this.loop(f)));this.loops=l,this.initLoopProperties()},e.compareLoops=function(n,r){if(n.numVertices()!==r.numVertices())return n.numVertices()-r.numVertices();var s=n.canonicalFirstVertex(),o=s[0],a=s[1],l=r.canonicalFirstVertex(),c=l[0],u=l[1];if(a!==u)return a-u;for(var f=n.numVertices()-1;f>=0;f--,o+=a,c+=u){var d=n.vertex(o).vector.cmp(r.vertex(c).vector);if(d!==0)return d}return 0},i.fromCell=function(n){return new i([eD.fromCell(n)])},e.initNested=function(){if(this.loops.length===1){this.initOneLoop();return}var n=new Ffe;this.loops.forEach(function(r){n.insertLoop(r,null)}),this.loops=[],this.initLoops(n),this.initLoopProperties()},e.initOneLoop=function(){this.hasHoles=!1,this.numVertices=this.loops[0].vertices.length,this.bound=this.loops[0].rectBound(),this.subregionBound=P1.expandForSubregions(this.bound),this.loops[0].depth=0,this.initEdgesAndIndex()},e.initLoopProperties=function(){this.numVertices=0,this.bound=Ri.emptyRect(),this.hasHoles=!1;for(var n=Ct(this.loops),r;!(r=n()).done;){var s=r.value;s.isHole()?this.hasHoles=!0:this.bound=this.bound.union(s.rectBound()),this.numVertices+=s.numVertices()}this.subregionBound=P1.expandForSubregions(this.bound),this.initEdgesAndIndex()},e.initEdgesAndIndex=function(){if(this.nEdges=0,this.cumulativeEdges=[],!this.isFull()){var n=12;this.loops.length>n&&(this.cumulativeEdges=[]);for(var r=Ct(this.loops),s;!(s=r()).done;){var o=s.value;this.cumulativeEdges.length>0&&this.cumulativeEdges.push(this.nEdges),this.nEdges+=o.vertices.length}this.index=new wT,this.index.add(this)}},i.fullPolygon=function(){var n=eD.fullLoop(),r=new i;return r.loops=[n],r.numVertices=n.vertices.length,r.bound=Ri.fullRect(),r.subregionBound=Ri.fullRect(),r.initEdgesAndIndex(),r},e.validate=function(){for(var n=0;n<this.loops.length;n++){var r=this.loops[n],s=r.findValidationErrorNoIndex();if(s)return new Error("loop "+n+": "+s.message);if(r.isEmpty())return new Error("loop "+n+": empty loops are not allowed");if(r.isFull()&&this.loops.length>1)return new Error("loop "+n+": full loop appears in non-full polygon")}return this.findLoopNestingError()},e.findLoopNestingError=function(){for(var n=-1,r=0;r<this.loops.length;r++){var s=this.loops[r].depth;if(s<0||s>n+1)return new Error("loop "+r+": invalid loop depth ("+s+")");n=s}for(var o=0;o<this.loops.length;o++)for(var a=this.loops[o],l=this.lastDescendant(o),c=0;c<this.loops.length;c++)if(o!==c){var u=c>=o+1&&c<=l,f=!1;if(a.containsNonCrossingBoundary(this.loops[c],f)!==u){var d=u?"":"not ";return new Error("invalid nesting: loop "+o+" should "+d+"contain loop "+c)}}return null},e.isEmpty=function(){return this.loops.length===0},e.isFull=function(){return this.loops.length===1&&this.loops[0].isFull()},e.numLoops=function(){return this.loops.length},e.loop=function(n){return this.loops[n]},e.parent=function(n){var r,s=((r=this.loops[n])==null?void 0:r.depth)||0;if(s===0)return[-1,!1];for(n--;n>=0&&this.loops[n].depth<=s;n--);return[n,!0]},e.lastDescendant=function(n){var r;if(n<0)return this.loops.length-1;var s=((r=this.loops[n])==null?void 0:r.depth)||0;for(n++;n<this.loops.length&&this.loops[n].depth>s;n++);return n-1},e.capBound=function(){return this.bound.capBound()},e.rectBound=function(){return this.bound},e.containsPoint=function(n){if(!this.index.isFresh()&&!this.bound.containsPoint(n))return!1;var r=32;if(this.numVertices<r||this.index==null){for(var s=!1,o=Ct(this.loops),a;!(a=o()).done;){var l=a.value;s=s!==l.bruteForceContainsPoint(n)}return s}return new gp(this.index,Xf).contains(n)},e.containsCell=function(n){var r=this.index.iterator(),s=r.locateCellID(n.id);return s!==vp||this.boundaryApproxIntersects(r,n)?!1:this.iteratorContainsPoint(r,n.center())},e.intersectsCell=function(n){var r=this.index.iterator(),s=r.locateCellID(n.id);return s===PT?!1:s===fy||r.cellID()===n.id||this.boundaryApproxIntersects(r,n)?!0:this.iteratorContainsPoint(r,n.center())},e.cellUnionBound=function(){return this.capBound().cellUnionBound()},e.boundaryApproxIntersects=function(n,r){var s=n.indexCell().findByShapeID(0);if(s.edges.length===0)return!1;if(n.cellID()===r.id)return!0;for(var o=hy+LH,a=r.boundUV().expandedByMargin(o),l=Ct(s.edges),c;!(c=l()).done;){var u=c.value,f=this.index.shape(0).edge(u),d=ry(f.v0,f.v1,r.face,o),A=d[0],y=d[1],w=d[2];if(w&&DH(A,y,a))return!0}return!1},e.iteratorContainsPoint=function(n,r){var s=n.indexCell().findByShapeID(0),o=s.containsCenter;if(s.edges.length===0)return o;for(var a=new Vl(n.center(),r),l=this.index.shape(0),c=Ct(s.edges),u;!(u=c()).done;){var f=u.value,d=l.edge(f);o=o!==a.edgeOrVertexCrossing(d.v0,d.v1)}return o},e.numEdges=function(){return this.nEdges},e.edge=function(n){var r=0;if(this.cumulativeEdges.length>0){for(r=0;r<this.cumulativeEdges.length;r++)if(r+1>=this.cumulativeEdges.length||n<this.cumulativeEdges[r+1]){n-=this.cumulativeEdges[r];break}}else for(r=0;n>=this.loop(r).vertices.length;r++)n-=this.loop(r).vertices.length;return new ah(this.loop(r).orientedVertex(n),this.loop(r).orientedVertex(n+1))},e.referencePoint=function(){for(var n=!1,r=Ct(this.loops),s;!(s=r()).done;){var o=s.value;n=n!==o.containsOrigin()}return IT(n)},e.numChains=function(){return this.numLoops()},e.chain=function(n){if(this.cumulativeEdges.length>0)return new T1(this.cumulativeEdges[n],this.loop(n).vertices.length);for(var r=0,s=0;s<n;s++)r+=this.loop(s).vertices.length;var o=this.loop(n).numVertices();return o!==1?new T1(r,o):new T1(r,0)},e.chainEdge=function(n,r){return new ah(this.loop(n).orientedVertex(r),this.loop(n).orientedVertex(r+1))},e.chainPosition=function(n){var r=0;if(this.cumulativeEdges.length>0){for(r=0;r<this.cumulativeEdges.length;r++)if(r+1>=this.cumulativeEdges.length||n<this.cumulativeEdges[r+1]){n-=this.cumulativeEdges[r];break}}else for(r=0;n>=this.loop(r).vertices.length;r++)n-=this.loop(r).vertices.length;return new RT(r,n)},e.dimension=function(){return 2},e.typeTag=function(){return Yhe},e.privateInterface=function(){},e.contains=function(n){if(this.loops.length===1&&n.loops.length===1)return this.loops[0].contains(n.loops[0]);if(!this.subregionBound.contains(n.bound)&&!this.bound.lng.union(n.bound.lng).isFull())return!1;if(!this.hasHoles&&!n.hasHoles){for(var r=Ct(n.loops),s;!(s=r()).done;){var o=s.value;if(!this.anyLoopContains(o))return!1}return!0}return this.containsBoundary(n)&&n.excludesNonCrossingComplementShells(this)},e.intersects=function(n){if(this.loops.length===1&&n.loops.length===1)return this.loops[0].intersects(n.loops[0]);if(!this.bound.intersects(n.bound))return!1;if(!this.hasHoles&&!n.hasHoles){for(var r=Ct(n.loops),s;!(s=r()).done;){var o=s.value;if(this.anyLoopIntersects(o))return!0}return!1}return!this.excludesBoundary(n)||!n.excludesNonCrossingShells(this)},e.compareBoundary=function(n){for(var r=-1,s=0;s<this.loops.length&&r!==0;s++)r*=-this.loops[s].compareBoundary(n);return r},e.containsBoundary=function(n){for(var r=Ct(n.loops),s;!(s=r()).done;){var o=s.value;if(this.compareBoundary(o)<=0)return!1}return!0},e.excludesBoundary=function(n){for(var r=Ct(n.loops),s;!(s=r()).done;){var o=s.value;if(this.compareBoundary(o)>=0)return!1}return!0},e.containsNonCrossingBoundary=function(n,r){for(var s=!1,o=Ct(this.loops),a;!(a=o()).done;){var l=a.value,c=l.containsNonCrossingBoundary(n,r);s=s!=c}return s},e.excludesNonCrossingShells=function(n){for(var r=Ct(n.loops),s;!(s=r()).done;){var o=s.value;if(!o.isHole()&&this.containsNonCrossingBoundary(o,!1))return!1}return!0},e.excludesNonCrossingComplementShells=function(n){if(n.isEmpty())return!this.isFull();if(n.isFull())return!0;for(var r=0;r<n.loops.length;r++){var s=n.loops[r];if(!(r>0&&!s.isHole())&&this.containsNonCrossingBoundary(s,r===0))return!1}return!0},e.anyLoopContains=function(n){for(var r=Ct(this.loops),s;!(s=r()).done;){var o=s.value;if(o.contains(n))return!0}return!1},e.anyLoopIntersects=function(n){for(var r=Ct(this.loops),s;!(s=r()).done;){var o=s.value;if(o.intersects(n))return!0}return!1},e.area=function(){for(var n=0,r=Ct(this.loops),s;!(s=r()).done;){var o=s.value;n+=o.sign()*o.area()}return n},e.centroid=function(){for(var n=new We(0,0,0).vector,r=Ct(this.loops),s;!(s=r()).done;){var o=s.value,a=o.centroid().vector;o.sign()<0?n=n.sub(a):n=n.add(a)}return We.fromVector(n)},i})(),Ffe=(function(i){function e(){return i.apply(this,arguments)||this}sy(e,i);var t=e.prototype;return t.insertLoop=function(r,s){for(var o=[],a=!1;!a;){o=i.prototype.get.call(this,s)||[],a=!0;for(var l=Ct(o),c;!(c=l()).done;){var u=c.value;if(u.containsNested(r)){s=u,a=!1;break}}}for(var f=i.prototype.get.call(this,r)||[],d=0;d<o.length;){var A=o[d];r.containsNested(A)?(f.push(A),o.splice(d,1)):d++}i.prototype.set.call(this,r,f),i.prototype.set.call(this,s,[].concat(o,[r]))},e})(E1(Map)),Bfe=(function(){function i(t){t===void 0&&(t=[]),this.points=t}i.fromLatLngs=function(n){return new i(n.map(We.fromLatLng))};var e=i.prototype;return e.reverse=function(){for(var n=this.points.length,r=0;r<n/2;r++){var s=n-r-1,o=[this.points[s],this.points[r]];this.points[r]=o[0],this.points[s]=o[1]}},e.length=function(){for(var n=0,r=1;r<this.points.length;r++)n+=this.points[r-1].distance(this.points[r]);return n},e.centroid=function(){for(var n=new We(0,0,0),r=1;r<this.points.length;r++){var s=this.points[r-1].vector.add(this.points[r].vector),o=this.points[r-1].vector.sub(this.points[r].vector);n=We.fromVector(n.vector.add(s.mul(Math.sqrt(o.norm2()/s.norm2()))))}return n},e.equal=function(n){if(this.points.length!==n.points.length)return!1;for(var r=0;r<this.points.length;r++)if(!this.points[r].equals(n.points[r]))return!1;return!0},e.approxEqual=function(n,r){if(r===void 0&&(r=dH),this.points.length!==n.points.length)return!1;for(var s=0;s<this.points.length;s++)if(!this.points[s].approxEqual(n.points[s],r))return!1;return!0},e.capBound=function(){return this.rectBound().capBound()},e.rectBound=function(){for(var n=new P1,r=Ct(this.points),s;!(s=r()).done;){var o=s.value;n.addPoint(o)}return n.rectBound()},e.containsCell=function(n){return!1},e.intersectsCell=function(n){if(this.points.length===0)return!1;for(var r=Ct(this.points),s;!(s=r()).done;){var o=s.value;if(n.containsPoint(o))return!0}for(var a=[n.vertex(0),n.vertex(1),n.vertex(2),n.vertex(3)],l=0;l<4;l++)for(var c=Vl.newChainEdgeCrosser(a[l],a[l+1&3],this.points[0]),u=1;u<this.points.length;u++)if(c.chainCrossingSign(this.points[u])!==zl)return!0;return!1},e.containsPoint=function(n){return!1},e.cellUnionBound=function(){return this.capBound().cellUnionBound()},e.numEdges=function(){return this.points.length===0?0:this.points.length-1},e.edge=function(n){return new ah(this.points[n],this.points[n+1])},e.referencePoint=function(){return IT(!1)},e.numChains=function(){return Math.min(1,this.numEdges())},e.chain=function(n){return new T1(0,this.numEdges())},e.chainEdge=function(n,r){return new ah(this.points[r],this.points[r+1])},e.chainPosition=function(n){return new RT(0,n)},e.dimension=function(){return 1},e.isEmpty=function(){return Khe(this)},e.isFull=function(){return Qhe(this)},e.typeTag=function(){return Zhe},e.privateInterface=function(){},i.findEndVertex=function(n,r,s){var o=n.points[s],a=sD(o),l=to.fullInterval(),c=0;for(s++;s<n.points.length;s++){var u=n.points[s],f=o.distance(u);if(f>Math.PI/2&&c>0||f<c&&c>r)break;if(c=f,!(f<=r)){var d=phe(a,u),A=Math.atan2(d.y,d.x);if(!l.contains(A))break;var y=Math.asin(Math.sin(r)/Math.sin(f)),w=to.fromPointPair(A,A).expanded(y);l=l.intersection(w)}}return s-1},e.subsampleVertices=function(n){var r=[];if(this.points.length<1)return r;r.push(0);for(var s=Math.max(n,0),o=0;o+1<this.points.length;){var a=i.findEndVertex(this,s,o);this.points[a].equals(this.points[o])||r.push(a),o=a}return r},e.project=function(n){if(this.points.length===1)return[this.points[0],1];for(var r=10,s=-1,o=1;o<this.points.length;o++){var a=Vhe(n,this.points[o-1],this.points[o]);a<r&&(r=a,s=o)}var l=TH(n,this.points[s-1],this.points[s]);return l.equals(this.points[s])&&s++,[l,s]},e.isOnRight=function(n){var r=this.project(n),s=r[0],o=r[1];return s.equals(this.points[o-1])&&o>1&&o<this.points.length?n.equals(this.points[o-1])?!1:We.orderedCCW(this.points[o-2],n,this.points[o],this.points[o-1]):(o===this.points.length&&o--,GL(n,this.points[o],this.points[o-1]))},e.validate=function(){for(var n=0;n<this.points.length;n++)if(!this.points[n].vector.isUnit())return new Error("vertex "+n+" is not unit length");for(var r=1;r<this.points.length;r++){var s=this.points[r-1],o=this.points[r];if(s.equals(o))return new Error("vertices "+(r-1)+" and "+r+" are identical");if(s.equals(We.fromVector(o.vector.mul(-1))))return new Error("vertices "+(r-1)+" and "+r+" are antipodal")}return null},e.intersects=function(n){if(this.points.length===0||n.points.length===0||!this.rectBound().intersects(n.rectBound()))return!1;for(var r=1;r<this.points.length;r++)for(var s=Vl.newChainEdgeCrosser(this.points[r-1],this.points[r],n.points[0]),o=1;o<n.points.length;o++)if(s.chainCrossingSign(n.points[o])!==zl)return!0;return!1},e.interpolate=function(n){if(n<=0)return[this.points[0],1];for(var r=n*this.length(),s=1;s<this.points.length;s++){var o=this.points[s-1].distance(this.points[s]);if(r<o){var a=EH(r,this.points[s-1],this.points[s]);return a.equals(this.points[s])?[a,s+1]:[a,s]}r-=o}return[this.points[this.points.length-1],this.points.length]},e.uninterpolate=function(n,r){if(this.points.length<2)return 0;for(var s=0,o=1;o<r;o++)s+=this.points[o-1].distance(this.points[o]);for(var a=s+this.points[r-1].distance(n),l=r;l<this.points.length;l++)s+=this.points[l-1].distance(this.points[l]);return Math.min(1,a/s)},i})(),tH=(function(){function i(){}var e=i.prototype;return e.capBound=function(){return mp.emptyCap()},e.rectBound=function(){return Ri.emptyRect()},e.containsCell=function(n){return!1},e.intersectsCell=function(n){return!1},e.containsPoint=function(n){return!1},e.cellUnionBound=function(){return[]},i})(),tD=(function(){function i(t){var n=t===void 0?{}:t,r=n.minLevel,s=r===void 0?0:r,o=n.maxLevel,a=o===void 0?_i:o,l=n.levelMod,c=l===void 0?1:l,u=n.maxCells,f=u===void 0?8:u;this.minLevel=s,this.maxLevel=a,this.levelMod=c,this.maxCells=f}var e=i.prototype;return e.coverer=function(){return new VH(Math.max(0,Math.min(_i,this.minLevel)),Math.max(0,Math.min(_i,this.maxLevel)),Math.max(1,Math.min(3,this.levelMod)),this.maxCells)},e.covering=function(n){var r=this.cellUnion(n);return r.denormalize(Math.max(0,Math.min(_i,this.minLevel)),Math.max(1,Math.min(3,this.levelMod))),r},e.interiorCovering=function(n){var r=this.interiorCellUnion(n);return r.denormalize(Math.max(0,Math.min(_i,this.minLevel)),Math.max(1,Math.min(3,this.levelMod))),r},e.cellUnion=function(n){var r=this.coverer();r.coveringInternal(n);var s=r.result;return s.normalize(),s},e.interiorCellUnion=function(n){var r=this.coverer();r.interiorCovering=!0,r.coveringInternal(n);var s=r.result;return s.normalize(),s},e.fastCovering=function(n){var r=this.coverer(),s=Jx(R1,n.cellUnionBound());return r.normalizeCovering(s),s},e.isCanonical=function(n){return this.coverer().isCanonical(n)},i})(),VH=(function(){function i(t,n,r,s){this.region=new tH,this.result=new R1,this.pq=new Ufe,this.interiorCovering=!1,this.minLevel=t,this.maxLevel=n,this.levelMod=r,this.maxCells=s}var e=i.prototype;return e.newCandidate=function(n){if(!this.region.intersectsCell(n))return new Kx;var r=new Ofe(n),s=n.level;if(s>=this.minLevel)if(this.interiorCovering){if(this.region.containsCell(n))r.terminal=!0;else if(s+this.levelMod>this.maxLevel)return new Kx}else(s+this.levelMod>this.maxLevel||this.region.containsCell(n))&&(r.terminal=!0);return r},e.expandChildren=function(n,r,s){s--;for(var o=0,a=yH(r.id),l=uD(r.id);l!==a;l=Ia(l)){var c=Ra.fromCellID(l);if(s>0){this.region.intersectsCell(c)&&(o+=this.expandChildren(n,c,s));continue}var u=this.newCandidate(c);u instanceof Kx||(n.children.push(u),n.numChildren++,u.terminal&&o++)}return o},e.addCandidate=function(n){if(!(n instanceof Kx)){if(n.terminal){this.result.push(n.cell.id);return}var r=this.levelMod,s=n.cell.level;s<this.minLevel&&(r=1);var o=this.expandChildren(n,n.cell,r),a=2*this.levelMod;n.numChildren!==0&&(!this.interiorCovering&&o===1<<a&&s>=this.minLevel?(n.terminal=!0,this.addCandidate(n)):(n.priority=-((s<<a)+n.numChildren<<a+o),this.pq.push(n)))}},e.adjustLevel=function(n){return this.levelMod>1&&n>this.minLevel&&(n-=(n-this.minLevel)%this.levelMod),n},e.adjustCellLevels=function(n){if(this.levelMod!==1){for(var r=0,s=Ct(n),o;!(o=s()).done;){var a=o.value,l=no(a),c=this.adjustLevel(l);if(c!==l&&(a=wr(a,c)),!(r>0&&qm(n[r-1],a))){for(;r>0&&qm(a,n[r-1]);)r--;n[r]=a,r++}}n.length=r}},e.initialCandidates=function(n){var r=new tD;r.maxLevel=this.maxLevel,r.levelMod=1,r.maxCells=Math.min(4,this.maxCells);var s=r.fastCovering(n);this.adjustCellLevels(s);for(var o=Ct(s),a;!(a=o()).done;){var l=a.value;this.addCandidate(this.newCandidate(Ra.fromCellID(l)))}},e.coveringInternal=function(n){for(this.region=n,this.initialCandidates(n);this.pq.length>0&&(!this.interiorCovering||this.result.length<this.maxCells);){var r=this.pq.pop();if(this.interiorCovering||r.cell.level<this.minLevel||r.numChildren===1||this.result.length+this.pq.length+r.numChildren<=this.maxCells)for(var s=Ct(r.children),o;!(o=s()).done;){var a=o.value;(!this.interiorCovering||this.result.length<this.maxCells)&&this.addCandidate(a)}else r.terminal=!0,this.addCandidate(r)}this.region=new tH,this.pq.reset(),this.result.normalize(),(this.minLevel>0||this.levelMod>1)&&this.result.denormalize(this.minLevel,this.levelMod)},e.normalizeCovering=function(n){if(this.maxLevel<_i||this.levelMod>1)for(var r=0;r<n.length;r++){var s=no(n[r]),o=this.adjustLevel(Math.min(s,this.maxLevel));o!==s&&(n[r]=wr(n[r],o))}n.normalize(),(this.minLevel>0||this.levelMod>1)&&n.denormalize(this.minLevel,this.levelMod);var a=n.length-this.maxCells;if(!(a<=0||this.isCanonical(n))){if(a*n.length>1e4){var l=new tD,c=l.covering(n);n.length=0,n.push.apply(n,c);return}for(;n.length>this.maxCells;){for(var u=-1,f=-1,d=0;d+1<n.length;d++){var A=iy(n[d],n[d+1]),y=A[0],w=A[1];if(w){var S=this.adjustLevel(y);S>f&&(f=S,u=d)}}if(f<this.minLevel)break;var T=wr(n[u],f),R=this.replaceCellsWithAncestor(n,T);for(n.length=0,n.push.apply(n,R);f>this.minLevel&&(f-=this.levelMod,T=wr(T,f),!!this.containsAllChildren(n,T));){var P=this.replaceCellsWithAncestor(n,T);n.length=0,n.push.apply(n,P)}}}},e.isCanonical=function(n){var r=this.maxLevel;this.levelMod!==1&&(r=this.maxLevel-(this.maxLevel-this.minLevel)%this.levelMod);for(var s=n.length>this.maxCells,o=1,a=0n,l=Ct(n),c;!(c=l()).done;){var u=c.value;if(!ny(u))return!1;var f=no(u);if(f<this.minLevel||f>r||this.levelMod>1&&(f-this.minLevel)%this.levelMod!==0)return!1;if(a!==0n){if(Gi(a)>=qi(u))return!1;var d=iy(u,a),A=d[0],y=d[1];if(s&&y&&A>=this.minLevel)return!1;var w=f-this.levelMod;if(w<this.minLevel||f!==no(a)||wr(u,w)!==wr(a,w))o=1;else if(o++,o===1<<2*this.levelMod)return!1}a=u}return!0},e.containsAllChildren=function(n,r){for(var s=n.findIndex(function(l){return l>=qi(r)}),o=no(r)+this.levelMod,a=uy(r,o);a!==CT(r,o);a=Ia(a)){if(s===-1||n[s]!==a)return!1;s++}return!0},e.replaceCellsWithAncestor=function(n,r){var s=jL(n.length,function(a){return n[a]>qi(r)}),o=jL(n.length,function(a){return n[a]>Gi(r)});return[].concat(n.slice(0,s),[r],n.slice(o))},i})(),Ofe=function(e){this.terminal=!1,this.numChildren=0,this.children=[],this.priority=0,this.cell=e},Kx=function(){this.cell=Ra.fromCellID(hl),this.terminal=!1,this.numChildren=0,this.children=[],this.priority=0},Ufe=(function(i){function e(){return i.apply(this,arguments)||this}sy(e,i);var t=e.prototype;return t.len=function(){return this.length},t.swap=function(r,s){var o=[this[s],this[r]];this[r]=o[0],this[s]=o[1]},t.push=function(){for(var r,s=arguments.length,o=new Array(s),a=0;a<s;a++)o[a]=arguments[a];var l=(r=i.prototype.push).call.apply(r,[this].concat(o));return this.sort(e.ascending),l},t.pop=function(){var r=i.prototype.pop.call(this);return r||new Kx},t.reset=function(){this.length=0},e.ascending=function(r,s){return r.priority<s.priority?-1:r.priority>s.priority?1:0},e})(E1(Array)),Gn={__proto__:null,cellid:Uhe,Cap:mp,Cell:Ra,CellIndex:Xhe,CellIndexRangeIterator:MH,CellIndexContentsIterator:CH,CellUnion:R1,ClosestCellQuery:Efe,ClosestCellQueryOptions:OH,PointTarget:yfe,EdgeTarget:bfe,CellTarget:wfe,CellUnionTarget:Sfe,ShapeIndexTarget:Tfe,ClosestEdgeQuery:vfe,ClosestEdgeQueryOptions:NH,EdgeQueryPointTarget:mfe,EdgeQueryEdgeTarget:Afe,EdgeQueryCellTarget:gfe,EdgeQueryShapeIndexTarget:FH,LatLng:ar,Loop:eD,Point:We,Polygon:Nfe,Polyline:Bfe,Rect:Ri,RegionCoverer:tD,Coverer:VH,ShapeIndex:wT};function lh(i){let e=i.attrs?.["atlas.render.as"];return e||(i.displayType==="text"?"text":"pin")}function LT(i){return i?.attrs?.["atlas.geometry.surface"]||"plane"}function dD(i){let e=ch(i);return e||kfe(i)}function kfe(i){let e=i?.attrs||{};if(e["atlas.geometry.projection"]!=="mercator")return null;let t=(e["atlas.geometry.mercator.px"]||"").split(",").map(Number),n=(e["atlas.geometry.mercator.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;if(!o||!a||c===f||l===u)return null;let d=S=>Math.asinh(Math.tan(S*Math.PI/180)),A=S=>Math.atan(Math.sinh(S))*180/Math.PI,y=d(c),w=d(f);return{toLatLng(S,T){return[A(y-(T-s)/a*(y-w)),l+(S-r)/o*(u-l)]},toWorld(S,T){return[r+(T-l)/(u-l)*o,s+(y-d(S))/(y-w)*a]}}}function ch(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(d,A){return[c-(A-s)/a*(c-f),l+(d-r)/o*(u-l)]},toWorld(d,A){return[r+(A-l)/(u-l)*o,s+(c-d)/(c-f)*a]}}}var dy=10,GH=i=>i+1,qH=i=>Gn.cellid.level(Gn.cellid.fromToken(i)),pD={map:null,mapping:null};function DT(){return pD.map!==U.world&&(pD={map:U.world,mapping:dD(U.world)}),pD.mapping}function zfe(i){let e=DT();if(!e)return null;let[t,n]=e.toLatLng(i[0],-i[1]);return Gn.LatLng.fromDegrees(t,n)}function HH(i){let e=Gn.LatLng.fromPoint(i);return[e.lat*180/Math.PI,e.lng*180/Math.PI]}var WH=new WeakMap;function mD(i){let e=DT();if(!e)return 0n;let t=WH.get(i);if(t&&t.mapping===e)return t.leaf;let n=zfe(i),r=n?Gn.cellid.fromLatLng(n):0n;return typeof i=="object"&&WH.set(i,{mapping:e,leaf:r}),r}var jH={slug:"s2",name:"S2",short:"S2",appliesTo(i){return LT(i)==="sphere"&&dD(i)!==null},maxLevel(){return GH(dy)},inputLength(){return 6},level(i){return i===""?0:GH(qH(i))},parent(i){let e=Gn.cellid.fromToken(i),t=Gn.cellid.level(e);return t===0?"":Gn.cellid.toToken(Gn.cellid.parent(e,t-1))},children(i){return i===""?[0,1,2,3,4,5].map(e=>Gn.cellid.toToken(Gn.cellid.fromFace(e))):Gn.cellid.children(Gn.cellid.fromToken(i)).map(Gn.cellid.toToken)},childIndex(i){let e=Gn.cellid.fromToken(i),t=Gn.cellid.level(e);return t===0?Gn.cellid.face(e):Gn.cellid.childPosition(e,t)},contains(i,e){return Gn.cellid.contains(Gn.cellid.fromToken(i),mD(e))},descendTarget(i,e){let t=mD(e);if(t===0n)return"";let n=i===""?0:qH(i)+1;return n>dy?"":Gn.cellid.toToken(Gn.cellid.parent(t,n))},bbox(i){if(i==="")return Hf();let e=this.ring(i),t=1/0,n=1/0,r=-1/0,s=-1/0;for(let[o,a]of e)t=Math.min(t,o),n=Math.min(n,a),r=Math.max(r,o),s=Math.max(s,a);return[t,n,r,s]},center(i){let e=DT(),[t,n]=HH(Gn.Cell.fromCellID(Gn.cellid.fromToken(i)).center()),[r,s]=e.toWorld(t,n);return[r,-s]},ring(i){let e=DT(),t=Gn.Cell.fromCellID(Gn.cellid.fromToken(i)),n=Gn.cellid.level(Gn.cellid.fromToken(i)),r=Math.max(2,Math.min(16,2**(4-n)*2)),s=Hf(),o=s[2]-s[0],a=[];for(let u=0;u<4;u++){let f=t.vertex(u).vector,d=t.vertex((u+1)%4).vector;for(let A=0;A<r;A++){let y=A/r,w=f.x+(d.x-f.x)*y,S=f.y+(d.y-f.y)*y,T=f.z+(d.z-f.z)*y,R=Math.hypot(w,S,T)||1,[P,I]=HH(new Gn.Point(w/R,S/R,T/R)),[F,D]=e.toWorld(P,I);a.push([F,-D])}}for(let u=1;u<a.length;u++){let f=a[u][0]-a[u-1][0];f>o/2?a[u][0]-=o:f<-o/2&&(a[u][0]+=o)}let l=[...a[0]],c=l[0]-a[a.length-1][0];return c>o/2?l[0]-=o:c<-o/2&&(l[0]+=o),a.push(l),a},poleContained(i){let e=Gn.cellid.fromToken(i);return Gn.cellid.contains(e,Gn.cellid.fromLatLng(Gn.LatLng.fromDegrees(90,0)))?"north":Gn.cellid.contains(e,Gn.cellid.fromLatLng(Gn.LatLng.fromDegrees(-90,0)))?"south":null},label(i){return{context:i.slice(0,-1),principal:i.slice(-1)}},colorKey(i){return this.childIndex(i)%qf.length},normalizeInput(i){return[...i.toLocaleLowerCase()].filter(e=>"0123456789abcdef".includes(e)).slice(0,6).join("")},parseInput(i){if(i==="")return"";let e=Gn.cellid.fromToken(i);return e===0n||!Gn.cellid.valid(e)?null:Gn.cellid.level(e)>dy?Gn.cellid.toToken(Gn.cellid.parent(e,dy)):Gn.cellid.toToken(e)},locate(i){let e=mD(i);return e===0n?null:{label:"S2",value:Gn.cellid.toToken(Gn.cellid.parent(e,dy))}}};function Hf(){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 $H=[ML,jH];function py(i){return $H.filter(e=>e.appliesTo(i))}function Ts(){return $H.find(i=>i.slug===U.gridSystem)||ML}function YH(i,e,t,n){if(!t)return"";let r=i.center(t),s=XH(i.bbox(t)),o="",a="",l=1/0;for(;e.level(o)<e.maxLevel(n);){let c=e.descendTarget(o,r);if(!c)break;let u=XH(e.bbox(c)),f=Math.abs(Math.log(u/s));if(f<l&&(a=c,l=f),u<=s)break;o=c}return a}function XH([i,e,t,n]){return(t-i)*(n-e)}function ZH(i,e,t){let n=i[0]===i[i.length-1]||Vfe(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 d=(r-c[0])/(l[0]-c[0]);o.push([r,c[1]+d*(l[1]-c[1])])}u&&o.push(l)}if(n=o,n.length===0)return[]}return[...n,n[0]]}function Vfe(i,e){return i[0]===e[0]&&i[1]===e[1]}var Us={UNKNOWN:0,INTERSECTING:1,ABOVE:2,RIGHT:4,BELOW:8,LEFT:16};function AD(i){let e=Wr();for(let t=0,n=i.length;t<n;++t)$m(e,i[t]);return e}function Gfe(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 Gl(n,r,s,o,t)}function F1(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 FT(i,e){return e?(e[0]=i[0],e[1]=i[1],e[2]=i[2],e[3]=i[3],e):i.slice()}function Mc(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 fu(i,e){return my(i,e[0],e[1])}function uh(i,e){return i[0]<=e[0]&&e[2]<=i[2]&&i[1]<=e[1]&&e[3]<=i[3]}function my(i,e,t){return i[0]<=e&&e<=i[2]&&i[1]<=t&&t<=i[3]}function NT(i,e){let t=i[0],n=i[1],r=i[2],s=i[3],o=e[0],a=e[1],l=Us.UNKNOWN;return o<t?l=l|Us.LEFT:o>r&&(l=l|Us.RIGHT),a<n?l=l|Us.BELOW:a>s&&(l=l|Us.ABOVE),l===Us.UNKNOWN&&(l=Us.INTERSECTING),l}function Wr(){return[1/0,1/0,-1/0,-1/0]}function Gl(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 jm(i){return Gl(1/0,1/0,-1/0,-1/0,i)}function BT(i,e){let t=i[0],n=i[1];return Gl(t,n,t,n,e)}function B1(i,e,t,n,r){let s=jm(r);return gD(s,i,e,t,n)}function Xm(i,e){return i[0]==e[0]&&i[2]==e[2]&&i[1]==e[1]&&i[3]==e[3]}function OT(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 $m(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 gD(i,e,t,n,r){for(;t<n;t+=r)qfe(i,e[t],e[t+1]);return i}function qfe(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 UT(i,e){let t;return t=e(O1(i)),t||(t=e(U1(i)),t)||(t=e(k1(i)),t)||(t=e(Cc(i)),t)?t:!1}function Ay(i){let e=0;return fh(i)||(e=Kn(i)*Lr(i)),e}function O1(i){return[i[0],i[1]]}function U1(i){return[i[2],i[1]]}function fl(i){return[(i[0]+i[2])/2,(i[1]+i[3])/2]}function KH(i,e){let t;if(e==="bottom-left")t=O1(i);else if(e==="bottom-right")t=U1(i);else if(e==="top-left")t=Cc(i);else if(e==="top-right")t=k1(i);else throw new Error("Invalid corner");return t}function gy(i,e,t,n,r){let[s,o,a,l,c,u,f,d]=vD(i,e,t,n);return Gl(Math.min(s,a,c,f),Math.min(o,l,u,d),Math.max(s,a,c,f),Math.max(o,l,u,d),r)}function vD(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,d=i[0],A=i[1];return[d-l+f,A-c-u,d-l-f,A-c+u,d+l-f,A+c+u,d+l+f,A+c-u,d-l+f,A-c-u]}function Lr(i){return i[3]-i[1]}function hh(i,e,t){let n=t||Wr();return Dr(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]):jm(n),n}function _D(i,e){if(!Dr(i,e))return[i.slice()];if(uh(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 Cc(i){return[i[0],i[3]]}function k1(i){return[i[2],i[3]]}function Kn(i){return i[2]-i[0]}function Dr(i,e){return i[0]<=e[2]&&i[2]>=e[0]&&i[1]<=e[3]&&i[3]>=e[1]}function fh(i){return i[2]<i[0]||i[3]<i[1]}function QH(i,e){return e?(e[0]=i[0],e[1]=i[1],e[2]=i[2],e[3]=i[3],e):i}function JH(i,e,t){let n=!1,r=NT(i,e),s=NT(i,t);if(r===Us.INTERSECTING||s===Us.INTERSECTING)n=!0;else{let o=i[0],a=i[1],l=i[2],c=i[3],u=e[0],f=e[1],d=t[0],A=t[1],y=(A-f)/(d-u),w,S;s&Us.ABOVE&&!(r&Us.ABOVE)&&(w=d-(A-c)/y,n=w>=o&&w<=l),!n&&s&Us.RIGHT&&!(r&Us.RIGHT)&&(S=A-(d-l)*y,n=S>=a&&S<=c),!n&&s&Us.BELOW&&!(r&Us.BELOW)&&(w=d-(A-a)/y,n=w>=o&&w<=l),!n&&s&Us.LEFT&&!(r&Us.LEFT)&&(S=A-(d-o)*y,n=S>=a&&S<=c)}return n}function eW(i,e,t,n){if(fh(i))return jm(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 Gfe(s,o,t)}function xD(i,e){let t=e.getExtent(),n=fl(i);if(e.canWrapX()&&(n[0]<t[0]||n[0]>=t[2])){let r=Kn(t),o=Math.floor((n[0]-t[0])/r)*r;i[0]-=o,i[2]-=o}return i}function kT(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]]];xD(i,e);let r=Kn(n);if(Kn(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 tW(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(..._D(t[o],e[n]));t=s}return t}var nW={info:1,warn:2,error:3,none:4},Hfe=nW.info;function zT(...i){Hfe>nW.warn||console.warn(...i)}function Si(i,e,t){return Math.min(Math.max(i,e),t)}function iW(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 du(i,e,t,n)}function du(i,e,t,n){let r=t-i,s=n-e;return r*r+s*s}function rW(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 VT(i){return i*180/Math.PI}function pu(i){return i*Math.PI/180}function dh(i,e){let t=i%e;return t*e<0?t+e:t}function Po(i,e,t){return i+t*(e-i)}function Ym(i,e){let t=Math.pow(10,e);return Math.round(i*t)/t}function vy(i,e){return Math.floor(Ym(i,e))}function _y(i,e){return Math.ceil(Ym(i,e))}function GT(i,e,t){if(i>=e&&i<t)return i;let n=t-e;return((i-e)%n+n)%n+e}function sW(i,e){return i[0]+=+e[0],i[1]+=+e[1],i}function Zm(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 z1(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 oW(i,e){return i[0]*=e,i[1]*=e,i}function qT(i,e){if(e.canWrapX()){let t=Kn(e.getExtent()),n=aW(i,e,t);n&&(i[0]-=n*t)}return i}function aW(i,e,t){let n=e.getExtent(),r=0;return e.canWrapX()&&(i[0]<n[0]||i[0]>n[2])&&(t=t||Kn(n),r=Math.floor((i[0]-n[0])/t)),r}function lW(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(Si(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 $f={radians:6370997/(2*Math.PI),degrees:2*Math.PI*6370997/360,ft:.3048,m:1,"us-ft":1200/3937};var yD=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_||$f[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_}},xp=yD;var xy=6378137,V1=Math.PI*xy,Wfe=[-V1,-V1,V1,V1],jfe=[-180,-85,180,85],HT=xy*Math.log(Math.tan(Math.PI/2)),yp=class extends xp{constructor(e){super({code:e,units:"m",extent:Wfe,global:!0,worldExtent:jfe,getPointResolution:function(t,n){return t/Math.cosh(n[1]/xy)}})}},bD=[new yp("EPSG:3857"),new yp("EPSG:102100"),new yp("EPSG:102113"),new yp("EPSG:900913"),new yp("http://www.opengis.net/def/crs/EPSG/0/3857"),new yp("http://www.opengis.net/gml/srs/epsg.xml#3857")];function cW(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]=V1*i[s]/180;let o=xy*Math.log(Math.tan(Math.PI*(+i[s+1]+90)/360));o>HT?o=HT:o<-HT&&(o=-HT),e[s+1]=o}return e}function uW(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]/V1,e[s+1]=360*Math.atan(Math.exp(i[s+1]/xy))/Math.PI-90;return e}var Xfe=6378137,hW=[-180,-90,180,90],$fe=Math.PI*Xfe/180,Yf=class extends xp{constructor(e,t){super({code:e,units:"degrees",extent:hW,axisOrientation:t,global:!0,metersPerUnit:$fe,worldExtent:hW})}},wD=[new Yf("CRS:84"),new Yf("EPSG:4326","neu"),new Yf("urn:ogc:def:crs:OGC:1.3:CRS84"),new Yf("urn:ogc:def:crs:OGC:2:84"),new Yf("http://www.opengis.net/def/crs/OGC/1.3/CRS84"),new Yf("http://www.opengis.net/gml/srs/epsg.xml#4326","neu"),new Yf("http://www.opengis.net/def/crs/EPSG/0/4326","neu")];var SD={};function fW(i){return SD[i]||SD[i.replace(/urn:(x-)?ogc:def:crs:EPSG:(.*:)?(\w+)$/,"EPSG:$3")]||null}function dW(i,e){SD[i]=e}function ph(i){for(let e in i)delete i[e]}function mu(i){let e;for(e in i)return!1;return!e}var G1={};function q1(i,e,t){let n=i.getCode(),r=e.getCode();n in G1||(G1[n]={}),G1[n][r]=t}function WT(i,e){return i in G1&&e in G1[i]?G1[i][e]:null}var jT=.9996,Rc=.00669438,$T=Rc*Rc,YT=$T*Rc,Km=Rc/(1-Rc),pW=Math.sqrt(1-Rc),H1=(1-pW)/(1+pW),vW=H1*H1,TD=vW*H1,ED=TD*H1,_W=ED*H1,xW=1-Rc/4-3*$T/64-5*YT/256,Yfe=3*Rc/8+3*$T/32+45*YT/1024,Zfe=15*$T/256+45*YT/1024,Kfe=35*YT/3072,Qfe=3/2*H1-27/32*TD+269/512*_W,Jfe=21/16*vW-55/32*ED,ede=151/96*TD-417/128*_W,tde=1097/512*ED,XT=6378137;function nde(i,e,t){let n=i-5e5,o=(t.north?e:e-1e7)/jT/(XT*xW),a=o+Qfe*Math.sin(2*o)+Jfe*Math.sin(4*o)+ede*Math.sin(6*o)+tde*Math.sin(8*o),l=Math.sin(a),c=l*l,u=Math.cos(a),f=l/u,d=f*f,A=d*d,y=1-Rc*c,w=Math.sqrt(1-Rc*c),S=XT/w,T=(1-Rc)/y,R=Km*u**2,P=R*R,I=n/(S*jT),F=I*I,D=F*I,L=D*I,C=L*I,B=C*I,k=a-f/T*(F/2-L/24*(5+3*d+10*R-4*P-9*Km))+B/720*(61+90*d+298*R+45*A-252*Km-3*P),z=(I-D/6*(1+2*d+R)+C/120*(5-2*R+28*d-3*P+8*Km+24*A))/u;return z=GT(z+pu(yW(t.number)),-Math.PI,Math.PI),[VT(z),VT(k)]}var mW=-80,AW=84,ide=-180,rde=180;function sde(i,e,t){i=GT(i,ide,rde),e<mW?e=mW:e>AW&&(e=AW);let n=pu(e),r=Math.sin(n),s=Math.cos(n),o=r/s,a=o*o,l=a*a,c=pu(i),u=yW(t.number),f=pu(u),d=XT/Math.sqrt(1-Rc*r**2),A=Km*s**2,y=s*GT(c-f,-Math.PI,Math.PI),w=y*y,S=w*y,T=S*y,R=T*y,P=R*y,I=XT*(xW*n-Yfe*Math.sin(2*n)+Zfe*Math.sin(4*n)-Kfe*Math.sin(6*n)),F=jT*d*(y+S/6*(1-a+A)+R/120*(5-18*a+l+72*A-58*Km))+5e5,D=jT*(I+d*o*(w/2+T/24*(5-a+9*A+4*A**2)+P/720*(61-58*a+l+600*A-330*Km)));return t.north||(D+=1e7),[F,D]}function yW(i){return(i-1)*6-180+3}var ode=[/^EPSG:(\d+)$/,/^urn:ogc:def:crs:EPSG::(\d+)$/,/^http:\/\/www\.opengis\.net\/def\/crs\/EPSG\/0\/(\d+)$/];function bW(i){let e=0;for(let r of ode){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 gW(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 wW(i){return bW(i)?new xp({code:i,units:"m"}):null}function SW(i){let e=bW(i.getCode());return e?{forward:gW(sde,e),inverse:gW(nde,e)}:null}var ade=63710088e-1;function MD(i,e,t){t=t||ade;let n=pu(i[1]),r=pu(e[1]),s=(r-n)/2,o=pu(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 lde=[SW],cde=[wW];var RD=!0;function EW(i){RD=!(i===void 0?!0:i)}function PD(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 ID(i){dW(i.getCode(),i),q1(i,i,PD)}function ude(i){i.forEach(ID)}function ks(i){if(typeof i!="string")return i;let e=fW(i);if(e)return e;for(let t of cde){let n=t(i);if(n)return n}return null}function LD(i,e,t,n){i=ks(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/$f[n])}}else{let o=i.getUnits();if(o=="degrees"&&!n||n=="degrees")r=e;else{let a=Qm(i,ks("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=MD(c.slice(0,2),c.slice(2,4)),f=MD(c.slice(4,6),c.slice(6,8));r=(u+f)/2}let l=n?$f[n]:i.getMetersPerUnit();l!==void 0&&(r/=l)}}return r}function TW(i){ude(i),i.forEach(function(e){i.forEach(function(t){e!==t&&q1(e,t,PD)})})}function hde(i,e,t,n){i.forEach(function(r){e.forEach(function(s){q1(r,s,t),q1(s,r,n)})})}function ZT(i,e){return i?typeof i=="string"?ks(i):i:ks(e)}function MW(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 W1(i,e){if(i===e)return!0;let t=i.getUnits()===e.getUnits();return(i.getCode()===e.getCode()||Qm(i,e)===PD)&&t}function Qm(i,e){let t=i.getCode(),n=e.getCode(),r=WT(t,n);if(r)return r;let s=null,o=null;for(let l of lde)s||(s=l(i)),o||(o=l(e));if(!s&&!o)return null;let a="EPSG:4326";if(o)if(s)r=CD(s.inverse,o.forward);else{let l=WT(t,a);l&&(r=CD(l,o.forward))}else{let l=WT(a,n);l&&(r=CD(s.inverse,l))}return r&&(ID(i),ID(e),q1(i,e,r)),r}function CD(i,e){return function(t,n,r,s){return n=i(t,n,r,s),e(n,n,r,s)}}function Jm(i,e){let t=ks(i),n=ks(e);return Qm(t,n)}function j1(i,e,t){let n=Jm(e,t);if(!n){let r=ks(e).getCode(),s=ks(t).getCode();throw new Error(`No transform available between ${r} and ${s}`)}return n(i,void 0,i.length)}function CW(i,e,t,n){let r=Jm(e,t);return eW(i,r,void 0,n)}var Au=null;function eA(){return Au}function yy(i,e){return Au?j1(i,e,Au):i}function gu(i,e){return Au?j1(i,Au,e):(RD&&!Zm(i,[0,0])&&i[0]>=-180&&i[0]<=180&&i[1]>=-90&&i[1]<=90&&(RD=!1,zT("Call useGeographic() from ol/proj once to work with [longitude, latitude] coordinates.")),i)}function bp(i,e){return Au?CW(i,e,Au):i}function vu(i,e){return Au?CW(i,Au,e):i}function RW(i,e){if(!Au)return i;let t=ks(e).getMetersPerUnit(),n=Au.getMetersPerUnit();return t&&n?i*t/n:i}function fde(){TW(bD),TW(wD),hde(wD,bD,cW,uW)}fde();function DD(i){return i[0]>0&&i[1]>0}function IW(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 ls(i,e){return Array.isArray(i)?i:(e===void 0?e=[i,i]:(e[0]=i,e[1]=i),e)}var KT=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 tA(i,e,t,n,r){return r!==void 0?(r.minX=i,r.maxX=e,r.minY=t,r.maxY=n,r):new KT(i,e,t,n)}var QT=KT;function PW(i,e,t){let n,r;t=t||dl;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 dl(i,e){return i>e?1:i<e?-1:0}function LW(i,e){return i<e?1:i>e?-1:0}function X1(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 DW(i,e,t){for(;e<t;){let n=i[e];i[e]=i[t],i[t]=n,++e,--t}}function Lo(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 ea(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 NW(i,e,t){let n=e||dl;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 jn(i,e){if(!i)throw new Error(e)}function FW(i,e,t,n,r){return!UT(r,function(o){return!wp(i,e,t,n,o[0],o[1])})}function wp(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 by(i,e,t,n,r,s){if(t.length===0||!wp(i,e,t[0],n,r,s))return!1;for(let o=1,a=t.length;o<a;++o)if(wp(i,t[o-1],t[o],n,r,s))return!1;return!0}function BW(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(by(i,e,l,n,r,s))return!0;e=l[l.length-1]}return!1}function JT(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 nA(i,e,t,n,r,s){return s=s??gD(Wr(),i,e,t,n),Dr(r,s)?s[0]>=r[0]&&s[2]<=r[2]||s[1]>=r[1]&&s[3]<=r[3]?!0:JT(i,e,t,n,function(o,a){return JH(r,o,a)}):!1}function OW(i,e,t,n,r){for(let s=0,o=t.length;s<o;++s){if(nA(i,e,t[s],n,r))return!0;e=t[s]}return!1}function ND(i,e,t,n,r){return!!(nA(i,e,t,n,r)||wp(i,e,t,n,r[0],r[1])||wp(i,e,t,n,r[0],r[3])||wp(i,e,t,n,r[2],r[1])||wp(i,e,t,n,r[2],r[3]))}function FD(i,e,t,n,r){if(!ND(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(FW(i,t[s-1],t[s],n,r)&&!nA(i,t[s-1],t[s],n,r))return!1;return!0}function UW(i,e,t,n,r){for(let s=0,o=t.length;s<o;++s){let a=t[s];if(FD(i,e,a,n,r))return!0;e=a[a.length-1]}return!1}function ei(){throw new Error("Unimplemented abstract method.")}var dde=0;function Bn(i){return i.ol_uid||(i.ol_uid=String(++dde))}function $1(i,e,t,n){return n!==void 0?(n[0]=i,n[1]=e,n[2]=t,n):[i,e,t]}function pde(i,e,t){return i+"/"+e+"/"+t}function Y1(i,e,t,n,r){return`${Bn(i)},${e},${pde(t,n,r)}`}function kW(i){return mde(i[0],i[1],i[2])}function mde(i,e,t){return(e<<i)+t}function zW(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 Z1=[0,0,0],Sp=5,BD=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,jn(NW(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,jn(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_=Cc(s)),jn(!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,jn(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,jn(!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 QT(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=tA(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 tA(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 tA(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 tA(c,c,u,u,n);let f=Math.floor(l*(s+1))-1,d=Math.floor(l*(o+1))-1;return tA(c,f,u,d,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,Z1);let r=Z1[1],s=Z1[2];this.getTileCoordForXYAndZ_(e[2],e[1],t,!0,Z1);let o=Z1[1],a=Z1[2];return tA(r,o,s,a,n)}getTileCoordCenter(e){let t=this.getOrigin(e[0]),n=this.getResolution(e[0]),r=ls(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=ls(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 Gl(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=ls(this.getTileSize(o),this.tmpSize_),u=a*(e-l[0])/n/c[0],f=a*(l[1]-t)/n/c[1];return r?(u=_y(u,Sp)-1,f=_y(f,Sp)-1):(u=vy(u,Sp),f=vy(f,Sp)),$1(o,u,f,s)}getTileCoordForXYAndZ_(e,t,n,r,s){let o=this.getOrigin(n),a=this.getResolution(n),l=ls(this.getTileSize(n),this.tmpSize_),c=(e-o[0])/a/l[0],u=(o[1]-t)/a/l[1];return r?(c=_y(c,Sp)-1,u=_y(u,Sp)-1):(c=vy(c,Sp),u=vy(u,Sp)),$1(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=X1(this.resolutions_,e,t||0);return Si(n,this.minZoom,this.maxZoom)}tileCoordIntersectsViewport(e,t){return ND(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}},wy=BD;function eE(i){let e=i.getDefaultTileGrid();return e||(e=gde(i),i.setDefaultTileGrid(e)),e}function GW(i,e,t){let n=e[0],r=i.getTileCoordCenter(e),s=tE(t);if(!fu(s,r)){let o=Kn(s),a=Math.ceil((s[0]-r[0])/o);return r[0]+=o*a,i.getTileCoordForCoordAndZ(r,n)}return e}function Ade(i,e,t,n){n=n!==void 0?n:"top-left";let r=HW(i,e,t);return new wy({extent:i,origin:KH(i,n),resolutions:r,tileSize:t})}function qW(i){let e=i||{},t=e.extent||ks("EPSG:3857").getExtent(),n={extent:t,minZoom:e.minZoom,tileSize:e.tileSize,resolutions:HW(t,e.maxZoom,e.tileSize,e.maxResolution)};return new wy(n)}function HW(i,e,t,n){e=e!==void 0?e:42,t=ls(t!==void 0?t:256);let r=Lr(i),s=Kn(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 gde(i,e,t,n){let r=tE(i);return Ade(r,e,t,n)}function tE(i){i=ks(i);let e=i.getExtent();if(!e){let t=180*$f.degrees/i.getMetersPerUnit();e=Gl(-t,-t,t,t)}return e}var In={IDLE:0,LOADING:1,LOADED:2,ERROR:3,EMPTY:4};function qn(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 K1(i,e,t,n){return qn(i,e,t,n,!0)}function li(i){i&&i.target&&(i.target.removeEventListener(i.type,i.listener),ph(i))}var rn={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 OD=class{constructor(){this.disposed=!1}dispose(){this.disposed||(this.disposed=!0,this.disposeInternal())}disposeInternal(){}},Tp=OD;function Zf(){return!0}function Kf(){return!1}function Qf(){}function nE(i){let e,t,n;return function(){let r=Array.prototype.slice.call(arguments);return(!t||this!==n||!ea(r,t))&&(n=this,t=r,e=i.apply(this,arguments)),e}}function WW(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 UD=class{constructor(e){this.propagationStopped,this.defaultPrevented,this.type=e,this.target=null}preventDefault(){this.defaultPrevented=!0}stopPropagation(){this.propagationStopped=!0}};var Ao=UD;var kD=class extends Tp{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 Ao(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,Qf);delete o[n]}return l}disposeInternal(){this.listeners_&&ph(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]=Qf,++this.pendingRemovals_[e]):(n.splice(r,1),n.length===0&&delete this.listeners_[e]))}},Ep=kD;var iA=typeof navigator<"u"&&typeof navigator.userAgent<"u"?navigator.userAgent.toLowerCase():"",vde=iA.includes("safari")&&!iA.includes("chrom"),mBe=vde&&(iA.includes("version/15.4")||/cpu (os|iphone os) 15_4 like mac os x/.test(iA)),jW=iA.includes("webkit")&&!iA.includes("edge"),zD=iA.includes("macintosh"),XW=typeof devicePixelRatio<"u"?devicePixelRatio:1,io=typeof WorkerGlobalScope<"u"&&typeof OffscreenCanvas<"u"&&self instanceof WorkerGlobalScope,VD=typeof Image<"u"&&Image.prototype.decode;var iE=(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 $W(i,e,t){let n=i,r=!0,s=!1,o=!1,a=[K1(n,rn.LOAD,function(){o=!0,s||e()})];return n.src&&VD?(s=!0,n.decode().then(function(){r&&e()}).catch(function(l){r&&(o?e():t())})):a.push(K1(n,rn.ERROR,t)),function(){r=!1,a.forEach(li)}}function _de(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 YW(i,e){return e&&(i.src=e),i.src&&VD?new Promise((t,n)=>i.decode().then(()=>t(i)).catch(r=>i.complete&&i.width?t(i):n(r))):_de(i)}var an={IDLE:0,LOADING:1,LOADED:2,ERROR:3,EMPTY:4};function GD(i){return Math.pow(i,3)}function Ic(i){return 1-GD(1-i)}function ZW(i){return 3*i*i-2*i*i*i}function KW(i){return i}var qD=class extends Ep{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(rn.CHANGE)}release(){this.setState(an.EMPTY)}getKey(){return this.key+"/"+this.tileCoord}getTileCoord(){return this.tileCoord}getState(){return this.state}setState(e){if(this.state!==an.EMPTY){if(this.state!==an.ERROR&&this.state>e)throw new Error("Tile load sequence violation");this.state=e,this.changed()}}load(){ei()}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:GD(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()}},Q1=qD;function Di(i,e,t,n){let r;return t&&t.length?r=t.shift():io?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 HD;function Sy(){return HD||(HD=Di(1,1)),HD}function rA(i){let e=i.canvas;e.width=1,e.height=1,i.clearRect(0,0,1,1)}function WD(i,e){let t=e.parentNode;t&&t.replaceChild(i,e)}function QW(i){for(;i.lastChild;)i.lastChild.remove()}function JW(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 rE(){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 ql(i){return typeof HTMLCanvasElement<"u"&&i instanceof HTMLCanvasElement||typeof OffscreenCanvas<"u"&&i instanceof OffscreenCanvas}var jD=class extends Q1{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_,io?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=an.LOADED,this.unlistenImage_(),this.changed()}getCrossOrigin(){return this.crossOrigin_}getReferrerPolicy(){return this.referrerPolicy_}handleImageError_(){this.state=an.ERROR,this.unlistenImage_(),this.image_=xde(),this.changed()}handleImageLoad_(){if(io)this.state=an.LOADED;else{let e=this.image_;e.naturalWidth&&e.naturalHeight?this.state=an.LOADED:this.state=an.EMPTY}this.unlistenImage_(),this.changed()}load(){this.state==an.ERROR&&(this.state=an.IDLE,this.image_=new Image,this.crossOrigin_!==null&&(this.image_.crossOrigin=this.crossOrigin_),this.referrerPolicy_!==void 0&&(this.image_.referrerPolicy=this.referrerPolicy_)),this.state==an.IDLE&&(this.state=an.LOADING,this.changed(),this.tileLoadFunction_(this,this.src_),this.unlisten_=$W(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 xde(){let i=Di(1,1);return i.fillStyle="rgba(0,0,0,0)",i.fillRect(0,0,1,1),i.canvas}var sE=jD;var XD,sA=[];function ej(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 $D(i,e){return Math.abs(i[e*4]-210)>2||Math.abs(i[e*4+3]-.75*255)>2}function yde(){if(XD===void 0){let i=Di(6,6,sA);i.globalCompositeOperation="lighter",i.fillStyle="rgba(210, 0, 0, 0.75)",ej(i,4,5,4,0),ej(i,4,5,0,5);let e=i.getImageData(0,0,3,3).data;XD=$D(e,0)||$D(e,4)||$D(e,8),rA(i),sA.push(i.canvas)}return XD}function tj(i,e,t,n){let r=j1(t,e,i),s=LD(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||fu(l,r)){let c=LD(i,s,r)/s;isFinite(c)&&c>0&&(s/=c)}return s}function nj(i,e,t,n){let r=fl(t),s=tj(i,e,r,n);return(!isFinite(s)||s<=0)&&UT(t,function(o){return s=tj(i,e,o,n),isFinite(s)&&s>0}),s}function ij(i,e,t,n,r,s,o,a,l,c,u,f,d,A){let y=Di(Math.round(t*i),Math.round(t*e),sA);if(f||(y.imageSmoothingEnabled=!1),l.length===0)return y.canvas;y.scale(t,t);function w(F){return Math.round(F*t)/t}y.globalCompositeOperation="lighter";let S=Wr();l.forEach(function(F,D,L){OT(S,F.extent)});let T,R=t/n,P=(f?1:1+Math.pow(2,-24))/R;if(!d||l.length!==1||c!==0){if(T=Di(Math.round(Kn(S)*R),Math.round(Lr(S)*R),sA),f||(T.imageSmoothingEnabled=!1),r&&A){let F=(r[0]-S[0])*R,D=-(r[3]-S[3])*R,L=Kn(r)*R,C=Lr(r)*R;T.rect(F,D,L,C),T.clip()}l.forEach(function(F,D,L){if(F.image.width>0&&F.image.height>0){if(F.clipExtent){T.save();let G=(F.clipExtent[0]-S[0])*R,W=-(F.clipExtent[3]-S[3])*R,Y=Kn(F.clipExtent)*R,H=Lr(F.clipExtent)*R;T.rect(f?G:Math.round(G),f?W:Math.round(W),f?Y:Math.round(G+Y)-Math.round(G),f?H:Math.round(W+H)-Math.round(W)),T.clip()}let C=(F.extent[0]-S[0])*R,B=-(F.extent[3]-S[3])*R,k=Kn(F.extent)*R,z=Lr(F.extent)*R;T.drawImage(F.image,c,c,F.image.width-2*c,F.image.height-2*c,f?C:Math.round(C),f?B:Math.round(B),f?k:Math.round(C+k)-Math.round(C),f?z:Math.round(B+z)-Math.round(B)),F.clipExtent&&T.restore()}})}let I=Cc(o);return a.getTriangles().forEach(function(F,D,L){let C=F.source,B=F.target,k=C[0][0],z=C[0][1],G=C[1][0],W=C[1][1],Y=C[2][0],H=C[2][1],$=w((B[0][0]-I[0])/s),J=w(-(B[0][1]-I[1])/s),te=w((B[1][0]-I[0])/s),ce=w(-(B[1][1]-I[1])/s),he=w((B[2][0]-I[0])/s),ve=w(-(B[2][1]-I[1])/s),Re=k,Qe=z;k=0,z=0,G-=Re,W-=Qe,Y-=Re,H-=Qe;let Fe=[[G,W,0,0,te-$],[Y,H,0,0,he-$],[0,0,G,W,ce-J],[0,0,Y,H,ve-J]],mt=rW(Fe);if(!mt)return;if(y.save(),y.beginPath(),yde()||!f){y.moveTo(te,ce);let Ve=4,Ye=$-te,Mt=J-ce;for(let Et=0;Et<Ve;Et++)y.lineTo(te+w((Et+1)*Ye/Ve),ce+w(Et*Mt/(Ve-1))),Et!=Ve-1&&y.lineTo(te+w((Et+1)*Ye/Ve),ce+w((Et+1)*Mt/(Ve-1)));y.lineTo(he,ve)}else y.moveTo(te,ce),y.lineTo($,J),y.lineTo(he,ve);y.clip(),y.transform(mt[0],mt[2],mt[1],mt[3],$,J),y.translate(S[0]-Re,S[3]-Qe);let Ee;if(T)Ee=T.canvas,y.scale(P,-P);else{let Ve=l[0],Ye=Ve.extent;Ee=Ve.image,y.scale(Kn(Ye)/Ee.width,-Lr(Ye)/Ee.height)}y.drawImage(Ee,0,0),y.restore()}),T&&(rA(T),sA.push(T.canvas)),u&&(y.save(),y.globalCompositeOperation="source-over",y.strokeStyle="black",y.lineWidth=1,a.getTriangles().forEach(function(F,D,L){let C=F.target,B=(C[0][0]-I[0])/s,k=-(C[0][1]-I[1])/s,z=(C[1][0]-I[0])/s,G=-(C[1][1]-I[1])/s,W=(C[2][0]-I[0])/s,Y=-(C[2][1]-I[1])/s;y.beginPath(),y.moveTo(z,G),y.lineTo(B,k),y.lineTo(W,Y),y.closePath(),y.stroke()}),y.restore()),y.canvas}var bde=[1,0,0,1,0,0],WBe=new Array(6);function go(){return bde.slice(0)}function rj(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 jr(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 Do(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 aE(i,e){let t=wde(e);jn(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 wde(i){return i[0]*i[3]-i[1]*i[2]}var Sde=[1e5,1e5,1e5,1e5,2,2];function sj(i){return"matrix("+i.join(", ")+")"}function oE(i){return i.substring(7,i.length-1).split(",").map(parseFloat)}function oj(i,e){let t=oE(i),n=oE(e);for(let r=0;r<6;++r)if(Math.round((t[r]-n[r])*Sde[r])!==0)return!1;return!0}var Tde=10,aj=.25,YD=class{constructor(e,t,n,r,s,o,a){this.sourceProj_=e,this.targetProj_=t;let l={},c=a?MW(P=>jr(a,j1(P,this.targetProj_,this.sourceProj_))):Jm(this.targetProj_,this.sourceProj_);this.transformInv_=function(P){let I=P[0]+"/"+P[1];return l[I]||(l[I]=c(P)),l[I]},this.maxSourceExtent_=r,this.errorThresholdSquared_=s*s,this.triangles_=[],this.wrapsXInSource_=!1,this.canWrapXInSource_=this.sourceProj_.canWrapX()&&!!r&&!!this.sourceProj_.getExtent()&&Kn(r)>=Kn(this.sourceProj_.getExtent()),this.sourceWorldWidth_=this.sourceProj_.getExtent()?Kn(this.sourceProj_.getExtent()):null,this.targetWorldWidth_=this.targetProj_.getExtent()?Kn(this.targetProj_.getExtent()):null;let u=Cc(n),f=k1(n),d=U1(n),A=O1(n),y=this.transformInv_(u),w=this.transformInv_(f),S=this.transformInv_(d),T=this.transformInv_(A),R=Tde+(o?Math.max(0,Math.ceil(Math.log2(Ay(n)/(o*o*256*256)))):0);if(this.addQuad_(u,f,d,A,y,w,S,T,R),this.wrapsXInSource_){let P=1/0;this.triangles_.forEach(function(I,F,D){P=Math.min(P,I.source[0][0],I.source[1][0],I.source[2][0])}),this.triangles_.forEach(I=>{if(Math.max(I.source[0][0],I.source[1][0],I.source[2][0])-P>this.sourceWorldWidth_/2){let F=[[I.source[0][0],I.source[0][1]],[I.source[1][0],I.source[1][1]],[I.source[2][0],I.source[2][1]]];F[0][0]-P>this.sourceWorldWidth_/2&&(F[0][0]-=this.sourceWorldWidth_),F[1][0]-P>this.sourceWorldWidth_/2&&(F[1][0]-=this.sourceWorldWidth_),F[2][0]-P>this.sourceWorldWidth_/2&&(F[2][0]-=this.sourceWorldWidth_);let D=Math.min(F[0][0],F[1][0],F[2][0]);Math.max(F[0][0],F[1][0],F[2][0])-D<this.sourceWorldWidth_/2&&(I.source=F)}})}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=AD([s,o,a,l]),f=this.sourceWorldWidth_?Kn(u)/this.sourceWorldWidth_:null,d=this.sourceWorldWidth_,A=this.sourceProj_.canWrapX()&&f>.5&&f<1,y=!1;if(c>0){if(this.targetProj_.isGlobal()&&this.targetWorldWidth_){let S=AD([e,t,n,r]);y=Kn(S)/this.targetWorldWidth_>aj||y}!A&&this.sourceProj_.isGlobal()&&f&&(y=f>aj||y)}if(!y&&this.maxSourceExtent_&&isFinite(u[0])&&isFinite(u[1])&&isFinite(u[2])&&isFinite(u[3])&&!Dr(u,this.maxSourceExtent_))return;let w=0;if(!y&&(!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)y=!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(!y){let S=[(e[0]+n[0])/2,(e[1]+n[1])/2],T=this.transformInv_(S),R;A?R=(dh(s[0],d)+dh(a[0],d))/2-dh(T[0],d):R=(s[0]+a[0])/2-T[0];let P=(s[1]+a[1])/2-T[1];y=R*R+P*P>this.errorThresholdSquared_}if(y){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(A){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=Wr();return this.triangles_.forEach(function(t,n,r){let s=t.source;$m(e,s[0]),$m(e,s[1]),$m(e,s[2])}),e}getTriangles(){return this.triangles_}},lj=YD;var ZD=class extends Q1{constructor(e,t,n,r,s,o,a,l,c,u,f,d){super(s,an.IDLE,d),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 A=r.getTileCoordExtent(this.wrappedTileCoord_),y=this.targetTileGrid_.getExtent(),w=this.sourceTileGrid_.getExtent(),S=y?hh(A,y):A;if(Ay(S)===0){this.state=an.EMPTY;return}let T=e.getExtent();T&&(w?w=hh(w,T):w=T);let R=r.getResolution(this.wrappedTileCoord_[0]),P=nj(e,n,S,R);if(!isFinite(P)||P<=0){this.state=an.EMPTY;return}let I=u!==void 0?u:.5;if(this.triangulation_=new lj(e,n,S,w,P*I,R),this.triangulation_.getTriangles().length===0){this.state=an.EMPTY;return}this.sourceZ_=t.getZForResolution(P);let F=this.triangulation_.calculateSourceExtent();if(w&&(e.canWrapX()?(F[1]=Si(F[1],w[1],w[3]),F[3]=Si(F[3],w[1],w[3])):F=hh(F,w)),!Ay(F))this.state=an.EMPTY;else{let D=0,L=0;e.canWrapX()&&(D=Kn(T),L=Math.floor((F[0]-T[0])/D)),kT(F.slice(),e,!0).forEach(B=>{let k=t.getTileRangeForExtentAndZ(B,this.sourceZ_);for(let z=k.minX;z<=k.maxX;z++)for(let G=k.minY;G<=k.maxY;G++){let W=L*D;this.sourceTiles_.push({getTile:()=>c(this.sourceZ_,z,G,a),offset:W})}++L}),this.sourceTiles_.length===0&&(this.state=an.EMPTY)}}getImage(){return this.canvas_}reproject_(){let e=[];if(this.sourceTiles_.forEach(t=>{let n=t.tile;if(n&&n.getState()==an.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=an.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_=ij(r,s,this.pixelRatio_,a,this.sourceTileGrid_.getExtent(),o,l,this.triangulation_,e,this.gutter_,this.renderEdges_,this.interpolate),this.state=an.LOADED}this.changed()}load(){for(let e of this.sourceTiles_)e.tile=e.getTile();if(this.state==an.IDLE){this.state=an.LOADING,this.changed();let e=0;this.sourcesListenerKeys_=[],this.sourceTiles_.forEach(({tile:t})=>{let n=t.getState();if(n==an.IDLE||n==an.LOADING){e++;let r=qn(t,rn.CHANGE,s=>{let o=t.getState();(o==an.LOADED||o==an.ERROR||o==an.EMPTY)&&(li(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()==an.IDLE&&t.load()})}}unlistenSources_(){this.sourcesListenerKeys_.forEach(li),this.sourcesListenerKeys_=null}release(){this.canvas_&&(rA(this.canvas_.getContext("2d")),sA.push(this.canvas_),this.canvas_=null),this.sourceTiles_.length=0,super.release()}},lE=ZD;var Ede=/\{z\}/g,Mde=/\{x\}/g,Cde=/\{y\}/g,Rde=/\{-y\}/g;function cj(i,e,t,n,r){return i.replace(Ede,e.toString()).replace(Mde,t.toString()).replace(Cde,n.toString()).replace(Rde,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 uj(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 Ide(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 cj(i,o,t[1],t[2],s)})}function hj(i,e){let t=i.length,n=new Array(t);for(let r=0;r<t;++r)n[r]=Ide(i[r],e);return Pde(n)}function Pde(i){return i.length===1?i[0]:(function(e,t,n){if(!e)return;let r=kW(e),s=dh(r,i.length);return i[s](e,t,n)})}var _u={PROPERTYCHANGE:"propertychange"};var J1=class extends Ep{constructor(){super(),this.on=this.onInternal,this.once=this.onceInternal,this.un=this.unInternal,this.revision_=0}changed(){++this.revision_,this.dispatchEvent(rn.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]=qn(this,e[s],t);return r}return qn(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]=K1(this,e[s],t)}else n=K1(this,e,t);return t.ol_key=n,n}unInternal(e,t){let n=t.ol_key;if(n)Lde(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)}};J1.prototype.on;J1.prototype.once;J1.prototype.un;function Lde(i){if(Array.isArray(i))for(let e=0,t=i.length;e<t;++e)li(i[e]);else li(i)}var cE=J1;var uE=class extends Ao{constructor(e,t,n){super(e),this.key=t,this.oldValue=n}},KD=class extends cE{constructor(e){super(),this.on,this.once,this.un,Bn(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 uE(n,e,t)),n=_u.PROPERTYCHANGE,this.hasListener(n)&&this.dispatchEvent(new uE(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],mu(this.values_)&&(this.values_=null),t||this.notify(e,n)}}},zs=KD;var QD=class extends zs{constructor(e){super(),this.projection=ks(e.projection),this.attributions_=fj(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_=fj(e),this.changed()}setState(e){this.state_=e,this.changed()}};function fj(i){return i?typeof i=="function"?i:(Array.isArray(i)||(i=[i]),e=>i):null}var hE=QD;var JD=class extends hE{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&&ls(this.tileGrid.getTileSize(this.tileGrid.getMinZoom()),t),this.tmpSize=[0,0],this.key_=e.key||Bn(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 ei()}getTileGrid(){return this.tileGrid}getTileGridForProjection(e){return this.tileGrid?this.tileGrid:eE(e)}getTilePixelRatio(e){return this.tilePixelRatio_}getTilePixelSize(e,t,n){let r=this.getTileGridForProjection(n),s=this.getTilePixelRatio(t),o=ls(r.getTileSize(e),this.tmpSize);return s==1?o:IW(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=GW(r,e,n)),zW(e,r)?e:null}clear(){}refresh(){this.clear(),super.refresh()}},fE=class extends Ao{constructor(e,t){super(e),this.tile=t}},dj=JD;var dE={TILELOADSTART:"tileloadstart",TILELOADEND:"tileloadend",TILELOADERROR:"tileloaderror"};var eN=class i extends dj{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=Bn(t),r=t.getState(),s;r==an.LOADING?(this.tileLoadingKeys_[n]=!0,s=dE.TILELOADSTART):n in this.tileLoadingKeys_&&(delete this.tileLoadingKeys_[n],s=r==an.ERROR?dE.TILELOADERROR:r==an.LOADED?dE.TILELOADEND:void 0),s!=null&&this.dispatchEvent(new fE(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=uj(e);this.urls=t,this.setUrls(t)}setUrls(e){this.urls=e;let t=e.join(`3-`);this.generateTileUrlFunction_?this.setTileUrlFunction(hj(e,this.tileGrid),t):this.setKey(t)}tileUrlFunction(e,t,n){}},pj=eN;var tN=class extends pj{constructor(e){super({attributions:e.attributions,cacheSize:e.cacheSize,projection:e.projection,state:e.state,tileGrid:e.tileGrid,tileLoadFunction:e.tileLoadFunction?e.tileLoadFunction:Dde,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:sE,this.tileGridForProjection={},this.reprojectionErrorThreshold_=e.reprojectionErrorThreshold,this.renderReprojectionEdges_=!1}getGutterForProjection(e){return this.getProjection()&&e&&!W1(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||W1(t,e)))return this.tileGrid;let n=Bn(e);return n in this.tileGridForProjection||(this.tileGridForProjection[n]=eE(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?an.IDLE:an.EMPTY,c!==void 0?c:"",{crossOrigin:this.crossOrigin,referrerPolicy:this.referrerPolicy},this.tileLoadFunction,this.tileOptions);return u.key=o,u.addEventListener(rn.CHANGE,this.handleTileChange.bind(this)),u}getTile(e,t,n,r,s,o){let a=this.getProjection();if(!a||!s||W1(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),d=this.getTileCoordForTileUrlFunction(l,s),A=new lE(a,u,s,f,l,d,this.getTilePixelRatio(r),this.getGutter(),(y,w,S,T)=>this.getTileInternal(y,w,S,T,a,o),this.reprojectionErrorThreshold_,this.renderReprojectionEdges_,this.tileOptions);return A.key=c,A}getTileInternal(e,t,n,r,s,o){let a=this.getKey(),l=Y1(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=ks(e);if(n){let r=Bn(n);r in this.tileGridForProjection||(this.tileGridForProjection[r]=t)}}};function Dde(i,e){if(io){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 mj=tN;var nN=class extends mj{constructor(e){e=e||{};let t=e.projection!==void 0?e.projection:"EPSG:3857",n=e.tileGrid!==void 0?e.tileGrid:qW({extent:tE(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_}},Aj=nN;function xu(){if(!U.world||!U.lens||U.settling)return;let i=U.engine?.getView();try{let e=gj();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(SL,JSON.stringify(e))}catch{}}function gj(){try{let i=JSON.parse(localStorage.getItem(SL)||"null");if(i&&i.volumes)return i}catch{}return{last:"",volumes:{}}}function ev(i){let e=gj(),t=i||e.last,n=t&&e.volumes[t];return n&&n.volume&&n.world?n:null}function tv(){let[i,e]=decodeURIComponent(location.hash.replace(/^#\/?/,"")).split("/").map(t=>t.trim());return{volume:i,world:e}}function vj(){if(!U.volume||!U.world)return;let i=`#${U.volume.slug}/${U.world.slug}`;location.hash!==i&&history.replaceState(null,"",i)}var iN=class i extends zs{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_&&(li(this.geometryChangeKey_),this.geometryChangeKey_=null);let e=this.getGeometry();e&&(this.geometryChangeKey_=qn(e,rn.CHANGE,this.handleGeometryChange_,this)),this.changed()}setGeometry(e){this.set(this.geometryName_,e)}setStyle(e){this.style_=e,this.styleFunction_=e?Nde(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 Nde(i){if(typeof i=="function")return i;let e;return Array.isArray(i)?e=i:(jn(typeof i.getZIndex=="function","Expected an `ol/style/Style` or an array of `ol/style/Style.js`"),e=[i]),function(){return e}}var Mp=iN;function pl(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 pE(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 d=e;d<t;d+=n){let A=i[d]-c,y=i[d+1]-u;o[f++]=c+A*a-y*l,o[f++]=u+A*l+y*a;for(let w=d+2;w<d+n;++w)o[f++]=i[w]}return o&&o.length!=f&&(o.length=f),o}function _j(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 d=i[f]-l,A=i[f+1]-c;a[u++]=l+r*d,a[u++]=c+s*A;for(let y=f+2;y<f+n;++y)a[u++]=i[y]}return a&&a.length!=u&&(a.length=u),a}function xj(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 yj=go(),Fde=[NaN,NaN],rN=class extends zs{constructor(){super(),this.extent_=Wr(),this.extentRevision_=-1,this.simplifiedGeometryMaxMinSquaredTolerance=0,this.simplifiedGeometryRevision=0,this.simplifyTransformedInternal=nE((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 ei()}closestPointXY(e,t,n,r){return ei()}containsXY(e,t){return this.closestPointXY(e,t,Fde,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 ei()}getExtent(e){if(this.extentRevision_!=this.getRevision()){let t=this.computeExtent(this.extent_);(isNaN(t[0])||isNaN(t[1]))&&jm(t),this.extentRevision_=this.getRevision()}return QH(this.extent_,e)}rotate(e,t){ei()}scale(e,t,n){ei()}simplify(e){return this.getSimplifiedGeometry(e*e)}getSimplifiedGeometry(e){return ei()}getType(){return ei()}applyTransform(e){ei()}intersectsExtent(e){return ei()}translate(e,t){ei()}transform(e,t){let n=ks(e),r=n.getUnits()=="tile-pixels"?function(s,o,a){let l=n.getExtent(),c=n.getWorldExtent(),u=Lr(c)/Lr(l);Do(yj,c[0],c[3],u,-u,0,0,0);let f=pl(s,0,s.length,a,yj,o),d=Jm(n,t);return d?d(f,f,a):f}:Jm(n,t);return this.applyTransform(r),this}},bj=rN;var sN=class extends bj{constructor(){super(),this.layout="XY",this.stride=2,this.flatCoordinates}computeExtent(e){return B1(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,e)}getCoordinates(){return ei()}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=wj(e),this.layout=e,this.flatCoordinates=t}setCoordinates(e,t){ei()}setLayout(e,t,n){let r;if(e)r=wj(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=Bde(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();pE(n,0,n.length,r,e,t,n),this.changed()}}scale(e,t,n){t===void 0&&(t=e),n||(n=fl(this.getExtent()));let r=this.getFlatCoordinates();if(r){let s=this.getStride();_j(r,0,r.length,s,e,t,n,r),this.changed()}}translate(e,t){let n=this.getFlatCoordinates();if(n){let r=this.getStride();xj(n,0,n.length,r,e,t,n),this.changed()}}};function Bde(i){let e;return i==2?e="XY":i==3?e="XYZ":i==4&&(e="XYZM"),e}function wj(i){let e;return i=="XY"?e=2:i=="XYZ"||i=="XYM"?e=3:i=="XYZM"&&(e=4),e}function Sj(i,e,t){let n=i.getFlatCoordinates();if(!n)return null;let r=i.getStride();return pl(n,0,n.length,r,e,t)}var ml=sN;function Tj(i,e,t,n){for(let r=0,s=t.length;r<s;++r)i[e++]=t[r];return e}function oA(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 Ty(i,e,t,n,r){r=r||[];let s=0;for(let o=0,a=t.length;o<a;++o){let l=oA(i,e,t[o],n);r[s++]=l,e=l}return r.length=s,r}function Ej(i,e,t,n,r){r=r||[];let s=0;for(let o=0,a=t.length;o<a;++o){let l=Ty(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 oN=class i extends ml{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=du(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 BT(this.flatCoordinates,e)}getType(){return"Point"}intersectsExtent(e){return my(e,this.flatCoordinates[0],this.flatCoordinates[1])}setCoordinates(e,t){this.setLayout(t,e,0),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=Tj(this.flatCoordinates,0,e,this.stride),this.changed()}},yu=oN;function aA(){return yq[U.world?.iconOutset==="dark"?"dark":"light"]}function Ode(i){let e=U.world?.iconOutset==="dark",t=kde(i);return(e?t>.3:t<.88)?i:Ude(i,e?.74:.42)}function Ude(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 d=(1-Math.abs(2*e-1))*f,A=d*(1-Math.abs(c/60%2-1)),y=e-d/2,[w,S,T]=c<60?[d,A,0]:c<120?[A,d,0]:c<180?[0,d,A]:c<240?[0,A,d]:c<300?[A,0,d]:[d,0,A],R=P=>Math.round((P+y)*255).toString(16).padStart(2,"0");return`#${R(w)}${R(S)}${R(T)}`}function kde(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 nv(i){let e=Math.abs(Number(i)||0);return qf[(Math.imul(e,2654435761)>>>0)%qf.length]}function Pc(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 iv(i,e){i.style.setProperty("--pin-color",lA(e))}function lA(i){return Ode(i.color||nv(i.id))}function rv(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("${aN(e.iconAsset)}")`),i.classList.add("has-source-icon")}function aN(i){let e=i.split("/").map(t=>encodeURIComponent(t)).join("/");return`${U.volume.base}/icons/${e}`}function bu(i){return i.split(/\s+/).slice(0,2).map(e=>e[0]||"").join("")}function Mj(i){return Math.imul(Number(i)||0,2654435761)>>>0}function lN(i){return String(i||"").replace(/\[([^\]]+)\]\([^)]+\)/g,"$1").replace(/[*_`>#]/g,"").replace(/\r/g,"").replace(/\n{3,}/g,`4-5-`).trim()}function wu(i){return new Intl.NumberFormat().format(i)}function cs(i,e,t){return Math.min(t,Math.max(e,i))}function mE(i){return i instanceof HTMLElement&&(i.matches("input, textarea, select")||i.isContentEditable)}var zde=100;function Jf(){if(!ge.searchResults)return;let i=U.pins.filter(n=>!n.filteredHidden).sort((n,r)=>n.location.title.localeCompare(r.location.title)),e=i.slice(0,zde),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),iv(r,n.category);let s=document.createElement("span");s.className="result-dot",rv(s,n.category,bu(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 ${wu(i.length)} \u2014 search or filter to narrow the list.`,t.append(n)}ge.searchResults.replaceChildren(t),Gde(i.length),Vde()}var Cj=28;function Vde(){let i=U.selectedPin?.location.title||"",e=i.length>Cj?`${i.slice(0,Cj-1).trimEnd()}\u2026`:i;ge.dockRailName.textContent=e?` \xB7 ${e}`:"",ge.dockRailName.hidden=!e}function Gde(i){ge.dockCount.textContent=`${wu(i)} ${i===1?"location":"locations"}`,U.search?(ge.dockFlag.textContent=`\u201C${U.search}\u201D`,ge.dockFlag.hidden=!1):U.hiddenCategories.size>0?(ge.dockFlag.textContent="filtered",ge.dockFlag.hidden=!1):ge.dockFlag.hidden=!0}function Ey(){!U.dockFolded||U.dockDismissed||AE(!1)}function cN(i){U.dockDismissed=i,AE(i)}function AE(i,e=!0){U.dockFolded=i,ge.dock.classList.toggle("is-folded",i),ge.dockFold.setAttribute("aria-expanded",String(!i));let t=i?"Bring the panel back (\u2318\u2325B)":"Put the panel away (\u2318\u2325B)";ge.dockFold.setAttribute("aria-label",t),ge.dockFold.setAttribute("title",t),e&&xu()}function uN(i){U.hiddenCategories.delete(i.category.id),Cy(),Lc(),Cp(),My(i,!0)}function My(i,e=!1){U.selectedPin=i,U.selectedZone=null,ge.detailCoordinatesField.hidden=!1,document.dispatchEvent(new Event("atlas:selection")),Dc(),U.layers.pins.changed(),U.layers.pinLabels.changed(),U.layers.text.changed(),U.layers.textDetail.changed(),U.layers.priority.changed(),ge.detailTitle.textContent=i.location.title,ge.detailCategory.textContent=`${i.group.title} / ${i.category.title}`,ge.detailDescription.textContent="",ge.detailLinks.hidden=!0,Wde(i),ge.detailID.textContent=String(i.location.id),ge.detailCoordinates.textContent=`${i.location.lat.toFixed(6)}, ${i.location.lng.toFixed(6)}`;let t=bq(i.coordinate);ge.detailCell.textContent=t,ge.detailCellField.hidden=!t;for(let r of ge.detail.querySelectorAll("[data-cell-system-row]"))r.remove();for(let r of py(U.world)){if(r.slug==="geohash")continue;let s=r.locate(i.coordinate,U.world);if(!s)continue;let o=document.createElement("div");o.dataset.cellSystemRow=r.slug;let a=document.createElement("dt");a.textContent=s.label;let l=document.createElement("dd");l.textContent=s.value,o.append(a,l),ge.detailCellField.after(o)}let n=Hde(i);if(ge.detailSource.textContent=n,ge.detailSourceField.hidden=!n,iv(ge.detailDot,i.category),rv(ge.detailDot,i.category,bu(i.category.title)),ge.detail.hidden=!1,Ey(),Jf(),e){let r=U.engine.getView();r.animate({center:i.coordinate,zoom:Math.min(mh(U.lens),Math.max(r.getZoom()||0,4)),duration:220})}}function Rj(i){U.selectedPin=null,U.selectedZone=i,document.dispatchEvent(new Event("atlas:selection")),Dc(),U.layers.pins.changed(),U.layers.priority.changed(),ge.detailTitle.textContent=i.title,ge.detailCategory.textContent=i.subtitle||"Zone",ge.detailDescription.textContent="",ge.detailLinks.hidden=!0,ge.detailLinks.replaceChildren(),ge.detailID.textContent=String(i.id),ge.detailCoordinatesField.hidden=!0,ge.detailCellField.hidden=!0;for(let t of ge.detail.querySelectorAll("[data-cell-system-row]"))t.remove();let e=U.world?.merged?.find(t=>t.origin)?.source||"";ge.detailSource.textContent=e,ge.detailSourceField.hidden=!e,ge.detailDot.textContent="",ge.detailDot.removeAttribute("style"),ge.detailDot.style.setProperty("background",nv(i.id)),i.hasText?qde(i):ge.detailDescription.textContent="No description is included in the archive.",ge.detail.hidden=!1,Ey(),Jf()}async function qde(i){let e=await hN();if(U.selectedZone!==i)return;let t=e[String(i.id)]||{};ge.detailDescription.textContent=lN(t.d)||"No description is included in the archive."}function Hde(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 Wde(i){let e=await hN();if(U.selectedPin!==i)return;let t=e[String(i.location.id)]||{};i.location.description=t.d||"",i.location.links=t.l||[],ge.detailDescription.textContent=lN(t.d)||"No description is included in the archive.",jde(i)}function jde(i){let e=(i.location.links||[]).filter(n=>U.pinByID.has(n.locationId));if(ge.detailLinks.hidden=e.length===0,!e.length){ge.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)}ge.detailLinks.replaceChildren(t)}function ed(){let i=U.selectedPin!==null||U.selectedZone!==null;U.selectedPin=null,U.selectedZone=null,document.dispatchEvent(new Event("atlas:selection")),U.sources&&(Dc(),U.layers.pins.changed(),U.layers.pinLabels.changed(),U.layers.text.changed(),U.layers.textDetail.changed(),U.layers.priority.changed()),ge.detail.hidden=!0,i&&Jf()}function Nc(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 Rp(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++]=Nc(i,e,l,n,r[s]),e=l}return r.length=s,r}function Ry(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?[]:Rp(i,e,l,n,r[s]),e=l[l.length-1]}return r.length=s,r}var fN=class i extends ml{constructor(e,t){super(),t&&!Array.isArray(e[0])?this.setFlatCoordinates(t,e):this.setCoordinates(e,t)}appendPoint(e){Lo(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<Mc(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=du(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 Nc(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getPoint(e){let t=this.flatCoordinates.length/this.stride;return e<0||t<=e?null:new yu(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 yu(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(my(e,o,a))return!0}return!1}setCoordinates(e,t){this.setLayout(t,e,1),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=oA(this.flatCoordinates,0,e,this.stride),this.changed()}},Ij=fN;function dN(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 pN(i,e,t,n){let r=0;for(let s=0,o=t.length;s<o;++s){let a=t[s];r+=dN(i,e,a,n),e=a}return r}function Pj(i,e,t,n){let r=0;for(let s=0,o=t.length;s<o;++s){let a=t[s];r+=pN(i,e,a,n),e=a[a.length-1]}return r}function Lj(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 d=((r-a)*c+(s-l)*u)/(c*c+u*u);if(d>1)f=t;else if(d>0){for(let A=0;A<n;++A)o[A]=Po(i[e+A],i[t+A],d);o.length=n;return}else f=e}for(let d=0;d<n;++d)o[d]=i[f+d];o.length=n}function Iy(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=du(s,o,a,l);c>r&&(r=c),s=a,o=l}return r}function Py(i,e,t,n,r){for(let s=0,o=t.length;s<o;++s){let a=t[s];r=Iy(i,e,a,n,r),e=a}return r}function Dj(i,e,t,n,r){for(let s=0,o=t.length;s<o;++s){let a=t[s];r=Py(i,e,a,n,r),e=a[a.length-1]}return r}function Ly(i,e,t,n,r,s,o,a,l,c,u){if(e==t)return c;let f,d;if(r===0){if(d=du(o,a,i[e],i[e+1]),d<c){for(f=0;f<n;++f)l[f]=i[e+f];return l.length=n,d}return c}u=u||[NaN,NaN];let A=e+n;for(;A<t;)if(Lj(i,A-n,A,n,o,a,u),d=du(o,a,u[0],u[1]),d<c){for(c=d,f=0;f<n;++f)l[f]=u[f];l.length=n,A+=n}else A+=n*Math.max((Math.sqrt(d)-Math.sqrt(c))/r|0,1);if(s&&(Lj(i,t-n,e,n,o,a,u),d=du(o,a,u[0],u[1]),d<c)){for(c=d,f=0;f<n;++f)l[f]=u[f];l.length=n}return c}function Dy(i,e,t,n,r,s,o,a,l,c,u){u=u||[NaN,NaN];for(let f=0,d=t.length;f<d;++f){let A=t[f];c=Ly(i,e,A,n,r,s,o,a,l,c,u),e=A}return c}function Nj(i,e,t,n,r,s,o,a,l,c,u){u=u||[NaN,NaN];for(let f=0,d=t.length;f<d;++f){let A=t[f];c=Dy(i,e,A,n,r,s,o,a,l,c,u),e=A[A.length-1]}return c}function cA(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(),d=c.pop(),A=0,y=i[d],w=i[d+1],S=i[f],T=i[f+1];for(let R=d+n;R<f;R+=n){let P=i[R],I=i[R+1],F=iW(P,I,y,w,S,T);F>A&&(u=R,A=F)}A>r&&(l[(u-e)/n]=1,d+n<u&&c.push(d,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 gE(i,e,t,n,r,s,o,a){for(let l=0,c=t.length;l<c;++l){let u=t[l];o=cA(i,e,u,n,r,s,o),a.push(o),e=u}return o}function Ip(i,e){return e*Math.round(i/e)}function Xde(i,e,t,n,r,s,o){if(e==t)return o;let a=Ip(i[e],r),l=Ip(i[e+1],r);e+=n,s[o++]=a,s[o++]=l;let c,u;do if(c=Ip(i[e],r),u=Ip(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=Ip(i[e],r),d=Ip(i[e+1],r);if(e+=n,f==c&&d==u)continue;let A=c-a,y=u-l,w=f-a,S=d-l;if(A*S==y*w&&(A<0&&w<A||A==w||A>0&&w>A)&&(y<0&&S<y||y==S||y>0&&S>y)){c=f,u=d;continue}s[o++]=c,s[o++]=u,a=c,l=u,c=f,u=d}return s[o++]=c,s[o++]=u,o}function Ny(i,e,t,n,r,s,o,a){for(let l=0,c=t.length;l<c;++l){let u=t[l];o=Xde(i,e,u,n,r,s,o),a.push(o),e=u}return o}function Fj(i,e,t,n,r,s,o,a){for(let l=0,c=t.length;l<c;++l){let u=t[l],f=[];o=Ny(i,e,u,n,r,s,o,f),a.push(f),e=u[u.length-1]}return o}var mN=class i extends ml{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<Mc(this.getExtent(),e,t)?r:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(Iy(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),Ly(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,this.maxDelta_,!0,e,t,n,r))}getArea(){return dN(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getCoordinates(){return Nc(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getSimplifiedGeometryInternal(e){let t=[];return t.length=cA(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,e,t,0),new i(t,"XY")}getType(){return"LinearRing"}intersectsExtent(e){return nA(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,e)}setCoordinates(e,t){this.setLayout(t,e,1),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=oA(this.flatCoordinates,0,e,this.stride),this.changed()}},AN=mN;function Fy(i,e,t,n,r,s,o){let a,l,c,u,f,d,A,y=r[s+1],w=[];for(let R=0,P=t.length;R<P;++R){let I=t[R];for(u=i[I-n],d=i[I-n+1],a=e;a<I;a+=n)f=i[a],A=i[a+1],(y<=d&&A<=y||d<=y&&y<=A)&&(c=(y-d)/(A-d)*(f-u)+u,w.push(c)),u=f,d=A}let S=NaN,T=-1/0;for(w.sort(dl),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,by(i,e,t,n,c,y)&&(S=c,T=R)),u=f}return isNaN(S)&&(S=r[s]),o?(o.push(S,y,T),o):[S,y,T]}function vE(i,e,t,n,r){let s=[];for(let o=0,a=t.length;o<a;++o){let l=t[o];s=Fy(i,e,l,n,r,2*o,s),e=l[l.length-1]}return s}function Bj(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 gN(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 vN(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=gN(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 Oj(i,e,t,n,r){for(let s=0,o=t.length;s<o;++s){let a=t[s];if(!vN(i,e,a,n,r))return!1;a.length&&(e=a[a.length-1])}return!0}function _E(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=gN(i,e,a,n);(s===0?r&&l||!r&&!l:r&&!l||!r&&l)&&Bj(i,e,a,n),e=a}return e}function _N(i,e,t,n,r){for(let s=0,o=t.length;s<o;++s)e=_E(i,e,t[s],n,r);return e}function Uj(i,e){let t=[],n=0,r=0,s;for(let o=0,a=e.length;o<a;++o){let l=e[o],c=gN(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 xE=class i extends ml{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?Lo(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<Mc(this.getExtent(),e,t)?r:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(Py(this.flatCoordinates,0,this.ends_,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),Dy(this.flatCoordinates,0,this.ends_,this.stride,this.maxDelta_,!0,e,t,n,r))}containsXY(e,t){return by(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,e,t)}getArea(){return pN(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride)}getCoordinates(e){let t;return e!==void 0?(t=this.getOrientedFlatCoordinates().slice(),_E(t,0,this.ends_,this.stride,e)):t=this.flatCoordinates,Rp(t,0,this.ends_,this.stride)}getEnds(){return this.ends_}getFlatInteriorPoint(){if(this.flatInteriorPointRevision_!=this.getRevision()){let e=fl(this.getExtent());this.flatInteriorPoint_=Fy(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,e,0),this.flatInteriorPointRevision_=this.getRevision()}return this.flatInteriorPoint_}getInteriorPoint(){return new yu(this.getFlatInteriorPoint(),"XYM")}getLinearRingCount(){return this.ends_.length}getLinearRing(e){return e<0||this.ends_.length<=e?null:new AN(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 AN(t.slice(s,l),e);r.push(c),s=l}return r}getOrientedFlatCoordinates(){if(this.orientedRevision_!=this.getRevision()){let e=this.flatCoordinates;vN(e,0,this.ends_,this.stride)?this.orientedFlatCoordinates_=e:(this.orientedFlatCoordinates_=e.slice(),this.orientedFlatCoordinates_.length=_E(this.orientedFlatCoordinates_,0,this.ends_,this.stride)),this.orientedRevision_=this.getRevision()}return this.orientedFlatCoordinates_}getSimplifiedGeometryInternal(e){let t=[],n=[];return t.length=Ny(this.flatCoordinates,0,this.ends_,this.stride,Math.sqrt(e),t,0,n),new i(t,"XY",n)}getType(){return"Polygon"}intersectsExtent(e){return FD(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,e)}setCoordinates(e,t){this.setLayout(t,e,2),this.flatCoordinates||(this.flatCoordinates=[]);let n=Ty(this.flatCoordinates,0,e,this.stride,this.ends_);this.flatCoordinates.length=n.length===0?0:n[n.length-1],this.changed()}},Ah=xE;function xN(i){if(fh(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 xE(s,"XY",[s.length])}function yE(i,e,t,n){let r=[],s=Wr();for(let o=0,a=t.length;o<a;++o){let l=t[o];s=B1(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 yN=class i extends ml{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 d=0,A=f.length;d<A;++d)f[d]+=u;Lo(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;Lo(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<Mc(this.getExtent(),e,t)?r:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(Dj(this.flatCoordinates,0,this.endss_,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),Nj(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,this.maxDelta_,!0,e,t,n,r))}containsXY(e,t){return BW(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,e,t)}getArea(){return Pj(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride)}getCoordinates(e){let t;return e!==void 0?(t=this.getOrientedFlatCoordinates().slice(),_N(t,0,this.endss_,this.stride,e)):t=this.flatCoordinates,Ry(t,0,this.endss_,this.stride)}getEndss(){return this.endss_}getFlatInteriorPoints(){if(this.flatInteriorPointsRevision_!=this.getRevision()){let e=yE(this.flatCoordinates,0,this.endss_,this.stride);this.flatInteriorPoints_=vE(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,e),this.flatInteriorPointsRevision_=this.getRevision()}return this.flatInteriorPoints_}getInteriorPoints(){return new Ij(this.getFlatInteriorPoints().slice(),"XYM")}getOrientedFlatCoordinates(){if(this.orientedRevision_!=this.getRevision()){let e=this.flatCoordinates;Oj(e,0,this.endss_,this.stride)?this.orientedFlatCoordinates_=e:(this.orientedFlatCoordinates_=e.slice(),this.orientedFlatCoordinates_.length=_N(this.orientedFlatCoordinates_,0,this.endss_,this.stride)),this.orientedRevision_=this.getRevision()}return this.orientedFlatCoordinates_}getSimplifiedGeometryInternal(e){let t=[],n=[];return t.length=Fj(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 Ah(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,d=l.length;f<d;++f)l[f]-=s;let u=new Ah(t.slice(s,c),e,l);r.push(u),s=c}return r}getType(){return"MultiPolygon"}intersectsExtent(e){return UW(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,e)}setCoordinates(e,t){this.setLayout(t,e,3),this.flatCoordinates||(this.flatCoordinates=[]);let n=Ej(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()}},bE=yN;function kj(i){return i.key.toLocaleLowerCase()==="g"?(i.preventDefault(),zj(),U.gridEnabled?(ge.gridInput.focus(),ge.gridInput.select()):ge.viewport.focus({preventScroll:!0}),!0):i.key===" "&&U.gridEnabled&&i.target!==ge.subgridToggle?(i.preventDefault(),By(!U.subgridVisible),!0):i.key==="Escape"&&U.gridEnabled?(i.preventDefault(),bN(),!0):!1}function zj(i=!U.gridEnabled){U.gridEnabled=i,i&&By(!0),Oy(),Dc(),U.layers.pins.changed(),U.layers.text.changed(),U.layers.priority.changed()}function By(i){U.subgridVisible=i,U.layers.grid.changed(),U.layers.gridContext.changed(),ge.subgridToggle.setAttribute("aria-pressed",String(i)),ge.subgridToggle.setAttribute("aria-label",i?"Hide the subgrid":"Show the subgrid"),Vj(),document.dispatchEvent(new Event("atlas:grid"))}function Vj(){if(!U.gridEnabled){ge.gridHint.textContent="G \xB7 grid off";return}ge.gridHint.textContent=`G-${U.gridCell||"root"}`+(U.subgridVisible?"":" no subgrid")}function uA(i){let e=Ts(),t=e.parseInput(e.normalizeInput(i));if(t===null)return;let n=t!==U.gridCell;U.gridCell=t,U.gridEnabled||(U.gridEnabled=!0),Oy(),Dc(),U.layers.pins.changed(),U.layers.text.changed(),U.layers.priority.changed(),n&&(ed(),U.engine.getView().fit(SN(),{size:U.engine.getSize(),padding:[52,52,52,52],maxZoom:mh(U.lens),duration:180}))}function bN(){if(U.gridEnabled){if(!U.gridCell){zj(!1);return}uA(Ts().parent(U.gridCell))}}function Oy(){if(U.sources){if(U.sources.grid.clear(),U.sources.gridContext.clear(),ge.gridNavigator.hidden=!U.gridEnabled,Vj(),$de(),U.gridEnabled&&U.lens){let i=Ts();ge.gridInput.maxLength=i.inputLength(U.world),ge.gridInput.value=U.gridCell,ge.gridBack.title=U.gridCell?`Back one ${i.slug} level`:`Close ${i.slug} grid`;for(let e of TE())Qde(e)}document.dispatchEvent(new Event("atlas:grid"))}}function $de(){let i=py(U.world),e=Ts();if(ge.gridSystemName.textContent=e.name,ge.gridSystem.hidden=i.length<2,i.length<2)return;let t=i[(i.indexOf(e)+1)%i.length];ge.gridSystem.textContent=e.short,ge.gridSystem.title=`Dividing by ${e.name} \xB7 \u2318G for ${t.name}`,ge.gridSystem.setAttribute("aria-label",`Cell system: ${e.name}. Switch to ${t.name}`)}function wN(){let i=py(U.world);if(i.length<2)return;let e=i.indexOf(Ts());Yde(i[(e+1)%i.length].slug)}function Yde(i){if(i===U.gridSystem)return;let e=Ts(),t=U.gridCell;U.gridSystem=i,U.gridCell=t?YH(e,Ts(),t,U.world):"",Oy(),Dc(),U.layers.pins.changed(),U.layers.text.changed(),U.layers.priority.changed()}function Zde(i){return qf[Ts().colorKey(i)]}function SE(i,{subgridVisible:e,labelled:t}){let{role:n,contextDistance:r}=i;if(n==="child"&&(!t||!e))return null;let s=Zde(i.hash),o=n==="leaf"||n==="scope",a=n==="scope"&&e,l={color:o?Vi.lineWhite:s,opacity:n==="neighbor"?Vi.neighborLineAlpha:n==="child"?Vi.childLineAlpha:1,widthPx:a?Vi.widths.scopeBare:Vi.widths[n]},c=null;n==="neighbor"?c={color:Vi.dimColor,opacity:Math.min(Vi.dimCap,Vi.dimBase+r*Vi.dimStep)}:n==="leaf"?c={color:s,opacity:Vi.leafFillAlpha}:n==="child"&&(c={color:s,opacity:Vi.childFillAlpha});let u=null;if(t&&!a){let{context:f,principal:d}=Ts().label(i.hash);u={prefix:f,final:d,color:o?Vi.lineWhite:s,textAlpha:n==="neighbor"?Vi.neighborTextAlpha:1,chip:n==="neighbor"?Vi.neighborChip:Vi.chip,sizePx:n==="neighbor"?Vi.neighborLabelSizePx:Vi.labelSizePx}}return{line:l,fill:c,label:u,bare:a}}function TE(){let i=Ts(),e=[],t=Kde(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(wE(i,s,"neighbor",t.length-1-n))}if(U.gridCell&&i.level(U.gridCell)>=i.maxLevel(U.world))return e.push(wE(i,U.gridCell,"leaf",0)),e;U.gridCell&&e.push(wE(i,U.gridCell,"scope",0));for(let n of i.children(U.gridCell))e.push(wE(i,n,"child",0));return e}function Kde(i,e){let t=[e],n=e;for(;n;)n=i.parent(n),t.unshift(n);return t}function wE(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 Qde(i){let e=Ts(),t=U.pins.filter(s=>!s.filteredHidden&&e.contains(i.hash,s.coordinate)).length,n=new Mp({geometry:Jde(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 Jde(i){let e=Hf(),t=i.ring;if(i.pole){let o=i.pole==="north"?e[3]:e[1];t=[...t,[t[t.length-1][0],o],[t[0][0],o],t[0]]}if(t.every(([o])=>o>=e[0]&&o<=e[2]))return new Ah([t]);let r=e[2]-e[0],s=[];for(let o of[0,-r,r]){let a=ZH(t.map(([l,c])=>[l+o,c]),e[0],e[2]);a.length>=4&&s.push([a])}return new bE(s)}function SN(){return Ts().bbox(U.gridCell)}function Gj(){return Ts().maxLevel(U.world)}function Pp(i){return!U.gridEnabled||!U.gridCell?!1:Ts().contains(U.gridCell,i.coordinate)}var ME=[NaN,NaN,NaN,0],TN;function epe(){return TN||(TN=Di(1,1,void 0,{willReadFrequently:!0,desynchronized:!0})),TN}var tpe=/^rgba?\(\s*(\d+%?)\s+(\d+%?)\s+(\d+%?)(?:\s*\/\s*(\d+%|\d*\.\d+|[01]))?\s*\)$/i,npe=/^rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)(?:\s*,\s*(\d+%|\d*\.\d+|[01]))?\s*\)$/i,ipe=/^rgba?\(\s*(\d+%)\s*,\s*(\d+%)\s*,\s*(\d+%)(?:\s*,\s*(\d+%|\d*\.\d+|[01]))?\s*\)$/i,rpe=/^#([\da-f]{3,4}|[\da-f]{6}|[\da-f]{8})$/i;function EE(i,e){return i.endsWith("%")?Number(i.substring(0,i.length-1))/e:Number(i)}function ky(i){throw new Error('failed to parse "'+i+'" as color')}function qj(i){if(i.toLowerCase().startsWith("rgb")){let s=i.match(npe)||i.match(tpe)||i.match(ipe);if(s){let o=s[4],a=100/255;return[Si(EE(s[1],a)+.5|0,0,255),Si(EE(s[2],a)+.5|0,0,255),Si(EE(s[3],a)+.5|0,0,255),o!==void 0?Si(EE(o,100),0,1):1]}ky(i)}if(i.startsWith("#")){if(rpe.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}ky(i)}let e=epe();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&&ky(i));let n=e.fillStyle;if(n.startsWith("#")||n.startsWith("rgba"))return qj(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]=Ym(r[3]/255,3),r}function Hj(i){return typeof i=="string"?i:Vy(i)}var spe=1024,Uy={},EN=0;function Wj(i){if(i.length===4)return i;let e=i.slice();return e[3]=1,e}function MN(i){return i>.0031308?Math.pow(i,1/2.4)*269.025-14.025:i*3294.6}function CN(i){return i>.2068965?Math.pow(i,3):(i-4/29)*(108/841)}function RN(i){return i>10.314724?Math.pow((i+14.025)/269.025,2.4):i/3294.6}function IN(i){return i>.0088564?Math.pow(i,1/3):i/(108/841)+4/29}function PN(i){let e=RN(i[0]),t=RN(i[1]),n=RN(i[2]),r=IN(e*.222488403+t*.716873169+n*.06060791),s=500*(IN(e*.452247074+t*.399439023+n*.148375274)-r),o=200*(r-IN(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 jj(i){let e=(i[0]+16)/116,t=i[1],n=i[2]*Math.PI/180,r=CN(e),s=CN(e+t/500*Math.cos(n)),o=CN(e-t/200*Math.sin(n)),a=MN(s*3.021973625-r*1.617392459-o*.404875592),l=MN(s*-.943766287+r*1.916279586+o*.027607165),c=MN(s*.069407491-r*.22898585+o*1.159737864);return[Si(a+.5|0,0,255),Si(l+.5|0,0,255),Si(c+.5|0,0,255),i[3]]}function zy(i){if(i==="none")return ME;if(Uy.hasOwnProperty(i))return Uy[i];if(EN>=spe){let t=0;for(let n in Uy)(t++&3)===0&&(delete Uy[n],--EN)}let e=qj(i);e.length!==4&&ky(i);for(let t of e)isNaN(t)&&ky(i);return Uy[i]=e,++EN,e}function Fc(i){return Array.isArray(i)?i:zy(i)}function Vy(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 DN=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=LN(e,t);return n in this.cache_?this.cache_[n]:null}getPattern(e,t){let n=LN(e,t);return n in this.patternCache_?this.patternCache_[n]:null}set(e,t,n,r){let s=LN(e,t),o=s in this.cache_;this.cache_[s]=n,r&&(n.getImageState()===In.IDLE&&n.load(),n.getImageState()===In.LOADING?n.ready().then(()=>{this.patternCache_[s]=Sy().createPattern(n.getImage(1),"repeat")}):this.patternCache_[s]=Sy().createPattern(n.getImage(1),"repeat")),o||++this.cacheSize_}setSize(e){this.maxCacheSize_=e,this.expire()}};function LN(i,e){let t=e?Fc(e):"null";return i+":"+t}var ta=new DN;var Gy=null,CE=class extends Ep{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?In.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_===In.LOADED){Gy||(Gy=Di(1,1,void 0,{willReadFrequently:!0})),Gy.drawImage(this.image_,0,0);try{Gy.getImageData(0,0,1,1),this.tainted_=!1}catch{Gy=null,this.tainted_=!0}}return this.tainted_===!0}dispatchChangeEvent_(){this.dispatchEvent(rn.CHANGE)}handleImageError_(){this.imageState_=In.ERROR,this.dispatchChangeEvent_()}handleImageLoad_(){this.imageState_=In.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=Di(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_===In.IDLE){this.image_||this.initializeImage_(),this.imageState_=In.LOADING;try{this.src_!==void 0&&(this.image_.src=this.src_)}catch{this.handleImageError_()}this.image_ instanceof HTMLImageElement&&YW(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_!==In.LOADED)return;let t=this.image_,n=Di(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=Hj(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_===In.LOADED||this.imageState_===In.ERROR)e();else{let t=()=>{(this.imageState_===In.LOADED||this.imageState_===In.ERROR)&&(this.removeEventListener(rn.CHANGE,t),e())};this.addEventListener(rn.CHANGE,t)}})),this.ready_}};function Lp(i,e,t,n,r,s){let o=e===void 0?void 0:ta.get(e,r);return o||(o=new CE(i,i&&"src"in i?i.src||void 0:e,t,n,r),ta.set(e,r,o,s)),s&&o&&!ta.getPattern(e,r)&&ta.set(e,r,o,s),o}var Xj=CE;function Al(i){return i?Array.isArray(i)?Vy(i):typeof i=="object"&&"src"in i?ope(i):i:null}function ope(i){if(!i.offset||!i.size)return ta.getPattern(i.src,i.color);let e=i.src+":"+i.offset,t=ta.getPattern(e,i.color);if(t)return t;let n=ta.get(i.src,null);if(n.getImageState()!==In.LOADED)return null;let r=Di(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]),Lp(r.canvas,e,void 0,In.LOADED,i.color,!0),ta.getPattern(e,i.color)}var qy="ol-hidden";var Dp="ol-unselectable";var sv="ol-control",NN="ol-collapsed",ape=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"),$j=["style","variant","weight","size","lineHeight","family"],RE={normal:400,bold:700},IE=function(i){let e=i.match(ape);if(!e)return null;let t={lineHeight:"normal",size:"1.2em",style:"normal",weight:"400",variant:"normal"};for(let n=0,r=$j.length;n<r;++n){let s=e[n+1];s!==void 0&&(t[$j[n]]=typeof s=="string"?s.trim():s)}return isNaN(Number(t.weight))&&t.weight in RE&&(t.weight=RE[t.weight]),t.families=t.family.split(/,\s?/).map(n=>n.trim().replace(/^['"]|['"]$/g,"")),t};var PE="10px sans-serif",ro="#000",gh="round",gl=[],vl=0,vh="round",td=10,Zj=0,na="#000",Np="center",fA="middle",nd=[0,0,0,0],id=1,hA=new zs,Hy=null,Yj,FN={},lpe=new Set(["serif","sans-serif","monospace","cursive","fantasy","system-ui","ui-serif","ui-sans-serif","ui-monospace","ui-rounded","emoji","math","fangsong"]);function cpe(i,e,t){return`${i} ${e} 16px "${t}"`}var Kj=(function(){let e,t;async function n(s){await t.ready;let o=IE(s),a=o.families[0].toLowerCase(),l=o.weight,c=[];return t.forEach(f=>{let d=f.family.replace(/^['"]|['"]$/g,"").toLowerCase(),A=RE[f.weight]||f.weight;d===a&&f.style===o.style&&A==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=hA.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)?(ph(FN),hA.set(c,100)):(u+=10,hA.set(c,u,!0),u<100&&(s=!1)))}e=void 0,s||(e=setTimeout(r,100))}return async function(s){t||(t=io?self.fonts:document.fonts);let o=IE(s);if(!o)return;let a=o.families,l=!1;for(let c of a){if(lpe.has(c))continue;let u=cpe(o.style,o.weight,c);hA.get(u)===void 0&&(hA.set(u,0,!0),l=!0)}l&&(clearTimeout(e),e=setTimeout(r,100))}})(),upe=(function(){let i;return function(e){let t=FN[e];if(t==null){if(io){let n=IE(e),r=Qj(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);FN[e]=t}return t}})();function Qj(i,e){return Hy||(Hy=Di(1,1)),i!=Yj&&(Hy.font=i,Yj=Hy.font),Hy.measureText(e)}function Jj(i,e){return Qj(i,e).width}function BN(i,e,t){if(e in t)return t[e];let n=e.split(`6-`).reduce((r,s)=>Math.max(r,Jj(i,s)),0);return t[e]=n,n}function eX(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===`7-`||c===u){s=Math.max(s,o),r.push(o),o=0,a+=l,l=0;continue}let d=e[c+1]||i.font,A=Jj(d,f);t.push(A),o+=A;let y=upe(d);n.push(y),l=Math.max(l,y)}return{width:s,height:a,widths:t,heights:n,lineWidths:r}}function tX(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]),hpe(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 hpe(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 ON=class i{constructor(e){this.opacity_=e.opacity,this.rotateWithView_=e.rotateWithView,this.rotation_=e.rotation,this.scale_=e.scale,this.scaleArray_=ls(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 ei()}getImage(e){return ei()}getHitDetectionImage(){return ei()}getPixelRatio(e){return 1}getImageState(){return ei()}getImageSize(){return ei()}getOrigin(){return ei()}getSize(){return ei()}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_=ls(e)}listenImageChange(e){ei()}load(){ei()}unlistenImageChange(e){ei()}ready(){return Promise.resolve()}},LE=ON;var UN=class i extends LE{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()?In.LOADING:In.LOADED,this.imageState_===In.LOADING&&this.ready().then(()=>this.imageState_=In.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=ta.get(n,null)?.getImage(1);if(!r){let s=this.renderOptions_,o=Math.ceil(s.size*e),a=Di(o,o);this.draw_(s,a,e),r=a.canvas;let l=new Xj(r,void 0,null,In.LOADED,null);ta.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),d=f/l;if(e==="miter"&&d<=n)return d*t;let A=t/2/d,y=t/2*(u/f),S=Math.sqrt((r+A)*(r+A)+y*y)-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,F=Math.sqrt(T*T+P*P)/T;if(F<=n){let D=F*t/2-s-r;return 2*Math.max(S,D)}return S*2}createRenderOptions(){let e=gh,t=vh,n=0,r=null,s=0,o,a=0;this.stroke_&&(o=Al(this.stroke_.getColor()??na),a=this.stroke_.getWidth()??id,r=this.stroke_.getLineDash(),s=this.stroke_.getLineDashOffset()??0,t=this.stroke_.getLineJoin()??vh,e=this.stroke_.getLineCap()??gh,n=this.stroke_.getMiterLimit()??td);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=ro),t.fillStyle=Al(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=Fc(n)),n===null?r=1:Array.isArray(n)&&(r=n.length===4?n[3]:1),r===0&&(t=Di(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=ro,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()}},DE=UN;var kN=class i extends DE{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}},NE=kN;var zN=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=Lp(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()===In.IDLE&&t.load(),t.getImageState()===In.LOADING&&(this.patternImage_=t)}this.color_=e}getKey(){let e=this.getColor();return e?e instanceof CanvasPattern||e instanceof CanvasGradient?Bn(e):typeof e=="object"&&"src"in e?e.src+":"+e.offset:Fc(e).toString():""}loading(){return!!this.patternImage_}ready(){return this.patternImage_?this.patternImage_.ready():Promise.resolve()}},us=zN;function nX(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 VN=class i extends LE{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;jn(!(a!==void 0&&o),"`image` and `src` cannot be provided at the same time"),(a===void 0||a.length===0)&&o&&(a=o.src||Bn(o)),jn(a!==void 0&&a.length>0,"A defined and non-empty `src` or `image` must be provided"),jn(!((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=In.IDLE:o!==void 0&&("complete"in o?o.complete?l=o.src?In.LOADED:In.IDLE:l=In.LOADING:l=In.LOADED),this.color_=e.color!==void 0?Fc(e.color):null,this.iconImage_=Lp(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 d=()=>{if(this.unlistenImageChange(d),!this.initialOptions_)return;let A=this.iconImage_.getSize();this.setScale(nX(A[0],A[1],e.width,e.height))};this.listenImageChange(d);return}}c!==void 0&&this.setScale(nX(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?Fc(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?In.IDLE:this.iconImage_.getImageState();this.iconImage_=Lp(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_=Lp(null,e,{crossOrigin:this.crossOrigin_,referrerPolicy:this.referrerPolicy_},In.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()==In.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()==In.LOADED)return this.iconImage_.getSize()[1]*e[1]}setScale(e){delete this.initialOptions_,super.setScale(e)}listenImageChange(e){this.iconImage_.addEventListener(rn.CHANGE,e)}load(){this.iconImage_.load()}unlistenImageChange(e){this.iconImage_.removeEventListener(rn.CHANGE,e)}ready(){return this.iconImage_.ready()}},dA=VN;var GN=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}},Es=GN;var FE=class i{constructor(e){e=e||{},this.geometry_=null,this.geometryFunction_=iX,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_=iX,this.geometry_=e}setZIndex(e){this.zIndex_=e}};function rX(i){let e;if(typeof i=="function")e=i;else{let t;Array.isArray(i)?t=i:(jn(typeof i.getZIndex=="function","Expected an `Style` or an array of `Style`"),t=[i]),e=function(){return t}}return e}var qN=null;function HN(i,e){if(!qN){let t=new us({color:"rgba(255,255,255,0.4)"}),n=new Es({color:"#3399CC",width:1.25});qN=[new FE({image:new NE({fill:t,stroke:n,radius:5}),fill:t,stroke:n})]}return qN}function iX(i){return i.getGeometry()}var Nr=FE;var fpe="#333",WN=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_=ls(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 us({color:fpe}),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 us?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_=ls(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}},rd=WN;function Bc(i,e){return(i.get("priority")||0)-(e.get("priority")||0)}function aX(i){let e=i.get("pin");return!e||Oc(e)||e.insideHighlightedZone||ov(e)?null:jN(e,!1)}function lX(i){let e=i.get("pin");return!e||!U.highlightedZones.size||!e.insideHighlightedZone||Oc(e)||ov(e)?null:jN(e,!1)}function cX(i){let e=i.get("pin");return!e||Oc(e)||!U.labelsHeld?null:pX(e)}function uX(i){let e=i.get("pin");if(!e||Oc(e)||e.insideHighlightedZone||ov(e)||Xy())return null;if(U.labelsHeld)return Wy(e,!1);let t=U.fitZoom+Math.log2(bX(e.category));return(U.engine.getView().getZoom()||0)<t?null:Wy(e,!1)}function hX(i){let e=i.get("pin");return!e||Oc(e)||e.insideHighlightedZone||ov(e)||!Xy()?null:Wy(e,!1)}function fX(i){let e=i.get("pin");return!e||!U.highlightedZones.size||!e.insideHighlightedZone||Oc(e)||ov(e)?null:Wy(e,!1)}function dX(i){let e=i.get("pin");if(!e||Oc(e))return null;if(lh(e.category)==="text")return Wy(e,e===U.selectedPin);let t=jN(e,e===U.selectedPin);return e===U.hoveredPin||e===U.selectedPin?[t,pX(e)]:t}function jN(i,e){let t=`marker:${i.category.id}:${e?1:0}`;if(U.styleCache.has(t))return U.styleCache.get(t);let n=lA(i.category),r=e?2e7:i.priority,s=U.markerIcons.get(jy(i.category)),o;return s?o=new Nr({image:new dA({src:s,width:e?36:31,height:e?36:31}),zIndex:r}):o=new Nr({text:new rd({text:bu(i.category.title),font:`900 ${e?15:13}px Inter, sans-serif`,fill:new us({color:n}),stroke:new Es({color:aA(),width:e?4:3})}),zIndex:r}),U.styleCache.set(t,o),o}function pX(i){let e=`marker-label:${i.location.id}`;if(U.styleCache.has(e))return U.styleCache.get(e);let t=new Nr({text:new rd({text:i.location.title,offsetY:21,font:'700 10px "Arial Narrow", "Roboto Condensed", sans-serif',fill:new us({color:"#f2ece0"}),stroke:new Es({color:"rgba(0,0,0,0.98)",width:3}),backgroundFill:new us({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 mX(i){if(!i.iconAsset)return;let e=jy(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=lA(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=aA(),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")),dpe(),U.layers.pins.changed(),U.layers.zonePins.changed(),U.layers.priority.changed()},t.onerror=()=>U.markerIcons.set(e,!1),t.src=aN(i.iconAsset)}function dpe(){for(let i of U.styleCache.keys())i.startsWith("marker:")&&U.styleCache.delete(i)}function jy(i){return`${i.iconAsset||""}:${lA(i)}:${U.world?.iconOutset||"light"}`}function Wy(i,e){let t=`text:${i.location.id}:${e?1:0}`;if(U.styleCache.has(t))return U.styleCache.get(t);let r=[new Nr({text:new rd({text:i.location.title,font:`${e?"900":"800"} 14px "Arial Narrow", "Roboto Condensed", sans-serif`,fill:new us({color:e?"#7fd0ea":"#f2ece0"}),stroke:new Es({color:"rgba(0,0,0,0.95)",width:4}),backgroundFill:new us({color:e?"rgba(13,16,23,0.9)":"rgba(10,12,17,0.58)"}),backgroundStroke:e?new Es({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 BE(i,e){return`${i} ${e}px ${Vi.labelFont}`}function XN(i,e){let t=i.get("gridCell");if(!t)return null;let n=t.role==="neighbor",r=n?Vi.neighborLabelSizePx:Vi.labelSizePx,s=BE(900,r),o=n?[2,4,2,4]:[3,5,3,5],a=mpe(t,s,r,o,e),l=SE(t,{subgridVisible:U.subgridVisible,labelled:a});if(!l)return null;let c=`grid:${U.gridSystem}:${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 Nr({fill:l.fill?new us({color:Pc(l.fill.color,l.fill.opacity)}):void 0,stroke:new Es({color:Pc(l.line.color,l.line.opacity),width:l.line.widthPx}),zIndex:u})];if(l.label){let d=l.label.prefix?[l.label.prefix,BE(500,r),l.label.final,BE(900,r)]:l.label.final,A=Vi.labelInsetPx*e,y=ppe(i.getGeometry());y&&f.push(new Nr({geometry:new yu([y[0]-A,y[1]+A]),text:new rd({text:d,font:BE(900,r),textAlign:"right",textBaseline:"bottom",fill:new us({color:Pc(l.label.color,l.label.textAlpha)}),backgroundFill:new us({color:l.label.chip}),padding:o,overflow:!0}),zIndex:u+1}))}return U.styleCache.set(c,f),f}function ppe(i){let e=i.getType()==="MultiPolygon"?i.getCoordinates():[i.getCoordinates()],t=null;for(let n of e)for(let[r,s]of n[0]||[])(!t||r-s>t[0]-t[1])&&(t=[r,s]);return t}function mpe(i,e,t,n,r){if(!r)return!0;let s=$N(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 sX=document.createElement("canvas").getContext("2d"),oX=new Map;function $N(i,e){let t=`${e}|${i}`,n=oX.get(t);return n===void 0&&(sX.font=e,n=sX.measureText(i).width,oX.set(t,n)),n}var Ape=new Nr({fill:new us({color:"rgba(5, 8, 16, 0.62)"})});function AX(){return U.zonesVisible?Ape:null}function gX(i,e){if(!U.zonesVisible)return null;let t=i.get("zone"),n=i.get("child"),r=U.highlightedZones.has(t.id),s=yX(t.id),o=Number(t.attrs?.["atlas.stroke.width_px"])||0;if(o>0&&i.getGeometry()?.getType()==="MultiLineString")return gpe(t,i.get("color"),o/e,r,s);let a=`zone:${t.id}:${n?1:0}:${r?1:s?2:0}`;if(U.styleCache.has(a))return U.styleCache.get(a);let l=i.get("color");if(s){let f=new Nr({stroke:new Es({color:Pc(l,n?.34:.44),width:n?1:1.3,lineDash:n?[3,4]:[7,5]}),zIndex:n?101:100});return U.styleCache.set(a,f),f}let c=new Nr({fill:new us({color:Pc(l,n?.035:.07)}),stroke:new Es({color:Pc(l,n?.5:.72),width:n?1.2:1.8,lineDash:n?[3,4]:[7,5]})});if(!r)return U.styleCache.set(a,c),c;let u=[new Nr({stroke:new Es({color:"rgba(255,255,255,0.94)",width:5}),zIndex:9e3}),new Nr({fill:new us({color:Pc(l,.22)}),stroke:new Es({color:l,width:2.6}),zIndex:9001})];return U.styleCache.set(a,u),u}function gpe(i,e,t,n,r){let s=Math.max(t,1.5);return n?[new Nr({stroke:new Es({color:"rgba(255,255,255,0.94)",width:s+4,lineCap:"round",lineJoin:"round"}),zIndex:9e3}),new Nr({stroke:new Es({color:Pc(e,.9),width:s,lineCap:"round",lineJoin:"round"}),zIndex:9001})]:[new Nr({stroke:new Es({color:Pc(e,r?.14:.3),width:s,lineCap:"round",lineJoin:"round"})}),new Nr({stroke:new Es({color:Pc(e,r?.4:.8),width:Math.min(1.6,s),lineDash:[7,5]})})]}function vX(i){if(!U.zonesVisible||Xy())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:xX(i)}function _X(i){return!U.zonesVisible||!Xy()?null:xX(i)}function xX(i){let e=i.get("child"),t=i.get("zone"),n=U.highlightedZones.has(t.id),r=yX(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 Nr({text:new rd({text:t.title.toLocaleUpperCase(),font:`${e?"700 12px":"800 14px"} "Arial Narrow", "Roboto Condensed", sans-serif`,fill:new us({color:n?"#10131a":r?"rgba(196,191,177,0.56)":e?"#c8c2b4":"#f2ece0"}),stroke:new Es({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 us({color:n?o:r?"rgba(8,11,18,0.84)":"rgba(13,16,23,0.72)"}),backgroundStroke:new Es({color:n?"#ffffff":Pc(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 yX(i){if(!U.highlightedZones.size||U.highlightedZones.has(i))return!1;for(let e of U.highlightedZones)if(vpe(i,e))return!1;return!0}function vpe(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 pA(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],d=0,A=[0];for(let S=e+n;S<t;S+=n){let T=i[S],R=i[S+1];d+=Math.sqrt((T-u)*(T-u)+(R-f)*(R-f)),A.push(d),u=T,f=R}let y=r*d,w=PW(A,y);w<0?(l=(y-A[-w-2])/(A[-w-1]-A[-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]:Po(i[a+u],i[a+n+u],l);return s}function OE(i,e,t,n,r,s){if(t==e)return null;let o;if(r<i[e+n-1])return s?(o=i.slice(e,e+n),o[n-1]=r,o):null;if(i[t-1]<r)return s?(o=i.slice(t-n,t),o[n-1]=r,o):null;if(r==i[e+n-1])return i.slice(e,e+n);let a=e/n,l=t/n;for(;a<l;){let d=a+l>>1;r<i[(d+1)*n-1]?l=d:a=d+1}let c=i[a*n-1];if(r==c)return i.slice((a-1)*n,(a-1)*n+n);let u=i[(a+1)*n-1],f=(r-c)/(u-c);o=[];for(let d=0;d<n-1;++d)o.push(Po(i[(a-1)*n+d],i[a*n+d],f));return o.push(r),o}function wX(i,e,t,n,r,s,o){if(o)return OE(i,e,t[t.length-1],n,r,s);let a;if(r<i[n-1])return s?(a=i.slice(0,n),a[n-1]=r,a):null;if(i[i.length-1]<r)return s?(a=i.slice(i.length-n),a[n-1]=r,a):null;for(let l=0,c=t.length;l<c;++l){let u=t[l];if(e!=u){if(r<i[e+n-1])return null;if(r<=i[u-1])return OE(i,e,u,n,r,!1);e=u}}return null}function av(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}var YN=class i extends ml{constructor(e,t){super(),this.flatMidpoint_=null,this.flatMidpointRevision_=-1,this.maxDelta_=-1,this.maxDeltaRevision_=-1,t!==void 0&&!Array.isArray(e[0])?this.setFlatCoordinates(t,e):this.setCoordinates(e,t)}appendCoordinate(e){Lo(this.flatCoordinates,e),this.changed()}clone(){let e=new i(this.flatCoordinates.slice(),this.layout);return e.applyProperties(this),e}closestPointXY(e,t,n,r){return r<Mc(this.getExtent(),e,t)?r:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(Iy(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),Ly(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,this.maxDelta_,!1,e,t,n,r))}forEachSegment(e){return JT(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,e)}getCoordinateAtM(e,t){return this.layout!="XYM"&&this.layout!="XYZM"?null:(t=t!==void 0?t:!1,OE(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,e,t))}getCoordinates(){return Nc(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getCoordinateAt(e,t){return pA(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,e,t,this.stride)}getLength(){return av(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getFlatMidpoint(){return this.flatMidpointRevision_!=this.getRevision()&&(this.flatMidpoint_=this.getCoordinateAt(.5,this.flatMidpoint_??void 0),this.flatMidpointRevision_=this.getRevision()),this.flatMidpoint_}getSimplifiedGeometryInternal(e){let t=[];return t.length=cA(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,e,t,0),new i(t,"XY")}getType(){return"LineString"}intersectsExtent(e){return nA(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,e,this.getExtent())}setCoordinates(e,t){this.setLayout(t,e,1),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=oA(this.flatCoordinates,0,e,this.stride),this.changed()}},ZN=YN;var KN=class i extends ml{constructor(e,t,n){if(super(),this.ends_=[],this.maxDelta_=-1,this.maxDeltaRevision_=-1,Array.isArray(e[0]))this.setCoordinates(e,t);else if(t!==void 0&&n)this.setFlatCoordinates(t,e),this.ends_=n;else{let r=e,s=[],o=[];for(let l=0,c=r.length;l<c;++l){let u=r[l];Lo(s,u.getFlatCoordinates()),o.push(s.length)}let a=r.length===0?this.getLayout():r[0].getLayout();this.setFlatCoordinates(a,s),this.ends_=o}}appendLineString(e){Lo(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<Mc(this.getExtent(),e,t)?r:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(Py(this.flatCoordinates,0,this.ends_,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),Dy(this.flatCoordinates,0,this.ends_,this.stride,this.maxDelta_,!1,e,t,n,r))}getCoordinateAtM(e,t,n){return this.layout!="XYM"&&this.layout!="XYZM"||this.flatCoordinates.length===0?null:(t=t!==void 0?t:!1,n=n!==void 0?n:!1,wX(this.flatCoordinates,0,this.ends_,this.stride,e,t,n))}getCoordinates(){return Rp(this.flatCoordinates,0,this.ends_,this.stride)}getEnds(){return this.ends_}getLineString(e){return e<0||this.ends_.length<=e?null:new ZN(this.flatCoordinates.slice(e===0?0:this.ends_[e-1],this.ends_[e]),this.layout)}getLineStrings(){let e=this.flatCoordinates,t=this.ends_,n=this.layout,r=[],s=0;for(let o=0,a=t.length;o<a;++o){let l=t[o],c=new ZN(e.slice(s,l),n);r.push(c),s=l}return r}getLength(){let e=this.ends_,t=0,n=0;for(let r=0,s=e.length;r<s;++r)n+=av(this.flatCoordinates,t,e[r],this.stride),t=e[r];return n}getFlatMidpoints(){let e=[],t=this.flatCoordinates,n=0,r=this.ends_,s=this.stride;for(let o=0,a=r.length;o<a;++o){let l=r[o],c=pA(t,n,l,s,.5);Lo(e,c),n=l}return e}getSimplifiedGeometryInternal(e){let t=[],n=[];return t.length=gE(this.flatCoordinates,0,this.ends_,this.stride,e,t,0,n),new i(t,"XY",n)}getType(){return"MultiLineString"}intersectsExtent(e){return OW(this.flatCoordinates,0,this.ends_,this.stride,e)}setCoordinates(e,t){this.setLayout(t,e,2),this.flatCoordinates||(this.flatCoordinates=[]);let n=Ty(this.flatCoordinates,0,e,this.stride,this.ends_);this.flatCoordinates.length=n.length===0?0:n[n.length-1],this.changed()}},SX=KN;function QN(){let i=(U.world.zones||[]).filter(t5);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,UE(!0),ge.zoneIndex.hidden=i.length===0,ge.zoneCount.textContent=wu(i.length);for(let e of i){let t=Wr(),n=[],r=!1;for(let l of e.features||[]){let c=ype(l);c&&(r=!0,n.push(c),OT(t,c.getExtent()),U.sources.zones.addFeature(new Mp({geometry:c,zone:e,color:nv(e.id),child:e.parentRegionId!=null})))}if(!r)continue;let s=nv(e.id),o=e.center?lv(e.center.lat,e.center.lng):fl(t),a=Math.max(t[2]-t[0],t[3]-t[1]);U.sources.zoneTitles.addFeature(new Mp({geometry:new yu(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,EX(),_pe()}function EX(){if(U.sources.zoneScrim.clear(),!U.highlightedZones.size)return;let[i,e,t,n]=U.projection.getExtent(),r=[TX([[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||[]){if(o.getType()==="MultiLineString")continue;let a=o.getType()==="MultiPolygon"?o.getPolygons():[o];for(let l of a)l.getLinearRings().forEach((c,u)=>{r.push(TX(c.getCoordinates(),u>0))})}U.sources.zoneScrim.addFeature(new Mp({geometry:new Ah(r)}))}function TX(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 _pe(){let i=document.createDocumentFragment();for(let{zone:e,depth:t}of xpe()){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)}ge.zoneList.replaceChildren(i),ge.zoneIndex.hidden=U.zoneRecords.size===0}function xpe(){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 UE(i){U.zonesVisible=i,ge.zoneToggle.checked=i,U.layers.zoneScrim.setVisible(i),U.layers.zones.setVisible(i),U.layers.zoneTitles.setVisible(i),U.layers.zoneTitleDetail.setVisible(i)}function MX(i){let e=U.zoneRecords.get(i);e&&(U.focusedZoneID=i,RX(),Rj(e.zone),U.engine.getView().fit(e.extent,{size:U.engine.getSize(),padding:[54,54,54,54],maxZoom:mh(U.lens),duration:220}),ge.sidebar.classList.remove("is-open"),ge.mobileLegend.setAttribute("aria-expanded","false"))}function CX(i){U.zoneRecords.has(i)&&(U.highlightedZones.has(i)?U.highlightedZones.delete(i):(U.highlightedZones.add(i),UE(!0)),U.hoveredPin=null,JN(),e5(),RX(),EX(),U.layers.zones.changed(),U.layers.zoneTitles.changed(),U.layers.zoneTitleDetail.changed())}function RX(){ge.zoneIndex.classList.toggle("has-highlights",U.highlightedZones.size>0);for(let i of ge.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 ype(i){if(!i?.coordinates)return null;let e=([t,n])=>lv(n,t);return i.type==="Polygon"?new Ah(i.coordinates.map(t=>t.map(e))):i.type==="MultiPolygon"?new bE(i.coordinates.map(t=>t.map(n=>n.map(e)))):i.type==="MultiLineString"?new SX(i.coordinates.map(t=>t.map(e))):null}function lv(i,e){let t=bpe(),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 bpe(){let i=U.volume.tileGrid,e=U.world?.grid;return e?{...i,...e}:i}function IX(){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){lh(e)!=="text"&&mX(e);for(let t of e.locations){let n={location:t,category:e,group:i,coordinate:lv(t.lat,t.lng),filteredHidden:!1,priority:Epe(e,t),feature:null};n.feature=new Mp({geometry:new yu(n.coordinate),pin:n,priority:n.priority}),U.pins.push(n),U.pinByID.set(t.id,n),lh(e)==="text"?U.sources.text.addFeature(n.feature):U.sources.pins.addFeature(n.feature)}}Lc()}function Lc(){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)}JN(),e5(),U.selectedPin?.filteredHidden&&ed(),Jf(),document.dispatchEvent(new Event("atlas:filters"))}function JN(){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=>wpe(n,e.coordinate)))}function wpe(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 e5(){U.eligibleLocations=U.pins.filter(i=>!Oc(i)).length,Dc(),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(),mA()}function Dc(){U.sources.priority.clear();for(let i of U.pins){if(Oc(i))continue;let e=!!U.search&&i.location.title.toLocaleLowerCase().includes(U.search);(i===U.selectedPin||i===U.hoveredPin||e||Pp(i))&&U.sources.priority.addFeature(i.feature)}}function cv(i){U.hoveredPin!==i&&(U.hoveredPin=i,U.sources&&(Dc(),U.layers.pins.changed(),U.layers.priority.changed()))}function kE(i){U.labelsHeld!==i&&(U.labelsHeld=i,ge.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 ov(i){return i===U.selectedPin||i===U.hoveredPin||Pp(i)||!!U.search&&i.location.title.toLocaleLowerCase().includes(U.search)}function Oc(i){return i.filteredHidden||Spe(i)||Tpe(i)||!t5(i.location)}function t5(i){let e=U.lens?.shard;return!e||!i.shard||i.shard===e}function Spe(i){return!U.highlightedZones.size||i.insideHighlightedZone||i===U.selectedPin?!1:!(U.search&&i.location.title.toLocaleLowerCase().includes(U.search))}function Tpe(i){return!U.gridEnabled||!U.gridCell||Pp(i)||i===U.selectedPin?!1:!(U.search&&i.location.title.toLocaleLowerCase().includes(U.search))}function Epe(i,e){return Math.max(0,1e6-Math.min(i.locations.length,999)*1e3)+Mj(e.id)%1e3}function bX(i){return i.locations.length>200?4:i.locations.length>75?2.5:1}function Xy(){return(U.engine?.getView().getZoom()||0)>=(U.lens?.maxZoom||0)-.05}function PX(i){let e=[],t=[];for(let n of i){let r=[];for(let s of n.categories)(lh(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 LX(){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(Mpe(e.key,e.title,n));let r=document.createElement("div");r.className="category-toggles";for(let s of e.categories)r.append(Cpe(s));t.append(r),i.append(t)}ge.legend.replaceChildren(i),zE(),Cp()}function Mpe(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=wu(t),r.append(s,o,a);let l=DX(`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 DX(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 Cpe(i){let e=lh(i)==="text",t=document.createElement("label");t.className="category-row",iv(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",rv(r,i,bu(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=wu(i.locations.length);let a=DX(`Show only ${i.title}`);return a.dataset.onlyCategory=String(i.id),t.append(n,r,s,a,o),t}function n5(i){if(U.collapsedSections.clear(),i)for(let e of ge.layers.querySelectorAll("[data-section]"))U.collapsedSections.add(e.dataset.section);zE()}function zE(){for(let i of ge.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)}xu()}function $y(i){if(U.hiddenCategories.clear(),!i)for(let e of U.world.groups)for(let t of e.categories)U.hiddenCategories.add(t.id);Cy(),Lc(),Jf(),Cp()}function Cy(){for(let i of document.querySelectorAll("[data-category]"))i.checked=!U.hiddenCategories.has(Number(i.dataset.category))}function NX(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);Cy(),Lc(),Cp()}function FX(i){if(U.world){if(Rpe(i)){$y(!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)}Cy(),Lc(),Jf(),Cp()}}function Rpe(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 Ipe(){let i=ge.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 Cp(){if(U.world){for(let i of U.world.sections){let e=ge.legend.querySelector(`input[data-section-toggle="${i.key}"]`);e&&(e.checked=i.categories.some(t=>!U.hiddenCategories.has(t.id)))}Ipe(),xu()}}async function BX(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(a=>a.categories);Ppe(r,s);let o=PX(n.groups);return{...i,grid:n.grid,lenses:n.lenses,groups:n.groups,zones:n.zones||[],attrs:n.attrs||{},merged:n.merged||[],sections:o}}function Ppe(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),d=new Uint32Array(i,o+=s*4,s+1),A=new Uint16Array(i,o+=(s+1)*4,s),y=new Uint8Array(i,o+s*2),w=new TextDecoder;for(let S of e)S.locations=[];for(let S=0;S<s;S++)e[A[S]].locations.push({id:a[S],title:w.decode(y.subarray(d[S],d[S+1])),lat:l[S],lng:c[S],regionId:u[S]||void 0,shard:f[S]||void 0})}async function hN(){let i=`${U.volume.base}/${U.world.slug}`;return U.textByWorld.has(i)||U.textByWorld.set(i,fetch(`${U.volume.base}/worlds/${U.world.slug}.text`).then(e=>e.json()).catch(()=>({}))),U.textByWorld.get(i)}var VE=null;function AA(){return VE||(VE=Lpe().finally(()=>{VE=null})),VE}async function Lpe(){let i=await fetch("/data/catalog.json");if(!i.ok)return;let e=U.volume;if(U.catalog=await i.json(),km(ge.volume,U.catalog.volumes,"title"),i5(),!U.catalog.volumes.length)return;let t=e&&U.catalog.volumes.find(n=>n.slug===e.slug);if(!t){let n=tv();await sd(n.volume||ev()?.volume||U.catalog.volumes[0].slug,n.volume?n.world:void 0);return}if(t.stamp!==e.stamp){for(let r of U.textByWorld.keys())r.startsWith(e.base+"/")&&U.textByWorld.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 sd(t.slug,U.world?.slug);return}U.volume=t,ge.volume.value=t.slug}function i5(){let i=!U.catalog?.volumes?.length;ge.emptyState.hidden=!i,U.catalog?.bundlesDir&&(ge.emptyPath.textContent=U.catalog.bundlesDir)}async function r5(){for(let i of[ge.emptyOpen,ge.addBundles])i.disabled=!0;try{let e=await(await fetch("/data/bundles/import",{method:"POST"})).json().catch(()=>({}));await AA();let t=e.imported?.[0];t&&U.catalog.volumes.some(n=>n.slug===t)&&await sd(t)}finally{for(let i of[ge.emptyOpen,ge.addBundles])i.disabled=!1}}var vo={ADD:"add",REMOVE:"remove"};var OX={LENGTH:"length"},uv=class extends Ao{constructor(e,t,n){super(e),this.element=t,this.index=n}},s5=class extends zs{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(OX.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 uv(vo.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 uv(vo.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 uv(vo.REMOVE,r,e)),this.dispatchEvent(new uv(vo.ADD,t,e))}updateLength_(){this.set(OX.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")}},No=s5;var o5=class extends Ao{constructor(e,t,n){super(e),this.map=t,this.frameState=n!==void 0?n:null}},Fp=o5;var a5=class extends Fp{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()}},_h=a5;var Ar={SINGLECLICK:"singleclick",CLICK:rn.CLICK,DBLCLICK:rn.DBLCLICK,POINTERDRAG:"pointerdrag",POINTERMOVE:"pointermove",POINTERDOWN:"pointerdown",POINTERUP:"pointerup",POINTEROVER:"pointerover",POINTEROUT:"pointerout",POINTERENTER:"pointerenter",POINTERLEAVE:"pointerleave",POINTERCANCEL:"pointercancel"};var Yy={POINTERMOVE:"pointermove",POINTERDOWN:"pointerdown",POINTERUP:"pointerup",POINTEROVER:"pointerover",POINTEROUT:"pointerout",POINTERENTER:"pointerenter",POINTERLEAVE:"pointerleave",POINTERCANCEL:"pointercancel"};var l5=class extends Ep{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_=qn(n,Yy.POINTERDOWN,this.handlePointerDown_,this),this.originalPointerMoveEvent_,this.relayedListenerKey_=qn(n,Yy.POINTERMOVE,this.relayMoveEvent_,this),this.boundHandleTouchMove_=this.handleTouchMove_.bind(this),this.element_.addEventListener(rn.TOUCHMOVE,this.boundHandleTouchMove_,iE?{passive:!1}:!1)}emulateClick_(e){let t=new _h(Ar.CLICK,this.map_,e);this.dispatchEvent(t),this.clickTimeoutId_!==void 0?(clearTimeout(this.clickTimeoutId_),this.clickTimeoutId_=void 0,t=new _h(Ar.DBLCLICK,this.map_,e),this.dispatchEvent(t)):this.clickTimeoutId_=setTimeout(()=>{this.clickTimeoutId_=void 0;let n=new _h(Ar.SINGLECLICK,this.map_,e);this.dispatchEvent(n)},250)}updateActivePointers_(e){let t=e,n=t.pointerId;if(t.type==Ar.POINTERUP||t.type==Ar.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==Ar.POINTERDOWN||t.type==Ar.POINTERMOVE)&&(this.trackedTouches_[n]=t);this.activePointers_=Object.values(this.trackedTouches_)}handlePointerUp_(e){this.updateActivePointers_(e);let t=new _h(Ar.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(li),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 _h(Ar.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(qn(n,Ar.POINTERMOVE,this.handlePointerMove_,this),qn(n,Ar.POINTERUP,this.handlePointerUp_,this),qn(this.element_,Ar.POINTERCANCEL,this.handlePointerUp_,this)),this.element_.getRootNode&&this.element_.getRootNode()!==n&&this.dragListenerKeys_.push(qn(this.element_.getRootNode(),Ar.POINTERUP,this.handlePointerUp_,this))}}handlePointerMove_(e){if(this.isMoving_(e)){this.updateActivePointers_(e),this.dragging_=!0;let t=new _h(Ar.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 _h(Ar.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_&&(li(this.relayedListenerKey_),this.relayedListenerKey_=null),this.element_.removeEventListener(rn.TOUCHMOVE,this.boundHandleTouchMove_),this.pointerdownListenerKey_&&(li(this.pointerdownListenerKey_),this.pointerdownListenerKey_=null),this.dragListenerKeys_.forEach(li),this.dragListenerKeys_.length=0,this.element_=null,super.disposeInternal()}},UX=l5;var xh={POSTRENDER:"postrender",MOVESTART:"movestart",MOVEEND:"moveend",LOADSTART:"loadstart",LOADEND:"loadend"};var Fo={LAYERGROUP:"layergroup",SIZE:"size",TARGET:"target",VIEW:"view"};var Zy=1/0,c5=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,ph(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){jn(!(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!=Zy?(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==Zy?delete this.queuedElements_[this.keyFunction_(o)]:(n[r]=l,t[r++]=o);t.length=r,n.length=r,this.heapify_()}},kX=c5;var u5=class extends kX{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(rn.CHANGE,this.boundHandleTileChange_),t}getTilesLoading(){return this.tilesLoading_}handleTileChange(e){let t=e.target,n=t.getState();if(n===an.LOADED||n===an.ERROR||n===an.EMPTY){n!==an.ERROR&&t.removeEventListener(rn.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()===an.IDLE&&!(s in this.tilesLoadingKeys_)&&(this.tilesLoadingKeys_[s]=!0,++this.tilesLoading_,++n,r.load())}}},zX=u5;function VX(i,e,t,n,r){if(!i||!(t in i.wantedTiles))return Zy;if(!i.wantedTiles[t][e.getKey()])return Zy;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 so={ANIMATING:0,INTERACTING:1};var Uc={CENTER:"center",RESOLUTION:"resolution",ROTATION:"rotation"};function h5(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,d=i[0]+l/2+u,A=i[2]-l/2+u,y=i[1]+c/2+f,w=i[3]-c/2+f;d>A&&(d=(A+d)/2,A=d),y>w&&(y=(w+y)/2,w=y);let S=Si(n[0],d,A),T=Si(n[1],y,w);if(o&&t&&r){let R=30*r;S+=-R*Math.log(1+Math.max(0,d-n[0])/R)+R*Math.log(1+Math.max(0,n[0]-A)/R),T+=-R*Math.log(1+Math.max(0,y-n[1])/R)+R*Math.log(1+Math.max(0,n[1]-w)/R)}return[S,T]})}function GX(i){return i}function f5(i,e,t,n){let r=Kn(e)/t[0],s=Lr(e)/t[1];return n?Math.min(i,Math.max(r,s)):Math.min(i,Math.min(r,s))}function d5(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),Si(n,t/2,e*2)}function qX(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?f5(l,t,o,n):l;if(a)return e?d5(r,u,c):Si(r,c,u);let f=Math.min(u,r),d=Math.floor(X1(i,f,s));return i[d]>u&&d<i.length-1?i[d+1]:i[d]}})}function HX(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?f5(e,r,l,s):e;if(c)return n?d5(o,u,t):Si(o,t,u);let f=1e-9,d=Math.ceil(Math.log(e/u)/Math.log(i)-f),A=-a*(.5-f)+.5,y=Math.min(u,o),w=Math.floor(Math.log(e/y)/Math.log(i)+A),S=Math.max(d,w),T=e/Math.pow(i,S);return Si(T,t,u)}})}function p5(i,e,t,n,r){return t=t!==void 0?t:!0,(function(s,o,a,l){if(s!==void 0){let c=n?f5(i,n,a,r):i;return!t||!l?Si(s,e,c):d5(s,c,e)}})}function hv(i){if(i!==void 0)return 0}function m5(i){if(i!==void 0)return i}function WX(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 jX(i){let e=i===void 0?pu(5):i;return(function(t,n){return n||t===void 0?t:Math.abs(t)<=e?0:t})}var A5=0,v5=class extends zs{constructor(e){super(),this.on,this.once,this.un,e=Object.assign({},e),this.hints_=[0,0],this.animations_=[],this.updateAnimationKey_,this.projection_=ZT(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&&EW(),e.center&&(e.center=gu(e.center,this.projection_)),e.extent&&(e.extent=vu(e.extent,this.projection_)),this.applyOptions_(e)}applyOptions_(e){let t=Object.assign({},e);for(let a in Uc)delete t[a];this.setProperties(t,!0);let n=Npe(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=Dpe(e),s=n.constraint,o=Fpe(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=gu(r.center,this.getProjection())),r.anchor&&(r=Object.assign({},r),r.anchor=gu(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&&GE(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||ZW,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 d=dh(u.rotation-l+Math.PI,2*Math.PI)-Math.PI;f.targetRotation=l+d,l=f.targetRotation}Bpe(f)?f.complete=!0:s+=f.duration,c.push(f)}this.animations_.push(c),this.setHint(so.ANIMATING,1),this.updateAnimations_()}getAnimating(){return this.hints_[so.ANIMATING]>0}getInteracting(){return this.hints_[so.INTERACTING]>0}cancelAnimations(){this.setHint(so.ANIMATING,-this.hints_[so.ANIMATING]);let e;for(let t=0,n=this.animations_.length;t<n;++t){let r=this.animations_[t];if(r[0].callback&&GE(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 d=l.sourceCenter[0],A=l.sourceCenter[1],y=l.targetCenter[0],w=l.targetCenter[1];this.nextCenter_=l.targetCenter;let S=d+f*(y-d),T=A+f*(w-A);this.targetCenter_=[S,T]}if(l.sourceResolution&&l.targetResolution){let d=f===1?l.targetResolution:l.sourceResolution+f*(l.targetResolution-l.sourceResolution);if(l.anchor){let A=this.getViewportSize_(this.getRotation()),y=this.constraints_.resolution(d,0,A,!0);this.targetCenter_=this.calculateCenterZoom(y,l.anchor)}this.nextResolution_=l.targetResolution,this.targetResolution_=d,this.applyTargetState_(!0)}if(l.sourceRotation!==void 0&&l.targetRotation!==void 0){let d=f===1?dh(l.targetRotation+Math.PI,2*Math.PI)-Math.PI:l.sourceRotation+f*(l.targetRotation-l.sourceRotation);if(l.anchor){let A=this.constraints_.rotation(d,!0);this.targetCenter_=this.calculateCenterRotate(A,l.anchor)}this.nextRotation_=l.targetRotation,this.targetRotation_=d}if(this.applyTargetState_(!0),t=!0,!l.complete)break}if(s){this.animations_[n]=null,this.setHint(so.ANIMATING,-1),this.nextCenter_=null,this.nextResolution_=NaN,this.nextRotation_=NaN;let o=r[0].callback;o&&GE(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]],z1(n,e-this.getRotation()),sW(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&&yy(e,this.getProjection())}getCenterInternal(){return this.get(Uc.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 bp(t,this.getProjection())}calculateExtentInternal(e){e=e||this.getViewportSizeMinusPadding_();let t=this.getCenterInternal();jn(t,"The view center is not defined");let n=this.getResolution();jn(n!==void 0,"The view resolution is not defined");let r=this.getRotation();return jn(r!==void 0,"The view rotation is not defined"),gy(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(Uc.RESOLUTION)}getResolutions(){return this.resolutions_}getResolutionForExtent(e,t){return this.getResolutionForExtentInternal(vu(e,this.getProjection()),t)}getResolutionForExtentInternal(e,t){t=t||this.getViewportSizeMinusPadding_();let n=Kn(e)/t[0],r=Lr(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(Uc.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=g5(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=X1(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=Si(Math.floor(e),0,this.resolutions_.length-2),n=this.resolutions_[t]/this.resolutions_[t+1];return this.resolutions_[t]/Math.pow(n,Si(e-t,0,1))}return this.maxResolution_/Math.pow(this.zoomFactor_,e-this.minZoom_)}fit(e,t){let n;if(jn(Array.isArray(e)||typeof e.getSimplifiedGeometry=="function","Invalid extent or geometry provided as `geometry`"),Array.isArray(e)){jn(!fh(e),"Cannot fit empty extent provided as `geometry`");let r=vu(e,this.getProjection());n=xN(r)}else if(e.getType()==="Circle"){let r=vu(e.getExtent(),this.getProjection());n=xN(r),n.rotate(this.getRotation(),fl(r))}else{let r=eA();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,d=s.length;f<d;f+=o){let A=s[f]*n-s[f+1]*r,y=s[f]*r+s[f+1]*n;a=Math.min(a,A),l=Math.min(l,y),c=Math.max(c,A),u=Math.max(u,y)}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),d=fl(a);d[0]+=(r[1]-r[3])/2*l,d[1]+=(r[0]-r[2])/2*l;let A=d[0]*f-d[1]*u,y=d[1]*f+d[0]*u,w=this.getConstrainedCenter([A,y],l),S=t.callback?t.callback:Qf;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),GE(S,!0))}centerOn(e,t,n){this.centerOnInternal(gu(e,this.getProjection()),t,n)}centerOnInternal(e,t,n){this.setCenterInternal(g5(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=g5(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=yy(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&&gu(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=gu(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&&gu(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(Uc.ROTATION)!==r&&this.set(Uc.ROTATION,r),this.get(Uc.RESOLUTION)!==o&&(this.set(Uc.RESOLUTION,o),this.set("zoom",this.getZoom(),!0)),(!a||!this.get(Uc.CENTER)||!Zm(this.get(Uc.CENTER),a))&&this.set(Uc.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()||!Zm(this.getCenterInternal(),l))&&(this.getAnimating()&&this.cancelAnimations(),this.animateInternal({rotation:s,center:l,resolution:a,duration:e,easing:Ic,anchor:n}))}beginInteraction(){this.resolveConstraints(0),this.setHint(so.INTERACTING,1)}endInteraction(e,t,n){n=n&&gu(n,this.getProjection()),this.endInteractionInternal(e,t,n)}endInteractionInternal(e,t,n){this.getInteracting()&&(this.setHint(so.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 GE(i,e){setTimeout(function(){i(e)},0)}function Dpe(i){if(i.extent!==void 0){let t=i.smoothExtentConstraint!==void 0?i.smoothExtentConstraint:!0;return h5(i.extent,i.constrainOnlyCenter,t)}let e=ZT(i.projection,"EPSG:3857");if(i.multiWorld!==!0&&e.isGlobal()){let t=e.getExtent().slice();return t[0]=-1/0,t[2]=1/0,h5(t,!1,!1)}return GX}function Npe(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,d=ZT(i.projection,"EPSG:3857"),A=d.getExtent(),y=i.constrainOnlyCenter,w=i.extent;if(!c&&!w&&d.isGlobal()&&(y=!1,w=A),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=qX(S,u,!y&&w,f):e=p5(t,n,u,!y&&w,f)}else{let T=(A?Math.max(Kn(A),Lr(A)):360*$f.degrees/d.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=HX(l,t,n,u,!y&&w,f):e=p5(t,n,u,!y&&w,f)}return{constraint:e,maxResolution:t,minResolution:n,minZoom:o,zoomFactor:l}}function Fpe(i){if(i.enableRotation!==void 0?i.enableRotation:!0){let t=i.constrainRotation;return t===void 0||t===!0?jX():t===!1?m5:typeof t=="number"?WX(t):m5}return hv}function Bpe(i){return!(i.sourceCenter&&i.targetCenter&&!Zm(i.sourceCenter,i.targetCenter)||i.sourceResolution!==i.targetResolution||i.sourceRotation!==i.targetRotation)}function g5(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 Hl=v5;var _5=class extends zs{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)li(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!==Qf&&this.listenerKeys.push(qn(e,xh.POSTRENDER,this.render,this)),e.render()}}render(e){}setTarget(e){this.target_=typeof e=="string"?document.getElementById(e):e}},fv=_5;var x5=class extends fv{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(rn.CLICK,this.handleClick_.bind(this),!1);let c=t+" "+Dp+" "+sv+(this.collapsed_&&this.collapsible_?" "+NN:"")+(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=>WW(()=>r))),n=t.length>0;if(this.renderedVisible_!=n&&(this.element.style.display=n?"":"none",this.renderedVisible_=n),!ea(t,this.renderedAttributions_)){QW(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(NN),this.collapsed_?WD(this.collapseLabel_,this.label_):WD(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)}},XX=x5;var y5=class extends fv{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(rn.CLICK,this.handleClick_.bind(this),!1);let a=t+" "+Dp+" "+sv,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(qy)}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:Ic}):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(qy);!s&&n===0?this.element.classList.add(qy):s&&n!==0&&this.element.classList.remove(qy)}this.label_.style.transform=r}this.rotation_=n}},$X=y5;var b5=class extends fv{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(rn.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(rn.CLICK,this.handleClick_.bind(this,-n),!1);let d=t+" "+Dp+" "+sv,A=this.element;A.className=d,A.appendChild(u),A.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:Ic})):n.setZoom(s)}}},YX=b5;function qE(i){i=i||{};let e=new No;return(i.zoom===void 0||i.zoom)&&e.push(new YX(i.zoomOptions)),(i.rotate===void 0||i.rotate)&&e.push(new $X(i.rotateOptions)),(i.attribution===void 0||i.attribution)&&e.push(new XX(i.attributionOptions)),e}var w5=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_}},ZX=w5;var S5={ACTIVE:"active"};var T5=class extends zs{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(S5.ACTIVE)}getMap(){return this.map_}handleEvent(e){return!0}setActive(e){this.set(S5.ACTIVE,e)}setMap(e){this.map_=e}};function KX(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:KW,center:i.getConstrainedCenter(r)})}}function dv(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:Ic})}var yh=T5;var E5=class extends yh{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==Ar.DBLCLICK){let n=e.originalEvent,r=e.map,s=e.coordinate,o=n.shiftKey?-this.delta_:this.delta_,a=r.getView();dv(a,o,s,this.duration_),n.preventDefault(),t=!0}return!t}},QX=E5;function Ky(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 JX=function(i){let e=i.originalEvent;return e.altKey&&!(e.metaKey||e.ctrlKey)&&e.shiftKey},Ope=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)},HE=function(i){let e=i.map.getTargetElement(),t=e.getRootNode();return(t instanceof ShadowRoot?t.host:e).hasAttribute("tabindex")?Ope(i):!0},e$=Zf;var WE=function(i){let e=i.originalEvent;return"pointerId"in e&&e.button==0&&!(jW&&zD&&e.ctrlKey)};var jE=function(i){let e=i.originalEvent;return!e.altKey&&!(e.metaKey||e.ctrlKey)&&!e.shiftKey};var t$=function(i){let e=i.originalEvent;return zD?e.metaKey:e.ctrlKey},n$=function(i){let e=i.originalEvent;return!e.altKey&&!(e.metaKey||e.ctrlKey)&&e.shiftKey},XE=function(i){let e=i.originalEvent,t=e.target.tagName;return t!=="INPUT"&&t!=="SELECT"&&t!=="TEXTAREA"&&!e.target.isContentEditable},$E=function(i){let e=i.originalEvent;return"pointerId"in e&&e.pointerType=="mouse"};var i$=function(i){let e=i.originalEvent;return"pointerId"in e&&e.isPrimary&&e.button===0};var M5=class extends yh{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==Ar.POINTERDRAG)this.handleDragEvent(e),e.originalEvent.preventDefault();else if(e.type==Ar.POINTERUP){let n=this.handleUpEvent(e);this.handlingDownUpSequence=n&&this.targetPointers.length>0}}else if(e.type==Ar.POINTERDOWN){let n=this.handleDownEvent(e);this.handlingDownUpSequence=n,t=this.stopDown(n)}else e.type==Ar.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 pv(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 bh=M5;var C5=class extends bh{constructor(e){super({stopDown:Kf}),e=e||{},this.kinetic_=e.kinetic,this.lastCentroid=null,this.lastPointersCount_,this.panning_=!1;let t=e.condition?e.condition:Ky(jE,i$);this.condition_=e.onFocusOnly?Ky(HE,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(pv(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();oW(s,a.getResolution()),z1(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:Ic})}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}},r$=C5;var R5=class extends bh{constructor(e){e=e||{},super({stopDown:Kf}),this.condition_=e.condition?e.condition:JX,this.lastAngle_=void 0,this.duration_=e.duration!==void 0?e.duration:250}handleDragEvent(e){if(!$E(e))return;let t=e.map,n=t.getView();if(n.getConstraints().rotation===hv)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 $E(e)?(e.map.getView().endInteraction(this.duration_),!1):!0}handleDownEvent(e){return $E(e)&&WE(e)&&this.condition_(e)?(e.map.getView().beginInteraction(),this.lastAngle_=void 0,!0):!1}},s$=R5;var I5=class extends Tp{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 Ah([r])}getGeometry(){return this.geometry_}},o$=I5;var mv={BOXSTART:"boxstart",BOXDRAG:"boxdrag",BOXEND:"boxend",BOXCANCEL:"boxcancel"},gA=class extends Ao{constructor(e,t,n){super(e),this.coordinate=t,this.mapBrowserEvent=n}},P5=class extends bh{constructor(e){super(),this.on,this.once,this.un,e=e??{},this.box_=new o$(e.className||"ol-dragbox"),this.minArea_=e.minArea??64,e.onBoxEnd&&(this.onBoxEnd=e.onBoxEnd),this.startPixel_=null,this.condition_=e.condition??WE,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 gA(mv.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 gA(t?mv.BOXEND:mv.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 gA(mv.BOXSTART,e.coordinate,e)),!0):!1}onBoxEnd(e){}setActive(e){e||(this.box_.setMap(null),this.startPixel_&&(this.dispatchEvent(new gA(mv.BOXCANCEL,this.startPixel_,null)),this.startPixel_=null)),super.setActive(e)}setMap(e){this.getMap()&&(this.box_.setMap(null),this.startPixel_&&(this.dispatchEvent(new gA(mv.BOXCANCEL,this.startPixel_,null)),this.startPixel_=null)),super.setMap(e)}},a$=P5;var L5=class extends a${constructor(e){e=e||{};let t=e.condition?e.condition:n$;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:Ic})}},l$=L5;var Bp={LEFT:"ArrowLeft",UP:"ArrowUp",RIGHT:"ArrowRight",DOWN:"ArrowDown"};var D5=class extends yh{constructor(e){super(),e=e||{},this.defaultCondition_=function(t){return jE(t)&&XE(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==rn.KEYDOWN){let n=e.originalEvent,r=n.key;if(this.condition_(e)&&(r==Bp.DOWN||r==Bp.LEFT||r==Bp.RIGHT||r==Bp.UP)){let o=e.map.getView(),a=o.getResolution()*this.pixelDelta_,l=0,c=0;r==Bp.DOWN?c=-a:r==Bp.LEFT?l=-a:r==Bp.RIGHT?l=a:c=a;let u=[l,c];z1(u,o.getRotation()),KX(o,u,this.duration_),n.preventDefault(),t=!0}}return!t}},c$=D5;var N5=class extends yh{constructor(e){super(),e=e||{},this.condition_=e.condition?e.condition:function(t){return!t$(t)&&XE(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==rn.KEYDOWN||e.type==rn.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();dv(a,o,void 0,this.duration_),n.preventDefault(),t=!0}}return!t}},u$=N5;var Upe=40,kpe=300,zpe=3,F5=class extends yh{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:e$;this.condition_=e.onFocusOnly?Ky(HE,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(li),this.ctrlKeyListenerKeys_.length=0,this.ctrlKeyPressed_=!1,super.setMap(e),e){let t=e.getOwnerDocument();this.ctrlKeyListenerKeys_.push(qn(t,"keydown",n=>{n.key==="Control"&&(this.ctrlKeyPressed_=!0)}),qn(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!==rn.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*=Upe;break;case WheelEvent.DOM_DELTA_PAGE:o*=kpe;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*zpe),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=-Si(this.totalDelta_,-this.maxDelta_*this.deltaPerZoom_,this.maxDelta_*this.deltaPerZoom_)/this.deltaPerZoom_;(t.getConstrainResolution()||this.constrainResolution_)&&(n=n?n>0?1:-1:0),dv(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)}},h$=F5;var B5=class extends bh{constructor(e){e=e||{};let t=e;t.stopDown||(t.stopDown=Kf),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!==hv&&(this.anchor_=o.getCoordinateFromPixelInternal(o.getEventPixel(pv(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}},f$=B5;var O5=class extends bh{constructor(e){e=e||{};let t=e;t.stopDown||(t.stopDown=Kf),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(pv(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}},d$=O5;function YE(i){i=i||{};let e=new No,t=new ZX(-.005,.05,100);return(i.altShiftDragRotate===void 0||i.altShiftDragRotate)&&e.push(new s$),(i.doubleClickZoom===void 0||i.doubleClickZoom)&&e.push(new QX({delta:i.zoomDelta,duration:i.zoomDuration})),(i.dragPan===void 0||i.dragPan)&&e.push(new r$({onFocusOnly:i.onFocusOnly,kinetic:t})),(i.pinchRotate===void 0||i.pinchRotate)&&e.push(new f$),(i.pinchZoom===void 0||i.pinchZoom)&&e.push(new d$({duration:i.zoomDuration})),(i.keyboard===void 0||i.keyboard)&&(e.push(new c$),e.push(new u$({delta:i.zoomDelta,duration:i.zoomDuration}))),(i.mouseWheelZoom===void 0||i.mouseWheelZoom)&&e.push(new h$({onFocusOnly:i.onFocusOnly,duration:i.zoomDuration})),(i.shiftDragZoom===void 0||i.shiftDragZoom)&&e.push(new l$({duration:i.zoomDuration})),e}var Ni={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 U5=class extends zs{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[Ni.OPACITY]=e.opacity!==void 0?e.opacity:1,jn(typeof t[Ni.OPACITY]=="number","Layer opacity must be a number"),t[Ni.VISIBLE]=e.visible!==void 0?e.visible:!0,t[Ni.Z_INDEX]=e.zIndex,t[Ni.MAX_RESOLUTION]=e.maxResolution!==void 0?e.maxResolution:1/0,t[Ni.MIN_RESOLUTION]=e.minResolution!==void 0?e.minResolution:0,t[Ni.MIN_ZOOM]=e.minZoom!==void 0?e.minZoom:-1/0,t[Ni.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=Si(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 ei()}getLayerStatesArray(e){return ei()}getExtent(){return this.get(Ni.EXTENT)}getMaxResolution(){return this.get(Ni.MAX_RESOLUTION)}getMinResolution(){return this.get(Ni.MIN_RESOLUTION)}getMinZoom(){return this.get(Ni.MIN_ZOOM)}getMaxZoom(){return this.get(Ni.MAX_ZOOM)}getOpacity(){return this.get(Ni.OPACITY)}getSourceState(){return ei()}getVisible(){return this.get(Ni.VISIBLE)}getZIndex(){return this.get(Ni.Z_INDEX)}setBackground(e){this.background_=e,this.changed()}setExtent(e){this.set(Ni.EXTENT,e)}setMaxResolution(e){this.set(Ni.MAX_RESOLUTION,e)}setMinResolution(e){this.set(Ni.MIN_RESOLUTION,e)}setMaxZoom(e){this.set(Ni.MAX_ZOOM,e)}setMinZoom(e){this.set(Ni.MIN_ZOOM,e)}setOpacity(e){jn(typeof e=="number","Layer opacity must be a number"),this.set(Ni.OPACITY,e)}setVisible(e){this.set(Ni.VISIBLE,e)}setZIndex(e){this.set(Ni.Z_INDEX,e)}disposeInternal(){this.state_&&(this.state_.layer=null,this.state_=null),super.disposeInternal()}},ZE=U5;var Op={ADDLAYER:"addlayer",REMOVELAYER:"removelayer"},Su=class extends Ao{constructor(e,t){super(e),this.layer=t}},k5={LAYERS:"layers"},z5=class i extends ZE{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(k5.LAYERS,this.handleLayersChanged_),n?Array.isArray(n)?n=new No(n.slice(),{unique:!0}):jn(typeof n.getArray=="function","Expected `layers` to be an array or a `Collection`"):n=new No(void 0,{unique:!0}),this.setLayers(n)}handleLayerChange_(){this.changed()}handleLayersChanged_(){this.layersListenerKeys_.forEach(li),this.layersListenerKeys_.length=0;let e=this.getLayers();this.layersListenerKeys_.push(qn(e,vo.ADD,this.handleLayersAdd_,this),qn(e,vo.REMOVE,this.handleLayersRemove_,this));for(let n in this.listenerKeys_)this.listenerKeys_[n].forEach(li);ph(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 Su(Op.ADDLAYER,s))}this.changed()}registerLayerListeners_(e){let t=[qn(e,_u.PROPERTYCHANGE,this.handleLayerChange_,this),qn(e,rn.CHANGE,this.handleLayerChange_,this)];e instanceof i&&t.push(qn(e,Op.ADDLAYER,this.handleLayerGroupAdd_,this),qn(e,Op.REMOVELAYER,this.handleLayerGroupRemove_,this)),this.listenerKeys_[Bn(e)]=t}handleLayerGroupAdd_(e){this.dispatchEvent(new Su(Op.ADDLAYER,e.layer))}handleLayerGroupRemove_(e){this.dispatchEvent(new Su(Op.REMOVELAYER,e.layer))}handleLayersAdd_(e){let t=e.element;this.registerLayerListeners_(t),this.dispatchEvent(new Su(Op.ADDLAYER,t)),this.changed()}handleLayersRemove_(e){let t=e.element,n=Bn(t);this.listenerKeys_[n].forEach(li),delete this.listenerKeys_[n],this.dispatchEvent(new Su(Op.REMOVELAYER,t)),this.changed()}getLayers(){return this.get(k5.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 Su(Op.REMOVELAYER,n[r]))}this.set(k5.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=hh(l.extent,r.extent):l.extent=r.extent),l.zIndex===void 0&&(l.zIndex=s)}return t}getSourceState(){return"ready"}},Qy=z5;var Bo={PRERENDER:"prerender",POSTRENDER:"postrender",PRECOMPOSE:"precompose",POSTCOMPOSE:"postcompose",RENDERCOMPLETE:"rendercomplete"};var V5=class extends ZE{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(Ni.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(Ni.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_&&(li(this.sourceChangeKey_),this.sourceChangeKey_=null),this.sourceReady_=!1;let e=this.getSource();e&&(this.sourceChangeKey_=qn(e,rn.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 Hl?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 Jy(r,t.viewState)&&(!s||Dr(s,t.extent))}getAttributions(e){if(!this.isVisible(e))return[];let t=this.getSource()?.getAttributions();if(!t)return[];let n=e instanceof Hl?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(Ni.MAP,e)}getMapInternal(){return this.get(Ni.MAP)}setMap(e){this.mapPrecomposeKey_&&(li(this.mapPrecomposeKey_),this.mapPrecomposeKey_=null),e||this.changed(),this.mapRenderKey_&&(li(this.mapRenderKey_),this.mapRenderKey_=null),e&&(this.mapPrecomposeKey_=qn(e,Bo.PRECOMPOSE,this.handlePrecompose_,this),this.mapRenderKey_=qn(this,rn.CHANGE,e.render,e),this.changed())}handlePrecompose_(e){let t=e.frameState.layerStatesArray,n=this.getLayerState(!1);jn(!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(Ni.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 Jy(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 vA=V5;function KE(i,e,t=0,n=i.length-1,r=Vpe){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),d=.5*Math.sqrt(u*f*(l-f)/l)*(c-l/2<0?-1:1),A=Math.max(t,Math.floor(e-c*f/l+d)),y=Math.min(n,Math.floor(e+(l-c)*f/l+d));KE(i,e,A,y,r)}let s=i[e],o=t,a=n;for(e2(i,t,e),r(i[n],s)>0&&e2(i,t,n);o<a;){for(e2(i,o,a),o++,a--;r(i[o],s)<0;)o++;for(;r(i[a],s)>0;)a--}r(i[t],s)===0?e2(i,t,a):(a++,e2(i,a,n)),a<=e&&(t=a+1),e<=a&&(n=a-1)}}function e2(i,e,t){let n=i[e];i[e]=i[t],i[t]=n}function Vpe(i,e){return i<e?-1:i>e?1:0}var _A=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(!JE(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;JE(e,l)&&(t.leaf?n.push(a):q5(e,l)?this._all(a,n):s.push(a))}t=s.pop()}return n}collides(e){let t=this.data;if(!JE(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(JE(e,o)){if(t.leaf||q5(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=gv([]),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=Gpe(e,n.children,t);if(u!==-1)return n.children.splice(u,1),s.push(n),this._condense(s),this}!c&&!n.leaf&&q5(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=gv(e.slice(t,n+1)),Av(a,this.toBBox),a;r||(r=Math.ceil(Math.log(s)/Math.log(o)),o=Math.ceil(s/Math.pow(o,r-1))),a=gv([]),a.leaf=!1,a.height=r;let l=Math.ceil(s/o),c=l*Math.ceil(Math.sqrt(o));p$(e,t,n,c,this.compareMinX);for(let u=t;u<=n;u+=c){let f=Math.min(u+c-1,n);p$(e,u,f,l,this.compareMinY);for(let d=u;d<=f;d+=l){let A=Math.min(d+l-1,f);a.children.push(this._build(e,d,A,r-1))}}return Av(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=G5(c),f=Wpe(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),n2(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=gv(n.children.splice(o,n.children.length-o));a.height=n.height,a.leaf=n.leaf,Av(n,this.toBBox),Av(a,this.toBBox),t?e[t-1].children.push(a):this._splitRoot(n,a)}_splitRoot(e,t){this.data=gv([e,t]),this.data.height=e.height+1,this.data.leaf=!1,Av(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=t2(e,0,a,this.toBBox),c=t2(e,a,n,this.toBBox),u=jpe(l,c),f=G5(l)+G5(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:qpe,s=e.leaf?this.compareMinY:Hpe,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=t2(e,0,t,s),a=t2(e,n-t,n,s),l=QE(o)+QE(a);for(let c=t;c<n-t;c++){let u=e.children[c];n2(o,e.leaf?s(u):u),l+=QE(o)}for(let c=n-t-1;c>=t;c--){let u=e.children[c];n2(a,e.leaf?s(u):u),l+=QE(a)}return l}_adjustParentBBoxes(e,t,n){for(let r=n;r>=0;r--)n2(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():Av(e[t],this.toBBox)}};function Gpe(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 Av(i,e){t2(i,0,i.children.length,e,i)}function t2(i,e,t,n,r){r||(r=gv(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];n2(r,i.leaf?n(o):o)}return r}function n2(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 qpe(i,e){return i.minX-e.minX}function Hpe(i,e){return i.minY-e.minY}function G5(i){return(i.maxX-i.minX)*(i.maxY-i.minY)}function QE(i){return i.maxX-i.minX+(i.maxY-i.minY)}function Wpe(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 jpe(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 q5(i,e){return i.minX<=e.minX&&i.minY<=e.minY&&e.maxX<=i.maxX&&e.maxY<=i.maxY}function JE(i,e){return e.minX<=i.maxX&&e.minY<=i.maxY&&e.maxX>=i.minX&&e.maxY>=i.minY}function gv(i){return{children:i,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function p$(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;KE(i,o,e,t,r),s.push(e,o,o,t)}}var yA=0,t3=0,ia=1<<yA++,ci=1<<yA++,ra=1<<yA++,Pa=1<<yA++,ad=1<<yA++,xA=1<<yA++,n3=Math.pow(2,yA)-1,W5={[ia]:"boolean",[ci]:"number",[ra]:"string",[Pa]:"color",[ad]:"number[]",[xA]:"size"},Xpe=Object.keys(W5).map(Number).sort(dl);function $pe(i){return i in W5}function od(i){let e=[];for(let t of Xpe)i2(i,t)&&e.push(W5[t]);return e.length===0?"untyped":e.length<3?e.join(" or "):e.slice(0,-1).join(", ")+", or "+e[e.length-1]}function i2(i,e){return(i&e)===e}function e3(i,e){return!!(i&e)}function Up(i,e){return i===e}var Xr=class{constructor(e,t){if(!$pe(e))throw new Error(`literal expressions must have a specific type, got ${od(e)}`);this.type=e,this.value=t}},i3=class{constructor(e,t,...n){this.type=e,this.operator=t,this.args=n}};function r3(i){return{variables:new Map,properties:new Map,featureId:!1,geometryType:!1,mCoordinate:!1,mapState:!1,inputVariables:i}}function hs(i,e,t){switch(typeof i){case"boolean":{if(Up(e,ra))return new Xr(ra,i?"true":"false");if(!i2(e,ia))throw new Error(`got a boolean, but expected ${od(e)}`);return new Xr(ia,i)}case"number":{if(Up(e,xA))return new Xr(xA,ls(i));if(Up(e,ia))return new Xr(ia,!!i);if(Up(e,ra))return new Xr(ra,i.toString());if(!i2(e,ci))throw new Error(`got a number, but expected ${od(e)}`);return new Xr(ci,i)}case"string":{if(Up(e,Pa))return new Xr(Pa,zy(i));if(Up(e,ia))return new Xr(ia,!!i);if(!i2(e,ra))throw new Error(`got a string, but expected ${od(e)}`);return new Xr(ra,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 o0e(i,e,t);for(let n of i)if(typeof n!="number")throw new Error("expected an array of numbers");if(Up(e,xA)){if(i.length!==2)throw new Error(`expected an array of two values for a size, got ${i.length}`);return new Xr(xA,i)}if(Up(e,Pa)){if(i.length===3)return new Xr(Pa,[...i,1]);if(i.length===4)return new Xr(Pa,i);throw new Error(`expected an array of 3 or 4 values for a color, got ${i.length}`)}if(!i2(e,ad))throw new Error(`got an array of numbers, but expected ${od(e)}`);return new Xr(ad,i)}var et={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"},Ype={[et.Get]:Un(ti(1,1/0),m$),[et.Var]:Zpe(),[et.Has]:Un(ti(1,1/0),m$),[et.Id]:Un(Kpe,vv),[et.Concat]:Un(ti(2,1/0),Qi(ra)),[et.GeometryType]:Un(Qpe,vv),[et.LineMetric]:Un(Jpe,vv),[et.Resolution]:Un(H5,vv),[et.Zoom]:Un(H5,vv),[et.Time]:Un(H5,vv),[et.Any]:Un(ti(2,1/0),Qi(ia)),[et.All]:Un(ti(2,1/0),Qi(ia)),[et.Not]:Un(ti(1,1),Qi(ia)),[et.Equal]:Un(ti(2,2),g$()),[et.NotEqual]:Un(ti(2,2),g$()),[et.GreaterThan]:Un(ti(2,2),Qi(ci)),[et.GreaterThanOrEqualTo]:Un(ti(2,2),Qi(ci)),[et.LessThan]:Un(ti(2,2),Qi(ci)),[et.LessThanOrEqualTo]:Un(ti(2,2),Qi(ci)),[et.Multiply]:Un(ti(2,1/0),A$),[et.Coalesce]:Un(ti(2,1/0),A$),[et.Divide]:Un(ti(2,2),Qi(ci)),[et.Add]:Un(ti(2,1/0),Qi(ci)),[et.Subtract]:Un(ti(2,2),Qi(ci)),[et.Clamp]:Un(ti(3,3),Qi(ci)),[et.Mod]:Un(ti(2,2),Qi(ci)),[et.Pow]:Un(ti(2,2),Qi(ci)),[et.Abs]:Un(ti(1,1),Qi(ci)),[et.Floor]:Un(ti(1,1),Qi(ci)),[et.Ceil]:Un(ti(1,1),Qi(ci)),[et.Round]:Un(ti(1,1),Qi(ci)),[et.Sin]:Un(ti(1,1),Qi(ci)),[et.Cos]:Un(ti(1,1),Qi(ci)),[et.Atan]:Un(ti(1,2),Qi(ci)),[et.Sqrt]:Un(ti(1,1),Qi(ci)),[et.Match]:Un(ti(4,1/0),v$,t0e),[et.Between]:Un(ti(3,3),Qi(ci)),[et.Interpolate]:Un(ti(6,1/0),v$,n0e),[et.Case]:Un(ti(3,1/0),e0e,i0e),[et.In]:Un(ti(2,2),r0e),[et.Number]:Un(ti(1,1/0),Qi(n3)),[et.String]:Un(ti(1,1/0),Qi(n3)),[et.Array]:Un(ti(1,1/0),Qi(ci)),[et.Color]:Un(ti(1,4),Qi(ci)),[et.Band]:Un(ti(1,3),Qi(ci)),[et.Palette]:Un(ti(2,2),s0e),[et.ToString]:Un(ti(1,1),Qi(ia|ci|ra|Pa))};function m$(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 Xr(ci,o);break}case"string":{r[s]=new Xr(ra,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 Zpe(){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=hs(s,n3,t);if(!(o instanceof Xr))throw new Error(`style variables should only be literal values (no expressions!), variable name: ${n}`);let a=o.type;if(typeof s=="string"&&e3(r,Pa)&&!e3(r,ra)?a=Pa:Array.isArray(s)&&s.length===2&&e3(r,xA)&&!e3(r,ad)&&(a=xA),r&=a,r===t3)throw new Error(`the type expected from the var operator (${od(e)}) did not have any overlap with the type of the corresponding style variables (${od(a)}), variable name: ${n}`)}if(t.variables.has(n)){let o=t.variables.get(n);if(r&=o,r===t3)throw new Error(`a new type expected from the var operator (${od(e)}) did not have any overlap with the previous type expected for it (${od(o)}), variable name: ${n}`)}return t.variables.set(n,r),new i3(r,"var",new Xr(ra,n))}}function Kpe(i,e,t){t.featureId=!0}function Qpe(i,e,t){t.geometryType=!0}function Jpe(i,e,t){t.mCoordinate=!0}function H5(i,e,t){t.mapState=!0}function vv(i,e,t){let n=i[0];if(i.length!==1)throw new Error(`expected no arguments for ${n} operation`);return[]}function ti(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 A$(i,e,t){let n=i.length-1,r=new Array(n);for(let s=0;s<n;++s){let o=hs(i[s+1],e,t);r[s]=o}return r}function Qi(i){return function(e,t,n){let r=e.length-1,s=new Array(r);for(let o=0;o<r;++o){let a=hs(e[o+1],i,n);s[o]=a}return s}}function g$(){return function(i,e,t){let n=i[0],r=i.length-1,s=new Array(r),o=n3;for(let a=0;a<r;++a){let l=hs(i[a+1],o,t);o&=l.type}if(o===t3)throw new Error(`no common type was found among the arguments of ${n}`);for(let a=0;a<r;++a){let l=hs(i[a+1],o,t);s[a]=l}return s}}function e0e(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 v$(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 t0e(i,e,t){let n=i.length-1,r=hs(i[i.length-1],e,t),s=ra|ci|ia,o=new Array(n-2);for(let l=0;l<n-2;l+=2){try{let c=hs(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===t3)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=hs(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=hs(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[hs(i[1],s,t),...o,r]}function n0e(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 Xr(ci,r),o;try{o=hs(i[2],ci,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=hs(i[l+3],ci,t);a[l]=c}catch(c){throw new Error(`failed to parse argument ${l+2} for interpolate expression: ${c.message}`)}try{let c=hs(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 i0e(i,e,t){let n=hs(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=hs(i[s+1],ia,t);r[s]=o}catch(o){throw new Error(`failed to parse argument ${s} of case expression: ${o.message}`)}try{let o=hs(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 r0e(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=ra:r=ci;let s=new Array(n.length);for(let a=0;a<s.length;a++)try{let l=hs(n[a],r,t);s[a]=l}catch(l){throw new Error(`failed to parse haystack item ${a} for "in" expression: ${l.message}`)}return[hs(i[1],r,t),...s]}function s0e(i,e,t){let n;try{n=hs(i[1],ci,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=hs(r[o],Pa,t)}catch(l){throw new Error(`failed to parse color at index ${o} in palette expression: ${l.message}`)}if(!(a instanceof Xr))throw new Error(`the palette color at index ${o} must be a literal value`);s[o]=a}return[n,...s]}function Un(...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 i3(t,r,...s)}}function o0e(i,e,t){let n=i[0],r=Ype[n];if(!r)throw new Error(`unknown operator: ${n}`);return r(i,e,t)}function s3(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 s3(i.getGeometries()[0]);default:return""}}function j5(){return{variables:{},properties:{},resolution:NaN,featureId:null,geometryType:""}}function Eu(i,e,t){let n=hs(i,e,t);return Tu(n,t)}function Tu(i,e){if(i instanceof Xr){if(i.type===Pa&&typeof i.value=="string"){let n=zy(i.value);return function(){return n}}return function(){return i.value}}let t=i.operator;switch(t){case et.Number:case et.String:case et.Coalesce:return a0e(i,e);case et.Get:case et.Var:case et.Has:return l0e(i,e);case et.Id:return n=>n.featureId;case et.GeometryType:return n=>n.geometryType;case et.Concat:{let n=i.args.map(r=>Tu(r,e));return r=>"".concat(...n.map(s=>s(r).toString()))}case et.Resolution:return n=>n.resolution;case et.Any:case et.All:case et.Between:case et.In:case et.Not:return u0e(i,e);case et.Equal:case et.NotEqual:case et.LessThan:case et.LessThanOrEqualTo:case et.GreaterThan:case et.GreaterThanOrEqualTo:return c0e(i,e);case et.Multiply:case et.Divide:case et.Add:case et.Subtract:case et.Clamp:case et.Mod:case et.Pow:case et.Abs:case et.Floor:case et.Ceil:case et.Round:case et.Sin:case et.Cos:case et.Atan:case et.Sqrt:return h0e(i,e);case et.Case:return f0e(i,e);case et.Match:return d0e(i,e);case et.Interpolate:return p0e(i,e);case et.ToString:return m0e(i,e);default:throw new Error(`Unsupported operator ${t}`)}}function a0e(i,e){let t=i.operator,n=i.args.length,r=new Array(n);for(let s=0;s<n;++s)r[s]=Tu(i.args[s],e);switch(t){case et.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 et.Number:case et.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 l0e(i,e){let n=i.args[0].value;switch(i.operator){case et.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 et.Var:return r=>r.variables[n];case et.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 c0e(i,e){let t=i.operator,n=Tu(i.args[0],e),r=Tu(i.args[1],e);switch(t){case et.Equal:return s=>n(s)===r(s);case et.NotEqual:return s=>n(s)!==r(s);case et.LessThan:return s=>n(s)<r(s);case et.LessThanOrEqualTo:return s=>n(s)<=r(s);case et.GreaterThan:return s=>n(s)>r(s);case et.GreaterThanOrEqualTo:return s=>n(s)>=r(s);default:throw new Error(`Unsupported comparison operator ${t}`)}}function u0e(i,e){let t=i.operator,n=i.args.length,r=new Array(n);for(let s=0;s<n;++s)r[s]=Tu(i.args[s],e);switch(t){case et.Any:return s=>{for(let o=0;o<n;++o)if(r[o](s))return!0;return!1};case et.All:return s=>{for(let o=0;o<n;++o)if(!r[o](s))return!1;return!0};case et.Between:return s=>{let o=r[0](s),a=r[1](s),l=r[2](s);return o>=a&&o<=l};case et.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 et.Not:return s=>!r[0](s);default:throw new Error(`Unsupported logical operator ${t}`)}}function h0e(i,e){let t=i.operator,n=i.args.length,r=new Array(n);for(let s=0;s<n;++s)r[s]=Tu(i.args[s],e);switch(t){case et.Multiply:return s=>{let o=1;for(let a=0;a<n;++a)o*=r[a](s);return o};case et.Divide:return s=>r[0](s)/r[1](s);case et.Add:return s=>{let o=0;for(let a=0;a<n;++a)o+=r[a](s);return o};case et.Subtract:return s=>r[0](s)-r[1](s);case et.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 et.Mod:return s=>r[0](s)%r[1](s);case et.Pow:return s=>Math.pow(r[0](s),r[1](s));case et.Abs:return s=>Math.abs(r[0](s));case et.Floor:return s=>Math.floor(r[0](s));case et.Ceil:return s=>Math.ceil(r[0](s));case et.Round:return s=>Math.round(r[0](s));case et.Sin:return s=>Math.sin(r[0](s));case et.Cos:return s=>Math.cos(r[0](s));case et.Atan:return n===2?s=>Math.atan2(r[0](s),r[1](s)):s=>Math.atan(r[0](s));case et.Sqrt:return s=>Math.sqrt(r[0](s));default:throw new Error(`Unsupported numeric operator ${t}`)}}function f0e(i,e){let t=i.args.length,n=new Array(t);for(let r=0;r<t;++r)n[r]=Tu(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 d0e(i,e){let t=i.args.length,n=new Array(t);for(let r=0;r<t;++r)n[r]=Tu(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 p0e(i,e){let t=i.args.length,n=new Array(t);for(let r=0;r<t;++r)n[r]=Tu(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),d=Array.isArray(f);if(d&&(f=Wj(f)),u>=o)return c===2?f:d?A0e(s,o,a,l,u,f):r2(s,o,a,l,u,f);a=u,l=f}return l}}function m0e(i,e){let t=i.operator,n=i.args.length,r=new Array(n);for(let s=0;s<n;++s)r[s]=Tu(i.args[s],e);if(t===et.ToString)return s=>{let o=r[0](s);return i.args[0].type===Pa?Vy(o):o.toString()};throw new Error(`Unsupported convert operator ${t}`)}function r2(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 A0e(i,e,t,n,r,s){if(r-t===0)return n;let a=PN(n),l=PN(s),c=l[2]-a[2];c>180?c-=360:c<-180&&(c+=360);let u=[r2(i,e,t,a[0],r,l[0]),r2(i,e,t,a[1],r,l[1]),a[2]+r2(i,e,t,0,r,c),r2(i,e,t,n[3],r,s[3])];return jj(u)}function g0e(i){return!0}function v0e(i,e){e=e??r3();let t=_0e(i,e),n=j5();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=s3(r.getGeometry())),t(n)}}function _$(i,e){e=e??r3();let t=i.length,n=new Array(t);for(let o=0;o<t;++o)n[o]=X5(i[o],e);let r=j5(),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=s3(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 w$(i,e){if(e=e??r3(),!Array.isArray(i))return _$([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 v0e(s,e)}return _$(i,e)}function _0e(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?Eu(s.filter,ia,e):g0e,a;if(Array.isArray(s.style)){let l=s.style.length;a=new Array(l);for(let c=0;c<l;++c)a[c]=X5(s.style[c],e)}else a=[X5(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 X5(i,e){let t=s2(i,"",e),n=o2(i,"",e),r=x0e(i,e),s=y0e(i,e),o=Oo(i,"z-index",e);if(!t&&!n&&!r&&!s&&!mu(i))throw new Error("No fill, stroke, point, or text symbolizer properties in style: "+JSON.stringify(i));let a=new Nr;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 s2(i,e,t){let n;if(e+"fill-pattern-src"in i)n=T0e(i,e+"fill-",t);else{if(i[e+"fill-color"]==="none")return s=>null;n=a3(i,e+"fill-color",t)}if(!n)return null;let r=new us;return function(s){let o=n(s);return o===ME?null:(r.setColor(o),r)}}function o2(i,e,t){let n=Oo(i,e+"stroke-width",t),r=a3(i,e+"stroke-color",t);if(!n&&!r)return null;let s=ld(i,e+"stroke-line-cap",t),o=ld(i,e+"stroke-line-join",t),a=S$(i,e+"stroke-line-dash",t),l=Oo(i,e+"stroke-line-dash-offset",t),c=Oo(i,e+"stroke-miter-limit",t),u=Oo(i,e+"stroke-offset",t),f=new Es;return function(d){if(r){let A=r(d);if(A===ME)return null;f.setColor(A)}if(n&&f.setWidth(n(d)),s){let A=s(d);if(A!=="butt"&&A!=="round"&&A!=="square")throw new Error("Expected butt, round, or square line cap");f.setLineCap(A)}if(o){let A=o(d);if(A!=="bevel"&&A!=="round"&&A!=="miter")throw new Error("Expected bevel, round, or miter line join");f.setLineJoin(A)}return a&&f.setLineDash(a(d)),l&&f.setLineDashOffset(l(d)),c&&f.setMiterLimit(c(d)),u&&f.setOffset(u(d)),f}}function x0e(i,e){let t="text-",n=ld(i,t+"value",e);if(!n)return null;let r=s2(i,t,e),s=s2(i,t+"background-",e),o=o2(i,t,e),a=o2(i,t+"background-",e),l=ld(i,t+"font",e),c=Oo(i,t+"max-angle",e),u=Oo(i,t+"offset-x",e),f=Oo(i,t+"offset-y",e),d=_v(i,t+"overflow",e),A=ld(i,t+"placement",e),y=Oo(i,t+"repeat",e),w=l3(i,t+"scale",e),S=_v(i,t+"rotate-with-view",e),T=Oo(i,t+"rotation",e),R=ld(i,t+"align",e),P=ld(i,t+"justify",e),I=ld(i,t+"baseline",e),F=_v(i,t+"keep-upright",e),D=S$(i,t+"padding",e),L=c3(i,t+"declutter-mode"),C=new rd({declutterMode:L});return function(B){if(C.setText(n(B)),r&&C.setFill(r(B)),s&&C.setBackgroundFill(s(B)),o&&C.setStroke(o(B)),a&&C.setBackgroundStroke(a(B)),l&&C.setFont(l(B)),c&&C.setMaxAngle(c(B)),u&&C.setOffsetX(u(B)),f&&C.setOffsetY(f(B)),d&&C.setOverflow(d(B)),A){let k=A(B);if(k!=="point"&&k!=="line")throw new Error("Expected point or line for text-placement");C.setPlacement(k)}if(y&&C.setRepeat(y(B)),w&&C.setScale(w(B)),S&&C.setRotateWithView(S(B)),T&&C.setRotation(T(B)),R){let k=R(B);if(k!=="left"&&k!=="center"&&k!=="right"&&k!=="end"&&k!=="start")throw new Error("Expected left, right, center, start, or end for text-align");C.setTextAlign(k)}if(P){let k=P(B);if(k!=="left"&&k!=="right"&&k!=="center")throw new Error("Expected left, right, or center for text-justify");C.setJustify(k)}if(I){let k=I(B);if(k!=="bottom"&&k!=="top"&&k!=="middle"&&k!=="alphabetic"&&k!=="hanging")throw new Error("Expected bottom, top, middle, alphabetic, or hanging for text-baseline");C.setTextBaseline(k)}return D&&C.setPadding(D(B)),F&&C.setKeepUpright(F(B)),C}}function y0e(i,e){return"icon-src"in i?b0e(i,e):"shape-points"in i?w0e(i,e):"circle-radius"in i?S0e(i,e):null}function b0e(i,e){let t="icon-",n=t+"src",r=T$(i[n],n),s=o3(i,t+"anchor",e),o=l3(i,t+"scale",e),a=Oo(i,t+"opacity",e),l=o3(i,t+"displacement",e),c=Oo(i,t+"rotation",e),u=_v(i,t+"rotate-with-view",e),f=y$(i,t+"anchor-origin"),d=b$(i,t+"anchor-x-units"),A=b$(i,t+"anchor-y-units"),y=cd(i,t+"color"),w,S=null;y!==void 0&&(Array.isArray(y)&&y.length>0&&typeof y[0]=="string"?S=a3(i,t+"color",e):w=E$(y,t+"color"));let T=M0e(i,t+"cross-origin"),R=C0e(i,t+"offset"),P=y$(i,t+"offset-origin"),I=$5(i,t+"width"),F=$5(i,t+"height"),D=E0e(i,t+"size"),L=c3(i,t+"declutter-mode"),C={src:r,anchorOrigin:f,anchorXUnits:d,anchorYUnits:A,crossOrigin:T,offset:R,offsetOrigin:P,height:F,width:I,size:D,declutterMode:L},B=null;return function(k){if(B)S&&B.setColor(S(k));else{let z=S?S(k):w;B=new dA(z!==void 0?Object.assign({},C,{color:z}):Object.assign({},C))}return a&&B.setOpacity(a(k)),l&&B.setDisplacement(l(k)),c&&B.setRotation(c(k)),u&&B.setRotateWithView(u(k)),o&&B.setScale(o(k)),s&&B.setAnchor(s(k)),B}}function w0e(i,e){let t="shape-",n=t+"points",r=t+"radius",s=Y5(i[n],n);if(!(r in i))throw new Error(`Expected a number for ${r}`);let o=Oo(i,r,e),a=typeof i[r]=="number"?i[r]:5,l=t+"radius2",c=Oo(i,l,e),u=typeof i[l]=="number"?i[l]:void 0,f=s2(i,t,e),d=o2(i,t,e),A=l3(i,t+"scale",e),y=o3(i,t+"displacement",e),w=Oo(i,t+"rotation",e),S=_v(i,t+"rotate-with-view",e),T=$5(i,t+"angle"),R=c3(i,t+"declutter-mode"),P=new DE({points:s,radius:a,radius2:u,angle:T,declutterMode:R});return function(I){return o&&P.setRadius(o(I)),c&&P.setRadius2(c(I)),f&&P.setFill(f(I)),d&&P.setStroke(d(I)),y&&P.setDisplacement(y(I)),w&&P.setRotation(w(I)),S&&P.setRotateWithView(S(I)),A&&P.setScale(A(I)),P}}function S0e(i,e){let t="circle-",n=s2(i,t,e),r=o2(i,t,e),s=Oo(i,t+"radius",e),o=l3(i,t+"scale",e),a=o3(i,t+"displacement",e),l=Oo(i,t+"rotation",e),c=_v(i,t+"rotate-with-view",e),u=c3(i,t+"declutter-mode"),f=new NE({radius:5,declutterMode:u});return function(d){return s&&f.setRadius(s(d)),n&&f.setFill(n(d)),r&&f.setStroke(r(d)),a&&f.setDisplacement(a(d)),l&&f.setRotation(l(d)),c&&f.setRotateWithView(c(d)),o&&f.setScale(o(d)),f}}function cd(i,e){if(!(e in i))return;let t=i[e];return t===void 0?void 0:t}function Oo(i,e,t){let n=cd(i,e);if(n===void 0)return;let r=Eu(n,ci,t);return function(s){return Y5(r(s),e)}}function ld(i,e,t){let n=cd(i,e);if(n===void 0)return null;let r=Eu(n,ra,t);return function(s){return T$(r(s),e)}}function T0e(i,e,t){let n=ld(i,e+"pattern-src",t),r=x$(i,e+"pattern-offset",t),s=x$(i,e+"pattern-size",t),o=a3(i,e+"color",t);return function(a){return{src:n(a),offset:r&&r(a),size:s&&s(a),color:o&&o(a)}}}function _v(i,e,t){let n=cd(i,e);if(n===void 0)return null;let r=Eu(n,ia,t);return function(s){let o=r(s);if(typeof o!="boolean")throw new Error(`Expected a boolean for ${e}`);return o}}function a3(i,e,t){let n=cd(i,e);if(n===void 0)return null;let r=Eu(n,Pa,t);return function(s){return E$(r(s),e)}}function S$(i,e,t){let n=cd(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=Eu(o,ci,t);return function(c){return Y5(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=Eu(n,ad,t);return function(s){return a2(r(s),e)}}function o3(i,e,t){let n=cd(i,e);if(n===void 0)return null;let r=Eu(n,ad,t);return function(s){let o=a2(r(s),e);if(o.length!==2)throw new Error(`Expected two numbers for ${e}`);return o}}function x$(i,e,t){let n=cd(i,e);if(n===void 0)return null;let r=Eu(n,ad,t);return function(s){return M$(r(s),e)}}function l3(i,e,t){let n=cd(i,e);if(n===void 0)return null;let r=Eu(n,ad|ci,t);return function(s){return R0e(r(s),e)}}function $5(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 E0e(i,e){let t=i[e];if(t!==void 0){if(typeof t=="number")return ls(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 M0e(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 y$(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 b$(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 C0e(i,e){let t=i[e];if(t!==void 0)return a2(t,e)}function c3(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 a2(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 T$(i,e){if(typeof i!="string")throw new Error(`Expected a string for ${e}`);return i}function Y5(i,e){if(typeof i!="number")throw new Error(`Expected a number for ${e}`);return i}function E$(i,e){if(typeof i=="string")return i;let t=a2(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 M$(i,e){let t=a2(i,e);if(t.length!==2)throw new Error(`Expected an array of two numbers for ${e}`);return t}function R0e(i,e){return typeof i=="number"?i:M$(i,e)}var C$={RENDER_ORDER:"renderOrder"},Z5=class extends vA{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(C$.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 _A(9)),this.getRenderer().renderDeclutter(e,t)}setRenderOrder(e){this.set(C$.RENDER_ORDER,e)}setStyle(e){this.style_=e===void 0?HN:e;let t=I0e(e);this.styleFunction_=e===null?void 0:rX(t),this.changed()}setDeclutter(e){this.declutter_=e?String(e):void 0,this.changed()}};function I0e(i){if(i===void 0)return HN;if(!i)return null;if(typeof i=="function"||i instanceof Nr)return i;if(Array.isArray(i)&&i.length===0)return[];if(Array.isArray(i)&&i[0]instanceof Nr){let t=i.length,n=new Array(t);for(let r=0;r<t;++r){let s=i[r];if(!(s instanceof Nr))throw new Error("Expected a list of style instances");n[r]=s}return n}return w$(i)}var u3=Z5;var K5=class extends Ao{constructor(e,t,n,r){super(e),this.inversePixelTransform=t,this.frameState=n,this.context=r}},h3=K5;var Q5=class extends Tp{constructor(e){super(),this.map_=e}dispatchRenderEvent(e,t){ei()}calculateMatrices2D(e){let t=e.viewState,n=e.coordinateToPixelTransform,r=e.pixelToCoordinateTransform;Do(n,e.size[0]/2,e.size[1]/2,1/t.resolution,-1/t.resolution,-t.rotation,-t.center[0],-t.center[1]),aE(r,n)}forEachFeatureAtCoordinate(e,t,n,r,s,o,a,l){let c,u=t.viewState;function f(I,F,D,L){return s.call(o,F,I?D:null,L)}let d=u.projection,A=qT(e.slice(),d),y=[[0,0]];if(d.canWrapX()&&r){let I=d.getExtent(),F=Kn(I);y.push([-F,0],[F,0])}let w=t.layerStatesArray,S=w.length,T=[],R=[];for(let I=0;I<y.length;I++)for(let F=S-1;F>=0;--F){let D=w[F],L=D.layer;if(L.hasRenderer()&&Jy(D,u)&&a.call(l,L)){let C=L.getRenderer(),B=L.getSource();if(C&&B){let k=B.getWrapX()?A:e,z=f.bind(null,D.managed);R[0]=k[0]+y[I][0],R[1]=k[1]+y[I][1],c=C.forEachFeatureAtCoordinate(R,t,n,z,T)}if(c)return c}}if(T.length===0)return;let P=1/T.length;return T.forEach((I,F)=>I.distanceSq+=F*P),T.sort((I,F)=>I.distanceSq-F.distanceSq),T.some(I=>c=I.callback(I.feature,I.layer,I.geometry)),c}hasFeatureAtCoordinate(e,t,n,r,s,o){return this.forEachFeatureAtCoordinate(e,t,n,r,Zf,this,s,o)!==void 0}getMap(){return this.map_}renderFrame(e){ei()}scheduleExpireIconCache(e){ta.canExpireCache()&&e.postRenderFunctions.push(P0e)}};function P0e(i,e){ta.expire()}var R$=Q5;var J5=class extends R${constructor(e){super(e),this.fontChangeListenerKey_=qn(hA,_u.PROPERTYCHANGE,e.redrawText,e),this.element_=io?rE():document.createElement("div");let t=this.element_.style;t.position="absolute",t.width="100%",t.height="100%",t.zIndex="0",this.element_.className=Dp+" 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 h3(e,void 0,t);n.dispatchEvent(r)}}disposeInternal(){li(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(Bo.PRECOMPOSE,e);let t=e.layerStatesArray.sort((u,f)=>u.zIndex-f.zIndex);t.some(u=>u.layer instanceof u3&&u.layer.getDeclutter())&&(e.declutter={});let r=e.viewState;this.children_.length=0;let o=this.getMap().getTargetElement(),a;ql(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 d=t[u];e.layerIndex=u;let A=d.layer,y=A.getSourceState();if(!Jy(d,r)||y!="ready"&&y!="undefined"){A.unrender();continue}let w=A.render(e,c);w&&(w!==c&&(this.children_.push(w),c=w),l.push(d))}this.declutter(e,l),JW(this.element_,this.children_);for(let u of a?this.children_:[]){let f=u.firstElementChild||u,d=u.style.backgroundColor;if(d&&(!ql(f)||f.width>0)&&(a.fillStyle=d,a.fillRect(0,0,a.canvas.width,a.canvas.height)),!ql(f)||f.width===0)continue;a.save();let A=u.style.opacity||f.style.opacity;a.globalAlpha=A===""?1:Number(A);let y=f.style.transform;if(y)a.transform(...oE(y));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(Bo.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))}}},I$=J5;function P$(i){if(i instanceof vA){i.setMapInternal(null);return}i instanceof Qy&&i.getLayers().forEach(P$)}function L$(i,e){if(i instanceof vA){i.setMapInternal(e);return}if(i instanceof Qy){let t=i.getLayers().getArray();for(let n=0,r=t.length;n<r;++n)L$(t[n],e)}}var e6=class extends zs{constructor(e){super(),e=e||{},this.on,this.once,this.un;let t=L0e(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:XW,this.postRenderTimeoutHandle_,this.animationDelayKey_,this.animationDelay_=this.animationDelay_.bind(this),this.coordinateToPixelTransform_=go(),this.pixelToCoordinateTransform_=go(),this.frameIndex_=0,this.frameState_=null,this.previousExtent_=null,this.viewPropertyListenerKey_=null,this.viewChangeListenerKey_=null,this.layerGroupPropertyListenerKeys_=null,io||(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,io||(this.resizeObserver_=new ResizeObserver(()=>this.updateSize())),this.controls=t.controls||(io?new No:qE()),this.interactions=t.interactions||(io?new No:YE({onFocusOnly:!0})),this.overlays_=t.overlays,this.overlayIdIndex_={},this.renderer_=null,this.postRenderFunctions_=[],this.tileQueue_=new zX(this.getTilePriority.bind(this),this.handleTileChange_.bind(this)),this.addChangeListener(Fo.LAYERGROUP,this.handleLayerGroupChanged_),this.addChangeListener(Fo.VIEW,this.handleViewChanged_),this.addChangeListener(Fo.SIZE,this.handleSizeChanged_),this.addChangeListener(Fo.TARGET,this.handleTargetChanged_),this.setProperties(t.values);let n=this;e.view&&!(e.view instanceof Hl)&&e.view.then(function(r){n.setView(new Hl(r))}),this.controls.addEventListener(vo.ADD,r=>{r.element.setMap(this)}),this.controls.addEventListener(vo.REMOVE,r=>{r.element.setMap(null)}),this.interactions.addEventListener(vo.ADD,r=>{r.element.setMap(this)}),this.interactions.addEventListener(vo.REMOVE,r=>{r.element.setMap(null)}),this.overlays_.addEventListener(vo.ADD,r=>{this.addOverlayInternal_(r.element)}),this.overlays_.addEventListener(vo.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){L$(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:Zf,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 Qy?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:Zf,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(Fo.TARGET)}getTargetElement(){return this.targetElement_}getCoordinateFromPixel(e){return yy(this.getCoordinateFromPixelInternal(e),this.getView().getProjection())}getCoordinateFromPixelInternal(e){let t=this.frameState_;return t?jr(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(Fo.LAYERGROUP)}setLayers(e){let t=this.getLayerGroup();if(e instanceof No){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=gu(e,this.getView().getProjection());return this.getPixelFromCoordinateInternal(t)}getPixelFromCoordinateInternal(e){let t=this.frameState_;return t?jr(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(Fo.SIZE)}getView(){return this.get(Fo.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 VX(this.frameState_,e,t,n,r)}handleBrowserEvent(e,t){t=t||e.type;let n=new _h(t,this,e);this.handleMapBrowserEvent(n)}handleMapBrowserEvent(e){if(!this.frameState_)return;let t=e.originalEvent,n=t.type;if(n===Yy.POINTERDOWN||n===rn.WHEEL||n===rn.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[so.ANIMATING]||o[so.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(Bo.RENDERCOMPLETE)&&this.renderer_.dispatchRenderEvent(Bo.RENDERCOMPLETE,e),this.loaded_===!1&&(this.loaded_=!0,this.dispatchEvent(new Fp(xh.LOADEND,this,e)))):this.loaded_===!0&&(this.loaded_=!1,this.dispatchEvent(new Fp(xh.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)li(this.targetChangeHandlerKeys_[n]);this.targetChangeHandlerKeys_=null,this.viewport_.removeEventListener(rn.CONTEXTMENU,this.boundHandleBrowserEvent_),this.viewport_.removeEventListener(rn.WHEEL,this.boundHandleBrowserEvent_),this.mapBrowserEventHandler_.dispose(),this.mapBrowserEventHandler_=null,this.viewport_.remove()}if(this.targetElement_&&!ql(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(ql(t)||t.appendChild(this.viewport_),this.renderer_||(this.renderer_=new I$(this)),!ql(t)){this.mapBrowserEventHandler_=new UX(this,this.moveTolerance_);for(let r in Ar)this.mapBrowserEventHandler_.addEventListener(Ar[r],this.handleMapBrowserEvent.bind(this));this.viewport_.addEventListener(rn.CONTEXTMENU,this.boundHandleBrowserEvent_,!1),this.viewport_.addEventListener(rn.WHEEL,this.boundHandleBrowserEvent_,iE?{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_=[qn(n,rn.KEYDOWN,this.handleBrowserEvent,this),qn(n,rn.KEYPRESS,this.handleBrowserEvent,this)],!ql(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_&&(li(this.viewPropertyListenerKey_),this.viewPropertyListenerKey_=null),this.viewChangeListenerKey_&&(li(this.viewChangeListenerKey_),this.viewChangeListenerKey_=null);let e=this.getView();e&&(this.updateViewportSize_(this.getSize()),this.viewPropertyListenerKey_=qn(e,_u.PROPERTYCHANGE,this.handleViewPropertyChanged_,this),this.viewChangeListenerKey_=qn(e,rn.CHANGE,this.handleViewPropertyChanged_,this),e.resolveConstraints(0)),this.render()}handleLayerGroupChanged_(){this.layerGroupPropertyListenerKeys_&&(this.layerGroupPropertyListenerKeys_.forEach(li),this.layerGroupPropertyListenerKeys_=null);let e=this.getLayerGroup();e&&(this.handleLayerAdd_(new Su("addlayer",e)),this.layerGroupPropertyListenerKeys_=[qn(e,_u.PROPERTYCHANGE,this.render,this),qn(e,rn.CHANGE,this.render,this),qn(e,"addlayer",this.handleLayerAdd_,this),qn(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){P$(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&&DD(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:gy(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:Bn(this),renderTargets:{}},a.nextCenter&&a.nextResolution){let l=isNaN(a.nextRotation)?a.rotation:a.nextRotation;s.nextExtent=gy(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_||!fh(this.previousExtent_)&&!Xm(s.extent,this.previousExtent_))&&(this.dispatchEvent(new Fp(xh.MOVESTART,this,r)),this.previousExtent_=jm(this.previousExtent_)),this.previousExtent_&&!s.viewHints[so.ANIMATING]&&!s.viewHints[so.INTERACTING]&&!Xm(s.extent,this.previousExtent_)&&(this.dispatchEvent(new Fp(xh.MOVEEND,this,s)),FT(s.extent,this.previousExtent_))),this.dispatchEvent(new Fp(xh.POSTRENDER,this,s)),this.renderComplete_=(this.hasListener(xh.LOADSTART)||this.hasListener(xh.LOADEND)||this.hasListener(Bo.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 Su("removelayer",t)),this.set(Fo.LAYERGROUP,e)}setSize(e){this.set(Fo.SIZE,e)}setTarget(e){this.set(Fo.TARGET,e)}setView(e){if(!e||e instanceof Hl){this.set(Fo.VIEW,e);return}this.set(Fo.VIEW,new Hl);let t=this;e.then(function(n){t.setView(new Hl(n))})}updateSize(){let e=this.getTargetElement(),t;if(e){let r,s;if(ql(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)],!DD(t)&&(e.offsetWidth||e.offsetHeight||e.getClientRects().length)&&zT("No map visible because the map container's width or height are 0."))}let n=this.getSize();t&&(!n||!ea(t,n))&&(this.updateViewportSize_(t),this.setSize(t))}updateViewportSize_(e){let t=this.getView();t&&t.setViewportSize(e)}};function L0e(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 Qy({layers:i.layers});t[Fo.LAYERGROUP]=n,t[Fo.TARGET]=i.target,t[Fo.VIEW]=i.view instanceof Hl?i.view:new Hl;let r;i.controls!==void 0&&(Array.isArray(i.controls)?r=new No(i.controls.slice()):(jn(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 No(i.interactions.slice()):(jn(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 No(i.overlays.slice()):(jn(typeof i.overlays.getArray=="function","Expected `overlays` to be an array or an `ol/Collection.js`"),o=i.overlays):o=new No,{controls:r,interactions:s,keyboardEventTarget:e,overlays:o,values:t}}var D$=e6;function f3(i){return i instanceof Image||i instanceof HTMLCanvasElement||i instanceof HTMLVideoElement||i instanceof ImageBitmap?i:null}var D0e=new Error("disposed");var N0e=[256,256],t6=class extends Q1{constructor(e){let t=an.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=f3(this.data_);return e?[e.width,e.height]:N0e}getData(){return this.data_}getError(){return this.error_}load(){if(this.state!==an.IDLE&&this.state!==an.ERROR)return;this.state=an.LOADING,this.changed();let e=this;this.loader_().then(function(t){e.data_=t,e.state=an.LOADED,e.changed()}).catch(function(t){e.error_=t,e.state=an.ERROR,e.changed()})}disposeInternal(){this.controller_&&(this.controller_.abort(D0e),this.controller_=null),super.disposeInternal()}},n6=t6;var i6=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 Tp&&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 jn(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 jn(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){jn(!(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}},r6=i6;var s6=class{constructor(){this.instructions_=[],this.zIndex=0,this.offset_=0,this.pendingMethod_,this.context_=new Proxy(Sy(),{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}},d3=s6;var F0e=5,o6=class extends cE{constructor(e){super(),this.ready=!0,this.boundHandleImageChange_=this.handleImageChange_.bind(this),this.layer_=e,this.staleKeys_=new Array,this.maxStaleKeys=F0e,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 ei()}getData(e){return null}prepareFrame(e){return ei()}renderFrame(e,t){return ei()}forEachFeatureAtCoordinate(e,t,n,r,s){}getLayer(){return this.layer_}handleFontsChanged(){}handleImageChange_(e){let t=e.target;(t.getState()===In.LOADED||t.getState()===In.ERROR)&&this.renderIfReadyAndVisible()}loadImage(e){let t=e.getState();return t!=In.LOADED&&t!=In.ERROR&&e.addEventListener(rn.CHANGE,this.boundHandleImageChange_),t==In.IDLE&&(e.load(),t=e.getState()),t==In.LOADED}renderIfReadyAndVisible(){let e=this.getLayer();e&&e.getVisible()&&e.getSourceState()==="ready"&&e.changed()}renderDeferred(e){}disposeInternal(){delete this.layer_,super.disposeInternal()}},N$=o6;var l6=[],xv=null;function B0e(){xv=Di(1,1,void 0,{willReadFrequently:!0})}var a6=class extends N${constructor(e){super(e),this.container=null,this.renderedResolution,this.tempTransform=go(),this.pixelTransform=go(),this.inversePixelTransform=go(),this.context=null,this.deferredContext_=null,this.containerReused=!1,this.frameState=null}getImageData(e,t,n){xv||B0e(),xv.clearRect(0,0,1,1);let r;try{xv.drawImage(e,t,n,1,1,0,0,1,1),r=xv.getImageData(0,0,1,1).data}catch{return xv=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(ql(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&&ea(Fc(e.style.backgroundColor),Fc(n)))){let c=e.firstElementChild;ql(c)&&(l=c.getContext("2d"))}if(l&&oj(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=io?rE():document.createElement("div"),a.className=o;let c=a.style;c.position="absolute",c.width="100%",c.height="100%",l=Di();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=Cc(n),s=k1(n),o=U1(n),a=O1(n);jr(t.coordinateToPixelTransform,r),jr(t.coordinateToPixelTransform,s),jr(t.coordinateToPixelTransform,o),jr(t.coordinateToPixelTransform,a);let l=this.inversePixelTransform;jr(l,r),jr(l,s),jr(l,o),jr(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(Kn(n)/r*o),l=Math.round(Lr(n)/r*o);Do(this.pixelTransform,e.size[0]/2,e.size[1]/2,1/o,1/o,s,-a/2,-l/2),aE(this.inversePixelTransform,this.pixelTransform);let c=sj(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 h3(e,this.inversePixelTransform,n,t);r.dispatchEvent(s)}}preRender(e,t){this.frameState=t,!t.declutter&&this.dispatchRenderEvent_(Bo.PRERENDER,e,t)}postRender(e,t){t.declutter||this.dispatchRenderEvent_(Bo.POSTRENDER,e,t)}renderDeferredInternal(e){}getRenderContext(e){return e.declutter&&!this.deferredContext_&&(this.deferredContext_=new d3),e.declutter?this.deferredContext_.getContext():this.context}renderDeferred(e){e.declutter&&(this.dispatchRenderEvent_(Bo.PRERENDER,this.context,e),e.declutter&&this.deferredContext_&&(this.deferredContext_.draw(this.context),this.deferredContext_.clear()),this.renderDeferredInternal(e),this.dispatchRenderEvent_(Bo.POSTRENDER,this.context,e))}getRenderTransform(e,t,n,r,s,o,a){let l=s/2,c=o/2,u=r/t,f=-u,d=-e[0]+a,A=-e[1];return Do(this.tempTransform,l,c,u,f,-n,d,A)}disposeInternal(){delete this.frameState,super.disposeInternal()}},p3=a6;function c6(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 O0e(i,e,t){let n=i[t];return n?n.delete(e):!1}function F$(i,e){let t=i.layerStatesArray[i.layerIndex];t.extent&&(e=hh(e,vu(t.extent,i.viewState.projection)));let n=t.layer.getRenderSource();if(!n.getWrapX()){let r=n.getTileGridForProjection(i.viewState.projection).getExtent();r&&(e=hh(e,r))}return e}var u6=class extends p3{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=Wr(),this.tempTileRange_=new QT(0,0,0,0),this.tempTileCoord_=$1(0,0,0);let n=t.cacheSize!==void 0?t.cacheSize:512;this.tileCache_=new r6(n),this.sourceTileCache_=null,this.layerExtent=null,this.maxStaleKeys=n*.5}getTileCache(){return this.tileCache_}getSourceTileCache(){return this.sourceTileCache_||(this.sourceTileCache_=new r6(512)),this.sourceTileCache_}getOrCreateTile(e,t,n,r){let s=this.tileCache_,a=this.getLayer().getSource(),l=Y1(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||W1(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=jr(t.pixelToCoordinateTransform,e.slice()),s=n.getExtent();if(s&&!fu(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),d=this.getTile(u,f[1],f[2],t);if(!d||d.getState()!==an.LOADED)continue;let A=l.getOrigin(u),y=ls(l.getTileSize(u)),w=l.getResolution(u),S;if(d instanceof sE||d instanceof lE)S=d.getImage();else if(d instanceof n6){if(S=f3(d.getData()),!S)continue}else continue;let T=Math.floor(c*((r[0]-A[0])/w-f[1]*y[0])),R=Math.floor(c*((A[1]-r[1])/w-f[2]*y[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=Bn(l);u in e.wantedTiles||(e.wantedTiles[u]={});let f=e.wantedTiles[u],d=a.getMapInternal(),A=Math.max(n-s,c.getMinZoom(),c.getZForResolution(Math.min(a.getMaxResolution(),d?d.getView().getResolutionForZoom(Math.max(a.getMinZoom(),0)):c.getResolution(0)),l.zDirection)),y=o.rotation,w=y?vD(o.center,o.resolution,y,e.size):void 0;for(let S=n;S>=A;--S){let T=c.getTileRangeForExtentAndZ(t,S,this.tempTileRange_),R=c.getResolution(S);for(let P=T.minX;P<=T.maxX;++P)for(let I=T.minY;I<=T.maxY;++I){if(y&&!c.tileCoordIntersectsViewport([S,P,I],w))continue;let F=this.getTile(S,P,I,e);if(!F||!c6(r,F,S))continue;let L=F.getKey();if(f[L]=!0,F.getState()===an.IDLE&&!e.tileQueue.isKeyQueued(L)){let C=$1(S,P,I,this.tempTileCoord_);e.tileQueue.enqueue([F,u,c.getTileCoordCenter(C),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=Y1(this.getLayer().getSource(),a[l],r,s,o);if(n.containsKey(c)){let u=n.peek(c);if(u.getState()===an.LOADED)return u.endTransition(Bn(this)),c6(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 d=Y1(l,c,n,u,f),A=!1;if(a.containsKey(d)){let y=a.peek(d);y.getState()===an.LOADED&&(c6(r,y,n),A=!0)}A||(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),d=f.getZForResolution(o,u.zDirection),A=f.getResolution(d);this.updateStaleKeys(u.getKey());let y=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?vu(n.extent,s):null,this.layerExtent&&(y=hh(y,this.layerExtent));let R=A*S/2/w,P=A*T/2/w,I=[a[0]-R,a[1]-P,a[0]+R,a[1]+P],F={};this.renderedTiles.length=0;let D=c.getPreload();if(e.nextExtent&&this.enqueueTilesForNextExtent()){let $=f.getZForResolution(r.nextResolution,u.zDirection),J=F$(e,e.nextExtent);this.enqueueTiles(e,J,$,F,D)}let L=F$(e,y);if(this.enqueueTiles(e,L,d,F,0),D>0&&setTimeout(()=>{this.enqueueTiles(e,L,d-1,F,D-1)},0),!(d in F))return this.container;let C=Bn(this),B=e.time;for(let $ of F[d]){let J=$.getState();if(J===an.EMPTY)continue;let te=$.tileCoord;if(J===an.LOADED&&$.getAlpha(C,B)===1){$.endTransition(C);continue}if(J!==an.ERROR&&(this.renderComplete=!1),this.findStaleTile_(te,F)){O0e(F,$,d),e.animate=!0;continue}if(this.findAltTiles_(f,te,d+1,F))continue;let ve=f.getMinZoom();for(let Re=d-1;Re>=ve&&!this.findAltTiles_(f,te,Re,F);--Re);}let k=A/o*l/w,z=this.getRenderContext(e);Do(this.tempTransform,S/2,T/2,k,k,0,-S/2,-T/2),this.layerExtent&&this.clipUnrotated(z,e,this.layerExtent),u.getInterpolate()||(z.imageSmoothingEnabled=!1),this.preRender(z,e);let G=Object.keys(F).map(Number);G.sort(dl);let W=[],Y=[],H=[];for(let $=G.length-1;$>=0;--$){let J=G[$],te=u.getTilePixelSize(J,l,s),he=f.getResolution(J)/A,ve=te[0]*he*k,Re=te[1]*he*k,Qe=f.getTileCoordForCoordAndZ(Cc(I),J),Fe=f.getTileCoordExtent(Qe),mt=jr(this.tempTransform,[w*(Fe[0]-I[0])/A,w*(I[3]-Fe[3])/A]),Ee=w*u.getGutterForProjection(s);for(let Ve of F[J]){if(Ve.getState()!==an.LOADED)continue;let Ye=Ve.tileCoord,Mt=Qe[1]-Ye[1],Et=Math.round(mt[0]-(Mt-1)*ve),It=Qe[2]-Ye[2],dn=Math.round(mt[1]-(It-1)*Re),Gt=Math.round(mt[0]-Mt*ve),$e=Math.round(mt[1]-It*Re),ot=Et-Gt,nt=dn-$e,bt=J===d;if(bt&&Ve.inTransition(C)){H.push({tile:Ve,x:Gt,y:$e,w:ot,h:nt,gutter:Ee}),this.renderedTiles.unshift(Ve),this.updateUsedTiles(e.usedTiles,u,Ve);continue}let yt=[Gt,$e,Gt+ot,$e+nt],hn=[];for(let nn=0,bn=W.length;nn<bn;++nn)J<Y[nn]&&Dr(yt,W[nn])&&hn.push(W[nn]);let tn;hn.length>0&&(tn=tW(yt,hn)),W.push(yt),Y.push(J),this.drawTile(Ve,e,Gt,$e,ot,nt,Ee,bt,tn),this.renderedTiles.unshift(Ve),this.updateUsedTiles(e.usedTiles,u,Ve)}}for(let $=0,J=H.length;$<J;++$){let{tile:te,x:ce,y:he,w:ve,h:Re,gutter:Qe}=H[$];this.drawTile(te,e,ce,he,ve,Re,Qe,!0,void 0)}if(this.renderedResolution=A,this.extentChanged=!this.renderedExtent_||!Xm(this.renderedExtent_,I),this.renderedExtent_=I,this.renderedPixelRatio=l,this.postRender(this.context,e),this.layerExtent&&z.restore(),z.imageSmoothingEnabled=!0,this.renderComplete){let $=(J,te)=>{let ce=Bn(u),he=te.wantedTiles[ce],ve=he?Object.keys(he).length:0;this.updateCacheSize(ve),this.tileCache_.expireCache(),this.sourceTileCache_?.expireCache()};e.postRenderFunctions.push($)}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 n6){if(u=f3(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),d=Bn(this),A=t.layerStatesArray[t.layerIndex],y=A.opacity*(l?e.getAlpha(d,t.time):1),w=y!==f.globalAlpha;w&&(f.save(),f.globalAlpha=y);let S=u.width-2*a,T=u.height-2*a;if(c){let R=S/s,P=T/o;for(let I=0,F=c.length;I<F;++I){let D=c[I],L=D[0],C=D[1],B=D[2]-D[0],k=D[3]-D[1];f.drawImage(u,a+(L-n)*R,a+(C-r)*P,B*R,k*P,L,C,B,k)}}else f.drawImage(u,a,a,S,T,n,r,s,o);w&&f.restore(),y!==A.opacity?t.animate=!0:l&&e.endTransition(d)}getImage(){let e=this.context;return e?e.canvas:null}getTileImage(e){return e.getImage()}updateUsedTiles(e,t,n){let r=Bn(t);r in e||(e[r]={}),e[r][n.getKey()]=!0}},B$=u6;var l2={PRELOAD:"preload",USE_INTERIM_TILES_ON_ERROR:"useInterimTilesOnError"};var h6=class extends vA{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(l2.PRELOAD)}setPreload(e){this.set(l2.PRELOAD,e)}getUseInterimTilesOnError(){return this.get(l2.USE_INTERIM_TILES_ON_ERROR)}setUseInterimTilesOnError(e){this.set(l2.USE_INTERIM_TILES_ON_ERROR,e)}getData(e){return super.getData(e)}},O$=h6;var f6=class extends O${constructor(e){super(e)}createRenderer(){return new B$(this,{cacheSize:this.getCacheSize()})}},d6=f6;var p6=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){}},m3=p6;var c2={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},u2=[c2.FILL],wh=[c2.STROKE],ud=[c2.BEGIN_PATH],m6=[c2.CLOSE_PATH],vn=c2;var A6=class extends m3{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],fu(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],d=this.tmpCoordinate_,A=!0,y,w,S;for(y=t+r;y<n;y+=r)d[0]=e[y],d[1]=e[y+1],S=NT(c,d),S!==w?(A&&(a[l++]=u,a[l++]=f,A=!1),a[l++]=d[0],a[l++]=d[1]):S===Us.INTERSECTING?(a[l++]=d[0],a[l++]=d[1],A=!1):A=!0,u=d[0],f=d[1],w=S;return(s&&A||y===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,d,A;switch(o){case"MultiPolygon":c=e.getOrientedFlatCoordinates(),d=[];let y=e.getEndss();A=0;for(let w=0,S=y.length;w<S;++w){let T=[];A=this.drawCustomCoordinates_(c,A,y[w],a,T),d.push(T)}this.instructions.push([vn.CUSTOM,l,d,e,n,Ry,s]),this.hitDetectionInstructions.push([vn.CUSTOM,l,d,e,r||n,Ry,s]);break;case"Polygon":case"MultiLineString":f=[],c=o=="Polygon"?e.getOrientedFlatCoordinates():e.getFlatCoordinates(),A=this.drawCustomCoordinates_(c,0,e.getEnds(),a,f),this.instructions.push([vn.CUSTOM,l,f,e,n,Rp,s]),this.hitDetectionInstructions.push([vn.CUSTOM,l,f,e,r||n,Rp,s]);break;case"LineString":case"Circle":c=e.getFlatCoordinates(),u=this.appendFlatLineCoordinates(c,0,c.length,a,!1,!1),this.instructions.push([vn.CUSTOM,l,u,e,n,Nc,s]),this.hitDetectionInstructions.push([vn.CUSTOM,l,u,e,r||n,Nc,s]);break;case"MultiPoint":c=e.getFlatCoordinates(),u=this.appendFlatPointCoordinates(c,a),u>l&&(this.instructions.push([vn.CUSTOM,l,u,e,n,Nc,s]),this.hitDetectionInstructions.push([vn.CUSTOM,l,u,e,r||n,Nc,s]));break;case"Point":c=e.getFlatCoordinates(),this.coordinates.push(c[0],c[1]),u=this.coordinates.length,this.instructions.push([vn.CUSTOM,l,u,e,n,void 0,s]),this.hitDetectionInstructions.push([vn.CUSTOM,l,u,e,r||n,void 0,s]);break;default:}this.endGeometry(t)}beginGeometry(e,t,n){this.beginGeometryInstruction1_=[vn.BEGIN_GEOMETRY,t,0,e,n],this.instructions.push(this.beginGeometryInstruction1_),this.beginGeometryInstruction2_=[vn.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==vn.END_GEOMETRY?o=t:s==vn.BEGIN_GEOMETRY&&(r[2]=t,DW(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=Al(n||ro)??void 0}else t.fillStyle=void 0;return t}strokeStyleToState(e,t={}){if(e){let n=e.getColor();t.strokeStyle=Al(n||na);let r=e.getLineCap();t.lineCap=r!==void 0?r:gh;let s=e.getLineDash();t.lineDash=s?s.slice():gl;let o=e.getLineDashOffset();t.lineDashOffset=o||vl;let a=e.getLineJoin();t.lineJoin=a!==void 0?a:vh;let l=e.getWidth();t.lineWidth=l!==void 0?l:id;let c=e.getMiterLimit();t.miterLimit=c!==void 0?c:td;let u=e.getOffset();t.strokeOffset=u??Zj,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=[vn.SET_FILL_STYLE,t];return typeof t!="string"&&n.push(e.fillPatternScale),n}applyStroke(e){this.instructions.push(this.createStroke(e))}createStroke(e){return[vn.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&&!ea(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=[vn.END_GEOMETRY,e];this.instructions.push(t),this.hitDetectionInstructions.push(t)}getBufferedMaxExtent(){if(!this.bufferedMaxExtent_&&(this.bufferedMaxExtent_=FT(this.maxExtent),this.maxLineWidth>0)){let e=this.resolution*(this.maxLineWidth+1)/2;F1(this.bufferedMaxExtent_,e,this.bufferedMaxExtent_)}return this.bufferedMaxExtent_}},Sh=A6;var g6=class extends Sh{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&&!fu(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([vn.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([vn.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||fu(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([vn.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([vn.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}},U$=g6;var v6=class extends Sh{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([vn.MOVE_TO_LINE_TO,o,a,s*this.pixelRatio]),this.hitDetectionInstructions.push([vn.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([vn.SET_STROKE_STYLE,na,r.lineWidth,r.lineCap,r.lineJoin,r.miterLimit,gl,vl],ud);let l=e.getFlatCoordinates(),c=e.getStride();this.drawFlatCoordinates_(l,0,l.length,c,a),this.hitDetectionInstructions.push(wh),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([vn.SET_STROKE_STYLE,na,r.lineWidth,r.lineCap,r.lineJoin,r.miterLimit,gl,vl],ud);let l=e.getEnds(),c=e.getFlatCoordinates(),u=e.getStride(),f=0;for(let d=0,A=l.length;d<A;++d)f=this.drawFlatCoordinates_(c,f,l[d],u,a);this.hitDetectionInstructions.push(wh),this.endGeometry(t)}finish(){let e=this.state;return e.lastStroke!=null&&e.lastStroke!=this.coordinates.length&&this.instructions.push(wh),this.reverseHitDetectionInstructions(),this.state=null,super.finish()}applyStroke(e){e.lastStroke!=null&&e.lastStroke!=this.coordinates.length&&(this.instructions.push(wh),e.lastStroke=this.coordinates.length),e.lastStroke=0,super.applyStroke(e),this.instructions.push(ud)}},k$=v6;var _6=class extends Sh{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(ud),this.hitDetectionInstructions.push(ud);for(let u=0;u<c;++u){let f=n[u],d=this.coordinates.length,A=this.appendFlatLineCoordinates(e,t,f,r,!0,!l);this.instructions.push([vn.MOVE_TO_LINE_TO,d,A,s*this.pixelRatio,!0]),this.hitDetectionInstructions.push([vn.MOVE_TO_LINE_TO,d,A,s,!0]),l&&(this.instructions.push(m6),this.hitDetectionInstructions.push(m6)),t=f}return a&&(this.instructions.push(u2),this.hitDetectionInstructions.push(u2)),l&&(this.instructions.push(wh),this.hitDetectionInstructions.push(wh)),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([vn.SET_FILL_STYLE,ro]),r.strokeStyle!==void 0&&this.hitDetectionInstructions.push([vn.SET_STROKE_STYLE,na,r.lineWidth,r.lineCap,r.lineJoin,r.miterLimit,gl,vl]);let l=e.getFlatCoordinates(),c=e.getStride(),u=this.coordinates.length;this.appendFlatLineCoordinates(l,0,l.length,c,!1,!1);let f=[vn.CIRCLE,u,a];this.instructions.push(ud,f),this.hitDetectionInstructions.push(ud,f),r.fillStyle!==void 0&&(this.instructions.push(u2),this.hitDetectionInstructions.push(u2)),r.strokeStyle!==void 0&&(this.instructions.push(wh),this.hitDetectionInstructions.push(wh)),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([vn.SET_FILL_STYLE,ro]),r.strokeStyle!==void 0&&this.hitDetectionInstructions.push([vn.SET_STROKE_STYLE,na,r.lineWidth,r.lineCap,r.lineJoin,r.miterLimit,gl,vl]);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([vn.SET_FILL_STYLE,ro]),r.strokeStyle!==void 0&&this.hitDetectionInstructions.push([vn.SET_STROKE_STYLE,na,r.lineWidth,r.lineCap,r.lineJoin,r.miterLimit,gl,vl]);let l=e.getEndss(),c=e.getOrientedFlatCoordinates(),u=e.getStride(),f=0;for(let d=0,A=l.length;d<A;++d)f=this.drawFlatCoordinatess_(c,f,l[d],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]=Ip(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}},x6=_6;var y6=0,b6=1;function U0e(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 d=(i-r)/l,A=(t-r)/l;if(d>A){let y=d;d=A,A=y}if(d>u&&(u=d),A<f&&(f=A),u>f)return!1}if(c===0){if(s<e||s>n)return!1}else{let d=(e-s)/c,A=(n-s)/c;if(d>A){let y=d;d=A,A=y}if(d>u&&(u=d),A<f&&(f=A),u>f)return!1}return y6=u,b6=f,!0}function z$(i,e,t,n){let r=n[0],s=n[1],o=n[2],a=n[3],l=[],c=[],u=!1,f,d,A=0;for(let y=0,w=e.length;y<w;++y){let S=e[y],T=i[A],R=i[A+1],P=!1;for(let I=A+t;I<S;I+=t){let F=i[I],D=i[I+1];if(U0e(r,s,o,a,T,R,F,D)){let L=F-T,C=D-R,B=T+y6*L,k=R+y6*C,z=T+b6*L,G=R+b6*C;u&&P&&B===f&&k===d?l.push(z,G):(u&&c.push(l.length),l.push(B,k,z,G),u=!0),f=z,d=G,P=!0}T=F,R=D}A=S}return u&&c.push(l.length),{flatCoordinates:l,ends:c}}function V$(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],d=e[o+r+1],A=Math.sqrt((f-c)*(f-c)+(d-u)*(d-u));if(a+=A,a>=i){let y=(i-a+A)/A,w=Po(c,f,y),S=Po(u,d,y);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 y=A-a,w=Po(c,f,y/A),S=Po(u,d,y/A);l.push(w,S),s.push(l),l=[w,S],a=0,o+=r}}return a>0&&s.push(l),s}function G$(i,e,t,n,r){let s=t,o=t,a=0,l=0,c=t,u,f,d,A,y,w,S,T,R,P;for(f=t;f<n;f+=r){let I=e[f],F=e[f+1];y!==void 0&&(R=I-y,P=F-w,A=Math.sqrt(R*R+P*P),S!==void 0&&(l+=d,u=Math.acos((S*R+T*P)/(d*A)),u>i&&(l>a&&(a=l,s=c,o=f),l=0,c=f-r)),d=A,S=R,T=P),y=I,w=F}return l+=A,l>a?[c,f]:[s,o]}var h2={left:0,center:.5,right:1,top:0,middle:.5,hanging:.2,alphabetic:.8,ideographic:.8,bottom:1},w6=class extends Sh{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[ro]={fillStyle:ro},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 d=e.getExtent();if(!Dr(this.maxExtent,d))return;let A;if(u=e.getFlatCoordinates(),c=="LineString")A=[u.length];else if(c=="MultiLineString")A=e.getEnds();else if(c=="Polygon")A=e.getEnds().slice(0,1);else if(c=="MultiPolygon"){let T=e.getEndss();A=[];for(let R=0,P=T.length;R<P;++R)A.push(T[R][0])}if((c=="LineString"||c=="MultiLineString")&&!uh(this.getBufferedMaxExtent(),d)){let T=z$(u,A,f,this.getBufferedMaxExtent());if(u=T.flatCoordinates,A=T.ends,f=2,A.length===0)return}this.beginGeometry(e,t,n);let y=o.repeat,w=y?void 0:o.textAlign,S=0;for(let T=0,R=A.length;T<R;++T){let P;y?P=V$(y*this.resolution,u,S,A[T],f):P=[u.slice(S,A[T])];for(let I=0,F=P.length;I<F;++I){let D=P[I],L=0,C=D.length;if(w==null){let k=G$(o.maxAngle,D,0,D.length,2);L=k[0],C=k[1]}for(let k=L;k<C;k+=f)a.push(D[k],D[k+1]);let B=a.length;S=A[T],this.drawChars_(l,B),l=B}}this.endGeometry(t)}else{let d=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||d.push(u[2]/this.resolution),f=3;break;case"MultiPolygon":let I=e.getFlatInteriorPoints();u=[];for(let F=0,D=I.length;F<D;F+=3)o.overflow||d.push(I[F+2]/this.resolution),u.push(I[F],I[F+1]);if(u.length===0)return;f=2;break;default:}let A=this.appendFlatPointCoordinates(u,f);if(A===l)return;if(d&&(A-l)/2!==u.length/f){let I=l/2;d=d.filter((F,D)=>{let L=a[(I+D)*2]===u[D*f]&&a[(I+D)*2+1]===u[D*f+1];return L||--I,L})}this.saveTextStates_();let y=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!=nd&&(o.scale[0]<0||o.scale[1]<0)){let I=o.padding[0],F=o.padding[1],D=o.padding[2],L=o.padding[3];o.scale[0]<0&&(F=-F,L=-L),o.scale[1]<0&&(I=-I,D=-D),S=[I,F,D,L]}let T=this.pixelRatio;this.instructions.push([vn.DRAW_IMAGE,l,A,null,NaN,NaN,NaN,1,0,0,this.textRotateWithView_,this.textRotation_,[1,1],NaN,this.declutterMode_,this.declutterImageWithText_,S==nd?nd:S.map(function(I){return I*T}),y,w,this.text_,this.textKey_,this.strokeKey_,this.fillKey_,this.textOffsetX_,this.textOffsetY_,d]);let R=1/T,P=y?y.slice(0):null;P&&(P[1]=ro),this.hitDetectionInstructions.push([vn.DRAW_IMAGE,l,A,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_?ro:this.fillKey_,this.textOffsetX_,this.textOffsetY_,d]),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||Np,justify:t.justify,textBaseline:t.textBaseline||fA,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=h2[r.textBaseline],u=this.textOffsetX_*l,f=this.textOffsetY_*l,d=this.text_,A=n?n.lineWidth*Math.abs(r.scale[0])/2:0;this.instructions.push([vn.DRAW_CHARS,e,t,c,r.overflow,a,r.maxAngle,l,f,s,A*l,d,o,1,this.declutterMode_,this.textKeepUpright_,u]),this.hitDetectionInstructions.push([vn.DRAW_CHARS,e,t,c,r.overflow,a&&ro,r.maxAngle,l,f,s,A*l,d,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=Al(o.getColor()||ro)):(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()||gh,s.lineDash=w?w.slice():gl,s.lineDashOffset=S===void 0?vl:S,s.lineJoin=a.getLineJoin()||vh,s.lineWidth=T===void 0?id:T,s.miterLimit=R===void 0?td:R,s.strokeStyle=Al(a.getColor()||na)}n=this.textState_;let l=e.getFont()||PE;Kj(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()||fA,n.backgroundFill=e.getBackgroundFill(),n.backgroundStroke=e.getBackgroundStroke(),n.padding=e.getPadding()||nd,n.scale=c===void 0?[1,1]:c;let u=e.getOffsetX(),f=e.getOffsetY(),d=e.getRotateWithView(),A=e.getKeepUpright(),y=e.getRotation();this.text_=e.getText()||"",this.textOffsetX_=u===void 0?0:u,this.textOffsetY_=f===void 0?0:f,this.textRotateWithView_=d===void 0?!1:d,this.textKeepUpright_=A===void 0?!0:A,this.textRotation_=y===void 0?0:y,this.strokeKey_=s?(typeof s.strokeStyle=="string"?s.strokeStyle:Bn(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:"|"+Bn(r.fillStyle):""}this.declutterMode_=e.getDeclutterMode(),this.declutterImageWithText_=t}},q$=w6;var k0e={Circle:x6,Default:Sh,Image:U$,LineString:k$,Polygon:x6,Text:q$},S6=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=k0e[t];s=new o(this.tolerance_,this.maxExtent_,this.resolution_,this.pixelRatio_),r[t]=s}return s}},H$=S6;function A3(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],d,A,y,w,S,T,R,P,I=0;for(let F=e;F<t;F+=n){y=d,w=A,S=void 0,T=void 0,F+n<t&&(S=i[F+n],T=i[F+n+1]),s&&F===e&&(y=u,w=f),s&&F===t-n&&(S=l,T=c),d=i[F],A=i[F+1],[R,P]=z0e(d,A,y,w,S,T,r),o[I++]=R,o[I++]=P;for(let D=2;D<a;D++)o[I++]=i[F+D]}return o.length!=I&&(o.length=I),o}function z0e(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 d=lW([i,e],[t,n],[r,s]);if(Math.cos(d)>.998)return[i+u*o,e+f*o];let A=Math.cos(d/2),y=Math.sin(d/2),w=y*a+A*l,S=-A*a+y*l,T=w*(1/y),R=S*(1/y);return[i+T*o,e+R*o]}function g3(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],d=i[o+1],A=i[o+e],y=i[o+e+1],w=(y-d)*(c-a)-(A-f)*(u-l);if(w===0)continue;let S=((A-f)*(l-d)-(y-d)*(a-f))/w,T=((c-a)*(l-d)-(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 T6;function V0e(){return T6||(T6=new Intl.Segmenter(void 0,{granularity:"grapheme"})),T6}function W$(i,e,t,n,r,s,o,a,l,c,u,f,d=!0){let A=i[e],y=i[e+1],w=0,S=0,T=0,R=0;function P(){w=A,S=y,e+=n,A=i[e],y=i[e+1],R+=T,T=Math.sqrt((A-w)*(A-w)+(y-S)*(y-S))}do P();while(e<t-n&&R+T<s);let I=T===0?0:(s-R)/T,F=Po(w,A,I),D=Po(S,y,I),L=e-n,C=R,B=s+a*l(c,r,u);for(;e<t-n&&R+T<B;)P();I=T===0?0:(B-R)/T;let k=Po(w,A,I),z=Po(S,y,I),G=!1;if(d)if(f){let te=[F,D,k,z];pE(te,0,4,2,f,te,te),G=te[0]>te[2]}else G=F>k;let W=Math.PI,Y=[],H=L+n===e;e=L,T=0,R=C,A=i[e],y=i[e+1];let $;if(H){P(),$=Math.atan2(y-S,A-w),G&&($+=$>0?-W:W);let te=(k+F)/2,ce=(z+D)/2;return Y[0]=[te,ce,(B-s)/2,$,r],Y}r=r.replace(/\n/g," ");let J=Array.from(V0e().segment(r),te=>te.segment);for(let te=0,ce=J.length;te<ce;){P();let he=Math.atan2(y-S,A-w);if(G&&(he+=he>0?-W:W),$!==void 0){let Ee=he-$;if(Ee+=Ee>W?-2*W:Ee<-W?2*W:0,Math.abs(Ee)>o)return null}$=he;let ve=te,Re=0;for(;te<ce;++te){let Ee=G?ce-te-1:te,Ve=a*l(c,J[Ee],u);if(e+n<t&&R+T<s+Re+Ve/2)break;Re+=Ve}if(te===ve)continue;let Qe=(G?J.slice(ce-te,ce-ve):J.slice(ve,te)).join("");I=T===0?0:(s+Re/2-R)/T;let Fe=Po(w,A,I),mt=Po(S,y,I);Y.push([Fe,mt,Re/2,he,Qe]),s+=Re}return Y}var yv=Wr(),kp=[],hd=[],fd=[],zp=[];function j$(i){return i[3].declutterBox}var X$=new RegExp("[\u0591-\u08FF\uFB1D-\uFDFF\uFE70-\uFEFC\u0800-\u0FFF\uE800-\uEFFF]");function E6(i,e){return e==="start"?e=X$.test(i)?"right":"left":e==="end"&&(e=X$.test(i)?"left":"right"),h2[e]}function G0e(i,e,t){return t>0&&i.push(`8-`,""),i.push(e,""),i}function q0e(i,e,t){return t%2===0&&(i+=e),i}var M6=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_=go(),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 d3: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?h2[l.justify]:E6(Array.isArray(e)?e[0]:e,l.textAlign||Np),d=r&&o.lineWidth?o.lineWidth:0,A=Array.isArray(e)?e:String(e).split(`9-`).reduce(G0e,[]),{width:y,height:w,widths:S,heights:T,lineWidths:R}=eX(l,A),P=y+d,I=[],F=(P+2)*u[0],D=(w+d)*u[1],L={width:F<0?Math.floor(F):Math.ceil(F),height:D<0?Math.floor(D):Math.ceil(D),contextInstructions:I};(u[0]!=1||u[1]!=1)&&I.push("scale",u),r&&(I.push("strokeStyle",o.strokeStyle),I.push("lineWidth",d),I.push("lineCap",o.lineCap),I.push("lineJoin",o.lineJoin),I.push("miterLimit",o.miterLimit),I.push("setLineDash",[o.lineDash]),I.push("lineDashOffset",o.lineDashOffset)),n&&I.push("fillStyle",a.fillStyle),I.push("textBaseline","middle"),I.push("textAlign","center");let C=.5-f,B=f*P+C*d,k=[],z=[],G=0,W=0,Y=0,H=0,$;for(let J=0,te=A.length;J<te;J+=2){let ce=A[J];if(ce===`10-`){W+=G,G=0,B=f*P+C*d,++H;continue}let he=A[J+1]||l.font;he!==$&&(r&&k.push("font",he),n&&z.push("font",he),$=he),G=Math.max(G,T[Y]);let ve=[ce,B+C*S[Y]+f*(S[Y]-R[H]),.5*(d+G)+W];B+=S[Y],r&&k.push("strokeText",ve),n&&z.push("fillText",ve),++Y}return Array.prototype.push.apply(I,k),Array.prototype.push.apply(I,z),this.labels_[s]=L,L}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,d,A,y,w,S){a*=d[0],l*=d[1];let T=n-a,R=r-l,P=s+c>e?e-c:s,I=o+u>t?t-u:o,F=y[3]+P*d[0]+y[1],D=y[0]+I*d[1]+y[2],L=T-y[3],C=R-y[0];(w||f!==0)&&(kp[0]=L,zp[0]=L,kp[1]=C,hd[1]=C,hd[0]=L+F,fd[0]=hd[0],fd[1]=C+D,zp[1]=fd[1]);let B;return f!==0?(B=Do(go(),n,r,1,1,f,-n,-r),jr(B,kp),jr(B,hd),jr(B,fd),jr(B,zp),Gl(Math.min(kp[0],hd[0],fd[0],zp[0]),Math.min(kp[1],hd[1],fd[1],zp[1]),Math.max(kp[0],hd[0],fd[0],zp[0]),Math.max(kp[1],hd[1],fd[1],zp[1]),yv)):Gl(Math.min(L,L+F),Math.min(C,C+D),Math.max(L,L+F),Math.max(C,C+D),yv),A&&(T=Math.round(T),R=Math.round(R)),{drawImageX:T,drawImageY:R,drawImageW:P,drawImageH:I,originX:c,originY:u,declutterBox:{minX:yv[0],minY:yv[1],maxX:yv[2],maxY:yv[3],value:S},canvasTransform:B,scale:d}}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,kp,hd,fd,zp,o,a),tX(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=jr(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=E6(Array.isArray(e)?e[0]:e,s.textAlign||Np),u=h2[s.textBaseline||fA],f=a&&a.lineWidth?a.lineWidth:0,d=o.width/l-2*s.scale[0],A=c*d+2*(.5-c)*f,y=u*o.height/l+2*(.5-u)*f;return{label:o,anchorX:A,anchorY:y}}execute_(e,t,n,r,s,o,a,l){let c=this.zIndexContext_,u;this.pixelCoordinates_&&ea(n,this.renderedTransform_)?u=this.pixelCoordinates_:(this.pixelCoordinates_||(this.pixelCoordinates_=[]),u=pl(this.coordinates,0,this.coordinates.length,2,n,this.pixelCoordinates_),rj(this.renderedTransform_,n));let f=0,d=r.length,A=0,y,w=[],S,T,R,P,I,F,D,L,C,B,k,z,G,W=0,Y=0,H=this.coordinateCache_,$=this.viewRotation_,J=Math.round(Math.atan2(-n[1],n[0])*1e12)/1e12,te={context:e,pixelRatio:this.pixelRatio,resolution:this.resolution,rotation:$},ce=this.instructions!=r||this.overlaps?0:200,he,ve,Re,Qe;for(;f<d;){let Fe=r[f];switch(Fe[0]){case vn.BEGIN_GEOMETRY:he=Fe[1],Qe=Fe[3],he.getGeometry()?a!==void 0&&!Dr(a,Qe.getExtent())?f=Fe[2]+1:++f:f=Fe[2],c&&(c.zIndex=Fe[4]);break;case vn.BEGIN_PATH:W>ce&&(this.fill_(e),W=0),Y>ce&&(e.stroke(),Y=0),!W&&!Y&&(e.beginPath(),I=NaN,F=NaN),++f;break;case vn.CIRCLE:A=Fe[1],R=Fe[2]??0;let Ee=u[A],Ve=u[A+1],Ye=u[A+2]-R,Mt=u[A+3]-R,Et=Ye-Ee,It=Mt-Ve,dn=Math.sqrt(Et*Et+It*It);e.moveTo(Ee+dn,Ve),e.arc(Ee,Ve,dn,0,2*Math.PI,!0),++f;break;case vn.CLOSE_PATH:e.closePath(),++f;break;case vn.CUSTOM:A=Fe[1],y=Fe[2];let Gt=Fe[3],$e=Fe[4],ot=Fe[5];te.geometry=Gt,te.feature=he,f in H||(H[f]=[]);let nt=H[f];ot?ot(u,A,y,2,nt):(nt[0]=u[A],nt[1]=u[A+1],nt.length=2),c&&(c.zIndex=Fe[6]),$e(nt,te),++f;break;case vn.DRAW_IMAGE:A=Fe[1],y=Fe[2],C=Fe[3],S=Fe[4],T=Fe[5];let bt=Fe[6],yt=Fe[7],hn=Fe[8],tn=Fe[9],nn=Fe[10],bn=Fe[11],_e=Fe[12],vi=Fe[13];P=Fe[14]||"declutter";let zn=Fe[15];if(!C&&Fe.length>=20){B=Fe[19],k=Fe[20],z=Fe[21],G=Fe[22];let Fn=this.drawLabelWithPointPlacement_(B,k,z,G);C=Fn.label,Fe[3]=C;let is=Fe[23];S=(Fn.anchorX-is)*this.pixelRatio,Fe[4]=S;let Pr=Fe[24];T=(Fn.anchorY-Pr)*this.pixelRatio,Fe[5]=T,bt=C.height,Fe[6]=bt,vi=C.width,Fe[13]=vi}let le;Fe.length>25&&(le=Fe[25]);let Z,Te,Pe;Fe.length>17?(Z=Fe[16],Te=Fe[17],Pe=Fe[18]):(Z=nd,Te=null,Pe=null),nn&&J?bn+=$:!nn&&!J&&(bn-=$);let Ge=0;for(;A<y;A+=2){if(le&&le[Ge++]<vi/this.pixelRatio)continue;let Fn=this.calculateImageOrLabelDimensions_(C.width,C.height,u[A],u[A+1],vi,bt,S,T,hn,tn,bn,_e,s,Z,!!Te||!!Pe,he),is=[e,t,C,Fn,yt,Te,Pe];if(l){let Pr,Nl,wa;if(zn){let _r=y-A;if(!zn[_r]){zn[_r]={args:is,declutterMode:P};continue}let Ks=zn[_r];Pr=Ks.args,Nl=Ks.declutterMode,delete zn[_r],wa=j$(Pr)}let Fl,il;if(Pr&&(Nl!=="declutter"||!l.collides(wa))&&(Fl=!0),(P!=="declutter"||!l.collides(Fn.declutterBox))&&(il=!0),Nl==="declutter"&&P==="declutter"){let _r=Fl&&il;Fl=_r,il=_r}Fl&&(Nl!=="none"&&l.insert(wa),this.replayImageOrLabel_.apply(this,Pr)),il&&(P!=="none"&&l.insert(Fn.declutterBox),this.replayImageOrLabel_.apply(this,is))}else this.replayImageOrLabel_.apply(this,is)}++f;break;case vn.DRAW_CHARS:let vt=Fe[1],Tt=Fe[2],qe=Fe[3],Je=Fe[4];G=Fe[5];let Pt=Fe[6],sn=Fe[7],Lt=Fe[8];z=Fe[9];let Rt=Fe[10];B=Fe[11],Array.isArray(B)&&(B=B.reduce(q0e,"")),k=Fe[12];let fn=[Fe[13],Fe[13]];P=Fe[14]||"declutter";let wn=Fe[15],Dn=Fe[16],ye=this.textStates[k],wt=ye.font,Ze=[ye.scale[0]*sn,ye.scale[1]*sn],St;wt in this.widths_?St=this.widths_[wt]:(St={},this.widths_[wt]=St);let Bt=av(u,vt,Tt,2),ut=Math.abs(Ze[0])*BN(wt,B,St);if(Je||ut<=Bt){let Fn=this.textStates[k].textAlign,is=(Bt-ut)*E6(B,Fn),Pr=W$(u,vt,Tt,2,B,is,Pt,Math.abs(Ze[0]),BN,wt,St,J?0:this.viewRotation_,wn);e:if(Pr){let Nl=[],wa,Fl,il,_r,Ks;if(z)for(wa=0,Fl=Pr.length;wa<Fl;++wa){Ks=Pr[wa],il=Ks[4],_r=this.createLabel(il,k,"",z),S=Ks[2]+(Ze[0]<0?-Rt:Rt)-Dn,T=qe*_r.height+(.5-qe)*2*Rt*Ze[1]/Ze[0]-Lt;let Bl=this.calculateImageOrLabelDimensions_(_r.width,_r.height,Ks[0],Ks[1],_r.width,_r.height,S,T,0,0,Ks[3],fn,!1,nd,!1,he);if(l&&P==="declutter"&&l.collides(Bl.declutterBox))break e;Nl.push([e,t,_r,Bl,1,null,null])}if(G)for(wa=0,Fl=Pr.length;wa<Fl;++wa){Ks=Pr[wa],il=Ks[4],_r=this.createLabel(il,k,G,""),S=Ks[2]-Dn,T=qe*_r.height-Lt;let Bl=this.calculateImageOrLabelDimensions_(_r.width,_r.height,Ks[0],Ks[1],_r.width,_r.height,S,T,0,0,Ks[3],fn,!1,nd,!1,he);if(l&&P==="declutter"&&l.collides(Bl.declutterBox))break e;Nl.push([e,t,_r,Bl,1,null,null])}l&&P!=="none"&&l.load(Nl.map(j$));for(let Bl=0,nh=Nl.length;Bl<nh;++Bl)this.replayImageOrLabel_.apply(this,Nl[Bl])}}++f;break;case vn.END_GEOMETRY:if(o!==void 0){he=Fe[1];let Fn=o(he,Qe,P);if(Fn)return Fn}++f;break;case vn.FILL:ce?W++:this.fill_(e),++f;break;case vn.MOVE_TO_LINE_TO:A=Fe[1],y=Fe[2],R=Fe[3];let Ce,Yt,nr;if(R){let is=(Fe[4]??!1)||Math.abs(u[A]-u[y-2])<1e-6&&Math.abs(u[A+1]-u[y-1])<1e-6;A3(u,A,y,2,R,is,w),g3(w,2,is),Ce=w,Yt=0,nr=Ce.length}else Ce=u,Yt=A,nr=y;ve=Ce[Yt],Re=Ce[Yt+1],e.moveTo(ve,Re),I=ve+.5|0,F=Re+.5|0;for(let Fn=Yt+2;Fn<nr;Fn+=2)ve=Ce[Fn],Re=Ce[Fn+1],D=ve+.5|0,L=Re+.5|0,(Fn==nr-2||D!==I||L!==F)&&(e.lineTo(ve,Re),I=D,F=L);++f;break;case vn.SET_FILL_STYLE:this.alignAndScaleFill_=Fe[2],W?(this.fill_(e),W=0,Y&&(e.stroke(),Y=0)):Y&&Fe[1]&&(e.stroke(),Y=0),e.fillStyle=Fe[1],++f;break;case vn.SET_STROKE_STYLE:W&&Fe[1]&&(this.fill_(e),W=0),Y&&(e.stroke(),Y=0),this.setStrokeStyle_(e,Fe),++f;break;case vn.STROKE:ce?Y++:e.stroke(),++f;break;default:++f;break}}W&&this.fill_(e),Y&&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)}},$$=M6;var Vp=["Polygon","Circle","LineString","Image","Text","Default"],I6=["Image","Text"],Y$=Vp.filter(i=>!I6.includes(i)),Z$=!1,K$=!1;function H0e(){let i=0,e=n=>{let r=Di(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};Z$={[e(!0)]:!0,[e(!1)]:!1,[e(void 0)]:void 0}[i],K$=!0}var R6=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_=go(),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 $$(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){K$===!1&&H0e(),r=Math.round(r);let a=r*2+1,l=Do(this.hitDetectionTransform_,r+.5,r+.5,1/t,-1/t,-n,-e[0],-e[1]),c=!this.hitDetectionContext_;c&&(this.hitDetectionContext_=Di(a,a,null,{willReadFrequently:Z$}));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=Wr(),$m(f,e),F1(f,t*(this.renderBuffer_+r),f));let d=W0e(r),A;function y(F,D,L){let C=u.getImageData(0,0,a,a).data;for(let B=0,k=d.length;B<k;B++)if(C[d[B]]>0){if(!o||L==="none"||A!=="Image"&&A!=="Text"||o.includes(F)){let z=(d[B]-3)/4,G=r-z%a,W=r-(z/a|0),Y=s(F,D,G*G+W*W);if(Y)return Y}u.clearRect(0,0,a,a);break}}let w=Object.keys(this.executorsByZIndex_).map(Number);w.sort(dl);let S,T,R,P,I;for(S=w.length-1;S>=0;--S){let F=w[S].toString();for(R=this.executorsByZIndex_[F],T=Vp.length-1;T>=0;--T)if(A=Vp[T],P=R[A],P!==void 0&&(I=P.executeHitDetection(u,l,n,y,f),I))return I}}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 pl(a,0,8,2,e,a),a}isEmpty(){return mu(this.executorsByZIndex_)}execute(e,t,n,r,s,o,a){let l=Object.keys(this.executorsByZIndex_).map(Number);l.sort(a?LW:dl),o=o||Vp;let c=Vp.length;for(let u=0,f=l.length;u<f;++u){let d=l[u].toString(),A=this.executorsByZIndex_[d];for(let y=0,w=o.length;y<w;++y){let S=o[y],T=A[S];if(T!==void 0){let R=a===null?void 0:T.getZIndexContext(),P=R?R.getContext():e,I=this.maxExtent_&&S!=="Image"&&S!=="Text";if(I&&(P.save(),this.clip(P,n)),!R||S==="Text"||S==="Image"?T.execute(P,t,n,r,s,a):R.pushFunction(F=>T.execute(F,t,n,r,s,a)),I&&P.restore(),R){R.offset();let F=l[u]*c+Vp.indexOf(S);this.deferredZIndexContexts_[F]||(this.deferredZIndexContexts_[F]=[]),this.deferredZIndexContexts_[F].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(dl);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}},C6={};function W0e(i){if(C6[i]!==void 0)return C6[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 C6[i]=r,r}var Q$=R6;var P6=class extends m3{constructor(e,t,n,r,s,o,a){super(),this.context_=e,this.pixelRatio_=t,this.extent_=n,this.transform_=r,this.transformRotation_=r?Ym(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_=go()}drawImages_(e,t,n,r){if(!this.image_)return;let s=pl(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 d=s[u]-this.imageAnchorX_,A=s[u+1]-this.imageAnchorY_;if(c!==0||this.imageScale_[0]!=1||this.imageScale_[1]!=1){let y=d+this.imageAnchorX_,w=A+this.imageAnchorY_;Do(a,y,w,1,1,c,-y,-w),o.save(),o.transform.apply(o,a),o.translate(y,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_,d,A,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=pl(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=pl(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=A3(l,0,u,2,o,f,l),g3(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_)),!!Dr(this.extent_,e.getExtent())){if(this.fillState_||this.strokeState_){this.fillState_&&this.setContextFillState_(this.fillState_),this.strokeState_&&this.setContextStrokeState_(this.strokeState_);let t=Sj(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_)),!!Dr(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(Dr(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_)),!!Dr(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_)),!!Dr(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),ea(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:Np;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:Al(n||ro)}}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||gl,f=t.getOffset();this.strokeState_={lineCap:r!==void 0?r:gh,lineDash:this.pixelRatio_===1?u:u.map(d=>d*this.pixelRatio_),lineDashOffset:(o||vl)*this.pixelRatio_,lineJoin:a!==void 0?a:vh,lineWidth:(l!==void 0?l:id)*this.pixelRatio_,miterLimit:c!==void 0?c:td,strokeStyle:Al(n||na),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 A=t.getColor();this.textFillState_={fillStyle:Al(A||ro)}}let n=e.getStroke();if(!n)this.textStrokeState_=null;else{let A=n.getColor(),y=n.getLineCap(),w=n.getLineDash(),S=n.getLineDashOffset(),T=n.getLineJoin(),R=n.getWidth(),P=n.getMiterLimit();this.textStrokeState_={lineCap:y!==void 0?y:gh,lineDash:w||gl,lineDashOffset:S||vl,lineJoin:T!==void 0?T:vh,lineWidth:R!==void 0?R:id,miterLimit:P!==void 0?P:td,strokeStyle:Al(A||na)}}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(),d=e.getTextBaseline();this.textState_={font:r!==void 0?r:PE,textAlign:f!==void 0?f:Np,textBaseline:d!==void 0?d:fA},this.text_=u!==void 0?Array.isArray(u)?u.reduce((A,y,w)=>A+=w%2?" ":y,""):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]]}}},J$=P6;var Mu=.5;function eY(i,e,t,n,r,s,o,a,l){let c=l?bp(r,l):r,u=i[0]*Mu,f=i[1]*Mu,d=Di(u,f);d.imageSmoothingEnabled=!1;let A=d.canvas,y=new J$(d,Mu,r,null,o,a,l?Qm(eA(),l):null),w=t.length,S=Math.floor((256*256*256-1)/w),T={};for(let P=1;P<=w;++P){let I=t[P-1],F=I.getStyleFunction()||n;if(!F)continue;let D=F(I,s);if(!D)continue;Array.isArray(D)||(D=[D]);let C=(P*S).toString(16).padStart(7,"#00000");for(let B=0,k=D.length;B<k;++B){let z=D[B],G=z.getGeometryFunction()(I);if(!G||!Dr(c,G.getExtent()))continue;let W=z.clone(),Y=W.getFill();Y&&Y.setColor(C);let H=W.getStroke();H&&(H.setColor(C),H.setLineDash(null)),W.setText(void 0);let $=z.getImage();if($){let he=$.getImageSize();if(!he)continue;let ve=Di(he[0],he[1],void 0,{alpha:!1}),Re=ve.canvas;ve.fillStyle=C,ve.fillRect(0,0,Re.width,Re.height),W.setImage(new dA({img:Re,anchor:$.getAnchor(),anchorXUnits:"pixels",anchorYUnits:"pixels",offset:$.getOrigin(),opacity:1,size:$.getSize(),scale:$.getScale(),rotation:$.getRotation(),rotateWithView:$.getRotateWithView()}))}let J=W.getZIndex()||0,te=T[J];te||(te={},T[J]=te,te.Polygon=[],te.Circle=[],te.LineString=[],te.Point=[]);let ce=G.getType();if(ce==="GeometryCollection"){let he=G.getGeometriesArrayRecursive();for(let ve=0,Re=he.length;ve<Re;++ve){let Qe=he[ve];te[Qe.getType().replace("Multi","")].push(Qe,W)}}else te[ce.replace("Multi","")].push(G,W)}}let R=Object.keys(T).map(Number).sort(dl);for(let P=0,I=R.length;P<I;++P){let F=T[R[P]];for(let D in F){let L=F[D];for(let C=0,B=L.length;C<B;C+=2){y.setStyle(L[C+1]);for(let k=0,z=e.length;k<z;++k)y.setTransform(e[k]),y.drawGeometry(L[C])}}}return d.getImageData(0,0,A.width,A.height)}function tY(i,e,t){let n=[];if(t){let r=Math.floor(Math.round(i[0])*Mu),s=Math.floor(Math.round(i[1])*Mu),o=(Si(r,0,t.width-1)+Si(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 j0e=.5,nY={Point:J0e,LineString:Z0e,Polygon:tme,MultiPoint:eme,MultiLineString:K0e,MultiPolygon:Q0e,GeometryCollection:Y0e,Circle:X0e};function iY(i,e){return parseInt(Bn(i),10)-parseInt(Bn(e),10)}function L6(i,e){let t=D6(i,e);return t*t}function D6(i,e){return j0e*i/e}function X0e(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 N6(i,e,t,n,r,s,o,a){let l=[],c=t.getImage();if(c){let d=!0,A=c.getImageState();A==In.LOADED||A==In.ERROR?d=!1:A==In.IDLE&&c.load(),d&&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)),$0e(i,e,t,n,s,o,a),f}function $0e(i,e,t,n,r,s,o){let a=t.getGeometryFunction()(e);if(!a)return;let l=a.simplifyTransformed(n,r);if(t.getRenderer())rY(i,l,t,e,o);else{let u=nY[l.getType()];u(i,l,t,e,o,s)}}function rY(i,e,t,n,r){if(e.getType()=="GeometryCollection"){let o=e.getGeometries();for(let a=0,l=o.length;a<l;++a)rY(i,o[a],t,n,r);return}i.getBuilder(t.getZIndex(),"Default").drawCustom(e,n,t.getRenderer(),t.getHitDetectionRenderer(),r)}function Y0e(i,e,t,n,r,s){let o=e.getGeometriesArray(),a,l;for(a=0,l=o.length;a<l;++a){let c=nY[o[a].getType()];c(i,o[a],t,n,r,s)}}function Z0e(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 K0e(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 Q0e(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 J0e(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()!=In.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 eme(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()!=In.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 tme(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 F6=class extends p3{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_=Wr(),this.wrappedRenderedExtent_=Wr(),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(),d=this.getLayer().getDeclutter(),A=t.pixelRatio,y=t.viewHints,w=!(y[so.ANIMATING]||y[so.INTERACTING]),S=this.context,T=Math.round(Kn(r)/a*A),R=Math.round(Lr(r)/a*A),P=f.getWrapX()&&l.canWrapX(),I=P?Kn(u):null,F=P?Math.ceil((r[2]-u[2])/I)+(this.extendX_?2:1):1,D=P?Math.floor((r[0]-u[0])/I)-(this.extendX_?1:0):0;do{let L=this.getRenderTransform(o,a,0,A,T,R,D*I);t.declutter&&(L=L.slice(0)),e.execute(S,[S.canvas.width,S.canvas.height],L,c,w,n===void 0?Vp:n?I6:Y$,n?d&&t.declutter[d]:void 0)}while(++D<F)}setDrawContext_(){this.opacity_!==1&&(this.targetContext_=this.context,this.context=Di(this.context.canvas.width,this.context.canvas.height,l6))}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,rA(this.context),l6.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(Bo.PRERENDER)||this.getLayer().hasListener(Bo.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=vu(n.extent,l);a=Dr(u,e.extent),a&&!uh(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]*Mu,d=n[1]*Mu;u.push(this.getRenderTransform(r,s,o,Mu,f,d,0).slice());let A=c.getSource(),y=a.getExtent();if(A.getWrapX()&&a.canWrapX()&&!uh(y,l)){let S=l[0],T=Kn(y),R=0,P;for(;S<y[0];)--R,P=T*R,u.push(this.getRenderTransform(r,s,o,Mu,f,d,P).slice()),S+=T;for(R=0,S=l[2];S>y[2];)++R,P=T*R,u.push(this.getRenderTransform(r,s,o,Mu,f,d,P).slice()),S-=T}let w=eA();this.hitDetectionImageData_=eY(n,u,this.renderedFeatures_,c.getStyleFunction(),l,s,o,L6(s,this.renderedPixelRatio_),w?a:null)}t(tY(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(d,A,y){let w=Bn(d),S=c[w];if(S){if(S!==!0&&y<S.distanceSq){if(y===0)return c[w]=!0,s.splice(s.lastIndexOf(S),1),r(d,l,A);S.geometry=A,S.distanceSq=y}}else{if(y===0)return c[w]=!0,r(d,l,A);s.push(c[w]={feature:d,layer:l,geometry:A,distanceSq:y,callback:r})}},f=this.getLayer().getDeclutter();return this.replayGroup_.forEachFeatureAtCoordinate(e,o,a,n,u,f?t.declutter?.[f]?.all().map(d=>d.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[so.ANIMATING],s=e.viewHints[so.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,d=e.pixelRatio,A=t.getRevision(),y=t.getRenderBuffer(),w=t.getRenderOrder();w===void 0&&(w=iY);let S=c.center.slice(),T=F1(l,y*f),R=T.slice(),P=[T.slice()],I=u.getExtent(),F=n.getWrapX()&&u.canWrapX();if(this.extendX_=!1,F){let $=n.getExtent();$&&!fh($)&&(this.extendX_=$[0]<I[0]||$[2]>I[2])}if(F&&(!uh(I,e.extent)||this.extendX_)){let $=Kn(I),J=Math.max(Kn(T)/2,$),te=I[0],ce=I[2];this.extendX_&&(te-=$,ce+=$),T[0]=te-J,T[2]=ce+J,qT(S,u);let he=xD(P[0],u);he[0]<I[0]&&he[2]<I[2]?P.push([he[0]+$,he[1],he[2]+$,he[3]]):he[0]>I[0]&&he[2]>I[2]&&P.push([he[0]-$,he[1],he[2]-$,he[3]])}if(this.ready&&this.renderedResolution_==f&&this.renderedPixelRatio_===d&&this.renderedRevision_==A&&this.renderedRenderOrder_==w&&this.renderedFrameDeclutter_===!!e.declutter&&uh(this.wrappedRenderedExtent_,T))return ea(this.renderedExtent_,R)||(this.hitDetectionImageData_=null,this.renderedExtent_=R),this.renderedCenter_=S,this.replayGroupChanged=!1,!0;this.replayGroup_=null;let D=new H$(D6(f,d),T,f,d),L=eA(),C;if(L){for(let $=0,J=P.length;$<J;++$){let te=P[$],ce=bp(te,u);n.loadFeatures(ce,RW(f,u),L)}C=Qm(L,u)}else for(let $=0,J=P.length;$<J;++$)n.loadFeatures(P[$],f,u);let B=L6(f,d),k=!0,z=($,J)=>{let te,ce=$.getStyleFunction()||t.getStyleFunction();if(ce&&(te=ce($,f)),te){let he=this.renderFeature($,B,te,D,C,this.getLayer().getDeclutter(),J);k=k&&!he}},G=bp(T,u),W=n.getFeaturesInExtent(G);w&&W.sort(w);for(let $=0,J=W.length;$<J;++$)z(W[$],$);this.renderedFeatures_=W,this.ready=k;let Y=D.finish(),H=new Q$(T,f,d,n.getOverlaps(),Y,t.getRenderBuffer(),!!e.declutter);return this.renderedResolution_=f,this.renderedRevision_=A,this.renderedRenderOrder_=w,this.renderedFrameDeclutter_=!!e.declutter,this.renderedExtent_=R,this.wrappedRenderedExtent_=T,this.renderedCenter_=S,this.renderedProjection_=u,this.renderedPixelRatio_=d,this.replayGroup_=H,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=N6(r,e,n[c],t,this.boundHandleStyleImageChange_,s,o,a)||l;else l=N6(r,e,n,t,this.boundHandleStyleImageChange_,s,o,a);return l}},sY=F6;var B6=class extends u3{constructor(e){super(e)}createRenderer(){return new sY(this)}},oY=B6;var nme=!1;function ime(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=nme,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 O6(i,e){return function(t,n,r,s,o){ime(i,e,t,n,r,(a,l)=>{this.addFeatures(a),s!==void 0&&s(a)},()=>{this.changed(),o!==void 0&&o()})}}function aY(i,e){return[[-1/0,-1/0,1/0,1/0]]}var lY=go(),f2=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"?BT(this.flatCoordinates_):B1(this.flatCoordinates_,0,this.flatCoordinates_.length,this.stride_)),this.extent_}getFlatInteriorPoint(){if(!this.flatInteriorPoints_){let e=fl(this.getExtent());this.flatInteriorPoints_=Fy(this.flatCoordinates_,0,this.ends_,this.stride_,e,0)}return this.flatInteriorPoints_}getFlatInteriorPoints(){if(!this.flatInteriorPoints_){let e=Uj(this.flatCoordinates_,this.ends_),t=yE(this.flatCoordinates_,0,e,this.stride_);this.flatInteriorPoints_=vE(this.flatCoordinates_,0,e,this.stride_,t)}return this.flatInteriorPoints_}getFlatMidpoint(){return this.flatMidpoints_||(this.flatMidpoints_=pA(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=pA(e,t,o,this.stride_,.5);Lo(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=ks(e);let t=e.getExtent(),n=e.getWorldExtent();if(t&&n){let r=Lr(n)/Lr(t);Do(lY,n[0],n[3],r,-r,0,0,0),pl(this.flatCoordinates_,0,this.flatCoordinates_.length,this.stride_,lY,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=nE((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=cA(n,0,this.simplifiedGeometry_.flatCoordinates_.length,this.simplifiedGeometry_.stride_,e,n,0),r=[n.length];break;case"MultiLineString":r=[],n.length=gE(n,0,this.simplifiedGeometry_.ends_,this.simplifiedGeometry_.stride_,e,n,0,r);break;case"Polygon":r=[],n.length=Ny(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}};f2.prototype.getFlatCoordinates=f2.prototype.getOrientedFlatCoordinates;var bA=f2;var U6=class{constructor(e){this.rbush_=new _A(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_[Bn(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_[Bn(a)]=l}this.rbush_.load(n)}remove(e){let t=Bn(e),n=this.items_[t];return delete this.items_[t],this.rbush_.remove(n)!==null}update(e,t){let n=this.items_[Bn(t)],r=[n.minX,n.minY,n.maxX,n.maxY];Xm(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 mu(this.items_)}clear(){this.rbush_.clear(),this.items_={}}getExtent(e){let t=this.rbush_.toJSON();return Gl(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]}},k6=U6;var Wl={ADDFEATURE:"addfeature",CHANGEFEATURE:"changefeature",CLEAR:"clear",REMOVEFEATURE:"removefeature",FEATURESLOADSTART:"featuresloadstart",FEATURESLOADEND:"featuresloadend",FEATURESLOADERROR:"featuresloaderror"};var Th=class extends Ao{constructor(e,t,n){super(e),this.feature=t,this.features=n}},z6=class extends hE{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_=Qf,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&&(jn(this.format_,"`format` must be set when `url` is set"),this.loader_=O6(this.url_,this.format_)),this.strategy_=e.strategy!==void 0?e.strategy:aY;let t=e.useSpatialIndex!==void 0?e.useSpatialIndex:!0;this.featuresRtree_=t?new k6:null,this.loadedExtentsRtree_=new k6,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 No(r)),r!==void 0&&this.addFeaturesInternal(r),n!==void 0&&this.bindFeaturesCollection_(n)}addFeature(e){this.addFeatureInternal(e),this.changed()}addFeatureInternal(e){let t=Bn(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 Th(Wl.ADDFEATURE,e))}setupChangeEvents_(e,t){t instanceof bA||(this.featureChangeKeys_[e]=[qn(t,rn.CHANGE,this.handleFeatureChange_,this),qn(t,_u.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 bA){let s=this.idIndex_[r];s instanceof bA?Array.isArray(s)?s.push(t):this.idIndex_[r]=[s,t]:n=!1}else n=!1}return n&&(jn(!(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=Bn(a);this.addToIndex_(l,a)&&n.push(a)}for(let s=0,o=n.length;s<o;s++){let a=n[s],l=Bn(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(Wl.ADDFEATURE))for(let s=0,o=n.length;s<o;s++)this.dispatchEvent(new Th(Wl.ADDFEATURE,n[s]))}bindFeaturesCollection_(e){let t=!1;this.addEventListener(Wl.ADDFEATURE,function(n){t||(t=!0,e.push(n.feature),t=!1)}),this.addEventListener(Wl.REMOVEFEATURE,function(n){t||(t=!0,e.remove(n.feature),t=!1)}),e.addEventListener(vo.ADD,n=>{t||(t=!0,this.addFeature(n.element),t=!1)}),e.addEventListener(vo.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(li);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 Th(Wl.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 bA||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 bA||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(),mu(this.nullGeometryFeatures_)||Lo(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=kT(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||Zf,this.featuresRtree_.forEachInExtent(l,function(c){if(t(c)){let u=c.getGeometry(),f=a;if(a=u instanceof bA?0:u.closestPointXY(n,r,o,a),a<f){s=c;let d=Math.sqrt(a);l[0]=n-d,l[1]=r-d,l[2]=n+d,l[3]=r+d}}}),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=Bn(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 Th(Wl.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 Bn(e)in this.uidIndex_}isEmpty(){return this.featuresRtree_?this.featuresRtree_.isEmpty()&&mu(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 uh(u.extent,l)})){this.loading=Number(this.loading)+1,this.dispatchEvent(new Th(Wl.FEATURESLOADSTART));let u=y=>{this.loading=Number(this.loading)-1,this.dispatchEvent(new Th(Wl.FEATURESLOADEND,void 0,y))},f=()=>{this.changed(),this.loading=Number(this.loading)-1,this.dispatchEvent(new Th(Wl.FEATURESLOADERROR))},d=!1,A=this.loader_.call(this,l,t,n,y=>d||u(y),()=>d||f());A instanceof Promise?(d=!0,A.then(y=>{this.addFeatures(y),u(y)}).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=_D(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=Bn(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(li),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(Wl.REMOVEFEATURE)&&this.dispatchEvent(new Th(Wl.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){jn(this.format_,"`format` must be set when `url` is set"),this.url_=e,this.setLoader(O6(e,this.format_))}setOverlaps(e){this.overlaps_=e,this.changed()}},dd=z6;var Ga={LEFT:0,MIDDLE:1,RIGHT:2,ROTATE:0,DOLLY:1,PAN:2},l0={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},wM=0,sb=1,SM=2;var C8=0,c0=1,TM=2,Vc=3,ko=0,mi=1,gr=2,ps=0,Ms=1,Dh=2,Nh=3,Fh=4,Id=5,ob=6,oo=100,ab=101,lb=102,EM=103,MM=104,Nu=200,cb=201,ub=202,hb=203,Yp=204,Zp=205,fb=206,db=207,pb=208,mb=209,Ab=210,KY=211,QY=212,JY=213,eZ=214,MA=0,CA=1,RA=2,Ch=3,IA=4,PA=5,LA=6,DA=7,ZA=0,CM=1,RM=2,ao=0,gb=1,vb=2,_b=3,xb=4,R8=5,yb=6,bb=7;var wb=300,Kl=301,Gc=302,u0=303,h0=304,Bh=306,wd=1e3,aa=1001,Sd=1002,Ti=1003,Sb=1004;var qc=1005;var Mi=1006,f0=1007;var Vo=1008,I8=1008,Ji=1009,Oh=1010,Uh=1011,bl=1012,Zr=1013,xi=1014,cr=1015,Wi=1016,KA=1017,QA=1018,ca=1020,JA=35902,eg=35899,r_=1021,Pd=1022,Or=1023,Gs=1026,xo=1027,Ld=1028,kh=1029,js=1030,zh=1031,Tb=1032,d0=1033,Vh=33776,Gh=33777,qh=33778,Hh=33779,tg=35840,ng=35841,ig=35842,rg=35843,p0=36196,m0=37492,A0=37496,g0=37488,v0=37489,Wh=37490,_0=37491,x0=37808,y0=37809,b0=37810,w0=37811,S0=37812,T0=37813,E0=37814,M0=37815,C0=37816,R0=37817,I0=37818,P0=37819,L0=37820,D0=37821,N0=36492,F0=36494,B0=36495,O0=36283,U0=36284,jh=36285,k0=36286;var E2=2300,K3=2301,Y3=2302,m8=2303,A8=2400,g8=2401,v8=2402;var P8=0,L8=1,IM=2,tZ=3200;var Ql=0,PM=1,ua="",Fr="srgb",Kp="srgb-linear",Qp="linear",kt="srgb",Eb="",LM="rg",D8="ga",N8=0,_d=7680,F8=7681,B8=7682,O8=7683,U8=34055,k8=34056,z8=5386,V8=512,G8=513,q8=514,H8=515,W8=516,j8=517,X8=518,M2=519,Mb=512,s_=513,Cb=514,Xh=515,sg=516,Rb=517,Fu=518,Ib=519,Jp=35044,og=35048;var $8="300 es",Uo=2e3,_l=2001,Hc={COMPUTE:"compute",RENDER:"render"};var Dd={TEXTURE_COMPARE:"depthTextureCompare"};function rme(i){for(let e=i.length-1;e>=0;--e)if(i[e]>=65535)return!0;return!1}function o_(i){return ArrayBuffer.isView(i)&&!(i instanceof DataView)}function Gv(i){return document.createElementNS("http://www.w3.org/1999/xhtml",i)}function DM(){let i=Gv("canvas");return i.style.display="block",i}var cY={},qv=null;function NA(...i){let e="THREE."+i.shift();qv?qv("log",e,...i):console.log(e,...i)}function nZ(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 Xe(...i){i=nZ(i);let e="THREE."+i.shift();if(qv)qv("warn",e,...i);else{let t=i[0];t&&t.isStackTrace?console.warn(t.getError(e)):console.warn(e,...i)}}function ze(...i){i=nZ(i);let e="THREE."+i.shift();if(qv)qv("error",e,...i);else{let t=i[0];t&&t.isStackTrace?console.error(t.getError(e)):console.error(e,...i)}}function ni(...i){let e=i.join(" ");e in cY||(cY[e]=!0,Xe(...i))}function Y8(){return typeof self<"u"&&typeof self.scheduler<"u"&&typeof self.scheduler.yield<"u"?self.scheduler.yield():new Promise(i=>{requestAnimationFrame(i)})}function iZ(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 Pb={[MA]:CA,[RA]:LA,[IA]:DA,[Ch]:PA,[CA]:MA,[LA]:RA,[DA]:IA,[PA]:Ch},la=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}}},sa=["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"],uY=1234567,b2=Math.PI/180,Td=180/Math.PI;function Mh(){let i=Math.random()*4294967295|0,e=Math.random()*4294967295|0,t=Math.random()*4294967295|0,n=Math.random()*4294967295|0;return(sa[i&255]+sa[i>>8&255]+sa[i>>16&255]+sa[i>>24&255]+"-"+sa[e&255]+sa[e>>8&255]+"-"+sa[e>>16&15|64]+sa[e>>24&255]+"-"+sa[t&63|128]+sa[t>>8&255]+"-"+sa[t>>16&255]+sa[t>>24&255]+sa[n&255]+sa[n>>8&255]+sa[n>>16&255]+sa[n>>24&255]).toLowerCase()}function Nn(i,e,t){return Math.max(e,Math.min(t,i))}function Z8(i,e){return(i%e+e)%e}function sme(i,e,t,n,r){return n+(i-e)*(r-n)/(t-e)}function ome(i,e,t){return i!==e?(t-i)/(e-i):0}function w2(i,e,t){return(1-t)*i+t*e}function ame(i,e,t,n){return w2(i,e,1-Math.exp(-t*n))}function lme(i,e=1){return e-Math.abs(Z8(i,e*2)-e)}function cme(i,e,t){return i<=e?0:i>=t?1:(i=(i-e)/(t-e),i*i*(3-2*i))}function ume(i,e,t){return i<=e?0:i>=t?1:(i=(i-e)/(t-e),i*i*i*(i*(i*6-15)+10))}function hme(i,e){return i+Math.floor(Math.random()*(e-i+1))}function fme(i,e){return i+Math.random()*(e-i)}function dme(i){return i*(.5-Math.random())}function pme(i){i!==void 0&&(uY=i);let e=uY+=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 mme(i){return i*b2}function Ame(i){return i*Td}function gme(i){return(i&i-1)===0&&i!==0}function vme(i){return Math.pow(2,Math.ceil(Math.log(i)/Math.LN2))}function _me(i){return Math.pow(2,Math.floor(Math.log(i)/Math.LN2))}function xme(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),d=o((e-n)/2),A=s((n-e)/2),y=o((n-e)/2);switch(r){case"XYX":i.set(a*u,l*f,l*d,a*c);break;case"YZY":i.set(l*d,a*u,l*f,a*c);break;case"ZXZ":i.set(l*f,l*d,a*u,a*c);break;case"XZX":i.set(a*u,l*y,l*A,a*c);break;case"YXY":i.set(l*A,a*u,l*y,a*c);break;case"ZYZ":i.set(l*y,l*A,a*u,a*c);break;default:Xe("MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+r)}}function Na(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 Zn(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 Bu={DEG2RAD:b2,RAD2DEG:Td,generateUUID:Mh,clamp:Nn,euclideanModulo:Z8,mapLinear:sme,inverseLerp:ome,lerp:w2,damp:ame,pingpong:lme,smoothstep:cme,smootherstep:ume,randInt:hme,randFloat:fme,randFloatSpread:dme,seededRandom:pme,degToRad:mme,radToDeg:Ame,isPowerOfTwo:gme,ceilPowerOfTwo:vme,floorPowerOfTwo:_me,setQuaternionFromProperEuler:xme,normalize:Zn,denormalize:Na},tF=class tF{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=Nn(this.x,e.x,t.x),this.y=Nn(this.y,e.y,t.y),this}clampScalar(e,t){return this.x=Nn(this.x,e,t),this.y=Nn(this.y,e,t),this}clampLength(e,t){let n=this.length();return this.divideScalar(n||1).multiplyScalar(Nn(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(Nn(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}};tF.prototype.isVector2=!0;var Oe=tF,qs=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],d=s[o+0],A=s[o+1],y=s[o+2],w=s[o+3];if(f!==w||l!==d||c!==A||u!==y){let S=l*d+c*A+u*y+f*w;S<0&&(d=-d,A=-A,y=-y,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+d*a,c=c*T+A*a,u=u*T+y*a,f=f*T+w*a}else{l=l*T+d*a,c=c*T+A*a,u=u*T+y*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],d=s[o+1],A=s[o+2],y=s[o+3];return e[t]=a*y+u*f+l*A-c*d,e[t+1]=l*y+u*d+c*f-a*A,e[t+2]=c*y+u*A+a*d-l*f,e[t+3]=u*y-a*f-l*d-c*A,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),d=l(n/2),A=l(r/2),y=l(s/2);switch(o){case"XYZ":this._x=d*u*f+c*A*y,this._y=c*A*f-d*u*y,this._z=c*u*y+d*A*f,this._w=c*u*f-d*A*y;break;case"YXZ":this._x=d*u*f+c*A*y,this._y=c*A*f-d*u*y,this._z=c*u*y-d*A*f,this._w=c*u*f+d*A*y;break;case"ZXY":this._x=d*u*f-c*A*y,this._y=c*A*f+d*u*y,this._z=c*u*y+d*A*f,this._w=c*u*f-d*A*y;break;case"ZYX":this._x=d*u*f-c*A*y,this._y=c*A*f+d*u*y,this._z=c*u*y-d*A*f,this._w=c*u*f+d*A*y;break;case"YZX":this._x=d*u*f+c*A*y,this._y=c*A*f+d*u*y,this._z=c*u*y-d*A*f,this._w=c*u*f-d*A*y;break;case"XZY":this._x=d*u*f-c*A*y,this._y=c*A*f-d*u*y,this._z=c*u*y+d*A*f,this._w=c*u*f+d*A*y;break;default:Xe("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],d=n+a+f;if(d>0){let A=.5/Math.sqrt(d+1);this._w=.25/A,this._x=(u-l)*A,this._y=(s-c)*A,this._z=(o-r)*A}else if(n>a&&n>f){let A=2*Math.sqrt(1+n-a-f);this._w=(u-l)/A,this._x=.25*A,this._y=(r+o)/A,this._z=(s+c)/A}else if(a>f){let A=2*Math.sqrt(1+a-n-f);this._w=(s-c)/A,this._x=(r+o)/A,this._y=.25*A,this._z=(l+u)/A}else{let A=2*Math.sqrt(1+f-n-a);this._w=(o-r)/A,this._x=(s+c)/A,this._y=(l+u)/A,this._z=.25*A}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(Nn(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}},nF=class nF{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(hY.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(hY.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=Nn(this.x,e.x,t.x),this.y=Nn(this.y,e.y,t.y),this.z=Nn(this.z,e.z,t.z),this}clampScalar(e,t){return this.x=Nn(this.x,e,t),this.y=Nn(this.y,e,t),this.z=Nn(this.z,e,t),this}clampLength(e,t){let n=this.length();return this.divideScalar(n||1).multiplyScalar(Nn(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 V6.copy(this).projectOnVector(e),this.sub(V6)}reflect(e){return this.sub(V6.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(Nn(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}};nF.prototype.isVector3=!0;var re=nF,V6=new re,hY=new qs,iF=class iF{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],d=n[2],A=n[5],y=n[8],w=r[0],S=r[3],T=r[6],R=r[1],P=r[4],I=r[7],F=r[2],D=r[5],L=r[8];return s[0]=o*w+a*R+l*F,s[3]=o*S+a*P+l*D,s[6]=o*T+a*I+l*L,s[1]=c*w+u*R+f*F,s[4]=c*S+u*P+f*D,s[7]=c*T+u*I+f*L,s[2]=d*w+A*R+y*F,s[5]=d*S+A*P+y*D,s[8]=d*T+A*I+y*L,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,d=a*l-u*s,A=c*s-o*l,y=t*f+n*d+r*A;if(y===0)return this.set(0,0,0,0,0,0,0,0,0);let w=1/y;return e[0]=f*w,e[1]=(r*c-u*n)*w,e[2]=(a*n-r*o)*w,e[3]=d*w,e[4]=(u*t-r*l)*w,e[5]=(r*s-a*t)*w,e[6]=A*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 ni("Matrix3: .scale() is deprecated. Use .makeScale() instead."),this.premultiply(G6.makeScale(e,t)),this}rotate(e){return ni("Matrix3: .rotate() is deprecated. Use .makeRotation() instead."),this.premultiply(G6.makeRotation(-e)),this}translate(e,t){return ni("Matrix3: .translate() is deprecated. Use .makeTranslation() instead."),this.premultiply(G6.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)}};iF.prototype.isMatrix3=!0;var Mn=iF,G6=new Mn,fY=new Mn().set(.4123908,.3575843,.1804808,.212639,.7151687,.0721923,.0193308,.1191948,.9505322),dY=new Mn().set(3.2409699,-1.5373832,-.4986108,-.9692436,1.8759675,.0415551,.0556301,-.203977,1.0569715);function yme(){let i={enabled:!0,workingColorSpace:Kp,spaces:{},convert:function(r,s,o){return this.enabled===!1||s===o||!s||!o||(this.spaces[s].transfer===kt&&(r.r=bd(r.r),r.g=bd(r.g),r.b=bd(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===kt&&(r.r=Vv(r.r),r.g=Vv(r.g),r.b=Vv(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===ua?Qp: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 ni("ColorManagement: .fromWorkingColorSpace() has been renamed to .workingToColorSpace()."),i.workingToColorSpace(r,s)},toWorkingColorSpace:function(r,s){return ni("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({[Kp]:{primaries:e,whitePoint:n,transfer:Qp,toXYZ:fY,fromXYZ:dY,luminanceCoefficients:t,workingColorSpaceConfig:{unpackColorSpace:Fr},outputColorSpaceConfig:{drawingBufferColorSpace:Fr}},[Fr]:{primaries:e,whitePoint:n,transfer:kt,toXYZ:fY,fromXYZ:dY,luminanceCoefficients:t,outputColorSpaceConfig:{drawingBufferColorSpace:Fr}}}),i}var ln=yme();function bd(i){return i<.04045?i*.0773993808:Math.pow(i*.9478672986+.0521327014,2.4)}function Vv(i){return i<.0031308?i*12.92:1.055*Math.pow(i,.41666)-.055}var bv,Q3=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{bv===void 0&&(bv=Gv("canvas")),bv.width=e.width,bv.height=e.height;let r=bv.getContext("2d");e instanceof ImageData?r.putImageData(e,0,0):r.drawImage(e,0,0,e.width,e.height),n=bv}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=Gv("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]=bd(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(bd(t[n]/255)*255):t[n]=bd(t[n]);return{data:t,width:e.width,height:e.height}}else return Xe("ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied."),e}},bme=0,Hv=class{constructor(e=null){this.isSource=!0,Object.defineProperty(this,"id",{value:bme++}),this.uuid=Mh(),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(q6(r[o].image)):s.push(q6(r[o]))}else s=q6(r);n.url=s}return t||(e.images[this.uuid]=n),n}};function q6(i){return typeof HTMLImageElement<"u"&&i instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&i instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&i instanceof ImageBitmap?Q3.getDataURL(i):i.data?{data:Array.from(i.data),width:i.width,height:i.height,type:i.data.constructor.name}:(Xe("Texture: Unable to serialize Texture."),{})}var wme=0,H6=new re,Hs=class i extends la{constructor(e=i.DEFAULT_IMAGE,t=i.DEFAULT_MAPPING,n=aa,r=aa,s=Mi,o=Vo,a=Or,l=Ji,c=i.DEFAULT_ANISOTROPY,u=ua){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:wme++}),this.uuid=Mh(),this.name="",this.source=new Hv(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 Mn,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(H6).x}get height(){return this.source.getSize(H6).y}get depth(){return this.source.getSize(H6).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){Xe(`Texture.setValues(): parameter '${t}' has value of undefined.`);continue}let r=this[t];if(r===void 0){Xe(`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!==wb)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case wd:e.x=e.x-Math.floor(e.x);break;case aa:e.x=e.x<0?0:1;break;case Sd: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 wd:e.y=e.y-Math.floor(e.y);break;case aa:e.y=e.y<0?0:1;break;case Sd: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++}};Hs.DEFAULT_IMAGE=null;Hs.DEFAULT_MAPPING=wb;Hs.DEFAULT_ANISOTROPY=1;var rF=class rF{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],d=l[1],A=l[5],y=l[9],w=l[2],S=l[6],T=l[10];if(Math.abs(u-d)<.01&&Math.abs(f-w)<.01&&Math.abs(y-S)<.01){if(Math.abs(u+d)<.1&&Math.abs(f+w)<.1&&Math.abs(y+S)<.1&&Math.abs(c+A+T-3)<.1)return this.set(1,0,0,0),this;t=Math.PI;let P=(c+1)/2,I=(A+1)/2,F=(T+1)/2,D=(u+d)/4,L=(f+w)/4,C=(y+S)/4;return P>I&&P>F?P<.01?(n=0,r=.707106781,s=.707106781):(n=Math.sqrt(P),r=D/n,s=L/n):I>F?I<.01?(n=.707106781,r=0,s=.707106781):(r=Math.sqrt(I),n=D/r,s=C/r):F<.01?(n=.707106781,r=.707106781,s=0):(s=Math.sqrt(F),n=L/s,r=C/s),this.set(n,r,s,t),this}let R=Math.sqrt((S-y)*(S-y)+(f-w)*(f-w)+(d-u)*(d-u));return Math.abs(R)<.001&&(R=1),this.x=(S-y)/R,this.y=(f-w)/R,this.z=(d-u)/R,this.w=Math.acos((c+A+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=Nn(this.x,e.x,t.x),this.y=Nn(this.y,e.y,t.y),this.z=Nn(this.z,e.z,t.z),this.w=Nn(this.w,e.w,t.w),this}clampScalar(e,t){return this.x=Nn(this.x,e,t),this.y=Nn(this.y,e,t),this.z=Nn(this.z,e,t),this.w=Nn(this.w,e,t),this}clampLength(e,t){let n=this.length();return this.divideScalar(n||1).multiplyScalar(Nn(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}};rF.prototype.isVector4=!0;var xn=rF,Fa=class extends la{constructor(e=1,t=1,n={}){super(),n=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:Mi,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 xn(0,0,e,t),this.scissorTest=!1,this.viewport=new xn(0,0,e,t),this.textures=[];let r={width:e,height:t,depth:n.depth},s=new Hs(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:Mi,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 Hv(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"})}},Ba=class extends Fa{constructor(e=1,t=1,n={}){super(e,t,n),this.isWebGLRenderTarget=!0}},FA=class extends Hs{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=Ti,this.minFilter=Ti,this.wrapR=aa,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.layerUpdates=new Set}addLayerUpdate(e){this.layerUpdates.add(e)}clearLayerUpdates(){this.layerUpdates.clear()}};var J3=class extends Hs{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=Ti,this.minFilter=Ti,this.wrapR=aa,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}};var bM=class bM{constructor(e,t,n,r,s,o,a,l,c,u,f,d,A,y,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,d,A,y,w,S)}set(e,t,n,r,s,o,a,l,c,u,f,d,A,y,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]=d,T[3]=A,T[7]=y,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 bM().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/wv.setFromMatrixColumn(e,0).length(),s=1/wv.setFromMatrixColumn(e,1).length(),o=1/wv.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 d=o*u,A=o*f,y=a*u,w=a*f;t[0]=l*u,t[4]=-l*f,t[8]=c,t[1]=A+y*c,t[5]=d-w*c,t[9]=-a*l,t[2]=w-d*c,t[6]=y+A*c,t[10]=o*l}else if(e.order==="YXZ"){let d=l*u,A=l*f,y=c*u,w=c*f;t[0]=d+w*a,t[4]=y*a-A,t[8]=o*c,t[1]=o*f,t[5]=o*u,t[9]=-a,t[2]=A*a-y,t[6]=w+d*a,t[10]=o*l}else if(e.order==="ZXY"){let d=l*u,A=l*f,y=c*u,w=c*f;t[0]=d-w*a,t[4]=-o*f,t[8]=y+A*a,t[1]=A+y*a,t[5]=o*u,t[9]=w-d*a,t[2]=-o*c,t[6]=a,t[10]=o*l}else if(e.order==="ZYX"){let d=o*u,A=o*f,y=a*u,w=a*f;t[0]=l*u,t[4]=y*c-A,t[8]=d*c+w,t[1]=l*f,t[5]=w*c+d,t[9]=A*c-y,t[2]=-c,t[6]=a*l,t[10]=o*l}else if(e.order==="YZX"){let d=o*l,A=o*c,y=a*l,w=a*c;t[0]=l*u,t[4]=w-d*f,t[8]=y*f+A,t[1]=f,t[5]=o*u,t[9]=-a*u,t[2]=-c*u,t[6]=A*f+y,t[10]=d-w*f}else if(e.order==="XZY"){let d=o*l,A=o*c,y=a*l,w=a*c;t[0]=l*u,t[4]=-f,t[8]=c*u,t[1]=d*f+w,t[5]=o*u,t[9]=A*f-y,t[2]=y*f-A,t[6]=a*u,t[10]=w*f+d}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(Sme,e,Tme)}lookAt(e,t,n){let r=this.elements;return jl.subVectors(e,t),jl.lengthSq()===0&&(jl.z=1),jl.normalize(),Gp.crossVectors(n,jl),Gp.lengthSq()===0&&(Math.abs(n.z)===1?jl.x+=1e-4:jl.z+=1e-4,jl.normalize(),Gp.crossVectors(n,jl)),Gp.normalize(),v3.crossVectors(jl,Gp),r[0]=Gp.x,r[4]=v3.x,r[8]=jl.x,r[1]=Gp.y,r[5]=v3.y,r[9]=jl.y,r[2]=Gp.z,r[6]=v3.z,r[10]=jl.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],d=n[9],A=n[13],y=n[2],w=n[6],S=n[10],T=n[14],R=n[3],P=n[7],I=n[11],F=n[15],D=r[0],L=r[4],C=r[8],B=r[12],k=r[1],z=r[5],G=r[9],W=r[13],Y=r[2],H=r[6],$=r[10],J=r[14],te=r[3],ce=r[7],he=r[11],ve=r[15];return s[0]=o*D+a*k+l*Y+c*te,s[4]=o*L+a*z+l*H+c*ce,s[8]=o*C+a*G+l*$+c*he,s[12]=o*B+a*W+l*J+c*ve,s[1]=u*D+f*k+d*Y+A*te,s[5]=u*L+f*z+d*H+A*ce,s[9]=u*C+f*G+d*$+A*he,s[13]=u*B+f*W+d*J+A*ve,s[2]=y*D+w*k+S*Y+T*te,s[6]=y*L+w*z+S*H+T*ce,s[10]=y*C+w*G+S*$+T*he,s[14]=y*B+w*W+S*J+T*ve,s[3]=R*D+P*k+I*Y+F*te,s[7]=R*L+P*z+I*H+F*ce,s[11]=R*C+P*G+I*$+F*he,s[15]=R*B+P*W+I*J+F*ve,this}multiplyScalar(e){let t=this.elements;return t[0]*=e,t[4]*=e,t[8]*=e,t[12]*=e,t[1]*=e,t[5]*=e,t[9]*=e,t[13]*=e,t[2]*=e,t[6]*=e,t[10]*=e,t[14]*=e,t[3]*=e,t[7]*=e,t[11]*=e,t[15]*=e,this}determinant(){let e=this.elements,t=e[0],n=e[4],r=e[8],s=e[12],o=e[1],a=e[5],l=e[9],c=e[13],u=e[2],f=e[6],d=e[10],A=e[14],y=e[3],w=e[7],S=e[11],T=e[15],R=l*A-c*d,P=a*A-c*f,I=a*d-l*f,F=o*A-c*u,D=o*d-l*u,L=o*f-a*u;return t*(w*R-S*P+T*I)-n*(y*R-S*F+T*D)+r*(y*P-w*F+T*L)-s*(y*I-w*D+S*L)}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],d=e[10],A=e[11],y=e[12],w=e[13],S=e[14],T=e[15],R=t*a-n*o,P=t*l-r*o,I=t*c-s*o,F=n*l-r*a,D=n*c-s*a,L=r*c-s*l,C=u*w-f*y,B=u*S-d*y,k=u*T-A*y,z=f*S-d*w,G=f*T-A*w,W=d*T-A*S,Y=R*W-P*G+I*z+F*k-D*B+L*C;if(Y===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);let H=1/Y;return e[0]=(a*W-l*G+c*z)*H,e[1]=(r*G-n*W-s*z)*H,e[2]=(w*L-S*D+T*F)*H,e[3]=(d*D-f*L-A*F)*H,e[4]=(l*k-o*W-c*B)*H,e[5]=(t*W-r*k+s*B)*H,e[6]=(S*I-y*L-T*P)*H,e[7]=(u*L-d*I+A*P)*H,e[8]=(o*G-a*k+c*C)*H,e[9]=(n*k-t*G-s*C)*H,e[10]=(y*D-w*I+T*R)*H,e[11]=(f*I-u*D-A*R)*H,e[12]=(a*B-o*z-l*C)*H,e[13]=(t*z-n*B+r*C)*H,e[14]=(w*P-y*F-S*R)*H,e[15]=(u*F-f*P+d*R)*H,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,d=s*c,A=s*u,y=s*f,w=o*u,S=o*f,T=a*f,R=l*c,P=l*u,I=l*f,F=n.x,D=n.y,L=n.z;return r[0]=(1-(w+T))*F,r[1]=(A+I)*F,r[2]=(y-P)*F,r[3]=0,r[4]=(A-I)*D,r[5]=(1-(d+T))*D,r[6]=(S+R)*D,r[7]=0,r[8]=(y+P)*L,r[9]=(S-R)*L,r[10]=(1-(d+w))*L,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=wv.set(r[0],r[1],r[2]).length(),a=wv.set(r[4],r[5],r[6]).length(),l=wv.set(r[8],r[9],r[10]).length();s<0&&(o=-o),Cu.copy(this);let c=1/o,u=1/a,f=1/l;return Cu.elements[0]*=c,Cu.elements[1]*=c,Cu.elements[2]*=c,Cu.elements[4]*=u,Cu.elements[5]*=u,Cu.elements[6]*=u,Cu.elements[8]*=f,Cu.elements[9]*=f,Cu.elements[10]*=f,t.setFromRotationMatrix(Cu),n.x=o,n.y=a,n.z=l,this}makePerspective(e,t,n,r,s,o,a=Uo,l=!1){let c=this.elements,u=2*s/(t-e),f=2*s/(n-r),d=(t+e)/(t-e),A=(n+r)/(n-r),y,w;if(l)y=s/(o-s),w=o*s/(o-s);else if(a===Uo)y=-(o+s)/(o-s),w=-2*o*s/(o-s);else if(a===_l)y=-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]=d,c[12]=0,c[1]=0,c[5]=f,c[9]=A,c[13]=0,c[2]=0,c[6]=0,c[10]=y,c[14]=w,c[3]=0,c[7]=0,c[11]=-1,c[15]=0,this}makeOrthographic(e,t,n,r,s,o,a=Uo,l=!1){let c=this.elements,u=2/(t-e),f=2/(n-r),d=-(t+e)/(t-e),A=-(n+r)/(n-r),y,w;if(l)y=1/(o-s),w=o/(o-s);else if(a===Uo)y=-2/(o-s),w=-(o+s)/(o-s);else if(a===_l)y=-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]=d,c[1]=0,c[5]=f,c[9]=0,c[13]=A,c[2]=0,c[6]=0,c[10]=y,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}};bM.prototype.isMatrix4=!0;var cn=bM,wv=new re,Cu=new cn,Sme=new re(0,0,0),Tme=new re(1,1,1),Gp=new re,v3=new re,jl=new re,pY=new cn,mY=new qs,Oa=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],d=r[6],A=r[10];switch(t){case"XYZ":this._y=Math.asin(Nn(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(-u,A),this._z=Math.atan2(-o,s)):(this._x=Math.atan2(d,c),this._z=0);break;case"YXZ":this._x=Math.asin(-Nn(u,-1,1)),Math.abs(u)<.9999999?(this._y=Math.atan2(a,A),this._z=Math.atan2(l,c)):(this._y=Math.atan2(-f,s),this._z=0);break;case"ZXY":this._x=Math.asin(Nn(d,-1,1)),Math.abs(d)<.9999999?(this._y=Math.atan2(-f,A),this._z=Math.atan2(-o,c)):(this._y=0,this._z=Math.atan2(l,s));break;case"ZYX":this._y=Math.asin(-Nn(f,-1,1)),Math.abs(f)<.9999999?(this._x=Math.atan2(d,A),this._z=Math.atan2(l,s)):(this._x=0,this._z=Math.atan2(-o,c));break;case"YZX":this._z=Math.asin(Nn(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,A));break;case"XZY":this._z=Math.asin(-Nn(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(d,c),this._y=Math.atan2(a,s)):(this._x=Math.atan2(-u,A),this._y=0);break;default:Xe("Euler: .setFromRotationMatrix() encountered an unknown order: "+t)}return this._order=t,n===!0&&this._onChangeCallback(),this}setFromQuaternion(e,t,n){return pY.makeRotationFromQuaternion(e),this.setFromRotationMatrix(pY,t,n)}setFromVector3(e,t=this._order){return this.set(e.x,e.y,e.z,t)}reorder(e){return mY.setFromEuler(this),this.setFromQuaternion(mY,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}};Oa.DEFAULT_ORDER="XYZ";var Wv=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}},Eme=0,AY=new re,Sv=new qs,pd=new cn,_3=new re,d2=new re,Mme=new re,Cme=new qs,gY=new re(1,0,0),vY=new re(0,1,0),_Y=new re(0,0,1),xY={type:"added"},Rme={type:"removed"},Tv={type:"childadded",child:null},W6={type:"childremoved",child:null},lr=class i extends la{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:Eme++}),this.uuid=Mh(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=i.DEFAULT_UP.clone();let e=new re,t=new Oa,n=new qs,r=new re(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 cn},normalMatrix:{value:new Mn}}),this.matrix=new cn,this.matrixWorld=new cn,this.matrixAutoUpdate=i.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldAutoUpdate=i.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.layers=new Wv,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 Sv.setFromAxisAngle(e,t),this.quaternion.multiply(Sv),this}rotateOnWorldAxis(e,t){return Sv.setFromAxisAngle(e,t),this.quaternion.premultiply(Sv),this}rotateX(e){return this.rotateOnAxis(gY,e)}rotateY(e){return this.rotateOnAxis(vY,e)}rotateZ(e){return this.rotateOnAxis(_Y,e)}translateOnAxis(e,t){return AY.copy(e).applyQuaternion(this.quaternion),this.position.add(AY.multiplyScalar(t)),this}translateX(e){return this.translateOnAxis(gY,e)}translateY(e){return this.translateOnAxis(vY,e)}translateZ(e){return this.translateOnAxis(_Y,e)}localToWorld(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(this.matrixWorld)}worldToLocal(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(pd.copy(this.matrixWorld).invert())}lookAt(e,t,n){e.isVector3?_3.copy(e):_3.set(e,t,n);let r=this.parent;this.updateWorldMatrix(!0,!1),d2.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?pd.lookAt(d2,_3,this.up):pd.lookAt(_3,d2,this.up),this.quaternion.setFromRotationMatrix(pd),r&&(pd.extractRotation(r.matrixWorld),Sv.setFromRotationMatrix(pd),this.quaternion.premultiply(Sv.invert()))}add(e){if(arguments.length>1){for(let t=0;t<arguments.length;t++)this.add(arguments[t]);return this}return e===this?(ze("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(xY),Tv.child=e,this.dispatchEvent(Tv),Tv.child=null):ze("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(Rme),W6.child=e,this.dispatchEvent(W6),W6.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),pd.copy(this.matrixWorld).invert(),e.parent!==null&&(e.parent.updateWorldMatrix(!0,!1),pd.multiply(e.parent.matrixWorld)),e.applyMatrix4(pd),e.removeFromParent(),e.parent=this,this.children.push(e),e.updateWorldMatrix(!1,!0),e.dispatchEvent(xY),Tv.child=e,this.dispatchEvent(Tv),Tv.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(d2,e,Mme),e}getWorldScale(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(d2,Cme,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),d=o(e.skeletons),A=o(e.animations),y=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),d.length>0&&(n.skeletons=d),A.length>0&&(n.animations=A),y.length>0&&(n.nodes=y)}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}};lr.DEFAULT_UP=new re(0,1,0);lr.DEFAULT_MATRIX_AUTO_UPDATE=!0;lr.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;var Br=class extends lr{constructor(){super(),this.isGroup=!0,this.type="Group"}},Ime={type:"move"},e0=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 re,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new re),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 re,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new re,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"],d=u.position.distanceTo(f.position),A=.02,y=.005;c.inputState.pinching&&d>A+y?(c.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!c.inputState.pinching&&d<=A-y&&(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(Ime)))}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]}},rZ={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},qp={h:0,s:0,l:0},x3={h:0,s:0,l:0};function j6(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 zt=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=Fr){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,ln.colorSpaceToWorking(this,t),this}setRGB(e,t,n,r=ln.workingColorSpace){return this.r=e,this.g=t,this.b=n,ln.colorSpaceToWorking(this,r),this}setHSL(e,t,n,r=ln.workingColorSpace){if(e=Z8(e,1),t=Nn(t,0,1),n=Nn(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=j6(o,s,e+1/3),this.g=j6(o,s,e),this.b=j6(o,s,e-1/3)}return ln.colorSpaceToWorking(this,r),this}setStyle(e,t=Fr){function n(s){s!==void 0&&parseFloat(s)<1&&Xe("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:Xe("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);Xe("Color: Invalid hex color "+e)}else if(e&&e.length>0)return this.setColorName(e,t);return this}setColorName(e,t=Fr){let n=rZ[e.toLowerCase()];return n!==void 0?this.setHex(n,t):Xe("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=bd(e.r),this.g=bd(e.g),this.b=bd(e.b),this}copyLinearToSRGB(e){return this.r=Vv(e.r),this.g=Vv(e.g),this.b=Vv(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=Fr){return ln.workingToColorSpace(oa.copy(this),e),Math.round(Nn(oa.r*255,0,255))*65536+Math.round(Nn(oa.g*255,0,255))*256+Math.round(Nn(oa.b*255,0,255))}getHexString(e=Fr){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=ln.workingColorSpace){ln.workingToColorSpace(oa.copy(this),t);let n=oa.r,r=oa.g,s=oa.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=ln.workingColorSpace){return ln.workingToColorSpace(oa.copy(this),t),e.r=oa.r,e.g=oa.g,e.b=oa.b,e}getStyle(e=Fr){ln.workingToColorSpace(oa.copy(this),e);let t=oa.r,n=oa.g,r=oa.b;return e!==Fr?`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(qp),this.setHSL(qp.h+e,qp.s+t,qp.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(qp),e.getHSL(x3);let n=w2(qp.h,x3.h,t),r=w2(qp.s,x3.s,t),s=w2(qp.l,x3.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}},oa=new zt;zt.NAMES=rZ;var t0=class extends lr{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 Oa,this.environmentIntensity=1,this.environmentRotation=new Oa,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}},Ru=new re,md=new re,X6=new re,Ad=new re,Ev=new re,Mv=new re,yY=new re,$6=new re,Y6=new re,Z6=new re,K6=new xn,Q6=new xn,J6=new xn,xd=class i{constructor(e=new re,t=new re,n=new re){this.a=e,this.b=t,this.c=n}static getNormal(e,t,n,r){r.subVectors(n,t),Ru.subVectors(e,t),r.cross(Ru);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){Ru.subVectors(r,t),md.subVectors(n,t),X6.subVectors(e,t);let o=Ru.dot(Ru),a=Ru.dot(md),l=Ru.dot(X6),c=md.dot(md),u=md.dot(X6),f=o*c-a*a;if(f===0)return s.set(0,0,0),null;let d=1/f,A=(c*l-a*u)*d,y=(o*u-a*l)*d;return s.set(1-A-y,y,A)}static containsPoint(e,t,n,r){return this.getBarycoord(e,t,n,r,Ad)===null?!1:Ad.x>=0&&Ad.y>=0&&Ad.x+Ad.y<=1}static getInterpolation(e,t,n,r,s,o,a,l){return this.getBarycoord(e,t,n,r,Ad)===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,Ad.x),l.addScaledVector(o,Ad.y),l.addScaledVector(a,Ad.z),l)}static getInterpolatedAttribute(e,t,n,r,s,o){return K6.setScalar(0),Q6.setScalar(0),J6.setScalar(0),K6.fromBufferAttribute(e,t),Q6.fromBufferAttribute(e,n),J6.fromBufferAttribute(e,r),o.setScalar(0),o.addScaledVector(K6,s.x),o.addScaledVector(Q6,s.y),o.addScaledVector(J6,s.z),o}static isFrontFacing(e,t,n,r){return Ru.subVectors(n,t),md.subVectors(e,t),Ru.cross(md).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 Ru.subVectors(this.c,this.b),md.subVectors(this.a,this.b),Ru.cross(md).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;Ev.subVectors(r,n),Mv.subVectors(s,n),$6.subVectors(e,n);let l=Ev.dot($6),c=Mv.dot($6);if(l<=0&&c<=0)return t.copy(n);Y6.subVectors(e,r);let u=Ev.dot(Y6),f=Mv.dot(Y6);if(u>=0&&f<=u)return t.copy(r);let d=l*f-u*c;if(d<=0&&l>=0&&u<=0)return o=l/(l-u),t.copy(n).addScaledVector(Ev,o);Z6.subVectors(e,s);let A=Ev.dot(Z6),y=Mv.dot(Z6);if(y>=0&&A<=y)return t.copy(s);let w=A*c-l*y;if(w<=0&&c>=0&&y<=0)return a=c/(c-y),t.copy(n).addScaledVector(Mv,a);let S=u*y-A*f;if(S<=0&&f-u>=0&&A-y>=0)return yY.subVectors(s,r),a=(f-u)/(f-u+(A-y)),t.copy(r).addScaledVector(yY,a);let T=1/(S+w+d);return o=w*T,a=d*T,t.copy(n).addScaledVector(Ev,o).addScaledVector(Mv,a)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}},Ua=class{constructor(e=new re(1/0,1/0,1/0),t=new re(-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(Iu.fromArray(e,t));return this}setFromBufferAttribute(e){this.makeEmpty();for(let t=0,n=e.count;t<n;t++)this.expandByPoint(Iu.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=Iu.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,Iu):Iu.fromBufferAttribute(s,o),Iu.applyMatrix4(e.matrixWorld),this.expandByPoint(Iu);else e.boundingBox!==void 0?(e.boundingBox===null&&e.computeBoundingBox(),y3.copy(e.boundingBox)):(n.boundingBox===null&&n.computeBoundingBox(),y3.copy(n.boundingBox)),y3.applyMatrix4(e.matrixWorld),this.union(y3)}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,Iu),Iu.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(p2),b3.subVectors(this.max,p2),Cv.subVectors(e.a,p2),Rv.subVectors(e.b,p2),Iv.subVectors(e.c,p2),Hp.subVectors(Rv,Cv),Wp.subVectors(Iv,Rv),wA.subVectors(Cv,Iv);let t=[0,-Hp.z,Hp.y,0,-Wp.z,Wp.y,0,-wA.z,wA.y,Hp.z,0,-Hp.x,Wp.z,0,-Wp.x,wA.z,0,-wA.x,-Hp.y,Hp.x,0,-Wp.y,Wp.x,0,-wA.y,wA.x,0];return!e8(t,Cv,Rv,Iv,b3)||(t=[1,0,0,0,1,0,0,0,1],!e8(t,Cv,Rv,Iv,b3))?!1:(w3.crossVectors(Hp,Wp),t=[w3.x,w3.y,w3.z],e8(t,Cv,Rv,Iv,b3))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,Iu).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=this.getSize(Iu).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:(gd[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),gd[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),gd[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),gd[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),gd[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),gd[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),gd[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),gd[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(gd),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}},gd=[new re,new re,new re,new re,new re,new re,new re,new re],Iu=new re,y3=new Ua,Cv=new re,Rv=new re,Iv=new re,Hp=new re,Wp=new re,wA=new re,p2=new re,b3=new re,w3=new re,SA=new re;function e8(i,e,t,n,r){for(let s=0,o=i.length-3;s<=o;s+=3){SA.fromArray(i,s);let a=r.x*Math.abs(SA.x)+r.y*Math.abs(SA.y)+r.z*Math.abs(SA.z),l=e.dot(SA),c=t.dot(SA),u=n.dot(SA);if(Math.max(-Math.max(l,c,u),Math.min(l,c,u))>a)return!1}return!0}var yd=Pme();function Pme(){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 Xl(i){Math.abs(i)>65504&&Xe("DataUtils.toHalfFloat(): Value out of range."),i=Nn(i,-65504,65504),yd.floatView[0]=i;let e=yd.uint32View[0],t=e>>23&511;return yd.baseTable[t]+((e&8388607)>>yd.shiftTable[t])}function S3(i){let e=i>>10;return yd.uint32View[0]=yd.mantissaTable[yd.offsetTable[e]+(i&1023)]+yd.exponentTable[e],yd.floatView[0]}var Vs=new re,T3=new Oe,Lme=0,Hi=class extends la{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:Lme++}),this.name="",this.array=e,this.itemSize=t,this.count=e!==void 0?e.length/t:0,this.normalized=n,this.usage=Jp,this.updateRanges=[],this.gpuType=cr,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++)T3.fromBufferAttribute(this,t),T3.applyMatrix3(e),this.setXY(t,T3.x,T3.y);else if(this.itemSize===3)for(let t=0,n=this.count;t<n;t++)Vs.fromBufferAttribute(this,t),Vs.applyMatrix3(e),this.setXYZ(t,Vs.x,Vs.y,Vs.z);return this}applyMatrix4(e){for(let t=0,n=this.count;t<n;t++)Vs.fromBufferAttribute(this,t),Vs.applyMatrix4(e),this.setXYZ(t,Vs.x,Vs.y,Vs.z);return this}applyNormalMatrix(e){for(let t=0,n=this.count;t<n;t++)Vs.fromBufferAttribute(this,t),Vs.applyNormalMatrix(e),this.setXYZ(t,Vs.x,Vs.y,Vs.z);return this}transformDirection(e){for(let t=0,n=this.count;t<n;t++)Vs.fromBufferAttribute(this,t),Vs.transformDirection(e),this.setXYZ(t,Vs.x,Vs.y,Vs.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=Na(n,this.array)),n}setComponent(e,t,n){return this.normalized&&(n=Zn(n,this.array)),this.array[e*this.itemSize+t]=n,this}getX(e){let t=this.array[e*this.itemSize];return this.normalized&&(t=Na(t,this.array)),t}setX(e,t){return this.normalized&&(t=Zn(t,this.array)),this.array[e*this.itemSize]=t,this}getY(e){let t=this.array[e*this.itemSize+1];return this.normalized&&(t=Na(t,this.array)),t}setY(e,t){return this.normalized&&(t=Zn(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=Na(t,this.array)),t}setZ(e,t){return this.normalized&&(t=Zn(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=Na(t,this.array)),t}setW(e,t){return this.normalized&&(t=Zn(t,this.array)),this.array[e*this.itemSize+3]=t,this}setXY(e,t,n){return e*=this.itemSize,this.normalized&&(t=Zn(t,this.array),n=Zn(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=Zn(t,this.array),n=Zn(n,this.array),r=Zn(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=Zn(t,this.array),n=Zn(n,this.array),r=Zn(r,this.array),s=Zn(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!==Jp&&(e.usage=this.usage),e}dispose(){this.dispatchEvent({type:"dispose"})}};var BA=class extends Hi{constructor(e,t,n){super(new Uint16Array(e),t,n)}};var OA=class extends Hi{constructor(e,t,n){super(new Uint32Array(e),t,n)}},jv=class extends Hi{constructor(e,t,n){super(new Uint16Array(e),t,n),this.isFloat16BufferAttribute=!0}getX(e){let t=S3(this.array[e*this.itemSize]);return this.normalized&&(t=Na(t,this.array)),t}setX(e,t){return this.normalized&&(t=Zn(t,this.array)),this.array[e*this.itemSize]=Xl(t),this}getY(e){let t=S3(this.array[e*this.itemSize+1]);return this.normalized&&(t=Na(t,this.array)),t}setY(e,t){return this.normalized&&(t=Zn(t,this.array)),this.array[e*this.itemSize+1]=Xl(t),this}getZ(e){let t=S3(this.array[e*this.itemSize+2]);return this.normalized&&(t=Na(t,this.array)),t}setZ(e,t){return this.normalized&&(t=Zn(t,this.array)),this.array[e*this.itemSize+2]=Xl(t),this}getW(e){let t=S3(this.array[e*this.itemSize+3]);return this.normalized&&(t=Na(t,this.array)),t}setW(e,t){return this.normalized&&(t=Zn(t,this.array)),this.array[e*this.itemSize+3]=Xl(t),this}setXY(e,t,n){return e*=this.itemSize,this.normalized&&(t=Zn(t,this.array),n=Zn(n,this.array)),this.array[e+0]=Xl(t),this.array[e+1]=Xl(n),this}setXYZ(e,t,n,r){return e*=this.itemSize,this.normalized&&(t=Zn(t,this.array),n=Zn(n,this.array),r=Zn(r,this.array)),this.array[e+0]=Xl(t),this.array[e+1]=Xl(n),this.array[e+2]=Xl(r),this}setXYZW(e,t,n,r,s){return e*=this.itemSize,this.normalized&&(t=Zn(t,this.array),n=Zn(n,this.array),r=Zn(r,this.array),s=Zn(s,this.array)),this.array[e+0]=Xl(t),this.array[e+1]=Xl(n),this.array[e+2]=Xl(r),this.array[e+3]=Xl(s),this}},Ln=class extends Hi{constructor(e,t,n){super(new Float32Array(e),t,n)}},Dme=new Ua,m2=new re,t8=new re,xl=class{constructor(e=new re,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):Dme.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;m2.subVectors(e,this.center);let t=m2.lengthSq();if(t>this.radius*this.radius){let n=Math.sqrt(t),r=(n-this.radius)*.5;this.center.addScaledVector(m2,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):(t8.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(m2.copy(e.center).add(t8)),this.expandByPoint(m2.copy(e.center).sub(t8))),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}},Nme=0,kc=new cn,n8=new lr,Pv=new re,$l=new Ua,A2=new Ua,_o=new re,Xn=class i extends la{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:Nme++}),this.uuid=Mh(),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(rme(e)?OA:BA)(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 Mn().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 kc.makeRotationFromQuaternion(e),this.applyMatrix4(kc),this}rotateX(e){return kc.makeRotationX(e),this.applyMatrix4(kc),this}rotateY(e){return kc.makeRotationY(e),this.applyMatrix4(kc),this}rotateZ(e){return kc.makeRotationZ(e),this.applyMatrix4(kc),this}translate(e,t,n){return kc.makeTranslation(e,t,n),this.applyMatrix4(kc),this}scale(e,t,n){return kc.makeScale(e,t,n),this.applyMatrix4(kc),this}lookAt(e){return n8.lookAt(e),n8.updateMatrix(),this.applyMatrix4(n8.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(Pv).negate(),this.translate(Pv.x,Pv.y,Pv.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 Ln(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&&Xe("BufferGeometry: Buffer size too small for points data. Use .dispose() and create a new geometry."),t.needsUpdate=!0}return this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new Ua);let e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){ze("BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box.",this),this.boundingBox.set(new re(-1/0,-1/0,-1/0),new re(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];$l.setFromBufferAttribute(s),this.morphTargetsRelative?(_o.addVectors(this.boundingBox.min,$l.min),this.boundingBox.expandByPoint(_o),_o.addVectors(this.boundingBox.max,$l.max),this.boundingBox.expandByPoint(_o)):(this.boundingBox.expandByPoint($l.min),this.boundingBox.expandByPoint($l.max))}}else this.boundingBox.makeEmpty();(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&ze('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 xl);let e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){ze("BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere.",this),this.boundingSphere.set(new re,1/0);return}if(e){let n=this.boundingSphere.center;if($l.setFromBufferAttribute(e),t)for(let s=0,o=t.length;s<o;s++){let a=t[s];A2.setFromBufferAttribute(a),this.morphTargetsRelative?(_o.addVectors($l.min,A2.min),$l.expandByPoint(_o),_o.addVectors($l.max,A2.max),$l.expandByPoint(_o)):($l.expandByPoint(A2.min),$l.expandByPoint(A2.max))}$l.getCenter(n);let r=0;for(let s=0,o=e.count;s<o;s++)_o.fromBufferAttribute(e,s),r=Math.max(r,n.distanceToSquared(_o));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++)_o.fromBufferAttribute(a,c),l&&(Pv.fromBufferAttribute(e,c),_o.add(Pv)),r=Math.max(r,n.distanceToSquared(_o))}this.boundingSphere.radius=Math.sqrt(r),isNaN(this.boundingSphere.radius)&&ze('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){ze("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 Hi(new Float32Array(4*n.count),4),this.setAttribute("tangent",o));let a=[],l=[];for(let C=0;C<n.count;C++)a[C]=new re,l[C]=new re;let c=new re,u=new re,f=new re,d=new Oe,A=new Oe,y=new Oe,w=new re,S=new re;function T(C,B,k){c.fromBufferAttribute(n,C),u.fromBufferAttribute(n,B),f.fromBufferAttribute(n,k),d.fromBufferAttribute(s,C),A.fromBufferAttribute(s,B),y.fromBufferAttribute(s,k),u.sub(c),f.sub(c),A.sub(d),y.sub(d);let z=1/(A.x*y.y-y.x*A.y);isFinite(z)&&(w.copy(u).multiplyScalar(y.y).addScaledVector(f,-A.y).multiplyScalar(z),S.copy(f).multiplyScalar(A.x).addScaledVector(u,-y.x).multiplyScalar(z),a[C].add(w),a[B].add(w),a[k].add(w),l[C].add(S),l[B].add(S),l[k].add(S))}let R=this.groups;R.length===0&&(R=[{start:0,count:e.count}]);for(let C=0,B=R.length;C<B;++C){let k=R[C],z=k.start,G=k.count;for(let W=z,Y=z+G;W<Y;W+=3)T(e.getX(W+0),e.getX(W+1),e.getX(W+2))}let P=new re,I=new re,F=new re,D=new re;function L(C){F.fromBufferAttribute(r,C),D.copy(F);let B=a[C];P.copy(B),P.sub(F.multiplyScalar(F.dot(B))).normalize(),I.crossVectors(D,B);let z=I.dot(l[C])<0?-1:1;o.setXYZW(C,P.x,P.y,P.z,z)}for(let C=0,B=R.length;C<B;++C){let k=R[C],z=k.start,G=k.count;for(let W=z,Y=z+G;W<Y;W+=3)L(e.getX(W+0)),L(e.getX(W+1)),L(e.getX(W+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 Hi(new Float32Array(t.count*3),3),this.setAttribute("normal",n);else for(let d=0,A=n.count;d<A;d++)n.setXYZ(d,0,0,0);let r=new re,s=new re,o=new re,a=new re,l=new re,c=new re,u=new re,f=new re;if(e)for(let d=0,A=e.count;d<A;d+=3){let y=e.getX(d+0),w=e.getX(d+1),S=e.getX(d+2);r.fromBufferAttribute(t,y),s.fromBufferAttribute(t,w),o.fromBufferAttribute(t,S),u.subVectors(o,s),f.subVectors(r,s),u.cross(f),a.fromBufferAttribute(n,y),l.fromBufferAttribute(n,w),c.fromBufferAttribute(n,S),a.add(u),l.add(u),c.add(u),n.setXYZ(y,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 d=0,A=t.count;d<A;d+=3)r.fromBufferAttribute(t,d+0),s.fromBufferAttribute(t,d+1),o.fromBufferAttribute(t,d+2),u.subVectors(o,s),f.subVectors(r,s),u.cross(f),n.setXYZ(d+0,u.x,u.y,u.z),n.setXYZ(d+1,u.x,u.y,u.z),n.setXYZ(d+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++)_o.fromBufferAttribute(e,t),_o.normalize(),e.setXYZ(t,_o.x,_o.y,_o.z)}toNonIndexed(){function e(a,l){let c=a.array,u=a.itemSize,f=a.normalized,d=new c.constructor(l.length*u),A=0,y=0;for(let w=0,S=l.length;w<S;w++){a.isInterleavedBufferAttribute?A=l[w]*a.data.stride+a.offset:A=l[w]*u;for(let T=0;T<u;T++)d[y++]=c[A++]}return new Hi(d,u,f)}if(this.index===null)return Xe("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 d=c[u],A=e(d,n);l.push(A)}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,d=c.length;f<d;f++){let A=c[f];u.push(A.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 d=0,A=f.length;d<A;d++)u.push(f[d].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"})}},Ed=class{constructor(e,t){this.isInterleavedBuffer=!0,this.array=e,this.stride=t,this.count=e!==void 0?e.length/t:0,this.usage=Jp,this.updateRanges=[],this.version=0,this.uuid=Mh()}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=Mh()),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=Mh()),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}}},La=new re,zo=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++)La.fromBufferAttribute(this,t),La.applyMatrix4(e),this.setXYZ(t,La.x,La.y,La.z);return this}applyNormalMatrix(e){for(let t=0,n=this.count;t<n;t++)La.fromBufferAttribute(this,t),La.applyNormalMatrix(e),this.setXYZ(t,La.x,La.y,La.z);return this}transformDirection(e){for(let t=0,n=this.count;t<n;t++)La.fromBufferAttribute(this,t),La.transformDirection(e),this.setXYZ(t,La.x,La.y,La.z);return this}getComponent(e,t){let n=this.array[e*this.data.stride+this.offset+t];return this.normalized&&(n=Na(n,this.array)),n}setComponent(e,t,n){return this.normalized&&(n=Zn(n,this.array)),this.data.array[e*this.data.stride+this.offset+t]=n,this}setX(e,t){return this.normalized&&(t=Zn(t,this.array)),this.data.array[e*this.data.stride+this.offset]=t,this}setY(e,t){return this.normalized&&(t=Zn(t,this.array)),this.data.array[e*this.data.stride+this.offset+1]=t,this}setZ(e,t){return this.normalized&&(t=Zn(t,this.array)),this.data.array[e*this.data.stride+this.offset+2]=t,this}setW(e,t){return this.normalized&&(t=Zn(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=Na(t,this.array)),t}getY(e){let t=this.data.array[e*this.data.stride+this.offset+1];return this.normalized&&(t=Na(t,this.array)),t}getZ(e){let t=this.data.array[e*this.data.stride+this.offset+2];return this.normalized&&(t=Na(t,this.array)),t}getW(e){let t=this.data.array[e*this.data.stride+this.offset+3];return this.normalized&&(t=Na(t,this.array)),t}setXY(e,t,n){return e=e*this.data.stride+this.offset,this.normalized&&(t=Zn(t,this.array),n=Zn(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=Zn(t,this.array),n=Zn(n,this.array),r=Zn(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=Zn(t,this.array),n=Zn(n,this.array),r=Zn(r,this.array),s=Zn(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){NA("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 Hi(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){NA("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}}},Fme=0,Ws=class extends la{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:Fme++}),this.uuid=Mh(),this.name="",this.type="Material",this.blending=Ms,this.side=ko,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.alphaHash=!1,this.blendSrc=Yp,this.blendDst=Zp,this.blendEquation=oo,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.blendColor=new zt(0,0,0),this.blendAlpha=0,this.depthFunc=Ch,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=M2,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=_d,this.stencilZFail=_d,this.stencilZPass=_d,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){Xe(`Material: parameter '${t}' has value of undefined.`);continue}let r=this[t];if(r===void 0){Xe(`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!==Ms&&(n.blending=this.blending),this.side!==ko&&(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!==Yp&&(n.blendSrc=this.blendSrc),this.blendDst!==Zp&&(n.blendDst=this.blendDst),this.blendEquation!==oo&&(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!==Ch&&(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!==M2&&(n.stencilFunc=this.stencilFunc),this.stencilRef!==0&&(n.stencilRef=this.stencilRef),this.stencilFuncMask!==255&&(n.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==_d&&(n.stencilFail=this.stencilFail),this.stencilZFail!==_d&&(n.stencilZFail=this.stencilZFail),this.stencilZPass!==_d&&(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 zt().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++}},Rh=class extends Ws{constructor(e){super(),this.isSpriteMaterial=!0,this.type="SpriteMaterial",this.color=new zt(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}},Lv,g2=new re,Dv=new re,Nv=new re,Fv=new Oe,v2=new Oe,sZ=new cn,E3=new re,_2=new re,M3=new re,bY=new Oe,i8=new Oe,wY=new Oe,UA=class extends lr{constructor(e=new Rh){if(super(),this.isSprite=!0,this.type="Sprite",Lv===void 0){Lv=new Xn;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 Ed(t,5);Lv.setIndex([0,1,2,0,2,3]),Lv.setAttribute("position",new zo(n,3,0,!1)),Lv.setAttribute("uv",new zo(n,2,3,!1))}this.geometry=Lv,this.material=e,this.center=new Oe(.5,.5),this.count=1}raycast(e,t){e.camera===null&&ze('Sprite: "Raycaster.camera" needs to be set in order to raycast against sprites.'),Dv.setFromMatrixScale(this.matrixWorld),sZ.copy(e.camera.matrixWorld),this.modelViewMatrix.multiplyMatrices(e.camera.matrixWorldInverse,this.matrixWorld),Nv.setFromMatrixPosition(this.modelViewMatrix),e.camera.isPerspectiveCamera&&this.material.sizeAttenuation===!1&&Dv.multiplyScalar(-Nv.z);let n=this.material.rotation,r,s;n!==0&&(s=Math.cos(n),r=Math.sin(n));let o=this.center;C3(E3.set(-.5,-.5,0),Nv,o,Dv,r,s),C3(_2.set(.5,-.5,0),Nv,o,Dv,r,s),C3(M3.set(.5,.5,0),Nv,o,Dv,r,s),bY.set(0,0),i8.set(1,0),wY.set(1,1);let a=e.ray.intersectTriangle(E3,_2,M3,!1,g2);if(a===null&&(C3(_2.set(-.5,.5,0),Nv,o,Dv,r,s),i8.set(0,1),a=e.ray.intersectTriangle(E3,M3,_2,!1,g2),a===null))return;let l=e.ray.origin.distanceTo(g2);l<e.near||l>e.far||t.push({distance:l,point:g2.clone(),uv:xd.getInterpolation(g2,E3,_2,M3,bY,i8,wY,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 C3(i,e,t,n,r,s){Fv.subVectors(i,t).addScalar(.5).multiply(n),r!==void 0?(v2.x=s*Fv.x-r*Fv.y,v2.y=r*Fv.x+s*Fv.y):v2.copy(Fv),i.copy(e),i.x+=v2.x,i.y+=v2.y,i.applyMatrix4(sZ)}var vd=new re,r8=new re,R3=new re,jp=new re,s8=new re,I3=new re,o8=new re,Md=class{constructor(e=new re,t=new re(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,vd)),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=vd.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(vd.copy(this.origin).addScaledVector(this.direction,t),vd.distanceToSquared(e))}distanceSqToSegment(e,t,n,r){r8.copy(e).add(t).multiplyScalar(.5),R3.copy(t).sub(e).normalize(),jp.copy(this.origin).sub(r8);let s=e.distanceTo(t)*.5,o=-this.direction.dot(R3),a=jp.dot(this.direction),l=-jp.dot(R3),c=jp.lengthSq(),u=Math.abs(1-o*o),f,d,A,y;if(u>0)if(f=o*l-a,d=o*a-l,y=s*u,f>=0)if(d>=-y)if(d<=y){let w=1/u;f*=w,d*=w,A=f*(f+o*d+2*a)+d*(o*f+d+2*l)+c}else d=s,f=Math.max(0,-(o*d+a)),A=-f*f+d*(d+2*l)+c;else d=-s,f=Math.max(0,-(o*d+a)),A=-f*f+d*(d+2*l)+c;else d<=-y?(f=Math.max(0,-(-o*s+a)),d=f>0?-s:Math.min(Math.max(-s,-l),s),A=-f*f+d*(d+2*l)+c):d<=y?(f=0,d=Math.min(Math.max(-s,-l),s),A=d*(d+2*l)+c):(f=Math.max(0,-(o*s+a)),d=f>0?s:Math.min(Math.max(-s,-l),s),A=-f*f+d*(d+2*l)+c);else d=o>0?-s:s,f=Math.max(0,-(o*d+a)),A=-f*f+d*(d+2*l)+c;return n&&n.copy(this.origin).addScaledVector(this.direction,f),r&&r.copy(r8).addScaledVector(R3,d),A}intersectSphere(e,t){vd.subVectors(e.center,this.origin);let n=vd.dot(this.direction),r=vd.dot(vd)-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,d=this.origin;return c>=0?(n=(e.min.x-d.x)*c,r=(e.max.x-d.x)*c):(n=(e.max.x-d.x)*c,r=(e.min.x-d.x)*c),u>=0?(s=(e.min.y-d.y)*u,o=(e.max.y-d.y)*u):(s=(e.max.y-d.y)*u,o=(e.min.y-d.y)*u),n>o||s>r||((s>n||isNaN(n))&&(n=s),(o<r||isNaN(r))&&(r=o),f>=0?(a=(e.min.z-d.z)*f,l=(e.max.z-d.z)*f):(a=(e.max.z-d.z)*f,l=(e.min.z-d.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,vd)!==null}intersectTriangle(e,t,n,r,s){s8.subVectors(t,e),I3.subVectors(n,e),o8.crossVectors(s8,I3);let o=this.direction.dot(o8),a;if(o>0){if(r)return null;a=1}else if(o<0)a=-1,o=-o;else return null;jp.subVectors(this.origin,e);let l=a*this.direction.dot(I3.crossVectors(jp,I3));if(l<0)return null;let c=a*this.direction.dot(s8.cross(jp));if(c<0||l+c>o)return null;let u=-a*jp.dot(o8);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)}},fs=class extends Ws{constructor(e){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new zt(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 Oa,this.combine=ZA,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}},SY=new cn,TA=new Md,P3=new xl,TY=new re,L3=new re,D3=new re,N3=new re,a8=new re,F3=new re,EY=new re,B3=new re,Hn=class extends lr{constructor(e=new Xn,t=new fs){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){F3.set(0,0,0);for(let l=0,c=s.length;l<c;l++){let u=a[l],f=s[l];u!==0&&(a8.fromBufferAttribute(f,e),o?F3.addScaledVector(a8,u):F3.addScaledVector(a8.sub(t),u))}t.add(F3)}return t}raycast(e,t){let n=this.geometry,r=this.material,s=this.matrixWorld;r!==void 0&&(n.boundingSphere===null&&n.computeBoundingSphere(),P3.copy(n.boundingSphere),P3.applyMatrix4(s),TA.copy(e.ray).recast(e.near),!(P3.containsPoint(TA.origin)===!1&&(TA.intersectSphere(P3,TY)===null||TA.origin.distanceToSquared(TY)>(e.far-e.near)**2))&&(SY.copy(s).invert(),TA.copy(e.ray).applyMatrix4(SY),!(n.boundingBox!==null&&TA.intersectsBox(n.boundingBox)===!1)&&this._computeIntersections(e,t,TA)))}_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,d=s.groups,A=s.drawRange;if(a!==null)if(Array.isArray(o))for(let y=0,w=d.length;y<w;y++){let S=d[y],T=o[S.materialIndex],R=Math.max(S.start,A.start),P=Math.min(a.count,Math.min(S.start+S.count,A.start+A.count));for(let I=R,F=P;I<F;I+=3){let D=a.getX(I),L=a.getX(I+1),C=a.getX(I+2);r=O3(this,T,e,n,c,u,f,D,L,C),r&&(r.faceIndex=Math.floor(I/3),r.face.materialIndex=S.materialIndex,t.push(r))}}else{let y=Math.max(0,A.start),w=Math.min(a.count,A.start+A.count);for(let S=y,T=w;S<T;S+=3){let R=a.getX(S),P=a.getX(S+1),I=a.getX(S+2);r=O3(this,o,e,n,c,u,f,R,P,I),r&&(r.faceIndex=Math.floor(S/3),t.push(r))}}else if(l!==void 0)if(Array.isArray(o))for(let y=0,w=d.length;y<w;y++){let S=d[y],T=o[S.materialIndex],R=Math.max(S.start,A.start),P=Math.min(l.count,Math.min(S.start+S.count,A.start+A.count));for(let I=R,F=P;I<F;I+=3){let D=I,L=I+1,C=I+2;r=O3(this,T,e,n,c,u,f,D,L,C),r&&(r.faceIndex=Math.floor(I/3),r.face.materialIndex=S.materialIndex,t.push(r))}}else{let y=Math.max(0,A.start),w=Math.min(l.count,A.start+A.count);for(let S=y,T=w;S<T;S+=3){let R=S,P=S+1,I=S+2;r=O3(this,o,e,n,c,u,f,R,P,I),r&&(r.faceIndex=Math.floor(S/3),t.push(r))}}}};function Bme(i,e,t,n,r,s,o,a){let l;if(e.side===mi?l=n.intersectTriangle(o,s,r,!0,a):l=n.intersectTriangle(r,s,o,e.side===ko,a),l===null)return null;B3.copy(a),B3.applyMatrix4(i.matrixWorld);let c=t.ray.origin.distanceTo(B3);return c<t.near||c>t.far?null:{distance:c,point:B3.clone(),object:i}}function O3(i,e,t,n,r,s,o,a,l,c){i.getVertexPosition(a,L3),i.getVertexPosition(l,D3),i.getVertexPosition(c,N3);let u=Bme(i,e,t,n,L3,D3,N3,EY);if(u){let f=new re;xd.getBarycoord(EY,L3,D3,N3,f),r&&(u.uv=xd.getInterpolatedAttribute(r,a,l,c,f,new Oe)),s&&(u.uv1=xd.getInterpolatedAttribute(s,a,l,c,f,new Oe)),o&&(u.normal=xd.getInterpolatedAttribute(o,a,l,c,f,new re),u.normal.dot(n.direction)>0&&u.normal.multiplyScalar(-1));let d={a,b:l,c,normal:new re,materialIndex:0};xd.getNormal(L3,D3,N3,d.normal),u.face=d,u.barycoord=f}return u}var kA=class extends Hs{constructor(e=null,t=1,n=1,r,s,o,a,l,c=Ti,u=Ti,f,d){super(null,o,a,l,c,u,r,s,f,d),this.isDataTexture=!0,this.image={data:e,width:t,height:n},this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}};var Yl=class extends Hi{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 l8=new re,Ome=new re,Ume=new Mn,Da=class{constructor(e=new re(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=l8.subVectors(n,t).cross(Ome.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(l8),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||Ume.getNormalMatrix(e),r=this.coplanarPoint(l8).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)}},EA=new xl,kme=new Oe(.5,.5),U3=new re,zc=class{constructor(e=new Da,t=new Da,n=new Da,r=new Da,s=new Da,o=new Da){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=Uo,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],d=s[6],A=s[7],y=s[8],w=s[9],S=s[10],T=s[11],R=s[12],P=s[13],I=s[14],F=s[15];if(r[0].setComponents(c-o,A-u,T-y,F-R).normalize(),r[1].setComponents(c+o,A+u,T+y,F+R).normalize(),r[2].setComponents(c+a,A+f,T+w,F+P).normalize(),r[3].setComponents(c-a,A-f,T-w,F-P).normalize(),n)r[4].setComponents(l,d,S,I).normalize(),r[5].setComponents(c-l,A-d,T-S,F-I).normalize();else if(r[4].setComponents(c-l,A-d,T-S,F-I).normalize(),t===Uo)r[5].setComponents(c+l,A+d,T+S,F+I).normalize();else if(t===_l)r[5].setComponents(l,d,S,I).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(),EA.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);else{let t=e.geometry;t.boundingSphere===null&&t.computeBoundingSphere(),EA.copy(t.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere(EA)}intersectsSprite(e){EA.center.set(0,0,0);let t=kme.distanceTo(e.center);return EA.radius=.7071067811865476+t,EA.applyMatrix4(e.matrixWorld),this.intersectsSphere(EA)}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(U3.x=r.normal.x>0?e.max.x:e.min.x,U3.y=r.normal.y>0?e.max.y:e.min.y,U3.z=r.normal.z>0?e.max.z:e.min.z,r.distanceToPoint(U3)<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)}},MY=new cn,C2=class i{constructor(){this.coordinateSystem=Uo,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];MY.multiplyMatrices(s.projectionMatrix,s.matrixWorldInverse),n[r]===void 0&&(n[r]=new zc),n[r].setFromProjectionMatrix(MY,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 zc),t[r].copy(n[r]);return this._count=e._count,this}clone(){return new i().copy(this)}};var Pu=class extends Ws{constructor(e){super(),this.isLineBasicMaterial=!0,this.type="LineBasicMaterial",this.color=new zt(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}},eM=new re,tM=new re,CY=new cn,x2=new Md,k3=new xl,c8=new re,RY=new re,n0=class extends lr{constructor(e=new Xn,t=new Pu){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++)eM.fromBufferAttribute(t,r-1),tM.fromBufferAttribute(t,r),n[r]=n[r-1],n[r]+=eM.distanceTo(tM);e.setAttribute("lineDistance",new Ln(n,1))}else Xe("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(),k3.copy(n.boundingSphere),k3.applyMatrix4(r),k3.radius+=s,e.ray.intersectsSphere(k3)===!1)return;CY.copy(r).invert(),x2.copy(e.ray).applyMatrix4(CY);let a=s/((this.scale.x+this.scale.y+this.scale.z)/3),l=a*a,c=this.isLineSegments?2:1,u=n.index,d=n.attributes.position;if(u!==null){let A=Math.max(0,o.start),y=Math.min(u.count,o.start+o.count);for(let w=A,S=y-1;w<S;w+=c){let T=u.getX(w),R=u.getX(w+1),P=z3(this,e,x2,l,T,R,w);P&&t.push(P)}if(this.isLineLoop){let w=u.getX(y-1),S=u.getX(A),T=z3(this,e,x2,l,w,S,y-1);T&&t.push(T)}}else{let A=Math.max(0,o.start),y=Math.min(d.count,o.start+o.count);for(let w=A,S=y-1;w<S;w+=c){let T=z3(this,e,x2,l,w,w+1,w);T&&t.push(T)}if(this.isLineLoop){let w=z3(this,e,x2,l,y-1,A,y-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 z3(i,e,t,n,r,s,o){let a=i.geometry.attributes.position;if(eM.fromBufferAttribute(a,r),tM.fromBufferAttribute(a,s),t.distanceSqToSegment(eM,tM,c8,RY)>n)return;c8.applyMatrix4(i.matrixWorld);let c=e.ray.origin.distanceTo(c8);if(!(c<e.near||c>e.far))return{distance:c,point:RY.clone().applyMatrix4(i.matrixWorld),index:o,face:null,faceIndex:null,barycoord:null,object:i}}var IY=new re,PY=new re,Xv=class extends n0{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)IY.fromBufferAttribute(t,r),PY.fromBufferAttribute(t,r+1),n[r]=r===0?0:n[r-1],n[r+1]=n[r]+IY.distanceTo(PY);e.setAttribute("lineDistance",new Ln(n,1))}else Xe("LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}};var i0=class extends Ws{constructor(e){super(),this.isPointsMaterial=!0,this.type="PointsMaterial",this.color=new zt(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}},LY=new cn,_8=new Md,V3=new xl,G3=new re,R2=class extends lr{constructor(e=new Xn,t=new i0){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(),V3.copy(n.boundingSphere),V3.applyMatrix4(r),V3.radius+=s,e.ray.intersectsSphere(V3)===!1)return;LY.copy(r).invert(),_8.copy(e.ray).applyMatrix4(LY);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 d=Math.max(0,o.start),A=Math.min(c.count,o.start+o.count);for(let y=d,w=A;y<w;y++){let S=c.getX(y);G3.fromBufferAttribute(f,S),DY(G3,S,l,r,e,t,this)}}else{let d=Math.max(0,o.start),A=Math.min(f.count,o.start+o.count);for(let y=d,w=A;y<w;y++)G3.fromBufferAttribute(f,y),DY(G3,y,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 DY(i,e,t,n,r,s,o){let a=_8.distanceSqToPoint(i);if(a<t){let l=new re;_8.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 zA=class extends Hs{constructor(e,t){super({width:e,height:t}),this.isFramebufferTexture=!0,this.magFilter=Ti,this.minFilter=Ti,this.generateMipmaps=!1,this.needsUpdate=!0}};var Ih=class extends Hs{constructor(e=[],t=Kl,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 Cs=class extends Hs{constructor(e,t,n=xi,r,s,o,a=Ti,l=Ti,c,u=Gs,f=1){if(u!==Gs&&u!==xo)throw new Error("THREE.DepthTexture: format must be either THREE.DepthFormat or THREE.DepthStencilFormat");let d={width:e,height:t,depth:f};super(d,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 Hv(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}},$v=class extends Cs{constructor(e,t=xi,n=Kl,r,s,o=Ti,a=Ti,l,c=Gs){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}},I2=class extends Hs{constructor(e=null){super(),this.sourceTexture=e,this.isExternalTexture=!0}copy(e){return super.copy(e),this.sourceTexture=e.sourceTexture,this}},Lu=class i extends Xn{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=[],d=0,A=0;y("z","y","x",-1,-1,n,t,e,o,s,0),y("z","y","x",1,-1,n,t,-e,o,s,1),y("x","z","y",1,1,e,n,t,r,o,2),y("x","z","y",1,-1,e,n,-t,r,o,3),y("x","y","z",1,-1,e,t,n,r,s,4),y("x","y","z",-1,-1,e,t,-n,r,s,5),this.setIndex(l),this.setAttribute("position",new Ln(c,3)),this.setAttribute("normal",new Ln(u,3)),this.setAttribute("uv",new Ln(f,2));function y(w,S,T,R,P,I,F,D,L,C,B){let k=I/L,z=F/C,G=I/2,W=F/2,Y=D/2,H=L+1,$=C+1,J=0,te=0,ce=new re;for(let he=0;he<$;he++){let ve=he*z-W;for(let Re=0;Re<H;Re++){let Qe=Re*k-G;ce[w]=Qe*R,ce[S]=ve*P,ce[T]=Y,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(Re/L),f.push(1-he/C),J+=1}}for(let he=0;he<C;he++)for(let ve=0;ve<L;ve++){let Re=d+ve+H*he,Qe=d+ve+H*(he+1),Fe=d+(ve+1)+H*(he+1),mt=d+(ve+1)+H*he;l.push(Re,Qe,mt),l.push(Qe,Fe,mt),te+=6}a.addGroup(A,te,B),A+=te,d+=J}}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 Yv=class i extends Xn{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 re,u=new Oe;o.push(0,0,0),a.push(0,0,1),l.push(.5,.5);for(let f=0,d=3;f<=t;f++,d+=3){let A=n+f/t*r;c.x=e*Math.cos(A),c.y=e*Math.sin(A),o.push(c.x,c.y,c.z),a.push(0,0,1),u.x=(o[d]/e+1)/2,u.y=(o[d+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 Ln(o,3)),this.setAttribute("normal",new Ln(a,3)),this.setAttribute("uv",new Ln(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)}},VA=class i extends Xn{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=[],d=[],A=[],y=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 Ln(f,3)),this.setAttribute("normal",new Ln(d,3)),this.setAttribute("uv",new Ln(A,2));function R(){let I=new re,F=new re,D=0,L=(t-e)/n;for(let C=0;C<=s;C++){let B=[],k=C/s,z=k*(t-e)+e;for(let G=0;G<=r;G++){let W=G/r,Y=W*l+a,H=Math.sin(Y),$=Math.cos(Y);F.x=z*H,F.y=-k*n+S,F.z=z*$,f.push(F.x,F.y,F.z),I.set(H,L,$).normalize(),d.push(I.x,I.y,I.z),A.push(W,1-k),B.push(y++)}w.push(B)}for(let C=0;C<r;C++)for(let B=0;B<s;B++){let k=w[B][C],z=w[B+1][C],G=w[B+1][C+1],W=w[B][C+1];(e>0||B!==0)&&(u.push(k,z,W),D+=3),(t>0||B!==s-1)&&(u.push(z,G,W),D+=3)}c.addGroup(T,D,0),T+=D}function P(I){let F=y,D=new Oe,L=new re,C=0,B=I===!0?e:t,k=I===!0?1:-1;for(let G=1;G<=r;G++)f.push(0,S*k,0),d.push(0,k,0),A.push(.5,.5),y++;let z=y;for(let G=0;G<=r;G++){let Y=G/r*l+a,H=Math.cos(Y),$=Math.sin(Y);L.x=B*$,L.y=S*k,L.z=B*H,f.push(L.x,L.y,L.z),d.push(0,k,0),D.x=H*.5+.5,D.y=$*.5*k+.5,A.push(D.x,D.y),y++}for(let G=0;G<r;G++){let W=F+G,Y=z+G;I===!0?u.push(Y,Y+1,W):u.push(Y+1,Y,W),C+=3}c.addGroup(T,C,I===!0?1:2),T+=C}}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 ka=class{constructor(){this.type="Curve",this.arcLengthDivisions=200,this.needsUpdate=!1,this.cacheArcLengths=null}getPoint(){Xe("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],d=n[r+1]-u,A=(o-u)/d;return(r+A)/(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 re);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 re,r=[],s=[],o=[],a=new re,l=new cn;for(let A=0;A<=e;A++){let y=A/e;r[A]=this.getTangentAt(y,new re)}s[0]=new re,o[0]=new re;let c=Number.MAX_VALUE,u=Math.abs(r[0].x),f=Math.abs(r[0].y),d=Math.abs(r[0].z);u<=c&&(c=u,n.set(1,0,0)),f<=c&&(c=f,n.set(0,1,0)),d<=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 A=1;A<=e;A++){if(s[A]=s[A-1].clone(),o[A]=o[A-1].clone(),a.crossVectors(r[A-1],r[A]),a.length()>Number.EPSILON){a.normalize();let y=Math.acos(Nn(r[A-1].dot(r[A]),-1,1));s[A].applyMatrix4(l.makeRotationAxis(a,y))}o[A].crossVectors(r[A],s[A])}if(t===!0){let A=Math.acos(Nn(s[0].dot(s[e]),-1,1));A/=e,r[0].dot(a.crossVectors(s[0],s[e]))>0&&(A=-A);for(let y=1;y<=e;y++)s[y].applyMatrix4(l.makeRotationAxis(r[y],A*y)),o[y].crossVectors(r[y],s[y])}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}},Zv=class extends ka{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),d=l-this.aX,A=c-this.aY;l=d*u-A*f+this.aX,c=d*f+A*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}},nM=class extends Zv{constructor(e,t,n,r,s,o){super(e,t,n,n,r,s,o),this.isArcCurve=!0,this.type="ArcCurve"}};function K8(){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 d=(o-s)/c-(a-s)/(c+u)+(a-o)/u,A=(a-o)/u-(l-o)/(u+f)+(l-a)/f;d*=u,A*=u,r(o,a,d,A)},calc:function(s){let o=s*s,a=o*s;return i+e*s+t*o+n*a}}}var NY=new re,FY=new re,u8=new K8,h8=new K8,f8=new K8,iM=class extends ka{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 re){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]:(FY.subVectors(r[0],r[1]).add(r[0]),c=FY);let f=r[a%s],d=r[(a+1)%s];if(this.closed||a+2<s?u=r[(a+2)%s]:(NY.subVectors(r[s-1],r[s-2]).add(r[s-1]),u=NY),this.curveType==="centripetal"||this.curveType==="chordal"){let A=this.curveType==="chordal"?.5:.25,y=Math.pow(c.distanceToSquared(f),A),w=Math.pow(f.distanceToSquared(d),A),S=Math.pow(d.distanceToSquared(u),A);w<1e-4&&(w=1),y<1e-4&&(y=w),S<1e-4&&(S=w),u8.initNonuniformCatmullRom(c.x,f.x,d.x,u.x,y,w,S),h8.initNonuniformCatmullRom(c.y,f.y,d.y,u.y,y,w,S),f8.initNonuniformCatmullRom(c.z,f.z,d.z,u.z,y,w,S)}else this.curveType==="catmullrom"&&(u8.initCatmullRom(c.x,f.x,d.x,u.x,this.tension),h8.initCatmullRom(c.y,f.y,d.y,u.y,this.tension),f8.initCatmullRom(c.z,f.z,d.z,u.z,this.tension));return n.set(u8.calc(l),h8.calc(l),f8.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 re().fromArray(r))}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this}};function BY(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 zme(i,e){let t=1-i;return t*t*e}function Vme(i,e){return 2*(1-i)*i*e}function Gme(i,e){return i*i*e}function S2(i,e,t,n){return zme(i,e)+Vme(i,t)+Gme(i,n)}function qme(i,e){let t=1-i;return t*t*t*e}function Hme(i,e){let t=1-i;return 3*t*t*i*e}function Wme(i,e){return 3*(1-i)*i*i*e}function jme(i,e){return i*i*i*e}function T2(i,e,t,n,r){return qme(i,e)+Hme(i,t)+Wme(i,n)+jme(i,r)}var P2=class extends ka{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(T2(e,r.x,s.x,o.x,a.x),T2(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}},Kv=class extends ka{constructor(e=new re,t=new re,n=new re,r=new re){super(),this.isCubicBezierCurve3=!0,this.type="CubicBezierCurve3",this.v0=e,this.v1=t,this.v2=n,this.v3=r}getPoint(e,t=new re){let n=t,r=this.v0,s=this.v1,o=this.v2,a=this.v3;return n.set(T2(e,r.x,s.x,o.x,a.x),T2(e,r.y,s.y,o.y,a.y),T2(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}},L2=class extends ka{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}},rM=class extends ka{constructor(e=new re,t=new re){super(),this.isLineCurve3=!0,this.type="LineCurve3",this.v1=e,this.v2=t}getPoint(e,t=new re){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 re){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}},D2=class extends ka{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(S2(e,r.x,s.x,o.x),S2(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}},N2=class extends ka{constructor(e=new re,t=new re,n=new re){super(),this.isQuadraticBezierCurve3=!0,this.type="QuadraticBezierCurve3",this.v0=e,this.v1=t,this.v2=n}getPoint(e,t=new re){let n=t,r=this.v0,s=this.v1,o=this.v2;return n.set(S2(e,r.x,s.x,o.x),S2(e,r.y,s.y,o.y),S2(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}},F2=class extends ka{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(BY(a,l.x,c.x,u.x,f.x),BY(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}},sM=Object.freeze({__proto__:null,ArcCurve:nM,CatmullRomCurve3:iM,CubicBezierCurve:P2,CubicBezierCurve3:Kv,EllipseCurve:Zv,LineCurve:L2,LineCurve3:rM,QuadraticBezierCurve:D2,QuadraticBezierCurve3:N2,SplineCurve:F2}),oM=class extends ka{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 sM[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 sM[r.type]().fromJSON(r))}return this}},GA=class extends oM{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 L2(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 D2(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 P2(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 F2(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 Zv(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}},B2=class extends GA{constructor(e){super(e),this.uuid=Mh(),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 GA().fromJSON(r))}return this}};function Xme(i,e,t=2){let n=e&&e.length,r=n?e[0]*t:i.length,s=oZ(i,0,r,t,!0),o=[];if(!s||s.next===s.prev)return o;let a,l,c;if(n&&(s=Qme(i,e,s,t)),i.length>80*t){a=i[0],l=i[1];let u=a,f=l;for(let d=t;d<r;d+=t){let A=i[d],y=i[d+1];A<a&&(a=A),y<l&&(l=y),A>u&&(u=A),y>f&&(f=y)}c=Math.max(u-a,f-l),c=c!==0?32767/c:0}return O2(s,o,t,a,l,c,0),o}function oZ(i,e,t,n,r){let s;if(r===cAe(i,e,t,n)>0)for(let o=e;o<t;o+=n)s=OY(o/n|0,i[o],i[o+1],s);else for(let o=t-n;o>=e;o-=n)s=OY(o/n|0,i[o],i[o+1],s);return s&&Qv(s,s.next)&&(k2(s),s=s.next),s}function qA(i,e){if(!i)return i;e||(e=i);let t=i,n;do if(n=!1,!t.steiner&&(Qv(t,t.next)||Yr(t.prev,t,t.next)===0)){if(k2(t),t=e=t.prev,t===t.next)break;n=!0}else t=t.next;while(n||t!==e);return e}function O2(i,e,t,n,r,s,o){if(!i)return;!o&&s&&iAe(i,n,r,s);let a=i;for(;i.prev!==i.next;){let l=i.prev,c=i.next;if(s?Yme(i,n,r,s):$me(i)){e.push(l.i,i.i,c.i),k2(i),i=c.next,a=c.next;continue}if(i=c,i===a){o?o===1?(i=Zme(qA(i),e),O2(i,e,t,n,r,s,2)):o===2&&Kme(i,e,t,n,r,s):O2(qA(i),e,t,n,r,s,1);break}}}function $me(i){let e=i.prev,t=i,n=i.next;if(Yr(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),d=Math.max(r,s,o),A=Math.max(a,l,c),y=n.next;for(;y!==e;){if(y.x>=u&&y.x<=d&&y.y>=f&&y.y<=A&&y2(r,a,s,l,o,c,y.x,y.y)&&Yr(y.prev,y,y.next)>=0)return!1;y=y.next}return!0}function Yme(i,e,t,n){let r=i.prev,s=i,o=i.next;if(Yr(r,s,o)>=0)return!1;let a=r.x,l=s.x,c=o.x,u=r.y,f=s.y,d=o.y,A=Math.min(a,l,c),y=Math.min(u,f,d),w=Math.max(a,l,c),S=Math.max(u,f,d),T=x8(A,y,e,t,n),R=x8(w,S,e,t,n),P=i.prevZ,I=i.nextZ;for(;P&&P.z>=T&&I&&I.z<=R;){if(P.x>=A&&P.x<=w&&P.y>=y&&P.y<=S&&P!==r&&P!==o&&y2(a,u,l,f,c,d,P.x,P.y)&&Yr(P.prev,P,P.next)>=0||(P=P.prevZ,I.x>=A&&I.x<=w&&I.y>=y&&I.y<=S&&I!==r&&I!==o&&y2(a,u,l,f,c,d,I.x,I.y)&&Yr(I.prev,I,I.next)>=0))return!1;I=I.nextZ}for(;P&&P.z>=T;){if(P.x>=A&&P.x<=w&&P.y>=y&&P.y<=S&&P!==r&&P!==o&&y2(a,u,l,f,c,d,P.x,P.y)&&Yr(P.prev,P,P.next)>=0)return!1;P=P.prevZ}for(;I&&I.z<=R;){if(I.x>=A&&I.x<=w&&I.y>=y&&I.y<=S&&I!==r&&I!==o&&y2(a,u,l,f,c,d,I.x,I.y)&&Yr(I.prev,I,I.next)>=0)return!1;I=I.nextZ}return!0}function Zme(i,e){let t=i;do{let n=t.prev,r=t.next.next;!Qv(n,r)&&lZ(n,t,t.next,r)&&U2(n,r)&&U2(r,n)&&(e.push(n.i,t.i,r.i),k2(t),k2(t.next),t=i=r),t=t.next}while(t!==i);return qA(t)}function Kme(i,e,t,n,r,s){let o=i;do{let a=o.next.next;for(;a!==o.prev;){if(o.i!==a.i&&oAe(o,a)){let l=cZ(o,a);o=qA(o,o.next),l=qA(l,l.next),O2(o,e,t,n,r,s,0),O2(l,e,t,n,r,s,0);return}a=a.next}o=o.next}while(o!==i)}function Qme(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=oZ(i,a,l,n,!1);c===c.next&&(c.steiner=!0),r.push(sAe(c))}r.sort(Jme);for(let s=0;s<r.length;s++)t=eAe(r[s],t);return t}function Jme(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 eAe(i,e){let t=tAe(i,e);if(!t)return e;let n=cZ(t,i);return qA(n,n.next),qA(t,t.next)}function tAe(i,e){let t=e,n=i.x,r=i.y,s=-1/0,o;if(Qv(i,t))return t;do{if(Qv(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&&aZ(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);U2(t,i)&&(f<u||f===u&&(t.x>o.x||t.x===o.x&&nAe(o,t)))&&(o=t,u=f)}t=t.next}while(t!==a);return o}function nAe(i,e){return Yr(i.prev,i,e.prev)<0&&Yr(e.next,i,i.next)<0}function iAe(i,e,t,n){let r=i;do r.z===0&&(r.z=x8(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,rAe(r)}function rAe(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 x8(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 sAe(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 aZ(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 y2(i,e,t,n,r,s,o,a){return!(i===o&&e===a)&&aZ(i,e,t,n,r,s,o,a)}function oAe(i,e){return i.next.i!==e.i&&i.prev.i!==e.i&&!aAe(i,e)&&(U2(i,e)&&U2(e,i)&&lAe(i,e)&&(Yr(i.prev,i,e.prev)||Yr(i,e.prev,e))||Qv(i,e)&&Yr(i.prev,i,i.next)>0&&Yr(e.prev,e,e.next)>0)}function Yr(i,e,t){return(e.y-i.y)*(t.x-e.x)-(e.x-i.x)*(t.y-e.y)}function Qv(i,e){return i.x===e.x&&i.y===e.y}function lZ(i,e,t,n){let r=H3(Yr(i,e,t)),s=H3(Yr(i,e,n)),o=H3(Yr(t,n,i)),a=H3(Yr(t,n,e));return!!(r!==s&&o!==a||r===0&&q3(i,t,e)||s===0&&q3(i,n,e)||o===0&&q3(t,i,n)||a===0&&q3(t,e,n))}function q3(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 H3(i){return i>0?1:i<0?-1:0}function aAe(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&&lZ(t,t.next,i,e))return!0;t=t.next}while(t!==i);return!1}function U2(i,e){return Yr(i.prev,i,i.next)<0?Yr(i,e,i.next)>=0&&Yr(i,i.prev,e)>=0:Yr(i,e,i.prev)<0||Yr(i,i.next,e)<0}function lAe(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 cZ(i,e){let t=y8(i.i,i.x,i.y),n=y8(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 OY(i,e,t,n){let r=y8(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 k2(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 y8(i,e,t){return{i,x:e,y:t,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}function cAe(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 b8=class{static triangulate(e,t,n=2){return Xme(e,t,n)}},$p=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=[];UY(e),kY(n,e);let o=e.length;t.forEach(UY);for(let l=0;l<t.length;l++)r.push(o),o+=t[l].length,kY(n,t[l]);let a=b8.triangulate(n,r);for(let l=0;l<a.length;l+=3)s.push(a.slice(l,l+3));return s}};function UY(i){let e=i.length;e>2&&i[e-1].equals(i[0])&&i.pop()}function kY(i,e){for(let t=0;t<e.length;t++)i.push(e[t].x),i.push(e[t].y)}var z2=class i extends Xn{constructor(e=new B2([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 Ln(r,3)),this.setAttribute("uv",new Ln(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,d=t.bevelEnabled!==void 0?t.bevelEnabled:!0,A=t.bevelThickness!==void 0?t.bevelThickness:.2,y=t.bevelSize!==void 0?t.bevelSize:A-.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:uAe,P,I=!1,F,D,L,C;if(T){P=T.getSpacedPoints(u),I=!0,d=!1;let $e=T.isCatmullRomCurve3?T.closed:!1;F=T.computeFrenetFrames(u,$e),D=new re,L=new re,C=new re}d||(S=0,A=0,y=0,w=0);let B=a.extractPoints(c),k=B.shape,z=B.holes;if(!$p.isClockWise(k)){k=k.reverse();for(let $e=0,ot=z.length;$e<ot;$e++){let nt=z[$e];$p.isClockWise(nt)&&(z[$e]=nt.reverse())}}function W($e){let nt=10000000000000001e-36,bt=$e[0];for(let yt=1;yt<=$e.length;yt++){let hn=yt%$e.length,tn=$e[hn],nn=tn.x-bt.x,bn=tn.y-bt.y,_e=nn*nn+bn*bn,vi=Math.max(Math.abs(tn.x),Math.abs(tn.y),Math.abs(bt.x),Math.abs(bt.y)),zn=nt*vi*vi;if(_e<=zn){$e.splice(hn,1),yt--;continue}bt=tn}}W(k),z.forEach(W);let Y=z.length,H=k;for(let $e=0;$e<Y;$e++){let ot=z[$e];k=k.concat(ot)}function $($e,ot,nt){return ot||ze("ExtrudeGeometry: vec does not exist"),$e.clone().addScaledVector(ot,nt)}let J=k.length;function te($e,ot,nt){let bt,yt,hn,tn=$e.x-ot.x,nn=$e.y-ot.y,bn=nt.x-$e.x,_e=nt.y-$e.y,vi=tn*tn+nn*nn,zn=tn*_e-nn*bn;if(Math.abs(zn)>Number.EPSILON){let le=Math.sqrt(vi),Z=Math.sqrt(bn*bn+_e*_e),Te=ot.x-nn/le,Pe=ot.y+tn/le,Ge=nt.x-_e/Z,vt=nt.y+bn/Z,Tt=((Ge-Te)*_e-(vt-Pe)*bn)/(tn*_e-nn*bn);bt=Te+tn*Tt-$e.x,yt=Pe+nn*Tt-$e.y;let qe=bt*bt+yt*yt;if(qe<=2)return new Oe(bt,yt);hn=Math.sqrt(qe/2)}else{let le=!1;tn>Number.EPSILON?bn>Number.EPSILON&&(le=!0):tn<-Number.EPSILON?bn<-Number.EPSILON&&(le=!0):Math.sign(nn)===Math.sign(_e)&&(le=!0),le?(bt=-nn,yt=tn,hn=Math.sqrt(vi)):(bt=tn,yt=nn,hn=Math.sqrt(vi/2))}return new Oe(bt/hn,yt/hn)}let ce=[];for(let $e=0,ot=H.length,nt=ot-1,bt=$e+1;$e<ot;$e++,nt++,bt++)nt===ot&&(nt=0),bt===ot&&(bt=0),ce[$e]=te(H[$e],H[nt],H[bt]);let he=[],ve,Re=ce.concat();for(let $e=0,ot=Y;$e<ot;$e++){let nt=z[$e];ve=[];for(let bt=0,yt=nt.length,hn=yt-1,tn=bt+1;bt<yt;bt++,hn++,tn++)hn===yt&&(hn=0),tn===yt&&(tn=0),ve[bt]=te(nt[bt],nt[hn],nt[tn]);he.push(ve),Re=Re.concat(ve)}let Qe;if(S===0)Qe=$p.triangulateShape(H,z);else{let $e=[],ot=[];for(let nt=0;nt<S;nt++){let bt=nt/S,yt=A*Math.cos(bt*Math.PI/2),hn=y*Math.sin(bt*Math.PI/2)+w;for(let tn=0,nn=H.length;tn<nn;tn++){let bn=$(H[tn],ce[tn],hn);Mt(bn.x,bn.y,-yt),bt===0&&$e.push(bn)}for(let tn=0,nn=Y;tn<nn;tn++){let bn=z[tn];ve=he[tn];let _e=[];for(let vi=0,zn=bn.length;vi<zn;vi++){let le=$(bn[vi],ve[vi],hn);Mt(le.x,le.y,-yt),bt===0&&_e.push(le)}bt===0&&ot.push(_e)}}Qe=$p.triangulateShape($e,ot)}let Fe=Qe.length,mt=y+w;for(let $e=0;$e<J;$e++){let ot=d?$(k[$e],Re[$e],mt):k[$e];I?(L.copy(F.normals[0]).multiplyScalar(ot.x),D.copy(F.binormals[0]).multiplyScalar(ot.y),C.copy(P[0]).add(L).add(D),Mt(C.x,C.y,C.z)):Mt(ot.x,ot.y,0)}for(let $e=1;$e<=u;$e++)for(let ot=0;ot<J;ot++){let nt=d?$(k[ot],Re[ot],mt):k[ot];I?(L.copy(F.normals[$e]).multiplyScalar(nt.x),D.copy(F.binormals[$e]).multiplyScalar(nt.y),C.copy(P[$e]).add(L).add(D),Mt(C.x,C.y,C.z)):Mt(nt.x,nt.y,f/u*$e)}for(let $e=S-1;$e>=0;$e--){let ot=$e/S,nt=A*Math.cos(ot*Math.PI/2),bt=y*Math.sin(ot*Math.PI/2)+w;for(let yt=0,hn=H.length;yt<hn;yt++){let tn=$(H[yt],ce[yt],bt);Mt(tn.x,tn.y,f+nt)}for(let yt=0,hn=z.length;yt<hn;yt++){let tn=z[yt];ve=he[yt];for(let nn=0,bn=tn.length;nn<bn;nn++){let _e=$(tn[nn],ve[nn],bt);I?Mt(_e.x,_e.y+P[u-1].y,P[u-1].x+nt):Mt(_e.x,_e.y,f+nt)}}}Ee(),Ve();function Ee(){let $e=r.length/3;if(d){let ot=0,nt=J*ot;for(let bt=0;bt<Fe;bt++){let yt=Qe[bt];Et(yt[2]+nt,yt[1]+nt,yt[0]+nt)}ot=u+S*2,nt=J*ot;for(let bt=0;bt<Fe;bt++){let yt=Qe[bt];Et(yt[0]+nt,yt[1]+nt,yt[2]+nt)}}else{for(let ot=0;ot<Fe;ot++){let nt=Qe[ot];Et(nt[2],nt[1],nt[0])}for(let ot=0;ot<Fe;ot++){let nt=Qe[ot];Et(nt[0]+J*u,nt[1]+J*u,nt[2]+J*u)}}n.addGroup($e,r.length/3-$e,0)}function Ve(){let $e=r.length/3,ot=0;Ye(H,ot),ot+=H.length;for(let nt=0,bt=z.length;nt<bt;nt++){let yt=z[nt];Ye(yt,ot),ot+=yt.length}n.addGroup($e,r.length/3-$e,1)}function Ye($e,ot){let nt=$e.length;for(;--nt>=0;){let bt=nt,yt=nt-1;yt<0&&(yt=$e.length-1);for(let hn=0,tn=u+S*2;hn<tn;hn++){let nn=J*hn,bn=J*(hn+1),_e=ot+bt+nn,vi=ot+yt+nn,zn=ot+yt+bn,le=ot+bt+bn;It(_e,vi,zn,le)}}}function Mt($e,ot,nt){l.push($e),l.push(ot),l.push(nt)}function Et($e,ot,nt){dn($e),dn(ot),dn(nt);let bt=r.length/3,yt=R.generateTopUV(n,r,bt-3,bt-2,bt-1);Gt(yt[0]),Gt(yt[1]),Gt(yt[2])}function It($e,ot,nt,bt){dn($e),dn(ot),dn(bt),dn(ot),dn(nt),dn(bt);let yt=r.length/3,hn=R.generateSideWallUV(n,r,yt-6,yt-3,yt-2,yt-1);Gt(hn[0]),Gt(hn[1]),Gt(hn[3]),Gt(hn[1]),Gt(hn[2]),Gt(hn[3])}function dn($e){r.push(l[$e*3+0]),r.push(l[$e*3+1]),r.push(l[$e*3+2])}function Gt($e){s.push($e.x),s.push($e.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 hAe(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 sM[r.type]().fromJSON(r)),new i(n,e.options)}},uAe={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],d=e[r*3],A=e[r*3+1],y=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(d,1-y),new Oe(w,1-T)]:[new Oe(a,1-l),new Oe(u,1-f),new Oe(A,1-y),new Oe(S,1-T)]}};function hAe(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 HA=class i extends Xn{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,d=t/l,A=[],y=[],w=[],S=[];for(let T=0;T<u;T++){let R=T*d-o;for(let P=0;P<c;P++){let I=P*f-s;y.push(I,-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,I=R+c*(T+1),F=R+1+c*(T+1),D=R+1+c*T;A.push(P,I,D),A.push(I,F,D)}this.setIndex(A),this.setAttribute("position",new Ln(y,3)),this.setAttribute("normal",new Ln(w,3)),this.setAttribute("uv",new Ln(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 za=class i extends Xn{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 re,d=new re,A=[],y=[],w=[],S=[];for(let T=0;T<=n;T++){let R=[],P=T/n,I=o+P*a,F=e*Math.cos(I),D=Math.sqrt(e*e-F*F),L=0;T===0&&o===0?L=.5/t:T===n&&l===Math.PI&&(L=-.5/t);for(let C=0;C<=t;C++){let B=C/t,k=r+B*s;f.x=-D*Math.cos(k),f.y=F,f.z=D*Math.sin(k),y.push(f.x,f.y,f.z),d.copy(f).normalize(),w.push(d.x,d.y,d.z),S.push(B+L,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],I=u[T][R],F=u[T+1][R],D=u[T+1][R+1];(T!==0||o>0)&&A.push(P,I,D),(T!==n-1||l<Math.PI)&&A.push(I,F,D)}this.setIndex(A),this.setAttribute("position",new Ln(y,3)),this.setAttribute("normal",new Ln(w,3)),this.setAttribute("uv",new Ln(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 V2=class i extends Xn{constructor(e=new N2(new re(-1,-1,0),new re(-1,1,0),new re(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 re,l=new re,c=new Oe,u=new re,f=[],d=[],A=[],y=[];w(),this.setIndex(y),this.setAttribute("position",new Ln(f,3)),this.setAttribute("normal",new Ln(d,3)),this.setAttribute("uv",new Ln(A,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 I=o.normals[P],F=o.binormals[P];for(let D=0;D<=r;D++){let L=D/r*Math.PI*2,C=Math.sin(L),B=-Math.cos(L);l.x=B*I.x+C*F.x,l.y=B*I.y+C*F.y,l.z=B*I.z+C*F.z,l.normalize(),d.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 I=1;I<=r;I++){let F=(r+1)*(P-1)+(I-1),D=(r+1)*P+(I-1),L=(r+1)*P+I,C=(r+1)*(P-1)+I;y.push(F,D,C),y.push(D,L,C)}}function R(){for(let P=0;P<=t;P++)for(let I=0;I<=r;I++)c.x=P/t,c.y=I/r,A.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 sM[e.path.type]().fromJSON(e.path),e.tubularSegments,e.radius,e.radialSegments,e.closed)}},G2=class extends Xn{constructor(e=null){if(super(),this.type="WireframeGeometry",this.parameters={geometry:e},e!==null){let t=[],n=new Set,r=new re,s=new re;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],d=f.start,A=f.count;for(let y=d,w=d+A;y<w;y+=3)for(let S=0;S<3;S++){let T=a.getX(y+S),R=a.getX(y+(S+1)%3);r.fromBufferAttribute(o,T),s.fromBufferAttribute(o,R),zY(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),zY(r,s,n)===!0&&(t.push(r.x,r.y,r.z),t.push(s.x,s.y,s.z))}}this.setAttribute("position",new Ln(t,3))}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}};function zY(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 q2=class extends Ws{constructor(e){super(),this.isShadowMaterial=!0,this.type="ShadowMaterial",this.color=new zt(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 ag(i){let e={};for(let t in i){e[t]={};for(let n in i[t]){let r=i[t][n];if(VY(r))r.isRenderTargetTexture?(Xe("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(VY(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 ha(i){let e={};for(let t=0;t<i.length;t++){let n=ag(i[t]);for(let r in n)e[r]=n[r]}return e}function VY(i){return i&&(i.isColor||i.isMatrix3||i.isMatrix4||i.isVector2||i.isVector3||i.isVector4||i.isTexture||i.isQuaternion)}function fAe(i){let e=[];for(let t=0;t<i.length;t++)e.push(i[t].clone());return e}function Q8(i){let e=i.getRenderTarget();return e===null?i.outputColorSpace:e.isXRRenderTarget===!0?e.texture.colorSpace:ln.workingColorSpace}var lg={clone:ag,merge:ha},dAe=`void main() {1+(()=>{var ohe=Object.create;var CL=Object.defineProperty;var ahe=Object.getOwnPropertyDescriptor;var lhe=Object.getOwnPropertyNames;var che=Object.getPrototypeOf,uhe=Object.prototype.hasOwnProperty;var Uq=(i,e)=>()=>{try{return e||i((e={exports:{}}).exports,e),e.exports}catch(t){throw e=0,t}},hhe=(i,e)=>{for(var t in e)CL(i,t,{get:e[t],enumerable:!0})},fhe=(i,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of lhe(e))!uhe.call(i,r)&&r!==t&&CL(i,r,{get:()=>e[r],enumerable:!(n=ahe(e,r))||n.enumerable});return i};var kq=(i,e,t)=>(t=i!=null?ohe(che(i)):{},fhe(e||!i||!i.__esModule?CL(t,"default",{value:i,enumerable:!0}):t,i));var jq=Uq((gT,Wq)=>{(function(i,e){typeof gT=="object"&&typeof Wq<"u"?e(gT):typeof define=="function"&&define.amd?define(["exports"],e):e(i.bigfloat={})})(gT,(function(i){"use strict";var e=Math.pow(2,32),t=Math.pow(2,-32),n=Math.log(10)/(32*Math.log(2));function r(D){return new Array(D+1).join("0")}var s=(function(){function D(L){this.base=L,this.limbDigitsExact=Math.log(e)/Math.log(this.base),this.limbDigits=~~this.limbDigitsExact,this.limbBase=Math.pow(this.base,this.limbDigits),this.pad=r(this.limbDigits)}return D.init=function(L){return D.baseTbl[L]||(D.baseTbl[L]=new D(L))},D.baseTbl={},D})();function o(D){return D.replace(/^(-?)0+([1-9a-z]|0(\.|$))/,"$1$2").replace(/(\.|(\.[0-9a-z]*[1-9a-z]))0+$/,"$2")}function a(D,L){L===void 0&&(L=10);var C=s.init(L),B=C.pad,k=C.limbBase,z="",G="",W,Y;if(isNaN(D))return"NaN";if(D<0&&(z="-",D=-D),!isFinite(D))return z+"Inf";if(D<1)G+="0";else{var H=Math.floor(D);for(D-=H;H;)W=H%k,H=(H-W)/k,Y=W.toString(L),G=Y+G,H&&(G=B.substr(Y.length)+G)}if(D>0)for(G+=".",k!=e&&(k=L,B="");D;)D*=k,W=D>>>0,D-=W,Y=W.toString(L),G+=B.substr(Y.length)+Y;return z+G.replace(/(\.[0-9a-z]*[1-9a-z])0+$/,"$1")}var l=(function(){function D(L,C){this.limbList=[],L?this.setValue(L,C):this.setZero()}return D.prototype.clone=function(){return new D().setBig(this)},D.prototype.setZero=function(){return this.sign=1,this.fractionLen=0,this.len=0,this},D.prototype.setValue=function(L,C){return typeof L=="number"?this.setNumber(L):L instanceof D?this.setBig(L):this.setString(L.toString(),C||10)},D.prototype.setBig=function(L){var C=L.len;this.sign=L.sign,this.fractionLen=L.fractionLen,this.len=C;for(var B=0;B<C;++B)this.limbList[B]=L.limbList[B];return this},D.prototype.setNumber=function(L){L<0?(L=-L,this.sign=-1):this.sign=1;for(var C=Math.floor(L),B=L-C,k=0,z=this.limbList,G,W=0;B;)B*=e,G=B>>>0,B-=G,z[W++]=G,++k;for(var Y=0;--W>Y;)G=z[Y],z[Y++]=z[W],z[W]=G;for(W+=Y+1;C;)G=C%e,C=(C-G)/e,z[W++]=G;return this.limbList=z,this.fractionLen=k,this.len=W,this},D.prototype.parseFraction=function(L,C,B,k,z,G){for(var W=this.limbList,Y=L.length,H=k-1;H;)W[--H]=0;var $=Y-((Y-B+G-1)%G+1);for(W[k-1]=parseInt(L.substr($,Y-$),C),this.divInt(Math.pow(C,Y-$),k),Y=$;Y>B;)Y-=G,W[k-1]=parseInt(L.substr(Y,G),C),this.divInt(z,k)},D.prototype.setString=function(L,C){var B=s.init(C),k=B.limbBase,z=B.limbDigits,G=B.limbDigitsExact,W=this.limbList,Y=-1,H;for(this.sign=1;;){switch(H=L.charAt(++Y),H){case"-":this.sign=-1;case"+":case"0":continue}break}var $=(L.indexOf(".",Y)+1||L.length+1)-1;if($<L.length-1){var J=~~((L.length-$-1)/G)+1;this.parseFraction(L,C,$+1,J+1,k,z),this.fractionLen=J,this.len=J,this.trimLeast()}else this.fractionLen=0,this.len=0;var te=this.fractionLen;if($>Y){var ce=Y+($-Y+z-1)%z+1;for(++this.len,W[te]=parseInt(L.substr(Y,ce-Y),C),Y=ce;Y<$;)this.mulInt(k,W,te,te,0)&&++this.len,W[te]+=parseInt(L.substr(Y,z),C),Y+=z}return this},D.prototype.trimMost=function(){for(var L=this.limbList,C=this.fractionLen,B=this.len;B>C&&!L[B-1];)--B;this.len=B},D.prototype.trimLeast=function(){for(var L=this.limbList,C=this.fractionLen,B=0;B<C&&!L[B];)++B;B&&this.truncate(C-B)},D.prototype.mulInt=function(L,C,B,k,z){if(!L)return 0;for(var G=this.limbList,W=this.len,Y,H,$=0;B<W;)Y=G[B++],$+=L*(Y&65535),H=$&65535,$=($-H)/65536,$+=L*(Y>>>16),H|=$<<16,Y=(C[k]&z)+H>>>0,C[k++]=Y,$=$/65536>>>0,$+=(H^(Y-H^H)&~(Y^H))>>>31;return $&&(C[k]=$),$},D.prototype.mulBig=function(L,C){if(this.isZero()||L.isZero())return C.setZero();var B=L.limbList,k=L.len,z=C.limbList,G=this.len+k;for(C.len=G;G--;)z[G]=0;this.mulInt(B[0],z,0,0,0);for(var W=1;W<k;++W)this.mulInt(B[W],z,0,W,4294967295);return C.sign=this.sign*L.sign,C.fractionLen=this.fractionLen+L.fractionLen,C.trimMost(),C.trimLeast(),C},D.prototype.mul=function(L,C){if(C=C||new D,typeof L=="number"&&(L=c.setNumber(L)),C==this)throw new Error("Multiplication in place is unsupported");return this.mulBig(L,C)},D.prototype.absDeltaFrom=function(L){typeof L=="number"&&(L=c.setNumber(L));for(var C=this.limbList,B=L.limbList,k=this.len,z=L.len,G=k-this.fractionLen-(z-L.fractionLen);!G&&k&&z;)G=C[--k]-B[--z];if(G)return G;if(k)do G=C[--k];while(!G&&k);else if(z)do G=-B[--z];while(!G&&z);return G},D.prototype.isZero=function(){return this.len==0},D.prototype.getSign=function(){return this.len&&this.sign},D.prototype.deltaFrom=function(L){return typeof L=="number"&&(L=c.setNumber(L)),this.len+L.len&&(this.sign-L.sign||this.absDeltaFrom(L)*this.sign)},D.prototype.addBig=function(L,C){var B=this,k=B.fractionLen,z=k-L.fractionLen;z<0&&(z=-z,k+=z,B=L,L=this),C.sign=this.sign,C.fractionLen=k;for(var G=C.limbList,W=B.limbList,Y=L.limbList,H=0,$=0,J=0,te;H<z;)G[H]=W[H],++H;var ce=L.len;for(z=B.len-H,z>ce&&(z=ce);$<z;)J+=W[H]+Y[$++],te=J>>>0,J=J-te&&1,G[H++]=te;var he=H;for(z<ce?(z=ce,B=L,H=$,W=Y):z=B.len;H<z;)J+=W[H++],te=J>>>0,J=J-te&&1,G[he++]=te;return J&&(G[he++]=J),C.len=he,C.trimLeast(),C},D.prototype.subBig=function(L,C){var B=this;C.sign=this.sign,B.absDeltaFrom(L)<0&&(B=L,L=this,C.sign=-this.sign);var k=B.fractionLen,z=k-L.fractionLen,G=C.limbList,W=B.limbList,Y=L.limbList,H=B.len,$=L.len,J=H,te=0,ce=0,he=0,ve=0,Re;if(z>=0){for(;te<z;)G[te]=W[te],++te;z+=$,z>H&&(z=H),he=te}else{for(z=-z,k+=z,J+=z;ce<z;)ve-=Y[ce],Re=ve>>>0,ve=-(ve<0),G[ce++]=Re;z+=H,z>$&&(z=$),he=ce}for(C.fractionLen=k;he<z;)ve+=W[te++]-Y[ce++],Re=ve>>>0,ve=-(ve<0),G[he++]=Re;for(;he<J;)ve+=W[te++],Re=ve>>>0,ve=-(ve<0),G[he++]=Re;return C.len=he,C.trimMost(),C.trimLeast(),C},D.prototype.addSub=function(L,C,B){if(B=B||new D,B==this)throw new Error("Addition and subtraction in place is unsupported");return typeof L=="number"&&(L=c.setNumber(L)),this.sign*L.sign*C<0?this.subBig(L,B):this.addBig(L,B)},D.prototype.add=function(L,C){return this.addSub(L,1,C)},D.prototype.sub=function(L,C){return this.addSub(L,-1,C)},D.prototype.truncate=function(L){var C=this.fractionLen-L;if(C>0){this.fractionLen=L,this.len-=C;for(var B=this.len,k=this.limbList,z=0;z<B;++z)k[z]=k[z+C]}return this},D.prototype.round=function(L){return this.truncate(1+~~(L*n))},D.prototype.divInt=function(L,C){var B=this.limbList,k,z,G,W=0;for(B[C-1]<L&&(W=B[--C],this.len=C);C--;)k=B[C],W=W*65536+(k>>>16),z=W/L>>>0,W=W-z*L,W=W*65536+(k&65535),G=W/L>>>0,W=W-G*L,B[C]=(z<<16|G)>>>0;return W},D.prototype.fractionToString=function(L,C){var B=s.init(L),k=B.pad,z=B.limbBase,G=this.limbList,W=this.fractionLen,Y=0,H;if(L&1)throw new Error("Conversion of floating point values to odd bases is unsupported");for(;Y<W&&!G[Y];)++Y;if(!(Y>=W)){C.push(".");var $=c;for($.limbList=G.slice(Y,W),$.len=W-Y,Y=0;Y<$.len;)if($.limbList[Y]){var J=$.mulInt(z,$.limbList,Y,Y,0);H=J.toString(L),C.push(k.substr(H.length)+H)}else++Y}},D.prototype.getExpansion=function(L){for(var C=this.limbList,B=this.len,k=this.sign,z=this.fractionLen;z--;)k*=t;for(;++z<B;)L[z]=C[z]*k,k*=e;return B},D.prototype.valueOf=function(){for(var L=this.limbList,C=0,B=t*this.sign,k=this.fractionLen,z=0;z<k;)C=C*t+L[z++];for(k=this.len;z<k;)C=C*t+L[z++],B*=e;return C*B},D.prototype.toString=function(L){L===void 0&&(L=10);var C=s.init(L),B=C.pad,k=C.limbBase,z=[],G=this.limbList,W;if(k!=e){var Y=c;for(Y.limbList=G.slice(this.fractionLen,this.len),Y.len=this.len-this.fractionLen;Y.len>1;)W=Y.divInt(k,Y.len).toString(L),z.push(B.substr(W.length)+W);z.push(""+(Y.limbList[0]||0)),this.sign<0&&z.push("-"),z.reverse(),this.fractionToString(L,z)}else{var H=this.len,$=this.fractionLen;for(this.sign<0&&z.push("-"),H==$&&z.push("0");H--;)W=G[H].toString(L),H==$-1&&z.push("."),z.push(B.substr(W.length)+W)}return o(z.join(""))},D})();l.prototype.cmp=l.prototype.deltaFrom;var c=new l,u=(1<<27)+1,f=Math.log(10)/(53*Math.log(2));function d(D,L,C){var B=D+L,k=B-D,z=B-k;return C[0]=D-z+(L-k),C[1]=B,C}function A(D,L){w=D*L;var C=D*u,B=C-(C-D),k=D-B,z=L*u,G=z-(z-L),W=L-G;return k*W-(w-B*G-k*G-B*W)}var y=(function(){function D(L,C){this.limbList=[],L&&this.setValue(L,C)}return D.prototype.clone=function(){return new D().setBig(this)},D.prototype.setZero=function(){return this.len=0,this},D.prototype.setValue=function(L,C){return typeof L=="number"?this.setNumber(L):L instanceof D?this.setBig(L):this.setString(L.toString(),C||10)},D.prototype.setBig=function(L){var C=L.len;this.len=C;for(var B=0;B<C;++B)this.limbList[B]=L.limbList[B];return this},D.prototype.setNumber=function(L){return this.limbList[0]=L,this.len=L&&1,this},D.prototype.setString=function(L,C){return S[0].setValue(L,C),this.len=S[0].getExpansion(this.limbList),this.normalize(),this},D.prototype.setSum=function(L,C){return this.len=2,d(L,C,this.limbList),this},D.prototype.setProduct=function(L,C){return this.len=2,this.limbList[0]=A(L,C),this.limbList[1]=w,this},D.prototype.normalize=function(){var L=this.limbList,C=this.len,B;if(C){for(var k=C-1,z=C-1,G=L[k],W=void 0;k;)B=L[--k],W=G,G+=B,W=B-(G-W),L[z]=G,z-=W&&1,G=W||G;for(L[z]=G;++z<C;)B=L[z],W=G,G+=B,W-=G-B,L[k]=W,k+=W&&1;L[k]=G,this.len=k+(G&&1)}return this},D.prototype.mulSmall=function(L,C){var B=this.limbList,k=C.limbList,z=this.len,G,W,Y,H=0,$=0;function J(ce){k[$]=ce,$+=ce&&1}J(A(B[H++],L));for(var te=w;H<z;)G=A(B[H++],L),W=te+G,Y=W-te,J(te-(W-Y)+(G-Y)),te=w+W,J(W-(te-w));return k[$]=te,C.len=$+(te&&1),C},D.prototype.mulBig=function(L,C){var B=L.limbList,k=L.len;if(!k)return C.setZero();for(--k,this.mulSmall(B[k],k?T[k&1]:C);k;)--k,this.mulSmall(B[k],C).addBig(T[~k&1],1,k?T[k&1]:C);return C},D.prototype.mul=function(L,C){if(C=C||new D,typeof L=="number")return this.mulSmall(L,C);if(C==this)throw new Error("Cannot multiply in place");return this.mulBig(L,C)},D.prototype.isZero=function(){for(var L=this.limbList,C=this.len;C--;)if(L[C])return!1;return!0},D.prototype.getSign=function(){var L=this.len;return L&&(L=this.limbList[L-1])&&(L>0?1:-1)},D.prototype.deltaFrom=function(L){var C=this.len,B=this.getSign(),k=B;if(typeof L!="number"){if(C=L.len,k-=C&&(C=L.limbList[C-1])&&(C>0?1:-1),k||!B)return k;this.addBig(L,-1,T[0])}else{if(k-=L&&(L>0?1:-1),k||!B)return k;this.addSmall(-L,T[0])}return C=T[0].len,C&&T[0].limbList[C-1]},D.prototype.addSmall=function(L,C){for(var B=this.limbList,k=C.limbList,z=this.len,G,W,Y,H,$=0,J=0;$<z;)W=B[$++],G=W+L,Y=G-W,W-=G-Y,H=W+(L-Y),k[J]=H,J+=H&&1,L=G;return k[J]=L,C.len=J+(L&&1),C},D.prototype.addBig=function(L,C,B){var k=this.limbList,z=L.limbList,G=B.limbList,W=this.len+L.len,Y=0,H=0,$=0,J=k[Y++],te=z[H++]*C,ce=J<0?-J:J,he=te<0?-te:te,ve,Re,Qe,Fe;if(!W)return B.setZero();k[this.len]=1/0,z[L.len]=1/0;function mt(){var Ve;return ce<he?(Ve=J,J=k[Y++],ce=J<0?-J:J):(Ve=te,te=z[H++]*C,he=te<0?-te:te),Ve}for(var Ee=mt();--W;)ve=mt(),Qe=Ee,Ee+=ve,Re=Ee-Qe,Fe=Qe-(Ee-Re)+(ve-Re),G[$]=Fe,$+=Fe&&1;return G[$]=Ee,B.len=$+(Ee&&1),B},D.prototype.addSub=function(L,C,B){return B=B||new D,typeof L=="number"?this.addSmall(C*L,B):this.addBig(L,C,B)},D.prototype.add=function(L,C){return this.addSub(L,1,C)},D.prototype.sub=function(L,C){return this.addSub(L,-1,C)},D.prototype.truncate=function(L){this.normalize();for(var C=this.limbList,B=this.len,k=0,z=B,G=0,W=0;k<z;)G=k+z>>1,W=C[G],W>-1&&W<1?k=G+1:z=G;if(G&&(W<=-1||W>=1)&&(W=C[--G]),G-=L-1,G>0){this.len-=G,B=this.len;for(var Y=0;Y<B;++Y)C[Y]=C[Y+G]}return this},D.prototype.round=function(L){return this.truncate(1+~~(L*f))},D.prototype.valueOf=function(){for(var L=this.limbList,C=this.len,B=0,k=0;k<C;++k)B+=L[k];return B},D.prototype.toString=function(L){var C=this.limbList,B=this.len;for(S[B&1].setZero();B--;)S[~B&1].add(C[B],S[B&1]);return S[~B&1].toString(L)},D})();y.prototype.cmp=y.prototype.deltaFrom;var w=0,S=[new l,new l],T=[new y,new y];function R(D,L){function C(){this.constructor=D}C.prototype=L.prototype,D.prototype=new C}var I=(function(){function D(L,C,B){this.real=typeof L=="object"?L:new this.Base(L,B),this.imag=typeof C=="object"?C:new this.Base(C,B)}return D.prototype.clone=function(){var L=new this.constructor(this.real.clone(),this.imag.clone());return L},D.prototype.setZero=function(){return this.real.setZero(),this.imag.setZero(),this},D.prototype.setValue=function(L){return this.real.setValue(L.real),this.imag.setValue(L.imag),this},D.prototype.mul=function(L,C){return C=C||new this.constructor,L instanceof D?(this.real.mul(L.real,this.temp1),this.imag.mul(L.imag,this.temp2),this.temp1.sub(this.temp2,C.real),this.real.mul(L.imag,this.temp1),this.imag.mul(L.real,this.temp2),this.temp1.add(this.temp2,C.imag)):(this.real.mul(L,C.real),this.imag.mul(L,C.imag)),C},D.prototype.sqr=function(L){return L=L||new this.constructor,this.real.mul(this.real,this.temp1),this.imag.mul(this.imag,this.temp2),this.temp1.sub(this.temp2,L.real),this.real.mul(this.imag,this.temp1),this.temp1.add(this.temp1,L.imag),L},D.prototype.add=function(L,C){return C=C||new this.constructor,L instanceof D?(this.real.add(L.real,C.real),this.imag.add(L.imag,C.imag)):this.real.add(L,C.real),C},D.prototype.sub=function(L,C){return C=C||new this.constructor,L instanceof D?(this.real.sub(L.real,C.real),this.imag.sub(L.imag,C.imag)):this.real.sub(L,C.real),C},D.prototype.truncate=function(L){return this.real.truncate(L),this.imag.truncate(L),this},D})(),P=(function(D){R(L,D);function L(){return D!==null&&D.apply(this,arguments)||this}return L})(I),F=(function(D){R(L,D);function L(){return D!==null&&D.apply(this,arguments)||this}return L})(I);P.prototype.Base=l,P.prototype.temp1=new l,P.prototype.temp2=new l,F.prototype.Base=y,F.prototype.temp1=new y,F.prototype.temp2=new y,i.BigFloat32=l,i.BigFloat53=y,i.BigComplex32=P,i.BigComplex53=F,i.trimNumber=o,i.numberToString=a,Object.defineProperty(i,"__esModule",{value:!0})}))});var JJ=Uq((Tw,_O)=>{(function(i,e){typeof Tw=="object"&&typeof _O=="object"?_O.exports=e():typeof define=="function"&&define.amd?define("FrameTicker",[],e):typeof Tw=="object"?Tw.FrameTicker=e():i.FrameTicker=e()})(Tw,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 Vq=i=>new Promise(e=>setTimeout(e,i)),Dr=i=>document.querySelector(i);async function dhe(){for(let i=0;i<300&&!(window.__atlasDebug&&!Dr("#map-loading")?.checkVisibility?.());i+=1)await Vq(100)}async function phe(){let i="";for(let e=0;e<100;e+=1){await Vq(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 Hf(i,e={}){window.dispatchEvent(new KeyboardEvent("keydown",{key:i,bubbles:!0,cancelable:!0,...e}))}function zq(i,e={}){window.dispatchEvent(new KeyboardEvent("keyup",{key:i,bubbles:!0,cancelable:!0,...e}))}function mhe(i){Dr("#map").dispatchEvent(new KeyboardEvent("keydown",{key:i,bubbles:!0,cancelable:!0}))}function Gm(i,e){i.value=e,i.dispatchEvent(new Event("change",{bubbles:!0}))}function RL(i,e){let t=Dr(i);t.value=e,t.dispatchEvent(new Event("input",{bubbles:!0}))}function PL(i,e=!1){let t=Dr("#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 Ahe(){let i=[],e=async R=>{await phe(),i.push({name:R,snapshot:JSON.parse(window.render_game_to_text())})};await dhe(),localStorage.clear();let t=Dr("#volume-select"),n=t.options[0].value;Gm(t,n),await e("initial"),RL("#pin-search","a"),await e("search-a");let r=Dr(".search-result");r&&(r.click(),await e("search-select-first"),Dr("#close-detail").click(),await e("detail-closed")),RL("#pin-search",""),await e("search-cleared");let s=Dr(".category-row input");s&&(s.click(),await e("category-hidden"),s.click(),await e("category-restored"));let o=Dr(".only-button");if(o){o.click(),await e("solo-first");let R=Dr("#solo-chip");R&&!R.hidden&&R.click(),await e("solo-cleared")}let a=Dr("#legend .layer-title");a&&(a.click(),await e("section-folded"),Dr("#expand-all").click(),await e("sections-unfolded")),Dr("#hide-all").click(),await e("all-hidden"),Dr("#show-all").click(),await e("all-shown");let l=Dr(".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"));let c=Dr("[data-expand-collection]");c&&(c.click(),await e("collection-folded"),c.click(),await e("collection-unfolded"));let u=[...document.querySelectorAll(".category-row")].filter(R=>R.querySelector("[data-expand-collection]")),f=u[1]||u[0];if(f){let R=f.querySelector("input[data-collection]");R.click(),await e("collection-hidden"),R.click(),await e("collection-restored");let I=f.querySelector("[data-only-collection]");if(I){I.click(),await e("collection-solo");let P=Dr("#solo-chip");P&&!P.hidden&&P.click(),await e("collection-solo-cleared")}}let d=Dr("[data-label-toggle]");d&&(d.click(),await e("labels-flipped"),d.click(),await e("labels-curated"));let A=[...document.querySelectorAll(".category-row")].filter(R=>!R.querySelector("[data-expand-collection]")).map(R=>R.querySelector("[data-label-toggle]")).find(Boolean);A&&(A.click(),await e("point-labels-flipped"),A.click(),await e("point-labels-curated"));let y=[...document.querySelectorAll(".feature-index")].map(R=>R.querySelector(".zone-index-item")).filter(Boolean);if(y.length>1){let R=F=>F.dispatchEvent(new MouseEvent("contextmenu",{bubbles:!0,cancelable:!0})),I=y[0],P=y[y.length-1];R(I),R(P),await e("and-highlighted"),Hf("z"),await e("labels-held-highlighted"),zq("z"),R(I),R(P),await e("and-cleared")}Hf("g"),await e("grid-open"),RL("#grid-input","m"),await e("grid-descended"),Hf(" "),await e("subgrid-hidden"),Hf(" "),Hf("Escape"),await e("grid-ascended"),Hf("Escape"),await e("grid-closed"),Hf("z"),await e("labels-on"),zq("z"),await e("labels-off"),Hf("b",{metaKey:!0}),await e("sidebar-collapsed"),Hf("b",{metaKey:!0}),await e("sidebar-restored"),Dr("#zoom-in").click(),await e("zoomed-in");let w=Dr("#overview-dock");w&&!Dr("#overview-shelf").hidden&&(w.click(),await e("overview-docked"),w.click(),await e("overview-undocked")),Dr("#zoom-out").click(),await e("zoomed-out"),mhe("Escape"),await e("viewport-escape");let S=Dr("#lens-select");S.options.length>1&&(Gm(S,S.options[1].value),await e("variant-second"),Gm(S,S.options[0].value),await e("variant-first"));let T=Dr("#world-select");return T.options.length>1&&(Gm(T,T.options[1].value),await e("map-second"),Gm(T,T.options[0].value),await e("map-first")),t.options.length>1&&(Gm(t,t.options[1].value),await e("game-second"),Gm(t,n),await e("game-first")),localStorage.clear(),{viewport:[window.innerWidth,window.innerHeight],steps:i}}var IL=!1;async function Gq(){if(!IL){IL=!0,PL("parity tour running\u2026");try{let i=await Ahe(),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}`);PL(`parity tour complete \u2713 ${i.steps.length} steps`),console.log("parity tour saved to",t)}catch(i){PL(`parity tour failed: ${i}`,!0),console.error("parity tour failed",i)}finally{IL=!1}}}window.__atlasTour=Gq;window.addEventListener("keydown",i=>{i.key==="F9"&&Gq()});var on=i=>document.querySelector(i),ge={volume:on("#volume-select"),world:on("#world-select"),lens:on("#lens-select"),lensField:on("#lens-field"),legend:on("#legend"),search:on("#pin-search"),searchResults:on("#dock-results"),dock:on("#dock"),dockCount:on("#dock-count"),dockFlag:on("#dock-flag"),dockFold:on("#dock-fold"),dockRailName:on("#dock-rail-name"),visibleCount:on("#visible-count"),viewport:on("#map"),globe:on("#globe"),globeToggle:on("#globe-toggle"),layers:on("#layers"),loading:on("#map-loading"),labelsHint:on("#labels-hint"),gridHint:on("#grid-hint"),soloChip:on("#solo-chip"),overview:on("#overview"),overviewShelf:on("#overview-shelf"),overviewDock:on("#overview-dock"),overviewCanvas:on("#overview-canvas"),overviewViewport:on("#overview-viewport"),gridNavigator:on("#grid-navigator"),gridSystem:on("#grid-system"),gridSystemName:on("#grid-system-name"),gridInput:on("#grid-input"),gridBack:on("#grid-back"),subgridToggle:on("#subgrid-toggle"),detail:on("#pin-detail"),detailTitle:on("#detail-title"),detailCategory:on("#detail-category"),detailDescription:on("#detail-description"),detailID:on("#detail-id"),detailCoordinates:on("#detail-coordinates"),detailCoordinatesField:on("#detail-coordinates-field"),detailCell:on("#detail-cell"),detailCellField:on("#detail-cell-field"),detailSource:on("#detail-source"),detailSourceField:on("#detail-source-field"),detailLinks:on("#detail-links"),detailDot:on("#detail-dot"),sidebar:on("#sidebar"),mobileLegend:on("#mobile-legend"),fatal:on("#fatal-error"),fatalMessage:on("#fatal-message"),emptyState:on("#empty-state"),emptyPath:on("#empty-path"),emptyOpen:on("#empty-open"),addBundles:on("#add-bundles")};function qm(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 O={catalog:null,volume:null,world:null,lens:null,engine:null,projection:null,layers:null,sources:null,hiddenCollections:new Set,collapsedSections:new Set,expandedCollections:new Set,features:[],featureByID:new Map,selectedPin:null,selectedZone:null,hoveredPin:null,labelsHeld:!1,gridEnabled:!1,gridSystem:"geohash",globeActive:!1,subgridVisible:!0,gridCell:"",zoneRecords:new Map,highlightedZones:new Set,focusedZoneID:null,labelOverrides:new Map,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,worldRun:0,textByWorld:new Map,restore:null,settling:!1,styleCache:new Map,markerIcons:new Map};var Wf=["#4fb3d5","#c9924b","#82b56a","#c96a6a","#9581cc","#4bc9a9","#d4b04a","#6a92c9","#b08a5a","#8fb3a2"],Hm="0123456789bcdefghjkmnpqrstuvwxyz";var LL="atlas.session.v3";var qq={light:"rgba(255, 255, 255, 0.96)",dark:"rgba(7, 9, 7, 0.98)"},Vi={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 AT(i){let e=[...jf()],t=!0;for(let n of i){let r=Hm.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 NL(i,e){let t=[...jf()],[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+=Hm[l]}return o}var DL={key:null,extent:null};function ghe(i){let t=`${jf().join(",")}|${i}`;return DL.key!==t&&(DL={key:t,extent:AT(i)}),DL.extent}var FL={slug:"geohash",name:"Geohash",short:"G",appliesTo(){return!0},maxLevel(){return 3},inputLength(){return 3},level(i){return i.length},parent(i){return i.slice(0,-1)},children(i){return[...Hm].map(e=>i+e)},childIndex(i){return Math.max(0,Hm.indexOf(i[i.length-1]))},contains(i,e){let t=ghe(i),[n,r]=e;return n>=t[0]&&n<=t[2]&&r>=t[1]&&r<=t[3]},descendTarget(i,e){return NL(e,i.length+1)},bbox:AT,center(i){let e=AT(i);return[(e[0]+e[2])/2,(e[1]+e[3])/2]},ring(i){let[e,t,n,r]=AT(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,Hm.indexOf(i[i.length-1]))%Wf.length},normalizeInput(i){return[...i.toLocaleLowerCase()].filter(e=>Hm.includes(e)).slice(0,3).join("")},parseInput(i){return i},locate(i){let e=NL(i,3);return e?{label:"Geohash",value:e}:null}};function Hq(i,e=3){return NL(i,e)}var T1=kq(jq());function Xq(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 sy(i,e,t){if(SH())return Reflect.construct.apply(null,arguments);var n=[null];n.push.apply(n,e);var r=new(i.bind.apply(i,n));return t&&oy(r,t.prototype),r}function $q(i,e){for(var t=0;t<e.length;t++){var n=e[t];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(i,yhe(n.key),n)}}function vhe(i,e,t){return e&&$q(i.prototype,e),t&&$q(i,t),Object.defineProperty(i,"prototype",{writable:!1}),i}function Ct(i,e){var t=typeof Symbol<"u"&&i[Symbol.iterator]||i["@@iterator"];if(t)return(t=t.call(i)).next.bind(t);if(Array.isArray(i)||(t=bhe(i))||e&&i&&typeof i.length=="number"){t&&(i=t);var n=0;return function(){return n>=i.length?{done:!0}:{done:!1,value:i[n++]}}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.2+In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function yT(){return yT=Object.assign?Object.assign.bind():function(i){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var n in t)({}).hasOwnProperty.call(t,n)&&(i[n]=t[n])}return i},yT.apply(null,arguments)}function WL(i){return WL=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},WL(i)}function hy(i,e){i.prototype=Object.create(e.prototype),i.prototype.constructor=i,oy(i,e)}function _he(i){try{return Function.toString.call(i).indexOf("[native code]")!==-1}catch{return typeof i=="function"}}function SH(){try{var i=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(SH=function(){return!!i})()}function oy(i,e){return oy=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,n){return t.__proto__=n,t},oy(i,e)}function xhe(i,e){if(typeof i!="object"||!i)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var n=t.call(i,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(i)}function yhe(i){var e=xhe(i,"string");return typeof e=="symbol"?e:e+""}function bhe(i,e){if(i){if(typeof i=="string")return Xq(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)?Xq(i,e):void 0}}function I1(i){var e=typeof Map=="function"?new Map:void 0;return I1=function(t){if(t===null||!_he(t))return t;if(typeof t!="function")throw new TypeError("Super expression must either be null or a function");if(e!==void 0){if(e.has(t))return e.get(t);e.set(t,n)}function n(){return sy(t,arguments,WL(this).constructor)}return n.prototype=Object.create(t.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),oy(n,t)},I1(i)}var Li=(function(){function i(t,n){this.lo=0,this.hi=0,this.lo=t,this.hi=n}var e=i.prototype;return e.isEmpty=function(){return this.lo>this.hi},e.equals=function(n){return this.lo==n.lo&&this.hi==n.hi||this.isEmpty()&&n.isEmpty()},e.center=function(){return .5*(this.lo+this.hi)},e.length=function(){return this.hi-this.lo},e.contains=function(n){return this.lo<=n&&n<=this.hi},e.containsInterval=function(n){return n.isEmpty()?!0:this.lo<=n.lo&&n.hi<=this.hi},e.interiorContains=function(n){return this.lo<n&&n<this.hi},e.interiorContainsInterval=function(n){return n.isEmpty()?!0:this.lo<n.lo&&n.hi<this.hi},e.intersects=function(n){return this.lo<=n.lo?n.lo<=this.hi&&n.lo<=n.hi:this.lo<=n.hi&&this.lo<=this.hi},e.interiorIntersects=function(n){return n.lo<this.hi&&this.lo<n.hi&&this.lo<this.hi&&n.lo<=n.hi},e.intersection=function(n){return new i(Math.max(this.lo,n.lo),Math.min(this.hi,n.hi))},e.union=function(n){return this.isEmpty()?n:n.isEmpty()?this:new i(Math.min(this.lo,n.lo),Math.max(this.hi,n.hi))},e.addPoint=function(n){return this.isEmpty()?new i(n,n):n<this.lo?new i(n,this.hi):n>this.hi?new i(this.lo,n):this},e.clampPoint=function(n){return Math.max(this.lo,Math.min(this.hi,n))},e.expanded=function(n){return this.isEmpty()?this:new i(this.lo-n,this.hi+n)},e.approxEqual=function(n,r){return r===void 0&&(r=1e-15),this.isEmpty()?n.length()<=2*r:n.isEmpty()?this.length()<=2*r:Math.abs(n.lo-this.lo)<=r&&Math.abs(n.hi-this.hi)<=r},e.directedHausdorffDistance=function(n){return this.isEmpty()?0:n.isEmpty()?1/0:Math.max(0,Math.max(this.hi-n.hi,n.lo-this.lo))},e.trunc=function(n){n===void 0&&(n=15);var r=+("1e"+n),s=function(a){return Math.round(a*r)/r};return new i(s(this.lo),s(this.hi))},e.toString=function(){var n=this.trunc(7);return"["+n.lo.toFixed(7)+", "+n.hi.toFixed(7)+"]"},i.empty=function(){return new i(1,0)},i.fromPoint=function(n){return new i(n,n)},i})();var Ci=(function(){function i(t,n){t===void 0&&(t=0),n===void 0&&(n=0),this.x=0,this.y=0,this.x=t,this.y=n}var e=i.prototype;return e.add=function(n){return new i(this.x+n.x,this.y+n.y)},e.sub=function(n){return new i(this.x-n.x,this.y-n.y)},e.mul=function(n){return new i(this.x*n,this.y*n)},e.ortho=function(){return new i(-this.y,this.x)},e.dot=function(n){return this.x*n.x+this.y*n.y},e.cross=function(n){return this.x*n.y-this.y*n.x},e.norm=function(){return Math.hypot(this.x,this.y)},e.normalize=function(){return this.x==0&&this.y==0?this:this.mul(1/this.norm())},e.trunc=function(n){n===void 0&&(n=15);var r=+("1e"+n),s=function(a){return Math.round(a*r)/r};return new i(s(this.x),s(this.y))},e.equals=function(n){return this.x===n.x&&this.y===n.y},e.toString=function(){var n=this.trunc(12);return"("+n.x.toFixed(12)+", "+n.y.toFixed(12)+")"},i})(),Hr=(function(){function i(t,n){t===void 0&&(t=new Li(0,0)),n===void 0&&(n=new Li(0,0)),this.x=t,this.y=n}var e=i.prototype;return e.isValid=function(){return this.x.isEmpty()==this.y.isEmpty()},e.isEmpty=function(){return this.x.isEmpty()},e.vertices=function(){return[new Ci(this.x.lo,this.y.lo),new Ci(this.x.hi,this.y.lo),new Ci(this.x.hi,this.y.hi),new Ci(this.x.lo,this.y.hi)]},e.vertexIJ=function(n,r){var s=this.x.lo;n==1&&(s=this.x.hi);var o=this.y.lo;return r==1&&(o=this.y.hi),new Ci(s,o)},e.lo=function(){return new Ci(this.x.lo,this.y.lo)},e.hi=function(){return new Ci(this.x.hi,this.y.hi)},e.center=function(){return new Ci(this.x.center(),this.y.center())},e.size=function(){return new Ci(this.x.length(),this.y.length())},e.containsPoint=function(n){return this.x.contains(n.x)&&this.y.contains(n.y)},e.interiorContainsPoint=function(n){return this.x.interiorContains(n.x)&&this.y.interiorContains(n.y)},e.contains=function(n){return this.x.containsInterval(n.x)&&this.y.containsInterval(n.y)},e.interiorContains=function(n){return this.x.interiorContainsInterval(n.x)&&this.y.interiorContainsInterval(n.y)},e.intersects=function(n){return this.x.intersects(n.x)&&this.y.intersects(n.y)},e.interiorIntersects=function(n){return this.x.interiorIntersects(n.x)&&this.y.interiorIntersects(n.y)},e.addPoint=function(n){return new i(this.x.addPoint(n.x),this.y.addPoint(n.y))},e.addRect=function(n){return new i(this.x.union(n.x),this.y.union(n.y))},e.clampPoint=function(n){return new Ci(this.x.clampPoint(n.x),this.y.clampPoint(n.y))},e.expanded=function(n){var r=this.x.expanded(n.x),s=this.y.expanded(n.y);return r.isEmpty()||s.isEmpty()?i.empty():new i(r,s)},e.expandedByMargin=function(n){return this.expanded(new Ci(n,n))},e.union=function(n){return new i(this.x.union(n.x),this.y.union(n.y))},e.intersection=function(n){var r=this.x.intersection(n.x),s=this.y.intersection(n.y);return r.isEmpty()||s.isEmpty()?i.empty():new i(r,s)},e.approxEqual=function(n){return this.x.approxEqual(n.x)&&this.y.approxEqual(n.y)},e.string=function(){return"["+this.lo().toString()+", "+this.hi.toString()+"]"},i.fromPoints=function(){for(var n=arguments.length,r=new Array(n),s=0;s<n;s++)r[s]=arguments[s];if(r.length==0)return new i;for(var o=new i(new Li(r[0].x,r[0].x),new Li(r[0].y,r[0].y)),a=1;a<r.length;a++)o=o.addPoint(r[a]);return o},i.fromCenterSize=function(n,r){return new i(new Li(n.x-r.x/2,n.x+r.x/2),new Li(n.y-r.y/2,n.y+r.y/2))},i.fromRect=function(n){return new i(new Li(n.x.lo,n.x.hi),new Li(n.y.lo,n.y.hi))},i.empty=function(){return new i(Li.empty(),Li.empty())},i})();var Wt=(function(){function i(t,n,r){this.x=0,this.y=0,this.z=0,this.x=t,this.y=n,this.z=r}var e=i.prototype;return e.approxEqual=function(n){var r=1e-16;return Math.abs(this.x-n.x)<r&&Math.abs(this.y-n.y)<r&&Math.abs(this.z-n.z)<r},e.toString=function(){return"("+this.x.toFixed(24)+", "+this.y.toFixed(24)+", "+this.z.toFixed(24)+")"},e.norm=function(){return Math.sqrt(this.dot(this))},e.norm2=function(){return this.dot(this)},e.normalize=function(){var n=this.norm2();return n==0?new i(0,0,0):this.mul(1/Math.sqrt(n))},e.isUnit=function(){var n=5e-14;return Math.abs(this.norm2()-1)<=n},e.abs=function(){return new i(Math.abs(this.x),Math.abs(this.y),Math.abs(this.z))},e.add=function(n){return new i(this.x+n.x,this.y+n.y,this.z+n.z)},e.sub=function(n){return new i(this.x-n.x,this.y-n.y,this.z-n.z)},e.mul=function(n){return new i(n*this.x,n*this.y,n*this.z)},e.dot=function(n){return this.x*n.x+this.y*n.y+this.z*n.z||0},e.cross=function(n){return new i(this.y*n.z-this.z*n.y,this.z*n.x-this.x*n.z,this.x*n.y-this.y*n.x)},e.distance=function(n){return this.sub(n).norm()},e.angle=function(n){return Math.atan2(this.cross(n).norm(),this.dot(n))},e.ortho=function(){var n=new i(0,0,0),r=this.largestComponent();return r===i.X_AXIS?n.z=1:r===i.Y_AXIS?n.x=1:n.y=1,this.cross(n).normalize()},e.largestComponent=function(){var n=this.abs();return n.x>n.y?n.x>n.z?i.X_AXIS:i.Z_AXIS:n.y>n.z?i.Y_AXIS:i.Z_AXIS},e.smallestComponent=function(){var n=this.abs();return n.x<n.y?n.x<n.z?i.X_AXIS:i.Z_AXIS:n.y<n.z?i.Y_AXIS:i.Z_AXIS},e.equals=function(n){return this.x==n.x&&this.y==n.y&&this.z==n.z},e.cmp=function(n){return this.x<n.x?-1:this.x>n.x?1:this.y<n.y?-1:this.y>n.y?1:this.z<n.z?-1:this.z>n.z?1:0},i})();Wt.X_AXIS=0;Wt.Y_AXIS=1;Wt.Z_AXIS=2;var BL=(function(){function i(t,n,r){this.x=t,this.y=n,this.z=r}i.fromVector=function(n){return new i(new T1.BigFloat32(n.x),new T1.BigFloat32(n.y),new T1.BigFloat32(n.z))};var e=i.prototype;return e.vector=function(){return new Wt(this.x.valueOf(),this.y.valueOf(),this.z.valueOf()).normalize()},e.equals=function(n){return this.x.cmp(n.x)===0&&this.y.cmp(n.y)===0&&this.z.cmp(n.z)===0},e.toString=function(){return"("+this.x.toString()+", "+this.y.toString()+", "+this.z.toString()+")"},e.norm2=function(){return this.dot(this)},e.isUnit=function(){return this.norm2().cmp(new T1.BigFloat32(1))===0},e.abs=function(){var n=this.x.mul(this.x.getSign()),r=this.y.mul(this.y.getSign()),s=this.z.mul(this.z.getSign());return new i(n,r,s)},e.add=function(n){return new i(this.x.add(n.x),this.y.add(n.y),this.z.add(n.z))},e.sub=function(n){return new i(this.x.sub(n.x),this.y.sub(n.y),this.z.sub(n.z))},e.mul=function(n){return new i(this.x.mul(n),this.y.mul(n),this.z.mul(n))},e.mulByFloat64=function(n){return this.mul(new T1.BigFloat32(n))},e.dot=function(n){return this.x.mul(n.x).add(this.y.mul(n.y).add(this.z.mul(n.z)))},e.cross=function(n){return new i(this.y.mul(n.z).sub(this.z.mul(n.y)),this.z.mul(n.x).sub(this.x.mul(n.z)),this.x.mul(n.y).sub(this.y.mul(n.x)))},e.largestComponent=function(){var n=this.abs();return n.x.cmp(n.y)>0?n.x.cmp(n.z)>0?Wt.X_AXIS:Wt.Z_AXIS:n.y.cmp(n.z)>0?Wt.Y_AXIS:Wt.Z_AXIS},e.smallestComponent=function(){var n=this.abs();return n.x.cmp(n.y)<0?n.x.cmp(n.z)<0?Wt.X_AXIS:Wt.Z_AXIS:n.y.cmp(n.z)<0?Wt.Y_AXIS:Wt.Z_AXIS},e.isZero=function(){return this.x.isZero()&&this.y.isZero()&&this.z.isZero()},i})();var jL=Math.PI/180,hp=function(e,t){if(isNaN(e)||isNaN(t)||!isFinite(e)||t===0)return NaN;var n=e/t,r=Math.round(n);Math.abs(n-r)===.5&&(r=2*Math.round(n/2));var s=e-r*t;return s||Math.sign(e)*0},TH=function(e,t){if(isNaN(e)||isNaN(t))return NaN;if(e===t)return t;if(e===0)return t>0?Number.MIN_VALUE:-Number.MIN_VALUE;var n=new ArrayBuffer(8),r=new DataView(n);r.setFloat64(0,e,!0);var s=r.getBigUint64(0,!0);return e>0==t>e?s+=1n:s-=1n,r.setBigUint64(0,s,!0),r.getFloat64(0,!0)},whe=function(e){var t=e&-e&0xffffffffffffffffn;if(t===0n)return 64;var n=Math.clz32(Number(t&0xffffffffn));if(n<32)return 31-n;var r=Math.clz32(Number(t>>32n&0xffffffffn));return 63-r},EH=function(e){var t=e&0xffffffffffffffffn;if(t===0n)return 64;var n=Math.clz32(Number(t>>32n&0xffffffffn));if(n<32)return 63-n;var r=Math.clz32(Number(t&0xffffffffn));return 31-r},XL=function(e,t){return e*Math.pow(2,t)},Yq=function(e){return isNaN(e)?NaN:e===0?-1/0:isFinite(e)?(e=Math.abs(e),e<Number.MIN_VALUE?-1074:Math.floor(Math.log2(e))):1/0},bc=function(e){return e},MH=function(e){return e/jL||0};var She=function(){return 1/0},The=function(e){return e==1/0};var Zq=function(e){return MH(e).toFixed(7)},Kq=function(e,t,n){return n===void 0&&(n=1e-15),Math.abs(e-t)<=n};var bT=-1,L1=2,Sc=4,uD=4,Wm=1e-15,ry=2220446049e-25,_T=function(e){if(e<0)return bT;if(The(e))return Cc();var t=2*Math.sin(.5*Math.min(Math.PI,bc(e)));return t*t},$L=function(e){return e>uD?Sc:e},LT=function(e,t){return Ehe(e)?e:Math.max(0,Math.min(uD,e+t))},wT=function(e){return e<0?-1:CH(e)?She():2*Math.asin(.5*Math.sqrt(e))},Cc=function(){return 1/0},CH=function(e){return e==1/0},Ehe=function(e){return e<0||CH(e)};var D1=function(e){return e>=uD?Cc():e<0?0:TH(e,10)};var hD=function(e){return 4.5*ry*e+16*ry*ry};var ey=function(e,t){return _T(wT(e)+wT(t))},Mhe=function(e,t){if(t==0)return e;if(e<=t)return 0;var n=e*(1-.25*t),r=t*(1-.25*e);return Math.max(0,n+r-2*Math.sqrt(n*r))},Che=function(e){return Math.sqrt(RH(e))||0},RH=function(e){return e*(1-.25*e)||0};var eo=(function(){function i(t,n){this.lo=t,this.hi=n}i.fromEndpoints=function(n,r){var s=new i(n,r);return n===-Math.PI&&r!==Math.PI&&(s.lo=Math.PI),r===-Math.PI&&n!==Math.PI&&(s.hi=Math.PI),s},i.fromPointPair=function(n,r){return n===-Math.PI&&(n=Math.PI),r===-Math.PI&&(r=Math.PI),i.positiveDistance(n,r)<=Math.PI?new i(n,r):new i(r,n)},i.emptyInterval=function(){return new i(Math.PI,-Math.PI)},i.fullInterval=function(){return new i(-Math.PI,Math.PI)};var e=i.prototype;return e.isValid=function(){return Math.abs(this.lo)<=Math.PI&&Math.abs(this.hi)<=Math.PI&&!(this.lo===-Math.PI&&this.hi!==Math.PI)&&!(this.hi===-Math.PI&&this.lo!==Math.PI)},e.isFull=function(){return this.lo===-Math.PI&&this.hi===Math.PI},e.isEmpty=function(){return this.lo===Math.PI&&this.hi===-Math.PI},e.isInverted=function(){return this.lo>this.hi},e.equals=function(n){return this.lo==n.lo&&this.hi==n.hi||this.isEmpty()&&n.isEmpty()},e.invert=function(){return new i(this.hi,this.lo)},e.center=function(){var n=.5*(this.lo+this.hi);return this.isInverted()?n<=0?n+Math.PI:n-Math.PI:n},e.length=function(){var n=this.hi-this.lo;return n>=0||(n+=2*Math.PI,n>0)?n:-1},e.fastContains=function(n){return this.isInverted()?(n>=this.lo||n<=this.hi)&&!this.isEmpty():n>=this.lo&&n<=this.hi},e.contains=function(n){return n===-Math.PI&&(n=Math.PI),this.fastContains(n)},e.containsInterval=function(n){return this.isInverted()?n.isInverted()?n.lo>=this.lo&&n.hi<=this.hi:(n.lo>=this.lo||n.hi<=this.hi)&&!this.isEmpty():n.isInverted()?this.isFull()||n.isEmpty():n.lo>=this.lo&&n.hi<=this.hi},e.interiorContains=function(n){return n===-Math.PI&&(n=Math.PI),this.isInverted()?n>this.lo||n<this.hi:n>this.lo&&n<this.hi||this.isFull()},e.interiorContainsInterval=function(n){return this.isInverted()?n.isInverted()?n.lo>this.lo&&n.hi<this.hi||n.isEmpty():n.lo>this.lo||n.hi<this.hi:n.isInverted()?this.isFull()||n.isEmpty():n.lo>this.lo&&n.hi<this.hi||this.isFull()},e.intersects=function(n){return this.isEmpty()||n.isEmpty()?!1:this.isInverted()?n.isInverted()||n.lo<=this.hi||n.hi>=this.lo:n.isInverted()?n.lo<=this.hi||n.hi>=this.lo:n.lo<=this.hi&&n.hi>=this.lo},e.interiorIntersects=function(n){return this.isEmpty()||n.isEmpty()||this.lo===this.hi?!1:this.isInverted()?n.isInverted()||n.lo<this.hi||n.hi>this.lo:n.isInverted()?n.lo<this.hi||n.hi>this.lo:n.lo<this.hi&&n.hi>this.lo||this.isFull()},i.positiveDistance=function(n,r){var s=r-n;return s>=0?s:r+Math.PI-(n-Math.PI)},e.union=function(n){return n.isEmpty()?this:this.fastContains(n.lo)?this.fastContains(n.hi)?this.containsInterval(n)?this:i.fullInterval():new i(this.lo,n.hi):this.fastContains(n.hi)?new i(n.lo,this.hi):this.isEmpty()||n.fastContains(this.lo)?n:i.positiveDistance(n.hi,this.lo)<i.positiveDistance(this.hi,n.lo)?new i(n.lo,this.hi):new i(this.lo,n.hi)},e.intersection=function(n){return n.isEmpty()?i.emptyInterval():this.fastContains(n.lo)?this.fastContains(n.hi)?n.length()<this.length()?n:this:new i(n.lo,this.hi):this.fastContains(n.hi)?new i(this.lo,n.hi):n.fastContains(this.lo)?this:i.emptyInterval()},e.addPoint=function(n){return Math.abs(n)>Math.PI?this:(n===-Math.PI&&(n=Math.PI),this.fastContains(n)?this:this.isEmpty()?new i(n,n):i.positiveDistance(n,this.lo)<i.positiveDistance(this.hi,n)?new i(n,this.hi):new i(this.lo,n))},e.expanded=function(n){if(n>=0){if(this.isEmpty())return this;if(this.length()+2*n+2*ry>=2*Math.PI)return i.fullInterval()}else{if(this.isFull())return this;if(this.length()+2*n-2*ry<=0)return i.emptyInterval()}var r=i.fromEndpoints(hp(this.lo-n,2*Math.PI),hp(this.hi+n,2*Math.PI));return r.lo<=-Math.PI&&(r.lo=Math.PI),r},e.approxEqual=function(n){return this.isEmpty()?n.length()<=2*Wm:n.isEmpty()?this.length()<=2*Wm:this.isFull()?n.length()>=2*(Math.PI-Wm):n.isFull()?this.length()>=2*(Math.PI-Wm):Math.abs(hp(n.lo-this.lo,2*Math.PI))<=Wm&&Math.abs(hp(n.hi-this.hi,2*Math.PI))<=Wm&&Math.abs(this.length()-n.length())<=2*Wm},e.toString=function(){return"["+this.lo.toFixed(7)+", "+this.hi.toFixed(7)+"]"},e.complement=function(){return this.lo===this.hi?i.fullInterval():new i(this.hi,this.lo)},e.complementCenter=function(){return this.lo!==this.hi?this.complement().center():this.hi<=0?this.hi+Math.PI:this.hi-Math.PI},e.directedHausdorffDistance=function(n){if(n.containsInterval(this))return 0;if(n.isEmpty())return Math.PI;var r=n.complementCenter();if(this.contains(r))return i.positiveDistance(n.hi,r);var s=0;i.fromEndpoints(n.hi,r).contains(this.hi)&&(s=i.positiveDistance(n.hi,this.hi));var o=0;return i.fromEndpoints(r,n.lo).contains(this.lo)&&(o=i.positiveDistance(this.lo,n.lo)),Math.max(s,o)},e.project=function(n){if(n===-Math.PI&&(n=Math.PI),this.fastContains(n))return n;var r=i.positiveDistance(n,this.lo),s=i.positiveDistance(this.hi,n);return r<s?this.lo:this.hi},i})();var ul=4,Mc=1,$f=2,Rhe=[[0,1,3,2],[0,3,1,2],[2,3,1,0],[2,1,3,0]],fD=[[0,1,3,2],[0,2,3,1],[3,2,0,1],[3,1,0,2]],M1=[Mc,0,0,$f|Mc],PH=[],IH=[];fp(0,0,0,0,0,0);fp(0,0,0,Mc,0,Mc);fp(0,0,0,$f,0,$f);fp(0,0,0,Mc|$f,0,Mc|$f);function fp(i,e,t,n,r,s){if(i==ul){var o=(e<<ul)+t;IH[(o<<2)+n]=(r<<2)+s,PH[(r<<2)+n]=(o<<2)+s;return}i++,e<<=1,t<<=1,r<<=2;var a=fD[s];fp(i,e+(a[0]>>1),t+(a[0]&1),n,r,s^M1[0]),fp(i,e+(a[1]>>1),t+(a[1]&1),n,r+1,s^M1[1]),fp(i,e+(a[2]>>1),t+(a[2]&1),n,r+2,s^M1[2]),fp(i,e+(a[3]>>1),t+(a[3]&1),n,r+3,s^M1[3])}var Phe=3,LH=6,_i=30,fy=2*_i+1,hl=Number(1n<<BigInt(_i)),mp=BigInt(LH)<<BigInt(fy),Qq=Number(BigInt(hl)<<1n),dp=function(e){return e>Qq?1:e/Qq},Tc=function(e){return e>=.5?1/3*(4*e*e-1):1/3*(1-4*(1-e)*(1-e))},sh=function(e){return e>=0?.5*Math.sqrt(1+3*e):1-.5*Math.sqrt(1-3*e)},ay=function(e){var t=e.largestComponent();switch(t){case Wt.X_AXIS:e.x<0&&(t+=3);break;case Wt.Y_AXIS:e.y<0&&(t+=3);break;case Wt.Z_AXIS:e.z<0&&(t+=3);break}return t},$m=function(e,t){switch(e){case 0:return[t.y/t.x,t.z/t.x];case 1:return[-t.x/t.y,t.z/t.y];case 2:return[-t.x/t.z,-t.y/t.z];case 3:return[t.z/t.x,t.y/t.x];case 4:return[t.z/t.y,-t.x/t.y];default:return[-t.y/t.z,-t.x/t.z]}},ST=function(e){var t=ay(e),n=$m(t,e),r=n[0],s=n[1];return[t,r,s]},oh=function(e,t,n){switch(e){case 0:return new Wt(1,t,n);case 1:return new Wt(-t,1,n);case 2:return new Wt(-t,-n,1);case 3:return new Wt(-1,-n,-t);case 4:return new Wt(n,-1,-t);default:return new Wt(n,t,-1)}},Ihe=function(e,t){switch(e){case 0:if(t.x<=0)return[0,0,!1];break;case 1:if(t.y<=0)return[0,0,!1];break;case 2:if(t.z<=0)return[0,0,!1];break;case 3:if(t.x>=0)return[0,0,!1];break;case 4:if(t.y>=0)return[0,0,!1];break;default:if(t.z>=0)return[0,0,!1];break}var n=$m(e,t),r=n[0],s=n[1];return[r,s,!0]},Ap=function(e,t){switch(e){case 0:return new Wt(t.y,t.z,t.x);case 1:return new Wt(-t.x,t.z,t.y);case 2:return new Wt(-t.x,-t.y,t.z);case 3:return new Wt(-t.z,-t.y,-t.x);case 4:return new Wt(-t.z,t.x,-t.y);default:return new Wt(t.y,t.x,-t.z)}},xT=function(e,t,n){return oh(e,Tc(dp(t)),Tc(dp(n)))},Jq=function(e,t){switch(e){case 0:return new Wt(t,-1,0);case 1:return new Wt(1,t,0);case 2:return new Wt(1,0,t);case 3:return new Wt(-t,0,1);case 4:return new Wt(0,-t,1);default:return new Wt(0,-1,-t)}},eH=function(e,t){switch(e){case 0:return new Wt(-t,0,1);case 1:return new Wt(0,-t,1);case 2:return new Wt(0,-1,-t);case 3:return new Wt(t,-1,0);case 4:return new Wt(1,t,0);default:return new Wt(1,0,t)}},Lhe=[[new Wt(0,1,0),new Wt(0,0,1),new Wt(1,0,0)],[new Wt(-1,0,0),new Wt(0,0,1),new Wt(0,1,0)],[new Wt(-1,0,0),new Wt(0,-1,0),new Wt(0,0,1)],[new Wt(0,0,-1),new Wt(0,-1,0),new Wt(-1,0,0)],[new Wt(0,0,-1),new Wt(1,0,0),new Wt(0,-1,0)],[new Wt(0,1,0),new Wt(1,0,0),new Wt(0,0,-1)]],Dhe=[[[4,1],[5,2],[3,0]],[[0,3],[5,2],[4,1]],[[0,3],[1,4],[5,2]],[[2,5],[1,4],[0,3]],[[2,5],[3,0],[1,4]],[[4,1],[3,0],[2,5]]],DH=function(e,t){return Lhe[e][t]},TT=function(e,t,n){return Dhe[e][t][n]},Nhe=function(e){return DH(e,0)},Fhe=function(e){return DH(e,1)},YL=Math.PI/2,tH=-YL,ar=(function(){function i(t,n){this.lat=t,this.lng=n}i.fromDegrees=function(n,r){return new i(n*jL,r*jL)},i.latitude=function(n){var r=n.vector;return Math.atan2(r.z,Math.sqrt(r.x*r.x+r.y*r.y))},i.longitude=function(n){return Math.atan2(n.vector.y,n.vector.x)},i.fromPoint=function(n){return new i(this.latitude(n),this.longitude(n))};var e=i.prototype;return e.isValid=function(){return Math.abs(this.lat)<=Math.PI/2&&Math.abs(this.lng)<=Math.PI},e.normalized=function(){var n=this.lat;n>YL?n=YL:n<tH&&(n=tH);var r=hp(this.lng,2*Math.PI);return new i(n,r)},e.toString=function(){return"["+Zq(this.lat)+", "+Zq(this.lng)+"]"},e.distance=function(n){var r=Math.sin(.5*(n.lat-this.lat)),s=Math.sin(.5*(n.lng-this.lng)),o=r*r+s*s*Math.cos(this.lat)*Math.cos(n.lat);return 2*Math.atan2(Math.sqrt(o),Math.sqrt(Math.max(0,1-o)))},e.approxEqual=function(n){return Kq(this.lat,n.lat)&&Kq(this.lng,n.lng)},i})(),Bhe=function(e,t){return new We(e[0][t],e[1][t],e[2][t])},OL=function(e,t,n){return e[0][t]=n.x,e[1][t]=n.y,e[2][t]=n.z,e},NH=function(e,t){return new We(e[0][0]*t.x+e[0][1]*t.y+e[0][2]*t.z,e[1][0]*t.x+e[1][1]*t.y+e[1][2]*t.z,e[2][0]*t.x+e[2][1]*t.y+e[2][2]*t.z)},Ohe=function(e){return[[e[0][0],e[1][0],e[2][0]],[e[0][1],e[1][1],e[2][1]],[e[0][2],e[1][2],e[2][2]]]},dD=function(e){var t=[[0,0,0],[0,0,0],[0,0,0]];return OL(t,2,e),OL(t,1,We.ortho(e)),OL(t,0,We.fromVector(Bhe(t,1).vector.cross(e.vector))),t},Uhe=function(e,t){return NH(Ohe(e),t)},khe=function(e,t){return NH(e,t)},ET=-1,Xf=0,O1=1,FH=1e-15,Ki=2220446049250313e-31,nH=1.8274*Ki,zhe=3.2321*Ki,ZL=function(e,t,n){return n.vector.cross(e.vector).dot(t.vector)>0},jm=function(e,t,n){var r=KL(e,t,n);return r===Xf&&(r=QL(e,t,n)),r},Vhe=function(e,t,n){var r=t.vector.sub(e.vector),s=r.norm2(),o=n.vector.sub(t.vector),a=o.norm2(),l=e.vector.sub(n.vector),c=l.norm2(),u,f,d;s>=a&&s>=c?(u=l,f=o,d=n.vector):a>=c?(u=r,f=l,d=e.vector):(u=o,f=r,d=t.vector);var A=-u.cross(f).dot(d),y=zhe*Math.sqrt(u.norm2()*f.norm2());return A>y?O1:A<-y?ET:Xf},KL=function(e,t,n){var r=e.vector.cross(t.vector).dot(n.vector);return r>nH?O1:r<-nH?ET:Xf},QL=function(e,t,n){if(e.equals(t)||t.equals(n)||n.equals(e))return Xf;var r=Vhe(e,t,n);return r!==Xf?r:Ghe(e,t,n,!0)},Ghe=function(e,t,n,r){var s=O1,o=e,a=t,l=n;if(o.vector.cmp(a.vector)>0){var c=[a,o];o=c[0],a=c[1],s=-s}if(a.vector.cmp(l.vector)>0){var u=[l,a];a=u[0],l=u[1],s=-s}if(o.vector.cmp(a.vector)>0){var f=[a,o];o=f[0],a=f[1],s=-s}var d=BL.fromVector(o.vector),A=BL.fromVector(a.vector),y=BL.fromVector(l.vector),w=A.cross(y),S=d.dot(w),T=S.getSign();return T===Xf&&r&&(T=qhe(d,A,y,w)),s*T},qhe=function(e,t,n,r){var s=r.z.getSign();return s!==0||(s=r.y.getSign(),s!==0)||(s=r.x.getSign(),s!==0)||(s=n.x.mul(e.y).sub(n.y.mul(e.x)).getSign(),s!==0)||(s=n.x.getSign(),s!==0)||(s=-n.y.getSign(),s!==0)||(s=n.z.mul(e.x).sub(n.x.mul(e.z)).getSign(),s!==0)||(s=n.z.getSign(),s!==0)||(s=e.x.mul(t.y).sub(e.y.mul(t.x)).getSign(),s!==0)||(s=-t.x.getSign(),s!==0)||(s=t.y.getSign(),s!==0)||(s=e.x.getSign(),s!==0)?s:O1},We=(function(){function i(t,n,r){this.vector=new Wt(t,n,r)}i.fromVector=function(n){return new i(n.x,n.y,n.z)},i.fromLatLng=function(n){var r=n.lat,s=n.lng,o=Math.cos(r);return new i(Math.cos(s)*o,Math.sin(s)*o,Math.sin(r))},i.fromCoords=function(n,r,s){return n===0&&r===0&&s===0?this.originPoint():i.fromVector(new Wt(n,r,s).normalize())},i.originPoint=function(){return new i(-.00999946643502502,.002592454260932412,.999946643502502)};var e=i.prototype;return e.pointCross=function(n){var r=this.vector.add(n.vector).cross(n.vector.sub(this.vector));return r.x===0&&r.y===0&&r.z===0&&(r=this.vector.ortho()),i.fromVector(r)},i.orderedCCW=function(n,r,s,o){var a=0;return jm(r,o,n)!==ET&&a++,jm(s,o,r)!==ET&&a++,jm(n,o,s)===O1&&a++,a>=2},e.distance=function(n){return this.vector.angle(n.vector)},e.equals=function(n){return this.vector.equals(n.vector)},e.approxEqual=function(n,r){return r===void 0&&(r=FH),this.vector.angle(n.vector)<=r},e.stableAngle=function(n){return 2*Math.atan2(this.vector.sub(n.vector).norm(),this.vector.add(n.vector).norm())},i.chordAngleBetweenPoints=function(n,r){return Math.min(4,n.vector.sub(r.vector).norm2())},i.regularPoints=function(n,r,s){return this.regularPointsForFrame(dD(n),r,s)},i.regularPointsForFrame=function(n,r,s){for(var o=Math.cos(r),a=Math.sin(r),l=2*Math.PI/s,c=[],u=0;u<s;u++){var f=u*l,d=new i(a*Math.cos(f),a*Math.sin(f),o);c.push(i.fromVector(khe(n,d).vector.normalize()))}return c},e.containsCell=function(n){return!1},e.intersectsCell=function(n){return n.containsPoint(this)},e.containsPoint=function(n){return this.contains(n)},e.cellUnionBound=function(){return[k1(this)]},e.contains=function(n){return this.equals(n)},e.referenceDir=function(){return i.ortho(this)},e.toString=function(){return this.vector.toString()},i.ortho=function(n){var r=n.vector.largestComponent(),s=new Wt(.012,.0053,.00457);return r===Wt.X_AXIS?s.z=1:r===Wt.Y_AXIS?s.x=1:s.y=1,i.fromVector(n.vector.cross(s).normalize())},i.sortPoints=function(n){n.sort(function(r,s){return r.vector.cmp(s.vector)})},vhe(i,[{key:"x",get:function(){return this.vector.x}},{key:"y",get:function(){return this.vector.y}},{key:"z",get:function(){return this.vector.z}}])})(),MT=function(e,t,n){return e<t?t:e>n?n:e},Hhe=function(e){for(var t=e,n=arguments.length,r=new Array(n>1?n-1:0),s=1;s<n;s++)r[s-1]=arguments[s];for(var o=0,a=r;o<a.length;o++){var l=a[o];l>t&&(t=l)}return t},Whe=function(e){for(var t=e,n=arguments.length,r=new Array(n>1?n-1:0),s=1;s<n;s++)r[s-1]=arguments[s];for(var o=0,a=r;o<a.length;o++){var l=a[o];l<t&&(t=l)}return t},jhe=function(e){return e<0n?-e:e},JL=function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];return Hhe.apply(void 0,[e].concat(n))},UL=function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];return Whe.apply(void 0,[e].concat(n))},eD=function(e,t){for(var n=0,r=e;n<r;){var s=Math.floor((n+r)/2);t(s)?r=s:n=s+1}return n},fl=(1n<<64n)-1n,uu=function(e){return Number(e>>BigInt(fy))},Xhe=function(e){return e&fl>>BigInt(Phe)},to=function(e){return _i-(whe(e)>>>1)},Sr=function(e,t){var n=Ym(t);return e&-n|n},pD=function(e){var t=ls(e)<<2n;return e&-t|t},dy=function(e){return(e&Ym(0)-1n)===0n},ly=function(e){return typeof e!="bigint"||BigInt.asUintN(64,e)!=e?!1:uu(e)<=LH&&(ls(e)&0x1555555555555555n)!=0n},mD=function(e){return(e&1n)!=0n},BH=function(e,t){return Number(e>>2n*BigInt(_i-t)+1n)&3},ls=function(e){return e&-e},Ym=function(e){return 1n<<BigInt(2*(_i-e))},U1=function(e){var t=[e,e,e,e],n=ls(e);return t[0]=e-n+(n>>2n),n>>=1n,t[1]=t[0]+n,t[2]=t[1]+n,t[3]=t[2]+n,t},OH=function(e,t){var n=[],r=yp(e),s=r.f,o=r.i,a=r.j,l=Ra(to(e));o&=-l,a&=-l;for(var c=Ra(t),u=-c;;u+=c){var f=void 0;if(u<0?f=a+u>=0:u>=l?f=a+u<hl:(f=!0,n.push(Sr(pp(s,o+u,a-c,a-l>=0),t)),n.push(Sr(pp(s,o+u,a+l,a+l<hl),t))),n.push(Sr(pp(s,o-c,a+u,f&&o-l>=0),t)),n.push(Sr(pp(s,o+l,a+u,f&&o+l<hl),t)),u>=l)break}return n},qi=function(e){return e-(ls(e)-1n)},Gi=function(e){return e+(ls(e)-1n)},Xm=function(e,t){return qi(e)<=t&&t<=Gi(e)},UH=function(e,t){return qi(t)<=Gi(e)&&Gi(t)>=qi(e)},$he=function(e){var t=e.toString(16).padStart(16,"0").replace(/0+$/,"");return t.length===0?"X":t},Yhe=function(e){if(e.length>16||!/^[A-F0-9]+$/i.test(e))return 0n;var t=BigInt("0x"+e);return e.length<16&&(t=t<<BigInt(4*(16-e.length))),t},Zhe=function(e){if(!ly(e))return"Invalid: "+e.toString(16);for(var t=uu(e)+"/",n=1;n<=to(e);n++)t+=BH(e,n);return t},Khe=function(e){var t=e.length-2;if(t<0||t>_i)return 0n;var n=parseInt(e[0],10);if(isNaN(n)||n<0||n>5||e[1]!=="/")return 0n;for(var r=vp(n),s=2;s<e.length;s++){var o=parseInt(e[s],10);if(isNaN(o)||o<0||o>3)return 0n;r=U1(r)[o]}return r},Qhe=function(e,t,n){return Sr((BigInt(e)<<BigInt(fy))+(t||1n),n)},vp=function(e){return(BigInt(e)<<BigInt(fy))+Ym(0)},k1=function(e){var t=ST(e.vector),n=t[0],r=t[1],s=t[2],o=zl(sh(r)),a=zl(sh(s));return py(n,o,a)},kH=function(e){return k1(We.fromLatLng(e))},zl=function(e){return MT(Math.floor(hl*e),0,hl-1)},Ra=function(e){return 1<<MT(_i-e,0,_i)},zH=function(e){return C1(Ra(e))},C1=function(e){return e/hl},VH=function(e){var t=AD(e),n=t.si,r=t.ti;return new Ci(Tc(dp(n)),Tc(dp(r)))},Jhe=function(e){var t=yp(e),n=t.i,r=t.j;return DT(n,r,to(e))},py=function(e,t,n){for(var r=BigInt(e)<<BigInt(fy-1),s=e&Mc,o=7;o>=0;o--){var a=(1<<ul)-1;s+=(t>>o*ul&a)<<ul+2,s+=(n>>o*ul&a)<<2,s=IH[s],r|=BigInt(s>>2)<<BigInt(o*2*ul),s&=Mc|$f}return r*2n+1n},R1=function(e,t,n){t=MT(t,-1,hl),n=MT(n,-1,hl);var r=1/hl,s=TH(1,2),o=Math.max(-s,Math.min(s,r*(Number(BigInt(t)<<1n)+1-hl))),a=Math.max(-s,Math.min(s,r*(Number(BigInt(n)<<1n)+1-hl))),l=ST(oh(e,o,a));return e=l[0],o=l[1],a=l[2],py(e,zl(.5*(o+1)),zl(.5*(a+1)))},pp=function(e,t,n,r){return r?py(e,t,n):R1(e,t,n)},yp=function(e){for(var t=uu(e),n=t&Mc,r=_i-7*ul,s=0,o=0,a=7;a>=0;a--)n+=Number((e>>BigInt(a*2*ul+1)&(1n<<BigInt(2*r))-1n)<<2n),n=PH[n],s+=n>>ul+2<<a*ul,o+=(n>>2&(1<<ul)-1)<<a*ul,n&=Mc|$f,r=ul;return(ls(e)&BigInt("0x1111111111111110"))!=0n&&(n^=Mc),{f:t,i:s,j:o,orientation:n}},AD=function(e){var t=yp(e),n=t.f,r=t.i,s=t.j,o=0;return mD(e)?o=1:((BigInt(r)^e>>2n)&1n)!=0n&&(o=2),{face:n,si:2*r+o,ti:2*s+o}},DT=function(e,t,n){var r=Ra(n),s=e&-r,o=t&-r;return new Hr(new Li(Tc(C1(s)),Tc(C1(s+r))),new Li(Tc(C1(o)),Tc(C1(o+r))))},efe=function(e){return e>>2n*BigInt(_i-to(e))+1n},my=function(e){var t=AD(e),n=t.face,r=t.si,s=t.ti;return xT(n,r,s)},gD=function(e){return We.fromVector(my(e).normalize())},tfe=function(e){return ar.fromPoint(We.fromVector(my(e)))},nfe=function(e){var t=to(e),n=Ra(t),r=yp(e),s=r.f,o=r.i,a=r.j;return[Sr(R1(s,o,a-n),t),Sr(R1(s,o+n,a),t),Sr(R1(s,o,a+n),t),Sr(R1(s,o-n,a),t)]},GH=function(e,t){var n=Ra(t+1),r=n<<1,s=yp(e),o=s.f,a=s.i,l=s.j,c=!1,u=!1,f=0,d=0;(a&n)!=0?(f=r,c=a+r<hl):(f=-r,c=a-r>=0),(l&n)!=0?(d=r,u=l+r<hl):(d=-r,u=l-r>=0);var A=[Sr(e,t),Sr(pp(o,a+f,l,c),t),Sr(pp(o,a,l+d,u),t)];return(c||u)&&A.push(Sr(pp(o,a+f,l+d,c&&u),t)),A},vD=function(e){var t=ls(e);return e-t+(t>>2n)},Ay=function(e,t){return e-ls(e)+Ym(t)},qH=function(e){var t=ls(e);return e+t+(t>>2n)},NT=function(e,t){return e+ls(e)+Ym(t)},Ia=function(e){return e+(ls(e)<<1n)&fl},HH=function(e){return e-(ls(e)<<1n)&fl},ife=function(e){var t=Ia(e);return t<mp?t:t-mp&fl},rfe=function(e){var t=HH(e);return t<mp?t:t+mp&fl},sfe=function(e,t){if(t===0n)return e;var n=BigInt(2*(_i-to(e))+1);if(t<0n){var r=-(e>>n);if(t<r){var s=mp>>n;t%=s,t<r&&(t+=s)}}else{var o=mp-e>>n;if(t>o){var a=mp>>n;t%=a,t>o&&(t-=a)}}return e+(t<<jhe(n))},cy=function(e,t){var n=e^t;n<ls(e)&&(n=ls(e)),n<ls(t)&&(n=ls(t));var r=EH(n);return r>60?[0,!1]:[60-r>>1,!0]},tD=function(e,t){var n=qi(e);if(n>=qi(t))return t;if(Gi(e)>=t){for(;e=U1(e)[0],!(Gi(e)<t););return e}for(;!dy(e);){var r=pD(e);if(qi(r)!==n||Gi(r)>=t)break;e=r}return e},ofe=function(e,t){if(t===0n)return e;var n=BigInt(2*(_i-to(e))+1);if(t<0n){var r=-(e>>n);t<r&&(t=r)}else{var s=mp+ls(e)-e>>n;t>s&&(t=s)}return e+(t<<n)},nD=function(e,t){return e<t?-1:e>t?1:0},afe=function(e,t){return e>t?-1:e<t?1:0},lfe={__proto__:null,SentinelCellID:fl,face:uu,pos:Xhe,level:to,parent:Sr,immediateParent:pD,isFace:dy,valid:ly,isLeaf:mD,childPosition:BH,lsb:ls,lsbForLevel:Ym,children:U1,allNeighbors:OH,rangeMin:qi,rangeMax:Gi,contains:Xm,intersects:UH,toToken:$he,fromToken:Yhe,toString:Zhe,fromString:Khe,fromFacePosLevel:Qhe,fromFace:vp,fromPoint:k1,fromLatLng:kH,stToIJ:zl,sizeIJ:Ra,sizeST:zH,ijToSTMin:C1,centerUV:VH,boundUV:Jhe,fromFaceIJ:py,fromFaceIJWrap:R1,fromFaceIJSame:pp,faceIJOrientation:yp,faceSiTi:AD,ijLevelToBoundUV:DT,distanceFromBegin:efe,rawPoint:my,point:gD,latLng:tfe,edgeNeighbors:nfe,vertexNeighbors:GH,childBegin:vD,childBeginAtLevel:Ay,childEnd:qH,childEndAtLevel:NT,next:Ia,prev:HH,nextWrap:ife,prevWrap:rfe,advanceWrap:sfe,commonAncestorLevel:cy,maxTile:tD,advance:ofe,ascending:nD,descending:afe},Gl=(function(){function i(t,n){var r=t.pointCross(n);this.a=t,this.b=n,this.aXb=We.fromVector(t.vector.cross(n.vector)),this.aTangent=We.fromVector(t.vector.cross(r.vector)),this.bTangent=We.fromVector(r.vector.cross(n.vector)),this.c=new We(0,0,0),this.acb=Ec}i.newChainEdgeCrosser=function(n,r,s){var o=new i(n,r);return o.restartAt(s),o};var e=i.prototype;return e.crossingSign=function(n,r){return n.equals(this.c)||this.restartAt(n),this.chainCrossingSign(r)},e.edgeOrVertexCrossing=function(n,r){return n.equals(this.c)||this.restartAt(n),this.edgeOrVertexChainCrossing(r)},e.restartAt=function(n){this.c=n,this.acb=-KL(this.a,this.b,this.c)},e.chainCrossingSign=function(n){var r=KL(this.a,this.b,n);return this.acb===-r&&r!==Xf?(this.c=n,this.acb=-r,Vl):this._crossingSign(n,r)},e.edgeOrVertexChainCrossing=function(n){var r=We.fromVector(this.c.vector);switch(this.chainCrossingSign(n)){case Vl:return!1;case Ec:return!0}return jH(this.a,this.b,r,n)},e._crossingSign=function(n,r){var s=(1.5+1/Math.sqrt(3))*Ki;if(this.c.vector.dot(this.aTangent.vector)>s&&n.vector.dot(this.aTangent.vector)>s||this.c.vector.dot(this.bTangent.vector)>s&&n.vector.dot(this.bTangent.vector)>s)return this.c=n,this.acb=-r,Vl;if(this.a.equals(this.c)||this.a.equals(n)||this.b.equals(this.c)||this.b.equals(n))return this.c=n,this.acb=-r,CT;if(this.a.equals(this.b)||this.c.equals(n))return this.c=n,this.acb=-r,Vl;if(this.acb===Xf&&(this.acb=-QL(this.a,this.b,this.c)),r===Xf&&(r=QL(this.a,this.b,n)),r!==this.acb)return this.c=n,this.acb=-r,Vl;var o=-jm(this.c,n,this.b);if(o!==this.acb)return this.c=n,this.acb=-r,Vl;var a=jm(this.c,n,this.a);return a!==this.acb?(this.c=n,this.acb=-r,Vl):(this.c=n,this.acb=-r,Ec)},i})(),Ec=0,CT=1,Vl=2,WH=function(e,t,n,r){var s=Gl.newChainEdgeCrosser(e,t,n);return s.chainCrossingSign(r)},jH=function(e,t,n,r){if(e.equals(t)||n.equals(r))return!1;switch(!0){case e.equals(n):return t.equals(r)||We.orderedCCW(e.referenceDir(),r,t,e);case t.equals(r):return We.orderedCCW(t.referenceDir(),n,e,t);case e.equals(r):return t.equals(n)||We.orderedCCW(e.referenceDir(),n,t,e);case t.equals(n):return We.orderedCCW(t.referenceDir(),r,e,t)}return!1},cfe=function(e,t,n){return!We.orderedCCW(t.referenceDir(),n,e,t)},Ri=(function(){function i(t,n){this.lat=t,this.lng=n}i.emptyRect=function(){return new i(Li.empty(),eo.emptyInterval())},i.fullRect=function(){return new i(i.validRectLatRange,i.validRectLngRange)},i.fromLatLng=function(n){return new i(new Li(bc(n.lat),bc(n.lat)),new eo(bc(n.lng),bc(n.lng)))},i.fromCenterSize=function(n,r){var s=new ar(r.lat/2,r.lng/2);return i.fromLatLng(n).expanded(s)};var e=i.prototype;return e.equals=function(n){return this.lat.equals(n.lat)&&this.lng.equals(n.lng)},e.isValid=function(){return Math.abs(this.lat.lo)<=Math.PI/2&&Math.abs(this.lat.hi)<=Math.PI/2&&this.lng.isValid()&&this.lat.isEmpty()===this.lng.isEmpty()},e.isEmpty=function(){return this.lat.isEmpty()},e.isFull=function(){return this.lat.equals(i.validRectLatRange)&&this.lng.isFull()},e.isPoint=function(){return this.lat.lo===this.lat.hi&&this.lng.lo===this.lng.hi},e.vertex=function(n){var r,s;switch(n){case 0:r=this.lat.lo,s=this.lng.lo;break;case 1:r=this.lat.lo,s=this.lng.hi;break;case 2:r=this.lat.hi,s=this.lng.hi;break;default:r=this.lat.hi,s=this.lng.lo;break}return new ar(r,s)},e.lo=function(){return new ar(this.lat.lo,this.lng.lo)},e.hi=function(){return new ar(this.lat.hi,this.lng.hi)},e.center=function(){return new ar(this.lat.center(),this.lng.center())},e.size=function(){return new ar(this.lat.length(),this.lng.length())},e.area=function(){if(this.isEmpty())return 0;var n=Math.abs(Math.sin(this.lat.hi)-Math.sin(this.lat.lo));return this.lng.length()*n},e.addPoint=function(n){return n.isValid()?new i(this.lat.addPoint(bc(n.lat)),this.lng.addPoint(bc(n.lng))):this},e.expanded=function(n){var r=this.lat.expanded(bc(n.lat)),s=this.lng.expanded(bc(n.lng));return r.isEmpty()||s.isEmpty()?i.emptyRect():new i(r.intersection(i.validRectLatRange),s)},e.toString=function(){return"[Lo"+this.lo()+", Hi"+this.hi()+"]"},e.polarClosure=function(){return this.lat.lo===-Math.PI/2||this.lat.hi===Math.PI/2?new i(this.lat,eo.fullInterval()):this},e.union=function(n){return new i(this.lat.union(n.lat),this.lng.union(n.lng))},e.intersection=function(n){var r=this.lat.intersection(n.lat),s=this.lng.intersection(n.lng);return r.isEmpty()||s.isEmpty()?i.emptyRect():new i(r,s)},e.intersects=function(n){return this.lat.intersects(n.lat)&&this.lng.intersects(n.lng)},e.capBound=function(){if(this.isEmpty())return gp.emptyCap();var n,r;this.lat.hi+this.lat.lo<0?(n=-1,r=Math.PI/2+this.lat.hi):(n=1,r=Math.PI/2-this.lat.lo);var s=gp.fromCenterAngle(new We(0,0,n),r);if(hp(this.lng.hi-this.lng.lo,2*Math.PI)>=0&&this.lng.hi-this.lng.lo<2*Math.PI){var o=gp.fromPoint(We.fromLatLng(this.center())).addPoint(We.fromLatLng(this.lo())).addPoint(We.fromLatLng(this.hi()));if(o.height()<s.height())return o}return s},e.rectBound=function(){return this},e.contains=function(n){return this.lat.containsInterval(n.lat)&&this.lng.containsInterval(n.lng)},e.containsCell=function(n){return this.contains(n.rectBound())},e.containsLatLng=function(n){return n.isValid()?this.lat.contains(bc(n.lat))&&this.lng.contains(bc(n.lng)):!1},e.containsPoint=function(n){return this.containsLatLng(ar.fromPoint(n))},e.cellUnionBound=function(){return this.capBound().cellUnionBound()},e.approxEqual=function(n){return this.lat.approxEqual(n.lat)&&this.lng.approxEqual(n.lng)},i.bisectorIntersection=function(n,r){r=Math.abs(r);var s=n.center(),o=new ar(s-Math.PI/2,r);s<0&&(o=new ar(-s-Math.PI/2,r-Math.PI));var a=new We(0,-1,0);return a.pointCross(We.fromLatLng(o))},e.centroid=function(){if(this.isEmpty())return new We(0,0,0);var n=Math.sin(this.lat.lo),r=Math.sin(this.lat.hi),s=Math.cos(this.lat.lo),o=Math.cos(this.lat.hi),a=.5*this.lng.length(),l=Math.sin(a)*(o*r-s*n+this.lat.length()),c=this.lng.center(),u=a*(r+n)*(r-n);return new We(l*Math.cos(c),l*Math.sin(c),u)},e.intersectsCell=function(n){if(this.isEmpty())return!1;if(this.containsPoint(We.fromVector(my(n.id)))||n.containsPoint(We.fromLatLng(this.center())))return!0;if(!this.intersects(n.rectBound()))return!1;for(var r=[],s=[],o=0;o<4;o++){var a=n.vertex(o);r.push(a);var l=ar.fromPoint(a);if(s.push(l),this.containsLatLng(l)||n.containsPoint(We.fromLatLng(this.vertex(o))))return!0}for(var c=0;c<4;c++){var u=eo.fromEndpoints(s[c].lng,s[c+1&3].lng);if(this.lng.intersects(u)){var f=r[c],d=r[c+1&3];if(u.contains(this.lng.lo)&&rH(f,d,this.lat,this.lng.lo)||u.contains(this.lng.hi)&&rH(f,d,this.lat,this.lng.hi)||iH(f,d,this.lat.lo,this.lng)||iH(f,d,this.lat.hi,this.lng))return!0}}return!1},i})();Ri.validRectLatRange=new Li(-Math.PI/2,Math.PI/2);Ri.validRectLngRange=eo.fullInterval();var iH=function(e,t,n,r){var s=e.vector.cross(t.vector).normalize();s.z<0&&(s=s.mul(-1));var o=s.cross(We.fromCoords(0,0,1).vector).normalize(),a=o.cross(s),l=Math.sin(bc(n));if(Math.abs(l)>=a.z)return!1;var c=l/a.z,u=Math.sqrt(1-c*c),f=Math.atan2(u,c),d=eo.fromPointPair(Math.atan2(e.vector.dot(o),e.vector.dot(a)),Math.atan2(t.vector.dot(o),t.vector.dot(a)));if(d.contains(f)){var A=a.mul(c).add(o.mul(u));if(r.contains(Math.atan2(A.y,A.x)))return!0}if(d.contains(-f)){var y=a.mul(c).sub(o.mul(u));if(r.contains(Math.atan2(y.y,y.x)))return!0}return!1},rH=function(e,t,n,r){return WH(e,t,We.fromLatLng(new ar(n.lo,r)),We.fromLatLng(new ar(n.hi,r)))===Ec},_D=(function(){function i(t,n){this.dim=t,this.deriv=n}var e=i.prototype;return e.value=function(n){return XL(this.deriv,-this.dim*n)},e.minLevel=function(n){if(n<=0)return _i;var r=-(Yq(n/this.deriv)>>this.dim-1);return r>_i&&(r=_i),r<0&&(r=0),r||0},e.maxLevel=function(n){if(n<=0)return _i;var r=Yq(this.deriv/n)>>this.dim-1;return r>_i&&(r=_i),r<0&&(r=0),r||0},e.closestLevel=function(n){var r=Math.SQRT2;return this.dim===2&&(r=2),this.minLevel(r*n)},i})(),iD=new _D(1,2*Math.SQRT2/3),ufe=new _D(1,1.4592137463861061),rD=new _D(2,4*Math.PI/6),hfe=function(e,t,n){return wT(xD(e,t,n,0,!0).dist)},hu=function(e,t,n,r){return xD(e,t,n,r,!1)},sH=function(e,t,n,r){var s=JL(We.chordAngleBetweenPoints(e,t),We.chordAngleBetweenPoints(e,n));if(s>L1){var o=xD(We.fromVector(e.vector.mul(-1)),t,n,s,!0);s=o.dist,s=Sc-s}return r<s?{dist:s,less:!0}:{dist:r,less:!1}},XH=function(e,t,n){var r=t.pointCross(n),s=e.vector.sub(r.vector.mul(e.vector.dot(r.vector)/r.vector.norm2()));return ZL(r,t,We.fromVector(s))&&ZL(We.fromVector(s),n,r)?We.fromVector(s.normalize()):e.vector.sub(t.vector).norm2()<=e.vector.sub(n.vector).norm2()?t:n},$H=function(e,t,n){var r=e,s=t.pointCross(n),o=s.vector.cross(t.vector);return We.fromVector(t.vector.mul(Math.cos(r)).add(o.mul(Math.sin(r)/o.norm())).normalize())},ffe=function(e){return Math.max(dfe(e),hD(e))},dfe=function(e){if(e>=L1)return 0;var t=Math.min(1,.5*e),n=Math.sqrt(t*(2-t));return((2.5+2*Math.sqrt(3)+8.5*n)*n+(2+2*Math.sqrt(3)/3+6.5*(1-t))*t+(23+16/Math.sqrt(3))*Ki)*Ki},xD=function(e,t,n,r,s){var o=pfe(e,t,n,r,s),a=o.dist,l=o.less;if(l)return{dist:a,less:!0};var c=e.vector.sub(t.vector).norm2(),u=e.vector.sub(n.vector).norm2(),f=Math.min(c,u);return!s&&f>=r?{dist:r,less:!1}:{dist:f,less:!0}},pfe=function(e,t,n,r,s){var o=e.vector.sub(t.vector).norm2(),a=e.vector.sub(n.vector).norm2(),l=t.vector.sub(n.vector).norm2(),c=4.75*Ki*(o+a+l)+8*Ki*Ki;if(Math.abs(o-a)>=l+c)return{dist:r,less:!1};var u=t.pointCross(n),f=u.vector.norm2(),d=e.vector.dot(u.vector),A=d*d;if(!s&&A>f*r)return{dist:r,less:!1};var y=u.vector.cross(e.vector);if(t.vector.sub(e.vector).dot(y)>=0||n.vector.sub(e.vector).dot(y)<=0)return{dist:r,less:!1};var w=1-Math.sqrt(y.norm2()/f),S=A/f+w*w;return!s&&S>=r?{dist:r,less:!1}:{dist:S,less:!0}},oH=We.fromCoords(1,0,0),gp=(function(){function i(t,n){this.center=t,this.rad=n}i.fromPoint=function(n){return i.fromCenterChordAngle(n,0)},i.fromCenterAngle=function(n,r){return i.fromCenterChordAngle(n,_T(r))},i.fromCenterChordAngle=function(n,r){return new i(n,r)},i.fromCenterHeight=function(n,r){return i.fromCenterChordAngle(n,$L(2*r))},i.fromCenterArea=function(n,r){return i.fromCenterChordAngle(n,$L(r/Math.PI))},i.fromCap=function(n){return new i(We.fromVector(n.center.vector),n.rad)},i.emptyCap=function(){return i.fromCenterChordAngle(oH,bT)},i.fullCap=function(){return i.fromCenterChordAngle(oH,Sc)};var e=i.prototype;return e.isValid=function(){return this.center.vector.isUnit()&&this.rad<=Sc},e.isEmpty=function(){return this.rad<0},e.isFull=function(){return this.rad==Sc},e.centerPoint=function(){return this.center},e.height=function(){return .5*this.rad},e.radius=function(){return wT(this.rad)},e.area=function(){return 2*Math.PI*Math.max(0,this.height())},e.contains=function(n){return this.isFull()||n.isEmpty()?!0:this.rad>=ey(We.chordAngleBetweenPoints(this.center,n.center),n.rad)},e.intersects=function(n){return this.isEmpty()||n.isEmpty()?!1:ey(this.rad,n.rad)>=We.chordAngleBetweenPoints(this.center,n.center)},e.interiorIntersects=function(n){return this.rad<=0||n.isEmpty()?!1:ey(this.rad,n.rad)>We.chordAngleBetweenPoints(this.center,n.center)},e.intersectsCell=function(n){for(var r=[],s=0;s<4;s++)if(r[s]=n.vertex(s),this.containsPoint(r[s]))return!0;return this._intersects(n,r)},e._intersects=function(n,r){if(this.rad>=L1||this.isEmpty())return!1;if(n.containsPoint(this.center))return!0;for(var s=RH(this.rad),o=0;o<4;o++){var a=n.edge(o).vector,l=this.center.vector.dot(a);if(!(l>0)){if(l*l>s*a.norm2())return!1;var c=a.cross(this.center.vector);if(c.dot(r[o].vector)<0&&c.dot(r[o+1&3].vector)>0)return!0}}return!1},e.containsPoint=function(n){return We.chordAngleBetweenPoints(this.center,n)<=this.rad},e.containsCell=function(n){for(var r=[],s=0;s<4;s++)if(r[s]=n.vertex(s),!this.containsPoint(r[s]))return!1;return!this.complement()._intersects(n,r)},e.interiorContainsPoint=function(n){return this.isFull()||We.chordAngleBetweenPoints(this.center,n)<this.rad},e.complement=function(){return this.isFull()?i.emptyCap():this.isEmpty()?i.fullCap():i.fromCenterChordAngle(We.fromVector(this.center.vector.mul(-1)),Mhe(Sc,this.rad))},e.capBound=function(){return this},e.rectBound=function(){if(this.isEmpty())return Ri.emptyRect();var n=this.radius(),r=!1,s=new Li(ar.latitude(this.center)-n,ar.latitude(this.center)+n),o=eo.fullInterval();if(s.lo<=-Math.PI/2&&(s.lo=-Math.PI/2,r=!0),s.hi>=Math.PI/2&&(s.hi=Math.PI/2,r=!0),!r){var a=Che(this.rad),l=Math.cos(ar.latitude(this.center));if(a<=l){var c=Math.asin(a/l);o.lo=hp(ar.longitude(this.center)-c,Math.PI*2),o.hi=hp(ar.longitude(this.center)+c,Math.PI*2)}}return new Ri(s,o)},e.equals=function(n){return this.rad===n.rad&&this.center.equals(n.center)||this.isEmpty()&&n.isEmpty()||this.isFull()&&n.isFull()},e.approxEqual=function(n){var r=1e-14,s=this.rad,o=n.rad;return this.center.approxEqual(n.center)&&Math.abs(s-o)<=r||this.isEmpty()&&o<=r||n.isEmpty()&&s<=r||this.isFull()&&o>=2-r||n.isFull()&&s>=2-r},e.addPoint=function(n){if(this.isEmpty())return new i(n,0);var r=We.chordAngleBetweenPoints(this.center,n);return r>this.rad&&(this.rad=r),this},e.addCap=function(n){if(this.isEmpty())return n;if(n.isEmpty())return this;var r=ey(We.chordAngleBetweenPoints(this.center,n.center),n.rad),s=LT(r,Ki*r);return s>this.rad&&(this.rad=s),this},e.expanded=function(n){return this.isEmpty()?i.emptyCap():i.fromCenterChordAngle(this.center,ey(this.rad,_T(n)))},e.toString=function(){return"[Center="+this.center.vector+", Radius="+MH(this.radius())+"]"},i.radiusToHeight=function(n){return n<0?bT:n>=Math.PI?L1:.5*_T(n)},e.cellUnionBound=function(){var n=iD.maxLevel(this.radius())-1;if(n<0){for(var r=[],s=0;s<6;s++)r[s]=vp(s);return r}return GH(k1(this.center),n)},e.centroid=function(){if(this.isEmpty())return new We(0,0,0);var n=1-.5*this.height();return We.fromVector(this.center.vector.mul(n*this.area()))},e.union=function(n){var r=this;if(r.rad<n.rad){var s=[n,r];r=s[0],n=s[1]}if(r.isFull()||n.isEmpty())return r;var o=r.radius(),a=n.radius(),l=r.center.distance(n.center);if(o>=l+a)return r;var c=.5*(l+o+a),u=$H(.5*(l-o+a),r.center,n.center);return i.fromCenterAngle(u,c)},i})(),sD=function(e,t,n){var r=t.stableAngle(n),s=n.stableAngle(e),o=e.stableAngle(t),a=.5*(r+s+o);if(a>=3e-4){var l=a-Math.max(r,s,o);if(l<.01*a*a*a*a*a){var c=mfe(e,t,n);if(l<a*.1*(c+5e-15))return c}}return 4*Math.atan(Math.sqrt(Math.max(0,Math.tan(.5*a)*Math.tan(.5*(a-r))*Math.tan(.5*(a-s))*Math.tan(.5*(a-o)))))},mfe=function(e,t,n){var r=e.pointCross(t),s=t.pointCross(n),o=e.pointCross(n),a=r.vector.angle(o.vector)-r.vector.angle(s.vector)+s.vector.angle(o.vector);return a<0&&(a=0),a},Afe=function(e,t,n){return jm(e,t,n)*sD(e,t,n)},aH=function(e,t,n){var r=e.pointCross(t).vector.angle(t.pointCross(n).vector);return jm(e,t,n)===O1?r:-r},lH=Math.asin(Math.sqrt(1/3))-.5*Ki,Pa=(function(){function i(t,n,r,s,o){this.face=t,this.level=n,this.orientation=r,this.id=s,this.uv=o}i.fromCellID=function(n){var r=yp(n),s=r.f,o=r.i,a=r.j,l=r.orientation,c=to(n);return new i(s,c,l,n,DT(o,a,c))},i.fromPoint=function(n){return i.fromCellID(k1(n))},i.fromLatLng=function(n){return i.fromCellID(kH(n))},i.oppositeFace=function(n){return(n+3)%6};var e=i.prototype;return e.isLeaf=function(){return this.level===_i},e.sizeIJ=function(){return Ra(this.level)},e.sizeST=function(){return zH(this.level)},e.vertex=function(n){var r=this.uv.vertices()[n];return We.fromVector(oh(this.face,r.x,r.y).normalize())},e.edge=function(n){switch(n){case 0:return We.fromVector(eH(this.face,this.uv.y.lo).normalize());case 1:return We.fromVector(Jq(this.face,this.uv.x.hi).normalize());case 2:return We.fromVector(eH(this.face,this.uv.y.hi).mul(-1).normalize());default:return We.fromVector(Jq(this.face,this.uv.x.lo).mul(-1).normalize())}},e.boundUV=function(){return this.uv},e.center=function(){return We.fromVector(my(this.id).normalize())},e.children=function(){var n=[];if(mD(this.id))return n;for(var r=VH(this.id),s=vD(this.id),o=0;o<4;o++){var a=new i(this.face,this.level+1,this.orientation^M1[o],s,Hr.empty()),l=fD[this.orientation][o],c=l>>1,u=l&1;c===1?(a.uv.x.hi=this.uv.x.hi,a.uv.x.lo=r.x):(a.uv.x.lo=this.uv.x.lo,a.uv.x.hi=r.x),u===1?(a.uv.y.hi=this.uv.y.hi,a.uv.y.lo=r.y):(a.uv.y.lo=this.uv.y.lo,a.uv.y.hi=r.y),s=Ia(s),n.push(a)}return n},e.exactArea=function(){var n=this.vertex(0),r=this.vertex(1),s=this.vertex(2),o=this.vertex(3);return sD(n,r,s)+sD(n,s,o)},e.approxArea=function(){if(this.level<2)return this.averageArea();var n=.5*this.vertex(2).vector.sub(this.vertex(0).vector).cross(this.vertex(3).vector.sub(this.vertex(1).vector)).norm();return n*2/(1+Math.sqrt(1-Math.min(1/Math.PI*n,1)))},e.averageArea=function(){return rD.value(this.level)},e.intersectsCell=function(n){return UH(this.id,n.id)},e.containsCell=function(n){return Xm(this.id,n.id)},e.cellUnionBound=function(){return this.capBound().cellUnionBound()},e.latitude=function(n,r){var s,o;switch(!0){case(n===0&&r===0):s=this.uv.x.lo,o=this.uv.y.lo;break;case(n===0&&r===1):s=this.uv.x.lo,o=this.uv.y.hi;break;case(n===1&&r===0):s=this.uv.x.hi,o=this.uv.y.lo;break;case(n===1&&r===1):s=this.uv.x.hi,o=this.uv.y.hi;break;default:throw new Error("i and/or j is out of bounds")}return ar.latitude(We.fromVector(oh(this.face,s,o)))},e.longitude=function(n,r){var s,o;switch(!0){case(n===0&&r===0):s=this.uv.x.lo,o=this.uv.y.lo;break;case(n===0&&r===1):s=this.uv.x.lo,o=this.uv.y.hi;break;case(n===1&&r===0):s=this.uv.x.hi,o=this.uv.y.lo;break;case(n===1&&r===1):s=this.uv.x.hi,o=this.uv.y.hi;break;default:throw new Error("i and/or j is out of bounds")}return ar.longitude(We.fromVector(oh(this.face,s,o)))},e.rectBound=function(){if(this.level>0){var n=this.uv.x.lo+this.uv.x.hi,r=this.uv.y.lo+this.uv.y.hi,s,o;Nhe(this.face).z===0?s=n<0?1:0:s=n>0?1:0,Fhe(this.face).z===0?o=r<0?1:0:o=r>0?1:0;var a=Li.fromPoint(this.latitude(s,o)).addPoint(this.latitude(1-s,1-o)),l=eo.emptyInterval().addPoint(this.longitude(s,1-o)).addPoint(this.longitude(1-s,o));return new Ri(a,l).expanded(new ar(2*Ki,2*Ki)).polarClosure()}var c;switch(this.face){case 0:c=new Ri(new Li(-Math.PI/4,Math.PI/4),new eo(-Math.PI/4,Math.PI/4));break;case 1:c=new Ri(new Li(-Math.PI/4,Math.PI/4),new eo(Math.PI/4,3*Math.PI/4));break;case 2:c=new Ri(new Li(lH,Math.PI/2),eo.fullInterval());break;case 3:c=new Ri(new Li(-Math.PI/4,Math.PI/4),new eo(3*Math.PI/4,-3*Math.PI/4));break;case 4:c=new Ri(new Li(-Math.PI/4,Math.PI/4),new eo(-3*Math.PI/4,-Math.PI/4));break;default:c=new Ri(new Li(-Math.PI/2,-lH),eo.fullInterval())}return c.expanded(new ar(Ki,0))},e.capBound=function(){for(var n=gp.fromPoint(We.fromVector(oh(this.face,this.uv.center().x,this.uv.center().y).normalize())),r=0;r<4;r++)n=n.addPoint(this.vertex(r));return n},e.containsPoint=function(n){var r=Ihe(this.face,n.vector),s=r[0],o=r[1],a=r[2];return a?this.uv.expandedByMargin(Ki).containsPoint(new Ci(s,o)):!1},e.vertexChordDist2=function(n,r,s){var o=this.uv.x.lo,a=this.uv.y.lo;return r&&(o=this.uv.x.hi),s&&(a=this.uv.y.hi),We.chordAngleBetweenPoints(n,We.fromCoords(o,a,1))},e.uEdgeIsClosest=function(n,r){var s=this.uv.x.lo,o=this.uv.x.hi,a=this.uv.y.lo;r&&(a=this.uv.y.hi);var l=new Wt(a*a+1,-s*a,-s),c=new Wt(a*a+1,-o*a,-o);return n.vector.dot(l)>0&&n.vector.dot(c)<0},e.vEdgeIsClosest=function(n,r){var s=this.uv.y.lo,o=this.uv.y.hi,a=this.uv.x.lo;r&&(a=this.uv.x.hi);var l=new Wt(-a*s,a*a+1,-s),c=new Wt(-a*o,a*a+1,-o);return n.vector.dot(l)>0&&n.vector.dot(c)<0},i.edgeDistance=function(n,r){var s=n*n/(1+r*r),o=1-Math.sqrt(1-s);return $L(s+o*o)},e.distanceInternal=function(n,r){var s=We.fromVector(Ap(this.face,n.vector)),o=s.x-s.z*this.uv.x.lo,a=s.x-s.z*this.uv.x.hi,l=s.y-s.z*this.uv.y.lo,c=s.y-s.z*this.uv.y.hi,u=!0;return o<0&&(u=!1,this.vEdgeIsClosest(s,!1))?i.edgeDistance(-o,this.uv.x.lo):a>0&&(u=!1,this.vEdgeIsClosest(s,!0))?i.edgeDistance(a,this.uv.x.hi):l<0&&(u=!1,this.uEdgeIsClosest(s,!1))?i.edgeDistance(-l,this.uv.y.lo):c>0&&(u=!1,this.uEdgeIsClosest(s,!0))?i.edgeDistance(c,this.uv.y.hi):u?r?0:UL(i.edgeDistance(-o,this.uv.x.lo),i.edgeDistance(a,this.uv.x.hi),i.edgeDistance(-l,this.uv.y.lo),i.edgeDistance(c,this.uv.y.hi)):UL(this.vertexChordDist2(s,!1,!1),this.vertexChordDist2(s,!0,!1),this.vertexChordDist2(s,!1,!0),this.vertexChordDist2(s,!0,!0))},e.distance=function(n){return this.distanceInternal(n,!0)},e.maxDistance=function(n){var r=We.fromVector(Ap(this.face,n.vector)),s=JL(this.vertexChordDist2(r,!1,!1),this.vertexChordDist2(r,!0,!1),this.vertexChordDist2(r,!1,!0),this.vertexChordDist2(r,!0,!0));return s<=L1?s:Sc-this.distance(We.fromVector(n.vector.mul(-1)))},e.boundaryDistance=function(n){return this.distanceInternal(n,!1)},e.distanceToEdge=function(n,r){var s=UL(this.distance(n),this.distance(r));if(s===0)return s;for(var o=Gl.newChainEdgeCrosser(n,r,this.vertex(3)),a=0;a<4;a++)if(o.chainCrossingSign(this.vertex(a))!==Vl)return 0;for(var l=0;l<4;l++)s=hu(this.vertex(l),n,r,s).dist;return s},e.maxDistanceToEdge=function(n,r){var s=JL(this.maxDistance(n),this.maxDistance(r));return s<=L1?s:Sc-this.distanceToEdge(We.fromVector(n.vector.mul(-1)),We.fromVector(r.vector.mul(-1)))},e.distanceToCell=function(n){if(this.face===n.face&&this.uv.intersects(n.uv))return 0;for(var r=[],s=[],o=0;o<4;o++)r.push(this.vertex(o)),s.push(n.vertex(o));for(var a=Cc(),l=0;l<4;l++)for(var c=0;c<4;c++)a=hu(r[l],s[c],s[c+1&3],a).dist,a=hu(s[l],r[c],r[c+1&3],a).dist;return a},e.maxDistanceToCell=function(n){var r=new Hr(n.uv.y,n.uv.x);if(this.face===i.oppositeFace(n.face)&&this.uv.intersects(r))return Sc;for(var s=[],o=[],a=0;a<4;a++)s.push(this.vertex(a)),o.push(n.vertex(a));for(var l=bT,c=0;c<4;c++)for(var u=0;u<4;u++)l=sH(s[c],o[u],o[u+1&3],l).dist,l=sH(o[c],s[u],s[u+1&3],l).dist;return l},i})(),E1=-1,YH=(function(){function i(t,n){n===void 0&&(n=!1),this.nonEmpty=n,this.rangeNodes=t.rangeNodes,this.pos=0}var e=i.prototype;return e.startID=function(){return this.rangeNodes[this.pos].startID},e.limitID=function(){return this.rangeNodes[this.pos+1].startID},e.isEmpty=function(){return this.rangeNodes[this.pos].contents===E1},e.begin=function(){for(this.pos=0;this.nonEmpty&&this.isEmpty()&&!this.done();)this.pos++},e.internalPrev=function(){return this.pos===0?!1:(this.pos--,!0)},e.nonEmptyPrev=function(){for(;this.internalPrev();)if(!this.isEmpty())return!0;return this.isEmpty()&&!this.done()&&this.next(),!1},e.prev=function(){return this.nonEmpty?this.nonEmptyPrev():this.internalPrev()},e.next=function(){for(this.pos++;this.nonEmpty&&this.isEmpty()&&!this.done();)this.pos++},e.advance=function(n){return n>=this.rangeNodes.length-1-this.pos?!1:(this.pos+=n,!0)},e.finish=function(){this.pos=this.rangeNodes.length-1},e.done=function(){return this.pos>=this.rangeNodes.length-1},e.seek=function(n){for(var r=0,s=this.rangeNodes.length;r<s;){var o=r+s>>>1;this.rangeNodes[o].startID>n?s=o:r=o+1}for(this.pos=Math.max(r-1,0);this.nonEmpty&&this.isEmpty()&&!this.done();)this.pos++},i})(),ZH=(function(){function i(t){this.cellTree=t.cellTree,this.prevStartID=0n,this.nodeCutoff=-1,this.nextNodeCutoff=-1,this.node={cellID:0n,label:E1,parent:-1}}var e=i.prototype;return e.clear=function(){this.prevStartID=0n,this.nodeCutoff=-1,this.nextNodeCutoff=-1,this.node.label=E1},e.cellID=function(){return this.node.cellID},e.label=function(){return this.node.label},e.next=function(){this.node.parent<=this.nodeCutoff?(this.nodeCutoff=this.nextNodeCutoff,this.node.label=E1):this.node=yT({},this.cellTree[this.node.parent])},e.done=function(){return this.node.label===E1},e.startUnion=function(n){n.startID()<this.prevStartID&&(this.nodeCutoff=-1),this.prevStartID=n.startID();var r=n.rangeNodes[n.pos].contents;r<=this.nodeCutoff?this.node.label=E1:this.node=yT({},this.cellTree[r]),this.nextNodeCutoff=r},i})(),gfe=(function(){function i(){this.cellTree=[],this.rangeNodes=[]}var e=i.prototype;return e.add=function(n,r){if(r<0)throw new Error("labels must be non-negative");this.cellTree.push({cellID:n,label:r,parent:-1})},e.addCellUnion=function(n,r){if(r<0)throw new Error("labels must be non-negative");for(var s=Ct(n),o;!(o=s()).done;){var a=o.value;this.add(a,r)}},e.build=function(){for(var n=[],r=Ct(this.cellTree),s;!(s=r()).done;){var o=s.value;n.push({startID:qi(o.cellID),cellID:o.cellID,label:o.label}),n.push({startID:Ia(Gi(o.cellID)),cellID:fl,label:-1})}n.push({startID:Ay(vp(0),_i),cellID:0n,label:-1}),n.push({startID:NT(vp(5),_i),cellID:0n,label:-1}),n.sort(function(u,f){return u.startID!==f.startID?u.startID<f.startID?-1:1:u.cellID!==f.cellID?u.cellID>f.cellID?-1:1:u.label<f.label?-1:u.label>f.label?1:0}),this.cellTree=[],this.rangeNodes=[];for(var a=-1,l=0;l<n.length;){for(var c=n[l].startID;l<n.length&&n[l].startID===c;)n[l].label>=0?(this.cellTree.push({cellID:n[l].cellID,label:n[l].label,parent:a}),a=this.cellTree.length-1):n[l].cellID===fl&&(a=this.cellTree[a].parent),l++;this.rangeNodes.push({startID:c,contents:a})}},i})(),N1=(function(i){function e(){return i.apply(this,arguments)||this}hy(e,i),e.fromRange=function(r,s){for(var o=new e,a=tD(r,s);a!==s;a=tD(Ia(a),s))o.push(a);return o},e.fromUnion=function(){for(var r=arguments.length,s=new Array(r),o=0;o<r;o++)s[o]=arguments[o];var a=sy(e,s.flat(1));return a.normalize(),a},e.fromIntersection=function(r,s){for(var o=new e,a=0,l=0;a<r.length&&l<s.length;){var c=qi(r[a]),u=qi(s[l]);c>u?r[a]<=Gi(s[l])?(o.push(r[a]),a++):(l=s.lowerBound(l+1,s.length,c),r[a]<=Gi(s[l-1])&&l--):u>c?s[l]<=Gi(r[a])?(o.push(s[l]),l++):(a=r.lowerBound(a+1,r.length,u),s[l]<=Gi(r[a-1])&&a--):r[a]<s[l]?(o.push(r[a]),a++):(o.push(s[l]),l++)}return o.normalize(),o},e.fromIntersectionWithCellID=function(r,s){var o=new e;if(r.containsCellID(s))return o.push(s),o.normalize(),o;for(var a=Gi(s),l=r.lowerBound(0,r.length,qi(s));l<r.length&&r[l]<=a;l++)o.push(r[l]);return o.normalize(),o},e.fromDifference=function(r,s){for(var o=new e,a=Ct(r),l;!(l=a()).done;){var c=l.value;o.cellUnionDifferenceInternal(c,s)}return o};var t=e.prototype;return t.isValid=function(){for(var r=0;r<this.length;r++){var s=this[r];if(!ly(s)||r>0&&Gi(this[r-1])>=qi(s))return!1}return!0},t.isNormalized=function(){for(var r=0;r<this.length;r++){var s=this[r];if(!ly(s)||r>0&&Gi(this[r-1])>=qi(s)||r>=3&&e.areSiblings(this[r-3],this[r-2],this[r-1],s))return!1}return!0},t.normalize=function(){this.sort(nD);for(var r=[],s=Ct(this),o;!(o=s()).done;){var a=o.value;if(!(r.length>0&&Xm(r[r.length-1],a))){for(var l=r.length-1;l>=0&&Xm(a,r[l]);)l--;for(r.length=l+1;r.length>=3&&e.areSiblings(r[r.length-3],r[r.length-2],r[r.length-1],a);)r.length-=3,a=pD(a);r.push(a)}}this.length=0,this.push.apply(this,r)},t.intersectsCellID=function(r){var s=this.lowerBound(0,this.length,r);return s!==this.length&&qi(this[s])<=Gi(r)?!0:s!==0&&Gi(this[s-1])>=qi(r)},t.containsCellID=function(r){var s=this.lowerBound(0,this.length,r);return s!==this.length&&qi(this[s])<=r?!0:s!==0&&Gi(this[s-1])>=r},t.denormalize=function(r,s){for(var o=new e,a=Ct(this),l;!(l=a()).done;){var c=l.value,u=to(c),f=u;if(f<r&&(f=r),s>1&&(f+=(_i-(f-r))%s,f>_i&&(f=_i)),f===u)o.push(c);else for(var d=NT(c,f),A=Ay(c,f);A!==d;A=Ia(A))o.push(A)}this.length=0,this.push.apply(this,o)},t.rectBound=function(){for(var r=Ri.emptyRect(),s=Ct(this),o;!(o=s()).done;){var a=o.value;r=r.union(Pa.fromCellID(a).rectBound())}return r},t.capBound=function(){if(this.length===0)return gp.emptyCap();for(var r=new We(0,0,0),s=Ct(this),o;!(o=s()).done;){var a=o.value,l=rD.value(to(a));r=We.fromVector(r.vector.add(gD(a).vector.mul(l)))}r.equals(new We(0,0,0))?r=We.fromCoords(1,0,0):r=We.fromVector(r.vector.normalize());for(var c=gp.fromPoint(r),u=Ct(this),f;!(f=u()).done;){var d=f.value;c=c.addCap(Pa.fromCellID(d).capBound())}return c},t.containsCell=function(r){return this.containsCellID(r.id)},t.intersectsCell=function(r){return this.intersectsCellID(r.id)},t.containsPoint=function(r){return this.containsCell(Pa.fromPoint(r))},t.cellUnionBound=function(){return this.capBound().cellUnionBound()},t.leafCellsCovered=function(){for(var r=0n,s=Ct(this),o;!(o=s()).done;){var a=o.value;r+=1n<<BigInt(_i-to(a)<<1)}return r},e.areSiblings=function(r,s,o,a){if((r^s^o)!==a)return!1;var l=ls(a)<<1n;l=~(l+(l<<1n));var c=a&l;return(r&l)===c&&(s&l)===c&&(o&l)===c&&!dy(a)},t.contains=function(r){for(var s=Ct(r),o;!(o=s()).done;){var a=o.value;if(!this.containsCellID(a))return!1}return!0},t.intersects=function(r){for(var s=Ct(this),o;!(o=s()).done;){var a=o.value;if(r.intersectsCellID(a))return!0}return!1},t.lowerBound=function(r,s,o){for(var a=r;a<s;a++)if(this[a]>=o)return a;return s},t.cellUnionDifferenceInternal=function(r,s){if(!s.intersectsCellID(r)){this.push(r);return}if(!s.containsCellID(r))for(var o=Ct(U1(r)),a;!(a=o()).done;){var l=a.value;this.cellUnionDifferenceInternal(l,s)}},t.expandAtLevel=function(r){for(var s=new e,o=Ym(r),a=this.length-1;a>=0;a--){var l=this[a];if(ls(l)<o)for(l=Sr(l,r);a>0&&Xm(l,this[a-1]);)a--;s.push(l),s.push.apply(s,OH(l,r))}s.sort(nD),this.length=0,this.push.apply(this,s),this.normalize()},t.expandByRadius=function(r,s){for(var o=_i,a=Ct(this),l;!(l=a()).done;){var c=l.value;o=Math.min(o,to(c))}var u=iD.maxLevel(r);u===0&&r>iD.value(0)&&this.expandAtLevel(0),this.expandAtLevel(Math.min(o+s,u))},t.equals=function(r){if(this.length!==r.length)return!1;for(var s=0;s<this.length;s++)if(this[s]!==r[s])return!1;return!0},t.averageArea=function(){return rD.value(_i)*Number(this.leafCellsCovered())},t.approxArea=function(){for(var r=0,s=Ct(this),o;!(o=s()).done;){var a=o.value;r+=Pa.fromCellID(a).approxArea()}return r},t.exactArea=function(){for(var r=0,s=Ct(this),o;!(o=s()).done;){var a=o.value;r+=Pa.fromCellID(a).exactArea()}return r},e})(I1(Array)),ah=(function(){function i(t,n){this.v0=t,this.v1=n}var e=i.prototype;return e.cmp=function(n){var r=this.v0.vector.cmp(n.v0.vector);return r!==0?r:this.v1.vector.cmp(n.v1.vector)},e.equals=function(n){return this.v0.equals(n.v0)&&this.v1.equals(n.v1)},i})(),P1=function(e,t){this.start=e,this.length=t},FT=function(e,t){this.chainID=e,this.offset=t},vfe=function(e,t){this.point=e,this.contained=t},BT=function(e){return new vfe(We.originPoint(),e)},KH=0,_fe=1,xfe=2,yfe=function(e){return e.numEdges()===0&&(e.dimension()!==2||e.numChains()===0)},bfe=function(e){return e.numEdges()===0&&e.dimension()===2&&e.numChains()>0},ny=(function(){function i(){}var e=i.prototype;return e.numEdges=function(){return 0},e.edge=function(n){return new ah(We.originPoint(),We.originPoint())},e.referencePoint=function(){return BT(!1)},e.numChains=function(){return 0},e.chain=function(n){return new P1(0,0)},e.chainEdge=function(n,r){return new ah(We.originPoint(),We.originPoint())},e.chainPosition=function(n){return new FT(0,0)},e.dimension=function(){return-1},e.isEmpty=function(){return!0},e.isFull=function(){return!1},e.typeTag=function(){return KH},e.privateInterface=function(){},i})(),cH=(function(){function i(t,n){this.containsCenter=!1,this.shapeID=t,this.containsCenter=!1,this.edges=new Array(n)}var e=i.prototype;return e.numEdges=function(){return this.edges.length},e.containsEdge=function(n){for(var r=Ct(this.edges),s;!(s=r()).done;){var o=s.value;if(o===n)return!0}return!1},i})(),QH=(function(){function i(){this.shapeID=0,this.containsCenter=!1,this.edges=[]}var e=i.prototype;return e.numEdges=function(){return 0},e.containsEdge=function(n){return!1},i})(),wfe=(function(){function i(t){this.shapes=new Array(t)}var e=i.prototype;return e.numEdges=function(){for(var n=0,r=Ct(this.shapes),s;!(s=r()).done;){var o=s.value;n+=o.numEdges()}return n},e.add=function(n){this.shapes.push(n)},e.findByShapeID=function(n){for(var r=Ct(this.shapes),s;!(s=r()).done;){var o=s.value;if(o.shapeID===n)return o}return new QH},i})(),kL=(function(){function i(){this.shapes=[]}var e=i.prototype;return e.numEdges=function(){return 0},e.add=function(n){},e.findByShapeID=function(n){return new QH},i})(),oD=0,JH=0,zL=(function(){function i(t,n){if(this.index=t,this.position=0,this.id=fl,this.cell=new kL,n!==void 0)switch(n){case oD:this.begin();break;case JH:this.end();break;default:throw new Error("unknown ShapeIndexIteratorPos value")}}var e=i.prototype;return e.clone=function(){var n=new i(this.index);return n.position=this.position,n.id=this.id,n.cell=this.cell,n},e.cellID=function(){return this.id},e.indexCell=function(){return this.cell},e.center=function(){return gD(this.cellID())},e.begin=function(){this.index.isFresh()||this.index.maybeApplyUpdates(),this.position=0,this.refresh()},e.next=function(){this.position++,this.refresh()},e.prev=function(){return this.position<=0?!1:(this.position--,this.refresh(),!0)},e.end=function(){this.position=this.index.cells.length,this.refresh()},e.done=function(){return this.id===fl},e.refresh=function(){this.position<this.index.cells.length?(this.id=this.index.cells[this.position],this.cell=this.index.cellMap.get(this.cellID())||new kL):(this.id=fl,this.cell=new kL)},e.seek=function(n){var r=this;this.position=eD(this.index.cells.length,function(s){return r.index.cells[s]>=n}),this.refresh()},e.locatePoint=function(n){var r=k1(n);return this.seek(r),!!(!this.done()&&qi(this.cellID())<=r||this.prev()&&Gi(this.cellID())>=r)},e.locateCellID=function(n){if(this.seek(qi(n)),!this.done()){if(this.cellID()>=n&&qi(this.cellID())<=n)return xp;if(this.cellID()<=Gi(n))return vy}return this.prev()&&Gi(this.cellID())>=n?xp:OT},i})(),Sfe=(function(){function i(){this.isActive=!1,this.a=this.b=i.trackerOrigin(),this.nextCellID=Ay(vp(0),_i),this.crosser=null,this.shapeIDs=[],this.savedIDs=[],this.drawTo(We.fromVector(oh(0,-1,-1).normalize()))}i.trackerOrigin=function(){return We.fromVector(oh(0,-1,-1).normalize())};var e=i.prototype;return e.focus=function(){return this.b},e.addShape=function(n,r){this.isActive=!0,r&&this.toggleShape(n)},e.moveTo=function(n){this.b=n},e.drawTo=function(n){this.a=this.b,this.b=n,this.crosser=new Gl(this.a,this.b)},e.testEdge=function(n,r){var s;(s=this.crosser)!=null&&s.edgeOrVertexCrossing(r.v0,r.v1)&&this.toggleShape(n)},e.setNextCellID=function(n){this.nextCellID=qi(n)},e.atCellID=function(n){return qi(n)===this.nextCellID},e.toggleShape=function(n){if(this.shapeIDs.length===0){this.shapeIDs.push(n);return}if(this.shapeIDs[0]===n){this.shapeIDs.shift();return}for(var r=0;r<this.shapeIDs.length;r++){var s=this.shapeIDs[r];if(!(s<n)){if(s===n){this.shapeIDs.splice(r,1);return}this.shapeIDs.splice(r,0,n);return}}this.shapeIDs.push(n)},e.saveAndClearStateBefore=function(n){var r=this.lowerBound(n);this.savedIDs=this.shapeIDs.slice(0,r),this.shapeIDs=this.shapeIDs.slice(r)},e.restoreStateBefore=function(n){var r=this.lowerBound(n);this.shapeIDs=this.savedIDs.concat(this.shapeIDs.slice(r)),this.savedIDs=[]},e.lowerBound=function(n){for(var r=0;r<this.shapeIDs.length;r++)if(this.shapeIDs[r]>=n)return r;return this.shapeIDs.length},i})(),Yf=1,uH=2,_p=(function(){function i(t,n){this.index=t,this.model=n,this.iter=t.iterator()}var e=i.prototype;return e.contains=function(n){if(!this.iter.locatePoint(n))return!1;for(var r=this.iter.indexCell(),s=Ct(r.shapes),o;!(o=s()).done;){var a=o.value;if(this._shapeContains(a,this.iter.center(),n))return!0}return!1},e._shapeContains=function(n,r,s){var o=n.containsCenter,a=n.numEdges();if(a<=0)return o;var l=this.index.shape(n.shapeID);if(l.dimension()!==2){if(this.model!==uH)return!1;for(var c=Ct(n.edges),u;!(u=c()).done;){var f=u.value,d=l.edge(f);if(d.v0.equals(s)||d.v1.equals(s))return!0}return!1}for(var A=new Gl(r,s),y=Ct(n.edges),w;!(w=y()).done;){var S=w.value,T=l.edge(S),R=A.crossingSign(T.v0,T.v1);if(R!==Vl){if(R===CT){if(this.model!==Yf&&(T.v0.equals(s)||T.v1.equals(s)))return this.model===uH;jH(A.a,A.b,T.v0,T.v1)?R=Ec:R=Vl}o=o!==(R===Ec)}}return o},e.shapeContains=function(n,r){if(!n||n instanceof ny||!this.iter.locatePoint(r))return!1;var s=this.iter.indexCell(),o=s.findByShapeID(this.index.idForShape(n));return o?this._shapeContains(o,this.iter.center(),r):!1},e.shapeVisitorFunc=function(n){return!0},e.visitContainingShapes=function(n,r){if(!this.iter.locatePoint(n))return!0;for(var s=this.iter.indexCell(),o=Ct(s.shapes),a;!(a=o()).done;){var l=a.value;if(this._shapeContains(l,this.iter.center(),n)&&!r(this.index.shape(l.shapeID)))return!1}return!0},e.containingShapes=function(n){var r=[];return this.visitContainingShapes(n,function(s){return r.push(s),!0}),r},i})(),Tfe=(function(){function i(t,n){n===void 0&&(n=new _p(t,Yf)),this.index=t,this.containsQuery=n,this.iter=t.iterator()}var e=i.prototype;return e.capBound=function(){var n=sy(N1,this.cellUnionBound());return n.capBound()},e.rectBound=function(){var n=sy(N1,this.cellUnionBound());return n.rectBound()},e.cellUnionBound=function(){var n=[];if(this.iter.end(),!this.iter.prev())return n;var r=this.iter.cellID();if(this.iter.begin(),this.iter.cellID()!==r){var s=cy(this.iter.cellID(),r),o=s[0];o===void 0&&(o=-1),o++;for(var a=Sr(r,o),l=Sr(this.iter.cellID(),o);l!=a;l=Ia(l))if(!(Gi(l)<this.iter.cellID())){var c=this.iter.cellID();this.iter.seek(Ia(Gi(l))),this.iter.prev(),n.push.apply(n,this.coverRange(c,this.iter.cellID(),[])),this.iter.next()}}return this.coverRange(this.iter.cellID(),r,n)},e.coverRange=function(n,r,s){if(n==r)return s.concat([n]);var o=cy(n,r),a=o[0],l=o[1];return l||s.concat([0n]),s.concat([Sr(n,a)])},i})(),Efe=2.25*Ki,Mfe=3*Ki,gy=9*(1/Math.SQRT2)*Ki,eW=3*Math.SQRT2*Ki,Cfe=function(e,t,n){return uy(e,t,n,0)},uy=function(e,t,n,r){if(ay(e.vector)===n&&ay(t.vector)===n){var s=$m(n,e.vector),o=s[0],a=s[1],l=$m(n,t.vector),c=l[0],u=l[1];return[new Ci(o,a),new Ci(c,u),!0]}var f=new wc(Ap(n,e.pointCross(t).vector)),d=new wc(Ap(n,e.vector)),A=new wc(Ap(n,t.vector)),y=1+r,w=new wc(new We(y*f.x,y*f.y,f.z));if(!w.intersectsFace())return[null,null,!1];Math.max(Math.abs(f.x),Math.max(Math.abs(f.y),Math.abs(f.z)))<XL(1,-511)&&(f=new wc(We.fromVector(f.vector.mul(XL(1,563)))));var S=new wc(We.fromVector(f.vector.normalize())),T=new wc(We.fromVector(S.vector.cross(d.vector))),R=new wc(We.fromVector(A.vector.cross(S.vector))),I=hH(A,d,new wc(We.fromVector(w.vector.mul(-1))),R,T,y),P=I[0],F=I[1],D=hH(d,A,w,T,R,y),L=D[0],C=D[1];return[P,L,F+C<3]},Rfe=function(e,t,n){return e+t===n&&e===n-t&&t===n-e},VL=0,aD=1,wc=(function(i){function e(n){return i.call(this,n.x,n.y,n.z)||this}hy(e,i);var t=e.prototype;return t.intersectsFace=function(){var r=Math.abs(this.x),s=Math.abs(this.y),o=Math.abs(this.z);return s>=o-r&&r>=o-s},t.intersectsOppositeEdges=function(){var r=Math.abs(this.x),s=Math.abs(this.y),o=Math.abs(this.z);return Math.abs(r-s)!==o?Math.abs(r-s)>=o:r>=s?r-o>=s:s-o>=r},t.exitAxis=function(){if(this.intersectsOppositeEdges())return Math.abs(this.x)>=Math.abs(this.y)?aD:VL;var r=0,s=0,o=0;return Math.sign(this.x)<0&&(r=1),Math.sign(this.y)<0&&(s=1),Math.sign(this.z)<0&&(o=1),(r^s^o)===0?aD:VL},t.exitPoint=function(r){if(r===VL){var s=this.y>0?1:-1;return new Ci(s,(-s*this.x-this.z)/this.y)}var o=this.x<0?1:-1;return new Ci((-o*this.y-this.z)/this.x,o)},e})(We),hH=function(e,t,n,r,s,o){var a=1-gy;if(t.z>0){var l=new Ci(t.x/t.z,t.y/t.z);if(Math.max(Math.abs(l.x),Math.abs(l.y))<=a)return[l,0]}var c=n.exitPoint(n.exitAxis()).mul(o),u=new wc(new We(c.x,c.y,1)),f=0;return u.vector.sub(e.vector).dot(r.vector)<0?f=2:u.vector.sub(t.vector).dot(s.vector)<0&&(f=1),f>0&&(t.z<=0?f=3:c=new Ci(t.x/t.z,t.y/t.z)),[c,f]},fH=function(e,t,n){return t?e.lo>n?[e,!1]:(e.hi>n&&(e.hi=n),[e,!0]):e.hi<n?[e,!1]:(e.lo<n&&(e.lo=n),[e,!0])},dH=function(e,t,n,r,s,o,a,l){var c=!1;if(n.lo<l.lo){if(n.hi<l.lo)return[n,o,!1];n.lo=l.lo;var u=fH(o,a,F1(l.lo,e,t,r,s));if(o=u[0],c=u[1],!c)return[n,o,!1]}if(n.hi>l.hi){if(n.lo>l.hi)return[n,o,!1];n.hi=l.hi;var f=fH(o,!a,F1(l.hi,e,t,r,s));if(o=f[0],c=f[1],!c)return[n,o,!1]}return[n,o,!0]},tW=function(e,t,n){if(!n.intersects(Hr.fromPoints(e,t)))return!1;var r=t.sub(e).ortho(),s=r.x>=0?1:0,o=r.y>=0?1:0,a=r.dot(n.vertexIJ(s,o).sub(e)),l=r.dot(n.vertexIJ(1-s,1-o).sub(e));return a>=0&&l<=0},Pfe=function(e,t,n){var r=Hr.fromPoints(e,t),s=Ife(e,t,n,r),o=s[0],a=s[1];return a?o:Hr.empty()},Ife=function(e,t,n,r){var s=e.x>t.x!=e.y>t.y,o=dH(e.x,t.x,r.x,e.y,t.y,r.y,s,n.x),a=o[0],l=o[1],c=o[2];if(!c)return[r,!1];var u=dH(e.y,t.y,l,e.x,t.x,a,s,n.y),f=u[0],d=u[1],A=u[2];return A?[new Hr(d,f),!0]:[new Hr(a,l),!1]},F1=function(e,t,n,r,s){return Math.abs(t-e)<=Math.abs(n-e)?r+(s-r)*(e-t)/(n-t):s+(r-s)*(e-n)/(t-n)},Lfe=(function(){function i(t,n,r){this.face=t,this.a=n,this.b=r}var e=i.prototype;return e.clone=function(){return new i(this.face,new Ci(this.a.x,this.a.y),new Ci(this.b.x,this.b.y))},i})(),Dfe=function(e,t){var n=new Lfe(0,new Ci(0,0),new Ci(0,0)),r=ST(e.vector),s=r[0],o=r[1],a=r[2],l=ST(t.vector),c=l[0],u=l[1],f=l[2];if(n.a.x=o,n.a.y=a,n.b.x=u,n.b.y=f,s===c)return n.face=s,[n];var d=e.pointCross(t),A=pH(s,e,d,n.a),y=A[0],w=A[1],S=pH(c,t,We.fromVector(d.vector.mul(-1)),n.b),T=S[0],R=S[1];n.a=w,n.b=R;var I=[];n.face=y;for(var P=n.b,F=y;F!==T;){var D=Ap(F,d.vector),L=new wc(D),C=L.exitAxis();n.b=L.exitPoint(C),I.push(n.clone());var B=oh(F,n.b.x,n.b.y);F=Nfe(F,n.b,C,L,T);var k=Ap(F,B);n.face=F,n.a=new Ci(k.x,k.y)}return n.b=P,I.push(n),I},pH=function(e,t,n,r){var s=1-gy;if(Math.max(Math.abs(r.x),Math.abs(r.y))<=s)return[e,r];var o=Ap(e,n.vector),a=new wc(o);if(a.intersectsFace()){var l=a.exitPoint(a.exitAxis()),c=oh(e,l.x,l.y),u=n.vector.normalize().cross(t.vector);if(c.sub(t.vector).dot(u)>=-Mfe)return[e,r]}var f=0;Math.abs(r.x)>=Math.abs(r.y)?(r.x>0&&(f=1),e=TT(e,0,f)):(r.y>0&&(f=1),e=TT(e,1,f));var d=$m(e,t.vector);return r.x=d[0],r.y=d[1],r.x=Math.max(-1,Math.min(1,r.x)),r.y=Math.max(-1,Math.min(1,r.y)),[e,r]},Nfe=function(e,t,n,r,s){var o=t.x,a=t.y;n==aD&&(o=t.y,a=t.x);var l=0;o>0&&(l=1);var c=0;return a>0&&(c=1),Math.abs(a)===1&&TT(e,1-n,c)===s&&Rfe(t.x*r.x,t.y*r.y,-r.z)?s:TT(e,n,l)},vT=1,mH=(function(){function i(t){this.rangeMin=fl,this.rangeMax=fl,this.it=t.iterator(),this.refresh()}var e=i.prototype;return e.cellID=function(){return this.it.cellID()},e.indexCell=function(){return this.it.indexCell()},e.next=function(){this.it.next(),this.refresh()},e.done=function(){return this.it.done()},e.seekTo=function(n){this.it.seek(n.rangeMin),(this.it.done()||qi(this.it.cellID())>n.rangeMax)&&this.it.prev()&&Gi(this.it.cellID())<n.cellID()&&this.it.next(),this.refresh()},e.seekBeyond=function(n){this.it.seek(Ia(n.rangeMax)),!this.it.done()&&qi(this.it.cellID())<=n.rangeMax&&this.it.next(),this.refresh()},e.refresh=function(){this.rangeMin=qi(this.cellID()),this.rangeMax=Gi(this.cellID())},i})(),Ffe=function(e,t){if(e.dimension()!==2)return!1;var n=e.referencePoint();if(n.point===t)return n.contained;for(var r=new Gl(n.point,t),s=n.contained,o=0;o<e.numEdges();o++){var a=e.edge(o);s=s!==r.edgeOrVertexCrossing(a.v0,a.v1)}return s},Ca=(function(){function i(){this.id=0n,this.padding=0,this.boundRect=Hr.empty(),this.middleRect=Hr.empty(),this.iLo=0,this.jLo=0,this.orientation=0,this.level=0}i.fromCellID=function(n,r){var s=new i;if(s.id=n,s.padding=r,s.middleRect=Hr.empty(),dy(n)){var o=r+1;return s.boundRect=new Hr(new Li(-o,o),new Li(-o,o)),s.middleRect=new Hr(new Li(-r,r),new Li(-r,r)),s.orientation=uu(n)&1,s}var a=yp(n),l=a.i,c=a.j,u=a.orientation;s.iLo=l,s.jLo=c,s.orientation=u,s.level=to(n),s.boundRect=DT(l,c,s.level).expandedByMargin(r);var f=Ra(s.level);return s.iLo&=-f,s.jLo&=-f,s},i.fromParentIJ=function(n,r,s){var o=Rhe[n.orientation][2*r+s],a=new i;a.id=U1(n.id)[o],a.padding=n.padding,a.boundRect=Hr.fromRect(n.boundRect),a.orientation=n.orientation^M1[o],a.level=n.level+1,a.middleRect=Hr.empty();var l=Ra(a.level);a.iLo=n.iLo+r*l,a.jLo=n.jLo+s*l;var c=n.middle();return r===1?a.boundRect.x.lo=c.x.lo:a.boundRect.x.hi=c.x.hi,s===1?a.boundRect.y.lo=c.y.lo:a.boundRect.y.hi=c.y.hi,a};var e=i.prototype;return e.cellID=function(){return this.id},e.paddingValue=function(){return this.padding},e.levelValue=function(){return this.level},e.center=function(){var n=Ra(this.level),r=2*this.iLo+n,s=2*this.jLo+n;return We.fromVector(xT(uu(this.id),r,s).normalize())},e.middle=function(){if(this.middleRect.isEmpty()){var n=Ra(this.level),r=Tc(dp(2*this.iLo+n)),s=Tc(dp(2*this.jLo+n));this.middleRect=new Hr(new Li(r-this.padding,r+this.padding),new Li(s-this.padding,s+this.padding))}return this.middleRect},e.bound=function(){return this.boundRect},e.childIJ=function(n){var r=fD[this.orientation][n];return[r>>1,r&1]},e.entryVertex=function(){var n=this.iLo,r=this.jLo;if(this.orientation&$f){var s=Ra(this.level);n+=s,r+=s}return We.fromVector(xT(uu(this.id),2*n,2*r).normalize())},e.exitVertex=function(){var n=this.iLo,r=this.jLo,s=Ra(this.level);return this.orientation===0||this.orientation===Mc+$f?n+=s:r+=s,We.fromVector(xT(uu(this.id),2*n,2*r).normalize())},e.shrinkToFit=function(n){if(this.level===0&&(n.x.contains(0)||n.y.contains(0)))return this.id;var r=Ra(this.level);if(n.x.contains(Tc(dp(2*this.iLo+r)))||n.y.contains(Tc(dp(2*this.jLo+r))))return this.id;var s=n.expandedByMargin(this.padding+1.5*Ki),o=this.iLo,a=this.jLo,l=0,c=0;o<zl(sh(s.x.lo))&&(o=zl(sh(s.x.lo))),this.iLo+r-1<=zl(sh(s.x.hi))?l=o^this.iLo+r-1:l=o^zl(sh(s.x.hi)),a<zl(sh(s.y.lo))&&(a=zl(sh(s.y.lo))),this.jLo+r-1<=zl(sh(s.y.hi))?c=a^this.jLo+r-1:c=a^zl(sh(s.y.hi));var u=BigInt((l|c)<<1)+1n,f=_i-EH(u);return f<=this.level?this.id:Sr(py(uu(this.id),o,a),f)},i})(),xp=0,vy=1,OT=2,AH=0,ty=2,S1=2*(gy+Efe),Bfe=1,gH=(function(){function i(t,n,r,s,o,a,l){t===void 0&&(t=0),n===void 0&&(n=0),r===void 0&&(r=0),s===void 0&&(s=!1),o===void 0&&(o=new Ci(0,0)),a===void 0&&(a=new Ci(0,0)),l===void 0&&(l=new ah(new We(0,0,0),new We(0,0,0))),this.shapeID=t,this.edgeID=n,this.maxLevel=r,this.hasInterior=s,this.a=o,this.b=a,this.edge=l}var e=i.prototype;return e.copy=function(){return new i(this.shapeID,this.edgeID,this.maxLevel,this.hasInterior,new Ci(this.a.x,this.a.y),new Ci(this.b.x,this.b.y),new ah(We.fromVector(this.edge.v0.vector),We.fromVector(this.edge.v1.vector)))},i})(),GL=function(e,t){this.faceEdge=e,this.bound=t},RT=(function(){function i(){var t=this;this.iterator=function(){return t.maybeApplyUpdates(),new zL(t,oD)},this.begin=function(){return t.maybeApplyUpdates(),new zL(t,oD)},this.end=function(){return t.maybeApplyUpdates(),new zL(t,JH)},this.region=function(){return new Tfe(t,new _p(t,Yf))},this.len=function(){return t.shapes.size},this.reset=function(){t.shapes.clear(),t.nextID=0,t.cellMap.clear(),t.cells=[],t.status=ty},this.numEdges=function(){var n=0;return t.shapes.forEach(function(r){n+=r.numEdges()}),n},this.numEdgesUpTo=function(n){for(var r=0,s=0;s<=t.nextID;s++){var o=t.shape(s);if(!(o instanceof ny)&&(r+=o.numEdges(),r>=n))break}return r},this.shape=function(n){return t.shapes.get(n)||new ny},this.idForShape=function(n){for(var r=Ct(t.shapes.entries()),s;!(s=r()).done;){var o=s.value,a=o[0],l=o[1];if(l===n)return a}return-1},this.add=function(n){return t.shapes.set(t.nextID,n),t.nextID++,t.status=AH,t.nextID-1},this.remove=function(n){var r=t.idForShape(n);if(t.shapes.has(r)&&(t.shapes.delete(r),!(r>=t.pendingAdditionsPos))){for(var s=n.numEdges(),o=new Ofe(r,n.dimension()===2,n.referencePoint().contained,new Array(s)),a=0;a<s;a++)o.edges[a]=n.edge(a);t.pendingRemovals.push(o),t.status=AH}},this.build=function(){return t.maybeApplyUpdates()},this.isFresh=function(){return t.status===ty},this.isFirstUpdate=function(){return t.pendingAdditionsPos===0},this.isShapeBeingRemoved=function(n){return n<t.pendingAdditionsPos},this.maybeApplyUpdates=function(){t.status!==ty&&(t.applyUpdatesInternal(),t.status=ty)},this.applyUpdatesInternal=function(){for(var n=new Sfe,r=Array.from({length:6},function(){return[]}),s=Ct(t.pendingRemovals),o;!(o=s()).done;){var a=o.value;t.removeShapeInternal(a,r,n)}for(var l=t.pendingAdditionsPos;l<t.shapes.size;l++)t.addShapeInternal(l,r,n);for(var c=0;c<6;c++)t.updateFaceEdges(c,r[c],n);t.pendingRemovals.length=0,t.pendingAdditionsPos=t.shapes.size},this.addShapeInternal=function(n,r,s){var o=t.shapes.get(n)||new ny;if(!(o instanceof ny)){var a=new gH(n,void 0,void 0,o.dimension()===2);a.hasInterior&&s.addShape(n,Ffe(o,s.focus()));for(var l=o.numEdges(),c=0;c<l;c++){var u=o.edge(c);a.edgeID=c,a.edge=u,a.maxLevel=vH(u),t.addFaceEdge(a,r)}}},this.addFaceEdge=function(n,r){var s=n.copy(),o=ay(s.edge.v0.vector);if(o===ay(s.edge.v1.vector)){var a=$m(o,s.edge.v0.vector),l=a[0],c=a[1];s.a=new Ci(l,c);var u=$m(o,s.edge.v1.vector);l=u[0],c=u[1],s.b=new Ci(l,c);var f=1-S1;if(Math.abs(s.a.x)<=f&&Math.abs(s.a.y)<=f&&Math.abs(s.b.x)<=f&&Math.abs(s.b.y)<=f){r[o].push(s);return}}for(var d=0;d<6;d++){var A=uy(s.edge.v0,s.edge.v1,d,S1),y=A[0],w=A[1],S=A[2];if(S){var T=n.copy();T.a=y,T.b=w,r[d].push(T)}}},this.updateFaceEdges=function(n,r,s){var o=r.length;if(!(o===0&&s.shapeIDs.length===0)){for(var a=Array(o),l=Hr.empty(),c=0;c<o;c++){var u=new GL(r[c],Hr.fromPoints(r[c].a,r[c].b));a[c]=u,l=l.addRect(u.bound)}var f=vp(n),d=Ca.fromCellID(f,S1),A=t.isFirstUpdate();if(o>0){var y=t.shrinkToFit(d,l);if(y!==d.id){t.skipCellRange(qi(f),qi(y),s,A),d=Ca.fromCellID(y,S1),t.updateEdges(d,a,s,A),t.skipCellRange(Ia(Gi(y)),Ia(Gi(f)),s,A);return}}t.updateEdges(d,a,s,A)}},this.shrinkToFit=function(n,r){var s=n.shrinkToFit(r);if(!t.isFirstUpdate()&&s!==n.id){var o=t.iterator();o.locateCellID(s)===xp&&(s=o.cellID())}return s},this.skipCellRange=function(n,r,s,o){if(s.shapeIDs.length!==0)for(var a=N1.fromRange(n,r),l=Ct(a),c;!(c=l()).done;){var u=c.value,f=[];t.updateEdges(Ca.fromCellID(u,S1),f,s,o)}},this.updateEdges=function(n,r,s,o){var a=!1;if(!o){var l=t.iterator(),c=l.locateCellID(n.id);c===OT?o=!0:c===xp&&(t.absorbIndexCell(n,l,r,s),a=!0,o=!0)}if(!o||!t.makeIndexCell(n,r,s)){for(var u=[[[],[]],[[],[]]],f=n.middle(),d=Ct(r),A;!(A=d()).done;){var y=A.value;if(y.bound.x.hi<=f.x.lo){var w=t.clipVAxis(y,f.y),S=w[0],T=w[1];S&&u[0][0].push(S),T&&u[0][1].push(T)}else if(y.bound.x.lo>=f.x.hi){var R=t.clipVAxis(y,f.y),I=R[0],P=R[1];I&&u[1][0].push(I),P&&u[1][1].push(P)}else if(y.bound.y.hi<=f.y.lo){var F=t.clipUBound(y,1,f.x.hi);F&&u[0][0].push(F);var D=t.clipUBound(y,0,f.x.lo);D&&u[1][0].push(D)}else if(y.bound.y.lo>=f.y.hi){var L=t.clipUBound(y,1,f.x.hi);L&&u[0][1].push(L);var C=t.clipUBound(y,0,f.x.lo);C&&u[1][1].push(C)}else{var B=t.clipUBound(y,1,f.x.hi),k=t.clipVAxis(B,f.y),z=k[0],G=k[1];z&&u[0][0].push(z),G&&u[0][1].push(G);var W=t.clipUBound(y,0,f.x.lo),Y=t.clipVAxis(W,f.y);z=Y[0],G=Y[1],z&&u[1][0].push(z),G&&u[1][1].push(G)}}for(var H=0;H<4;H++){var $=n.childIJ(H),J=$[0],te=$[1];(u[J][te].length>0||s.shapeIDs.length>0)&&t.updateEdges(Ca.fromParentIJ(n,J,te),u[J][te],s,o)}}a&&s.restoreStateBefore(t.pendingAdditionsPos)},this.makeIndexCell=function(n,r,s){if(r.length===0&&s.shapeIDs.length===0)return!0;for(var o=0,a=Ct(r),l;!(l=a()).done;){var c=l.value;if(n.level<c.faceEdge.maxLevel&&o++,o>t.maxEdgesPerCell)return!1}s.isActive&&r.length!==0&&(s.atCellID(n.id)||s.moveTo(n.entryVertex()),s.drawTo(n.center()),t.testAllEdges(r,s));for(var u=s.shapeIDs,f=t.countShapes(r,u),d=new wfe(f),A=0,y=0,w=0;w<f;w++){var S=void 0,T=t.shapes.size,R=T;A!==r.length&&(T=r[A].faceEdge.shapeID),y<u.length&&(R=u[y]);var I=A;if(R<T)S=new cH(R,0),S.containsCenter=!0,y++;else{for(;A<r.length&&r[A].faceEdge.shapeID===T;)A++;S=new cH(T,A-I);for(var P=I;P<A;P++)S.edges[P-I]=r[P].faceEdge.edgeID;R===T&&(S.containsCenter=!0,y++)}d.shapes[w]=S}return t.cellMap.set(n.id,d),t.cells.push(n.id),s.isActive&&r.length!==0&&(s.drawTo(n.exitVertex()),t.testAllEdges(r,s),s.setNextCellID(Ia(n.id))),!0},this.updateBound=function(n,r,s,o,a){var l=new GL(n.faceEdge,new Hr);return r===0?(l.bound.x.lo=s,l.bound.x.hi=n.bound.x.hi):(l.bound.x.lo=n.bound.x.lo,l.bound.x.hi=s),o===0?(l.bound.y.lo=a,l.bound.y.hi=n.bound.y.hi):(l.bound.y.lo=n.bound.y.lo,l.bound.y.hi=a),l},this.clipUBound=function(n,r,s){if(r===0&&n.bound.x.lo>=s||r===1&&n.bound.x.hi<=s)return n;var o=n.faceEdge,a=n.bound.y.clampPoint(F1(s,o.a.x,o.b.x,o.a.y,o.b.y)),l=o.a.x>o.b.x==o.a.y>o.b.y,c=r===1===l?1:0;return t.updateBound(n,r,s,c,a)},this.clipVBound=function(n,r,s){if(r===0&&n.bound.y.lo>=s||r===1&&n.bound.y.hi<=s)return n;var o=n.faceEdge,a=n.bound.x.clampPoint(F1(s,o.a.y,o.b.y,o.a.x,o.b.x)),l=o.a.x>o.b.x==o.a.y>o.b.y,c=r===1===l?1:0;return t.updateBound(n,c,a,r,s)},this.clipVAxis=function(n,r){return n.bound.y.hi<=r.lo?[n,void 0]:n.bound.y.lo>=r.hi?[void 0,n]:[t.clipVBound(n,1,r.hi),t.clipVBound(n,0,r.lo)]},this.absorbIndexCell=function(n,r,s,o){if(o.isActive&&s.length!==0&&t.isShapeBeingRemoved(s[0].faceEdge.shapeID)){o.atCellID(n.id)||o.moveTo(n.entryVertex()),o.drawTo(n.exitVertex()),o.setNextCellID(Ia(n.id));for(var a=Ct(s),l;!(l=a()).done;){var c=l.value,u=c.faceEdge;if(!t.isShapeBeingRemoved(u.shapeID))break;u.hasInterior&&o.testEdge(u.shapeID,u.edge)}}o.saveAndClearStateBefore(t.pendingAdditionsPos);var f=[],d=!1,A=r.indexCell();if(A)for(var y=Ct(A.shapes),w;!(w=y()).done;){var S=w.value,T=S.shapeID,R=t.shape(T);if(R){var I=S.numEdges(),P=new gH(T,void 0,void 0,R.dimension()===2);P.hasInterior&&(o.addShape(T,S.containsCenter),!d&&I>0&&(o.moveTo(n.center()),o.drawTo(n.entryVertex()),o.setNextCellID(n.id),d=!0));for(var F=0;F<I;F++){var D=S.edges[F];P.edgeID=D,P.edge=R.edge(D),P.maxLevel=vH(P.edge),P.hasInterior&&o.testEdge(T,P.edge);var L=uy(P.edge.v0,P.edge.v1,uu(n.id),S1),C=L[0],B=L[1],k=L[2];if(!k)throw new Error("invariant failure in ShapeIndex");P.a=C,P.b=B,f.push(P)}}}for(var z=f.map(function(H){return new GL(H,Pfe(H.a,H.b,n.bound()))}),G=Ct(s),W;!(W=G()).done;){var Y=W.value;if(!t.isShapeBeingRemoved(Y.faceEdge.shapeID)){z.push.apply(z,s.slice(s.indexOf(Y)));break}}s=z,t.cellMap.delete(n.id)},this.testAllEdges=function(n,r){for(var s=Ct(n),o;!(o=s()).done;){var a=o.value;a.faceEdge.hasInterior&&r.testEdge(a.faceEdge.shapeID,a.faceEdge.edge)}},this.countShapes=function(n,r){for(var s=0,o=-1,a=0,l=0,c=Ct(n),u;!(u=c()).done;){var f=u.value;if(f.faceEdge.shapeID!==o)for(s++,o=f.faceEdge.shapeID;l<r.length&&(a=r[l],!(a>o));)a<o&&s++,l++}return s+=r.length-l,s},this.maxEdgesPerCell=10,this.nextID=0,this.shapes=new Map,this.cellMap=new Map,this.cells=[],this.status=ty,this.pendingAdditionsPos=0,this.pendingRemovals=[]}var e=i.prototype;return e.removeShapeInternal=function(n,r,s){},i})(),vH=function(e){var t=e.v0.vector.sub(e.v1.vector).norm()*Bfe;return ufe.minLevel(t)},Ofe=function(e,t,n,r){this.shapeID=e,this.hasInterior=t,this.containsTrackerOrigin=n,this.edges=r};function Ufe(){return{distance:Cc(),shapeID:-1,edgeID:-1}}function qL(i,e){return i.distance<e.distance?-1:i.distance>e.distance?1:i.shapeID<e.shapeID?-1:i.shapeID>e.shapeID?1:i.edgeID<e.edgeID?-1:i.edgeID>e.edgeID?1:0}var nW=(function(){function i(){this.maxResults=1/0,this.maxDistance=Cc(),this.maxError=0,this.includeInteriors=!0,this.useBruteForce=!1}var e=i.prototype;return e.setInclusiveMaxDistance=function(n){this.maxDistance=D1(n)},e.setConservativeMaxDistance=function(n){this.maxDistance=D1(LT(n,ffe(n)))},e.clone=function(){var n=new i;return n.maxResults=this.maxResults,n.maxDistance=this.maxDistance,n.maxError=this.maxError,n.includeInteriors=this.includeInteriors,n.useBruteForce=this.useBruteForce,n},i})(),kfe=(function(){function i(t){this._includeInteriors=!0,this.point=t}var e=i.prototype;return e.maxBruteForceIndexSize=function(){return 120},e.updateMinDistanceToEdge=function(n,r,s){var o=hu(this.point,n,r,s);return{distance:o.dist,updated:o.less}},e.updateMinDistanceToPoint=function(n,r){var s=We.chordAngleBetweenPoints(this.point,n);return s<r?{distance:s,updated:!0}:{distance:r,updated:!1}},e.updateMinDistanceToCell=function(n,r){var s=n.distance(this.point);return s<r?{distance:s,updated:!0}:{distance:r,updated:!1}},e.includeInteriors=function(){return this._includeInteriors},e.setIncludeInteriors=function(n){this._includeInteriors=n},e.setMaxError=function(n){return!1},e.visitContainingShapeIds=function(n,r){var s=this,o=new _p(n,Yf);return o.visitContainingShapes(this.point,function(a){var l=n.idForShape(a);return l>=0?r(l,s.point):!0})},e.getCapBound=function(){return{center:this.point,radius:0}},i})(),zfe=(function(){function i(t,n){this._includeInteriors=!0,this.a=t,this.b=n}var e=i.prototype;return e.maxBruteForceIndexSize=function(){return 60},e.updateMinDistanceToEdge=function(n,r,s){return rW(this.a,this.b,n,r,s)},e.updateMinDistanceToPoint=function(n,r){var s=hu(n,this.a,this.b,r);return{distance:s.dist,updated:s.less}},e.updateMinDistanceToCell=function(n,r){var s=n.distanceToEdge(this.a,this.b);return s<r?{distance:s,updated:!0}:{distance:r,updated:!1}},e.includeInteriors=function(){return this._includeInteriors},e.setIncludeInteriors=function(n){this._includeInteriors=n},e.setMaxError=function(n){return!1},e.visitContainingShapeIds=function(n,r){for(var s=new _p(n,Yf),o=new Set,a=function(){var d=u[c],A=s.visitContainingShapes(d,function(y){var w=n.idForShape(y);return w>=0&&!o.has(w)?(o.add(w),r(w,d)):!0});if(!A)return{v:!1}},l,c=0,u=[this.a,this.b];c<u.length;c++)if(l=a(),l)return l.v;return!0},e.getCapBound=function(){var n=We.fromVector(this.a.vector.add(this.b.vector).normalize()),r=Math.max(We.chordAngleBetweenPoints(n,this.a),We.chordAngleBetweenPoints(n,this.b));return{center:n,radius:r}},i})(),Vfe=(function(){function i(t){this._includeInteriors=!0,this.cell=t}var e=i.prototype;return e.maxBruteForceIndexSize=function(){return 30},e.updateMinDistanceToEdge=function(n,r,s){var o=this.cell.distanceToEdge(n,r);return o<s?{distance:o,updated:!0}:{distance:s,updated:!1}},e.updateMinDistanceToPoint=function(n,r){var s=this.cell.distance(n);return s<r?{distance:s,updated:!0}:{distance:r,updated:!1}},e.updateMinDistanceToCell=function(n,r){var s=this.cell.distanceToCell(n);return s<r?{distance:s,updated:!0}:{distance:r,updated:!1}},e.includeInteriors=function(){return this._includeInteriors},e.setIncludeInteriors=function(n){this._includeInteriors=n},e.setMaxError=function(n){return!1},e.visitContainingShapeIds=function(n,r){var s=new _p(n,Yf),o=this.cell.center();return s.visitContainingShapes(o,function(a){var l=n.idForShape(a);return l>=0?r(l,o):!0})},e.getCapBound=function(){for(var n=this.cell.center(),r=0,s=0;s<4;s++){var o=We.chordAngleBetweenPoints(n,this.cell.vertex(s));o>r&&(r=o)}return{center:n,radius:r}},i})(),iW=(function(){function i(t){this._includeInteriors=!0,this.index=t,this.query=new _p(t,Yf)}var e=i.prototype;return e.maxBruteForceIndexSize=function(){return 25},e.updateMinDistanceToEdge=function(n,r,s){if(this._includeInteriors&&(this.query.contains(n)||this.query.contains(r)))return{distance:0,updated:s>0};for(var o=!1,a=Ct(this.index.shapes),l;!(l=a()).done;){var c=l.value,u=c[1];if(u)for(var f=u.numEdges(),d=0;d<f;d++){var A=u.edge(d),y=rW(n,r,A.v0,A.v1,s);if(y.updated&&(s=y.distance,o=!0),s===0)return{distance:0,updated:o}}}return{distance:s,updated:o}},e.updateMinDistanceToPoint=function(n,r){if(this._includeInteriors&&this.query.contains(n))return{distance:0,updated:r>0};for(var s=!1,o=Ct(this.index.shapes),a;!(a=o()).done;){var l=a.value,c=l[1];if(c)for(var u=c.numEdges(),f=0;f<u;f++){var d=c.edge(f),A=hu(n,d.v0,d.v1,r);if(A.less&&(r=A.dist,s=!0),r===0)return{distance:0,updated:s}}}return{distance:r,updated:s}},e.updateMinDistanceToCell=function(n,r){if(this._includeInteriors&&this.query.contains(n.center()))return{distance:0,updated:r>0};for(var s=!1,o=Ct(this.index.shapes),a;!(a=o()).done;){var l=a.value,c=l[1];if(c)for(var u=c.numEdges(),f=0;f<u;f++){var d=c.edge(f),A=n.distanceToEdge(d.v0,d.v1);if(A<r&&(r=A,s=!0),r===0)return{distance:0,updated:s}}}return{distance:r,updated:s}},e.includeInteriors=function(){return this._includeInteriors},e.setIncludeInteriors=function(n){this._includeInteriors=n},e.setMaxError=function(n){return!1},e.visitContainingShapeIds=function(n,r){for(var s=new _p(n,Yf),o=new Set,a=Ct(this.index.shapes),l;!(l=a()).done;){var c=l.value,u=c[1];if(u){for(var f=u.numEdges(),d=0;d<f;d++)for(var A=u.edge(d),y=function(){var I=T[S],P=s.visitContainingShapes(I,function(F){var D=n.idForShape(F);return D>=0&&!o.has(D)?(o.add(D),r(D,I)):!0});if(!P)return{v:!1}},w,S=0,T=[A.v0,A.v1];S<T.length;S++)if(w=y(),w)return w.v}}return!0},e.getCapBound=function(){if(this.index.len()===0)return null;for(var n=null,r=0,s=Ct(this.index.shapes),o;!(o=s()).done;){var a=o.value,l=a[1];if(l)for(var c=l.numEdges(),u=0;u<c;u++){var f=l.edge(u);n===null&&(n=f.v0);var d=We.chordAngleBetweenPoints(n,f.v0),A=We.chordAngleBetweenPoints(n,f.v1);r=Math.max(r,d,A)}}return n===null?null:{center:n,radius:r}},i})();function rW(i,e,t,n,r){if(r===0)return{distance:0,updated:!1};if(WH(i,e,t,n)===Ec)return{distance:0,updated:!0};var s=!1,o=hu(i,t,n,r);return o.less&&(r=o.dist,s=!0),o=hu(e,t,n,r),o.less&&(r=o.dist,s=!0),o=hu(t,i,e,r),o.less&&(r=o.dist,s=!0),o=hu(n,i,e,r),o.less&&(r=o.dist,s=!0),{distance:r,updated:s}}var Gfe=(function(){function i(t,n){n===void 0&&(n=new nW),this.indexNumEdges=0,this.indexNumEdgesLimit=0,this.index=t,this.options=n,this.iter=t.iterator()}var e=i.prototype;return e.reInit=function(){this.indexNumEdges=0,this.indexNumEdgesLimit=0,this.iter=this.index.iterator()},e.findClosestEdges=function(n,r){return this.findClosestEdgesInternal(n,this.options,r)},e.visitClosestEdges=function(n,r,s,o){for(var a=this.findClosestEdgesInternal(n,r,o),l=Ct(a),c;!(c=l()).done;){var u=c.value;if(!s(u))break}},e.visitClosestShapes=function(n,r,s,o){for(var a=this.findClosestEdgesInternal(n,r,o),l=new Set,c=-1,u=Ct(a),f;!(f=u()).done;){var d=f.value,A=d.shapeID;if(A!==c&&!l.has(A)&&(l.add(A),c=A,!s(d)))break}},e.findClosestEdge=function(n,r){var s=this.options.clone();s.maxResults=1;var o=this.findClosestEdgesInternal(n,s,r);return o.length===0?Ufe():o[0]},e.getDistance=function(n,r){return this.findClosestEdge(n,r).distance},e.isDistanceLess=function(n,r,s){var o=this.options.clone();o.maxResults=1,o.maxDistance=r,o.maxError=Sc;var a=this.findClosestEdgesInternal(n,o,s);return a.length>0},e.isDistanceLessOrEqual=function(n,r,s){var o=this.options.clone();o.maxResults=1,o.setInclusiveMaxDistance(r),o.maxError=Sc;var a=this.findClosestEdgesInternal(n,o,s);return a.length>0},e.isConservativeDistanceLessOrEqual=function(n,r,s){var o=this.options.clone();o.maxResults=1,o.setConservativeMaxDistance(r),o.maxError=Sc;var a=this.findClosestEdgesInternal(n,o,s);return a.length>0},e.getEdge=function(n){var r=this.index.shape(n.shapeID);return r.edge(n.edgeID)},e.project=function(n,r){if(r.edgeID<0)return n;var s=this.getEdge(r);return XH(n,s.v0,s.v1)},e.findClosestEdgesInternal=function(n,r,s){var o=r.maxDistance,a=[];if(o===0)return a;if(r.includeInteriors){var l=new Set;n.visitContainingShapeIds(this.index,function(T,R){return(!s||s(T))&&l.add(T),l.size<r.maxResults});for(var c=Ct(l),u;!(u=c()).done;){var f=u.value;a.push({distance:0,shapeID:f,edgeID:-1})}if(o===0)return a}var d=n.maxBruteForceIndexSize()+1;d>this.indexNumEdgesLimit&&this.indexNumEdges>=this.indexNumEdgesLimit&&(this.indexNumEdges=this.countEdgesUpTo(d),this.indexNumEdgesLimit=d),r.useBruteForce||this.indexNumEdges<d?this.findClosestEdgesBruteForce(n,r,s,o,a):this.findClosestEdgesOptimized(n,r,s,o,a),a.sort(qL);for(var A=[],y=0,w=a;y<w.length;y++){var S=w[y];(A.length===0||A[A.length-1].shapeID!==S.shapeID||A[A.length-1].edgeID!==S.edgeID)&&A.push(S)}return A.length>r.maxResults&&(A.length=r.maxResults),A},e.findClosestEdgesBruteForce=function(n,r,s,o,a){for(var l=Ct(this.index.shapes),c;!(c=l()).done;){var u=c.value,f=u[0],d=u[1];if(d&&!(s&&!s(f)))for(var A=d.numEdges(),y=0;y<A;y++){var w=d.edge(y),S=n.updateMinDistanceToEdge(w.v0,w.v1,o);if(S.updated){var T={distance:S.distance,shapeID:f,edgeID:y};r.maxResults===1?(a.length===0?a.push(T):a[0]=T,o=S.distance-r.maxError):r.maxResults===1/0?a.push(T):(a.push(T),a.length>r.maxResults&&(a.sort(qL),a.length=r.maxResults,o=a[a.length-1].distance-r.maxError))}}}},e.findClosestEdgesOptimized=function(n,r,s,o,a){var l=n.getCapBound();if(l){if(this.iter=this.index.iterator(),r.maxResults===1&&this.iter.locatePoint(l.center)){var c=this.iter.indexCell();if(o=this.processIndexCell(n,r,s,c,o,a),o===0)return}var u=[];for(this.iter.begin();!this.iter.done();){var f=this.iter.cellID(),d=Pa.fromCellID(f),A=n.updateMinDistanceToCell(d,o);A.distance<o&&u.push({distance:A.distance,id:f,indexCell:this.iter.indexCell()}),this.iter.next()}for(u.sort(function(C,B){return C.distance-B.distance});u.length>0;){var y=u.shift();if(y.distance>=o)break;if(y.indexCell!==null)o=this.processIndexCell(n,r,s,y.indexCell,o,a);else{console.log("HEYYYY");for(var w=U1(y.id),S=Ct(w),T;!(T=S()).done;){var R=T.value,I=this.iter.locateCellID(R);if(I===xp){var P=Pa.fromCellID(this.iter.cellID()),F=n.updateMinDistanceToCell(P,o);F.distance<o&&u.push({distance:F.distance,id:this.iter.cellID(),indexCell:this.iter.indexCell()})}else if(I===vy){var D=Pa.fromCellID(R),L=n.updateMinDistanceToCell(D,o);L.distance<o&&u.push({distance:L.distance,id:R,indexCell:null})}}u.sort(function(C,B){return C.distance-B.distance})}}}},e.processIndexCell=function(n,r,s,o,a,l){for(var c=Ct(o.shapes),u;!(u=c()).done;){var f=u.value,d=f.shapeID;if(!(s&&!s(d))){var A=this.index.shape(d);if(A)for(var y=Ct(f.edges),w;!(w=y()).done;){var S=w.value,T=A.edge(S),R=n.updateMinDistanceToEdge(T.v0,T.v1,a);if(R.updated){var I={distance:R.distance,shapeID:d,edgeID:S};r.maxResults===1?(l.length===0?l.push(I):l[0]=I,a=R.distance-r.maxError):r.maxResults===1/0?l.push(I):(l.push(I),l.length>r.maxResults&&(l.sort(qL),l.length=r.maxResults,a=l[l.length-1].distance-r.maxError))}}}}return a},e.countEdgesUpTo=function(n){for(var r=0,s=Ct(this.index.shapes),o;!(o=s()).done;){var a=o.value,l=a[1];if(l&&(r+=l.numEdges(),r>=n))break}return r},i})();function qfe(){return{distance:Cc(),cellID:0n,label:-1}}function Hfe(i){return i.label<0}var sW=(function(){function i(){this.maxResults=1/0,this.maxDistance=Cc(),this.maxError=0}var e=i.prototype;return e.setInclusiveMaxDistance=function(n){this.maxDistance=D1(n)},e.setConservativeMaxDistance=function(n){this.maxDistance=D1(LT(n,this.computeMaxDistanceError(n)))},e.computeMaxDistanceError=function(n){return hD(n)},i})(),Wfe=(function(){function i(t){this.point=t}var e=i.prototype;return e.maxBruteForceIndexSize=function(){return 100},e.distanceToCell=function(n){return n.distance(this.point)},e.distanceToPoint=function(n){return We.chordAngleBetweenPoints(this.point,n)},i})(),jfe=(function(){function i(t,n){this.a=t,this.b=n}var e=i.prototype;return e.maxBruteForceIndexSize=function(){return 100},e.distanceToCell=function(n){return n.distanceToEdge(this.a,this.b)},e.distanceToPoint=function(n){return hu(n,this.a,this.b,Cc()).dist},i})(),Xfe=(function(){function i(t){this.cell=t}var e=i.prototype;return e.maxBruteForceIndexSize=function(){return 100},e.distanceToCell=function(n){return this.cell.distanceToCell(n)},e.distanceToPoint=function(n){return this.cell.distance(n)},i})(),$fe=(function(){function i(t){this.cellUnion=t}var e=i.prototype;return e.maxBruteForceIndexSize=function(){return 100},e.distanceToCell=function(n){for(var r=Cc(),s=Ct(this.cellUnion),o;!(o=s()).done;){var a=o.value,l=Pa.fromCellID(a),c=l.distanceToCell(n);if(c<r&&(r=c),r===0)break}return r},e.distanceToPoint=function(n){for(var r=Cc(),s=Ct(this.cellUnion),o;!(o=s()).done;){var a=o.value,l=Pa.fromCellID(a),c=l.distance(n);if(c<r&&(r=c),r===0)break}return r},i})(),Yfe=(function(){function i(t){this.index=t,this.edgeTarget=new iW(t)}var e=i.prototype;return e.setIncludeInteriors=function(n){this.edgeTarget.setIncludeInteriors(n)},e.maxBruteForceIndexSize=function(){return this.edgeTarget.maxBruteForceIndexSize()},e.distanceToCell=function(n){var r=this.edgeTarget.updateMinDistanceToCell(n,Cc());return r.distance},e.distanceToPoint=function(n){var r=this.edgeTarget.updateMinDistanceToPoint(n,Cc());return r.distance},i})(),Zfe=(function(){function i(t,n){n===void 0&&(n=new sW),this.index=t,this.options=n}var e=i.prototype;return e.findClosestCells=function(n){var r=new YH(this.index,!0),s=new ZH(this.index),o=[];for(r.begin();!r.done();r.next())for(s.startUnion(r);!s.done();){var a=s.cellID(),l=s.label(),c=Pa.fromCellID(a);if(this.options.region&&!this.options.region.intersectsCell(c)){s.next();continue}var u=n.distanceToCell(c);u<this.options.maxDistance&&o.push({cellID:a,label:l,distance:u}),s.next()}o.sort(function(d,A){return d.distance-A.distance});var f=Math.min(o.length,this.options.maxResults);return o.slice(0,f)},e.findClosestCell=function(n){var r=this.options.maxResults;this.options.maxResults=1;var s=this.findClosestCells(n);return this.options.maxResults=r,s.length===0?qfe():s[0]},e.getDistance=function(n){return this.findClosestCell(n).distance},e.isDistanceLess=function(n,r){var s=this.options.maxResults,o=this.options.maxDistance;this.options.maxResults=1,this.options.maxDistance=r;var a=this.findClosestCell(n);return this.options.maxResults=s,this.options.maxDistance=o,!Hfe(a)},e.isDistanceLessOrEqual=function(n,r){return this.isDistanceLess(n,D1(r))},e.isConservativeDistanceLessOrEqual=function(n,r){return this.isDistanceLess(n,D1(LT(r,hD(r))))},i})(),B1=(function(){function i(){this.a=new We(0,0,0),this.aLL=new ar(0,0),this.bound=Ri.emptyRect()}i.maxErrorForTests=function(){return new ar(10*Ki,1*Ki)};var e=i.prototype;return e.addPoint=function(n){var r=ar.fromPoint(n);if(this.bound.isEmpty()){this.a=n,this.aLL=r,this.bound=this.bound.addPoint(r);return}var s=this.a.vector.sub(n.vector).cross(this.a.vector.add(n.vector)),o=s.norm();if(o<191346e-20){this.a.vector.dot(n.vector)<0?this.bound=Ri.fullRect():this.bound=this.bound.union(Ri.fromLatLng(this.aLL).addPoint(r)),this.a=n,this.aLL=r;return}var a=eo.emptyInterval().addPoint(this.aLL.lng).addPoint(r.lng);a.length()>=Math.PI-2*Ki&&(a=eo.fullInterval());var l=Li.fromPoint(this.aLL.lat).addPoint(r.lat),c=s.cross(new Wt(0,0,1)),u=c.dot(this.a.vector),f=c.dot(n.vector),d=606638e-21*o+683174e-36;if(u*f<0||Math.abs(u)<=d||Math.abs(f)<=d){var A=Math.min(Math.atan2(Math.sqrt(s.x*s.x+s.y*s.y),Math.abs(s.z))+3*Ki,Math.PI/2),y=2*Math.asin(.5*this.a.vector.sub(n.vector).norm()*Math.sin(A)),w=.5*(y-l.length())+Ki;u<=d&&f>=-d&&(l.hi=Math.min(A,l.hi+w)),f<=d&&u>=-d&&(l.lo=Math.max(-A,l.lo-w))}this.a=n,this.aLL=r,this.bound=this.bound.union(new Ri(l,a))},e.rectBound=function(){return this.bound.expanded(new ar(2*Ki,0)).polarClosure()},i})();B1.expandForSubregions=function(i){if(i.isEmpty())return i;var e=Math.max(0,Math.PI-i.lng.length()-2.5*Ki),t=Math.max(i.lat.lo,-i.lat.hi),n=Math.PI/2+i.lat.lo,r=Math.PI/2-i.lat.hi;if(t>=0){if(2*t+e<1354e-18)return Ri.fullRect()}else if(e>=Math.PI/2){if(n+r<1687e-18)return Ri.fullRect()}else if(Math.max(n,r)*e<1765e-18)return Ri.fullRect();var s=9*Ki,o=0;return e<=0&&(o=Math.PI),i.expanded(new ar(s,o)).polarClosure()};var oW=function(e,t,n,r,s){return We.orderedCCW(n,s,r,t)&&We.orderedCCW(r,e,n,t)},Kfe=function(e,t,n,r,s){return!(We.orderedCCW(e,s,r,t)&&We.orderedCCW(r,n,e,t))},Qfe=(function(){function i(t){this.a=new Ci(0,0),this.b=new Ci(0,0),this.index=t,this.iter=t.iterator(),this.cells=[]}var e=i.prototype;return e.crossings=function(n,r,s,o){var a=this.candidates(n,r,s);if(a.length===0)return[];for(var l=new Gl(n,r),c=0,u=a.length,f=0;f<u;f++){var d=s.edge(a[f]),A=l.crossingSign(d.v0,d.v1);(o===vT&&(A===CT||A===Ec)||o!==vT&&A===Ec)&&(a[c]=a[f],c++)}return c<u&&(a=a.slice(0,c)),a},e.crossingsEdgeMap=function(n,r,s){var o=this.candidatesEdgeMap(n,r);if(o.size===0)return o;var a=new Gl(n,r);return o.forEach(function(l,c){for(var u=l.length,f=0,d=0;d<u;d++){var A=c.edge(l[d]),y=a.crossingSign(A.v0,A.v1);(s===vT&&(y===CT||y===Ec)||s!==vT&&y===Ec)&&(l[f]=l[d],o.set(c,l),f++)}f===0?o.delete(c):f<u&&o.set(c,o.get(c).slice(0,f))}),o},e.candidates=function(n,r,s){var o=[],a=27,l=s.numEdges();if(l<=a)return o=Array.from({length:l},function(w,S){return S}),o;if(this.getCellsForEdge(n,r),this.cells.length===0)return[];var c=-1;this.index.shapes.forEach(function(w,S){w===s&&(c=S)});for(var u=Ct(this.cells),f;!(f=u()).done;){var d,A=f.value;if(A){var y=A.findByShapeID(c);y&&(d=o).push.apply(d,y.edges)}}return this.cells.length>1&&(o=i.uniqueInts(o)),o},i.uniqueInts=function(n){for(var r=[],s={},o=Ct(n),a;!(a=o()).done;){var l=a.value;s[l]||(s[l]=!0,r.push(l))}return r.sort(function(c,u){return c-u}),r},e.candidatesEdgeMap=function(n,r){var s=new Jfe;if(this.index.shapes.size===1){var o=this.index.shape(0);return s.set(o,this.candidates(n,r,o)),s}if(this.getCellsForEdge(n,r),this.cells.length===0)return s;for(var a=Ct(this.cells),l;!(l=a()).done;)for(var c=l.value,u=Ct(c.shapes),f;!(f=u()).done;)for(var d=f.value,A=this.index.shape(d.shapeID),y=0;y<d.numEdges();y++)s.set(A,(s.get(A)||[]).concat([d.edges[y]]));return this.cells.length>1&&s.forEach(function(w,S){s.set(S,i.uniqueInts(w))}),s},e.getCells=function(n,r,s){var o=Cfe(n,r,uu(s.id)),a=o[0],l=o[1],c=o[2];if(c){this.a=a,this.b=l;var u=Hr.fromPoints(this.a,this.b);s.bound().intersects(u)&&this.computeCellsIntersected(s,u)}return this.cells.length===0?[]:this.cells},e.getCellsForEdge=function(n,r){this.cells=[];for(var s=Dfe(n,r),o=Ct(s),a;!(a=o()).done;){var l=a.value;this.a=l.a,this.b=l.b;var c=Hr.fromPoints(this.a,this.b),u=Ca.fromCellID(vp(l.face),0),f=u.shrinkToFit(c),d=this.iter.locateCellID(f);d===xp?this.cells.push(this.iter.indexCell()):d===vy&&(dy(f)||(u=Ca.fromCellID(f,0)),this.computeCellsIntersected(u,c))}},e.computeCellsIntersected=function(n,r){if(this.iter.seek(qi(n.id)),!(this.iter.done()||this.iter.cellID()>Gi(n.id))){if(this.iter.cellID()===n.id){this.cells.push(this.iter.indexCell());return}var s=n.middle().lo();if(r.x.hi<s.x){this.clipVAxis(r,s.y,0,n);return}else if(r.x.lo>=s.x){this.clipVAxis(r,s.y,1,n);return}var o=this.splitUBound(r,s.x);r.y.hi<s.y?(this.computeCellsIntersected(Ca.fromParentIJ(n,0,0),o[0]),this.computeCellsIntersected(Ca.fromParentIJ(n,1,0),o[1])):r.y.lo>=s.y?(this.computeCellsIntersected(Ca.fromParentIJ(n,0,1),o[0]),this.computeCellsIntersected(Ca.fromParentIJ(n,1,1),o[1])):(this.clipVAxis(o[0],s.y,0,n),this.clipVAxis(o[1],s.y,1,n))}},e.clipVAxis=function(n,r,s,o){if(n.y.hi<r)this.computeCellsIntersected(Ca.fromParentIJ(o,s,0),n);else if(n.y.lo>=r)this.computeCellsIntersected(Ca.fromParentIJ(o,s,1),n);else{var a=this.splitVBound(n,r);this.computeCellsIntersected(Ca.fromParentIJ(o,s,0),a[0]),this.computeCellsIntersected(Ca.fromParentIJ(o,s,1),a[1])}},e.splitUBound=function(n,r){var s=n.y.clampPoint(F1(r,this.a.x,this.b.x,this.a.y,this.b.y)),o=this.a.x>this.b.x!=this.a.y>this.b.y?1:0;return this.splitBound(n,0,o,r,s)},e.splitVBound=function(n,r){var s=n.x.clampPoint(F1(r,this.a.y,this.b.y,this.a.x,this.b.x)),o=this.a.x>this.b.x!=this.a.y>this.b.y?1:0;return this.splitBound(n,o,0,s,r)},e.splitBound=function(n,r,s,o,a){var l=[Hr.fromRect(n),Hr.fromRect(n)];return r===1?(l[0].x.lo=o,l[1].x.hi=o):(l[0].x.hi=o,l[1].x.lo=o),s===1?(l[0].y.lo=a,l[1].y.hi=a):(l[0].y.hi=a,l[1].y.lo=a),l},i})(),Jfe=(function(i){function e(){return i.apply(this,arguments)||this}return hy(e,i),e})(I1(Map)),ede=function(e,t,n){var r=1,s=t.distance(n);s!==0&&(r=s/Math.sin(s));var o=1,a=n.distance(e);a!==0&&(o=a/Math.sin(a));var l=1,c=e.distance(t);c!==0&&(l=c/Math.sin(c));var u=new Wt(e.x,t.x-e.x,n.x-e.x),f=new Wt(e.y,t.y-e.y,n.y-e.y),d=new Wt(e.z,t.z-e.z,n.z-e.z),A=new Wt(r,o-r,l-r);return We.fromVector(new Wt(f.cross(d).dot(A),d.cross(u).dot(A),u.cross(f).dot(A)).mul(.5))},_H=new We(0,0,1),xH=new We(0,0,-1),lD=(function(){function i(t){this.originInside=!1,this.depth=0,this.bound=Ri.emptyRect(),this.subregionBound=Ri.emptyRect(),this.vertices=t,this.index=new RT,this.initOriginAndBound()}i.fromCell=function(n){var r=[n.vertex(0),n.vertex(1),n.vertex(2),n.vertex(3)];return new i(r)},i.fromLoop=function(n){return new i(n.vertices.map(function(r){return We.fromVector(r.vector)}))},i.emptyLoop=function(){return new i([_H])},i.fullLoop=function(){return new i([xH])};var e=i.prototype;return e.initOriginAndBound=function(){if(this.vertices.length<3){if(!this.isEmptyOrFull()){this.originInside=!1;return}this.originInside=this.vertices[0].z<0}else{var n=this.vertices[0]!==this.vertices[1]&&this.vertices[2]!==this.vertices[1]&&cfe(this.vertices[0],this.vertices[1],this.vertices[2]);this.originInside=!1,n!==this.containsPoint(this.vertices[1])&&(this.originInside=!0)}this.initBound(),this.index.add(this)},e.copyFrom=function(n){this.vertices=n.vertices,this.originInside=n.originInside,this.depth=n.depth,this.bound=n.bound,this.subregionBound=n.subregionBound,this.index=n.index},e.initBound=function(){if(this.vertices.length===0){this.copyFrom(i.emptyLoop());return}if(this.isEmptyOrFull()){this.isEmpty()?this.bound=Ri.emptyRect():this.bound=Ri.fullRect(),this.subregionBound=this.bound;return}for(var n=new B1,r=0;r<=this.vertices.length;r++)n.addPoint(this.vertex(r));var s=n.rectBound();this.containsPoint(new We(0,0,1))&&(s=new Ri(new Li(s.lat.lo,Math.PI/2),eo.fullInterval())),s.lng.isFull()&&this.containsPoint(new We(0,0,-1))&&(s.lat.lo=-Math.PI/2),this.bound=s,this.subregionBound=B1.expandForSubregions(this.bound)},e.validate=function(){var n=this.findValidationErrorNoIndex();return n||null},e.findValidationErrorNoIndex=function(){for(var n=0;n<this.vertices.length;n++){var r=this.vertices[n];if(!r.vector.isUnit())return new Error("vertex "+n+" is not unit length")}if(this.vertices.length<3)return this.isEmptyOrFull()?null:new Error("non-empty, non-full loops must have at least 3 vertices");for(var s=0;s<this.vertices.length;s++){if(this.vertices[s].equals(this.vertex(s+1)))return new Error("edge "+s+" is degenerate (duplicate vertex)");var o=We.fromVector(this.vertex(s+1).vector.mul(-1));if(this.vertices[s].equals(o))return new Error("vertices "+s+" and "+(s+1)%this.vertices.length+" are antipodal")}return null},e.contains=function(n){if(!this.subregionBound.contains(n.bound))return!1;if(this.isEmptyOrFull()||n.isEmptyOrFull())return this.isFull()||n.isEmpty();var r=new tde;return HL(this,n,r)?!1:r.foundSharedVertex?!0:!(!this.containsPoint(n.vertex(0))||(n.subregionBound.contains(this.bound)||n.bound.union(this.bound).isFull())&&n.containsPoint(this.vertex(0)))},e.intersects=function(n){if(!this.bound.intersects(n.bound))return!1;var r=new nde;return HL(this,n,r)?!0:r.foundSharedVertex?!1:!!((this.subregionBound.contains(n.bound)||this.bound.union(n.bound).isFull())&&this.containsPoint(n.vertex(0))||n.subregionBound.contains(this.bound)&&n.containsPoint(this.vertex(0)))},e.equal=function(n){if(this.vertices.length!==n.vertices.length)return!1;for(var r=0;r<this.vertices.length;r++)if(this.vertices[r]!==n.vertex(r))return!1;return!0},e.boundaryEqual=function(n){if(this.vertices.length!==n.vertices.length)return!1;if(this.isEmptyOrFull())return this.isEmpty()===n.isEmpty();for(var r=0;r<this.vertices.length;r++)if(this.vertices[r].equals(n.vertex(0))){for(var s=0;s<this.vertices.length;s++)if(this.vertex(s+r)!==n.vertex(s))return!1;return!0}return!1},e.compareBoundary=function(n){if(!this.bound.intersects(n.bound))return-1;if(this.isFull())return 1;if(n.isFull())return-1;var r=new ide(n.isHole());return HL(this,n,r)?0:r.foundSharedVertex?r.containsEdge?1:-1:this.containsPoint(n.vertex(0))?1:-1},e.containsOrigin=function(){return this.originInside},e.referencePoint=function(){return BT(this.originInside)},e.numEdges=function(){return this.isEmptyOrFull()?0:this.vertices.length},e.edge=function(n){return new ah(this.vertex(n),this.vertex(n+1))},e.numChains=function(){return this.isEmpty()?0:1},e.chain=function(n){return new P1(0,this.numEdges())},e.chainEdge=function(n,r){return new ah(this.vertex(r),this.vertex(r+1))},e.chainPosition=function(n){return new FT(0,n)},e.dimension=function(){return 2},e.typeTag=function(){return KH},e.privateInterface=function(){},e.isEmpty=function(){return this.isEmptyOrFull()&&!this.containsOrigin()},e.isFull=function(){return this.isEmptyOrFull()&&this.containsOrigin()},e.isEmptyOrFull=function(){return this.vertices.length===1},e.rectBound=function(){return this.bound},e.capBound=function(){return this.bound.capBound()},e.vertex=function(n){return this.vertices[n%this.vertices.length]},e.orientedVertex=function(n){var r=n-this.vertices.length;return r<0&&(r=n),this.isHole()&&(r=this.vertices.length-1-r),this.vertex(r)},e.numVertices=function(){return this.vertices.length},e.bruteForceContainsPoint=function(n){for(var r=We.originPoint(),s=this.originInside,o=Gl.newChainEdgeCrosser(r,n,this.vertex(0)),a=1;a<=this.vertices.length;a++)s=s!==o.edgeOrVertexChainCrossing(this.vertex(a));return s},e.containsPoint=function(n){if(!this.index.isFresh()&&!this.bound.containsPoint(n))return!1;var r=32;if(this.index.shapes.size===0||this.vertices.length<=r)return this.bruteForceContainsPoint(n);var s=this.index.iterator();return s.locatePoint(n)?this.iteratorContainsPoint(s,n):!1},e.containsCell=function(n){var r=this.index.iterator(),s=r.locateCellID(n.id);return s!==xp||this.boundaryApproxIntersects(r,n)?!1:this.iteratorContainsPoint(r,n.center())},e.intersectsCell=function(n){var r=this.index.iterator(),s=r.locateCellID(n.id);return s===OT?!1:s===vy||r.cellID()===n.id||this.boundaryApproxIntersects(r,n)?!0:this.iteratorContainsPoint(r,n.center())},e.cellUnionBound=function(){return this.capBound().cellUnionBound()},e.boundaryApproxIntersects=function(n,r){var s=n.indexCell().findByShapeID(0);if(s.edges.length===0)return!1;if(n.cellID()===r.id)return!0;for(var o=gy+eW,a=r.boundUV().expandedByMargin(o),l=Ct(s.edges),c;!(c=l()).done;){var u=c.value,f=uy(this.vertex(u),this.vertex(u+1),r.face,o),d=f[0],A=f[1],y=f[2];if(y&&tW(d,A,a))return!0}return!1},e.iteratorContainsPoint=function(n,r){var s,o=(s=n.indexCell())==null?void 0:s.findByShapeID(0),a=o?.containsCenter||!1;if(o&&o.edges.length>0)for(var l=n.center(),c=new Gl(l,r),u=-2,f=Ct(o.edges),d;!(d=f()).done;){var A=d.value;A!==u+1&&c.restartAt(this.vertex(A)),u=A,a=a!==c.edgeOrVertexChainCrossing(this.vertex(A+1))}return a},i.regularLoop=function(n,r,s){return i.regularLoopForFrame(dD(n),r,s)},i.regularLoopForFrame=function(n,r,s){return new i(We.regularPointsForFrame(n,r,s))},e.canonicalFirstVertex=function(){for(var n=0,r=this.vertices.length,s=1;s<r;s++)this.vertex(s).vector.cmp(this.vertex(n).vector)===-1&&(n=s);return this.vertex(n+1).vector.cmp(this.vertex(n+r-1).vector)===-1?[n,1]:(n+=r,[n,-1])},e.turningAngle=function(){if(this.isEmptyOrFull())return this.containsOrigin()?-2*Math.PI:2*Math.PI;if(this.vertices.length<3)return 0;for(var n=this.canonicalFirstVertex(),r=n[0],s=n[1],o=aH(this.vertex((r+this.vertices.length-s)%this.vertices.length),this.vertex(r),this.vertex((r+s)%this.vertices.length)),a=0,l=this.vertices.length-1;l>0;l--){r+=s;var c=aH(this.vertex(r-s),this.vertex(r),this.vertex(r+s)),u=o;o+=c+a,a=u-o+c}var f=2*Math.PI-4*Ki;return Math.max(-f,Math.min(f,s*(o+a)))},e.turningAngleMaxError=function(){var n=11.25*Ki;return n*this.vertices.length},e.isHole=function(){return(this.depth&1)!==0},e.sign=function(){return this.isHole()?-1:1},e.isNormalized=function(){return this.bound.lng.length()<Math.PI?!0:this.turningAngle()>=-this.turningAngleMaxError()},e.normalize=function(){this.isNormalized()||this.invert()},e.invert=function(){if(this.index.reset(),this.isEmptyOrFull())this.vertices[0]=this.isFull()?_H:xH;else for(var n=Math.floor(this.vertices.length/2)-1;n>=0;n--){var r=this.vertices.length-1-n,s=[this.vertices[r],this.vertices[n]];this.vertices[n]=s[0],this.vertices[r]=s[1]}this.originInside=!this.originInside,this.bound.lat.lo>-Math.PI/2&&this.bound.lat.hi<Math.PI/2?(this.bound=Ri.fullRect(),this.subregionBound=this.bound):this.initBound(),this.index.add(this)},e.findVertex=function(n){var r=0;if(this.vertices.length<10){for(var s=1;s<=this.vertices.length;s++)if(this.vertex(s).equals(n))return[s,!0];return[r,!1]}var o=this.index.iterator();if(!o.locatePoint(n))return[r,!1];for(var a=o.indexCell().findByShapeID(0),l=a.numEdges()-1;l>=0;l--){var c=a.edges[l];if(this.vertex(c).equals(n))return c===0?[this.vertices.length,!0]:[c,!0];if(this.vertex(c+1).equals(n))return[c+1,!0]}return[r,!1]},e.containsNested=function(n){if(!this.subregionBound.contains(n.bound))return!1;if(this.isEmptyOrFull()||n.numVertices()<2)return this.isFull()||n.isEmpty();var r=this.findVertex(n.vertex(1)),s=r[0],o=r[1];return o?oW(this.vertex(s-1),this.vertex(s),this.vertex(s+1),n.vertex(0),n.vertex(2)):this.containsPoint(n.vertex(1))},e.surfaceIntegralFloat64=function(n){for(var r=Math.PI-1e-5,s=0,o=this.vertex(0),a=1;a+1<this.vertices.length;a++){if(this.vertex(a+1).vector.angle(o.vector)>r){var l=o;o.equals(this.vertex(0))?o=We.fromVector(this.vertex(0).pointCross(this.vertex(a)).vector.normalize()):this.vertex(a).vector.angle(this.vertex(0).vector)<r?o=this.vertex(0):(o=We.fromVector(this.vertex(0).vector.cross(l.vector)),s+=n(this.vertex(0),l,o)),s+=n(l,this.vertex(a),o)}s+=n(o,this.vertex(a),this.vertex(a+1))}return o!==this.vertex(0)&&(s+=n(o,this.vertex(this.vertices.length-1),this.vertex(0))),s},e.surfaceIntegralPoint=function(n){for(var r=Math.PI-1e-5,s=new We(0,0,0).vector,o=this.vertex(0),a=1;a+1<this.vertices.length;a++){if(this.vertex(a+1).vector.angle(o.vector)>r){var l=o;o.equals(this.vertex(0))?o=We.fromVector(this.vertex(0).pointCross(this.vertex(a)).vector.normalize()):this.vertex(a).vector.angle(this.vertex(0).vector)<r?o=this.vertex(0):(o=We.fromVector(this.vertex(0).vector.cross(l.vector)),s=s.add(n(this.vertex(0),l,o).vector)),s=s.add(n(l,this.vertex(a),o).vector)}s=s.add(n(o,this.vertex(a),this.vertex(a+1)).vector)}return o!==this.vertex(0)&&(s=s.add(n(o,this.vertex(this.vertices.length-1),this.vertex(0)).vector)),We.fromVector(s)},e.area=function(){if(this.isEmptyOrFull())return this.containsOrigin()?4*Math.PI:0;var n=this.surfaceIntegralFloat64(Afe),r=this.turningAngleMaxError();return n<0&&(n+=4*Math.PI),n>4*Math.PI&&(n=4*Math.PI),n<0&&(n=0),n<r&&!this.isNormalized()?4*Math.PI:n>4*Math.PI-r&&this.isNormalized()?0:n},e.centroid=function(){return this.surfaceIntegralPoint(ede)},e.containsNonCrossingBoundary=function(n,r){if(!this.bound.intersects(n.bound))return!1;if(this.isFull())return!0;if(n.isFull())return!1;var s=this.findVertex(n.vertex(0)),o=s[0],a=s[1];return a?lW(this.vertex(o-1),this.vertex(o),this.vertex(o+1),n.vertex(1),r):this.containsPoint(n.vertex(0))},i})(),PT=function(e,t){return!e.containsCenter&&t===aW||e.containsCenter&&t===IT},HL=function(e,t,n){for(var r=new mH(e.index),s=new mH(t.index),o=new bH(e,t,n,!1),a=new bH(t,e,n,!0);!r.done()||!s.done();)if(r.rangeMax<s.rangeMin)r.seekTo(s);else if(s.rangeMax<r.rangeMin)s.seekTo(r);else{var l=ls(r.it.cellID())-ls(s.it.cellID());if(l>0){if(o.hasCrossingRelation(r,s))return!0}else if(l<0){if(a.hasCrossingRelation(s,r))return!0}else{var c=r.it.indexCell().shapes[0],u=s.it.indexCell().shapes[0];if(PT(c,o.aCrossingTarget)&&PT(u,o.bCrossingTarget)||c.numEdges()>0&&u.numEdges()>0&&o.cellCrossesCell(c,u))return!0;r.next(),s.next()}}return!1},yH=0,aW=1,IT=2,tde=(function(){function i(){this.foundSharedVertex=!1}var e=i.prototype;return e.aCrossingTarget=function(){return aW},e.bCrossingTarget=function(){return IT},e.wedgesCross=function(n,r,s,o,a){return this.foundSharedVertex=!0,!oW(n,r,s,o,a)},i})(),nde=(function(){function i(){this.foundSharedVertex=!1}var e=i.prototype;return e.aCrossingTarget=function(){return IT},e.bCrossingTarget=function(){return IT},e.wedgesCross=function(n,r,s,o,a){return this.foundSharedVertex=!0,Kfe(n,r,s,o,a)},i})(),ide=(function(){function i(t){this.foundSharedVertex=!1,this.containsEdge=!1,this.excludesEdge=!1,this.reverse=t}var e=i.prototype;return e.aCrossingTarget=function(){return yH},e.bCrossingTarget=function(){return yH},e.wedgesCross=function(n,r,s,o,a){return this.foundSharedVertex=!0,lW(n,r,s,a,this.reverse)?this.containsEdge=!0:this.excludesEdge=!0,this.containsEdge&&this.excludesEdge},i})(),lW=function(e,t,n,r,s){return r.equals(e)||r.equals(n)?r.equals(e)===s:We.orderedCCW(e,n,r,t)},bH=(function(){function i(t,n,r,s){if(this.crosser=null,this.aj=0,this.bjPrev=-2,this.bCells=[],this.a=t,this.b=n,this.relation=r,this.swapped=s,this.aCrossingTarget=r.aCrossingTarget(),this.bCrossingTarget=r.bCrossingTarget(),this.bQuery=new Qfe(n.index),s){var o=[this.bCrossingTarget,this.aCrossingTarget];this.aCrossingTarget=o[0],this.bCrossingTarget=o[1]}}var e=i.prototype;return e.startEdge=function(n){this.crosser=new Gl(this.a.vertex(n),this.a.vertex(n+1)),this.aj=n,this.bjPrev=-2},e.edgeCrossesCell=function(n){for(var r=n.numEdges(),s=0;s<r;s++){var o,a=n.edges[s];if(a!==this.bjPrev+1){var l;(l=this.crosser)==null||l.restartAt(this.b.vertex(a))}this.bjPrev=a;var c=(o=this.crosser)==null?void 0:o.chainCrossingSign(this.b.vertex(a+1));if(c!==Vl){if(c===Ec)return!0;if(this.a.vertex(this.aj+1).equals(this.b.vertex(a+1))){if(this.swapped){if(this.relation.wedgesCross(this.b.vertex(a),this.b.vertex(a+1),this.b.vertex(a+2),this.a.vertex(this.aj),this.a.vertex(this.aj+2)))return!0}else if(this.relation.wedgesCross(this.a.vertex(this.aj),this.a.vertex(this.aj+1),this.a.vertex(this.aj+2),this.b.vertex(a),this.b.vertex(a+2)))return!0}}}return!1},e.cellCrossesCell=function(n,r){for(var s=Ct(n.edges),o;!(o=s()).done;){var a=o.value;if(this.startEdge(a),this.edgeCrossesCell(r))return!0}return!1},e.cellCrossesAnySubcell=function(n,r){for(var s=Ca.fromCellID(r,0),o=Ct(n.edges),a;!(a=o()).done;){var l=a.value;if(this.bCells=this.bQuery.getCells(this.a.vertex(l),this.a.vertex(l+1),s),this.bCells.length!==0){this.startEdge(l);for(var c=Ct(this.bCells),u;!(u=c()).done;){var f=u.value;if(this.edgeCrossesCell(f.shapes[0]))return!0}}}return!1},e.hasCrossing=function(n,r){var s=20,o=0;for(this.bCells=[];;){var a=r.it.indexCell().shapes[0].numEdges();if(a>0){if(o+=a,o>=s)return this.cellCrossesAnySubcell(n.it.indexCell().shapes[0],n.cellID())?!0:(r.seekBeyond(n),!1);this.bCells.push(r.indexCell())}if(r.next(),r.cellID()>n.rangeMax)break}for(var l=Ct(this.bCells),c;!(c=l()).done;){var u=c.value;if(this.cellCrossesCell(n.it.indexCell().shapes[0],u.shapes[0]))return!0}return!1},e.hasCrossingRelation=function(n,r){var s=n.it.indexCell().shapes[0];if(s.numEdges()!==0)return this.hasCrossing(n,r)?!0:(n.next(),!1);if(PT(s,this.aCrossingTarget))return r.seekBeyond(n),n.next(),!1;for(;r.cellID()<=n.rangeMax;){var o=r.it.indexCell().shapes[0];if(PT(o,this.bCrossingTarget))return!0;r.next()}return n.next(),!1},i})(),rde=(function(){function i(t){var n=this;if(t===void 0&&(t=[]),this.loops=[],this.index=new RT,this.hasHoles=!1,this.numVertices=0,this.nEdges=0,this.bound=Ri.emptyRect(),this.subregionBound=Ri.emptyRect(),this.cumulativeEdges=[],this.initLoops=function(r){var s=new Array;s.push(null);for(var o=-1;s.length>0;){var a=s.pop();a!=null&&(o=a.depth,n.loops.push(a));for(var l=r.get(a)||[],c=l.length-1;c>=0;c--){var u=l[c];u.depth=o+1,s.push(u)}}},t.length===1&&t[0].isEmpty()){this.initLoopProperties();return}this.loops=t,this.initNested()}i.fromOrientedLoops=function(n){for(var r=new Map,s=Ct(n),o;!(o=s()).done;){var a=o.value;r.set(a,a.containsOrigin())}for(var l=Ct(n),c;!(c=l()).done;){var u=c.value,f=u.turningAngle();Math.abs(f)>u.turningAngleMaxError()?f<0&&u.invert():u.containsOrigin()&&u.invert()}var d=new i(n);if(d.numLoops()>0){for(var A=d.loop(0),y=!1,w=Ct(d.loops),S;!(S=w()).done;){var T=S.value;T.containsOrigin()&&(y=!y,A=T)}r.get(A)!==y&&d.invert()}return d};var e=i.prototype;return e.invert=function(){if(this.isEmpty()){Object.assign(this,i.fullPolygon()),this.initLoopProperties();return}if(this.isFull()){Object.assign(this,new i),this.initLoopProperties();return}for(var n=0,r=10,s=r,o=1;o<this.numLoops();o++)if(this.loop(o).depth===0){s===r&&(s=this.loop(n).turningAngle());var a=this.loop(o).turningAngle();(a<s||a===s&&this.compareLoops(this.loop(o),this.loop(n))<0)&&(n=o,s=a)}this.loop(n).invert();var l=[],c=this.lastDescendant(n);l.push(this.loop(n));for(var u=0;u<this.loops.length;u++)(u<n||u>c)&&(this.loop(u).depth++,l.push(this.loop(u)));for(var f=0;f<this.loops.length;f++)f>n&&f<=c&&(this.loop(f).depth--,l.push(this.loop(f)));this.loops=l,this.initLoopProperties()},e.compareLoops=function(n,r){if(n.numVertices()!==r.numVertices())return n.numVertices()-r.numVertices();var s=n.canonicalFirstVertex(),o=s[0],a=s[1],l=r.canonicalFirstVertex(),c=l[0],u=l[1];if(a!==u)return a-u;for(var f=n.numVertices()-1;f>=0;f--,o+=a,c+=u){var d=n.vertex(o).vector.cmp(r.vertex(c).vector);if(d!==0)return d}return 0},i.fromCell=function(n){return new i([lD.fromCell(n)])},e.initNested=function(){if(this.loops.length===1){this.initOneLoop();return}var n=new sde;this.loops.forEach(function(r){n.insertLoop(r,null)}),this.loops=[],this.initLoops(n),this.initLoopProperties()},e.initOneLoop=function(){this.hasHoles=!1,this.numVertices=this.loops[0].vertices.length,this.bound=this.loops[0].rectBound(),this.subregionBound=B1.expandForSubregions(this.bound),this.loops[0].depth=0,this.initEdgesAndIndex()},e.initLoopProperties=function(){this.numVertices=0,this.bound=Ri.emptyRect(),this.hasHoles=!1;for(var n=Ct(this.loops),r;!(r=n()).done;){var s=r.value;s.isHole()?this.hasHoles=!0:this.bound=this.bound.union(s.rectBound()),this.numVertices+=s.numVertices()}this.subregionBound=B1.expandForSubregions(this.bound),this.initEdgesAndIndex()},e.initEdgesAndIndex=function(){if(this.nEdges=0,this.cumulativeEdges=[],!this.isFull()){var n=12;this.loops.length>n&&(this.cumulativeEdges=[]);for(var r=Ct(this.loops),s;!(s=r()).done;){var o=s.value;this.cumulativeEdges.length>0&&this.cumulativeEdges.push(this.nEdges),this.nEdges+=o.vertices.length}this.index=new RT,this.index.add(this)}},i.fullPolygon=function(){var n=lD.fullLoop(),r=new i;return r.loops=[n],r.numVertices=n.vertices.length,r.bound=Ri.fullRect(),r.subregionBound=Ri.fullRect(),r.initEdgesAndIndex(),r},e.validate=function(){for(var n=0;n<this.loops.length;n++){var r=this.loops[n],s=r.findValidationErrorNoIndex();if(s)return new Error("loop "+n+": "+s.message);if(r.isEmpty())return new Error("loop "+n+": empty loops are not allowed");if(r.isFull()&&this.loops.length>1)return new Error("loop "+n+": full loop appears in non-full polygon")}return this.findLoopNestingError()},e.findLoopNestingError=function(){for(var n=-1,r=0;r<this.loops.length;r++){var s=this.loops[r].depth;if(s<0||s>n+1)return new Error("loop "+r+": invalid loop depth ("+s+")");n=s}for(var o=0;o<this.loops.length;o++)for(var a=this.loops[o],l=this.lastDescendant(o),c=0;c<this.loops.length;c++)if(o!==c){var u=c>=o+1&&c<=l,f=!1;if(a.containsNonCrossingBoundary(this.loops[c],f)!==u){var d=u?"":"not ";return new Error("invalid nesting: loop "+o+" should "+d+"contain loop "+c)}}return null},e.isEmpty=function(){return this.loops.length===0},e.isFull=function(){return this.loops.length===1&&this.loops[0].isFull()},e.numLoops=function(){return this.loops.length},e.loop=function(n){return this.loops[n]},e.parent=function(n){var r,s=((r=this.loops[n])==null?void 0:r.depth)||0;if(s===0)return[-1,!1];for(n--;n>=0&&this.loops[n].depth<=s;n--);return[n,!0]},e.lastDescendant=function(n){var r;if(n<0)return this.loops.length-1;var s=((r=this.loops[n])==null?void 0:r.depth)||0;for(n++;n<this.loops.length&&this.loops[n].depth>s;n++);return n-1},e.capBound=function(){return this.bound.capBound()},e.rectBound=function(){return this.bound},e.containsPoint=function(n){if(!this.index.isFresh()&&!this.bound.containsPoint(n))return!1;var r=32;if(this.numVertices<r||this.index==null){for(var s=!1,o=Ct(this.loops),a;!(a=o()).done;){var l=a.value;s=s!==l.bruteForceContainsPoint(n)}return s}return new _p(this.index,Yf).contains(n)},e.containsCell=function(n){var r=this.index.iterator(),s=r.locateCellID(n.id);return s!==xp||this.boundaryApproxIntersects(r,n)?!1:this.iteratorContainsPoint(r,n.center())},e.intersectsCell=function(n){var r=this.index.iterator(),s=r.locateCellID(n.id);return s===OT?!1:s===vy||r.cellID()===n.id||this.boundaryApproxIntersects(r,n)?!0:this.iteratorContainsPoint(r,n.center())},e.cellUnionBound=function(){return this.capBound().cellUnionBound()},e.boundaryApproxIntersects=function(n,r){var s=n.indexCell().findByShapeID(0);if(s.edges.length===0)return!1;if(n.cellID()===r.id)return!0;for(var o=gy+eW,a=r.boundUV().expandedByMargin(o),l=Ct(s.edges),c;!(c=l()).done;){var u=c.value,f=this.index.shape(0).edge(u),d=uy(f.v0,f.v1,r.face,o),A=d[0],y=d[1],w=d[2];if(w&&tW(A,y,a))return!0}return!1},e.iteratorContainsPoint=function(n,r){var s=n.indexCell().findByShapeID(0),o=s.containsCenter;if(s.edges.length===0)return o;for(var a=new Gl(n.center(),r),l=this.index.shape(0),c=Ct(s.edges),u;!(u=c()).done;){var f=u.value,d=l.edge(f);o=o!==a.edgeOrVertexCrossing(d.v0,d.v1)}return o},e.numEdges=function(){return this.nEdges},e.edge=function(n){var r=0;if(this.cumulativeEdges.length>0){for(r=0;r<this.cumulativeEdges.length;r++)if(r+1>=this.cumulativeEdges.length||n<this.cumulativeEdges[r+1]){n-=this.cumulativeEdges[r];break}}else for(r=0;n>=this.loop(r).vertices.length;r++)n-=this.loop(r).vertices.length;return new ah(this.loop(r).orientedVertex(n),this.loop(r).orientedVertex(n+1))},e.referencePoint=function(){for(var n=!1,r=Ct(this.loops),s;!(s=r()).done;){var o=s.value;n=n!==o.containsOrigin()}return BT(n)},e.numChains=function(){return this.numLoops()},e.chain=function(n){if(this.cumulativeEdges.length>0)return new P1(this.cumulativeEdges[n],this.loop(n).vertices.length);for(var r=0,s=0;s<n;s++)r+=this.loop(s).vertices.length;var o=this.loop(n).numVertices();return o!==1?new P1(r,o):new P1(r,0)},e.chainEdge=function(n,r){return new ah(this.loop(n).orientedVertex(r),this.loop(n).orientedVertex(r+1))},e.chainPosition=function(n){var r=0;if(this.cumulativeEdges.length>0){for(r=0;r<this.cumulativeEdges.length;r++)if(r+1>=this.cumulativeEdges.length||n<this.cumulativeEdges[r+1]){n-=this.cumulativeEdges[r];break}}else for(r=0;n>=this.loop(r).vertices.length;r++)n-=this.loop(r).vertices.length;return new FT(r,n)},e.dimension=function(){return 2},e.typeTag=function(){return _fe},e.privateInterface=function(){},e.contains=function(n){if(this.loops.length===1&&n.loops.length===1)return this.loops[0].contains(n.loops[0]);if(!this.subregionBound.contains(n.bound)&&!this.bound.lng.union(n.bound.lng).isFull())return!1;if(!this.hasHoles&&!n.hasHoles){for(var r=Ct(n.loops),s;!(s=r()).done;){var o=s.value;if(!this.anyLoopContains(o))return!1}return!0}return this.containsBoundary(n)&&n.excludesNonCrossingComplementShells(this)},e.intersects=function(n){if(this.loops.length===1&&n.loops.length===1)return this.loops[0].intersects(n.loops[0]);if(!this.bound.intersects(n.bound))return!1;if(!this.hasHoles&&!n.hasHoles){for(var r=Ct(n.loops),s;!(s=r()).done;){var o=s.value;if(this.anyLoopIntersects(o))return!0}return!1}return!this.excludesBoundary(n)||!n.excludesNonCrossingShells(this)},e.compareBoundary=function(n){for(var r=-1,s=0;s<this.loops.length&&r!==0;s++)r*=-this.loops[s].compareBoundary(n);return r},e.containsBoundary=function(n){for(var r=Ct(n.loops),s;!(s=r()).done;){var o=s.value;if(this.compareBoundary(o)<=0)return!1}return!0},e.excludesBoundary=function(n){for(var r=Ct(n.loops),s;!(s=r()).done;){var o=s.value;if(this.compareBoundary(o)>=0)return!1}return!0},e.containsNonCrossingBoundary=function(n,r){for(var s=!1,o=Ct(this.loops),a;!(a=o()).done;){var l=a.value,c=l.containsNonCrossingBoundary(n,r);s=s!=c}return s},e.excludesNonCrossingShells=function(n){for(var r=Ct(n.loops),s;!(s=r()).done;){var o=s.value;if(!o.isHole()&&this.containsNonCrossingBoundary(o,!1))return!1}return!0},e.excludesNonCrossingComplementShells=function(n){if(n.isEmpty())return!this.isFull();if(n.isFull())return!0;for(var r=0;r<n.loops.length;r++){var s=n.loops[r];if(!(r>0&&!s.isHole())&&this.containsNonCrossingBoundary(s,r===0))return!1}return!0},e.anyLoopContains=function(n){for(var r=Ct(this.loops),s;!(s=r()).done;){var o=s.value;if(o.contains(n))return!0}return!1},e.anyLoopIntersects=function(n){for(var r=Ct(this.loops),s;!(s=r()).done;){var o=s.value;if(o.intersects(n))return!0}return!1},e.area=function(){for(var n=0,r=Ct(this.loops),s;!(s=r()).done;){var o=s.value;n+=o.sign()*o.area()}return n},e.centroid=function(){for(var n=new We(0,0,0).vector,r=Ct(this.loops),s;!(s=r()).done;){var o=s.value,a=o.centroid().vector;o.sign()<0?n=n.sub(a):n=n.add(a)}return We.fromVector(n)},i})(),sde=(function(i){function e(){return i.apply(this,arguments)||this}hy(e,i);var t=e.prototype;return t.insertLoop=function(r,s){for(var o=[],a=!1;!a;){o=i.prototype.get.call(this,s)||[],a=!0;for(var l=Ct(o),c;!(c=l()).done;){var u=c.value;if(u.containsNested(r)){s=u,a=!1;break}}}for(var f=i.prototype.get.call(this,r)||[],d=0;d<o.length;){var A=o[d];r.containsNested(A)?(f.push(A),o.splice(d,1)):d++}i.prototype.set.call(this,r,f),i.prototype.set.call(this,s,[].concat(o,[r]))},e})(I1(Map)),ode=(function(){function i(t){t===void 0&&(t=[]),this.points=t}i.fromLatLngs=function(n){return new i(n.map(We.fromLatLng))};var e=i.prototype;return e.reverse=function(){for(var n=this.points.length,r=0;r<n/2;r++){var s=n-r-1,o=[this.points[s],this.points[r]];this.points[r]=o[0],this.points[s]=o[1]}},e.length=function(){for(var n=0,r=1;r<this.points.length;r++)n+=this.points[r-1].distance(this.points[r]);return n},e.centroid=function(){for(var n=new We(0,0,0),r=1;r<this.points.length;r++){var s=this.points[r-1].vector.add(this.points[r].vector),o=this.points[r-1].vector.sub(this.points[r].vector);n=We.fromVector(n.vector.add(s.mul(Math.sqrt(o.norm2()/s.norm2()))))}return n},e.equal=function(n){if(this.points.length!==n.points.length)return!1;for(var r=0;r<this.points.length;r++)if(!this.points[r].equals(n.points[r]))return!1;return!0},e.approxEqual=function(n,r){if(r===void 0&&(r=FH),this.points.length!==n.points.length)return!1;for(var s=0;s<this.points.length;s++)if(!this.points[s].approxEqual(n.points[s],r))return!1;return!0},e.capBound=function(){return this.rectBound().capBound()},e.rectBound=function(){for(var n=new B1,r=Ct(this.points),s;!(s=r()).done;){var o=s.value;n.addPoint(o)}return n.rectBound()},e.containsCell=function(n){return!1},e.intersectsCell=function(n){if(this.points.length===0)return!1;for(var r=Ct(this.points),s;!(s=r()).done;){var o=s.value;if(n.containsPoint(o))return!0}for(var a=[n.vertex(0),n.vertex(1),n.vertex(2),n.vertex(3)],l=0;l<4;l++)for(var c=Gl.newChainEdgeCrosser(a[l],a[l+1&3],this.points[0]),u=1;u<this.points.length;u++)if(c.chainCrossingSign(this.points[u])!==Vl)return!0;return!1},e.containsPoint=function(n){return!1},e.cellUnionBound=function(){return this.capBound().cellUnionBound()},e.numEdges=function(){return this.points.length===0?0:this.points.length-1},e.edge=function(n){return new ah(this.points[n],this.points[n+1])},e.referencePoint=function(){return BT(!1)},e.numChains=function(){return Math.min(1,this.numEdges())},e.chain=function(n){return new P1(0,this.numEdges())},e.chainEdge=function(n,r){return new ah(this.points[r],this.points[r+1])},e.chainPosition=function(n){return new FT(0,n)},e.dimension=function(){return 1},e.isEmpty=function(){return yfe(this)},e.isFull=function(){return bfe(this)},e.typeTag=function(){return xfe},e.privateInterface=function(){},i.findEndVertex=function(n,r,s){var o=n.points[s],a=dD(o),l=eo.fullInterval(),c=0;for(s++;s<n.points.length;s++){var u=n.points[s],f=o.distance(u);if(f>Math.PI/2&&c>0||f<c&&c>r)break;if(c=f,!(f<=r)){var d=Uhe(a,u),A=Math.atan2(d.y,d.x);if(!l.contains(A))break;var y=Math.asin(Math.sin(r)/Math.sin(f)),w=eo.fromPointPair(A,A).expanded(y);l=l.intersection(w)}}return s-1},e.subsampleVertices=function(n){var r=[];if(this.points.length<1)return r;r.push(0);for(var s=Math.max(n,0),o=0;o+1<this.points.length;){var a=i.findEndVertex(this,s,o);this.points[a].equals(this.points[o])||r.push(a),o=a}return r},e.project=function(n){if(this.points.length===1)return[this.points[0],1];for(var r=10,s=-1,o=1;o<this.points.length;o++){var a=hfe(n,this.points[o-1],this.points[o]);a<r&&(r=a,s=o)}var l=XH(n,this.points[s-1],this.points[s]);return l.equals(this.points[s])&&s++,[l,s]},e.isOnRight=function(n){var r=this.project(n),s=r[0],o=r[1];return s.equals(this.points[o-1])&&o>1&&o<this.points.length?n.equals(this.points[o-1])?!1:We.orderedCCW(this.points[o-2],n,this.points[o],this.points[o-1]):(o===this.points.length&&o--,ZL(n,this.points[o],this.points[o-1]))},e.validate=function(){for(var n=0;n<this.points.length;n++)if(!this.points[n].vector.isUnit())return new Error("vertex "+n+" is not unit length");for(var r=1;r<this.points.length;r++){var s=this.points[r-1],o=this.points[r];if(s.equals(o))return new Error("vertices "+(r-1)+" and "+r+" are identical");if(s.equals(We.fromVector(o.vector.mul(-1))))return new Error("vertices "+(r-1)+" and "+r+" are antipodal")}return null},e.intersects=function(n){if(this.points.length===0||n.points.length===0||!this.rectBound().intersects(n.rectBound()))return!1;for(var r=1;r<this.points.length;r++)for(var s=Gl.newChainEdgeCrosser(this.points[r-1],this.points[r],n.points[0]),o=1;o<n.points.length;o++)if(s.chainCrossingSign(n.points[o])!==Vl)return!0;return!1},e.interpolate=function(n){if(n<=0)return[this.points[0],1];for(var r=n*this.length(),s=1;s<this.points.length;s++){var o=this.points[s-1].distance(this.points[s]);if(r<o){var a=$H(r,this.points[s-1],this.points[s]);return a.equals(this.points[s])?[a,s+1]:[a,s]}r-=o}return[this.points[this.points.length-1],this.points.length]},e.uninterpolate=function(n,r){if(this.points.length<2)return 0;for(var s=0,o=1;o<r;o++)s+=this.points[o-1].distance(this.points[o]);for(var a=s+this.points[r-1].distance(n),l=r;l<this.points.length;l++)s+=this.points[l-1].distance(this.points[l]);return Math.min(1,a/s)},i})(),wH=(function(){function i(){}var e=i.prototype;return e.capBound=function(){return gp.emptyCap()},e.rectBound=function(){return Ri.emptyRect()},e.containsCell=function(n){return!1},e.intersectsCell=function(n){return!1},e.containsPoint=function(n){return!1},e.cellUnionBound=function(){return[]},i})(),cD=(function(){function i(t){var n=t===void 0?{}:t,r=n.minLevel,s=r===void 0?0:r,o=n.maxLevel,a=o===void 0?_i:o,l=n.levelMod,c=l===void 0?1:l,u=n.maxCells,f=u===void 0?8:u;this.minLevel=s,this.maxLevel=a,this.levelMod=c,this.maxCells=f}var e=i.prototype;return e.coverer=function(){return new cW(Math.max(0,Math.min(_i,this.minLevel)),Math.max(0,Math.min(_i,this.maxLevel)),Math.max(1,Math.min(3,this.levelMod)),this.maxCells)},e.covering=function(n){var r=this.cellUnion(n);return r.denormalize(Math.max(0,Math.min(_i,this.minLevel)),Math.max(1,Math.min(3,this.levelMod))),r},e.interiorCovering=function(n){var r=this.interiorCellUnion(n);return r.denormalize(Math.max(0,Math.min(_i,this.minLevel)),Math.max(1,Math.min(3,this.levelMod))),r},e.cellUnion=function(n){var r=this.coverer();r.coveringInternal(n);var s=r.result;return s.normalize(),s},e.interiorCellUnion=function(n){var r=this.coverer();r.interiorCovering=!0,r.coveringInternal(n);var s=r.result;return s.normalize(),s},e.fastCovering=function(n){var r=this.coverer(),s=sy(N1,n.cellUnionBound());return r.normalizeCovering(s),s},e.isCanonical=function(n){return this.coverer().isCanonical(n)},i})(),cW=(function(){function i(t,n,r,s){this.region=new wH,this.result=new N1,this.pq=new lde,this.interiorCovering=!1,this.minLevel=t,this.maxLevel=n,this.levelMod=r,this.maxCells=s}var e=i.prototype;return e.newCandidate=function(n){if(!this.region.intersectsCell(n))return new iy;var r=new ade(n),s=n.level;if(s>=this.minLevel)if(this.interiorCovering){if(this.region.containsCell(n))r.terminal=!0;else if(s+this.levelMod>this.maxLevel)return new iy}else(s+this.levelMod>this.maxLevel||this.region.containsCell(n))&&(r.terminal=!0);return r},e.expandChildren=function(n,r,s){s--;for(var o=0,a=qH(r.id),l=vD(r.id);l!==a;l=Ia(l)){var c=Pa.fromCellID(l);if(s>0){this.region.intersectsCell(c)&&(o+=this.expandChildren(n,c,s));continue}var u=this.newCandidate(c);u instanceof iy||(n.children.push(u),n.numChildren++,u.terminal&&o++)}return o},e.addCandidate=function(n){if(!(n instanceof iy)){if(n.terminal){this.result.push(n.cell.id);return}var r=this.levelMod,s=n.cell.level;s<this.minLevel&&(r=1);var o=this.expandChildren(n,n.cell,r),a=2*this.levelMod;n.numChildren!==0&&(!this.interiorCovering&&o===1<<a&&s>=this.minLevel?(n.terminal=!0,this.addCandidate(n)):(n.priority=-((s<<a)+n.numChildren<<a+o),this.pq.push(n)))}},e.adjustLevel=function(n){return this.levelMod>1&&n>this.minLevel&&(n-=(n-this.minLevel)%this.levelMod),n},e.adjustCellLevels=function(n){if(this.levelMod!==1){for(var r=0,s=Ct(n),o;!(o=s()).done;){var a=o.value,l=to(a),c=this.adjustLevel(l);if(c!==l&&(a=Sr(a,c)),!(r>0&&Xm(n[r-1],a))){for(;r>0&&Xm(a,n[r-1]);)r--;n[r]=a,r++}}n.length=r}},e.initialCandidates=function(n){var r=new cD;r.maxLevel=this.maxLevel,r.levelMod=1,r.maxCells=Math.min(4,this.maxCells);var s=r.fastCovering(n);this.adjustCellLevels(s);for(var o=Ct(s),a;!(a=o()).done;){var l=a.value;this.addCandidate(this.newCandidate(Pa.fromCellID(l)))}},e.coveringInternal=function(n){for(this.region=n,this.initialCandidates(n);this.pq.length>0&&(!this.interiorCovering||this.result.length<this.maxCells);){var r=this.pq.pop();if(this.interiorCovering||r.cell.level<this.minLevel||r.numChildren===1||this.result.length+this.pq.length+r.numChildren<=this.maxCells)for(var s=Ct(r.children),o;!(o=s()).done;){var a=o.value;(!this.interiorCovering||this.result.length<this.maxCells)&&this.addCandidate(a)}else r.terminal=!0,this.addCandidate(r)}this.region=new wH,this.pq.reset(),this.result.normalize(),(this.minLevel>0||this.levelMod>1)&&this.result.denormalize(this.minLevel,this.levelMod)},e.normalizeCovering=function(n){if(this.maxLevel<_i||this.levelMod>1)for(var r=0;r<n.length;r++){var s=to(n[r]),o=this.adjustLevel(Math.min(s,this.maxLevel));o!==s&&(n[r]=Sr(n[r],o))}n.normalize(),(this.minLevel>0||this.levelMod>1)&&n.denormalize(this.minLevel,this.levelMod);var a=n.length-this.maxCells;if(!(a<=0||this.isCanonical(n))){if(a*n.length>1e4){var l=new cD,c=l.covering(n);n.length=0,n.push.apply(n,c);return}for(;n.length>this.maxCells;){for(var u=-1,f=-1,d=0;d+1<n.length;d++){var A=cy(n[d],n[d+1]),y=A[0],w=A[1];if(w){var S=this.adjustLevel(y);S>f&&(f=S,u=d)}}if(f<this.minLevel)break;var T=Sr(n[u],f),R=this.replaceCellsWithAncestor(n,T);for(n.length=0,n.push.apply(n,R);f>this.minLevel&&(f-=this.levelMod,T=Sr(T,f),!!this.containsAllChildren(n,T));){var I=this.replaceCellsWithAncestor(n,T);n.length=0,n.push.apply(n,I)}}}},e.isCanonical=function(n){var r=this.maxLevel;this.levelMod!==1&&(r=this.maxLevel-(this.maxLevel-this.minLevel)%this.levelMod);for(var s=n.length>this.maxCells,o=1,a=0n,l=Ct(n),c;!(c=l()).done;){var u=c.value;if(!ly(u))return!1;var f=to(u);if(f<this.minLevel||f>r||this.levelMod>1&&(f-this.minLevel)%this.levelMod!==0)return!1;if(a!==0n){if(Gi(a)>=qi(u))return!1;var d=cy(u,a),A=d[0],y=d[1];if(s&&y&&A>=this.minLevel)return!1;var w=f-this.levelMod;if(w<this.minLevel||f!==to(a)||Sr(u,w)!==Sr(a,w))o=1;else if(o++,o===1<<2*this.levelMod)return!1}a=u}return!0},e.containsAllChildren=function(n,r){for(var s=n.findIndex(function(l){return l>=qi(r)}),o=to(r)+this.levelMod,a=Ay(r,o);a!==NT(r,o);a=Ia(a)){if(s===-1||n[s]!==a)return!1;s++}return!0},e.replaceCellsWithAncestor=function(n,r){var s=eD(n.length,function(a){return n[a]>qi(r)}),o=eD(n.length,function(a){return n[a]>Gi(r)});return[].concat(n.slice(0,s),[r],n.slice(o))},i})(),ade=function(e){this.terminal=!1,this.numChildren=0,this.children=[],this.priority=0,this.cell=e},iy=function(){this.cell=Pa.fromCellID(fl),this.terminal=!1,this.numChildren=0,this.children=[],this.priority=0},lde=(function(i){function e(){return i.apply(this,arguments)||this}hy(e,i);var t=e.prototype;return t.len=function(){return this.length},t.swap=function(r,s){var o=[this[s],this[r]];this[r]=o[0],this[s]=o[1]},t.push=function(){for(var r,s=arguments.length,o=new Array(s),a=0;a<s;a++)o[a]=arguments[a];var l=(r=i.prototype.push).call.apply(r,[this].concat(o));return this.sort(e.ascending),l},t.pop=function(){var r=i.prototype.pop.call(this);return r||new iy},t.reset=function(){this.length=0},e.ascending=function(r,s){return r.priority<s.priority?-1:r.priority>s.priority?1:0},e})(I1(Array)),Gn={__proto__:null,cellid:lfe,Cap:gp,Cell:Pa,CellIndex:gfe,CellIndexRangeIterator:YH,CellIndexContentsIterator:ZH,CellUnion:N1,ClosestCellQuery:Zfe,ClosestCellQueryOptions:sW,PointTarget:Wfe,EdgeTarget:jfe,CellTarget:Xfe,CellUnionTarget:$fe,ShapeIndexTarget:Yfe,ClosestEdgeQuery:Gfe,ClosestEdgeQueryOptions:nW,EdgeQueryPointTarget:kfe,EdgeQueryEdgeTarget:zfe,EdgeQueryCellTarget:Vfe,EdgeQueryShapeIndexTarget:iW,LatLng:ar,Loop:lD,Point:We,Polygon:rde,Polyline:ode,Rect:Ri,RegionCoverer:cD,Coverer:cW,ShapeIndex:RT};function fu(i){return i?.collectionId}function z1(i){return O.world?.collectionsById?.get(i?.collectionId)}function V1(){return(O.world?.collections||[]).some(i=>i.kind!=="point"&&!Io(i.id))}function Io(i){return O.hiddenCollections.has(i)}function uW(i){let e=new Map;for(let t of i){let n=fu(t.zone);e.has(n)||e.set(n,[]),e.get(n).push(t)}return e}function hW(i,e){for(let t of i.values())if(!t.some(r=>r.geometries.some(s=>yD(s,e))))return!1;return!0}function yD(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}var bD=Object.freeze({point:"point",path:"path",area:"area"}),_y=Object.freeze({always:"always",quiet:"quiet"});function Zf(i,e){let t=e??z1(i),n=O.labelOverrides.get(t?.id);return n||wD(t)}function wD(i){let e=i?.attrs?.["atlas.label.policy"];return e||((i?.kind??bD.point)===bD.point?SD(i)==="text"?_y.always:_y.quiet:i?.kind===bD.path?_y.quiet:_y.always)}function fW(i){return O.labelOverrides.get(i?.id)===_y.quiet}function SD(i){return i?.attrs?.["atlas.render.as"]||"pin"}var cde={"atlas.hydro.huc12":"HUC-12"},ude=new Set(["atlas.geo.lat","atlas.geo.lon"]),hde=["atlas.render.","atlas.label.","atlas.stroke.","atlas.geometry."];function TD(i){let e=[];for(let[t,n]of Object.entries(i||{}))ude.has(t)||hde.some(r=>t.startsWith(r))||e.push({label:cde[t]||t,value:n});return e.sort((t,n)=>t.label.localeCompare(n.label))}function UT(i){return i?.attrs?.["atlas.geometry.surface"]||"plane"}function xy(i){let e=lh(i);return e||fde(i)}function fde(i){let e=i?.attrs||{};if(e["atlas.geometry.projection"]!=="mercator")return null;let t=(e["atlas.geometry.mercator.px"]||"").split(",").map(Number),n=(e["atlas.geometry.mercator.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;if(!o||!a||c===f||l===u)return null;let d=S=>Math.asinh(Math.tan(S*Math.PI/180)),A=S=>Math.atan(Math.sinh(S))*180/Math.PI,y=d(c),w=d(f);return{toLatLng(S,T){return[A(y-(T-s)/a*(y-w)),l+(S-r)/o*(u-l)]},toWorld(S,T){return[r+(T-l)/(u-l)*o,s+(y-d(S))/(y-w)*a]}}}function lh(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(d,A){return[c-(A-s)/a*(c-f),l+(d-r)/o*(u-l)]},toWorld(d,A){return[r+(A-l)/(u-l)*o,s+(c-d)/(c-f)*a]}}}var yy=10,dW=i=>i+1,pW=i=>Gn.cellid.level(Gn.cellid.fromToken(i)),ED={map:null,mapping:null};function kT(){return ED.map!==O.world&&(ED={map:O.world,mapping:xy(O.world)}),ED.mapping}function dde(i){let e=kT();if(!e)return null;let[t,n]=e.toLatLng(i[0],-i[1]);return Gn.LatLng.fromDegrees(t,n)}function mW(i){let e=Gn.LatLng.fromPoint(i);return[e.lat*180/Math.PI,e.lng*180/Math.PI]}var AW=new WeakMap;function MD(i){let e=kT();if(!e)return 0n;let t=AW.get(i);if(t&&t.mapping===e)return t.leaf;let n=dde(i),r=n?Gn.cellid.fromLatLng(n):0n;return typeof i=="object"&&AW.set(i,{mapping:e,leaf:r}),r}var gW={slug:"s2",name:"S2",short:"S2",appliesTo(i){return UT(i)==="sphere"&&xy(i)!==null},maxLevel(){return dW(yy)},inputLength(){return 6},level(i){return i===""?0:dW(pW(i))},parent(i){let e=Gn.cellid.fromToken(i),t=Gn.cellid.level(e);return t===0?"":Gn.cellid.toToken(Gn.cellid.parent(e,t-1))},children(i){return i===""?[0,1,2,3,4,5].map(e=>Gn.cellid.toToken(Gn.cellid.fromFace(e))):Gn.cellid.children(Gn.cellid.fromToken(i)).map(Gn.cellid.toToken)},childIndex(i){let e=Gn.cellid.fromToken(i),t=Gn.cellid.level(e);return t===0?Gn.cellid.face(e):Gn.cellid.childPosition(e,t)},contains(i,e){return Gn.cellid.contains(Gn.cellid.fromToken(i),MD(e))},descendTarget(i,e){let t=MD(e);if(t===0n)return"";let n=i===""?0:pW(i)+1;return n>yy?"":Gn.cellid.toToken(Gn.cellid.parent(t,n))},bbox(i){if(i==="")return jf();let e=this.ring(i),t=1/0,n=1/0,r=-1/0,s=-1/0;for(let[o,a]of e)t=Math.min(t,o),n=Math.min(n,a),r=Math.max(r,o),s=Math.max(s,a);return[t,n,r,s]},center(i){let e=kT(),[t,n]=mW(Gn.Cell.fromCellID(Gn.cellid.fromToken(i)).center()),[r,s]=e.toWorld(t,n);return[r,-s]},ring(i){let e=kT(),t=Gn.Cell.fromCellID(Gn.cellid.fromToken(i)),n=Gn.cellid.level(Gn.cellid.fromToken(i)),r=Math.max(2,Math.min(16,2**(4-n)*2)),s=jf(),o=s[2]-s[0],a=[];for(let u=0;u<4;u++){let f=t.vertex(u).vector,d=t.vertex((u+1)%4).vector;for(let A=0;A<r;A++){let y=A/r,w=f.x+(d.x-f.x)*y,S=f.y+(d.y-f.y)*y,T=f.z+(d.z-f.z)*y,R=Math.hypot(w,S,T)||1,[I,P]=mW(new Gn.Point(w/R,S/R,T/R)),[F,D]=e.toWorld(I,P);a.push([F,-D])}}for(let u=1;u<a.length;u++){let f=a[u][0]-a[u-1][0];f>o/2?a[u][0]-=o:f<-o/2&&(a[u][0]+=o)}let l=[...a[0]],c=l[0]-a[a.length-1][0];return c>o/2?l[0]-=o:c<-o/2&&(l[0]+=o),a.push(l),a},poleContained(i){let e=Gn.cellid.fromToken(i);return Gn.cellid.contains(e,Gn.cellid.fromLatLng(Gn.LatLng.fromDegrees(90,0)))?"north":Gn.cellid.contains(e,Gn.cellid.fromLatLng(Gn.LatLng.fromDegrees(-90,0)))?"south":null},label(i){return{context:i.slice(0,-1),principal:i.slice(-1)}},colorKey(i){return this.childIndex(i)%Wf.length},normalizeInput(i){return[...i.toLocaleLowerCase()].filter(e=>"0123456789abcdef".includes(e)).slice(0,6).join("")},parseInput(i){if(i==="")return"";let e=Gn.cellid.fromToken(i);return e===0n||!Gn.cellid.valid(e)?null:Gn.cellid.level(e)>yy?Gn.cellid.toToken(Gn.cellid.parent(e,yy)):Gn.cellid.toToken(e)},locate(i){let e=MD(i);return e===0n?null:{label:"S2",value:Gn.cellid.toToken(Gn.cellid.parent(e,yy))}}};function jf(){let i=O.lens?.surface;if(i)return[i.x,-(i.y+i.height),i.x+i.width,-i.y];let e=O.volume?.tileGrid.size??0,t=O.lens?.bounds||{x:0,y:0,width:e,height:e};return[t.x,-(t.y+t.height),t.x+t.width,-t.y]}var _W=[FL,gW];function by(i){return _W.filter(e=>e.appliesTo(i))}function Ss(){return _W.find(i=>i.slug===O.gridSystem)||FL}function xW(i,e,t,n){if(!t)return"";let r=i.center(t),s=vW(i.bbox(t)),o="",a="",l=1/0;for(;e.level(o)<e.maxLevel(n);){let c=e.descendTarget(o,r);if(!c)break;let u=vW(e.bbox(c)),f=Math.abs(Math.log(u/s));if(f<l&&(a=c,l=f),u<=s)break;o=c}return a}function vW([i,e,t,n]){return(t-i)*(n-e)}function yW(i,e,t){let n=i[0]===i[i.length-1]||pde(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 d=(r-c[0])/(l[0]-c[0]);o.push([r,c[1]+d*(l[1]-c[1])])}u&&o.push(l)}if(n=o,n.length===0)return[]}return[...n,n[0]]}function pde(i,e){return i[0]===e[0]&&i[1]===e[1]}var Bs={UNKNOWN:0,INTERSECTING:1,ABOVE:2,RIGHT:4,BELOW:8,LEFT:16};function CD(i){let e=Wr();for(let t=0,n=i.length;t<n;++t)Qm(e,i[t]);return e}function mde(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 ql(n,r,s,o,t)}function G1(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 VT(i,e){return e?(e[0]=i[0],e[1]=i[1],e[2]=i[2],e[3]=i[3],e):i.slice()}function Rc(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 du(i,e){return wy(i,e[0],e[1])}function ch(i,e){return i[0]<=e[0]&&e[2]<=i[2]&&i[1]<=e[1]&&e[3]<=i[3]}function wy(i,e,t){return i[0]<=e&&e<=i[2]&&i[1]<=t&&t<=i[3]}function zT(i,e){let t=i[0],n=i[1],r=i[2],s=i[3],o=e[0],a=e[1],l=Bs.UNKNOWN;return o<t?l=l|Bs.LEFT:o>r&&(l=l|Bs.RIGHT),a<n?l=l|Bs.BELOW:a>s&&(l=l|Bs.ABOVE),l===Bs.UNKNOWN&&(l=Bs.INTERSECTING),l}function Wr(){return[1/0,1/0,-1/0,-1/0]}function ql(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 Zm(i){return ql(1/0,1/0,-1/0,-1/0,i)}function GT(i,e){let t=i[0],n=i[1];return ql(t,n,t,n,e)}function q1(i,e,t,n,r){let s=Zm(r);return RD(s,i,e,t,n)}function Km(i,e){return i[0]==e[0]&&i[2]==e[2]&&i[1]==e[1]&&i[3]==e[3]}function qT(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 Qm(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 RD(i,e,t,n,r){for(;t<n;t+=r)Ade(i,e[t],e[t+1]);return i}function Ade(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 HT(i,e){let t;return t=e(H1(i)),t||(t=e(W1(i)),t)||(t=e(j1(i)),t)||(t=e(Pc(i)),t)?t:!1}function Sy(i){let e=0;return hh(i)||(e=Kn(i)*Nr(i)),e}function H1(i){return[i[0],i[1]]}function W1(i){return[i[2],i[1]]}function dl(i){return[(i[0]+i[2])/2,(i[1]+i[3])/2]}function bW(i,e){let t;if(e==="bottom-left")t=H1(i);else if(e==="bottom-right")t=W1(i);else if(e==="top-left")t=Pc(i);else if(e==="top-right")t=j1(i);else throw new Error("Invalid corner");return t}function Ty(i,e,t,n,r){let[s,o,a,l,c,u,f,d]=PD(i,e,t,n);return ql(Math.min(s,a,c,f),Math.min(o,l,u,d),Math.max(s,a,c,f),Math.max(o,l,u,d),r)}function PD(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,d=i[0],A=i[1];return[d-l+f,A-c-u,d-l-f,A-c+u,d+l-f,A+c+u,d+l+f,A+c-u,d-l+f,A-c-u]}function Nr(i){return i[3]-i[1]}function uh(i,e,t){let n=t||Wr();return Ar(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]):Zm(n),n}function ID(i,e){if(!Ar(i,e))return[i.slice()];if(ch(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 Pc(i){return[i[0],i[3]]}function j1(i){return[i[2],i[3]]}function Kn(i){return i[2]-i[0]}function Ar(i,e){return i[0]<=e[2]&&i[2]>=e[0]&&i[1]<=e[3]&&i[3]>=e[1]}function hh(i){return i[2]<i[0]||i[3]<i[1]}function wW(i,e){return e?(e[0]=i[0],e[1]=i[1],e[2]=i[2],e[3]=i[3],e):i}function SW(i,e,t){let n=!1,r=zT(i,e),s=zT(i,t);if(r===Bs.INTERSECTING||s===Bs.INTERSECTING)n=!0;else{let o=i[0],a=i[1],l=i[2],c=i[3],u=e[0],f=e[1],d=t[0],A=t[1],y=(A-f)/(d-u),w,S;s&Bs.ABOVE&&!(r&Bs.ABOVE)&&(w=d-(A-c)/y,n=w>=o&&w<=l),!n&&s&Bs.RIGHT&&!(r&Bs.RIGHT)&&(S=A-(d-l)*y,n=S>=a&&S<=c),!n&&s&Bs.BELOW&&!(r&Bs.BELOW)&&(w=d-(A-a)/y,n=w>=o&&w<=l),!n&&s&Bs.LEFT&&!(r&Bs.LEFT)&&(S=A-(d-o)*y,n=S>=a&&S<=c)}return n}function TW(i,e,t,n){if(hh(i))return Zm(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 mde(s,o,t)}function LD(i,e){let t=e.getExtent(),n=dl(i);if(e.canWrapX()&&(n[0]<t[0]||n[0]>=t[2])){let r=Kn(t),o=Math.floor((n[0]-t[0])/r)*r;i[0]-=o,i[2]-=o}return i}function WT(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]]];LD(i,e);let r=Kn(n);if(Kn(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 EW(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(...ID(t[o],e[n]));t=s}return t}var MW={info:1,warn:2,error:3,none:4},gde=MW.info;function jT(...i){gde>MW.warn||console.warn(...i)}function Si(i,e,t){return Math.min(Math.max(i,e),t)}function CW(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 pu(i,e,t,n)}function pu(i,e,t,n){let r=t-i,s=n-e;return r*r+s*s}function RW(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 XT(i){return i*180/Math.PI}function mu(i){return i*Math.PI/180}function fh(i,e){let t=i%e;return t*e<0?t+e:t}function Lo(i,e,t){return i+t*(e-i)}function Jm(i,e){let t=Math.pow(10,e);return Math.round(i*t)/t}function Ey(i,e){return Math.floor(Jm(i,e))}function My(i,e){return Math.ceil(Jm(i,e))}function $T(i,e,t){if(i>=e&&i<t)return i;let n=t-e;return((i-e)%n+n)%n+e}function PW(i,e){return i[0]+=+e[0],i[1]+=+e[1],i}function eA(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 X1(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 IW(i,e){return i[0]*=e,i[1]*=e,i}function YT(i,e){if(e.canWrapX()){let t=Kn(e.getExtent()),n=LW(i,e,t);n&&(i[0]-=n*t)}return i}function LW(i,e,t){let n=e.getExtent(),r=0;return e.canWrapX()&&(i[0]<n[0]||i[0]>n[2])&&(t=t||Kn(n),r=Math.floor((i[0]-n[0])/t)),r}function DW(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(Si(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 Kf={radians:6370997/(2*Math.PI),degrees:2*Math.PI*6370997/360,ft:.3048,m:1,"us-ft":1200/3937};var DD=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_||Kf[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_}},bp=DD;var Cy=6378137,$1=Math.PI*Cy,vde=[-$1,-$1,$1,$1],_de=[-180,-85,180,85],ZT=Cy*Math.log(Math.tan(Math.PI/2)),wp=class extends bp{constructor(e){super({code:e,units:"m",extent:vde,global:!0,worldExtent:_de,getPointResolution:function(t,n){return t/Math.cosh(n[1]/Cy)}})}},ND=[new wp("EPSG:3857"),new wp("EPSG:102100"),new wp("EPSG:102113"),new wp("EPSG:900913"),new wp("http://www.opengis.net/def/crs/EPSG/0/3857"),new wp("http://www.opengis.net/gml/srs/epsg.xml#3857")];function NW(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]=$1*i[s]/180;let o=Cy*Math.log(Math.tan(Math.PI*(+i[s+1]+90)/360));o>ZT?o=ZT:o<-ZT&&(o=-ZT),e[s+1]=o}return e}function FW(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]/$1,e[s+1]=360*Math.atan(Math.exp(i[s+1]/Cy))/Math.PI-90;return e}var xde=6378137,BW=[-180,-90,180,90],yde=Math.PI*xde/180,Qf=class extends bp{constructor(e,t){super({code:e,units:"degrees",extent:BW,axisOrientation:t,global:!0,metersPerUnit:yde,worldExtent:BW})}},FD=[new Qf("CRS:84"),new Qf("EPSG:4326","neu"),new Qf("urn:ogc:def:crs:OGC:1.3:CRS84"),new Qf("urn:ogc:def:crs:OGC:2:84"),new Qf("http://www.opengis.net/def/crs/OGC/1.3/CRS84"),new Qf("http://www.opengis.net/gml/srs/epsg.xml#4326","neu"),new Qf("http://www.opengis.net/def/crs/EPSG/0/4326","neu")];var BD={};function OW(i){return BD[i]||BD[i.replace(/urn:(x-)?ogc:def:crs:EPSG:(.*:)?(\w+)$/,"EPSG:$3")]||null}function UW(i,e){BD[i]=e}function dh(i){for(let e in i)delete i[e]}function Au(i){let e;for(e in i)return!1;return!e}var Y1={};function Z1(i,e,t){let n=i.getCode(),r=e.getCode();n in Y1||(Y1[n]={}),Y1[n][r]=t}function KT(i,e){return i in Y1&&e in Y1[i]?Y1[i][e]:null}var QT=.9996,Ic=.00669438,eE=Ic*Ic,tE=eE*Ic,tA=Ic/(1-Ic),kW=Math.sqrt(1-Ic),K1=(1-kW)/(1+kW),qW=K1*K1,OD=qW*K1,UD=OD*K1,HW=UD*K1,WW=1-Ic/4-3*eE/64-5*tE/256,bde=3*Ic/8+3*eE/32+45*tE/1024,wde=15*eE/256+45*tE/1024,Sde=35*tE/3072,Tde=3/2*K1-27/32*OD+269/512*HW,Ede=21/16*qW-55/32*UD,Mde=151/96*OD-417/128*HW,Cde=1097/512*UD,JT=6378137;function Rde(i,e,t){let n=i-5e5,o=(t.north?e:e-1e7)/QT/(JT*WW),a=o+Tde*Math.sin(2*o)+Ede*Math.sin(4*o)+Mde*Math.sin(6*o)+Cde*Math.sin(8*o),l=Math.sin(a),c=l*l,u=Math.cos(a),f=l/u,d=f*f,A=d*d,y=1-Ic*c,w=Math.sqrt(1-Ic*c),S=JT/w,T=(1-Ic)/y,R=tA*u**2,I=R*R,P=n/(S*QT),F=P*P,D=F*P,L=D*P,C=L*P,B=C*P,k=a-f/T*(F/2-L/24*(5+3*d+10*R-4*I-9*tA))+B/720*(61+90*d+298*R+45*A-252*tA-3*I),z=(P-D/6*(1+2*d+R)+C/120*(5-2*R+28*d-3*I+8*tA+24*A))/u;return z=$T(z+mu(jW(t.number)),-Math.PI,Math.PI),[XT(z),XT(k)]}var zW=-80,VW=84,Pde=-180,Ide=180;function Lde(i,e,t){i=$T(i,Pde,Ide),e<zW?e=zW:e>VW&&(e=VW);let n=mu(e),r=Math.sin(n),s=Math.cos(n),o=r/s,a=o*o,l=a*a,c=mu(i),u=jW(t.number),f=mu(u),d=JT/Math.sqrt(1-Ic*r**2),A=tA*s**2,y=s*$T(c-f,-Math.PI,Math.PI),w=y*y,S=w*y,T=S*y,R=T*y,I=R*y,P=JT*(WW*n-bde*Math.sin(2*n)+wde*Math.sin(4*n)-Sde*Math.sin(6*n)),F=QT*d*(y+S/6*(1-a+A)+R/120*(5-18*a+l+72*A-58*tA))+5e5,D=QT*(P+d*o*(w/2+T/24*(5-a+9*A+4*A**2)+I/720*(61-58*a+l+600*A-330*tA)));return t.north||(D+=1e7),[F,D]}function jW(i){return(i-1)*6-180+3}var Dde=[/^EPSG:(\d+)$/,/^urn:ogc:def:crs:EPSG::(\d+)$/,/^http:\/\/www\.opengis\.net\/def\/crs\/EPSG\/0\/(\d+)$/];function XW(i){let e=0;for(let r of Dde){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 GW(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 $W(i){return XW(i)?new bp({code:i,units:"m"}):null}function YW(i){let e=XW(i.getCode());return e?{forward:GW(Lde,e),inverse:GW(Rde,e)}:null}var Nde=63710088e-1;function kD(i,e,t){t=t||Nde;let n=mu(i[1]),r=mu(e[1]),s=(r-n)/2,o=mu(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 Fde=[YW],Bde=[$W];var VD=!0;function KW(i){VD=!(i===void 0?!0:i)}function qD(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 GD(i){UW(i.getCode(),i),Z1(i,i,qD)}function Ode(i){i.forEach(GD)}function Os(i){if(typeof i!="string")return i;let e=OW(i);if(e)return e;for(let t of Bde){let n=t(i);if(n)return n}return null}function HD(i,e,t,n){i=Os(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/Kf[n])}}else{let o=i.getUnits();if(o=="degrees"&&!n||n=="degrees")r=e;else{let a=nA(i,Os("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=kD(c.slice(0,2),c.slice(2,4)),f=kD(c.slice(4,6),c.slice(6,8));r=(u+f)/2}let l=n?Kf[n]:i.getMetersPerUnit();l!==void 0&&(r/=l)}}return r}function ZW(i){Ode(i),i.forEach(function(e){i.forEach(function(t){e!==t&&Z1(e,t,qD)})})}function Ude(i,e,t,n){i.forEach(function(r){e.forEach(function(s){Z1(r,s,t),Z1(s,r,n)})})}function nE(i,e){return i?typeof i=="string"?Os(i):i:Os(e)}function QW(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 Q1(i,e){if(i===e)return!0;let t=i.getUnits()===e.getUnits();return(i.getCode()===e.getCode()||nA(i,e)===qD)&&t}function nA(i,e){let t=i.getCode(),n=e.getCode(),r=KT(t,n);if(r)return r;let s=null,o=null;for(let l of Fde)s||(s=l(i)),o||(o=l(e));if(!s&&!o)return null;let a="EPSG:4326";if(o)if(s)r=zD(s.inverse,o.forward);else{let l=KT(t,a);l&&(r=zD(l,o.forward))}else{let l=KT(a,n);l&&(r=zD(s.inverse,l))}return r&&(GD(i),GD(e),Z1(i,e,r)),r}function zD(i,e){return function(t,n,r,s){return n=i(t,n,r,s),e(n,n,r,s)}}function iA(i,e){let t=Os(i),n=Os(e);return nA(t,n)}function J1(i,e,t){let n=iA(e,t);if(!n){let r=Os(e).getCode(),s=Os(t).getCode();throw new Error(`No transform available between ${r} and ${s}`)}return n(i,void 0,i.length)}function JW(i,e,t,n){let r=iA(e,t);return TW(i,r,void 0,n)}var gu=null;function rA(){return gu}function Ry(i,e){return gu?J1(i,e,gu):i}function vu(i,e){return gu?J1(i,gu,e):(VD&&!eA(i,[0,0])&&i[0]>=-180&&i[0]<=180&&i[1]>=-90&&i[1]<=90&&(VD=!1,jT("Call useGeographic() from ol/proj once to work with [longitude, latitude] coordinates.")),i)}function Sp(i,e){return gu?JW(i,e,gu):i}function _u(i,e){return gu?JW(i,gu,e):i}function ej(i,e){if(!gu)return i;let t=Os(e).getMetersPerUnit(),n=gu.getMetersPerUnit();return t&&n?i*t/n:i}function kde(){ZW(ND),ZW(FD),Ude(FD,ND,NW,FW)}kde();function WD(i){return i[0]>0&&i[1]>0}function tj(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 cs(i,e){return Array.isArray(i)?i:(e===void 0?e=[i,i]:(e[0]=i,e[1]=i),e)}var iE=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 sA(i,e,t,n,r){return r!==void 0?(r.minX=i,r.maxX=e,r.minY=t,r.maxY=n,r):new iE(i,e,t,n)}var rE=iE;function nj(i,e,t){let n,r;t=t||pl;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 pl(i,e){return i>e?1:i<e?-1:0}function ij(i,e){return i<e?1:i>e?-1:0}function ev(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 rj(i,e,t){for(;e<t;){let n=i[e];i[e]=i[t],i[t]=n,++e,--t}}function Do(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 ta(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 sj(i,e,t){let n=e||pl;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 jn(i,e){if(!i)throw new Error(e)}function oj(i,e,t,n,r){return!HT(r,function(o){return!Tp(i,e,t,n,o[0],o[1])})}function Tp(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 Py(i,e,t,n,r,s){if(t.length===0||!Tp(i,e,t[0],n,r,s))return!1;for(let o=1,a=t.length;o<a;++o)if(Tp(i,t[o-1],t[o],n,r,s))return!1;return!0}function aj(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(Py(i,e,l,n,r,s))return!0;e=l[l.length-1]}return!1}function sE(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 oA(i,e,t,n,r,s){return s=s??RD(Wr(),i,e,t,n),Ar(r,s)?s[0]>=r[0]&&s[2]<=r[2]||s[1]>=r[1]&&s[3]<=r[3]?!0:sE(i,e,t,n,function(o,a){return SW(r,o,a)}):!1}function lj(i,e,t,n,r){for(let s=0,o=t.length;s<o;++s){if(oA(i,e,t[s],n,r))return!0;e=t[s]}return!1}function jD(i,e,t,n,r){return!!(oA(i,e,t,n,r)||Tp(i,e,t,n,r[0],r[1])||Tp(i,e,t,n,r[0],r[3])||Tp(i,e,t,n,r[2],r[1])||Tp(i,e,t,n,r[2],r[3]))}function XD(i,e,t,n,r){if(!jD(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(oj(i,t[s-1],t[s],n,r)&&!oA(i,t[s-1],t[s],n,r))return!1;return!0}function cj(i,e,t,n,r){for(let s=0,o=t.length;s<o;++s){let a=t[s];if(XD(i,e,a,n,r))return!0;e=a[a.length-1]}return!1}function ei(){throw new Error("Unimplemented abstract method.")}var zde=0;function Bn(i){return i.ol_uid||(i.ol_uid=String(++zde))}function tv(i,e,t,n){return n!==void 0?(n[0]=i,n[1]=e,n[2]=t,n):[i,e,t]}function Vde(i,e,t){return i+"/"+e+"/"+t}function nv(i,e,t,n,r){return`${Bn(i)},${e},${Vde(t,n,r)}`}function uj(i){return Gde(i[0],i[1],i[2])}function Gde(i,e,t){return(e<<i)+t}function hj(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 iv=[0,0,0],Ep=5,$D=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,jn(sj(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,jn(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_=Pc(s)),jn(!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,jn(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,jn(!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 rE(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=sA(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 sA(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 sA(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 sA(c,c,u,u,n);let f=Math.floor(l*(s+1))-1,d=Math.floor(l*(o+1))-1;return sA(c,f,u,d,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,iv);let r=iv[1],s=iv[2];this.getTileCoordForXYAndZ_(e[2],e[1],t,!0,iv);let o=iv[1],a=iv[2];return sA(r,o,s,a,n)}getTileCoordCenter(e){let t=this.getOrigin(e[0]),n=this.getResolution(e[0]),r=cs(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=cs(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 ql(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=cs(this.getTileSize(o),this.tmpSize_),u=a*(e-l[0])/n/c[0],f=a*(l[1]-t)/n/c[1];return r?(u=My(u,Ep)-1,f=My(f,Ep)-1):(u=Ey(u,Ep),f=Ey(f,Ep)),tv(o,u,f,s)}getTileCoordForXYAndZ_(e,t,n,r,s){let o=this.getOrigin(n),a=this.getResolution(n),l=cs(this.getTileSize(n),this.tmpSize_),c=(e-o[0])/a/l[0],u=(o[1]-t)/a/l[1];return r?(c=My(c,Ep)-1,u=My(u,Ep)-1):(c=Ey(c,Ep),u=Ey(u,Ep)),tv(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=ev(this.resolutions_,e,t||0);return Si(n,this.minZoom,this.maxZoom)}tileCoordIntersectsViewport(e,t){return jD(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}},Iy=$D;function oE(i){let e=i.getDefaultTileGrid();return e||(e=Hde(i),i.setDefaultTileGrid(e)),e}function dj(i,e,t){let n=e[0],r=i.getTileCoordCenter(e),s=aE(t);if(!du(s,r)){let o=Kn(s),a=Math.ceil((s[0]-r[0])/o);return r[0]+=o*a,i.getTileCoordForCoordAndZ(r,n)}return e}function qde(i,e,t,n){n=n!==void 0?n:"top-left";let r=mj(i,e,t);return new Iy({extent:i,origin:bW(i,n),resolutions:r,tileSize:t})}function pj(i){let e=i||{},t=e.extent||Os("EPSG:3857").getExtent(),n={extent:t,minZoom:e.minZoom,tileSize:e.tileSize,resolutions:mj(t,e.maxZoom,e.tileSize,e.maxResolution)};return new Iy(n)}function mj(i,e,t,n){e=e!==void 0?e:42,t=cs(t!==void 0?t:256);let r=Nr(i),s=Kn(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 Hde(i,e,t,n){let r=aE(i);return qde(r,e,t,n)}function aE(i){i=Os(i);let e=i.getExtent();if(!e){let t=180*Kf.degrees/i.getMetersPerUnit();e=ql(-t,-t,t,t)}return e}var Pn={IDLE:0,LOADING:1,LOADED:2,ERROR:3,EMPTY:4};function qn(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 rv(i,e,t,n){return qn(i,e,t,n,!0)}function li(i){i&&i.target&&(i.target.removeEventListener(i.type,i.listener),dh(i))}var nn={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 YD=class{constructor(){this.disposed=!1}dispose(){this.disposed||(this.disposed=!0,this.disposeInternal())}disposeInternal(){}},Mp=YD;function Jf(){return!0}function ed(){return!1}function td(){}function lE(i){let e,t,n;return function(){let r=Array.prototype.slice.call(arguments);return(!t||this!==n||!ta(r,t))&&(n=this,t=r,e=i.apply(this,arguments)),e}}function Aj(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 ZD=class{constructor(e){this.propagationStopped,this.defaultPrevented,this.type=e,this.target=null}preventDefault(){this.defaultPrevented=!0}stopPropagation(){this.propagationStopped=!0}};var Ao=ZD;var KD=class extends Mp{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 Ao(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,td);delete o[n]}return l}disposeInternal(){this.listeners_&&dh(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]=td,++this.pendingRemovals_[e]):(n.splice(r,1),n.length===0&&delete this.listeners_[e]))}},Cp=KD;var aA=typeof navigator<"u"&&typeof navigator.userAgent<"u"?navigator.userAgent.toLowerCase():"",Wde=aA.includes("safari")&&!aA.includes("chrom"),eOe=Wde&&(aA.includes("version/15.4")||/cpu (os|iphone os) 15_4 like mac os x/.test(aA)),gj=aA.includes("webkit")&&!aA.includes("edge"),QD=aA.includes("macintosh"),vj=typeof devicePixelRatio<"u"?devicePixelRatio:1,no=typeof WorkerGlobalScope<"u"&&typeof OffscreenCanvas<"u"&&self instanceof WorkerGlobalScope,JD=typeof Image<"u"&&Image.prototype.decode;var cE=(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 _j(i,e,t){let n=i,r=!0,s=!1,o=!1,a=[rv(n,nn.LOAD,function(){o=!0,s||e()})];return n.src&&JD?(s=!0,n.decode().then(function(){r&&e()}).catch(function(l){r&&(o?e():t())})):a.push(rv(n,nn.ERROR,t)),function(){r=!1,a.forEach(li)}}function jde(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 xj(i,e){return e&&(i.src=e),i.src&&JD?new Promise((t,n)=>i.decode().then(()=>t(i)).catch(r=>i.complete&&i.width?t(i):n(r))):jde(i)}var an={IDLE:0,LOADING:1,LOADED:2,ERROR:3,EMPTY:4};function eN(i){return Math.pow(i,3)}function Lc(i){return 1-eN(1-i)}function yj(i){return 3*i*i-2*i*i*i}function bj(i){return i}var tN=class extends Cp{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(nn.CHANGE)}release(){this.setState(an.EMPTY)}getKey(){return this.key+"/"+this.tileCoord}getTileCoord(){return this.tileCoord}getState(){return this.state}setState(e){if(this.state!==an.EMPTY){if(this.state!==an.ERROR&&this.state>e)throw new Error("Tile load sequence violation");this.state=e,this.changed()}}load(){ei()}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:eN(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()}},sv=tN;function Di(i,e,t,n){let r;return t&&t.length?r=t.shift():no?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 nN;function Ly(){return nN||(nN=Di(1,1)),nN}function lA(i){let e=i.canvas;e.width=1,e.height=1,i.clearRect(0,0,1,1)}function iN(i,e){let t=e.parentNode;t&&t.replaceChild(i,e)}function wj(i){for(;i.lastChild;)i.lastChild.remove()}function Sj(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 uE(){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 Hl(i){return typeof HTMLCanvasElement<"u"&&i instanceof HTMLCanvasElement||typeof OffscreenCanvas<"u"&&i instanceof OffscreenCanvas}var rN=class extends sv{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_,no?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=an.LOADED,this.unlistenImage_(),this.changed()}getCrossOrigin(){return this.crossOrigin_}getReferrerPolicy(){return this.referrerPolicy_}handleImageError_(){this.state=an.ERROR,this.unlistenImage_(),this.image_=Xde(),this.changed()}handleImageLoad_(){if(no)this.state=an.LOADED;else{let e=this.image_;e.naturalWidth&&e.naturalHeight?this.state=an.LOADED:this.state=an.EMPTY}this.unlistenImage_(),this.changed()}load(){this.state==an.ERROR&&(this.state=an.IDLE,this.image_=new Image,this.crossOrigin_!==null&&(this.image_.crossOrigin=this.crossOrigin_),this.referrerPolicy_!==void 0&&(this.image_.referrerPolicy=this.referrerPolicy_)),this.state==an.IDLE&&(this.state=an.LOADING,this.changed(),this.tileLoadFunction_(this,this.src_),this.unlisten_=_j(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 Xde(){let i=Di(1,1);return i.fillStyle="rgba(0,0,0,0)",i.fillRect(0,0,1,1),i.canvas}var hE=rN;var sN,cA=[];function Tj(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 oN(i,e){return Math.abs(i[e*4]-210)>2||Math.abs(i[e*4+3]-.75*255)>2}function $de(){if(sN===void 0){let i=Di(6,6,cA);i.globalCompositeOperation="lighter",i.fillStyle="rgba(210, 0, 0, 0.75)",Tj(i,4,5,4,0),Tj(i,4,5,0,5);let e=i.getImageData(0,0,3,3).data;sN=oN(e,0)||oN(e,4)||oN(e,8),lA(i),cA.push(i.canvas)}return sN}function Ej(i,e,t,n){let r=J1(t,e,i),s=HD(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||du(l,r)){let c=HD(i,s,r)/s;isFinite(c)&&c>0&&(s/=c)}return s}function Mj(i,e,t,n){let r=dl(t),s=Ej(i,e,r,n);return(!isFinite(s)||s<=0)&&HT(t,function(o){return s=Ej(i,e,o,n),isFinite(s)&&s>0}),s}function Cj(i,e,t,n,r,s,o,a,l,c,u,f,d,A){let y=Di(Math.round(t*i),Math.round(t*e),cA);if(f||(y.imageSmoothingEnabled=!1),l.length===0)return y.canvas;y.scale(t,t);function w(F){return Math.round(F*t)/t}y.globalCompositeOperation="lighter";let S=Wr();l.forEach(function(F,D,L){qT(S,F.extent)});let T,R=t/n,I=(f?1:1+Math.pow(2,-24))/R;if(!d||l.length!==1||c!==0){if(T=Di(Math.round(Kn(S)*R),Math.round(Nr(S)*R),cA),f||(T.imageSmoothingEnabled=!1),r&&A){let F=(r[0]-S[0])*R,D=-(r[3]-S[3])*R,L=Kn(r)*R,C=Nr(r)*R;T.rect(F,D,L,C),T.clip()}l.forEach(function(F,D,L){if(F.image.width>0&&F.image.height>0){if(F.clipExtent){T.save();let G=(F.clipExtent[0]-S[0])*R,W=-(F.clipExtent[3]-S[3])*R,Y=Kn(F.clipExtent)*R,H=Nr(F.clipExtent)*R;T.rect(f?G:Math.round(G),f?W:Math.round(W),f?Y:Math.round(G+Y)-Math.round(G),f?H:Math.round(W+H)-Math.round(W)),T.clip()}let C=(F.extent[0]-S[0])*R,B=-(F.extent[3]-S[3])*R,k=Kn(F.extent)*R,z=Nr(F.extent)*R;T.drawImage(F.image,c,c,F.image.width-2*c,F.image.height-2*c,f?C:Math.round(C),f?B:Math.round(B),f?k:Math.round(C+k)-Math.round(C),f?z:Math.round(B+z)-Math.round(B)),F.clipExtent&&T.restore()}})}let P=Pc(o);return a.getTriangles().forEach(function(F,D,L){let C=F.source,B=F.target,k=C[0][0],z=C[0][1],G=C[1][0],W=C[1][1],Y=C[2][0],H=C[2][1],$=w((B[0][0]-P[0])/s),J=w(-(B[0][1]-P[1])/s),te=w((B[1][0]-P[0])/s),ce=w(-(B[1][1]-P[1])/s),he=w((B[2][0]-P[0])/s),ve=w(-(B[2][1]-P[1])/s),Re=k,Qe=z;k=0,z=0,G-=Re,W-=Qe,Y-=Re,H-=Qe;let Fe=[[G,W,0,0,te-$],[Y,H,0,0,he-$],[0,0,G,W,ce-J],[0,0,Y,H,ve-J]],mt=RW(Fe);if(!mt)return;if(y.save(),y.beginPath(),$de()||!f){y.moveTo(te,ce);let Ve=4,Ye=$-te,Mt=J-ce;for(let Et=0;Et<Ve;Et++)y.lineTo(te+w((Et+1)*Ye/Ve),ce+w(Et*Mt/(Ve-1))),Et!=Ve-1&&y.lineTo(te+w((Et+1)*Ye/Ve),ce+w((Et+1)*Mt/(Ve-1)));y.lineTo(he,ve)}else y.moveTo(te,ce),y.lineTo($,J),y.lineTo(he,ve);y.clip(),y.transform(mt[0],mt[2],mt[1],mt[3],$,J),y.translate(S[0]-Re,S[3]-Qe);let Ee;if(T)Ee=T.canvas,y.scale(I,-I);else{let Ve=l[0],Ye=Ve.extent;Ee=Ve.image,y.scale(Kn(Ye)/Ee.width,-Nr(Ye)/Ee.height)}y.drawImage(Ee,0,0),y.restore()}),T&&(lA(T),cA.push(T.canvas)),u&&(y.save(),y.globalCompositeOperation="source-over",y.strokeStyle="black",y.lineWidth=1,a.getTriangles().forEach(function(F,D,L){let C=F.target,B=(C[0][0]-P[0])/s,k=-(C[0][1]-P[1])/s,z=(C[1][0]-P[0])/s,G=-(C[1][1]-P[1])/s,W=(C[2][0]-P[0])/s,Y=-(C[2][1]-P[1])/s;y.beginPath(),y.moveTo(z,G),y.lineTo(B,k),y.lineTo(W,Y),y.closePath(),y.stroke()}),y.restore()),y.canvas}var Yde=[1,0,0,1,0,0],POe=new Array(6);function go(){return Yde.slice(0)}function Rj(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 jr(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 No(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 dE(i,e){let t=Zde(e);jn(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 Zde(i){return i[0]*i[3]-i[1]*i[2]}var Kde=[1e5,1e5,1e5,1e5,2,2];function Pj(i){return"matrix("+i.join(", ")+")"}function fE(i){return i.substring(7,i.length-1).split(",").map(parseFloat)}function Ij(i,e){let t=fE(i),n=fE(e);for(let r=0;r<6;++r)if(Math.round((t[r]-n[r])*Kde[r])!==0)return!1;return!0}var Qde=10,Lj=.25,aN=class{constructor(e,t,n,r,s,o,a){this.sourceProj_=e,this.targetProj_=t;let l={},c=a?QW(I=>jr(a,J1(I,this.targetProj_,this.sourceProj_))):iA(this.targetProj_,this.sourceProj_);this.transformInv_=function(I){let P=I[0]+"/"+I[1];return l[P]||(l[P]=c(I)),l[P]},this.maxSourceExtent_=r,this.errorThresholdSquared_=s*s,this.triangles_=[],this.wrapsXInSource_=!1,this.canWrapXInSource_=this.sourceProj_.canWrapX()&&!!r&&!!this.sourceProj_.getExtent()&&Kn(r)>=Kn(this.sourceProj_.getExtent()),this.sourceWorldWidth_=this.sourceProj_.getExtent()?Kn(this.sourceProj_.getExtent()):null,this.targetWorldWidth_=this.targetProj_.getExtent()?Kn(this.targetProj_.getExtent()):null;let u=Pc(n),f=j1(n),d=W1(n),A=H1(n),y=this.transformInv_(u),w=this.transformInv_(f),S=this.transformInv_(d),T=this.transformInv_(A),R=Qde+(o?Math.max(0,Math.ceil(Math.log2(Sy(n)/(o*o*256*256)))):0);if(this.addQuad_(u,f,d,A,y,w,S,T,R),this.wrapsXInSource_){let I=1/0;this.triangles_.forEach(function(P,F,D){I=Math.min(I,P.source[0][0],P.source[1][0],P.source[2][0])}),this.triangles_.forEach(P=>{if(Math.max(P.source[0][0],P.source[1][0],P.source[2][0])-I>this.sourceWorldWidth_/2){let F=[[P.source[0][0],P.source[0][1]],[P.source[1][0],P.source[1][1]],[P.source[2][0],P.source[2][1]]];F[0][0]-I>this.sourceWorldWidth_/2&&(F[0][0]-=this.sourceWorldWidth_),F[1][0]-I>this.sourceWorldWidth_/2&&(F[1][0]-=this.sourceWorldWidth_),F[2][0]-I>this.sourceWorldWidth_/2&&(F[2][0]-=this.sourceWorldWidth_);let D=Math.min(F[0][0],F[1][0],F[2][0]);Math.max(F[0][0],F[1][0],F[2][0])-D<this.sourceWorldWidth_/2&&(P.source=F)}})}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=CD([s,o,a,l]),f=this.sourceWorldWidth_?Kn(u)/this.sourceWorldWidth_:null,d=this.sourceWorldWidth_,A=this.sourceProj_.canWrapX()&&f>.5&&f<1,y=!1;if(c>0){if(this.targetProj_.isGlobal()&&this.targetWorldWidth_){let S=CD([e,t,n,r]);y=Kn(S)/this.targetWorldWidth_>Lj||y}!A&&this.sourceProj_.isGlobal()&&f&&(y=f>Lj||y)}if(!y&&this.maxSourceExtent_&&isFinite(u[0])&&isFinite(u[1])&&isFinite(u[2])&&isFinite(u[3])&&!Ar(u,this.maxSourceExtent_))return;let w=0;if(!y&&(!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)y=!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(!y){let S=[(e[0]+n[0])/2,(e[1]+n[1])/2],T=this.transformInv_(S),R;A?R=(fh(s[0],d)+fh(a[0],d))/2-fh(T[0],d):R=(s[0]+a[0])/2-T[0];let I=(s[1]+a[1])/2-T[1];y=R*R+I*I>this.errorThresholdSquared_}if(y){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],I=this.transformInv_(R);this.addQuad_(e,t,S,R,s,o,T,I,c-1),this.addQuad_(R,S,n,r,I,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],I=this.transformInv_(R);this.addQuad_(e,S,R,r,s,T,I,l,c-1),this.addQuad_(S,t,n,R,T,o,a,I,c-1)}return}}if(A){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=Wr();return this.triangles_.forEach(function(t,n,r){let s=t.source;Qm(e,s[0]),Qm(e,s[1]),Qm(e,s[2])}),e}getTriangles(){return this.triangles_}},Dj=aN;var lN=class extends sv{constructor(e,t,n,r,s,o,a,l,c,u,f,d){super(s,an.IDLE,d),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 A=r.getTileCoordExtent(this.wrappedTileCoord_),y=this.targetTileGrid_.getExtent(),w=this.sourceTileGrid_.getExtent(),S=y?uh(A,y):A;if(Sy(S)===0){this.state=an.EMPTY;return}let T=e.getExtent();T&&(w?w=uh(w,T):w=T);let R=r.getResolution(this.wrappedTileCoord_[0]),I=Mj(e,n,S,R);if(!isFinite(I)||I<=0){this.state=an.EMPTY;return}let P=u!==void 0?u:.5;if(this.triangulation_=new Dj(e,n,S,w,I*P,R),this.triangulation_.getTriangles().length===0){this.state=an.EMPTY;return}this.sourceZ_=t.getZForResolution(I);let F=this.triangulation_.calculateSourceExtent();if(w&&(e.canWrapX()?(F[1]=Si(F[1],w[1],w[3]),F[3]=Si(F[3],w[1],w[3])):F=uh(F,w)),!Sy(F))this.state=an.EMPTY;else{let D=0,L=0;e.canWrapX()&&(D=Kn(T),L=Math.floor((F[0]-T[0])/D)),WT(F.slice(),e,!0).forEach(B=>{let k=t.getTileRangeForExtentAndZ(B,this.sourceZ_);for(let z=k.minX;z<=k.maxX;z++)for(let G=k.minY;G<=k.maxY;G++){let W=L*D;this.sourceTiles_.push({getTile:()=>c(this.sourceZ_,z,G,a),offset:W})}++L}),this.sourceTiles_.length===0&&(this.state=an.EMPTY)}}getImage(){return this.canvas_}reproject_(){let e=[];if(this.sourceTiles_.forEach(t=>{let n=t.tile;if(n&&n.getState()==an.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=an.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_=Cj(r,s,this.pixelRatio_,a,this.sourceTileGrid_.getExtent(),o,l,this.triangulation_,e,this.gutter_,this.renderEdges_,this.interpolate),this.state=an.LOADED}this.changed()}load(){for(let e of this.sourceTiles_)e.tile=e.getTile();if(this.state==an.IDLE){this.state=an.LOADING,this.changed();let e=0;this.sourcesListenerKeys_=[],this.sourceTiles_.forEach(({tile:t})=>{let n=t.getState();if(n==an.IDLE||n==an.LOADING){e++;let r=qn(t,nn.CHANGE,s=>{let o=t.getState();(o==an.LOADED||o==an.ERROR||o==an.EMPTY)&&(li(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()==an.IDLE&&t.load()})}}unlistenSources_(){this.sourcesListenerKeys_.forEach(li),this.sourcesListenerKeys_=null}release(){this.canvas_&&(lA(this.canvas_.getContext("2d")),cA.push(this.canvas_),this.canvas_=null),this.sourceTiles_.length=0,super.release()}},pE=lN;var Jde=/\{z\}/g,epe=/\{x\}/g,tpe=/\{y\}/g,npe=/\{-y\}/g;function Nj(i,e,t,n,r){return i.replace(Jde,e.toString()).replace(epe,t.toString()).replace(tpe,n.toString()).replace(npe,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 Fj(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 ipe(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 Nj(i,o,t[1],t[2],s)})}function Bj(i,e){let t=i.length,n=new Array(t);for(let r=0;r<t;++r)n[r]=ipe(i[r],e);return rpe(n)}function rpe(i){return i.length===1?i[0]:(function(e,t,n){if(!e)return;let r=uj(e),s=fh(r,i.length);return i[s](e,t,n)})}var xu={PROPERTYCHANGE:"propertychange"};var ov=class extends Cp{constructor(){super(),this.on=this.onInternal,this.once=this.onceInternal,this.un=this.unInternal,this.revision_=0}changed(){++this.revision_,this.dispatchEvent(nn.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]=qn(this,e[s],t);return r}return qn(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]=rv(this,e[s],t)}else n=rv(this,e,t);return t.ol_key=n,n}unInternal(e,t){let n=t.ol_key;if(n)spe(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)}};ov.prototype.on;ov.prototype.once;ov.prototype.un;function spe(i){if(Array.isArray(i))for(let e=0,t=i.length;e<t;++e)li(i[e]);else li(i)}var mE=ov;var AE=class extends Ao{constructor(e,t,n){super(e),this.key=t,this.oldValue=n}},cN=class extends mE{constructor(e){super(),this.on,this.once,this.un,Bn(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 AE(n,e,t)),n=xu.PROPERTYCHANGE,this.hasListener(n)&&this.dispatchEvent(new AE(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],Au(this.values_)&&(this.values_=null),t||this.notify(e,n)}}},Us=cN;var uN=class extends Us{constructor(e){super(),this.projection=Os(e.projection),this.attributions_=Oj(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_=Oj(e),this.changed()}setState(e){this.state_=e,this.changed()}};function Oj(i){return i?typeof i=="function"?i:(Array.isArray(i)||(i=[i]),e=>i):null}var gE=uN;var hN=class extends gE{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&&cs(this.tileGrid.getTileSize(this.tileGrid.getMinZoom()),t),this.tmpSize=[0,0],this.key_=e.key||Bn(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 ei()}getTileGrid(){return this.tileGrid}getTileGridForProjection(e){return this.tileGrid?this.tileGrid:oE(e)}getTilePixelRatio(e){return this.tilePixelRatio_}getTilePixelSize(e,t,n){let r=this.getTileGridForProjection(n),s=this.getTilePixelRatio(t),o=cs(r.getTileSize(e),this.tmpSize);return s==1?o:tj(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=dj(r,e,n)),hj(e,r)?e:null}clear(){}refresh(){this.clear(),super.refresh()}},vE=class extends Ao{constructor(e,t){super(e),this.tile=t}},Uj=hN;var _E={TILELOADSTART:"tileloadstart",TILELOADEND:"tileloadend",TILELOADERROR:"tileloaderror"};var fN=class i extends Uj{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=Bn(t),r=t.getState(),s;r==an.LOADING?(this.tileLoadingKeys_[n]=!0,s=_E.TILELOADSTART):n in this.tileLoadingKeys_&&(delete this.tileLoadingKeys_[n],s=r==an.ERROR?_E.TILELOADERROR:r==an.LOADED?_E.TILELOADEND:void 0),s!=null&&this.dispatchEvent(new vE(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=Fj(e);this.urls=t,this.setUrls(t)}setUrls(e){this.urls=e;let t=e.join(`3+`);this.generateTileUrlFunction_?this.setTileUrlFunction(Bj(e,this.tileGrid),t):this.setKey(t)}tileUrlFunction(e,t,n){}},kj=fN;var dN=class extends kj{constructor(e){super({attributions:e.attributions,cacheSize:e.cacheSize,projection:e.projection,state:e.state,tileGrid:e.tileGrid,tileLoadFunction:e.tileLoadFunction?e.tileLoadFunction:ope,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:hE,this.tileGridForProjection={},this.reprojectionErrorThreshold_=e.reprojectionErrorThreshold,this.renderReprojectionEdges_=!1}getGutterForProjection(e){return this.getProjection()&&e&&!Q1(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||Q1(t,e)))return this.tileGrid;let n=Bn(e);return n in this.tileGridForProjection||(this.tileGridForProjection[n]=oE(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?an.IDLE:an.EMPTY,c!==void 0?c:"",{crossOrigin:this.crossOrigin,referrerPolicy:this.referrerPolicy},this.tileLoadFunction,this.tileOptions);return u.key=o,u.addEventListener(nn.CHANGE,this.handleTileChange.bind(this)),u}getTile(e,t,n,r,s,o){let a=this.getProjection();if(!a||!s||Q1(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),d=this.getTileCoordForTileUrlFunction(l,s),A=new pE(a,u,s,f,l,d,this.getTilePixelRatio(r),this.getGutter(),(y,w,S,T)=>this.getTileInternal(y,w,S,T,a,o),this.reprojectionErrorThreshold_,this.renderReprojectionEdges_,this.tileOptions);return A.key=c,A}getTileInternal(e,t,n,r,s,o){let a=this.getKey(),l=nv(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=Os(e);if(n){let r=Bn(n);r in this.tileGridForProjection||(this.tileGridForProjection[r]=t)}}};function ope(i,e){if(no){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 zj=dN;var pN=class extends zj{constructor(e){e=e||{};let t=e.projection!==void 0?e.projection:"EPSG:3857",n=e.tileGrid!==void 0?e.tileGrid:pj({extent:aE(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_}},Vj=pN;function Wl(){if(!O.world||!O.lens||O.settling)return;let i=O.engine?.getView();try{let e=Gj();e.last=O.volume.slug,e.volumes[O.volume.slug]={volume:O.volume.slug,world:O.world.slug,lens:O.world.lenses.indexOf(O.lens),center:i?.getCenter(),zoom:i?.getZoom(),hidden:[...O.hiddenCollections],collapsed:[...O.collapsedSections],expanded:[...O.expandedCollections],labels:[...O.labelOverrides],overviewDocked:O.overviewDocked,dockFolded:O.dockFolded,dockDismissed:O.dockDismissed},localStorage.setItem(LL,JSON.stringify(e))}catch{}}function Gj(){try{let i=JSON.parse(localStorage.getItem(LL)||"null");if(i&&i.volumes)return i}catch{}return{last:"",volumes:{}}}function av(i){let e=Gj(),t=i||e.last,n=t&&e.volumes[t];return n&&n.volume&&n.world?n:null}function lv(){let[i,e]=decodeURIComponent(location.hash.replace(/^#\/?/,"")).split("/").map(t=>t.trim());return{volume:i,world:e}}function qj(){if(!O.volume||!O.world)return;let i=`#${O.volume.slug}/${O.world.slug}`;location.hash!==i&&history.replaceState(null,"",i)}var mN=class i extends Us{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_&&(li(this.geometryChangeKey_),this.geometryChangeKey_=null);let e=this.getGeometry();e&&(this.geometryChangeKey_=qn(e,nn.CHANGE,this.handleGeometryChange_,this)),this.changed()}setGeometry(e){this.set(this.geometryName_,e)}setStyle(e){this.style_=e,this.styleFunction_=e?ape(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 ape(i){if(typeof i=="function")return i;let e;return Array.isArray(i)?e=i:(jn(typeof i.getZIndex=="function","Expected an `ol/style/Style` or an array of `ol/style/Style.js`"),e=[i]),function(){return e}}var Rp=mN;function ml(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 xE(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 d=e;d<t;d+=n){let A=i[d]-c,y=i[d+1]-u;o[f++]=c+A*a-y*l,o[f++]=u+A*l+y*a;for(let w=d+2;w<d+n;++w)o[f++]=i[w]}return o&&o.length!=f&&(o.length=f),o}function Hj(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 d=i[f]-l,A=i[f+1]-c;a[u++]=l+r*d,a[u++]=c+s*A;for(let y=f+2;y<f+n;++y)a[u++]=i[y]}return a&&a.length!=u&&(a.length=u),a}function Wj(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 jj=go(),lpe=[NaN,NaN],AN=class extends Us{constructor(){super(),this.extent_=Wr(),this.extentRevision_=-1,this.simplifiedGeometryMaxMinSquaredTolerance=0,this.simplifiedGeometryRevision=0,this.simplifyTransformedInternal=lE((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 ei()}closestPointXY(e,t,n,r){return ei()}containsXY(e,t){return this.closestPointXY(e,t,lpe,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 ei()}getExtent(e){if(this.extentRevision_!=this.getRevision()){let t=this.computeExtent(this.extent_);(isNaN(t[0])||isNaN(t[1]))&&Zm(t),this.extentRevision_=this.getRevision()}return wW(this.extent_,e)}rotate(e,t){ei()}scale(e,t,n){ei()}simplify(e){return this.getSimplifiedGeometry(e*e)}getSimplifiedGeometry(e){return ei()}getType(){return ei()}applyTransform(e){ei()}intersectsExtent(e){return ei()}translate(e,t){ei()}transform(e,t){let n=Os(e),r=n.getUnits()=="tile-pixels"?function(s,o,a){let l=n.getExtent(),c=n.getWorldExtent(),u=Nr(c)/Nr(l);No(jj,c[0],c[3],u,-u,0,0,0);let f=ml(s,0,s.length,a,jj,o),d=iA(n,t);return d?d(f,f,a):f}:iA(n,t);return this.applyTransform(r),this}},Xj=AN;var gN=class extends Xj{constructor(){super(),this.layout="XY",this.stride=2,this.flatCoordinates}computeExtent(e){return q1(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,e)}getCoordinates(){return ei()}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=$j(e),this.layout=e,this.flatCoordinates=t}setCoordinates(e,t){ei()}setLayout(e,t,n){let r;if(e)r=$j(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=cpe(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();xE(n,0,n.length,r,e,t,n),this.changed()}}scale(e,t,n){t===void 0&&(t=e),n||(n=dl(this.getExtent()));let r=this.getFlatCoordinates();if(r){let s=this.getStride();Hj(r,0,r.length,s,e,t,n,r),this.changed()}}translate(e,t){let n=this.getFlatCoordinates();if(n){let r=this.getStride();Wj(n,0,n.length,r,e,t,n),this.changed()}}};function cpe(i){let e;return i==2?e="XY":i==3?e="XYZ":i==4&&(e="XYZM"),e}function $j(i){let e;return i=="XY"?e=2:i=="XYZ"||i=="XYM"?e=3:i=="XYZM"&&(e=4),e}function Yj(i,e,t){let n=i.getFlatCoordinates();if(!n)return null;let r=i.getStride();return ml(n,0,n.length,r,e,t)}var Al=gN;function Zj(i,e,t,n){for(let r=0,s=t.length;r<s;++r)i[e++]=t[r];return e}function uA(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 Dy(i,e,t,n,r){r=r||[];let s=0;for(let o=0,a=t.length;o<a;++o){let l=uA(i,e,t[o],n);r[s++]=l,e=l}return r.length=s,r}function Kj(i,e,t,n,r){r=r||[];let s=0;for(let o=0,a=t.length;o<a;++o){let l=Dy(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 vN=class i extends Al{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=pu(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 GT(this.flatCoordinates,e)}getType(){return"Point"}intersectsExtent(e){return wy(e,this.flatCoordinates[0],this.flatCoordinates[1])}setCoordinates(e,t){this.setLayout(t,e,0),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=Zj(this.flatCoordinates,0,e,this.stride),this.changed()}},yu=vN;function hA(){return qq[O.world?.iconOutset==="dark"?"dark":"light"]}function upe(i){let e=O.world?.iconOutset==="dark",t=fpe(i);return(e?t>.3:t<.88)?i:hpe(i,e?.74:.42)}function hpe(i,e){let t=String(i).replace("#","");if(t.length!==6)return i;let[n,r,s]=[0,2,4].map(I=>parseInt(t.slice(I,I+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 d=(1-Math.abs(2*e-1))*f,A=d*(1-Math.abs(c/60%2-1)),y=e-d/2,[w,S,T]=c<60?[d,A,0]:c<120?[A,d,0]:c<180?[0,d,A]:c<240?[0,A,d]:c<300?[A,0,d]:[d,0,A],R=I=>Math.round((I+y)*255).toString(16).padStart(2,"0");return`#${R(w)}${R(S)}${R(T)}`}function fpe(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 cv(i){let e=Math.abs(Number(i)||0);return Wf[(Math.imul(e,2654435761)>>>0)%Wf.length]}function Dc(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 uv(i,e){i.style.setProperty("--pin-color",fA(e))}function fA(i){return upe(i.color||cv(i.id))}function hv(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("${_N(e.iconAsset)}")`),i.classList.add("has-source-icon")}function _N(i){let e=i.split("/").map(t=>encodeURIComponent(t)).join("/");return`${O.volume.base}/icons/${e}`}function bu(i){return i.split(/\s+/).slice(0,2).map(e=>e[0]||"").join("")}function Qj(i){return Math.imul(Number(i)||0,2654435761)>>>0}function xN(i){return String(i||"").replace(/\[([^\]]+)\]\([^)]+\)/g,"$1").replace(/[*_`>#]/g,"").replace(/\r/g,"").replace(/\n{3,}/g,`4+5+`).trim()}function jl(i){return new Intl.NumberFormat().format(i)}function us(i,e,t){return Math.min(t,Math.max(e,i))}function yE(i){return i instanceof HTMLElement&&(i.matches("input, textarea, select")||i.isContentEditable)}var dpe=100;function nd(){if(!ge.searchResults)return;let i=[...O.features.filter(n=>!n.filteredHidden).map(n=>({title:n.location.title,pin:n})),...[...O.zoneRecords.values()].filter(n=>n.zone.title&&!Io(n.zone.collectionId)&&(!O.search||n.zone.title.toLocaleLowerCase().includes(O.search))).map(n=>({title:n.zone.title,record:n}))].sort((n,r)=>n.title.localeCompare(r.title)),e=i.slice(0,dpe),t=document.createDocumentFragment();if(!e.length){let n=document.createElement("p");n.className="search-empty",n.textContent=O.search?"No visible features match.":"Nothing is enabled. Show a collection to list its features.",t.append(n)}for(let n of e)t.append(n.pin?ppe(n.pin):mpe(n.record));if(i.length>e.length){let n=document.createElement("p");n.className="dock-note",n.textContent=`First ${e.length} of ${jl(i.length)} \u2014 search or filter to narrow the list.`,t.append(n)}ge.searchResults.replaceChildren(t),gpe(i.length),Ape()}function ppe(i){let e=document.createElement("button");e.type="button",e.className="search-result",O.selectedPin===i&&e.classList.add("is-selected"),e.dataset.location=String(i.location.id),uv(e,i.category);let t=document.createElement("span");t.className="result-dot",hv(t,i.category,bu(i.category.title));let n=document.createElement("span"),r=document.createElement("strong");r.textContent=i.location.title;let s=document.createElement("small");return s.textContent=[i.category.title,i.category.group].filter(Boolean).join(" \xB7 "),n.append(r,s),e.append(t,n),e}function mpe(i){let e=document.createElement("button");e.type="button",e.className="search-result",O.selectedZone===i.zone&&e.classList.add("is-selected"),e.dataset.zone=String(i.zone.id);let t=document.createElement("span");t.className="result-dot",t.style.setProperty("background",i.color);let n=document.createElement("span"),r=document.createElement("strong");r.textContent=i.zone.title;let s=document.createElement("small");return s.textContent=i.collection?.title||"Zone",n.append(r,s),e.append(t,n),e}var Jj=28;function Ape(){let i=O.selectedPin?.location.title||"",e=i.length>Jj?`${i.slice(0,Jj-1).trimEnd()}\u2026`:i;ge.dockRailName.textContent=e?` \xB7 ${e}`:"",ge.dockRailName.hidden=!e}function gpe(i){ge.dockCount.textContent=`${jl(i)} ${i===1?"feature":"features"}`,O.search?(ge.dockFlag.textContent=`\u201C${O.search}\u201D`,ge.dockFlag.hidden=!1):O.hiddenCollections.size>0?(ge.dockFlag.textContent="filtered",ge.dockFlag.hidden=!1):ge.dockFlag.hidden=!0}function Ny(){!O.dockFolded||O.dockDismissed||bE(!1)}function yN(i){O.dockDismissed=i,bE(i)}function bE(i,e=!0){O.dockFolded=i,ge.dock.classList.toggle("is-folded",i),ge.dockFold.setAttribute("aria-expanded",String(!i));let t=i?"Bring the panel back (\u2318\u2325B)":"Put the panel away (\u2318\u2325B)";ge.dockFold.setAttribute("aria-label",t),ge.dockFold.setAttribute("title",t),e&&Wl()}function SN(i){O.hiddenCollections.delete(i.category.id),dA(),Nc(),ph(),Fy(i,!0)}function Fy(i,e=!1){O.selectedPin=i,O.selectedZone=null,ge.detailCoordinatesField.hidden=!1,document.dispatchEvent(new Event("atlas:selection")),Fc(),O.layers.pins.changed(),O.layers.pinLabels.changed(),O.layers.priority.changed(),ge.detailTitle.textContent=i.location.title,ge.detailCategory.textContent=[i.category.group,i.category.title].filter(Boolean).join(" / "),ge.detailDescription.textContent="",ge.detailLinks.hidden=!0,TN(),Epe(i),ge.detailID.textContent=String(i.location.id),ge.detailCoordinates.textContent=`${i.location.lat.toFixed(6)}, ${i.location.lng.toFixed(6)}`;let t=Hq(i.coordinate);ge.detailCell.textContent=t,ge.detailCellField.hidden=!t;for(let r of ge.detail.querySelectorAll("[data-cell-system-row]"))r.remove();for(let r of by(O.world)){if(r.slug==="geohash")continue;let s=r.locate(i.coordinate,O.world);if(!s)continue;let o=document.createElement("div");o.dataset.cellSystemRow=r.slug;let a=document.createElement("dt");a.textContent=s.label;let l=document.createElement("dd");l.textContent=s.value,o.append(a,l),ge.detailCellField.after(o)}let n=Tpe(i);if(ge.detailSource.textContent=n,ge.detailSourceField.hidden=!n,uv(ge.detailDot,i.category),hv(ge.detailDot,i.category,bu(i.category.title)),ge.detail.hidden=!1,Ny(),nd(),e){let r=O.engine.getView();r.animate({center:i.coordinate,zoom:Math.min(mh(O.lens),Math.max(r.getZoom()||0,4)),duration:220})}}function wE(i){O.selectedPin=null,O.selectedZone=i,document.dispatchEvent(new Event("atlas:selection")),Fc(),O.layers.pins.changed(),O.layers.priority.changed(),O.layers.zoneTitles.changed(),O.layers.zoneTitleDetail.changed();let e=z1(i);ge.detailTitle.textContent=i.title,ge.detailCategory.textContent=[e?.group,e?.title].filter(Boolean).join(" / ")||i.subtitle||"Zone",ge.detailDescription.textContent="",ge.detailLinks.hidden=!0,ge.detailLinks.replaceChildren(),ge.detailID.textContent=String(i.id),ge.detailCoordinatesField.hidden=!0,ge.detailCellField.hidden=!0;for(let n of ge.detail.querySelectorAll("[data-cell-system-row]"))n.remove();let t=O.world?.merged?.find(n=>n.origin)?.source||"";ge.detailSource.textContent=t,ge.detailSourceField.hidden=!t,ge.detailDot.textContent="",ge.detailDot.removeAttribute("style"),ge.detailDot.style.setProperty("background",cv(i.id)),TN(),eX([...vpe(i,e),...TD(i.attrs)]),i.hasText?Spe(i):ge.detailDescription.textContent="No description is included in the archive.",ge.detail.hidden=!1,Ny(),nd()}function vpe(i,e){let t=O.zoneRecords.get(i.id);if(!t||!e)return[];let n=[],r=xy(O.world);if(e.kind==="area"){if(r){let o=t.geometries.reduce((a,l)=>a+xpe(l,r),0);o>0&&n.push({label:"Area",value:bpe(o)})}let s=O.features.filter(o=>!o.filteredHidden&&By(o.location)&&t.geometries.some(a=>yD(a,o.coordinate))).length;n.push({label:"Locations inside",value:jl(s)})}if(e.kind==="path"&&r){let s=t.geometries.reduce((o,a)=>o+ype(a,r),0);s>0&&n.push({label:"Length",value:wpe(s)})}return n}var bN=110.574;function wN(i,[e,t]){return i.toLatLng(e,-t)}function _pe(i,e){let t=i.map(o=>wN(e,o));if(t.length<3)return 0;let n=t.reduce((o,a)=>o+a[0],0)/t.length,r=111.32*Math.cos(n*Math.PI/180),s=0;for(let o=0,a=t.length-1;o<t.length;a=o++){let[l,c]=t[a],[u,f]=t[o];s+=c*r*u*bN-f*r*l*bN}return Math.abs(s)/2}function xpe(i,e){let t=i.getType()==="MultiPolygon"?i.getPolygons():i.getType()==="Polygon"?[i]:[],n=0;for(let r of t)r.getLinearRings().forEach((s,o)=>{let a=_pe(s.getCoordinates(),e);n+=o===0?a:-a});return Math.max(0,n)}function ype(i,e){let t=i.getType()==="MultiLineString"?i.getCoordinates():i.getType()==="LineString"?[i.getCoordinates()]:[],n=0;for(let r of t)for(let s=1;s<r.length;s++){let[o,a]=wN(e,r[s-1]),[l,c]=wN(e,r[s]),u=(o+l)/2*(Math.PI/180),f=(c-a)*111.32*Math.cos(u),d=(l-o)*bN;n+=Math.hypot(f,d)}return n}function bpe(i){return`${i>=10?jl(Math.round(i)):i.toFixed(2)} km\xB2`}function wpe(i){return i<1?`${Math.round(i*1e3)} m`:`${i>=10?jl(Math.round(i)):i.toFixed(1)} km`}function TN(){for(let i of ge.detail.querySelectorAll("[data-feature-row]"))i.remove()}function eX(i){let e=ge.detailSourceField;for(let t of i){let n=document.createElement("div");n.dataset.featureRow="";let r=document.createElement("dt");r.textContent=t.label;let s=document.createElement("dd");s.textContent=t.value,n.append(r,s),e.after(n),e=n}}async function Spe(i){let e=await EN();if(O.selectedZone!==i)return;let t=e[String(i.id)]||{};ge.detailDescription.textContent=xN(t.d)||"No description is included in the archive."}function Tpe(i){let e=O.world?.merged;if(!e?.length)return"";let t=e.find(n=>n.origin)?.source||"";if(O.pinSourceIndex?.world!==O.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)}}O.pinSourceIndex={world:O.world,byID:n}}for(let n of e)if(!n.origin&&i.category.group===n.source)return n.source;return O.pinSourceIndex.byID.get(i.location.id)||t}async function Epe(i){let e=await EN();if(O.selectedPin!==i)return;let t=e[String(i.location.id)]||{};i.location.description=t.d||"",i.location.links=t.l||[],ge.detailDescription.textContent=xN(t.d)||"No description is included in the archive.",TN(),eX(TD(t.a)),Mpe(i)}function Mpe(i){let e=(i.location.links||[]).filter(n=>O.featureByID.has(n.locationId));if(ge.detailLinks.hidden=e.length===0,!e.length){ge.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)}ge.detailLinks.replaceChildren(t)}function id(){let i=O.selectedPin!==null||O.selectedZone!==null;O.selectedPin=null,O.selectedZone=null,document.dispatchEvent(new Event("atlas:selection")),O.sources&&(Fc(),O.layers.pins.changed(),O.layers.pinLabels.changed(),O.layers.priority.changed(),O.layers.zoneTitles.changed(),O.layers.zoneTitleDetail.changed()),ge.detail.hidden=!0,i&&nd()}function Bc(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 Pp(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++]=Bc(i,e,l,n,r[s]),e=l}return r.length=s,r}function Oy(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?[]:Pp(i,e,l,n,r[s]),e=l[l.length-1]}return r.length=s,r}var MN=class i extends Al{constructor(e,t){super(),t&&!Array.isArray(e[0])?this.setFlatCoordinates(t,e):this.setCoordinates(e,t)}appendPoint(e){Do(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<Rc(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=pu(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 Bc(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getPoint(e){let t=this.flatCoordinates.length/this.stride;return e<0||t<=e?null:new yu(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 yu(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(wy(e,o,a))return!0}return!1}setCoordinates(e,t){this.setLayout(t,e,1),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=uA(this.flatCoordinates,0,e,this.stride),this.changed()}},tX=MN;function CN(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 RN(i,e,t,n){let r=0;for(let s=0,o=t.length;s<o;++s){let a=t[s];r+=CN(i,e,a,n),e=a}return r}function nX(i,e,t,n){let r=0;for(let s=0,o=t.length;s<o;++s){let a=t[s];r+=RN(i,e,a,n),e=a[a.length-1]}return r}function iX(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 d=((r-a)*c+(s-l)*u)/(c*c+u*u);if(d>1)f=t;else if(d>0){for(let A=0;A<n;++A)o[A]=Lo(i[e+A],i[t+A],d);o.length=n;return}else f=e}for(let d=0;d<n;++d)o[d]=i[f+d];o.length=n}function Uy(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=pu(s,o,a,l);c>r&&(r=c),s=a,o=l}return r}function ky(i,e,t,n,r){for(let s=0,o=t.length;s<o;++s){let a=t[s];r=Uy(i,e,a,n,r),e=a}return r}function rX(i,e,t,n,r){for(let s=0,o=t.length;s<o;++s){let a=t[s];r=ky(i,e,a,n,r),e=a[a.length-1]}return r}function zy(i,e,t,n,r,s,o,a,l,c,u){if(e==t)return c;let f,d;if(r===0){if(d=pu(o,a,i[e],i[e+1]),d<c){for(f=0;f<n;++f)l[f]=i[e+f];return l.length=n,d}return c}u=u||[NaN,NaN];let A=e+n;for(;A<t;)if(iX(i,A-n,A,n,o,a,u),d=pu(o,a,u[0],u[1]),d<c){for(c=d,f=0;f<n;++f)l[f]=u[f];l.length=n,A+=n}else A+=n*Math.max((Math.sqrt(d)-Math.sqrt(c))/r|0,1);if(s&&(iX(i,t-n,e,n,o,a,u),d=pu(o,a,u[0],u[1]),d<c)){for(c=d,f=0;f<n;++f)l[f]=u[f];l.length=n}return c}function Vy(i,e,t,n,r,s,o,a,l,c,u){u=u||[NaN,NaN];for(let f=0,d=t.length;f<d;++f){let A=t[f];c=zy(i,e,A,n,r,s,o,a,l,c,u),e=A}return c}function sX(i,e,t,n,r,s,o,a,l,c,u){u=u||[NaN,NaN];for(let f=0,d=t.length;f<d;++f){let A=t[f];c=Vy(i,e,A,n,r,s,o,a,l,c,u),e=A[A.length-1]}return c}function pA(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(),d=c.pop(),A=0,y=i[d],w=i[d+1],S=i[f],T=i[f+1];for(let R=d+n;R<f;R+=n){let I=i[R],P=i[R+1],F=CW(I,P,y,w,S,T);F>A&&(u=R,A=F)}A>r&&(l[(u-e)/n]=1,d+n<u&&c.push(d,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 SE(i,e,t,n,r,s,o,a){for(let l=0,c=t.length;l<c;++l){let u=t[l];o=pA(i,e,u,n,r,s,o),a.push(o),e=u}return o}function Ip(i,e){return e*Math.round(i/e)}function Cpe(i,e,t,n,r,s,o){if(e==t)return o;let a=Ip(i[e],r),l=Ip(i[e+1],r);e+=n,s[o++]=a,s[o++]=l;let c,u;do if(c=Ip(i[e],r),u=Ip(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=Ip(i[e],r),d=Ip(i[e+1],r);if(e+=n,f==c&&d==u)continue;let A=c-a,y=u-l,w=f-a,S=d-l;if(A*S==y*w&&(A<0&&w<A||A==w||A>0&&w>A)&&(y<0&&S<y||y==S||y>0&&S>y)){c=f,u=d;continue}s[o++]=c,s[o++]=u,a=c,l=u,c=f,u=d}return s[o++]=c,s[o++]=u,o}function Gy(i,e,t,n,r,s,o,a){for(let l=0,c=t.length;l<c;++l){let u=t[l];o=Cpe(i,e,u,n,r,s,o),a.push(o),e=u}return 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],f=[];o=Gy(i,e,u,n,r,s,o,f),a.push(f),e=u[u.length-1]}return o}var PN=class i extends Al{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<Rc(this.getExtent(),e,t)?r:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(Uy(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),zy(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,this.maxDelta_,!0,e,t,n,r))}getArea(){return CN(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getCoordinates(){return Bc(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getSimplifiedGeometryInternal(e){let t=[];return t.length=pA(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,e,t,0),new i(t,"XY")}getType(){return"LinearRing"}intersectsExtent(e){return oA(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,e)}setCoordinates(e,t){this.setLayout(t,e,1),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=uA(this.flatCoordinates,0,e,this.stride),this.changed()}},IN=PN;function qy(i,e,t,n,r,s,o){let a,l,c,u,f,d,A,y=r[s+1],w=[];for(let R=0,I=t.length;R<I;++R){let P=t[R];for(u=i[P-n],d=i[P-n+1],a=e;a<P;a+=n)f=i[a],A=i[a+1],(y<=d&&A<=y||d<=y&&y<=A)&&(c=(y-d)/(A-d)*(f-u)+u,w.push(c)),u=f,d=A}let S=NaN,T=-1/0;for(w.sort(pl),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,Py(i,e,t,n,c,y)&&(S=c,T=R)),u=f}return isNaN(S)&&(S=r[s]),o?(o.push(S,y,T),o):[S,y,T]}function TE(i,e,t,n,r){let s=[];for(let o=0,a=t.length;o<a;++o){let l=t[o];s=qy(i,e,l,n,r,2*o,s),e=l[l.length-1]}return s}function aX(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 LN(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 DN(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=LN(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 lX(i,e,t,n,r){for(let s=0,o=t.length;s<o;++s){let a=t[s];if(!DN(i,e,a,n,r))return!1;a.length&&(e=a[a.length-1])}return!0}function EE(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=LN(i,e,a,n);(s===0?r&&l||!r&&!l:r&&!l||!r&&l)&&aX(i,e,a,n),e=a}return e}function NN(i,e,t,n,r){for(let s=0,o=t.length;s<o;++s)e=EE(i,e,t[s],n,r);return e}function cX(i,e){let t=[],n=0,r=0,s;for(let o=0,a=e.length;o<a;++o){let l=e[o],c=LN(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 ME=class i extends Al{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?Do(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<Rc(this.getExtent(),e,t)?r:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(ky(this.flatCoordinates,0,this.ends_,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),Vy(this.flatCoordinates,0,this.ends_,this.stride,this.maxDelta_,!0,e,t,n,r))}containsXY(e,t){return Py(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,e,t)}getArea(){return RN(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride)}getCoordinates(e){let t;return e!==void 0?(t=this.getOrientedFlatCoordinates().slice(),EE(t,0,this.ends_,this.stride,e)):t=this.flatCoordinates,Pp(t,0,this.ends_,this.stride)}getEnds(){return this.ends_}getFlatInteriorPoint(){if(this.flatInteriorPointRevision_!=this.getRevision()){let e=dl(this.getExtent());this.flatInteriorPoint_=qy(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,e,0),this.flatInteriorPointRevision_=this.getRevision()}return this.flatInteriorPoint_}getInteriorPoint(){return new yu(this.getFlatInteriorPoint(),"XYM")}getLinearRingCount(){return this.ends_.length}getLinearRing(e){return e<0||this.ends_.length<=e?null:new IN(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 IN(t.slice(s,l),e);r.push(c),s=l}return r}getOrientedFlatCoordinates(){if(this.orientedRevision_!=this.getRevision()){let e=this.flatCoordinates;DN(e,0,this.ends_,this.stride)?this.orientedFlatCoordinates_=e:(this.orientedFlatCoordinates_=e.slice(),this.orientedFlatCoordinates_.length=EE(this.orientedFlatCoordinates_,0,this.ends_,this.stride)),this.orientedRevision_=this.getRevision()}return this.orientedFlatCoordinates_}getSimplifiedGeometryInternal(e){let t=[],n=[];return t.length=Gy(this.flatCoordinates,0,this.ends_,this.stride,Math.sqrt(e),t,0,n),new i(t,"XY",n)}getType(){return"Polygon"}intersectsExtent(e){return XD(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,e)}setCoordinates(e,t){this.setLayout(t,e,2),this.flatCoordinates||(this.flatCoordinates=[]);let n=Dy(this.flatCoordinates,0,e,this.stride,this.ends_);this.flatCoordinates.length=n.length===0?0:n[n.length-1],this.changed()}},Ah=ME;function FN(i){if(hh(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 ME(s,"XY",[s.length])}function CE(i,e,t,n){let r=[],s=Wr();for(let o=0,a=t.length;o<a;++o){let l=t[o];s=q1(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 BN=class i extends Al{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 d=0,A=f.length;d<A;++d)f[d]+=u;Do(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;Do(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<Rc(this.getExtent(),e,t)?r:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(rX(this.flatCoordinates,0,this.endss_,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),sX(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,this.maxDelta_,!0,e,t,n,r))}containsXY(e,t){return aj(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,e,t)}getArea(){return nX(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride)}getCoordinates(e){let t;return e!==void 0?(t=this.getOrientedFlatCoordinates().slice(),NN(t,0,this.endss_,this.stride,e)):t=this.flatCoordinates,Oy(t,0,this.endss_,this.stride)}getEndss(){return this.endss_}getFlatInteriorPoints(){if(this.flatInteriorPointsRevision_!=this.getRevision()){let e=CE(this.flatCoordinates,0,this.endss_,this.stride);this.flatInteriorPoints_=TE(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,e),this.flatInteriorPointsRevision_=this.getRevision()}return this.flatInteriorPoints_}getInteriorPoints(){return new tX(this.getFlatInteriorPoints().slice(),"XYM")}getOrientedFlatCoordinates(){if(this.orientedRevision_!=this.getRevision()){let e=this.flatCoordinates;lX(e,0,this.endss_,this.stride)?this.orientedFlatCoordinates_=e:(this.orientedFlatCoordinates_=e.slice(),this.orientedFlatCoordinates_.length=NN(this.orientedFlatCoordinates_,0,this.endss_,this.stride)),this.orientedRevision_=this.getRevision()}return this.orientedFlatCoordinates_}getSimplifiedGeometryInternal(e){let t=[],n=[];return t.length=oX(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 Ah(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,d=l.length;f<d;++f)l[f]-=s;let u=new Ah(t.slice(s,c),e,l);r.push(u),s=c}return r}getType(){return"MultiPolygon"}intersectsExtent(e){return cj(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,e)}setCoordinates(e,t){this.setLayout(t,e,3),this.flatCoordinates||(this.flatCoordinates=[]);let n=Kj(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()}},RE=BN;function uX(i){return i.key.toLocaleLowerCase()==="g"?(i.preventDefault(),hX(),O.gridEnabled?(ge.gridInput.focus(),ge.gridInput.select()):ge.viewport.focus({preventScroll:!0}),!0):i.key===" "&&O.gridEnabled&&i.target!==ge.subgridToggle?(i.preventDefault(),Hy(!O.subgridVisible),!0):i.key==="Escape"&&O.gridEnabled?(i.preventDefault(),ON(),!0):!1}function hX(i=!O.gridEnabled){O.gridEnabled=i,i&&Hy(!0),Wy(),Fc(),O.layers.pins.changed(),O.layers.priority.changed()}function Hy(i){O.subgridVisible=i,O.layers.grid.changed(),O.layers.gridContext.changed(),ge.subgridToggle.setAttribute("aria-pressed",String(i)),ge.subgridToggle.setAttribute("aria-label",i?"Hide the subgrid":"Show the subgrid"),fX(),document.dispatchEvent(new Event("atlas:grid"))}function fX(){if(!O.gridEnabled){ge.gridHint.textContent="G \xB7 grid off";return}ge.gridHint.textContent=`G-${O.gridCell||"root"}`+(O.subgridVisible?"":" no subgrid")}function mA(i){let e=Ss(),t=e.parseInput(e.normalizeInput(i));if(t===null)return;let n=t!==O.gridCell;O.gridCell=t,O.gridEnabled||(O.gridEnabled=!0),Wy(),Fc(),O.layers.pins.changed(),O.layers.priority.changed(),n&&(id(),O.engine.getView().fit(kN(),{size:O.engine.getSize(),padding:[52,52,52,52],maxZoom:mh(O.lens),duration:180}))}function ON(){if(O.gridEnabled){if(!O.gridCell){hX(!1);return}mA(Ss().parent(O.gridCell))}}function Wy(){if(O.sources){if(O.sources.grid.clear(),O.sources.gridContext.clear(),ge.gridNavigator.hidden=!O.gridEnabled,fX(),Rpe(),O.gridEnabled&&O.lens){let i=Ss();ge.gridInput.maxLength=i.inputLength(O.world),ge.gridInput.value=O.gridCell,ge.gridBack.title=O.gridCell?`Back one ${i.slug} level`:`Close ${i.slug} grid`;for(let e of LE())Dpe(e)}document.dispatchEvent(new Event("atlas:grid"))}}function Rpe(){let i=by(O.world),e=Ss();if(ge.gridSystemName.textContent=e.name,ge.gridSystem.hidden=i.length<2,i.length<2)return;let t=i[(i.indexOf(e)+1)%i.length];ge.gridSystem.textContent=e.short,ge.gridSystem.title=`Dividing by ${e.name} \xB7 \u2318G for ${t.name}`,ge.gridSystem.setAttribute("aria-label",`Cell system: ${e.name}. Switch to ${t.name}`)}function UN(){let i=by(O.world);if(i.length<2)return;let e=i.indexOf(Ss());Ppe(i[(e+1)%i.length].slug)}function Ppe(i){if(i===O.gridSystem)return;let e=Ss(),t=O.gridCell;O.gridSystem=i,O.gridCell=t?xW(e,Ss(),t,O.world):"",Wy(),Fc(),O.layers.pins.changed(),O.layers.priority.changed()}function Ipe(i){return Wf[Ss().colorKey(i)]}function IE(i,{subgridVisible:e,labelled:t}){let{role:n,contextDistance:r}=i;if(n==="child"&&(!t||!e))return null;let s=Ipe(i.hash),o=n==="leaf"||n==="scope",a=n==="scope"&&e,l={color:o?Vi.lineWhite:s,opacity:n==="neighbor"?Vi.neighborLineAlpha:n==="child"?Vi.childLineAlpha:1,widthPx:a?Vi.widths.scopeBare:Vi.widths[n]},c=null;n==="neighbor"?c={color:Vi.dimColor,opacity:Math.min(Vi.dimCap,Vi.dimBase+r*Vi.dimStep)}:n==="leaf"?c={color:s,opacity:Vi.leafFillAlpha}:n==="child"&&(c={color:s,opacity:Vi.childFillAlpha});let u=null;if(t&&!a){let{context:f,principal:d}=Ss().label(i.hash);u={prefix:f,final:d,color:o?Vi.lineWhite:s,textAlpha:n==="neighbor"?Vi.neighborTextAlpha:1,chip:n==="neighbor"?Vi.neighborChip:Vi.chip,sizePx:n==="neighbor"?Vi.neighborLabelSizePx:Vi.labelSizePx}}return{line:l,fill:c,label:u,bare:a}}function LE(){let i=Ss(),e=[],t=Lpe(i,O.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(PE(i,s,"neighbor",t.length-1-n))}if(O.gridCell&&i.level(O.gridCell)>=i.maxLevel(O.world))return e.push(PE(i,O.gridCell,"leaf",0)),e;O.gridCell&&e.push(PE(i,O.gridCell,"scope",0));for(let n of i.children(O.gridCell))e.push(PE(i,n,"child",0));return e}function Lpe(i,e){let t=[e],n=e;for(;n;)n=i.parent(n),t.unshift(n);return t}function PE(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 Dpe(i){let e=Ss(),t=O.features.filter(s=>!s.filteredHidden&&e.contains(i.hash,s.coordinate)).length,n=new Rp({geometry:Npe(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"?O.sources.gridContext:O.sources.grid).addFeature(n)}function Npe(i){let e=jf(),t=i.ring;if(i.pole){let o=i.pole==="north"?e[3]:e[1];t=[...t,[t[t.length-1][0],o],[t[0][0],o],t[0]]}if(t.every(([o])=>o>=e[0]&&o<=e[2]))return new Ah([t]);let r=e[2]-e[0],s=[];for(let o of[0,-r,r]){let a=yW(t.map(([l,c])=>[l+o,c]),e[0],e[2]);a.length>=4&&s.push([a])}return new RE(s)}function kN(){return Ss().bbox(O.gridCell)}function dX(){return Ss().maxLevel(O.world)}function Lp(i){return!O.gridEnabled||!O.gridCell?!1:Ss().contains(O.gridCell,i.coordinate)}var NE=[NaN,NaN,NaN,0],zN;function Fpe(){return zN||(zN=Di(1,1,void 0,{willReadFrequently:!0,desynchronized:!0})),zN}var Bpe=/^rgba?\(\s*(\d+%?)\s+(\d+%?)\s+(\d+%?)(?:\s*\/\s*(\d+%|\d*\.\d+|[01]))?\s*\)$/i,Ope=/^rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)(?:\s*,\s*(\d+%|\d*\.\d+|[01]))?\s*\)$/i,Upe=/^rgba?\(\s*(\d+%)\s*,\s*(\d+%)\s*,\s*(\d+%)(?:\s*,\s*(\d+%|\d*\.\d+|[01]))?\s*\)$/i,kpe=/^#([\da-f]{3,4}|[\da-f]{6}|[\da-f]{8})$/i;function DE(i,e){return i.endsWith("%")?Number(i.substring(0,i.length-1))/e:Number(i)}function Xy(i){throw new Error('failed to parse "'+i+'" as color')}function pX(i){if(i.toLowerCase().startsWith("rgb")){let s=i.match(Ope)||i.match(Bpe)||i.match(Upe);if(s){let o=s[4],a=100/255;return[Si(DE(s[1],a)+.5|0,0,255),Si(DE(s[2],a)+.5|0,0,255),Si(DE(s[3],a)+.5|0,0,255),o!==void 0?Si(DE(o,100),0,1):1]}Xy(i)}if(i.startsWith("#")){if(kpe.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}Xy(i)}let e=Fpe();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&&Xy(i));let n=e.fillStyle;if(n.startsWith("#")||n.startsWith("rgba"))return pX(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]=Jm(r[3]/255,3),r}function mX(i){return typeof i=="string"?i:Yy(i)}var zpe=1024,jy={},VN=0;function AX(i){if(i.length===4)return i;let e=i.slice();return e[3]=1,e}function GN(i){return i>.0031308?Math.pow(i,1/2.4)*269.025-14.025:i*3294.6}function qN(i){return i>.2068965?Math.pow(i,3):(i-4/29)*(108/841)}function HN(i){return i>10.314724?Math.pow((i+14.025)/269.025,2.4):i/3294.6}function WN(i){return i>.0088564?Math.pow(i,1/3):i/(108/841)+4/29}function jN(i){let e=HN(i[0]),t=HN(i[1]),n=HN(i[2]),r=WN(e*.222488403+t*.716873169+n*.06060791),s=500*(WN(e*.452247074+t*.399439023+n*.148375274)-r),o=200*(r-WN(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 gX(i){let e=(i[0]+16)/116,t=i[1],n=i[2]*Math.PI/180,r=qN(e),s=qN(e+t/500*Math.cos(n)),o=qN(e-t/200*Math.sin(n)),a=GN(s*3.021973625-r*1.617392459-o*.404875592),l=GN(s*-.943766287+r*1.916279586+o*.027607165),c=GN(s*.069407491-r*.22898585+o*1.159737864);return[Si(a+.5|0,0,255),Si(l+.5|0,0,255),Si(c+.5|0,0,255),i[3]]}function $y(i){if(i==="none")return NE;if(jy.hasOwnProperty(i))return jy[i];if(VN>=zpe){let t=0;for(let n in jy)(t++&3)===0&&(delete jy[n],--VN)}let e=pX(i);e.length!==4&&Xy(i);for(let t of e)isNaN(t)&&Xy(i);return jy[i]=e,++VN,e}function Oc(i){return Array.isArray(i)?i:$y(i)}function Yy(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 $N=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=XN(e,t);return n in this.cache_?this.cache_[n]:null}getPattern(e,t){let n=XN(e,t);return n in this.patternCache_?this.patternCache_[n]:null}set(e,t,n,r){let s=XN(e,t),o=s in this.cache_;this.cache_[s]=n,r&&(n.getImageState()===Pn.IDLE&&n.load(),n.getImageState()===Pn.LOADING?n.ready().then(()=>{this.patternCache_[s]=Ly().createPattern(n.getImage(1),"repeat")}):this.patternCache_[s]=Ly().createPattern(n.getImage(1),"repeat")),o||++this.cacheSize_}setSize(e){this.maxCacheSize_=e,this.expire()}};function XN(i,e){let t=e?Oc(e):"null";return i+":"+t}var na=new $N;var Zy=null,FE=class extends Cp{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?Pn.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_===Pn.LOADED){Zy||(Zy=Di(1,1,void 0,{willReadFrequently:!0})),Zy.drawImage(this.image_,0,0);try{Zy.getImageData(0,0,1,1),this.tainted_=!1}catch{Zy=null,this.tainted_=!0}}return this.tainted_===!0}dispatchChangeEvent_(){this.dispatchEvent(nn.CHANGE)}handleImageError_(){this.imageState_=Pn.ERROR,this.dispatchChangeEvent_()}handleImageLoad_(){this.imageState_=Pn.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=Di(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_===Pn.IDLE){this.image_||this.initializeImage_(),this.imageState_=Pn.LOADING;try{this.src_!==void 0&&(this.image_.src=this.src_)}catch{this.handleImageError_()}this.image_ instanceof HTMLImageElement&&xj(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_!==Pn.LOADED)return;let t=this.image_,n=Di(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=mX(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_===Pn.LOADED||this.imageState_===Pn.ERROR)e();else{let t=()=>{(this.imageState_===Pn.LOADED||this.imageState_===Pn.ERROR)&&(this.removeEventListener(nn.CHANGE,t),e())};this.addEventListener(nn.CHANGE,t)}})),this.ready_}};function Dp(i,e,t,n,r,s){let o=e===void 0?void 0:na.get(e,r);return o||(o=new FE(i,i&&"src"in i?i.src||void 0:e,t,n,r),na.set(e,r,o,s)),s&&o&&!na.getPattern(e,r)&&na.set(e,r,o,s),o}var vX=FE;function gl(i){return i?Array.isArray(i)?Yy(i):typeof i=="object"&&"src"in i?Vpe(i):i:null}function Vpe(i){if(!i.offset||!i.size)return na.getPattern(i.src,i.color);let e=i.src+":"+i.offset,t=na.getPattern(e,i.color);if(t)return t;let n=na.get(i.src,null);if(n.getImageState()!==Pn.LOADED)return null;let r=Di(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]),Dp(r.canvas,e,void 0,Pn.LOADED,i.color,!0),na.getPattern(e,i.color)}var Ky="ol-hidden";var Np="ol-unselectable";var fv="ol-control",YN="ol-collapsed",Gpe=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"),_X=["style","variant","weight","size","lineHeight","family"],BE={normal:400,bold:700},OE=function(i){let e=i.match(Gpe);if(!e)return null;let t={lineHeight:"normal",size:"1.2em",style:"normal",weight:"400",variant:"normal"};for(let n=0,r=_X.length;n<r;++n){let s=e[n+1];s!==void 0&&(t[_X[n]]=typeof s=="string"?s.trim():s)}return isNaN(Number(t.weight))&&t.weight in BE&&(t.weight=BE[t.weight]),t.families=t.family.split(/,\s?/).map(n=>n.trim().replace(/^['"]|['"]$/g,"")),t};var UE="10px sans-serif",io="#000",gh="round",vl=[],_l=0,vh="round",rd=10,yX=0,ia="#000",Fp="center",gA="middle",sd=[0,0,0,0],od=1,AA=new Us,Qy=null,xX,ZN={},qpe=new Set(["serif","sans-serif","monospace","cursive","fantasy","system-ui","ui-serif","ui-sans-serif","ui-monospace","ui-rounded","emoji","math","fangsong"]);function Hpe(i,e,t){return`${i} ${e} 16px "${t}"`}var bX=(function(){let e,t;async function n(s){await t.ready;let o=OE(s),a=o.families[0].toLowerCase(),l=o.weight,c=[];return t.forEach(f=>{let d=f.family.replace(/^['"]|['"]$/g,"").toLowerCase(),A=BE[f.weight]||f.weight;d===a&&f.style===o.style&&A==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=AA.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)?(dh(ZN),AA.set(c,100)):(u+=10,AA.set(c,u,!0),u<100&&(s=!1)))}e=void 0,s||(e=setTimeout(r,100))}return async function(s){t||(t=no?self.fonts:document.fonts);let o=OE(s);if(!o)return;let a=o.families,l=!1;for(let c of a){if(qpe.has(c))continue;let u=Hpe(o.style,o.weight,c);AA.get(u)===void 0&&(AA.set(u,0,!0),l=!0)}l&&(clearTimeout(e),e=setTimeout(r,100))}})(),Wpe=(function(){let i;return function(e){let t=ZN[e];if(t==null){if(no){let n=OE(e),r=wX(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);ZN[e]=t}return t}})();function wX(i,e){return Qy||(Qy=Di(1,1)),i!=xX&&(Qy.font=i,xX=Qy.font),Qy.measureText(e)}function SX(i,e){return wX(i,e).width}function KN(i,e,t){if(e in t)return t[e];let n=e.split(`6+`).reduce((r,s)=>Math.max(r,SX(i,s)),0);return t[e]=n,n}function TX(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===`7+`||c===u){s=Math.max(s,o),r.push(o),o=0,a+=l,l=0;continue}let d=e[c+1]||i.font,A=SX(d,f);t.push(A),o+=A;let y=Wpe(d);n.push(y),l=Math.max(l,y)}return{width:s,height:a,widths:t,heights:n,lineWidths:r}}function EX(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]),jpe(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 jpe(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 QN=class i{constructor(e){this.opacity_=e.opacity,this.rotateWithView_=e.rotateWithView,this.rotation_=e.rotation,this.scale_=e.scale,this.scaleArray_=cs(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 ei()}getImage(e){return ei()}getHitDetectionImage(){return ei()}getPixelRatio(e){return 1}getImageState(){return ei()}getImageSize(){return ei()}getOrigin(){return ei()}getSize(){return ei()}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_=cs(e)}listenImageChange(e){ei()}load(){ei()}unlistenImageChange(e){ei()}ready(){return Promise.resolve()}},kE=QN;var JN=class i extends kE{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()?Pn.LOADING:Pn.LOADED,this.imageState_===Pn.LOADING&&this.ready().then(()=>this.imageState_=Pn.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=na.get(n,null)?.getImage(1);if(!r){let s=this.renderOptions_,o=Math.ceil(s.size*e),a=Di(o,o);this.draw_(s,a,e),r=a.canvas;let l=new vX(r,void 0,null,Pn.LOADED,null);na.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),d=f/l;if(e==="miter"&&d<=n)return d*t;let A=t/2/d,y=t/2*(u/f),S=Math.sqrt((r+A)*(r+A)+y*y)-r;if(this.radius2_===void 0||e==="bevel")return S*2;let T=r*Math.sin(a),R=Math.sqrt(r*r-T*T),I=s-R,F=Math.sqrt(T*T+I*I)/T;if(F<=n){let D=F*t/2-s-r;return 2*Math.max(S,D)}return S*2}createRenderOptions(){let e=gh,t=vh,n=0,r=null,s=0,o,a=0;this.stroke_&&(o=gl(this.stroke_.getColor()??ia),a=this.stroke_.getWidth()??od,r=this.stroke_.getLineDash(),s=this.stroke_.getLineDashOffset()??0,t=this.stroke_.getLineJoin()??vh,e=this.stroke_.getLineCap()??gh,n=this.stroke_.getMiterLimit()??rd);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=io),t.fillStyle=gl(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=Oc(n)),n===null?r=1:Array.isArray(n)&&(r=n.length===4?n[3]:1),r===0&&(t=Di(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=io,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()}},zE=JN;var e5=class i extends zE{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}},VE=e5;var t5=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=Dp(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()===Pn.IDLE&&t.load(),t.getImageState()===Pn.LOADING&&(this.patternImage_=t)}this.color_=e}getKey(){let e=this.getColor();return e?e instanceof CanvasPattern||e instanceof CanvasGradient?Bn(e):typeof e=="object"&&"src"in e?e.src+":"+e.offset:Oc(e).toString():""}loading(){return!!this.patternImage_}ready(){return this.patternImage_?this.patternImage_.ready():Promise.resolve()}},ks=t5;function MX(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 n5=class i extends kE{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;jn(!(a!==void 0&&o),"`image` and `src` cannot be provided at the same time"),(a===void 0||a.length===0)&&o&&(a=o.src||Bn(o)),jn(a!==void 0&&a.length>0,"A defined and non-empty `src` or `image` must be provided"),jn(!((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=Pn.IDLE:o!==void 0&&("complete"in o?o.complete?l=o.src?Pn.LOADED:Pn.IDLE:l=Pn.LOADING:l=Pn.LOADED),this.color_=e.color!==void 0?Oc(e.color):null,this.iconImage_=Dp(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 d=()=>{if(this.unlistenImageChange(d),!this.initialOptions_)return;let A=this.iconImage_.getSize();this.setScale(MX(A[0],A[1],e.width,e.height))};this.listenImageChange(d);return}}c!==void 0&&this.setScale(MX(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?Oc(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?Pn.IDLE:this.iconImage_.getImageState();this.iconImage_=Dp(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_=Dp(null,e,{crossOrigin:this.crossOrigin_,referrerPolicy:this.referrerPolicy_},Pn.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()==Pn.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()==Pn.LOADED)return this.iconImage_.getSize()[1]*e[1]}setScale(e){delete this.initialOptions_,super.setScale(e)}listenImageChange(e){this.iconImage_.addEventListener(nn.CHANGE,e)}load(){this.iconImage_.load()}unlistenImageChange(e){this.iconImage_.removeEventListener(nn.CHANGE,e)}ready(){return this.iconImage_.ready()}},vA=n5;var i5=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}},ro=i5;var GE=class i{constructor(e){e=e||{},this.geometry_=null,this.geometryFunction_=CX,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_=CX,this.geometry_=e}setZIndex(e){this.zIndex_=e}};function RX(i){let e;if(typeof i=="function")e=i;else{let t;Array.isArray(i)?t=i:(jn(typeof i.getZIndex=="function","Expected an `Style` or an array of `Style`"),t=[i]),e=function(){return t}}return e}var r5=null;function s5(i,e){if(!r5){let t=new ks({color:"rgba(255,255,255,0.4)"}),n=new ro({color:"#3399CC",width:1.25});r5=[new GE({image:new VE({fill:t,stroke:n,radius:5}),fill:t,stroke:n})]}return r5}function CX(i){return i.getGeometry()}var Xr=GE;var Xpe="#333",o5=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_=cs(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 ks({color:Xpe}),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 ks?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_=cs(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}},Bp=o5;function ad(i,e){return(i.get("priority")||0)-(e.get("priority")||0)}function LX(i){let e=i.get("pin");return!e||ld(e)||e.passesZoneFilters||h5(e)?null:l5(e,!1)}function DX(i){let e=i.get("pin");return!e||!O.highlightedZones.size||!e.passesZoneFilters||ld(e)||h5(e)?null:l5(e,!1)}function NX(i){let e=i.get("pin");return!e||ld(e)||Zf(null,e.category)!=="always"&&!(O.labelsHeld&&!fW(e.category))?null:BX(e)}function FX(i){let e=i.get("pin");if(!e||ld(e))return null;let t=l5(e,e===O.selectedPin);return e===O.hoveredPin||e===O.selectedPin?[t,BX(e)]:t}function l5(i,e){let t=`marker:${i.category.id}:${e?1:0}`;if(O.styleCache.has(t))return O.styleCache.get(t);let n=fA(i.category),r=e?2e7:i.priority,s=O.markerIcons.get(Jy(i.category)),o;return s?o=new Xr({image:new vA({src:s,width:e?36:31,height:e?36:31}),zIndex:r}):o=new Xr({text:new Bp({text:bu(i.category.title),font:`900 ${e?15:13}px Inter, sans-serif`,fill:new ks({color:n}),stroke:new ro({color:hA(),width:e?4:3})}),zIndex:r}),O.styleCache.set(t,o),o}function BX(i){let e=`marker-label:${i.location.id}`;if(O.styleCache.has(e))return O.styleCache.get(e);let t=new Xr({text:new Bp({text:i.location.title,offsetY:21,font:'700 10px "Arial Narrow", "Roboto Condensed", sans-serif',fill:new ks({color:"#f2ece0"}),stroke:new ro({color:"rgba(0,0,0,0.98)",width:3}),backgroundFill:new ks({color:"rgba(10,12,17,0.72)"}),padding:[2,4,2,4],overflow:!0}),zIndex:i.priority});return O.styleCache.set(e,t),t}function OX(i){if(!i.iconAsset)return;let e=Jy(i);if(O.markerIcons.has(e))return;O.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=fA(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=hA(),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),O.markerIcons.set(e,n.toDataURL("image/png")),$pe(),O.layers.pins.changed(),O.layers.zonePins.changed(),O.layers.priority.changed()},t.onerror=()=>O.markerIcons.set(e,!1),t.src=_N(i.iconAsset)}function $pe(){for(let i of O.styleCache.keys())i.startsWith("marker:")&&O.styleCache.delete(i)}function Jy(i){return`${i.iconAsset||""}:${fA(i)}:${O.world?.iconOutset||"light"}`}function qE(i,e){return`${i} ${e}px ${Vi.labelFont}`}function c5(i,e){let t=i.get("gridCell");if(!t)return null;let n=t.role==="neighbor",r=n?Vi.neighborLabelSizePx:Vi.labelSizePx,s=qE(900,r),o=n?[2,4,2,4]:[3,5,3,5],a=Zpe(t,s,r,o,e),l=IE(t,{subgridVisible:O.subgridVisible,labelled:a});if(!l)return null;let c=`grid:${O.gridSystem}:${t.hash}:${t.role}:${t.contextDistance}:${a?1:0}:${l.bare?1:0}`;if(O.styleCache.has(c))return O.styleCache.get(c);let u=t.role==="leaf"||t.role==="scope"?100:i.get("priority"),f=[new Xr({fill:l.fill?new ks({color:Dc(l.fill.color,l.fill.opacity)}):void 0,stroke:new ro({color:Dc(l.line.color,l.line.opacity),width:l.line.widthPx}),zIndex:u})];if(l.label){let d=l.label.prefix?[l.label.prefix,qE(500,r),l.label.final,qE(900,r)]:l.label.final,A=Vi.labelInsetPx*e,y=Ype(i.getGeometry());y&&f.push(new Xr({geometry:new yu([y[0]-A,y[1]+A]),text:new Bp({text:d,font:qE(900,r),textAlign:"right",textBaseline:"bottom",fill:new ks({color:Dc(l.label.color,l.label.textAlpha)}),backgroundFill:new ks({color:l.label.chip}),padding:o,overflow:!0}),zIndex:u+1}))}return O.styleCache.set(c,f),f}function Ype(i){let e=i.getType()==="MultiPolygon"?i.getCoordinates():[i.getCoordinates()],t=null;for(let n of e)for(let[r,s]of n[0]||[])(!t||r-s>t[0]-t[1])&&(t=[r,s]);return t}function Zpe(i,e,t,n,r){if(!r)return!0;let s=u5(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 PX=document.createElement("canvas").getContext("2d"),IX=new Map;function u5(i,e){let t=`${e}|${i}`,n=IX.get(t);return n===void 0&&(PX.font=e,n=PX.measureText(i).width,IX.set(t,n)),n}var Kpe=new Xr({fill:new ks({color:"rgba(5, 8, 16, 0.62)"})});function UX(){return V1()?Kpe:null}function kX(i,e){let t=i.get("zone");if(Io(fu(t)))return null;let n=i.get("child"),r=O.highlightedZones.has(t.id),s=qX(t.id),o=Number(t.attrs?.["atlas.stroke.width_px"])||Number(z1(t)?.attrs?.["atlas.stroke.width_px"])||0;if(o>0&&i.getGeometry()?.getType()==="MultiLineString")return Qpe(t,i.get("color"),o/e,r,s);let a=`zone:${t.id}:${n?1:0}:${r?1:s?2:0}`;if(O.styleCache.has(a))return O.styleCache.get(a);let l=i.get("color");if(s){let f=new Xr({stroke:new ro({color:Dc(l,n?.34:.44),width:n?1:1.3,lineDash:n?[3,4]:[7,5]}),zIndex:n?101:100});return O.styleCache.set(a,f),f}let c=new Xr({fill:new ks({color:Dc(l,n?.035:.07)}),stroke:new ro({color:Dc(l,n?.5:.72),width:n?1.2:1.8,lineDash:n?[3,4]:[7,5]})});if(!r)return O.styleCache.set(a,c),c;let u=[new Xr({stroke:new ro({color:"rgba(255,255,255,0.94)",width:5}),zIndex:9e3}),new Xr({fill:new ks({color:Dc(l,.22)}),stroke:new ro({color:l,width:2.6}),zIndex:9001})];return O.styleCache.set(a,u),u}function Qpe(i,e,t,n,r){let s=Math.max(t,1.5);return n?[new Xr({stroke:new ro({color:"rgba(255,255,255,0.94)",width:s+4,lineCap:"round",lineJoin:"round"}),zIndex:9e3}),new Xr({stroke:new ro({color:Dc(e,.9),width:s,lineCap:"round",lineJoin:"round"}),zIndex:9001})]:[new Xr({stroke:new ro({color:Dc(e,r?.14:.3),width:s,lineCap:"round",lineJoin:"round"})}),new Xr({stroke:new ro({color:Dc(e,r?.4:.8),width:Math.min(1.6,s),lineDash:[7,5]})})]}function zX(i){if(f5())return null;let e=i.get("zone");if(Io(fu(e))||GX(e))return null;let t=O.highlightedZones.has(e.id);if(Zf(e)==="quiet")return a5(i);let n=i.get("child"),r=O.engine.getView().getZoom()||0;if(!t&&n&&r<O.fitZoom+3)return null;let s=i.get("span")/O.engine.getView().getResolution();return!t&&O.zoneTitleCount>40&&s<52?null:a5(i)}function VX(i){if(!f5())return null;let e=i.get("zone");return Io(fu(e))||GX(e)?null:a5(i)}function GX(i){return Zf(i)!=="quiet"||O.highlightedZones.has(i.id)||O.selectedZone===i?!1:O.labelOverrides.get(fu(i))==="quiet"||!O.labelsHeld}function a5(i){let e=i.get("child"),t=i.get("zone"),n=O.highlightedZones.has(t.id),r=qX(t.id),s=`zone-title:${t.id}:${e?1:0}:${n?1:r?2:0}`;if(O.styleCache.has(s))return O.styleCache.get(s);let o=i.get("color"),a=new Xr({text:new Bp({text:t.title.toLocaleUpperCase(),font:`${e?"700 12px":"800 14px"} "Arial Narrow", "Roboto Condensed", sans-serif`,fill:new ks({color:n?"#10131a":r?"rgba(196,191,177,0.56)":e?"#c8c2b4":"#f2ece0"}),stroke:new ro({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 ks({color:n?o:r?"rgba(8,11,18,0.84)":"rgba(13,16,23,0.72)"}),backgroundStroke:new ro({color:n?"#ffffff":Dc(o,r?.24:.55),width:n?2:1}),padding:[5,8,5,8],overflow:!0}),zIndex:n?91e5:i.get("priority")});return O.styleCache.set(s,a),a}function qX(i){if(!O.highlightedZones.size||O.highlightedZones.has(i))return!1;for(let e of O.highlightedZones)if(Jpe(i,e))return!1;return!0}function Jpe(i,e){let t=new Set,n=O.zoneRecords.get(e)?.zone.parent;for(;n!=null&&!t.has(n);){if(n===i)return!0;t.add(n),n=O.zoneRecords.get(n)?.zone.parent}return!1}function _A(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],d=0,A=[0];for(let S=e+n;S<t;S+=n){let T=i[S],R=i[S+1];d+=Math.sqrt((T-u)*(T-u)+(R-f)*(R-f)),A.push(d),u=T,f=R}let y=r*d,w=nj(A,y);w<0?(l=(y-A[-w-2])/(A[-w-1]-A[-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]:Lo(i[a+u],i[a+n+u],l);return s}function HE(i,e,t,n,r,s){if(t==e)return null;let o;if(r<i[e+n-1])return s?(o=i.slice(e,e+n),o[n-1]=r,o):null;if(i[t-1]<r)return s?(o=i.slice(t-n,t),o[n-1]=r,o):null;if(r==i[e+n-1])return i.slice(e,e+n);let a=e/n,l=t/n;for(;a<l;){let d=a+l>>1;r<i[(d+1)*n-1]?l=d:a=d+1}let c=i[a*n-1];if(r==c)return i.slice((a-1)*n,(a-1)*n+n);let u=i[(a+1)*n-1],f=(r-c)/(u-c);o=[];for(let d=0;d<n-1;++d)o.push(Lo(i[(a-1)*n+d],i[a*n+d],f));return o.push(r),o}function HX(i,e,t,n,r,s,o){if(o)return HE(i,e,t[t.length-1],n,r,s);let a;if(r<i[n-1])return s?(a=i.slice(0,n),a[n-1]=r,a):null;if(i[i.length-1]<r)return s?(a=i.slice(i.length-n),a[n-1]=r,a):null;for(let l=0,c=t.length;l<c;++l){let u=t[l];if(e!=u){if(r<i[e+n-1])return null;if(r<=i[u-1])return HE(i,e,u,n,r,!1);e=u}}return null}function dv(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}var d5=class i extends Al{constructor(e,t){super(),this.flatMidpoint_=null,this.flatMidpointRevision_=-1,this.maxDelta_=-1,this.maxDeltaRevision_=-1,t!==void 0&&!Array.isArray(e[0])?this.setFlatCoordinates(t,e):this.setCoordinates(e,t)}appendCoordinate(e){Do(this.flatCoordinates,e),this.changed()}clone(){let e=new i(this.flatCoordinates.slice(),this.layout);return e.applyProperties(this),e}closestPointXY(e,t,n,r){return r<Rc(this.getExtent(),e,t)?r:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(Uy(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),zy(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,this.maxDelta_,!1,e,t,n,r))}forEachSegment(e){return sE(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,e)}getCoordinateAtM(e,t){return this.layout!="XYM"&&this.layout!="XYZM"?null:(t=t!==void 0?t:!1,HE(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,e,t))}getCoordinates(){return Bc(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getCoordinateAt(e,t){return _A(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,e,t,this.stride)}getLength(){return dv(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getFlatMidpoint(){return this.flatMidpointRevision_!=this.getRevision()&&(this.flatMidpoint_=this.getCoordinateAt(.5,this.flatMidpoint_??void 0),this.flatMidpointRevision_=this.getRevision()),this.flatMidpoint_}getSimplifiedGeometryInternal(e){let t=[];return t.length=pA(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,e,t,0),new i(t,"XY")}getType(){return"LineString"}intersectsExtent(e){return oA(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,e,this.getExtent())}setCoordinates(e,t){this.setLayout(t,e,1),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=uA(this.flatCoordinates,0,e,this.stride),this.changed()}},p5=d5;var m5=class i extends Al{constructor(e,t,n){if(super(),this.ends_=[],this.maxDelta_=-1,this.maxDeltaRevision_=-1,Array.isArray(e[0]))this.setCoordinates(e,t);else if(t!==void 0&&n)this.setFlatCoordinates(t,e),this.ends_=n;else{let r=e,s=[],o=[];for(let l=0,c=r.length;l<c;++l){let u=r[l];Do(s,u.getFlatCoordinates()),o.push(s.length)}let a=r.length===0?this.getLayout():r[0].getLayout();this.setFlatCoordinates(a,s),this.ends_=o}}appendLineString(e){Do(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<Rc(this.getExtent(),e,t)?r:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(ky(this.flatCoordinates,0,this.ends_,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),Vy(this.flatCoordinates,0,this.ends_,this.stride,this.maxDelta_,!1,e,t,n,r))}getCoordinateAtM(e,t,n){return this.layout!="XYM"&&this.layout!="XYZM"||this.flatCoordinates.length===0?null:(t=t!==void 0?t:!1,n=n!==void 0?n:!1,HX(this.flatCoordinates,0,this.ends_,this.stride,e,t,n))}getCoordinates(){return Pp(this.flatCoordinates,0,this.ends_,this.stride)}getEnds(){return this.ends_}getLineString(e){return e<0||this.ends_.length<=e?null:new p5(this.flatCoordinates.slice(e===0?0:this.ends_[e-1],this.ends_[e]),this.layout)}getLineStrings(){let e=this.flatCoordinates,t=this.ends_,n=this.layout,r=[],s=0;for(let o=0,a=t.length;o<a;++o){let l=t[o],c=new p5(e.slice(s,l),n);r.push(c),s=l}return r}getLength(){let e=this.ends_,t=0,n=0;for(let r=0,s=e.length;r<s;++r)n+=dv(this.flatCoordinates,t,e[r],this.stride),t=e[r];return n}getFlatMidpoints(){let e=[],t=this.flatCoordinates,n=0,r=this.ends_,s=this.stride;for(let o=0,a=r.length;o<a;++o){let l=r[o],c=_A(t,n,l,s,.5);Do(e,c),n=l}return e}getSimplifiedGeometryInternal(e){let t=[],n=[];return t.length=SE(this.flatCoordinates,0,this.ends_,this.stride,e,t,0,n),new i(t,"XY",n)}getType(){return"MultiLineString"}intersectsExtent(e){return lj(this.flatCoordinates,0,this.ends_,this.stride,e)}setCoordinates(e,t){this.setLayout(t,e,2),this.flatCoordinates||(this.flatCoordinates=[]);let n=Dy(this.flatCoordinates,0,e,this.stride,this.ends_);this.flatCoordinates.length=n.length===0?0:n[n.length-1],this.changed()}},WX=m5;function A5(){O.renderedShard=O.lens?.shard||0,O.sources.zones.clear(),O.sources.zoneTitles.clear(),O.zoneRecords.clear(),O.highlightedZones.clear(),O.focusedZoneID=null,O.zoneTitleCount=0,Op();for(let i of O.world.collections)if(i.kind!=="point")for(let e of i.features||[]){if(!By(e))continue;e.collectionId=i.id;let t=Wr(),n=[],r=!1;for(let l of e.geometry||[]){let c=n0e(l);c&&(r=!0,n.push(c),qT(t,c.getExtent()),O.sources.zones.addFeature(new Rp({geometry:c,zone:e,color:cv(e.id),child:e.parent!=null})))}if(!r)continue;let s=cv(e.id),o=e.center?pv(e.center.lat,e.center.lng):dl(t),a=Math.max(t[2]-t[0],t[3]-t[1]);O.sources.zoneTitles.addFeature(new Rp({geometry:new yu(o),zone:e,color:s,child:e.parent!=null,span:a,priority:(e.parent==null?2e6:1e6)+Math.round(a)})),O.zoneRecords.set(e.id,{zone:e,collection:i,extent:t.slice(),geometries:n,color:s})}g5(),v5(),e0e()}function g5(){O.zoneTitleCount=O.sources.zoneTitles.getFeatures().filter(i=>Zf(i.get("zone"))!=="quiet").length}function v5(){if(O.sources.zoneScrim.clear(),!O.highlightedZones.size)return;let[i,e,t,n]=O.projection.getExtent(),r=[jX([[i,e],[t,e],[t,n],[i,n],[i,e]],!0)];for(let s of O.highlightedZones)for(let o of O.zoneRecords.get(s)?.geometries||[]){if(o.getType()==="MultiLineString")continue;let a=o.getType()==="MultiPolygon"?o.getPolygons():[o];for(let l of a)l.getLinearRings().forEach((c,u)=>{r.push(jX(c.getCoordinates(),u>0))})}O.sources.zoneScrim.addFeature(new Rp({geometry:new Ah(r)}))}function jX(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 e0e(){for(let i of ge.legend.querySelectorAll(".feature-index")){let e=document.createDocumentFragment();for(let{zone:t,depth:n}of t0e(wu(i.dataset.featureIndex))){let r=O.zoneRecords.get(t.id);if(!r)continue;let s=document.createElement("button");s.type="button",s.className="zone-index-item",s.dataset.zone=String(t.id),s.style.setProperty("--zone-color",r.color),s.style.setProperty("--zone-depth",String(n)),s.setAttribute("aria-pressed","false"),s.title=`${t.title}: click to jump; right-click to toggle highlight`;let o=document.createElement("span");o.className="zone-index-marker",o.setAttribute("aria-hidden","true");let a=document.createElement("span");a.textContent=t.title,s.append(o,a),e.append(s)}i.replaceChildren(e)}}function t0e(i){let e=[...O.zoneRecords.values()].filter(a=>a.zone.collectionId===i).map(a=>a.zone),t=new Set(e.map(a=>a.id)),n=new Map;for(let a of e){let l=t.has(a.parent)?a.parent:null;n.has(l)||n.set(l,[]),n.get(l).push(a)}for(let a of n.values())a.sort((l,c)=>l.title.localeCompare(c.title,void 0,{numeric:!0,sensitivity:"base"}));let r=[],s=new Set,o=(a,l)=>{if(!s.has(a.id)){s.add(a.id),r.push({zone:a,depth:l});for(let c of n.get(a.id)||[])o(c,l+1)}};for(let a of n.get(null)||[])o(a,0);for(let a of e)o(a,0);return r}function Op(){let i=V1();O.layers.zoneScrim.setVisible(i),O.layers.zones.setVisible(i),O.layers.zoneTitles.setVisible(i),O.layers.zoneTitleDetail.setVisible(i);let e=!1;for(let t of[...O.highlightedZones]){let n=O.zoneRecords.get(t);(!n||Io(fu(n.zone)))&&(O.highlightedZones.delete(t),e=!0)}e&&(WE(),v5(),x5()),O.layers.zones.changed(),O.layers.zoneTitles.changed(),O.layers.zoneTitleDetail.changed()}function _5(i){let e=O.zoneRecords.get(i);e&&(O.focusedZoneID=i,x5(),wE(e.zone),O.engine.getView().fit(e.extent,{size:O.engine.getSize(),padding:[54,54,54,54],maxZoom:mh(O.lens),duration:220}),ge.sidebar.classList.remove("is-open"),ge.mobileLegend.setAttribute("aria-expanded","false"))}function XX(i){let e=O.zoneRecords.get(i);e&&(O.highlightedZones.has(i)?O.highlightedZones.delete(i):(O.highlightedZones.add(i),O.hiddenCollections.delete(fu(e.zone))&&(dA(),ph()),Op()),O.hoveredPin=null,WE(),y5(),x5(),v5(),O.layers.zones.changed(),O.layers.zoneTitles.changed(),O.layers.zoneTitleDetail.changed())}function x5(){for(let i of ge.legend.querySelectorAll(".feature-index"))i.classList.toggle("has-highlights",O.highlightedZones.size>0);for(let i of ge.legend.querySelectorAll("[data-zone]")){let e=Number(i.dataset.zone),t=O.highlightedZones.has(e);i.classList.toggle("is-highlighted",t),i.classList.toggle("is-current",O.focusedZoneID===e),i.setAttribute("aria-pressed",String(t))}}function n0e(i){if(!i?.coordinates)return null;let e=([t,n])=>pv(n,t);return i.type==="Polygon"?new Ah(i.coordinates.map(t=>t.map(e))):i.type==="MultiPolygon"?new RE(i.coordinates.map(t=>t.map(n=>n.map(e)))):i.type==="MultiLineString"?new WX(i.coordinates.map(t=>t.map(e))):null}function pv(i,e){let t=i0e(),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 i0e(){let i=O.volume.tileGrid,e=O.world?.grid;return e?{...i,...e}:i}function $X(){O.sources.pins.clear(),O.sources.priority.clear(),O.features=[],O.featureByID.clear();for(let i of O.world.collections)if(i.kind==="point"){OX(i);for(let e of i.locations){let t={location:e,category:i,coordinate:pv(e.lat,e.lng),filteredHidden:!1,priority:o0e(i,e),feature:null};t.feature=new Rp({geometry:new yu(t.coordinate),pin:t,priority:t.priority}),O.features.push(t),O.featureByID.set(e.id,t),O.sources.pins.addFeature(t.feature)}}Nc()}function Nc(){for(let i of O.features){let e=Io(i.category.id),t=O.search&&!i.location.title.toLocaleLowerCase().includes(O.search);i.filteredHidden=!!(e||t)}WE(),y5(),O.selectedPin?.filteredHidden&&id(),nd(),document.dispatchEvent(new Event("atlas:filters"))}function WE(){if(!O.highlightedZones.size){for(let e of O.features)e.passesZoneFilters=!1;return}let i=uW([...O.highlightedZones].map(e=>O.zoneRecords.get(e)).filter(Boolean));for(let e of O.features)e.passesZoneFilters=hW(i,e.coordinate)}function y5(){O.eligibleLocations=O.features.filter(i=>!ld(i)).length,Fc(),O.layers.pins.changed(),O.layers.zonePins.changed(),O.layers.pinLabels.changed(),O.layers.priority.changed(),xA()}function Fc(){O.sources.priority.clear();for(let i of O.features){if(ld(i))continue;let e=!!O.search&&i.location.title.toLocaleLowerCase().includes(O.search);(i===O.selectedPin||i===O.hoveredPin||e||Lp(i))&&O.sources.priority.addFeature(i.feature)}}function mv(i){O.hoveredPin!==i&&(O.hoveredPin=i,O.sources&&(Fc(),O.layers.pins.changed(),O.layers.priority.changed()))}function jE(i){O.labelsHeld!==i&&(O.labelsHeld=i,ge.labelsHint.textContent=i?"Z \xB7 labels shown":"Z \xB7 hold for labels",O.layers.pinLabels.changed(),O.layers.zoneTitles.changed(),O.layers.zoneTitleDetail.changed(),document.dispatchEvent(new Event("atlas:labels")))}function h5(i){return i===O.selectedPin||i===O.hoveredPin||Lp(i)||!!O.search&&i.location.title.toLocaleLowerCase().includes(O.search)}function ld(i){return i.filteredHidden||r0e(i)||s0e(i)||!By(i.location)}function By(i){let e=O.lens?.shard;return!e||!i.shard||i.shard===e}function r0e(i){return!O.highlightedZones.size||i.passesZoneFilters||i===O.selectedPin?!1:!(O.search&&i.location.title.toLocaleLowerCase().includes(O.search))}function s0e(i){return!O.gridEnabled||!O.gridCell||Lp(i)||i===O.selectedPin?!1:!(O.search&&i.location.title.toLocaleLowerCase().includes(O.search))}function o0e(i,e){return Math.max(0,1e6-Math.min(i.locations.length,999)*1e3)+Qj(e.id)%1e3}function f5(){return(O.engine?.getView().getZoom()||0)>=(O.lens?.maxZoom||0)-.05}function YX(i){let e=[],t=new Map,n=(s,o,a)=>{t.has(s)||(t.set(s,e.length),e.push({key:s,title:o,collections:[]})),e[t.get(s)].collections.push(a)},r=[];for(let s of i)s.kind!=="point"&&!s.group?r.push(s):n(`group-${s.group}`,s.group,s);return r.length&&e.unshift({key:"zones",title:"Zones",collections:r}),e}function ZX(i){return i.kind||"point"}function KX(i){return(i.features||i.locations||[]).length}function wu(i){return/^\d+$/.test(i)?Number(i):i}function QX(i){for(let e of O.world?.sections||[])for(let t of e.collections)if(t.id===i)return t;return null}function JX(){let i=document.createDocumentFragment();for(let e of O.world.sections){let t=document.createElement("section");t.className="layer-section",t.dataset.layerSection=e.key;let n=e.collections.reduce((s,o)=>s+KX(o),0);t.append(a0e(e.key,e.title,n));let r=document.createElement("div");r.className="category-toggles";for(let s of e.collections)if(r.append(l0e(s)),ZX(s)!=="point"){let o=document.createElement("div");o.className="feature-index",o.dataset.featureIndex=String(s.id),r.append(o)}t.append(r),i.append(t)}ge.legend.replaceChildren(i),XE(),n$(),ph()}function a0e(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=jl(t),r.append(s,o,a);let l=e$(`Exclusively ${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 e$(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 l0e(i){let e=ZX(i),t=document.createElement("label");t.className="category-row";let n=document.createElement("input");n.type="checkbox",n.dataset.collection=String(i.id),n.checked=!O.hiddenCollections.has(i.id);let r;e!=="point"?(r=document.createElement("button"),r.type="button",r.className="collection-expand",r.dataset.expandCollection=String(i.id),r.setAttribute("aria-label",`Unfold the ${i.title} index`),r.innerHTML='<svg class="collection-chevron" viewBox="0 0 16 16" aria-hidden="true"><path d="m6 4 4 4-4 4"/></svg>'+(e==="path"?'<svg class="collection-kind" viewBox="0 0 16 16" aria-hidden="true"><path d="M2.5 12.5c3-6 8-2 11-9"/></svg>':'<svg class="collection-kind collection-kind-area" viewBox="0 0 16 16" aria-hidden="true"><path d="M8 4.2 12.6 11.6H3.4z"/></svg>')):(r=document.createElement("span"),r.className="category-icon",uv(t,i),hv(r,i,bu(i.title)),r.title=i.icon||i.title);let s=document.createElement("span");s.className="category-name",s.textContent=i.title;let o=e$(`Exclusively ${i.title}`);o.dataset.onlyCollection=String(i.id);let a;e==="area"?(a=document.createElement("button"),a.type="button",a.className="label-toggle",a.dataset.labelToggle=String(i.id),a.innerHTML='<svg viewBox="0 0 16 16" aria-hidden="true"><path d="M3.5 3.5h9M8 3.5v9"/></svg>',b5(a,i)):e==="point"&&SD(i)==="text"?(a=document.createElement("button"),a.type="button",a.className="label-toggle",a.dataset.labelToggle=String(i.id),a.innerHTML='<svg viewBox="0 0 16 16" aria-hidden="true"><path d="M8.6 2.5H2.5v6.1l5.4 5.4a1.2 1.2 0 0 0 1.7 0l4.4-4.4a1.2 1.2 0 0 0 0-1.7z"/><path d="M5.6 5.6h.01"/></svg>',b5(a,i)):(a=document.createElement("span"),a.className="label-toggle-spacer");let l=document.createElement("span");return l.className="category-count",l.textContent=jl(KX(i)),t.append(n,r,s,a,o,l),t}function w5(i){if(O.collapsedSections.clear(),i)for(let e of ge.layers.querySelectorAll("[data-section]"))O.collapsedSections.add(e.dataset.section);XE()}function XE(){for(let i of ge.layers.querySelectorAll("[data-section]")){let e=O.collapsedSections.has(i.dataset.section);i.setAttribute("aria-expanded",String(!e)),i.closest(".layer-section").classList.toggle("is-collapsed",e)}Wl()}function t$(i){O.expandedCollections.has(i)?O.expandedCollections.delete(i):O.expandedCollections.add(i),n$()}function n$(){for(let i of ge.legend.querySelectorAll("[data-expand-collection]")){let e=O.expandedCollections.has(wu(i.dataset.expandCollection));i.setAttribute("aria-expanded",String(e)),i.closest(".category-row").classList.toggle("is-expanded",e)}for(let i of ge.legend.querySelectorAll(".feature-index"))i.hidden=!O.expandedCollections.has(wu(i.dataset.featureIndex));Wl()}function i$(i){let e=QX(i);if(!e)return;let t=Zf(null,e)==="always"?"quiet":"always";t===wD(e)?O.labelOverrides.delete(e.id):O.labelOverrides.set(e.id,t),c0e(),e.kind==="point"?O.layers.pinLabels.changed():(g5(),O.layers.zoneTitles.changed(),O.layers.zoneTitleDetail.changed()),Wl()}function b5(i,e){let t=Zf(null,e)==="always";i.dataset.label=t?"Hide labels":"Show labels",i.setAttribute("aria-label",`${t?"Hide":"Show"} ${e.title} labels`),i.setAttribute("aria-pressed",String(t))}function c0e(){for(let i of ge.legend.querySelectorAll("[data-label-toggle]")){let e=QX(wu(i.dataset.labelToggle));e&&b5(i,e)}}function $E(i){if(O.hiddenCollections.clear(),!i)for(let e of O.world.sections)for(let t of e.collections)O.hiddenCollections.add(t.id);dA(),Op(),Nc(),nd(),ph()}function dA(){for(let i of document.querySelectorAll("[data-collection]"))i.checked=!O.hiddenCollections.has(wu(i.dataset.collection))}function r$(i){let e=O.world.sections.find(n=>n.key===i);if(!e)return;let t=e.collections.some(n=>!O.hiddenCollections.has(n.id));for(let n of e.collections)t?O.hiddenCollections.add(n.id):O.hiddenCollections.delete(n.id);dA(),Op(),Nc(),ph()}function e2(i){return i.kind==="point"?"features":"zones"}function s$(i){let e=new Set;for(let t of O.world.sections)for(let n of t.collections)(i.section===t.key||i.collection===n.id)&&e.add(e2(n));return e}function o$(i){if(!O.world)return;let e=s$(i);if(u0e(i))for(let t of O.world.sections)for(let n of t.collections)e.has(e2(n))&&O.hiddenCollections.delete(n.id);else for(let t of O.world.sections){let n=i.section===t.key;for(let r of t.collections)e.has(e2(r))&&(n||i.collection===r.id?O.hiddenCollections.delete(r.id):O.hiddenCollections.add(r.id))}dA(),Op(),Nc(),nd(),ph()}function u0e(i){let e=s$(i);for(let t of O.world.sections)for(let n of t.collections){if(!e.has(e2(n)))continue;if((i.section===t.key||i.collection===n.id)===O.hiddenCollections.has(n.id))return!1}return!0}function h0e(){let i=ge.soloChip;if(!O.world){i.hidden=!0;return}let e=[];for(let n of["zones","features"]){let r=null,s=0,o=0,a=null,l=0;for(let c of O.world.sections){let u=0,f=0;for(let d of c.collections)if(e2(d)===n){if(f++,O.hiddenCollections.has(d.id)){o++;continue}u++,s++,r=d}u>0&&(l++,a=u===f?c:null)}o!==0&&(s===1&&r?e.push(r.title):s>1&&l===1&&a&&e.push(a.title))}let t=e.join(" \xB7 ");i.hidden=!t,i.textContent=t?`exclusively: ${t}`:"",i.title=t?`Showing exclusively ${t} \u2014 click to show everything`:""}function ph(){if(O.world){for(let i of O.world.sections){let e=ge.legend.querySelector(`input[data-section-toggle="${i.key}"]`);e&&(e.checked=i.collections.some(t=>!O.hiddenCollections.has(t.id)))}h0e(),Wl()}}async function a$(i){let[e,t]=await Promise.all([fetch(`${O.volume.base}/worlds/${i.slug}.json`),fetch(`${O.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.collections||[];f0e(r,s);let o=YX(s);return{...i,grid:n.grid,lenses:n.lenses,collections:s,collectionsById:new Map(s.map(a=>[a.id,a])),attrs:n.attrs||{},merged:n.merged||[],sections:o}}function f0e(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!==3)throw new Error(`location payload is version ${r}, and this reads 3`);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),d=new Uint32Array(i,o+=s*4,s+1),A=new Uint16Array(i,o+=(s+1)*4,s),y=new Uint8Array(i,o+s*2),w=new TextDecoder;for(let S of e)S.kind==="point"&&(S.locations=[]);for(let S=0;S<s;S++){let T=e[A[S]];if(!T||T.kind!=="point")throw new Error(`location ${a[S]} names collection ${A[S]}, which is no point collection`);T.locations.push({id:a[S],title:w.decode(y.subarray(d[S],d[S+1])),lat:l[S],lng:c[S],memberId:u[S]||void 0,shard:f[S]||void 0})}}async function EN(){let i=`${O.volume.base}/${O.world.slug}`;return O.textByWorld.has(i)||O.textByWorld.set(i,fetch(`${O.volume.base}/worlds/${O.world.slug}.text`).then(e=>e.json()).catch(()=>({}))),O.textByWorld.get(i)}var YE=null;function yA(){return YE||(YE=d0e().finally(()=>{YE=null})),YE}async function d0e(){let i=await fetch("/data/catalog.json");if(!i.ok)return;let e=O.volume;if(O.catalog=await i.json(),qm(ge.volume,O.catalog.volumes,"title"),S5(),!O.catalog.volumes.length)return;let t=e&&O.catalog.volumes.find(n=>n.slug===e.slug);if(!t){let n=lv();await cd(n.volume||av()?.volume||O.catalog.volumes[0].slug,n.volume?n.world:void 0);return}if(t.stamp!==e.stamp){for(let r of O.textByWorld.keys())r.startsWith(e.base+"/")&&O.textByWorld.delete(r);let n=O.engine?.getView();O.restore={volume:t.slug,world:O.world?.slug,lens:O.world?O.world.lenses.indexOf(O.lens):0,center:n?.getCenter(),zoom:n?.getZoom(),hidden:[...O.hiddenCollections],collapsed:[...O.collapsedSections],expanded:[...O.expandedCollections],labels:[...O.labelOverrides],overviewDocked:O.overviewDocked,dockFolded:O.dockFolded,dockDismissed:O.dockDismissed},await cd(t.slug,O.world?.slug);return}O.volume=t,ge.volume.value=t.slug}function S5(){let i=!O.catalog?.volumes?.length;ge.emptyState.hidden=!i,O.catalog?.bundlesDir&&(ge.emptyPath.textContent=O.catalog.bundlesDir)}async function T5(){for(let i of[ge.emptyOpen,ge.addBundles])i.disabled=!0;try{let e=await(await fetch("/data/bundles/import",{method:"POST"})).json().catch(()=>({}));await yA();let t=e.imported?.[0];t&&O.catalog.volumes.some(n=>n.slug===t)&&await cd(t)}finally{for(let i of[ge.emptyOpen,ge.addBundles])i.disabled=!1}}var vo={ADD:"add",REMOVE:"remove"};var l$={LENGTH:"length"},Av=class extends Ao{constructor(e,t,n){super(e),this.element=t,this.index=n}},E5=class extends Us{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(l$.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 Av(vo.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 Av(vo.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 Av(vo.REMOVE,r,e)),this.dispatchEvent(new Av(vo.ADD,t,e))}updateLength_(){this.set(l$.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")}},Fo=E5;var M5=class extends Ao{constructor(e,t,n){super(e),this.map=t,this.frameState=n!==void 0?n:null}},Up=M5;var C5=class extends Up{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()}},_h=C5;var gr={SINGLECLICK:"singleclick",CLICK:nn.CLICK,DBLCLICK:nn.DBLCLICK,POINTERDRAG:"pointerdrag",POINTERMOVE:"pointermove",POINTERDOWN:"pointerdown",POINTERUP:"pointerup",POINTEROVER:"pointerover",POINTEROUT:"pointerout",POINTERENTER:"pointerenter",POINTERLEAVE:"pointerleave",POINTERCANCEL:"pointercancel"};var t2={POINTERMOVE:"pointermove",POINTERDOWN:"pointerdown",POINTERUP:"pointerup",POINTEROVER:"pointerover",POINTEROUT:"pointerout",POINTERENTER:"pointerenter",POINTERLEAVE:"pointerleave",POINTERCANCEL:"pointercancel"};var R5=class extends Cp{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_=qn(n,t2.POINTERDOWN,this.handlePointerDown_,this),this.originalPointerMoveEvent_,this.relayedListenerKey_=qn(n,t2.POINTERMOVE,this.relayMoveEvent_,this),this.boundHandleTouchMove_=this.handleTouchMove_.bind(this),this.element_.addEventListener(nn.TOUCHMOVE,this.boundHandleTouchMove_,cE?{passive:!1}:!1)}emulateClick_(e){let t=new _h(gr.CLICK,this.map_,e);this.dispatchEvent(t),this.clickTimeoutId_!==void 0?(clearTimeout(this.clickTimeoutId_),this.clickTimeoutId_=void 0,t=new _h(gr.DBLCLICK,this.map_,e),this.dispatchEvent(t)):this.clickTimeoutId_=setTimeout(()=>{this.clickTimeoutId_=void 0;let n=new _h(gr.SINGLECLICK,this.map_,e);this.dispatchEvent(n)},250)}updateActivePointers_(e){let t=e,n=t.pointerId;if(t.type==gr.POINTERUP||t.type==gr.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==gr.POINTERDOWN||t.type==gr.POINTERMOVE)&&(this.trackedTouches_[n]=t);this.activePointers_=Object.values(this.trackedTouches_)}handlePointerUp_(e){this.updateActivePointers_(e);let t=new _h(gr.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(li),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 _h(gr.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(qn(n,gr.POINTERMOVE,this.handlePointerMove_,this),qn(n,gr.POINTERUP,this.handlePointerUp_,this),qn(this.element_,gr.POINTERCANCEL,this.handlePointerUp_,this)),this.element_.getRootNode&&this.element_.getRootNode()!==n&&this.dragListenerKeys_.push(qn(this.element_.getRootNode(),gr.POINTERUP,this.handlePointerUp_,this))}}handlePointerMove_(e){if(this.isMoving_(e)){this.updateActivePointers_(e),this.dragging_=!0;let t=new _h(gr.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 _h(gr.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_&&(li(this.relayedListenerKey_),this.relayedListenerKey_=null),this.element_.removeEventListener(nn.TOUCHMOVE,this.boundHandleTouchMove_),this.pointerdownListenerKey_&&(li(this.pointerdownListenerKey_),this.pointerdownListenerKey_=null),this.dragListenerKeys_.forEach(li),this.dragListenerKeys_.length=0,this.element_=null,super.disposeInternal()}},c$=R5;var xh={POSTRENDER:"postrender",MOVESTART:"movestart",MOVEEND:"moveend",LOADSTART:"loadstart",LOADEND:"loadend"};var Bo={LAYERGROUP:"layergroup",SIZE:"size",TARGET:"target",VIEW:"view"};var n2=1/0,P5=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,dh(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){jn(!(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!=n2?(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==n2?delete this.queuedElements_[this.keyFunction_(o)]:(n[r]=l,t[r++]=o);t.length=r,n.length=r,this.heapify_()}},u$=P5;var I5=class extends u${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(nn.CHANGE,this.boundHandleTileChange_),t}getTilesLoading(){return this.tilesLoading_}handleTileChange(e){let t=e.target,n=t.getState();if(n===an.LOADED||n===an.ERROR||n===an.EMPTY){n!==an.ERROR&&t.removeEventListener(nn.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()===an.IDLE&&!(s in this.tilesLoadingKeys_)&&(this.tilesLoadingKeys_[s]=!0,++this.tilesLoading_,++n,r.load())}}},h$=I5;function f$(i,e,t,n,r){if(!i||!(t in i.wantedTiles))return n2;if(!i.wantedTiles[t][e.getKey()])return n2;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 so={ANIMATING:0,INTERACTING:1};var Uc={CENTER:"center",RESOLUTION:"resolution",ROTATION:"rotation"};function L5(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,d=i[0]+l/2+u,A=i[2]-l/2+u,y=i[1]+c/2+f,w=i[3]-c/2+f;d>A&&(d=(A+d)/2,A=d),y>w&&(y=(w+y)/2,w=y);let S=Si(n[0],d,A),T=Si(n[1],y,w);if(o&&t&&r){let R=30*r;S+=-R*Math.log(1+Math.max(0,d-n[0])/R)+R*Math.log(1+Math.max(0,n[0]-A)/R),T+=-R*Math.log(1+Math.max(0,y-n[1])/R)+R*Math.log(1+Math.max(0,n[1]-w)/R)}return[S,T]})}function d$(i){return i}function D5(i,e,t,n){let r=Kn(e)/t[0],s=Nr(e)/t[1];return n?Math.min(i,Math.max(r,s)):Math.min(i,Math.min(r,s))}function N5(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),Si(n,t/2,e*2)}function p$(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?D5(l,t,o,n):l;if(a)return e?N5(r,u,c):Si(r,c,u);let f=Math.min(u,r),d=Math.floor(ev(i,f,s));return i[d]>u&&d<i.length-1?i[d+1]:i[d]}})}function m$(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?D5(e,r,l,s):e;if(c)return n?N5(o,u,t):Si(o,t,u);let f=1e-9,d=Math.ceil(Math.log(e/u)/Math.log(i)-f),A=-a*(.5-f)+.5,y=Math.min(u,o),w=Math.floor(Math.log(e/y)/Math.log(i)+A),S=Math.max(d,w),T=e/Math.pow(i,S);return Si(T,t,u)}})}function F5(i,e,t,n,r){return t=t!==void 0?t:!0,(function(s,o,a,l){if(s!==void 0){let c=n?D5(i,n,a,r):i;return!t||!l?Si(s,e,c):N5(s,c,e)}})}function gv(i){if(i!==void 0)return 0}function B5(i){if(i!==void 0)return i}function A$(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 g$(i){let e=i===void 0?mu(5):i;return(function(t,n){return n||t===void 0?t:Math.abs(t)<=e?0:t})}var O5=0,k5=class extends Us{constructor(e){super(),this.on,this.once,this.un,e=Object.assign({},e),this.hints_=[0,0],this.animations_=[],this.updateAnimationKey_,this.projection_=nE(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&&KW(),e.center&&(e.center=vu(e.center,this.projection_)),e.extent&&(e.extent=_u(e.extent,this.projection_)),this.applyOptions_(e)}applyOptions_(e){let t=Object.assign({},e);for(let a in Uc)delete t[a];this.setProperties(t,!0);let n=m0e(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=p0e(e),s=n.constraint,o=A0e(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=vu(r.center,this.getProjection())),r.anchor&&(r=Object.assign({},r),r.anchor=vu(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&&ZE(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||yj,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 d=fh(u.rotation-l+Math.PI,2*Math.PI)-Math.PI;f.targetRotation=l+d,l=f.targetRotation}g0e(f)?f.complete=!0:s+=f.duration,c.push(f)}this.animations_.push(c),this.setHint(so.ANIMATING,1),this.updateAnimations_()}getAnimating(){return this.hints_[so.ANIMATING]>0}getInteracting(){return this.hints_[so.INTERACTING]>0}cancelAnimations(){this.setHint(so.ANIMATING,-this.hints_[so.ANIMATING]);let e;for(let t=0,n=this.animations_.length;t<n;++t){let r=this.animations_[t];if(r[0].callback&&ZE(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 d=l.sourceCenter[0],A=l.sourceCenter[1],y=l.targetCenter[0],w=l.targetCenter[1];this.nextCenter_=l.targetCenter;let S=d+f*(y-d),T=A+f*(w-A);this.targetCenter_=[S,T]}if(l.sourceResolution&&l.targetResolution){let d=f===1?l.targetResolution:l.sourceResolution+f*(l.targetResolution-l.sourceResolution);if(l.anchor){let A=this.getViewportSize_(this.getRotation()),y=this.constraints_.resolution(d,0,A,!0);this.targetCenter_=this.calculateCenterZoom(y,l.anchor)}this.nextResolution_=l.targetResolution,this.targetResolution_=d,this.applyTargetState_(!0)}if(l.sourceRotation!==void 0&&l.targetRotation!==void 0){let d=f===1?fh(l.targetRotation+Math.PI,2*Math.PI)-Math.PI:l.sourceRotation+f*(l.targetRotation-l.sourceRotation);if(l.anchor){let A=this.constraints_.rotation(d,!0);this.targetCenter_=this.calculateCenterRotate(A,l.anchor)}this.nextRotation_=l.targetRotation,this.targetRotation_=d}if(this.applyTargetState_(!0),t=!0,!l.complete)break}if(s){this.animations_[n]=null,this.setHint(so.ANIMATING,-1),this.nextCenter_=null,this.nextResolution_=NaN,this.nextRotation_=NaN;let o=r[0].callback;o&&ZE(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]],X1(n,e-this.getRotation()),PW(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&&Ry(e,this.getProjection())}getCenterInternal(){return this.get(Uc.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 Sp(t,this.getProjection())}calculateExtentInternal(e){e=e||this.getViewportSizeMinusPadding_();let t=this.getCenterInternal();jn(t,"The view center is not defined");let n=this.getResolution();jn(n!==void 0,"The view resolution is not defined");let r=this.getRotation();return jn(r!==void 0,"The view rotation is not defined"),Ty(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(Uc.RESOLUTION)}getResolutions(){return this.resolutions_}getResolutionForExtent(e,t){return this.getResolutionForExtentInternal(_u(e,this.getProjection()),t)}getResolutionForExtentInternal(e,t){t=t||this.getViewportSizeMinusPadding_();let n=Kn(e)/t[0],r=Nr(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(Uc.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=U5(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=ev(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=Si(Math.floor(e),0,this.resolutions_.length-2),n=this.resolutions_[t]/this.resolutions_[t+1];return this.resolutions_[t]/Math.pow(n,Si(e-t,0,1))}return this.maxResolution_/Math.pow(this.zoomFactor_,e-this.minZoom_)}fit(e,t){let n;if(jn(Array.isArray(e)||typeof e.getSimplifiedGeometry=="function","Invalid extent or geometry provided as `geometry`"),Array.isArray(e)){jn(!hh(e),"Cannot fit empty extent provided as `geometry`");let r=_u(e,this.getProjection());n=FN(r)}else if(e.getType()==="Circle"){let r=_u(e.getExtent(),this.getProjection());n=FN(r),n.rotate(this.getRotation(),dl(r))}else{let r=rA();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,d=s.length;f<d;f+=o){let A=s[f]*n-s[f+1]*r,y=s[f]*r+s[f+1]*n;a=Math.min(a,A),l=Math.min(l,y),c=Math.max(c,A),u=Math.max(u,y)}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),d=dl(a);d[0]+=(r[1]-r[3])/2*l,d[1]+=(r[0]-r[2])/2*l;let A=d[0]*f-d[1]*u,y=d[1]*f+d[0]*u,w=this.getConstrainedCenter([A,y],l),S=t.callback?t.callback:td;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),ZE(S,!0))}centerOn(e,t,n){this.centerOnInternal(vu(e,this.getProjection()),t,n)}centerOnInternal(e,t,n){this.setCenterInternal(U5(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=U5(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=Ry(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&&vu(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=vu(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&&vu(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(Uc.ROTATION)!==r&&this.set(Uc.ROTATION,r),this.get(Uc.RESOLUTION)!==o&&(this.set(Uc.RESOLUTION,o),this.set("zoom",this.getZoom(),!0)),(!a||!this.get(Uc.CENTER)||!eA(this.get(Uc.CENTER),a))&&this.set(Uc.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()||!eA(this.getCenterInternal(),l))&&(this.getAnimating()&&this.cancelAnimations(),this.animateInternal({rotation:s,center:l,resolution:a,duration:e,easing:Lc,anchor:n}))}beginInteraction(){this.resolveConstraints(0),this.setHint(so.INTERACTING,1)}endInteraction(e,t,n){n=n&&vu(n,this.getProjection()),this.endInteractionInternal(e,t,n)}endInteractionInternal(e,t,n){this.getInteracting()&&(this.setHint(so.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 ZE(i,e){setTimeout(function(){i(e)},0)}function p0e(i){if(i.extent!==void 0){let t=i.smoothExtentConstraint!==void 0?i.smoothExtentConstraint:!0;return L5(i.extent,i.constrainOnlyCenter,t)}let e=nE(i.projection,"EPSG:3857");if(i.multiWorld!==!0&&e.isGlobal()){let t=e.getExtent().slice();return t[0]=-1/0,t[2]=1/0,L5(t,!1,!1)}return d$}function m0e(i){let e,t,n,o=i.minZoom!==void 0?i.minZoom:O5,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,d=nE(i.projection,"EPSG:3857"),A=d.getExtent(),y=i.constrainOnlyCenter,w=i.extent;if(!c&&!w&&d.isGlobal()&&(y=!1,w=A),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=p$(S,u,!y&&w,f):e=F5(t,n,u,!y&&w,f)}else{let T=(A?Math.max(Kn(A),Nr(A)):360*Kf.degrees/d.getMetersPerUnit())/256/Math.pow(2,O5),R=T/Math.pow(2,28-O5);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=m$(l,t,n,u,!y&&w,f):e=F5(t,n,u,!y&&w,f)}return{constraint:e,maxResolution:t,minResolution:n,minZoom:o,zoomFactor:l}}function A0e(i){if(i.enableRotation!==void 0?i.enableRotation:!0){let t=i.constrainRotation;return t===void 0||t===!0?g$():t===!1?B5:typeof t=="number"?A$(t):B5}return gv}function g0e(i){return!(i.sourceCenter&&i.targetCenter&&!eA(i.sourceCenter,i.targetCenter)||i.sourceResolution!==i.targetResolution||i.sourceRotation!==i.targetRotation)}function U5(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 Xl=k5;var z5=class extends Us{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)li(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!==td&&this.listenerKeys.push(qn(e,xh.POSTRENDER,this.render,this)),e.render()}}render(e){}setTarget(e){this.target_=typeof e=="string"?document.getElementById(e):e}},vv=z5;var V5=class extends vv{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(nn.CLICK,this.handleClick_.bind(this),!1);let c=t+" "+Np+" "+fv+(this.collapsed_&&this.collapsible_?" "+YN:"")+(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=>Aj(()=>r))),n=t.length>0;if(this.renderedVisible_!=n&&(this.element.style.display=n?"":"none",this.renderedVisible_=n),!ta(t,this.renderedAttributions_)){wj(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(YN),this.collapsed_?iN(this.collapseLabel_,this.label_):iN(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)}},v$=V5;var G5=class extends vv{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(nn.CLICK,this.handleClick_.bind(this),!1);let a=t+" "+Np+" "+fv,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(Ky)}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:Lc}):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(Ky);!s&&n===0?this.element.classList.add(Ky):s&&n!==0&&this.element.classList.remove(Ky)}this.label_.style.transform=r}this.rotation_=n}},_$=G5;var q5=class extends vv{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(nn.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(nn.CLICK,this.handleClick_.bind(this,-n),!1);let d=t+" "+Np+" "+fv,A=this.element;A.className=d,A.appendChild(u),A.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:Lc})):n.setZoom(s)}}},x$=q5;function KE(i){i=i||{};let e=new Fo;return(i.zoom===void 0||i.zoom)&&e.push(new x$(i.zoomOptions)),(i.rotate===void 0||i.rotate)&&e.push(new _$(i.rotateOptions)),(i.attribution===void 0||i.attribution)&&e.push(new v$(i.attributionOptions)),e}var H5=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_}},y$=H5;var W5={ACTIVE:"active"};var j5=class extends Us{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(W5.ACTIVE)}getMap(){return this.map_}handleEvent(e){return!0}setActive(e){this.set(W5.ACTIVE,e)}setMap(e){this.map_=e}};function b$(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:bj,center:i.getConstrainedCenter(r)})}}function _v(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:Lc})}var yh=j5;var X5=class extends yh{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==gr.DBLCLICK){let n=e.originalEvent,r=e.map,s=e.coordinate,o=n.shiftKey?-this.delta_:this.delta_,a=r.getView();_v(a,o,s,this.duration_),n.preventDefault(),t=!0}return!t}},w$=X5;function i2(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 S$=function(i){let e=i.originalEvent;return e.altKey&&!(e.metaKey||e.ctrlKey)&&e.shiftKey},v0e=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)},QE=function(i){let e=i.map.getTargetElement(),t=e.getRootNode();return(t instanceof ShadowRoot?t.host:e).hasAttribute("tabindex")?v0e(i):!0},T$=Jf;var JE=function(i){let e=i.originalEvent;return"pointerId"in e&&e.button==0&&!(gj&&QD&&e.ctrlKey)};var e3=function(i){let e=i.originalEvent;return!e.altKey&&!(e.metaKey||e.ctrlKey)&&!e.shiftKey};var E$=function(i){let e=i.originalEvent;return QD?e.metaKey:e.ctrlKey},M$=function(i){let e=i.originalEvent;return!e.altKey&&!(e.metaKey||e.ctrlKey)&&e.shiftKey},t3=function(i){let e=i.originalEvent,t=e.target.tagName;return t!=="INPUT"&&t!=="SELECT"&&t!=="TEXTAREA"&&!e.target.isContentEditable},n3=function(i){let e=i.originalEvent;return"pointerId"in e&&e.pointerType=="mouse"};var C$=function(i){let e=i.originalEvent;return"pointerId"in e&&e.isPrimary&&e.button===0};var $5=class extends yh{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==gr.POINTERDRAG)this.handleDragEvent(e),e.originalEvent.preventDefault();else if(e.type==gr.POINTERUP){let n=this.handleUpEvent(e);this.handlingDownUpSequence=n&&this.targetPointers.length>0}}else if(e.type==gr.POINTERDOWN){let n=this.handleDownEvent(e);this.handlingDownUpSequence=n,t=this.stopDown(n)}else e.type==gr.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 xv(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 bh=$5;var Y5=class extends bh{constructor(e){super({stopDown:ed}),e=e||{},this.kinetic_=e.kinetic,this.lastCentroid=null,this.lastPointersCount_,this.panning_=!1;let t=e.condition?e.condition:i2(e3,C$);this.condition_=e.onFocusOnly?i2(QE,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(xv(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();IW(s,a.getResolution()),X1(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:Lc})}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}},R$=Y5;var Z5=class extends bh{constructor(e){e=e||{},super({stopDown:ed}),this.condition_=e.condition?e.condition:S$,this.lastAngle_=void 0,this.duration_=e.duration!==void 0?e.duration:250}handleDragEvent(e){if(!n3(e))return;let t=e.map,n=t.getView();if(n.getConstraints().rotation===gv)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 n3(e)?(e.map.getView().endInteraction(this.duration_),!1):!0}handleDownEvent(e){return n3(e)&&JE(e)&&this.condition_(e)?(e.map.getView().beginInteraction(),this.lastAngle_=void 0,!0):!1}},P$=Z5;var K5=class extends Mp{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 Ah([r])}getGeometry(){return this.geometry_}},I$=K5;var yv={BOXSTART:"boxstart",BOXDRAG:"boxdrag",BOXEND:"boxend",BOXCANCEL:"boxcancel"},bA=class extends Ao{constructor(e,t,n){super(e),this.coordinate=t,this.mapBrowserEvent=n}},Q5=class extends bh{constructor(e){super(),this.on,this.once,this.un,e=e??{},this.box_=new I$(e.className||"ol-dragbox"),this.minArea_=e.minArea??64,e.onBoxEnd&&(this.onBoxEnd=e.onBoxEnd),this.startPixel_=null,this.condition_=e.condition??JE,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 bA(yv.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 bA(t?yv.BOXEND:yv.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 bA(yv.BOXSTART,e.coordinate,e)),!0):!1}onBoxEnd(e){}setActive(e){e||(this.box_.setMap(null),this.startPixel_&&(this.dispatchEvent(new bA(yv.BOXCANCEL,this.startPixel_,null)),this.startPixel_=null)),super.setActive(e)}setMap(e){this.getMap()&&(this.box_.setMap(null),this.startPixel_&&(this.dispatchEvent(new bA(yv.BOXCANCEL,this.startPixel_,null)),this.startPixel_=null)),super.setMap(e)}},L$=Q5;var J5=class extends L${constructor(e){e=e||{};let t=e.condition?e.condition:M$;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:Lc})}},D$=J5;var kp={LEFT:"ArrowLeft",UP:"ArrowUp",RIGHT:"ArrowRight",DOWN:"ArrowDown"};var e6=class extends yh{constructor(e){super(),e=e||{},this.defaultCondition_=function(t){return e3(t)&&t3(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==nn.KEYDOWN){let n=e.originalEvent,r=n.key;if(this.condition_(e)&&(r==kp.DOWN||r==kp.LEFT||r==kp.RIGHT||r==kp.UP)){let o=e.map.getView(),a=o.getResolution()*this.pixelDelta_,l=0,c=0;r==kp.DOWN?c=-a:r==kp.LEFT?l=-a:r==kp.RIGHT?l=a:c=a;let u=[l,c];X1(u,o.getRotation()),b$(o,u,this.duration_),n.preventDefault(),t=!0}}return!t}},N$=e6;var t6=class extends yh{constructor(e){super(),e=e||{},this.condition_=e.condition?e.condition:function(t){return!E$(t)&&t3(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==nn.KEYDOWN||e.type==nn.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();_v(a,o,void 0,this.duration_),n.preventDefault(),t=!0}}return!t}},F$=t6;var _0e=40,x0e=300,y0e=3,n6=class extends yh{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:T$;this.condition_=e.onFocusOnly?i2(QE,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(li),this.ctrlKeyListenerKeys_.length=0,this.ctrlKeyPressed_=!1,super.setMap(e),e){let t=e.getOwnerDocument();this.ctrlKeyListenerKeys_.push(qn(t,"keydown",n=>{n.key==="Control"&&(this.ctrlKeyPressed_=!0)}),qn(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!==nn.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*=_0e;break;case WheelEvent.DOM_DELTA_PAGE:o*=x0e;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*y0e),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=-Si(this.totalDelta_,-this.maxDelta_*this.deltaPerZoom_,this.maxDelta_*this.deltaPerZoom_)/this.deltaPerZoom_;(t.getConstrainResolution()||this.constrainResolution_)&&(n=n?n>0?1:-1:0),_v(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)}},B$=n6;var i6=class extends bh{constructor(e){e=e||{};let t=e;t.stopDown||(t.stopDown=ed),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!==gv&&(this.anchor_=o.getCoordinateFromPixelInternal(o.getEventPixel(xv(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}},O$=i6;var r6=class extends bh{constructor(e){e=e||{};let t=e;t.stopDown||(t.stopDown=ed),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(xv(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}},U$=r6;function i3(i){i=i||{};let e=new Fo,t=new y$(-.005,.05,100);return(i.altShiftDragRotate===void 0||i.altShiftDragRotate)&&e.push(new P$),(i.doubleClickZoom===void 0||i.doubleClickZoom)&&e.push(new w$({delta:i.zoomDelta,duration:i.zoomDuration})),(i.dragPan===void 0||i.dragPan)&&e.push(new R$({onFocusOnly:i.onFocusOnly,kinetic:t})),(i.pinchRotate===void 0||i.pinchRotate)&&e.push(new O$),(i.pinchZoom===void 0||i.pinchZoom)&&e.push(new U$({duration:i.zoomDuration})),(i.keyboard===void 0||i.keyboard)&&(e.push(new N$),e.push(new F$({delta:i.zoomDelta,duration:i.zoomDuration}))),(i.mouseWheelZoom===void 0||i.mouseWheelZoom)&&e.push(new B$({onFocusOnly:i.onFocusOnly,duration:i.zoomDuration})),(i.shiftDragZoom===void 0||i.shiftDragZoom)&&e.push(new D$({duration:i.zoomDuration})),e}var Ni={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 s6=class extends Us{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[Ni.OPACITY]=e.opacity!==void 0?e.opacity:1,jn(typeof t[Ni.OPACITY]=="number","Layer opacity must be a number"),t[Ni.VISIBLE]=e.visible!==void 0?e.visible:!0,t[Ni.Z_INDEX]=e.zIndex,t[Ni.MAX_RESOLUTION]=e.maxResolution!==void 0?e.maxResolution:1/0,t[Ni.MIN_RESOLUTION]=e.minResolution!==void 0?e.minResolution:0,t[Ni.MIN_ZOOM]=e.minZoom!==void 0?e.minZoom:-1/0,t[Ni.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=Si(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 ei()}getLayerStatesArray(e){return ei()}getExtent(){return this.get(Ni.EXTENT)}getMaxResolution(){return this.get(Ni.MAX_RESOLUTION)}getMinResolution(){return this.get(Ni.MIN_RESOLUTION)}getMinZoom(){return this.get(Ni.MIN_ZOOM)}getMaxZoom(){return this.get(Ni.MAX_ZOOM)}getOpacity(){return this.get(Ni.OPACITY)}getSourceState(){return ei()}getVisible(){return this.get(Ni.VISIBLE)}getZIndex(){return this.get(Ni.Z_INDEX)}setBackground(e){this.background_=e,this.changed()}setExtent(e){this.set(Ni.EXTENT,e)}setMaxResolution(e){this.set(Ni.MAX_RESOLUTION,e)}setMinResolution(e){this.set(Ni.MIN_RESOLUTION,e)}setMaxZoom(e){this.set(Ni.MAX_ZOOM,e)}setMinZoom(e){this.set(Ni.MIN_ZOOM,e)}setOpacity(e){jn(typeof e=="number","Layer opacity must be a number"),this.set(Ni.OPACITY,e)}setVisible(e){this.set(Ni.VISIBLE,e)}setZIndex(e){this.set(Ni.Z_INDEX,e)}disposeInternal(){this.state_&&(this.state_.layer=null,this.state_=null),super.disposeInternal()}},r3=s6;var zp={ADDLAYER:"addlayer",REMOVELAYER:"removelayer"},Su=class extends Ao{constructor(e,t){super(e),this.layer=t}},o6={LAYERS:"layers"},a6=class i extends r3{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(o6.LAYERS,this.handleLayersChanged_),n?Array.isArray(n)?n=new Fo(n.slice(),{unique:!0}):jn(typeof n.getArray=="function","Expected `layers` to be an array or a `Collection`"):n=new Fo(void 0,{unique:!0}),this.setLayers(n)}handleLayerChange_(){this.changed()}handleLayersChanged_(){this.layersListenerKeys_.forEach(li),this.layersListenerKeys_.length=0;let e=this.getLayers();this.layersListenerKeys_.push(qn(e,vo.ADD,this.handleLayersAdd_,this),qn(e,vo.REMOVE,this.handleLayersRemove_,this));for(let n in this.listenerKeys_)this.listenerKeys_[n].forEach(li);dh(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 Su(zp.ADDLAYER,s))}this.changed()}registerLayerListeners_(e){let t=[qn(e,xu.PROPERTYCHANGE,this.handleLayerChange_,this),qn(e,nn.CHANGE,this.handleLayerChange_,this)];e instanceof i&&t.push(qn(e,zp.ADDLAYER,this.handleLayerGroupAdd_,this),qn(e,zp.REMOVELAYER,this.handleLayerGroupRemove_,this)),this.listenerKeys_[Bn(e)]=t}handleLayerGroupAdd_(e){this.dispatchEvent(new Su(zp.ADDLAYER,e.layer))}handleLayerGroupRemove_(e){this.dispatchEvent(new Su(zp.REMOVELAYER,e.layer))}handleLayersAdd_(e){let t=e.element;this.registerLayerListeners_(t),this.dispatchEvent(new Su(zp.ADDLAYER,t)),this.changed()}handleLayersRemove_(e){let t=e.element,n=Bn(t);this.listenerKeys_[n].forEach(li),delete this.listenerKeys_[n],this.dispatchEvent(new Su(zp.REMOVELAYER,t)),this.changed()}getLayers(){return this.get(o6.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 Su(zp.REMOVELAYER,n[r]))}this.set(o6.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=uh(l.extent,r.extent):l.extent=r.extent),l.zIndex===void 0&&(l.zIndex=s)}return t}getSourceState(){return"ready"}},r2=a6;var Oo={PRERENDER:"prerender",POSTRENDER:"postrender",PRECOMPOSE:"precompose",POSTCOMPOSE:"postcompose",RENDERCOMPLETE:"rendercomplete"};var l6=class extends r3{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(Ni.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(Ni.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_&&(li(this.sourceChangeKey_),this.sourceChangeKey_=null),this.sourceReady_=!1;let e=this.getSource();e&&(this.sourceChangeKey_=qn(e,nn.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 Xl?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 s2(r,t.viewState)&&(!s||Ar(s,t.extent))}getAttributions(e){if(!this.isVisible(e))return[];let t=this.getSource()?.getAttributions();if(!t)return[];let n=e instanceof Xl?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(Ni.MAP,e)}getMapInternal(){return this.get(Ni.MAP)}setMap(e){this.mapPrecomposeKey_&&(li(this.mapPrecomposeKey_),this.mapPrecomposeKey_=null),e||this.changed(),this.mapRenderKey_&&(li(this.mapRenderKey_),this.mapRenderKey_=null),e&&(this.mapPrecomposeKey_=qn(e,Oo.PRECOMPOSE,this.handlePrecompose_,this),this.mapRenderKey_=qn(this,nn.CHANGE,e.render,e),this.changed())}handlePrecompose_(e){let t=e.frameState.layerStatesArray,n=this.getLayerState(!1);jn(!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(Ni.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 s2(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 wA=l6;function s3(i,e,t=0,n=i.length-1,r=b0e){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),d=.5*Math.sqrt(u*f*(l-f)/l)*(c-l/2<0?-1:1),A=Math.max(t,Math.floor(e-c*f/l+d)),y=Math.min(n,Math.floor(e+(l-c)*f/l+d));s3(i,e,A,y,r)}let s=i[e],o=t,a=n;for(o2(i,t,e),r(i[n],s)>0&&o2(i,t,n);o<a;){for(o2(i,o,a),o++,a--;r(i[o],s)<0;)o++;for(;r(i[a],s)>0;)a--}r(i[t],s)===0?o2(i,t,a):(a++,o2(i,a,n)),a<=e&&(t=a+1),e<=a&&(n=a-1)}}function o2(i,e,t){let n=i[e];i[e]=i[t],i[t]=n}function b0e(i,e){return i<e?-1:i>e?1:0}var SA=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(!a3(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;a3(e,l)&&(t.leaf?n.push(a):u6(e,l)?this._all(a,n):s.push(a))}t=s.pop()}return n}collides(e){let t=this.data;if(!a3(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(a3(e,o)){if(t.leaf||u6(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=wv([]),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=w0e(e,n.children,t);if(u!==-1)return n.children.splice(u,1),s.push(n),this._condense(s),this}!c&&!n.leaf&&u6(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=wv(e.slice(t,n+1)),bv(a,this.toBBox),a;r||(r=Math.ceil(Math.log(s)/Math.log(o)),o=Math.ceil(s/Math.pow(o,r-1))),a=wv([]),a.leaf=!1,a.height=r;let l=Math.ceil(s/o),c=l*Math.ceil(Math.sqrt(o));k$(e,t,n,c,this.compareMinX);for(let u=t;u<=n;u+=c){let f=Math.min(u+c-1,n);k$(e,u,f,l,this.compareMinY);for(let d=u;d<=f;d+=l){let A=Math.min(d+l-1,f);a.children.push(this._build(e,d,A,r-1))}}return bv(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=c6(c),f=E0e(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),l2(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=wv(n.children.splice(o,n.children.length-o));a.height=n.height,a.leaf=n.leaf,bv(n,this.toBBox),bv(a,this.toBBox),t?e[t-1].children.push(a):this._splitRoot(n,a)}_splitRoot(e,t){this.data=wv([e,t]),this.data.height=e.height+1,this.data.leaf=!1,bv(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=a2(e,0,a,this.toBBox),c=a2(e,a,n,this.toBBox),u=M0e(l,c),f=c6(l)+c6(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:S0e,s=e.leaf?this.compareMinY:T0e,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=a2(e,0,t,s),a=a2(e,n-t,n,s),l=o3(o)+o3(a);for(let c=t;c<n-t;c++){let u=e.children[c];l2(o,e.leaf?s(u):u),l+=o3(o)}for(let c=n-t-1;c>=t;c--){let u=e.children[c];l2(a,e.leaf?s(u):u),l+=o3(a)}return l}_adjustParentBBoxes(e,t,n){for(let r=n;r>=0;r--)l2(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():bv(e[t],this.toBBox)}};function w0e(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 bv(i,e){a2(i,0,i.children.length,e,i)}function a2(i,e,t,n,r){r||(r=wv(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];l2(r,i.leaf?n(o):o)}return r}function l2(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 S0e(i,e){return i.minX-e.minX}function T0e(i,e){return i.minY-e.minY}function c6(i){return(i.maxX-i.minX)*(i.maxY-i.minY)}function o3(i){return i.maxX-i.minX+(i.maxY-i.minY)}function E0e(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 M0e(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 u6(i,e){return i.minX<=e.minX&&i.minY<=e.minY&&e.maxX<=i.maxX&&e.maxY<=i.maxY}function a3(i,e){return e.minX<=i.maxX&&e.minY<=i.maxY&&e.maxX>=i.minX&&e.maxY>=i.minY}function wv(i){return{children:i,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function k$(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;s3(i,o,e,t,r),s.push(e,o,o,t)}}var EA=0,c3=0,ra=1<<EA++,ci=1<<EA++,sa=1<<EA++,La=1<<EA++,hd=1<<EA++,TA=1<<EA++,u3=Math.pow(2,EA)-1,f6={[ra]:"boolean",[ci]:"number",[sa]:"string",[La]:"color",[hd]:"number[]",[TA]:"size"},C0e=Object.keys(f6).map(Number).sort(pl);function R0e(i){return i in f6}function ud(i){let e=[];for(let t of C0e)c2(i,t)&&e.push(f6[t]);return e.length===0?"untyped":e.length<3?e.join(" or "):e.slice(0,-1).join(", ")+", or "+e[e.length-1]}function c2(i,e){return(i&e)===e}function l3(i,e){return!!(i&e)}function Vp(i,e){return i===e}var $r=class{constructor(e,t){if(!R0e(e))throw new Error(`literal expressions must have a specific type, got ${ud(e)}`);this.type=e,this.value=t}},h3=class{constructor(e,t,...n){this.type=e,this.operator=t,this.args=n}};function f3(i){return{variables:new Map,properties:new Map,featureId:!1,geometryType:!1,mCoordinate:!1,mapState:!1,inputVariables:i}}function hs(i,e,t){switch(typeof i){case"boolean":{if(Vp(e,sa))return new $r(sa,i?"true":"false");if(!c2(e,ra))throw new Error(`got a boolean, but expected ${ud(e)}`);return new $r(ra,i)}case"number":{if(Vp(e,TA))return new $r(TA,cs(i));if(Vp(e,ra))return new $r(ra,!!i);if(Vp(e,sa))return new $r(sa,i.toString());if(!c2(e,ci))throw new Error(`got a number, but expected ${ud(e)}`);return new $r(ci,i)}case"string":{if(Vp(e,La))return new $r(La,$y(i));if(Vp(e,ra))return new $r(ra,!!i);if(!c2(e,sa))throw new Error(`got a string, but expected ${ud(e)}`);return new $r(sa,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 V0e(i,e,t);for(let n of i)if(typeof n!="number")throw new Error("expected an array of numbers");if(Vp(e,TA)){if(i.length!==2)throw new Error(`expected an array of two values for a size, got ${i.length}`);return new $r(TA,i)}if(Vp(e,La)){if(i.length===3)return new $r(La,[...i,1]);if(i.length===4)return new $r(La,i);throw new Error(`expected an array of 3 or 4 values for a color, got ${i.length}`)}if(!c2(e,hd))throw new Error(`got an array of numbers, but expected ${ud(e)}`);return new $r(hd,i)}var et={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"},P0e={[et.Get]:Un(ti(1,1/0),z$),[et.Var]:I0e(),[et.Has]:Un(ti(1,1/0),z$),[et.Id]:Un(L0e,Sv),[et.Concat]:Un(ti(2,1/0),Qi(sa)),[et.GeometryType]:Un(D0e,Sv),[et.LineMetric]:Un(N0e,Sv),[et.Resolution]:Un(h6,Sv),[et.Zoom]:Un(h6,Sv),[et.Time]:Un(h6,Sv),[et.Any]:Un(ti(2,1/0),Qi(ra)),[et.All]:Un(ti(2,1/0),Qi(ra)),[et.Not]:Un(ti(1,1),Qi(ra)),[et.Equal]:Un(ti(2,2),G$()),[et.NotEqual]:Un(ti(2,2),G$()),[et.GreaterThan]:Un(ti(2,2),Qi(ci)),[et.GreaterThanOrEqualTo]:Un(ti(2,2),Qi(ci)),[et.LessThan]:Un(ti(2,2),Qi(ci)),[et.LessThanOrEqualTo]:Un(ti(2,2),Qi(ci)),[et.Multiply]:Un(ti(2,1/0),V$),[et.Coalesce]:Un(ti(2,1/0),V$),[et.Divide]:Un(ti(2,2),Qi(ci)),[et.Add]:Un(ti(2,1/0),Qi(ci)),[et.Subtract]:Un(ti(2,2),Qi(ci)),[et.Clamp]:Un(ti(3,3),Qi(ci)),[et.Mod]:Un(ti(2,2),Qi(ci)),[et.Pow]:Un(ti(2,2),Qi(ci)),[et.Abs]:Un(ti(1,1),Qi(ci)),[et.Floor]:Un(ti(1,1),Qi(ci)),[et.Ceil]:Un(ti(1,1),Qi(ci)),[et.Round]:Un(ti(1,1),Qi(ci)),[et.Sin]:Un(ti(1,1),Qi(ci)),[et.Cos]:Un(ti(1,1),Qi(ci)),[et.Atan]:Un(ti(1,2),Qi(ci)),[et.Sqrt]:Un(ti(1,1),Qi(ci)),[et.Match]:Un(ti(4,1/0),q$,B0e),[et.Between]:Un(ti(3,3),Qi(ci)),[et.Interpolate]:Un(ti(6,1/0),q$,O0e),[et.Case]:Un(ti(3,1/0),F0e,U0e),[et.In]:Un(ti(2,2),k0e),[et.Number]:Un(ti(1,1/0),Qi(u3)),[et.String]:Un(ti(1,1/0),Qi(u3)),[et.Array]:Un(ti(1,1/0),Qi(ci)),[et.Color]:Un(ti(1,4),Qi(ci)),[et.Band]:Un(ti(1,3),Qi(ci)),[et.Palette]:Un(ti(2,2),z0e),[et.ToString]:Un(ti(1,1),Qi(ra|ci|sa|La))};function z$(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 $r(ci,o);break}case"string":{r[s]=new $r(sa,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 I0e(){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=hs(s,u3,t);if(!(o instanceof $r))throw new Error(`style variables should only be literal values (no expressions!), variable name: ${n}`);let a=o.type;if(typeof s=="string"&&l3(r,La)&&!l3(r,sa)?a=La:Array.isArray(s)&&s.length===2&&l3(r,TA)&&!l3(r,hd)&&(a=TA),r&=a,r===c3)throw new Error(`the type expected from the var operator (${ud(e)}) did not have any overlap with the type of the corresponding style variables (${ud(a)}), variable name: ${n}`)}if(t.variables.has(n)){let o=t.variables.get(n);if(r&=o,r===c3)throw new Error(`a new type expected from the var operator (${ud(e)}) did not have any overlap with the previous type expected for it (${ud(o)}), variable name: ${n}`)}return t.variables.set(n,r),new h3(r,"var",new $r(sa,n))}}function L0e(i,e,t){t.featureId=!0}function D0e(i,e,t){t.geometryType=!0}function N0e(i,e,t){t.mCoordinate=!0}function h6(i,e,t){t.mapState=!0}function Sv(i,e,t){let n=i[0];if(i.length!==1)throw new Error(`expected no arguments for ${n} operation`);return[]}function ti(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 V$(i,e,t){let n=i.length-1,r=new Array(n);for(let s=0;s<n;++s){let o=hs(i[s+1],e,t);r[s]=o}return r}function Qi(i){return function(e,t,n){let r=e.length-1,s=new Array(r);for(let o=0;o<r;++o){let a=hs(e[o+1],i,n);s[o]=a}return s}}function G$(){return function(i,e,t){let n=i[0],r=i.length-1,s=new Array(r),o=u3;for(let a=0;a<r;++a){let l=hs(i[a+1],o,t);o&=l.type}if(o===c3)throw new Error(`no common type was found among the arguments of ${n}`);for(let a=0;a<r;++a){let l=hs(i[a+1],o,t);s[a]=l}return s}}function F0e(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 q$(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 B0e(i,e,t){let n=i.length-1,r=hs(i[i.length-1],e,t),s=sa|ci|ra,o=new Array(n-2);for(let l=0;l<n-2;l+=2){try{let c=hs(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===c3)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=hs(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=hs(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[hs(i[1],s,t),...o,r]}function O0e(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 $r(ci,r),o;try{o=hs(i[2],ci,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=hs(i[l+3],ci,t);a[l]=c}catch(c){throw new Error(`failed to parse argument ${l+2} for interpolate expression: ${c.message}`)}try{let c=hs(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 U0e(i,e,t){let n=hs(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=hs(i[s+1],ra,t);r[s]=o}catch(o){throw new Error(`failed to parse argument ${s} of case expression: ${o.message}`)}try{let o=hs(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 k0e(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=sa:r=ci;let s=new Array(n.length);for(let a=0;a<s.length;a++)try{let l=hs(n[a],r,t);s[a]=l}catch(l){throw new Error(`failed to parse haystack item ${a} for "in" expression: ${l.message}`)}return[hs(i[1],r,t),...s]}function z0e(i,e,t){let n;try{n=hs(i[1],ci,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=hs(r[o],La,t)}catch(l){throw new Error(`failed to parse color at index ${o} in palette expression: ${l.message}`)}if(!(a instanceof $r))throw new Error(`the palette color at index ${o} must be a literal value`);s[o]=a}return[n,...s]}function Un(...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 h3(t,r,...s)}}function V0e(i,e,t){let n=i[0],r=P0e[n];if(!r)throw new Error(`unknown operator: ${n}`);return r(i,e,t)}function d3(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 d3(i.getGeometries()[0]);default:return""}}function d6(){return{variables:{},properties:{},resolution:NaN,featureId:null,geometryType:""}}function Eu(i,e,t){let n=hs(i,e,t);return Tu(n,t)}function Tu(i,e){if(i instanceof $r){if(i.type===La&&typeof i.value=="string"){let n=$y(i.value);return function(){return n}}return function(){return i.value}}let t=i.operator;switch(t){case et.Number:case et.String:case et.Coalesce:return G0e(i,e);case et.Get:case et.Var:case et.Has:return q0e(i,e);case et.Id:return n=>n.featureId;case et.GeometryType:return n=>n.geometryType;case et.Concat:{let n=i.args.map(r=>Tu(r,e));return r=>"".concat(...n.map(s=>s(r).toString()))}case et.Resolution:return n=>n.resolution;case et.Any:case et.All:case et.Between:case et.In:case et.Not:return W0e(i,e);case et.Equal:case et.NotEqual:case et.LessThan:case et.LessThanOrEqualTo:case et.GreaterThan:case et.GreaterThanOrEqualTo:return H0e(i,e);case et.Multiply:case et.Divide:case et.Add:case et.Subtract:case et.Clamp:case et.Mod:case et.Pow:case et.Abs:case et.Floor:case et.Ceil:case et.Round:case et.Sin:case et.Cos:case et.Atan:case et.Sqrt:return j0e(i,e);case et.Case:return X0e(i,e);case et.Match:return $0e(i,e);case et.Interpolate:return Y0e(i,e);case et.ToString:return Z0e(i,e);default:throw new Error(`Unsupported operator ${t}`)}}function G0e(i,e){let t=i.operator,n=i.args.length,r=new Array(n);for(let s=0;s<n;++s)r[s]=Tu(i.args[s],e);switch(t){case et.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 et.Number:case et.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 q0e(i,e){let n=i.args[0].value;switch(i.operator){case et.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 et.Var:return r=>r.variables[n];case et.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 H0e(i,e){let t=i.operator,n=Tu(i.args[0],e),r=Tu(i.args[1],e);switch(t){case et.Equal:return s=>n(s)===r(s);case et.NotEqual:return s=>n(s)!==r(s);case et.LessThan:return s=>n(s)<r(s);case et.LessThanOrEqualTo:return s=>n(s)<=r(s);case et.GreaterThan:return s=>n(s)>r(s);case et.GreaterThanOrEqualTo:return s=>n(s)>=r(s);default:throw new Error(`Unsupported comparison operator ${t}`)}}function W0e(i,e){let t=i.operator,n=i.args.length,r=new Array(n);for(let s=0;s<n;++s)r[s]=Tu(i.args[s],e);switch(t){case et.Any:return s=>{for(let o=0;o<n;++o)if(r[o](s))return!0;return!1};case et.All:return s=>{for(let o=0;o<n;++o)if(!r[o](s))return!1;return!0};case et.Between:return s=>{let o=r[0](s),a=r[1](s),l=r[2](s);return o>=a&&o<=l};case et.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 et.Not:return s=>!r[0](s);default:throw new Error(`Unsupported logical operator ${t}`)}}function j0e(i,e){let t=i.operator,n=i.args.length,r=new Array(n);for(let s=0;s<n;++s)r[s]=Tu(i.args[s],e);switch(t){case et.Multiply:return s=>{let o=1;for(let a=0;a<n;++a)o*=r[a](s);return o};case et.Divide:return s=>r[0](s)/r[1](s);case et.Add:return s=>{let o=0;for(let a=0;a<n;++a)o+=r[a](s);return o};case et.Subtract:return s=>r[0](s)-r[1](s);case et.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 et.Mod:return s=>r[0](s)%r[1](s);case et.Pow:return s=>Math.pow(r[0](s),r[1](s));case et.Abs:return s=>Math.abs(r[0](s));case et.Floor:return s=>Math.floor(r[0](s));case et.Ceil:return s=>Math.ceil(r[0](s));case et.Round:return s=>Math.round(r[0](s));case et.Sin:return s=>Math.sin(r[0](s));case et.Cos:return s=>Math.cos(r[0](s));case et.Atan:return n===2?s=>Math.atan2(r[0](s),r[1](s)):s=>Math.atan(r[0](s));case et.Sqrt:return s=>Math.sqrt(r[0](s));default:throw new Error(`Unsupported numeric operator ${t}`)}}function X0e(i,e){let t=i.args.length,n=new Array(t);for(let r=0;r<t;++r)n[r]=Tu(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 $0e(i,e){let t=i.args.length,n=new Array(t);for(let r=0;r<t;++r)n[r]=Tu(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 Y0e(i,e){let t=i.args.length,n=new Array(t);for(let r=0;r<t;++r)n[r]=Tu(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),d=Array.isArray(f);if(d&&(f=AX(f)),u>=o)return c===2?f:d?K0e(s,o,a,l,u,f):u2(s,o,a,l,u,f);a=u,l=f}return l}}function Z0e(i,e){let t=i.operator,n=i.args.length,r=new Array(n);for(let s=0;s<n;++s)r[s]=Tu(i.args[s],e);if(t===et.ToString)return s=>{let o=r[0](s);return i.args[0].type===La?Yy(o):o.toString()};throw new Error(`Unsupported convert operator ${t}`)}function u2(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 K0e(i,e,t,n,r,s){if(r-t===0)return n;let a=jN(n),l=jN(s),c=l[2]-a[2];c>180?c-=360:c<-180&&(c+=360);let u=[u2(i,e,t,a[0],r,l[0]),u2(i,e,t,a[1],r,l[1]),a[2]+u2(i,e,t,0,r,c),u2(i,e,t,n[3],r,s[3])];return gX(u)}function Q0e(i){return!0}function J0e(i,e){e=e??f3();let t=eme(i,e),n=d6();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=d3(r.getGeometry())),t(n)}}function H$(i,e){e=e??f3();let t=i.length,n=new Array(t);for(let o=0;o<t;++o)n[o]=p6(i[o],e);let r=d6(),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=d3(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 $$(i,e){if(e=e??f3(),!Array.isArray(i))return H$([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 J0e(s,e)}return H$(i,e)}function eme(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?Eu(s.filter,ra,e):Q0e,a;if(Array.isArray(s.style)){let l=s.style.length;a=new Array(l);for(let c=0;c<l;++c)a[c]=p6(s.style[c],e)}else a=[p6(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 p6(i,e){let t=h2(i,"",e),n=f2(i,"",e),r=tme(i,e),s=nme(i,e),o=Uo(i,"z-index",e);if(!t&&!n&&!r&&!s&&!Au(i))throw new Error("No fill, stroke, point, or text symbolizer properties in style: "+JSON.stringify(i));let a=new Xr;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 h2(i,e,t){let n;if(e+"fill-pattern-src"in i)n=ome(i,e+"fill-",t);else{if(i[e+"fill-color"]==="none")return s=>null;n=m3(i,e+"fill-color",t)}if(!n)return null;let r=new ks;return function(s){let o=n(s);return o===NE?null:(r.setColor(o),r)}}function f2(i,e,t){let n=Uo(i,e+"stroke-width",t),r=m3(i,e+"stroke-color",t);if(!n&&!r)return null;let s=fd(i,e+"stroke-line-cap",t),o=fd(i,e+"stroke-line-join",t),a=Y$(i,e+"stroke-line-dash",t),l=Uo(i,e+"stroke-line-dash-offset",t),c=Uo(i,e+"stroke-miter-limit",t),u=Uo(i,e+"stroke-offset",t),f=new ro;return function(d){if(r){let A=r(d);if(A===NE)return null;f.setColor(A)}if(n&&f.setWidth(n(d)),s){let A=s(d);if(A!=="butt"&&A!=="round"&&A!=="square")throw new Error("Expected butt, round, or square line cap");f.setLineCap(A)}if(o){let A=o(d);if(A!=="bevel"&&A!=="round"&&A!=="miter")throw new Error("Expected bevel, round, or miter line join");f.setLineJoin(A)}return a&&f.setLineDash(a(d)),l&&f.setLineDashOffset(l(d)),c&&f.setMiterLimit(c(d)),u&&f.setOffset(u(d)),f}}function tme(i,e){let t="text-",n=fd(i,t+"value",e);if(!n)return null;let r=h2(i,t,e),s=h2(i,t+"background-",e),o=f2(i,t,e),a=f2(i,t+"background-",e),l=fd(i,t+"font",e),c=Uo(i,t+"max-angle",e),u=Uo(i,t+"offset-x",e),f=Uo(i,t+"offset-y",e),d=Tv(i,t+"overflow",e),A=fd(i,t+"placement",e),y=Uo(i,t+"repeat",e),w=A3(i,t+"scale",e),S=Tv(i,t+"rotate-with-view",e),T=Uo(i,t+"rotation",e),R=fd(i,t+"align",e),I=fd(i,t+"justify",e),P=fd(i,t+"baseline",e),F=Tv(i,t+"keep-upright",e),D=Y$(i,t+"padding",e),L=g3(i,t+"declutter-mode"),C=new Bp({declutterMode:L});return function(B){if(C.setText(n(B)),r&&C.setFill(r(B)),s&&C.setBackgroundFill(s(B)),o&&C.setStroke(o(B)),a&&C.setBackgroundStroke(a(B)),l&&C.setFont(l(B)),c&&C.setMaxAngle(c(B)),u&&C.setOffsetX(u(B)),f&&C.setOffsetY(f(B)),d&&C.setOverflow(d(B)),A){let k=A(B);if(k!=="point"&&k!=="line")throw new Error("Expected point or line for text-placement");C.setPlacement(k)}if(y&&C.setRepeat(y(B)),w&&C.setScale(w(B)),S&&C.setRotateWithView(S(B)),T&&C.setRotation(T(B)),R){let k=R(B);if(k!=="left"&&k!=="center"&&k!=="right"&&k!=="end"&&k!=="start")throw new Error("Expected left, right, center, start, or end for text-align");C.setTextAlign(k)}if(I){let k=I(B);if(k!=="left"&&k!=="right"&&k!=="center")throw new Error("Expected left, right, or center for text-justify");C.setJustify(k)}if(P){let k=P(B);if(k!=="bottom"&&k!=="top"&&k!=="middle"&&k!=="alphabetic"&&k!=="hanging")throw new Error("Expected bottom, top, middle, alphabetic, or hanging for text-baseline");C.setTextBaseline(k)}return D&&C.setPadding(D(B)),F&&C.setKeepUpright(F(B)),C}}function nme(i,e){return"icon-src"in i?ime(i,e):"shape-points"in i?rme(i,e):"circle-radius"in i?sme(i,e):null}function ime(i,e){let t="icon-",n=t+"src",r=Z$(i[n],n),s=p3(i,t+"anchor",e),o=A3(i,t+"scale",e),a=Uo(i,t+"opacity",e),l=p3(i,t+"displacement",e),c=Uo(i,t+"rotation",e),u=Tv(i,t+"rotate-with-view",e),f=j$(i,t+"anchor-origin"),d=X$(i,t+"anchor-x-units"),A=X$(i,t+"anchor-y-units"),y=dd(i,t+"color"),w,S=null;y!==void 0&&(Array.isArray(y)&&y.length>0&&typeof y[0]=="string"?S=m3(i,t+"color",e):w=K$(y,t+"color"));let T=lme(i,t+"cross-origin"),R=cme(i,t+"offset"),I=j$(i,t+"offset-origin"),P=m6(i,t+"width"),F=m6(i,t+"height"),D=ame(i,t+"size"),L=g3(i,t+"declutter-mode"),C={src:r,anchorOrigin:f,anchorXUnits:d,anchorYUnits:A,crossOrigin:T,offset:R,offsetOrigin:I,height:F,width:P,size:D,declutterMode:L},B=null;return function(k){if(B)S&&B.setColor(S(k));else{let z=S?S(k):w;B=new vA(z!==void 0?Object.assign({},C,{color:z}):Object.assign({},C))}return a&&B.setOpacity(a(k)),l&&B.setDisplacement(l(k)),c&&B.setRotation(c(k)),u&&B.setRotateWithView(u(k)),o&&B.setScale(o(k)),s&&B.setAnchor(s(k)),B}}function rme(i,e){let t="shape-",n=t+"points",r=t+"radius",s=A6(i[n],n);if(!(r in i))throw new Error(`Expected a number for ${r}`);let o=Uo(i,r,e),a=typeof i[r]=="number"?i[r]:5,l=t+"radius2",c=Uo(i,l,e),u=typeof i[l]=="number"?i[l]:void 0,f=h2(i,t,e),d=f2(i,t,e),A=A3(i,t+"scale",e),y=p3(i,t+"displacement",e),w=Uo(i,t+"rotation",e),S=Tv(i,t+"rotate-with-view",e),T=m6(i,t+"angle"),R=g3(i,t+"declutter-mode"),I=new zE({points:s,radius:a,radius2:u,angle:T,declutterMode:R});return function(P){return o&&I.setRadius(o(P)),c&&I.setRadius2(c(P)),f&&I.setFill(f(P)),d&&I.setStroke(d(P)),y&&I.setDisplacement(y(P)),w&&I.setRotation(w(P)),S&&I.setRotateWithView(S(P)),A&&I.setScale(A(P)),I}}function sme(i,e){let t="circle-",n=h2(i,t,e),r=f2(i,t,e),s=Uo(i,t+"radius",e),o=A3(i,t+"scale",e),a=p3(i,t+"displacement",e),l=Uo(i,t+"rotation",e),c=Tv(i,t+"rotate-with-view",e),u=g3(i,t+"declutter-mode"),f=new VE({radius:5,declutterMode:u});return function(d){return s&&f.setRadius(s(d)),n&&f.setFill(n(d)),r&&f.setStroke(r(d)),a&&f.setDisplacement(a(d)),l&&f.setRotation(l(d)),c&&f.setRotateWithView(c(d)),o&&f.setScale(o(d)),f}}function dd(i,e){if(!(e in i))return;let t=i[e];return t===void 0?void 0:t}function Uo(i,e,t){let n=dd(i,e);if(n===void 0)return;let r=Eu(n,ci,t);return function(s){return A6(r(s),e)}}function fd(i,e,t){let n=dd(i,e);if(n===void 0)return null;let r=Eu(n,sa,t);return function(s){return Z$(r(s),e)}}function ome(i,e,t){let n=fd(i,e+"pattern-src",t),r=W$(i,e+"pattern-offset",t),s=W$(i,e+"pattern-size",t),o=m3(i,e+"color",t);return function(a){return{src:n(a),offset:r&&r(a),size:s&&s(a),color:o&&o(a)}}}function Tv(i,e,t){let n=dd(i,e);if(n===void 0)return null;let r=Eu(n,ra,t);return function(s){let o=r(s);if(typeof o!="boolean")throw new Error(`Expected a boolean for ${e}`);return o}}function m3(i,e,t){let n=dd(i,e);if(n===void 0)return null;let r=Eu(n,La,t);return function(s){return K$(r(s),e)}}function Y$(i,e,t){let n=dd(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=Eu(o,ci,t);return function(c){return A6(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=Eu(n,hd,t);return function(s){return d2(r(s),e)}}function p3(i,e,t){let n=dd(i,e);if(n===void 0)return null;let r=Eu(n,hd,t);return function(s){let o=d2(r(s),e);if(o.length!==2)throw new Error(`Expected two numbers for ${e}`);return o}}function W$(i,e,t){let n=dd(i,e);if(n===void 0)return null;let r=Eu(n,hd,t);return function(s){return Q$(r(s),e)}}function A3(i,e,t){let n=dd(i,e);if(n===void 0)return null;let r=Eu(n,hd|ci,t);return function(s){return ume(r(s),e)}}function m6(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 ame(i,e){let t=i[e];if(t!==void 0){if(typeof t=="number")return cs(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 lme(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 j$(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 X$(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 cme(i,e){let t=i[e];if(t!==void 0)return d2(t,e)}function g3(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 d2(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 Z$(i,e){if(typeof i!="string")throw new Error(`Expected a string for ${e}`);return i}function A6(i,e){if(typeof i!="number")throw new Error(`Expected a number for ${e}`);return i}function K$(i,e){if(typeof i=="string")return i;let t=d2(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 Q$(i,e){let t=d2(i,e);if(t.length!==2)throw new Error(`Expected an array of two numbers for ${e}`);return t}function ume(i,e){return typeof i=="number"?i:Q$(i,e)}var J$={RENDER_ORDER:"renderOrder"},g6=class extends wA{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(J$.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 SA(9)),this.getRenderer().renderDeclutter(e,t)}setRenderOrder(e){this.set(J$.RENDER_ORDER,e)}setStyle(e){this.style_=e===void 0?s5:e;let t=hme(e);this.styleFunction_=e===null?void 0:RX(t),this.changed()}setDeclutter(e){this.declutter_=e?String(e):void 0,this.changed()}};function hme(i){if(i===void 0)return s5;if(!i)return null;if(typeof i=="function"||i instanceof Xr)return i;if(Array.isArray(i)&&i.length===0)return[];if(Array.isArray(i)&&i[0]instanceof Xr){let t=i.length,n=new Array(t);for(let r=0;r<t;++r){let s=i[r];if(!(s instanceof Xr))throw new Error("Expected a list of style instances");n[r]=s}return n}return $$(i)}var v3=g6;var v6=class extends Ao{constructor(e,t,n,r){super(e),this.inversePixelTransform=t,this.frameState=n,this.context=r}},_3=v6;var _6=class extends Mp{constructor(e){super(),this.map_=e}dispatchRenderEvent(e,t){ei()}calculateMatrices2D(e){let t=e.viewState,n=e.coordinateToPixelTransform,r=e.pixelToCoordinateTransform;No(n,e.size[0]/2,e.size[1]/2,1/t.resolution,-1/t.resolution,-t.rotation,-t.center[0],-t.center[1]),dE(r,n)}forEachFeatureAtCoordinate(e,t,n,r,s,o,a,l){let c,u=t.viewState;function f(P,F,D,L){return s.call(o,F,P?D:null,L)}let d=u.projection,A=YT(e.slice(),d),y=[[0,0]];if(d.canWrapX()&&r){let P=d.getExtent(),F=Kn(P);y.push([-F,0],[F,0])}let w=t.layerStatesArray,S=w.length,T=[],R=[];for(let P=0;P<y.length;P++)for(let F=S-1;F>=0;--F){let D=w[F],L=D.layer;if(L.hasRenderer()&&s2(D,u)&&a.call(l,L)){let C=L.getRenderer(),B=L.getSource();if(C&&B){let k=B.getWrapX()?A:e,z=f.bind(null,D.managed);R[0]=k[0]+y[P][0],R[1]=k[1]+y[P][1],c=C.forEachFeatureAtCoordinate(R,t,n,z,T)}if(c)return c}}if(T.length===0)return;let I=1/T.length;return T.forEach((P,F)=>P.distanceSq+=F*I),T.sort((P,F)=>P.distanceSq-F.distanceSq),T.some(P=>c=P.callback(P.feature,P.layer,P.geometry)),c}hasFeatureAtCoordinate(e,t,n,r,s,o){return this.forEachFeatureAtCoordinate(e,t,n,r,Jf,this,s,o)!==void 0}getMap(){return this.map_}renderFrame(e){ei()}scheduleExpireIconCache(e){na.canExpireCache()&&e.postRenderFunctions.push(fme)}};function fme(i,e){na.expire()}var eY=_6;var x6=class extends eY{constructor(e){super(e),this.fontChangeListenerKey_=qn(AA,xu.PROPERTYCHANGE,e.redrawText,e),this.element_=no?uE():document.createElement("div");let t=this.element_.style;t.position="absolute",t.width="100%",t.height="100%",t.zIndex="0",this.element_.className=Np+" 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 _3(e,void 0,t);n.dispatchEvent(r)}}disposeInternal(){li(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(Oo.PRECOMPOSE,e);let t=e.layerStatesArray.sort((u,f)=>u.zIndex-f.zIndex);t.some(u=>u.layer instanceof v3&&u.layer.getDeclutter())&&(e.declutter={});let r=e.viewState;this.children_.length=0;let o=this.getMap().getTargetElement(),a;Hl(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 d=t[u];e.layerIndex=u;let A=d.layer,y=A.getSourceState();if(!s2(d,r)||y!="ready"&&y!="undefined"){A.unrender();continue}let w=A.render(e,c);w&&(w!==c&&(this.children_.push(w),c=w),l.push(d))}this.declutter(e,l),Sj(this.element_,this.children_);for(let u of a?this.children_:[]){let f=u.firstElementChild||u,d=u.style.backgroundColor;if(d&&(!Hl(f)||f.width>0)&&(a.fillStyle=d,a.fillRect(0,0,a.canvas.width,a.canvas.height)),!Hl(f)||f.width===0)continue;a.save();let A=u.style.opacity||f.style.opacity;a.globalAlpha=A===""?1:Number(A);let y=f.style.transform;if(y)a.transform(...fE(y));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(Oo.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))}}},tY=x6;function nY(i){if(i instanceof wA){i.setMapInternal(null);return}i instanceof r2&&i.getLayers().forEach(nY)}function iY(i,e){if(i instanceof wA){i.setMapInternal(e);return}if(i instanceof r2){let t=i.getLayers().getArray();for(let n=0,r=t.length;n<r;++n)iY(t[n],e)}}var y6=class extends Us{constructor(e){super(),e=e||{},this.on,this.once,this.un;let t=dme(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:vj,this.postRenderTimeoutHandle_,this.animationDelayKey_,this.animationDelay_=this.animationDelay_.bind(this),this.coordinateToPixelTransform_=go(),this.pixelToCoordinateTransform_=go(),this.frameIndex_=0,this.frameState_=null,this.previousExtent_=null,this.viewPropertyListenerKey_=null,this.viewChangeListenerKey_=null,this.layerGroupPropertyListenerKeys_=null,no||(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,no||(this.resizeObserver_=new ResizeObserver(()=>this.updateSize())),this.controls=t.controls||(no?new Fo:KE()),this.interactions=t.interactions||(no?new Fo:i3({onFocusOnly:!0})),this.overlays_=t.overlays,this.overlayIdIndex_={},this.renderer_=null,this.postRenderFunctions_=[],this.tileQueue_=new h$(this.getTilePriority.bind(this),this.handleTileChange_.bind(this)),this.addChangeListener(Bo.LAYERGROUP,this.handleLayerGroupChanged_),this.addChangeListener(Bo.VIEW,this.handleViewChanged_),this.addChangeListener(Bo.SIZE,this.handleSizeChanged_),this.addChangeListener(Bo.TARGET,this.handleTargetChanged_),this.setProperties(t.values);let n=this;e.view&&!(e.view instanceof Xl)&&e.view.then(function(r){n.setView(new Xl(r))}),this.controls.addEventListener(vo.ADD,r=>{r.element.setMap(this)}),this.controls.addEventListener(vo.REMOVE,r=>{r.element.setMap(null)}),this.interactions.addEventListener(vo.ADD,r=>{r.element.setMap(this)}),this.interactions.addEventListener(vo.REMOVE,r=>{r.element.setMap(null)}),this.overlays_.addEventListener(vo.ADD,r=>{this.addOverlayInternal_(r.element)}),this.overlays_.addEventListener(vo.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){iY(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:Jf,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 r2?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:Jf,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(Bo.TARGET)}getTargetElement(){return this.targetElement_}getCoordinateFromPixel(e){return Ry(this.getCoordinateFromPixelInternal(e),this.getView().getProjection())}getCoordinateFromPixelInternal(e){let t=this.frameState_;return t?jr(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(Bo.LAYERGROUP)}setLayers(e){let t=this.getLayerGroup();if(e instanceof Fo){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=vu(e,this.getView().getProjection());return this.getPixelFromCoordinateInternal(t)}getPixelFromCoordinateInternal(e){let t=this.frameState_;return t?jr(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(Bo.SIZE)}getView(){return this.get(Bo.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 f$(this.frameState_,e,t,n,r)}handleBrowserEvent(e,t){t=t||e.type;let n=new _h(t,this,e);this.handleMapBrowserEvent(n)}handleMapBrowserEvent(e){if(!this.frameState_)return;let t=e.originalEvent,n=t.type;if(n===t2.POINTERDOWN||n===nn.WHEEL||n===nn.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[so.ANIMATING]||o[so.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(Oo.RENDERCOMPLETE)&&this.renderer_.dispatchRenderEvent(Oo.RENDERCOMPLETE,e),this.loaded_===!1&&(this.loaded_=!0,this.dispatchEvent(new Up(xh.LOADEND,this,e)))):this.loaded_===!0&&(this.loaded_=!1,this.dispatchEvent(new Up(xh.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)li(this.targetChangeHandlerKeys_[n]);this.targetChangeHandlerKeys_=null,this.viewport_.removeEventListener(nn.CONTEXTMENU,this.boundHandleBrowserEvent_),this.viewport_.removeEventListener(nn.WHEEL,this.boundHandleBrowserEvent_),this.mapBrowserEventHandler_.dispose(),this.mapBrowserEventHandler_=null,this.viewport_.remove()}if(this.targetElement_&&!Hl(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(Hl(t)||t.appendChild(this.viewport_),this.renderer_||(this.renderer_=new tY(this)),!Hl(t)){this.mapBrowserEventHandler_=new c$(this,this.moveTolerance_);for(let r in gr)this.mapBrowserEventHandler_.addEventListener(gr[r],this.handleMapBrowserEvent.bind(this));this.viewport_.addEventListener(nn.CONTEXTMENU,this.boundHandleBrowserEvent_,!1),this.viewport_.addEventListener(nn.WHEEL,this.boundHandleBrowserEvent_,cE?{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_=[qn(n,nn.KEYDOWN,this.handleBrowserEvent,this),qn(n,nn.KEYPRESS,this.handleBrowserEvent,this)],!Hl(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_&&(li(this.viewPropertyListenerKey_),this.viewPropertyListenerKey_=null),this.viewChangeListenerKey_&&(li(this.viewChangeListenerKey_),this.viewChangeListenerKey_=null);let e=this.getView();e&&(this.updateViewportSize_(this.getSize()),this.viewPropertyListenerKey_=qn(e,xu.PROPERTYCHANGE,this.handleViewPropertyChanged_,this),this.viewChangeListenerKey_=qn(e,nn.CHANGE,this.handleViewPropertyChanged_,this),e.resolveConstraints(0)),this.render()}handleLayerGroupChanged_(){this.layerGroupPropertyListenerKeys_&&(this.layerGroupPropertyListenerKeys_.forEach(li),this.layerGroupPropertyListenerKeys_=null);let e=this.getLayerGroup();e&&(this.handleLayerAdd_(new Su("addlayer",e)),this.layerGroupPropertyListenerKeys_=[qn(e,xu.PROPERTYCHANGE,this.render,this),qn(e,nn.CHANGE,this.render,this),qn(e,"addlayer",this.handleLayerAdd_,this),qn(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){nY(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&&WD(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:Ty(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:Bn(this),renderTargets:{}},a.nextCenter&&a.nextResolution){let l=isNaN(a.nextRotation)?a.rotation:a.nextRotation;s.nextExtent=Ty(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_||!hh(this.previousExtent_)&&!Km(s.extent,this.previousExtent_))&&(this.dispatchEvent(new Up(xh.MOVESTART,this,r)),this.previousExtent_=Zm(this.previousExtent_)),this.previousExtent_&&!s.viewHints[so.ANIMATING]&&!s.viewHints[so.INTERACTING]&&!Km(s.extent,this.previousExtent_)&&(this.dispatchEvent(new Up(xh.MOVEEND,this,s)),VT(s.extent,this.previousExtent_))),this.dispatchEvent(new Up(xh.POSTRENDER,this,s)),this.renderComplete_=(this.hasListener(xh.LOADSTART)||this.hasListener(xh.LOADEND)||this.hasListener(Oo.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 Su("removelayer",t)),this.set(Bo.LAYERGROUP,e)}setSize(e){this.set(Bo.SIZE,e)}setTarget(e){this.set(Bo.TARGET,e)}setView(e){if(!e||e instanceof Xl){this.set(Bo.VIEW,e);return}this.set(Bo.VIEW,new Xl);let t=this;e.then(function(n){t.setView(new Xl(n))})}updateSize(){let e=this.getTargetElement(),t;if(e){let r,s;if(Hl(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)],!WD(t)&&(e.offsetWidth||e.offsetHeight||e.getClientRects().length)&&jT("No map visible because the map container's width or height are 0."))}let n=this.getSize();t&&(!n||!ta(t,n))&&(this.updateViewportSize_(t),this.setSize(t))}updateViewportSize_(e){let t=this.getView();t&&t.setViewportSize(e)}};function dme(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 r2({layers:i.layers});t[Bo.LAYERGROUP]=n,t[Bo.TARGET]=i.target,t[Bo.VIEW]=i.view instanceof Xl?i.view:new Xl;let r;i.controls!==void 0&&(Array.isArray(i.controls)?r=new Fo(i.controls.slice()):(jn(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 Fo(i.interactions.slice()):(jn(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 Fo(i.overlays.slice()):(jn(typeof i.overlays.getArray=="function","Expected `overlays` to be an array or an `ol/Collection.js`"),o=i.overlays):o=new Fo,{controls:r,interactions:s,keyboardEventTarget:e,overlays:o,values:t}}var rY=y6;function x3(i){return i instanceof Image||i instanceof HTMLCanvasElement||i instanceof HTMLVideoElement||i instanceof ImageBitmap?i:null}var pme=new Error("disposed");var mme=[256,256],b6=class extends sv{constructor(e){let t=an.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=x3(this.data_);return e?[e.width,e.height]:mme}getData(){return this.data_}getError(){return this.error_}load(){if(this.state!==an.IDLE&&this.state!==an.ERROR)return;this.state=an.LOADING,this.changed();let e=this;this.loader_().then(function(t){e.data_=t,e.state=an.LOADED,e.changed()}).catch(function(t){e.error_=t,e.state=an.ERROR,e.changed()})}disposeInternal(){this.controller_&&(this.controller_.abort(pme),this.controller_=null),super.disposeInternal()}},w6=b6;var S6=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 Mp&&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 jn(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 jn(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){jn(!(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}},T6=S6;var E6=class{constructor(){this.instructions_=[],this.zIndex=0,this.offset_=0,this.pendingMethod_,this.context_=new Proxy(Ly(),{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}},y3=E6;var Ame=5,M6=class extends mE{constructor(e){super(),this.ready=!0,this.boundHandleImageChange_=this.handleImageChange_.bind(this),this.layer_=e,this.staleKeys_=new Array,this.maxStaleKeys=Ame,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 ei()}getData(e){return null}prepareFrame(e){return ei()}renderFrame(e,t){return ei()}forEachFeatureAtCoordinate(e,t,n,r,s){}getLayer(){return this.layer_}handleFontsChanged(){}handleImageChange_(e){let t=e.target;(t.getState()===Pn.LOADED||t.getState()===Pn.ERROR)&&this.renderIfReadyAndVisible()}loadImage(e){let t=e.getState();return t!=Pn.LOADED&&t!=Pn.ERROR&&e.addEventListener(nn.CHANGE,this.boundHandleImageChange_),t==Pn.IDLE&&(e.load(),t=e.getState()),t==Pn.LOADED}renderIfReadyAndVisible(){let e=this.getLayer();e&&e.getVisible()&&e.getSourceState()==="ready"&&e.changed()}renderDeferred(e){}disposeInternal(){delete this.layer_,super.disposeInternal()}},sY=M6;var R6=[],Ev=null;function gme(){Ev=Di(1,1,void 0,{willReadFrequently:!0})}var C6=class extends sY{constructor(e){super(e),this.container=null,this.renderedResolution,this.tempTransform=go(),this.pixelTransform=go(),this.inversePixelTransform=go(),this.context=null,this.deferredContext_=null,this.containerReused=!1,this.frameState=null}getImageData(e,t,n){Ev||gme(),Ev.clearRect(0,0,1,1);let r;try{Ev.drawImage(e,t,n,1,1,0,0,1,1),r=Ev.getImageData(0,0,1,1).data}catch{return Ev=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(Hl(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&&ta(Oc(e.style.backgroundColor),Oc(n)))){let c=e.firstElementChild;Hl(c)&&(l=c.getContext("2d"))}if(l&&Ij(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=no?uE():document.createElement("div"),a.className=o;let c=a.style;c.position="absolute",c.width="100%",c.height="100%",l=Di();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=Pc(n),s=j1(n),o=W1(n),a=H1(n);jr(t.coordinateToPixelTransform,r),jr(t.coordinateToPixelTransform,s),jr(t.coordinateToPixelTransform,o),jr(t.coordinateToPixelTransform,a);let l=this.inversePixelTransform;jr(l,r),jr(l,s),jr(l,o),jr(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(Kn(n)/r*o),l=Math.round(Nr(n)/r*o);No(this.pixelTransform,e.size[0]/2,e.size[1]/2,1/o,1/o,s,-a/2,-l/2),dE(this.inversePixelTransform,this.pixelTransform);let c=Pj(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 _3(e,this.inversePixelTransform,n,t);r.dispatchEvent(s)}}preRender(e,t){this.frameState=t,!t.declutter&&this.dispatchRenderEvent_(Oo.PRERENDER,e,t)}postRender(e,t){t.declutter||this.dispatchRenderEvent_(Oo.POSTRENDER,e,t)}renderDeferredInternal(e){}getRenderContext(e){return e.declutter&&!this.deferredContext_&&(this.deferredContext_=new y3),e.declutter?this.deferredContext_.getContext():this.context}renderDeferred(e){e.declutter&&(this.dispatchRenderEvent_(Oo.PRERENDER,this.context,e),e.declutter&&this.deferredContext_&&(this.deferredContext_.draw(this.context),this.deferredContext_.clear()),this.renderDeferredInternal(e),this.dispatchRenderEvent_(Oo.POSTRENDER,this.context,e))}getRenderTransform(e,t,n,r,s,o,a){let l=s/2,c=o/2,u=r/t,f=-u,d=-e[0]+a,A=-e[1];return No(this.tempTransform,l,c,u,f,-n,d,A)}disposeInternal(){delete this.frameState,super.disposeInternal()}},b3=C6;function P6(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 vme(i,e,t){let n=i[t];return n?n.delete(e):!1}function oY(i,e){let t=i.layerStatesArray[i.layerIndex];t.extent&&(e=uh(e,_u(t.extent,i.viewState.projection)));let n=t.layer.getRenderSource();if(!n.getWrapX()){let r=n.getTileGridForProjection(i.viewState.projection).getExtent();r&&(e=uh(e,r))}return e}var I6=class extends b3{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=Wr(),this.tempTileRange_=new rE(0,0,0,0),this.tempTileCoord_=tv(0,0,0);let n=t.cacheSize!==void 0?t.cacheSize:512;this.tileCache_=new T6(n),this.sourceTileCache_=null,this.layerExtent=null,this.maxStaleKeys=n*.5}getTileCache(){return this.tileCache_}getSourceTileCache(){return this.sourceTileCache_||(this.sourceTileCache_=new T6(512)),this.sourceTileCache_}getOrCreateTile(e,t,n,r){let s=this.tileCache_,a=this.getLayer().getSource(),l=nv(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||Q1(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=jr(t.pixelToCoordinateTransform,e.slice()),s=n.getExtent();if(s&&!du(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),d=this.getTile(u,f[1],f[2],t);if(!d||d.getState()!==an.LOADED)continue;let A=l.getOrigin(u),y=cs(l.getTileSize(u)),w=l.getResolution(u),S;if(d instanceof hE||d instanceof pE)S=d.getImage();else if(d instanceof w6){if(S=x3(d.getData()),!S)continue}else continue;let T=Math.floor(c*((r[0]-A[0])/w-f[1]*y[0])),R=Math.floor(c*((A[1]-r[1])/w-f[2]*y[1])),I=Math.round(c*a.getGutterForProjection(o.projection));return this.getImageData(S,T+I,R+I)}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=Bn(l);u in e.wantedTiles||(e.wantedTiles[u]={});let f=e.wantedTiles[u],d=a.getMapInternal(),A=Math.max(n-s,c.getMinZoom(),c.getZForResolution(Math.min(a.getMaxResolution(),d?d.getView().getResolutionForZoom(Math.max(a.getMinZoom(),0)):c.getResolution(0)),l.zDirection)),y=o.rotation,w=y?PD(o.center,o.resolution,y,e.size):void 0;for(let S=n;S>=A;--S){let T=c.getTileRangeForExtentAndZ(t,S,this.tempTileRange_),R=c.getResolution(S);for(let I=T.minX;I<=T.maxX;++I)for(let P=T.minY;P<=T.maxY;++P){if(y&&!c.tileCoordIntersectsViewport([S,I,P],w))continue;let F=this.getTile(S,I,P,e);if(!F||!P6(r,F,S))continue;let L=F.getKey();if(f[L]=!0,F.getState()===an.IDLE&&!e.tileQueue.isKeyQueued(L)){let C=tv(S,I,P,this.tempTileCoord_);e.tileQueue.enqueue([F,u,c.getTileCoordCenter(C),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=nv(this.getLayer().getSource(),a[l],r,s,o);if(n.containsKey(c)){let u=n.peek(c);if(u.getState()===an.LOADED)return u.endTransition(Bn(this)),P6(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 d=nv(l,c,n,u,f),A=!1;if(a.containsKey(d)){let y=a.peek(d);y.getState()===an.LOADED&&(P6(r,y,n),A=!0)}A||(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),d=f.getZForResolution(o,u.zDirection),A=f.getResolution(d);this.updateStaleKeys(u.getKey());let y=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?_u(n.extent,s):null,this.layerExtent&&(y=uh(y,this.layerExtent));let R=A*S/2/w,I=A*T/2/w,P=[a[0]-R,a[1]-I,a[0]+R,a[1]+I],F={};this.renderedTiles.length=0;let D=c.getPreload();if(e.nextExtent&&this.enqueueTilesForNextExtent()){let $=f.getZForResolution(r.nextResolution,u.zDirection),J=oY(e,e.nextExtent);this.enqueueTiles(e,J,$,F,D)}let L=oY(e,y);if(this.enqueueTiles(e,L,d,F,0),D>0&&setTimeout(()=>{this.enqueueTiles(e,L,d-1,F,D-1)},0),!(d in F))return this.container;let C=Bn(this),B=e.time;for(let $ of F[d]){let J=$.getState();if(J===an.EMPTY)continue;let te=$.tileCoord;if(J===an.LOADED&&$.getAlpha(C,B)===1){$.endTransition(C);continue}if(J!==an.ERROR&&(this.renderComplete=!1),this.findStaleTile_(te,F)){vme(F,$,d),e.animate=!0;continue}if(this.findAltTiles_(f,te,d+1,F))continue;let ve=f.getMinZoom();for(let Re=d-1;Re>=ve&&!this.findAltTiles_(f,te,Re,F);--Re);}let k=A/o*l/w,z=this.getRenderContext(e);No(this.tempTransform,S/2,T/2,k,k,0,-S/2,-T/2),this.layerExtent&&this.clipUnrotated(z,e,this.layerExtent),u.getInterpolate()||(z.imageSmoothingEnabled=!1),this.preRender(z,e);let G=Object.keys(F).map(Number);G.sort(pl);let W=[],Y=[],H=[];for(let $=G.length-1;$>=0;--$){let J=G[$],te=u.getTilePixelSize(J,l,s),he=f.getResolution(J)/A,ve=te[0]*he*k,Re=te[1]*he*k,Qe=f.getTileCoordForCoordAndZ(Pc(P),J),Fe=f.getTileCoordExtent(Qe),mt=jr(this.tempTransform,[w*(Fe[0]-P[0])/A,w*(P[3]-Fe[3])/A]),Ee=w*u.getGutterForProjection(s);for(let Ve of F[J]){if(Ve.getState()!==an.LOADED)continue;let Ye=Ve.tileCoord,Mt=Qe[1]-Ye[1],Et=Math.round(mt[0]-(Mt-1)*ve),Pt=Qe[2]-Ye[2],dn=Math.round(mt[1]-(Pt-1)*Re),Gt=Math.round(mt[0]-Mt*ve),$e=Math.round(mt[1]-Pt*Re),ot=Et-Gt,nt=dn-$e,bt=J===d;if(bt&&Ve.inTransition(C)){H.push({tile:Ve,x:Gt,y:$e,w:ot,h:nt,gutter:Ee}),this.renderedTiles.unshift(Ve),this.updateUsedTiles(e.usedTiles,u,Ve);continue}let yt=[Gt,$e,Gt+ot,$e+nt],hn=[];for(let tn=0,bn=W.length;tn<bn;++tn)J<Y[tn]&&Ar(yt,W[tn])&&hn.push(W[tn]);let en;hn.length>0&&(en=EW(yt,hn)),W.push(yt),Y.push(J),this.drawTile(Ve,e,Gt,$e,ot,nt,Ee,bt,en),this.renderedTiles.unshift(Ve),this.updateUsedTiles(e.usedTiles,u,Ve)}}for(let $=0,J=H.length;$<J;++$){let{tile:te,x:ce,y:he,w:ve,h:Re,gutter:Qe}=H[$];this.drawTile(te,e,ce,he,ve,Re,Qe,!0,void 0)}if(this.renderedResolution=A,this.extentChanged=!this.renderedExtent_||!Km(this.renderedExtent_,P),this.renderedExtent_=P,this.renderedPixelRatio=l,this.postRender(this.context,e),this.layerExtent&&z.restore(),z.imageSmoothingEnabled=!0,this.renderComplete){let $=(J,te)=>{let ce=Bn(u),he=te.wantedTiles[ce],ve=he?Object.keys(he).length:0;this.updateCacheSize(ve),this.tileCache_.expireCache(),this.sourceTileCache_?.expireCache()};e.postRenderFunctions.push($)}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 w6){if(u=x3(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),d=Bn(this),A=t.layerStatesArray[t.layerIndex],y=A.opacity*(l?e.getAlpha(d,t.time):1),w=y!==f.globalAlpha;w&&(f.save(),f.globalAlpha=y);let S=u.width-2*a,T=u.height-2*a;if(c){let R=S/s,I=T/o;for(let P=0,F=c.length;P<F;++P){let D=c[P],L=D[0],C=D[1],B=D[2]-D[0],k=D[3]-D[1];f.drawImage(u,a+(L-n)*R,a+(C-r)*I,B*R,k*I,L,C,B,k)}}else f.drawImage(u,a,a,S,T,n,r,s,o);w&&f.restore(),y!==A.opacity?t.animate=!0:l&&e.endTransition(d)}getImage(){let e=this.context;return e?e.canvas:null}getTileImage(e){return e.getImage()}updateUsedTiles(e,t,n){let r=Bn(t);r in e||(e[r]={}),e[r][n.getKey()]=!0}},aY=I6;var p2={PRELOAD:"preload",USE_INTERIM_TILES_ON_ERROR:"useInterimTilesOnError"};var L6=class extends wA{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(p2.PRELOAD)}setPreload(e){this.set(p2.PRELOAD,e)}getUseInterimTilesOnError(){return this.get(p2.USE_INTERIM_TILES_ON_ERROR)}setUseInterimTilesOnError(e){this.set(p2.USE_INTERIM_TILES_ON_ERROR,e)}getData(e){return super.getData(e)}},lY=L6;var D6=class extends lY{constructor(e){super(e)}createRenderer(){return new aY(this,{cacheSize:this.getCacheSize()})}},N6=D6;var F6=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){}},w3=F6;var m2={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},A2=[m2.FILL],wh=[m2.STROKE],pd=[m2.BEGIN_PATH],B6=[m2.CLOSE_PATH],vn=m2;var O6=class extends w3{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],du(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],d=this.tmpCoordinate_,A=!0,y,w,S;for(y=t+r;y<n;y+=r)d[0]=e[y],d[1]=e[y+1],S=zT(c,d),S!==w?(A&&(a[l++]=u,a[l++]=f,A=!1),a[l++]=d[0],a[l++]=d[1]):S===Bs.INTERSECTING?(a[l++]=d[0],a[l++]=d[1],A=!1):A=!0,u=d[0],f=d[1],w=S;return(s&&A||y===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,d,A;switch(o){case"MultiPolygon":c=e.getOrientedFlatCoordinates(),d=[];let y=e.getEndss();A=0;for(let w=0,S=y.length;w<S;++w){let T=[];A=this.drawCustomCoordinates_(c,A,y[w],a,T),d.push(T)}this.instructions.push([vn.CUSTOM,l,d,e,n,Oy,s]),this.hitDetectionInstructions.push([vn.CUSTOM,l,d,e,r||n,Oy,s]);break;case"Polygon":case"MultiLineString":f=[],c=o=="Polygon"?e.getOrientedFlatCoordinates():e.getFlatCoordinates(),A=this.drawCustomCoordinates_(c,0,e.getEnds(),a,f),this.instructions.push([vn.CUSTOM,l,f,e,n,Pp,s]),this.hitDetectionInstructions.push([vn.CUSTOM,l,f,e,r||n,Pp,s]);break;case"LineString":case"Circle":c=e.getFlatCoordinates(),u=this.appendFlatLineCoordinates(c,0,c.length,a,!1,!1),this.instructions.push([vn.CUSTOM,l,u,e,n,Bc,s]),this.hitDetectionInstructions.push([vn.CUSTOM,l,u,e,r||n,Bc,s]);break;case"MultiPoint":c=e.getFlatCoordinates(),u=this.appendFlatPointCoordinates(c,a),u>l&&(this.instructions.push([vn.CUSTOM,l,u,e,n,Bc,s]),this.hitDetectionInstructions.push([vn.CUSTOM,l,u,e,r||n,Bc,s]));break;case"Point":c=e.getFlatCoordinates(),this.coordinates.push(c[0],c[1]),u=this.coordinates.length,this.instructions.push([vn.CUSTOM,l,u,e,n,void 0,s]),this.hitDetectionInstructions.push([vn.CUSTOM,l,u,e,r||n,void 0,s]);break;default:}this.endGeometry(t)}beginGeometry(e,t,n){this.beginGeometryInstruction1_=[vn.BEGIN_GEOMETRY,t,0,e,n],this.instructions.push(this.beginGeometryInstruction1_),this.beginGeometryInstruction2_=[vn.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==vn.END_GEOMETRY?o=t:s==vn.BEGIN_GEOMETRY&&(r[2]=t,rj(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=gl(n||io)??void 0}else t.fillStyle=void 0;return t}strokeStyleToState(e,t={}){if(e){let n=e.getColor();t.strokeStyle=gl(n||ia);let r=e.getLineCap();t.lineCap=r!==void 0?r:gh;let s=e.getLineDash();t.lineDash=s?s.slice():vl;let o=e.getLineDashOffset();t.lineDashOffset=o||_l;let a=e.getLineJoin();t.lineJoin=a!==void 0?a:vh;let l=e.getWidth();t.lineWidth=l!==void 0?l:od;let c=e.getMiterLimit();t.miterLimit=c!==void 0?c:rd;let u=e.getOffset();t.strokeOffset=u??yX,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=[vn.SET_FILL_STYLE,t];return typeof t!="string"&&n.push(e.fillPatternScale),n}applyStroke(e){this.instructions.push(this.createStroke(e))}createStroke(e){return[vn.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&&!ta(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=[vn.END_GEOMETRY,e];this.instructions.push(t),this.hitDetectionInstructions.push(t)}getBufferedMaxExtent(){if(!this.bufferedMaxExtent_&&(this.bufferedMaxExtent_=VT(this.maxExtent),this.maxLineWidth>0)){let e=this.resolution*(this.maxLineWidth+1)/2;G1(this.bufferedMaxExtent_,e,this.bufferedMaxExtent_)}return this.bufferedMaxExtent_}},Sh=O6;var U6=class extends Sh{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&&!du(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([vn.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([vn.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||du(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([vn.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([vn.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}},cY=U6;var k6=class extends Sh{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([vn.MOVE_TO_LINE_TO,o,a,s*this.pixelRatio]),this.hitDetectionInstructions.push([vn.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([vn.SET_STROKE_STYLE,ia,r.lineWidth,r.lineCap,r.lineJoin,r.miterLimit,vl,_l],pd);let l=e.getFlatCoordinates(),c=e.getStride();this.drawFlatCoordinates_(l,0,l.length,c,a),this.hitDetectionInstructions.push(wh),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([vn.SET_STROKE_STYLE,ia,r.lineWidth,r.lineCap,r.lineJoin,r.miterLimit,vl,_l],pd);let l=e.getEnds(),c=e.getFlatCoordinates(),u=e.getStride(),f=0;for(let d=0,A=l.length;d<A;++d)f=this.drawFlatCoordinates_(c,f,l[d],u,a);this.hitDetectionInstructions.push(wh),this.endGeometry(t)}finish(){let e=this.state;return e.lastStroke!=null&&e.lastStroke!=this.coordinates.length&&this.instructions.push(wh),this.reverseHitDetectionInstructions(),this.state=null,super.finish()}applyStroke(e){e.lastStroke!=null&&e.lastStroke!=this.coordinates.length&&(this.instructions.push(wh),e.lastStroke=this.coordinates.length),e.lastStroke=0,super.applyStroke(e),this.instructions.push(pd)}},uY=k6;var z6=class extends Sh{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(pd),this.hitDetectionInstructions.push(pd);for(let u=0;u<c;++u){let f=n[u],d=this.coordinates.length,A=this.appendFlatLineCoordinates(e,t,f,r,!0,!l);this.instructions.push([vn.MOVE_TO_LINE_TO,d,A,s*this.pixelRatio,!0]),this.hitDetectionInstructions.push([vn.MOVE_TO_LINE_TO,d,A,s,!0]),l&&(this.instructions.push(B6),this.hitDetectionInstructions.push(B6)),t=f}return a&&(this.instructions.push(A2),this.hitDetectionInstructions.push(A2)),l&&(this.instructions.push(wh),this.hitDetectionInstructions.push(wh)),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([vn.SET_FILL_STYLE,io]),r.strokeStyle!==void 0&&this.hitDetectionInstructions.push([vn.SET_STROKE_STYLE,ia,r.lineWidth,r.lineCap,r.lineJoin,r.miterLimit,vl,_l]);let l=e.getFlatCoordinates(),c=e.getStride(),u=this.coordinates.length;this.appendFlatLineCoordinates(l,0,l.length,c,!1,!1);let f=[vn.CIRCLE,u,a];this.instructions.push(pd,f),this.hitDetectionInstructions.push(pd,f),r.fillStyle!==void 0&&(this.instructions.push(A2),this.hitDetectionInstructions.push(A2)),r.strokeStyle!==void 0&&(this.instructions.push(wh),this.hitDetectionInstructions.push(wh)),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([vn.SET_FILL_STYLE,io]),r.strokeStyle!==void 0&&this.hitDetectionInstructions.push([vn.SET_STROKE_STYLE,ia,r.lineWidth,r.lineCap,r.lineJoin,r.miterLimit,vl,_l]);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([vn.SET_FILL_STYLE,io]),r.strokeStyle!==void 0&&this.hitDetectionInstructions.push([vn.SET_STROKE_STYLE,ia,r.lineWidth,r.lineCap,r.lineJoin,r.miterLimit,vl,_l]);let l=e.getEndss(),c=e.getOrientedFlatCoordinates(),u=e.getStride(),f=0;for(let d=0,A=l.length;d<A;++d)f=this.drawFlatCoordinatess_(c,f,l[d],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]=Ip(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}},V6=z6;var G6=0,q6=1;function _me(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 d=(i-r)/l,A=(t-r)/l;if(d>A){let y=d;d=A,A=y}if(d>u&&(u=d),A<f&&(f=A),u>f)return!1}if(c===0){if(s<e||s>n)return!1}else{let d=(e-s)/c,A=(n-s)/c;if(d>A){let y=d;d=A,A=y}if(d>u&&(u=d),A<f&&(f=A),u>f)return!1}return G6=u,q6=f,!0}function hY(i,e,t,n){let r=n[0],s=n[1],o=n[2],a=n[3],l=[],c=[],u=!1,f,d,A=0;for(let y=0,w=e.length;y<w;++y){let S=e[y],T=i[A],R=i[A+1],I=!1;for(let P=A+t;P<S;P+=t){let F=i[P],D=i[P+1];if(_me(r,s,o,a,T,R,F,D)){let L=F-T,C=D-R,B=T+G6*L,k=R+G6*C,z=T+q6*L,G=R+q6*C;u&&I&&B===f&&k===d?l.push(z,G):(u&&c.push(l.length),l.push(B,k,z,G),u=!0),f=z,d=G,I=!0}T=F,R=D}A=S}return u&&c.push(l.length),{flatCoordinates:l,ends:c}}function fY(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],d=e[o+r+1],A=Math.sqrt((f-c)*(f-c)+(d-u)*(d-u));if(a+=A,a>=i){let y=(i-a+A)/A,w=Lo(c,f,y),S=Lo(u,d,y);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 y=A-a,w=Lo(c,f,y/A),S=Lo(u,d,y/A);l.push(w,S),s.push(l),l=[w,S],a=0,o+=r}}return a>0&&s.push(l),s}function dY(i,e,t,n,r){let s=t,o=t,a=0,l=0,c=t,u,f,d,A,y,w,S,T,R,I;for(f=t;f<n;f+=r){let P=e[f],F=e[f+1];y!==void 0&&(R=P-y,I=F-w,A=Math.sqrt(R*R+I*I),S!==void 0&&(l+=d,u=Math.acos((S*R+T*I)/(d*A)),u>i&&(l>a&&(a=l,s=c,o=f),l=0,c=f-r)),d=A,S=R,T=I),y=P,w=F}return l+=A,l>a?[c,f]:[s,o]}var g2={left:0,center:.5,right:1,top:0,middle:.5,hanging:.2,alphabetic:.8,ideographic:.8,bottom:1},H6=class extends Sh{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[io]={fillStyle:io},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 d=e.getExtent();if(!Ar(this.maxExtent,d))return;let A;if(u=e.getFlatCoordinates(),c=="LineString")A=[u.length];else if(c=="MultiLineString")A=e.getEnds();else if(c=="Polygon")A=e.getEnds().slice(0,1);else if(c=="MultiPolygon"){let T=e.getEndss();A=[];for(let R=0,I=T.length;R<I;++R)A.push(T[R][0])}if((c=="LineString"||c=="MultiLineString")&&!ch(this.getBufferedMaxExtent(),d)){let T=hY(u,A,f,this.getBufferedMaxExtent());if(u=T.flatCoordinates,A=T.ends,f=2,A.length===0)return}this.beginGeometry(e,t,n);let y=o.repeat,w=y?void 0:o.textAlign,S=0;for(let T=0,R=A.length;T<R;++T){let I;y?I=fY(y*this.resolution,u,S,A[T],f):I=[u.slice(S,A[T])];for(let P=0,F=I.length;P<F;++P){let D=I[P],L=0,C=D.length;if(w==null){let k=dY(o.maxAngle,D,0,D.length,2);L=k[0],C=k[1]}for(let k=L;k<C;k+=f)a.push(D[k],D[k+1]);let B=a.length;S=A[T],this.drawChars_(l,B),l=B}}this.endGeometry(t)}else{let d=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||d.push(u[2]/this.resolution),f=3;break;case"MultiPolygon":let P=e.getFlatInteriorPoints();u=[];for(let F=0,D=P.length;F<D;F+=3)o.overflow||d.push(P[F+2]/this.resolution),u.push(P[F],P[F+1]);if(u.length===0)return;f=2;break;default:}let A=this.appendFlatPointCoordinates(u,f);if(A===l)return;if(d&&(A-l)/2!==u.length/f){let P=l/2;d=d.filter((F,D)=>{let L=a[(P+D)*2]===u[D*f]&&a[(P+D)*2+1]===u[D*f+1];return L||--P,L})}this.saveTextStates_();let y=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!=sd&&(o.scale[0]<0||o.scale[1]<0)){let P=o.padding[0],F=o.padding[1],D=o.padding[2],L=o.padding[3];o.scale[0]<0&&(F=-F,L=-L),o.scale[1]<0&&(P=-P,D=-D),S=[P,F,D,L]}let T=this.pixelRatio;this.instructions.push([vn.DRAW_IMAGE,l,A,null,NaN,NaN,NaN,1,0,0,this.textRotateWithView_,this.textRotation_,[1,1],NaN,this.declutterMode_,this.declutterImageWithText_,S==sd?sd:S.map(function(P){return P*T}),y,w,this.text_,this.textKey_,this.strokeKey_,this.fillKey_,this.textOffsetX_,this.textOffsetY_,d]);let R=1/T,I=y?y.slice(0):null;I&&(I[1]=io),this.hitDetectionInstructions.push([vn.DRAW_IMAGE,l,A,null,NaN,NaN,NaN,1,0,0,this.textRotateWithView_,this.textRotation_,[R,R],NaN,this.declutterMode_,this.declutterImageWithText_,S,I,w,this.text_,this.textKey_,this.strokeKey_,this.fillKey_?io:this.fillKey_,this.textOffsetX_,this.textOffsetY_,d]),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||Fp,justify:t.justify,textBaseline:t.textBaseline||gA,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=g2[r.textBaseline],u=this.textOffsetX_*l,f=this.textOffsetY_*l,d=this.text_,A=n?n.lineWidth*Math.abs(r.scale[0])/2:0;this.instructions.push([vn.DRAW_CHARS,e,t,c,r.overflow,a,r.maxAngle,l,f,s,A*l,d,o,1,this.declutterMode_,this.textKeepUpright_,u]),this.hitDetectionInstructions.push([vn.DRAW_CHARS,e,t,c,r.overflow,a&&io,r.maxAngle,l,f,s,A*l,d,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=gl(o.getColor()||io)):(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()||gh,s.lineDash=w?w.slice():vl,s.lineDashOffset=S===void 0?_l:S,s.lineJoin=a.getLineJoin()||vh,s.lineWidth=T===void 0?od:T,s.miterLimit=R===void 0?rd:R,s.strokeStyle=gl(a.getColor()||ia)}n=this.textState_;let l=e.getFont()||UE;bX(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()||gA,n.backgroundFill=e.getBackgroundFill(),n.backgroundStroke=e.getBackgroundStroke(),n.padding=e.getPadding()||sd,n.scale=c===void 0?[1,1]:c;let u=e.getOffsetX(),f=e.getOffsetY(),d=e.getRotateWithView(),A=e.getKeepUpright(),y=e.getRotation();this.text_=e.getText()||"",this.textOffsetX_=u===void 0?0:u,this.textOffsetY_=f===void 0?0:f,this.textRotateWithView_=d===void 0?!1:d,this.textKeepUpright_=A===void 0?!0:A,this.textRotation_=y===void 0?0:y,this.strokeKey_=s?(typeof s.strokeStyle=="string"?s.strokeStyle:Bn(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:"|"+Bn(r.fillStyle):""}this.declutterMode_=e.getDeclutterMode(),this.declutterImageWithText_=t}},pY=H6;var xme={Circle:V6,Default:Sh,Image:cY,LineString:uY,Polygon:V6,Text:pY},W6=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=xme[t];s=new o(this.tolerance_,this.maxExtent_,this.resolution_,this.pixelRatio_),r[t]=s}return s}},mY=W6;function S3(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],d,A,y,w,S,T,R,I,P=0;for(let F=e;F<t;F+=n){y=d,w=A,S=void 0,T=void 0,F+n<t&&(S=i[F+n],T=i[F+n+1]),s&&F===e&&(y=u,w=f),s&&F===t-n&&(S=l,T=c),d=i[F],A=i[F+1],[R,I]=yme(d,A,y,w,S,T,r),o[P++]=R,o[P++]=I;for(let D=2;D<a;D++)o[P++]=i[F+D]}return o.length!=P&&(o.length=P),o}function yme(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 d=DW([i,e],[t,n],[r,s]);if(Math.cos(d)>.998)return[i+u*o,e+f*o];let A=Math.cos(d/2),y=Math.sin(d/2),w=y*a+A*l,S=-A*a+y*l,T=w*(1/y),R=S*(1/y);return[i+T*o,e+R*o]}function T3(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],d=i[o+1],A=i[o+e],y=i[o+e+1],w=(y-d)*(c-a)-(A-f)*(u-l);if(w===0)continue;let S=((A-f)*(l-d)-(y-d)*(a-f))/w,T=((c-a)*(l-d)-(u-l)*(a-f))/w;if(S>0&&S<1&&T>0&&T<1){let R=a+S*(c-a),I=l+S*(u-l);i[n+e]=R,i[n+e+1]=I,i.splice(n+2*e,o-n-e);break}}}return i}var j6;function bme(){return j6||(j6=new Intl.Segmenter(void 0,{granularity:"grapheme"})),j6}function AY(i,e,t,n,r,s,o,a,l,c,u,f,d=!0){let A=i[e],y=i[e+1],w=0,S=0,T=0,R=0;function I(){w=A,S=y,e+=n,A=i[e],y=i[e+1],R+=T,T=Math.sqrt((A-w)*(A-w)+(y-S)*(y-S))}do I();while(e<t-n&&R+T<s);let P=T===0?0:(s-R)/T,F=Lo(w,A,P),D=Lo(S,y,P),L=e-n,C=R,B=s+a*l(c,r,u);for(;e<t-n&&R+T<B;)I();P=T===0?0:(B-R)/T;let k=Lo(w,A,P),z=Lo(S,y,P),G=!1;if(d)if(f){let te=[F,D,k,z];xE(te,0,4,2,f,te,te),G=te[0]>te[2]}else G=F>k;let W=Math.PI,Y=[],H=L+n===e;e=L,T=0,R=C,A=i[e],y=i[e+1];let $;if(H){I(),$=Math.atan2(y-S,A-w),G&&($+=$>0?-W:W);let te=(k+F)/2,ce=(z+D)/2;return Y[0]=[te,ce,(B-s)/2,$,r],Y}r=r.replace(/\n/g," ");let J=Array.from(bme().segment(r),te=>te.segment);for(let te=0,ce=J.length;te<ce;){I();let he=Math.atan2(y-S,A-w);if(G&&(he+=he>0?-W:W),$!==void 0){let Ee=he-$;if(Ee+=Ee>W?-2*W:Ee<-W?2*W:0,Math.abs(Ee)>o)return null}$=he;let ve=te,Re=0;for(;te<ce;++te){let Ee=G?ce-te-1:te,Ve=a*l(c,J[Ee],u);if(e+n<t&&R+T<s+Re+Ve/2)break;Re+=Ve}if(te===ve)continue;let Qe=(G?J.slice(ce-te,ce-ve):J.slice(ve,te)).join("");P=T===0?0:(s+Re/2-R)/T;let Fe=Lo(w,A,P),mt=Lo(S,y,P);Y.push([Fe,mt,Re/2,he,Qe]),s+=Re}return Y}var Mv=Wr(),Gp=[],md=[],Ad=[],qp=[];function gY(i){return i[3].declutterBox}var vY=new RegExp("[\u0591-\u08FF\uFB1D-\uFDFF\uFE70-\uFEFC\u0800-\u0FFF\uE800-\uEFFF]");function X6(i,e){return e==="start"?e=vY.test(i)?"right":"left":e==="end"&&(e=vY.test(i)?"left":"right"),g2[e]}function wme(i,e,t){return t>0&&i.push(`8+`,""),i.push(e,""),i}function Sme(i,e,t){return t%2===0&&(i+=e),i}var $6=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_=go(),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 y3: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?g2[l.justify]:X6(Array.isArray(e)?e[0]:e,l.textAlign||Fp),d=r&&o.lineWidth?o.lineWidth:0,A=Array.isArray(e)?e:String(e).split(`9+`).reduce(wme,[]),{width:y,height:w,widths:S,heights:T,lineWidths:R}=TX(l,A),I=y+d,P=[],F=(I+2)*u[0],D=(w+d)*u[1],L={width:F<0?Math.floor(F):Math.ceil(F),height:D<0?Math.floor(D):Math.ceil(D),contextInstructions:P};(u[0]!=1||u[1]!=1)&&P.push("scale",u),r&&(P.push("strokeStyle",o.strokeStyle),P.push("lineWidth",d),P.push("lineCap",o.lineCap),P.push("lineJoin",o.lineJoin),P.push("miterLimit",o.miterLimit),P.push("setLineDash",[o.lineDash]),P.push("lineDashOffset",o.lineDashOffset)),n&&P.push("fillStyle",a.fillStyle),P.push("textBaseline","middle"),P.push("textAlign","center");let C=.5-f,B=f*I+C*d,k=[],z=[],G=0,W=0,Y=0,H=0,$;for(let J=0,te=A.length;J<te;J+=2){let ce=A[J];if(ce===`10+`){W+=G,G=0,B=f*I+C*d,++H;continue}let he=A[J+1]||l.font;he!==$&&(r&&k.push("font",he),n&&z.push("font",he),$=he),G=Math.max(G,T[Y]);let ve=[ce,B+C*S[Y]+f*(S[Y]-R[H]),.5*(d+G)+W];B+=S[Y],r&&k.push("strokeText",ve),n&&z.push("fillText",ve),++Y}return Array.prototype.push.apply(P,k),Array.prototype.push.apply(P,z),this.labels_[s]=L,L}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,d,A,y,w,S){a*=d[0],l*=d[1];let T=n-a,R=r-l,I=s+c>e?e-c:s,P=o+u>t?t-u:o,F=y[3]+I*d[0]+y[1],D=y[0]+P*d[1]+y[2],L=T-y[3],C=R-y[0];(w||f!==0)&&(Gp[0]=L,qp[0]=L,Gp[1]=C,md[1]=C,md[0]=L+F,Ad[0]=md[0],Ad[1]=C+D,qp[1]=Ad[1]);let B;return f!==0?(B=No(go(),n,r,1,1,f,-n,-r),jr(B,Gp),jr(B,md),jr(B,Ad),jr(B,qp),ql(Math.min(Gp[0],md[0],Ad[0],qp[0]),Math.min(Gp[1],md[1],Ad[1],qp[1]),Math.max(Gp[0],md[0],Ad[0],qp[0]),Math.max(Gp[1],md[1],Ad[1],qp[1]),Mv)):ql(Math.min(L,L+F),Math.min(C,C+D),Math.max(L,L+F),Math.max(C,C+D),Mv),A&&(T=Math.round(T),R=Math.round(R)),{drawImageX:T,drawImageY:R,drawImageW:I,drawImageH:P,originX:c,originY:u,declutterBox:{minX:Mv[0],minY:Mv[1],maxX:Mv[2],maxY:Mv[3],value:S},canvasTransform:B,scale:d}}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,Gp,md,Ad,qp,o,a),EX(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=jr(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=X6(Array.isArray(e)?e[0]:e,s.textAlign||Fp),u=g2[s.textBaseline||gA],f=a&&a.lineWidth?a.lineWidth:0,d=o.width/l-2*s.scale[0],A=c*d+2*(.5-c)*f,y=u*o.height/l+2*(.5-u)*f;return{label:o,anchorX:A,anchorY:y}}execute_(e,t,n,r,s,o,a,l){let c=this.zIndexContext_,u;this.pixelCoordinates_&&ta(n,this.renderedTransform_)?u=this.pixelCoordinates_:(this.pixelCoordinates_||(this.pixelCoordinates_=[]),u=ml(this.coordinates,0,this.coordinates.length,2,n,this.pixelCoordinates_),Rj(this.renderedTransform_,n));let f=0,d=r.length,A=0,y,w=[],S,T,R,I,P,F,D,L,C,B,k,z,G,W=0,Y=0,H=this.coordinateCache_,$=this.viewRotation_,J=Math.round(Math.atan2(-n[1],n[0])*1e12)/1e12,te={context:e,pixelRatio:this.pixelRatio,resolution:this.resolution,rotation:$},ce=this.instructions!=r||this.overlaps?0:200,he,ve,Re,Qe;for(;f<d;){let Fe=r[f];switch(Fe[0]){case vn.BEGIN_GEOMETRY:he=Fe[1],Qe=Fe[3],he.getGeometry()?a!==void 0&&!Ar(a,Qe.getExtent())?f=Fe[2]+1:++f:f=Fe[2],c&&(c.zIndex=Fe[4]);break;case vn.BEGIN_PATH:W>ce&&(this.fill_(e),W=0),Y>ce&&(e.stroke(),Y=0),!W&&!Y&&(e.beginPath(),P=NaN,F=NaN),++f;break;case vn.CIRCLE:A=Fe[1],R=Fe[2]??0;let Ee=u[A],Ve=u[A+1],Ye=u[A+2]-R,Mt=u[A+3]-R,Et=Ye-Ee,Pt=Mt-Ve,dn=Math.sqrt(Et*Et+Pt*Pt);e.moveTo(Ee+dn,Ve),e.arc(Ee,Ve,dn,0,2*Math.PI,!0),++f;break;case vn.CLOSE_PATH:e.closePath(),++f;break;case vn.CUSTOM:A=Fe[1],y=Fe[2];let Gt=Fe[3],$e=Fe[4],ot=Fe[5];te.geometry=Gt,te.feature=he,f in H||(H[f]=[]);let nt=H[f];ot?ot(u,A,y,2,nt):(nt[0]=u[A],nt[1]=u[A+1],nt.length=2),c&&(c.zIndex=Fe[6]),$e(nt,te),++f;break;case vn.DRAW_IMAGE:A=Fe[1],y=Fe[2],C=Fe[3],S=Fe[4],T=Fe[5];let bt=Fe[6],yt=Fe[7],hn=Fe[8],en=Fe[9],tn=Fe[10],bn=Fe[11],_e=Fe[12],vi=Fe[13];I=Fe[14]||"declutter";let zn=Fe[15];if(!C&&Fe.length>=20){B=Fe[19],k=Fe[20],z=Fe[21],G=Fe[22];let Fn=this.drawLabelWithPointPlacement_(B,k,z,G);C=Fn.label,Fe[3]=C;let rs=Fe[23];S=(Fn.anchorX-rs)*this.pixelRatio,Fe[4]=S;let Lr=Fe[24];T=(Fn.anchorY-Lr)*this.pixelRatio,Fe[5]=T,bt=C.height,Fe[6]=bt,vi=C.width,Fe[13]=vi}let le;Fe.length>25&&(le=Fe[25]);let Z,Te,Ie;Fe.length>17?(Z=Fe[16],Te=Fe[17],Ie=Fe[18]):(Z=sd,Te=null,Ie=null),tn&&J?bn+=$:!tn&&!J&&(bn-=$);let Ge=0;for(;A<y;A+=2){if(le&&le[Ge++]<vi/this.pixelRatio)continue;let Fn=this.calculateImageOrLabelDimensions_(C.width,C.height,u[A],u[A+1],vi,bt,S,T,hn,en,bn,_e,s,Z,!!Te||!!Ie,he),rs=[e,t,C,Fn,yt,Te,Ie];if(l){let Lr,Fl,Sa;if(zn){let xr=y-A;if(!zn[xr]){zn[xr]={args:rs,declutterMode:I};continue}let Zs=zn[xr];Lr=Zs.args,Fl=Zs.declutterMode,delete zn[xr],Sa=gY(Lr)}let Bl,rl;if(Lr&&(Fl!=="declutter"||!l.collides(Sa))&&(Bl=!0),(I!=="declutter"||!l.collides(Fn.declutterBox))&&(rl=!0),Fl==="declutter"&&I==="declutter"){let xr=Bl&&rl;Bl=xr,rl=xr}Bl&&(Fl!=="none"&&l.insert(Sa),this.replayImageOrLabel_.apply(this,Lr)),rl&&(I!=="none"&&l.insert(Fn.declutterBox),this.replayImageOrLabel_.apply(this,rs))}else this.replayImageOrLabel_.apply(this,rs)}++f;break;case vn.DRAW_CHARS:let vt=Fe[1],Tt=Fe[2],qe=Fe[3],Je=Fe[4];G=Fe[5];let It=Fe[6],rn=Fe[7],Lt=Fe[8];z=Fe[9];let Rt=Fe[10];B=Fe[11],Array.isArray(B)&&(B=B.reduce(Sme,"")),k=Fe[12];let fn=[Fe[13],Fe[13]];I=Fe[14]||"declutter";let wn=Fe[15],Dn=Fe[16],ye=this.textStates[k],wt=ye.font,Ze=[ye.scale[0]*rn,ye.scale[1]*rn],St;wt in this.widths_?St=this.widths_[wt]:(St={},this.widths_[wt]=St);let Bt=dv(u,vt,Tt,2),ut=Math.abs(Ze[0])*KN(wt,B,St);if(Je||ut<=Bt){let Fn=this.textStates[k].textAlign,rs=(Bt-ut)*X6(B,Fn),Lr=AY(u,vt,Tt,2,B,rs,It,Math.abs(Ze[0]),KN,wt,St,J?0:this.viewRotation_,wn);e:if(Lr){let Fl=[],Sa,Bl,rl,xr,Zs;if(z)for(Sa=0,Bl=Lr.length;Sa<Bl;++Sa){Zs=Lr[Sa],rl=Zs[4],xr=this.createLabel(rl,k,"",z),S=Zs[2]+(Ze[0]<0?-Rt:Rt)-Dn,T=qe*xr.height+(.5-qe)*2*Rt*Ze[1]/Ze[0]-Lt;let Ol=this.calculateImageOrLabelDimensions_(xr.width,xr.height,Zs[0],Zs[1],xr.width,xr.height,S,T,0,0,Zs[3],fn,!1,sd,!1,he);if(l&&I==="declutter"&&l.collides(Ol.declutterBox))break e;Fl.push([e,t,xr,Ol,1,null,null])}if(G)for(Sa=0,Bl=Lr.length;Sa<Bl;++Sa){Zs=Lr[Sa],rl=Zs[4],xr=this.createLabel(rl,k,G,""),S=Zs[2]-Dn,T=qe*xr.height-Lt;let Ol=this.calculateImageOrLabelDimensions_(xr.width,xr.height,Zs[0],Zs[1],xr.width,xr.height,S,T,0,0,Zs[3],fn,!1,sd,!1,he);if(l&&I==="declutter"&&l.collides(Ol.declutterBox))break e;Fl.push([e,t,xr,Ol,1,null,null])}l&&I!=="none"&&l.load(Fl.map(gY));for(let Ol=0,nh=Fl.length;Ol<nh;++Ol)this.replayImageOrLabel_.apply(this,Fl[Ol])}}++f;break;case vn.END_GEOMETRY:if(o!==void 0){he=Fe[1];let Fn=o(he,Qe,I);if(Fn)return Fn}++f;break;case vn.FILL:ce?W++:this.fill_(e),++f;break;case vn.MOVE_TO_LINE_TO:A=Fe[1],y=Fe[2],R=Fe[3];let Ce,Yt,nr;if(R){let rs=(Fe[4]??!1)||Math.abs(u[A]-u[y-2])<1e-6&&Math.abs(u[A+1]-u[y-1])<1e-6;S3(u,A,y,2,R,rs,w),T3(w,2,rs),Ce=w,Yt=0,nr=Ce.length}else Ce=u,Yt=A,nr=y;ve=Ce[Yt],Re=Ce[Yt+1],e.moveTo(ve,Re),P=ve+.5|0,F=Re+.5|0;for(let Fn=Yt+2;Fn<nr;Fn+=2)ve=Ce[Fn],Re=Ce[Fn+1],D=ve+.5|0,L=Re+.5|0,(Fn==nr-2||D!==P||L!==F)&&(e.lineTo(ve,Re),P=D,F=L);++f;break;case vn.SET_FILL_STYLE:this.alignAndScaleFill_=Fe[2],W?(this.fill_(e),W=0,Y&&(e.stroke(),Y=0)):Y&&Fe[1]&&(e.stroke(),Y=0),e.fillStyle=Fe[1],++f;break;case vn.SET_STROKE_STYLE:W&&Fe[1]&&(this.fill_(e),W=0),Y&&(e.stroke(),Y=0),this.setStrokeStyle_(e,Fe),++f;break;case vn.STROKE:ce?Y++:e.stroke(),++f;break;default:++f;break}}W&&this.fill_(e),Y&&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)}},_Y=$6;var Hp=["Polygon","Circle","LineString","Image","Text","Default"],K6=["Image","Text"],xY=Hp.filter(i=>!K6.includes(i)),yY=!1,bY=!1;function Tme(){let i=0,e=n=>{let r=Di(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};yY={[e(!0)]:!0,[e(!1)]:!1,[e(void 0)]:void 0}[i],bY=!0}var Z6=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_=go(),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 _Y(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){bY===!1&&Tme(),r=Math.round(r);let a=r*2+1,l=No(this.hitDetectionTransform_,r+.5,r+.5,1/t,-1/t,-n,-e[0],-e[1]),c=!this.hitDetectionContext_;c&&(this.hitDetectionContext_=Di(a,a,null,{willReadFrequently:yY}));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=Wr(),Qm(f,e),G1(f,t*(this.renderBuffer_+r),f));let d=Eme(r),A;function y(F,D,L){let C=u.getImageData(0,0,a,a).data;for(let B=0,k=d.length;B<k;B++)if(C[d[B]]>0){if(!o||L==="none"||A!=="Image"&&A!=="Text"||o.includes(F)){let z=(d[B]-3)/4,G=r-z%a,W=r-(z/a|0),Y=s(F,D,G*G+W*W);if(Y)return Y}u.clearRect(0,0,a,a);break}}let w=Object.keys(this.executorsByZIndex_).map(Number);w.sort(pl);let S,T,R,I,P;for(S=w.length-1;S>=0;--S){let F=w[S].toString();for(R=this.executorsByZIndex_[F],T=Hp.length-1;T>=0;--T)if(A=Hp[T],I=R[A],I!==void 0&&(P=I.executeHitDetection(u,l,n,y,f),P))return P}}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 ml(a,0,8,2,e,a),a}isEmpty(){return Au(this.executorsByZIndex_)}execute(e,t,n,r,s,o,a){let l=Object.keys(this.executorsByZIndex_).map(Number);l.sort(a?ij:pl),o=o||Hp;let c=Hp.length;for(let u=0,f=l.length;u<f;++u){let d=l[u].toString(),A=this.executorsByZIndex_[d];for(let y=0,w=o.length;y<w;++y){let S=o[y],T=A[S];if(T!==void 0){let R=a===null?void 0:T.getZIndexContext(),I=R?R.getContext():e,P=this.maxExtent_&&S!=="Image"&&S!=="Text";if(P&&(I.save(),this.clip(I,n)),!R||S==="Text"||S==="Image"?T.execute(I,t,n,r,s,a):R.pushFunction(F=>T.execute(F,t,n,r,s,a)),P&&I.restore(),R){R.offset();let F=l[u]*c+Hp.indexOf(S);this.deferredZIndexContexts_[F]||(this.deferredZIndexContexts_[F]=[]),this.deferredZIndexContexts_[F].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(pl);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}},Y6={};function Eme(i){if(Y6[i]!==void 0)return Y6[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 Y6[i]=r,r}var wY=Z6;var Q6=class extends w3{constructor(e,t,n,r,s,o,a){super(),this.context_=e,this.pixelRatio_=t,this.extent_=n,this.transform_=r,this.transformRotation_=r?Jm(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_=go()}drawImages_(e,t,n,r){if(!this.image_)return;let s=ml(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 d=s[u]-this.imageAnchorX_,A=s[u+1]-this.imageAnchorY_;if(c!==0||this.imageScale_[0]!=1||this.imageScale_[1]!=1){let y=d+this.imageAnchorX_,w=A+this.imageAnchorY_;No(a,y,w,1,1,c,-y,-w),o.save(),o.transform.apply(o,a),o.translate(y,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_,d,A,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=ml(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=ml(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=S3(l,0,u,2,o,f,l),T3(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_)),!!Ar(this.extent_,e.getExtent())){if(this.fillState_||this.strokeState_){this.fillState_&&this.setContextFillState_(this.fillState_),this.strokeState_&&this.setContextStrokeState_(this.strokeState_);let t=Yj(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_)),!!Ar(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(Ar(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_)),!!Ar(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_)),!!Ar(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),ta(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:Fp;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:gl(n||io)}}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||vl,f=t.getOffset();this.strokeState_={lineCap:r!==void 0?r:gh,lineDash:this.pixelRatio_===1?u:u.map(d=>d*this.pixelRatio_),lineDashOffset:(o||_l)*this.pixelRatio_,lineJoin:a!==void 0?a:vh,lineWidth:(l!==void 0?l:od)*this.pixelRatio_,miterLimit:c!==void 0?c:rd,strokeStyle:gl(n||ia),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 A=t.getColor();this.textFillState_={fillStyle:gl(A||io)}}let n=e.getStroke();if(!n)this.textStrokeState_=null;else{let A=n.getColor(),y=n.getLineCap(),w=n.getLineDash(),S=n.getLineDashOffset(),T=n.getLineJoin(),R=n.getWidth(),I=n.getMiterLimit();this.textStrokeState_={lineCap:y!==void 0?y:gh,lineDash:w||vl,lineDashOffset:S||_l,lineJoin:T!==void 0?T:vh,lineWidth:R!==void 0?R:od,miterLimit:I!==void 0?I:rd,strokeStyle:gl(A||ia)}}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(),d=e.getTextBaseline();this.textState_={font:r!==void 0?r:UE,textAlign:f!==void 0?f:Fp,textBaseline:d!==void 0?d:gA},this.text_=u!==void 0?Array.isArray(u)?u.reduce((A,y,w)=>A+=w%2?" ":y,""):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]]}}},SY=Q6;var Mu=.5;function TY(i,e,t,n,r,s,o,a,l){let c=l?Sp(r,l):r,u=i[0]*Mu,f=i[1]*Mu,d=Di(u,f);d.imageSmoothingEnabled=!1;let A=d.canvas,y=new SY(d,Mu,r,null,o,a,l?nA(rA(),l):null),w=t.length,S=Math.floor((256*256*256-1)/w),T={};for(let I=1;I<=w;++I){let P=t[I-1],F=P.getStyleFunction()||n;if(!F)continue;let D=F(P,s);if(!D)continue;Array.isArray(D)||(D=[D]);let C=(I*S).toString(16).padStart(7,"#00000");for(let B=0,k=D.length;B<k;++B){let z=D[B],G=z.getGeometryFunction()(P);if(!G||!Ar(c,G.getExtent()))continue;let W=z.clone(),Y=W.getFill();Y&&Y.setColor(C);let H=W.getStroke();H&&(H.setColor(C),H.setLineDash(null)),W.setText(void 0);let $=z.getImage();if($){let he=$.getImageSize();if(!he)continue;let ve=Di(he[0],he[1],void 0,{alpha:!1}),Re=ve.canvas;ve.fillStyle=C,ve.fillRect(0,0,Re.width,Re.height),W.setImage(new vA({img:Re,anchor:$.getAnchor(),anchorXUnits:"pixels",anchorYUnits:"pixels",offset:$.getOrigin(),opacity:1,size:$.getSize(),scale:$.getScale(),rotation:$.getRotation(),rotateWithView:$.getRotateWithView()}))}let J=W.getZIndex()||0,te=T[J];te||(te={},T[J]=te,te.Polygon=[],te.Circle=[],te.LineString=[],te.Point=[]);let ce=G.getType();if(ce==="GeometryCollection"){let he=G.getGeometriesArrayRecursive();for(let ve=0,Re=he.length;ve<Re;++ve){let Qe=he[ve];te[Qe.getType().replace("Multi","")].push(Qe,W)}}else te[ce.replace("Multi","")].push(G,W)}}let R=Object.keys(T).map(Number).sort(pl);for(let I=0,P=R.length;I<P;++I){let F=T[R[I]];for(let D in F){let L=F[D];for(let C=0,B=L.length;C<B;C+=2){y.setStyle(L[C+1]);for(let k=0,z=e.length;k<z;++k)y.setTransform(e[k]),y.drawGeometry(L[C])}}}return d.getImageData(0,0,A.width,A.height)}function EY(i,e,t){let n=[];if(t){let r=Math.floor(Math.round(i[0])*Mu),s=Math.floor(Math.round(i[1])*Mu),o=(Si(r,0,t.width-1)+Si(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 Mme=.5,MY={Point:Nme,LineString:Ime,Polygon:Bme,MultiPoint:Fme,MultiLineString:Lme,MultiPolygon:Dme,GeometryCollection:Pme,Circle:Cme};function CY(i,e){return parseInt(Bn(i),10)-parseInt(Bn(e),10)}function J6(i,e){let t=e8(i,e);return t*t}function e8(i,e){return Mme*i/e}function Cme(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 t8(i,e,t,n,r,s,o,a){let l=[],c=t.getImage();if(c){let d=!0,A=c.getImageState();A==Pn.LOADED||A==Pn.ERROR?d=!1:A==Pn.IDLE&&c.load(),d&&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)),Rme(i,e,t,n,s,o,a),f}function Rme(i,e,t,n,r,s,o){let a=t.getGeometryFunction()(e);if(!a)return;let l=a.simplifyTransformed(n,r);if(t.getRenderer())RY(i,l,t,e,o);else{let u=MY[l.getType()];u(i,l,t,e,o,s)}}function RY(i,e,t,n,r){if(e.getType()=="GeometryCollection"){let o=e.getGeometries();for(let a=0,l=o.length;a<l;++a)RY(i,o[a],t,n,r);return}i.getBuilder(t.getZIndex(),"Default").drawCustom(e,n,t.getRenderer(),t.getHitDetectionRenderer(),r)}function Pme(i,e,t,n,r,s){let o=e.getGeometriesArray(),a,l;for(a=0,l=o.length;a<l;++a){let c=MY[o[a].getType()];c(i,o[a],t,n,r,s)}}function Ime(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 Lme(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 Dme(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 Nme(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()!=Pn.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 Fme(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()!=Pn.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 Bme(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 n8=class extends b3{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_=Wr(),this.wrappedRenderedExtent_=Wr(),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(),d=this.getLayer().getDeclutter(),A=t.pixelRatio,y=t.viewHints,w=!(y[so.ANIMATING]||y[so.INTERACTING]),S=this.context,T=Math.round(Kn(r)/a*A),R=Math.round(Nr(r)/a*A),I=f.getWrapX()&&l.canWrapX(),P=I?Kn(u):null,F=I?Math.ceil((r[2]-u[2])/P)+(this.extendX_?2:1):1,D=I?Math.floor((r[0]-u[0])/P)-(this.extendX_?1:0):0;do{let L=this.getRenderTransform(o,a,0,A,T,R,D*P);t.declutter&&(L=L.slice(0)),e.execute(S,[S.canvas.width,S.canvas.height],L,c,w,n===void 0?Hp:n?K6:xY,n?d&&t.declutter[d]:void 0)}while(++D<F)}setDrawContext_(){this.opacity_!==1&&(this.targetContext_=this.context,this.context=Di(this.context.canvas.width,this.context.canvas.height,R6))}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,lA(this.context),R6.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(Oo.PRERENDER)||this.getLayer().hasListener(Oo.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=_u(n.extent,l);a=Ar(u,e.extent),a&&!ch(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]*Mu,d=n[1]*Mu;u.push(this.getRenderTransform(r,s,o,Mu,f,d,0).slice());let A=c.getSource(),y=a.getExtent();if(A.getWrapX()&&a.canWrapX()&&!ch(y,l)){let S=l[0],T=Kn(y),R=0,I;for(;S<y[0];)--R,I=T*R,u.push(this.getRenderTransform(r,s,o,Mu,f,d,I).slice()),S+=T;for(R=0,S=l[2];S>y[2];)++R,I=T*R,u.push(this.getRenderTransform(r,s,o,Mu,f,d,I).slice()),S-=T}let w=rA();this.hitDetectionImageData_=TY(n,u,this.renderedFeatures_,c.getStyleFunction(),l,s,o,J6(s,this.renderedPixelRatio_),w?a:null)}t(EY(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(d,A,y){let w=Bn(d),S=c[w];if(S){if(S!==!0&&y<S.distanceSq){if(y===0)return c[w]=!0,s.splice(s.lastIndexOf(S),1),r(d,l,A);S.geometry=A,S.distanceSq=y}}else{if(y===0)return c[w]=!0,r(d,l,A);s.push(c[w]={feature:d,layer:l,geometry:A,distanceSq:y,callback:r})}},f=this.getLayer().getDeclutter();return this.replayGroup_.forEachFeatureAtCoordinate(e,o,a,n,u,f?t.declutter?.[f]?.all().map(d=>d.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[so.ANIMATING],s=e.viewHints[so.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,d=e.pixelRatio,A=t.getRevision(),y=t.getRenderBuffer(),w=t.getRenderOrder();w===void 0&&(w=CY);let S=c.center.slice(),T=G1(l,y*f),R=T.slice(),I=[T.slice()],P=u.getExtent(),F=n.getWrapX()&&u.canWrapX();if(this.extendX_=!1,F){let $=n.getExtent();$&&!hh($)&&(this.extendX_=$[0]<P[0]||$[2]>P[2])}if(F&&(!ch(P,e.extent)||this.extendX_)){let $=Kn(P),J=Math.max(Kn(T)/2,$),te=P[0],ce=P[2];this.extendX_&&(te-=$,ce+=$),T[0]=te-J,T[2]=ce+J,YT(S,u);let he=LD(I[0],u);he[0]<P[0]&&he[2]<P[2]?I.push([he[0]+$,he[1],he[2]+$,he[3]]):he[0]>P[0]&&he[2]>P[2]&&I.push([he[0]-$,he[1],he[2]-$,he[3]])}if(this.ready&&this.renderedResolution_==f&&this.renderedPixelRatio_===d&&this.renderedRevision_==A&&this.renderedRenderOrder_==w&&this.renderedFrameDeclutter_===!!e.declutter&&ch(this.wrappedRenderedExtent_,T))return ta(this.renderedExtent_,R)||(this.hitDetectionImageData_=null,this.renderedExtent_=R),this.renderedCenter_=S,this.replayGroupChanged=!1,!0;this.replayGroup_=null;let D=new mY(e8(f,d),T,f,d),L=rA(),C;if(L){for(let $=0,J=I.length;$<J;++$){let te=I[$],ce=Sp(te,u);n.loadFeatures(ce,ej(f,u),L)}C=nA(L,u)}else for(let $=0,J=I.length;$<J;++$)n.loadFeatures(I[$],f,u);let B=J6(f,d),k=!0,z=($,J)=>{let te,ce=$.getStyleFunction()||t.getStyleFunction();if(ce&&(te=ce($,f)),te){let he=this.renderFeature($,B,te,D,C,this.getLayer().getDeclutter(),J);k=k&&!he}},G=Sp(T,u),W=n.getFeaturesInExtent(G);w&&W.sort(w);for(let $=0,J=W.length;$<J;++$)z(W[$],$);this.renderedFeatures_=W,this.ready=k;let Y=D.finish(),H=new wY(T,f,d,n.getOverlaps(),Y,t.getRenderBuffer(),!!e.declutter);return this.renderedResolution_=f,this.renderedRevision_=A,this.renderedRenderOrder_=w,this.renderedFrameDeclutter_=!!e.declutter,this.renderedExtent_=R,this.wrappedRenderedExtent_=T,this.renderedCenter_=S,this.renderedProjection_=u,this.renderedPixelRatio_=d,this.replayGroup_=H,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=t8(r,e,n[c],t,this.boundHandleStyleImageChange_,s,o,a)||l;else l=t8(r,e,n,t,this.boundHandleStyleImageChange_,s,o,a);return l}},PY=n8;var i8=class extends v3{constructor(e){super(e)}createRenderer(){return new PY(this)}},IY=i8;var Ome=!1;function Ume(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=Ome,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 r8(i,e){return function(t,n,r,s,o){Ume(i,e,t,n,r,(a,l)=>{this.addFeatures(a),s!==void 0&&s(a)},()=>{this.changed(),o!==void 0&&o()})}}function LY(i,e){return[[-1/0,-1/0,1/0,1/0]]}var DY=go(),v2=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"?GT(this.flatCoordinates_):q1(this.flatCoordinates_,0,this.flatCoordinates_.length,this.stride_)),this.extent_}getFlatInteriorPoint(){if(!this.flatInteriorPoints_){let e=dl(this.getExtent());this.flatInteriorPoints_=qy(this.flatCoordinates_,0,this.ends_,this.stride_,e,0)}return this.flatInteriorPoints_}getFlatInteriorPoints(){if(!this.flatInteriorPoints_){let e=cX(this.flatCoordinates_,this.ends_),t=CE(this.flatCoordinates_,0,e,this.stride_);this.flatInteriorPoints_=TE(this.flatCoordinates_,0,e,this.stride_,t)}return this.flatInteriorPoints_}getFlatMidpoint(){return this.flatMidpoints_||(this.flatMidpoints_=_A(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=_A(e,t,o,this.stride_,.5);Do(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=Os(e);let t=e.getExtent(),n=e.getWorldExtent();if(t&&n){let r=Nr(n)/Nr(t);No(DY,n[0],n[3],r,-r,0,0,0),ml(this.flatCoordinates_,0,this.flatCoordinates_.length,this.stride_,DY,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=lE((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=pA(n,0,this.simplifiedGeometry_.flatCoordinates_.length,this.simplifiedGeometry_.stride_,e,n,0),r=[n.length];break;case"MultiLineString":r=[],n.length=SE(n,0,this.simplifiedGeometry_.ends_,this.simplifiedGeometry_.stride_,e,n,0,r);break;case"Polygon":r=[],n.length=Gy(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}};v2.prototype.getFlatCoordinates=v2.prototype.getOrientedFlatCoordinates;var MA=v2;var s8=class{constructor(e){this.rbush_=new SA(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_[Bn(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_[Bn(a)]=l}this.rbush_.load(n)}remove(e){let t=Bn(e),n=this.items_[t];return delete this.items_[t],this.rbush_.remove(n)!==null}update(e,t){let n=this.items_[Bn(t)],r=[n.minX,n.minY,n.maxX,n.maxY];Km(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 Au(this.items_)}clear(){this.rbush_.clear(),this.items_={}}getExtent(e){let t=this.rbush_.toJSON();return ql(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]}},o8=s8;var $l={ADDFEATURE:"addfeature",CHANGEFEATURE:"changefeature",CLEAR:"clear",REMOVEFEATURE:"removefeature",FEATURESLOADSTART:"featuresloadstart",FEATURESLOADEND:"featuresloadend",FEATURESLOADERROR:"featuresloaderror"};var Th=class extends Ao{constructor(e,t,n){super(e),this.feature=t,this.features=n}},a8=class extends gE{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_=td,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&&(jn(this.format_,"`format` must be set when `url` is set"),this.loader_=r8(this.url_,this.format_)),this.strategy_=e.strategy!==void 0?e.strategy:LY;let t=e.useSpatialIndex!==void 0?e.useSpatialIndex:!0;this.featuresRtree_=t?new o8:null,this.loadedExtentsRtree_=new o8,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 Fo(r)),r!==void 0&&this.addFeaturesInternal(r),n!==void 0&&this.bindFeaturesCollection_(n)}addFeature(e){this.addFeatureInternal(e),this.changed()}addFeatureInternal(e){let t=Bn(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 Th($l.ADDFEATURE,e))}setupChangeEvents_(e,t){t instanceof MA||(this.featureChangeKeys_[e]=[qn(t,nn.CHANGE,this.handleFeatureChange_,this),qn(t,xu.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 MA){let s=this.idIndex_[r];s instanceof MA?Array.isArray(s)?s.push(t):this.idIndex_[r]=[s,t]:n=!1}else n=!1}return n&&(jn(!(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=Bn(a);this.addToIndex_(l,a)&&n.push(a)}for(let s=0,o=n.length;s<o;s++){let a=n[s],l=Bn(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($l.ADDFEATURE))for(let s=0,o=n.length;s<o;s++)this.dispatchEvent(new Th($l.ADDFEATURE,n[s]))}bindFeaturesCollection_(e){let t=!1;this.addEventListener($l.ADDFEATURE,function(n){t||(t=!0,e.push(n.feature),t=!1)}),this.addEventListener($l.REMOVEFEATURE,function(n){t||(t=!0,e.remove(n.feature),t=!1)}),e.addEventListener(vo.ADD,n=>{t||(t=!0,this.addFeature(n.element),t=!1)}),e.addEventListener(vo.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(li);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 Th($l.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 MA||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 MA||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(),Au(this.nullGeometryFeatures_)||Do(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=WT(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||Jf,this.featuresRtree_.forEachInExtent(l,function(c){if(t(c)){let u=c.getGeometry(),f=a;if(a=u instanceof MA?0:u.closestPointXY(n,r,o,a),a<f){s=c;let d=Math.sqrt(a);l[0]=n-d,l[1]=r-d,l[2]=n+d,l[3]=r+d}}}),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=Bn(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 Th($l.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 Bn(e)in this.uidIndex_}isEmpty(){return this.featuresRtree_?this.featuresRtree_.isEmpty()&&Au(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 ch(u.extent,l)})){this.loading=Number(this.loading)+1,this.dispatchEvent(new Th($l.FEATURESLOADSTART));let u=y=>{this.loading=Number(this.loading)-1,this.dispatchEvent(new Th($l.FEATURESLOADEND,void 0,y))},f=()=>{this.changed(),this.loading=Number(this.loading)-1,this.dispatchEvent(new Th($l.FEATURESLOADERROR))},d=!1,A=this.loader_.call(this,l,t,n,y=>d||u(y),()=>d||f());A instanceof Promise?(d=!0,A.then(y=>{this.addFeatures(y),u(y)}).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=ID(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=Bn(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(li),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($l.REMOVEFEATURE)&&this.dispatchEvent(new Th($l.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){jn(this.format_,"`format` must be set when `url` is set"),this.url_=e,this.setLoader(r8(e,this.format_))}setOverlaps(e){this.overlaps_=e,this.changed()}},Wp=a8;var qa={LEFT:0,MIDDLE:1,RIGHT:2,ROTATE:0,DOLLY:1,PAN:2},f0={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},IM=0,hb=1,LM=2;var Y8=0,d0=1,DM=2,Vc=3,zo=0,mi=1,vr=2,ps=0,Ts=1,Dh=2,Nh=3,Fh=4,Dd=5,fb=6,oo=100,db=101,pb=102,NM=103,FM=104,Nu=200,mb=201,Ab=202,gb=203,Jp=204,e0=205,vb=206,_b=207,xb=208,yb=209,bb=210,bZ=211,wZ=212,SZ=213,TZ=214,LA=0,DA=1,NA=2,Ch=3,FA=4,BA=5,OA=6,UA=7,tg=0,BM=1,OM=2,ao=0,wb=1,Sb=2,Tb=3,Eb=4,Z8=5,Mb=6,Cb=7;var Rb=300,ec=301,Gc=302,p0=303,m0=304,Bh=306,Ed=1e3,la=1001,Md=1002,Ti=1003,Pb=1004;var qc=1005;var Mi=1006,A0=1007;var Go=1008,K8=1008,Ji=1009,Oh=1010,Uh=1011,wl=1012,Kr=1013,xi=1014,cr=1015,Wi=1016,ng=1017,ig=1018,ua=1020,rg=35902,sg=35899,u_=1021,Nd=1022,Or=1023,Vs=1026,xo=1027,Fd=1028,kh=1029,Ws=1030,zh=1031,Ib=1032,g0=1033,Vh=33776,Gh=33777,qh=33778,Hh=33779,og=35840,ag=35841,lg=35842,cg=35843,v0=36196,_0=37492,x0=37496,y0=37488,b0=37489,Wh=37490,w0=37491,S0=37808,T0=37809,E0=37810,M0=37811,C0=37812,R0=37813,P0=37814,I0=37815,L0=37816,D0=37817,N0=37818,F0=37819,B0=37820,O0=37821,U0=36492,k0=36494,z0=36495,V0=36283,G0=36284,jh=36285,q0=36286;var L2=2300,sM=2301,iM=2302,B8=2303,O8=2400,U8=2401,k8=2402;var Q8=0,J8=1,UM=2,EZ=3200;var tc=0,kM=1,ha="",Fr="srgb",t0="srgb-linear",n0="linear",kt="srgb",Lb="",zM="rg",eF="ga",tF=0,bd=7680,nF=7681,iF=7682,rF=7683,sF=34055,oF=34056,aF=5386,lF=512,cF=513,uF=514,hF=515,fF=516,dF=517,pF=518,D2=519,Db=512,h_=513,Nb=514,Xh=515,ug=516,Fb=517,Fu=518,Bb=519,i0=35044,hg=35048;var mF="300 es",ko=2e3,xl=2001,Hc={COMPUTE:"compute",RENDER:"render"};var Bd={TEXTURE_COMPARE:"depthTextureCompare"};function kme(i){for(let e=i.length-1;e>=0;--e)if(i[e]>=65535)return!0;return!1}function f_(i){return ArrayBuffer.isView(i)&&!(i instanceof DataView)}function $v(i){return document.createElementNS("http://www.w3.org/1999/xhtml",i)}function VM(){let i=$v("canvas");return i.style.display="block",i}var NY={},Yv=null;function kA(...i){let e="THREE."+i.shift();Yv?Yv("log",e,...i):console.log(e,...i)}function MZ(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 Xe(...i){i=MZ(i);let e="THREE."+i.shift();if(Yv)Yv("warn",e,...i);else{let t=i[0];t&&t.isStackTrace?console.warn(t.getError(e)):console.warn(e,...i)}}function ze(...i){i=MZ(i);let e="THREE."+i.shift();if(Yv)Yv("error",e,...i);else{let t=i[0];t&&t.isStackTrace?console.error(t.getError(e)):console.error(e,...i)}}function ni(...i){let e=i.join(" ");e in NY||(NY[e]=!0,Xe(...i))}function AF(){return typeof self<"u"&&typeof self.scheduler<"u"&&typeof self.scheduler.yield<"u"?self.scheduler.yield():new Promise(i=>{requestAnimationFrame(i)})}function CZ(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 Ob={[LA]:DA,[NA]:OA,[FA]:UA,[Ch]:BA,[DA]:LA,[OA]:NA,[UA]:FA,[BA]:Ch},ca=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}}},oa=["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"],FY=1234567,C2=Math.PI/180,Cd=180/Math.PI;function Mh(){let i=Math.random()*4294967295|0,e=Math.random()*4294967295|0,t=Math.random()*4294967295|0,n=Math.random()*4294967295|0;return(oa[i&255]+oa[i>>8&255]+oa[i>>16&255]+oa[i>>24&255]+"-"+oa[e&255]+oa[e>>8&255]+"-"+oa[e>>16&15|64]+oa[e>>24&255]+"-"+oa[t&63|128]+oa[t>>8&255]+"-"+oa[t>>16&255]+oa[t>>24&255]+oa[n&255]+oa[n>>8&255]+oa[n>>16&255]+oa[n>>24&255]).toLowerCase()}function Nn(i,e,t){return Math.max(e,Math.min(t,i))}function gF(i,e){return(i%e+e)%e}function zme(i,e,t,n,r){return n+(i-e)*(r-n)/(t-e)}function Vme(i,e,t){return i!==e?(t-i)/(e-i):0}function R2(i,e,t){return(1-t)*i+t*e}function Gme(i,e,t,n){return R2(i,e,1-Math.exp(-t*n))}function qme(i,e=1){return e-Math.abs(gF(i,e*2)-e)}function Hme(i,e,t){return i<=e?0:i>=t?1:(i=(i-e)/(t-e),i*i*(3-2*i))}function Wme(i,e,t){return i<=e?0:i>=t?1:(i=(i-e)/(t-e),i*i*i*(i*(i*6-15)+10))}function jme(i,e){return i+Math.floor(Math.random()*(e-i+1))}function Xme(i,e){return i+Math.random()*(e-i)}function $me(i){return i*(.5-Math.random())}function Yme(i){i!==void 0&&(FY=i);let e=FY+=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 Zme(i){return i*C2}function Kme(i){return i*Cd}function Qme(i){return(i&i-1)===0&&i!==0}function Jme(i){return Math.pow(2,Math.ceil(Math.log(i)/Math.LN2))}function eAe(i){return Math.pow(2,Math.floor(Math.log(i)/Math.LN2))}function tAe(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),d=o((e-n)/2),A=s((n-e)/2),y=o((n-e)/2);switch(r){case"XYX":i.set(a*u,l*f,l*d,a*c);break;case"YZY":i.set(l*d,a*u,l*f,a*c);break;case"ZXZ":i.set(l*f,l*d,a*u,a*c);break;case"XZX":i.set(a*u,l*y,l*A,a*c);break;case"YXY":i.set(l*A,a*u,l*y,a*c);break;case"ZYZ":i.set(l*y,l*A,a*u,a*c);break;default:Xe("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 Zn(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 Bu={DEG2RAD:C2,RAD2DEG:Cd,generateUUID:Mh,clamp:Nn,euclideanModulo:gF,mapLinear:zme,inverseLerp:Vme,lerp:R2,damp:Gme,pingpong:qme,smoothstep:Hme,smootherstep:Wme,randInt:jme,randFloat:Xme,randFloatSpread:$me,seededRandom:Yme,degToRad:Zme,radToDeg:Kme,isPowerOfTwo:Qme,ceilPowerOfTwo:Jme,floorPowerOfTwo:eAe,setQuaternionFromProperEuler:tAe,normalize:Zn,denormalize:Fa},bF=class bF{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=Nn(this.x,e.x,t.x),this.y=Nn(this.y,e.y,t.y),this}clampScalar(e,t){return this.x=Nn(this.x,e,t),this.y=Nn(this.y,e,t),this}clampLength(e,t){let n=this.length();return this.divideScalar(n||1).multiplyScalar(Nn(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(Nn(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}};bF.prototype.isVector2=!0;var Oe=bF,Gs=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],d=s[o+0],A=s[o+1],y=s[o+2],w=s[o+3];if(f!==w||l!==d||c!==A||u!==y){let S=l*d+c*A+u*y+f*w;S<0&&(d=-d,A=-A,y=-y,w=-w,S=-S);let T=1-a;if(S<.9995){let R=Math.acos(S),I=Math.sin(R);T=Math.sin(T*R)/I,a=Math.sin(a*R)/I,l=l*T+d*a,c=c*T+A*a,u=u*T+y*a,f=f*T+w*a}else{l=l*T+d*a,c=c*T+A*a,u=u*T+y*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],d=s[o+1],A=s[o+2],y=s[o+3];return e[t]=a*y+u*f+l*A-c*d,e[t+1]=l*y+u*d+c*f-a*A,e[t+2]=c*y+u*A+a*d-l*f,e[t+3]=u*y-a*f-l*d-c*A,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),d=l(n/2),A=l(r/2),y=l(s/2);switch(o){case"XYZ":this._x=d*u*f+c*A*y,this._y=c*A*f-d*u*y,this._z=c*u*y+d*A*f,this._w=c*u*f-d*A*y;break;case"YXZ":this._x=d*u*f+c*A*y,this._y=c*A*f-d*u*y,this._z=c*u*y-d*A*f,this._w=c*u*f+d*A*y;break;case"ZXY":this._x=d*u*f-c*A*y,this._y=c*A*f+d*u*y,this._z=c*u*y+d*A*f,this._w=c*u*f-d*A*y;break;case"ZYX":this._x=d*u*f-c*A*y,this._y=c*A*f+d*u*y,this._z=c*u*y-d*A*f,this._w=c*u*f+d*A*y;break;case"YZX":this._x=d*u*f+c*A*y,this._y=c*A*f+d*u*y,this._z=c*u*y-d*A*f,this._w=c*u*f-d*A*y;break;case"XZY":this._x=d*u*f-c*A*y,this._y=c*A*f-d*u*y,this._z=c*u*y+d*A*f,this._w=c*u*f+d*A*y;break;default:Xe("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],d=n+a+f;if(d>0){let A=.5/Math.sqrt(d+1);this._w=.25/A,this._x=(u-l)*A,this._y=(s-c)*A,this._z=(o-r)*A}else if(n>a&&n>f){let A=2*Math.sqrt(1+n-a-f);this._w=(u-l)/A,this._x=.25*A,this._y=(r+o)/A,this._z=(s+c)/A}else if(a>f){let A=2*Math.sqrt(1+a-n-f);this._w=(s-c)/A,this._x=(r+o)/A,this._y=.25*A,this._z=(l+u)/A}else{let A=2*Math.sqrt(1+f-n-a);this._w=(o-r)/A,this._x=(s+c)/A,this._y=(l+u)/A,this._z=.25*A}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(Nn(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}},wF=class wF{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(BY.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(BY.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=Nn(this.x,e.x,t.x),this.y=Nn(this.y,e.y,t.y),this.z=Nn(this.z,e.z,t.z),this}clampScalar(e,t){return this.x=Nn(this.x,e,t),this.y=Nn(this.y,e,t),this.z=Nn(this.z,e,t),this}clampLength(e,t){let n=this.length();return this.divideScalar(n||1).multiplyScalar(Nn(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 l8.copy(this).projectOnVector(e),this.sub(l8)}reflect(e){return this.sub(l8.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(Nn(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}};wF.prototype.isVector3=!0;var re=wF,l8=new re,BY=new Gs,SF=class SF{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],d=n[2],A=n[5],y=n[8],w=r[0],S=r[3],T=r[6],R=r[1],I=r[4],P=r[7],F=r[2],D=r[5],L=r[8];return s[0]=o*w+a*R+l*F,s[3]=o*S+a*I+l*D,s[6]=o*T+a*P+l*L,s[1]=c*w+u*R+f*F,s[4]=c*S+u*I+f*D,s[7]=c*T+u*P+f*L,s[2]=d*w+A*R+y*F,s[5]=d*S+A*I+y*D,s[8]=d*T+A*P+y*L,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,d=a*l-u*s,A=c*s-o*l,y=t*f+n*d+r*A;if(y===0)return this.set(0,0,0,0,0,0,0,0,0);let w=1/y;return e[0]=f*w,e[1]=(r*c-u*n)*w,e[2]=(a*n-r*o)*w,e[3]=d*w,e[4]=(u*t-r*l)*w,e[5]=(r*s-a*t)*w,e[6]=A*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 ni("Matrix3: .scale() is deprecated. Use .makeScale() instead."),this.premultiply(c8.makeScale(e,t)),this}rotate(e){return ni("Matrix3: .rotate() is deprecated. Use .makeRotation() instead."),this.premultiply(c8.makeRotation(-e)),this}translate(e,t){return ni("Matrix3: .translate() is deprecated. Use .makeTranslation() instead."),this.premultiply(c8.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)}};SF.prototype.isMatrix3=!0;var Mn=SF,c8=new Mn,OY=new Mn().set(.4123908,.3575843,.1804808,.212639,.7151687,.0721923,.0193308,.1191948,.9505322),UY=new Mn().set(3.2409699,-1.5373832,-.4986108,-.9692436,1.8759675,.0415551,.0556301,-.203977,1.0569715);function nAe(){let i={enabled:!0,workingColorSpace:t0,spaces:{},convert:function(r,s,o){return this.enabled===!1||s===o||!s||!o||(this.spaces[s].transfer===kt&&(r.r=Td(r.r),r.g=Td(r.g),r.b=Td(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===kt&&(r.r=Xv(r.r),r.g=Xv(r.g),r.b=Xv(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===ha?n0: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 ni("ColorManagement: .fromWorkingColorSpace() has been renamed to .workingToColorSpace()."),i.workingToColorSpace(r,s)},toWorkingColorSpace:function(r,s){return ni("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({[t0]:{primaries:e,whitePoint:n,transfer:n0,toXYZ:OY,fromXYZ:UY,luminanceCoefficients:t,workingColorSpaceConfig:{unpackColorSpace:Fr},outputColorSpaceConfig:{drawingBufferColorSpace:Fr}},[Fr]:{primaries:e,whitePoint:n,transfer:kt,toXYZ:OY,fromXYZ:UY,luminanceCoefficients:t,outputColorSpaceConfig:{drawingBufferColorSpace:Fr}}}),i}var ln=nAe();function Td(i){return i<.04045?i*.0773993808:Math.pow(i*.9478672986+.0521327014,2.4)}function Xv(i){return i<.0031308?i*12.92:1.055*Math.pow(i,.41666)-.055}var Cv,oM=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{Cv===void 0&&(Cv=$v("canvas")),Cv.width=e.width,Cv.height=e.height;let r=Cv.getContext("2d");e instanceof ImageData?r.putImageData(e,0,0):r.drawImage(e,0,0,e.width,e.height),n=Cv}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=$v("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]=Td(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(Td(t[n]/255)*255):t[n]=Td(t[n]);return{data:t,width:e.width,height:e.height}}else return Xe("ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied."),e}},iAe=0,Zv=class{constructor(e=null){this.isSource=!0,Object.defineProperty(this,"id",{value:iAe++}),this.uuid=Mh(),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(u8(r[o].image)):s.push(u8(r[o]))}else s=u8(r);n.url=s}return t||(e.images[this.uuid]=n),n}};function u8(i){return typeof HTMLImageElement<"u"&&i instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&i instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&i instanceof ImageBitmap?oM.getDataURL(i):i.data?{data:Array.from(i.data),width:i.width,height:i.height,type:i.data.constructor.name}:(Xe("Texture: Unable to serialize Texture."),{})}var rAe=0,h8=new re,qs=class i extends ca{constructor(e=i.DEFAULT_IMAGE,t=i.DEFAULT_MAPPING,n=la,r=la,s=Mi,o=Go,a=Or,l=Ji,c=i.DEFAULT_ANISOTROPY,u=ha){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:rAe++}),this.uuid=Mh(),this.name="",this.source=new Zv(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 Mn,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(h8).x}get height(){return this.source.getSize(h8).y}get depth(){return this.source.getSize(h8).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){Xe(`Texture.setValues(): parameter '${t}' has value of undefined.`);continue}let r=this[t];if(r===void 0){Xe(`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!==Rb)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case Ed:e.x=e.x-Math.floor(e.x);break;case la:e.x=e.x<0?0:1;break;case Md: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 Ed:e.y=e.y-Math.floor(e.y);break;case la:e.y=e.y<0?0:1;break;case Md: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++}};qs.DEFAULT_IMAGE=null;qs.DEFAULT_MAPPING=Rb;qs.DEFAULT_ANISOTROPY=1;var TF=class TF{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],d=l[1],A=l[5],y=l[9],w=l[2],S=l[6],T=l[10];if(Math.abs(u-d)<.01&&Math.abs(f-w)<.01&&Math.abs(y-S)<.01){if(Math.abs(u+d)<.1&&Math.abs(f+w)<.1&&Math.abs(y+S)<.1&&Math.abs(c+A+T-3)<.1)return this.set(1,0,0,0),this;t=Math.PI;let I=(c+1)/2,P=(A+1)/2,F=(T+1)/2,D=(u+d)/4,L=(f+w)/4,C=(y+S)/4;return I>P&&I>F?I<.01?(n=0,r=.707106781,s=.707106781):(n=Math.sqrt(I),r=D/n,s=L/n):P>F?P<.01?(n=.707106781,r=0,s=.707106781):(r=Math.sqrt(P),n=D/r,s=C/r):F<.01?(n=.707106781,r=.707106781,s=0):(s=Math.sqrt(F),n=L/s,r=C/s),this.set(n,r,s,t),this}let R=Math.sqrt((S-y)*(S-y)+(f-w)*(f-w)+(d-u)*(d-u));return Math.abs(R)<.001&&(R=1),this.x=(S-y)/R,this.y=(f-w)/R,this.z=(d-u)/R,this.w=Math.acos((c+A+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=Nn(this.x,e.x,t.x),this.y=Nn(this.y,e.y,t.y),this.z=Nn(this.z,e.z,t.z),this.w=Nn(this.w,e.w,t.w),this}clampScalar(e,t){return this.x=Nn(this.x,e,t),this.y=Nn(this.y,e,t),this.z=Nn(this.z,e,t),this.w=Nn(this.w,e,t),this}clampLength(e,t){let n=this.length();return this.divideScalar(n||1).multiplyScalar(Nn(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}};TF.prototype.isVector4=!0;var xn=TF,Ba=class extends ca{constructor(e=1,t=1,n={}){super(),n=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:Mi,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 xn(0,0,e,t),this.scissorTest=!1,this.viewport=new xn(0,0,e,t),this.textures=[];let r={width:e,height:t,depth:n.depth},s=new qs(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:Mi,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 Zv(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"})}},Oa=class extends Ba{constructor(e=1,t=1,n={}){super(e,t,n),this.isWebGLRenderTarget=!0}},zA=class extends qs{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=Ti,this.minFilter=Ti,this.wrapR=la,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.layerUpdates=new Set}addLayerUpdate(e){this.layerUpdates.add(e)}clearLayerUpdates(){this.layerUpdates.clear()}};var aM=class extends qs{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=Ti,this.minFilter=Ti,this.wrapR=la,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}};var PM=class PM{constructor(e,t,n,r,s,o,a,l,c,u,f,d,A,y,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,d,A,y,w,S)}set(e,t,n,r,s,o,a,l,c,u,f,d,A,y,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]=d,T[3]=A,T[7]=y,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 PM().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/Rv.setFromMatrixColumn(e,0).length(),s=1/Rv.setFromMatrixColumn(e,1).length(),o=1/Rv.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 d=o*u,A=o*f,y=a*u,w=a*f;t[0]=l*u,t[4]=-l*f,t[8]=c,t[1]=A+y*c,t[5]=d-w*c,t[9]=-a*l,t[2]=w-d*c,t[6]=y+A*c,t[10]=o*l}else if(e.order==="YXZ"){let d=l*u,A=l*f,y=c*u,w=c*f;t[0]=d+w*a,t[4]=y*a-A,t[8]=o*c,t[1]=o*f,t[5]=o*u,t[9]=-a,t[2]=A*a-y,t[6]=w+d*a,t[10]=o*l}else if(e.order==="ZXY"){let d=l*u,A=l*f,y=c*u,w=c*f;t[0]=d-w*a,t[4]=-o*f,t[8]=y+A*a,t[1]=A+y*a,t[5]=o*u,t[9]=w-d*a,t[2]=-o*c,t[6]=a,t[10]=o*l}else if(e.order==="ZYX"){let d=o*u,A=o*f,y=a*u,w=a*f;t[0]=l*u,t[4]=y*c-A,t[8]=d*c+w,t[1]=l*f,t[5]=w*c+d,t[9]=A*c-y,t[2]=-c,t[6]=a*l,t[10]=o*l}else if(e.order==="YZX"){let d=o*l,A=o*c,y=a*l,w=a*c;t[0]=l*u,t[4]=w-d*f,t[8]=y*f+A,t[1]=f,t[5]=o*u,t[9]=-a*u,t[2]=-c*u,t[6]=A*f+y,t[10]=d-w*f}else if(e.order==="XZY"){let d=o*l,A=o*c,y=a*l,w=a*c;t[0]=l*u,t[4]=-f,t[8]=c*u,t[1]=d*f+w,t[5]=o*u,t[9]=A*f-y,t[2]=y*f-A,t[6]=a*u,t[10]=w*f+d}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(sAe,e,oAe)}lookAt(e,t,n){let r=this.elements;return Yl.subVectors(e,t),Yl.lengthSq()===0&&(Yl.z=1),Yl.normalize(),jp.crossVectors(n,Yl),jp.lengthSq()===0&&(Math.abs(n.z)===1?Yl.x+=1e-4:Yl.z+=1e-4,Yl.normalize(),jp.crossVectors(n,Yl)),jp.normalize(),E3.crossVectors(Yl,jp),r[0]=jp.x,r[4]=E3.x,r[8]=Yl.x,r[1]=jp.y,r[5]=E3.y,r[9]=Yl.y,r[2]=jp.z,r[6]=E3.z,r[10]=Yl.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],d=n[9],A=n[13],y=n[2],w=n[6],S=n[10],T=n[14],R=n[3],I=n[7],P=n[11],F=n[15],D=r[0],L=r[4],C=r[8],B=r[12],k=r[1],z=r[5],G=r[9],W=r[13],Y=r[2],H=r[6],$=r[10],J=r[14],te=r[3],ce=r[7],he=r[11],ve=r[15];return s[0]=o*D+a*k+l*Y+c*te,s[4]=o*L+a*z+l*H+c*ce,s[8]=o*C+a*G+l*$+c*he,s[12]=o*B+a*W+l*J+c*ve,s[1]=u*D+f*k+d*Y+A*te,s[5]=u*L+f*z+d*H+A*ce,s[9]=u*C+f*G+d*$+A*he,s[13]=u*B+f*W+d*J+A*ve,s[2]=y*D+w*k+S*Y+T*te,s[6]=y*L+w*z+S*H+T*ce,s[10]=y*C+w*G+S*$+T*he,s[14]=y*B+w*W+S*J+T*ve,s[3]=R*D+I*k+P*Y+F*te,s[7]=R*L+I*z+P*H+F*ce,s[11]=R*C+I*G+P*$+F*he,s[15]=R*B+I*W+P*J+F*ve,this}multiplyScalar(e){let t=this.elements;return t[0]*=e,t[4]*=e,t[8]*=e,t[12]*=e,t[1]*=e,t[5]*=e,t[9]*=e,t[13]*=e,t[2]*=e,t[6]*=e,t[10]*=e,t[14]*=e,t[3]*=e,t[7]*=e,t[11]*=e,t[15]*=e,this}determinant(){let e=this.elements,t=e[0],n=e[4],r=e[8],s=e[12],o=e[1],a=e[5],l=e[9],c=e[13],u=e[2],f=e[6],d=e[10],A=e[14],y=e[3],w=e[7],S=e[11],T=e[15],R=l*A-c*d,I=a*A-c*f,P=a*d-l*f,F=o*A-c*u,D=o*d-l*u,L=o*f-a*u;return t*(w*R-S*I+T*P)-n*(y*R-S*F+T*D)+r*(y*I-w*F+T*L)-s*(y*P-w*D+S*L)}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],d=e[10],A=e[11],y=e[12],w=e[13],S=e[14],T=e[15],R=t*a-n*o,I=t*l-r*o,P=t*c-s*o,F=n*l-r*a,D=n*c-s*a,L=r*c-s*l,C=u*w-f*y,B=u*S-d*y,k=u*T-A*y,z=f*S-d*w,G=f*T-A*w,W=d*T-A*S,Y=R*W-I*G+P*z+F*k-D*B+L*C;if(Y===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);let H=1/Y;return e[0]=(a*W-l*G+c*z)*H,e[1]=(r*G-n*W-s*z)*H,e[2]=(w*L-S*D+T*F)*H,e[3]=(d*D-f*L-A*F)*H,e[4]=(l*k-o*W-c*B)*H,e[5]=(t*W-r*k+s*B)*H,e[6]=(S*P-y*L-T*I)*H,e[7]=(u*L-d*P+A*I)*H,e[8]=(o*G-a*k+c*C)*H,e[9]=(n*k-t*G-s*C)*H,e[10]=(y*D-w*P+T*R)*H,e[11]=(f*P-u*D-A*R)*H,e[12]=(a*B-o*z-l*C)*H,e[13]=(t*z-n*B+r*C)*H,e[14]=(w*I-y*F-S*R)*H,e[15]=(u*F-f*I+d*R)*H,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,d=s*c,A=s*u,y=s*f,w=o*u,S=o*f,T=a*f,R=l*c,I=l*u,P=l*f,F=n.x,D=n.y,L=n.z;return r[0]=(1-(w+T))*F,r[1]=(A+P)*F,r[2]=(y-I)*F,r[3]=0,r[4]=(A-P)*D,r[5]=(1-(d+T))*D,r[6]=(S+R)*D,r[7]=0,r[8]=(y+I)*L,r[9]=(S-R)*L,r[10]=(1-(d+w))*L,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=Rv.set(r[0],r[1],r[2]).length(),a=Rv.set(r[4],r[5],r[6]).length(),l=Rv.set(r[8],r[9],r[10]).length();s<0&&(o=-o),Cu.copy(this);let c=1/o,u=1/a,f=1/l;return Cu.elements[0]*=c,Cu.elements[1]*=c,Cu.elements[2]*=c,Cu.elements[4]*=u,Cu.elements[5]*=u,Cu.elements[6]*=u,Cu.elements[8]*=f,Cu.elements[9]*=f,Cu.elements[10]*=f,t.setFromRotationMatrix(Cu),n.x=o,n.y=a,n.z=l,this}makePerspective(e,t,n,r,s,o,a=ko,l=!1){let c=this.elements,u=2*s/(t-e),f=2*s/(n-r),d=(t+e)/(t-e),A=(n+r)/(n-r),y,w;if(l)y=s/(o-s),w=o*s/(o-s);else if(a===ko)y=-(o+s)/(o-s),w=-2*o*s/(o-s);else if(a===xl)y=-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]=d,c[12]=0,c[1]=0,c[5]=f,c[9]=A,c[13]=0,c[2]=0,c[6]=0,c[10]=y,c[14]=w,c[3]=0,c[7]=0,c[11]=-1,c[15]=0,this}makeOrthographic(e,t,n,r,s,o,a=ko,l=!1){let c=this.elements,u=2/(t-e),f=2/(n-r),d=-(t+e)/(t-e),A=-(n+r)/(n-r),y,w;if(l)y=1/(o-s),w=o/(o-s);else if(a===ko)y=-2/(o-s),w=-(o+s)/(o-s);else if(a===xl)y=-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]=d,c[1]=0,c[5]=f,c[9]=0,c[13]=A,c[2]=0,c[6]=0,c[10]=y,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}};PM.prototype.isMatrix4=!0;var cn=PM,Rv=new re,Cu=new cn,sAe=new re(0,0,0),oAe=new re(1,1,1),jp=new re,E3=new re,Yl=new re,kY=new cn,zY=new Gs,Ua=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],d=r[6],A=r[10];switch(t){case"XYZ":this._y=Math.asin(Nn(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(-u,A),this._z=Math.atan2(-o,s)):(this._x=Math.atan2(d,c),this._z=0);break;case"YXZ":this._x=Math.asin(-Nn(u,-1,1)),Math.abs(u)<.9999999?(this._y=Math.atan2(a,A),this._z=Math.atan2(l,c)):(this._y=Math.atan2(-f,s),this._z=0);break;case"ZXY":this._x=Math.asin(Nn(d,-1,1)),Math.abs(d)<.9999999?(this._y=Math.atan2(-f,A),this._z=Math.atan2(-o,c)):(this._y=0,this._z=Math.atan2(l,s));break;case"ZYX":this._y=Math.asin(-Nn(f,-1,1)),Math.abs(f)<.9999999?(this._x=Math.atan2(d,A),this._z=Math.atan2(l,s)):(this._x=0,this._z=Math.atan2(-o,c));break;case"YZX":this._z=Math.asin(Nn(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,A));break;case"XZY":this._z=Math.asin(-Nn(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(d,c),this._y=Math.atan2(a,s)):(this._x=Math.atan2(-u,A),this._y=0);break;default:Xe("Euler: .setFromRotationMatrix() encountered an unknown order: "+t)}return this._order=t,n===!0&&this._onChangeCallback(),this}setFromQuaternion(e,t,n){return kY.makeRotationFromQuaternion(e),this.setFromRotationMatrix(kY,t,n)}setFromVector3(e,t=this._order){return this.set(e.x,e.y,e.z,t)}reorder(e){return zY.setFromEuler(this),this.setFromQuaternion(zY,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}};Ua.DEFAULT_ORDER="XYZ";var Kv=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}},aAe=0,VY=new re,Pv=new Gs,gd=new cn,M3=new re,_2=new re,lAe=new re,cAe=new Gs,GY=new re(1,0,0),qY=new re(0,1,0),HY=new re(0,0,1),WY={type:"added"},uAe={type:"removed"},Iv={type:"childadded",child:null},f8={type:"childremoved",child:null},lr=class i extends ca{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:aAe++}),this.uuid=Mh(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=i.DEFAULT_UP.clone();let e=new re,t=new Ua,n=new Gs,r=new re(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 cn},normalMatrix:{value:new Mn}}),this.matrix=new cn,this.matrixWorld=new cn,this.matrixAutoUpdate=i.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldAutoUpdate=i.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.layers=new Kv,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 Pv.setFromAxisAngle(e,t),this.quaternion.multiply(Pv),this}rotateOnWorldAxis(e,t){return Pv.setFromAxisAngle(e,t),this.quaternion.premultiply(Pv),this}rotateX(e){return this.rotateOnAxis(GY,e)}rotateY(e){return this.rotateOnAxis(qY,e)}rotateZ(e){return this.rotateOnAxis(HY,e)}translateOnAxis(e,t){return VY.copy(e).applyQuaternion(this.quaternion),this.position.add(VY.multiplyScalar(t)),this}translateX(e){return this.translateOnAxis(GY,e)}translateY(e){return this.translateOnAxis(qY,e)}translateZ(e){return this.translateOnAxis(HY,e)}localToWorld(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(this.matrixWorld)}worldToLocal(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(gd.copy(this.matrixWorld).invert())}lookAt(e,t,n){e.isVector3?M3.copy(e):M3.set(e,t,n);let r=this.parent;this.updateWorldMatrix(!0,!1),_2.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?gd.lookAt(_2,M3,this.up):gd.lookAt(M3,_2,this.up),this.quaternion.setFromRotationMatrix(gd),r&&(gd.extractRotation(r.matrixWorld),Pv.setFromRotationMatrix(gd),this.quaternion.premultiply(Pv.invert()))}add(e){if(arguments.length>1){for(let t=0;t<arguments.length;t++)this.add(arguments[t]);return this}return e===this?(ze("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(WY),Iv.child=e,this.dispatchEvent(Iv),Iv.child=null):ze("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(uAe),f8.child=e,this.dispatchEvent(f8),f8.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),gd.copy(this.matrixWorld).invert(),e.parent!==null&&(e.parent.updateWorldMatrix(!0,!1),gd.multiply(e.parent.matrixWorld)),e.applyMatrix4(gd),e.removeFromParent(),e.parent=this,this.children.push(e),e.updateWorldMatrix(!1,!0),e.dispatchEvent(WY),Iv.child=e,this.dispatchEvent(Iv),Iv.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(_2,e,lAe),e}getWorldScale(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(_2,cAe,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),d=o(e.skeletons),A=o(e.animations),y=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),d.length>0&&(n.skeletons=d),A.length>0&&(n.animations=A),y.length>0&&(n.nodes=y)}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}};lr.DEFAULT_UP=new re(0,1,0);lr.DEFAULT_MATRIX_AUTO_UPDATE=!0;lr.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;var Br=class extends lr{constructor(){super(),this.isGroup=!0,this.type="Group"}},hAe={type:"move"},r0=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 re,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new re),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 re,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new re,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"],d=u.position.distanceTo(f.position),A=.02,y=.005;c.inputState.pinching&&d>A+y?(c.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!c.inputState.pinching&&d<=A-y&&(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(hAe)))}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]}},RZ={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},Xp={h:0,s:0,l:0},C3={h:0,s:0,l:0};function d8(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 zt=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=Fr){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,ln.colorSpaceToWorking(this,t),this}setRGB(e,t,n,r=ln.workingColorSpace){return this.r=e,this.g=t,this.b=n,ln.colorSpaceToWorking(this,r),this}setHSL(e,t,n,r=ln.workingColorSpace){if(e=gF(e,1),t=Nn(t,0,1),n=Nn(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=d8(o,s,e+1/3),this.g=d8(o,s,e),this.b=d8(o,s,e-1/3)}return ln.colorSpaceToWorking(this,r),this}setStyle(e,t=Fr){function n(s){s!==void 0&&parseFloat(s)<1&&Xe("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:Xe("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);Xe("Color: Invalid hex color "+e)}else if(e&&e.length>0)return this.setColorName(e,t);return this}setColorName(e,t=Fr){let n=RZ[e.toLowerCase()];return n!==void 0?this.setHex(n,t):Xe("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=Td(e.r),this.g=Td(e.g),this.b=Td(e.b),this}copyLinearToSRGB(e){return this.r=Xv(e.r),this.g=Xv(e.g),this.b=Xv(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=Fr){return ln.workingToColorSpace(aa.copy(this),e),Math.round(Nn(aa.r*255,0,255))*65536+Math.round(Nn(aa.g*255,0,255))*256+Math.round(Nn(aa.b*255,0,255))}getHexString(e=Fr){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=ln.workingColorSpace){ln.workingToColorSpace(aa.copy(this),t);let n=aa.r,r=aa.g,s=aa.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=ln.workingColorSpace){return ln.workingToColorSpace(aa.copy(this),t),e.r=aa.r,e.g=aa.g,e.b=aa.b,e}getStyle(e=Fr){ln.workingToColorSpace(aa.copy(this),e);let t=aa.r,n=aa.g,r=aa.b;return e!==Fr?`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(Xp),this.setHSL(Xp.h+e,Xp.s+t,Xp.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(Xp),e.getHSL(C3);let n=R2(Xp.h,C3.h,t),r=R2(Xp.s,C3.s,t),s=R2(Xp.l,C3.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}},aa=new zt;zt.NAMES=RZ;var s0=class extends lr{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 Ua,this.environmentIntensity=1,this.environmentRotation=new Ua,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}},Ru=new re,vd=new re,p8=new re,_d=new re,Lv=new re,Dv=new re,jY=new re,m8=new re,A8=new re,g8=new re,v8=new xn,_8=new xn,x8=new xn,wd=class i{constructor(e=new re,t=new re,n=new re){this.a=e,this.b=t,this.c=n}static getNormal(e,t,n,r){r.subVectors(n,t),Ru.subVectors(e,t),r.cross(Ru);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){Ru.subVectors(r,t),vd.subVectors(n,t),p8.subVectors(e,t);let o=Ru.dot(Ru),a=Ru.dot(vd),l=Ru.dot(p8),c=vd.dot(vd),u=vd.dot(p8),f=o*c-a*a;if(f===0)return s.set(0,0,0),null;let d=1/f,A=(c*l-a*u)*d,y=(o*u-a*l)*d;return s.set(1-A-y,y,A)}static containsPoint(e,t,n,r){return this.getBarycoord(e,t,n,r,_d)===null?!1:_d.x>=0&&_d.y>=0&&_d.x+_d.y<=1}static getInterpolation(e,t,n,r,s,o,a,l){return this.getBarycoord(e,t,n,r,_d)===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,_d.x),l.addScaledVector(o,_d.y),l.addScaledVector(a,_d.z),l)}static getInterpolatedAttribute(e,t,n,r,s,o){return v8.setScalar(0),_8.setScalar(0),x8.setScalar(0),v8.fromBufferAttribute(e,t),_8.fromBufferAttribute(e,n),x8.fromBufferAttribute(e,r),o.setScalar(0),o.addScaledVector(v8,s.x),o.addScaledVector(_8,s.y),o.addScaledVector(x8,s.z),o}static isFrontFacing(e,t,n,r){return Ru.subVectors(n,t),vd.subVectors(e,t),Ru.cross(vd).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 Ru.subVectors(this.c,this.b),vd.subVectors(this.a,this.b),Ru.cross(vd).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;Lv.subVectors(r,n),Dv.subVectors(s,n),m8.subVectors(e,n);let l=Lv.dot(m8),c=Dv.dot(m8);if(l<=0&&c<=0)return t.copy(n);A8.subVectors(e,r);let u=Lv.dot(A8),f=Dv.dot(A8);if(u>=0&&f<=u)return t.copy(r);let d=l*f-u*c;if(d<=0&&l>=0&&u<=0)return o=l/(l-u),t.copy(n).addScaledVector(Lv,o);g8.subVectors(e,s);let A=Lv.dot(g8),y=Dv.dot(g8);if(y>=0&&A<=y)return t.copy(s);let w=A*c-l*y;if(w<=0&&c>=0&&y<=0)return a=c/(c-y),t.copy(n).addScaledVector(Dv,a);let S=u*y-A*f;if(S<=0&&f-u>=0&&A-y>=0)return jY.subVectors(s,r),a=(f-u)/(f-u+(A-y)),t.copy(r).addScaledVector(jY,a);let T=1/(S+w+d);return o=w*T,a=d*T,t.copy(n).addScaledVector(Lv,o).addScaledVector(Dv,a)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}},ka=class{constructor(e=new re(1/0,1/0,1/0),t=new re(-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(Pu.fromArray(e,t));return this}setFromBufferAttribute(e){this.makeEmpty();for(let t=0,n=e.count;t<n;t++)this.expandByPoint(Pu.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=Pu.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,Pu):Pu.fromBufferAttribute(s,o),Pu.applyMatrix4(e.matrixWorld),this.expandByPoint(Pu);else e.boundingBox!==void 0?(e.boundingBox===null&&e.computeBoundingBox(),R3.copy(e.boundingBox)):(n.boundingBox===null&&n.computeBoundingBox(),R3.copy(n.boundingBox)),R3.applyMatrix4(e.matrixWorld),this.union(R3)}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,Pu),Pu.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(x2),P3.subVectors(this.max,x2),Nv.subVectors(e.a,x2),Fv.subVectors(e.b,x2),Bv.subVectors(e.c,x2),$p.subVectors(Fv,Nv),Yp.subVectors(Bv,Fv),CA.subVectors(Nv,Bv);let t=[0,-$p.z,$p.y,0,-Yp.z,Yp.y,0,-CA.z,CA.y,$p.z,0,-$p.x,Yp.z,0,-Yp.x,CA.z,0,-CA.x,-$p.y,$p.x,0,-Yp.y,Yp.x,0,-CA.y,CA.x,0];return!y8(t,Nv,Fv,Bv,P3)||(t=[1,0,0,0,1,0,0,0,1],!y8(t,Nv,Fv,Bv,P3))?!1:(I3.crossVectors($p,Yp),t=[I3.x,I3.y,I3.z],y8(t,Nv,Fv,Bv,P3))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,Pu).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=this.getSize(Pu).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:(xd[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),xd[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),xd[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),xd[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),xd[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),xd[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),xd[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),xd[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(xd),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}},xd=[new re,new re,new re,new re,new re,new re,new re,new re],Pu=new re,R3=new ka,Nv=new re,Fv=new re,Bv=new re,$p=new re,Yp=new re,CA=new re,x2=new re,P3=new re,I3=new re,RA=new re;function y8(i,e,t,n,r){for(let s=0,o=i.length-3;s<=o;s+=3){RA.fromArray(i,s);let a=r.x*Math.abs(RA.x)+r.y*Math.abs(RA.y)+r.z*Math.abs(RA.z),l=e.dot(RA),c=t.dot(RA),u=n.dot(RA);if(Math.max(-Math.max(l,c,u),Math.min(l,c,u))>a)return!1}return!0}var Sd=fAe();function fAe(){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 Zl(i){Math.abs(i)>65504&&Xe("DataUtils.toHalfFloat(): Value out of range."),i=Nn(i,-65504,65504),Sd.floatView[0]=i;let e=Sd.uint32View[0],t=e>>23&511;return Sd.baseTable[t]+((e&8388607)>>Sd.shiftTable[t])}function L3(i){let e=i>>10;return Sd.uint32View[0]=Sd.mantissaTable[Sd.offsetTable[e]+(i&1023)]+Sd.exponentTable[e],Sd.floatView[0]}var zs=new re,D3=new Oe,dAe=0,Hi=class extends ca{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:dAe++}),this.name="",this.array=e,this.itemSize=t,this.count=e!==void 0?e.length/t:0,this.normalized=n,this.usage=i0,this.updateRanges=[],this.gpuType=cr,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++)D3.fromBufferAttribute(this,t),D3.applyMatrix3(e),this.setXY(t,D3.x,D3.y);else if(this.itemSize===3)for(let t=0,n=this.count;t<n;t++)zs.fromBufferAttribute(this,t),zs.applyMatrix3(e),this.setXYZ(t,zs.x,zs.y,zs.z);return this}applyMatrix4(e){for(let t=0,n=this.count;t<n;t++)zs.fromBufferAttribute(this,t),zs.applyMatrix4(e),this.setXYZ(t,zs.x,zs.y,zs.z);return this}applyNormalMatrix(e){for(let t=0,n=this.count;t<n;t++)zs.fromBufferAttribute(this,t),zs.applyNormalMatrix(e),this.setXYZ(t,zs.x,zs.y,zs.z);return this}transformDirection(e){for(let t=0,n=this.count;t<n;t++)zs.fromBufferAttribute(this,t),zs.transformDirection(e),this.setXYZ(t,zs.x,zs.y,zs.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=Zn(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=Zn(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=Zn(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=Zn(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=Zn(t,this.array)),this.array[e*this.itemSize+3]=t,this}setXY(e,t,n){return e*=this.itemSize,this.normalized&&(t=Zn(t,this.array),n=Zn(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=Zn(t,this.array),n=Zn(n,this.array),r=Zn(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=Zn(t,this.array),n=Zn(n,this.array),r=Zn(r,this.array),s=Zn(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!==i0&&(e.usage=this.usage),e}dispose(){this.dispatchEvent({type:"dispose"})}};var VA=class extends Hi{constructor(e,t,n){super(new Uint16Array(e),t,n)}};var GA=class extends Hi{constructor(e,t,n){super(new Uint32Array(e),t,n)}},Qv=class extends Hi{constructor(e,t,n){super(new Uint16Array(e),t,n),this.isFloat16BufferAttribute=!0}getX(e){let t=L3(this.array[e*this.itemSize]);return this.normalized&&(t=Fa(t,this.array)),t}setX(e,t){return this.normalized&&(t=Zn(t,this.array)),this.array[e*this.itemSize]=Zl(t),this}getY(e){let t=L3(this.array[e*this.itemSize+1]);return this.normalized&&(t=Fa(t,this.array)),t}setY(e,t){return this.normalized&&(t=Zn(t,this.array)),this.array[e*this.itemSize+1]=Zl(t),this}getZ(e){let t=L3(this.array[e*this.itemSize+2]);return this.normalized&&(t=Fa(t,this.array)),t}setZ(e,t){return this.normalized&&(t=Zn(t,this.array)),this.array[e*this.itemSize+2]=Zl(t),this}getW(e){let t=L3(this.array[e*this.itemSize+3]);return this.normalized&&(t=Fa(t,this.array)),t}setW(e,t){return this.normalized&&(t=Zn(t,this.array)),this.array[e*this.itemSize+3]=Zl(t),this}setXY(e,t,n){return e*=this.itemSize,this.normalized&&(t=Zn(t,this.array),n=Zn(n,this.array)),this.array[e+0]=Zl(t),this.array[e+1]=Zl(n),this}setXYZ(e,t,n,r){return e*=this.itemSize,this.normalized&&(t=Zn(t,this.array),n=Zn(n,this.array),r=Zn(r,this.array)),this.array[e+0]=Zl(t),this.array[e+1]=Zl(n),this.array[e+2]=Zl(r),this}setXYZW(e,t,n,r,s){return e*=this.itemSize,this.normalized&&(t=Zn(t,this.array),n=Zn(n,this.array),r=Zn(r,this.array),s=Zn(s,this.array)),this.array[e+0]=Zl(t),this.array[e+1]=Zl(n),this.array[e+2]=Zl(r),this.array[e+3]=Zl(s),this}},Ln=class extends Hi{constructor(e,t,n){super(new Float32Array(e),t,n)}},pAe=new ka,y2=new re,b8=new re,yl=class{constructor(e=new re,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):pAe.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;y2.subVectors(e,this.center);let t=y2.lengthSq();if(t>this.radius*this.radius){let n=Math.sqrt(t),r=(n-this.radius)*.5;this.center.addScaledVector(y2,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):(b8.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(y2.copy(e.center).add(b8)),this.expandByPoint(y2.copy(e.center).sub(b8))),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}},mAe=0,kc=new cn,w8=new lr,Ov=new re,Kl=new ka,b2=new ka,_o=new re,Xn=class i extends ca{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:mAe++}),this.uuid=Mh(),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(kme(e)?GA:VA)(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 Mn().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 kc.makeRotationFromQuaternion(e),this.applyMatrix4(kc),this}rotateX(e){return kc.makeRotationX(e),this.applyMatrix4(kc),this}rotateY(e){return kc.makeRotationY(e),this.applyMatrix4(kc),this}rotateZ(e){return kc.makeRotationZ(e),this.applyMatrix4(kc),this}translate(e,t,n){return kc.makeTranslation(e,t,n),this.applyMatrix4(kc),this}scale(e,t,n){return kc.makeScale(e,t,n),this.applyMatrix4(kc),this}lookAt(e){return w8.lookAt(e),w8.updateMatrix(),this.applyMatrix4(w8.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(Ov).negate(),this.translate(Ov.x,Ov.y,Ov.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 Ln(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&&Xe("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 ka);let e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){ze("BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box.",this),this.boundingBox.set(new re(-1/0,-1/0,-1/0),new re(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];Kl.setFromBufferAttribute(s),this.morphTargetsRelative?(_o.addVectors(this.boundingBox.min,Kl.min),this.boundingBox.expandByPoint(_o),_o.addVectors(this.boundingBox.max,Kl.max),this.boundingBox.expandByPoint(_o)):(this.boundingBox.expandByPoint(Kl.min),this.boundingBox.expandByPoint(Kl.max))}}else this.boundingBox.makeEmpty();(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&ze('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 yl);let e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){ze("BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere.",this),this.boundingSphere.set(new re,1/0);return}if(e){let n=this.boundingSphere.center;if(Kl.setFromBufferAttribute(e),t)for(let s=0,o=t.length;s<o;s++){let a=t[s];b2.setFromBufferAttribute(a),this.morphTargetsRelative?(_o.addVectors(Kl.min,b2.min),Kl.expandByPoint(_o),_o.addVectors(Kl.max,b2.max),Kl.expandByPoint(_o)):(Kl.expandByPoint(b2.min),Kl.expandByPoint(b2.max))}Kl.getCenter(n);let r=0;for(let s=0,o=e.count;s<o;s++)_o.fromBufferAttribute(e,s),r=Math.max(r,n.distanceToSquared(_o));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++)_o.fromBufferAttribute(a,c),l&&(Ov.fromBufferAttribute(e,c),_o.add(Ov)),r=Math.max(r,n.distanceToSquared(_o))}this.boundingSphere.radius=Math.sqrt(r),isNaN(this.boundingSphere.radius)&&ze('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){ze("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 Hi(new Float32Array(4*n.count),4),this.setAttribute("tangent",o));let a=[],l=[];for(let C=0;C<n.count;C++)a[C]=new re,l[C]=new re;let c=new re,u=new re,f=new re,d=new Oe,A=new Oe,y=new Oe,w=new re,S=new re;function T(C,B,k){c.fromBufferAttribute(n,C),u.fromBufferAttribute(n,B),f.fromBufferAttribute(n,k),d.fromBufferAttribute(s,C),A.fromBufferAttribute(s,B),y.fromBufferAttribute(s,k),u.sub(c),f.sub(c),A.sub(d),y.sub(d);let z=1/(A.x*y.y-y.x*A.y);isFinite(z)&&(w.copy(u).multiplyScalar(y.y).addScaledVector(f,-A.y).multiplyScalar(z),S.copy(f).multiplyScalar(A.x).addScaledVector(u,-y.x).multiplyScalar(z),a[C].add(w),a[B].add(w),a[k].add(w),l[C].add(S),l[B].add(S),l[k].add(S))}let R=this.groups;R.length===0&&(R=[{start:0,count:e.count}]);for(let C=0,B=R.length;C<B;++C){let k=R[C],z=k.start,G=k.count;for(let W=z,Y=z+G;W<Y;W+=3)T(e.getX(W+0),e.getX(W+1),e.getX(W+2))}let I=new re,P=new re,F=new re,D=new re;function L(C){F.fromBufferAttribute(r,C),D.copy(F);let B=a[C];I.copy(B),I.sub(F.multiplyScalar(F.dot(B))).normalize(),P.crossVectors(D,B);let z=P.dot(l[C])<0?-1:1;o.setXYZW(C,I.x,I.y,I.z,z)}for(let C=0,B=R.length;C<B;++C){let k=R[C],z=k.start,G=k.count;for(let W=z,Y=z+G;W<Y;W+=3)L(e.getX(W+0)),L(e.getX(W+1)),L(e.getX(W+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 Hi(new Float32Array(t.count*3),3),this.setAttribute("normal",n);else for(let d=0,A=n.count;d<A;d++)n.setXYZ(d,0,0,0);let r=new re,s=new re,o=new re,a=new re,l=new re,c=new re,u=new re,f=new re;if(e)for(let d=0,A=e.count;d<A;d+=3){let y=e.getX(d+0),w=e.getX(d+1),S=e.getX(d+2);r.fromBufferAttribute(t,y),s.fromBufferAttribute(t,w),o.fromBufferAttribute(t,S),u.subVectors(o,s),f.subVectors(r,s),u.cross(f),a.fromBufferAttribute(n,y),l.fromBufferAttribute(n,w),c.fromBufferAttribute(n,S),a.add(u),l.add(u),c.add(u),n.setXYZ(y,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 d=0,A=t.count;d<A;d+=3)r.fromBufferAttribute(t,d+0),s.fromBufferAttribute(t,d+1),o.fromBufferAttribute(t,d+2),u.subVectors(o,s),f.subVectors(r,s),u.cross(f),n.setXYZ(d+0,u.x,u.y,u.z),n.setXYZ(d+1,u.x,u.y,u.z),n.setXYZ(d+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++)_o.fromBufferAttribute(e,t),_o.normalize(),e.setXYZ(t,_o.x,_o.y,_o.z)}toNonIndexed(){function e(a,l){let c=a.array,u=a.itemSize,f=a.normalized,d=new c.constructor(l.length*u),A=0,y=0;for(let w=0,S=l.length;w<S;w++){a.isInterleavedBufferAttribute?A=l[w]*a.data.stride+a.offset:A=l[w]*u;for(let T=0;T<u;T++)d[y++]=c[A++]}return new Hi(d,u,f)}if(this.index===null)return Xe("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 d=c[u],A=e(d,n);l.push(A)}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,d=c.length;f<d;f++){let A=c[f];u.push(A.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 d=0,A=f.length;d<A;d++)u.push(f[d].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"})}},Rd=class{constructor(e,t){this.isInterleavedBuffer=!0,this.array=e,this.stride=t,this.count=e!==void 0?e.length/t:0,this.usage=i0,this.updateRanges=[],this.version=0,this.uuid=Mh()}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=Mh()),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=Mh()),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}}},Da=new re,Vo=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++)Da.fromBufferAttribute(this,t),Da.applyMatrix4(e),this.setXYZ(t,Da.x,Da.y,Da.z);return this}applyNormalMatrix(e){for(let t=0,n=this.count;t<n;t++)Da.fromBufferAttribute(this,t),Da.applyNormalMatrix(e),this.setXYZ(t,Da.x,Da.y,Da.z);return this}transformDirection(e){for(let t=0,n=this.count;t<n;t++)Da.fromBufferAttribute(this,t),Da.transformDirection(e),this.setXYZ(t,Da.x,Da.y,Da.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=Zn(n,this.array)),this.data.array[e*this.data.stride+this.offset+t]=n,this}setX(e,t){return this.normalized&&(t=Zn(t,this.array)),this.data.array[e*this.data.stride+this.offset]=t,this}setY(e,t){return this.normalized&&(t=Zn(t,this.array)),this.data.array[e*this.data.stride+this.offset+1]=t,this}setZ(e,t){return this.normalized&&(t=Zn(t,this.array)),this.data.array[e*this.data.stride+this.offset+2]=t,this}setW(e,t){return this.normalized&&(t=Zn(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=Zn(t,this.array),n=Zn(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=Zn(t,this.array),n=Zn(n,this.array),r=Zn(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=Zn(t,this.array),n=Zn(n,this.array),r=Zn(r,this.array),s=Zn(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){kA("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 Hi(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){kA("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}}},AAe=0,Hs=class extends ca{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:AAe++}),this.uuid=Mh(),this.name="",this.type="Material",this.blending=Ts,this.side=zo,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.alphaHash=!1,this.blendSrc=Jp,this.blendDst=e0,this.blendEquation=oo,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.blendColor=new zt(0,0,0),this.blendAlpha=0,this.depthFunc=Ch,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=D2,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=bd,this.stencilZFail=bd,this.stencilZPass=bd,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){Xe(`Material: parameter '${t}' has value of undefined.`);continue}let r=this[t];if(r===void 0){Xe(`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!==Ts&&(n.blending=this.blending),this.side!==zo&&(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!==Jp&&(n.blendSrc=this.blendSrc),this.blendDst!==e0&&(n.blendDst=this.blendDst),this.blendEquation!==oo&&(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!==Ch&&(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!==D2&&(n.stencilFunc=this.stencilFunc),this.stencilRef!==0&&(n.stencilRef=this.stencilRef),this.stencilFuncMask!==255&&(n.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==bd&&(n.stencilFail=this.stencilFail),this.stencilZFail!==bd&&(n.stencilZFail=this.stencilZFail),this.stencilZPass!==bd&&(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 zt().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++}},Rh=class extends Hs{constructor(e){super(),this.isSpriteMaterial=!0,this.type="SpriteMaterial",this.color=new zt(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}},Uv,w2=new re,kv=new re,zv=new re,Vv=new Oe,S2=new Oe,PZ=new cn,N3=new re,T2=new re,F3=new re,XY=new Oe,S8=new Oe,$Y=new Oe,qA=class extends lr{constructor(e=new Rh){if(super(),this.isSprite=!0,this.type="Sprite",Uv===void 0){Uv=new Xn;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 Rd(t,5);Uv.setIndex([0,1,2,0,2,3]),Uv.setAttribute("position",new Vo(n,3,0,!1)),Uv.setAttribute("uv",new Vo(n,2,3,!1))}this.geometry=Uv,this.material=e,this.center=new Oe(.5,.5),this.count=1}raycast(e,t){e.camera===null&&ze('Sprite: "Raycaster.camera" needs to be set in order to raycast against sprites.'),kv.setFromMatrixScale(this.matrixWorld),PZ.copy(e.camera.matrixWorld),this.modelViewMatrix.multiplyMatrices(e.camera.matrixWorldInverse,this.matrixWorld),zv.setFromMatrixPosition(this.modelViewMatrix),e.camera.isPerspectiveCamera&&this.material.sizeAttenuation===!1&&kv.multiplyScalar(-zv.z);let n=this.material.rotation,r,s;n!==0&&(s=Math.cos(n),r=Math.sin(n));let o=this.center;B3(N3.set(-.5,-.5,0),zv,o,kv,r,s),B3(T2.set(.5,-.5,0),zv,o,kv,r,s),B3(F3.set(.5,.5,0),zv,o,kv,r,s),XY.set(0,0),S8.set(1,0),$Y.set(1,1);let a=e.ray.intersectTriangle(N3,T2,F3,!1,w2);if(a===null&&(B3(T2.set(-.5,.5,0),zv,o,kv,r,s),S8.set(0,1),a=e.ray.intersectTriangle(N3,F3,T2,!1,w2),a===null))return;let l=e.ray.origin.distanceTo(w2);l<e.near||l>e.far||t.push({distance:l,point:w2.clone(),uv:wd.getInterpolation(w2,N3,T2,F3,XY,S8,$Y,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 B3(i,e,t,n,r,s){Vv.subVectors(i,t).addScalar(.5).multiply(n),r!==void 0?(S2.x=s*Vv.x-r*Vv.y,S2.y=r*Vv.x+s*Vv.y):S2.copy(Vv),i.copy(e),i.x+=S2.x,i.y+=S2.y,i.applyMatrix4(PZ)}var yd=new re,T8=new re,O3=new re,Zp=new re,E8=new re,U3=new re,M8=new re,Pd=class{constructor(e=new re,t=new re(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,yd)),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=yd.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(yd.copy(this.origin).addScaledVector(this.direction,t),yd.distanceToSquared(e))}distanceSqToSegment(e,t,n,r){T8.copy(e).add(t).multiplyScalar(.5),O3.copy(t).sub(e).normalize(),Zp.copy(this.origin).sub(T8);let s=e.distanceTo(t)*.5,o=-this.direction.dot(O3),a=Zp.dot(this.direction),l=-Zp.dot(O3),c=Zp.lengthSq(),u=Math.abs(1-o*o),f,d,A,y;if(u>0)if(f=o*l-a,d=o*a-l,y=s*u,f>=0)if(d>=-y)if(d<=y){let w=1/u;f*=w,d*=w,A=f*(f+o*d+2*a)+d*(o*f+d+2*l)+c}else d=s,f=Math.max(0,-(o*d+a)),A=-f*f+d*(d+2*l)+c;else d=-s,f=Math.max(0,-(o*d+a)),A=-f*f+d*(d+2*l)+c;else d<=-y?(f=Math.max(0,-(-o*s+a)),d=f>0?-s:Math.min(Math.max(-s,-l),s),A=-f*f+d*(d+2*l)+c):d<=y?(f=0,d=Math.min(Math.max(-s,-l),s),A=d*(d+2*l)+c):(f=Math.max(0,-(o*s+a)),d=f>0?s:Math.min(Math.max(-s,-l),s),A=-f*f+d*(d+2*l)+c);else d=o>0?-s:s,f=Math.max(0,-(o*d+a)),A=-f*f+d*(d+2*l)+c;return n&&n.copy(this.origin).addScaledVector(this.direction,f),r&&r.copy(T8).addScaledVector(O3,d),A}intersectSphere(e,t){yd.subVectors(e.center,this.origin);let n=yd.dot(this.direction),r=yd.dot(yd)-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,d=this.origin;return c>=0?(n=(e.min.x-d.x)*c,r=(e.max.x-d.x)*c):(n=(e.max.x-d.x)*c,r=(e.min.x-d.x)*c),u>=0?(s=(e.min.y-d.y)*u,o=(e.max.y-d.y)*u):(s=(e.max.y-d.y)*u,o=(e.min.y-d.y)*u),n>o||s>r||((s>n||isNaN(n))&&(n=s),(o<r||isNaN(r))&&(r=o),f>=0?(a=(e.min.z-d.z)*f,l=(e.max.z-d.z)*f):(a=(e.max.z-d.z)*f,l=(e.min.z-d.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,yd)!==null}intersectTriangle(e,t,n,r,s){E8.subVectors(t,e),U3.subVectors(n,e),M8.crossVectors(E8,U3);let o=this.direction.dot(M8),a;if(o>0){if(r)return null;a=1}else if(o<0)a=-1,o=-o;else return null;Zp.subVectors(this.origin,e);let l=a*this.direction.dot(U3.crossVectors(Zp,U3));if(l<0)return null;let c=a*this.direction.dot(E8.cross(Zp));if(c<0||l+c>o)return null;let u=-a*Zp.dot(M8);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)}},fs=class extends Hs{constructor(e){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new zt(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 Ua,this.combine=tg,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}},YY=new cn,PA=new Pd,k3=new yl,ZY=new re,z3=new re,V3=new re,G3=new re,C8=new re,q3=new re,KY=new re,H3=new re,Hn=class extends lr{constructor(e=new Xn,t=new fs){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){q3.set(0,0,0);for(let l=0,c=s.length;l<c;l++){let u=a[l],f=s[l];u!==0&&(C8.fromBufferAttribute(f,e),o?q3.addScaledVector(C8,u):q3.addScaledVector(C8.sub(t),u))}t.add(q3)}return t}raycast(e,t){let n=this.geometry,r=this.material,s=this.matrixWorld;r!==void 0&&(n.boundingSphere===null&&n.computeBoundingSphere(),k3.copy(n.boundingSphere),k3.applyMatrix4(s),PA.copy(e.ray).recast(e.near),!(k3.containsPoint(PA.origin)===!1&&(PA.intersectSphere(k3,ZY)===null||PA.origin.distanceToSquared(ZY)>(e.far-e.near)**2))&&(YY.copy(s).invert(),PA.copy(e.ray).applyMatrix4(YY),!(n.boundingBox!==null&&PA.intersectsBox(n.boundingBox)===!1)&&this._computeIntersections(e,t,PA)))}_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,d=s.groups,A=s.drawRange;if(a!==null)if(Array.isArray(o))for(let y=0,w=d.length;y<w;y++){let S=d[y],T=o[S.materialIndex],R=Math.max(S.start,A.start),I=Math.min(a.count,Math.min(S.start+S.count,A.start+A.count));for(let P=R,F=I;P<F;P+=3){let D=a.getX(P),L=a.getX(P+1),C=a.getX(P+2);r=W3(this,T,e,n,c,u,f,D,L,C),r&&(r.faceIndex=Math.floor(P/3),r.face.materialIndex=S.materialIndex,t.push(r))}}else{let y=Math.max(0,A.start),w=Math.min(a.count,A.start+A.count);for(let S=y,T=w;S<T;S+=3){let R=a.getX(S),I=a.getX(S+1),P=a.getX(S+2);r=W3(this,o,e,n,c,u,f,R,I,P),r&&(r.faceIndex=Math.floor(S/3),t.push(r))}}else if(l!==void 0)if(Array.isArray(o))for(let y=0,w=d.length;y<w;y++){let S=d[y],T=o[S.materialIndex],R=Math.max(S.start,A.start),I=Math.min(l.count,Math.min(S.start+S.count,A.start+A.count));for(let P=R,F=I;P<F;P+=3){let D=P,L=P+1,C=P+2;r=W3(this,T,e,n,c,u,f,D,L,C),r&&(r.faceIndex=Math.floor(P/3),r.face.materialIndex=S.materialIndex,t.push(r))}}else{let y=Math.max(0,A.start),w=Math.min(l.count,A.start+A.count);for(let S=y,T=w;S<T;S+=3){let R=S,I=S+1,P=S+2;r=W3(this,o,e,n,c,u,f,R,I,P),r&&(r.faceIndex=Math.floor(S/3),t.push(r))}}}};function gAe(i,e,t,n,r,s,o,a){let l;if(e.side===mi?l=n.intersectTriangle(o,s,r,!0,a):l=n.intersectTriangle(r,s,o,e.side===zo,a),l===null)return null;H3.copy(a),H3.applyMatrix4(i.matrixWorld);let c=t.ray.origin.distanceTo(H3);return c<t.near||c>t.far?null:{distance:c,point:H3.clone(),object:i}}function W3(i,e,t,n,r,s,o,a,l,c){i.getVertexPosition(a,z3),i.getVertexPosition(l,V3),i.getVertexPosition(c,G3);let u=gAe(i,e,t,n,z3,V3,G3,KY);if(u){let f=new re;wd.getBarycoord(KY,z3,V3,G3,f),r&&(u.uv=wd.getInterpolatedAttribute(r,a,l,c,f,new Oe)),s&&(u.uv1=wd.getInterpolatedAttribute(s,a,l,c,f,new Oe)),o&&(u.normal=wd.getInterpolatedAttribute(o,a,l,c,f,new re),u.normal.dot(n.direction)>0&&u.normal.multiplyScalar(-1));let d={a,b:l,c,normal:new re,materialIndex:0};wd.getNormal(z3,V3,G3,d.normal),u.face=d,u.barycoord=f}return u}var HA=class extends qs{constructor(e=null,t=1,n=1,r,s,o,a,l,c=Ti,u=Ti,f,d){super(null,o,a,l,c,u,r,s,f,d),this.isDataTexture=!0,this.image={data:e,width:t,height:n},this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}};var Ql=class extends Hi{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 R8=new re,vAe=new re,_Ae=new Mn,Na=class{constructor(e=new re(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=R8.subVectors(n,t).cross(vAe.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(R8),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||_Ae.getNormalMatrix(e),r=this.coplanarPoint(R8).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)}},IA=new yl,xAe=new Oe(.5,.5),j3=new re,zc=class{constructor(e=new Na,t=new Na,n=new Na,r=new Na,s=new Na,o=new Na){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=ko,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],d=s[6],A=s[7],y=s[8],w=s[9],S=s[10],T=s[11],R=s[12],I=s[13],P=s[14],F=s[15];if(r[0].setComponents(c-o,A-u,T-y,F-R).normalize(),r[1].setComponents(c+o,A+u,T+y,F+R).normalize(),r[2].setComponents(c+a,A+f,T+w,F+I).normalize(),r[3].setComponents(c-a,A-f,T-w,F-I).normalize(),n)r[4].setComponents(l,d,S,P).normalize(),r[5].setComponents(c-l,A-d,T-S,F-P).normalize();else if(r[4].setComponents(c-l,A-d,T-S,F-P).normalize(),t===ko)r[5].setComponents(c+l,A+d,T+S,F+P).normalize();else if(t===xl)r[5].setComponents(l,d,S,P).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(),IA.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);else{let t=e.geometry;t.boundingSphere===null&&t.computeBoundingSphere(),IA.copy(t.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere(IA)}intersectsSprite(e){IA.center.set(0,0,0);let t=xAe.distanceTo(e.center);return IA.radius=.7071067811865476+t,IA.applyMatrix4(e.matrixWorld),this.intersectsSphere(IA)}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(j3.x=r.normal.x>0?e.max.x:e.min.x,j3.y=r.normal.y>0?e.max.y:e.min.y,j3.z=r.normal.z>0?e.max.z:e.min.z,r.distanceToPoint(j3)<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)}},QY=new cn,N2=class i{constructor(){this.coordinateSystem=ko,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];QY.multiplyMatrices(s.projectionMatrix,s.matrixWorldInverse),n[r]===void 0&&(n[r]=new zc),n[r].setFromProjectionMatrix(QY,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 zc),t[r].copy(n[r]);return this._count=e._count,this}clone(){return new i().copy(this)}};var Iu=class extends Hs{constructor(e){super(),this.isLineBasicMaterial=!0,this.type="LineBasicMaterial",this.color=new zt(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}},lM=new re,cM=new re,JY=new cn,E2=new Pd,X3=new yl,P8=new re,eZ=new re,o0=class extends lr{constructor(e=new Xn,t=new Iu){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++)lM.fromBufferAttribute(t,r-1),cM.fromBufferAttribute(t,r),n[r]=n[r-1],n[r]+=lM.distanceTo(cM);e.setAttribute("lineDistance",new Ln(n,1))}else Xe("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(),X3.copy(n.boundingSphere),X3.applyMatrix4(r),X3.radius+=s,e.ray.intersectsSphere(X3)===!1)return;JY.copy(r).invert(),E2.copy(e.ray).applyMatrix4(JY);let a=s/((this.scale.x+this.scale.y+this.scale.z)/3),l=a*a,c=this.isLineSegments?2:1,u=n.index,d=n.attributes.position;if(u!==null){let A=Math.max(0,o.start),y=Math.min(u.count,o.start+o.count);for(let w=A,S=y-1;w<S;w+=c){let T=u.getX(w),R=u.getX(w+1),I=$3(this,e,E2,l,T,R,w);I&&t.push(I)}if(this.isLineLoop){let w=u.getX(y-1),S=u.getX(A),T=$3(this,e,E2,l,w,S,y-1);T&&t.push(T)}}else{let A=Math.max(0,o.start),y=Math.min(d.count,o.start+o.count);for(let w=A,S=y-1;w<S;w+=c){let T=$3(this,e,E2,l,w,w+1,w);T&&t.push(T)}if(this.isLineLoop){let w=$3(this,e,E2,l,y-1,A,y-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 $3(i,e,t,n,r,s,o){let a=i.geometry.attributes.position;if(lM.fromBufferAttribute(a,r),cM.fromBufferAttribute(a,s),t.distanceSqToSegment(lM,cM,P8,eZ)>n)return;P8.applyMatrix4(i.matrixWorld);let c=e.ray.origin.distanceTo(P8);if(!(c<e.near||c>e.far))return{distance:c,point:eZ.clone().applyMatrix4(i.matrixWorld),index:o,face:null,faceIndex:null,barycoord:null,object:i}}var tZ=new re,nZ=new re,Jv=class extends o0{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)tZ.fromBufferAttribute(t,r),nZ.fromBufferAttribute(t,r+1),n[r]=r===0?0:n[r-1],n[r+1]=n[r]+tZ.distanceTo(nZ);e.setAttribute("lineDistance",new Ln(n,1))}else Xe("LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}};var a0=class extends Hs{constructor(e){super(),this.isPointsMaterial=!0,this.type="PointsMaterial",this.color=new zt(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}},iZ=new cn,z8=new Pd,Y3=new yl,Z3=new re,F2=class extends lr{constructor(e=new Xn,t=new a0){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(),Y3.copy(n.boundingSphere),Y3.applyMatrix4(r),Y3.radius+=s,e.ray.intersectsSphere(Y3)===!1)return;iZ.copy(r).invert(),z8.copy(e.ray).applyMatrix4(iZ);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 d=Math.max(0,o.start),A=Math.min(c.count,o.start+o.count);for(let y=d,w=A;y<w;y++){let S=c.getX(y);Z3.fromBufferAttribute(f,S),rZ(Z3,S,l,r,e,t,this)}}else{let d=Math.max(0,o.start),A=Math.min(f.count,o.start+o.count);for(let y=d,w=A;y<w;y++)Z3.fromBufferAttribute(f,y),rZ(Z3,y,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 rZ(i,e,t,n,r,s,o){let a=z8.distanceSqToPoint(i);if(a<t){let l=new re;z8.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 WA=class extends qs{constructor(e,t){super({width:e,height:t}),this.isFramebufferTexture=!0,this.magFilter=Ti,this.minFilter=Ti,this.generateMipmaps=!1,this.needsUpdate=!0}};var Ph=class extends qs{constructor(e=[],t=ec,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 Es=class extends qs{constructor(e,t,n=xi,r,s,o,a=Ti,l=Ti,c,u=Vs,f=1){if(u!==Vs&&u!==xo)throw new Error("THREE.DepthTexture: format must be either THREE.DepthFormat or THREE.DepthStencilFormat");let d={width:e,height:t,depth:f};super(d,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 Zv(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}},e_=class extends Es{constructor(e,t=xi,n=ec,r,s,o=Ti,a=Ti,l,c=Vs){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}},B2=class extends qs{constructor(e=null){super(),this.sourceTexture=e,this.isExternalTexture=!0}copy(e){return super.copy(e),this.sourceTexture=e.sourceTexture,this}},Lu=class i extends Xn{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=[],d=0,A=0;y("z","y","x",-1,-1,n,t,e,o,s,0),y("z","y","x",1,-1,n,t,-e,o,s,1),y("x","z","y",1,1,e,n,t,r,o,2),y("x","z","y",1,-1,e,n,-t,r,o,3),y("x","y","z",1,-1,e,t,n,r,s,4),y("x","y","z",-1,-1,e,t,-n,r,s,5),this.setIndex(l),this.setAttribute("position",new Ln(c,3)),this.setAttribute("normal",new Ln(u,3)),this.setAttribute("uv",new Ln(f,2));function y(w,S,T,R,I,P,F,D,L,C,B){let k=P/L,z=F/C,G=P/2,W=F/2,Y=D/2,H=L+1,$=C+1,J=0,te=0,ce=new re;for(let he=0;he<$;he++){let ve=he*z-W;for(let Re=0;Re<H;Re++){let Qe=Re*k-G;ce[w]=Qe*R,ce[S]=ve*I,ce[T]=Y,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(Re/L),f.push(1-he/C),J+=1}}for(let he=0;he<C;he++)for(let ve=0;ve<L;ve++){let Re=d+ve+H*he,Qe=d+ve+H*(he+1),Fe=d+(ve+1)+H*(he+1),mt=d+(ve+1)+H*he;l.push(Re,Qe,mt),l.push(Qe,Fe,mt),te+=6}a.addGroup(A,te,B),A+=te,d+=J}}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 t_=class i extends Xn{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 re,u=new Oe;o.push(0,0,0),a.push(0,0,1),l.push(.5,.5);for(let f=0,d=3;f<=t;f++,d+=3){let A=n+f/t*r;c.x=e*Math.cos(A),c.y=e*Math.sin(A),o.push(c.x,c.y,c.z),a.push(0,0,1),u.x=(o[d]/e+1)/2,u.y=(o[d+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 Ln(o,3)),this.setAttribute("normal",new Ln(a,3)),this.setAttribute("uv",new Ln(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)}},jA=class i extends Xn{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=[],d=[],A=[],y=0,w=[],S=n/2,T=0;R(),o===!1&&(e>0&&I(!0),t>0&&I(!1)),this.setIndex(u),this.setAttribute("position",new Ln(f,3)),this.setAttribute("normal",new Ln(d,3)),this.setAttribute("uv",new Ln(A,2));function R(){let P=new re,F=new re,D=0,L=(t-e)/n;for(let C=0;C<=s;C++){let B=[],k=C/s,z=k*(t-e)+e;for(let G=0;G<=r;G++){let W=G/r,Y=W*l+a,H=Math.sin(Y),$=Math.cos(Y);F.x=z*H,F.y=-k*n+S,F.z=z*$,f.push(F.x,F.y,F.z),P.set(H,L,$).normalize(),d.push(P.x,P.y,P.z),A.push(W,1-k),B.push(y++)}w.push(B)}for(let C=0;C<r;C++)for(let B=0;B<s;B++){let k=w[B][C],z=w[B+1][C],G=w[B+1][C+1],W=w[B][C+1];(e>0||B!==0)&&(u.push(k,z,W),D+=3),(t>0||B!==s-1)&&(u.push(z,G,W),D+=3)}c.addGroup(T,D,0),T+=D}function I(P){let F=y,D=new Oe,L=new re,C=0,B=P===!0?e:t,k=P===!0?1:-1;for(let G=1;G<=r;G++)f.push(0,S*k,0),d.push(0,k,0),A.push(.5,.5),y++;let z=y;for(let G=0;G<=r;G++){let Y=G/r*l+a,H=Math.cos(Y),$=Math.sin(Y);L.x=B*$,L.y=S*k,L.z=B*H,f.push(L.x,L.y,L.z),d.push(0,k,0),D.x=H*.5+.5,D.y=$*.5*k+.5,A.push(D.x,D.y),y++}for(let G=0;G<r;G++){let W=F+G,Y=z+G;P===!0?u.push(Y,Y+1,W):u.push(Y+1,Y,W),C+=3}c.addGroup(T,C,P===!0?1:2),T+=C}}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 za=class{constructor(){this.type="Curve",this.arcLengthDivisions=200,this.needsUpdate=!1,this.cacheArcLengths=null}getPoint(){Xe("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],d=n[r+1]-u,A=(o-u)/d;return(r+A)/(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 re);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 re,r=[],s=[],o=[],a=new re,l=new cn;for(let A=0;A<=e;A++){let y=A/e;r[A]=this.getTangentAt(y,new re)}s[0]=new re,o[0]=new re;let c=Number.MAX_VALUE,u=Math.abs(r[0].x),f=Math.abs(r[0].y),d=Math.abs(r[0].z);u<=c&&(c=u,n.set(1,0,0)),f<=c&&(c=f,n.set(0,1,0)),d<=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 A=1;A<=e;A++){if(s[A]=s[A-1].clone(),o[A]=o[A-1].clone(),a.crossVectors(r[A-1],r[A]),a.length()>Number.EPSILON){a.normalize();let y=Math.acos(Nn(r[A-1].dot(r[A]),-1,1));s[A].applyMatrix4(l.makeRotationAxis(a,y))}o[A].crossVectors(r[A],s[A])}if(t===!0){let A=Math.acos(Nn(s[0].dot(s[e]),-1,1));A/=e,r[0].dot(a.crossVectors(s[0],s[e]))>0&&(A=-A);for(let y=1;y<=e;y++)s[y].applyMatrix4(l.makeRotationAxis(r[y],A*y)),o[y].crossVectors(r[y],s[y])}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}},n_=class extends za{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),d=l-this.aX,A=c-this.aY;l=d*u-A*f+this.aX,c=d*f+A*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}},uM=class extends n_{constructor(e,t,n,r,s,o){super(e,t,n,n,r,s,o),this.isArcCurve=!0,this.type="ArcCurve"}};function vF(){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 d=(o-s)/c-(a-s)/(c+u)+(a-o)/u,A=(a-o)/u-(l-o)/(u+f)+(l-a)/f;d*=u,A*=u,r(o,a,d,A)},calc:function(s){let o=s*s,a=o*s;return i+e*s+t*o+n*a}}}var sZ=new re,oZ=new re,I8=new vF,L8=new vF,D8=new vF,hM=class extends za{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 re){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]:(oZ.subVectors(r[0],r[1]).add(r[0]),c=oZ);let f=r[a%s],d=r[(a+1)%s];if(this.closed||a+2<s?u=r[(a+2)%s]:(sZ.subVectors(r[s-1],r[s-2]).add(r[s-1]),u=sZ),this.curveType==="centripetal"||this.curveType==="chordal"){let A=this.curveType==="chordal"?.5:.25,y=Math.pow(c.distanceToSquared(f),A),w=Math.pow(f.distanceToSquared(d),A),S=Math.pow(d.distanceToSquared(u),A);w<1e-4&&(w=1),y<1e-4&&(y=w),S<1e-4&&(S=w),I8.initNonuniformCatmullRom(c.x,f.x,d.x,u.x,y,w,S),L8.initNonuniformCatmullRom(c.y,f.y,d.y,u.y,y,w,S),D8.initNonuniformCatmullRom(c.z,f.z,d.z,u.z,y,w,S)}else this.curveType==="catmullrom"&&(I8.initCatmullRom(c.x,f.x,d.x,u.x,this.tension),L8.initCatmullRom(c.y,f.y,d.y,u.y,this.tension),D8.initCatmullRom(c.z,f.z,d.z,u.z,this.tension));return n.set(I8.calc(l),L8.calc(l),D8.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 re().fromArray(r))}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this}};function aZ(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 yAe(i,e){let t=1-i;return t*t*e}function bAe(i,e){return 2*(1-i)*i*e}function wAe(i,e){return i*i*e}function P2(i,e,t,n){return yAe(i,e)+bAe(i,t)+wAe(i,n)}function SAe(i,e){let t=1-i;return t*t*t*e}function TAe(i,e){let t=1-i;return 3*t*t*i*e}function EAe(i,e){return 3*(1-i)*i*i*e}function MAe(i,e){return i*i*i*e}function I2(i,e,t,n,r){return SAe(i,e)+TAe(i,t)+EAe(i,n)+MAe(i,r)}var O2=class extends za{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(I2(e,r.x,s.x,o.x,a.x),I2(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}},i_=class extends za{constructor(e=new re,t=new re,n=new re,r=new re){super(),this.isCubicBezierCurve3=!0,this.type="CubicBezierCurve3",this.v0=e,this.v1=t,this.v2=n,this.v3=r}getPoint(e,t=new re){let n=t,r=this.v0,s=this.v1,o=this.v2,a=this.v3;return n.set(I2(e,r.x,s.x,o.x,a.x),I2(e,r.y,s.y,o.y,a.y),I2(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}},U2=class extends za{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}},fM=class extends za{constructor(e=new re,t=new re){super(),this.isLineCurve3=!0,this.type="LineCurve3",this.v1=e,this.v2=t}getPoint(e,t=new re){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 re){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}},k2=class extends za{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(P2(e,r.x,s.x,o.x),P2(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}},z2=class extends za{constructor(e=new re,t=new re,n=new re){super(),this.isQuadraticBezierCurve3=!0,this.type="QuadraticBezierCurve3",this.v0=e,this.v1=t,this.v2=n}getPoint(e,t=new re){let n=t,r=this.v0,s=this.v1,o=this.v2;return n.set(P2(e,r.x,s.x,o.x),P2(e,r.y,s.y,o.y),P2(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}},V2=class extends za{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(aZ(a,l.x,c.x,u.x,f.x),aZ(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}},dM=Object.freeze({__proto__:null,ArcCurve:uM,CatmullRomCurve3:hM,CubicBezierCurve:O2,CubicBezierCurve3:i_,EllipseCurve:n_,LineCurve:U2,LineCurve3:fM,QuadraticBezierCurve:k2,QuadraticBezierCurve3:z2,SplineCurve:V2}),pM=class extends za{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 dM[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 dM[r.type]().fromJSON(r))}return this}},XA=class extends pM{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 U2(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 k2(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 O2(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 V2(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 n_(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}},G2=class extends XA{constructor(e){super(e),this.uuid=Mh(),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 XA().fromJSON(r))}return this}};function CAe(i,e,t=2){let n=e&&e.length,r=n?e[0]*t:i.length,s=IZ(i,0,r,t,!0),o=[];if(!s||s.next===s.prev)return o;let a,l,c;if(n&&(s=DAe(i,e,s,t)),i.length>80*t){a=i[0],l=i[1];let u=a,f=l;for(let d=t;d<r;d+=t){let A=i[d],y=i[d+1];A<a&&(a=A),y<l&&(l=y),A>u&&(u=A),y>f&&(f=y)}c=Math.max(u-a,f-l),c=c!==0?32767/c:0}return q2(s,o,t,a,l,c,0),o}function IZ(i,e,t,n,r){let s;if(r===HAe(i,e,t,n)>0)for(let o=e;o<t;o+=n)s=lZ(o/n|0,i[o],i[o+1],s);else for(let o=t-n;o>=e;o-=n)s=lZ(o/n|0,i[o],i[o+1],s);return s&&r_(s,s.next)&&(W2(s),s=s.next),s}function $A(i,e){if(!i)return i;e||(e=i);let t=i,n;do if(n=!1,!t.steiner&&(r_(t,t.next)||Zr(t.prev,t,t.next)===0)){if(W2(t),t=e=t.prev,t===t.next)break;n=!0}else t=t.next;while(n||t!==e);return e}function q2(i,e,t,n,r,s,o){if(!i)return;!o&&s&&UAe(i,n,r,s);let a=i;for(;i.prev!==i.next;){let l=i.prev,c=i.next;if(s?PAe(i,n,r,s):RAe(i)){e.push(l.i,i.i,c.i),W2(i),i=c.next,a=c.next;continue}if(i=c,i===a){o?o===1?(i=IAe($A(i),e),q2(i,e,t,n,r,s,2)):o===2&&LAe(i,e,t,n,r,s):q2($A(i),e,t,n,r,s,1);break}}}function RAe(i){let e=i.prev,t=i,n=i.next;if(Zr(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),d=Math.max(r,s,o),A=Math.max(a,l,c),y=n.next;for(;y!==e;){if(y.x>=u&&y.x<=d&&y.y>=f&&y.y<=A&&M2(r,a,s,l,o,c,y.x,y.y)&&Zr(y.prev,y,y.next)>=0)return!1;y=y.next}return!0}function PAe(i,e,t,n){let r=i.prev,s=i,o=i.next;if(Zr(r,s,o)>=0)return!1;let a=r.x,l=s.x,c=o.x,u=r.y,f=s.y,d=o.y,A=Math.min(a,l,c),y=Math.min(u,f,d),w=Math.max(a,l,c),S=Math.max(u,f,d),T=V8(A,y,e,t,n),R=V8(w,S,e,t,n),I=i.prevZ,P=i.nextZ;for(;I&&I.z>=T&&P&&P.z<=R;){if(I.x>=A&&I.x<=w&&I.y>=y&&I.y<=S&&I!==r&&I!==o&&M2(a,u,l,f,c,d,I.x,I.y)&&Zr(I.prev,I,I.next)>=0||(I=I.prevZ,P.x>=A&&P.x<=w&&P.y>=y&&P.y<=S&&P!==r&&P!==o&&M2(a,u,l,f,c,d,P.x,P.y)&&Zr(P.prev,P,P.next)>=0))return!1;P=P.nextZ}for(;I&&I.z>=T;){if(I.x>=A&&I.x<=w&&I.y>=y&&I.y<=S&&I!==r&&I!==o&&M2(a,u,l,f,c,d,I.x,I.y)&&Zr(I.prev,I,I.next)>=0)return!1;I=I.prevZ}for(;P&&P.z<=R;){if(P.x>=A&&P.x<=w&&P.y>=y&&P.y<=S&&P!==r&&P!==o&&M2(a,u,l,f,c,d,P.x,P.y)&&Zr(P.prev,P,P.next)>=0)return!1;P=P.nextZ}return!0}function IAe(i,e){let t=i;do{let n=t.prev,r=t.next.next;!r_(n,r)&&DZ(n,t,t.next,r)&&H2(n,r)&&H2(r,n)&&(e.push(n.i,t.i,r.i),W2(t),W2(t.next),t=i=r),t=t.next}while(t!==i);return $A(t)}function LAe(i,e,t,n,r,s){let o=i;do{let a=o.next.next;for(;a!==o.prev;){if(o.i!==a.i&&VAe(o,a)){let l=NZ(o,a);o=$A(o,o.next),l=$A(l,l.next),q2(o,e,t,n,r,s,0),q2(l,e,t,n,r,s,0);return}a=a.next}o=o.next}while(o!==i)}function DAe(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=IZ(i,a,l,n,!1);c===c.next&&(c.steiner=!0),r.push(zAe(c))}r.sort(NAe);for(let s=0;s<r.length;s++)t=FAe(r[s],t);return t}function NAe(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 FAe(i,e){let t=BAe(i,e);if(!t)return e;let n=NZ(t,i);return $A(n,n.next),$A(t,t.next)}function BAe(i,e){let t=e,n=i.x,r=i.y,s=-1/0,o;if(r_(i,t))return t;do{if(r_(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&&LZ(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);H2(t,i)&&(f<u||f===u&&(t.x>o.x||t.x===o.x&&OAe(o,t)))&&(o=t,u=f)}t=t.next}while(t!==a);return o}function OAe(i,e){return Zr(i.prev,i,e.prev)<0&&Zr(e.next,i,i.next)<0}function UAe(i,e,t,n){let r=i;do r.z===0&&(r.z=V8(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,kAe(r)}function kAe(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 V8(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 zAe(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 LZ(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 M2(i,e,t,n,r,s,o,a){return!(i===o&&e===a)&&LZ(i,e,t,n,r,s,o,a)}function VAe(i,e){return i.next.i!==e.i&&i.prev.i!==e.i&&!GAe(i,e)&&(H2(i,e)&&H2(e,i)&&qAe(i,e)&&(Zr(i.prev,i,e.prev)||Zr(i,e.prev,e))||r_(i,e)&&Zr(i.prev,i,i.next)>0&&Zr(e.prev,e,e.next)>0)}function Zr(i,e,t){return(e.y-i.y)*(t.x-e.x)-(e.x-i.x)*(t.y-e.y)}function r_(i,e){return i.x===e.x&&i.y===e.y}function DZ(i,e,t,n){let r=Q3(Zr(i,e,t)),s=Q3(Zr(i,e,n)),o=Q3(Zr(t,n,i)),a=Q3(Zr(t,n,e));return!!(r!==s&&o!==a||r===0&&K3(i,t,e)||s===0&&K3(i,n,e)||o===0&&K3(t,i,n)||a===0&&K3(t,e,n))}function K3(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 Q3(i){return i>0?1:i<0?-1:0}function GAe(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&&DZ(t,t.next,i,e))return!0;t=t.next}while(t!==i);return!1}function H2(i,e){return Zr(i.prev,i,i.next)<0?Zr(i,e,i.next)>=0&&Zr(i,i.prev,e)>=0:Zr(i,e,i.prev)<0||Zr(i,i.next,e)<0}function qAe(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 NZ(i,e){let t=G8(i.i,i.x,i.y),n=G8(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 lZ(i,e,t,n){let r=G8(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 W2(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 G8(i,e,t){return{i,x:e,y:t,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}function HAe(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 q8=class{static triangulate(e,t,n=2){return CAe(e,t,n)}},Qp=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=[];cZ(e),uZ(n,e);let o=e.length;t.forEach(cZ);for(let l=0;l<t.length;l++)r.push(o),o+=t[l].length,uZ(n,t[l]);let a=q8.triangulate(n,r);for(let l=0;l<a.length;l+=3)s.push(a.slice(l,l+3));return s}};function cZ(i){let e=i.length;e>2&&i[e-1].equals(i[0])&&i.pop()}function uZ(i,e){for(let t=0;t<e.length;t++)i.push(e[t].x),i.push(e[t].y)}var j2=class i extends Xn{constructor(e=new G2([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 Ln(r,3)),this.setAttribute("uv",new Ln(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,d=t.bevelEnabled!==void 0?t.bevelEnabled:!0,A=t.bevelThickness!==void 0?t.bevelThickness:.2,y=t.bevelSize!==void 0?t.bevelSize:A-.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:WAe,I,P=!1,F,D,L,C;if(T){I=T.getSpacedPoints(u),P=!0,d=!1;let $e=T.isCatmullRomCurve3?T.closed:!1;F=T.computeFrenetFrames(u,$e),D=new re,L=new re,C=new re}d||(S=0,A=0,y=0,w=0);let B=a.extractPoints(c),k=B.shape,z=B.holes;if(!Qp.isClockWise(k)){k=k.reverse();for(let $e=0,ot=z.length;$e<ot;$e++){let nt=z[$e];Qp.isClockWise(nt)&&(z[$e]=nt.reverse())}}function W($e){let nt=10000000000000001e-36,bt=$e[0];for(let yt=1;yt<=$e.length;yt++){let hn=yt%$e.length,en=$e[hn],tn=en.x-bt.x,bn=en.y-bt.y,_e=tn*tn+bn*bn,vi=Math.max(Math.abs(en.x),Math.abs(en.y),Math.abs(bt.x),Math.abs(bt.y)),zn=nt*vi*vi;if(_e<=zn){$e.splice(hn,1),yt--;continue}bt=en}}W(k),z.forEach(W);let Y=z.length,H=k;for(let $e=0;$e<Y;$e++){let ot=z[$e];k=k.concat(ot)}function $($e,ot,nt){return ot||ze("ExtrudeGeometry: vec does not exist"),$e.clone().addScaledVector(ot,nt)}let J=k.length;function te($e,ot,nt){let bt,yt,hn,en=$e.x-ot.x,tn=$e.y-ot.y,bn=nt.x-$e.x,_e=nt.y-$e.y,vi=en*en+tn*tn,zn=en*_e-tn*bn;if(Math.abs(zn)>Number.EPSILON){let le=Math.sqrt(vi),Z=Math.sqrt(bn*bn+_e*_e),Te=ot.x-tn/le,Ie=ot.y+en/le,Ge=nt.x-_e/Z,vt=nt.y+bn/Z,Tt=((Ge-Te)*_e-(vt-Ie)*bn)/(en*_e-tn*bn);bt=Te+en*Tt-$e.x,yt=Ie+tn*Tt-$e.y;let qe=bt*bt+yt*yt;if(qe<=2)return new Oe(bt,yt);hn=Math.sqrt(qe/2)}else{let le=!1;en>Number.EPSILON?bn>Number.EPSILON&&(le=!0):en<-Number.EPSILON?bn<-Number.EPSILON&&(le=!0):Math.sign(tn)===Math.sign(_e)&&(le=!0),le?(bt=-tn,yt=en,hn=Math.sqrt(vi)):(bt=en,yt=tn,hn=Math.sqrt(vi/2))}return new Oe(bt/hn,yt/hn)}let ce=[];for(let $e=0,ot=H.length,nt=ot-1,bt=$e+1;$e<ot;$e++,nt++,bt++)nt===ot&&(nt=0),bt===ot&&(bt=0),ce[$e]=te(H[$e],H[nt],H[bt]);let he=[],ve,Re=ce.concat();for(let $e=0,ot=Y;$e<ot;$e++){let nt=z[$e];ve=[];for(let bt=0,yt=nt.length,hn=yt-1,en=bt+1;bt<yt;bt++,hn++,en++)hn===yt&&(hn=0),en===yt&&(en=0),ve[bt]=te(nt[bt],nt[hn],nt[en]);he.push(ve),Re=Re.concat(ve)}let Qe;if(S===0)Qe=Qp.triangulateShape(H,z);else{let $e=[],ot=[];for(let nt=0;nt<S;nt++){let bt=nt/S,yt=A*Math.cos(bt*Math.PI/2),hn=y*Math.sin(bt*Math.PI/2)+w;for(let en=0,tn=H.length;en<tn;en++){let bn=$(H[en],ce[en],hn);Mt(bn.x,bn.y,-yt),bt===0&&$e.push(bn)}for(let en=0,tn=Y;en<tn;en++){let bn=z[en];ve=he[en];let _e=[];for(let vi=0,zn=bn.length;vi<zn;vi++){let le=$(bn[vi],ve[vi],hn);Mt(le.x,le.y,-yt),bt===0&&_e.push(le)}bt===0&&ot.push(_e)}}Qe=Qp.triangulateShape($e,ot)}let Fe=Qe.length,mt=y+w;for(let $e=0;$e<J;$e++){let ot=d?$(k[$e],Re[$e],mt):k[$e];P?(L.copy(F.normals[0]).multiplyScalar(ot.x),D.copy(F.binormals[0]).multiplyScalar(ot.y),C.copy(I[0]).add(L).add(D),Mt(C.x,C.y,C.z)):Mt(ot.x,ot.y,0)}for(let $e=1;$e<=u;$e++)for(let ot=0;ot<J;ot++){let nt=d?$(k[ot],Re[ot],mt):k[ot];P?(L.copy(F.normals[$e]).multiplyScalar(nt.x),D.copy(F.binormals[$e]).multiplyScalar(nt.y),C.copy(I[$e]).add(L).add(D),Mt(C.x,C.y,C.z)):Mt(nt.x,nt.y,f/u*$e)}for(let $e=S-1;$e>=0;$e--){let ot=$e/S,nt=A*Math.cos(ot*Math.PI/2),bt=y*Math.sin(ot*Math.PI/2)+w;for(let yt=0,hn=H.length;yt<hn;yt++){let en=$(H[yt],ce[yt],bt);Mt(en.x,en.y,f+nt)}for(let yt=0,hn=z.length;yt<hn;yt++){let en=z[yt];ve=he[yt];for(let tn=0,bn=en.length;tn<bn;tn++){let _e=$(en[tn],ve[tn],bt);P?Mt(_e.x,_e.y+I[u-1].y,I[u-1].x+nt):Mt(_e.x,_e.y,f+nt)}}}Ee(),Ve();function Ee(){let $e=r.length/3;if(d){let ot=0,nt=J*ot;for(let bt=0;bt<Fe;bt++){let yt=Qe[bt];Et(yt[2]+nt,yt[1]+nt,yt[0]+nt)}ot=u+S*2,nt=J*ot;for(let bt=0;bt<Fe;bt++){let yt=Qe[bt];Et(yt[0]+nt,yt[1]+nt,yt[2]+nt)}}else{for(let ot=0;ot<Fe;ot++){let nt=Qe[ot];Et(nt[2],nt[1],nt[0])}for(let ot=0;ot<Fe;ot++){let nt=Qe[ot];Et(nt[0]+J*u,nt[1]+J*u,nt[2]+J*u)}}n.addGroup($e,r.length/3-$e,0)}function Ve(){let $e=r.length/3,ot=0;Ye(H,ot),ot+=H.length;for(let nt=0,bt=z.length;nt<bt;nt++){let yt=z[nt];Ye(yt,ot),ot+=yt.length}n.addGroup($e,r.length/3-$e,1)}function Ye($e,ot){let nt=$e.length;for(;--nt>=0;){let bt=nt,yt=nt-1;yt<0&&(yt=$e.length-1);for(let hn=0,en=u+S*2;hn<en;hn++){let tn=J*hn,bn=J*(hn+1),_e=ot+bt+tn,vi=ot+yt+tn,zn=ot+yt+bn,le=ot+bt+bn;Pt(_e,vi,zn,le)}}}function Mt($e,ot,nt){l.push($e),l.push(ot),l.push(nt)}function Et($e,ot,nt){dn($e),dn(ot),dn(nt);let bt=r.length/3,yt=R.generateTopUV(n,r,bt-3,bt-2,bt-1);Gt(yt[0]),Gt(yt[1]),Gt(yt[2])}function Pt($e,ot,nt,bt){dn($e),dn(ot),dn(bt),dn(ot),dn(nt),dn(bt);let yt=r.length/3,hn=R.generateSideWallUV(n,r,yt-6,yt-3,yt-2,yt-1);Gt(hn[0]),Gt(hn[1]),Gt(hn[3]),Gt(hn[1]),Gt(hn[2]),Gt(hn[3])}function dn($e){r.push(l[$e*3+0]),r.push(l[$e*3+1]),r.push(l[$e*3+2])}function Gt($e){s.push($e.x),s.push($e.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 jAe(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 dM[r.type]().fromJSON(r)),new i(n,e.options)}},WAe={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],d=e[r*3],A=e[r*3+1],y=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(d,1-y),new Oe(w,1-T)]:[new Oe(a,1-l),new Oe(u,1-f),new Oe(A,1-y),new Oe(S,1-T)]}};function jAe(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 YA=class i extends Xn{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,d=t/l,A=[],y=[],w=[],S=[];for(let T=0;T<u;T++){let R=T*d-o;for(let I=0;I<c;I++){let P=I*f-s;y.push(P,-R,0),w.push(0,0,1),S.push(I/a),S.push(1-T/l)}}for(let T=0;T<l;T++)for(let R=0;R<a;R++){let I=R+c*T,P=R+c*(T+1),F=R+1+c*(T+1),D=R+1+c*T;A.push(I,P,D),A.push(P,F,D)}this.setIndex(A),this.setAttribute("position",new Ln(y,3)),this.setAttribute("normal",new Ln(w,3)),this.setAttribute("uv",new Ln(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 Va=class i extends Xn{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 re,d=new re,A=[],y=[],w=[],S=[];for(let T=0;T<=n;T++){let R=[],I=T/n,P=o+I*a,F=e*Math.cos(P),D=Math.sqrt(e*e-F*F),L=0;T===0&&o===0?L=.5/t:T===n&&l===Math.PI&&(L=-.5/t);for(let C=0;C<=t;C++){let B=C/t,k=r+B*s;f.x=-D*Math.cos(k),f.y=F,f.z=D*Math.sin(k),y.push(f.x,f.y,f.z),d.copy(f).normalize(),w.push(d.x,d.y,d.z),S.push(B+L,1-I),R.push(c++)}u.push(R)}for(let T=0;T<n;T++)for(let R=0;R<t;R++){let I=u[T][R+1],P=u[T][R],F=u[T+1][R],D=u[T+1][R+1];(T!==0||o>0)&&A.push(I,P,D),(T!==n-1||l<Math.PI)&&A.push(P,F,D)}this.setIndex(A),this.setAttribute("position",new Ln(y,3)),this.setAttribute("normal",new Ln(w,3)),this.setAttribute("uv",new Ln(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 X2=class i extends Xn{constructor(e=new z2(new re(-1,-1,0),new re(-1,1,0),new re(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 re,l=new re,c=new Oe,u=new re,f=[],d=[],A=[],y=[];w(),this.setIndex(y),this.setAttribute("position",new Ln(f,3)),this.setAttribute("normal",new Ln(d,3)),this.setAttribute("uv",new Ln(A,2));function w(){for(let I=0;I<t;I++)S(I);S(s===!1?t:0),R(),T()}function S(I){u=e.getPointAt(I/t,u);let P=o.normals[I],F=o.binormals[I];for(let D=0;D<=r;D++){let L=D/r*Math.PI*2,C=Math.sin(L),B=-Math.cos(L);l.x=B*P.x+C*F.x,l.y=B*P.y+C*F.y,l.z=B*P.z+C*F.z,l.normalize(),d.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 I=1;I<=t;I++)for(let P=1;P<=r;P++){let F=(r+1)*(I-1)+(P-1),D=(r+1)*I+(P-1),L=(r+1)*I+P,C=(r+1)*(I-1)+P;y.push(F,D,C),y.push(D,L,C)}}function R(){for(let I=0;I<=t;I++)for(let P=0;P<=r;P++)c.x=I/t,c.y=P/r,A.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 dM[e.path.type]().fromJSON(e.path),e.tubularSegments,e.radius,e.radialSegments,e.closed)}},$2=class extends Xn{constructor(e=null){if(super(),this.type="WireframeGeometry",this.parameters={geometry:e},e!==null){let t=[],n=new Set,r=new re,s=new re;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],d=f.start,A=f.count;for(let y=d,w=d+A;y<w;y+=3)for(let S=0;S<3;S++){let T=a.getX(y+S),R=a.getX(y+(S+1)%3);r.fromBufferAttribute(o,T),s.fromBufferAttribute(o,R),hZ(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),hZ(r,s,n)===!0&&(t.push(r.x,r.y,r.z),t.push(s.x,s.y,s.z))}}this.setAttribute("position",new Ln(t,3))}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}};function hZ(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 Y2=class extends Hs{constructor(e){super(),this.isShadowMaterial=!0,this.type="ShadowMaterial",this.color=new zt(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 fg(i){let e={};for(let t in i){e[t]={};for(let n in i[t]){let r=i[t][n];if(fZ(r))r.isRenderTargetTexture?(Xe("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(fZ(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 fa(i){let e={};for(let t=0;t<i.length;t++){let n=fg(i[t]);for(let r in n)e[r]=n[r]}return e}function fZ(i){return i&&(i.isColor||i.isMatrix3||i.isMatrix4||i.isVector2||i.isVector3||i.isVector4||i.isTexture||i.isQuaternion)}function XAe(i){let e=[];for(let t=0;t<i.length;t++)e.push(i[t].clone());return e}function _F(i){let e=i.getRenderTarget();return e===null?i.outputColorSpace:e.isXRRenderTarget===!0?e.texture.colorSpace:ln.workingColorSpace}var dg={clone:fg,merge:fa},$Ae=`void main() {1111 gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );12-}`,pAe=`void main() {12+}`,YAe=`void main() {1313 gl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );14-}`,ds=class extends Ws{constructor(e){super(),this.isShaderMaterial=!0,this.type="ShaderMaterial",this.defines={},this.uniforms={},this.uniformsGroups=[],this.vertexShader=dAe,this.fragmentShader=pAe,this.linewidth=1,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.clipping=!1,this.forceSinglePass=!0,this.extensions={clipCullDistance:!1,multiDraw:!1},this.defaultAttributeValues={color:[1,1,1],uv:[0,0],uv1:[0,0]},this.index0AttributeName=void 0,this.uniformsNeedUpdate=!1,this.glslVersion=null,e!==void 0&&this.setValues(e)}copy(e){return super.copy(e),this.fragmentShader=e.fragmentShader,this.vertexShader=e.vertexShader,this.uniforms=ag(e.uniforms),this.uniformsGroups=fAe(e.uniformsGroups),this.defines=Object.assign({},e.defines),this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.fog=e.fog,this.lights=e.lights,this.clipping=e.clipping,this.extensions=Object.assign({},e.extensions),this.glslVersion=e.glslVersion,this.defaultAttributeValues=Object.assign({},e.defaultAttributeValues),this.index0AttributeName=e.index0AttributeName,this.uniformsNeedUpdate=e.uniformsNeedUpdate,this}toJSON(e){let t=super.toJSON(e);t.glslVersion=this.glslVersion,t.uniforms={};for(let r in this.uniforms){let o=this.uniforms[r].value;o&&o.isTexture?t.uniforms[r]={type:"t",value:o.toJSON(e).uuid}:o&&o.isColor?t.uniforms[r]={type:"c",value:o.getHex()}:o&&o.isVector2?t.uniforms[r]={type:"v2",value:o.toArray()}:o&&o.isVector3?t.uniforms[r]={type:"v3",value:o.toArray()}:o&&o.isVector4?t.uniforms[r]={type:"v4",value:o.toArray()}:o&&o.isMatrix3?t.uniforms[r]={type:"m3",value:o.toArray()}:o&&o.isMatrix4?t.uniforms[r]={type:"m4",value:o.toArray()}:t.uniforms[r]={value:o}}Object.keys(this.defines).length>0&&(t.defines=this.defines),t.vertexShader=this.vertexShader,t.fragmentShader=this.fragmentShader,t.lights=this.lights,t.clipping=this.clipping;let n={};for(let r in this.extensions)this.extensions[r]===!0&&(n[r]=!0);return Object.keys(n).length>0&&(t.extensions=n),t}fromJSON(e,t){if(super.fromJSON(e,t),e.uniforms!==void 0)for(let n in e.uniforms){let r=e.uniforms[n];switch(this.uniforms[n]={},r.type){case"t":this.uniforms[n].value=t[r.value]||null;break;case"c":this.uniforms[n].value=new zt().setHex(r.value);break;case"v2":this.uniforms[n].value=new Oe().fromArray(r.value);break;case"v3":this.uniforms[n].value=new re().fromArray(r.value);break;case"v4":this.uniforms[n].value=new xn().fromArray(r.value);break;case"m3":this.uniforms[n].value=new Mn().fromArray(r.value);break;case"m4":this.uniforms[n].value=new cn().fromArray(r.value);break;default:this.uniforms[n].value=r.value}}if(e.defines!==void 0&&(this.defines=e.defines),e.vertexShader!==void 0&&(this.vertexShader=e.vertexShader),e.fragmentShader!==void 0&&(this.fragmentShader=e.fragmentShader),e.glslVersion!==void 0&&(this.glslVersion=e.glslVersion),e.extensions!==void 0)for(let n in e.extensions)this.extensions[n]=e.extensions[n];return e.lights!==void 0&&(this.lights=e.lights),e.clipping!==void 0&&(this.clipping=e.clipping),this}},aM=class extends ds{constructor(e){super(e),this.isRawShaderMaterial=!0,this.type="RawShaderMaterial"}},Jv=class extends Ws{constructor(e){super(),this.isMeshStandardMaterial=!0,this.type="MeshStandardMaterial",this.defines={STANDARD:""},this.color=new zt(16777215),this.roughness=1,this.metalness=0,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new zt(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Ql,this.normalScale=new Oe(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.roughnessMap=null,this.metalnessMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new Oa,this.envMapIntensity=1,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.defines={STANDARD:""},this.color.copy(e.color),this.roughness=e.roughness,this.metalness=e.metalness,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.roughnessMap=e.roughnessMap,this.metalnessMap=e.metalnessMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.envMapIntensity=e.envMapIntensity,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}},H2=class extends Jv{constructor(e){super(),this.isMeshPhysicalMaterial=!0,this.defines={STANDARD:"",PHYSICAL:""},this.type="MeshPhysicalMaterial",this.anisotropyRotation=0,this.anisotropyMap=null,this.clearcoatMap=null,this.clearcoatRoughness=0,this.clearcoatRoughnessMap=null,this.clearcoatNormalScale=new Oe(1,1),this.clearcoatNormalMap=null,this.ior=1.5,Object.defineProperty(this,"reflectivity",{get:function(){return Nn(2.5*(this.ior-1)/(this.ior+1),0,1)},set:function(t){this.ior=(1+.4*t)/(1-.4*t)}}),this.iridescenceMap=null,this.iridescenceIOR=1.3,this.iridescenceThicknessRange=[100,400],this.iridescenceThicknessMap=null,this.sheenColor=new zt(0),this.sheenColorMap=null,this.sheenRoughness=1,this.sheenRoughnessMap=null,this.transmissionMap=null,this.thickness=0,this.thicknessMap=null,this.attenuationDistance=1/0,this.attenuationColor=new zt(1,1,1),this.specularIntensity=1,this.specularIntensityMap=null,this.specularColor=new zt(1,1,1),this.specularColorMap=null,this._anisotropy=0,this._clearcoat=0,this._dispersion=0,this._iridescence=0,this._sheen=0,this._transmission=0,this.setValues(e)}get anisotropy(){return this._anisotropy}set anisotropy(e){this._anisotropy>0!=e>0&&this.version++,this._anisotropy=e}get clearcoat(){return this._clearcoat}set clearcoat(e){this._clearcoat>0!=e>0&&this.version++,this._clearcoat=e}get iridescence(){return this._iridescence}set iridescence(e){this._iridescence>0!=e>0&&this.version++,this._iridescence=e}get dispersion(){return this._dispersion}set dispersion(e){this._dispersion>0!=e>0&&this.version++,this._dispersion=e}get sheen(){return this._sheen}set sheen(e){this._sheen>0!=e>0&&this.version++,this._sheen=e}get transmission(){return this._transmission}set transmission(e){this._transmission>0!=e>0&&this.version++,this._transmission=e}copy(e){return super.copy(e),this.defines={STANDARD:"",PHYSICAL:""},this.anisotropy=e.anisotropy,this.anisotropyRotation=e.anisotropyRotation,this.anisotropyMap=e.anisotropyMap,this.clearcoat=e.clearcoat,this.clearcoatMap=e.clearcoatMap,this.clearcoatRoughness=e.clearcoatRoughness,this.clearcoatRoughnessMap=e.clearcoatRoughnessMap,this.clearcoatNormalMap=e.clearcoatNormalMap,this.clearcoatNormalScale.copy(e.clearcoatNormalScale),this.dispersion=e.dispersion,this.ior=e.ior,this.iridescence=e.iridescence,this.iridescenceMap=e.iridescenceMap,this.iridescenceIOR=e.iridescenceIOR,this.iridescenceThicknessRange=[...e.iridescenceThicknessRange],this.iridescenceThicknessMap=e.iridescenceThicknessMap,this.sheen=e.sheen,this.sheenColor.copy(e.sheenColor),this.sheenColorMap=e.sheenColorMap,this.sheenRoughness=e.sheenRoughness,this.sheenRoughnessMap=e.sheenRoughnessMap,this.transmission=e.transmission,this.transmissionMap=e.transmissionMap,this.thickness=e.thickness,this.thicknessMap=e.thicknessMap,this.attenuationDistance=e.attenuationDistance,this.attenuationColor.copy(e.attenuationColor),this.specularIntensity=e.specularIntensity,this.specularIntensityMap=e.specularIntensityMap,this.specularColor.copy(e.specularColor),this.specularColorMap=e.specularColorMap,this}},WA=class extends Ws{constructor(e){super(),this.isMeshPhongMaterial=!0,this.type="MeshPhongMaterial",this.color=new zt(16777215),this.specular=new zt(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new zt(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Ql,this.normalScale=new Oe(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new Oa,this.combine=ZA,this.reflectivity=1,this.envMapIntensity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.specular.copy(e.specular),this.shininess=e.shininess,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.envMapIntensity=e.envMapIntensity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}},W2=class extends Ws{constructor(e){super(),this.isMeshToonMaterial=!0,this.defines={TOON:""},this.type="MeshToonMaterial",this.color=new zt(16777215),this.map=null,this.gradientMap=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new zt(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Ql,this.normalScale=new Oe(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.gradientMap=e.gradientMap,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.alphaMap=e.alphaMap,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.fog=e.fog,this}},j2=class extends Ws{constructor(e){super(),this.isMeshNormalMaterial=!0,this.type="MeshNormalMaterial",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Ql,this.normalScale=new Oe(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.flatShading=!1,this.setValues(e)}copy(e){return super.copy(e),this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.flatShading=e.flatShading,this}},Va=class extends Ws{constructor(e){super(),this.isMeshLambertMaterial=!0,this.type="MeshLambertMaterial",this.color=new zt(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new zt(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Ql,this.normalScale=new Oe(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new Oa,this.combine=ZA,this.reflectivity=1,this.envMapIntensity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.envMapIntensity=e.envMapIntensity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}},lM=class extends Ws{constructor(e){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=tZ,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.setValues(e)}copy(e){return super.copy(e),this.depthPacking=e.depthPacking,this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this}},cM=class extends Ws{constructor(e){super(),this.isMeshDistanceMaterial=!0,this.type="MeshDistanceMaterial",this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.setValues(e)}copy(e){return super.copy(e),this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this}},X2=class extends Ws{constructor(e){super(),this.isMeshMatcapMaterial=!0,this.defines={MATCAP:""},this.type="MeshMatcapMaterial",this.color=new zt(16777215),this.matcap=null,this.map=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Ql,this.normalScale=new Oe(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.wireframe=!1,this.wireframeLinewidth=1,this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.defines={MATCAP:""},this.color.copy(e.color),this.matcap=e.matcap,this.map=e.map,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.alphaMap=e.alphaMap,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.flatShading=e.flatShading,this.fog=e.fog,this}},$2=class extends Pu{constructor(e){super(),this.isLineDashedMaterial=!0,this.type="LineDashedMaterial",this.scale=1,this.dashSize=3,this.gapSize=1,this.setValues(e)}copy(e){return super.copy(e),this.scale=e.scale,this.dashSize=e.dashSize,this.gapSize=e.gapSize,this}};function W3(i,e){return!i||i.constructor===e?i:typeof e.BYTES_PER_ELEMENT=="number"?new e(i):Array.prototype.slice.call(i)}var r0=class{constructor(e,t,n,r){this.parameterPositions=e,this._cachedIndex=0,this.resultBuffer=r!==void 0?r:new t.constructor(n),this.sampleValues=t,this.valueSize=n,this.settings=null,this.DefaultSettings_={}}evaluate(e){let t=this.parameterPositions,n=this._cachedIndex,r=t[n],s=t[n-1];e:{t:{let o;n:{i:if(!(e<r)){for(let a=n+2;;){if(r===void 0){if(e<s)break i;return n=t.length,this._cachedIndex=n,this.copySampleValue_(n-1)}if(n===a)break;if(s=r,r=t[++n],e<r)break t}o=t.length;break n}if(!(e>=s)){let a=t[1];e<a&&(n=2,s=a);for(let l=n-2;;){if(s===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(n===l)break;if(r=s,s=t[--n-1],e>=s)break t}o=n,n=0;break n}break e}for(;n<o;){let a=n+o>>>1;e<t[a]?o=a:n=a+1}if(r=t[n],s=t[n-1],s===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(r===void 0)return n=t.length,this._cachedIndex=n,this.copySampleValue_(n-1)}this._cachedIndex=n,this.intervalChanged_(n,s,r)}return this.interpolate_(n,s,e,r)}getSettings_(){return this.settings||this.DefaultSettings_}copySampleValue_(e){let t=this.resultBuffer,n=this.sampleValues,r=this.valueSize,s=e*r;for(let o=0;o!==r;++o)t[o]=n[s+o];return t}interpolate_(){throw new Error("THREE.Interpolant: Call to abstract method.")}intervalChanged_(){}},uM=class extends r0{constructor(e,t,n,r){super(e,t,n,r),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0,this.DefaultSettings_={endingStart:A8,endingEnd:A8}}intervalChanged_(e,t,n){let r=this.parameterPositions,s=e-2,o=e+1,a=r[s],l=r[o];if(a===void 0)switch(this.getSettings_().endingStart){case g8:s=e,a=2*t-n;break;case v8:s=r.length-2,a=t+r[s]-r[s+1];break;default:s=e,a=n}if(l===void 0)switch(this.getSettings_().endingEnd){case g8:o=e,l=2*n-t;break;case v8:o=1,l=n+r[1]-r[0];break;default:o=e-1,l=t}let c=(n-t)*.5,u=this.valueSize;this._weightPrev=c/(t-a),this._weightNext=c/(l-n),this._offsetPrev=s*u,this._offsetNext=o*u}interpolate_(e,t,n,r){let s=this.resultBuffer,o=this.sampleValues,a=this.valueSize,l=e*a,c=l-a,u=this._offsetPrev,f=this._offsetNext,d=this._weightPrev,A=this._weightNext,y=(n-t)/(r-t),w=y*y,S=w*y,T=-d*S+2*d*w-d*y,R=(1+d)*S+(-1.5-2*d)*w+(-.5+d)*y+1,P=(-1-A)*S+(1.5+A)*w+.5*y,I=A*S-A*w;for(let F=0;F!==a;++F)s[F]=T*o[u+F]+R*o[c+F]+P*o[l+F]+I*o[f+F];return s}},hM=class extends r0{constructor(e,t,n,r){super(e,t,n,r)}interpolate_(e,t,n,r){let s=this.resultBuffer,o=this.sampleValues,a=this.valueSize,l=e*a,c=l-a,u=(n-t)/(r-t),f=1-u;for(let d=0;d!==a;++d)s[d]=o[c+d]*f+o[l+d]*u;return s}},fM=class extends r0{constructor(e,t,n,r){super(e,t,n,r)}interpolate_(e){return this.copySampleValue_(e-1)}},dM=class extends r0{interpolate_(e,t,n,r){let s=this.resultBuffer,o=this.sampleValues,a=this.valueSize,l=e*a,c=l-a,u=this.inTangents,f=this.outTangents;if(!u||!f){let y=(n-t)/(r-t),w=1-y;for(let S=0;S!==a;++S)s[S]=o[c+S]*w+o[l+S]*y;return s}let d=a*2,A=e-1;for(let y=0;y!==a;++y){let w=o[c+y],S=o[l+y],T=A*d+y*2,R=f[T],P=f[T+1],I=e*d+y*2,F=u[I],D=u[I+1],L=(n-t)/(r-t),C,B,k,z,G;for(let W=0;W<8;W++){C=L*L,B=C*L,k=1-L,z=k*k,G=z*k;let H=G*t+3*z*L*R+3*k*C*F+B*r-n;if(Math.abs(H)<1e-10)break;let $=3*z*(R-t)+6*k*L*(F-R)+3*C*(r-F);if(Math.abs($)<1e-10)break;L=L-H/$,L=Math.max(0,Math.min(1,L))}s[y]=G*w+3*z*L*P+3*k*C*D+B*S}return s}},Zl=class{constructor(e,t,n,r){if(e===void 0)throw new Error("THREE.KeyframeTrack: track name is undefined");if(t===void 0||t.length===0)throw new Error("THREE.KeyframeTrack: no keyframes in track named "+e);this.name=e,this.times=W3(t,this.TimeBufferType),this.values=W3(n,this.ValueBufferType),this.setInterpolation(r||this.DefaultInterpolation)}static toJSON(e){let t=e.constructor,n;if(t.toJSON!==this.toJSON)n=t.toJSON(e);else{n={name:e.name,times:W3(e.times,Array),values:W3(e.values,Array)};let r=e.getInterpolation();r!==e.DefaultInterpolation&&(n.interpolation=r)}return n.type=e.ValueTypeName,n}InterpolantFactoryMethodDiscrete(e){return new fM(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodLinear(e){return new hM(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodSmooth(e){return new uM(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodBezier(e){let t=new dM(this.times,this.values,this.getValueSize(),e);return this.settings&&(t.inTangents=this.settings.inTangents,t.outTangents=this.settings.outTangents),t}setInterpolation(e){let t;switch(e){case E2:t=this.InterpolantFactoryMethodDiscrete;break;case K3:t=this.InterpolantFactoryMethodLinear;break;case Y3:t=this.InterpolantFactoryMethodSmooth;break;case m8:t=this.InterpolantFactoryMethodBezier;break}if(t===void 0){let n="unsupported interpolation for "+this.ValueTypeName+" keyframe track named "+this.name;if(this.createInterpolant===void 0)if(e!==this.DefaultInterpolation)this.setInterpolation(this.DefaultInterpolation);else throw new Error(n);return Xe("KeyframeTrack:",n),this}return this.createInterpolant=t,this}getInterpolation(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return E2;case this.InterpolantFactoryMethodLinear:return K3;case this.InterpolantFactoryMethodSmooth:return Y3;case this.InterpolantFactoryMethodBezier:return m8}}getValueSize(){return this.values.length/this.times.length}shift(e){if(e!==0){let t=this.times;for(let n=0,r=t.length;n!==r;++n)t[n]+=e}return this}scale(e){if(e!==1){let t=this.times;for(let n=0,r=t.length;n!==r;++n)t[n]*=e}return this}trim(e,t){let n=this.times,r=n.length,s=0,o=r-1;for(;s!==r&&n[s]<e;)++s;for(;o!==-1&&n[o]>t;)--o;if(++o,s!==0||o!==r){s>=o&&(o=Math.max(o,1),s=o-1);let a=this.getValueSize();this.times=n.slice(s,o),this.values=this.values.slice(s*a,o*a)}return this}validate(){let e=!0,t=this.getValueSize();t-Math.floor(t)!==0&&(ze("KeyframeTrack: Invalid value size in track.",this),e=!1);let n=this.times,r=this.values,s=n.length;s===0&&(ze("KeyframeTrack: Track is empty.",this),e=!1);let o=null;for(let a=0;a!==s;a++){let l=n[a];if(typeof l=="number"&&isNaN(l)){ze("KeyframeTrack: Time is not a valid number.",this,a,l),e=!1;break}if(o!==null&&o>l){ze("KeyframeTrack: Out of order keys.",this,a,l,o),e=!1;break}o=l}if(r!==void 0&&o_(r))for(let a=0,l=r.length;a!==l;++a){let c=r[a];if(isNaN(c)){ze("KeyframeTrack: Value is not a valid number.",this,a,c),e=!1;break}}return e}optimize(){let e=this.times.slice(),t=this.values.slice(),n=this.getValueSize(),r=this.getInterpolation()===Y3,s=e.length-1,o=1;for(let a=1;a<s;++a){let l=!1,c=e[a],u=e[a+1];if(c!==u&&(a!==1||c!==e[0]))if(r)l=!0;else{let f=a*n,d=f-n,A=f+n;for(let y=0;y!==n;++y){let w=t[f+y];if(w!==t[d+y]||w!==t[A+y]){l=!0;break}}}if(l){if(a!==o){e[o]=e[a];let f=a*n,d=o*n;for(let A=0;A!==n;++A)t[d+A]=t[f+A]}++o}}if(s>0){e[o]=e[s];for(let a=s*n,l=o*n,c=0;c!==n;++c)t[l+c]=t[a+c];++o}return o!==e.length?(this.times=e.slice(0,o),this.values=t.slice(0,o*n)):(this.times=e,this.values=t),this}clone(){let e=this.times.slice(),t=this.values.slice(),n=this.constructor,r=new n(this.name,e,t);return r.createInterpolant=this.createInterpolant,r}};Zl.prototype.ValueTypeName="";Zl.prototype.TimeBufferType=Float32Array;Zl.prototype.ValueBufferType=Float32Array;Zl.prototype.DefaultInterpolation=K3;var s0=class extends Zl{constructor(e,t,n){super(e,t,n)}};s0.prototype.ValueTypeName="bool";s0.prototype.ValueBufferType=Array;s0.prototype.DefaultInterpolation=E2;s0.prototype.InterpolantFactoryMethodLinear=void 0;s0.prototype.InterpolantFactoryMethodSmooth=void 0;var pM=class extends Zl{constructor(e,t,n,r){super(e,t,n,r)}};pM.prototype.ValueTypeName="color";var mM=class extends Zl{constructor(e,t,n,r){super(e,t,n,r)}};mM.prototype.ValueTypeName="number";var AM=class extends r0{constructor(e,t,n,r){super(e,t,n,r)}interpolate_(e,t,n,r){let s=this.resultBuffer,o=this.sampleValues,a=this.valueSize,l=(n-t)/(r-t),c=e*a;for(let u=c+a;c!==u;c+=4)qs.slerpFlat(s,0,o,c-a,o,c,l);return s}},Y2=class extends Zl{constructor(e,t,n,r){super(e,t,n,r)}InterpolantFactoryMethodLinear(e){return new AM(this.times,this.values,this.getValueSize(),e)}};Y2.prototype.ValueTypeName="quaternion";Y2.prototype.InterpolantFactoryMethodSmooth=void 0;var o0=class extends Zl{constructor(e,t,n){super(e,t,n)}};o0.prototype.ValueTypeName="string";o0.prototype.ValueBufferType=Array;o0.prototype.DefaultInterpolation=E2;o0.prototype.InterpolantFactoryMethodLinear=void 0;o0.prototype.InterpolantFactoryMethodSmooth=void 0;var gM=class extends Zl{constructor(e,t,n,r){super(e,t,n,r)}};gM.prototype.ValueTypeName="vector";var Z3={enabled:!1,files:{},add:function(i,e){this.enabled!==!1&&(GY(i)||(this.files[i]=e))},get:function(i){if(this.enabled!==!1&&!GY(i))return this.files[i]},remove:function(i){delete this.files[i]},clear:function(){this.files={}}};function GY(i){try{let e=i.slice(i.indexOf(":")+1);return new URL(e).protocol==="blob:"}catch{return!1}}var vM=class{constructor(e,t,n){let r=this,s=!1,o=0,a=0,l,c=[];this.onStart=void 0,this.onLoad=e,this.onProgress=t,this.onError=n,this._abortController=null,this.itemStart=function(u){a++,s===!1&&r.onStart!==void 0&&r.onStart(u,o,a),s=!0},this.itemEnd=function(u){o++,r.onProgress!==void 0&&r.onProgress(u,o,a),o===a&&(s=!1,r.onLoad!==void 0&&r.onLoad())},this.itemError=function(u){r.onError!==void 0&&r.onError(u)},this.resolveURL=function(u){return u=u.normalize("NFC"),l?l(u):u},this.setURLModifier=function(u){return l=u,this},this.addHandler=function(u,f){return c.push(u,f),this},this.removeHandler=function(u){let f=c.indexOf(u);return f!==-1&&c.splice(f,2),this},this.getHandler=function(u){for(let f=0,d=c.length;f<d;f+=2){let A=c[f],y=c[f+1];if(A.global&&(A.lastIndex=0),A.test(u))return y}return null},this.abort=function(){return this.abortController.abort(),this._abortController=null,this}}get abortController(){return this._abortController||(this._abortController=new AbortController),this._abortController}},uZ=new vM,a0=class{constructor(e){this.manager=e!==void 0?e:uZ,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={},typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}load(){}loadAsync(e,t){let n=this;return new Promise(function(r,s){n.load(e,r,t,s)})}parse(){}setCrossOrigin(e){return this.crossOrigin=e,this}setWithCredentials(e){return this.withCredentials=e,this}setPath(e){return this.path=e,this}setResourcePath(e){return this.resourcePath=e,this}setRequestHeader(e){return this.requestHeader=e,this}abort(){return this}};a0.DEFAULT_MATERIAL_NAME="__DEFAULT";var Bv=new WeakMap,_M=class extends a0{constructor(e){super(e)}load(e,t,n,r){this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);let s=this,o=Z3.get(`image:${e}`);if(o!==void 0){if(o.complete===!0)s.manager.itemStart(e),setTimeout(function(){t&&t(o),s.manager.itemEnd(e)},0);else{let f=Bv.get(o);f===void 0&&(f=[],Bv.set(o,f)),f.push({onLoad:t,onError:r})}return o}let a=Gv("img");function l(){u(),t&&t(this);let f=Bv.get(this)||[];for(let d=0;d<f.length;d++){let A=f[d];A.onLoad&&A.onLoad(this)}Bv.delete(this),s.manager.itemEnd(e)}function c(f){u(),r&&r(f),Z3.remove(`image:${e}`);let d=Bv.get(this)||[];for(let A=0;A<d.length;A++){let y=d[A];y.onError&&y.onError(f)}Bv.delete(this),s.manager.itemError(e),s.manager.itemEnd(e)}function u(){a.removeEventListener("load",l,!1),a.removeEventListener("error",c,!1)}return a.addEventListener("load",l,!1),a.addEventListener("error",c,!1),e.slice(0,5)!=="data:"&&this.crossOrigin!==void 0&&(a.crossOrigin=this.crossOrigin),Z3.add(`image:${e}`,a),s.manager.itemStart(e),a.src=e,a}};var yl=class extends a0{constructor(e){super(e)}load(e,t,n,r){let s=new Hs,o=new _M(this.manager);return o.setCrossOrigin(this.crossOrigin),o.setPath(this.path),o.load(e,function(a){s.image=a,s.needsUpdate=!0,t!==void 0&&t(s)},n,r),s}},Ph=class extends lr{constructor(e,t=1){super(),this.isLight=!0,this.type="Light",this.color=new zt(e),this.intensity=t}dispose(){this.dispatchEvent({type:"dispose"})}copy(e,t){return super.copy(e,t),this.color.copy(e.color),this.intensity=e.intensity,this}toJSON(e){let t=super.toJSON(e);return t.object.color=this.color.getHex(),t.object.intensity=this.intensity,t}},Z2=class extends Ph{constructor(e,t,n){super(e,n),this.isHemisphereLight=!0,this.type="HemisphereLight",this.position.copy(lr.DEFAULT_UP),this.updateMatrix(),this.groundColor=new zt(t)}copy(e,t){return super.copy(e,t),this.groundColor.copy(e.groundColor),this}toJSON(e){let t=super.toJSON(e);return t.object.groundColor=this.groundColor.getHex(),t}},d8=new cn,qY=new re,HY=new re,K2=class{constructor(e){this.camera=e,this.intensity=1,this.bias=0,this.biasNode=null,this.normalBias=0,this.radius=1,this.blurSamples=8,this.mapSize=new Oe(512,512),this.mapType=Ji,this.map=null,this.mapPass=null,this.matrix=new cn,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new zc,this._frameExtents=new Oe(1,1),this._viewportCount=1,this._viewports=[new xn(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(e){let t=this.camera,n=this.matrix;qY.setFromMatrixPosition(e.matrixWorld),t.position.copy(qY),HY.setFromMatrixPosition(e.target.matrixWorld),t.lookAt(HY),t.updateMatrixWorld(),d8.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),this._frustum.setFromProjectionMatrix(d8,t.coordinateSystem,t.reversedDepth),t.coordinateSystem===_l||t.reversedDepth?n.set(.5,0,0,.5,0,.5,0,.5,0,0,1,0,0,0,0,1):n.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),n.multiply(d8)}getViewport(e){return this._viewports[e]}getFrameExtents(){return this._frameExtents}dispose(){this.map&&this.map.dispose(),this.mapPass&&this.mapPass.dispose()}copy(e){return this.camera=e.camera.clone(),this.intensity=e.intensity,this.bias=e.bias,this.radius=e.radius,this.autoUpdate=e.autoUpdate,this.needsUpdate=e.needsUpdate,this.normalBias=e.normalBias,this.blurSamples=e.blurSamples,this.mapSize.copy(e.mapSize),this.biasNode=e.biasNode,this}clone(){return new this.constructor().copy(this)}toJSON(){let e={};return this.intensity!==1&&(e.intensity=this.intensity),this.bias!==0&&(e.bias=this.bias),this.normalBias!==0&&(e.normalBias=this.normalBias),this.radius!==1&&(e.radius=this.radius),(this.mapSize.x!==512||this.mapSize.y!==512)&&(e.mapSize=this.mapSize.toArray()),e.camera=this.camera.toJSON(!1).object,delete e.camera.matrix,e}},j3=new re,X3=new qs,Eh=new re,Cd=class extends lr{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new cn,this.projectionMatrix=new cn,this.projectionMatrixInverse=new cn,this.coordinateSystem=Uo,this._reversedDepth=!1}get reversedDepth(){return this._reversedDepth}copy(e,t){return super.copy(e,t),this.matrixWorldInverse.copy(e.matrixWorldInverse),this.projectionMatrix.copy(e.projectionMatrix),this.projectionMatrixInverse.copy(e.projectionMatrixInverse),this.coordinateSystem=e.coordinateSystem,this}getWorldDirection(e){return super.getWorldDirection(e).negate()}updateMatrixWorld(e){super.updateMatrixWorld(e),this.matrixWorld.decompose(j3,X3,Eh),Eh.x===1&&Eh.y===1&&Eh.z===1?this.matrixWorldInverse.copy(this.matrixWorld).invert():this.matrixWorldInverse.compose(j3,X3,Eh.set(1,1,1)).invert()}updateWorldMatrix(e,t,n=!1){super.updateWorldMatrix(e,t,n),this.matrixWorld.decompose(j3,X3,Eh),Eh.x===1&&Eh.y===1&&Eh.z===1?this.matrixWorldInverse.copy(this.matrixWorld).invert():this.matrixWorldInverse.compose(j3,X3,Eh.set(1,1,1)).invert()}clone(){return new this.constructor().copy(this)}},Xp=new re,WY=new Oe,jY=new Oe,$r=class extends Cd{constructor(e=50,t=1,n=.1,r=2e3){super(),this.isPerspectiveCamera=!0,this.type="PerspectiveCamera",this.fov=e,this.zoom=1,this.near=n,this.far=r,this.focus=10,this.aspect=t,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.fov=e.fov,this.zoom=e.zoom,this.near=e.near,this.far=e.far,this.focus=e.focus,this.aspect=e.aspect,this.view=e.view===null?null:Object.assign({},e.view),this.filmGauge=e.filmGauge,this.filmOffset=e.filmOffset,this}setFocalLength(e){let t=.5*this.getFilmHeight()/e;this.fov=Td*2*Math.atan(t),this.updateProjectionMatrix()}getFocalLength(){let e=Math.tan(b2*.5*this.fov);return .5*this.getFilmHeight()/e}getEffectiveFOV(){return Td*2*Math.atan(Math.tan(b2*.5*this.fov)/this.zoom)}getFilmWidth(){return this.filmGauge*Math.min(this.aspect,1)}getFilmHeight(){return this.filmGauge/Math.max(this.aspect,1)}getViewBounds(e,t,n){Xp.set(-1,-1,.5).applyMatrix4(this.projectionMatrixInverse),t.set(Xp.x,Xp.y).multiplyScalar(-e/Xp.z),Xp.set(1,1,.5).applyMatrix4(this.projectionMatrixInverse),n.set(Xp.x,Xp.y).multiplyScalar(-e/Xp.z)}getViewSize(e,t){return this.getViewBounds(e,WY,jY),t.subVectors(jY,WY)}setViewOffset(e,t,n,r,s,o){this.aspect=e/t,this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=n,this.view.offsetY=r,this.view.width=s,this.view.height=o,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){let e=this.near,t=e*Math.tan(b2*.5*this.fov)/this.zoom,n=2*t,r=this.aspect*n,s=-.5*r,o=this.view;if(this.view!==null&&this.view.enabled){let l=o.fullWidth,c=o.fullHeight;s+=o.offsetX*r/l,t-=o.offsetY*n/c,r*=o.width/l,n*=o.height/c}let a=this.filmOffset;a!==0&&(s+=e*a/this.getFilmWidth()),this.projectionMatrix.makePerspective(s,s+r,t,t-n,e,this.far,this.coordinateSystem,this.reversedDepth),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){let t=super.toJSON(e);return t.object.fov=this.fov,t.object.zoom=this.zoom,t.object.near=this.near,t.object.far=this.far,t.object.focus=this.focus,t.object.aspect=this.aspect,this.view!==null&&(t.object.view=Object.assign({},this.view)),t.object.filmGauge=this.filmGauge,t.object.filmOffset=this.filmOffset,t}},w8=class extends K2{constructor(){super(new $r(50,1,.5,500)),this.isSpotLightShadow=!0,this.focus=1,this.aspect=1}updateMatrices(e){let t=this.camera,n=Td*2*e.angle*this.focus,r=this.mapSize.width/this.mapSize.height*this.aspect,s=e.distance||t.far;(n!==t.fov||r!==t.aspect||s!==t.far)&&(t.fov=n,t.aspect=r,t.far=s,t.updateProjectionMatrix()),super.updateMatrices(e)}copy(e){return super.copy(e),this.focus=e.focus,this}},jA=class extends Ph{constructor(e,t,n=0,r=Math.PI/3,s=0,o=2){super(e,t),this.isSpotLight=!0,this.type="SpotLight",this.position.copy(lr.DEFAULT_UP),this.updateMatrix(),this.target=new lr,this.distance=n,this.angle=r,this.penumbra=s,this.decay=o,this.map=null,this.shadow=new w8}get power(){return this.intensity*Math.PI}set power(e){this.intensity=e/Math.PI}dispose(){super.dispose(),this.shadow.dispose()}copy(e,t){return super.copy(e,t),this.distance=e.distance,this.angle=e.angle,this.penumbra=e.penumbra,this.decay=e.decay,this.target=e.target.clone(),this.map=e.map,this.shadow=e.shadow.clone(),this}toJSON(e){let t=super.toJSON(e);return t.object.distance=this.distance,t.object.angle=this.angle,t.object.decay=this.decay,t.object.penumbra=this.penumbra,t.object.target=this.target.uuid,this.map&&this.map.isTexture&&(t.object.map=this.map.toJSON(e).uuid),t.object.shadow=this.shadow.toJSON(),t}},S8=class extends K2{constructor(){super(new $r(90,1,.5,500)),this.isPointLightShadow=!0}},Q2=class extends Ph{constructor(e,t,n=0,r=2){super(e,t),this.isPointLight=!0,this.type="PointLight",this.distance=n,this.decay=r,this.shadow=new S8}get power(){return this.intensity*4*Math.PI}set power(e){this.intensity=e/(4*Math.PI)}dispose(){super.dispose(),this.shadow.dispose()}copy(e,t){return super.copy(e,t),this.distance=e.distance,this.decay=e.decay,this.shadow=e.shadow.clone(),this}toJSON(e){let t=super.toJSON(e);return t.object.distance=this.distance,t.object.decay=this.decay,t.object.shadow=this.shadow.toJSON(),t}},Du=class extends Cd{constructor(e=-1,t=1,n=1,r=-1,s=.1,o=2e3){super(),this.isOrthographicCamera=!0,this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=e,this.right=t,this.top=n,this.bottom=r,this.near=s,this.far=o,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.left=e.left,this.right=e.right,this.top=e.top,this.bottom=e.bottom,this.near=e.near,this.far=e.far,this.zoom=e.zoom,this.view=e.view===null?null:Object.assign({},e.view),this}setViewOffset(e,t,n,r,s,o){this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=n,this.view.offsetY=r,this.view.width=s,this.view.height=o,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){let e=(this.right-this.left)/(2*this.zoom),t=(this.top-this.bottom)/(2*this.zoom),n=(this.right+this.left)/2,r=(this.top+this.bottom)/2,s=n-e,o=n+e,a=r+t,l=r-t;if(this.view!==null&&this.view.enabled){let c=(this.right-this.left)/this.view.fullWidth/this.zoom,u=(this.top-this.bottom)/this.view.fullHeight/this.zoom;s+=c*this.view.offsetX,o=s+c*this.view.width,a-=u*this.view.offsetY,l=a-u*this.view.height}this.projectionMatrix.makeOrthographic(s,o,a,l,this.near,this.far,this.coordinateSystem,this.reversedDepth),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){let t=super.toJSON(e);return t.object.zoom=this.zoom,t.object.left=this.left,t.object.right=this.right,t.object.top=this.top,t.object.bottom=this.bottom,t.object.near=this.near,t.object.far=this.far,this.view!==null&&(t.object.view=Object.assign({},this.view)),t}},T8=class extends K2{constructor(){super(new Du(-5,5,5,-5,.5,500)),this.isDirectionalLightShadow=!0}},XA=class extends Ph{constructor(e,t){super(e,t),this.isDirectionalLight=!0,this.type="DirectionalLight",this.position.copy(lr.DEFAULT_UP),this.updateMatrix(),this.target=new lr,this.shadow=new T8}dispose(){super.dispose(),this.shadow.dispose()}copy(e){return super.copy(e),this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}toJSON(e){let t=super.toJSON(e);return t.object.shadow=this.shadow.toJSON(),t.object.target=this.target.uuid,t}},$A=class extends Ph{constructor(e,t){super(e,t),this.isAmbientLight=!0,this.type="AmbientLight"}},J2=class extends Ph{constructor(e,t,n=10,r=10){super(e,t),this.isRectAreaLight=!0,this.type="RectAreaLight",this.width=n,this.height=r}get power(){return this.intensity*this.width*this.height*Math.PI}set power(e){this.intensity=e/(this.width*this.height*Math.PI)}copy(e){return super.copy(e),this.width=e.width,this.height=e.height,this}toJSON(e){let t=super.toJSON(e);return t.object.width=this.width,t.object.height=this.height,t}},xM=class{constructor(){this.isSphericalHarmonics3=!0,this.coefficients=[];for(let e=0;e<9;e++)this.coefficients.push(new re)}set(e){for(let t=0;t<9;t++)this.coefficients[t].copy(e[t]);return this}zero(){for(let e=0;e<9;e++)this.coefficients[e].set(0,0,0);return this}getAt(e,t){let n=e.x,r=e.y,s=e.z,o=this.coefficients;return t.copy(o[0]).multiplyScalar(.282095),t.addScaledVector(o[1],.488603*r),t.addScaledVector(o[2],.488603*s),t.addScaledVector(o[3],.488603*n),t.addScaledVector(o[4],1.092548*(n*r)),t.addScaledVector(o[5],1.092548*(r*s)),t.addScaledVector(o[6],.315392*(3*s*s-1)),t.addScaledVector(o[7],1.092548*(n*s)),t.addScaledVector(o[8],.546274*(n*n-r*r)),t}getIrradianceAt(e,t){let n=e.x,r=e.y,s=e.z,o=this.coefficients;return t.copy(o[0]).multiplyScalar(.886227),t.addScaledVector(o[1],2*.511664*r),t.addScaledVector(o[2],2*.511664*s),t.addScaledVector(o[3],2*.511664*n),t.addScaledVector(o[4],2*.429043*n*r),t.addScaledVector(o[5],2*.429043*r*s),t.addScaledVector(o[6],.743125*s*s-.247708),t.addScaledVector(o[7],2*.429043*n*s),t.addScaledVector(o[8],.429043*(n*n-r*r)),t}add(e){for(let t=0;t<9;t++)this.coefficients[t].add(e.coefficients[t]);return this}addScaledSH(e,t){for(let n=0;n<9;n++)this.coefficients[n].addScaledVector(e.coefficients[n],t);return this}scale(e){for(let t=0;t<9;t++)this.coefficients[t].multiplyScalar(e);return this}lerp(e,t){for(let n=0;n<9;n++)this.coefficients[n].lerp(e.coefficients[n],t);return this}equals(e){for(let t=0;t<9;t++)if(!this.coefficients[t].equals(e.coefficients[t]))return!1;return!0}copy(e){return this.set(e.coefficients)}clone(){return new this.constructor().copy(this)}fromArray(e,t=0){let n=this.coefficients;for(let r=0;r<9;r++)n[r].fromArray(e,t+r*3);return this}toArray(e=[],t=0){let n=this.coefficients;for(let r=0;r<9;r++)n[r].toArray(e,t+r*3);return e}static getBasisAt(e,t){let n=e.x,r=e.y,s=e.z;t[0]=.282095,t[1]=.488603*r,t[2]=.488603*s,t[3]=.488603*n,t[4]=1.092548*n*r,t[5]=1.092548*r*s,t[6]=.315392*(3*s*s-1),t[7]=1.092548*n*s,t[8]=.546274*(n*n-r*r)}},eb=class extends Ph{constructor(e=new xM,t=1){super(void 0,t),this.isLightProbe=!0,this.sh=e}copy(e){return super.copy(e),this.sh.copy(e.sh),this}toJSON(e){let t=super.toJSON(e);return t.object.sh=this.sh.toArray(),t}};var tb=class extends Xn{constructor(){super(),this.isInstancedBufferGeometry=!0,this.type="InstancedBufferGeometry",this.instanceCount=1/0}copy(e){return super.copy(e),this.instanceCount=e.instanceCount,this}toJSON(){let e=super.toJSON();return e.instanceCount=this.instanceCount,e.isInstancedBufferGeometry=!0,e}};var Ov=-90,Uv=1,e_=class extends lr{constructor(e,t,n){super(),this.type="CubeCamera",this.renderTarget=n,this.coordinateSystem=null,this.activeMipmapLevel=0;let r=new $r(Ov,Uv,e,t);r.layers=this.layers,this.add(r);let s=new $r(Ov,Uv,e,t);s.layers=this.layers,this.add(s);let o=new $r(Ov,Uv,e,t);o.layers=this.layers,this.add(o);let a=new $r(Ov,Uv,e,t);a.layers=this.layers,this.add(a);let l=new $r(Ov,Uv,e,t);l.layers=this.layers,this.add(l);let c=new $r(Ov,Uv,e,t);c.layers=this.layers,this.add(c)}updateCoordinateSystem(){let e=this.coordinateSystem,t=this.children.concat(),[n,r,s,o,a,l]=t;for(let c of t)this.remove(c);if(e===Uo)n.up.set(0,1,0),n.lookAt(1,0,0),r.up.set(0,1,0),r.lookAt(-1,0,0),s.up.set(0,0,-1),s.lookAt(0,1,0),o.up.set(0,0,1),o.lookAt(0,-1,0),a.up.set(0,1,0),a.lookAt(0,0,1),l.up.set(0,1,0),l.lookAt(0,0,-1);else if(e===_l)n.up.set(0,-1,0),n.lookAt(-1,0,0),r.up.set(0,-1,0),r.lookAt(1,0,0),s.up.set(0,0,1),s.lookAt(0,1,0),o.up.set(0,0,-1),o.lookAt(0,-1,0),a.up.set(0,-1,0),a.lookAt(0,0,1),l.up.set(0,-1,0),l.lookAt(0,0,-1);else throw new Error("THREE.CubeCamera.updateCoordinateSystem(): Invalid coordinate system: "+e);for(let c of t)this.add(c),c.updateMatrixWorld()}update(e,t){this.parent===null&&this.updateMatrixWorld();let{renderTarget:n,activeMipmapLevel:r}=this;this.coordinateSystem!==e.coordinateSystem&&(this.coordinateSystem=e.coordinateSystem,this.updateCoordinateSystem());let[s,o,a,l,c,u]=this.children,f=e.getRenderTarget(),d=e.getActiveCubeFace(),A=e.getActiveMipmapLevel(),y=e.xr.enabled;e.xr.enabled=!1;let w=n.texture.generateMipmaps;n.texture.generateMipmaps=!1;let S=!1;e.isWebGLRenderer===!0?S=e.state.buffers.depth.getReversed():S=e.reversedDepthBuffer,e.setRenderTarget(n,0,r),S&&e.autoClear===!1&&e.clearDepth(),e.render(t,s),e.setRenderTarget(n,1,r),S&&e.autoClear===!1&&e.clearDepth(),e.render(t,o),e.setRenderTarget(n,2,r),S&&e.autoClear===!1&&e.clearDepth(),e.render(t,a),e.setRenderTarget(n,3,r),S&&e.autoClear===!1&&e.clearDepth(),e.render(t,l),e.setRenderTarget(n,4,r),S&&e.autoClear===!1&&e.clearDepth(),e.render(t,c),n.texture.generateMipmaps=w,e.setRenderTarget(n,5,r),S&&e.autoClear===!1&&e.clearDepth(),e.render(t,u),e.setRenderTarget(f,d,A),e.xr.enabled=y,n.texture.needsPMREMUpdate=!0}},t_=class extends $r{constructor(e=[]){super(),this.isArrayCamera=!0,this.isMultiViewCamera=!1,this.cameras=e}},YA=class{constructor(){this._previousTime=0,this._currentTime=0,this._startTime=performance.now(),this._delta=0,this._elapsed=0,this._timescale=1,this._document=null,this._pageVisibilityHandler=null}connect(e){this._document=e,e.hidden!==void 0&&(this._pageVisibilityHandler=mAe.bind(this),e.addEventListener("visibilitychange",this._pageVisibilityHandler,!1))}disconnect(){this._pageVisibilityHandler!==null&&(this._document.removeEventListener("visibilitychange",this._pageVisibilityHandler),this._pageVisibilityHandler=null),this._document=null}getDelta(){return this._delta/1e3}getElapsed(){return this._elapsed/1e3}getTimescale(){return this._timescale}setTimescale(e){return this._timescale=e,this}reset(){return this._currentTime=performance.now()-this._startTime,this}dispose(){this.disconnect()}update(e){return this._pageVisibilityHandler!==null&&this._document.hidden===!0?this._delta=0:(this._previousTime=this._currentTime,this._currentTime=(e!==void 0?e:performance.now())-this._startTime,this._delta=(this._currentTime-this._previousTime)*this._timescale,this._elapsed+=this._delta),this}};function mAe(){this._document.hidden===!1&&this.reset()}var J8="\\[\\]\\.:\\/",AAe=new RegExp("["+J8+"]","g"),eF="[^"+J8+"]",gAe="[^"+J8.replace("\\.","")+"]",vAe=/((?:WC+[\/:])*)/.source.replace("WC",eF),_Ae=/(WCOD+)?/.source.replace("WCOD",gAe),xAe=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",eF),yAe=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",eF),bAe=new RegExp("^"+vAe+_Ae+xAe+yAe+"$"),wAe=["material","materials","bones","map"],E8=class{constructor(e,t,n){let r=n||Sr.parseTrackName(t);this._targetGroup=e,this._bindings=e.subscribe_(t,r)}getValue(e,t){this.bind();let n=this._targetGroup.nCachedObjects_,r=this._bindings[n];r!==void 0&&r.getValue(e,t)}setValue(e,t){let n=this._bindings;for(let r=this._targetGroup.nCachedObjects_,s=n.length;r!==s;++r)n[r].setValue(e,t)}bind(){let e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,n=e.length;t!==n;++t)e[t].bind()}unbind(){let e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,n=e.length;t!==n;++t)e[t].unbind()}},Sr=class i{constructor(e,t,n){this.path=t,this.parsedPath=n||i.parseTrackName(t),this.node=i.findNode(e,this.parsedPath.nodeName),this.rootNode=e,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(e,t,n){return e&&e.isAnimationObjectGroup?new i.Composite(e,t,n):new i(e,t,n)}static sanitizeNodeName(e){return e.replace(/\s/g,"_").replace(AAe,"")}static parseTrackName(e){let t=bAe.exec(e);if(t===null)throw new Error("THREE.PropertyBinding: Cannot parse trackName: "+e);let n={nodeName:t[2],objectName:t[3],objectIndex:t[4],propertyName:t[5],propertyIndex:t[6]},r=n.nodeName&&n.nodeName.lastIndexOf(".");if(r!==void 0&&r!==-1){let s=n.nodeName.substring(r+1);wAe.indexOf(s)!==-1&&(n.nodeName=n.nodeName.substring(0,r),n.objectName=s)}if(n.propertyName===null||n.propertyName.length===0)throw new Error("THREE.PropertyBinding: can not parse propertyName from trackName: "+e);return n}static findNode(e,t){if(t===void 0||t===""||t==="."||t===-1||t===e.name||t===e.uuid)return e;if(e.skeleton){let n=e.skeleton.getBoneByName(t);if(n!==void 0)return n}if(e.children){let n=function(s){for(let o=0;o<s.length;o++){let a=s[o];if(a.name===t||a.uuid===t)return a;let l=n(a.children);if(l)return l}return null},r=n(e.children);if(r)return r}return null}_getValue_unavailable(){}_setValue_unavailable(){}_getValue_direct(e,t){e[t]=this.targetObject[this.propertyName]}_getValue_array(e,t){let n=this.resolvedProperty;for(let r=0,s=n.length;r!==s;++r)e[t++]=n[r]}_getValue_arrayElement(e,t){e[t]=this.resolvedProperty[this.propertyIndex]}_getValue_toArray(e,t){this.resolvedProperty.toArray(e,t)}_setValue_direct(e,t){this.targetObject[this.propertyName]=e[t]}_setValue_direct_setNeedsUpdate(e,t){this.targetObject[this.propertyName]=e[t],this.targetObject.needsUpdate=!0}_setValue_direct_setMatrixWorldNeedsUpdate(e,t){this.targetObject[this.propertyName]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_array(e,t){let n=this.resolvedProperty;for(let r=0,s=n.length;r!==s;++r)n[r]=e[t++]}_setValue_array_setNeedsUpdate(e,t){let n=this.resolvedProperty;for(let r=0,s=n.length;r!==s;++r)n[r]=e[t++];this.targetObject.needsUpdate=!0}_setValue_array_setMatrixWorldNeedsUpdate(e,t){let n=this.resolvedProperty;for(let r=0,s=n.length;r!==s;++r)n[r]=e[t++];this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_arrayElement(e,t){this.resolvedProperty[this.propertyIndex]=e[t]}_setValue_arrayElement_setNeedsUpdate(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.needsUpdate=!0}_setValue_arrayElement_setMatrixWorldNeedsUpdate(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_fromArray(e,t){this.resolvedProperty.fromArray(e,t)}_setValue_fromArray_setNeedsUpdate(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.needsUpdate=!0}_setValue_fromArray_setMatrixWorldNeedsUpdate(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.matrixWorldNeedsUpdate=!0}_getValue_unbound(e,t){this.bind(),this.getValue(e,t)}_setValue_unbound(e,t){this.bind(),this.setValue(e,t)}bind(){let e=this.node,t=this.parsedPath,n=t.objectName,r=t.propertyName,s=t.propertyIndex;if(e||(e=i.findNode(this.rootNode,t.nodeName),this.node=e),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,!e){Xe("PropertyBinding: No target node found for track: "+this.path+".");return}if(n){let c=t.objectIndex;switch(n){case"materials":if(!e.material){ze("PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!e.material.materials){ze("PropertyBinding: Can not bind to material.materials as node.material does not have a materials array.",this);return}e=e.material.materials;break;case"bones":if(!e.skeleton){ze("PropertyBinding: Can not bind to bones as node does not have a skeleton.",this);return}e=e.skeleton.bones;for(let u=0;u<e.length;u++)if(e[u].name===c){c=u;break}break;case"map":if("map"in e){e=e.map;break}if(!e.material){ze("PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!e.material.map){ze("PropertyBinding: Can not bind to material.map as node.material does not have a map.",this);return}e=e.material.map;break;default:if(e[n]===void 0){ze("PropertyBinding: Can not bind to objectName of node undefined.",this);return}e=e[n]}if(c!==void 0){if(e[c]===void 0){ze("PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.",this,e);return}e=e[c]}}let o=e[r];if(o===void 0){let c=t.nodeName;ze("PropertyBinding: Trying to update property for track: "+c+"."+r+" but it wasn't found.",e);return}let a=this.Versioning.None;this.targetObject=e,e.isMaterial===!0?a=this.Versioning.NeedsUpdate:e.isObject3D===!0&&(a=this.Versioning.MatrixWorldNeedsUpdate);let l=this.BindingType.Direct;if(s!==void 0){if(r==="morphTargetInfluences"){if(!e.geometry){ze("PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.",this);return}if(!e.geometry.morphAttributes){ze("PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphAttributes.",this);return}e.morphTargetDictionary[s]!==void 0&&(s=e.morphTargetDictionary[s])}l=this.BindingType.ArrayElement,this.resolvedProperty=o,this.propertyIndex=s}else o.fromArray!==void 0&&o.toArray!==void 0?(l=this.BindingType.HasFromToArray,this.resolvedProperty=o):Array.isArray(o)?(l=this.BindingType.EntireArray,this.resolvedProperty=o):this.propertyName=r;this.getValue=this.GetterByBindingType[l],this.setValue=this.SetterByBindingTypeAndVersioning[l][a]}unbind(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}};Sr.Composite=E8;Sr.prototype.BindingType={Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3};Sr.prototype.Versioning={None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2};Sr.prototype.GetterByBindingType=[Sr.prototype._getValue_direct,Sr.prototype._getValue_array,Sr.prototype._getValue_arrayElement,Sr.prototype._getValue_toArray];Sr.prototype.SetterByBindingTypeAndVersioning=[[Sr.prototype._setValue_direct,Sr.prototype._setValue_direct_setNeedsUpdate,Sr.prototype._setValue_direct_setMatrixWorldNeedsUpdate],[Sr.prototype._setValue_array,Sr.prototype._setValue_array_setNeedsUpdate,Sr.prototype._setValue_array_setMatrixWorldNeedsUpdate],[Sr.prototype._setValue_arrayElement,Sr.prototype._setValue_arrayElement_setNeedsUpdate,Sr.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate],[Sr.prototype._setValue_fromArray,Sr.prototype._setValue_fromArray_setNeedsUpdate,Sr.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate]];var VYe=new Float32Array(1);var Lh=class extends Ed{constructor(e,t,n=1){super(e,t),this.isInstancedInterleavedBuffer=!0,this.meshPerAttribute=n}copy(e){return super.copy(e),this.meshPerAttribute=e.meshPerAttribute,this}clone(e){let t=super.clone(e);return t.meshPerAttribute=this.meshPerAttribute,t}toJSON(e){let t=super.toJSON(e);return t.isInstancedInterleavedBuffer=!0,t.meshPerAttribute=this.meshPerAttribute,t}};var XY=new cn,nb=class{constructor(e,t,n=0,r=1/0){this.ray=new Md(e,t),this.near=n,this.far=r,this.camera=null,this.layers=new Wv,this.params={Mesh:{},Line:{threshold:1},LOD:{},Points:{threshold:1},Sprite:{}}}set(e,t){this.ray.set(e,t)}setFromCamera(e,t){t.isPerspectiveCamera?(this.ray.origin.setFromMatrixPosition(t.matrixWorld),this.ray.direction.set(e.x,e.y,.5).unproject(t).sub(this.ray.origin).normalize(),this.camera=t):t.isOrthographicCamera?(this.ray.origin.set(e.x,e.y,t.projectionMatrix.elements[14]).unproject(t),this.ray.direction.set(0,0,-1).transformDirection(t.matrixWorld),this.camera=t):ze("Raycaster: Unsupported camera type: "+t.type)}setFromXRController(e){return XY.identity().extractRotation(e.matrixWorld),this.ray.origin.setFromMatrixPosition(e.matrixWorld),this.ray.direction.set(0,0,-1).applyMatrix4(XY),this}intersectObject(e,t=!0,n=[]){return M8(e,this,n,t),n.sort($Y),n}intersectObjects(e,t=!0,n=[]){for(let r=0,s=e.length;r<s;r++)M8(e[r],this,n,t);return n.sort($Y),n}};function $Y(i,e){return i.distance-e.distance}function M8(i,e,t,n){let r=!0;if(i.layers.test(e.layers)&&i.raycast(e,t)===!1&&(r=!1),r===!0&&n===!0){let s=i.children;for(let o=0,a=s.length;o<a;o++)M8(s[o],e,t,!0)}}var n_=class{constructor(e=1,t=0,n=0){this.radius=e,this.phi=t,this.theta=n}set(e,t,n){return this.radius=e,this.phi=t,this.theta=n,this}copy(e){return this.radius=e.radius,this.phi=e.phi,this.theta=e.theta,this}makeSafe(){return this.phi=Nn(this.phi,1e-6,Math.PI-1e-6),this}setFromVector3(e){return this.setFromCartesianCoords(e.x,e.y,e.z)}setFromCartesianCoords(e,t,n){return this.radius=Math.sqrt(e*e+t*t+n*n),this.radius===0?(this.theta=0,this.phi=0):(this.theta=Math.atan2(e,n),this.phi=Math.acos(Nn(t/this.radius,-1,1))),this}clone(){return new this.constructor().copy(this)}};var sF=class sF{constructor(e,t,n,r){this.elements=[1,0,0,1],e!==void 0&&this.set(e,t,n,r)}identity(){return this.set(1,0,0,1),this}fromArray(e,t=0){for(let n=0;n<4;n++)this.elements[n]=e[n+t];return this}set(e,t,n,r){let s=this.elements;return s[0]=e,s[2]=t,s[1]=n,s[3]=r,this}};sF.prototype.isMatrix2=!0;var i_=sF,YY=new Oe,yM=class{constructor(e=new Oe(1/0,1/0),t=new Oe(-1/0,-1/0)){this.isBox2=!0,this.min=e,this.max=t}set(e,t){return this.min.copy(e),this.max.copy(t),this}setFromPoints(e){this.makeEmpty();for(let t=0,n=e.length;t<n;t++)this.expandByPoint(e[t]);return this}setFromCenterAndSize(e,t){let n=YY.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(n),this.max.copy(e).add(n),this}clone(){return new this.constructor().copy(this)}copy(e){return this.min.copy(e.min),this.max.copy(e.max),this}makeEmpty(){return this.min.x=this.min.y=1/0,this.max.x=this.max.y=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y}getCenter(e){return this.isEmpty()?e.set(0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(e){return this.isEmpty()?e.set(0,0):e.subVectors(this.max,this.min)}expandByPoint(e){return this.min.min(e),this.max.max(e),this}expandByVector(e){return this.min.sub(e),this.max.add(e),this}expandByScalar(e){return this.min.addScalar(-e),this.max.addScalar(e),this}containsPoint(e){return e.x>=this.min.x&&e.x<=this.max.x&&e.y>=this.min.y&&e.y<=this.max.y}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y}getParameter(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y))}intersectsBox(e){return e.max.x>=this.min.x&&e.min.x<=this.max.x&&e.max.y>=this.min.y&&e.min.y<=this.max.y}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,YY).distanceTo(e)}intersect(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this}union(e){return this.min.min(e.min),this.max.max(e.max),this}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}},ZY=new re,$3=new re,kv=new re,zv=new re,p8=new re,SAe=new re,TAe=new re,ib=class{constructor(e=new re,t=new re){this.start=e,this.end=t}set(e,t){return this.start.copy(e),this.end.copy(t),this}copy(e){return this.start.copy(e.start),this.end.copy(e.end),this}getCenter(e){return e.addVectors(this.start,this.end).multiplyScalar(.5)}delta(e){return e.subVectors(this.end,this.start)}distanceSq(){return this.start.distanceToSquared(this.end)}distance(){return this.start.distanceTo(this.end)}at(e,t){return this.delta(t).multiplyScalar(e).add(this.start)}closestPointToPointParameter(e,t){ZY.subVectors(e,this.start),$3.subVectors(this.end,this.start);let n=$3.dot($3);if(n===0)return 0;let s=$3.dot(ZY)/n;return t&&(s=Nn(s,0,1)),s}closestPointToPoint(e,t,n){let r=this.closestPointToPointParameter(e,t);return this.delta(n).multiplyScalar(r).add(this.start)}distanceSqToLine3(e,t=SAe,n=TAe){let r=10000000000000001e-32,s,o,a=this.start,l=e.start,c=this.end,u=e.end;kv.subVectors(c,a),zv.subVectors(u,l),p8.subVectors(a,l);let f=kv.dot(kv),d=zv.dot(zv),A=zv.dot(p8);if(f<=r&&d<=r)return t.copy(a),n.copy(l),t.sub(n),t.dot(t);if(f<=r)s=0,o=A/d,o=Nn(o,0,1);else{let y=kv.dot(p8);if(d<=r)o=0,s=Nn(-y/f,0,1);else{let w=kv.dot(zv),S=f*d-w*w;S!==0?s=Nn((w*A-y*d)/S,0,1):s=0,o=(w*s+A)/d,o<0?(o=0,s=Nn(-y/f,0,1)):o>1&&(o=1,s=Nn((w-y)/f,0,1))}}return t.copy(a).addScaledVector(kv,s),n.copy(l).addScaledVector(zv,o),t.distanceToSquared(n)}applyMatrix4(e){return this.start.applyMatrix4(e),this.end.applyMatrix4(e),this}equals(e){return e.start.equals(this.start)&&e.end.equals(this.end)}clone(){return new this.constructor().copy(this)}};var rb=class{constructor(){this.type="ShapePath",this.color=new zt,this.subPaths=[],this.currentPath=null,this.userData={}}moveTo(e,t){return this.currentPath=new GA,this.subPaths.push(this.currentPath),this.currentPath.moveTo(e,t),this}lineTo(e,t){return this.currentPath.lineTo(e,t),this}quadraticCurveTo(e,t,n,r){return this.currentPath.quadraticCurveTo(e,t,n,r),this}bezierCurveTo(e,t,n,r,s,o){return this.currentPath.bezierCurveTo(e,t,n,r,s,o),this}splineThru(e){return this.currentPath.splineThru(e),this}toShapes(){function e(l,c){let u=!1,f=c.length;for(let d=0,A=f-1;d<f;A=d++){let y=c[d],w=c[A];y.y>l.y!=w.y>l.y&&l.x<(w.x-y.x)*(l.y-y.y)/(w.y-y.y)+y.x&&(u=!u)}return u}function t(l,c){let u=c.getCenter(new Oe);if(e(u,l))return u;let f=u.y,d=[],A=l.length;for(let y=0;y<A;y++){let w=l[y],S=l[(y+1)%A];if(w.y>f!=S.y>f){let T=w.x+(f-w.y)*(S.x-w.x)/(S.y-w.y);d.push(T)}}return d.length>1&&(d.sort((y,w)=>y-w),u.x=(d[0]+d[1])/2),u}let n=this.userData.style&&this.userData.style.fillRule||"nonzero";n!=="nonzero"&&n!=="evenodd"&&(Xe('Fill-rule "'+n+'" is not supported, falling back to "nonzero".'),n="nonzero");let r=n==="nonzero"?(l=>l!==0):(l=>(l&1)!==0),s=[];for(let l of this.subPaths){let c=l.getPoints();if(c.length<3)continue;let u=$p.area(c);if(u===0)continue;let f=new yM;for(let d=0;d<c.length;d++)f.expandByPoint(c[d]);s.push({subPath:l,points:c,boundingBox:f,interiorPoint:t(c,f),absArea:Math.abs(u),winding:u<0?-1:1,container:null,exclude:!1,role:null})}s.sort((l,c)=>c.absArea-l.absArea);for(let l=0;l<s.length;l++){let c=s[l],u=0;for(let f=l-1;f>=0;f--){let d=s[f];if(d.boundingBox.containsBox(c.boundingBox)&&e(c.interiorPoint,d.points)){c.container=d.exclude?d.container:d,u=d.winding,c.winding+=u;break}}r(c.winding)===r(u)&&(c.exclude=!0)}for(let l of s)l.exclude||(l.role=l.container===null||l.container.role==="hole"?"outer":"hole");let o=[],a=new Map;for(let l of s){if(l.exclude||l.role!=="outer")continue;let c=new B2;c.curves=l.subPath.curves,o.push(c),a.set(l,c)}for(let l of s){if(l.exclude||l.role!=="hole")continue;let c=a.get(l.container);if(!c)continue;let u=new GA;u.curves=l.subPath.curves,c.holes.push(u)}return o}},Rd=class extends la{constructor(e,t=null){super(),this.object=e,this.domElement=t,this.enabled=!0,this.state=-1,this.keys={},this.mouseButtons={LEFT:null,MIDDLE:null,RIGHT:null},this.touches={ONE:null,TWO:null}}connect(e){if(e===void 0){Xe("Controls: connect() now requires an element.");return}this.domElement!==null&&this.disconnect(),this.domElement=e}disconnect(){}dispose(){}update(){}};function Lb(i,e,t,n){let r=EAe(n);switch(t){case r_:return i*e;case Ld:return i*e/r.components*r.byteLength;case kh:return i*e/r.components*r.byteLength;case js:return i*e*2/r.components*r.byteLength;case zh:return i*e*2/r.components*r.byteLength;case Pd:return i*e*3/r.components*r.byteLength;case Or:return i*e*4/r.components*r.byteLength;case d0:return i*e*4/r.components*r.byteLength;case Vh:case Gh:return Math.floor((i+3)/4)*Math.floor((e+3)/4)*8;case qh:case Hh:return Math.floor((i+3)/4)*Math.floor((e+3)/4)*16;case ng:case rg:return Math.max(i,16)*Math.max(e,8)/4;case tg:case ig:return Math.max(i,8)*Math.max(e,8)/2;case p0:case m0:case g0:case v0:return Math.floor((i+3)/4)*Math.floor((e+3)/4)*8;case A0:case Wh:case _0:return Math.floor((i+3)/4)*Math.floor((e+3)/4)*16;case x0:return Math.floor((i+3)/4)*Math.floor((e+3)/4)*16;case y0:return Math.floor((i+4)/5)*Math.floor((e+3)/4)*16;case b0:return Math.floor((i+4)/5)*Math.floor((e+4)/5)*16;case w0:return Math.floor((i+5)/6)*Math.floor((e+4)/5)*16;case S0:return Math.floor((i+5)/6)*Math.floor((e+5)/6)*16;case T0:return Math.floor((i+7)/8)*Math.floor((e+4)/5)*16;case E0:return Math.floor((i+7)/8)*Math.floor((e+5)/6)*16;case M0:return Math.floor((i+7)/8)*Math.floor((e+7)/8)*16;case C0:return Math.floor((i+9)/10)*Math.floor((e+4)/5)*16;case R0:return Math.floor((i+9)/10)*Math.floor((e+5)/6)*16;case I0:return Math.floor((i+9)/10)*Math.floor((e+7)/8)*16;case P0:return Math.floor((i+9)/10)*Math.floor((e+9)/10)*16;case L0:return Math.floor((i+11)/12)*Math.floor((e+9)/10)*16;case D0:return Math.floor((i+11)/12)*Math.floor((e+11)/12)*16;case N0:case F0:case B0:return Math.ceil(i/4)*Math.ceil(e/4)*16;case O0:case U0:return Math.ceil(i/4)*Math.ceil(e/4)*8;case jh:case k0:return Math.ceil(i/4)*Math.ceil(e/4)*16}throw new Error(`Unable to determine texture byte length for ${t} format.`)}function EAe(i){switch(i){case Ji:case Oh:return{byteLength:1,components:1};case bl:case Uh:case Wi:return{byteLength:2,components:1};case KA:case QA:return{byteLength:2,components:4};case xi:case Zr:case cr:return{byteLength:4,components:1};case JA:case eg:return{byteLength:4,components:3}}throw new Error(`THREE.TextureUtils: Unknown texture type ${i}.`)}typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:"185"}}));typeof window<"u"&&(window.__THREE__?Xe("WARNING: Multiple instances of Three.js being imported."):window.__THREE__="185");function NZ(){let i=null,e=!1,t=null,n=null;function r(s,o){t(s,o),n=i.requestAnimationFrame(r)}return{start:function(){e!==!0&&t!==null&&i!==null&&(n=i.requestAnimationFrame(r),e=!0)},stop:function(){i!==null&&i.cancelAnimationFrame(n),e=!1},setAnimationLoop:function(s){t=s},setContext:function(s){i=s}}}function RAe(i){let e=new WeakMap;function t(a,l){let c=a.array,u=a.usage,f=c.byteLength,d=i.createBuffer();i.bindBuffer(l,d),i.bufferData(l,c,u),a.onUploadCallback();let A;if(c instanceof Float32Array)A=i.FLOAT;else if(typeof Float16Array<"u"&&c instanceof Float16Array)A=i.HALF_FLOAT;else if(c instanceof Uint16Array)a.isFloat16BufferAttribute?A=i.HALF_FLOAT:A=i.UNSIGNED_SHORT;else if(c instanceof Int16Array)A=i.SHORT;else if(c instanceof Uint32Array)A=i.UNSIGNED_INT;else if(c instanceof Int32Array)A=i.INT;else if(c instanceof Int8Array)A=i.BYTE;else if(c instanceof Uint8Array)A=i.UNSIGNED_BYTE;else if(c instanceof Uint8ClampedArray)A=i.UNSIGNED_BYTE;else throw new Error("THREE.WebGLAttributes: Unsupported buffer data format: "+c);return{buffer:d,type:A,bytesPerElement:c.BYTES_PER_ELEMENT,version:a.version,size:f}}function n(a,l,c){let u=l.array,f=l.updateRanges;if(i.bindBuffer(c,a),f.length===0)i.bufferSubData(c,0,u);else{f.sort((A,y)=>A.start-y.start);let d=0;for(let A=1;A<f.length;A++){let y=f[d],w=f[A];w.start<=y.start+y.count+1?y.count=Math.max(y.count,w.start+w.count-y.start):(++d,f[d]=w)}f.length=d+1;for(let A=0,y=f.length;A<y;A++){let w=f[A];i.bufferSubData(c,w.start*u.BYTES_PER_ELEMENT,u,w.start,w.count)}l.clearUpdateRanges()}l.onUploadCallback()}function r(a){return a.isInterleavedBufferAttribute&&(a=a.data),e.get(a)}function s(a){a.isInterleavedBufferAttribute&&(a=a.data);let l=e.get(a);l&&(i.deleteBuffer(l.buffer),e.delete(a))}function o(a,l){if(a.isInterleavedBufferAttribute&&(a=a.data),a.isGLBufferAttribute){let u=e.get(a);(!u||u.version<a.version)&&e.set(a,{buffer:a.buffer,type:a.type,bytesPerElement:a.elementSize,version:a.version});return}let c=e.get(a);if(c===void 0)e.set(a,t(a,l));else if(c.version<a.version){if(c.size!==a.array.byteLength)throw new Error("THREE.WebGLAttributes: The size of the buffer attribute's array buffer does not match the original size. Resizing buffer attributes is not supported.");n(c.buffer,a,l),c.version=a.version}}return{get:r,remove:s,update:o}}var IAe=`#ifdef USE_ALPHAHASH14+}`,ds=class extends Hs{constructor(e){super(),this.isShaderMaterial=!0,this.type="ShaderMaterial",this.defines={},this.uniforms={},this.uniformsGroups=[],this.vertexShader=$Ae,this.fragmentShader=YAe,this.linewidth=1,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.clipping=!1,this.forceSinglePass=!0,this.extensions={clipCullDistance:!1,multiDraw:!1},this.defaultAttributeValues={color:[1,1,1],uv:[0,0],uv1:[0,0]},this.index0AttributeName=void 0,this.uniformsNeedUpdate=!1,this.glslVersion=null,e!==void 0&&this.setValues(e)}copy(e){return super.copy(e),this.fragmentShader=e.fragmentShader,this.vertexShader=e.vertexShader,this.uniforms=fg(e.uniforms),this.uniformsGroups=XAe(e.uniformsGroups),this.defines=Object.assign({},e.defines),this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.fog=e.fog,this.lights=e.lights,this.clipping=e.clipping,this.extensions=Object.assign({},e.extensions),this.glslVersion=e.glslVersion,this.defaultAttributeValues=Object.assign({},e.defaultAttributeValues),this.index0AttributeName=e.index0AttributeName,this.uniformsNeedUpdate=e.uniformsNeedUpdate,this}toJSON(e){let t=super.toJSON(e);t.glslVersion=this.glslVersion,t.uniforms={};for(let r in this.uniforms){let o=this.uniforms[r].value;o&&o.isTexture?t.uniforms[r]={type:"t",value:o.toJSON(e).uuid}:o&&o.isColor?t.uniforms[r]={type:"c",value:o.getHex()}:o&&o.isVector2?t.uniforms[r]={type:"v2",value:o.toArray()}:o&&o.isVector3?t.uniforms[r]={type:"v3",value:o.toArray()}:o&&o.isVector4?t.uniforms[r]={type:"v4",value:o.toArray()}:o&&o.isMatrix3?t.uniforms[r]={type:"m3",value:o.toArray()}:o&&o.isMatrix4?t.uniforms[r]={type:"m4",value:o.toArray()}:t.uniforms[r]={value:o}}Object.keys(this.defines).length>0&&(t.defines=this.defines),t.vertexShader=this.vertexShader,t.fragmentShader=this.fragmentShader,t.lights=this.lights,t.clipping=this.clipping;let n={};for(let r in this.extensions)this.extensions[r]===!0&&(n[r]=!0);return Object.keys(n).length>0&&(t.extensions=n),t}fromJSON(e,t){if(super.fromJSON(e,t),e.uniforms!==void 0)for(let n in e.uniforms){let r=e.uniforms[n];switch(this.uniforms[n]={},r.type){case"t":this.uniforms[n].value=t[r.value]||null;break;case"c":this.uniforms[n].value=new zt().setHex(r.value);break;case"v2":this.uniforms[n].value=new Oe().fromArray(r.value);break;case"v3":this.uniforms[n].value=new re().fromArray(r.value);break;case"v4":this.uniforms[n].value=new xn().fromArray(r.value);break;case"m3":this.uniforms[n].value=new Mn().fromArray(r.value);break;case"m4":this.uniforms[n].value=new cn().fromArray(r.value);break;default:this.uniforms[n].value=r.value}}if(e.defines!==void 0&&(this.defines=e.defines),e.vertexShader!==void 0&&(this.vertexShader=e.vertexShader),e.fragmentShader!==void 0&&(this.fragmentShader=e.fragmentShader),e.glslVersion!==void 0&&(this.glslVersion=e.glslVersion),e.extensions!==void 0)for(let n in e.extensions)this.extensions[n]=e.extensions[n];return e.lights!==void 0&&(this.lights=e.lights),e.clipping!==void 0&&(this.clipping=e.clipping),this}},mM=class extends ds{constructor(e){super(e),this.isRawShaderMaterial=!0,this.type="RawShaderMaterial"}},s_=class extends Hs{constructor(e){super(),this.isMeshStandardMaterial=!0,this.type="MeshStandardMaterial",this.defines={STANDARD:""},this.color=new zt(16777215),this.roughness=1,this.metalness=0,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new zt(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=tc,this.normalScale=new Oe(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.roughnessMap=null,this.metalnessMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new Ua,this.envMapIntensity=1,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.defines={STANDARD:""},this.color.copy(e.color),this.roughness=e.roughness,this.metalness=e.metalness,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.roughnessMap=e.roughnessMap,this.metalnessMap=e.metalnessMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.envMapIntensity=e.envMapIntensity,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}},Z2=class extends s_{constructor(e){super(),this.isMeshPhysicalMaterial=!0,this.defines={STANDARD:"",PHYSICAL:""},this.type="MeshPhysicalMaterial",this.anisotropyRotation=0,this.anisotropyMap=null,this.clearcoatMap=null,this.clearcoatRoughness=0,this.clearcoatRoughnessMap=null,this.clearcoatNormalScale=new Oe(1,1),this.clearcoatNormalMap=null,this.ior=1.5,Object.defineProperty(this,"reflectivity",{get:function(){return Nn(2.5*(this.ior-1)/(this.ior+1),0,1)},set:function(t){this.ior=(1+.4*t)/(1-.4*t)}}),this.iridescenceMap=null,this.iridescenceIOR=1.3,this.iridescenceThicknessRange=[100,400],this.iridescenceThicknessMap=null,this.sheenColor=new zt(0),this.sheenColorMap=null,this.sheenRoughness=1,this.sheenRoughnessMap=null,this.transmissionMap=null,this.thickness=0,this.thicknessMap=null,this.attenuationDistance=1/0,this.attenuationColor=new zt(1,1,1),this.specularIntensity=1,this.specularIntensityMap=null,this.specularColor=new zt(1,1,1),this.specularColorMap=null,this._anisotropy=0,this._clearcoat=0,this._dispersion=0,this._iridescence=0,this._sheen=0,this._transmission=0,this.setValues(e)}get anisotropy(){return this._anisotropy}set anisotropy(e){this._anisotropy>0!=e>0&&this.version++,this._anisotropy=e}get clearcoat(){return this._clearcoat}set clearcoat(e){this._clearcoat>0!=e>0&&this.version++,this._clearcoat=e}get iridescence(){return this._iridescence}set iridescence(e){this._iridescence>0!=e>0&&this.version++,this._iridescence=e}get dispersion(){return this._dispersion}set dispersion(e){this._dispersion>0!=e>0&&this.version++,this._dispersion=e}get sheen(){return this._sheen}set sheen(e){this._sheen>0!=e>0&&this.version++,this._sheen=e}get transmission(){return this._transmission}set transmission(e){this._transmission>0!=e>0&&this.version++,this._transmission=e}copy(e){return super.copy(e),this.defines={STANDARD:"",PHYSICAL:""},this.anisotropy=e.anisotropy,this.anisotropyRotation=e.anisotropyRotation,this.anisotropyMap=e.anisotropyMap,this.clearcoat=e.clearcoat,this.clearcoatMap=e.clearcoatMap,this.clearcoatRoughness=e.clearcoatRoughness,this.clearcoatRoughnessMap=e.clearcoatRoughnessMap,this.clearcoatNormalMap=e.clearcoatNormalMap,this.clearcoatNormalScale.copy(e.clearcoatNormalScale),this.dispersion=e.dispersion,this.ior=e.ior,this.iridescence=e.iridescence,this.iridescenceMap=e.iridescenceMap,this.iridescenceIOR=e.iridescenceIOR,this.iridescenceThicknessRange=[...e.iridescenceThicknessRange],this.iridescenceThicknessMap=e.iridescenceThicknessMap,this.sheen=e.sheen,this.sheenColor.copy(e.sheenColor),this.sheenColorMap=e.sheenColorMap,this.sheenRoughness=e.sheenRoughness,this.sheenRoughnessMap=e.sheenRoughnessMap,this.transmission=e.transmission,this.transmissionMap=e.transmissionMap,this.thickness=e.thickness,this.thicknessMap=e.thicknessMap,this.attenuationDistance=e.attenuationDistance,this.attenuationColor.copy(e.attenuationColor),this.specularIntensity=e.specularIntensity,this.specularIntensityMap=e.specularIntensityMap,this.specularColor.copy(e.specularColor),this.specularColorMap=e.specularColorMap,this}},ZA=class extends Hs{constructor(e){super(),this.isMeshPhongMaterial=!0,this.type="MeshPhongMaterial",this.color=new zt(16777215),this.specular=new zt(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new zt(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=tc,this.normalScale=new Oe(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new Ua,this.combine=tg,this.reflectivity=1,this.envMapIntensity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.specular.copy(e.specular),this.shininess=e.shininess,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.envMapIntensity=e.envMapIntensity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}},K2=class extends Hs{constructor(e){super(),this.isMeshToonMaterial=!0,this.defines={TOON:""},this.type="MeshToonMaterial",this.color=new zt(16777215),this.map=null,this.gradientMap=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new zt(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=tc,this.normalScale=new Oe(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.gradientMap=e.gradientMap,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.alphaMap=e.alphaMap,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.fog=e.fog,this}},Q2=class extends Hs{constructor(e){super(),this.isMeshNormalMaterial=!0,this.type="MeshNormalMaterial",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=tc,this.normalScale=new Oe(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.flatShading=!1,this.setValues(e)}copy(e){return super.copy(e),this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.flatShading=e.flatShading,this}},Ga=class extends Hs{constructor(e){super(),this.isMeshLambertMaterial=!0,this.type="MeshLambertMaterial",this.color=new zt(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new zt(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=tc,this.normalScale=new Oe(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new Ua,this.combine=tg,this.reflectivity=1,this.envMapIntensity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.envMapIntensity=e.envMapIntensity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}},AM=class extends Hs{constructor(e){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=EZ,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.setValues(e)}copy(e){return super.copy(e),this.depthPacking=e.depthPacking,this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this}},gM=class extends Hs{constructor(e){super(),this.isMeshDistanceMaterial=!0,this.type="MeshDistanceMaterial",this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.setValues(e)}copy(e){return super.copy(e),this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this}},J2=class extends Hs{constructor(e){super(),this.isMeshMatcapMaterial=!0,this.defines={MATCAP:""},this.type="MeshMatcapMaterial",this.color=new zt(16777215),this.matcap=null,this.map=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=tc,this.normalScale=new Oe(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.wireframe=!1,this.wireframeLinewidth=1,this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.defines={MATCAP:""},this.color.copy(e.color),this.matcap=e.matcap,this.map=e.map,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.alphaMap=e.alphaMap,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.flatShading=e.flatShading,this.fog=e.fog,this}},eb=class extends Iu{constructor(e){super(),this.isLineDashedMaterial=!0,this.type="LineDashedMaterial",this.scale=1,this.dashSize=3,this.gapSize=1,this.setValues(e)}copy(e){return super.copy(e),this.scale=e.scale,this.dashSize=e.dashSize,this.gapSize=e.gapSize,this}};function J3(i,e){return!i||i.constructor===e?i:typeof e.BYTES_PER_ELEMENT=="number"?new e(i):Array.prototype.slice.call(i)}var l0=class{constructor(e,t,n,r){this.parameterPositions=e,this._cachedIndex=0,this.resultBuffer=r!==void 0?r:new t.constructor(n),this.sampleValues=t,this.valueSize=n,this.settings=null,this.DefaultSettings_={}}evaluate(e){let t=this.parameterPositions,n=this._cachedIndex,r=t[n],s=t[n-1];e:{t:{let o;n:{i:if(!(e<r)){for(let a=n+2;;){if(r===void 0){if(e<s)break i;return n=t.length,this._cachedIndex=n,this.copySampleValue_(n-1)}if(n===a)break;if(s=r,r=t[++n],e<r)break t}o=t.length;break n}if(!(e>=s)){let a=t[1];e<a&&(n=2,s=a);for(let l=n-2;;){if(s===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(n===l)break;if(r=s,s=t[--n-1],e>=s)break t}o=n,n=0;break n}break e}for(;n<o;){let a=n+o>>>1;e<t[a]?o=a:n=a+1}if(r=t[n],s=t[n-1],s===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(r===void 0)return n=t.length,this._cachedIndex=n,this.copySampleValue_(n-1)}this._cachedIndex=n,this.intervalChanged_(n,s,r)}return this.interpolate_(n,s,e,r)}getSettings_(){return this.settings||this.DefaultSettings_}copySampleValue_(e){let t=this.resultBuffer,n=this.sampleValues,r=this.valueSize,s=e*r;for(let o=0;o!==r;++o)t[o]=n[s+o];return t}interpolate_(){throw new Error("THREE.Interpolant: Call to abstract method.")}intervalChanged_(){}},vM=class extends l0{constructor(e,t,n,r){super(e,t,n,r),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0,this.DefaultSettings_={endingStart:O8,endingEnd:O8}}intervalChanged_(e,t,n){let r=this.parameterPositions,s=e-2,o=e+1,a=r[s],l=r[o];if(a===void 0)switch(this.getSettings_().endingStart){case U8:s=e,a=2*t-n;break;case k8:s=r.length-2,a=t+r[s]-r[s+1];break;default:s=e,a=n}if(l===void 0)switch(this.getSettings_().endingEnd){case U8:o=e,l=2*n-t;break;case k8:o=1,l=n+r[1]-r[0];break;default:o=e-1,l=t}let c=(n-t)*.5,u=this.valueSize;this._weightPrev=c/(t-a),this._weightNext=c/(l-n),this._offsetPrev=s*u,this._offsetNext=o*u}interpolate_(e,t,n,r){let s=this.resultBuffer,o=this.sampleValues,a=this.valueSize,l=e*a,c=l-a,u=this._offsetPrev,f=this._offsetNext,d=this._weightPrev,A=this._weightNext,y=(n-t)/(r-t),w=y*y,S=w*y,T=-d*S+2*d*w-d*y,R=(1+d)*S+(-1.5-2*d)*w+(-.5+d)*y+1,I=(-1-A)*S+(1.5+A)*w+.5*y,P=A*S-A*w;for(let F=0;F!==a;++F)s[F]=T*o[u+F]+R*o[c+F]+I*o[l+F]+P*o[f+F];return s}},_M=class extends l0{constructor(e,t,n,r){super(e,t,n,r)}interpolate_(e,t,n,r){let s=this.resultBuffer,o=this.sampleValues,a=this.valueSize,l=e*a,c=l-a,u=(n-t)/(r-t),f=1-u;for(let d=0;d!==a;++d)s[d]=o[c+d]*f+o[l+d]*u;return s}},xM=class extends l0{constructor(e,t,n,r){super(e,t,n,r)}interpolate_(e){return this.copySampleValue_(e-1)}},yM=class extends l0{interpolate_(e,t,n,r){let s=this.resultBuffer,o=this.sampleValues,a=this.valueSize,l=e*a,c=l-a,u=this.inTangents,f=this.outTangents;if(!u||!f){let y=(n-t)/(r-t),w=1-y;for(let S=0;S!==a;++S)s[S]=o[c+S]*w+o[l+S]*y;return s}let d=a*2,A=e-1;for(let y=0;y!==a;++y){let w=o[c+y],S=o[l+y],T=A*d+y*2,R=f[T],I=f[T+1],P=e*d+y*2,F=u[P],D=u[P+1],L=(n-t)/(r-t),C,B,k,z,G;for(let W=0;W<8;W++){C=L*L,B=C*L,k=1-L,z=k*k,G=z*k;let H=G*t+3*z*L*R+3*k*C*F+B*r-n;if(Math.abs(H)<1e-10)break;let $=3*z*(R-t)+6*k*L*(F-R)+3*C*(r-F);if(Math.abs($)<1e-10)break;L=L-H/$,L=Math.max(0,Math.min(1,L))}s[y]=G*w+3*z*L*I+3*k*C*D+B*S}return s}},Jl=class{constructor(e,t,n,r){if(e===void 0)throw new Error("THREE.KeyframeTrack: track name is undefined");if(t===void 0||t.length===0)throw new Error("THREE.KeyframeTrack: no keyframes in track named "+e);this.name=e,this.times=J3(t,this.TimeBufferType),this.values=J3(n,this.ValueBufferType),this.setInterpolation(r||this.DefaultInterpolation)}static toJSON(e){let t=e.constructor,n;if(t.toJSON!==this.toJSON)n=t.toJSON(e);else{n={name:e.name,times:J3(e.times,Array),values:J3(e.values,Array)};let r=e.getInterpolation();r!==e.DefaultInterpolation&&(n.interpolation=r)}return n.type=e.ValueTypeName,n}InterpolantFactoryMethodDiscrete(e){return new xM(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodLinear(e){return new _M(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodSmooth(e){return new vM(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodBezier(e){let t=new yM(this.times,this.values,this.getValueSize(),e);return this.settings&&(t.inTangents=this.settings.inTangents,t.outTangents=this.settings.outTangents),t}setInterpolation(e){let t;switch(e){case L2:t=this.InterpolantFactoryMethodDiscrete;break;case sM:t=this.InterpolantFactoryMethodLinear;break;case iM:t=this.InterpolantFactoryMethodSmooth;break;case B8:t=this.InterpolantFactoryMethodBezier;break}if(t===void 0){let n="unsupported interpolation for "+this.ValueTypeName+" keyframe track named "+this.name;if(this.createInterpolant===void 0)if(e!==this.DefaultInterpolation)this.setInterpolation(this.DefaultInterpolation);else throw new Error(n);return Xe("KeyframeTrack:",n),this}return this.createInterpolant=t,this}getInterpolation(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return L2;case this.InterpolantFactoryMethodLinear:return sM;case this.InterpolantFactoryMethodSmooth:return iM;case this.InterpolantFactoryMethodBezier:return B8}}getValueSize(){return this.values.length/this.times.length}shift(e){if(e!==0){let t=this.times;for(let n=0,r=t.length;n!==r;++n)t[n]+=e}return this}scale(e){if(e!==1){let t=this.times;for(let n=0,r=t.length;n!==r;++n)t[n]*=e}return this}trim(e,t){let n=this.times,r=n.length,s=0,o=r-1;for(;s!==r&&n[s]<e;)++s;for(;o!==-1&&n[o]>t;)--o;if(++o,s!==0||o!==r){s>=o&&(o=Math.max(o,1),s=o-1);let a=this.getValueSize();this.times=n.slice(s,o),this.values=this.values.slice(s*a,o*a)}return this}validate(){let e=!0,t=this.getValueSize();t-Math.floor(t)!==0&&(ze("KeyframeTrack: Invalid value size in track.",this),e=!1);let n=this.times,r=this.values,s=n.length;s===0&&(ze("KeyframeTrack: Track is empty.",this),e=!1);let o=null;for(let a=0;a!==s;a++){let l=n[a];if(typeof l=="number"&&isNaN(l)){ze("KeyframeTrack: Time is not a valid number.",this,a,l),e=!1;break}if(o!==null&&o>l){ze("KeyframeTrack: Out of order keys.",this,a,l,o),e=!1;break}o=l}if(r!==void 0&&f_(r))for(let a=0,l=r.length;a!==l;++a){let c=r[a];if(isNaN(c)){ze("KeyframeTrack: Value is not a valid number.",this,a,c),e=!1;break}}return e}optimize(){let e=this.times.slice(),t=this.values.slice(),n=this.getValueSize(),r=this.getInterpolation()===iM,s=e.length-1,o=1;for(let a=1;a<s;++a){let l=!1,c=e[a],u=e[a+1];if(c!==u&&(a!==1||c!==e[0]))if(r)l=!0;else{let f=a*n,d=f-n,A=f+n;for(let y=0;y!==n;++y){let w=t[f+y];if(w!==t[d+y]||w!==t[A+y]){l=!0;break}}}if(l){if(a!==o){e[o]=e[a];let f=a*n,d=o*n;for(let A=0;A!==n;++A)t[d+A]=t[f+A]}++o}}if(s>0){e[o]=e[s];for(let a=s*n,l=o*n,c=0;c!==n;++c)t[l+c]=t[a+c];++o}return o!==e.length?(this.times=e.slice(0,o),this.values=t.slice(0,o*n)):(this.times=e,this.values=t),this}clone(){let e=this.times.slice(),t=this.values.slice(),n=this.constructor,r=new n(this.name,e,t);return r.createInterpolant=this.createInterpolant,r}};Jl.prototype.ValueTypeName="";Jl.prototype.TimeBufferType=Float32Array;Jl.prototype.ValueBufferType=Float32Array;Jl.prototype.DefaultInterpolation=sM;var c0=class extends Jl{constructor(e,t,n){super(e,t,n)}};c0.prototype.ValueTypeName="bool";c0.prototype.ValueBufferType=Array;c0.prototype.DefaultInterpolation=L2;c0.prototype.InterpolantFactoryMethodLinear=void 0;c0.prototype.InterpolantFactoryMethodSmooth=void 0;var bM=class extends Jl{constructor(e,t,n,r){super(e,t,n,r)}};bM.prototype.ValueTypeName="color";var wM=class extends Jl{constructor(e,t,n,r){super(e,t,n,r)}};wM.prototype.ValueTypeName="number";var SM=class extends l0{constructor(e,t,n,r){super(e,t,n,r)}interpolate_(e,t,n,r){let s=this.resultBuffer,o=this.sampleValues,a=this.valueSize,l=(n-t)/(r-t),c=e*a;for(let u=c+a;c!==u;c+=4)Gs.slerpFlat(s,0,o,c-a,o,c,l);return s}},tb=class extends Jl{constructor(e,t,n,r){super(e,t,n,r)}InterpolantFactoryMethodLinear(e){return new SM(this.times,this.values,this.getValueSize(),e)}};tb.prototype.ValueTypeName="quaternion";tb.prototype.InterpolantFactoryMethodSmooth=void 0;var u0=class extends Jl{constructor(e,t,n){super(e,t,n)}};u0.prototype.ValueTypeName="string";u0.prototype.ValueBufferType=Array;u0.prototype.DefaultInterpolation=L2;u0.prototype.InterpolantFactoryMethodLinear=void 0;u0.prototype.InterpolantFactoryMethodSmooth=void 0;var TM=class extends Jl{constructor(e,t,n,r){super(e,t,n,r)}};TM.prototype.ValueTypeName="vector";var rM={enabled:!1,files:{},add:function(i,e){this.enabled!==!1&&(dZ(i)||(this.files[i]=e))},get:function(i){if(this.enabled!==!1&&!dZ(i))return this.files[i]},remove:function(i){delete this.files[i]},clear:function(){this.files={}}};function dZ(i){try{let e=i.slice(i.indexOf(":")+1);return new URL(e).protocol==="blob:"}catch{return!1}}var EM=class{constructor(e,t,n){let r=this,s=!1,o=0,a=0,l,c=[];this.onStart=void 0,this.onLoad=e,this.onProgress=t,this.onError=n,this._abortController=null,this.itemStart=function(u){a++,s===!1&&r.onStart!==void 0&&r.onStart(u,o,a),s=!0},this.itemEnd=function(u){o++,r.onProgress!==void 0&&r.onProgress(u,o,a),o===a&&(s=!1,r.onLoad!==void 0&&r.onLoad())},this.itemError=function(u){r.onError!==void 0&&r.onError(u)},this.resolveURL=function(u){return u=u.normalize("NFC"),l?l(u):u},this.setURLModifier=function(u){return l=u,this},this.addHandler=function(u,f){return c.push(u,f),this},this.removeHandler=function(u){let f=c.indexOf(u);return f!==-1&&c.splice(f,2),this},this.getHandler=function(u){for(let f=0,d=c.length;f<d;f+=2){let A=c[f],y=c[f+1];if(A.global&&(A.lastIndex=0),A.test(u))return y}return null},this.abort=function(){return this.abortController.abort(),this._abortController=null,this}}get abortController(){return this._abortController||(this._abortController=new AbortController),this._abortController}},FZ=new EM,h0=class{constructor(e){this.manager=e!==void 0?e:FZ,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={},typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}load(){}loadAsync(e,t){let n=this;return new Promise(function(r,s){n.load(e,r,t,s)})}parse(){}setCrossOrigin(e){return this.crossOrigin=e,this}setWithCredentials(e){return this.withCredentials=e,this}setPath(e){return this.path=e,this}setResourcePath(e){return this.resourcePath=e,this}setRequestHeader(e){return this.requestHeader=e,this}abort(){return this}};h0.DEFAULT_MATERIAL_NAME="__DEFAULT";var Gv=new WeakMap,MM=class extends h0{constructor(e){super(e)}load(e,t,n,r){this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);let s=this,o=rM.get(`image:${e}`);if(o!==void 0){if(o.complete===!0)s.manager.itemStart(e),setTimeout(function(){t&&t(o),s.manager.itemEnd(e)},0);else{let f=Gv.get(o);f===void 0&&(f=[],Gv.set(o,f)),f.push({onLoad:t,onError:r})}return o}let a=$v("img");function l(){u(),t&&t(this);let f=Gv.get(this)||[];for(let d=0;d<f.length;d++){let A=f[d];A.onLoad&&A.onLoad(this)}Gv.delete(this),s.manager.itemEnd(e)}function c(f){u(),r&&r(f),rM.remove(`image:${e}`);let d=Gv.get(this)||[];for(let A=0;A<d.length;A++){let y=d[A];y.onError&&y.onError(f)}Gv.delete(this),s.manager.itemError(e),s.manager.itemEnd(e)}function u(){a.removeEventListener("load",l,!1),a.removeEventListener("error",c,!1)}return a.addEventListener("load",l,!1),a.addEventListener("error",c,!1),e.slice(0,5)!=="data:"&&this.crossOrigin!==void 0&&(a.crossOrigin=this.crossOrigin),rM.add(`image:${e}`,a),s.manager.itemStart(e),a.src=e,a}};var bl=class extends h0{constructor(e){super(e)}load(e,t,n,r){let s=new qs,o=new MM(this.manager);return o.setCrossOrigin(this.crossOrigin),o.setPath(this.path),o.load(e,function(a){s.image=a,s.needsUpdate=!0,t!==void 0&&t(s)},n,r),s}},Ih=class extends lr{constructor(e,t=1){super(),this.isLight=!0,this.type="Light",this.color=new zt(e),this.intensity=t}dispose(){this.dispatchEvent({type:"dispose"})}copy(e,t){return super.copy(e,t),this.color.copy(e.color),this.intensity=e.intensity,this}toJSON(e){let t=super.toJSON(e);return t.object.color=this.color.getHex(),t.object.intensity=this.intensity,t}},nb=class extends Ih{constructor(e,t,n){super(e,n),this.isHemisphereLight=!0,this.type="HemisphereLight",this.position.copy(lr.DEFAULT_UP),this.updateMatrix(),this.groundColor=new zt(t)}copy(e,t){return super.copy(e,t),this.groundColor.copy(e.groundColor),this}toJSON(e){let t=super.toJSON(e);return t.object.groundColor=this.groundColor.getHex(),t}},N8=new cn,pZ=new re,mZ=new re,ib=class{constructor(e){this.camera=e,this.intensity=1,this.bias=0,this.biasNode=null,this.normalBias=0,this.radius=1,this.blurSamples=8,this.mapSize=new Oe(512,512),this.mapType=Ji,this.map=null,this.mapPass=null,this.matrix=new cn,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new zc,this._frameExtents=new Oe(1,1),this._viewportCount=1,this._viewports=[new xn(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(e){let t=this.camera,n=this.matrix;pZ.setFromMatrixPosition(e.matrixWorld),t.position.copy(pZ),mZ.setFromMatrixPosition(e.target.matrixWorld),t.lookAt(mZ),t.updateMatrixWorld(),N8.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),this._frustum.setFromProjectionMatrix(N8,t.coordinateSystem,t.reversedDepth),t.coordinateSystem===xl||t.reversedDepth?n.set(.5,0,0,.5,0,.5,0,.5,0,0,1,0,0,0,0,1):n.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),n.multiply(N8)}getViewport(e){return this._viewports[e]}getFrameExtents(){return this._frameExtents}dispose(){this.map&&this.map.dispose(),this.mapPass&&this.mapPass.dispose()}copy(e){return this.camera=e.camera.clone(),this.intensity=e.intensity,this.bias=e.bias,this.radius=e.radius,this.autoUpdate=e.autoUpdate,this.needsUpdate=e.needsUpdate,this.normalBias=e.normalBias,this.blurSamples=e.blurSamples,this.mapSize.copy(e.mapSize),this.biasNode=e.biasNode,this}clone(){return new this.constructor().copy(this)}toJSON(){let e={};return this.intensity!==1&&(e.intensity=this.intensity),this.bias!==0&&(e.bias=this.bias),this.normalBias!==0&&(e.normalBias=this.normalBias),this.radius!==1&&(e.radius=this.radius),(this.mapSize.x!==512||this.mapSize.y!==512)&&(e.mapSize=this.mapSize.toArray()),e.camera=this.camera.toJSON(!1).object,delete e.camera.matrix,e}},eM=new re,tM=new Gs,Eh=new re,Id=class extends lr{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new cn,this.projectionMatrix=new cn,this.projectionMatrixInverse=new cn,this.coordinateSystem=ko,this._reversedDepth=!1}get reversedDepth(){return this._reversedDepth}copy(e,t){return super.copy(e,t),this.matrixWorldInverse.copy(e.matrixWorldInverse),this.projectionMatrix.copy(e.projectionMatrix),this.projectionMatrixInverse.copy(e.projectionMatrixInverse),this.coordinateSystem=e.coordinateSystem,this}getWorldDirection(e){return super.getWorldDirection(e).negate()}updateMatrixWorld(e){super.updateMatrixWorld(e),this.matrixWorld.decompose(eM,tM,Eh),Eh.x===1&&Eh.y===1&&Eh.z===1?this.matrixWorldInverse.copy(this.matrixWorld).invert():this.matrixWorldInverse.compose(eM,tM,Eh.set(1,1,1)).invert()}updateWorldMatrix(e,t,n=!1){super.updateWorldMatrix(e,t,n),this.matrixWorld.decompose(eM,tM,Eh),Eh.x===1&&Eh.y===1&&Eh.z===1?this.matrixWorldInverse.copy(this.matrixWorld).invert():this.matrixWorldInverse.compose(eM,tM,Eh.set(1,1,1)).invert()}clone(){return new this.constructor().copy(this)}},Kp=new re,AZ=new Oe,gZ=new Oe,Yr=class extends Id{constructor(e=50,t=1,n=.1,r=2e3){super(),this.isPerspectiveCamera=!0,this.type="PerspectiveCamera",this.fov=e,this.zoom=1,this.near=n,this.far=r,this.focus=10,this.aspect=t,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.fov=e.fov,this.zoom=e.zoom,this.near=e.near,this.far=e.far,this.focus=e.focus,this.aspect=e.aspect,this.view=e.view===null?null:Object.assign({},e.view),this.filmGauge=e.filmGauge,this.filmOffset=e.filmOffset,this}setFocalLength(e){let t=.5*this.getFilmHeight()/e;this.fov=Cd*2*Math.atan(t),this.updateProjectionMatrix()}getFocalLength(){let e=Math.tan(C2*.5*this.fov);return .5*this.getFilmHeight()/e}getEffectiveFOV(){return Cd*2*Math.atan(Math.tan(C2*.5*this.fov)/this.zoom)}getFilmWidth(){return this.filmGauge*Math.min(this.aspect,1)}getFilmHeight(){return this.filmGauge/Math.max(this.aspect,1)}getViewBounds(e,t,n){Kp.set(-1,-1,.5).applyMatrix4(this.projectionMatrixInverse),t.set(Kp.x,Kp.y).multiplyScalar(-e/Kp.z),Kp.set(1,1,.5).applyMatrix4(this.projectionMatrixInverse),n.set(Kp.x,Kp.y).multiplyScalar(-e/Kp.z)}getViewSize(e,t){return this.getViewBounds(e,AZ,gZ),t.subVectors(gZ,AZ)}setViewOffset(e,t,n,r,s,o){this.aspect=e/t,this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=n,this.view.offsetY=r,this.view.width=s,this.view.height=o,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){let e=this.near,t=e*Math.tan(C2*.5*this.fov)/this.zoom,n=2*t,r=this.aspect*n,s=-.5*r,o=this.view;if(this.view!==null&&this.view.enabled){let l=o.fullWidth,c=o.fullHeight;s+=o.offsetX*r/l,t-=o.offsetY*n/c,r*=o.width/l,n*=o.height/c}let a=this.filmOffset;a!==0&&(s+=e*a/this.getFilmWidth()),this.projectionMatrix.makePerspective(s,s+r,t,t-n,e,this.far,this.coordinateSystem,this.reversedDepth),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){let t=super.toJSON(e);return t.object.fov=this.fov,t.object.zoom=this.zoom,t.object.near=this.near,t.object.far=this.far,t.object.focus=this.focus,t.object.aspect=this.aspect,this.view!==null&&(t.object.view=Object.assign({},this.view)),t.object.filmGauge=this.filmGauge,t.object.filmOffset=this.filmOffset,t}},H8=class extends ib{constructor(){super(new Yr(50,1,.5,500)),this.isSpotLightShadow=!0,this.focus=1,this.aspect=1}updateMatrices(e){let t=this.camera,n=Cd*2*e.angle*this.focus,r=this.mapSize.width/this.mapSize.height*this.aspect,s=e.distance||t.far;(n!==t.fov||r!==t.aspect||s!==t.far)&&(t.fov=n,t.aspect=r,t.far=s,t.updateProjectionMatrix()),super.updateMatrices(e)}copy(e){return super.copy(e),this.focus=e.focus,this}},KA=class extends Ih{constructor(e,t,n=0,r=Math.PI/3,s=0,o=2){super(e,t),this.isSpotLight=!0,this.type="SpotLight",this.position.copy(lr.DEFAULT_UP),this.updateMatrix(),this.target=new lr,this.distance=n,this.angle=r,this.penumbra=s,this.decay=o,this.map=null,this.shadow=new H8}get power(){return this.intensity*Math.PI}set power(e){this.intensity=e/Math.PI}dispose(){super.dispose(),this.shadow.dispose()}copy(e,t){return super.copy(e,t),this.distance=e.distance,this.angle=e.angle,this.penumbra=e.penumbra,this.decay=e.decay,this.target=e.target.clone(),this.map=e.map,this.shadow=e.shadow.clone(),this}toJSON(e){let t=super.toJSON(e);return t.object.distance=this.distance,t.object.angle=this.angle,t.object.decay=this.decay,t.object.penumbra=this.penumbra,t.object.target=this.target.uuid,this.map&&this.map.isTexture&&(t.object.map=this.map.toJSON(e).uuid),t.object.shadow=this.shadow.toJSON(),t}},W8=class extends ib{constructor(){super(new Yr(90,1,.5,500)),this.isPointLightShadow=!0}},rb=class extends Ih{constructor(e,t,n=0,r=2){super(e,t),this.isPointLight=!0,this.type="PointLight",this.distance=n,this.decay=r,this.shadow=new W8}get power(){return this.intensity*4*Math.PI}set power(e){this.intensity=e/(4*Math.PI)}dispose(){super.dispose(),this.shadow.dispose()}copy(e,t){return super.copy(e,t),this.distance=e.distance,this.decay=e.decay,this.shadow=e.shadow.clone(),this}toJSON(e){let t=super.toJSON(e);return t.object.distance=this.distance,t.object.decay=this.decay,t.object.shadow=this.shadow.toJSON(),t}},Du=class extends Id{constructor(e=-1,t=1,n=1,r=-1,s=.1,o=2e3){super(),this.isOrthographicCamera=!0,this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=e,this.right=t,this.top=n,this.bottom=r,this.near=s,this.far=o,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.left=e.left,this.right=e.right,this.top=e.top,this.bottom=e.bottom,this.near=e.near,this.far=e.far,this.zoom=e.zoom,this.view=e.view===null?null:Object.assign({},e.view),this}setViewOffset(e,t,n,r,s,o){this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=n,this.view.offsetY=r,this.view.width=s,this.view.height=o,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){let e=(this.right-this.left)/(2*this.zoom),t=(this.top-this.bottom)/(2*this.zoom),n=(this.right+this.left)/2,r=(this.top+this.bottom)/2,s=n-e,o=n+e,a=r+t,l=r-t;if(this.view!==null&&this.view.enabled){let c=(this.right-this.left)/this.view.fullWidth/this.zoom,u=(this.top-this.bottom)/this.view.fullHeight/this.zoom;s+=c*this.view.offsetX,o=s+c*this.view.width,a-=u*this.view.offsetY,l=a-u*this.view.height}this.projectionMatrix.makeOrthographic(s,o,a,l,this.near,this.far,this.coordinateSystem,this.reversedDepth),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){let t=super.toJSON(e);return t.object.zoom=this.zoom,t.object.left=this.left,t.object.right=this.right,t.object.top=this.top,t.object.bottom=this.bottom,t.object.near=this.near,t.object.far=this.far,this.view!==null&&(t.object.view=Object.assign({},this.view)),t}},j8=class extends ib{constructor(){super(new Du(-5,5,5,-5,.5,500)),this.isDirectionalLightShadow=!0}},QA=class extends Ih{constructor(e,t){super(e,t),this.isDirectionalLight=!0,this.type="DirectionalLight",this.position.copy(lr.DEFAULT_UP),this.updateMatrix(),this.target=new lr,this.shadow=new j8}dispose(){super.dispose(),this.shadow.dispose()}copy(e){return super.copy(e),this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}toJSON(e){let t=super.toJSON(e);return t.object.shadow=this.shadow.toJSON(),t.object.target=this.target.uuid,t}},JA=class extends Ih{constructor(e,t){super(e,t),this.isAmbientLight=!0,this.type="AmbientLight"}},sb=class extends Ih{constructor(e,t,n=10,r=10){super(e,t),this.isRectAreaLight=!0,this.type="RectAreaLight",this.width=n,this.height=r}get power(){return this.intensity*this.width*this.height*Math.PI}set power(e){this.intensity=e/(this.width*this.height*Math.PI)}copy(e){return super.copy(e),this.width=e.width,this.height=e.height,this}toJSON(e){let t=super.toJSON(e);return t.object.width=this.width,t.object.height=this.height,t}},CM=class{constructor(){this.isSphericalHarmonics3=!0,this.coefficients=[];for(let e=0;e<9;e++)this.coefficients.push(new re)}set(e){for(let t=0;t<9;t++)this.coefficients[t].copy(e[t]);return this}zero(){for(let e=0;e<9;e++)this.coefficients[e].set(0,0,0);return this}getAt(e,t){let n=e.x,r=e.y,s=e.z,o=this.coefficients;return t.copy(o[0]).multiplyScalar(.282095),t.addScaledVector(o[1],.488603*r),t.addScaledVector(o[2],.488603*s),t.addScaledVector(o[3],.488603*n),t.addScaledVector(o[4],1.092548*(n*r)),t.addScaledVector(o[5],1.092548*(r*s)),t.addScaledVector(o[6],.315392*(3*s*s-1)),t.addScaledVector(o[7],1.092548*(n*s)),t.addScaledVector(o[8],.546274*(n*n-r*r)),t}getIrradianceAt(e,t){let n=e.x,r=e.y,s=e.z,o=this.coefficients;return t.copy(o[0]).multiplyScalar(.886227),t.addScaledVector(o[1],2*.511664*r),t.addScaledVector(o[2],2*.511664*s),t.addScaledVector(o[3],2*.511664*n),t.addScaledVector(o[4],2*.429043*n*r),t.addScaledVector(o[5],2*.429043*r*s),t.addScaledVector(o[6],.743125*s*s-.247708),t.addScaledVector(o[7],2*.429043*n*s),t.addScaledVector(o[8],.429043*(n*n-r*r)),t}add(e){for(let t=0;t<9;t++)this.coefficients[t].add(e.coefficients[t]);return this}addScaledSH(e,t){for(let n=0;n<9;n++)this.coefficients[n].addScaledVector(e.coefficients[n],t);return this}scale(e){for(let t=0;t<9;t++)this.coefficients[t].multiplyScalar(e);return this}lerp(e,t){for(let n=0;n<9;n++)this.coefficients[n].lerp(e.coefficients[n],t);return this}equals(e){for(let t=0;t<9;t++)if(!this.coefficients[t].equals(e.coefficients[t]))return!1;return!0}copy(e){return this.set(e.coefficients)}clone(){return new this.constructor().copy(this)}fromArray(e,t=0){let n=this.coefficients;for(let r=0;r<9;r++)n[r].fromArray(e,t+r*3);return this}toArray(e=[],t=0){let n=this.coefficients;for(let r=0;r<9;r++)n[r].toArray(e,t+r*3);return e}static getBasisAt(e,t){let n=e.x,r=e.y,s=e.z;t[0]=.282095,t[1]=.488603*r,t[2]=.488603*s,t[3]=.488603*n,t[4]=1.092548*n*r,t[5]=1.092548*r*s,t[6]=.315392*(3*s*s-1),t[7]=1.092548*n*s,t[8]=.546274*(n*n-r*r)}},ob=class extends Ih{constructor(e=new CM,t=1){super(void 0,t),this.isLightProbe=!0,this.sh=e}copy(e){return super.copy(e),this.sh.copy(e.sh),this}toJSON(e){let t=super.toJSON(e);return t.object.sh=this.sh.toArray(),t}};var ab=class extends Xn{constructor(){super(),this.isInstancedBufferGeometry=!0,this.type="InstancedBufferGeometry",this.instanceCount=1/0}copy(e){return super.copy(e),this.instanceCount=e.instanceCount,this}toJSON(){let e=super.toJSON();return e.instanceCount=this.instanceCount,e.isInstancedBufferGeometry=!0,e}};var qv=-90,Hv=1,o_=class extends lr{constructor(e,t,n){super(),this.type="CubeCamera",this.renderTarget=n,this.coordinateSystem=null,this.activeMipmapLevel=0;let r=new Yr(qv,Hv,e,t);r.layers=this.layers,this.add(r);let s=new Yr(qv,Hv,e,t);s.layers=this.layers,this.add(s);let o=new Yr(qv,Hv,e,t);o.layers=this.layers,this.add(o);let a=new Yr(qv,Hv,e,t);a.layers=this.layers,this.add(a);let l=new Yr(qv,Hv,e,t);l.layers=this.layers,this.add(l);let c=new Yr(qv,Hv,e,t);c.layers=this.layers,this.add(c)}updateCoordinateSystem(){let e=this.coordinateSystem,t=this.children.concat(),[n,r,s,o,a,l]=t;for(let c of t)this.remove(c);if(e===ko)n.up.set(0,1,0),n.lookAt(1,0,0),r.up.set(0,1,0),r.lookAt(-1,0,0),s.up.set(0,0,-1),s.lookAt(0,1,0),o.up.set(0,0,1),o.lookAt(0,-1,0),a.up.set(0,1,0),a.lookAt(0,0,1),l.up.set(0,1,0),l.lookAt(0,0,-1);else if(e===xl)n.up.set(0,-1,0),n.lookAt(-1,0,0),r.up.set(0,-1,0),r.lookAt(1,0,0),s.up.set(0,0,1),s.lookAt(0,1,0),o.up.set(0,0,-1),o.lookAt(0,-1,0),a.up.set(0,-1,0),a.lookAt(0,0,1),l.up.set(0,-1,0),l.lookAt(0,0,-1);else throw new Error("THREE.CubeCamera.updateCoordinateSystem(): Invalid coordinate system: "+e);for(let c of t)this.add(c),c.updateMatrixWorld()}update(e,t){this.parent===null&&this.updateMatrixWorld();let{renderTarget:n,activeMipmapLevel:r}=this;this.coordinateSystem!==e.coordinateSystem&&(this.coordinateSystem=e.coordinateSystem,this.updateCoordinateSystem());let[s,o,a,l,c,u]=this.children,f=e.getRenderTarget(),d=e.getActiveCubeFace(),A=e.getActiveMipmapLevel(),y=e.xr.enabled;e.xr.enabled=!1;let w=n.texture.generateMipmaps;n.texture.generateMipmaps=!1;let S=!1;e.isWebGLRenderer===!0?S=e.state.buffers.depth.getReversed():S=e.reversedDepthBuffer,e.setRenderTarget(n,0,r),S&&e.autoClear===!1&&e.clearDepth(),e.render(t,s),e.setRenderTarget(n,1,r),S&&e.autoClear===!1&&e.clearDepth(),e.render(t,o),e.setRenderTarget(n,2,r),S&&e.autoClear===!1&&e.clearDepth(),e.render(t,a),e.setRenderTarget(n,3,r),S&&e.autoClear===!1&&e.clearDepth(),e.render(t,l),e.setRenderTarget(n,4,r),S&&e.autoClear===!1&&e.clearDepth(),e.render(t,c),n.texture.generateMipmaps=w,e.setRenderTarget(n,5,r),S&&e.autoClear===!1&&e.clearDepth(),e.render(t,u),e.setRenderTarget(f,d,A),e.xr.enabled=y,n.texture.needsPMREMUpdate=!0}},a_=class extends Yr{constructor(e=[]){super(),this.isArrayCamera=!0,this.isMultiViewCamera=!1,this.cameras=e}},eg=class{constructor(){this._previousTime=0,this._currentTime=0,this._startTime=performance.now(),this._delta=0,this._elapsed=0,this._timescale=1,this._document=null,this._pageVisibilityHandler=null}connect(e){this._document=e,e.hidden!==void 0&&(this._pageVisibilityHandler=ZAe.bind(this),e.addEventListener("visibilitychange",this._pageVisibilityHandler,!1))}disconnect(){this._pageVisibilityHandler!==null&&(this._document.removeEventListener("visibilitychange",this._pageVisibilityHandler),this._pageVisibilityHandler=null),this._document=null}getDelta(){return this._delta/1e3}getElapsed(){return this._elapsed/1e3}getTimescale(){return this._timescale}setTimescale(e){return this._timescale=e,this}reset(){return this._currentTime=performance.now()-this._startTime,this}dispose(){this.disconnect()}update(e){return this._pageVisibilityHandler!==null&&this._document.hidden===!0?this._delta=0:(this._previousTime=this._currentTime,this._currentTime=(e!==void 0?e:performance.now())-this._startTime,this._delta=(this._currentTime-this._previousTime)*this._timescale,this._elapsed+=this._delta),this}};function ZAe(){this._document.hidden===!1&&this.reset()}var xF="\\[\\]\\.:\\/",KAe=new RegExp("["+xF+"]","g"),yF="[^"+xF+"]",QAe="[^"+xF.replace("\\.","")+"]",JAe=/((?:WC+[\/:])*)/.source.replace("WC",yF),ege=/(WCOD+)?/.source.replace("WCOD",QAe),tge=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",yF),nge=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",yF),ige=new RegExp("^"+JAe+ege+tge+nge+"$"),rge=["material","materials","bones","map"],X8=class{constructor(e,t,n){let r=n||Tr.parseTrackName(t);this._targetGroup=e,this._bindings=e.subscribe_(t,r)}getValue(e,t){this.bind();let n=this._targetGroup.nCachedObjects_,r=this._bindings[n];r!==void 0&&r.getValue(e,t)}setValue(e,t){let n=this._bindings;for(let r=this._targetGroup.nCachedObjects_,s=n.length;r!==s;++r)n[r].setValue(e,t)}bind(){let e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,n=e.length;t!==n;++t)e[t].bind()}unbind(){let e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,n=e.length;t!==n;++t)e[t].unbind()}},Tr=class i{constructor(e,t,n){this.path=t,this.parsedPath=n||i.parseTrackName(t),this.node=i.findNode(e,this.parsedPath.nodeName),this.rootNode=e,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(e,t,n){return e&&e.isAnimationObjectGroup?new i.Composite(e,t,n):new i(e,t,n)}static sanitizeNodeName(e){return e.replace(/\s/g,"_").replace(KAe,"")}static parseTrackName(e){let t=ige.exec(e);if(t===null)throw new Error("THREE.PropertyBinding: Cannot parse trackName: "+e);let n={nodeName:t[2],objectName:t[3],objectIndex:t[4],propertyName:t[5],propertyIndex:t[6]},r=n.nodeName&&n.nodeName.lastIndexOf(".");if(r!==void 0&&r!==-1){let s=n.nodeName.substring(r+1);rge.indexOf(s)!==-1&&(n.nodeName=n.nodeName.substring(0,r),n.objectName=s)}if(n.propertyName===null||n.propertyName.length===0)throw new Error("THREE.PropertyBinding: can not parse propertyName from trackName: "+e);return n}static findNode(e,t){if(t===void 0||t===""||t==="."||t===-1||t===e.name||t===e.uuid)return e;if(e.skeleton){let n=e.skeleton.getBoneByName(t);if(n!==void 0)return n}if(e.children){let n=function(s){for(let o=0;o<s.length;o++){let a=s[o];if(a.name===t||a.uuid===t)return a;let l=n(a.children);if(l)return l}return null},r=n(e.children);if(r)return r}return null}_getValue_unavailable(){}_setValue_unavailable(){}_getValue_direct(e,t){e[t]=this.targetObject[this.propertyName]}_getValue_array(e,t){let n=this.resolvedProperty;for(let r=0,s=n.length;r!==s;++r)e[t++]=n[r]}_getValue_arrayElement(e,t){e[t]=this.resolvedProperty[this.propertyIndex]}_getValue_toArray(e,t){this.resolvedProperty.toArray(e,t)}_setValue_direct(e,t){this.targetObject[this.propertyName]=e[t]}_setValue_direct_setNeedsUpdate(e,t){this.targetObject[this.propertyName]=e[t],this.targetObject.needsUpdate=!0}_setValue_direct_setMatrixWorldNeedsUpdate(e,t){this.targetObject[this.propertyName]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_array(e,t){let n=this.resolvedProperty;for(let r=0,s=n.length;r!==s;++r)n[r]=e[t++]}_setValue_array_setNeedsUpdate(e,t){let n=this.resolvedProperty;for(let r=0,s=n.length;r!==s;++r)n[r]=e[t++];this.targetObject.needsUpdate=!0}_setValue_array_setMatrixWorldNeedsUpdate(e,t){let n=this.resolvedProperty;for(let r=0,s=n.length;r!==s;++r)n[r]=e[t++];this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_arrayElement(e,t){this.resolvedProperty[this.propertyIndex]=e[t]}_setValue_arrayElement_setNeedsUpdate(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.needsUpdate=!0}_setValue_arrayElement_setMatrixWorldNeedsUpdate(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_fromArray(e,t){this.resolvedProperty.fromArray(e,t)}_setValue_fromArray_setNeedsUpdate(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.needsUpdate=!0}_setValue_fromArray_setMatrixWorldNeedsUpdate(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.matrixWorldNeedsUpdate=!0}_getValue_unbound(e,t){this.bind(),this.getValue(e,t)}_setValue_unbound(e,t){this.bind(),this.setValue(e,t)}bind(){let e=this.node,t=this.parsedPath,n=t.objectName,r=t.propertyName,s=t.propertyIndex;if(e||(e=i.findNode(this.rootNode,t.nodeName),this.node=e),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,!e){Xe("PropertyBinding: No target node found for track: "+this.path+".");return}if(n){let c=t.objectIndex;switch(n){case"materials":if(!e.material){ze("PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!e.material.materials){ze("PropertyBinding: Can not bind to material.materials as node.material does not have a materials array.",this);return}e=e.material.materials;break;case"bones":if(!e.skeleton){ze("PropertyBinding: Can not bind to bones as node does not have a skeleton.",this);return}e=e.skeleton.bones;for(let u=0;u<e.length;u++)if(e[u].name===c){c=u;break}break;case"map":if("map"in e){e=e.map;break}if(!e.material){ze("PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!e.material.map){ze("PropertyBinding: Can not bind to material.map as node.material does not have a map.",this);return}e=e.material.map;break;default:if(e[n]===void 0){ze("PropertyBinding: Can not bind to objectName of node undefined.",this);return}e=e[n]}if(c!==void 0){if(e[c]===void 0){ze("PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.",this,e);return}e=e[c]}}let o=e[r];if(o===void 0){let c=t.nodeName;ze("PropertyBinding: Trying to update property for track: "+c+"."+r+" but it wasn't found.",e);return}let a=this.Versioning.None;this.targetObject=e,e.isMaterial===!0?a=this.Versioning.NeedsUpdate:e.isObject3D===!0&&(a=this.Versioning.MatrixWorldNeedsUpdate);let l=this.BindingType.Direct;if(s!==void 0){if(r==="morphTargetInfluences"){if(!e.geometry){ze("PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.",this);return}if(!e.geometry.morphAttributes){ze("PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphAttributes.",this);return}e.morphTargetDictionary[s]!==void 0&&(s=e.morphTargetDictionary[s])}l=this.BindingType.ArrayElement,this.resolvedProperty=o,this.propertyIndex=s}else o.fromArray!==void 0&&o.toArray!==void 0?(l=this.BindingType.HasFromToArray,this.resolvedProperty=o):Array.isArray(o)?(l=this.BindingType.EntireArray,this.resolvedProperty=o):this.propertyName=r;this.getValue=this.GetterByBindingType[l],this.setValue=this.SetterByBindingTypeAndVersioning[l][a]}unbind(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}};Tr.Composite=X8;Tr.prototype.BindingType={Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3};Tr.prototype.Versioning={None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2};Tr.prototype.GetterByBindingType=[Tr.prototype._getValue_direct,Tr.prototype._getValue_array,Tr.prototype._getValue_arrayElement,Tr.prototype._getValue_toArray];Tr.prototype.SetterByBindingTypeAndVersioning=[[Tr.prototype._setValue_direct,Tr.prototype._setValue_direct_setNeedsUpdate,Tr.prototype._setValue_direct_setMatrixWorldNeedsUpdate],[Tr.prototype._setValue_array,Tr.prototype._setValue_array_setNeedsUpdate,Tr.prototype._setValue_array_setMatrixWorldNeedsUpdate],[Tr.prototype._setValue_arrayElement,Tr.prototype._setValue_arrayElement_setNeedsUpdate,Tr.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate],[Tr.prototype._setValue_fromArray,Tr.prototype._setValue_fromArray_setNeedsUpdate,Tr.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate]];var DZe=new Float32Array(1);var Lh=class extends Rd{constructor(e,t,n=1){super(e,t),this.isInstancedInterleavedBuffer=!0,this.meshPerAttribute=n}copy(e){return super.copy(e),this.meshPerAttribute=e.meshPerAttribute,this}clone(e){let t=super.clone(e);return t.meshPerAttribute=this.meshPerAttribute,t}toJSON(e){let t=super.toJSON(e);return t.isInstancedInterleavedBuffer=!0,t.meshPerAttribute=this.meshPerAttribute,t}};var vZ=new cn,lb=class{constructor(e,t,n=0,r=1/0){this.ray=new Pd(e,t),this.near=n,this.far=r,this.camera=null,this.layers=new Kv,this.params={Mesh:{},Line:{threshold:1},LOD:{},Points:{threshold:1},Sprite:{}}}set(e,t){this.ray.set(e,t)}setFromCamera(e,t){t.isPerspectiveCamera?(this.ray.origin.setFromMatrixPosition(t.matrixWorld),this.ray.direction.set(e.x,e.y,.5).unproject(t).sub(this.ray.origin).normalize(),this.camera=t):t.isOrthographicCamera?(this.ray.origin.set(e.x,e.y,t.projectionMatrix.elements[14]).unproject(t),this.ray.direction.set(0,0,-1).transformDirection(t.matrixWorld),this.camera=t):ze("Raycaster: Unsupported camera type: "+t.type)}setFromXRController(e){return vZ.identity().extractRotation(e.matrixWorld),this.ray.origin.setFromMatrixPosition(e.matrixWorld),this.ray.direction.set(0,0,-1).applyMatrix4(vZ),this}intersectObject(e,t=!0,n=[]){return $8(e,this,n,t),n.sort(_Z),n}intersectObjects(e,t=!0,n=[]){for(let r=0,s=e.length;r<s;r++)$8(e[r],this,n,t);return n.sort(_Z),n}};function _Z(i,e){return i.distance-e.distance}function $8(i,e,t,n){let r=!0;if(i.layers.test(e.layers)&&i.raycast(e,t)===!1&&(r=!1),r===!0&&n===!0){let s=i.children;for(let o=0,a=s.length;o<a;o++)$8(s[o],e,t,!0)}}var l_=class{constructor(e=1,t=0,n=0){this.radius=e,this.phi=t,this.theta=n}set(e,t,n){return this.radius=e,this.phi=t,this.theta=n,this}copy(e){return this.radius=e.radius,this.phi=e.phi,this.theta=e.theta,this}makeSafe(){return this.phi=Nn(this.phi,1e-6,Math.PI-1e-6),this}setFromVector3(e){return this.setFromCartesianCoords(e.x,e.y,e.z)}setFromCartesianCoords(e,t,n){return this.radius=Math.sqrt(e*e+t*t+n*n),this.radius===0?(this.theta=0,this.phi=0):(this.theta=Math.atan2(e,n),this.phi=Math.acos(Nn(t/this.radius,-1,1))),this}clone(){return new this.constructor().copy(this)}};var EF=class EF{constructor(e,t,n,r){this.elements=[1,0,0,1],e!==void 0&&this.set(e,t,n,r)}identity(){return this.set(1,0,0,1),this}fromArray(e,t=0){for(let n=0;n<4;n++)this.elements[n]=e[n+t];return this}set(e,t,n,r){let s=this.elements;return s[0]=e,s[2]=t,s[1]=n,s[3]=r,this}};EF.prototype.isMatrix2=!0;var c_=EF,xZ=new Oe,RM=class{constructor(e=new Oe(1/0,1/0),t=new Oe(-1/0,-1/0)){this.isBox2=!0,this.min=e,this.max=t}set(e,t){return this.min.copy(e),this.max.copy(t),this}setFromPoints(e){this.makeEmpty();for(let t=0,n=e.length;t<n;t++)this.expandByPoint(e[t]);return this}setFromCenterAndSize(e,t){let n=xZ.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(n),this.max.copy(e).add(n),this}clone(){return new this.constructor().copy(this)}copy(e){return this.min.copy(e.min),this.max.copy(e.max),this}makeEmpty(){return this.min.x=this.min.y=1/0,this.max.x=this.max.y=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y}getCenter(e){return this.isEmpty()?e.set(0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(e){return this.isEmpty()?e.set(0,0):e.subVectors(this.max,this.min)}expandByPoint(e){return this.min.min(e),this.max.max(e),this}expandByVector(e){return this.min.sub(e),this.max.add(e),this}expandByScalar(e){return this.min.addScalar(-e),this.max.addScalar(e),this}containsPoint(e){return e.x>=this.min.x&&e.x<=this.max.x&&e.y>=this.min.y&&e.y<=this.max.y}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y}getParameter(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y))}intersectsBox(e){return e.max.x>=this.min.x&&e.min.x<=this.max.x&&e.max.y>=this.min.y&&e.min.y<=this.max.y}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,xZ).distanceTo(e)}intersect(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this}union(e){return this.min.min(e.min),this.max.max(e.max),this}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}},yZ=new re,nM=new re,Wv=new re,jv=new re,F8=new re,sge=new re,oge=new re,cb=class{constructor(e=new re,t=new re){this.start=e,this.end=t}set(e,t){return this.start.copy(e),this.end.copy(t),this}copy(e){return this.start.copy(e.start),this.end.copy(e.end),this}getCenter(e){return e.addVectors(this.start,this.end).multiplyScalar(.5)}delta(e){return e.subVectors(this.end,this.start)}distanceSq(){return this.start.distanceToSquared(this.end)}distance(){return this.start.distanceTo(this.end)}at(e,t){return this.delta(t).multiplyScalar(e).add(this.start)}closestPointToPointParameter(e,t){yZ.subVectors(e,this.start),nM.subVectors(this.end,this.start);let n=nM.dot(nM);if(n===0)return 0;let s=nM.dot(yZ)/n;return t&&(s=Nn(s,0,1)),s}closestPointToPoint(e,t,n){let r=this.closestPointToPointParameter(e,t);return this.delta(n).multiplyScalar(r).add(this.start)}distanceSqToLine3(e,t=sge,n=oge){let r=10000000000000001e-32,s,o,a=this.start,l=e.start,c=this.end,u=e.end;Wv.subVectors(c,a),jv.subVectors(u,l),F8.subVectors(a,l);let f=Wv.dot(Wv),d=jv.dot(jv),A=jv.dot(F8);if(f<=r&&d<=r)return t.copy(a),n.copy(l),t.sub(n),t.dot(t);if(f<=r)s=0,o=A/d,o=Nn(o,0,1);else{let y=Wv.dot(F8);if(d<=r)o=0,s=Nn(-y/f,0,1);else{let w=Wv.dot(jv),S=f*d-w*w;S!==0?s=Nn((w*A-y*d)/S,0,1):s=0,o=(w*s+A)/d,o<0?(o=0,s=Nn(-y/f,0,1)):o>1&&(o=1,s=Nn((w-y)/f,0,1))}}return t.copy(a).addScaledVector(Wv,s),n.copy(l).addScaledVector(jv,o),t.distanceToSquared(n)}applyMatrix4(e){return this.start.applyMatrix4(e),this.end.applyMatrix4(e),this}equals(e){return e.start.equals(this.start)&&e.end.equals(this.end)}clone(){return new this.constructor().copy(this)}};var ub=class{constructor(){this.type="ShapePath",this.color=new zt,this.subPaths=[],this.currentPath=null,this.userData={}}moveTo(e,t){return this.currentPath=new XA,this.subPaths.push(this.currentPath),this.currentPath.moveTo(e,t),this}lineTo(e,t){return this.currentPath.lineTo(e,t),this}quadraticCurveTo(e,t,n,r){return this.currentPath.quadraticCurveTo(e,t,n,r),this}bezierCurveTo(e,t,n,r,s,o){return this.currentPath.bezierCurveTo(e,t,n,r,s,o),this}splineThru(e){return this.currentPath.splineThru(e),this}toShapes(){function e(l,c){let u=!1,f=c.length;for(let d=0,A=f-1;d<f;A=d++){let y=c[d],w=c[A];y.y>l.y!=w.y>l.y&&l.x<(w.x-y.x)*(l.y-y.y)/(w.y-y.y)+y.x&&(u=!u)}return u}function t(l,c){let u=c.getCenter(new Oe);if(e(u,l))return u;let f=u.y,d=[],A=l.length;for(let y=0;y<A;y++){let w=l[y],S=l[(y+1)%A];if(w.y>f!=S.y>f){let T=w.x+(f-w.y)*(S.x-w.x)/(S.y-w.y);d.push(T)}}return d.length>1&&(d.sort((y,w)=>y-w),u.x=(d[0]+d[1])/2),u}let n=this.userData.style&&this.userData.style.fillRule||"nonzero";n!=="nonzero"&&n!=="evenodd"&&(Xe('Fill-rule "'+n+'" is not supported, falling back to "nonzero".'),n="nonzero");let r=n==="nonzero"?(l=>l!==0):(l=>(l&1)!==0),s=[];for(let l of this.subPaths){let c=l.getPoints();if(c.length<3)continue;let u=Qp.area(c);if(u===0)continue;let f=new RM;for(let d=0;d<c.length;d++)f.expandByPoint(c[d]);s.push({subPath:l,points:c,boundingBox:f,interiorPoint:t(c,f),absArea:Math.abs(u),winding:u<0?-1:1,container:null,exclude:!1,role:null})}s.sort((l,c)=>c.absArea-l.absArea);for(let l=0;l<s.length;l++){let c=s[l],u=0;for(let f=l-1;f>=0;f--){let d=s[f];if(d.boundingBox.containsBox(c.boundingBox)&&e(c.interiorPoint,d.points)){c.container=d.exclude?d.container:d,u=d.winding,c.winding+=u;break}}r(c.winding)===r(u)&&(c.exclude=!0)}for(let l of s)l.exclude||(l.role=l.container===null||l.container.role==="hole"?"outer":"hole");let o=[],a=new Map;for(let l of s){if(l.exclude||l.role!=="outer")continue;let c=new G2;c.curves=l.subPath.curves,o.push(c),a.set(l,c)}for(let l of s){if(l.exclude||l.role!=="hole")continue;let c=a.get(l.container);if(!c)continue;let u=new XA;u.curves=l.subPath.curves,c.holes.push(u)}return o}},Ld=class extends ca{constructor(e,t=null){super(),this.object=e,this.domElement=t,this.enabled=!0,this.state=-1,this.keys={},this.mouseButtons={LEFT:null,MIDDLE:null,RIGHT:null},this.touches={ONE:null,TWO:null}}connect(e){if(e===void 0){Xe("Controls: connect() now requires an element.");return}this.domElement!==null&&this.disconnect(),this.domElement=e}disconnect(){}dispose(){}update(){}};function Ub(i,e,t,n){let r=age(n);switch(t){case u_:return i*e;case Fd:return i*e/r.components*r.byteLength;case kh:return i*e/r.components*r.byteLength;case Ws:return i*e*2/r.components*r.byteLength;case zh:return i*e*2/r.components*r.byteLength;case Nd:return i*e*3/r.components*r.byteLength;case Or:return i*e*4/r.components*r.byteLength;case g0:return i*e*4/r.components*r.byteLength;case Vh:case Gh:return Math.floor((i+3)/4)*Math.floor((e+3)/4)*8;case qh:case Hh:return Math.floor((i+3)/4)*Math.floor((e+3)/4)*16;case ag:case cg:return Math.max(i,16)*Math.max(e,8)/4;case og:case lg:return Math.max(i,8)*Math.max(e,8)/2;case v0:case _0:case y0:case b0:return Math.floor((i+3)/4)*Math.floor((e+3)/4)*8;case x0:case Wh:case w0:return Math.floor((i+3)/4)*Math.floor((e+3)/4)*16;case S0:return Math.floor((i+3)/4)*Math.floor((e+3)/4)*16;case T0:return Math.floor((i+4)/5)*Math.floor((e+3)/4)*16;case E0:return Math.floor((i+4)/5)*Math.floor((e+4)/5)*16;case M0:return Math.floor((i+5)/6)*Math.floor((e+4)/5)*16;case C0:return Math.floor((i+5)/6)*Math.floor((e+5)/6)*16;case R0:return Math.floor((i+7)/8)*Math.floor((e+4)/5)*16;case P0:return Math.floor((i+7)/8)*Math.floor((e+5)/6)*16;case I0:return Math.floor((i+7)/8)*Math.floor((e+7)/8)*16;case L0:return Math.floor((i+9)/10)*Math.floor((e+4)/5)*16;case D0:return Math.floor((i+9)/10)*Math.floor((e+5)/6)*16;case N0:return Math.floor((i+9)/10)*Math.floor((e+7)/8)*16;case F0:return Math.floor((i+9)/10)*Math.floor((e+9)/10)*16;case B0:return Math.floor((i+11)/12)*Math.floor((e+9)/10)*16;case O0:return Math.floor((i+11)/12)*Math.floor((e+11)/12)*16;case U0:case k0:case z0:return Math.ceil(i/4)*Math.ceil(e/4)*16;case V0:case G0:return Math.ceil(i/4)*Math.ceil(e/4)*8;case jh:case q0:return Math.ceil(i/4)*Math.ceil(e/4)*16}throw new Error(`Unable to determine texture byte length for ${t} format.`)}function age(i){switch(i){case Ji:case Oh:return{byteLength:1,components:1};case wl:case Uh:case Wi:return{byteLength:2,components:1};case ng:case ig:return{byteLength:2,components:4};case xi:case Kr:case cr:return{byteLength:4,components:1};case rg:case sg:return{byteLength:4,components:3}}throw new Error(`THREE.TextureUtils: Unknown texture type ${i}.`)}typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:"185"}}));typeof window<"u"&&(window.__THREE__?Xe("WARNING: Multiple instances of Three.js being imported."):window.__THREE__="185");function sK(){let i=null,e=!1,t=null,n=null;function r(s,o){t(s,o),n=i.requestAnimationFrame(r)}return{start:function(){e!==!0&&t!==null&&i!==null&&(n=i.requestAnimationFrame(r),e=!0)},stop:function(){i!==null&&i.cancelAnimationFrame(n),e=!1},setAnimationLoop:function(s){t=s},setContext:function(s){i=s}}}function uge(i){let e=new WeakMap;function t(a,l){let c=a.array,u=a.usage,f=c.byteLength,d=i.createBuffer();i.bindBuffer(l,d),i.bufferData(l,c,u),a.onUploadCallback();let A;if(c instanceof Float32Array)A=i.FLOAT;else if(typeof Float16Array<"u"&&c instanceof Float16Array)A=i.HALF_FLOAT;else if(c instanceof Uint16Array)a.isFloat16BufferAttribute?A=i.HALF_FLOAT:A=i.UNSIGNED_SHORT;else if(c instanceof Int16Array)A=i.SHORT;else if(c instanceof Uint32Array)A=i.UNSIGNED_INT;else if(c instanceof Int32Array)A=i.INT;else if(c instanceof Int8Array)A=i.BYTE;else if(c instanceof Uint8Array)A=i.UNSIGNED_BYTE;else if(c instanceof Uint8ClampedArray)A=i.UNSIGNED_BYTE;else throw new Error("THREE.WebGLAttributes: Unsupported buffer data format: "+c);return{buffer:d,type:A,bytesPerElement:c.BYTES_PER_ELEMENT,version:a.version,size:f}}function n(a,l,c){let u=l.array,f=l.updateRanges;if(i.bindBuffer(c,a),f.length===0)i.bufferSubData(c,0,u);else{f.sort((A,y)=>A.start-y.start);let d=0;for(let A=1;A<f.length;A++){let y=f[d],w=f[A];w.start<=y.start+y.count+1?y.count=Math.max(y.count,w.start+w.count-y.start):(++d,f[d]=w)}f.length=d+1;for(let A=0,y=f.length;A<y;A++){let w=f[A];i.bufferSubData(c,w.start*u.BYTES_PER_ELEMENT,u,w.start,w.count)}l.clearUpdateRanges()}l.onUploadCallback()}function r(a){return a.isInterleavedBufferAttribute&&(a=a.data),e.get(a)}function s(a){a.isInterleavedBufferAttribute&&(a=a.data);let l=e.get(a);l&&(i.deleteBuffer(l.buffer),e.delete(a))}function o(a,l){if(a.isInterleavedBufferAttribute&&(a=a.data),a.isGLBufferAttribute){let u=e.get(a);(!u||u.version<a.version)&&e.set(a,{buffer:a.buffer,type:a.type,bytesPerElement:a.elementSize,version:a.version});return}let c=e.get(a);if(c===void 0)e.set(a,t(a,l));else if(c.version<a.version){if(c.size!==a.array.byteLength)throw new Error("THREE.WebGLAttributes: The size of the buffer attribute's array buffer does not match the original size. Resizing buffer attributes is not supported.");n(c.buffer,a,l),c.version=a.version}}return{get:r,remove:s,update:o}}var hge=`#ifdef USE_ALPHAHASH1515 if ( diffuseColor.a < getAlphaHashThreshold( vPosition ) ) discard;16-#endif`,PAe=`#ifdef USE_ALPHAHASH16+#endif`,fge=`#ifdef USE_ALPHAHASH1717 const float ALPHA_HASH_SCALE = 0.05;1818 float hash2D( vec2 value ) {1919 return fract( 1.0e4 * sin( 17.0 * value.x + 0.1 * value.y ) * ( 0.1 + abs( sin( 13.0 * value.y + value.x ) ) ) );@@ -48,20 +48,20 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
4848 : cases.z;4949 return clamp( threshold , 1.0e-6, 1.0 );5050 }51-#endif`,LAe=`#ifdef USE_ALPHAMAP51+#endif`,dge=`#ifdef USE_ALPHAMAP5252 diffuseColor.a *= texture2D( alphaMap, vAlphaMapUv ).g;53-#endif`,DAe=`#ifdef USE_ALPHAMAP53+#endif`,pge=`#ifdef USE_ALPHAMAP5454 uniform sampler2D alphaMap;55-#endif`,NAe=`#ifdef USE_ALPHATEST55+#endif`,mge=`#ifdef USE_ALPHATEST5656 #ifdef ALPHA_TO_COVERAGE5757 diffuseColor.a = smoothstep( alphaTest, alphaTest + fwidth( diffuseColor.a ), diffuseColor.a );5858 if ( diffuseColor.a == 0.0 ) discard;5959 #else6060 if ( diffuseColor.a < alphaTest ) discard;6161 #endif62-#endif`,FAe=`#ifdef USE_ALPHATEST62+#endif`,Age=`#ifdef USE_ALPHATEST6363 uniform float alphaTest;64-#endif`,BAe=`#ifdef USE_AOMAP64+#endif`,gge=`#ifdef USE_AOMAP6565 float ambientOcclusion = ( texture2D( aoMap, vAoMapUv ).r - 1.0 ) * aoMapIntensity + 1.0;6666 reflectedLight.indirectDiffuse *= ambientOcclusion;6767 #if defined( USE_CLEARCOAT ) @@ -74,10 +74,10 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
7474 float dotNV = saturate( dot( geometryNormal, geometryViewDir ) );7575 reflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.roughness );7676 #endif77-#endif`,OAe=`#ifdef USE_AOMAP77+#endif`,vge=`#ifdef USE_AOMAP7878 uniform sampler2D aoMap;7979 uniform float aoMapIntensity;80-#endif`,UAe=`#ifdef USE_BATCHING80+#endif`,_ge=`#ifdef USE_BATCHING8181 #if ! defined( GL_ANGLE_multi_draw )8282 #define gl_DrawID _gl_DrawID8383 uniform int _gl_DrawID;@@ -111,15 +111,15 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
111111 int y = j / size;112112 return texelFetch( batchingColorTexture, ivec2( x, y ), 0 );113113 }114-#endif`,kAe=`#ifdef USE_BATCHING114+#endif`,xge=`#ifdef USE_BATCHING115115 mat4 batchingMatrix = getBatchingMatrix( getIndirectIndex( gl_DrawID ) );116-#endif`,zAe=`vec3 transformed = vec3( position );116+#endif`,yge=`vec3 transformed = vec3( position );117117 #ifdef USE_ALPHAHASH118118 vPosition = vec3( position );119-#endif`,VAe=`vec3 objectNormal = vec3( normal );119+#endif`,bge=`vec3 objectNormal = vec3( normal );120120 #ifdef USE_TANGENT121121 vec3 objectTangent = vec3( tangent.xyz );122-#endif`,GAe=`float G_BlinnPhong_Implicit( ) {122+#endif`,wge=`float G_BlinnPhong_Implicit( ) {123123 return 0.25;124124 }125125 float D_BlinnPhong( const in float shininess, const in float dotNH ) {@@ -133,7 +133,7 @@ vec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in ve
133133 float G = G_BlinnPhong_Implicit( );134134 float D = D_BlinnPhong( shininess, dotNH );135135 return F * ( G * D );136-} // validated`,qAe=`#ifdef USE_IRIDESCENCE136+} // validated`,Sge=`#ifdef USE_IRIDESCENCE137137 const mat3 XYZ_TO_REC709 = mat3(138138 3.2404542, -0.9692660, 0.0556434,139139 -1.5371385, 1.8760108, -0.2040259,@@ -196,7 +196,7 @@ vec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in ve
196196 }197197 return max( I, vec3( 0.0 ) );198198 }199-#endif`,HAe=`#ifdef USE_BUMPMAP199+#endif`,Tge=`#ifdef USE_BUMPMAP200200 uniform sampler2D bumpMap;201201 uniform float bumpScale;202202 vec2 dHdxy_fwd() {@@ -217,7 +217,7 @@ vec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in ve
217217 vec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );218218 return normalize( abs( fDet ) * surf_norm - vGrad );219219 }220-#endif`,WAe=`#if NUM_CLIPPING_PLANES > 0220+#endif`,Ege=`#if NUM_CLIPPING_PLANES > 0221221 vec4 plane;222222 #ifdef ALPHA_TO_COVERAGE223223 float distanceToPlane, distanceGradient;@@ -263,20 +263,20 @@ vec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in ve
263263 if ( clipped ) discard;264264 #endif265265 #endif266-#endif`,jAe=`#if NUM_CLIPPING_PLANES > 0266+#endif`,Mge=`#if NUM_CLIPPING_PLANES > 0267267 varying vec3 vClipPosition;268268 uniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];269-#endif`,XAe=`#if NUM_CLIPPING_PLANES > 0269+#endif`,Cge=`#if NUM_CLIPPING_PLANES > 0270270 varying vec3 vClipPosition;271-#endif`,$Ae=`#if NUM_CLIPPING_PLANES > 0271+#endif`,Rge=`#if NUM_CLIPPING_PLANES > 0272272 vClipPosition = - mvPosition.xyz;273-#endif`,YAe=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA )273+#endif`,Pge=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA )274274 diffuseColor *= vColor;275-#endif`,ZAe=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA )275+#endif`,Ige=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA )276276 varying vec4 vColor;277-#endif`,KAe=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )277+#endif`,Lge=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )278278 varying vec4 vColor;279-#endif`,QAe=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )279+#endif`,Dge=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )280280 vColor = vec4( 1.0 );281281 #endif282282 #ifdef USE_COLOR_ALPHA@@ -289,7 +289,7 @@ vec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in ve
289289 #endif290290 #ifdef USE_BATCHING_COLOR291291 vColor *= getBatchingColor( getIndirectIndex( gl_DrawID ) );292-#endif`,JAe=`#define PI 3.141592653589793292+#endif`,Nge=`#define PI 3.141592653589793293293 #define PI2 6.283185307179586294294 #define PI_HALF 1.5707963267948966295295 #define RECIPROCAL_PI 0.3183098861837907@@ -360,7 +360,7 @@ vec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) {
360360 float F_Schlick( const in float f0, const in float f90, const in float dotVH ) {361361 float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );362362 return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );363-} // validated`,ege=`#ifdef ENVMAP_TYPE_CUBE_UV363+} // validated`,Fge=`#ifdef ENVMAP_TYPE_CUBE_UV364364 #define cubeUV_minMipLevel 4.0365365 #define cubeUV_minTileSize 16.0366366 float getFace( vec3 direction ) {@@ -453,7 +453,7 @@ float F_Schlick( const in float f0, const in float f90, const in float dotVH ) {
453453 return vec4( mix( color0, color1, mipF ), 1.0 );454454 }455455 }456-#endif`,tge=`vec3 transformedNormal = objectNormal;456+#endif`,Bge=`vec3 transformedNormal = objectNormal;457457 #ifdef USE_TANGENT458458 vec3 transformedTangent = objectTangent;459459 #endif@@ -479,21 +479,21 @@ transformedNormal = normalMatrix * transformedNormal;
479479 #endif480480 #ifdef USE_TANGENT481481 transformedTangent = ( modelViewMatrix * vec4( transformedTangent, 0.0 ) ).xyz;482-#endif`,nge=`#ifdef USE_DISPLACEMENTMAP482+#endif`,Oge=`#ifdef USE_DISPLACEMENTMAP483483 uniform sampler2D displacementMap;484484 uniform float displacementScale;485485 uniform float displacementBias;486-#endif`,ige=`#ifdef USE_DISPLACEMENTMAP486+#endif`,Uge=`#ifdef USE_DISPLACEMENTMAP487487 transformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + displacementBias );488-#endif`,rge=`#ifdef USE_EMISSIVEMAP488+#endif`,kge=`#ifdef USE_EMISSIVEMAP489489 vec4 emissiveColor = texture2D( emissiveMap, vEmissiveMapUv );490490 #ifdef DECODE_VIDEO_TEXTURE_EMISSIVE491491 emissiveColor = sRGBTransferEOTF( emissiveColor );492492 #endif493493 totalEmissiveRadiance *= emissiveColor.rgb;494-#endif`,sge=`#ifdef USE_EMISSIVEMAP494+#endif`,zge=`#ifdef USE_EMISSIVEMAP495495 uniform sampler2D emissiveMap;496-#endif`,oge="gl_FragColor = linearToOutputTexel( gl_FragColor );",age=`vec4 LinearTransferOETF( in vec4 value ) {496+#endif`,Vge="gl_FragColor = linearToOutputTexel( gl_FragColor );",Gge=`vec4 LinearTransferOETF( in vec4 value ) {497497 return value;498498 }499499 vec4 sRGBTransferEOTF( in vec4 value ) {@@ -501,7 +501,7 @@ vec4 sRGBTransferEOTF( in vec4 value ) {
501501 }502502 vec4 sRGBTransferOETF( in vec4 value ) {503503 return vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.a );504-}`,lge=`#ifdef USE_ENVMAP504+}`,qge=`#ifdef USE_ENVMAP505505 #ifdef ENV_WORLDPOS506506 vec3 cameraToFrag;507507 if ( isOrthographic ) {@@ -528,7 +528,7 @@ vec4 sRGBTransferOETF( in vec4 value ) {
528528 outgoingLight += envColor.xyz * specularStrength * reflectivity;529529 #endif530530 #endif531-#endif`,cge=`#ifdef USE_ENVMAP531+#endif`,Hge=`#ifdef USE_ENVMAP532532 uniform float envMapIntensity;533533 uniform mat3 envMapRotation;534534 #ifdef ENVMAP_TYPE_CUBE@@ -536,7 +536,7 @@ vec4 sRGBTransferOETF( in vec4 value ) {
536536 #else537537 uniform sampler2D envMap;538538 #endif539-#endif`,uge=`#ifdef USE_ENVMAP539+#endif`,Wge=`#ifdef USE_ENVMAP540540 uniform float reflectivity;541541 #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )542542 #define ENV_WORLDPOS@@ -547,7 +547,7 @@ vec4 sRGBTransferOETF( in vec4 value ) {
547547 #else548548 varying vec3 vReflect;549549 #endif550-#endif`,hge=`#ifdef USE_ENVMAP550+#endif`,jge=`#ifdef USE_ENVMAP551551 #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )552552 #define ENV_WORLDPOS553553 #endif@@ -558,7 +558,7 @@ vec4 sRGBTransferOETF( in vec4 value ) {
558558 varying vec3 vReflect;559559 uniform float refractionRatio;560560 #endif561-#endif`,fge=`#ifdef USE_ENVMAP561+#endif`,Xge=`#ifdef USE_ENVMAP562562 #ifdef ENV_WORLDPOS563563 vWorldPosition = worldPosition.xyz;564564 #else@@ -575,18 +575,18 @@ vec4 sRGBTransferOETF( in vec4 value ) {
575575 vReflect = refract( cameraToVertex, worldNormal, refractionRatio );576576 #endif577577 #endif578-#endif`,dge=`#ifdef USE_FOG578+#endif`,$ge=`#ifdef USE_FOG579579 vFogDepth = - mvPosition.z;580-#endif`,pge=`#ifdef USE_FOG580+#endif`,Yge=`#ifdef USE_FOG581581 varying float vFogDepth;582-#endif`,mge=`#ifdef USE_FOG582+#endif`,Zge=`#ifdef USE_FOG583583 #ifdef FOG_EXP2584584 float fogFactor = 1.0 - exp( - fogDensity * fogDensity * vFogDepth * vFogDepth );585585 #else586586 float fogFactor = smoothstep( fogNear, fogFar, vFogDepth );587587 #endif588588 gl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );589-#endif`,Age=`#ifdef USE_FOG589+#endif`,Kge=`#ifdef USE_FOG590590 uniform vec3 fogColor;591591 varying float vFogDepth;592592 #ifdef FOG_EXP2@@ -595,7 +595,7 @@ vec4 sRGBTransferOETF( in vec4 value ) {
595595 uniform float fogNear;596596 uniform float fogFar;597597 #endif598-#endif`,gge=`#ifdef USE_GRADIENTMAP598+#endif`,Qge=`#ifdef USE_GRADIENTMAP599599 uniform sampler2D gradientMap;600600 #endif601601 vec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {@@ -607,12 +607,12 @@ vec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {
607607 vec2 fw = fwidth( coord ) * 0.5;608608 return mix( vec3( 0.7 ), vec3( 1.0 ), smoothstep( 0.7 - fw.x, 0.7 + fw.x, coord.x ) );609609 #endif610-}`,vge=`#ifdef USE_LIGHTMAP610+}`,Jge=`#ifdef USE_LIGHTMAP611611 uniform sampler2D lightMap;612612 uniform float lightMapIntensity;613-#endif`,_ge=`LambertMaterial material;613+#endif`,e1e=`LambertMaterial material;614614 material.diffuseColor = diffuseColor.rgb;615-material.specularStrength = specularStrength;`,xge=`varying vec3 vViewPosition;615+material.specularStrength = specularStrength;`,t1e=`varying vec3 vViewPosition;616616 struct LambertMaterial {617617 vec3 diffuseColor;618618 float specularStrength;@@ -626,7 +626,7 @@ void RE_IndirectDiffuse_Lambert( const in vec3 irradiance, const in vec3 geometr
626626 reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );627627 }628628 #define RE_Direct RE_Direct_Lambert629-#define RE_IndirectDiffuse RE_IndirectDiffuse_Lambert`,yge=`uniform bool receiveShadow;629+#define RE_IndirectDiffuse RE_IndirectDiffuse_Lambert`,n1e=`uniform bool receiveShadow;630630 uniform vec3 ambientLightColor;631631 #if defined( USE_LIGHT_PROBES )632632 uniform vec3 lightProbe[ 9 ];@@ -743,7 +743,7 @@ float getSpotAttenuation( const in float coneCosine, const in float penumbraCosi
743743 return irradiance;744744 }745745 #endif746-#include <lightprobes_pars_fragment>`,bge=`#ifdef USE_ENVMAP746+#include <lightprobes_pars_fragment>`,i1e=`#ifdef USE_ENVMAP747747 vec3 getIBLIrradiance( const in vec3 normal ) {748748 #ifdef ENVMAP_TYPE_CUBE_UV749749 vec3 worldNormal = transformNormalByInverseViewMatrix( normal, viewMatrix );@@ -776,8 +776,8 @@ float getSpotAttenuation( const in float coneCosine, const in float penumbraCosi
776776 #endif777777 }778778 #endif779-#endif`,wge=`ToonMaterial material;780-material.diffuseColor = diffuseColor.rgb;`,Sge=`varying vec3 vViewPosition;779+#endif`,r1e=`ToonMaterial material;780+material.diffuseColor = diffuseColor.rgb;`,s1e=`varying vec3 vViewPosition;781781 struct ToonMaterial {782782 vec3 diffuseColor;783783 };@@ -789,11 +789,11 @@ void RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in vec3 geometryPo
789789 reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );790790 }791791 #define RE_Direct RE_Direct_Toon792-#define RE_IndirectDiffuse RE_IndirectDiffuse_Toon`,Tge=`BlinnPhongMaterial material;792+#define RE_IndirectDiffuse RE_IndirectDiffuse_Toon`,o1e=`BlinnPhongMaterial material;793793 material.diffuseColor = diffuseColor.rgb;794794 material.specularColor = specular;795795 material.specularShininess = shininess;796-material.specularStrength = specularStrength;`,Ege=`varying vec3 vViewPosition;796+material.specularStrength = specularStrength;`,a1e=`varying vec3 vViewPosition;797797 struct BlinnPhongMaterial {798798 vec3 diffuseColor;799799 vec3 specularColor;@@ -810,7 +810,7 @@ void RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in vec3 geom
810810 reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );811811 }812812 #define RE_Direct RE_Direct_BlinnPhong813-#define RE_IndirectDiffuse RE_IndirectDiffuse_BlinnPhong`,Mge=`PhysicalMaterial material;813+#define RE_IndirectDiffuse RE_IndirectDiffuse_BlinnPhong`,l1e=`PhysicalMaterial material;814814 material.diffuseColor = diffuseColor.rgb;815815 material.diffuseContribution = diffuseColor.rgb * ( 1.0 - metalnessFactor );816816 material.metalness = metalnessFactor;@@ -900,7 +900,7 @@ material.roughness = min( material.roughness, 1.0 );
900900 material.alphaT = mix( pow2( material.roughness ), 1.0, pow2( material.anisotropy ) );901901 material.anisotropyT = tbn[ 0 ] * anisotropyV.x + tbn[ 1 ] * anisotropyV.y;902902 material.anisotropyB = tbn[ 1 ] * anisotropyV.x - tbn[ 0 ] * anisotropyV.y;903-#endif`,Cge=`uniform sampler2D dfgLUT;903+#endif`,c1e=`uniform sampler2D dfgLUT;904904 struct PhysicalMaterial {905905 vec3 diffuseColor;906906 vec3 diffuseContribution;@@ -1260,7 +1260,7 @@ void RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradia
12601260 #define RE_IndirectSpecular RE_IndirectSpecular_Physical12611261 float computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {12621262 return saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );1263-}`,Rge=`1263+}`,u1e=`12641264 vec3 geometryPosition = - vViewPosition;12651265 vec3 geometryNormal = normal;12661266 vec3 geometryViewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );@@ -1382,7 +1382,7 @@ IncidentLight directLight;
13821382 #if defined( RE_IndirectSpecular )13831383 vec3 radiance = vec3( 0.0 );13841384 vec3 clearcoatRadiance = vec3( 0.0 );1385-#endif`,Ige=`#if defined( RE_IndirectDiffuse )1385+#endif`,h1e=`#if defined( RE_IndirectDiffuse )13861386 #ifdef USE_LIGHTMAP13871387 vec4 lightMapTexel = texture2D( lightMap, vLightMapUv );13881388 vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;@@ -1403,7 +1403,7 @@ IncidentLight directLight;
14031403 #ifdef USE_CLEARCOAT14041404 clearcoatRadiance += getIBLRadiance( geometryViewDir, geometryClearcoatNormal, material.clearcoatRoughness );14051405 #endif1406-#endif`,Pge=`#if defined( RE_IndirectDiffuse )1406+#endif`,f1e=`#if defined( RE_IndirectDiffuse )14071407 #if defined( LAMBERT ) || defined( PHONG )14081408 irradiance += iblIrradiance;14091409 #endif@@ -1411,7 +1411,7 @@ IncidentLight directLight;
14111411 #endif14121412 #if defined( RE_IndirectSpecular )14131413 RE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );1414-#endif`,Lge=`#ifdef USE_LIGHT_PROBES_GRID1414+#endif`,d1e=`#ifdef USE_LIGHT_PROBES_GRID14151415 uniform highp sampler3D probesSH;14161416 uniform vec3 probesMin;14171417 uniform vec3 probesMax;@@ -1456,27 +1456,27 @@ vec3 getLightProbeGridIrradiance( vec3 worldPos, vec3 worldNormal ) {
14561456 result += c8 * 0.429043 * ( x * x - y * y );14571457 return max( result, vec3( 0.0 ) );14581458 }1459-#endif`,Dge=`#if defined( USE_LOGARITHMIC_DEPTH_BUFFER )1459+#endif`,p1e=`#if defined( USE_LOGARITHMIC_DEPTH_BUFFER )14601460 gl_FragDepth = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;1461-#endif`,Nge=`#if defined( USE_LOGARITHMIC_DEPTH_BUFFER )1461+#endif`,m1e=`#if defined( USE_LOGARITHMIC_DEPTH_BUFFER )14621462 uniform float logDepthBufFC;14631463 varying float vFragDepth;14641464 varying float vIsPerspective;1465-#endif`,Fge=`#ifdef USE_LOGARITHMIC_DEPTH_BUFFER1465+#endif`,A1e=`#ifdef USE_LOGARITHMIC_DEPTH_BUFFER14661466 varying float vFragDepth;14671467 varying float vIsPerspective;1468-#endif`,Bge=`#ifdef USE_LOGARITHMIC_DEPTH_BUFFER1468+#endif`,g1e=`#ifdef USE_LOGARITHMIC_DEPTH_BUFFER14691469 vFragDepth = 1.0 + gl_Position.w;14701470 vIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );1471-#endif`,Oge=`#ifdef USE_MAP1471+#endif`,v1e=`#ifdef USE_MAP14721472 vec4 sampledDiffuseColor = texture2D( map, vMapUv );14731473 #ifdef DECODE_VIDEO_TEXTURE14741474 sampledDiffuseColor = sRGBTransferEOTF( sampledDiffuseColor );14751475 #endif14761476 diffuseColor *= sampledDiffuseColor;1477-#endif`,Uge=`#ifdef USE_MAP1477+#endif`,_1e=`#ifdef USE_MAP14781478 uniform sampler2D map;1479-#endif`,kge=`#if defined( USE_MAP ) || defined( USE_ALPHAMAP )1479+#endif`,x1e=`#if defined( USE_MAP ) || defined( USE_ALPHAMAP )14801480 #if defined( USE_POINTS_UV )14811481 vec2 uv = vUv;14821482 #else@@ -1488,7 +1488,7 @@ vec3 getLightProbeGridIrradiance( vec3 worldPos, vec3 worldNormal ) {
14881488 #endif14891489 #ifdef USE_ALPHAMAP14901490 diffuseColor.a *= texture2D( alphaMap, uv ).g;1491-#endif`,zge=`#if defined( USE_POINTS_UV )1491+#endif`,y1e=`#if defined( USE_POINTS_UV )14921492 varying vec2 vUv;14931493 #else14941494 #if defined( USE_MAP ) || defined( USE_ALPHAMAP )@@ -1500,19 +1500,19 @@ vec3 getLightProbeGridIrradiance( vec3 worldPos, vec3 worldNormal ) {
15001500 #endif15011501 #ifdef USE_ALPHAMAP15021502 uniform sampler2D alphaMap;1503-#endif`,Vge=`float metalnessFactor = metalness;1503+#endif`,b1e=`float metalnessFactor = metalness;15041504 #ifdef USE_METALNESSMAP15051505 vec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv );15061506 metalnessFactor *= texelMetalness.b;1507-#endif`,Gge=`#ifdef USE_METALNESSMAP1507+#endif`,w1e=`#ifdef USE_METALNESSMAP15081508 uniform sampler2D metalnessMap;1509-#endif`,qge=`#ifdef USE_INSTANCING_MORPH1509+#endif`,S1e=`#ifdef USE_INSTANCING_MORPH15101510 float morphTargetInfluences[ MORPHTARGETS_COUNT ];15111511 float morphTargetBaseInfluence = texelFetch( morphTexture, ivec2( 0, gl_InstanceID ), 0 ).r;15121512 for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {15131513 morphTargetInfluences[i] = texelFetch( morphTexture, ivec2( i + 1, gl_InstanceID ), 0 ).r;15141514 }1515-#endif`,Hge=`#if defined( USE_MORPHCOLORS )1515+#endif`,T1e=`#if defined( USE_MORPHCOLORS )15161516 vColor *= morphTargetBaseInfluence;15171517 for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {15181518 #if defined( USE_COLOR_ALPHA )@@ -1521,12 +1521,12 @@ vec3 getLightProbeGridIrradiance( vec3 worldPos, vec3 worldNormal ) {
15211521 if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ).rgb * morphTargetInfluences[ i ];15221522 #endif15231523 }1524-#endif`,Wge=`#ifdef USE_MORPHNORMALS1524+#endif`,E1e=`#ifdef USE_MORPHNORMALS15251525 objectNormal *= morphTargetBaseInfluence;15261526 for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {15271527 if ( morphTargetInfluences[ i ] != 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1 ).xyz * morphTargetInfluences[ i ];15281528 }1529-#endif`,jge=`#ifdef USE_MORPHTARGETS1529+#endif`,M1e=`#ifdef USE_MORPHTARGETS15301530 #ifndef USE_INSTANCING_MORPH15311531 uniform float morphTargetBaseInfluence;15321532 uniform float morphTargetInfluences[ MORPHTARGETS_COUNT ];@@ -1540,12 +1540,12 @@ vec3 getLightProbeGridIrradiance( vec3 worldPos, vec3 worldNormal ) {
15401540 ivec3 morphUV = ivec3( x, y, morphTargetIndex );15411541 return texelFetch( morphTargetsTexture, morphUV, 0 );15421542 }1543-#endif`,Xge=`#ifdef USE_MORPHTARGETS1543+#endif`,C1e=`#ifdef USE_MORPHTARGETS15441544 transformed *= morphTargetBaseInfluence;15451545 for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {15461546 if ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0 ).xyz * morphTargetInfluences[ i ];15471547 }1548-#endif`,$ge=`float faceDirection = gl_FrontFacing ? 1.0 : - 1.0;1548+#endif`,R1e=`float faceDirection = gl_FrontFacing ? 1.0 : - 1.0;15491549 #ifdef FLAT_SHADED15501550 vec3 fdx = dFdx( vViewPosition );15511551 vec3 fdy = dFdy( vViewPosition );@@ -1586,7 +1586,7 @@ vec3 getLightProbeGridIrradiance( vec3 worldPos, vec3 worldNormal ) {
15861586 tbn2[1] *= faceDirection;15871587 #endif15881588 #endif1589-vec3 nonPerturbedNormal = normal;`,Yge=`#ifdef USE_NORMALMAP_OBJECTSPACE1589+vec3 nonPerturbedNormal = normal;`,P1e=`#ifdef USE_NORMALMAP_OBJECTSPACE15901590 normal = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;15911591 #ifdef FLIP_SIDED15921592 normal = - normal;@@ -1604,19 +1604,19 @@ vec3 nonPerturbedNormal = normal;`,Yge=`#ifdef USE_NORMALMAP_OBJECTSPACE
16041604 normal = normalize( tbn * mapN );16051605 #elif defined( USE_BUMPMAP )16061606 normal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection );1607-#endif`,Zge=`#ifndef FLAT_SHADED1607+#endif`,I1e=`#ifndef FLAT_SHADED16081608 varying vec3 vNormal;16091609 #ifdef USE_TANGENT16101610 varying vec3 vTangent;16111611 varying vec3 vBitangent;16121612 #endif1613-#endif`,Kge=`#ifndef FLAT_SHADED1613+#endif`,L1e=`#ifndef FLAT_SHADED16141614 varying vec3 vNormal;16151615 #ifdef USE_TANGENT16161616 varying vec3 vTangent;16171617 varying vec3 vBitangent;16181618 #endif1619-#endif`,Qge=`#ifndef FLAT_SHADED1619+#endif`,D1e=`#ifndef FLAT_SHADED16201620 vNormal = normalize( transformedNormal );16211621 #ifdef USE_TANGENT16221622 vTangent = normalize( transformedTangent );@@ -1625,7 +1625,7 @@ vec3 nonPerturbedNormal = normal;`,Yge=`#ifdef USE_NORMALMAP_OBJECTSPACE
16251625 vBitangent = - vBitangent;16261626 #endif16271627 #endif1628-#endif`,Jge=`#ifdef USE_NORMALMAP1628+#endif`,N1e=`#ifdef USE_NORMALMAP16291629 uniform sampler2D normalMap;16301630 uniform vec2 normalScale;16311631 #endif@@ -1647,13 +1647,13 @@ vec3 nonPerturbedNormal = normal;`,Yge=`#ifdef USE_NORMALMAP_OBJECTSPACE
16471647 float scale = ( det == 0.0 ) ? 0.0 : inversesqrt( det );16481648 return mat3( T * scale, B * scale, N );16491649 }1650-#endif`,e1e=`#ifdef USE_CLEARCOAT1650+#endif`,F1e=`#ifdef USE_CLEARCOAT16511651 vec3 clearcoatNormal = nonPerturbedNormal;1652-#endif`,t1e=`#ifdef USE_CLEARCOAT_NORMALMAP1652+#endif`,B1e=`#ifdef USE_CLEARCOAT_NORMALMAP16531653 vec3 clearcoatMapN = texture2D( clearcoatNormalMap, vClearcoatNormalMapUv ).xyz * 2.0 - 1.0;16541654 clearcoatMapN.xy *= clearcoatNormalScale;16551655 clearcoatNormal = normalize( tbn2 * clearcoatMapN );1656-#endif`,n1e=`#ifdef USE_CLEARCOATMAP1656+#endif`,O1e=`#ifdef USE_CLEARCOATMAP16571657 uniform sampler2D clearcoatMap;16581658 #endif16591659 #ifdef USE_CLEARCOAT_NORMALMAP@@ -1662,18 +1662,18 @@ vec3 nonPerturbedNormal = normal;`,Yge=`#ifdef USE_NORMALMAP_OBJECTSPACE
16621662 #endif16631663 #ifdef USE_CLEARCOAT_ROUGHNESSMAP16641664 uniform sampler2D clearcoatRoughnessMap;1665-#endif`,i1e=`#ifdef USE_IRIDESCENCEMAP1665+#endif`,U1e=`#ifdef USE_IRIDESCENCEMAP16661666 uniform sampler2D iridescenceMap;16671667 #endif16681668 #ifdef USE_IRIDESCENCE_THICKNESSMAP16691669 uniform sampler2D iridescenceThicknessMap;1670-#endif`,r1e=`#ifdef OPAQUE1670+#endif`,k1e=`#ifdef OPAQUE16711671 diffuseColor.a = 1.0;16721672 #endif16731673 #ifdef USE_TRANSMISSION16741674 diffuseColor.a *= material.transmissionAlpha;16751675 #endif1676-gl_FragColor = vec4( outgoingLight, diffuseColor.a );`,s1e=`vec3 packNormalToRGB( const in vec3 normal ) {1676+gl_FragColor = vec4( outgoingLight, diffuseColor.a );`,z1e=`vec3 packNormalToRGB( const in vec3 normal ) {16771677 return normalize( normal ) * 0.5 + 0.5;16781678 }16791679 vec3 unpackRGBToNormal( const in vec3 rgb ) {@@ -1752,9 +1752,9 @@ float perspectiveDepthToViewZ( const in float depth, const in float near, const
17521752 #else17531753 return ( near * far ) / ( ( far - near ) * depth - far );17541754 #endif1755-}`,o1e=`#ifdef PREMULTIPLIED_ALPHA1755+}`,V1e=`#ifdef PREMULTIPLIED_ALPHA17561756 gl_FragColor.rgb *= gl_FragColor.a;1757-#endif`,a1e=`vec4 mvPosition = vec4( transformed, 1.0 );1757+#endif`,G1e=`vec4 mvPosition = vec4( transformed, 1.0 );17581758 #ifdef USE_BATCHING17591759 mvPosition = batchingMatrix * mvPosition;17601760 #endif@@ -1762,22 +1762,22 @@ float perspectiveDepthToViewZ( const in float depth, const in float near, const
17621762 mvPosition = instanceMatrix * mvPosition;17631763 #endif17641764 mvPosition = modelViewMatrix * mvPosition;1765-gl_Position = projectionMatrix * mvPosition;`,l1e=`#ifdef DITHERING1765+gl_Position = projectionMatrix * mvPosition;`,q1e=`#ifdef DITHERING17661766 gl_FragColor.rgb = dithering( gl_FragColor.rgb );1767-#endif`,c1e=`#ifdef DITHERING1767+#endif`,H1e=`#ifdef DITHERING17681768 vec3 dithering( vec3 color ) {17691769 float grid_position = rand( gl_FragCoord.xy );17701770 vec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 );17711771 dither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position );17721772 return color + dither_shift_RGB;17731773 }1774-#endif`,u1e=`float roughnessFactor = roughness;1774+#endif`,W1e=`float roughnessFactor = roughness;17751775 #ifdef USE_ROUGHNESSMAP17761776 vec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv );17771777 roughnessFactor *= texelRoughness.g;1778-#endif`,h1e=`#ifdef USE_ROUGHNESSMAP1778+#endif`,j1e=`#ifdef USE_ROUGHNESSMAP17791779 uniform sampler2D roughnessMap;1780-#endif`,f1e=`#if NUM_SPOT_LIGHT_COORDS > 01780+#endif`,X1e=`#if NUM_SPOT_LIGHT_COORDS > 017811781 varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];17821782 #endif17831783 #if NUM_SPOT_LIGHT_MAPS > 0@@ -1977,7 +1977,7 @@ gl_Position = projectionMatrix * mvPosition;`,l1e=`#ifdef DITHERING
19771977 }19781978 #endif19791979 #endif1980-#endif`,d1e=`#if NUM_SPOT_LIGHT_COORDS > 01980+#endif`,$1e=`#if NUM_SPOT_LIGHT_COORDS > 019811981 uniform mat4 spotLightMatrix[ NUM_SPOT_LIGHT_COORDS ];19821982 varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];19831983 #endif@@ -2018,7 +2018,7 @@ gl_Position = projectionMatrix * mvPosition;`,l1e=`#ifdef DITHERING
20182018 };20192019 uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];20202020 #endif2021-#endif`,p1e=`#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 )2021+#endif`,Y1e=`#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 )20222022 #ifdef HAS_NORMAL20232023 vec3 shadowWorldNormal = transformNormalByInverseViewMatrix( transformedNormal, viewMatrix );20242024 #else@@ -2054,7 +2054,7 @@ gl_Position = projectionMatrix * mvPosition;`,l1e=`#ifdef DITHERING
20542054 vSpotLightCoord[ i ] = spotLightMatrix[ i ] * shadowWorldPosition;20552055 }20562056 #pragma unroll_loop_end2057-#endif`,m1e=`float getShadowMask() {2057+#endif`,Z1e=`float getShadowMask() {20582058 float shadow = 1.0;20592059 #ifdef USE_SHADOWMAP20602060 #if NUM_DIR_LIGHT_SHADOWS > 0@@ -2086,12 +2086,12 @@ gl_Position = projectionMatrix * mvPosition;`,l1e=`#ifdef DITHERING
20862086 #endif20872087 #endif20882088 return shadow;2089-}`,A1e=`#ifdef USE_SKINNING2089+}`,K1e=`#ifdef USE_SKINNING20902090 mat4 boneMatX = getBoneMatrix( skinIndex.x );20912091 mat4 boneMatY = getBoneMatrix( skinIndex.y );20922092 mat4 boneMatZ = getBoneMatrix( skinIndex.z );20932093 mat4 boneMatW = getBoneMatrix( skinIndex.w );2094-#endif`,g1e=`#ifdef USE_SKINNING2094+#endif`,Q1e=`#ifdef USE_SKINNING20952095 uniform mat4 bindMatrix;20962096 uniform mat4 bindMatrixInverse;20972097 uniform highp sampler2D boneTexture;@@ -2106,7 +2106,7 @@ gl_Position = projectionMatrix * mvPosition;`,l1e=`#ifdef DITHERING
21062106 vec4 v4 = texelFetch( boneTexture, ivec2( x + 3, y ), 0 );21072107 return mat4( v1, v2, v3, v4 );21082108 }2109-#endif`,v1e=`#ifdef USE_SKINNING2109+#endif`,J1e=`#ifdef USE_SKINNING21102110 vec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );21112111 vec4 skinned = vec4( 0.0 );21122112 skinned += boneMatX * skinVertex * skinWeight.x;@@ -2114,7 +2114,7 @@ gl_Position = projectionMatrix * mvPosition;`,l1e=`#ifdef DITHERING
21142114 skinned += boneMatZ * skinVertex * skinWeight.z;21152115 skinned += boneMatW * skinVertex * skinWeight.w;21162116 transformed = ( bindMatrixInverse * skinned ).xyz;2117-#endif`,_1e=`#ifdef USE_SKINNING2117+#endif`,eve=`#ifdef USE_SKINNING21182118 mat4 skinMatrix = mat4( 0.0 );21192119 skinMatrix += skinWeight.x * boneMatX;21202120 skinMatrix += skinWeight.y * boneMatY;@@ -2125,17 +2125,17 @@ gl_Position = projectionMatrix * mvPosition;`,l1e=`#ifdef DITHERING
21252125 #ifdef USE_TANGENT21262126 objectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz;21272127 #endif2128-#endif`,x1e=`float specularStrength;2128+#endif`,tve=`float specularStrength;21292129 #ifdef USE_SPECULARMAP21302130 vec4 texelSpecular = texture2D( specularMap, vSpecularMapUv );21312131 specularStrength = texelSpecular.r;21322132 #else21332133 specularStrength = 1.0;2134-#endif`,y1e=`#ifdef USE_SPECULARMAP2134+#endif`,nve=`#ifdef USE_SPECULARMAP21352135 uniform sampler2D specularMap;2136-#endif`,b1e=`#if defined( TONE_MAPPING )2136+#endif`,ive=`#if defined( TONE_MAPPING )21372137 gl_FragColor.rgb = toneMapping( gl_FragColor.rgb );2138-#endif`,w1e=`#ifndef saturate2138+#endif`,rve=`#ifndef saturate21392139 #define saturate( a ) clamp( a, 0.0, 1.0 )21402140 #endif21412141 uniform float toneMappingExposure;@@ -2232,7 +2232,7 @@ vec3 NeutralToneMapping( vec3 color ) {
22322232 float g = 1. - 1. / ( Desaturation * ( peak - newPeak ) + 1. );22332233 return mix( color, vec3( newPeak ), g );22342234 }2235-vec3 CustomToneMapping( vec3 color ) { return color; }`,S1e=`#ifdef USE_TRANSMISSION2235+vec3 CustomToneMapping( vec3 color ) { return color; }`,sve=`#ifdef USE_TRANSMISSION22362236 material.transmission = transmission;22372237 material.transmissionAlpha = 1.0;22382238 material.thickness = thickness;@@ -2253,7 +2253,7 @@ vec3 CustomToneMapping( vec3 color ) { return color; }`,S1e=`#ifdef USE_TRANSMIS
22532253 material.attenuationColor, material.attenuationDistance );22542254 material.transmissionAlpha = mix( material.transmissionAlpha, transmitted.a, material.transmission );22552255 totalDiffuse = mix( totalDiffuse, transmitted.rgb, material.transmission );2256-#endif`,T1e=`#ifdef USE_TRANSMISSION2256+#endif`,ove=`#ifdef USE_TRANSMISSION22572257 uniform float transmission;22582258 uniform float thickness;22592259 uniform float attenuationDistance;@@ -2379,7 +2379,7 @@ vec3 CustomToneMapping( vec3 color ) { return color; }`,S1e=`#ifdef USE_TRANSMIS
23792379 float transmittanceFactor = ( transmittance.r + transmittance.g + transmittance.b ) / 3.0;23802380 return vec4( ( 1.0 - F ) * attenuatedColor, 1.0 - ( 1.0 - transmittedLight.a ) * transmittanceFactor );23812381 }2382-#endif`,E1e=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )2382+#endif`,ave=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )23832383 varying vec2 vUv;23842384 #endif23852385 #ifdef USE_MAP@@ -2449,7 +2449,7 @@ vec3 CustomToneMapping( vec3 color ) { return color; }`,S1e=`#ifdef USE_TRANSMIS
24492449 #ifdef USE_THICKNESSMAP24502450 uniform mat3 thicknessMapTransform;24512451 varying vec2 vThicknessMapUv;2452-#endif`,M1e=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )2452+#endif`,lve=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )24532453 varying vec2 vUv;24542454 #endif24552455 #ifdef USE_MAP@@ -2543,7 +2543,7 @@ vec3 CustomToneMapping( vec3 color ) { return color; }`,S1e=`#ifdef USE_TRANSMIS
25432543 #ifdef USE_THICKNESSMAP25442544 uniform mat3 thicknessMapTransform;25452545 varying vec2 vThicknessMapUv;2546-#endif`,C1e=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )2546+#endif`,cve=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )25472547 vUv = vec3( uv, 1 ).xy;25482548 #endif25492549 #ifdef USE_MAP@@ -2614,7 +2614,7 @@ vec3 CustomToneMapping( vec3 color ) { return color; }`,S1e=`#ifdef USE_TRANSMIS
26142614 #endif26152615 #ifdef USE_THICKNESSMAP26162616 vThicknessMapUv = ( thicknessMapTransform * vec3( THICKNESSMAP_UV, 1 ) ).xy;2617-#endif`,R1e=`#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 02617+#endif`,uve=`#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 026182618 vec4 worldPosition = vec4( transformed, 1.0 );26192619 #ifdef USE_BATCHING26202620 worldPosition = batchingMatrix * worldPosition;@@ -2623,12 +2623,12 @@ vec3 CustomToneMapping( vec3 color ) { return color; }`,S1e=`#ifdef USE_TRANSMIS
26232623 worldPosition = instanceMatrix * worldPosition;26242624 #endif26252625 worldPosition = modelMatrix * worldPosition;2626-#endif`,I1e=`varying vec2 vUv;2626+#endif`,hve=`varying vec2 vUv;26272627 uniform mat3 uvTransform;26282628 void main() {26292629 vUv = ( uvTransform * vec3( uv, 1 ) ).xy;26302630 gl_Position = vec4( position.xy, 1.0, 1.0 );2631-}`,P1e=`uniform sampler2D t2D;2631+}`,fve=`uniform sampler2D t2D;26322632 uniform float backgroundIntensity;26332633 varying vec2 vUv;26342634 void main() {@@ -2640,14 +2640,14 @@ void main() {
26402640 gl_FragColor = texColor;26412641 #include <tonemapping_fragment>26422642 #include <colorspace_fragment>2643-}`,L1e=`varying vec3 vWorldDirection;2643+}`,dve=`varying vec3 vWorldDirection;26442644 #include <common>26452645 void main() {26462646 vWorldDirection = transformDirection( position, modelMatrix );26472647 #include <begin_vertex>26482648 #include <project_vertex>26492649 gl_Position.z = gl_Position.w;2650-}`,D1e=`#ifdef ENVMAP_TYPE_CUBE2650+}`,pve=`#ifdef ENVMAP_TYPE_CUBE26512651 uniform samplerCube envMap;26522652 #elif defined( ENVMAP_TYPE_CUBE_UV )26532653 uniform sampler2D envMap;@@ -2669,14 +2669,14 @@ void main() {
26692669 gl_FragColor = texColor;26702670 #include <tonemapping_fragment>26712671 #include <colorspace_fragment>2672-}`,N1e=`varying vec3 vWorldDirection;2672+}`,mve=`varying vec3 vWorldDirection;26732673 #include <common>26742674 void main() {26752675 vWorldDirection = transformDirection( position, modelMatrix );26762676 #include <begin_vertex>26772677 #include <project_vertex>26782678 gl_Position.z = gl_Position.w;2679-}`,F1e=`uniform samplerCube tCube;2679+}`,Ave=`uniform samplerCube tCube;26802680 uniform float tFlip;26812681 uniform float opacity;26822682 varying vec3 vWorldDirection;@@ -2686,7 +2686,7 @@ void main() {
26862686 gl_FragColor.a *= opacity;26872687 #include <tonemapping_fragment>26882688 #include <colorspace_fragment>2689-}`,B1e=`#include <common>2689+}`,gve=`#include <common>26902690 #include <batching_pars_vertex>26912691 #include <uv_pars_vertex>26922692 #include <displacementmap_pars_vertex>@@ -2713,7 +2713,7 @@ void main() {
27132713 #include <logdepthbuf_vertex>27142714 #include <clipping_planes_vertex>27152715 vHighPrecisionZW = gl_Position.zw;2716-}`,O1e=`#if DEPTH_PACKING == 32002716+}`,vve=`#if DEPTH_PACKING == 320027172717 uniform float opacity;27182718 #endif27192719 #include <common>@@ -2751,7 +2751,7 @@ void main() {
27512751 #elif DEPTH_PACKING == 320327522752 gl_FragColor = vec4( packDepthToRG( fragCoordZ ), 0.0, 1.0 );27532753 #endif2754-}`,U1e=`#define DISTANCE2754+}`,_ve=`#define DISTANCE27552755 varying vec3 vWorldPosition;27562756 #include <common>27572757 #include <batching_pars_vertex>@@ -2778,7 +2778,7 @@ void main() {
27782778 #include <worldpos_vertex>27792779 #include <clipping_planes_vertex>27802780 vWorldPosition = worldPosition.xyz;2781-}`,k1e=`#define DISTANCE2781+}`,xve=`#define DISTANCE27822782 uniform vec3 referencePosition;27832783 uniform float nearDistance;27842784 uniform float farDistance;@@ -2801,13 +2801,13 @@ void main() {
28012801 dist = ( dist - nearDistance ) / ( farDistance - nearDistance );28022802 dist = saturate( dist );28032803 gl_FragColor = vec4( dist, 0.0, 0.0, 1.0 );2804-}`,z1e=`varying vec3 vWorldDirection;2804+}`,yve=`varying vec3 vWorldDirection;28052805 #include <common>28062806 void main() {28072807 vWorldDirection = transformDirection( position, modelMatrix );28082808 #include <begin_vertex>28092809 #include <project_vertex>2810-}`,V1e=`uniform sampler2D tEquirect;2810+}`,bve=`uniform sampler2D tEquirect;28112811 varying vec3 vWorldDirection;28122812 #include <common>28132813 void main() {@@ -2816,7 +2816,7 @@ void main() {
28162816 gl_FragColor = texture2D( tEquirect, sampleUV );28172817 #include <tonemapping_fragment>28182818 #include <colorspace_fragment>2819-}`,G1e=`uniform float scale;2819+}`,wve=`uniform float scale;28202820 attribute float lineDistance;28212821 varying float vLineDistance;28222822 #include <common>@@ -2838,7 +2838,7 @@ void main() {
28382838 #include <logdepthbuf_vertex>28392839 #include <clipping_planes_vertex>28402840 #include <fog_vertex>2841-}`,q1e=`uniform vec3 diffuse;2841+}`,Sve=`uniform vec3 diffuse;28422842 uniform float opacity;28432843 uniform float dashSize;28442844 uniform float totalSize;@@ -2866,7 +2866,7 @@ void main() {
28662866 #include <colorspace_fragment>28672867 #include <fog_fragment>28682868 #include <premultiplied_alpha_fragment>2869-}`,H1e=`#include <common>2869+}`,Tve=`#include <common>28702870 #include <batching_pars_vertex>28712871 #include <uv_pars_vertex>28722872 #include <envmap_pars_vertex>@@ -2898,7 +2898,7 @@ void main() {
28982898 #include <worldpos_vertex>28992899 #include <envmap_vertex>29002900 #include <fog_vertex>2901-}`,W1e=`uniform vec3 diffuse;2901+}`,Eve=`uniform vec3 diffuse;29022902 uniform float opacity;29032903 #ifndef FLAT_SHADED29042904 varying vec3 vNormal;@@ -2946,7 +2946,7 @@ void main() {
29462946 #include <fog_fragment>29472947 #include <premultiplied_alpha_fragment>29482948 #include <dithering_fragment>2949-}`,j1e=`#define LAMBERT2949+}`,Mve=`#define LAMBERT29502950 varying vec3 vViewPosition;29512951 #include <common>29522952 #include <batching_pars_vertex>@@ -2985,7 +2985,7 @@ void main() {
29852985 #include <envmap_vertex>29862986 #include <shadowmap_vertex>29872987 #include <fog_vertex>2988-}`,X1e=`#define LAMBERT2988+}`,Cve=`#define LAMBERT29892989 uniform vec3 diffuse;29902990 uniform vec3 emissive;29912991 uniform float opacity;@@ -3043,7 +3043,7 @@ void main() {
30433043 #include <fog_fragment>30443044 #include <premultiplied_alpha_fragment>30453045 #include <dithering_fragment>3046-}`,$1e=`#define MATCAP3046+}`,Rve=`#define MATCAP30473047 varying vec3 vViewPosition;30483048 #include <common>30493049 #include <batching_pars_vertex>@@ -3077,7 +3077,7 @@ void main() {
30773077 #include <clipping_planes_vertex>30783078 #include <fog_vertex>30793079 vViewPosition = - mvPosition.xyz;3080-}`,Y1e=`#define MATCAP3080+}`,Pve=`#define MATCAP30813081 uniform vec3 diffuse;30823082 uniform float opacity;30833083 uniform sampler2D matcap;@@ -3123,7 +3123,7 @@ void main() {
31233123 #include <fog_fragment>31243124 #include <premultiplied_alpha_fragment>31253125 #include <dithering_fragment>3126-}`,Z1e=`#define NORMAL3126+}`,Ive=`#define NORMAL31273127 #if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )31283128 varying vec3 vViewPosition;31293129 #endif@@ -3156,7 +3156,7 @@ void main() {
31563156 #if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )31573157 vViewPosition = - mvPosition.xyz;31583158 #endif3159-}`,K1e=`#define NORMAL3159+}`,Lve=`#define NORMAL31603160 uniform float opacity;31613161 #if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )31623162 varying vec3 vViewPosition;@@ -3177,7 +3177,7 @@ void main() {
31773177 #ifdef OPAQUE31783178 gl_FragColor.a = 1.0;31793179 #endif3180-}`,Q1e=`#define PHONG3180+}`,Dve=`#define PHONG31813181 varying vec3 vViewPosition;31823182 #include <common>31833183 #include <batching_pars_vertex>@@ -3216,7 +3216,7 @@ void main() {
32163216 #include <envmap_vertex>32173217 #include <shadowmap_vertex>32183218 #include <fog_vertex>3219-}`,J1e=`#define PHONG3219+}`,Nve=`#define PHONG32203220 uniform vec3 diffuse;32213221 uniform vec3 emissive;32223222 uniform vec3 specular;@@ -3276,7 +3276,7 @@ void main() {
32763276 #include <fog_fragment>32773277 #include <premultiplied_alpha_fragment>32783278 #include <dithering_fragment>3279-}`,eve=`#define STANDARD3279+}`,Fve=`#define STANDARD32803280 varying vec3 vViewPosition;32813281 #ifdef USE_TRANSMISSION32823282 varying vec3 vWorldPosition;@@ -3319,7 +3319,7 @@ void main() {
33193319 #ifdef USE_TRANSMISSION33203320 vWorldPosition = worldPosition.xyz;33213321 #endif3322-}`,tve=`#define STANDARD3322+}`,Bve=`#define STANDARD33233323 #ifdef PHYSICAL33243324 #define IOR33253325 #define USE_SPECULAR@@ -3444,7 +3444,7 @@ void main() {
34443444 #include <fog_fragment>34453445 #include <premultiplied_alpha_fragment>34463446 #include <dithering_fragment>3447-}`,nve=`#define TOON3447+}`,Ove=`#define TOON34483448 varying vec3 vViewPosition;34493449 #include <common>34503450 #include <batching_pars_vertex>@@ -3481,7 +3481,7 @@ void main() {
34813481 #include <worldpos_vertex>34823482 #include <shadowmap_vertex>34833483 #include <fog_vertex>3484-}`,ive=`#define TOON3484+}`,Uve=`#define TOON34853485 uniform vec3 diffuse;34863486 uniform vec3 emissive;34873487 uniform float opacity;@@ -3533,7 +3533,7 @@ void main() {
35333533 #include <fog_fragment>35343534 #include <premultiplied_alpha_fragment>35353535 #include <dithering_fragment>3536-}`,rve=`uniform float size;3536+}`,kve=`uniform float size;35373537 uniform float scale;35383538 #include <common>35393539 #include <color_pars_vertex>@@ -3564,7 +3564,7 @@ void main() {
35643564 #include <clipping_planes_vertex>35653565 #include <worldpos_vertex>35663566 #include <fog_vertex>3567-}`,sve=`uniform vec3 diffuse;3567+}`,zve=`uniform vec3 diffuse;35683568 uniform float opacity;35693569 #include <common>35703570 #include <color_pars_fragment>@@ -3589,7 +3589,7 @@ void main() {
35893589 #include <colorspace_fragment>35903590 #include <fog_fragment>35913591 #include <premultiplied_alpha_fragment>3592-}`,ove=`#include <common>3592+}`,Vve=`#include <common>35933593 #include <batching_pars_vertex>35943594 #include <fog_pars_vertex>35953595 #include <morphtarget_pars_vertex>@@ -3612,7 +3612,7 @@ void main() {
36123612 #include <worldpos_vertex>36133613 #include <shadowmap_vertex>36143614 #include <fog_vertex>3615-}`,ave=`uniform vec3 color;3615+}`,Gve=`uniform vec3 color;36163616 uniform float opacity;36173617 #include <common>36183618 #include <fog_pars_fragment>@@ -3628,7 +3628,7 @@ void main() {
36283628 #include <colorspace_fragment>36293629 #include <fog_fragment>36303630 #include <premultiplied_alpha_fragment>3631-}`,lve=`uniform float rotation;3631+}`,qve=`uniform float rotation;36323632 uniform vec2 center;36333633 #include <common>36343634 #include <uv_pars_vertex>@@ -3652,7 +3652,7 @@ void main() {
36523652 #include <logdepthbuf_vertex>36533653 #include <clipping_planes_vertex>36543654 #include <fog_vertex>3655-}`,cve=`uniform vec3 diffuse;3655+}`,Hve=`uniform vec3 diffuse;36563656 uniform float opacity;36573657 #include <common>36583658 #include <uv_pars_fragment>@@ -3677,7 +3677,7 @@ void main() {
36773677 #include <tonemapping_fragment>36783678 #include <colorspace_fragment>36793679 #include <fog_fragment>3680-}`,kn={alphahash_fragment:IAe,alphahash_pars_fragment:PAe,alphamap_fragment:LAe,alphamap_pars_fragment:DAe,alphatest_fragment:NAe,alphatest_pars_fragment:FAe,aomap_fragment:BAe,aomap_pars_fragment:OAe,batching_pars_vertex:UAe,batching_vertex:kAe,begin_vertex:zAe,beginnormal_vertex:VAe,bsdfs:GAe,iridescence_fragment:qAe,bumpmap_pars_fragment:HAe,clipping_planes_fragment:WAe,clipping_planes_pars_fragment:jAe,clipping_planes_pars_vertex:XAe,clipping_planes_vertex:$Ae,color_fragment:YAe,color_pars_fragment:ZAe,color_pars_vertex:KAe,color_vertex:QAe,common:JAe,cube_uv_reflection_fragment:ege,defaultnormal_vertex:tge,displacementmap_pars_vertex:nge,displacementmap_vertex:ige,emissivemap_fragment:rge,emissivemap_pars_fragment:sge,colorspace_fragment:oge,colorspace_pars_fragment:age,envmap_fragment:lge,envmap_common_pars_fragment:cge,envmap_pars_fragment:uge,envmap_pars_vertex:hge,envmap_physical_pars_fragment:bge,envmap_vertex:fge,fog_vertex:dge,fog_pars_vertex:pge,fog_fragment:mge,fog_pars_fragment:Age,gradientmap_pars_fragment:gge,lightmap_pars_fragment:vge,lights_lambert_fragment:_ge,lights_lambert_pars_fragment:xge,lights_pars_begin:yge,lights_toon_fragment:wge,lights_toon_pars_fragment:Sge,lights_phong_fragment:Tge,lights_phong_pars_fragment:Ege,lights_physical_fragment:Mge,lights_physical_pars_fragment:Cge,lights_fragment_begin:Rge,lights_fragment_maps:Ige,lights_fragment_end:Pge,lightprobes_pars_fragment:Lge,logdepthbuf_fragment:Dge,logdepthbuf_pars_fragment:Nge,logdepthbuf_pars_vertex:Fge,logdepthbuf_vertex:Bge,map_fragment:Oge,map_pars_fragment:Uge,map_particle_fragment:kge,map_particle_pars_fragment:zge,metalnessmap_fragment:Vge,metalnessmap_pars_fragment:Gge,morphinstance_vertex:qge,morphcolor_vertex:Hge,morphnormal_vertex:Wge,morphtarget_pars_vertex:jge,morphtarget_vertex:Xge,normal_fragment_begin:$ge,normal_fragment_maps:Yge,normal_pars_fragment:Zge,normal_pars_vertex:Kge,normal_vertex:Qge,normalmap_pars_fragment:Jge,clearcoat_normal_fragment_begin:e1e,clearcoat_normal_fragment_maps:t1e,clearcoat_pars_fragment:n1e,iridescence_pars_fragment:i1e,opaque_fragment:r1e,packing:s1e,premultiplied_alpha_fragment:o1e,project_vertex:a1e,dithering_fragment:l1e,dithering_pars_fragment:c1e,roughnessmap_fragment:u1e,roughnessmap_pars_fragment:h1e,shadowmap_pars_fragment:f1e,shadowmap_pars_vertex:d1e,shadowmap_vertex:p1e,shadowmask_pars_fragment:m1e,skinbase_vertex:A1e,skinning_pars_vertex:g1e,skinning_vertex:v1e,skinnormal_vertex:_1e,specularmap_fragment:x1e,specularmap_pars_fragment:y1e,tonemapping_fragment:b1e,tonemapping_pars_fragment:w1e,transmission_fragment:S1e,transmission_pars_fragment:T1e,uv_pars_fragment:E1e,uv_pars_vertex:M1e,uv_vertex:C1e,worldpos_vertex:R1e,background_vert:I1e,background_frag:P1e,backgroundCube_vert:L1e,backgroundCube_frag:D1e,cube_vert:N1e,cube_frag:F1e,depth_vert:B1e,depth_frag:O1e,distance_vert:U1e,distance_frag:k1e,equirect_vert:z1e,equirect_frag:V1e,linedashed_vert:G1e,linedashed_frag:q1e,meshbasic_vert:H1e,meshbasic_frag:W1e,meshlambert_vert:j1e,meshlambert_frag:X1e,meshmatcap_vert:$1e,meshmatcap_frag:Y1e,meshnormal_vert:Z1e,meshnormal_frag:K1e,meshphong_vert:Q1e,meshphong_frag:J1e,meshphysical_vert:eve,meshphysical_frag:tve,meshtoon_vert:nve,meshtoon_frag:ive,points_vert:rve,points_frag:sve,shadow_vert:ove,shadow_frag:ave,sprite_vert:lve,sprite_frag:cve},Nt={common:{diffuse:{value:new zt(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new Mn},alphaMap:{value:null},alphaMapTransform:{value:new Mn},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new Mn}},envmap:{envMap:{value:null},envMapRotation:{value:new Mn},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98},dfgLUT:{value:null}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new Mn}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new Mn}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new Mn},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new Mn},normalScale:{value:new Oe(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new Mn},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new Mn}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new Mn}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new Mn}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new zt(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotLightMap:{value:[]},spotLightMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}},ltc_1:{value:null},ltc_2:{value:null},probesSH:{value:null},probesMin:{value:new re},probesMax:{value:new re},probesResolution:{value:new re}},points:{diffuse:{value:new zt(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new Mn},alphaTest:{value:0},uvTransform:{value:new Mn}},sprite:{diffuse:{value:new zt(16777215)},opacity:{value:1},center:{value:new Oe(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new Mn},alphaMap:{value:null},alphaMapTransform:{value:new Mn},alphaTest:{value:0}}},qa={basic:{uniforms:ha([Nt.common,Nt.specularmap,Nt.envmap,Nt.aomap,Nt.lightmap,Nt.fog]),vertexShader:kn.meshbasic_vert,fragmentShader:kn.meshbasic_frag},lambert:{uniforms:ha([Nt.common,Nt.specularmap,Nt.envmap,Nt.aomap,Nt.lightmap,Nt.emissivemap,Nt.bumpmap,Nt.normalmap,Nt.displacementmap,Nt.fog,Nt.lights,{emissive:{value:new zt(0)},envMapIntensity:{value:1}}]),vertexShader:kn.meshlambert_vert,fragmentShader:kn.meshlambert_frag},phong:{uniforms:ha([Nt.common,Nt.specularmap,Nt.envmap,Nt.aomap,Nt.lightmap,Nt.emissivemap,Nt.bumpmap,Nt.normalmap,Nt.displacementmap,Nt.fog,Nt.lights,{emissive:{value:new zt(0)},specular:{value:new zt(1118481)},shininess:{value:30},envMapIntensity:{value:1}}]),vertexShader:kn.meshphong_vert,fragmentShader:kn.meshphong_frag},standard:{uniforms:ha([Nt.common,Nt.envmap,Nt.aomap,Nt.lightmap,Nt.emissivemap,Nt.bumpmap,Nt.normalmap,Nt.displacementmap,Nt.roughnessmap,Nt.metalnessmap,Nt.fog,Nt.lights,{emissive:{value:new zt(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:kn.meshphysical_vert,fragmentShader:kn.meshphysical_frag},toon:{uniforms:ha([Nt.common,Nt.aomap,Nt.lightmap,Nt.emissivemap,Nt.bumpmap,Nt.normalmap,Nt.displacementmap,Nt.gradientmap,Nt.fog,Nt.lights,{emissive:{value:new zt(0)}}]),vertexShader:kn.meshtoon_vert,fragmentShader:kn.meshtoon_frag},matcap:{uniforms:ha([Nt.common,Nt.bumpmap,Nt.normalmap,Nt.displacementmap,Nt.fog,{matcap:{value:null}}]),vertexShader:kn.meshmatcap_vert,fragmentShader:kn.meshmatcap_frag},points:{uniforms:ha([Nt.points,Nt.fog]),vertexShader:kn.points_vert,fragmentShader:kn.points_frag},dashed:{uniforms:ha([Nt.common,Nt.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:kn.linedashed_vert,fragmentShader:kn.linedashed_frag},depth:{uniforms:ha([Nt.common,Nt.displacementmap]),vertexShader:kn.depth_vert,fragmentShader:kn.depth_frag},normal:{uniforms:ha([Nt.common,Nt.bumpmap,Nt.normalmap,Nt.displacementmap,{opacity:{value:1}}]),vertexShader:kn.meshnormal_vert,fragmentShader:kn.meshnormal_frag},sprite:{uniforms:ha([Nt.sprite,Nt.fog]),vertexShader:kn.sprite_vert,fragmentShader:kn.sprite_frag},background:{uniforms:{uvTransform:{value:new Mn},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:kn.background_vert,fragmentShader:kn.background_frag},backgroundCube:{uniforms:{envMap:{value:null},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new Mn}},vertexShader:kn.backgroundCube_vert,fragmentShader:kn.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:kn.cube_vert,fragmentShader:kn.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:kn.equirect_vert,fragmentShader:kn.equirect_frag},distance:{uniforms:ha([Nt.common,Nt.displacementmap,{referencePosition:{value:new re},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:kn.distance_vert,fragmentShader:kn.distance_frag},shadow:{uniforms:ha([Nt.lights,Nt.fog,{color:{value:new zt(0)},opacity:{value:1}}]),vertexShader:kn.shadow_vert,fragmentShader:kn.shadow_frag}};qa.physical={uniforms:ha([qa.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new Mn},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new Mn},clearcoatNormalScale:{value:new Oe(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new Mn},dispersion:{value:0},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new Mn},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new Mn},sheen:{value:0},sheenColor:{value:new zt(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new Mn},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new Mn},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new Mn},transmissionSamplerSize:{value:new Oe},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new Mn},attenuationDistance:{value:0},attenuationColor:{value:new zt(0)},specularColor:{value:new zt(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new Mn},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new Mn},anisotropyVector:{value:new Oe},anisotropyMap:{value:null},anisotropyMapTransform:{value:new Mn}}]),vertexShader:kn.meshphysical_vert,fragmentShader:kn.meshphysical_frag};var NM={r:0,b:0,g:0},uve=new cn,FZ=new Mn;FZ.set(-1,0,0,0,1,0,0,0,1);function hve(i,e,t,n,r,s){let o=new zt(0),a=r===!0?0:1,l,c,u=null,f=0,d=null;function A(R){let P=R.isScene===!0?R.background:null;if(P&&P.isTexture){let I=R.backgroundBlurriness>0;P=e.get(P,I)}return P}function y(R){let P=!1,I=A(R);I===null?S(o,a):I&&I.isColor&&(S(I,1),P=!0);let F=i.xr.getEnvironmentBlendMode();F==="additive"?t.buffers.color.setClear(0,0,0,1,s):F==="alpha-blend"&&t.buffers.color.setClear(0,0,0,0,s),(i.autoClear||P)&&(t.buffers.depth.setTest(!0),t.buffers.depth.setMask(!0),t.buffers.color.setMask(!0),i.clear(i.autoClearColor,i.autoClearDepth,i.autoClearStencil))}function w(R,P){let I=A(P);I&&(I.isCubeTexture||I.mapping===Bh)?(c===void 0&&(c=new Hn(new Lu(1,1,1),new ds({name:"BackgroundCubeMaterial",uniforms:ag(qa.backgroundCube.uniforms),vertexShader:qa.backgroundCube.vertexShader,fragmentShader:qa.backgroundCube.fragmentShader,side:mi,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1})),c.geometry.deleteAttribute("normal"),c.geometry.deleteAttribute("uv"),c.onBeforeRender=function(F,D,L){this.matrixWorld.copyPosition(L.matrixWorld)},Object.defineProperty(c.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),n.update(c)),c.material.uniforms.envMap.value=I,c.material.uniforms.backgroundBlurriness.value=P.backgroundBlurriness,c.material.uniforms.backgroundIntensity.value=P.backgroundIntensity,c.material.uniforms.backgroundRotation.value.setFromMatrix4(uve.makeRotationFromEuler(P.backgroundRotation)).transpose(),I.isCubeTexture&&I.isRenderTargetTexture===!1&&c.material.uniforms.backgroundRotation.value.premultiply(FZ),c.material.toneMapped=ln.getTransfer(I.colorSpace)!==kt,(u!==I||f!==I.version||d!==i.toneMapping)&&(c.material.needsUpdate=!0,u=I,f=I.version,d=i.toneMapping),c.layers.enableAll(),R.unshift(c,c.geometry,c.material,0,0,null)):I&&I.isTexture&&(l===void 0&&(l=new Hn(new HA(2,2),new ds({name:"BackgroundMaterial",uniforms:ag(qa.background.uniforms),vertexShader:qa.background.vertexShader,fragmentShader:qa.background.fragmentShader,side:ko,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1})),l.geometry.deleteAttribute("normal"),Object.defineProperty(l.material,"map",{get:function(){return this.uniforms.t2D.value}}),n.update(l)),l.material.uniforms.t2D.value=I,l.material.uniforms.backgroundIntensity.value=P.backgroundIntensity,l.material.toneMapped=ln.getTransfer(I.colorSpace)!==kt,I.matrixAutoUpdate===!0&&I.updateMatrix(),l.material.uniforms.uvTransform.value.copy(I.matrix),(u!==I||f!==I.version||d!==i.toneMapping)&&(l.material.needsUpdate=!0,u=I,f=I.version,d=i.toneMapping),l.layers.enableAll(),R.unshift(l,l.geometry,l.material,0,0,null))}function S(R,P){R.getRGB(NM,Q8(i)),t.buffers.color.setClear(NM.r,NM.g,NM.b,P,s)}function T(){c!==void 0&&(c.geometry.dispose(),c.material.dispose(),c=void 0),l!==void 0&&(l.geometry.dispose(),l.material.dispose(),l=void 0)}return{getClearColor:function(){return o},setClearColor:function(R,P=1){o.set(R),a=P,S(o,a)},getClearAlpha:function(){return a},setClearAlpha:function(R){a=R,S(o,a)},render:y,addToRenderList:w,dispose:T}}function fve(i,e){let t=i.getParameter(i.MAX_VERTEX_ATTRIBS),n={},r=d(null),s=r,o=!1;function a(z,G,W,Y,H){let $=!1,J=f(z,Y,W,G);s!==J&&(s=J,c(s.object)),$=A(z,Y,W,H),$&&y(z,Y,W,H),H!==null&&e.update(H,i.ELEMENT_ARRAY_BUFFER),($||o)&&(o=!1,I(z,G,W,Y),H!==null&&i.bindBuffer(i.ELEMENT_ARRAY_BUFFER,e.get(H).buffer))}function l(){return i.createVertexArray()}function c(z){return i.bindVertexArray(z)}function u(z){return i.deleteVertexArray(z)}function f(z,G,W,Y){let H=Y.wireframe===!0,$=n[G.id];$===void 0&&($={},n[G.id]=$);let J=z.isInstancedMesh===!0?z.id:0,te=$[J];te===void 0&&(te={},$[J]=te);let ce=te[W.id];ce===void 0&&(ce={},te[W.id]=ce);let he=ce[H];return he===void 0&&(he=d(l()),ce[H]=he),he}function d(z){let G=[],W=[],Y=[];for(let H=0;H<t;H++)G[H]=0,W[H]=0,Y[H]=0;return{geometry:null,program:null,wireframe:!1,newAttributes:G,enabledAttributes:W,attributeDivisors:Y,object:z,attributes:{},index:null}}function A(z,G,W,Y){let H=s.attributes,$=G.attributes,J=0,te=W.getAttributes();for(let ce in te)if(te[ce].location>=0){let ve=H[ce],Re=$[ce];if(Re===void 0&&(ce==="instanceMatrix"&&z.instanceMatrix&&(Re=z.instanceMatrix),ce==="instanceColor"&&z.instanceColor&&(Re=z.instanceColor)),ve===void 0||ve.attribute!==Re||Re&&ve.data!==Re.data)return!0;J++}return s.attributesNum!==J||s.index!==Y}function y(z,G,W,Y){let H={},$=G.attributes,J=0,te=W.getAttributes();for(let ce in te)if(te[ce].location>=0){let ve=$[ce];ve===void 0&&(ce==="instanceMatrix"&&z.instanceMatrix&&(ve=z.instanceMatrix),ce==="instanceColor"&&z.instanceColor&&(ve=z.instanceColor));let Re={};Re.attribute=ve,ve&&ve.data&&(Re.data=ve.data),H[ce]=Re,J++}s.attributes=H,s.attributesNum=J,s.index=Y}function w(){let z=s.newAttributes;for(let G=0,W=z.length;G<W;G++)z[G]=0}function S(z){T(z,0)}function T(z,G){let W=s.newAttributes,Y=s.enabledAttributes,H=s.attributeDivisors;W[z]=1,Y[z]===0&&(i.enableVertexAttribArray(z),Y[z]=1),H[z]!==G&&(i.vertexAttribDivisor(z,G),H[z]=G)}function R(){let z=s.newAttributes,G=s.enabledAttributes;for(let W=0,Y=G.length;W<Y;W++)G[W]!==z[W]&&(i.disableVertexAttribArray(W),G[W]=0)}function P(z,G,W,Y,H,$,J){J===!0?i.vertexAttribIPointer(z,G,W,H,$):i.vertexAttribPointer(z,G,W,Y,H,$)}function I(z,G,W,Y){w();let H=Y.attributes,$=W.getAttributes(),J=G.defaultAttributeValues;for(let te in $){let ce=$[te];if(ce.location>=0){let he=H[te];if(he===void 0&&(te==="instanceMatrix"&&z.instanceMatrix&&(he=z.instanceMatrix),te==="instanceColor"&&z.instanceColor&&(he=z.instanceColor)),he!==void 0){let ve=he.normalized,Re=he.itemSize,Qe=e.get(he);if(Qe===void 0)continue;let Fe=Qe.buffer,mt=Qe.type,Ee=Qe.bytesPerElement,Ve=mt===i.INT||mt===i.UNSIGNED_INT||he.gpuType===Zr;if(he.isInterleavedBufferAttribute){let Ye=he.data,Mt=Ye.stride,Et=he.offset;if(Ye.isInstancedInterleavedBuffer){for(let It=0;It<ce.locationSize;It++)T(ce.location+It,Ye.meshPerAttribute);z.isInstancedMesh!==!0&&Y._maxInstanceCount===void 0&&(Y._maxInstanceCount=Ye.meshPerAttribute*Ye.count)}else for(let It=0;It<ce.locationSize;It++)S(ce.location+It);i.bindBuffer(i.ARRAY_BUFFER,Fe);for(let It=0;It<ce.locationSize;It++)P(ce.location+It,Re/ce.locationSize,mt,ve,Mt*Ee,(Et+Re/ce.locationSize*It)*Ee,Ve)}else{if(he.isInstancedBufferAttribute){for(let Ye=0;Ye<ce.locationSize;Ye++)T(ce.location+Ye,he.meshPerAttribute);z.isInstancedMesh!==!0&&Y._maxInstanceCount===void 0&&(Y._maxInstanceCount=he.meshPerAttribute*he.count)}else for(let Ye=0;Ye<ce.locationSize;Ye++)S(ce.location+Ye);i.bindBuffer(i.ARRAY_BUFFER,Fe);for(let Ye=0;Ye<ce.locationSize;Ye++)P(ce.location+Ye,Re/ce.locationSize,mt,ve,Re*Ee,Re/ce.locationSize*Ye*Ee,Ve)}}else if(J!==void 0){let ve=J[te];if(ve!==void 0)switch(ve.length){case 2:i.vertexAttrib2fv(ce.location,ve);break;case 3:i.vertexAttrib3fv(ce.location,ve);break;case 4:i.vertexAttrib4fv(ce.location,ve);break;default:i.vertexAttrib1fv(ce.location,ve)}}}}R()}function F(){B();for(let z in n){let G=n[z];for(let W in G){let Y=G[W];for(let H in Y){let $=Y[H];for(let J in $)u($[J].object),delete $[J];delete Y[H]}}delete n[z]}}function D(z){if(n[z.id]===void 0)return;let G=n[z.id];for(let W in G){let Y=G[W];for(let H in Y){let $=Y[H];for(let J in $)u($[J].object),delete $[J];delete Y[H]}}delete n[z.id]}function L(z){for(let G in n){let W=n[G];for(let Y in W){let H=W[Y];if(H[z.id]===void 0)continue;let $=H[z.id];for(let J in $)u($[J].object),delete $[J];delete H[z.id]}}}function C(z){for(let G in n){let W=n[G],Y=z.isInstancedMesh===!0?z.id:0,H=W[Y];if(H!==void 0){for(let $ in H){let J=H[$];for(let te in J)u(J[te].object),delete J[te];delete H[$]}delete W[Y],Object.keys(W).length===0&&delete n[G]}}}function B(){k(),o=!0,s!==r&&(s=r,c(s.object))}function k(){r.geometry=null,r.program=null,r.wireframe=!1}return{setup:a,reset:B,resetDefaultState:k,dispose:F,releaseStatesOfGeometry:D,releaseStatesOfObject:C,releaseStatesOfProgram:L,initAttributes:w,enableAttribute:S,disableUnusedAttributes:R}}function dve(i,e,t){let n;function r(l){n=l}function s(l,c){i.drawArrays(n,l,c),t.update(c,n,1)}function o(l,c,u){u!==0&&(i.drawArraysInstanced(n,l,c,u),t.update(c,n,u))}function a(l,c,u){if(u===0)return;e.get("WEBGL_multi_draw").multiDrawArraysWEBGL(n,l,0,c,0,u);let d=0;for(let A=0;A<u;A++)d+=c[A];t.update(d,n,1)}this.setMode=r,this.render=s,this.renderInstances=o,this.renderMultiDraw=a}function pve(i,e,t,n){let r;function s(){if(r!==void 0)return r;if(e.has("EXT_texture_filter_anisotropic")===!0){let L=e.get("EXT_texture_filter_anisotropic");r=i.getParameter(L.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else r=0;return r}function o(L){return!(L!==Or&&n.convert(L)!==i.getParameter(i.IMPLEMENTATION_COLOR_READ_FORMAT))}function a(L){let C=L===Wi&&(e.has("EXT_color_buffer_half_float")||e.has("EXT_color_buffer_float"));return!(L!==Ji&&n.convert(L)!==i.getParameter(i.IMPLEMENTATION_COLOR_READ_TYPE)&&L!==cr&&!C)}function l(L){if(L==="highp"){if(i.getShaderPrecisionFormat(i.VERTEX_SHADER,i.HIGH_FLOAT).precision>0&&i.getShaderPrecisionFormat(i.FRAGMENT_SHADER,i.HIGH_FLOAT).precision>0)return"highp";L="mediump"}return L==="mediump"&&i.getShaderPrecisionFormat(i.VERTEX_SHADER,i.MEDIUM_FLOAT).precision>0&&i.getShaderPrecisionFormat(i.FRAGMENT_SHADER,i.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}let c=t.precision!==void 0?t.precision:"highp",u=l(c);u!==c&&(Xe("WebGLRenderer:",c,"not supported, using",u,"instead."),c=u);let f=t.logarithmicDepthBuffer===!0,d=t.reversedDepthBuffer===!0&&e.has("EXT_clip_control");t.reversedDepthBuffer===!0&&d===!1&&Xe("WebGLRenderer: Unable to use reversed depth buffer due to missing EXT_clip_control extension. Fallback to default depth buffer.");let A=i.getParameter(i.MAX_TEXTURE_IMAGE_UNITS),y=i.getParameter(i.MAX_VERTEX_TEXTURE_IMAGE_UNITS),w=i.getParameter(i.MAX_TEXTURE_SIZE),S=i.getParameter(i.MAX_CUBE_MAP_TEXTURE_SIZE),T=i.getParameter(i.MAX_VERTEX_ATTRIBS),R=i.getParameter(i.MAX_VERTEX_UNIFORM_VECTORS),P=i.getParameter(i.MAX_VARYING_VECTORS),I=i.getParameter(i.MAX_FRAGMENT_UNIFORM_VECTORS),F=i.getParameter(i.MAX_SAMPLES),D=i.getParameter(i.SAMPLES);return{isWebGL2:!0,getMaxAnisotropy:s,getMaxPrecision:l,textureFormatReadable:o,textureTypeReadable:a,precision:c,logarithmicDepthBuffer:f,reversedDepthBuffer:d,maxTextures:A,maxVertexTextures:y,maxTextureSize:w,maxCubemapSize:S,maxAttributes:T,maxVertexUniforms:R,maxVaryings:P,maxFragmentUniforms:I,maxSamples:F,samples:D}}function mve(i){let e=this,t=null,n=0,r=!1,s=!1,o=new Da,a=new Mn,l={value:null,needsUpdate:!1};this.uniform=l,this.numPlanes=0,this.numIntersection=0,this.init=function(f,d){let A=f.length!==0||d||n!==0||r;return r=d,n=f.length,A},this.beginShadows=function(){s=!0,u(null)},this.endShadows=function(){s=!1},this.setGlobalState=function(f,d){t=u(f,d,0)},this.setState=function(f,d,A){let y=f.clippingPlanes,w=f.clipIntersection,S=f.clipShadows,T=i.get(f);if(!r||y===null||y.length===0||s&&!S)s?u(null):c();else{let R=s?0:n,P=R*4,I=T.clippingState||null;l.value=I,I=u(y,d,P,A);for(let F=0;F!==P;++F)I[F]=t[F];T.clippingState=I,this.numIntersection=w?this.numPlanes:0,this.numPlanes+=R}};function c(){l.value!==t&&(l.value=t,l.needsUpdate=n>0),e.numPlanes=n,e.numIntersection=0}function u(f,d,A,y){let w=f!==null?f.length:0,S=null;if(w!==0){if(S=l.value,y!==!0||S===null){let T=A+w*4,R=d.matrixWorldInverse;a.getNormalMatrix(R),(S===null||S.length<T)&&(S=new Float32Array(T));for(let P=0,I=A;P!==w;++P,I+=4)o.copy(f[P]).applyMatrix4(R,a),o.normal.toArray(S,I),S[I+3]=o.constant}l.value=S,l.needsUpdate=!0}return e.numPlanes=w,e.numIntersection=0,S}}var z0=4,hZ=[.125,.215,.35,.446,.526,.582],cg=20,Ave=256,Db=new Du,fZ=new zt,oF=null,aF=0,lF=0,cF=!1,gve=new re,BM=class{constructor(e){this._renderer=e,this._pingPongRenderTarget=null,this._lodMax=0,this._cubeSize=0,this._sizeLods=[],this._sigmas=[],this._lodMeshes=[],this._backgroundBox=null,this._cubemapMaterial=null,this._equirectMaterial=null,this._blurMaterial=null,this._ggxMaterial=null}fromScene(e,t=0,n=.1,r=100,s={}){let{size:o=256,position:a=gve}=s;oF=this._renderer.getRenderTarget(),aF=this._renderer.getActiveCubeFace(),lF=this._renderer.getActiveMipmapLevel(),cF=this._renderer.xr.enabled,this._renderer.xr.enabled=!1,this._setSize(o);let l=this._allocateTargets();return l.depthBuffer=!0,this._sceneToCubeUV(e,n,r,l,a),t>0&&this._blur(l,0,0,t),this._applyPMREM(l),this._cleanup(l),l}fromEquirectangular(e,t=null){return this._fromTexture(e,t)}fromCubemap(e,t=null){return this._fromTexture(e,t)}compileCubemapShader(){this._cubemapMaterial===null&&(this._cubemapMaterial=mZ(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=pZ(),this._compileMaterial(this._equirectMaterial))}dispose(){this._dispose(),this._cubemapMaterial!==null&&this._cubemapMaterial.dispose(),this._equirectMaterial!==null&&this._equirectMaterial.dispose(),this._backgroundBox!==null&&(this._backgroundBox.geometry.dispose(),this._backgroundBox.material.dispose())}_setSize(e){this._lodMax=Math.floor(Math.log2(e)),this._cubeSize=Math.pow(2,this._lodMax)}_dispose(){this._blurMaterial!==null&&this._blurMaterial.dispose(),this._ggxMaterial!==null&&this._ggxMaterial.dispose(),this._pingPongRenderTarget!==null&&this._pingPongRenderTarget.dispose();for(let e=0;e<this._lodMeshes.length;e++)this._lodMeshes[e].geometry.dispose()}_cleanup(e){this._renderer.setRenderTarget(oF,aF,lF),this._renderer.xr.enabled=cF,e.scissorTest=!1,a_(e,0,0,e.width,e.height)}_fromTexture(e,t){e.mapping===Kl||e.mapping===Gc?this._setSize(e.image.length===0?16:e.image[0].width||e.image[0].image.width):this._setSize(e.image.width/4),oF=this._renderer.getRenderTarget(),aF=this._renderer.getActiveCubeFace(),lF=this._renderer.getActiveMipmapLevel(),cF=this._renderer.xr.enabled,this._renderer.xr.enabled=!1;let n=t||this._allocateTargets();return this._textureToCubeUV(e,n),this._applyPMREM(n),this._cleanup(n),n}_allocateTargets(){let e=3*Math.max(this._cubeSize,112),t=4*this._cubeSize,n={magFilter:Mi,minFilter:Mi,generateMipmaps:!1,type:Wi,format:Or,colorSpace:Kp,depthBuffer:!1},r=dZ(e,t,n);if(this._pingPongRenderTarget===null||this._pingPongRenderTarget.width!==e||this._pingPongRenderTarget.height!==t){this._pingPongRenderTarget!==null&&this._dispose(),this._pingPongRenderTarget=dZ(e,t,n);let{_lodMax:s}=this;({lodMeshes:this._lodMeshes,sizeLods:this._sizeLods,sigmas:this._sigmas}=vve(s)),this._blurMaterial=xve(s,e,t),this._ggxMaterial=_ve(s,e,t)}return r}_compileMaterial(e){let t=new Hn(new Xn,e);this._renderer.compile(t,Db)}_sceneToCubeUV(e,t,n,r,s){let l=new $r(90,1,t,n),c=[1,-1,1,1,1,1],u=[1,1,1,-1,-1,-1],f=this._renderer,d=f.autoClear,A=f.toneMapping;f.getClearColor(fZ),f.toneMapping=ao,f.autoClear=!1,f.state.buffers.depth.getReversed()&&(f.setRenderTarget(r),f.clearDepth(),f.setRenderTarget(null)),this._backgroundBox===null&&(this._backgroundBox=new Hn(new Lu,new fs({name:"PMREM.Background",side:mi,depthWrite:!1,depthTest:!1})));let w=this._backgroundBox,S=w.material,T=!1,R=e.background;R?R.isColor&&(S.color.copy(R),e.background=null,T=!0):(S.color.copy(fZ),T=!0);for(let P=0;P<6;P++){let I=P%3;I===0?(l.up.set(0,c[P],0),l.position.set(s.x,s.y,s.z),l.lookAt(s.x+u[P],s.y,s.z)):I===1?(l.up.set(0,0,c[P]),l.position.set(s.x,s.y,s.z),l.lookAt(s.x,s.y+u[P],s.z)):(l.up.set(0,c[P],0),l.position.set(s.x,s.y,s.z),l.lookAt(s.x,s.y,s.z+u[P]));let F=this._cubeSize;a_(r,I*F,P>2?F:0,F,F),f.setRenderTarget(r),T&&f.render(w,l),f.render(e,l)}f.toneMapping=A,f.autoClear=d,e.background=R}_textureToCubeUV(e,t){let n=this._renderer,r=e.mapping===Kl||e.mapping===Gc;r?(this._cubemapMaterial===null&&(this._cubemapMaterial=mZ()),this._cubemapMaterial.uniforms.flipEnvMap.value=e.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=pZ());let s=r?this._cubemapMaterial:this._equirectMaterial,o=this._lodMeshes[0];o.material=s;let a=s.uniforms;a.envMap.value=e;let l=this._cubeSize;a_(t,0,0,3*l,2*l),n.setRenderTarget(t),n.render(o,Db)}_applyPMREM(e){let t=this._renderer,n=t.autoClear;t.autoClear=!1;let r=this._lodMeshes.length;for(let s=1;s<r;s++)this._applyGGXFilter(e,s-1,s);t.autoClear=n}_applyGGXFilter(e,t,n){let r=this._renderer,s=this._pingPongRenderTarget,o=this._ggxMaterial,a=this._lodMeshes[n];a.material=o;let l=o.uniforms,c=n/(this._lodMeshes.length-1),u=t/(this._lodMeshes.length-1),f=Math.sqrt(c*c-u*u),d=0+c*1.25,A=f*d,{_lodMax:y}=this,w=this._sizeLods[n],S=3*w*(n>y-z0?n-y+z0:0),T=4*(this._cubeSize-w);l.envMap.value=e.texture,l.roughness.value=A,l.mipInt.value=y-t,a_(s,S,T,3*w,2*w),r.setRenderTarget(s),r.render(a,Db),l.envMap.value=s.texture,l.roughness.value=0,l.mipInt.value=y-n,a_(e,S,T,3*w,2*w),r.setRenderTarget(e),r.render(a,Db)}_blur(e,t,n,r,s){let o=this._pingPongRenderTarget;this._halfBlur(e,o,t,n,r,"latitudinal",s),this._halfBlur(o,e,n,n,r,"longitudinal",s)}_halfBlur(e,t,n,r,s,o,a){let l=this._renderer,c=this._blurMaterial;o!=="latitudinal"&&o!=="longitudinal"&&ze("blur direction must be either latitudinal or longitudinal!");let u=3,f=this._lodMeshes[r];f.material=c;let d=c.uniforms,A=this._sizeLods[n]-1,y=isFinite(s)?Math.PI/(2*A):2*Math.PI/(2*cg-1),w=s/y,S=isFinite(s)?1+Math.floor(u*w):cg;S>cg&&Xe(`sigmaRadians, ${s}, is too large and will clip, as it requested ${S} samples when the maximum is set to ${cg}`);let T=[],R=0;for(let L=0;L<cg;++L){let C=L/w,B=Math.exp(-C*C/2);T.push(B),L===0?R+=B:L<S&&(R+=2*B)}for(let L=0;L<T.length;L++)T[L]=T[L]/R;d.envMap.value=e.texture,d.samples.value=S,d.weights.value=T,d.latitudinal.value=o==="latitudinal",a&&(d.poleAxis.value=a);let{_lodMax:P}=this;d.dTheta.value=y,d.mipInt.value=P-n;let I=this._sizeLods[r],F=3*I*(r>P-z0?r-P+z0:0),D=4*(this._cubeSize-I);a_(t,F,D,3*I,2*I),l.setRenderTarget(t),l.render(f,Db)}};function vve(i){let e=[],t=[],n=[],r=i,s=i-z0+1+hZ.length;for(let o=0;o<s;o++){let a=Math.pow(2,r);e.push(a);let l=1/a;o>i-z0?l=hZ[o-i+z0-1]:o===0&&(l=0),t.push(l);let c=1/(a-2),u=-c,f=1+c,d=[u,u,f,u,f,f,u,u,f,f,u,f],A=6,y=6,w=3,S=2,T=1,R=new Float32Array(w*y*A),P=new Float32Array(S*y*A),I=new Float32Array(T*y*A);for(let D=0;D<A;D++){let L=D%3*2/3-1,C=D>2?0:-1,B=[L,C,0,L+2/3,C,0,L+2/3,C+1,0,L,C,0,L+2/3,C+1,0,L,C+1,0];R.set(B,w*y*D),P.set(d,S*y*D);let k=[D,D,D,D,D,D];I.set(k,T*y*D)}let F=new Xn;F.setAttribute("position",new Hi(R,w)),F.setAttribute("uv",new Hi(P,S)),F.setAttribute("faceIndex",new Hi(I,T)),n.push(new Hn(F,null)),r>z0&&r--}return{lodMeshes:n,sizeLods:e,sigmas:t}}function dZ(i,e,t){let n=new Ba(i,e,t);return n.texture.mapping=Bh,n.texture.name="PMREM.cubeUv",n.scissorTest=!0,n}function a_(i,e,t,n,r){i.viewport.set(e,t,n,r),i.scissor.set(e,t,n,r)}function _ve(i,e,t){return new ds({name:"PMREMGGXConvolution",defines:{GGX_SAMPLES:Ave,CUBEUV_TEXEL_WIDTH:1/e,CUBEUV_TEXEL_HEIGHT:1/t,CUBEUV_MAX_MIP:`${i}.0`},uniforms:{envMap:{value:null},roughness:{value:0},mipInt:{value:0}},vertexShader:kM(),fragmentShader:`3680+}`,kn={alphahash_fragment:hge,alphahash_pars_fragment:fge,alphamap_fragment:dge,alphamap_pars_fragment:pge,alphatest_fragment:mge,alphatest_pars_fragment:Age,aomap_fragment:gge,aomap_pars_fragment:vge,batching_pars_vertex:_ge,batching_vertex:xge,begin_vertex:yge,beginnormal_vertex:bge,bsdfs:wge,iridescence_fragment:Sge,bumpmap_pars_fragment:Tge,clipping_planes_fragment:Ege,clipping_planes_pars_fragment:Mge,clipping_planes_pars_vertex:Cge,clipping_planes_vertex:Rge,color_fragment:Pge,color_pars_fragment:Ige,color_pars_vertex:Lge,color_vertex:Dge,common:Nge,cube_uv_reflection_fragment:Fge,defaultnormal_vertex:Bge,displacementmap_pars_vertex:Oge,displacementmap_vertex:Uge,emissivemap_fragment:kge,emissivemap_pars_fragment:zge,colorspace_fragment:Vge,colorspace_pars_fragment:Gge,envmap_fragment:qge,envmap_common_pars_fragment:Hge,envmap_pars_fragment:Wge,envmap_pars_vertex:jge,envmap_physical_pars_fragment:i1e,envmap_vertex:Xge,fog_vertex:$ge,fog_pars_vertex:Yge,fog_fragment:Zge,fog_pars_fragment:Kge,gradientmap_pars_fragment:Qge,lightmap_pars_fragment:Jge,lights_lambert_fragment:e1e,lights_lambert_pars_fragment:t1e,lights_pars_begin:n1e,lights_toon_fragment:r1e,lights_toon_pars_fragment:s1e,lights_phong_fragment:o1e,lights_phong_pars_fragment:a1e,lights_physical_fragment:l1e,lights_physical_pars_fragment:c1e,lights_fragment_begin:u1e,lights_fragment_maps:h1e,lights_fragment_end:f1e,lightprobes_pars_fragment:d1e,logdepthbuf_fragment:p1e,logdepthbuf_pars_fragment:m1e,logdepthbuf_pars_vertex:A1e,logdepthbuf_vertex:g1e,map_fragment:v1e,map_pars_fragment:_1e,map_particle_fragment:x1e,map_particle_pars_fragment:y1e,metalnessmap_fragment:b1e,metalnessmap_pars_fragment:w1e,morphinstance_vertex:S1e,morphcolor_vertex:T1e,morphnormal_vertex:E1e,morphtarget_pars_vertex:M1e,morphtarget_vertex:C1e,normal_fragment_begin:R1e,normal_fragment_maps:P1e,normal_pars_fragment:I1e,normal_pars_vertex:L1e,normal_vertex:D1e,normalmap_pars_fragment:N1e,clearcoat_normal_fragment_begin:F1e,clearcoat_normal_fragment_maps:B1e,clearcoat_pars_fragment:O1e,iridescence_pars_fragment:U1e,opaque_fragment:k1e,packing:z1e,premultiplied_alpha_fragment:V1e,project_vertex:G1e,dithering_fragment:q1e,dithering_pars_fragment:H1e,roughnessmap_fragment:W1e,roughnessmap_pars_fragment:j1e,shadowmap_pars_fragment:X1e,shadowmap_pars_vertex:$1e,shadowmap_vertex:Y1e,shadowmask_pars_fragment:Z1e,skinbase_vertex:K1e,skinning_pars_vertex:Q1e,skinning_vertex:J1e,skinnormal_vertex:eve,specularmap_fragment:tve,specularmap_pars_fragment:nve,tonemapping_fragment:ive,tonemapping_pars_fragment:rve,transmission_fragment:sve,transmission_pars_fragment:ove,uv_pars_fragment:ave,uv_pars_vertex:lve,uv_vertex:cve,worldpos_vertex:uve,background_vert:hve,background_frag:fve,backgroundCube_vert:dve,backgroundCube_frag:pve,cube_vert:mve,cube_frag:Ave,depth_vert:gve,depth_frag:vve,distance_vert:_ve,distance_frag:xve,equirect_vert:yve,equirect_frag:bve,linedashed_vert:wve,linedashed_frag:Sve,meshbasic_vert:Tve,meshbasic_frag:Eve,meshlambert_vert:Mve,meshlambert_frag:Cve,meshmatcap_vert:Rve,meshmatcap_frag:Pve,meshnormal_vert:Ive,meshnormal_frag:Lve,meshphong_vert:Dve,meshphong_frag:Nve,meshphysical_vert:Fve,meshphysical_frag:Bve,meshtoon_vert:Ove,meshtoon_frag:Uve,points_vert:kve,points_frag:zve,shadow_vert:Vve,shadow_frag:Gve,sprite_vert:qve,sprite_frag:Hve},Nt={common:{diffuse:{value:new zt(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new Mn},alphaMap:{value:null},alphaMapTransform:{value:new Mn},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new Mn}},envmap:{envMap:{value:null},envMapRotation:{value:new Mn},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98},dfgLUT:{value:null}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new Mn}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new Mn}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new Mn},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new Mn},normalScale:{value:new Oe(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new Mn},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new Mn}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new Mn}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new Mn}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new zt(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotLightMap:{value:[]},spotLightMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}},ltc_1:{value:null},ltc_2:{value:null},probesSH:{value:null},probesMin:{value:new re},probesMax:{value:new re},probesResolution:{value:new re}},points:{diffuse:{value:new zt(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new Mn},alphaTest:{value:0},uvTransform:{value:new Mn}},sprite:{diffuse:{value:new zt(16777215)},opacity:{value:1},center:{value:new Oe(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new Mn},alphaMap:{value:null},alphaMapTransform:{value:new Mn},alphaTest:{value:0}}},Ha={basic:{uniforms:fa([Nt.common,Nt.specularmap,Nt.envmap,Nt.aomap,Nt.lightmap,Nt.fog]),vertexShader:kn.meshbasic_vert,fragmentShader:kn.meshbasic_frag},lambert:{uniforms:fa([Nt.common,Nt.specularmap,Nt.envmap,Nt.aomap,Nt.lightmap,Nt.emissivemap,Nt.bumpmap,Nt.normalmap,Nt.displacementmap,Nt.fog,Nt.lights,{emissive:{value:new zt(0)},envMapIntensity:{value:1}}]),vertexShader:kn.meshlambert_vert,fragmentShader:kn.meshlambert_frag},phong:{uniforms:fa([Nt.common,Nt.specularmap,Nt.envmap,Nt.aomap,Nt.lightmap,Nt.emissivemap,Nt.bumpmap,Nt.normalmap,Nt.displacementmap,Nt.fog,Nt.lights,{emissive:{value:new zt(0)},specular:{value:new zt(1118481)},shininess:{value:30},envMapIntensity:{value:1}}]),vertexShader:kn.meshphong_vert,fragmentShader:kn.meshphong_frag},standard:{uniforms:fa([Nt.common,Nt.envmap,Nt.aomap,Nt.lightmap,Nt.emissivemap,Nt.bumpmap,Nt.normalmap,Nt.displacementmap,Nt.roughnessmap,Nt.metalnessmap,Nt.fog,Nt.lights,{emissive:{value:new zt(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:kn.meshphysical_vert,fragmentShader:kn.meshphysical_frag},toon:{uniforms:fa([Nt.common,Nt.aomap,Nt.lightmap,Nt.emissivemap,Nt.bumpmap,Nt.normalmap,Nt.displacementmap,Nt.gradientmap,Nt.fog,Nt.lights,{emissive:{value:new zt(0)}}]),vertexShader:kn.meshtoon_vert,fragmentShader:kn.meshtoon_frag},matcap:{uniforms:fa([Nt.common,Nt.bumpmap,Nt.normalmap,Nt.displacementmap,Nt.fog,{matcap:{value:null}}]),vertexShader:kn.meshmatcap_vert,fragmentShader:kn.meshmatcap_frag},points:{uniforms:fa([Nt.points,Nt.fog]),vertexShader:kn.points_vert,fragmentShader:kn.points_frag},dashed:{uniforms:fa([Nt.common,Nt.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:kn.linedashed_vert,fragmentShader:kn.linedashed_frag},depth:{uniforms:fa([Nt.common,Nt.displacementmap]),vertexShader:kn.depth_vert,fragmentShader:kn.depth_frag},normal:{uniforms:fa([Nt.common,Nt.bumpmap,Nt.normalmap,Nt.displacementmap,{opacity:{value:1}}]),vertexShader:kn.meshnormal_vert,fragmentShader:kn.meshnormal_frag},sprite:{uniforms:fa([Nt.sprite,Nt.fog]),vertexShader:kn.sprite_vert,fragmentShader:kn.sprite_frag},background:{uniforms:{uvTransform:{value:new Mn},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:kn.background_vert,fragmentShader:kn.background_frag},backgroundCube:{uniforms:{envMap:{value:null},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new Mn}},vertexShader:kn.backgroundCube_vert,fragmentShader:kn.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:kn.cube_vert,fragmentShader:kn.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:kn.equirect_vert,fragmentShader:kn.equirect_frag},distance:{uniforms:fa([Nt.common,Nt.displacementmap,{referencePosition:{value:new re},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:kn.distance_vert,fragmentShader:kn.distance_frag},shadow:{uniforms:fa([Nt.lights,Nt.fog,{color:{value:new zt(0)},opacity:{value:1}}]),vertexShader:kn.shadow_vert,fragmentShader:kn.shadow_frag}};Ha.physical={uniforms:fa([Ha.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new Mn},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new Mn},clearcoatNormalScale:{value:new Oe(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new Mn},dispersion:{value:0},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new Mn},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new Mn},sheen:{value:0},sheenColor:{value:new zt(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new Mn},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new Mn},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new Mn},transmissionSamplerSize:{value:new Oe},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new Mn},attenuationDistance:{value:0},attenuationColor:{value:new zt(0)},specularColor:{value:new zt(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new Mn},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new Mn},anisotropyVector:{value:new Oe},anisotropyMap:{value:null},anisotropyMapTransform:{value:new Mn}}]),vertexShader:kn.meshphysical_vert,fragmentShader:kn.meshphysical_frag};var GM={r:0,b:0,g:0},Wve=new cn,oK=new Mn;oK.set(-1,0,0,0,1,0,0,0,1);function jve(i,e,t,n,r,s){let o=new zt(0),a=r===!0?0:1,l,c,u=null,f=0,d=null;function A(R){let I=R.isScene===!0?R.background:null;if(I&&I.isTexture){let P=R.backgroundBlurriness>0;I=e.get(I,P)}return I}function y(R){let I=!1,P=A(R);P===null?S(o,a):P&&P.isColor&&(S(P,1),I=!0);let F=i.xr.getEnvironmentBlendMode();F==="additive"?t.buffers.color.setClear(0,0,0,1,s):F==="alpha-blend"&&t.buffers.color.setClear(0,0,0,0,s),(i.autoClear||I)&&(t.buffers.depth.setTest(!0),t.buffers.depth.setMask(!0),t.buffers.color.setMask(!0),i.clear(i.autoClearColor,i.autoClearDepth,i.autoClearStencil))}function w(R,I){let P=A(I);P&&(P.isCubeTexture||P.mapping===Bh)?(c===void 0&&(c=new Hn(new Lu(1,1,1),new ds({name:"BackgroundCubeMaterial",uniforms:fg(Ha.backgroundCube.uniforms),vertexShader:Ha.backgroundCube.vertexShader,fragmentShader:Ha.backgroundCube.fragmentShader,side:mi,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1})),c.geometry.deleteAttribute("normal"),c.geometry.deleteAttribute("uv"),c.onBeforeRender=function(F,D,L){this.matrixWorld.copyPosition(L.matrixWorld)},Object.defineProperty(c.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),n.update(c)),c.material.uniforms.envMap.value=P,c.material.uniforms.backgroundBlurriness.value=I.backgroundBlurriness,c.material.uniforms.backgroundIntensity.value=I.backgroundIntensity,c.material.uniforms.backgroundRotation.value.setFromMatrix4(Wve.makeRotationFromEuler(I.backgroundRotation)).transpose(),P.isCubeTexture&&P.isRenderTargetTexture===!1&&c.material.uniforms.backgroundRotation.value.premultiply(oK),c.material.toneMapped=ln.getTransfer(P.colorSpace)!==kt,(u!==P||f!==P.version||d!==i.toneMapping)&&(c.material.needsUpdate=!0,u=P,f=P.version,d=i.toneMapping),c.layers.enableAll(),R.unshift(c,c.geometry,c.material,0,0,null)):P&&P.isTexture&&(l===void 0&&(l=new Hn(new YA(2,2),new ds({name:"BackgroundMaterial",uniforms:fg(Ha.background.uniforms),vertexShader:Ha.background.vertexShader,fragmentShader:Ha.background.fragmentShader,side:zo,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1})),l.geometry.deleteAttribute("normal"),Object.defineProperty(l.material,"map",{get:function(){return this.uniforms.t2D.value}}),n.update(l)),l.material.uniforms.t2D.value=P,l.material.uniforms.backgroundIntensity.value=I.backgroundIntensity,l.material.toneMapped=ln.getTransfer(P.colorSpace)!==kt,P.matrixAutoUpdate===!0&&P.updateMatrix(),l.material.uniforms.uvTransform.value.copy(P.matrix),(u!==P||f!==P.version||d!==i.toneMapping)&&(l.material.needsUpdate=!0,u=P,f=P.version,d=i.toneMapping),l.layers.enableAll(),R.unshift(l,l.geometry,l.material,0,0,null))}function S(R,I){R.getRGB(GM,_F(i)),t.buffers.color.setClear(GM.r,GM.g,GM.b,I,s)}function T(){c!==void 0&&(c.geometry.dispose(),c.material.dispose(),c=void 0),l!==void 0&&(l.geometry.dispose(),l.material.dispose(),l=void 0)}return{getClearColor:function(){return o},setClearColor:function(R,I=1){o.set(R),a=I,S(o,a)},getClearAlpha:function(){return a},setClearAlpha:function(R){a=R,S(o,a)},render:y,addToRenderList:w,dispose:T}}function Xve(i,e){let t=i.getParameter(i.MAX_VERTEX_ATTRIBS),n={},r=d(null),s=r,o=!1;function a(z,G,W,Y,H){let $=!1,J=f(z,Y,W,G);s!==J&&(s=J,c(s.object)),$=A(z,Y,W,H),$&&y(z,Y,W,H),H!==null&&e.update(H,i.ELEMENT_ARRAY_BUFFER),($||o)&&(o=!1,P(z,G,W,Y),H!==null&&i.bindBuffer(i.ELEMENT_ARRAY_BUFFER,e.get(H).buffer))}function l(){return i.createVertexArray()}function c(z){return i.bindVertexArray(z)}function u(z){return i.deleteVertexArray(z)}function f(z,G,W,Y){let H=Y.wireframe===!0,$=n[G.id];$===void 0&&($={},n[G.id]=$);let J=z.isInstancedMesh===!0?z.id:0,te=$[J];te===void 0&&(te={},$[J]=te);let ce=te[W.id];ce===void 0&&(ce={},te[W.id]=ce);let he=ce[H];return he===void 0&&(he=d(l()),ce[H]=he),he}function d(z){let G=[],W=[],Y=[];for(let H=0;H<t;H++)G[H]=0,W[H]=0,Y[H]=0;return{geometry:null,program:null,wireframe:!1,newAttributes:G,enabledAttributes:W,attributeDivisors:Y,object:z,attributes:{},index:null}}function A(z,G,W,Y){let H=s.attributes,$=G.attributes,J=0,te=W.getAttributes();for(let ce in te)if(te[ce].location>=0){let ve=H[ce],Re=$[ce];if(Re===void 0&&(ce==="instanceMatrix"&&z.instanceMatrix&&(Re=z.instanceMatrix),ce==="instanceColor"&&z.instanceColor&&(Re=z.instanceColor)),ve===void 0||ve.attribute!==Re||Re&&ve.data!==Re.data)return!0;J++}return s.attributesNum!==J||s.index!==Y}function y(z,G,W,Y){let H={},$=G.attributes,J=0,te=W.getAttributes();for(let ce in te)if(te[ce].location>=0){let ve=$[ce];ve===void 0&&(ce==="instanceMatrix"&&z.instanceMatrix&&(ve=z.instanceMatrix),ce==="instanceColor"&&z.instanceColor&&(ve=z.instanceColor));let Re={};Re.attribute=ve,ve&&ve.data&&(Re.data=ve.data),H[ce]=Re,J++}s.attributes=H,s.attributesNum=J,s.index=Y}function w(){let z=s.newAttributes;for(let G=0,W=z.length;G<W;G++)z[G]=0}function S(z){T(z,0)}function T(z,G){let W=s.newAttributes,Y=s.enabledAttributes,H=s.attributeDivisors;W[z]=1,Y[z]===0&&(i.enableVertexAttribArray(z),Y[z]=1),H[z]!==G&&(i.vertexAttribDivisor(z,G),H[z]=G)}function R(){let z=s.newAttributes,G=s.enabledAttributes;for(let W=0,Y=G.length;W<Y;W++)G[W]!==z[W]&&(i.disableVertexAttribArray(W),G[W]=0)}function I(z,G,W,Y,H,$,J){J===!0?i.vertexAttribIPointer(z,G,W,H,$):i.vertexAttribPointer(z,G,W,Y,H,$)}function P(z,G,W,Y){w();let H=Y.attributes,$=W.getAttributes(),J=G.defaultAttributeValues;for(let te in $){let ce=$[te];if(ce.location>=0){let he=H[te];if(he===void 0&&(te==="instanceMatrix"&&z.instanceMatrix&&(he=z.instanceMatrix),te==="instanceColor"&&z.instanceColor&&(he=z.instanceColor)),he!==void 0){let ve=he.normalized,Re=he.itemSize,Qe=e.get(he);if(Qe===void 0)continue;let Fe=Qe.buffer,mt=Qe.type,Ee=Qe.bytesPerElement,Ve=mt===i.INT||mt===i.UNSIGNED_INT||he.gpuType===Kr;if(he.isInterleavedBufferAttribute){let Ye=he.data,Mt=Ye.stride,Et=he.offset;if(Ye.isInstancedInterleavedBuffer){for(let Pt=0;Pt<ce.locationSize;Pt++)T(ce.location+Pt,Ye.meshPerAttribute);z.isInstancedMesh!==!0&&Y._maxInstanceCount===void 0&&(Y._maxInstanceCount=Ye.meshPerAttribute*Ye.count)}else for(let Pt=0;Pt<ce.locationSize;Pt++)S(ce.location+Pt);i.bindBuffer(i.ARRAY_BUFFER,Fe);for(let Pt=0;Pt<ce.locationSize;Pt++)I(ce.location+Pt,Re/ce.locationSize,mt,ve,Mt*Ee,(Et+Re/ce.locationSize*Pt)*Ee,Ve)}else{if(he.isInstancedBufferAttribute){for(let Ye=0;Ye<ce.locationSize;Ye++)T(ce.location+Ye,he.meshPerAttribute);z.isInstancedMesh!==!0&&Y._maxInstanceCount===void 0&&(Y._maxInstanceCount=he.meshPerAttribute*he.count)}else for(let Ye=0;Ye<ce.locationSize;Ye++)S(ce.location+Ye);i.bindBuffer(i.ARRAY_BUFFER,Fe);for(let Ye=0;Ye<ce.locationSize;Ye++)I(ce.location+Ye,Re/ce.locationSize,mt,ve,Re*Ee,Re/ce.locationSize*Ye*Ee,Ve)}}else if(J!==void 0){let ve=J[te];if(ve!==void 0)switch(ve.length){case 2:i.vertexAttrib2fv(ce.location,ve);break;case 3:i.vertexAttrib3fv(ce.location,ve);break;case 4:i.vertexAttrib4fv(ce.location,ve);break;default:i.vertexAttrib1fv(ce.location,ve)}}}}R()}function F(){B();for(let z in n){let G=n[z];for(let W in G){let Y=G[W];for(let H in Y){let $=Y[H];for(let J in $)u($[J].object),delete $[J];delete Y[H]}}delete n[z]}}function D(z){if(n[z.id]===void 0)return;let G=n[z.id];for(let W in G){let Y=G[W];for(let H in Y){let $=Y[H];for(let J in $)u($[J].object),delete $[J];delete Y[H]}}delete n[z.id]}function L(z){for(let G in n){let W=n[G];for(let Y in W){let H=W[Y];if(H[z.id]===void 0)continue;let $=H[z.id];for(let J in $)u($[J].object),delete $[J];delete H[z.id]}}}function C(z){for(let G in n){let W=n[G],Y=z.isInstancedMesh===!0?z.id:0,H=W[Y];if(H!==void 0){for(let $ in H){let J=H[$];for(let te in J)u(J[te].object),delete J[te];delete H[$]}delete W[Y],Object.keys(W).length===0&&delete n[G]}}}function B(){k(),o=!0,s!==r&&(s=r,c(s.object))}function k(){r.geometry=null,r.program=null,r.wireframe=!1}return{setup:a,reset:B,resetDefaultState:k,dispose:F,releaseStatesOfGeometry:D,releaseStatesOfObject:C,releaseStatesOfProgram:L,initAttributes:w,enableAttribute:S,disableUnusedAttributes:R}}function $ve(i,e,t){let n;function r(l){n=l}function s(l,c){i.drawArrays(n,l,c),t.update(c,n,1)}function o(l,c,u){u!==0&&(i.drawArraysInstanced(n,l,c,u),t.update(c,n,u))}function a(l,c,u){if(u===0)return;e.get("WEBGL_multi_draw").multiDrawArraysWEBGL(n,l,0,c,0,u);let d=0;for(let A=0;A<u;A++)d+=c[A];t.update(d,n,1)}this.setMode=r,this.render=s,this.renderInstances=o,this.renderMultiDraw=a}function Yve(i,e,t,n){let r;function s(){if(r!==void 0)return r;if(e.has("EXT_texture_filter_anisotropic")===!0){let L=e.get("EXT_texture_filter_anisotropic");r=i.getParameter(L.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else r=0;return r}function o(L){return!(L!==Or&&n.convert(L)!==i.getParameter(i.IMPLEMENTATION_COLOR_READ_FORMAT))}function a(L){let C=L===Wi&&(e.has("EXT_color_buffer_half_float")||e.has("EXT_color_buffer_float"));return!(L!==Ji&&n.convert(L)!==i.getParameter(i.IMPLEMENTATION_COLOR_READ_TYPE)&&L!==cr&&!C)}function l(L){if(L==="highp"){if(i.getShaderPrecisionFormat(i.VERTEX_SHADER,i.HIGH_FLOAT).precision>0&&i.getShaderPrecisionFormat(i.FRAGMENT_SHADER,i.HIGH_FLOAT).precision>0)return"highp";L="mediump"}return L==="mediump"&&i.getShaderPrecisionFormat(i.VERTEX_SHADER,i.MEDIUM_FLOAT).precision>0&&i.getShaderPrecisionFormat(i.FRAGMENT_SHADER,i.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}let c=t.precision!==void 0?t.precision:"highp",u=l(c);u!==c&&(Xe("WebGLRenderer:",c,"not supported, using",u,"instead."),c=u);let f=t.logarithmicDepthBuffer===!0,d=t.reversedDepthBuffer===!0&&e.has("EXT_clip_control");t.reversedDepthBuffer===!0&&d===!1&&Xe("WebGLRenderer: Unable to use reversed depth buffer due to missing EXT_clip_control extension. Fallback to default depth buffer.");let A=i.getParameter(i.MAX_TEXTURE_IMAGE_UNITS),y=i.getParameter(i.MAX_VERTEX_TEXTURE_IMAGE_UNITS),w=i.getParameter(i.MAX_TEXTURE_SIZE),S=i.getParameter(i.MAX_CUBE_MAP_TEXTURE_SIZE),T=i.getParameter(i.MAX_VERTEX_ATTRIBS),R=i.getParameter(i.MAX_VERTEX_UNIFORM_VECTORS),I=i.getParameter(i.MAX_VARYING_VECTORS),P=i.getParameter(i.MAX_FRAGMENT_UNIFORM_VECTORS),F=i.getParameter(i.MAX_SAMPLES),D=i.getParameter(i.SAMPLES);return{isWebGL2:!0,getMaxAnisotropy:s,getMaxPrecision:l,textureFormatReadable:o,textureTypeReadable:a,precision:c,logarithmicDepthBuffer:f,reversedDepthBuffer:d,maxTextures:A,maxVertexTextures:y,maxTextureSize:w,maxCubemapSize:S,maxAttributes:T,maxVertexUniforms:R,maxVaryings:I,maxFragmentUniforms:P,maxSamples:F,samples:D}}function Zve(i){let e=this,t=null,n=0,r=!1,s=!1,o=new Na,a=new Mn,l={value:null,needsUpdate:!1};this.uniform=l,this.numPlanes=0,this.numIntersection=0,this.init=function(f,d){let A=f.length!==0||d||n!==0||r;return r=d,n=f.length,A},this.beginShadows=function(){s=!0,u(null)},this.endShadows=function(){s=!1},this.setGlobalState=function(f,d){t=u(f,d,0)},this.setState=function(f,d,A){let y=f.clippingPlanes,w=f.clipIntersection,S=f.clipShadows,T=i.get(f);if(!r||y===null||y.length===0||s&&!S)s?u(null):c();else{let R=s?0:n,I=R*4,P=T.clippingState||null;l.value=P,P=u(y,d,I,A);for(let F=0;F!==I;++F)P[F]=t[F];T.clippingState=P,this.numIntersection=w?this.numPlanes:0,this.numPlanes+=R}};function c(){l.value!==t&&(l.value=t,l.needsUpdate=n>0),e.numPlanes=n,e.numIntersection=0}function u(f,d,A,y){let w=f!==null?f.length:0,S=null;if(w!==0){if(S=l.value,y!==!0||S===null){let T=A+w*4,R=d.matrixWorldInverse;a.getNormalMatrix(R),(S===null||S.length<T)&&(S=new Float32Array(T));for(let I=0,P=A;I!==w;++I,P+=4)o.copy(f[I]).applyMatrix4(R,a),o.normal.toArray(S,P),S[P+3]=o.constant}l.value=S,l.needsUpdate=!0}return e.numPlanes=w,e.numIntersection=0,S}}var H0=4,BZ=[.125,.215,.35,.446,.526,.582],pg=20,Kve=256,kb=new Du,OZ=new zt,MF=null,CF=0,RF=0,PF=!1,Qve=new re,HM=class{constructor(e){this._renderer=e,this._pingPongRenderTarget=null,this._lodMax=0,this._cubeSize=0,this._sizeLods=[],this._sigmas=[],this._lodMeshes=[],this._backgroundBox=null,this._cubemapMaterial=null,this._equirectMaterial=null,this._blurMaterial=null,this._ggxMaterial=null}fromScene(e,t=0,n=.1,r=100,s={}){let{size:o=256,position:a=Qve}=s;MF=this._renderer.getRenderTarget(),CF=this._renderer.getActiveCubeFace(),RF=this._renderer.getActiveMipmapLevel(),PF=this._renderer.xr.enabled,this._renderer.xr.enabled=!1,this._setSize(o);let l=this._allocateTargets();return l.depthBuffer=!0,this._sceneToCubeUV(e,n,r,l,a),t>0&&this._blur(l,0,0,t),this._applyPMREM(l),this._cleanup(l),l}fromEquirectangular(e,t=null){return this._fromTexture(e,t)}fromCubemap(e,t=null){return this._fromTexture(e,t)}compileCubemapShader(){this._cubemapMaterial===null&&(this._cubemapMaterial=zZ(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=kZ(),this._compileMaterial(this._equirectMaterial))}dispose(){this._dispose(),this._cubemapMaterial!==null&&this._cubemapMaterial.dispose(),this._equirectMaterial!==null&&this._equirectMaterial.dispose(),this._backgroundBox!==null&&(this._backgroundBox.geometry.dispose(),this._backgroundBox.material.dispose())}_setSize(e){this._lodMax=Math.floor(Math.log2(e)),this._cubeSize=Math.pow(2,this._lodMax)}_dispose(){this._blurMaterial!==null&&this._blurMaterial.dispose(),this._ggxMaterial!==null&&this._ggxMaterial.dispose(),this._pingPongRenderTarget!==null&&this._pingPongRenderTarget.dispose();for(let e=0;e<this._lodMeshes.length;e++)this._lodMeshes[e].geometry.dispose()}_cleanup(e){this._renderer.setRenderTarget(MF,CF,RF),this._renderer.xr.enabled=PF,e.scissorTest=!1,d_(e,0,0,e.width,e.height)}_fromTexture(e,t){e.mapping===ec||e.mapping===Gc?this._setSize(e.image.length===0?16:e.image[0].width||e.image[0].image.width):this._setSize(e.image.width/4),MF=this._renderer.getRenderTarget(),CF=this._renderer.getActiveCubeFace(),RF=this._renderer.getActiveMipmapLevel(),PF=this._renderer.xr.enabled,this._renderer.xr.enabled=!1;let n=t||this._allocateTargets();return this._textureToCubeUV(e,n),this._applyPMREM(n),this._cleanup(n),n}_allocateTargets(){let e=3*Math.max(this._cubeSize,112),t=4*this._cubeSize,n={magFilter:Mi,minFilter:Mi,generateMipmaps:!1,type:Wi,format:Or,colorSpace:t0,depthBuffer:!1},r=UZ(e,t,n);if(this._pingPongRenderTarget===null||this._pingPongRenderTarget.width!==e||this._pingPongRenderTarget.height!==t){this._pingPongRenderTarget!==null&&this._dispose(),this._pingPongRenderTarget=UZ(e,t,n);let{_lodMax:s}=this;({lodMeshes:this._lodMeshes,sizeLods:this._sizeLods,sigmas:this._sigmas}=Jve(s)),this._blurMaterial=t_e(s,e,t),this._ggxMaterial=e_e(s,e,t)}return r}_compileMaterial(e){let t=new Hn(new Xn,e);this._renderer.compile(t,kb)}_sceneToCubeUV(e,t,n,r,s){let l=new Yr(90,1,t,n),c=[1,-1,1,1,1,1],u=[1,1,1,-1,-1,-1],f=this._renderer,d=f.autoClear,A=f.toneMapping;f.getClearColor(OZ),f.toneMapping=ao,f.autoClear=!1,f.state.buffers.depth.getReversed()&&(f.setRenderTarget(r),f.clearDepth(),f.setRenderTarget(null)),this._backgroundBox===null&&(this._backgroundBox=new Hn(new Lu,new fs({name:"PMREM.Background",side:mi,depthWrite:!1,depthTest:!1})));let w=this._backgroundBox,S=w.material,T=!1,R=e.background;R?R.isColor&&(S.color.copy(R),e.background=null,T=!0):(S.color.copy(OZ),T=!0);for(let I=0;I<6;I++){let P=I%3;P===0?(l.up.set(0,c[I],0),l.position.set(s.x,s.y,s.z),l.lookAt(s.x+u[I],s.y,s.z)):P===1?(l.up.set(0,0,c[I]),l.position.set(s.x,s.y,s.z),l.lookAt(s.x,s.y+u[I],s.z)):(l.up.set(0,c[I],0),l.position.set(s.x,s.y,s.z),l.lookAt(s.x,s.y,s.z+u[I]));let F=this._cubeSize;d_(r,P*F,I>2?F:0,F,F),f.setRenderTarget(r),T&&f.render(w,l),f.render(e,l)}f.toneMapping=A,f.autoClear=d,e.background=R}_textureToCubeUV(e,t){let n=this._renderer,r=e.mapping===ec||e.mapping===Gc;r?(this._cubemapMaterial===null&&(this._cubemapMaterial=zZ()),this._cubemapMaterial.uniforms.flipEnvMap.value=e.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=kZ());let s=r?this._cubemapMaterial:this._equirectMaterial,o=this._lodMeshes[0];o.material=s;let a=s.uniforms;a.envMap.value=e;let l=this._cubeSize;d_(t,0,0,3*l,2*l),n.setRenderTarget(t),n.render(o,kb)}_applyPMREM(e){let t=this._renderer,n=t.autoClear;t.autoClear=!1;let r=this._lodMeshes.length;for(let s=1;s<r;s++)this._applyGGXFilter(e,s-1,s);t.autoClear=n}_applyGGXFilter(e,t,n){let r=this._renderer,s=this._pingPongRenderTarget,o=this._ggxMaterial,a=this._lodMeshes[n];a.material=o;let l=o.uniforms,c=n/(this._lodMeshes.length-1),u=t/(this._lodMeshes.length-1),f=Math.sqrt(c*c-u*u),d=0+c*1.25,A=f*d,{_lodMax:y}=this,w=this._sizeLods[n],S=3*w*(n>y-H0?n-y+H0:0),T=4*(this._cubeSize-w);l.envMap.value=e.texture,l.roughness.value=A,l.mipInt.value=y-t,d_(s,S,T,3*w,2*w),r.setRenderTarget(s),r.render(a,kb),l.envMap.value=s.texture,l.roughness.value=0,l.mipInt.value=y-n,d_(e,S,T,3*w,2*w),r.setRenderTarget(e),r.render(a,kb)}_blur(e,t,n,r,s){let o=this._pingPongRenderTarget;this._halfBlur(e,o,t,n,r,"latitudinal",s),this._halfBlur(o,e,n,n,r,"longitudinal",s)}_halfBlur(e,t,n,r,s,o,a){let l=this._renderer,c=this._blurMaterial;o!=="latitudinal"&&o!=="longitudinal"&&ze("blur direction must be either latitudinal or longitudinal!");let u=3,f=this._lodMeshes[r];f.material=c;let d=c.uniforms,A=this._sizeLods[n]-1,y=isFinite(s)?Math.PI/(2*A):2*Math.PI/(2*pg-1),w=s/y,S=isFinite(s)?1+Math.floor(u*w):pg;S>pg&&Xe(`sigmaRadians, ${s}, is too large and will clip, as it requested ${S} samples when the maximum is set to ${pg}`);let T=[],R=0;for(let L=0;L<pg;++L){let C=L/w,B=Math.exp(-C*C/2);T.push(B),L===0?R+=B:L<S&&(R+=2*B)}for(let L=0;L<T.length;L++)T[L]=T[L]/R;d.envMap.value=e.texture,d.samples.value=S,d.weights.value=T,d.latitudinal.value=o==="latitudinal",a&&(d.poleAxis.value=a);let{_lodMax:I}=this;d.dTheta.value=y,d.mipInt.value=I-n;let P=this._sizeLods[r],F=3*P*(r>I-H0?r-I+H0:0),D=4*(this._cubeSize-P);d_(t,F,D,3*P,2*P),l.setRenderTarget(t),l.render(f,kb)}};function Jve(i){let e=[],t=[],n=[],r=i,s=i-H0+1+BZ.length;for(let o=0;o<s;o++){let a=Math.pow(2,r);e.push(a);let l=1/a;o>i-H0?l=BZ[o-i+H0-1]:o===0&&(l=0),t.push(l);let c=1/(a-2),u=-c,f=1+c,d=[u,u,f,u,f,f,u,u,f,f,u,f],A=6,y=6,w=3,S=2,T=1,R=new Float32Array(w*y*A),I=new Float32Array(S*y*A),P=new Float32Array(T*y*A);for(let D=0;D<A;D++){let L=D%3*2/3-1,C=D>2?0:-1,B=[L,C,0,L+2/3,C,0,L+2/3,C+1,0,L,C,0,L+2/3,C+1,0,L,C+1,0];R.set(B,w*y*D),I.set(d,S*y*D);let k=[D,D,D,D,D,D];P.set(k,T*y*D)}let F=new Xn;F.setAttribute("position",new Hi(R,w)),F.setAttribute("uv",new Hi(I,S)),F.setAttribute("faceIndex",new Hi(P,T)),n.push(new Hn(F,null)),r>H0&&r--}return{lodMeshes:n,sizeLods:e,sigmas:t}}function UZ(i,e,t){let n=new Oa(i,e,t);return n.texture.mapping=Bh,n.texture.name="PMREM.cubeUv",n.scissorTest=!0,n}function d_(i,e,t,n,r){i.viewport.set(e,t,n,r),i.scissor.set(e,t,n,r)}function e_e(i,e,t){return new ds({name:"PMREMGGXConvolution",defines:{GGX_SAMPLES:Kve,CUBEUV_TEXEL_WIDTH:1/e,CUBEUV_TEXEL_HEIGHT:1/t,CUBEUV_MAX_MIP:`${i}.0`},uniforms:{envMap:{value:null},roughness:{value:0},mipInt:{value:0}},vertexShader:XM(),fragmentShader:`36813681 36823682 precision highp float;36833683 precision highp int;@@ -3781,7 +3781,7 @@ void main() {
37813781 37823782 gl_FragColor = vec4(prefilteredColor, 1.0);37833783 }3784- `,blending:ps,depthTest:!1,depthWrite:!1})}function xve(i,e,t){let n=new Float32Array(cg),r=new re(0,1,0);return new ds({name:"SphericalGaussianBlur",defines:{n:cg,CUBEUV_TEXEL_WIDTH:1/e,CUBEUV_TEXEL_HEIGHT:1/t,CUBEUV_MAX_MIP:`${i}.0`},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:n},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:r}},vertexShader:kM(),fragmentShader:`3784+ `,blending:ps,depthTest:!1,depthWrite:!1})}function t_e(i,e,t){let n=new Float32Array(pg),r=new re(0,1,0);return new ds({name:"SphericalGaussianBlur",defines:{n:pg,CUBEUV_TEXEL_WIDTH:1/e,CUBEUV_TEXEL_HEIGHT:1/t,CUBEUV_MAX_MIP:`${i}.0`},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:n},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:r}},vertexShader:XM(),fragmentShader:`37853785 37863786 precision mediump float;37873787 precision mediump int;@@ -3841,7 +3841,7 @@ void main() {
38413841 }38423842 38433843 }3844- `,blending:ps,depthTest:!1,depthWrite:!1})}function pZ(){return new ds({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:kM(),fragmentShader:`3844+ `,blending:ps,depthTest:!1,depthWrite:!1})}function kZ(){return new ds({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:XM(),fragmentShader:`38453845 38463846 precision mediump float;38473847 precision mediump int;@@ -3860,7 +3860,7 @@ void main() {
38603860 gl_FragColor = vec4( texture2D ( envMap, uv ).rgb, 1.0 );38613861 38623862 }3863- `,blending:ps,depthTest:!1,depthWrite:!1})}function mZ(){return new ds({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:kM(),fragmentShader:`3863+ `,blending:ps,depthTest:!1,depthWrite:!1})}function zZ(){return new ds({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:XM(),fragmentShader:`38643864 38653865 precision mediump float;38663866 precision mediump int;@@ -3876,7 +3876,7 @@ void main() {
38763876 gl_FragColor = textureCube( envMap, vec3( flipEnvMap * vOutputDirection.x, vOutputDirection.yz ) );38773877 38783878 }3879- `,blending:ps,depthTest:!1,depthWrite:!1})}function kM(){return`3879+ `,blending:ps,depthTest:!1,depthWrite:!1})}function XM(){return`38803880 38813881 precision mediump float;38823882 precision mediump int;@@ -3931,7 +3931,7 @@ void main() {
39313931 gl_Position = vec4( position, 1.0 );39323932 39333933 }3934- `}var OM=class extends Ba{constructor(e=1,t={}){super(e,e,t),this.isWebGLCubeRenderTarget=!0;let n={width:e,height:e,depth:1},r=[n,n,n,n,n,n];this.texture=new Ih(r),this._setTextureOptions(t),this.texture.isRenderTargetTexture=!0}fromEquirectangularTexture(e,t){this.texture.type=t.type,this.texture.colorSpace=t.colorSpace,this.texture.generateMipmaps=t.generateMipmaps,this.texture.minFilter=t.minFilter,this.texture.magFilter=t.magFilter;let n={uniforms:{tEquirect:{value:null}},vertexShader:`3934+ `}var WM=class extends Oa{constructor(e=1,t={}){super(e,e,t),this.isWebGLCubeRenderTarget=!0;let n={width:e,height:e,depth:1},r=[n,n,n,n,n,n];this.texture=new Ph(r),this._setTextureOptions(t),this.texture.isRenderTargetTexture=!0}fromEquirectangularTexture(e,t){this.texture.type=t.type,this.texture.colorSpace=t.colorSpace,this.texture.generateMipmaps=t.generateMipmaps,this.texture.minFilter=t.minFilter,this.texture.magFilter=t.magFilter;let n={uniforms:{tEquirect:{value:null}},vertexShader:`39353935 39363936 varying vec3 vWorldDirection;39373937 @@ -3966,7 +3966,7 @@ void main() {
39663966 gl_FragColor = texture2D( tEquirect, sampleUV );39673967 39683968 }3969- `},r=new Lu(5,5,5),s=new ds({name:"CubemapFromEquirect",uniforms:ag(n.uniforms),vertexShader:n.vertexShader,fragmentShader:n.fragmentShader,side:mi,blending:ps});s.uniforms.tEquirect.value=t;let o=new Hn(r,s),a=t.minFilter;return t.minFilter===Vo&&(t.minFilter=Mi),new e_(1,10,this).update(e,o),t.minFilter=a,o.geometry.dispose(),o.material.dispose(),this}clear(e,t=!0,n=!0,r=!0){let s=e.getRenderTarget();for(let o=0;o<6;o++)e.setRenderTarget(this,o),e.clear(t,n,r);e.setRenderTarget(s)}};function yve(i){let e=new WeakMap,t=new WeakMap,n=null;function r(d,A=!1){return d==null?null:A?o(d):s(d)}function s(d){if(d&&d.isTexture){let A=d.mapping;if(A===u0||A===h0)if(e.has(d)){let y=e.get(d).texture;return a(y,d.mapping)}else{let y=d.image;if(y&&y.height>0){let w=new OM(y.height);return w.fromEquirectangularTexture(i,d),e.set(d,w),d.addEventListener("dispose",c),a(w.texture,d.mapping)}else return null}}return d}function o(d){if(d&&d.isTexture){let A=d.mapping,y=A===u0||A===h0,w=A===Kl||A===Gc;if(y||w){let S=t.get(d),T=S!==void 0?S.texture.pmremVersion:0;if(d.isRenderTargetTexture&&d.pmremVersion!==T)return n===null&&(n=new BM(i)),S=y?n.fromEquirectangular(d,S):n.fromCubemap(d,S),S.texture.pmremVersion=d.pmremVersion,t.set(d,S),S.texture;if(S!==void 0)return S.texture;{let R=d.image;return y&&R&&R.height>0||w&&R&&l(R)?(n===null&&(n=new BM(i)),S=y?n.fromEquirectangular(d):n.fromCubemap(d),S.texture.pmremVersion=d.pmremVersion,t.set(d,S),d.addEventListener("dispose",u),S.texture):null}}}return d}function a(d,A){return A===u0?d.mapping=Kl:A===h0&&(d.mapping=Gc),d}function l(d){let A=0,y=6;for(let w=0;w<y;w++)d[w]!==void 0&&A++;return A===y}function c(d){let A=d.target;A.removeEventListener("dispose",c);let y=e.get(A);y!==void 0&&(e.delete(A),y.dispose())}function u(d){let A=d.target;A.removeEventListener("dispose",u);let y=t.get(A);y!==void 0&&(t.delete(A),y.dispose())}function f(){e=new WeakMap,t=new WeakMap,n!==null&&(n.dispose(),n=null)}return{get:r,dispose:f}}function bve(i){let e={};function t(n){if(e[n]!==void 0)return e[n];let r=i.getExtension(n);return e[n]=r,r}return{has:function(n){return t(n)!==null},init:function(){t("EXT_color_buffer_float"),t("WEBGL_clip_cull_distance"),t("OES_texture_float_linear"),t("EXT_color_buffer_half_float"),t("WEBGL_multisampled_render_to_texture"),t("WEBGL_render_shared_exponent")},get:function(n){let r=t(n);return r===null&&ni("WebGLRenderer: "+n+" extension not supported."),r}}}function wve(i,e,t,n){let r={},s=new WeakMap;function o(f){let d=f.target;d.index!==null&&e.remove(d.index);for(let y in d.attributes)e.remove(d.attributes[y]);d.removeEventListener("dispose",o),delete r[d.id];let A=s.get(d);A&&(e.remove(A),s.delete(d)),n.releaseStatesOfGeometry(d),d.isInstancedBufferGeometry===!0&&delete d._maxInstanceCount,t.memory.geometries--}function a(f,d){return r[d.id]===!0||(d.addEventListener("dispose",o),r[d.id]=!0,t.memory.geometries++),d}function l(f){let d=f.attributes;for(let A in d)e.update(d[A],i.ARRAY_BUFFER)}function c(f){let d=[],A=f.index,y=f.attributes.position,w=0;if(y===void 0)return;if(A!==null){let R=A.array;w=A.version;for(let P=0,I=R.length;P<I;P+=3){let F=R[P+0],D=R[P+1],L=R[P+2];d.push(F,D,D,L,L,F)}}else{let R=y.array;w=y.version;for(let P=0,I=R.length/3-1;P<I;P+=3){let F=P+0,D=P+1,L=P+2;d.push(F,D,D,L,L,F)}}let S=new(y.count>=65535?OA:BA)(d,1);S.version=w;let T=s.get(f);T&&e.remove(T),s.set(f,S)}function u(f){let d=s.get(f);if(d){let A=f.index;A!==null&&d.version<A.version&&c(f)}else c(f);return s.get(f)}return{get:a,update:l,getWireframeAttribute:u}}function Sve(i,e,t){let n;function r(f){n=f}let s,o;function a(f){s=f.type,o=f.bytesPerElement}function l(f,d){i.drawElements(n,d,s,f*o),t.update(d,n,1)}function c(f,d,A){A!==0&&(i.drawElementsInstanced(n,d,s,f*o,A),t.update(d,n,A))}function u(f,d,A){if(A===0)return;e.get("WEBGL_multi_draw").multiDrawElementsWEBGL(n,d,0,s,f,0,A);let w=0;for(let S=0;S<A;S++)w+=d[S];t.update(w,n,1)}this.setMode=r,this.setIndex=a,this.render=l,this.renderInstances=c,this.renderMultiDraw=u}function Tve(i){let e={geometries:0,textures:0},t={frame:0,calls:0,triangles:0,points:0,lines:0};function n(s,o,a){switch(t.calls++,o){case i.TRIANGLES:t.triangles+=a*(s/3);break;case i.LINES:t.lines+=a*(s/2);break;case i.LINE_STRIP:t.lines+=a*(s-1);break;case i.LINE_LOOP:t.lines+=a*s;break;case i.POINTS:t.points+=a*s;break;default:ze("WebGLInfo: Unknown draw mode:",o);break}}function r(){t.calls=0,t.triangles=0,t.points=0,t.lines=0}return{memory:e,render:t,programs:null,autoReset:!0,reset:r,update:n}}function Eve(i,e,t){let n=new WeakMap,r=new xn;function s(o,a,l){let c=o.morphTargetInfluences,u=a.morphAttributes.position||a.morphAttributes.normal||a.morphAttributes.color,f=u!==void 0?u.length:0,d=n.get(a);if(d===void 0||d.count!==f){let B=function(){L.dispose(),n.delete(a),a.removeEventListener("dispose",B)};d!==void 0&&d.texture.dispose();let A=a.morphAttributes.position!==void 0,y=a.morphAttributes.normal!==void 0,w=a.morphAttributes.color!==void 0,S=a.morphAttributes.position||[],T=a.morphAttributes.normal||[],R=a.morphAttributes.color||[],P=0;A===!0&&(P=1),y===!0&&(P=2),w===!0&&(P=3);let I=a.attributes.position.count*P,F=1;I>e.maxTextureSize&&(F=Math.ceil(I/e.maxTextureSize),I=e.maxTextureSize);let D=new Float32Array(I*F*4*f),L=new FA(D,I,F,f);L.type=cr,L.needsUpdate=!0;let C=P*4;for(let k=0;k<f;k++){let z=S[k],G=T[k],W=R[k],Y=I*F*4*k;for(let H=0;H<z.count;H++){let $=H*C;A===!0&&(r.fromBufferAttribute(z,H),D[Y+$+0]=r.x,D[Y+$+1]=r.y,D[Y+$+2]=r.z,D[Y+$+3]=0),y===!0&&(r.fromBufferAttribute(G,H),D[Y+$+4]=r.x,D[Y+$+5]=r.y,D[Y+$+6]=r.z,D[Y+$+7]=0),w===!0&&(r.fromBufferAttribute(W,H),D[Y+$+8]=r.x,D[Y+$+9]=r.y,D[Y+$+10]=r.z,D[Y+$+11]=W.itemSize===4?r.w:1)}}d={count:f,texture:L,size:new Oe(I,F)},n.set(a,d),a.addEventListener("dispose",B)}if(o.isInstancedMesh===!0&&o.morphTexture!==null)l.getUniforms().setValue(i,"morphTexture",o.morphTexture,t);else{let A=0;for(let w=0;w<c.length;w++)A+=c[w];let y=a.morphTargetsRelative?1:1-A;l.getUniforms().setValue(i,"morphTargetBaseInfluence",y),l.getUniforms().setValue(i,"morphTargetInfluences",c)}l.getUniforms().setValue(i,"morphTargetsTexture",d.texture,t),l.getUniforms().setValue(i,"morphTargetsTextureSize",d.size)}return{update:s}}function Mve(i,e,t,n,r){let s=new WeakMap;function o(c){let u=r.render.frame,f=c.geometry,d=e.get(c,f);if(s.get(d)!==u&&(e.update(d),s.set(d,u)),c.isInstancedMesh&&(c.hasEventListener("dispose",l)===!1&&c.addEventListener("dispose",l),s.get(c)!==u&&(t.update(c.instanceMatrix,i.ARRAY_BUFFER),c.instanceColor!==null&&t.update(c.instanceColor,i.ARRAY_BUFFER),s.set(c,u))),c.isSkinnedMesh){let A=c.skeleton;s.get(A)!==u&&(A.update(),s.set(A,u))}return d}function a(){s=new WeakMap}function l(c){let u=c.target;u.removeEventListener("dispose",l),n.releaseStatesOfObject(u),t.remove(u.instanceMatrix),u.instanceColor!==null&&t.remove(u.instanceColor)}return{update:o,dispose:a}}var Cve={[gb]:"LINEAR_TONE_MAPPING",[vb]:"REINHARD_TONE_MAPPING",[_b]:"CINEON_TONE_MAPPING",[xb]:"ACES_FILMIC_TONE_MAPPING",[yb]:"AGX_TONE_MAPPING",[bb]:"NEUTRAL_TONE_MAPPING",[R8]:"CUSTOM_TONE_MAPPING"};function Rve(i,e,t,n,r,s){let o=new Ba(e,t,{type:i,depthBuffer:r,stencilBuffer:s,samples:n?4:0,depthTexture:r?new Cs(e,t):void 0}),a=new Ba(e,t,{type:Wi,depthBuffer:!1,stencilBuffer:!1}),l=new Xn;l.setAttribute("position",new Ln([-1,3,0,-1,-1,0,3,-1,0],3)),l.setAttribute("uv",new Ln([0,2,0,0,2,0],2));let c=new aM({uniforms:{tDiffuse:{value:null}},vertexShader:`3969+ `},r=new Lu(5,5,5),s=new ds({name:"CubemapFromEquirect",uniforms:fg(n.uniforms),vertexShader:n.vertexShader,fragmentShader:n.fragmentShader,side:mi,blending:ps});s.uniforms.tEquirect.value=t;let o=new Hn(r,s),a=t.minFilter;return t.minFilter===Go&&(t.minFilter=Mi),new o_(1,10,this).update(e,o),t.minFilter=a,o.geometry.dispose(),o.material.dispose(),this}clear(e,t=!0,n=!0,r=!0){let s=e.getRenderTarget();for(let o=0;o<6;o++)e.setRenderTarget(this,o),e.clear(t,n,r);e.setRenderTarget(s)}};function n_e(i){let e=new WeakMap,t=new WeakMap,n=null;function r(d,A=!1){return d==null?null:A?o(d):s(d)}function s(d){if(d&&d.isTexture){let A=d.mapping;if(A===p0||A===m0)if(e.has(d)){let y=e.get(d).texture;return a(y,d.mapping)}else{let y=d.image;if(y&&y.height>0){let w=new WM(y.height);return w.fromEquirectangularTexture(i,d),e.set(d,w),d.addEventListener("dispose",c),a(w.texture,d.mapping)}else return null}}return d}function o(d){if(d&&d.isTexture){let A=d.mapping,y=A===p0||A===m0,w=A===ec||A===Gc;if(y||w){let S=t.get(d),T=S!==void 0?S.texture.pmremVersion:0;if(d.isRenderTargetTexture&&d.pmremVersion!==T)return n===null&&(n=new HM(i)),S=y?n.fromEquirectangular(d,S):n.fromCubemap(d,S),S.texture.pmremVersion=d.pmremVersion,t.set(d,S),S.texture;if(S!==void 0)return S.texture;{let R=d.image;return y&&R&&R.height>0||w&&R&&l(R)?(n===null&&(n=new HM(i)),S=y?n.fromEquirectangular(d):n.fromCubemap(d),S.texture.pmremVersion=d.pmremVersion,t.set(d,S),d.addEventListener("dispose",u),S.texture):null}}}return d}function a(d,A){return A===p0?d.mapping=ec:A===m0&&(d.mapping=Gc),d}function l(d){let A=0,y=6;for(let w=0;w<y;w++)d[w]!==void 0&&A++;return A===y}function c(d){let A=d.target;A.removeEventListener("dispose",c);let y=e.get(A);y!==void 0&&(e.delete(A),y.dispose())}function u(d){let A=d.target;A.removeEventListener("dispose",u);let y=t.get(A);y!==void 0&&(t.delete(A),y.dispose())}function f(){e=new WeakMap,t=new WeakMap,n!==null&&(n.dispose(),n=null)}return{get:r,dispose:f}}function i_e(i){let e={};function t(n){if(e[n]!==void 0)return e[n];let r=i.getExtension(n);return e[n]=r,r}return{has:function(n){return t(n)!==null},init:function(){t("EXT_color_buffer_float"),t("WEBGL_clip_cull_distance"),t("OES_texture_float_linear"),t("EXT_color_buffer_half_float"),t("WEBGL_multisampled_render_to_texture"),t("WEBGL_render_shared_exponent")},get:function(n){let r=t(n);return r===null&&ni("WebGLRenderer: "+n+" extension not supported."),r}}}function r_e(i,e,t,n){let r={},s=new WeakMap;function o(f){let d=f.target;d.index!==null&&e.remove(d.index);for(let y in d.attributes)e.remove(d.attributes[y]);d.removeEventListener("dispose",o),delete r[d.id];let A=s.get(d);A&&(e.remove(A),s.delete(d)),n.releaseStatesOfGeometry(d),d.isInstancedBufferGeometry===!0&&delete d._maxInstanceCount,t.memory.geometries--}function a(f,d){return r[d.id]===!0||(d.addEventListener("dispose",o),r[d.id]=!0,t.memory.geometries++),d}function l(f){let d=f.attributes;for(let A in d)e.update(d[A],i.ARRAY_BUFFER)}function c(f){let d=[],A=f.index,y=f.attributes.position,w=0;if(y===void 0)return;if(A!==null){let R=A.array;w=A.version;for(let I=0,P=R.length;I<P;I+=3){let F=R[I+0],D=R[I+1],L=R[I+2];d.push(F,D,D,L,L,F)}}else{let R=y.array;w=y.version;for(let I=0,P=R.length/3-1;I<P;I+=3){let F=I+0,D=I+1,L=I+2;d.push(F,D,D,L,L,F)}}let S=new(y.count>=65535?GA:VA)(d,1);S.version=w;let T=s.get(f);T&&e.remove(T),s.set(f,S)}function u(f){let d=s.get(f);if(d){let A=f.index;A!==null&&d.version<A.version&&c(f)}else c(f);return s.get(f)}return{get:a,update:l,getWireframeAttribute:u}}function s_e(i,e,t){let n;function r(f){n=f}let s,o;function a(f){s=f.type,o=f.bytesPerElement}function l(f,d){i.drawElements(n,d,s,f*o),t.update(d,n,1)}function c(f,d,A){A!==0&&(i.drawElementsInstanced(n,d,s,f*o,A),t.update(d,n,A))}function u(f,d,A){if(A===0)return;e.get("WEBGL_multi_draw").multiDrawElementsWEBGL(n,d,0,s,f,0,A);let w=0;for(let S=0;S<A;S++)w+=d[S];t.update(w,n,1)}this.setMode=r,this.setIndex=a,this.render=l,this.renderInstances=c,this.renderMultiDraw=u}function o_e(i){let e={geometries:0,textures:0},t={frame:0,calls:0,triangles:0,points:0,lines:0};function n(s,o,a){switch(t.calls++,o){case i.TRIANGLES:t.triangles+=a*(s/3);break;case i.LINES:t.lines+=a*(s/2);break;case i.LINE_STRIP:t.lines+=a*(s-1);break;case i.LINE_LOOP:t.lines+=a*s;break;case i.POINTS:t.points+=a*s;break;default:ze("WebGLInfo: Unknown draw mode:",o);break}}function r(){t.calls=0,t.triangles=0,t.points=0,t.lines=0}return{memory:e,render:t,programs:null,autoReset:!0,reset:r,update:n}}function a_e(i,e,t){let n=new WeakMap,r=new xn;function s(o,a,l){let c=o.morphTargetInfluences,u=a.morphAttributes.position||a.morphAttributes.normal||a.morphAttributes.color,f=u!==void 0?u.length:0,d=n.get(a);if(d===void 0||d.count!==f){let B=function(){L.dispose(),n.delete(a),a.removeEventListener("dispose",B)};d!==void 0&&d.texture.dispose();let A=a.morphAttributes.position!==void 0,y=a.morphAttributes.normal!==void 0,w=a.morphAttributes.color!==void 0,S=a.morphAttributes.position||[],T=a.morphAttributes.normal||[],R=a.morphAttributes.color||[],I=0;A===!0&&(I=1),y===!0&&(I=2),w===!0&&(I=3);let P=a.attributes.position.count*I,F=1;P>e.maxTextureSize&&(F=Math.ceil(P/e.maxTextureSize),P=e.maxTextureSize);let D=new Float32Array(P*F*4*f),L=new zA(D,P,F,f);L.type=cr,L.needsUpdate=!0;let C=I*4;for(let k=0;k<f;k++){let z=S[k],G=T[k],W=R[k],Y=P*F*4*k;for(let H=0;H<z.count;H++){let $=H*C;A===!0&&(r.fromBufferAttribute(z,H),D[Y+$+0]=r.x,D[Y+$+1]=r.y,D[Y+$+2]=r.z,D[Y+$+3]=0),y===!0&&(r.fromBufferAttribute(G,H),D[Y+$+4]=r.x,D[Y+$+5]=r.y,D[Y+$+6]=r.z,D[Y+$+7]=0),w===!0&&(r.fromBufferAttribute(W,H),D[Y+$+8]=r.x,D[Y+$+9]=r.y,D[Y+$+10]=r.z,D[Y+$+11]=W.itemSize===4?r.w:1)}}d={count:f,texture:L,size:new Oe(P,F)},n.set(a,d),a.addEventListener("dispose",B)}if(o.isInstancedMesh===!0&&o.morphTexture!==null)l.getUniforms().setValue(i,"morphTexture",o.morphTexture,t);else{let A=0;for(let w=0;w<c.length;w++)A+=c[w];let y=a.morphTargetsRelative?1:1-A;l.getUniforms().setValue(i,"morphTargetBaseInfluence",y),l.getUniforms().setValue(i,"morphTargetInfluences",c)}l.getUniforms().setValue(i,"morphTargetsTexture",d.texture,t),l.getUniforms().setValue(i,"morphTargetsTextureSize",d.size)}return{update:s}}function l_e(i,e,t,n,r){let s=new WeakMap;function o(c){let u=r.render.frame,f=c.geometry,d=e.get(c,f);if(s.get(d)!==u&&(e.update(d),s.set(d,u)),c.isInstancedMesh&&(c.hasEventListener("dispose",l)===!1&&c.addEventListener("dispose",l),s.get(c)!==u&&(t.update(c.instanceMatrix,i.ARRAY_BUFFER),c.instanceColor!==null&&t.update(c.instanceColor,i.ARRAY_BUFFER),s.set(c,u))),c.isSkinnedMesh){let A=c.skeleton;s.get(A)!==u&&(A.update(),s.set(A,u))}return d}function a(){s=new WeakMap}function l(c){let u=c.target;u.removeEventListener("dispose",l),n.releaseStatesOfObject(u),t.remove(u.instanceMatrix),u.instanceColor!==null&&t.remove(u.instanceColor)}return{update:o,dispose:a}}var c_e={[wb]:"LINEAR_TONE_MAPPING",[Sb]:"REINHARD_TONE_MAPPING",[Tb]:"CINEON_TONE_MAPPING",[Eb]:"ACES_FILMIC_TONE_MAPPING",[Mb]:"AGX_TONE_MAPPING",[Cb]:"NEUTRAL_TONE_MAPPING",[Z8]:"CUSTOM_TONE_MAPPING"};function u_e(i,e,t,n,r,s){let o=new Oa(e,t,{type:i,depthBuffer:r,stencilBuffer:s,samples:n?4:0,depthTexture:r?new Es(e,t):void 0}),a=new Oa(e,t,{type:Wi,depthBuffer:!1,stencilBuffer:!1}),l=new Xn;l.setAttribute("position",new Ln([-1,3,0,-1,-1,0,3,-1,0],3)),l.setAttribute("uv",new Ln([0,2,0,0,2,0],2));let c=new mM({uniforms:{tDiffuse:{value:null}},vertexShader:`39703970 precision highp float;39713971 39723972 uniform mat4 modelViewMatrix;@@ -4012,17 +4012,17 @@ void main() {
40124012 #ifdef SRGB_TRANSFER40134013 gl_FragColor = sRGBTransferOETF( gl_FragColor );40144014 #endif4015- }`,depthTest:!1,depthWrite:!1}),u=new Hn(l,c),f=new Du(-1,1,1,-1,0,1),d=null,A=null,y=!1,w,S=null,T=[],R=!1;this.setSize=function(P,I){o.setSize(P,I),a.setSize(P,I);for(let F=0;F<T.length;F++){let D=T[F];D.setSize&&D.setSize(P,I)}},this.setEffects=function(P){T=P,R=T.length>0&&T[0].isRenderPass===!0;let I=o.width,F=o.height;for(let D=0;D<T.length;D++){let L=T[D];L.setSize&&L.setSize(I,F)}},this.begin=function(P,I){if(y||P.toneMapping===ao&&T.length===0)return!1;if(S=I,I!==null){let F=I.width,D=I.height;(o.width!==F||o.height!==D)&&this.setSize(F,D)}return R===!1&&P.setRenderTarget(o),w=P.toneMapping,P.toneMapping=ao,!0},this.hasRenderPass=function(){return R},this.end=function(P,I){P.toneMapping=w,y=!0;let F=o,D=a;for(let L=0;L<T.length;L++){let C=T[L];if(C.enabled!==!1&&(C.render(P,D,F,I),C.needsSwap!==!1)){let B=F;F=D,D=B}}if(d!==P.outputColorSpace||A!==P.toneMapping){d=P.outputColorSpace,A=P.toneMapping,c.defines={},ln.getTransfer(d)===kt&&(c.defines.SRGB_TRANSFER="");let L=Cve[A];L&&(c.defines[L]=""),c.needsUpdate=!0}c.uniforms.tDiffuse.value=F.texture,P.setRenderTarget(S),P.render(u,f),S=null,y=!1},this.isCompositing=function(){return y},this.dispose=function(){o.depthTexture&&o.depthTexture.dispose(),o.dispose(),a.dispose(),l.dispose(),c.dispose()}}var BZ=new Hs,fF=new Cs(1,1),OZ=new FA,UZ=new J3,kZ=new Ih,AZ=[],gZ=[],vZ=new Float32Array(16),_Z=new Float32Array(9),xZ=new Float32Array(4);function c_(i,e,t){let n=i[0];if(n<=0||n>0)return i;let r=e*t,s=AZ[r];if(s===void 0&&(s=new Float32Array(r),AZ[r]=s),e!==0){n.toArray(s,0);for(let o=1,a=0;o!==e;++o)a+=t,i[o].toArray(s,a)}return s}function lo(i,e){if(i.length!==e.length)return!1;for(let t=0,n=i.length;t<n;t++)if(i[t]!==e[t])return!1;return!0}function co(i,e){for(let t=0,n=e.length;t<n;t++)i[t]=e[t]}function zM(i,e){let t=gZ[e];t===void 0&&(t=new Int32Array(e),gZ[e]=t);for(let n=0;n!==e;++n)t[n]=i.allocateTextureUnit();return t}function Ive(i,e){let t=this.cache;t[0]!==e&&(i.uniform1f(this.addr,e),t[0]=e)}function Pve(i,e){let t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y)&&(i.uniform2f(this.addr,e.x,e.y),t[0]=e.x,t[1]=e.y);else{if(lo(t,e))return;i.uniform2fv(this.addr,e),co(t,e)}}function Lve(i,e){let t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z)&&(i.uniform3f(this.addr,e.x,e.y,e.z),t[0]=e.x,t[1]=e.y,t[2]=e.z);else if(e.r!==void 0)(t[0]!==e.r||t[1]!==e.g||t[2]!==e.b)&&(i.uniform3f(this.addr,e.r,e.g,e.b),t[0]=e.r,t[1]=e.g,t[2]=e.b);else{if(lo(t,e))return;i.uniform3fv(this.addr,e),co(t,e)}}function Dve(i,e){let t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z||t[3]!==e.w)&&(i.uniform4f(this.addr,e.x,e.y,e.z,e.w),t[0]=e.x,t[1]=e.y,t[2]=e.z,t[3]=e.w);else{if(lo(t,e))return;i.uniform4fv(this.addr,e),co(t,e)}}function Nve(i,e){let t=this.cache,n=e.elements;if(n===void 0){if(lo(t,e))return;i.uniformMatrix2fv(this.addr,!1,e),co(t,e)}else{if(lo(t,n))return;xZ.set(n),i.uniformMatrix2fv(this.addr,!1,xZ),co(t,n)}}function Fve(i,e){let t=this.cache,n=e.elements;if(n===void 0){if(lo(t,e))return;i.uniformMatrix3fv(this.addr,!1,e),co(t,e)}else{if(lo(t,n))return;_Z.set(n),i.uniformMatrix3fv(this.addr,!1,_Z),co(t,n)}}function Bve(i,e){let t=this.cache,n=e.elements;if(n===void 0){if(lo(t,e))return;i.uniformMatrix4fv(this.addr,!1,e),co(t,e)}else{if(lo(t,n))return;vZ.set(n),i.uniformMatrix4fv(this.addr,!1,vZ),co(t,n)}}function Ove(i,e){let t=this.cache;t[0]!==e&&(i.uniform1i(this.addr,e),t[0]=e)}function Uve(i,e){let t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y)&&(i.uniform2i(this.addr,e.x,e.y),t[0]=e.x,t[1]=e.y);else{if(lo(t,e))return;i.uniform2iv(this.addr,e),co(t,e)}}function kve(i,e){let t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z)&&(i.uniform3i(this.addr,e.x,e.y,e.z),t[0]=e.x,t[1]=e.y,t[2]=e.z);else{if(lo(t,e))return;i.uniform3iv(this.addr,e),co(t,e)}}function zve(i,e){let t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z||t[3]!==e.w)&&(i.uniform4i(this.addr,e.x,e.y,e.z,e.w),t[0]=e.x,t[1]=e.y,t[2]=e.z,t[3]=e.w);else{if(lo(t,e))return;i.uniform4iv(this.addr,e),co(t,e)}}function Vve(i,e){let t=this.cache;t[0]!==e&&(i.uniform1ui(this.addr,e),t[0]=e)}function Gve(i,e){let t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y)&&(i.uniform2ui(this.addr,e.x,e.y),t[0]=e.x,t[1]=e.y);else{if(lo(t,e))return;i.uniform2uiv(this.addr,e),co(t,e)}}function qve(i,e){let t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z)&&(i.uniform3ui(this.addr,e.x,e.y,e.z),t[0]=e.x,t[1]=e.y,t[2]=e.z);else{if(lo(t,e))return;i.uniform3uiv(this.addr,e),co(t,e)}}function Hve(i,e){let t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z||t[3]!==e.w)&&(i.uniform4ui(this.addr,e.x,e.y,e.z,e.w),t[0]=e.x,t[1]=e.y,t[2]=e.z,t[3]=e.w);else{if(lo(t,e))return;i.uniform4uiv(this.addr,e),co(t,e)}}function Wve(i,e,t){let n=this.cache,r=t.allocateTextureUnit();n[0]!==r&&(i.uniform1i(this.addr,r),n[0]=r);let s;this.type===i.SAMPLER_2D_SHADOW?(fF.compareFunction=t.isReversedDepthBuffer()?Fu:Xh,s=fF):s=BZ,t.setTexture2D(e||s,r)}function jve(i,e,t){let n=this.cache,r=t.allocateTextureUnit();n[0]!==r&&(i.uniform1i(this.addr,r),n[0]=r),t.setTexture3D(e||UZ,r)}function Xve(i,e,t){let n=this.cache,r=t.allocateTextureUnit();n[0]!==r&&(i.uniform1i(this.addr,r),n[0]=r),t.setTextureCube(e||kZ,r)}function $ve(i,e,t){let n=this.cache,r=t.allocateTextureUnit();n[0]!==r&&(i.uniform1i(this.addr,r),n[0]=r),t.setTexture2DArray(e||OZ,r)}function Yve(i){switch(i){case 5126:return Ive;case 35664:return Pve;case 35665:return Lve;case 35666:return Dve;case 35674:return Nve;case 35675:return Fve;case 35676:return Bve;case 5124:case 35670:return Ove;case 35667:case 35671:return Uve;case 35668:case 35672:return kve;case 35669:case 35673:return zve;case 5125:return Vve;case 36294:return Gve;case 36295:return qve;case 36296:return Hve;case 35678:case 36198:case 36298:case 36306:case 35682:return Wve;case 35679:case 36299:case 36307:return jve;case 35680:case 36300:case 36308:case 36293:return Xve;case 36289:case 36303:case 36311:case 36292:return $ve}}function Zve(i,e){i.uniform1fv(this.addr,e)}function Kve(i,e){let t=c_(e,this.size,2);i.uniform2fv(this.addr,t)}function Qve(i,e){let t=c_(e,this.size,3);i.uniform3fv(this.addr,t)}function Jve(i,e){let t=c_(e,this.size,4);i.uniform4fv(this.addr,t)}function e_e(i,e){let t=c_(e,this.size,4);i.uniformMatrix2fv(this.addr,!1,t)}function t_e(i,e){let t=c_(e,this.size,9);i.uniformMatrix3fv(this.addr,!1,t)}function n_e(i,e){let t=c_(e,this.size,16);i.uniformMatrix4fv(this.addr,!1,t)}function i_e(i,e){i.uniform1iv(this.addr,e)}function r_e(i,e){i.uniform2iv(this.addr,e)}function s_e(i,e){i.uniform3iv(this.addr,e)}function o_e(i,e){i.uniform4iv(this.addr,e)}function a_e(i,e){i.uniform1uiv(this.addr,e)}function l_e(i,e){i.uniform2uiv(this.addr,e)}function c_e(i,e){i.uniform3uiv(this.addr,e)}function u_e(i,e){i.uniform4uiv(this.addr,e)}function h_e(i,e,t){let n=this.cache,r=e.length,s=zM(t,r);lo(n,s)||(i.uniform1iv(this.addr,s),co(n,s));let o;this.type===i.SAMPLER_2D_SHADOW?o=fF:o=BZ;for(let a=0;a!==r;++a)t.setTexture2D(e[a]||o,s[a])}function f_e(i,e,t){let n=this.cache,r=e.length,s=zM(t,r);lo(n,s)||(i.uniform1iv(this.addr,s),co(n,s));for(let o=0;o!==r;++o)t.setTexture3D(e[o]||UZ,s[o])}function d_e(i,e,t){let n=this.cache,r=e.length,s=zM(t,r);lo(n,s)||(i.uniform1iv(this.addr,s),co(n,s));for(let o=0;o!==r;++o)t.setTextureCube(e[o]||kZ,s[o])}function p_e(i,e,t){let n=this.cache,r=e.length,s=zM(t,r);lo(n,s)||(i.uniform1iv(this.addr,s),co(n,s));for(let o=0;o!==r;++o)t.setTexture2DArray(e[o]||OZ,s[o])}function m_e(i){switch(i){case 5126:return Zve;case 35664:return Kve;case 35665:return Qve;case 35666:return Jve;case 35674:return e_e;case 35675:return t_e;case 35676:return n_e;case 5124:case 35670:return i_e;case 35667:case 35671:return r_e;case 35668:case 35672:return s_e;case 35669:case 35673:return o_e;case 5125:return a_e;case 36294:return l_e;case 36295:return c_e;case 36296:return u_e;case 35678:case 36198:case 36298:case 36306:case 35682:return h_e;case 35679:case 36299:case 36307:return f_e;case 35680:case 36300:case 36308:case 36293:return d_e;case 36289:case 36303:case 36311:case 36292:return p_e}}var dF=class{constructor(e,t,n){this.id=e,this.addr=n,this.cache=[],this.type=t.type,this.setValue=Yve(t.type)}},pF=class{constructor(e,t,n){this.id=e,this.addr=n,this.cache=[],this.type=t.type,this.size=t.size,this.setValue=m_e(t.type)}},mF=class{constructor(e){this.id=e,this.seq=[],this.map={}}setValue(e,t,n){let r=this.seq;for(let s=0,o=r.length;s!==o;++s){let a=r[s];a.setValue(e,t[a.id],n)}}},uF=/(\w+)(\])?(\[|\.)?/g;function yZ(i,e){i.seq.push(e),i.map[e.id]=e}function A_e(i,e,t){let n=i.name,r=n.length;for(uF.lastIndex=0;;){let s=uF.exec(n),o=uF.lastIndex,a=s[1],l=s[2]==="]",c=s[3];if(l&&(a=a|0),c===void 0||c==="["&&o+2===r){yZ(t,c===void 0?new dF(a,i,e):new pF(a,i,e));break}else{let f=t.map[a];f===void 0&&(f=new mF(a),yZ(t,f)),t=f}}}var l_=class{constructor(e,t){this.seq=[],this.map={};let n=e.getProgramParameter(t,e.ACTIVE_UNIFORMS);for(let o=0;o<n;++o){let a=e.getActiveUniform(t,o),l=e.getUniformLocation(t,a.name);A_e(a,l,this)}let r=[],s=[];for(let o of this.seq)o.type===e.SAMPLER_2D_SHADOW||o.type===e.SAMPLER_CUBE_SHADOW||o.type===e.SAMPLER_2D_ARRAY_SHADOW?r.push(o):s.push(o);r.length>0&&(this.seq=r.concat(s))}setValue(e,t,n,r){let s=this.map[t];s!==void 0&&s.setValue(e,n,r)}setOptional(e,t,n){let r=t[n];r!==void 0&&this.setValue(e,n,r)}static upload(e,t,n,r){for(let s=0,o=t.length;s!==o;++s){let a=t[s],l=n[a.id];l.needsUpdate!==!1&&a.setValue(e,l.value,r)}}static seqWithValue(e,t){let n=[];for(let r=0,s=e.length;r!==s;++r){let o=e[r];o.id in t&&n.push(o)}return n}};function bZ(i,e,t){let n=i.createShader(e);return i.shaderSource(n,t),i.compileShader(n),n}var g_e=37297,v_e=0;function __e(i,e){let t=i.split(`4015+ }`,depthTest:!1,depthWrite:!1}),u=new Hn(l,c),f=new Du(-1,1,1,-1,0,1),d=null,A=null,y=!1,w,S=null,T=[],R=!1;this.setSize=function(I,P){o.setSize(I,P),a.setSize(I,P);for(let F=0;F<T.length;F++){let D=T[F];D.setSize&&D.setSize(I,P)}},this.setEffects=function(I){T=I,R=T.length>0&&T[0].isRenderPass===!0;let P=o.width,F=o.height;for(let D=0;D<T.length;D++){let L=T[D];L.setSize&&L.setSize(P,F)}},this.begin=function(I,P){if(y||I.toneMapping===ao&&T.length===0)return!1;if(S=P,P!==null){let F=P.width,D=P.height;(o.width!==F||o.height!==D)&&this.setSize(F,D)}return R===!1&&I.setRenderTarget(o),w=I.toneMapping,I.toneMapping=ao,!0},this.hasRenderPass=function(){return R},this.end=function(I,P){I.toneMapping=w,y=!0;let F=o,D=a;for(let L=0;L<T.length;L++){let C=T[L];if(C.enabled!==!1&&(C.render(I,D,F,P),C.needsSwap!==!1)){let B=F;F=D,D=B}}if(d!==I.outputColorSpace||A!==I.toneMapping){d=I.outputColorSpace,A=I.toneMapping,c.defines={},ln.getTransfer(d)===kt&&(c.defines.SRGB_TRANSFER="");let L=c_e[A];L&&(c.defines[L]=""),c.needsUpdate=!0}c.uniforms.tDiffuse.value=F.texture,I.setRenderTarget(S),I.render(u,f),S=null,y=!1},this.isCompositing=function(){return y},this.dispose=function(){o.depthTexture&&o.depthTexture.dispose(),o.dispose(),a.dispose(),l.dispose(),c.dispose()}}var aK=new qs,DF=new Es(1,1),lK=new zA,cK=new aM,uK=new Ph,VZ=[],GZ=[],qZ=new Float32Array(16),HZ=new Float32Array(9),WZ=new Float32Array(4);function m_(i,e,t){let n=i[0];if(n<=0||n>0)return i;let r=e*t,s=VZ[r];if(s===void 0&&(s=new Float32Array(r),VZ[r]=s),e!==0){n.toArray(s,0);for(let o=1,a=0;o!==e;++o)a+=t,i[o].toArray(s,a)}return s}function lo(i,e){if(i.length!==e.length)return!1;for(let t=0,n=i.length;t<n;t++)if(i[t]!==e[t])return!1;return!0}function co(i,e){for(let t=0,n=e.length;t<n;t++)i[t]=e[t]}function $M(i,e){let t=GZ[e];t===void 0&&(t=new Int32Array(e),GZ[e]=t);for(let n=0;n!==e;++n)t[n]=i.allocateTextureUnit();return t}function h_e(i,e){let t=this.cache;t[0]!==e&&(i.uniform1f(this.addr,e),t[0]=e)}function f_e(i,e){let t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y)&&(i.uniform2f(this.addr,e.x,e.y),t[0]=e.x,t[1]=e.y);else{if(lo(t,e))return;i.uniform2fv(this.addr,e),co(t,e)}}function d_e(i,e){let t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z)&&(i.uniform3f(this.addr,e.x,e.y,e.z),t[0]=e.x,t[1]=e.y,t[2]=e.z);else if(e.r!==void 0)(t[0]!==e.r||t[1]!==e.g||t[2]!==e.b)&&(i.uniform3f(this.addr,e.r,e.g,e.b),t[0]=e.r,t[1]=e.g,t[2]=e.b);else{if(lo(t,e))return;i.uniform3fv(this.addr,e),co(t,e)}}function p_e(i,e){let t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z||t[3]!==e.w)&&(i.uniform4f(this.addr,e.x,e.y,e.z,e.w),t[0]=e.x,t[1]=e.y,t[2]=e.z,t[3]=e.w);else{if(lo(t,e))return;i.uniform4fv(this.addr,e),co(t,e)}}function m_e(i,e){let t=this.cache,n=e.elements;if(n===void 0){if(lo(t,e))return;i.uniformMatrix2fv(this.addr,!1,e),co(t,e)}else{if(lo(t,n))return;WZ.set(n),i.uniformMatrix2fv(this.addr,!1,WZ),co(t,n)}}function A_e(i,e){let t=this.cache,n=e.elements;if(n===void 0){if(lo(t,e))return;i.uniformMatrix3fv(this.addr,!1,e),co(t,e)}else{if(lo(t,n))return;HZ.set(n),i.uniformMatrix3fv(this.addr,!1,HZ),co(t,n)}}function g_e(i,e){let t=this.cache,n=e.elements;if(n===void 0){if(lo(t,e))return;i.uniformMatrix4fv(this.addr,!1,e),co(t,e)}else{if(lo(t,n))return;qZ.set(n),i.uniformMatrix4fv(this.addr,!1,qZ),co(t,n)}}function v_e(i,e){let t=this.cache;t[0]!==e&&(i.uniform1i(this.addr,e),t[0]=e)}function __e(i,e){let t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y)&&(i.uniform2i(this.addr,e.x,e.y),t[0]=e.x,t[1]=e.y);else{if(lo(t,e))return;i.uniform2iv(this.addr,e),co(t,e)}}function x_e(i,e){let t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z)&&(i.uniform3i(this.addr,e.x,e.y,e.z),t[0]=e.x,t[1]=e.y,t[2]=e.z);else{if(lo(t,e))return;i.uniform3iv(this.addr,e),co(t,e)}}function y_e(i,e){let t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z||t[3]!==e.w)&&(i.uniform4i(this.addr,e.x,e.y,e.z,e.w),t[0]=e.x,t[1]=e.y,t[2]=e.z,t[3]=e.w);else{if(lo(t,e))return;i.uniform4iv(this.addr,e),co(t,e)}}function b_e(i,e){let t=this.cache;t[0]!==e&&(i.uniform1ui(this.addr,e),t[0]=e)}function w_e(i,e){let t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y)&&(i.uniform2ui(this.addr,e.x,e.y),t[0]=e.x,t[1]=e.y);else{if(lo(t,e))return;i.uniform2uiv(this.addr,e),co(t,e)}}function S_e(i,e){let t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z)&&(i.uniform3ui(this.addr,e.x,e.y,e.z),t[0]=e.x,t[1]=e.y,t[2]=e.z);else{if(lo(t,e))return;i.uniform3uiv(this.addr,e),co(t,e)}}function T_e(i,e){let t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z||t[3]!==e.w)&&(i.uniform4ui(this.addr,e.x,e.y,e.z,e.w),t[0]=e.x,t[1]=e.y,t[2]=e.z,t[3]=e.w);else{if(lo(t,e))return;i.uniform4uiv(this.addr,e),co(t,e)}}function E_e(i,e,t){let n=this.cache,r=t.allocateTextureUnit();n[0]!==r&&(i.uniform1i(this.addr,r),n[0]=r);let s;this.type===i.SAMPLER_2D_SHADOW?(DF.compareFunction=t.isReversedDepthBuffer()?Fu:Xh,s=DF):s=aK,t.setTexture2D(e||s,r)}function M_e(i,e,t){let n=this.cache,r=t.allocateTextureUnit();n[0]!==r&&(i.uniform1i(this.addr,r),n[0]=r),t.setTexture3D(e||cK,r)}function C_e(i,e,t){let n=this.cache,r=t.allocateTextureUnit();n[0]!==r&&(i.uniform1i(this.addr,r),n[0]=r),t.setTextureCube(e||uK,r)}function R_e(i,e,t){let n=this.cache,r=t.allocateTextureUnit();n[0]!==r&&(i.uniform1i(this.addr,r),n[0]=r),t.setTexture2DArray(e||lK,r)}function P_e(i){switch(i){case 5126:return h_e;case 35664:return f_e;case 35665:return d_e;case 35666:return p_e;case 35674:return m_e;case 35675:return A_e;case 35676:return g_e;case 5124:case 35670:return v_e;case 35667:case 35671:return __e;case 35668:case 35672:return x_e;case 35669:case 35673:return y_e;case 5125:return b_e;case 36294:return w_e;case 36295:return S_e;case 36296:return T_e;case 35678:case 36198:case 36298:case 36306:case 35682:return E_e;case 35679:case 36299:case 36307:return M_e;case 35680:case 36300:case 36308:case 36293:return C_e;case 36289:case 36303:case 36311:case 36292:return R_e}}function I_e(i,e){i.uniform1fv(this.addr,e)}function L_e(i,e){let t=m_(e,this.size,2);i.uniform2fv(this.addr,t)}function D_e(i,e){let t=m_(e,this.size,3);i.uniform3fv(this.addr,t)}function N_e(i,e){let t=m_(e,this.size,4);i.uniform4fv(this.addr,t)}function F_e(i,e){let t=m_(e,this.size,4);i.uniformMatrix2fv(this.addr,!1,t)}function B_e(i,e){let t=m_(e,this.size,9);i.uniformMatrix3fv(this.addr,!1,t)}function O_e(i,e){let t=m_(e,this.size,16);i.uniformMatrix4fv(this.addr,!1,t)}function U_e(i,e){i.uniform1iv(this.addr,e)}function k_e(i,e){i.uniform2iv(this.addr,e)}function z_e(i,e){i.uniform3iv(this.addr,e)}function V_e(i,e){i.uniform4iv(this.addr,e)}function G_e(i,e){i.uniform1uiv(this.addr,e)}function q_e(i,e){i.uniform2uiv(this.addr,e)}function H_e(i,e){i.uniform3uiv(this.addr,e)}function W_e(i,e){i.uniform4uiv(this.addr,e)}function j_e(i,e,t){let n=this.cache,r=e.length,s=$M(t,r);lo(n,s)||(i.uniform1iv(this.addr,s),co(n,s));let o;this.type===i.SAMPLER_2D_SHADOW?o=DF:o=aK;for(let a=0;a!==r;++a)t.setTexture2D(e[a]||o,s[a])}function X_e(i,e,t){let n=this.cache,r=e.length,s=$M(t,r);lo(n,s)||(i.uniform1iv(this.addr,s),co(n,s));for(let o=0;o!==r;++o)t.setTexture3D(e[o]||cK,s[o])}function $_e(i,e,t){let n=this.cache,r=e.length,s=$M(t,r);lo(n,s)||(i.uniform1iv(this.addr,s),co(n,s));for(let o=0;o!==r;++o)t.setTextureCube(e[o]||uK,s[o])}function Y_e(i,e,t){let n=this.cache,r=e.length,s=$M(t,r);lo(n,s)||(i.uniform1iv(this.addr,s),co(n,s));for(let o=0;o!==r;++o)t.setTexture2DArray(e[o]||lK,s[o])}function Z_e(i){switch(i){case 5126:return I_e;case 35664:return L_e;case 35665:return D_e;case 35666:return N_e;case 35674:return F_e;case 35675:return B_e;case 35676:return O_e;case 5124:case 35670:return U_e;case 35667:case 35671:return k_e;case 35668:case 35672:return z_e;case 35669:case 35673:return V_e;case 5125:return G_e;case 36294:return q_e;case 36295:return H_e;case 36296:return W_e;case 35678:case 36198:case 36298:case 36306:case 35682:return j_e;case 35679:case 36299:case 36307:return X_e;case 35680:case 36300:case 36308:case 36293:return $_e;case 36289:case 36303:case 36311:case 36292:return Y_e}}var NF=class{constructor(e,t,n){this.id=e,this.addr=n,this.cache=[],this.type=t.type,this.setValue=P_e(t.type)}},FF=class{constructor(e,t,n){this.id=e,this.addr=n,this.cache=[],this.type=t.type,this.size=t.size,this.setValue=Z_e(t.type)}},BF=class{constructor(e){this.id=e,this.seq=[],this.map={}}setValue(e,t,n){let r=this.seq;for(let s=0,o=r.length;s!==o;++s){let a=r[s];a.setValue(e,t[a.id],n)}}},IF=/(\w+)(\])?(\[|\.)?/g;function jZ(i,e){i.seq.push(e),i.map[e.id]=e}function K_e(i,e,t){let n=i.name,r=n.length;for(IF.lastIndex=0;;){let s=IF.exec(n),o=IF.lastIndex,a=s[1],l=s[2]==="]",c=s[3];if(l&&(a=a|0),c===void 0||c==="["&&o+2===r){jZ(t,c===void 0?new NF(a,i,e):new FF(a,i,e));break}else{let f=t.map[a];f===void 0&&(f=new BF(a),jZ(t,f)),t=f}}}var p_=class{constructor(e,t){this.seq=[],this.map={};let n=e.getProgramParameter(t,e.ACTIVE_UNIFORMS);for(let o=0;o<n;++o){let a=e.getActiveUniform(t,o),l=e.getUniformLocation(t,a.name);K_e(a,l,this)}let r=[],s=[];for(let o of this.seq)o.type===e.SAMPLER_2D_SHADOW||o.type===e.SAMPLER_CUBE_SHADOW||o.type===e.SAMPLER_2D_ARRAY_SHADOW?r.push(o):s.push(o);r.length>0&&(this.seq=r.concat(s))}setValue(e,t,n,r){let s=this.map[t];s!==void 0&&s.setValue(e,n,r)}setOptional(e,t,n){let r=t[n];r!==void 0&&this.setValue(e,n,r)}static upload(e,t,n,r){for(let s=0,o=t.length;s!==o;++s){let a=t[s],l=n[a.id];l.needsUpdate!==!1&&a.setValue(e,l.value,r)}}static seqWithValue(e,t){let n=[];for(let r=0,s=e.length;r!==s;++r){let o=e[r];o.id in t&&n.push(o)}return n}};function XZ(i,e,t){let n=i.createShader(e);return i.shaderSource(n,t),i.compileShader(n),n}var Q_e=37297,J_e=0;function exe(i,e){let t=i.split(`40164016 `),n=[],r=Math.max(e-6,0),s=Math.min(e+6,t.length);for(let o=r;o<s;o++){let a=o+1;n.push(`${a===e?">":" "} ${a}: ${t[o]}`)}return n.join(`4017-`)}var wZ=new Mn;function x_e(i){ln._getMatrix(wZ,ln.workingColorSpace,i);let e=`mat3( ${wZ.elements.map(t=>t.toFixed(4))} )`;switch(ln.getTransfer(i)){case Qp:return[e,"LinearTransferOETF"];case kt:return[e,"sRGBTransferOETF"];default:return Xe("WebGLProgram: Unsupported color space: ",i),[e,"LinearTransferOETF"]}}function SZ(i,e,t){let n=i.getShaderParameter(e,i.COMPILE_STATUS),s=(i.getShaderInfoLog(e)||"").trim();if(n&&s==="")return"";let o=/ERROR: 0:(\d+)/.exec(s);if(o){let a=parseInt(o[1]);return t.toUpperCase()+`4017+`)}var $Z=new Mn;function txe(i){ln._getMatrix($Z,ln.workingColorSpace,i);let e=`mat3( ${$Z.elements.map(t=>t.toFixed(4))} )`;switch(ln.getTransfer(i)){case n0:return[e,"LinearTransferOETF"];case kt:return[e,"sRGBTransferOETF"];default:return Xe("WebGLProgram: Unsupported color space: ",i),[e,"LinearTransferOETF"]}}function YZ(i,e,t){let n=i.getShaderParameter(e,i.COMPILE_STATUS),s=(i.getShaderInfoLog(e)||"").trim();if(n&&s==="")return"";let o=/ERROR: 0:(\d+)/.exec(s);if(o){let a=parseInt(o[1]);return t.toUpperCase()+`40184018 40194019 `+s+`40204020 4021-`+__e(i.getShaderSource(e),a)}else return s}function y_e(i,e){let t=x_e(e);return[`vec4 ${i}( vec4 value ) {`,` return ${t[1]}( vec4( value.rgb * ${t[0]}, value.a ) );`,"}"].join(`4022-`)}var b_e={[gb]:"Linear",[vb]:"Reinhard",[_b]:"Cineon",[xb]:"ACESFilmic",[yb]:"AgX",[bb]:"Neutral",[R8]:"Custom"};function w_e(i,e){let t=b_e[e];return t===void 0?(Xe("WebGLProgram: Unsupported toneMapping:",e),"vec3 "+i+"( vec3 color ) { return LinearToneMapping( color ); }"):"vec3 "+i+"( vec3 color ) { return "+t+"ToneMapping( color ); }"}var FM=new re;function S_e(){ln.getLuminanceCoefficients(FM);let i=FM.x.toFixed(4),e=FM.y.toFixed(4),t=FM.z.toFixed(4);return["float luminance( const in vec3 rgb ) {",` const vec3 weights = vec3( ${i}, ${e}, ${t} );`," return dot( weights, rgb );","}"].join(`4023-`)}function T_e(i){return[i.extensionClipCullDistance?"#extension GL_ANGLE_clip_cull_distance : require":"",i.extensionMultiDraw?"#extension GL_ANGLE_multi_draw : require":""].filter(Fb).join(`4024-`)}function E_e(i){let e=[];for(let t in i){let n=i[t];n!==!1&&e.push("#define "+t+" "+n)}return e.join(`4025-`)}function M_e(i,e){let t={},n=i.getProgramParameter(e,i.ACTIVE_ATTRIBUTES);for(let r=0;r<n;r++){let s=i.getActiveAttrib(e,r),o=s.name,a=1;s.type===i.FLOAT_MAT2&&(a=2),s.type===i.FLOAT_MAT3&&(a=3),s.type===i.FLOAT_MAT4&&(a=4),t[o]={type:s.type,location:i.getAttribLocation(e,o),locationSize:a}}return t}function Fb(i){return i!==""}function TZ(i,e){let t=e.numSpotLightShadows+e.numSpotLightMaps-e.numSpotLightShadowsWithMaps;return i.replace(/NUM_DIR_LIGHTS/g,e.numDirLights).replace(/NUM_SPOT_LIGHTS/g,e.numSpotLights).replace(/NUM_SPOT_LIGHT_MAPS/g,e.numSpotLightMaps).replace(/NUM_SPOT_LIGHT_COORDS/g,t).replace(/NUM_RECT_AREA_LIGHTS/g,e.numRectAreaLights).replace(/NUM_POINT_LIGHTS/g,e.numPointLights).replace(/NUM_HEMI_LIGHTS/g,e.numHemiLights).replace(/NUM_DIR_LIGHT_SHADOWS/g,e.numDirLightShadows).replace(/NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS/g,e.numSpotLightShadowsWithMaps).replace(/NUM_SPOT_LIGHT_SHADOWS/g,e.numSpotLightShadows).replace(/NUM_POINT_LIGHT_SHADOWS/g,e.numPointLightShadows)}function EZ(i,e){return i.replace(/NUM_CLIPPING_PLANES/g,e.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,e.numClippingPlanes-e.numClipIntersection)}var C_e=/^[ \t]*#include +<([\w\d./]+)>/gm;function AF(i){return i.replace(C_e,I_e)}var R_e=new Map;function I_e(i,e){let t=kn[e];if(t===void 0){let n=R_e.get(e);if(n!==void 0)t=kn[n],Xe('WebGLRenderer: Shader chunk "%s" has been deprecated. Use "%s" instead.',e,n);else throw new Error("THREE.WebGLProgram: Can not resolve #include <"+e+">")}return AF(t)}var P_e=/#pragma unroll_loop_start\s+for\s*\(\s*int\s+i\s*=\s*(\d+)\s*;\s*i\s*<\s*(\d+)\s*;\s*i\s*\+\+\s*\)\s*{([\s\S]+?)}\s+#pragma unroll_loop_end/g;function MZ(i){return i.replace(P_e,L_e)}function L_e(i,e,t,n){let r="";for(let s=parseInt(e);s<parseInt(t);s++)r+=n.replace(/\[\s*i\s*\]/g,"[ "+s+" ]").replace(/UNROLLED_LOOP_INDEX/g,s);return r}function CZ(i){let e=`precision ${i.precision} float;4021+`+exe(i.getShaderSource(e),a)}else return s}function nxe(i,e){let t=txe(e);return[`vec4 ${i}( vec4 value ) {`,` return ${t[1]}( vec4( value.rgb * ${t[0]}, value.a ) );`,"}"].join(`4022+`)}var ixe={[wb]:"Linear",[Sb]:"Reinhard",[Tb]:"Cineon",[Eb]:"ACESFilmic",[Mb]:"AgX",[Cb]:"Neutral",[Z8]:"Custom"};function rxe(i,e){let t=ixe[e];return t===void 0?(Xe("WebGLProgram: Unsupported toneMapping:",e),"vec3 "+i+"( vec3 color ) { return LinearToneMapping( color ); }"):"vec3 "+i+"( vec3 color ) { return "+t+"ToneMapping( color ); }"}var qM=new re;function sxe(){ln.getLuminanceCoefficients(qM);let i=qM.x.toFixed(4),e=qM.y.toFixed(4),t=qM.z.toFixed(4);return["float luminance( const in vec3 rgb ) {",` const vec3 weights = vec3( ${i}, ${e}, ${t} );`," return dot( weights, rgb );","}"].join(`4023+`)}function oxe(i){return[i.extensionClipCullDistance?"#extension GL_ANGLE_clip_cull_distance : require":"",i.extensionMultiDraw?"#extension GL_ANGLE_multi_draw : require":""].filter(Vb).join(`4024+`)}function axe(i){let e=[];for(let t in i){let n=i[t];n!==!1&&e.push("#define "+t+" "+n)}return e.join(`4025+`)}function lxe(i,e){let t={},n=i.getProgramParameter(e,i.ACTIVE_ATTRIBUTES);for(let r=0;r<n;r++){let s=i.getActiveAttrib(e,r),o=s.name,a=1;s.type===i.FLOAT_MAT2&&(a=2),s.type===i.FLOAT_MAT3&&(a=3),s.type===i.FLOAT_MAT4&&(a=4),t[o]={type:s.type,location:i.getAttribLocation(e,o),locationSize:a}}return t}function Vb(i){return i!==""}function ZZ(i,e){let t=e.numSpotLightShadows+e.numSpotLightMaps-e.numSpotLightShadowsWithMaps;return i.replace(/NUM_DIR_LIGHTS/g,e.numDirLights).replace(/NUM_SPOT_LIGHTS/g,e.numSpotLights).replace(/NUM_SPOT_LIGHT_MAPS/g,e.numSpotLightMaps).replace(/NUM_SPOT_LIGHT_COORDS/g,t).replace(/NUM_RECT_AREA_LIGHTS/g,e.numRectAreaLights).replace(/NUM_POINT_LIGHTS/g,e.numPointLights).replace(/NUM_HEMI_LIGHTS/g,e.numHemiLights).replace(/NUM_DIR_LIGHT_SHADOWS/g,e.numDirLightShadows).replace(/NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS/g,e.numSpotLightShadowsWithMaps).replace(/NUM_SPOT_LIGHT_SHADOWS/g,e.numSpotLightShadows).replace(/NUM_POINT_LIGHT_SHADOWS/g,e.numPointLightShadows)}function KZ(i,e){return i.replace(/NUM_CLIPPING_PLANES/g,e.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,e.numClippingPlanes-e.numClipIntersection)}var cxe=/^[ \t]*#include +<([\w\d./]+)>/gm;function OF(i){return i.replace(cxe,hxe)}var uxe=new Map;function hxe(i,e){let t=kn[e];if(t===void 0){let n=uxe.get(e);if(n!==void 0)t=kn[n],Xe('WebGLRenderer: Shader chunk "%s" has been deprecated. Use "%s" instead.',e,n);else throw new Error("THREE.WebGLProgram: Can not resolve #include <"+e+">")}return OF(t)}var fxe=/#pragma unroll_loop_start\s+for\s*\(\s*int\s+i\s*=\s*(\d+)\s*;\s*i\s*<\s*(\d+)\s*;\s*i\s*\+\+\s*\)\s*{([\s\S]+?)}\s+#pragma unroll_loop_end/g;function QZ(i){return i.replace(fxe,dxe)}function dxe(i,e,t,n){let r="";for(let s=parseInt(e);s<parseInt(t);s++)r+=n.replace(/\[\s*i\s*\]/g,"[ "+s+" ]").replace(/UNROLLED_LOOP_INDEX/g,s);return r}function JZ(i){let e=`precision ${i.precision} float;40264026 precision ${i.precision} int;40274027 precision ${i.precision} sampler2D;40284028 precision ${i.precision} samplerCube;@@ -4042,30 +4042,30 @@ void main() {
40424042 `;return i.precision==="highp"?e+=`40434043 #define HIGH_PRECISION`:i.precision==="mediump"?e+=`40444044 #define MEDIUM_PRECISION`:i.precision==="lowp"&&(e+=`4045-#define LOW_PRECISION`),e}var D_e={[c0]:"SHADOWMAP_TYPE_PCF",[Vc]:"SHADOWMAP_TYPE_VSM"};function N_e(i){return D_e[i.shadowMapType]||"SHADOWMAP_TYPE_BASIC"}var F_e={[Kl]:"ENVMAP_TYPE_CUBE",[Gc]:"ENVMAP_TYPE_CUBE",[Bh]:"ENVMAP_TYPE_CUBE_UV"};function B_e(i){return i.envMap===!1?"ENVMAP_TYPE_CUBE":F_e[i.envMapMode]||"ENVMAP_TYPE_CUBE"}var O_e={[Gc]:"ENVMAP_MODE_REFRACTION"};function U_e(i){return i.envMap===!1?"ENVMAP_MODE_REFLECTION":O_e[i.envMapMode]||"ENVMAP_MODE_REFLECTION"}var k_e={[ZA]:"ENVMAP_BLENDING_MULTIPLY",[CM]:"ENVMAP_BLENDING_MIX",[RM]:"ENVMAP_BLENDING_ADD"};function z_e(i){return i.envMap===!1?"ENVMAP_BLENDING_NONE":k_e[i.combine]||"ENVMAP_BLENDING_NONE"}function V_e(i){let e=i.envMapCubeUVHeight;if(e===null)return null;let t=Math.log2(e)-2,n=1/e;return{texelWidth:1/(3*Math.max(Math.pow(2,t),112)),texelHeight:n,maxMip:t}}function G_e(i,e,t,n){let r=i.getContext(),s=t.defines,o=t.vertexShader,a=t.fragmentShader,l=N_e(t),c=B_e(t),u=U_e(t),f=z_e(t),d=V_e(t),A=T_e(t),y=E_e(s),w=r.createProgram(),S,T,R=t.glslVersion?"#version "+t.glslVersion+`4046-`:"";t.isRawShaderMaterial?(S=["#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,y].filter(Fb).join(`4045+#define LOW_PRECISION`),e}var pxe={[d0]:"SHADOWMAP_TYPE_PCF",[Vc]:"SHADOWMAP_TYPE_VSM"};function mxe(i){return pxe[i.shadowMapType]||"SHADOWMAP_TYPE_BASIC"}var Axe={[ec]:"ENVMAP_TYPE_CUBE",[Gc]:"ENVMAP_TYPE_CUBE",[Bh]:"ENVMAP_TYPE_CUBE_UV"};function gxe(i){return i.envMap===!1?"ENVMAP_TYPE_CUBE":Axe[i.envMapMode]||"ENVMAP_TYPE_CUBE"}var vxe={[Gc]:"ENVMAP_MODE_REFRACTION"};function _xe(i){return i.envMap===!1?"ENVMAP_MODE_REFLECTION":vxe[i.envMapMode]||"ENVMAP_MODE_REFLECTION"}var xxe={[tg]:"ENVMAP_BLENDING_MULTIPLY",[BM]:"ENVMAP_BLENDING_MIX",[OM]:"ENVMAP_BLENDING_ADD"};function yxe(i){return i.envMap===!1?"ENVMAP_BLENDING_NONE":xxe[i.combine]||"ENVMAP_BLENDING_NONE"}function bxe(i){let e=i.envMapCubeUVHeight;if(e===null)return null;let t=Math.log2(e)-2,n=1/e;return{texelWidth:1/(3*Math.max(Math.pow(2,t),112)),texelHeight:n,maxMip:t}}function wxe(i,e,t,n){let r=i.getContext(),s=t.defines,o=t.vertexShader,a=t.fragmentShader,l=mxe(t),c=gxe(t),u=_xe(t),f=yxe(t),d=bxe(t),A=oxe(t),y=axe(s),w=r.createProgram(),S,T,R=t.glslVersion?"#version "+t.glslVersion+`4046+`:"";t.isRawShaderMaterial?(S=["#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,y].filter(Vb).join(`40474047 `),S.length>0&&(S+=`4048-`),T=["#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,y].filter(Fb).join(`4048+`),T=["#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,y].filter(Vb).join(`40494049 `),T.length>0&&(T+=`4050-`)):(S=[CZ(t),"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,y,t.extensionClipCullDistance?"#define USE_CLIP_DISTANCE":"",t.batching?"#define USE_BATCHING":"",t.batchingColor?"#define USE_BATCHING_COLOR":"",t.instancing?"#define USE_INSTANCING":"",t.instancingColor?"#define USE_INSTANCING_COLOR":"",t.instancingMorph?"#define USE_INSTANCING_MORPH":"",t.useFog&&t.fog?"#define USE_FOG":"",t.useFog&&t.fogExp2?"#define FOG_EXP2":"",t.map?"#define USE_MAP":"",t.envMap?"#define USE_ENVMAP":"",t.envMap?"#define "+u:"",t.lightMap?"#define USE_LIGHTMAP":"",t.aoMap?"#define USE_AOMAP":"",t.bumpMap?"#define USE_BUMPMAP":"",t.normalMap?"#define USE_NORMALMAP":"",t.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",t.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",t.displacementMap?"#define USE_DISPLACEMENTMAP":"",t.emissiveMap?"#define USE_EMISSIVEMAP":"",t.anisotropy?"#define USE_ANISOTROPY":"",t.anisotropyMap?"#define USE_ANISOTROPYMAP":"",t.clearcoatMap?"#define USE_CLEARCOATMAP":"",t.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",t.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",t.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",t.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",t.specularMap?"#define USE_SPECULARMAP":"",t.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",t.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",t.roughnessMap?"#define USE_ROUGHNESSMAP":"",t.metalnessMap?"#define USE_METALNESSMAP":"",t.alphaMap?"#define USE_ALPHAMAP":"",t.alphaHash?"#define USE_ALPHAHASH":"",t.transmission?"#define USE_TRANSMISSION":"",t.transmissionMap?"#define USE_TRANSMISSIONMAP":"",t.thicknessMap?"#define USE_THICKNESSMAP":"",t.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",t.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",t.mapUv?"#define MAP_UV "+t.mapUv:"",t.alphaMapUv?"#define ALPHAMAP_UV "+t.alphaMapUv:"",t.lightMapUv?"#define LIGHTMAP_UV "+t.lightMapUv:"",t.aoMapUv?"#define AOMAP_UV "+t.aoMapUv:"",t.emissiveMapUv?"#define EMISSIVEMAP_UV "+t.emissiveMapUv:"",t.bumpMapUv?"#define BUMPMAP_UV "+t.bumpMapUv:"",t.normalMapUv?"#define NORMALMAP_UV "+t.normalMapUv:"",t.displacementMapUv?"#define DISPLACEMENTMAP_UV "+t.displacementMapUv:"",t.metalnessMapUv?"#define METALNESSMAP_UV "+t.metalnessMapUv:"",t.roughnessMapUv?"#define ROUGHNESSMAP_UV "+t.roughnessMapUv:"",t.anisotropyMapUv?"#define ANISOTROPYMAP_UV "+t.anisotropyMapUv:"",t.clearcoatMapUv?"#define CLEARCOATMAP_UV "+t.clearcoatMapUv:"",t.clearcoatNormalMapUv?"#define CLEARCOAT_NORMALMAP_UV "+t.clearcoatNormalMapUv:"",t.clearcoatRoughnessMapUv?"#define CLEARCOAT_ROUGHNESSMAP_UV "+t.clearcoatRoughnessMapUv:"",t.iridescenceMapUv?"#define IRIDESCENCEMAP_UV "+t.iridescenceMapUv:"",t.iridescenceThicknessMapUv?"#define IRIDESCENCE_THICKNESSMAP_UV "+t.iridescenceThicknessMapUv:"",t.sheenColorMapUv?"#define SHEEN_COLORMAP_UV "+t.sheenColorMapUv:"",t.sheenRoughnessMapUv?"#define SHEEN_ROUGHNESSMAP_UV "+t.sheenRoughnessMapUv:"",t.specularMapUv?"#define SPECULARMAP_UV "+t.specularMapUv:"",t.specularColorMapUv?"#define SPECULAR_COLORMAP_UV "+t.specularColorMapUv:"",t.specularIntensityMapUv?"#define SPECULAR_INTENSITYMAP_UV "+t.specularIntensityMapUv:"",t.transmissionMapUv?"#define TRANSMISSIONMAP_UV "+t.transmissionMapUv:"",t.thicknessMapUv?"#define THICKNESSMAP_UV "+t.thicknessMapUv:"",t.vertexTangents&&t.flatShading===!1?"#define USE_TANGENT":"",t.vertexNormals?"#define HAS_NORMAL":"",t.vertexColors?"#define USE_COLOR":"",t.vertexAlphas?"#define USE_COLOR_ALPHA":"",t.vertexUv1s?"#define USE_UV1":"",t.vertexUv2s?"#define USE_UV2":"",t.vertexUv3s?"#define USE_UV3":"",t.pointsUvs?"#define USE_POINTS_UV":"",t.flatShading?"#define FLAT_SHADED":"",t.skinning?"#define USE_SKINNING":"",t.morphTargets?"#define USE_MORPHTARGETS":"",t.morphNormals&&t.flatShading===!1?"#define USE_MORPHNORMALS":"",t.morphColors?"#define USE_MORPHCOLORS":"",t.morphTargetsCount>0?"#define MORPHTARGETS_TEXTURE_STRIDE "+t.morphTextureStride:"",t.morphTargetsCount>0?"#define MORPHTARGETS_COUNT "+t.morphTargetsCount:"",t.doubleSided?"#define DOUBLE_SIDED":"",t.flipSided?"#define FLIP_SIDED":"",t.shadowMapEnabled?"#define USE_SHADOWMAP":"",t.shadowMapEnabled?"#define "+l:"",t.sizeAttenuation?"#define USE_SIZEATTENUATION":"",t.numLightProbes>0?"#define USE_LIGHT_PROBES":"",t.logarithmicDepthBuffer?"#define USE_LOGARITHMIC_DEPTH_BUFFER":"",t.reversedDepthBuffer?"#define USE_REVERSED_DEPTH_BUFFER":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;","#ifdef USE_INSTANCING"," attribute mat4 instanceMatrix;","#endif","#ifdef USE_INSTANCING_COLOR"," attribute vec3 instanceColor;","#endif","#ifdef USE_INSTANCING_MORPH"," uniform sampler2D morphTexture;","#endif","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_UV1"," attribute vec2 uv1;","#endif","#ifdef USE_UV2"," attribute vec2 uv2;","#endif","#ifdef USE_UV3"," attribute vec2 uv3;","#endif","#ifdef USE_TANGENT"," attribute vec4 tangent;","#endif","#if defined( USE_COLOR_ALPHA )"," attribute vec4 color;","#elif defined( USE_COLOR )"," attribute vec3 color;","#endif","#ifdef USE_SKINNING"," attribute vec4 skinIndex;"," attribute vec4 skinWeight;","#endif",`4051-`].filter(Fb).join(`4052-`),T=[CZ(t),"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,y,t.useFog&&t.fog?"#define USE_FOG":"",t.useFog&&t.fogExp2?"#define FOG_EXP2":"",t.alphaToCoverage?"#define ALPHA_TO_COVERAGE":"",t.map?"#define USE_MAP":"",t.matcap?"#define USE_MATCAP":"",t.envMap?"#define USE_ENVMAP":"",t.envMap?"#define "+c:"",t.envMap?"#define "+u:"",t.envMap?"#define "+f:"",d?"#define CUBEUV_TEXEL_WIDTH "+d.texelWidth:"",d?"#define CUBEUV_TEXEL_HEIGHT "+d.texelHeight:"",d?"#define CUBEUV_MAX_MIP "+d.maxMip+".0":"",t.lightMap?"#define USE_LIGHTMAP":"",t.aoMap?"#define USE_AOMAP":"",t.bumpMap?"#define USE_BUMPMAP":"",t.normalMap?"#define USE_NORMALMAP":"",t.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",t.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",t.packedNormalMap?"#define USE_PACKED_NORMALMAP":"",t.emissiveMap?"#define USE_EMISSIVEMAP":"",t.anisotropy?"#define USE_ANISOTROPY":"",t.anisotropyMap?"#define USE_ANISOTROPYMAP":"",t.clearcoat?"#define USE_CLEARCOAT":"",t.clearcoatMap?"#define USE_CLEARCOATMAP":"",t.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",t.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",t.dispersion?"#define USE_DISPERSION":"",t.iridescence?"#define USE_IRIDESCENCE":"",t.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",t.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",t.specularMap?"#define USE_SPECULARMAP":"",t.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",t.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",t.roughnessMap?"#define USE_ROUGHNESSMAP":"",t.metalnessMap?"#define USE_METALNESSMAP":"",t.alphaMap?"#define USE_ALPHAMAP":"",t.alphaTest?"#define USE_ALPHATEST":"",t.alphaHash?"#define USE_ALPHAHASH":"",t.sheen?"#define USE_SHEEN":"",t.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",t.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",t.transmission?"#define USE_TRANSMISSION":"",t.transmissionMap?"#define USE_TRANSMISSIONMAP":"",t.thicknessMap?"#define USE_THICKNESSMAP":"",t.vertexTangents&&t.flatShading===!1?"#define USE_TANGENT":"",t.vertexColors||t.instancingColor?"#define USE_COLOR":"",t.vertexAlphas||t.batchingColor?"#define USE_COLOR_ALPHA":"",t.vertexUv1s?"#define USE_UV1":"",t.vertexUv2s?"#define USE_UV2":"",t.vertexUv3s?"#define USE_UV3":"",t.pointsUvs?"#define USE_POINTS_UV":"",t.gradientMap?"#define USE_GRADIENTMAP":"",t.flatShading?"#define FLAT_SHADED":"",t.doubleSided?"#define DOUBLE_SIDED":"",t.flipSided?"#define FLIP_SIDED":"",t.shadowMapEnabled?"#define USE_SHADOWMAP":"",t.shadowMapEnabled?"#define "+l:"",t.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",t.numLightProbes>0?"#define USE_LIGHT_PROBES":"",t.numLightProbeGrids>0?"#define USE_LIGHT_PROBES_GRID":"",t.decodeVideoTexture?"#define DECODE_VIDEO_TEXTURE":"",t.decodeVideoTextureEmissive?"#define DECODE_VIDEO_TEXTURE_EMISSIVE":"",t.logarithmicDepthBuffer?"#define USE_LOGARITHMIC_DEPTH_BUFFER":"",t.reversedDepthBuffer?"#define USE_REVERSED_DEPTH_BUFFER":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",t.toneMapping!==ao?"#define TONE_MAPPING":"",t.toneMapping!==ao?kn.tonemapping_pars_fragment:"",t.toneMapping!==ao?w_e("toneMapping",t.toneMapping):"",t.dithering?"#define DITHERING":"",t.opaque?"#define OPAQUE":"",kn.colorspace_pars_fragment,y_e("linearToOutputTexel",t.outputColorSpace),S_e(),t.useDepthPacking?"#define DEPTH_PACKING "+t.depthPacking:"",`4053-`].filter(Fb).join(`4054-`)),o=AF(o),o=TZ(o,t),o=EZ(o,t),a=AF(a),a=TZ(a,t),a=EZ(a,t),o=MZ(o),a=MZ(a),t.isRawShaderMaterial!==!0&&(R=`#version 300 es4050+`)):(S=[JZ(t),"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,y,t.extensionClipCullDistance?"#define USE_CLIP_DISTANCE":"",t.batching?"#define USE_BATCHING":"",t.batchingColor?"#define USE_BATCHING_COLOR":"",t.instancing?"#define USE_INSTANCING":"",t.instancingColor?"#define USE_INSTANCING_COLOR":"",t.instancingMorph?"#define USE_INSTANCING_MORPH":"",t.useFog&&t.fog?"#define USE_FOG":"",t.useFog&&t.fogExp2?"#define FOG_EXP2":"",t.map?"#define USE_MAP":"",t.envMap?"#define USE_ENVMAP":"",t.envMap?"#define "+u:"",t.lightMap?"#define USE_LIGHTMAP":"",t.aoMap?"#define USE_AOMAP":"",t.bumpMap?"#define USE_BUMPMAP":"",t.normalMap?"#define USE_NORMALMAP":"",t.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",t.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",t.displacementMap?"#define USE_DISPLACEMENTMAP":"",t.emissiveMap?"#define USE_EMISSIVEMAP":"",t.anisotropy?"#define USE_ANISOTROPY":"",t.anisotropyMap?"#define USE_ANISOTROPYMAP":"",t.clearcoatMap?"#define USE_CLEARCOATMAP":"",t.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",t.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",t.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",t.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",t.specularMap?"#define USE_SPECULARMAP":"",t.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",t.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",t.roughnessMap?"#define USE_ROUGHNESSMAP":"",t.metalnessMap?"#define USE_METALNESSMAP":"",t.alphaMap?"#define USE_ALPHAMAP":"",t.alphaHash?"#define USE_ALPHAHASH":"",t.transmission?"#define USE_TRANSMISSION":"",t.transmissionMap?"#define USE_TRANSMISSIONMAP":"",t.thicknessMap?"#define USE_THICKNESSMAP":"",t.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",t.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",t.mapUv?"#define MAP_UV "+t.mapUv:"",t.alphaMapUv?"#define ALPHAMAP_UV "+t.alphaMapUv:"",t.lightMapUv?"#define LIGHTMAP_UV "+t.lightMapUv:"",t.aoMapUv?"#define AOMAP_UV "+t.aoMapUv:"",t.emissiveMapUv?"#define EMISSIVEMAP_UV "+t.emissiveMapUv:"",t.bumpMapUv?"#define BUMPMAP_UV "+t.bumpMapUv:"",t.normalMapUv?"#define NORMALMAP_UV "+t.normalMapUv:"",t.displacementMapUv?"#define DISPLACEMENTMAP_UV "+t.displacementMapUv:"",t.metalnessMapUv?"#define METALNESSMAP_UV "+t.metalnessMapUv:"",t.roughnessMapUv?"#define ROUGHNESSMAP_UV "+t.roughnessMapUv:"",t.anisotropyMapUv?"#define ANISOTROPYMAP_UV "+t.anisotropyMapUv:"",t.clearcoatMapUv?"#define CLEARCOATMAP_UV "+t.clearcoatMapUv:"",t.clearcoatNormalMapUv?"#define CLEARCOAT_NORMALMAP_UV "+t.clearcoatNormalMapUv:"",t.clearcoatRoughnessMapUv?"#define CLEARCOAT_ROUGHNESSMAP_UV "+t.clearcoatRoughnessMapUv:"",t.iridescenceMapUv?"#define IRIDESCENCEMAP_UV "+t.iridescenceMapUv:"",t.iridescenceThicknessMapUv?"#define IRIDESCENCE_THICKNESSMAP_UV "+t.iridescenceThicknessMapUv:"",t.sheenColorMapUv?"#define SHEEN_COLORMAP_UV "+t.sheenColorMapUv:"",t.sheenRoughnessMapUv?"#define SHEEN_ROUGHNESSMAP_UV "+t.sheenRoughnessMapUv:"",t.specularMapUv?"#define SPECULARMAP_UV "+t.specularMapUv:"",t.specularColorMapUv?"#define SPECULAR_COLORMAP_UV "+t.specularColorMapUv:"",t.specularIntensityMapUv?"#define SPECULAR_INTENSITYMAP_UV "+t.specularIntensityMapUv:"",t.transmissionMapUv?"#define TRANSMISSIONMAP_UV "+t.transmissionMapUv:"",t.thicknessMapUv?"#define THICKNESSMAP_UV "+t.thicknessMapUv:"",t.vertexTangents&&t.flatShading===!1?"#define USE_TANGENT":"",t.vertexNormals?"#define HAS_NORMAL":"",t.vertexColors?"#define USE_COLOR":"",t.vertexAlphas?"#define USE_COLOR_ALPHA":"",t.vertexUv1s?"#define USE_UV1":"",t.vertexUv2s?"#define USE_UV2":"",t.vertexUv3s?"#define USE_UV3":"",t.pointsUvs?"#define USE_POINTS_UV":"",t.flatShading?"#define FLAT_SHADED":"",t.skinning?"#define USE_SKINNING":"",t.morphTargets?"#define USE_MORPHTARGETS":"",t.morphNormals&&t.flatShading===!1?"#define USE_MORPHNORMALS":"",t.morphColors?"#define USE_MORPHCOLORS":"",t.morphTargetsCount>0?"#define MORPHTARGETS_TEXTURE_STRIDE "+t.morphTextureStride:"",t.morphTargetsCount>0?"#define MORPHTARGETS_COUNT "+t.morphTargetsCount:"",t.doubleSided?"#define DOUBLE_SIDED":"",t.flipSided?"#define FLIP_SIDED":"",t.shadowMapEnabled?"#define USE_SHADOWMAP":"",t.shadowMapEnabled?"#define "+l:"",t.sizeAttenuation?"#define USE_SIZEATTENUATION":"",t.numLightProbes>0?"#define USE_LIGHT_PROBES":"",t.logarithmicDepthBuffer?"#define USE_LOGARITHMIC_DEPTH_BUFFER":"",t.reversedDepthBuffer?"#define USE_REVERSED_DEPTH_BUFFER":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;","#ifdef USE_INSTANCING"," attribute mat4 instanceMatrix;","#endif","#ifdef USE_INSTANCING_COLOR"," attribute vec3 instanceColor;","#endif","#ifdef USE_INSTANCING_MORPH"," uniform sampler2D morphTexture;","#endif","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_UV1"," attribute vec2 uv1;","#endif","#ifdef USE_UV2"," attribute vec2 uv2;","#endif","#ifdef USE_UV3"," attribute vec2 uv3;","#endif","#ifdef USE_TANGENT"," attribute vec4 tangent;","#endif","#if defined( USE_COLOR_ALPHA )"," attribute vec4 color;","#elif defined( USE_COLOR )"," attribute vec3 color;","#endif","#ifdef USE_SKINNING"," attribute vec4 skinIndex;"," attribute vec4 skinWeight;","#endif",`4051+`].filter(Vb).join(`4052+`),T=[JZ(t),"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,y,t.useFog&&t.fog?"#define USE_FOG":"",t.useFog&&t.fogExp2?"#define FOG_EXP2":"",t.alphaToCoverage?"#define ALPHA_TO_COVERAGE":"",t.map?"#define USE_MAP":"",t.matcap?"#define USE_MATCAP":"",t.envMap?"#define USE_ENVMAP":"",t.envMap?"#define "+c:"",t.envMap?"#define "+u:"",t.envMap?"#define "+f:"",d?"#define CUBEUV_TEXEL_WIDTH "+d.texelWidth:"",d?"#define CUBEUV_TEXEL_HEIGHT "+d.texelHeight:"",d?"#define CUBEUV_MAX_MIP "+d.maxMip+".0":"",t.lightMap?"#define USE_LIGHTMAP":"",t.aoMap?"#define USE_AOMAP":"",t.bumpMap?"#define USE_BUMPMAP":"",t.normalMap?"#define USE_NORMALMAP":"",t.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",t.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",t.packedNormalMap?"#define USE_PACKED_NORMALMAP":"",t.emissiveMap?"#define USE_EMISSIVEMAP":"",t.anisotropy?"#define USE_ANISOTROPY":"",t.anisotropyMap?"#define USE_ANISOTROPYMAP":"",t.clearcoat?"#define USE_CLEARCOAT":"",t.clearcoatMap?"#define USE_CLEARCOATMAP":"",t.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",t.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",t.dispersion?"#define USE_DISPERSION":"",t.iridescence?"#define USE_IRIDESCENCE":"",t.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",t.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",t.specularMap?"#define USE_SPECULARMAP":"",t.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",t.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",t.roughnessMap?"#define USE_ROUGHNESSMAP":"",t.metalnessMap?"#define USE_METALNESSMAP":"",t.alphaMap?"#define USE_ALPHAMAP":"",t.alphaTest?"#define USE_ALPHATEST":"",t.alphaHash?"#define USE_ALPHAHASH":"",t.sheen?"#define USE_SHEEN":"",t.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",t.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",t.transmission?"#define USE_TRANSMISSION":"",t.transmissionMap?"#define USE_TRANSMISSIONMAP":"",t.thicknessMap?"#define USE_THICKNESSMAP":"",t.vertexTangents&&t.flatShading===!1?"#define USE_TANGENT":"",t.vertexColors||t.instancingColor?"#define USE_COLOR":"",t.vertexAlphas||t.batchingColor?"#define USE_COLOR_ALPHA":"",t.vertexUv1s?"#define USE_UV1":"",t.vertexUv2s?"#define USE_UV2":"",t.vertexUv3s?"#define USE_UV3":"",t.pointsUvs?"#define USE_POINTS_UV":"",t.gradientMap?"#define USE_GRADIENTMAP":"",t.flatShading?"#define FLAT_SHADED":"",t.doubleSided?"#define DOUBLE_SIDED":"",t.flipSided?"#define FLIP_SIDED":"",t.shadowMapEnabled?"#define USE_SHADOWMAP":"",t.shadowMapEnabled?"#define "+l:"",t.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",t.numLightProbes>0?"#define USE_LIGHT_PROBES":"",t.numLightProbeGrids>0?"#define USE_LIGHT_PROBES_GRID":"",t.decodeVideoTexture?"#define DECODE_VIDEO_TEXTURE":"",t.decodeVideoTextureEmissive?"#define DECODE_VIDEO_TEXTURE_EMISSIVE":"",t.logarithmicDepthBuffer?"#define USE_LOGARITHMIC_DEPTH_BUFFER":"",t.reversedDepthBuffer?"#define USE_REVERSED_DEPTH_BUFFER":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",t.toneMapping!==ao?"#define TONE_MAPPING":"",t.toneMapping!==ao?kn.tonemapping_pars_fragment:"",t.toneMapping!==ao?rxe("toneMapping",t.toneMapping):"",t.dithering?"#define DITHERING":"",t.opaque?"#define OPAQUE":"",kn.colorspace_pars_fragment,nxe("linearToOutputTexel",t.outputColorSpace),sxe(),t.useDepthPacking?"#define DEPTH_PACKING "+t.depthPacking:"",`4053+`].filter(Vb).join(`4054+`)),o=OF(o),o=ZZ(o,t),o=KZ(o,t),a=OF(a),a=ZZ(a,t),a=KZ(a,t),o=QZ(o),a=QZ(a),t.isRawShaderMaterial!==!0&&(R=`#version 300 es40554055 `,S=[A,"#define attribute in","#define varying out","#define texture2D texture"].join(`40564056 `)+`4057-`+S,T=["#define varying in",t.glslVersion===$8?"":"layout(location = 0) out highp vec4 pc_fragColor;",t.glslVersion===$8?"":"#define gl_FragColor pc_fragColor","#define gl_FragDepthEXT gl_FragDepth","#define texture2D texture","#define textureCube texture","#define texture2DProj textureProj","#define texture2DLodEXT textureLod","#define texture2DProjLodEXT textureProjLod","#define textureCubeLodEXT textureLod","#define texture2DGradEXT textureGrad","#define texture2DProjGradEXT textureProjGrad","#define textureCubeGradEXT textureGrad"].join(`4057+`+S,T=["#define varying in",t.glslVersion===mF?"":"layout(location = 0) out highp vec4 pc_fragColor;",t.glslVersion===mF?"":"#define gl_FragColor pc_fragColor","#define gl_FragDepthEXT gl_FragDepth","#define texture2D texture","#define textureCube texture","#define texture2DProj textureProj","#define texture2DLodEXT textureLod","#define texture2DProjLodEXT textureProjLod","#define textureCubeLodEXT textureLod","#define texture2DGradEXT textureGrad","#define texture2DProjGradEXT textureProjGrad","#define textureCubeGradEXT textureGrad"].join(`40584058 `)+`4059-`+T);let P=R+S+o,I=R+T+a,F=bZ(r,r.VERTEX_SHADER,P),D=bZ(r,r.FRAGMENT_SHADER,I);r.attachShader(w,F),r.attachShader(w,D),t.index0AttributeName!==void 0?r.bindAttribLocation(w,0,t.index0AttributeName):t.hasPositionAttribute===!0&&r.bindAttribLocation(w,0,"position"),r.linkProgram(w);function L(z){if(i.debug.checkShaderErrors){let G=r.getProgramInfoLog(w)||"",W=r.getShaderInfoLog(F)||"",Y=r.getShaderInfoLog(D)||"",H=G.trim(),$=W.trim(),J=Y.trim(),te=!0,ce=!0;if(r.getProgramParameter(w,r.LINK_STATUS)===!1)if(te=!1,typeof i.debug.onShaderError=="function")i.debug.onShaderError(r,w,F,D);else{let he=SZ(r,F,"vertex"),ve=SZ(r,D,"fragment");ze("WebGLProgram: Shader Error "+r.getError()+" - VALIDATE_STATUS "+r.getProgramParameter(w,r.VALIDATE_STATUS)+`4059+`+T);let I=R+S+o,P=R+T+a,F=XZ(r,r.VERTEX_SHADER,I),D=XZ(r,r.FRAGMENT_SHADER,P);r.attachShader(w,F),r.attachShader(w,D),t.index0AttributeName!==void 0?r.bindAttribLocation(w,0,t.index0AttributeName):t.hasPositionAttribute===!0&&r.bindAttribLocation(w,0,"position"),r.linkProgram(w);function L(z){if(i.debug.checkShaderErrors){let G=r.getProgramInfoLog(w)||"",W=r.getShaderInfoLog(F)||"",Y=r.getShaderInfoLog(D)||"",H=G.trim(),$=W.trim(),J=Y.trim(),te=!0,ce=!0;if(r.getProgramParameter(w,r.LINK_STATUS)===!1)if(te=!1,typeof i.debug.onShaderError=="function")i.debug.onShaderError(r,w,F,D);else{let he=YZ(r,F,"vertex"),ve=YZ(r,D,"fragment");ze("WebGLProgram: Shader Error "+r.getError()+" - VALIDATE_STATUS "+r.getProgramParameter(w,r.VALIDATE_STATUS)+`40604060 40614061 Material Name: `+z.name+`40624062 Material Type: `+z.type+`40634063 40644064 Program Info Log: `+H+`40654065 `+he+`4066-`+ve)}else H!==""?Xe("WebGLProgram: Program Info Log:",H):($===""||J==="")&&(ce=!1);ce&&(z.diagnostics={runnable:te,programLog:H,vertexShader:{log:$,prefix:S},fragmentShader:{log:J,prefix:T}})}r.deleteShader(F),r.deleteShader(D),C=new l_(r,w),B=M_e(r,w)}let C;this.getUniforms=function(){return C===void 0&&L(this),C};let B;this.getAttributes=function(){return B===void 0&&L(this),B};let k=t.rendererExtensionParallelShaderCompile===!1;return this.isReady=function(){return k===!1&&(k=r.getProgramParameter(w,g_e)),k},this.destroy=function(){n.releaseStatesOfProgram(this),r.deleteProgram(w),this.program=void 0},this.type=t.shaderType,this.name=t.shaderName,this.id=v_e++,this.cacheKey=e,this.usedTimes=1,this.program=w,this.vertexShader=F,this.fragmentShader=D,this}var q_e=0,gF=class{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(e,t,n){let r=this._getShaderCacheForMaterial(e);return r.has(t)===!1&&(r.add(t),t.usedTimes++),r.has(n)===!1&&(r.add(n),n.usedTimes++),this}remove(e){let t=this.materialCache.get(e);for(let n of t)n.usedTimes--,n.usedTimes===0&&this.shaderCache.delete(n.code);return this.materialCache.delete(e),this}getVertexShaderStage(e){return this._getShaderStage(e.vertexShader)}getFragmentShaderStage(e){return this._getShaderStage(e.fragmentShader)}dispose(){this.shaderCache.clear(),this.materialCache.clear()}_getShaderCacheForMaterial(e){let t=this.materialCache,n=t.get(e);return n===void 0&&(n=new Set,t.set(e,n)),n}_getShaderStage(e){let t=this.shaderCache,n=t.get(e);return n===void 0&&(n=new vF(e),t.set(e,n)),n}},vF=class{constructor(e){this.id=q_e++,this.code=e,this.usedTimes=0}};function H_e(i){return i===js||i===Wh||i===jh}function W_e(i,e,t,n,r,s){let o=new Wv,a=new gF,l=new Set,c=[],u=new Map,f=n.logarithmicDepthBuffer,d=n.precision,A={MeshDepthMaterial:"depth",MeshDistanceMaterial:"distance",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",MeshToonMaterial:"toon",MeshStandardMaterial:"physical",MeshPhysicalMaterial:"physical",MeshMatcapMaterial:"matcap",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointsMaterial:"points",ShadowMaterial:"shadow",SpriteMaterial:"sprite"};function y(C){return l.add(C),C===0?"uv":`uv${C}`}function w(C,B,k,z,G,W){let Y=z.fog,H=G.geometry,$=C.isMeshStandardMaterial||C.isMeshLambertMaterial||C.isMeshPhongMaterial?z.environment:null,J=C.isMeshStandardMaterial||C.isMeshLambertMaterial&&!C.envMap||C.isMeshPhongMaterial&&!C.envMap,te=e.get(C.envMap||$,J),ce=te&&te.mapping===Bh?te.image.height:null,he=A[C.type];C.precision!==null&&(d=n.getMaxPrecision(C.precision),d!==C.precision&&Xe("WebGLProgram.getParameters:",C.precision,"not supported, using",d,"instead."));let ve=H.morphAttributes.position||H.morphAttributes.normal||H.morphAttributes.color,Re=ve!==void 0?ve.length:0,Qe=0;H.morphAttributes.position!==void 0&&(Qe=1),H.morphAttributes.normal!==void 0&&(Qe=2),H.morphAttributes.color!==void 0&&(Qe=3);let Fe,mt,Ee,Ve;if(he){let Yt=qa[he];Fe=Yt.vertexShader,mt=Yt.fragmentShader}else{Fe=C.vertexShader,mt=C.fragmentShader;let Yt=a.getVertexShaderStage(C),nr=a.getFragmentShaderStage(C);a.update(C,Yt,nr),Ee=Yt.id,Ve=nr.id}let Ye=i.getRenderTarget(),Mt=i.state.buffers.depth.getReversed(),Et=G.isInstancedMesh===!0,It=G.isBatchedMesh===!0,dn=!!C.map,Gt=!!C.matcap,$e=!!te,ot=!!C.aoMap,nt=!!C.lightMap,bt=!!C.bumpMap&&C.wireframe===!1,yt=!!C.normalMap,hn=!!C.displacementMap,tn=!!C.emissiveMap,nn=!!C.metalnessMap,bn=!!C.roughnessMap,_e=C.anisotropy>0,vi=C.clearcoat>0,zn=C.dispersion>0,le=C.iridescence>0,Z=C.sheen>0,Te=C.transmission>0,Pe=_e&&!!C.anisotropyMap,Ge=vi&&!!C.clearcoatMap,vt=vi&&!!C.clearcoatNormalMap,Tt=vi&&!!C.clearcoatRoughnessMap,qe=le&&!!C.iridescenceMap,Je=le&&!!C.iridescenceThicknessMap,Pt=Z&&!!C.sheenColorMap,sn=Z&&!!C.sheenRoughnessMap,Lt=!!C.specularMap,Rt=!!C.specularColorMap,fn=!!C.specularIntensityMap,wn=Te&&!!C.transmissionMap,Dn=Te&&!!C.thicknessMap,ye=!!C.gradientMap,wt=!!C.alphaMap,Ze=C.alphaTest>0,St=!!C.alphaHash,Bt=!!C.extensions,ut=ao;C.toneMapped&&(Ye===null||Ye.isXRRenderTarget===!0)&&(ut=i.toneMapping);let Ce={shaderID:he,shaderType:C.type,shaderName:C.name,vertexShader:Fe,fragmentShader:mt,defines:C.defines,customVertexShaderID:Ee,customFragmentShaderID:Ve,isRawShaderMaterial:C.isRawShaderMaterial===!0,glslVersion:C.glslVersion,precision:d,batching:It,batchingColor:It&&G._colorsTexture!==null,instancing:Et,instancingColor:Et&&G.instanceColor!==null,instancingMorph:Et&&G.morphTexture!==null,outputColorSpace:Ye===null?i.outputColorSpace:Ye.isXRRenderTarget===!0?Ye.texture.colorSpace:ln.workingColorSpace,alphaToCoverage:!!C.alphaToCoverage,map:dn,matcap:Gt,envMap:$e,envMapMode:$e&&te.mapping,envMapCubeUVHeight:ce,aoMap:ot,lightMap:nt,bumpMap:bt,normalMap:yt,displacementMap:hn,emissiveMap:tn,normalMapObjectSpace:yt&&C.normalMapType===PM,normalMapTangentSpace:yt&&C.normalMapType===Ql,packedNormalMap:yt&&C.normalMapType===Ql&&H_e(C.normalMap.format),metalnessMap:nn,roughnessMap:bn,anisotropy:_e,anisotropyMap:Pe,clearcoat:vi,clearcoatMap:Ge,clearcoatNormalMap:vt,clearcoatRoughnessMap:Tt,dispersion:zn,iridescence:le,iridescenceMap:qe,iridescenceThicknessMap:Je,sheen:Z,sheenColorMap:Pt,sheenRoughnessMap:sn,specularMap:Lt,specularColorMap:Rt,specularIntensityMap:fn,transmission:Te,transmissionMap:wn,thicknessMap:Dn,gradientMap:ye,opaque:C.transparent===!1&&C.blending===Ms&&C.alphaToCoverage===!1,alphaMap:wt,alphaTest:Ze,alphaHash:St,combine:C.combine,mapUv:dn&&y(C.map.channel),aoMapUv:ot&&y(C.aoMap.channel),lightMapUv:nt&&y(C.lightMap.channel),bumpMapUv:bt&&y(C.bumpMap.channel),normalMapUv:yt&&y(C.normalMap.channel),displacementMapUv:hn&&y(C.displacementMap.channel),emissiveMapUv:tn&&y(C.emissiveMap.channel),metalnessMapUv:nn&&y(C.metalnessMap.channel),roughnessMapUv:bn&&y(C.roughnessMap.channel),anisotropyMapUv:Pe&&y(C.anisotropyMap.channel),clearcoatMapUv:Ge&&y(C.clearcoatMap.channel),clearcoatNormalMapUv:vt&&y(C.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:Tt&&y(C.clearcoatRoughnessMap.channel),iridescenceMapUv:qe&&y(C.iridescenceMap.channel),iridescenceThicknessMapUv:Je&&y(C.iridescenceThicknessMap.channel),sheenColorMapUv:Pt&&y(C.sheenColorMap.channel),sheenRoughnessMapUv:sn&&y(C.sheenRoughnessMap.channel),specularMapUv:Lt&&y(C.specularMap.channel),specularColorMapUv:Rt&&y(C.specularColorMap.channel),specularIntensityMapUv:fn&&y(C.specularIntensityMap.channel),transmissionMapUv:wn&&y(C.transmissionMap.channel),thicknessMapUv:Dn&&y(C.thicknessMap.channel),alphaMapUv:wt&&y(C.alphaMap.channel),vertexTangents:!!H.attributes.tangent&&(yt||_e),vertexNormals:!!H.attributes.normal,vertexColors:C.vertexColors,vertexAlphas:C.vertexColors===!0&&!!H.attributes.color&&H.attributes.color.itemSize===4,pointsUvs:G.isPoints===!0&&!!H.attributes.uv&&(dn||wt),fog:!!Y,useFog:C.fog===!0,fogExp2:!!Y&&Y.isFogExp2,flatShading:C.wireframe===!1&&(C.flatShading===!0||H.attributes.normal===void 0&&yt===!1&&(C.isMeshLambertMaterial||C.isMeshPhongMaterial||C.isMeshStandardMaterial||C.isMeshPhysicalMaterial)),sizeAttenuation:C.sizeAttenuation===!0,logarithmicDepthBuffer:f,reversedDepthBuffer:Mt,skinning:G.isSkinnedMesh===!0,hasPositionAttribute:H.attributes.position!==void 0,morphTargets:H.morphAttributes.position!==void 0,morphNormals:H.morphAttributes.normal!==void 0,morphColors:H.morphAttributes.color!==void 0,morphTargetsCount:Re,morphTextureStride:Qe,numDirLights:B.directional.length,numPointLights:B.point.length,numSpotLights:B.spot.length,numSpotLightMaps:B.spotLightMap.length,numRectAreaLights:B.rectArea.length,numHemiLights:B.hemi.length,numDirLightShadows:B.directionalShadowMap.length,numPointLightShadows:B.pointShadowMap.length,numSpotLightShadows:B.spotShadowMap.length,numSpotLightShadowsWithMaps:B.numSpotLightShadowsWithMaps,numLightProbes:B.numLightProbes,numLightProbeGrids:W.length,numClippingPlanes:s.numPlanes,numClipIntersection:s.numIntersection,dithering:C.dithering,shadowMapEnabled:i.shadowMap.enabled&&k.length>0,shadowMapType:i.shadowMap.type,toneMapping:ut,decodeVideoTexture:dn&&C.map.isVideoTexture===!0&&ln.getTransfer(C.map.colorSpace)===kt,decodeVideoTextureEmissive:tn&&C.emissiveMap.isVideoTexture===!0&&ln.getTransfer(C.emissiveMap.colorSpace)===kt,premultipliedAlpha:C.premultipliedAlpha,doubleSided:C.side===gr,flipSided:C.side===mi,useDepthPacking:C.depthPacking>=0,depthPacking:C.depthPacking||0,index0AttributeName:C.index0AttributeName,extensionClipCullDistance:Bt&&C.extensions.clipCullDistance===!0&&t.has("WEBGL_clip_cull_distance"),extensionMultiDraw:(Bt&&C.extensions.multiDraw===!0||It)&&t.has("WEBGL_multi_draw"),rendererExtensionParallelShaderCompile:t.has("KHR_parallel_shader_compile"),customProgramCacheKey:C.customProgramCacheKey()};return Ce.vertexUv1s=l.has(1),Ce.vertexUv2s=l.has(2),Ce.vertexUv3s=l.has(3),l.clear(),Ce}function S(C){let B=[];if(C.shaderID?B.push(C.shaderID):(B.push(C.customVertexShaderID),B.push(C.customFragmentShaderID)),C.defines!==void 0)for(let k in C.defines)B.push(k),B.push(C.defines[k]);return C.isRawShaderMaterial===!1&&(T(B,C),R(B,C),B.push(i.outputColorSpace)),B.push(C.customProgramCacheKey),B.join()}function T(C,B){C.push(B.precision),C.push(B.outputColorSpace),C.push(B.envMapMode),C.push(B.envMapCubeUVHeight),C.push(B.mapUv),C.push(B.alphaMapUv),C.push(B.lightMapUv),C.push(B.aoMapUv),C.push(B.bumpMapUv),C.push(B.normalMapUv),C.push(B.displacementMapUv),C.push(B.emissiveMapUv),C.push(B.metalnessMapUv),C.push(B.roughnessMapUv),C.push(B.anisotropyMapUv),C.push(B.clearcoatMapUv),C.push(B.clearcoatNormalMapUv),C.push(B.clearcoatRoughnessMapUv),C.push(B.iridescenceMapUv),C.push(B.iridescenceThicknessMapUv),C.push(B.sheenColorMapUv),C.push(B.sheenRoughnessMapUv),C.push(B.specularMapUv),C.push(B.specularColorMapUv),C.push(B.specularIntensityMapUv),C.push(B.transmissionMapUv),C.push(B.thicknessMapUv),C.push(B.combine),C.push(B.fogExp2),C.push(B.sizeAttenuation),C.push(B.morphTargetsCount),C.push(B.morphAttributeCount),C.push(B.numDirLights),C.push(B.numPointLights),C.push(B.numSpotLights),C.push(B.numSpotLightMaps),C.push(B.numHemiLights),C.push(B.numRectAreaLights),C.push(B.numDirLightShadows),C.push(B.numPointLightShadows),C.push(B.numSpotLightShadows),C.push(B.numSpotLightShadowsWithMaps),C.push(B.numLightProbes),C.push(B.shadowMapType),C.push(B.toneMapping),C.push(B.numClippingPlanes),C.push(B.numClipIntersection),C.push(B.depthPacking)}function R(C,B){o.disableAll(),B.instancing&&o.enable(0),B.instancingColor&&o.enable(1),B.instancingMorph&&o.enable(2),B.matcap&&o.enable(3),B.envMap&&o.enable(4),B.normalMapObjectSpace&&o.enable(5),B.normalMapTangentSpace&&o.enable(6),B.clearcoat&&o.enable(7),B.iridescence&&o.enable(8),B.alphaTest&&o.enable(9),B.vertexColors&&o.enable(10),B.vertexAlphas&&o.enable(11),B.vertexUv1s&&o.enable(12),B.vertexUv2s&&o.enable(13),B.vertexUv3s&&o.enable(14),B.vertexTangents&&o.enable(15),B.anisotropy&&o.enable(16),B.alphaHash&&o.enable(17),B.batching&&o.enable(18),B.dispersion&&o.enable(19),B.batchingColor&&o.enable(20),B.gradientMap&&o.enable(21),B.packedNormalMap&&o.enable(22),B.vertexNormals&&o.enable(23),C.push(o.mask),o.disableAll(),B.fog&&o.enable(0),B.useFog&&o.enable(1),B.flatShading&&o.enable(2),B.logarithmicDepthBuffer&&o.enable(3),B.reversedDepthBuffer&&o.enable(4),B.skinning&&o.enable(5),B.morphTargets&&o.enable(6),B.morphNormals&&o.enable(7),B.morphColors&&o.enable(8),B.premultipliedAlpha&&o.enable(9),B.shadowMapEnabled&&o.enable(10),B.doubleSided&&o.enable(11),B.flipSided&&o.enable(12),B.useDepthPacking&&o.enable(13),B.dithering&&o.enable(14),B.transmission&&o.enable(15),B.sheen&&o.enable(16),B.opaque&&o.enable(17),B.pointsUvs&&o.enable(18),B.decodeVideoTexture&&o.enable(19),B.decodeVideoTextureEmissive&&o.enable(20),B.alphaToCoverage&&o.enable(21),B.numLightProbeGrids>0&&o.enable(22),B.hasPositionAttribute&&o.enable(23),C.push(o.mask)}function P(C){let B=A[C.type],k;if(B){let z=qa[B];k=lg.clone(z.uniforms)}else k=C.uniforms;return k}function I(C,B){let k=u.get(B);return k!==void 0?++k.usedTimes:(k=new G_e(i,B,C,r),c.push(k),u.set(B,k)),k}function F(C){if(--C.usedTimes===0){let B=c.indexOf(C);c[B]=c[c.length-1],c.pop(),u.delete(C.cacheKey),C.destroy()}}function D(C){a.remove(C)}function L(){a.dispose()}return{getParameters:w,getProgramCacheKey:S,getUniforms:P,acquireProgram:I,releaseProgram:F,releaseShaderCache:D,programs:c,dispose:L}}function j_e(){let i=new WeakMap;function e(o){return i.has(o)}function t(o){let a=i.get(o);return a===void 0&&(a={},i.set(o,a)),a}function n(o){i.delete(o)}function r(o,a,l){i.get(o)[a]=l}function s(){i=new WeakMap}return{has:e,get:t,remove:n,update:r,dispose:s}}function X_e(i,e){return i.groupOrder!==e.groupOrder?i.groupOrder-e.groupOrder:i.renderOrder!==e.renderOrder?i.renderOrder-e.renderOrder:i.material.id!==e.material.id?i.material.id-e.material.id:i.materialVariant!==e.materialVariant?i.materialVariant-e.materialVariant:i.z!==e.z?i.z-e.z:i.id-e.id}function RZ(i,e){return i.groupOrder!==e.groupOrder?i.groupOrder-e.groupOrder:i.renderOrder!==e.renderOrder?i.renderOrder-e.renderOrder:i.z!==e.z?e.z-i.z:i.id-e.id}function IZ(){let i=[],e=0,t=[],n=[],r=[];function s(){e=0,t.length=0,n.length=0,r.length=0}function o(d){let A=0;return d.isInstancedMesh&&(A+=2),d.isSkinnedMesh&&(A+=1),A}function a(d,A,y,w,S,T){let R=i[e];return R===void 0?(R={id:d.id,object:d,geometry:A,material:y,materialVariant:o(d),groupOrder:w,renderOrder:d.renderOrder,z:S,group:T},i[e]=R):(R.id=d.id,R.object=d,R.geometry=A,R.material=y,R.materialVariant=o(d),R.groupOrder=w,R.renderOrder=d.renderOrder,R.z=S,R.group=T),e++,R}function l(d,A,y,w,S,T){let R=a(d,A,y,w,S,T);y.transmission>0?n.push(R):y.transparent===!0?r.push(R):t.push(R)}function c(d,A,y,w,S,T){let R=a(d,A,y,w,S,T);y.transmission>0?n.unshift(R):y.transparent===!0?r.unshift(R):t.unshift(R)}function u(d,A,y){t.length>1&&t.sort(d||X_e),n.length>1&&n.sort(A||RZ),r.length>1&&r.sort(A||RZ),y&&(t.reverse(),n.reverse(),r.reverse())}function f(){for(let d=e,A=i.length;d<A;d++){let y=i[d];if(y.id===null)break;y.id=null,y.object=null,y.geometry=null,y.material=null,y.group=null}}return{opaque:t,transmissive:n,transparent:r,init:s,push:l,unshift:c,finish:f,sort:u}}function $_e(){let i=new WeakMap;function e(n,r){let s=i.get(n),o;return s===void 0?(o=new IZ,i.set(n,[o])):r>=s.length?(o=new IZ,s.push(o)):o=s[r],o}function t(){i=new WeakMap}return{get:e,dispose:t}}function Y_e(){let i={};return{get:function(e){if(i[e.id]!==void 0)return i[e.id];let t;switch(e.type){case"DirectionalLight":t={direction:new re,color:new zt};break;case"SpotLight":t={position:new re,direction:new re,color:new zt,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":t={position:new re,color:new zt,distance:0,decay:0};break;case"HemisphereLight":t={direction:new re,skyColor:new zt,groundColor:new zt};break;case"RectAreaLight":t={color:new zt,position:new re,halfWidth:new re,halfHeight:new re};break}return i[e.id]=t,t}}}function Z_e(){let i={};return{get:function(e){if(i[e.id]!==void 0)return i[e.id];let t;switch(e.type){case"DirectionalLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Oe};break;case"SpotLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Oe};break;case"PointLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Oe,shadowCameraNear:1,shadowCameraFar:1e3};break}return i[e.id]=t,t}}}var K_e=0;function Q_e(i,e){return(e.castShadow?2:0)-(i.castShadow?2:0)+(e.map?1:0)-(i.map?1:0)}function J_e(i){let e=new Y_e,t=Z_e(),n={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1,numSpotMaps:-1,numLightProbes:-1},ambient:[0,0,0],probe:[],directional:[],directionalShadow:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotLightMap:[],spotShadow:[],spotShadowMap:[],spotLightMatrix:[],rectArea:[],rectAreaLTC1:null,rectAreaLTC2:null,point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[],numSpotLightShadowsWithMaps:0,numLightProbes:0};for(let c=0;c<9;c++)n.probe.push(new re);let r=new re,s=new cn,o=new cn;function a(c){let u=0,f=0,d=0;for(let B=0;B<9;B++)n.probe[B].set(0,0,0);let A=0,y=0,w=0,S=0,T=0,R=0,P=0,I=0,F=0,D=0,L=0;c.sort(Q_e);for(let B=0,k=c.length;B<k;B++){let z=c[B],G=z.color,W=z.intensity,Y=z.distance,H=null;if(z.shadow&&z.shadow.map&&(z.shadow.map.texture.format===js?H=z.shadow.map.texture:H=z.shadow.map.depthTexture||z.shadow.map.texture),z.isAmbientLight)u+=G.r*W,f+=G.g*W,d+=G.b*W;else if(z.isLightProbe){for(let $=0;$<9;$++)n.probe[$].addScaledVector(z.sh.coefficients[$],W);L++}else if(z.isDirectionalLight){let $=e.get(z);if($.color.copy(z.color).multiplyScalar(z.intensity),z.castShadow){let J=z.shadow,te=t.get(z);te.shadowIntensity=J.intensity,te.shadowBias=J.bias,te.shadowNormalBias=J.normalBias,te.shadowRadius=J.radius,te.shadowMapSize=J.mapSize,n.directionalShadow[A]=te,n.directionalShadowMap[A]=H,n.directionalShadowMatrix[A]=z.shadow.matrix,R++}n.directional[A]=$,A++}else if(z.isSpotLight){let $=e.get(z);$.position.setFromMatrixPosition(z.matrixWorld),$.color.copy(G).multiplyScalar(W),$.distance=Y,$.coneCos=Math.cos(z.angle),$.penumbraCos=Math.cos(z.angle*(1-z.penumbra)),$.decay=z.decay,n.spot[w]=$;let J=z.shadow;if(z.map&&(n.spotLightMap[F]=z.map,F++,J.updateMatrices(z),z.castShadow&&D++),n.spotLightMatrix[w]=J.matrix,z.castShadow){let te=t.get(z);te.shadowIntensity=J.intensity,te.shadowBias=J.bias,te.shadowNormalBias=J.normalBias,te.shadowRadius=J.radius,te.shadowMapSize=J.mapSize,n.spotShadow[w]=te,n.spotShadowMap[w]=H,I++}w++}else if(z.isRectAreaLight){let $=e.get(z);$.color.copy(G).multiplyScalar(W),$.halfWidth.set(z.width*.5,0,0),$.halfHeight.set(0,z.height*.5,0),n.rectArea[S]=$,S++}else if(z.isPointLight){let $=e.get(z);if($.color.copy(z.color).multiplyScalar(z.intensity),$.distance=z.distance,$.decay=z.decay,z.castShadow){let J=z.shadow,te=t.get(z);te.shadowIntensity=J.intensity,te.shadowBias=J.bias,te.shadowNormalBias=J.normalBias,te.shadowRadius=J.radius,te.shadowMapSize=J.mapSize,te.shadowCameraNear=J.camera.near,te.shadowCameraFar=J.camera.far,n.pointShadow[y]=te,n.pointShadowMap[y]=H,n.pointShadowMatrix[y]=z.shadow.matrix,P++}n.point[y]=$,y++}else if(z.isHemisphereLight){let $=e.get(z);$.skyColor.copy(z.color).multiplyScalar(W),$.groundColor.copy(z.groundColor).multiplyScalar(W),n.hemi[T]=$,T++}}S>0&&(i.has("OES_texture_float_linear")===!0?(n.rectAreaLTC1=Nt.LTC_FLOAT_1,n.rectAreaLTC2=Nt.LTC_FLOAT_2):(n.rectAreaLTC1=Nt.LTC_HALF_1,n.rectAreaLTC2=Nt.LTC_HALF_2)),n.ambient[0]=u,n.ambient[1]=f,n.ambient[2]=d;let C=n.hash;(C.directionalLength!==A||C.pointLength!==y||C.spotLength!==w||C.rectAreaLength!==S||C.hemiLength!==T||C.numDirectionalShadows!==R||C.numPointShadows!==P||C.numSpotShadows!==I||C.numSpotMaps!==F||C.numLightProbes!==L)&&(n.directional.length=A,n.spot.length=w,n.rectArea.length=S,n.point.length=y,n.hemi.length=T,n.directionalShadow.length=R,n.directionalShadowMap.length=R,n.pointShadow.length=P,n.pointShadowMap.length=P,n.spotShadow.length=I,n.spotShadowMap.length=I,n.directionalShadowMatrix.length=R,n.pointShadowMatrix.length=P,n.spotLightMatrix.length=I+F-D,n.spotLightMap.length=F,n.numSpotLightShadowsWithMaps=D,n.numLightProbes=L,C.directionalLength=A,C.pointLength=y,C.spotLength=w,C.rectAreaLength=S,C.hemiLength=T,C.numDirectionalShadows=R,C.numPointShadows=P,C.numSpotShadows=I,C.numSpotMaps=F,C.numLightProbes=L,n.version=K_e++)}function l(c,u){let f=0,d=0,A=0,y=0,w=0,S=u.matrixWorldInverse;for(let T=0,R=c.length;T<R;T++){let P=c[T];if(P.isDirectionalLight){let I=n.directional[f];I.direction.setFromMatrixPosition(P.matrixWorld),r.setFromMatrixPosition(P.target.matrixWorld),I.direction.sub(r),I.direction.transformDirection(S),f++}else if(P.isSpotLight){let I=n.spot[A];I.position.setFromMatrixPosition(P.matrixWorld),I.position.applyMatrix4(S),I.direction.setFromMatrixPosition(P.matrixWorld),r.setFromMatrixPosition(P.target.matrixWorld),I.direction.sub(r),I.direction.transformDirection(S),A++}else if(P.isRectAreaLight){let I=n.rectArea[y];I.position.setFromMatrixPosition(P.matrixWorld),I.position.applyMatrix4(S),o.identity(),s.copy(P.matrixWorld),s.premultiply(S),o.extractRotation(s),I.halfWidth.set(P.width*.5,0,0),I.halfHeight.set(0,P.height*.5,0),I.halfWidth.applyMatrix4(o),I.halfHeight.applyMatrix4(o),y++}else if(P.isPointLight){let I=n.point[d];I.position.setFromMatrixPosition(P.matrixWorld),I.position.applyMatrix4(S),d++}else if(P.isHemisphereLight){let I=n.hemi[w];I.direction.setFromMatrixPosition(P.matrixWorld),I.direction.transformDirection(S),w++}}}return{setup:a,setupView:l,state:n}}function PZ(i){let e=new J_e(i),t=[],n=[],r=[];function s(d){f.camera=d,t.length=0,n.length=0,r.length=0}function o(d){t.push(d)}function a(d){n.push(d)}function l(d){r.push(d)}function c(){e.setup(t)}function u(d){e.setupView(t,d)}let f={lightsArray:t,shadowsArray:n,lightProbeGridArray:r,camera:null,lights:e,transmissionRenderTarget:{},textureUnits:0};return{init:s,state:f,setupLights:c,setupLightsView:u,pushLight:o,pushShadow:a,pushLightProbeGrid:l}}function exe(i){let e=new WeakMap;function t(r,s=0){let o=e.get(r),a;return o===void 0?(a=new PZ(i),e.set(r,[a])):s>=o.length?(a=new PZ(i),o.push(a)):a=o[s],a}function n(){e=new WeakMap}return{get:t,dispose:n}}var txe=`void main() {4066+`+ve)}else H!==""?Xe("WebGLProgram: Program Info Log:",H):($===""||J==="")&&(ce=!1);ce&&(z.diagnostics={runnable:te,programLog:H,vertexShader:{log:$,prefix:S},fragmentShader:{log:J,prefix:T}})}r.deleteShader(F),r.deleteShader(D),C=new p_(r,w),B=lxe(r,w)}let C;this.getUniforms=function(){return C===void 0&&L(this),C};let B;this.getAttributes=function(){return B===void 0&&L(this),B};let k=t.rendererExtensionParallelShaderCompile===!1;return this.isReady=function(){return k===!1&&(k=r.getProgramParameter(w,Q_e)),k},this.destroy=function(){n.releaseStatesOfProgram(this),r.deleteProgram(w),this.program=void 0},this.type=t.shaderType,this.name=t.shaderName,this.id=J_e++,this.cacheKey=e,this.usedTimes=1,this.program=w,this.vertexShader=F,this.fragmentShader=D,this}var Sxe=0,UF=class{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(e,t,n){let r=this._getShaderCacheForMaterial(e);return r.has(t)===!1&&(r.add(t),t.usedTimes++),r.has(n)===!1&&(r.add(n),n.usedTimes++),this}remove(e){let t=this.materialCache.get(e);for(let n of t)n.usedTimes--,n.usedTimes===0&&this.shaderCache.delete(n.code);return this.materialCache.delete(e),this}getVertexShaderStage(e){return this._getShaderStage(e.vertexShader)}getFragmentShaderStage(e){return this._getShaderStage(e.fragmentShader)}dispose(){this.shaderCache.clear(),this.materialCache.clear()}_getShaderCacheForMaterial(e){let t=this.materialCache,n=t.get(e);return n===void 0&&(n=new Set,t.set(e,n)),n}_getShaderStage(e){let t=this.shaderCache,n=t.get(e);return n===void 0&&(n=new kF(e),t.set(e,n)),n}},kF=class{constructor(e){this.id=Sxe++,this.code=e,this.usedTimes=0}};function Txe(i){return i===Ws||i===Wh||i===jh}function Exe(i,e,t,n,r,s){let o=new Kv,a=new UF,l=new Set,c=[],u=new Map,f=n.logarithmicDepthBuffer,d=n.precision,A={MeshDepthMaterial:"depth",MeshDistanceMaterial:"distance",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",MeshToonMaterial:"toon",MeshStandardMaterial:"physical",MeshPhysicalMaterial:"physical",MeshMatcapMaterial:"matcap",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointsMaterial:"points",ShadowMaterial:"shadow",SpriteMaterial:"sprite"};function y(C){return l.add(C),C===0?"uv":`uv${C}`}function w(C,B,k,z,G,W){let Y=z.fog,H=G.geometry,$=C.isMeshStandardMaterial||C.isMeshLambertMaterial||C.isMeshPhongMaterial?z.environment:null,J=C.isMeshStandardMaterial||C.isMeshLambertMaterial&&!C.envMap||C.isMeshPhongMaterial&&!C.envMap,te=e.get(C.envMap||$,J),ce=te&&te.mapping===Bh?te.image.height:null,he=A[C.type];C.precision!==null&&(d=n.getMaxPrecision(C.precision),d!==C.precision&&Xe("WebGLProgram.getParameters:",C.precision,"not supported, using",d,"instead."));let ve=H.morphAttributes.position||H.morphAttributes.normal||H.morphAttributes.color,Re=ve!==void 0?ve.length:0,Qe=0;H.morphAttributes.position!==void 0&&(Qe=1),H.morphAttributes.normal!==void 0&&(Qe=2),H.morphAttributes.color!==void 0&&(Qe=3);let Fe,mt,Ee,Ve;if(he){let Yt=Ha[he];Fe=Yt.vertexShader,mt=Yt.fragmentShader}else{Fe=C.vertexShader,mt=C.fragmentShader;let Yt=a.getVertexShaderStage(C),nr=a.getFragmentShaderStage(C);a.update(C,Yt,nr),Ee=Yt.id,Ve=nr.id}let Ye=i.getRenderTarget(),Mt=i.state.buffers.depth.getReversed(),Et=G.isInstancedMesh===!0,Pt=G.isBatchedMesh===!0,dn=!!C.map,Gt=!!C.matcap,$e=!!te,ot=!!C.aoMap,nt=!!C.lightMap,bt=!!C.bumpMap&&C.wireframe===!1,yt=!!C.normalMap,hn=!!C.displacementMap,en=!!C.emissiveMap,tn=!!C.metalnessMap,bn=!!C.roughnessMap,_e=C.anisotropy>0,vi=C.clearcoat>0,zn=C.dispersion>0,le=C.iridescence>0,Z=C.sheen>0,Te=C.transmission>0,Ie=_e&&!!C.anisotropyMap,Ge=vi&&!!C.clearcoatMap,vt=vi&&!!C.clearcoatNormalMap,Tt=vi&&!!C.clearcoatRoughnessMap,qe=le&&!!C.iridescenceMap,Je=le&&!!C.iridescenceThicknessMap,It=Z&&!!C.sheenColorMap,rn=Z&&!!C.sheenRoughnessMap,Lt=!!C.specularMap,Rt=!!C.specularColorMap,fn=!!C.specularIntensityMap,wn=Te&&!!C.transmissionMap,Dn=Te&&!!C.thicknessMap,ye=!!C.gradientMap,wt=!!C.alphaMap,Ze=C.alphaTest>0,St=!!C.alphaHash,Bt=!!C.extensions,ut=ao;C.toneMapped&&(Ye===null||Ye.isXRRenderTarget===!0)&&(ut=i.toneMapping);let Ce={shaderID:he,shaderType:C.type,shaderName:C.name,vertexShader:Fe,fragmentShader:mt,defines:C.defines,customVertexShaderID:Ee,customFragmentShaderID:Ve,isRawShaderMaterial:C.isRawShaderMaterial===!0,glslVersion:C.glslVersion,precision:d,batching:Pt,batchingColor:Pt&&G._colorsTexture!==null,instancing:Et,instancingColor:Et&&G.instanceColor!==null,instancingMorph:Et&&G.morphTexture!==null,outputColorSpace:Ye===null?i.outputColorSpace:Ye.isXRRenderTarget===!0?Ye.texture.colorSpace:ln.workingColorSpace,alphaToCoverage:!!C.alphaToCoverage,map:dn,matcap:Gt,envMap:$e,envMapMode:$e&&te.mapping,envMapCubeUVHeight:ce,aoMap:ot,lightMap:nt,bumpMap:bt,normalMap:yt,displacementMap:hn,emissiveMap:en,normalMapObjectSpace:yt&&C.normalMapType===kM,normalMapTangentSpace:yt&&C.normalMapType===tc,packedNormalMap:yt&&C.normalMapType===tc&&Txe(C.normalMap.format),metalnessMap:tn,roughnessMap:bn,anisotropy:_e,anisotropyMap:Ie,clearcoat:vi,clearcoatMap:Ge,clearcoatNormalMap:vt,clearcoatRoughnessMap:Tt,dispersion:zn,iridescence:le,iridescenceMap:qe,iridescenceThicknessMap:Je,sheen:Z,sheenColorMap:It,sheenRoughnessMap:rn,specularMap:Lt,specularColorMap:Rt,specularIntensityMap:fn,transmission:Te,transmissionMap:wn,thicknessMap:Dn,gradientMap:ye,opaque:C.transparent===!1&&C.blending===Ts&&C.alphaToCoverage===!1,alphaMap:wt,alphaTest:Ze,alphaHash:St,combine:C.combine,mapUv:dn&&y(C.map.channel),aoMapUv:ot&&y(C.aoMap.channel),lightMapUv:nt&&y(C.lightMap.channel),bumpMapUv:bt&&y(C.bumpMap.channel),normalMapUv:yt&&y(C.normalMap.channel),displacementMapUv:hn&&y(C.displacementMap.channel),emissiveMapUv:en&&y(C.emissiveMap.channel),metalnessMapUv:tn&&y(C.metalnessMap.channel),roughnessMapUv:bn&&y(C.roughnessMap.channel),anisotropyMapUv:Ie&&y(C.anisotropyMap.channel),clearcoatMapUv:Ge&&y(C.clearcoatMap.channel),clearcoatNormalMapUv:vt&&y(C.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:Tt&&y(C.clearcoatRoughnessMap.channel),iridescenceMapUv:qe&&y(C.iridescenceMap.channel),iridescenceThicknessMapUv:Je&&y(C.iridescenceThicknessMap.channel),sheenColorMapUv:It&&y(C.sheenColorMap.channel),sheenRoughnessMapUv:rn&&y(C.sheenRoughnessMap.channel),specularMapUv:Lt&&y(C.specularMap.channel),specularColorMapUv:Rt&&y(C.specularColorMap.channel),specularIntensityMapUv:fn&&y(C.specularIntensityMap.channel),transmissionMapUv:wn&&y(C.transmissionMap.channel),thicknessMapUv:Dn&&y(C.thicknessMap.channel),alphaMapUv:wt&&y(C.alphaMap.channel),vertexTangents:!!H.attributes.tangent&&(yt||_e),vertexNormals:!!H.attributes.normal,vertexColors:C.vertexColors,vertexAlphas:C.vertexColors===!0&&!!H.attributes.color&&H.attributes.color.itemSize===4,pointsUvs:G.isPoints===!0&&!!H.attributes.uv&&(dn||wt),fog:!!Y,useFog:C.fog===!0,fogExp2:!!Y&&Y.isFogExp2,flatShading:C.wireframe===!1&&(C.flatShading===!0||H.attributes.normal===void 0&&yt===!1&&(C.isMeshLambertMaterial||C.isMeshPhongMaterial||C.isMeshStandardMaterial||C.isMeshPhysicalMaterial)),sizeAttenuation:C.sizeAttenuation===!0,logarithmicDepthBuffer:f,reversedDepthBuffer:Mt,skinning:G.isSkinnedMesh===!0,hasPositionAttribute:H.attributes.position!==void 0,morphTargets:H.morphAttributes.position!==void 0,morphNormals:H.morphAttributes.normal!==void 0,morphColors:H.morphAttributes.color!==void 0,morphTargetsCount:Re,morphTextureStride:Qe,numDirLights:B.directional.length,numPointLights:B.point.length,numSpotLights:B.spot.length,numSpotLightMaps:B.spotLightMap.length,numRectAreaLights:B.rectArea.length,numHemiLights:B.hemi.length,numDirLightShadows:B.directionalShadowMap.length,numPointLightShadows:B.pointShadowMap.length,numSpotLightShadows:B.spotShadowMap.length,numSpotLightShadowsWithMaps:B.numSpotLightShadowsWithMaps,numLightProbes:B.numLightProbes,numLightProbeGrids:W.length,numClippingPlanes:s.numPlanes,numClipIntersection:s.numIntersection,dithering:C.dithering,shadowMapEnabled:i.shadowMap.enabled&&k.length>0,shadowMapType:i.shadowMap.type,toneMapping:ut,decodeVideoTexture:dn&&C.map.isVideoTexture===!0&&ln.getTransfer(C.map.colorSpace)===kt,decodeVideoTextureEmissive:en&&C.emissiveMap.isVideoTexture===!0&&ln.getTransfer(C.emissiveMap.colorSpace)===kt,premultipliedAlpha:C.premultipliedAlpha,doubleSided:C.side===vr,flipSided:C.side===mi,useDepthPacking:C.depthPacking>=0,depthPacking:C.depthPacking||0,index0AttributeName:C.index0AttributeName,extensionClipCullDistance:Bt&&C.extensions.clipCullDistance===!0&&t.has("WEBGL_clip_cull_distance"),extensionMultiDraw:(Bt&&C.extensions.multiDraw===!0||Pt)&&t.has("WEBGL_multi_draw"),rendererExtensionParallelShaderCompile:t.has("KHR_parallel_shader_compile"),customProgramCacheKey:C.customProgramCacheKey()};return Ce.vertexUv1s=l.has(1),Ce.vertexUv2s=l.has(2),Ce.vertexUv3s=l.has(3),l.clear(),Ce}function S(C){let B=[];if(C.shaderID?B.push(C.shaderID):(B.push(C.customVertexShaderID),B.push(C.customFragmentShaderID)),C.defines!==void 0)for(let k in C.defines)B.push(k),B.push(C.defines[k]);return C.isRawShaderMaterial===!1&&(T(B,C),R(B,C),B.push(i.outputColorSpace)),B.push(C.customProgramCacheKey),B.join()}function T(C,B){C.push(B.precision),C.push(B.outputColorSpace),C.push(B.envMapMode),C.push(B.envMapCubeUVHeight),C.push(B.mapUv),C.push(B.alphaMapUv),C.push(B.lightMapUv),C.push(B.aoMapUv),C.push(B.bumpMapUv),C.push(B.normalMapUv),C.push(B.displacementMapUv),C.push(B.emissiveMapUv),C.push(B.metalnessMapUv),C.push(B.roughnessMapUv),C.push(B.anisotropyMapUv),C.push(B.clearcoatMapUv),C.push(B.clearcoatNormalMapUv),C.push(B.clearcoatRoughnessMapUv),C.push(B.iridescenceMapUv),C.push(B.iridescenceThicknessMapUv),C.push(B.sheenColorMapUv),C.push(B.sheenRoughnessMapUv),C.push(B.specularMapUv),C.push(B.specularColorMapUv),C.push(B.specularIntensityMapUv),C.push(B.transmissionMapUv),C.push(B.thicknessMapUv),C.push(B.combine),C.push(B.fogExp2),C.push(B.sizeAttenuation),C.push(B.morphTargetsCount),C.push(B.morphAttributeCount),C.push(B.numDirLights),C.push(B.numPointLights),C.push(B.numSpotLights),C.push(B.numSpotLightMaps),C.push(B.numHemiLights),C.push(B.numRectAreaLights),C.push(B.numDirLightShadows),C.push(B.numPointLightShadows),C.push(B.numSpotLightShadows),C.push(B.numSpotLightShadowsWithMaps),C.push(B.numLightProbes),C.push(B.shadowMapType),C.push(B.toneMapping),C.push(B.numClippingPlanes),C.push(B.numClipIntersection),C.push(B.depthPacking)}function R(C,B){o.disableAll(),B.instancing&&o.enable(0),B.instancingColor&&o.enable(1),B.instancingMorph&&o.enable(2),B.matcap&&o.enable(3),B.envMap&&o.enable(4),B.normalMapObjectSpace&&o.enable(5),B.normalMapTangentSpace&&o.enable(6),B.clearcoat&&o.enable(7),B.iridescence&&o.enable(8),B.alphaTest&&o.enable(9),B.vertexColors&&o.enable(10),B.vertexAlphas&&o.enable(11),B.vertexUv1s&&o.enable(12),B.vertexUv2s&&o.enable(13),B.vertexUv3s&&o.enable(14),B.vertexTangents&&o.enable(15),B.anisotropy&&o.enable(16),B.alphaHash&&o.enable(17),B.batching&&o.enable(18),B.dispersion&&o.enable(19),B.batchingColor&&o.enable(20),B.gradientMap&&o.enable(21),B.packedNormalMap&&o.enable(22),B.vertexNormals&&o.enable(23),C.push(o.mask),o.disableAll(),B.fog&&o.enable(0),B.useFog&&o.enable(1),B.flatShading&&o.enable(2),B.logarithmicDepthBuffer&&o.enable(3),B.reversedDepthBuffer&&o.enable(4),B.skinning&&o.enable(5),B.morphTargets&&o.enable(6),B.morphNormals&&o.enable(7),B.morphColors&&o.enable(8),B.premultipliedAlpha&&o.enable(9),B.shadowMapEnabled&&o.enable(10),B.doubleSided&&o.enable(11),B.flipSided&&o.enable(12),B.useDepthPacking&&o.enable(13),B.dithering&&o.enable(14),B.transmission&&o.enable(15),B.sheen&&o.enable(16),B.opaque&&o.enable(17),B.pointsUvs&&o.enable(18),B.decodeVideoTexture&&o.enable(19),B.decodeVideoTextureEmissive&&o.enable(20),B.alphaToCoverage&&o.enable(21),B.numLightProbeGrids>0&&o.enable(22),B.hasPositionAttribute&&o.enable(23),C.push(o.mask)}function I(C){let B=A[C.type],k;if(B){let z=Ha[B];k=dg.clone(z.uniforms)}else k=C.uniforms;return k}function P(C,B){let k=u.get(B);return k!==void 0?++k.usedTimes:(k=new wxe(i,B,C,r),c.push(k),u.set(B,k)),k}function F(C){if(--C.usedTimes===0){let B=c.indexOf(C);c[B]=c[c.length-1],c.pop(),u.delete(C.cacheKey),C.destroy()}}function D(C){a.remove(C)}function L(){a.dispose()}return{getParameters:w,getProgramCacheKey:S,getUniforms:I,acquireProgram:P,releaseProgram:F,releaseShaderCache:D,programs:c,dispose:L}}function Mxe(){let i=new WeakMap;function e(o){return i.has(o)}function t(o){let a=i.get(o);return a===void 0&&(a={},i.set(o,a)),a}function n(o){i.delete(o)}function r(o,a,l){i.get(o)[a]=l}function s(){i=new WeakMap}return{has:e,get:t,remove:n,update:r,dispose:s}}function Cxe(i,e){return i.groupOrder!==e.groupOrder?i.groupOrder-e.groupOrder:i.renderOrder!==e.renderOrder?i.renderOrder-e.renderOrder:i.material.id!==e.material.id?i.material.id-e.material.id:i.materialVariant!==e.materialVariant?i.materialVariant-e.materialVariant:i.z!==e.z?i.z-e.z:i.id-e.id}function eK(i,e){return i.groupOrder!==e.groupOrder?i.groupOrder-e.groupOrder:i.renderOrder!==e.renderOrder?i.renderOrder-e.renderOrder:i.z!==e.z?e.z-i.z:i.id-e.id}function tK(){let i=[],e=0,t=[],n=[],r=[];function s(){e=0,t.length=0,n.length=0,r.length=0}function o(d){let A=0;return d.isInstancedMesh&&(A+=2),d.isSkinnedMesh&&(A+=1),A}function a(d,A,y,w,S,T){let R=i[e];return R===void 0?(R={id:d.id,object:d,geometry:A,material:y,materialVariant:o(d),groupOrder:w,renderOrder:d.renderOrder,z:S,group:T},i[e]=R):(R.id=d.id,R.object=d,R.geometry=A,R.material=y,R.materialVariant=o(d),R.groupOrder=w,R.renderOrder=d.renderOrder,R.z=S,R.group=T),e++,R}function l(d,A,y,w,S,T){let R=a(d,A,y,w,S,T);y.transmission>0?n.push(R):y.transparent===!0?r.push(R):t.push(R)}function c(d,A,y,w,S,T){let R=a(d,A,y,w,S,T);y.transmission>0?n.unshift(R):y.transparent===!0?r.unshift(R):t.unshift(R)}function u(d,A,y){t.length>1&&t.sort(d||Cxe),n.length>1&&n.sort(A||eK),r.length>1&&r.sort(A||eK),y&&(t.reverse(),n.reverse(),r.reverse())}function f(){for(let d=e,A=i.length;d<A;d++){let y=i[d];if(y.id===null)break;y.id=null,y.object=null,y.geometry=null,y.material=null,y.group=null}}return{opaque:t,transmissive:n,transparent:r,init:s,push:l,unshift:c,finish:f,sort:u}}function Rxe(){let i=new WeakMap;function e(n,r){let s=i.get(n),o;return s===void 0?(o=new tK,i.set(n,[o])):r>=s.length?(o=new tK,s.push(o)):o=s[r],o}function t(){i=new WeakMap}return{get:e,dispose:t}}function Pxe(){let i={};return{get:function(e){if(i[e.id]!==void 0)return i[e.id];let t;switch(e.type){case"DirectionalLight":t={direction:new re,color:new zt};break;case"SpotLight":t={position:new re,direction:new re,color:new zt,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":t={position:new re,color:new zt,distance:0,decay:0};break;case"HemisphereLight":t={direction:new re,skyColor:new zt,groundColor:new zt};break;case"RectAreaLight":t={color:new zt,position:new re,halfWidth:new re,halfHeight:new re};break}return i[e.id]=t,t}}}function Ixe(){let i={};return{get:function(e){if(i[e.id]!==void 0)return i[e.id];let t;switch(e.type){case"DirectionalLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Oe};break;case"SpotLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Oe};break;case"PointLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Oe,shadowCameraNear:1,shadowCameraFar:1e3};break}return i[e.id]=t,t}}}var Lxe=0;function Dxe(i,e){return(e.castShadow?2:0)-(i.castShadow?2:0)+(e.map?1:0)-(i.map?1:0)}function Nxe(i){let e=new Pxe,t=Ixe(),n={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1,numSpotMaps:-1,numLightProbes:-1},ambient:[0,0,0],probe:[],directional:[],directionalShadow:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotLightMap:[],spotShadow:[],spotShadowMap:[],spotLightMatrix:[],rectArea:[],rectAreaLTC1:null,rectAreaLTC2:null,point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[],numSpotLightShadowsWithMaps:0,numLightProbes:0};for(let c=0;c<9;c++)n.probe.push(new re);let r=new re,s=new cn,o=new cn;function a(c){let u=0,f=0,d=0;for(let B=0;B<9;B++)n.probe[B].set(0,0,0);let A=0,y=0,w=0,S=0,T=0,R=0,I=0,P=0,F=0,D=0,L=0;c.sort(Dxe);for(let B=0,k=c.length;B<k;B++){let z=c[B],G=z.color,W=z.intensity,Y=z.distance,H=null;if(z.shadow&&z.shadow.map&&(z.shadow.map.texture.format===Ws?H=z.shadow.map.texture:H=z.shadow.map.depthTexture||z.shadow.map.texture),z.isAmbientLight)u+=G.r*W,f+=G.g*W,d+=G.b*W;else if(z.isLightProbe){for(let $=0;$<9;$++)n.probe[$].addScaledVector(z.sh.coefficients[$],W);L++}else if(z.isDirectionalLight){let $=e.get(z);if($.color.copy(z.color).multiplyScalar(z.intensity),z.castShadow){let J=z.shadow,te=t.get(z);te.shadowIntensity=J.intensity,te.shadowBias=J.bias,te.shadowNormalBias=J.normalBias,te.shadowRadius=J.radius,te.shadowMapSize=J.mapSize,n.directionalShadow[A]=te,n.directionalShadowMap[A]=H,n.directionalShadowMatrix[A]=z.shadow.matrix,R++}n.directional[A]=$,A++}else if(z.isSpotLight){let $=e.get(z);$.position.setFromMatrixPosition(z.matrixWorld),$.color.copy(G).multiplyScalar(W),$.distance=Y,$.coneCos=Math.cos(z.angle),$.penumbraCos=Math.cos(z.angle*(1-z.penumbra)),$.decay=z.decay,n.spot[w]=$;let J=z.shadow;if(z.map&&(n.spotLightMap[F]=z.map,F++,J.updateMatrices(z),z.castShadow&&D++),n.spotLightMatrix[w]=J.matrix,z.castShadow){let te=t.get(z);te.shadowIntensity=J.intensity,te.shadowBias=J.bias,te.shadowNormalBias=J.normalBias,te.shadowRadius=J.radius,te.shadowMapSize=J.mapSize,n.spotShadow[w]=te,n.spotShadowMap[w]=H,P++}w++}else if(z.isRectAreaLight){let $=e.get(z);$.color.copy(G).multiplyScalar(W),$.halfWidth.set(z.width*.5,0,0),$.halfHeight.set(0,z.height*.5,0),n.rectArea[S]=$,S++}else if(z.isPointLight){let $=e.get(z);if($.color.copy(z.color).multiplyScalar(z.intensity),$.distance=z.distance,$.decay=z.decay,z.castShadow){let J=z.shadow,te=t.get(z);te.shadowIntensity=J.intensity,te.shadowBias=J.bias,te.shadowNormalBias=J.normalBias,te.shadowRadius=J.radius,te.shadowMapSize=J.mapSize,te.shadowCameraNear=J.camera.near,te.shadowCameraFar=J.camera.far,n.pointShadow[y]=te,n.pointShadowMap[y]=H,n.pointShadowMatrix[y]=z.shadow.matrix,I++}n.point[y]=$,y++}else if(z.isHemisphereLight){let $=e.get(z);$.skyColor.copy(z.color).multiplyScalar(W),$.groundColor.copy(z.groundColor).multiplyScalar(W),n.hemi[T]=$,T++}}S>0&&(i.has("OES_texture_float_linear")===!0?(n.rectAreaLTC1=Nt.LTC_FLOAT_1,n.rectAreaLTC2=Nt.LTC_FLOAT_2):(n.rectAreaLTC1=Nt.LTC_HALF_1,n.rectAreaLTC2=Nt.LTC_HALF_2)),n.ambient[0]=u,n.ambient[1]=f,n.ambient[2]=d;let C=n.hash;(C.directionalLength!==A||C.pointLength!==y||C.spotLength!==w||C.rectAreaLength!==S||C.hemiLength!==T||C.numDirectionalShadows!==R||C.numPointShadows!==I||C.numSpotShadows!==P||C.numSpotMaps!==F||C.numLightProbes!==L)&&(n.directional.length=A,n.spot.length=w,n.rectArea.length=S,n.point.length=y,n.hemi.length=T,n.directionalShadow.length=R,n.directionalShadowMap.length=R,n.pointShadow.length=I,n.pointShadowMap.length=I,n.spotShadow.length=P,n.spotShadowMap.length=P,n.directionalShadowMatrix.length=R,n.pointShadowMatrix.length=I,n.spotLightMatrix.length=P+F-D,n.spotLightMap.length=F,n.numSpotLightShadowsWithMaps=D,n.numLightProbes=L,C.directionalLength=A,C.pointLength=y,C.spotLength=w,C.rectAreaLength=S,C.hemiLength=T,C.numDirectionalShadows=R,C.numPointShadows=I,C.numSpotShadows=P,C.numSpotMaps=F,C.numLightProbes=L,n.version=Lxe++)}function l(c,u){let f=0,d=0,A=0,y=0,w=0,S=u.matrixWorldInverse;for(let T=0,R=c.length;T<R;T++){let I=c[T];if(I.isDirectionalLight){let P=n.directional[f];P.direction.setFromMatrixPosition(I.matrixWorld),r.setFromMatrixPosition(I.target.matrixWorld),P.direction.sub(r),P.direction.transformDirection(S),f++}else if(I.isSpotLight){let P=n.spot[A];P.position.setFromMatrixPosition(I.matrixWorld),P.position.applyMatrix4(S),P.direction.setFromMatrixPosition(I.matrixWorld),r.setFromMatrixPosition(I.target.matrixWorld),P.direction.sub(r),P.direction.transformDirection(S),A++}else if(I.isRectAreaLight){let P=n.rectArea[y];P.position.setFromMatrixPosition(I.matrixWorld),P.position.applyMatrix4(S),o.identity(),s.copy(I.matrixWorld),s.premultiply(S),o.extractRotation(s),P.halfWidth.set(I.width*.5,0,0),P.halfHeight.set(0,I.height*.5,0),P.halfWidth.applyMatrix4(o),P.halfHeight.applyMatrix4(o),y++}else if(I.isPointLight){let P=n.point[d];P.position.setFromMatrixPosition(I.matrixWorld),P.position.applyMatrix4(S),d++}else if(I.isHemisphereLight){let P=n.hemi[w];P.direction.setFromMatrixPosition(I.matrixWorld),P.direction.transformDirection(S),w++}}}return{setup:a,setupView:l,state:n}}function nK(i){let e=new Nxe(i),t=[],n=[],r=[];function s(d){f.camera=d,t.length=0,n.length=0,r.length=0}function o(d){t.push(d)}function a(d){n.push(d)}function l(d){r.push(d)}function c(){e.setup(t)}function u(d){e.setupView(t,d)}let f={lightsArray:t,shadowsArray:n,lightProbeGridArray:r,camera:null,lights:e,transmissionRenderTarget:{},textureUnits:0};return{init:s,state:f,setupLights:c,setupLightsView:u,pushLight:o,pushShadow:a,pushLightProbeGrid:l}}function Fxe(i){let e=new WeakMap;function t(r,s=0){let o=e.get(r),a;return o===void 0?(a=new nK(i),e.set(r,[a])):s>=o.length?(a=new nK(i),o.push(a)):a=o[s],a}function n(){e=new WeakMap}return{get:t,dispose:n}}var Bxe=`void main() {40674067 gl_Position = vec4( position, 1.0 );4068-}`,nxe=`uniform sampler2D shadow_pass;4068+}`,Oxe=`uniform sampler2D shadow_pass;40694069 uniform vec2 resolution;40704070 uniform float radius;40714071 void main() {@@ -4090,12 +4090,12 @@ void main() {
40904090 squared_mean = squared_mean / samples;40914091 float std_dev = sqrt( max( 0.0, squared_mean - mean * mean ) );40924092 gl_FragColor = vec4( mean, std_dev, 0.0, 1.0 );4093-}`,ixe=[new re(1,0,0),new re(-1,0,0),new re(0,1,0),new re(0,-1,0),new re(0,0,1),new re(0,0,-1)],rxe=[new re(0,-1,0),new re(0,-1,0),new re(0,0,1),new re(0,0,-1),new re(0,-1,0),new re(0,-1,0)],LZ=new cn,Nb=new re,hF=new re;function sxe(i,e,t){let n=new zc,r=new Oe,s=new Oe,o=new xn,a=new lM,l=new cM,c={},u=t.maxTextureSize,f={[ko]:mi,[mi]:ko,[gr]:gr},d=new ds({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new Oe},radius:{value:4}},vertexShader:txe,fragmentShader:nxe}),A=d.clone();A.defines.HORIZONTAL_PASS=1;let y=new Xn;y.setAttribute("position",new Hi(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));let w=new Hn(y,d),S=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=c0;let T=this.type;this.render=function(D,L,C){if(S.enabled===!1||S.autoUpdate===!1&&S.needsUpdate===!1||D.length===0)return;this.type===TM&&(Xe("WebGLShadowMap: PCFSoftShadowMap has been deprecated. Using PCFShadowMap instead."),this.type=c0);let B=i.getRenderTarget(),k=i.getActiveCubeFace(),z=i.getActiveMipmapLevel(),G=i.state;G.setBlending(ps),G.buffers.depth.getReversed()===!0?G.buffers.color.setClear(0,0,0,0):G.buffers.color.setClear(1,1,1,1),G.buffers.depth.setTest(!0),G.setScissorTest(!1);let W=T!==this.type;W&&L.traverse(function(Y){Y.material&&(Array.isArray(Y.material)?Y.material.forEach(H=>H.needsUpdate=!0):Y.material.needsUpdate=!0)});for(let Y=0,H=D.length;Y<H;Y++){let $=D[Y],J=$.shadow;if(J===void 0){Xe("WebGLShadowMap:",$,"has no shadow.");continue}if(J.autoUpdate===!1&&J.needsUpdate===!1)continue;r.copy(J.mapSize);let te=J.getFrameExtents();r.multiply(te),s.copy(J.mapSize),(r.x>u||r.y>u)&&(r.x>u&&(s.x=Math.floor(u/te.x),r.x=s.x*te.x,J.mapSize.x=s.x),r.y>u&&(s.y=Math.floor(u/te.y),r.y=s.y*te.y,J.mapSize.y=s.y));let ce=i.state.buffers.depth.getReversed();if(J.camera._reversedDepth=ce,J.map===null||W===!0){if(J.map!==null&&(J.map.depthTexture!==null&&(J.map.depthTexture.dispose(),J.map.depthTexture=null),J.map.dispose()),this.type===Vc){if($.isPointLight){Xe("WebGLShadowMap: VSM shadow maps are not supported for PointLights. Use PCF or BasicShadowMap instead.");continue}J.map=new Ba(r.x,r.y,{format:js,type:Wi,minFilter:Mi,magFilter:Mi,generateMipmaps:!1}),J.map.texture.name=$.name+".shadowMap",J.map.depthTexture=new Cs(r.x,r.y,cr),J.map.depthTexture.name=$.name+".shadowMapDepth",J.map.depthTexture.format=Gs,J.map.depthTexture.compareFunction=null,J.map.depthTexture.minFilter=Ti,J.map.depthTexture.magFilter=Ti}else $.isPointLight?(J.map=new OM(r.x),J.map.depthTexture=new $v(r.x,xi)):(J.map=new Ba(r.x,r.y),J.map.depthTexture=new Cs(r.x,r.y,xi)),J.map.depthTexture.name=$.name+".shadowMap",J.map.depthTexture.format=Gs,this.type===c0?(J.map.depthTexture.compareFunction=ce?Fu:Xh,J.map.depthTexture.minFilter=Mi,J.map.depthTexture.magFilter=Mi):(J.map.depthTexture.compareFunction=null,J.map.depthTexture.minFilter=Ti,J.map.depthTexture.magFilter=Ti);J.camera.updateProjectionMatrix()}let he=J.map.isWebGLCubeRenderTarget?6:1;for(let ve=0;ve<he;ve++){if(J.map.isWebGLCubeRenderTarget)i.setRenderTarget(J.map,ve),i.clear();else{ve===0&&(i.setRenderTarget(J.map),i.clear());let Re=J.getViewport(ve);o.set(s.x*Re.x,s.y*Re.y,s.x*Re.z,s.y*Re.w),G.viewport(o)}if($.isPointLight){let Re=J.camera,Qe=J.matrix,Fe=$.distance||Re.far;Fe!==Re.far&&(Re.far=Fe,Re.updateProjectionMatrix()),Nb.setFromMatrixPosition($.matrixWorld),Re.position.copy(Nb),hF.copy(Re.position),hF.add(ixe[ve]),Re.up.copy(rxe[ve]),Re.lookAt(hF),Re.updateMatrixWorld(),Qe.makeTranslation(-Nb.x,-Nb.y,-Nb.z),LZ.multiplyMatrices(Re.projectionMatrix,Re.matrixWorldInverse),J._frustum.setFromProjectionMatrix(LZ,Re.coordinateSystem,Re.reversedDepth)}else J.updateMatrices($);n=J.getFrustum(),I(L,C,J.camera,$,this.type)}J.isPointLightShadow!==!0&&this.type===Vc&&R(J,C),J.needsUpdate=!1}T=this.type,S.needsUpdate=!1,i.setRenderTarget(B,k,z)};function R(D,L){let C=e.update(w);d.defines.VSM_SAMPLES!==D.blurSamples&&(d.defines.VSM_SAMPLES=D.blurSamples,A.defines.VSM_SAMPLES=D.blurSamples,d.needsUpdate=!0,A.needsUpdate=!0),D.mapPass===null&&(D.mapPass=new Ba(r.x,r.y,{format:js,type:Wi})),d.uniforms.shadow_pass.value=D.map.depthTexture,d.uniforms.resolution.value=D.mapSize,d.uniforms.radius.value=D.radius,i.setRenderTarget(D.mapPass),i.clear(),i.renderBufferDirect(L,null,C,d,w,null),A.uniforms.shadow_pass.value=D.mapPass.texture,A.uniforms.resolution.value=D.mapSize,A.uniforms.radius.value=D.radius,i.setRenderTarget(D.map),i.clear(),i.renderBufferDirect(L,null,C,A,w,null)}function P(D,L,C,B){let k=null,z=C.isPointLight===!0?D.customDistanceMaterial:D.customDepthMaterial;if(z!==void 0)k=z;else if(k=C.isPointLight===!0?l:a,i.localClippingEnabled&&L.clipShadows===!0&&Array.isArray(L.clippingPlanes)&&L.clippingPlanes.length!==0||L.displacementMap&&L.displacementScale!==0||L.alphaMap&&L.alphaTest>0||L.map&&L.alphaTest>0||L.alphaToCoverage===!0){let G=k.uuid,W=L.uuid,Y=c[G];Y===void 0&&(Y={},c[G]=Y);let H=Y[W];H===void 0&&(H=k.clone(),Y[W]=H,L.addEventListener("dispose",F)),k=H}if(k.visible=L.visible,k.wireframe=L.wireframe,B===Vc?k.side=L.shadowSide!==null?L.shadowSide:L.side:k.side=L.shadowSide!==null?L.shadowSide:f[L.side],k.alphaMap=L.alphaMap,k.alphaTest=L.alphaToCoverage===!0?.5:L.alphaTest,k.map=L.map,k.clipShadows=L.clipShadows,k.clippingPlanes=L.clippingPlanes,k.clipIntersection=L.clipIntersection,k.displacementMap=L.displacementMap,k.displacementScale=L.displacementScale,k.displacementBias=L.displacementBias,k.wireframeLinewidth=L.wireframeLinewidth,k.linewidth=L.linewidth,C.isPointLight===!0&&k.isMeshDistanceMaterial===!0){let G=i.properties.get(k);G.light=C}return k}function I(D,L,C,B,k){if(D.visible===!1)return;if(D.layers.test(L.layers)&&(D.isMesh||D.isLine||D.isPoints)&&(D.castShadow||D.receiveShadow&&k===Vc)&&(!D.frustumCulled||n.intersectsObject(D))){D.modelViewMatrix.multiplyMatrices(C.matrixWorldInverse,D.matrixWorld);let W=e.update(D),Y=D.material;if(Array.isArray(Y)){let H=W.groups;for(let $=0,J=H.length;$<J;$++){let te=H[$],ce=Y[te.materialIndex];if(ce&&ce.visible){let he=P(D,ce,B,k);D.onBeforeShadow(i,D,L,C,W,he,te),i.renderBufferDirect(C,null,W,he,D,te),D.onAfterShadow(i,D,L,C,W,he,te)}}}else if(Y.visible){let H=P(D,Y,B,k);D.onBeforeShadow(i,D,L,C,W,H,null),i.renderBufferDirect(C,null,W,H,D,null),D.onAfterShadow(i,D,L,C,W,H,null)}}let G=D.children;for(let W=0,Y=G.length;W<Y;W++)I(G[W],L,C,B,k)}function F(D){D.target.removeEventListener("dispose",F);for(let C in c){let B=c[C],k=D.target.uuid;k in B&&(B[k].dispose(),delete B[k])}}}function oxe(i,e){function t(){let ye=!1,wt=new xn,Ze=null,St=new xn(0,0,0,0);return{setMask:function(Bt){Ze!==Bt&&!ye&&(i.colorMask(Bt,Bt,Bt,Bt),Ze=Bt)},setLocked:function(Bt){ye=Bt},setClear:function(Bt,ut,Ce,Yt,nr){nr===!0&&(Bt*=Yt,ut*=Yt,Ce*=Yt),wt.set(Bt,ut,Ce,Yt),St.equals(wt)===!1&&(i.clearColor(Bt,ut,Ce,Yt),St.copy(wt))},reset:function(){ye=!1,Ze=null,St.set(-1,0,0,0)}}}function n(){let ye=!1,wt=!1,Ze=null,St=null,Bt=null;return{setReversed:function(ut){if(wt!==ut){let Ce=e.get("EXT_clip_control");ut?Ce.clipControlEXT(Ce.LOWER_LEFT_EXT,Ce.ZERO_TO_ONE_EXT):Ce.clipControlEXT(Ce.LOWER_LEFT_EXT,Ce.NEGATIVE_ONE_TO_ONE_EXT),wt=ut;let Yt=Bt;Bt=null,this.setClear(Yt)}},getReversed:function(){return wt},setTest:function(ut){ut?Ye(i.DEPTH_TEST):Mt(i.DEPTH_TEST)},setMask:function(ut){Ze!==ut&&!ye&&(i.depthMask(ut),Ze=ut)},setFunc:function(ut){if(wt&&(ut=Pb[ut]),St!==ut){switch(ut){case MA:i.depthFunc(i.NEVER);break;case CA:i.depthFunc(i.ALWAYS);break;case RA:i.depthFunc(i.LESS);break;case Ch:i.depthFunc(i.LEQUAL);break;case IA:i.depthFunc(i.EQUAL);break;case PA:i.depthFunc(i.GEQUAL);break;case LA:i.depthFunc(i.GREATER);break;case DA:i.depthFunc(i.NOTEQUAL);break;default:i.depthFunc(i.LEQUAL)}St=ut}},setLocked:function(ut){ye=ut},setClear:function(ut){Bt!==ut&&(Bt=ut,wt&&(ut=1-ut),i.clearDepth(ut))},reset:function(){ye=!1,Ze=null,St=null,Bt=null,wt=!1}}}function r(){let ye=!1,wt=null,Ze=null,St=null,Bt=null,ut=null,Ce=null,Yt=null,nr=null;return{setTest:function(Fn){ye||(Fn?Ye(i.STENCIL_TEST):Mt(i.STENCIL_TEST))},setMask:function(Fn){wt!==Fn&&!ye&&(i.stencilMask(Fn),wt=Fn)},setFunc:function(Fn,is,Pr){(Ze!==Fn||St!==is||Bt!==Pr)&&(i.stencilFunc(Fn,is,Pr),Ze=Fn,St=is,Bt=Pr)},setOp:function(Fn,is,Pr){(ut!==Fn||Ce!==is||Yt!==Pr)&&(i.stencilOp(Fn,is,Pr),ut=Fn,Ce=is,Yt=Pr)},setLocked:function(Fn){ye=Fn},setClear:function(Fn){nr!==Fn&&(i.clearStencil(Fn),nr=Fn)},reset:function(){ye=!1,wt=null,Ze=null,St=null,Bt=null,ut=null,Ce=null,Yt=null,nr=null}}}let s=new t,o=new n,a=new r,l=new WeakMap,c=new WeakMap,u={},f={},d={},A=new WeakMap,y=[],w=null,S=!1,T=null,R=null,P=null,I=null,F=null,D=null,L=null,C=new zt(0,0,0),B=0,k=!1,z=null,G=null,W=null,Y=null,H=null,$=i.getParameter(i.MAX_COMBINED_TEXTURE_IMAGE_UNITS),J=!1,te=0,ce=i.getParameter(i.VERSION);ce.indexOf("WebGL")!==-1?(te=parseFloat(/^WebGL (\d)/.exec(ce)[1]),J=te>=1):ce.indexOf("OpenGL ES")!==-1&&(te=parseFloat(/^OpenGL ES (\d)/.exec(ce)[1]),J=te>=2);let he=null,ve={},Re=i.getParameter(i.SCISSOR_BOX),Qe=i.getParameter(i.VIEWPORT),Fe=new xn().fromArray(Re),mt=new xn().fromArray(Qe);function Ee(ye,wt,Ze,St){let Bt=new Uint8Array(4),ut=i.createTexture();i.bindTexture(ye,ut),i.texParameteri(ye,i.TEXTURE_MIN_FILTER,i.NEAREST),i.texParameteri(ye,i.TEXTURE_MAG_FILTER,i.NEAREST);for(let Ce=0;Ce<Ze;Ce++)ye===i.TEXTURE_3D||ye===i.TEXTURE_2D_ARRAY?i.texImage3D(wt,0,i.RGBA,1,1,St,0,i.RGBA,i.UNSIGNED_BYTE,Bt):i.texImage2D(wt+Ce,0,i.RGBA,1,1,0,i.RGBA,i.UNSIGNED_BYTE,Bt);return ut}let Ve={};Ve[i.TEXTURE_2D]=Ee(i.TEXTURE_2D,i.TEXTURE_2D,1),Ve[i.TEXTURE_CUBE_MAP]=Ee(i.TEXTURE_CUBE_MAP,i.TEXTURE_CUBE_MAP_POSITIVE_X,6),Ve[i.TEXTURE_2D_ARRAY]=Ee(i.TEXTURE_2D_ARRAY,i.TEXTURE_2D_ARRAY,1,1),Ve[i.TEXTURE_3D]=Ee(i.TEXTURE_3D,i.TEXTURE_3D,1,1),s.setClear(0,0,0,1),o.setClear(1),a.setClear(0),Ye(i.DEPTH_TEST),o.setFunc(Ch),bt(!1),yt(sb),Ye(i.CULL_FACE),ot(ps);function Ye(ye){u[ye]!==!0&&(i.enable(ye),u[ye]=!0)}function Mt(ye){u[ye]!==!1&&(i.disable(ye),u[ye]=!1)}function Et(ye,wt){return d[ye]!==wt?(i.bindFramebuffer(ye,wt),d[ye]=wt,ye===i.DRAW_FRAMEBUFFER&&(d[i.FRAMEBUFFER]=wt),ye===i.FRAMEBUFFER&&(d[i.DRAW_FRAMEBUFFER]=wt),!0):!1}function It(ye,wt){let Ze=y,St=!1;if(ye){Ze=A.get(wt),Ze===void 0&&(Ze=[],A.set(wt,Ze));let Bt=ye.textures;if(Ze.length!==Bt.length||Ze[0]!==i.COLOR_ATTACHMENT0){for(let ut=0,Ce=Bt.length;ut<Ce;ut++)Ze[ut]=i.COLOR_ATTACHMENT0+ut;Ze.length=Bt.length,St=!0}}else Ze[0]!==i.BACK&&(Ze[0]=i.BACK,St=!0);St&&i.drawBuffers(Ze)}function dn(ye){return w!==ye?(i.useProgram(ye),w=ye,!0):!1}let Gt={[oo]:i.FUNC_ADD,[ab]:i.FUNC_SUBTRACT,[lb]:i.FUNC_REVERSE_SUBTRACT};Gt[EM]=i.MIN,Gt[MM]=i.MAX;let $e={[Nu]:i.ZERO,[cb]:i.ONE,[ub]:i.SRC_COLOR,[Yp]:i.SRC_ALPHA,[Ab]:i.SRC_ALPHA_SATURATE,[pb]:i.DST_COLOR,[fb]:i.DST_ALPHA,[hb]:i.ONE_MINUS_SRC_COLOR,[Zp]:i.ONE_MINUS_SRC_ALPHA,[mb]:i.ONE_MINUS_DST_COLOR,[db]:i.ONE_MINUS_DST_ALPHA,[KY]:i.CONSTANT_COLOR,[QY]:i.ONE_MINUS_CONSTANT_COLOR,[JY]:i.CONSTANT_ALPHA,[eZ]:i.ONE_MINUS_CONSTANT_ALPHA};function ot(ye,wt,Ze,St,Bt,ut,Ce,Yt,nr,Fn){if(ye===ps){S===!0&&(Mt(i.BLEND),S=!1);return}if(S===!1&&(Ye(i.BLEND),S=!0),ye!==Id){if(ye!==T||Fn!==k){if((R!==oo||F!==oo)&&(i.blendEquation(i.FUNC_ADD),R=oo,F=oo),Fn)switch(ye){case Ms:i.blendFuncSeparate(i.ONE,i.ONE_MINUS_SRC_ALPHA,i.ONE,i.ONE_MINUS_SRC_ALPHA);break;case Dh:i.blendFunc(i.ONE,i.ONE);break;case Nh:i.blendFuncSeparate(i.ZERO,i.ONE_MINUS_SRC_COLOR,i.ZERO,i.ONE);break;case Fh:i.blendFuncSeparate(i.DST_COLOR,i.ONE_MINUS_SRC_ALPHA,i.ZERO,i.ONE);break;default:ze("WebGLState: Invalid blending: ",ye);break}else switch(ye){case Ms:i.blendFuncSeparate(i.SRC_ALPHA,i.ONE_MINUS_SRC_ALPHA,i.ONE,i.ONE_MINUS_SRC_ALPHA);break;case Dh:i.blendFuncSeparate(i.SRC_ALPHA,i.ONE,i.ONE,i.ONE);break;case Nh:ze("WebGLState: SubtractiveBlending requires material.premultipliedAlpha = true");break;case Fh:ze("WebGLState: MultiplyBlending requires material.premultipliedAlpha = true");break;default:ze("WebGLState: Invalid blending: ",ye);break}P=null,I=null,D=null,L=null,C.set(0,0,0),B=0,T=ye,k=Fn}return}Bt=Bt||wt,ut=ut||Ze,Ce=Ce||St,(wt!==R||Bt!==F)&&(i.blendEquationSeparate(Gt[wt],Gt[Bt]),R=wt,F=Bt),(Ze!==P||St!==I||ut!==D||Ce!==L)&&(i.blendFuncSeparate($e[Ze],$e[St],$e[ut],$e[Ce]),P=Ze,I=St,D=ut,L=Ce),(Yt.equals(C)===!1||nr!==B)&&(i.blendColor(Yt.r,Yt.g,Yt.b,nr),C.copy(Yt),B=nr),T=ye,k=!1}function nt(ye,wt){ye.side===gr?Mt(i.CULL_FACE):Ye(i.CULL_FACE);let Ze=ye.side===mi;wt&&(Ze=!Ze),bt(Ze),ye.blending===Ms&&ye.transparent===!1?ot(ps):ot(ye.blending,ye.blendEquation,ye.blendSrc,ye.blendDst,ye.blendEquationAlpha,ye.blendSrcAlpha,ye.blendDstAlpha,ye.blendColor,ye.blendAlpha,ye.premultipliedAlpha),o.setFunc(ye.depthFunc),o.setTest(ye.depthTest),o.setMask(ye.depthWrite),s.setMask(ye.colorWrite);let St=ye.stencilWrite;a.setTest(St),St&&(a.setMask(ye.stencilWriteMask),a.setFunc(ye.stencilFunc,ye.stencilRef,ye.stencilFuncMask),a.setOp(ye.stencilFail,ye.stencilZFail,ye.stencilZPass)),tn(ye.polygonOffset,ye.polygonOffsetFactor,ye.polygonOffsetUnits),ye.alphaToCoverage===!0?Ye(i.SAMPLE_ALPHA_TO_COVERAGE):Mt(i.SAMPLE_ALPHA_TO_COVERAGE)}function bt(ye){z!==ye&&(ye?i.frontFace(i.CW):i.frontFace(i.CCW),z=ye)}function yt(ye){ye!==wM?(Ye(i.CULL_FACE),ye!==G&&(ye===sb?i.cullFace(i.BACK):ye===SM?i.cullFace(i.FRONT):i.cullFace(i.FRONT_AND_BACK))):Mt(i.CULL_FACE),G=ye}function hn(ye){ye!==W&&(J&&i.lineWidth(ye),W=ye)}function tn(ye,wt,Ze){ye?(Ye(i.POLYGON_OFFSET_FILL),(Y!==wt||H!==Ze)&&(Y=wt,H=Ze,o.getReversed()&&(wt=-wt),i.polygonOffset(wt,Ze))):Mt(i.POLYGON_OFFSET_FILL)}function nn(ye){ye?Ye(i.SCISSOR_TEST):Mt(i.SCISSOR_TEST)}function bn(ye){ye===void 0&&(ye=i.TEXTURE0+$-1),he!==ye&&(i.activeTexture(ye),he=ye)}function _e(ye,wt,Ze){Ze===void 0&&(he===null?Ze=i.TEXTURE0+$-1:Ze=he);let St=ve[Ze];St===void 0&&(St={type:void 0,texture:void 0},ve[Ze]=St),(St.type!==ye||St.texture!==wt)&&(he!==Ze&&(i.activeTexture(Ze),he=Ze),i.bindTexture(ye,wt||Ve[ye]),St.type=ye,St.texture=wt)}function vi(){let ye=ve[he];ye!==void 0&&ye.type!==void 0&&(i.bindTexture(ye.type,null),ye.type=void 0,ye.texture=void 0)}function zn(){try{i.compressedTexImage2D(...arguments)}catch(ye){ze("WebGLState:",ye)}}function le(){try{i.compressedTexImage3D(...arguments)}catch(ye){ze("WebGLState:",ye)}}function Z(){try{i.texSubImage2D(...arguments)}catch(ye){ze("WebGLState:",ye)}}function Te(){try{i.texSubImage3D(...arguments)}catch(ye){ze("WebGLState:",ye)}}function Pe(){try{i.compressedTexSubImage2D(...arguments)}catch(ye){ze("WebGLState:",ye)}}function Ge(){try{i.compressedTexSubImage3D(...arguments)}catch(ye){ze("WebGLState:",ye)}}function vt(){try{i.texStorage2D(...arguments)}catch(ye){ze("WebGLState:",ye)}}function Tt(){try{i.texStorage3D(...arguments)}catch(ye){ze("WebGLState:",ye)}}function qe(){try{i.texImage2D(...arguments)}catch(ye){ze("WebGLState:",ye)}}function Je(){try{i.texImage3D(...arguments)}catch(ye){ze("WebGLState:",ye)}}function Pt(ye){return f[ye]!==void 0?f[ye]:i.getParameter(ye)}function sn(ye,wt){f[ye]!==wt&&(i.pixelStorei(ye,wt),f[ye]=wt)}function Lt(ye){Fe.equals(ye)===!1&&(i.scissor(ye.x,ye.y,ye.z,ye.w),Fe.copy(ye))}function Rt(ye){mt.equals(ye)===!1&&(i.viewport(ye.x,ye.y,ye.z,ye.w),mt.copy(ye))}function fn(ye,wt){let Ze=c.get(wt);Ze===void 0&&(Ze=new WeakMap,c.set(wt,Ze));let St=Ze.get(ye);St===void 0&&(St=i.getUniformBlockIndex(wt,ye.name),Ze.set(ye,St))}function wn(ye,wt){let St=c.get(wt).get(ye);l.get(wt)!==St&&(i.uniformBlockBinding(wt,St,ye.__bindingPointIndex),l.set(wt,St))}function Dn(){i.disable(i.BLEND),i.disable(i.CULL_FACE),i.disable(i.DEPTH_TEST),i.disable(i.POLYGON_OFFSET_FILL),i.disable(i.SCISSOR_TEST),i.disable(i.STENCIL_TEST),i.disable(i.SAMPLE_ALPHA_TO_COVERAGE),i.blendEquation(i.FUNC_ADD),i.blendFunc(i.ONE,i.ZERO),i.blendFuncSeparate(i.ONE,i.ZERO,i.ONE,i.ZERO),i.blendColor(0,0,0,0),i.colorMask(!0,!0,!0,!0),i.clearColor(0,0,0,0),i.depthMask(!0),i.depthFunc(i.LESS),o.setReversed(!1),i.clearDepth(1),i.stencilMask(4294967295),i.stencilFunc(i.ALWAYS,0,4294967295),i.stencilOp(i.KEEP,i.KEEP,i.KEEP),i.clearStencil(0),i.cullFace(i.BACK),i.frontFace(i.CCW),i.polygonOffset(0,0),i.activeTexture(i.TEXTURE0),i.bindFramebuffer(i.FRAMEBUFFER,null),i.bindFramebuffer(i.DRAW_FRAMEBUFFER,null),i.bindFramebuffer(i.READ_FRAMEBUFFER,null),i.useProgram(null),i.lineWidth(1),i.scissor(0,0,i.canvas.width,i.canvas.height),i.viewport(0,0,i.canvas.width,i.canvas.height),i.pixelStorei(i.PACK_ALIGNMENT,4),i.pixelStorei(i.UNPACK_ALIGNMENT,4),i.pixelStorei(i.UNPACK_FLIP_Y_WEBGL,!1),i.pixelStorei(i.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1),i.pixelStorei(i.UNPACK_COLORSPACE_CONVERSION_WEBGL,i.BROWSER_DEFAULT_WEBGL),i.pixelStorei(i.PACK_ROW_LENGTH,0),i.pixelStorei(i.PACK_SKIP_PIXELS,0),i.pixelStorei(i.PACK_SKIP_ROWS,0),i.pixelStorei(i.UNPACK_ROW_LENGTH,0),i.pixelStorei(i.UNPACK_IMAGE_HEIGHT,0),i.pixelStorei(i.UNPACK_SKIP_PIXELS,0),i.pixelStorei(i.UNPACK_SKIP_ROWS,0),i.pixelStorei(i.UNPACK_SKIP_IMAGES,0),u={},f={},he=null,ve={},d={},A=new WeakMap,y=[],w=null,S=!1,T=null,R=null,P=null,I=null,F=null,D=null,L=null,C=new zt(0,0,0),B=0,k=!1,z=null,G=null,W=null,Y=null,H=null,Fe.set(0,0,i.canvas.width,i.canvas.height),mt.set(0,0,i.canvas.width,i.canvas.height),s.reset(),o.reset(),a.reset()}return{buffers:{color:s,depth:o,stencil:a},enable:Ye,disable:Mt,bindFramebuffer:Et,drawBuffers:It,useProgram:dn,setBlending:ot,setMaterial:nt,setFlipSided:bt,setCullFace:yt,setLineWidth:hn,setPolygonOffset:tn,setScissorTest:nn,activeTexture:bn,bindTexture:_e,unbindTexture:vi,compressedTexImage2D:zn,compressedTexImage3D:le,texImage2D:qe,texImage3D:Je,pixelStorei:sn,getParameter:Pt,updateUBOMapping:fn,uniformBlockBinding:wn,texStorage2D:vt,texStorage3D:Tt,texSubImage2D:Z,texSubImage3D:Te,compressedTexSubImage2D:Pe,compressedTexSubImage3D:Ge,scissor:Lt,viewport:Rt,reset:Dn}}function axe(i,e,t,n,r,s,o){let a=e.has("WEBGL_multisampled_render_to_texture")?e.get("WEBGL_multisampled_render_to_texture"):null,l=typeof navigator>"u"?!1:/OculusBrowser/g.test(navigator.userAgent),c=new Oe,u=new WeakMap,f=new Set,d,A=new WeakMap,y=!1;try{y=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch{}function w(le,Z){return y?new OffscreenCanvas(le,Z):Gv("canvas")}function S(le,Z,Te){let Pe=1,Ge=zn(le);if((Ge.width>Te||Ge.height>Te)&&(Pe=Te/Math.max(Ge.width,Ge.height)),Pe<1)if(typeof HTMLImageElement<"u"&&le instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&le instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&le instanceof ImageBitmap||typeof VideoFrame<"u"&&le instanceof VideoFrame){let vt=Math.floor(Pe*Ge.width),Tt=Math.floor(Pe*Ge.height);d===void 0&&(d=w(vt,Tt));let qe=Z?w(vt,Tt):d;return qe.width=vt,qe.height=Tt,qe.getContext("2d").drawImage(le,0,0,vt,Tt),Xe("WebGLRenderer: Texture has been resized from ("+Ge.width+"x"+Ge.height+") to ("+vt+"x"+Tt+")."),qe}else return"data"in le&&Xe("WebGLRenderer: Image in DataTexture is too big ("+Ge.width+"x"+Ge.height+")."),le;return le}function T(le){return le.generateMipmaps}function R(le){i.generateMipmap(le)}function P(le){return le.isWebGLCubeRenderTarget?i.TEXTURE_CUBE_MAP:le.isWebGL3DRenderTarget?i.TEXTURE_3D:le.isWebGLArrayRenderTarget||le.isCompressedArrayTexture?i.TEXTURE_2D_ARRAY:i.TEXTURE_2D}function I(le,Z,Te,Pe,Ge,vt=!1){if(le!==null){if(i[le]!==void 0)return i[le];Xe("WebGLRenderer: Attempt to use non-existing WebGL internal format '"+le+"'")}let Tt;Pe&&(Tt=e.get("EXT_texture_norm16"),Tt||Xe("WebGLRenderer: Unable to use normalized textures without EXT_texture_norm16 extension"));let qe=Z;if(Z===i.RED&&(Te===i.FLOAT&&(qe=i.R32F),Te===i.HALF_FLOAT&&(qe=i.R16F),Te===i.UNSIGNED_BYTE&&(qe=i.R8),Te===i.UNSIGNED_SHORT&&Tt&&(qe=Tt.R16_EXT),Te===i.SHORT&&Tt&&(qe=Tt.R16_SNORM_EXT)),Z===i.RED_INTEGER&&(Te===i.UNSIGNED_BYTE&&(qe=i.R8UI),Te===i.UNSIGNED_SHORT&&(qe=i.R16UI),Te===i.UNSIGNED_INT&&(qe=i.R32UI),Te===i.BYTE&&(qe=i.R8I),Te===i.SHORT&&(qe=i.R16I),Te===i.INT&&(qe=i.R32I)),Z===i.RG&&(Te===i.FLOAT&&(qe=i.RG32F),Te===i.HALF_FLOAT&&(qe=i.RG16F),Te===i.UNSIGNED_BYTE&&(qe=i.RG8),Te===i.UNSIGNED_SHORT&&Tt&&(qe=Tt.RG16_EXT),Te===i.SHORT&&Tt&&(qe=Tt.RG16_SNORM_EXT)),Z===i.RG_INTEGER&&(Te===i.UNSIGNED_BYTE&&(qe=i.RG8UI),Te===i.UNSIGNED_SHORT&&(qe=i.RG16UI),Te===i.UNSIGNED_INT&&(qe=i.RG32UI),Te===i.BYTE&&(qe=i.RG8I),Te===i.SHORT&&(qe=i.RG16I),Te===i.INT&&(qe=i.RG32I)),Z===i.RGB_INTEGER&&(Te===i.UNSIGNED_BYTE&&(qe=i.RGB8UI),Te===i.UNSIGNED_SHORT&&(qe=i.RGB16UI),Te===i.UNSIGNED_INT&&(qe=i.RGB32UI),Te===i.BYTE&&(qe=i.RGB8I),Te===i.SHORT&&(qe=i.RGB16I),Te===i.INT&&(qe=i.RGB32I)),Z===i.RGBA_INTEGER&&(Te===i.UNSIGNED_BYTE&&(qe=i.RGBA8UI),Te===i.UNSIGNED_SHORT&&(qe=i.RGBA16UI),Te===i.UNSIGNED_INT&&(qe=i.RGBA32UI),Te===i.BYTE&&(qe=i.RGBA8I),Te===i.SHORT&&(qe=i.RGBA16I),Te===i.INT&&(qe=i.RGBA32I)),Z===i.RGB&&(Te===i.UNSIGNED_SHORT&&Tt&&(qe=Tt.RGB16_EXT),Te===i.SHORT&&Tt&&(qe=Tt.RGB16_SNORM_EXT),Te===i.UNSIGNED_INT_5_9_9_9_REV&&(qe=i.RGB9_E5),Te===i.UNSIGNED_INT_10F_11F_11F_REV&&(qe=i.R11F_G11F_B10F)),Z===i.RGBA){let Je=vt?Qp:ln.getTransfer(Ge);Te===i.FLOAT&&(qe=i.RGBA32F),Te===i.HALF_FLOAT&&(qe=i.RGBA16F),Te===i.UNSIGNED_BYTE&&(qe=Je===kt?i.SRGB8_ALPHA8:i.RGBA8),Te===i.UNSIGNED_SHORT&&Tt&&(qe=Tt.RGBA16_EXT),Te===i.SHORT&&Tt&&(qe=Tt.RGBA16_SNORM_EXT),Te===i.UNSIGNED_SHORT_4_4_4_4&&(qe=i.RGBA4),Te===i.UNSIGNED_SHORT_5_5_5_1&&(qe=i.RGB5_A1)}return(qe===i.R16F||qe===i.R32F||qe===i.RG16F||qe===i.RG32F||qe===i.RGBA16F||qe===i.RGBA32F)&&e.get("EXT_color_buffer_float"),qe}function F(le,Z){let Te;return le?Z===null||Z===xi||Z===ca?Te=i.DEPTH24_STENCIL8:Z===cr?Te=i.DEPTH32F_STENCIL8:Z===bl&&(Te=i.DEPTH24_STENCIL8,Xe("DepthTexture: 16 bit depth attachment is not supported with stencil. Using 24-bit attachment.")):Z===null||Z===xi||Z===ca?Te=i.DEPTH_COMPONENT24:Z===cr?Te=i.DEPTH_COMPONENT32F:Z===bl&&(Te=i.DEPTH_COMPONENT16),Te}function D(le,Z){return T(le)===!0||le.isFramebufferTexture&&le.minFilter!==Ti&&le.minFilter!==Mi?Math.log2(Math.max(Z.width,Z.height))+1:le.mipmaps!==void 0&&le.mipmaps.length>0?le.mipmaps.length:le.isCompressedTexture&&Array.isArray(le.image)?Z.mipmaps.length:1}function L(le){let Z=le.target;Z.removeEventListener("dispose",L),B(Z),Z.isVideoTexture&&u.delete(Z),Z.isHTMLTexture&&f.delete(Z)}function C(le){let Z=le.target;Z.removeEventListener("dispose",C),z(Z)}function B(le){let Z=n.get(le);if(Z.__webglInit===void 0)return;let Te=le.source,Pe=A.get(Te);if(Pe){let Ge=Pe[Z.__cacheKey];Ge.usedTimes--,Ge.usedTimes===0&&k(le),Object.keys(Pe).length===0&&A.delete(Te)}n.remove(le)}function k(le){let Z=n.get(le);i.deleteTexture(Z.__webglTexture);let Te=le.source,Pe=A.get(Te);delete Pe[Z.__cacheKey],o.memory.textures--}function z(le){let Z=n.get(le);if(le.depthTexture&&(le.depthTexture.dispose(),n.remove(le.depthTexture)),le.isWebGLCubeRenderTarget)for(let Pe=0;Pe<6;Pe++){if(Array.isArray(Z.__webglFramebuffer[Pe]))for(let Ge=0;Ge<Z.__webglFramebuffer[Pe].length;Ge++)i.deleteFramebuffer(Z.__webglFramebuffer[Pe][Ge]);else i.deleteFramebuffer(Z.__webglFramebuffer[Pe]);Z.__webglDepthbuffer&&i.deleteRenderbuffer(Z.__webglDepthbuffer[Pe])}else{if(Array.isArray(Z.__webglFramebuffer))for(let Pe=0;Pe<Z.__webglFramebuffer.length;Pe++)i.deleteFramebuffer(Z.__webglFramebuffer[Pe]);else i.deleteFramebuffer(Z.__webglFramebuffer);if(Z.__webglDepthbuffer&&i.deleteRenderbuffer(Z.__webglDepthbuffer),Z.__webglMultisampledFramebuffer&&i.deleteFramebuffer(Z.__webglMultisampledFramebuffer),Z.__webglColorRenderbuffer)for(let Pe=0;Pe<Z.__webglColorRenderbuffer.length;Pe++)Z.__webglColorRenderbuffer[Pe]&&i.deleteRenderbuffer(Z.__webglColorRenderbuffer[Pe]);Z.__webglDepthRenderbuffer&&i.deleteRenderbuffer(Z.__webglDepthRenderbuffer)}let Te=le.textures;for(let Pe=0,Ge=Te.length;Pe<Ge;Pe++){let vt=n.get(Te[Pe]);vt.__webglTexture&&(i.deleteTexture(vt.__webglTexture),o.memory.textures--),n.remove(Te[Pe])}n.remove(le)}let G=0;function W(){G=0}function Y(){return G}function H(le){G=le}function $(){let le=G;return le>=r.maxTextures&&Xe("WebGLTextures: Trying to use "+le+" texture units while this GPU supports only "+r.maxTextures),G+=1,le}function J(le){let Z=[];return Z.push(le.wrapS),Z.push(le.wrapT),Z.push(le.wrapR||0),Z.push(le.magFilter),Z.push(le.minFilter),Z.push(le.anisotropy),Z.push(le.internalFormat),Z.push(le.format),Z.push(le.type),Z.push(le.generateMipmaps),Z.push(le.premultiplyAlpha),Z.push(le.flipY),Z.push(le.unpackAlignment),Z.push(le.colorSpace),Z.join()}function te(le,Z){let Te=n.get(le);if(le.isVideoTexture&&_e(le),le.isRenderTargetTexture===!1&&le.isExternalTexture!==!0&&le.version>0&&Te.__version!==le.version){let Pe=le.image;if(Pe===null)Xe("WebGLRenderer: Texture marked for update but no image data found.");else if(Pe.complete===!1)Xe("WebGLRenderer: Texture marked for update but image is incomplete");else{Mt(Te,le,Z);return}}else le.isExternalTexture&&(Te.__webglTexture=le.sourceTexture?le.sourceTexture:null);t.bindTexture(i.TEXTURE_2D,Te.__webglTexture,i.TEXTURE0+Z)}function ce(le,Z){let Te=n.get(le);if(le.isRenderTargetTexture===!1&&le.version>0&&Te.__version!==le.version){Mt(Te,le,Z);return}else le.isExternalTexture&&(Te.__webglTexture=le.sourceTexture?le.sourceTexture:null);t.bindTexture(i.TEXTURE_2D_ARRAY,Te.__webglTexture,i.TEXTURE0+Z)}function he(le,Z){let Te=n.get(le);if(le.isRenderTargetTexture===!1&&le.version>0&&Te.__version!==le.version){Mt(Te,le,Z);return}t.bindTexture(i.TEXTURE_3D,Te.__webglTexture,i.TEXTURE0+Z)}function ve(le,Z){let Te=n.get(le);if(le.isCubeDepthTexture!==!0&&le.version>0&&Te.__version!==le.version){Et(Te,le,Z);return}t.bindTexture(i.TEXTURE_CUBE_MAP,Te.__webglTexture,i.TEXTURE0+Z)}let Re={[wd]:i.REPEAT,[aa]:i.CLAMP_TO_EDGE,[Sd]:i.MIRRORED_REPEAT},Qe={[Ti]:i.NEAREST,[Sb]:i.NEAREST_MIPMAP_NEAREST,[qc]:i.NEAREST_MIPMAP_LINEAR,[Mi]:i.LINEAR,[f0]:i.LINEAR_MIPMAP_NEAREST,[Vo]:i.LINEAR_MIPMAP_LINEAR},Fe={[Mb]:i.NEVER,[Ib]:i.ALWAYS,[s_]:i.LESS,[Xh]:i.LEQUAL,[Cb]:i.EQUAL,[Fu]:i.GEQUAL,[sg]:i.GREATER,[Rb]:i.NOTEQUAL};function mt(le,Z){if(Z.type===cr&&e.has("OES_texture_float_linear")===!1&&(Z.magFilter===Mi||Z.magFilter===f0||Z.magFilter===qc||Z.magFilter===Vo||Z.minFilter===Mi||Z.minFilter===f0||Z.minFilter===qc||Z.minFilter===Vo)&&Xe("WebGLRenderer: Unable to use linear filtering with floating point textures. OES_texture_float_linear not supported on this device."),i.texParameteri(le,i.TEXTURE_WRAP_S,Re[Z.wrapS]),i.texParameteri(le,i.TEXTURE_WRAP_T,Re[Z.wrapT]),(le===i.TEXTURE_3D||le===i.TEXTURE_2D_ARRAY)&&i.texParameteri(le,i.TEXTURE_WRAP_R,Re[Z.wrapR]),i.texParameteri(le,i.TEXTURE_MAG_FILTER,Qe[Z.magFilter]),i.texParameteri(le,i.TEXTURE_MIN_FILTER,Qe[Z.minFilter]),Z.compareFunction&&(i.texParameteri(le,i.TEXTURE_COMPARE_MODE,i.COMPARE_REF_TO_TEXTURE),i.texParameteri(le,i.TEXTURE_COMPARE_FUNC,Fe[Z.compareFunction])),e.has("EXT_texture_filter_anisotropic")===!0){if(Z.magFilter===Ti||Z.minFilter!==qc&&Z.minFilter!==Vo||Z.type===cr&&e.has("OES_texture_float_linear")===!1)return;if(Z.anisotropy>1||n.get(Z).__currentAnisotropy){let Te=e.get("EXT_texture_filter_anisotropic");i.texParameterf(le,Te.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(Z.anisotropy,r.getMaxAnisotropy())),n.get(Z).__currentAnisotropy=Z.anisotropy}}}function Ee(le,Z){let Te=!1;le.__webglInit===void 0&&(le.__webglInit=!0,Z.addEventListener("dispose",L));let Pe=Z.source,Ge=A.get(Pe);Ge===void 0&&(Ge={},A.set(Pe,Ge));let vt=J(Z);if(vt!==le.__cacheKey){Ge[vt]===void 0&&(Ge[vt]={texture:i.createTexture(),usedTimes:0},o.memory.textures++,Te=!0),Ge[vt].usedTimes++;let Tt=Ge[le.__cacheKey];Tt!==void 0&&(Ge[le.__cacheKey].usedTimes--,Tt.usedTimes===0&&k(Z)),le.__cacheKey=vt,le.__webglTexture=Ge[vt].texture}return Te}function Ve(le,Z,Te){return Math.floor(Math.floor(le/Te)/Z)}function Ye(le,Z,Te,Pe){let vt=le.updateRanges;if(vt.length===0)t.texSubImage2D(i.TEXTURE_2D,0,0,0,Z.width,Z.height,Te,Pe,Z.data);else{vt.sort((sn,Lt)=>sn.start-Lt.start);let Tt=0;for(let sn=1;sn<vt.length;sn++){let Lt=vt[Tt],Rt=vt[sn],fn=Lt.start+Lt.count,wn=Ve(Rt.start,Z.width,4),Dn=Ve(Lt.start,Z.width,4);Rt.start<=fn+1&&wn===Dn&&Ve(Rt.start+Rt.count-1,Z.width,4)===wn?Lt.count=Math.max(Lt.count,Rt.start+Rt.count-Lt.start):(++Tt,vt[Tt]=Rt)}vt.length=Tt+1;let qe=t.getParameter(i.UNPACK_ROW_LENGTH),Je=t.getParameter(i.UNPACK_SKIP_PIXELS),Pt=t.getParameter(i.UNPACK_SKIP_ROWS);t.pixelStorei(i.UNPACK_ROW_LENGTH,Z.width);for(let sn=0,Lt=vt.length;sn<Lt;sn++){let Rt=vt[sn],fn=Math.floor(Rt.start/4),wn=Math.ceil(Rt.count/4),Dn=fn%Z.width,ye=Math.floor(fn/Z.width),wt=wn,Ze=1;t.pixelStorei(i.UNPACK_SKIP_PIXELS,Dn),t.pixelStorei(i.UNPACK_SKIP_ROWS,ye),t.texSubImage2D(i.TEXTURE_2D,0,Dn,ye,wt,Ze,Te,Pe,Z.data)}le.clearUpdateRanges(),t.pixelStorei(i.UNPACK_ROW_LENGTH,qe),t.pixelStorei(i.UNPACK_SKIP_PIXELS,Je),t.pixelStorei(i.UNPACK_SKIP_ROWS,Pt)}}function Mt(le,Z,Te){let Pe=i.TEXTURE_2D;(Z.isDataArrayTexture||Z.isCompressedArrayTexture)&&(Pe=i.TEXTURE_2D_ARRAY),Z.isData3DTexture&&(Pe=i.TEXTURE_3D);let Ge=Ee(le,Z),vt=Z.source;t.bindTexture(Pe,le.__webglTexture,i.TEXTURE0+Te);let Tt=n.get(vt);if(vt.version!==Tt.__version||Ge===!0){if(t.activeTexture(i.TEXTURE0+Te),(typeof ImageBitmap<"u"&&Z.image instanceof ImageBitmap)===!1){let Ze=ln.getPrimaries(ln.workingColorSpace),St=Z.colorSpace===ua?null:ln.getPrimaries(Z.colorSpace),Bt=Z.colorSpace===ua||Ze===St?i.NONE:i.BROWSER_DEFAULT_WEBGL;t.pixelStorei(i.UNPACK_FLIP_Y_WEBGL,Z.flipY),t.pixelStorei(i.UNPACK_PREMULTIPLY_ALPHA_WEBGL,Z.premultiplyAlpha),t.pixelStorei(i.UNPACK_COLORSPACE_CONVERSION_WEBGL,Bt)}t.pixelStorei(i.UNPACK_ALIGNMENT,Z.unpackAlignment);let Je=S(Z.image,!1,r.maxTextureSize);Je=vi(Z,Je);let Pt=s.convert(Z.format,Z.colorSpace),sn=s.convert(Z.type),Lt=I(Z.internalFormat,Pt,sn,Z.normalized,Z.colorSpace,Z.isVideoTexture);mt(Pe,Z);let Rt,fn=Z.mipmaps,wn=Z.isVideoTexture!==!0,Dn=Tt.__version===void 0||Ge===!0,ye=vt.dataReady,wt=D(Z,Je);if(Z.isDepthTexture)Lt=F(Z.format===xo,Z.type),Dn&&(wn?t.texStorage2D(i.TEXTURE_2D,1,Lt,Je.width,Je.height):t.texImage2D(i.TEXTURE_2D,0,Lt,Je.width,Je.height,0,Pt,sn,null));else if(Z.isDataTexture)if(fn.length>0){wn&&Dn&&t.texStorage2D(i.TEXTURE_2D,wt,Lt,fn[0].width,fn[0].height);for(let Ze=0,St=fn.length;Ze<St;Ze++)Rt=fn[Ze],wn?ye&&t.texSubImage2D(i.TEXTURE_2D,Ze,0,0,Rt.width,Rt.height,Pt,sn,Rt.data):t.texImage2D(i.TEXTURE_2D,Ze,Lt,Rt.width,Rt.height,0,Pt,sn,Rt.data);Z.generateMipmaps=!1}else wn?(Dn&&t.texStorage2D(i.TEXTURE_2D,wt,Lt,Je.width,Je.height),ye&&Ye(Z,Je,Pt,sn)):t.texImage2D(i.TEXTURE_2D,0,Lt,Je.width,Je.height,0,Pt,sn,Je.data);else if(Z.isCompressedTexture)if(Z.isCompressedArrayTexture){wn&&Dn&&t.texStorage3D(i.TEXTURE_2D_ARRAY,wt,Lt,fn[0].width,fn[0].height,Je.depth);for(let Ze=0,St=fn.length;Ze<St;Ze++)if(Rt=fn[Ze],Z.format!==Or)if(Pt!==null)if(wn){if(ye)if(Z.layerUpdates.size>0){let Bt=Lb(Rt.width,Rt.height,Z.format,Z.type);for(let ut of Z.layerUpdates){let Ce=Rt.data.subarray(ut*Bt/Rt.data.BYTES_PER_ELEMENT,(ut+1)*Bt/Rt.data.BYTES_PER_ELEMENT);t.compressedTexSubImage3D(i.TEXTURE_2D_ARRAY,Ze,0,0,ut,Rt.width,Rt.height,1,Pt,Ce)}Z.clearLayerUpdates()}else t.compressedTexSubImage3D(i.TEXTURE_2D_ARRAY,Ze,0,0,0,Rt.width,Rt.height,Je.depth,Pt,Rt.data)}else t.compressedTexImage3D(i.TEXTURE_2D_ARRAY,Ze,Lt,Rt.width,Rt.height,Je.depth,0,Rt.data,0,0);else Xe("WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()");else wn?ye&&t.texSubImage3D(i.TEXTURE_2D_ARRAY,Ze,0,0,0,Rt.width,Rt.height,Je.depth,Pt,sn,Rt.data):t.texImage3D(i.TEXTURE_2D_ARRAY,Ze,Lt,Rt.width,Rt.height,Je.depth,0,Pt,sn,Rt.data)}else{wn&&Dn&&t.texStorage2D(i.TEXTURE_2D,wt,Lt,fn[0].width,fn[0].height);for(let Ze=0,St=fn.length;Ze<St;Ze++)Rt=fn[Ze],Z.format!==Or?Pt!==null?wn?ye&&t.compressedTexSubImage2D(i.TEXTURE_2D,Ze,0,0,Rt.width,Rt.height,Pt,Rt.data):t.compressedTexImage2D(i.TEXTURE_2D,Ze,Lt,Rt.width,Rt.height,0,Rt.data):Xe("WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):wn?ye&&t.texSubImage2D(i.TEXTURE_2D,Ze,0,0,Rt.width,Rt.height,Pt,sn,Rt.data):t.texImage2D(i.TEXTURE_2D,Ze,Lt,Rt.width,Rt.height,0,Pt,sn,Rt.data)}else if(Z.isDataArrayTexture)if(wn){if(Dn&&t.texStorage3D(i.TEXTURE_2D_ARRAY,wt,Lt,Je.width,Je.height,Je.depth),ye)if(Z.layerUpdates.size>0){let Ze=Lb(Je.width,Je.height,Z.format,Z.type);for(let St of Z.layerUpdates){let Bt=Je.data.subarray(St*Ze/Je.data.BYTES_PER_ELEMENT,(St+1)*Ze/Je.data.BYTES_PER_ELEMENT);t.texSubImage3D(i.TEXTURE_2D_ARRAY,0,0,0,St,Je.width,Je.height,1,Pt,sn,Bt)}Z.clearLayerUpdates()}else t.texSubImage3D(i.TEXTURE_2D_ARRAY,0,0,0,0,Je.width,Je.height,Je.depth,Pt,sn,Je.data)}else t.texImage3D(i.TEXTURE_2D_ARRAY,0,Lt,Je.width,Je.height,Je.depth,0,Pt,sn,Je.data);else if(Z.isData3DTexture)wn?(Dn&&t.texStorage3D(i.TEXTURE_3D,wt,Lt,Je.width,Je.height,Je.depth),ye&&t.texSubImage3D(i.TEXTURE_3D,0,0,0,0,Je.width,Je.height,Je.depth,Pt,sn,Je.data)):t.texImage3D(i.TEXTURE_3D,0,Lt,Je.width,Je.height,Je.depth,0,Pt,sn,Je.data);else if(Z.isFramebufferTexture){if(Dn)if(wn)t.texStorage2D(i.TEXTURE_2D,wt,Lt,Je.width,Je.height);else{let Ze=Je.width,St=Je.height;for(let Bt=0;Bt<wt;Bt++)t.texImage2D(i.TEXTURE_2D,Bt,Lt,Ze,St,0,Pt,sn,null),Ze>>=1,St>>=1}}else if(Z.isHTMLTexture){if("texElementImage2D"in i){let Ze=i.canvas;if(Ze.hasAttribute("layoutsubtree")||Ze.setAttribute("layoutsubtree","true"),Je.parentNode!==Ze){Ze.appendChild(Je),f.add(Z),Ze.onpaint=St=>{let Bt=St.changedElements;for(let ut of f)Bt.includes(ut.image)&&(ut.needsUpdate=!0)},Ze.requestPaint();return}if(i.texElementImage2D.length===3)i.texElementImage2D(i.TEXTURE_2D,i.RGBA8,Je);else{let Bt=i.RGBA,ut=i.RGBA,Ce=i.UNSIGNED_BYTE;i.texElementImage2D(i.TEXTURE_2D,0,Bt,ut,Ce,Je)}i.texParameteri(i.TEXTURE_2D,i.TEXTURE_MIN_FILTER,i.LINEAR),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_S,i.CLAMP_TO_EDGE),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_T,i.CLAMP_TO_EDGE)}}else if(fn.length>0){if(wn&&Dn){let Ze=zn(fn[0]);t.texStorage2D(i.TEXTURE_2D,wt,Lt,Ze.width,Ze.height)}for(let Ze=0,St=fn.length;Ze<St;Ze++)Rt=fn[Ze],wn?ye&&t.texSubImage2D(i.TEXTURE_2D,Ze,0,0,Pt,sn,Rt):t.texImage2D(i.TEXTURE_2D,Ze,Lt,Pt,sn,Rt);Z.generateMipmaps=!1}else if(wn){if(Dn){let Ze=zn(Je);t.texStorage2D(i.TEXTURE_2D,wt,Lt,Ze.width,Ze.height)}ye&&t.texSubImage2D(i.TEXTURE_2D,0,0,0,Pt,sn,Je)}else t.texImage2D(i.TEXTURE_2D,0,Lt,Pt,sn,Je);T(Z)&&R(Pe),Tt.__version=vt.version,Z.onUpdate&&Z.onUpdate(Z)}le.__version=Z.version}function Et(le,Z,Te){if(Z.image.length!==6)return;let Pe=Ee(le,Z),Ge=Z.source;t.bindTexture(i.TEXTURE_CUBE_MAP,le.__webglTexture,i.TEXTURE0+Te);let vt=n.get(Ge);if(Ge.version!==vt.__version||Pe===!0){t.activeTexture(i.TEXTURE0+Te);let Tt=ln.getPrimaries(ln.workingColorSpace),qe=Z.colorSpace===ua?null:ln.getPrimaries(Z.colorSpace),Je=Z.colorSpace===ua||Tt===qe?i.NONE:i.BROWSER_DEFAULT_WEBGL;t.pixelStorei(i.UNPACK_FLIP_Y_WEBGL,Z.flipY),t.pixelStorei(i.UNPACK_PREMULTIPLY_ALPHA_WEBGL,Z.premultiplyAlpha),t.pixelStorei(i.UNPACK_ALIGNMENT,Z.unpackAlignment),t.pixelStorei(i.UNPACK_COLORSPACE_CONVERSION_WEBGL,Je);let Pt=Z.isCompressedTexture||Z.image[0].isCompressedTexture,sn=Z.image[0]&&Z.image[0].isDataTexture,Lt=[];for(let ut=0;ut<6;ut++)!Pt&&!sn?Lt[ut]=S(Z.image[ut],!0,r.maxCubemapSize):Lt[ut]=sn?Z.image[ut].image:Z.image[ut],Lt[ut]=vi(Z,Lt[ut]);let Rt=Lt[0],fn=s.convert(Z.format,Z.colorSpace),wn=s.convert(Z.type),Dn=I(Z.internalFormat,fn,wn,Z.normalized,Z.colorSpace),ye=Z.isVideoTexture!==!0,wt=vt.__version===void 0||Pe===!0,Ze=Ge.dataReady,St=D(Z,Rt);mt(i.TEXTURE_CUBE_MAP,Z);let Bt;if(Pt){ye&&wt&&t.texStorage2D(i.TEXTURE_CUBE_MAP,St,Dn,Rt.width,Rt.height);for(let ut=0;ut<6;ut++){Bt=Lt[ut].mipmaps;for(let Ce=0;Ce<Bt.length;Ce++){let Yt=Bt[Ce];Z.format!==Or?fn!==null?ye?Ze&&t.compressedTexSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+ut,Ce,0,0,Yt.width,Yt.height,fn,Yt.data):t.compressedTexImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+ut,Ce,Dn,Yt.width,Yt.height,0,Yt.data):Xe("WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):ye?Ze&&t.texSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+ut,Ce,0,0,Yt.width,Yt.height,fn,wn,Yt.data):t.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+ut,Ce,Dn,Yt.width,Yt.height,0,fn,wn,Yt.data)}}}else{if(Bt=Z.mipmaps,ye&&wt){Bt.length>0&&St++;let ut=zn(Lt[0]);t.texStorage2D(i.TEXTURE_CUBE_MAP,St,Dn,ut.width,ut.height)}for(let ut=0;ut<6;ut++)if(sn){ye?Ze&&t.texSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+ut,0,0,0,Lt[ut].width,Lt[ut].height,fn,wn,Lt[ut].data):t.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+ut,0,Dn,Lt[ut].width,Lt[ut].height,0,fn,wn,Lt[ut].data);for(let Ce=0;Ce<Bt.length;Ce++){let nr=Bt[Ce].image[ut].image;ye?Ze&&t.texSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+ut,Ce+1,0,0,nr.width,nr.height,fn,wn,nr.data):t.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+ut,Ce+1,Dn,nr.width,nr.height,0,fn,wn,nr.data)}}else{ye?Ze&&t.texSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+ut,0,0,0,fn,wn,Lt[ut]):t.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+ut,0,Dn,fn,wn,Lt[ut]);for(let Ce=0;Ce<Bt.length;Ce++){let Yt=Bt[Ce];ye?Ze&&t.texSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+ut,Ce+1,0,0,fn,wn,Yt.image[ut]):t.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+ut,Ce+1,Dn,fn,wn,Yt.image[ut])}}}T(Z)&&R(i.TEXTURE_CUBE_MAP),vt.__version=Ge.version,Z.onUpdate&&Z.onUpdate(Z)}le.__version=Z.version}function It(le,Z,Te,Pe,Ge,vt){let Tt=s.convert(Te.format,Te.colorSpace),qe=s.convert(Te.type),Je=I(Te.internalFormat,Tt,qe,Te.normalized,Te.colorSpace),Pt=n.get(Z),sn=n.get(Te);if(sn.__renderTarget=Z,!Pt.__hasExternalTextures){let Lt=Math.max(1,Z.width>>vt),Rt=Math.max(1,Z.height>>vt);Ge===i.TEXTURE_3D||Ge===i.TEXTURE_2D_ARRAY?t.texImage3D(Ge,vt,Je,Lt,Rt,Z.depth,0,Tt,qe,null):t.texImage2D(Ge,vt,Je,Lt,Rt,0,Tt,qe,null)}t.bindFramebuffer(i.FRAMEBUFFER,le),bn(Z)?a.framebufferTexture2DMultisampleEXT(i.FRAMEBUFFER,Pe,Ge,sn.__webglTexture,0,nn(Z)):(Ge===i.TEXTURE_2D||Ge>=i.TEXTURE_CUBE_MAP_POSITIVE_X&&Ge<=i.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&i.framebufferTexture2D(i.FRAMEBUFFER,Pe,Ge,sn.__webglTexture,vt),t.bindFramebuffer(i.FRAMEBUFFER,null)}function dn(le,Z,Te){if(i.bindRenderbuffer(i.RENDERBUFFER,le),Z.depthBuffer){let Pe=Z.depthTexture,Ge=Pe&&Pe.isDepthTexture?Pe.type:null,vt=F(Z.stencilBuffer,Ge),Tt=Z.stencilBuffer?i.DEPTH_STENCIL_ATTACHMENT:i.DEPTH_ATTACHMENT;bn(Z)?a.renderbufferStorageMultisampleEXT(i.RENDERBUFFER,nn(Z),vt,Z.width,Z.height):Te?i.renderbufferStorageMultisample(i.RENDERBUFFER,nn(Z),vt,Z.width,Z.height):i.renderbufferStorage(i.RENDERBUFFER,vt,Z.width,Z.height),i.framebufferRenderbuffer(i.FRAMEBUFFER,Tt,i.RENDERBUFFER,le)}else{let Pe=Z.textures;for(let Ge=0;Ge<Pe.length;Ge++){let vt=Pe[Ge],Tt=s.convert(vt.format,vt.colorSpace),qe=s.convert(vt.type),Je=I(vt.internalFormat,Tt,qe,vt.normalized,vt.colorSpace);bn(Z)?a.renderbufferStorageMultisampleEXT(i.RENDERBUFFER,nn(Z),Je,Z.width,Z.height):Te?i.renderbufferStorageMultisample(i.RENDERBUFFER,nn(Z),Je,Z.width,Z.height):i.renderbufferStorage(i.RENDERBUFFER,Je,Z.width,Z.height)}}i.bindRenderbuffer(i.RENDERBUFFER,null)}function Gt(le,Z,Te){let Pe=Z.isWebGLCubeRenderTarget===!0;if(t.bindFramebuffer(i.FRAMEBUFFER,le),!(Z.depthTexture&&Z.depthTexture.isDepthTexture))throw new Error("THREE.WebGLTextures: renderTarget.depthTexture must be an instance of THREE.DepthTexture.");let Ge=n.get(Z.depthTexture);if(Ge.__renderTarget=Z,(!Ge.__webglTexture||Z.depthTexture.image.width!==Z.width||Z.depthTexture.image.height!==Z.height)&&(Z.depthTexture.image.width=Z.width,Z.depthTexture.image.height=Z.height,Z.depthTexture.needsUpdate=!0),Pe){if(Ge.__webglInit===void 0&&(Ge.__webglInit=!0,Z.depthTexture.addEventListener("dispose",L)),Ge.__webglTexture===void 0){Ge.__webglTexture=i.createTexture(),t.bindTexture(i.TEXTURE_CUBE_MAP,Ge.__webglTexture),mt(i.TEXTURE_CUBE_MAP,Z.depthTexture);let Pt=s.convert(Z.depthTexture.format),sn=s.convert(Z.depthTexture.type),Lt;Z.depthTexture.format===Gs?Lt=i.DEPTH_COMPONENT24:Z.depthTexture.format===xo&&(Lt=i.DEPTH24_STENCIL8);for(let Rt=0;Rt<6;Rt++)i.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+Rt,0,Lt,Z.width,Z.height,0,Pt,sn,null)}}else te(Z.depthTexture,0);let vt=Ge.__webglTexture,Tt=nn(Z),qe=Pe?i.TEXTURE_CUBE_MAP_POSITIVE_X+Te:i.TEXTURE_2D,Je=Z.depthTexture.format===xo?i.DEPTH_STENCIL_ATTACHMENT:i.DEPTH_ATTACHMENT;if(Z.depthTexture.format===Gs)bn(Z)?a.framebufferTexture2DMultisampleEXT(i.FRAMEBUFFER,Je,qe,vt,0,Tt):i.framebufferTexture2D(i.FRAMEBUFFER,Je,qe,vt,0);else if(Z.depthTexture.format===xo)bn(Z)?a.framebufferTexture2DMultisampleEXT(i.FRAMEBUFFER,Je,qe,vt,0,Tt):i.framebufferTexture2D(i.FRAMEBUFFER,Je,qe,vt,0);else throw new Error("THREE.WebGLTextures: Unknown depthTexture format.")}function $e(le){let Z=n.get(le),Te=le.isWebGLCubeRenderTarget===!0;if(Z.__boundDepthTexture!==le.depthTexture){let Pe=le.depthTexture;if(Z.__depthDisposeCallback&&Z.__depthDisposeCallback(),Pe){let Ge=()=>{delete Z.__boundDepthTexture,delete Z.__depthDisposeCallback,Pe.removeEventListener("dispose",Ge)};Pe.addEventListener("dispose",Ge),Z.__depthDisposeCallback=Ge}Z.__boundDepthTexture=Pe}if(le.depthTexture&&!Z.__autoAllocateDepthBuffer)if(Te)for(let Pe=0;Pe<6;Pe++)Gt(Z.__webglFramebuffer[Pe],le,Pe);else{let Pe=le.texture.mipmaps;Pe&&Pe.length>0?Gt(Z.__webglFramebuffer[0],le,0):Gt(Z.__webglFramebuffer,le,0)}else if(Te){Z.__webglDepthbuffer=[];for(let Pe=0;Pe<6;Pe++)if(t.bindFramebuffer(i.FRAMEBUFFER,Z.__webglFramebuffer[Pe]),Z.__webglDepthbuffer[Pe]===void 0)Z.__webglDepthbuffer[Pe]=i.createRenderbuffer(),dn(Z.__webglDepthbuffer[Pe],le,!1);else{let Ge=le.stencilBuffer?i.DEPTH_STENCIL_ATTACHMENT:i.DEPTH_ATTACHMENT,vt=Z.__webglDepthbuffer[Pe];i.bindRenderbuffer(i.RENDERBUFFER,vt),i.framebufferRenderbuffer(i.FRAMEBUFFER,Ge,i.RENDERBUFFER,vt)}}else{let Pe=le.texture.mipmaps;if(Pe&&Pe.length>0?t.bindFramebuffer(i.FRAMEBUFFER,Z.__webglFramebuffer[0]):t.bindFramebuffer(i.FRAMEBUFFER,Z.__webglFramebuffer),Z.__webglDepthbuffer===void 0)Z.__webglDepthbuffer=i.createRenderbuffer(),dn(Z.__webglDepthbuffer,le,!1);else{let Ge=le.stencilBuffer?i.DEPTH_STENCIL_ATTACHMENT:i.DEPTH_ATTACHMENT,vt=Z.__webglDepthbuffer;i.bindRenderbuffer(i.RENDERBUFFER,vt),i.framebufferRenderbuffer(i.FRAMEBUFFER,Ge,i.RENDERBUFFER,vt)}}t.bindFramebuffer(i.FRAMEBUFFER,null)}function ot(le,Z,Te){let Pe=n.get(le);Z!==void 0&&It(Pe.__webglFramebuffer,le,le.texture,i.COLOR_ATTACHMENT0,i.TEXTURE_2D,0),Te!==void 0&&$e(le)}function nt(le){let Z=le.texture,Te=n.get(le),Pe=n.get(Z);le.addEventListener("dispose",C);let Ge=le.textures,vt=le.isWebGLCubeRenderTarget===!0,Tt=Ge.length>1;if(Tt||(Pe.__webglTexture===void 0&&(Pe.__webglTexture=i.createTexture()),Pe.__version=Z.version,o.memory.textures++),vt){Te.__webglFramebuffer=[];for(let qe=0;qe<6;qe++)if(Z.mipmaps&&Z.mipmaps.length>0){Te.__webglFramebuffer[qe]=[];for(let Je=0;Je<Z.mipmaps.length;Je++)Te.__webglFramebuffer[qe][Je]=i.createFramebuffer()}else Te.__webglFramebuffer[qe]=i.createFramebuffer()}else{if(Z.mipmaps&&Z.mipmaps.length>0){Te.__webglFramebuffer=[];for(let qe=0;qe<Z.mipmaps.length;qe++)Te.__webglFramebuffer[qe]=i.createFramebuffer()}else Te.__webglFramebuffer=i.createFramebuffer();if(Tt)for(let qe=0,Je=Ge.length;qe<Je;qe++){let Pt=n.get(Ge[qe]);Pt.__webglTexture===void 0&&(Pt.__webglTexture=i.createTexture(),o.memory.textures++)}if(le.samples>0&&bn(le)===!1){Te.__webglMultisampledFramebuffer=i.createFramebuffer(),Te.__webglColorRenderbuffer=[],t.bindFramebuffer(i.FRAMEBUFFER,Te.__webglMultisampledFramebuffer);for(let qe=0;qe<Ge.length;qe++){let Je=Ge[qe];Te.__webglColorRenderbuffer[qe]=i.createRenderbuffer(),i.bindRenderbuffer(i.RENDERBUFFER,Te.__webglColorRenderbuffer[qe]);let Pt=s.convert(Je.format,Je.colorSpace),sn=s.convert(Je.type),Lt=I(Je.internalFormat,Pt,sn,Je.normalized,Je.colorSpace,le.isXRRenderTarget===!0),Rt=nn(le);i.renderbufferStorageMultisample(i.RENDERBUFFER,Rt,Lt,le.width,le.height),i.framebufferRenderbuffer(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0+qe,i.RENDERBUFFER,Te.__webglColorRenderbuffer[qe])}i.bindRenderbuffer(i.RENDERBUFFER,null),le.depthBuffer&&(Te.__webglDepthRenderbuffer=i.createRenderbuffer(),dn(Te.__webglDepthRenderbuffer,le,!0)),t.bindFramebuffer(i.FRAMEBUFFER,null)}}if(vt){t.bindTexture(i.TEXTURE_CUBE_MAP,Pe.__webglTexture),mt(i.TEXTURE_CUBE_MAP,Z);for(let qe=0;qe<6;qe++)if(Z.mipmaps&&Z.mipmaps.length>0)for(let Je=0;Je<Z.mipmaps.length;Je++)It(Te.__webglFramebuffer[qe][Je],le,Z,i.COLOR_ATTACHMENT0,i.TEXTURE_CUBE_MAP_POSITIVE_X+qe,Je);else It(Te.__webglFramebuffer[qe],le,Z,i.COLOR_ATTACHMENT0,i.TEXTURE_CUBE_MAP_POSITIVE_X+qe,0);T(Z)&&R(i.TEXTURE_CUBE_MAP),t.unbindTexture()}else if(Tt){for(let qe=0,Je=Ge.length;qe<Je;qe++){let Pt=Ge[qe],sn=n.get(Pt),Lt=i.TEXTURE_2D;(le.isWebGL3DRenderTarget||le.isWebGLArrayRenderTarget)&&(Lt=le.isWebGL3DRenderTarget?i.TEXTURE_3D:i.TEXTURE_2D_ARRAY),t.bindTexture(Lt,sn.__webglTexture),mt(Lt,Pt),It(Te.__webglFramebuffer,le,Pt,i.COLOR_ATTACHMENT0+qe,Lt,0),T(Pt)&&R(Lt)}t.unbindTexture()}else{let qe=i.TEXTURE_2D;if((le.isWebGL3DRenderTarget||le.isWebGLArrayRenderTarget)&&(qe=le.isWebGL3DRenderTarget?i.TEXTURE_3D:i.TEXTURE_2D_ARRAY),t.bindTexture(qe,Pe.__webglTexture),mt(qe,Z),Z.mipmaps&&Z.mipmaps.length>0)for(let Je=0;Je<Z.mipmaps.length;Je++)It(Te.__webglFramebuffer[Je],le,Z,i.COLOR_ATTACHMENT0,qe,Je);else It(Te.__webglFramebuffer,le,Z,i.COLOR_ATTACHMENT0,qe,0);T(Z)&&R(qe),t.unbindTexture()}le.depthBuffer&&$e(le)}function bt(le){let Z=le.textures;for(let Te=0,Pe=Z.length;Te<Pe;Te++){let Ge=Z[Te];if(T(Ge)){let vt=P(le),Tt=n.get(Ge).__webglTexture;t.bindTexture(vt,Tt),R(vt),t.unbindTexture()}}}let yt=[],hn=[];function tn(le){if(le.samples>0){if(bn(le)===!1){let Z=le.textures,Te=le.width,Pe=le.height,Ge=i.COLOR_BUFFER_BIT,vt=le.stencilBuffer?i.DEPTH_STENCIL_ATTACHMENT:i.DEPTH_ATTACHMENT,Tt=n.get(le),qe=Z.length>1;if(qe)for(let Pt=0;Pt<Z.length;Pt++)t.bindFramebuffer(i.FRAMEBUFFER,Tt.__webglMultisampledFramebuffer),i.framebufferRenderbuffer(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0+Pt,i.RENDERBUFFER,null),t.bindFramebuffer(i.FRAMEBUFFER,Tt.__webglFramebuffer),i.framebufferTexture2D(i.DRAW_FRAMEBUFFER,i.COLOR_ATTACHMENT0+Pt,i.TEXTURE_2D,null,0);t.bindFramebuffer(i.READ_FRAMEBUFFER,Tt.__webglMultisampledFramebuffer);let Je=le.texture.mipmaps;Je&&Je.length>0?t.bindFramebuffer(i.DRAW_FRAMEBUFFER,Tt.__webglFramebuffer[0]):t.bindFramebuffer(i.DRAW_FRAMEBUFFER,Tt.__webglFramebuffer);for(let Pt=0;Pt<Z.length;Pt++){if(le.resolveDepthBuffer&&(le.depthBuffer&&(Ge|=i.DEPTH_BUFFER_BIT),le.stencilBuffer&&le.resolveStencilBuffer&&(Ge|=i.STENCIL_BUFFER_BIT)),qe){i.framebufferRenderbuffer(i.READ_FRAMEBUFFER,i.COLOR_ATTACHMENT0,i.RENDERBUFFER,Tt.__webglColorRenderbuffer[Pt]);let sn=n.get(Z[Pt]).__webglTexture;i.framebufferTexture2D(i.DRAW_FRAMEBUFFER,i.COLOR_ATTACHMENT0,i.TEXTURE_2D,sn,0)}i.blitFramebuffer(0,0,Te,Pe,0,0,Te,Pe,Ge,i.NEAREST),l===!0&&(yt.length=0,hn.length=0,yt.push(i.COLOR_ATTACHMENT0+Pt),le.depthBuffer&&le.resolveDepthBuffer===!1&&(yt.push(vt),hn.push(vt),i.invalidateFramebuffer(i.DRAW_FRAMEBUFFER,hn)),i.invalidateFramebuffer(i.READ_FRAMEBUFFER,yt))}if(t.bindFramebuffer(i.READ_FRAMEBUFFER,null),t.bindFramebuffer(i.DRAW_FRAMEBUFFER,null),qe)for(let Pt=0;Pt<Z.length;Pt++){t.bindFramebuffer(i.FRAMEBUFFER,Tt.__webglMultisampledFramebuffer),i.framebufferRenderbuffer(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0+Pt,i.RENDERBUFFER,Tt.__webglColorRenderbuffer[Pt]);let sn=n.get(Z[Pt]).__webglTexture;t.bindFramebuffer(i.FRAMEBUFFER,Tt.__webglFramebuffer),i.framebufferTexture2D(i.DRAW_FRAMEBUFFER,i.COLOR_ATTACHMENT0+Pt,i.TEXTURE_2D,sn,0)}t.bindFramebuffer(i.DRAW_FRAMEBUFFER,Tt.__webglMultisampledFramebuffer)}else if(le.depthBuffer&&le.resolveDepthBuffer===!1&&l){let Z=le.stencilBuffer?i.DEPTH_STENCIL_ATTACHMENT:i.DEPTH_ATTACHMENT;i.invalidateFramebuffer(i.DRAW_FRAMEBUFFER,[Z])}}}function nn(le){return Math.min(r.maxSamples,le.samples)}function bn(le){let Z=n.get(le);return le.samples>0&&e.has("WEBGL_multisampled_render_to_texture")===!0&&Z.__useRenderToTexture!==!1}function _e(le){let Z=o.render.frame;u.get(le)!==Z&&(u.set(le,Z),le.update())}function vi(le,Z){let Te=le.colorSpace,Pe=le.format,Ge=le.type;return le.isCompressedTexture===!0||le.isVideoTexture===!0||Te!==Kp&&Te!==ua&&(ln.getTransfer(Te)===kt?(Pe!==Or||Ge!==Ji)&&Xe("WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):ze("WebGLTextures: Unsupported texture color space:",Te)),Z}function zn(le){return typeof HTMLImageElement<"u"&&le instanceof HTMLImageElement?(c.width=le.naturalWidth||le.width,c.height=le.naturalHeight||le.height):typeof VideoFrame<"u"&&le instanceof VideoFrame?(c.width=le.displayWidth,c.height=le.displayHeight):(c.width=le.width,c.height=le.height),c}this.allocateTextureUnit=$,this.resetTextureUnits=W,this.getTextureUnits=Y,this.setTextureUnits=H,this.setTexture2D=te,this.setTexture2DArray=ce,this.setTexture3D=he,this.setTextureCube=ve,this.rebindTextures=ot,this.setupRenderTarget=nt,this.updateRenderTargetMipmap=bt,this.updateMultisampleRenderTarget=tn,this.setupDepthRenderbuffer=$e,this.setupFrameBufferTexture=It,this.useMultisampledRTT=bn,this.isReversedDepthBuffer=function(){return t.buffers.depth.getReversed()}}function lxe(i,e){function t(n,r=ua){let s,o=ln.getTransfer(r);if(n===Ji)return i.UNSIGNED_BYTE;if(n===KA)return i.UNSIGNED_SHORT_4_4_4_4;if(n===QA)return i.UNSIGNED_SHORT_5_5_5_1;if(n===JA)return i.UNSIGNED_INT_5_9_9_9_REV;if(n===eg)return i.UNSIGNED_INT_10F_11F_11F_REV;if(n===Oh)return i.BYTE;if(n===Uh)return i.SHORT;if(n===bl)return i.UNSIGNED_SHORT;if(n===Zr)return i.INT;if(n===xi)return i.UNSIGNED_INT;if(n===cr)return i.FLOAT;if(n===Wi)return i.HALF_FLOAT;if(n===r_)return i.ALPHA;if(n===Pd)return i.RGB;if(n===Or)return i.RGBA;if(n===Gs)return i.DEPTH_COMPONENT;if(n===xo)return i.DEPTH_STENCIL;if(n===Ld)return i.RED;if(n===kh)return i.RED_INTEGER;if(n===js)return i.RG;if(n===zh)return i.RG_INTEGER;if(n===d0)return i.RGBA_INTEGER;if(n===Vh||n===Gh||n===qh||n===Hh)if(o===kt)if(s=e.get("WEBGL_compressed_texture_s3tc_srgb"),s!==null){if(n===Vh)return s.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(n===Gh)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(n===qh)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(n===Hh)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(s=e.get("WEBGL_compressed_texture_s3tc"),s!==null){if(n===Vh)return s.COMPRESSED_RGB_S3TC_DXT1_EXT;if(n===Gh)return s.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(n===qh)return s.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(n===Hh)return s.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(n===tg||n===ng||n===ig||n===rg)if(s=e.get("WEBGL_compressed_texture_pvrtc"),s!==null){if(n===tg)return s.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(n===ng)return s.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(n===ig)return s.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(n===rg)return s.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(n===p0||n===m0||n===A0||n===g0||n===v0||n===Wh||n===_0)if(s=e.get("WEBGL_compressed_texture_etc"),s!==null){if(n===p0||n===m0)return o===kt?s.COMPRESSED_SRGB8_ETC2:s.COMPRESSED_RGB8_ETC2;if(n===A0)return o===kt?s.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:s.COMPRESSED_RGBA8_ETC2_EAC;if(n===g0)return s.COMPRESSED_R11_EAC;if(n===v0)return s.COMPRESSED_SIGNED_R11_EAC;if(n===Wh)return s.COMPRESSED_RG11_EAC;if(n===_0)return s.COMPRESSED_SIGNED_RG11_EAC}else return null;if(n===x0||n===y0||n===b0||n===w0||n===S0||n===T0||n===E0||n===M0||n===C0||n===R0||n===I0||n===P0||n===L0||n===D0)if(s=e.get("WEBGL_compressed_texture_astc"),s!==null){if(n===x0)return o===kt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:s.COMPRESSED_RGBA_ASTC_4x4_KHR;if(n===y0)return o===kt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:s.COMPRESSED_RGBA_ASTC_5x4_KHR;if(n===b0)return o===kt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:s.COMPRESSED_RGBA_ASTC_5x5_KHR;if(n===w0)return o===kt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:s.COMPRESSED_RGBA_ASTC_6x5_KHR;if(n===S0)return o===kt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:s.COMPRESSED_RGBA_ASTC_6x6_KHR;if(n===T0)return o===kt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:s.COMPRESSED_RGBA_ASTC_8x5_KHR;if(n===E0)return o===kt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:s.COMPRESSED_RGBA_ASTC_8x6_KHR;if(n===M0)return o===kt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:s.COMPRESSED_RGBA_ASTC_8x8_KHR;if(n===C0)return o===kt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:s.COMPRESSED_RGBA_ASTC_10x5_KHR;if(n===R0)return o===kt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:s.COMPRESSED_RGBA_ASTC_10x6_KHR;if(n===I0)return o===kt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:s.COMPRESSED_RGBA_ASTC_10x8_KHR;if(n===P0)return o===kt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:s.COMPRESSED_RGBA_ASTC_10x10_KHR;if(n===L0)return o===kt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:s.COMPRESSED_RGBA_ASTC_12x10_KHR;if(n===D0)return o===kt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:s.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(n===N0||n===F0||n===B0)if(s=e.get("EXT_texture_compression_bptc"),s!==null){if(n===N0)return o===kt?s.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:s.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(n===F0)return s.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(n===B0)return s.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}else return null;if(n===O0||n===U0||n===jh||n===k0)if(s=e.get("EXT_texture_compression_rgtc"),s!==null){if(n===O0)return s.COMPRESSED_RED_RGTC1_EXT;if(n===U0)return s.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(n===jh)return s.COMPRESSED_RED_GREEN_RGTC2_EXT;if(n===k0)return s.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return n===ca?i.UNSIGNED_INT_24_8:i[n]!==void 0?i[n]:null}return{convert:t}}var cxe=`4093+}`,Uxe=[new re(1,0,0),new re(-1,0,0),new re(0,1,0),new re(0,-1,0),new re(0,0,1),new re(0,0,-1)],kxe=[new re(0,-1,0),new re(0,-1,0),new re(0,0,1),new re(0,0,-1),new re(0,-1,0),new re(0,-1,0)],iK=new cn,zb=new re,LF=new re;function zxe(i,e,t){let n=new zc,r=new Oe,s=new Oe,o=new xn,a=new AM,l=new gM,c={},u=t.maxTextureSize,f={[zo]:mi,[mi]:zo,[vr]:vr},d=new ds({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new Oe},radius:{value:4}},vertexShader:Bxe,fragmentShader:Oxe}),A=d.clone();A.defines.HORIZONTAL_PASS=1;let y=new Xn;y.setAttribute("position",new Hi(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));let w=new Hn(y,d),S=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=d0;let T=this.type;this.render=function(D,L,C){if(S.enabled===!1||S.autoUpdate===!1&&S.needsUpdate===!1||D.length===0)return;this.type===DM&&(Xe("WebGLShadowMap: PCFSoftShadowMap has been deprecated. Using PCFShadowMap instead."),this.type=d0);let B=i.getRenderTarget(),k=i.getActiveCubeFace(),z=i.getActiveMipmapLevel(),G=i.state;G.setBlending(ps),G.buffers.depth.getReversed()===!0?G.buffers.color.setClear(0,0,0,0):G.buffers.color.setClear(1,1,1,1),G.buffers.depth.setTest(!0),G.setScissorTest(!1);let W=T!==this.type;W&&L.traverse(function(Y){Y.material&&(Array.isArray(Y.material)?Y.material.forEach(H=>H.needsUpdate=!0):Y.material.needsUpdate=!0)});for(let Y=0,H=D.length;Y<H;Y++){let $=D[Y],J=$.shadow;if(J===void 0){Xe("WebGLShadowMap:",$,"has no shadow.");continue}if(J.autoUpdate===!1&&J.needsUpdate===!1)continue;r.copy(J.mapSize);let te=J.getFrameExtents();r.multiply(te),s.copy(J.mapSize),(r.x>u||r.y>u)&&(r.x>u&&(s.x=Math.floor(u/te.x),r.x=s.x*te.x,J.mapSize.x=s.x),r.y>u&&(s.y=Math.floor(u/te.y),r.y=s.y*te.y,J.mapSize.y=s.y));let ce=i.state.buffers.depth.getReversed();if(J.camera._reversedDepth=ce,J.map===null||W===!0){if(J.map!==null&&(J.map.depthTexture!==null&&(J.map.depthTexture.dispose(),J.map.depthTexture=null),J.map.dispose()),this.type===Vc){if($.isPointLight){Xe("WebGLShadowMap: VSM shadow maps are not supported for PointLights. Use PCF or BasicShadowMap instead.");continue}J.map=new Oa(r.x,r.y,{format:Ws,type:Wi,minFilter:Mi,magFilter:Mi,generateMipmaps:!1}),J.map.texture.name=$.name+".shadowMap",J.map.depthTexture=new Es(r.x,r.y,cr),J.map.depthTexture.name=$.name+".shadowMapDepth",J.map.depthTexture.format=Vs,J.map.depthTexture.compareFunction=null,J.map.depthTexture.minFilter=Ti,J.map.depthTexture.magFilter=Ti}else $.isPointLight?(J.map=new WM(r.x),J.map.depthTexture=new e_(r.x,xi)):(J.map=new Oa(r.x,r.y),J.map.depthTexture=new Es(r.x,r.y,xi)),J.map.depthTexture.name=$.name+".shadowMap",J.map.depthTexture.format=Vs,this.type===d0?(J.map.depthTexture.compareFunction=ce?Fu:Xh,J.map.depthTexture.minFilter=Mi,J.map.depthTexture.magFilter=Mi):(J.map.depthTexture.compareFunction=null,J.map.depthTexture.minFilter=Ti,J.map.depthTexture.magFilter=Ti);J.camera.updateProjectionMatrix()}let he=J.map.isWebGLCubeRenderTarget?6:1;for(let ve=0;ve<he;ve++){if(J.map.isWebGLCubeRenderTarget)i.setRenderTarget(J.map,ve),i.clear();else{ve===0&&(i.setRenderTarget(J.map),i.clear());let Re=J.getViewport(ve);o.set(s.x*Re.x,s.y*Re.y,s.x*Re.z,s.y*Re.w),G.viewport(o)}if($.isPointLight){let Re=J.camera,Qe=J.matrix,Fe=$.distance||Re.far;Fe!==Re.far&&(Re.far=Fe,Re.updateProjectionMatrix()),zb.setFromMatrixPosition($.matrixWorld),Re.position.copy(zb),LF.copy(Re.position),LF.add(Uxe[ve]),Re.up.copy(kxe[ve]),Re.lookAt(LF),Re.updateMatrixWorld(),Qe.makeTranslation(-zb.x,-zb.y,-zb.z),iK.multiplyMatrices(Re.projectionMatrix,Re.matrixWorldInverse),J._frustum.setFromProjectionMatrix(iK,Re.coordinateSystem,Re.reversedDepth)}else J.updateMatrices($);n=J.getFrustum(),P(L,C,J.camera,$,this.type)}J.isPointLightShadow!==!0&&this.type===Vc&&R(J,C),J.needsUpdate=!1}T=this.type,S.needsUpdate=!1,i.setRenderTarget(B,k,z)};function R(D,L){let C=e.update(w);d.defines.VSM_SAMPLES!==D.blurSamples&&(d.defines.VSM_SAMPLES=D.blurSamples,A.defines.VSM_SAMPLES=D.blurSamples,d.needsUpdate=!0,A.needsUpdate=!0),D.mapPass===null&&(D.mapPass=new Oa(r.x,r.y,{format:Ws,type:Wi})),d.uniforms.shadow_pass.value=D.map.depthTexture,d.uniforms.resolution.value=D.mapSize,d.uniforms.radius.value=D.radius,i.setRenderTarget(D.mapPass),i.clear(),i.renderBufferDirect(L,null,C,d,w,null),A.uniforms.shadow_pass.value=D.mapPass.texture,A.uniforms.resolution.value=D.mapSize,A.uniforms.radius.value=D.radius,i.setRenderTarget(D.map),i.clear(),i.renderBufferDirect(L,null,C,A,w,null)}function I(D,L,C,B){let k=null,z=C.isPointLight===!0?D.customDistanceMaterial:D.customDepthMaterial;if(z!==void 0)k=z;else if(k=C.isPointLight===!0?l:a,i.localClippingEnabled&&L.clipShadows===!0&&Array.isArray(L.clippingPlanes)&&L.clippingPlanes.length!==0||L.displacementMap&&L.displacementScale!==0||L.alphaMap&&L.alphaTest>0||L.map&&L.alphaTest>0||L.alphaToCoverage===!0){let G=k.uuid,W=L.uuid,Y=c[G];Y===void 0&&(Y={},c[G]=Y);let H=Y[W];H===void 0&&(H=k.clone(),Y[W]=H,L.addEventListener("dispose",F)),k=H}if(k.visible=L.visible,k.wireframe=L.wireframe,B===Vc?k.side=L.shadowSide!==null?L.shadowSide:L.side:k.side=L.shadowSide!==null?L.shadowSide:f[L.side],k.alphaMap=L.alphaMap,k.alphaTest=L.alphaToCoverage===!0?.5:L.alphaTest,k.map=L.map,k.clipShadows=L.clipShadows,k.clippingPlanes=L.clippingPlanes,k.clipIntersection=L.clipIntersection,k.displacementMap=L.displacementMap,k.displacementScale=L.displacementScale,k.displacementBias=L.displacementBias,k.wireframeLinewidth=L.wireframeLinewidth,k.linewidth=L.linewidth,C.isPointLight===!0&&k.isMeshDistanceMaterial===!0){let G=i.properties.get(k);G.light=C}return k}function P(D,L,C,B,k){if(D.visible===!1)return;if(D.layers.test(L.layers)&&(D.isMesh||D.isLine||D.isPoints)&&(D.castShadow||D.receiveShadow&&k===Vc)&&(!D.frustumCulled||n.intersectsObject(D))){D.modelViewMatrix.multiplyMatrices(C.matrixWorldInverse,D.matrixWorld);let W=e.update(D),Y=D.material;if(Array.isArray(Y)){let H=W.groups;for(let $=0,J=H.length;$<J;$++){let te=H[$],ce=Y[te.materialIndex];if(ce&&ce.visible){let he=I(D,ce,B,k);D.onBeforeShadow(i,D,L,C,W,he,te),i.renderBufferDirect(C,null,W,he,D,te),D.onAfterShadow(i,D,L,C,W,he,te)}}}else if(Y.visible){let H=I(D,Y,B,k);D.onBeforeShadow(i,D,L,C,W,H,null),i.renderBufferDirect(C,null,W,H,D,null),D.onAfterShadow(i,D,L,C,W,H,null)}}let G=D.children;for(let W=0,Y=G.length;W<Y;W++)P(G[W],L,C,B,k)}function F(D){D.target.removeEventListener("dispose",F);for(let C in c){let B=c[C],k=D.target.uuid;k in B&&(B[k].dispose(),delete B[k])}}}function Vxe(i,e){function t(){let ye=!1,wt=new xn,Ze=null,St=new xn(0,0,0,0);return{setMask:function(Bt){Ze!==Bt&&!ye&&(i.colorMask(Bt,Bt,Bt,Bt),Ze=Bt)},setLocked:function(Bt){ye=Bt},setClear:function(Bt,ut,Ce,Yt,nr){nr===!0&&(Bt*=Yt,ut*=Yt,Ce*=Yt),wt.set(Bt,ut,Ce,Yt),St.equals(wt)===!1&&(i.clearColor(Bt,ut,Ce,Yt),St.copy(wt))},reset:function(){ye=!1,Ze=null,St.set(-1,0,0,0)}}}function n(){let ye=!1,wt=!1,Ze=null,St=null,Bt=null;return{setReversed:function(ut){if(wt!==ut){let Ce=e.get("EXT_clip_control");ut?Ce.clipControlEXT(Ce.LOWER_LEFT_EXT,Ce.ZERO_TO_ONE_EXT):Ce.clipControlEXT(Ce.LOWER_LEFT_EXT,Ce.NEGATIVE_ONE_TO_ONE_EXT),wt=ut;let Yt=Bt;Bt=null,this.setClear(Yt)}},getReversed:function(){return wt},setTest:function(ut){ut?Ye(i.DEPTH_TEST):Mt(i.DEPTH_TEST)},setMask:function(ut){Ze!==ut&&!ye&&(i.depthMask(ut),Ze=ut)},setFunc:function(ut){if(wt&&(ut=Ob[ut]),St!==ut){switch(ut){case LA:i.depthFunc(i.NEVER);break;case DA:i.depthFunc(i.ALWAYS);break;case NA:i.depthFunc(i.LESS);break;case Ch:i.depthFunc(i.LEQUAL);break;case FA:i.depthFunc(i.EQUAL);break;case BA:i.depthFunc(i.GEQUAL);break;case OA:i.depthFunc(i.GREATER);break;case UA:i.depthFunc(i.NOTEQUAL);break;default:i.depthFunc(i.LEQUAL)}St=ut}},setLocked:function(ut){ye=ut},setClear:function(ut){Bt!==ut&&(Bt=ut,wt&&(ut=1-ut),i.clearDepth(ut))},reset:function(){ye=!1,Ze=null,St=null,Bt=null,wt=!1}}}function r(){let ye=!1,wt=null,Ze=null,St=null,Bt=null,ut=null,Ce=null,Yt=null,nr=null;return{setTest:function(Fn){ye||(Fn?Ye(i.STENCIL_TEST):Mt(i.STENCIL_TEST))},setMask:function(Fn){wt!==Fn&&!ye&&(i.stencilMask(Fn),wt=Fn)},setFunc:function(Fn,rs,Lr){(Ze!==Fn||St!==rs||Bt!==Lr)&&(i.stencilFunc(Fn,rs,Lr),Ze=Fn,St=rs,Bt=Lr)},setOp:function(Fn,rs,Lr){(ut!==Fn||Ce!==rs||Yt!==Lr)&&(i.stencilOp(Fn,rs,Lr),ut=Fn,Ce=rs,Yt=Lr)},setLocked:function(Fn){ye=Fn},setClear:function(Fn){nr!==Fn&&(i.clearStencil(Fn),nr=Fn)},reset:function(){ye=!1,wt=null,Ze=null,St=null,Bt=null,ut=null,Ce=null,Yt=null,nr=null}}}let s=new t,o=new n,a=new r,l=new WeakMap,c=new WeakMap,u={},f={},d={},A=new WeakMap,y=[],w=null,S=!1,T=null,R=null,I=null,P=null,F=null,D=null,L=null,C=new zt(0,0,0),B=0,k=!1,z=null,G=null,W=null,Y=null,H=null,$=i.getParameter(i.MAX_COMBINED_TEXTURE_IMAGE_UNITS),J=!1,te=0,ce=i.getParameter(i.VERSION);ce.indexOf("WebGL")!==-1?(te=parseFloat(/^WebGL (\d)/.exec(ce)[1]),J=te>=1):ce.indexOf("OpenGL ES")!==-1&&(te=parseFloat(/^OpenGL ES (\d)/.exec(ce)[1]),J=te>=2);let he=null,ve={},Re=i.getParameter(i.SCISSOR_BOX),Qe=i.getParameter(i.VIEWPORT),Fe=new xn().fromArray(Re),mt=new xn().fromArray(Qe);function Ee(ye,wt,Ze,St){let Bt=new Uint8Array(4),ut=i.createTexture();i.bindTexture(ye,ut),i.texParameteri(ye,i.TEXTURE_MIN_FILTER,i.NEAREST),i.texParameteri(ye,i.TEXTURE_MAG_FILTER,i.NEAREST);for(let Ce=0;Ce<Ze;Ce++)ye===i.TEXTURE_3D||ye===i.TEXTURE_2D_ARRAY?i.texImage3D(wt,0,i.RGBA,1,1,St,0,i.RGBA,i.UNSIGNED_BYTE,Bt):i.texImage2D(wt+Ce,0,i.RGBA,1,1,0,i.RGBA,i.UNSIGNED_BYTE,Bt);return ut}let Ve={};Ve[i.TEXTURE_2D]=Ee(i.TEXTURE_2D,i.TEXTURE_2D,1),Ve[i.TEXTURE_CUBE_MAP]=Ee(i.TEXTURE_CUBE_MAP,i.TEXTURE_CUBE_MAP_POSITIVE_X,6),Ve[i.TEXTURE_2D_ARRAY]=Ee(i.TEXTURE_2D_ARRAY,i.TEXTURE_2D_ARRAY,1,1),Ve[i.TEXTURE_3D]=Ee(i.TEXTURE_3D,i.TEXTURE_3D,1,1),s.setClear(0,0,0,1),o.setClear(1),a.setClear(0),Ye(i.DEPTH_TEST),o.setFunc(Ch),bt(!1),yt(hb),Ye(i.CULL_FACE),ot(ps);function Ye(ye){u[ye]!==!0&&(i.enable(ye),u[ye]=!0)}function Mt(ye){u[ye]!==!1&&(i.disable(ye),u[ye]=!1)}function Et(ye,wt){return d[ye]!==wt?(i.bindFramebuffer(ye,wt),d[ye]=wt,ye===i.DRAW_FRAMEBUFFER&&(d[i.FRAMEBUFFER]=wt),ye===i.FRAMEBUFFER&&(d[i.DRAW_FRAMEBUFFER]=wt),!0):!1}function Pt(ye,wt){let Ze=y,St=!1;if(ye){Ze=A.get(wt),Ze===void 0&&(Ze=[],A.set(wt,Ze));let Bt=ye.textures;if(Ze.length!==Bt.length||Ze[0]!==i.COLOR_ATTACHMENT0){for(let ut=0,Ce=Bt.length;ut<Ce;ut++)Ze[ut]=i.COLOR_ATTACHMENT0+ut;Ze.length=Bt.length,St=!0}}else Ze[0]!==i.BACK&&(Ze[0]=i.BACK,St=!0);St&&i.drawBuffers(Ze)}function dn(ye){return w!==ye?(i.useProgram(ye),w=ye,!0):!1}let Gt={[oo]:i.FUNC_ADD,[db]:i.FUNC_SUBTRACT,[pb]:i.FUNC_REVERSE_SUBTRACT};Gt[NM]=i.MIN,Gt[FM]=i.MAX;let $e={[Nu]:i.ZERO,[mb]:i.ONE,[Ab]:i.SRC_COLOR,[Jp]:i.SRC_ALPHA,[bb]:i.SRC_ALPHA_SATURATE,[xb]:i.DST_COLOR,[vb]:i.DST_ALPHA,[gb]:i.ONE_MINUS_SRC_COLOR,[e0]:i.ONE_MINUS_SRC_ALPHA,[yb]:i.ONE_MINUS_DST_COLOR,[_b]:i.ONE_MINUS_DST_ALPHA,[bZ]:i.CONSTANT_COLOR,[wZ]:i.ONE_MINUS_CONSTANT_COLOR,[SZ]:i.CONSTANT_ALPHA,[TZ]:i.ONE_MINUS_CONSTANT_ALPHA};function ot(ye,wt,Ze,St,Bt,ut,Ce,Yt,nr,Fn){if(ye===ps){S===!0&&(Mt(i.BLEND),S=!1);return}if(S===!1&&(Ye(i.BLEND),S=!0),ye!==Dd){if(ye!==T||Fn!==k){if((R!==oo||F!==oo)&&(i.blendEquation(i.FUNC_ADD),R=oo,F=oo),Fn)switch(ye){case Ts:i.blendFuncSeparate(i.ONE,i.ONE_MINUS_SRC_ALPHA,i.ONE,i.ONE_MINUS_SRC_ALPHA);break;case Dh:i.blendFunc(i.ONE,i.ONE);break;case Nh:i.blendFuncSeparate(i.ZERO,i.ONE_MINUS_SRC_COLOR,i.ZERO,i.ONE);break;case Fh:i.blendFuncSeparate(i.DST_COLOR,i.ONE_MINUS_SRC_ALPHA,i.ZERO,i.ONE);break;default:ze("WebGLState: Invalid blending: ",ye);break}else switch(ye){case Ts:i.blendFuncSeparate(i.SRC_ALPHA,i.ONE_MINUS_SRC_ALPHA,i.ONE,i.ONE_MINUS_SRC_ALPHA);break;case Dh:i.blendFuncSeparate(i.SRC_ALPHA,i.ONE,i.ONE,i.ONE);break;case Nh:ze("WebGLState: SubtractiveBlending requires material.premultipliedAlpha = true");break;case Fh:ze("WebGLState: MultiplyBlending requires material.premultipliedAlpha = true");break;default:ze("WebGLState: Invalid blending: ",ye);break}I=null,P=null,D=null,L=null,C.set(0,0,0),B=0,T=ye,k=Fn}return}Bt=Bt||wt,ut=ut||Ze,Ce=Ce||St,(wt!==R||Bt!==F)&&(i.blendEquationSeparate(Gt[wt],Gt[Bt]),R=wt,F=Bt),(Ze!==I||St!==P||ut!==D||Ce!==L)&&(i.blendFuncSeparate($e[Ze],$e[St],$e[ut],$e[Ce]),I=Ze,P=St,D=ut,L=Ce),(Yt.equals(C)===!1||nr!==B)&&(i.blendColor(Yt.r,Yt.g,Yt.b,nr),C.copy(Yt),B=nr),T=ye,k=!1}function nt(ye,wt){ye.side===vr?Mt(i.CULL_FACE):Ye(i.CULL_FACE);let Ze=ye.side===mi;wt&&(Ze=!Ze),bt(Ze),ye.blending===Ts&&ye.transparent===!1?ot(ps):ot(ye.blending,ye.blendEquation,ye.blendSrc,ye.blendDst,ye.blendEquationAlpha,ye.blendSrcAlpha,ye.blendDstAlpha,ye.blendColor,ye.blendAlpha,ye.premultipliedAlpha),o.setFunc(ye.depthFunc),o.setTest(ye.depthTest),o.setMask(ye.depthWrite),s.setMask(ye.colorWrite);let St=ye.stencilWrite;a.setTest(St),St&&(a.setMask(ye.stencilWriteMask),a.setFunc(ye.stencilFunc,ye.stencilRef,ye.stencilFuncMask),a.setOp(ye.stencilFail,ye.stencilZFail,ye.stencilZPass)),en(ye.polygonOffset,ye.polygonOffsetFactor,ye.polygonOffsetUnits),ye.alphaToCoverage===!0?Ye(i.SAMPLE_ALPHA_TO_COVERAGE):Mt(i.SAMPLE_ALPHA_TO_COVERAGE)}function bt(ye){z!==ye&&(ye?i.frontFace(i.CW):i.frontFace(i.CCW),z=ye)}function yt(ye){ye!==IM?(Ye(i.CULL_FACE),ye!==G&&(ye===hb?i.cullFace(i.BACK):ye===LM?i.cullFace(i.FRONT):i.cullFace(i.FRONT_AND_BACK))):Mt(i.CULL_FACE),G=ye}function hn(ye){ye!==W&&(J&&i.lineWidth(ye),W=ye)}function en(ye,wt,Ze){ye?(Ye(i.POLYGON_OFFSET_FILL),(Y!==wt||H!==Ze)&&(Y=wt,H=Ze,o.getReversed()&&(wt=-wt),i.polygonOffset(wt,Ze))):Mt(i.POLYGON_OFFSET_FILL)}function tn(ye){ye?Ye(i.SCISSOR_TEST):Mt(i.SCISSOR_TEST)}function bn(ye){ye===void 0&&(ye=i.TEXTURE0+$-1),he!==ye&&(i.activeTexture(ye),he=ye)}function _e(ye,wt,Ze){Ze===void 0&&(he===null?Ze=i.TEXTURE0+$-1:Ze=he);let St=ve[Ze];St===void 0&&(St={type:void 0,texture:void 0},ve[Ze]=St),(St.type!==ye||St.texture!==wt)&&(he!==Ze&&(i.activeTexture(Ze),he=Ze),i.bindTexture(ye,wt||Ve[ye]),St.type=ye,St.texture=wt)}function vi(){let ye=ve[he];ye!==void 0&&ye.type!==void 0&&(i.bindTexture(ye.type,null),ye.type=void 0,ye.texture=void 0)}function zn(){try{i.compressedTexImage2D(...arguments)}catch(ye){ze("WebGLState:",ye)}}function le(){try{i.compressedTexImage3D(...arguments)}catch(ye){ze("WebGLState:",ye)}}function Z(){try{i.texSubImage2D(...arguments)}catch(ye){ze("WebGLState:",ye)}}function Te(){try{i.texSubImage3D(...arguments)}catch(ye){ze("WebGLState:",ye)}}function Ie(){try{i.compressedTexSubImage2D(...arguments)}catch(ye){ze("WebGLState:",ye)}}function Ge(){try{i.compressedTexSubImage3D(...arguments)}catch(ye){ze("WebGLState:",ye)}}function vt(){try{i.texStorage2D(...arguments)}catch(ye){ze("WebGLState:",ye)}}function Tt(){try{i.texStorage3D(...arguments)}catch(ye){ze("WebGLState:",ye)}}function qe(){try{i.texImage2D(...arguments)}catch(ye){ze("WebGLState:",ye)}}function Je(){try{i.texImage3D(...arguments)}catch(ye){ze("WebGLState:",ye)}}function It(ye){return f[ye]!==void 0?f[ye]:i.getParameter(ye)}function rn(ye,wt){f[ye]!==wt&&(i.pixelStorei(ye,wt),f[ye]=wt)}function Lt(ye){Fe.equals(ye)===!1&&(i.scissor(ye.x,ye.y,ye.z,ye.w),Fe.copy(ye))}function Rt(ye){mt.equals(ye)===!1&&(i.viewport(ye.x,ye.y,ye.z,ye.w),mt.copy(ye))}function fn(ye,wt){let Ze=c.get(wt);Ze===void 0&&(Ze=new WeakMap,c.set(wt,Ze));let St=Ze.get(ye);St===void 0&&(St=i.getUniformBlockIndex(wt,ye.name),Ze.set(ye,St))}function wn(ye,wt){let St=c.get(wt).get(ye);l.get(wt)!==St&&(i.uniformBlockBinding(wt,St,ye.__bindingPointIndex),l.set(wt,St))}function Dn(){i.disable(i.BLEND),i.disable(i.CULL_FACE),i.disable(i.DEPTH_TEST),i.disable(i.POLYGON_OFFSET_FILL),i.disable(i.SCISSOR_TEST),i.disable(i.STENCIL_TEST),i.disable(i.SAMPLE_ALPHA_TO_COVERAGE),i.blendEquation(i.FUNC_ADD),i.blendFunc(i.ONE,i.ZERO),i.blendFuncSeparate(i.ONE,i.ZERO,i.ONE,i.ZERO),i.blendColor(0,0,0,0),i.colorMask(!0,!0,!0,!0),i.clearColor(0,0,0,0),i.depthMask(!0),i.depthFunc(i.LESS),o.setReversed(!1),i.clearDepth(1),i.stencilMask(4294967295),i.stencilFunc(i.ALWAYS,0,4294967295),i.stencilOp(i.KEEP,i.KEEP,i.KEEP),i.clearStencil(0),i.cullFace(i.BACK),i.frontFace(i.CCW),i.polygonOffset(0,0),i.activeTexture(i.TEXTURE0),i.bindFramebuffer(i.FRAMEBUFFER,null),i.bindFramebuffer(i.DRAW_FRAMEBUFFER,null),i.bindFramebuffer(i.READ_FRAMEBUFFER,null),i.useProgram(null),i.lineWidth(1),i.scissor(0,0,i.canvas.width,i.canvas.height),i.viewport(0,0,i.canvas.width,i.canvas.height),i.pixelStorei(i.PACK_ALIGNMENT,4),i.pixelStorei(i.UNPACK_ALIGNMENT,4),i.pixelStorei(i.UNPACK_FLIP_Y_WEBGL,!1),i.pixelStorei(i.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1),i.pixelStorei(i.UNPACK_COLORSPACE_CONVERSION_WEBGL,i.BROWSER_DEFAULT_WEBGL),i.pixelStorei(i.PACK_ROW_LENGTH,0),i.pixelStorei(i.PACK_SKIP_PIXELS,0),i.pixelStorei(i.PACK_SKIP_ROWS,0),i.pixelStorei(i.UNPACK_ROW_LENGTH,0),i.pixelStorei(i.UNPACK_IMAGE_HEIGHT,0),i.pixelStorei(i.UNPACK_SKIP_PIXELS,0),i.pixelStorei(i.UNPACK_SKIP_ROWS,0),i.pixelStorei(i.UNPACK_SKIP_IMAGES,0),u={},f={},he=null,ve={},d={},A=new WeakMap,y=[],w=null,S=!1,T=null,R=null,I=null,P=null,F=null,D=null,L=null,C=new zt(0,0,0),B=0,k=!1,z=null,G=null,W=null,Y=null,H=null,Fe.set(0,0,i.canvas.width,i.canvas.height),mt.set(0,0,i.canvas.width,i.canvas.height),s.reset(),o.reset(),a.reset()}return{buffers:{color:s,depth:o,stencil:a},enable:Ye,disable:Mt,bindFramebuffer:Et,drawBuffers:Pt,useProgram:dn,setBlending:ot,setMaterial:nt,setFlipSided:bt,setCullFace:yt,setLineWidth:hn,setPolygonOffset:en,setScissorTest:tn,activeTexture:bn,bindTexture:_e,unbindTexture:vi,compressedTexImage2D:zn,compressedTexImage3D:le,texImage2D:qe,texImage3D:Je,pixelStorei:rn,getParameter:It,updateUBOMapping:fn,uniformBlockBinding:wn,texStorage2D:vt,texStorage3D:Tt,texSubImage2D:Z,texSubImage3D:Te,compressedTexSubImage2D:Ie,compressedTexSubImage3D:Ge,scissor:Lt,viewport:Rt,reset:Dn}}function Gxe(i,e,t,n,r,s,o){let a=e.has("WEBGL_multisampled_render_to_texture")?e.get("WEBGL_multisampled_render_to_texture"):null,l=typeof navigator>"u"?!1:/OculusBrowser/g.test(navigator.userAgent),c=new Oe,u=new WeakMap,f=new Set,d,A=new WeakMap,y=!1;try{y=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch{}function w(le,Z){return y?new OffscreenCanvas(le,Z):$v("canvas")}function S(le,Z,Te){let Ie=1,Ge=zn(le);if((Ge.width>Te||Ge.height>Te)&&(Ie=Te/Math.max(Ge.width,Ge.height)),Ie<1)if(typeof HTMLImageElement<"u"&&le instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&le instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&le instanceof ImageBitmap||typeof VideoFrame<"u"&&le instanceof VideoFrame){let vt=Math.floor(Ie*Ge.width),Tt=Math.floor(Ie*Ge.height);d===void 0&&(d=w(vt,Tt));let qe=Z?w(vt,Tt):d;return qe.width=vt,qe.height=Tt,qe.getContext("2d").drawImage(le,0,0,vt,Tt),Xe("WebGLRenderer: Texture has been resized from ("+Ge.width+"x"+Ge.height+") to ("+vt+"x"+Tt+")."),qe}else return"data"in le&&Xe("WebGLRenderer: Image in DataTexture is too big ("+Ge.width+"x"+Ge.height+")."),le;return le}function T(le){return le.generateMipmaps}function R(le){i.generateMipmap(le)}function I(le){return le.isWebGLCubeRenderTarget?i.TEXTURE_CUBE_MAP:le.isWebGL3DRenderTarget?i.TEXTURE_3D:le.isWebGLArrayRenderTarget||le.isCompressedArrayTexture?i.TEXTURE_2D_ARRAY:i.TEXTURE_2D}function P(le,Z,Te,Ie,Ge,vt=!1){if(le!==null){if(i[le]!==void 0)return i[le];Xe("WebGLRenderer: Attempt to use non-existing WebGL internal format '"+le+"'")}let Tt;Ie&&(Tt=e.get("EXT_texture_norm16"),Tt||Xe("WebGLRenderer: Unable to use normalized textures without EXT_texture_norm16 extension"));let qe=Z;if(Z===i.RED&&(Te===i.FLOAT&&(qe=i.R32F),Te===i.HALF_FLOAT&&(qe=i.R16F),Te===i.UNSIGNED_BYTE&&(qe=i.R8),Te===i.UNSIGNED_SHORT&&Tt&&(qe=Tt.R16_EXT),Te===i.SHORT&&Tt&&(qe=Tt.R16_SNORM_EXT)),Z===i.RED_INTEGER&&(Te===i.UNSIGNED_BYTE&&(qe=i.R8UI),Te===i.UNSIGNED_SHORT&&(qe=i.R16UI),Te===i.UNSIGNED_INT&&(qe=i.R32UI),Te===i.BYTE&&(qe=i.R8I),Te===i.SHORT&&(qe=i.R16I),Te===i.INT&&(qe=i.R32I)),Z===i.RG&&(Te===i.FLOAT&&(qe=i.RG32F),Te===i.HALF_FLOAT&&(qe=i.RG16F),Te===i.UNSIGNED_BYTE&&(qe=i.RG8),Te===i.UNSIGNED_SHORT&&Tt&&(qe=Tt.RG16_EXT),Te===i.SHORT&&Tt&&(qe=Tt.RG16_SNORM_EXT)),Z===i.RG_INTEGER&&(Te===i.UNSIGNED_BYTE&&(qe=i.RG8UI),Te===i.UNSIGNED_SHORT&&(qe=i.RG16UI),Te===i.UNSIGNED_INT&&(qe=i.RG32UI),Te===i.BYTE&&(qe=i.RG8I),Te===i.SHORT&&(qe=i.RG16I),Te===i.INT&&(qe=i.RG32I)),Z===i.RGB_INTEGER&&(Te===i.UNSIGNED_BYTE&&(qe=i.RGB8UI),Te===i.UNSIGNED_SHORT&&(qe=i.RGB16UI),Te===i.UNSIGNED_INT&&(qe=i.RGB32UI),Te===i.BYTE&&(qe=i.RGB8I),Te===i.SHORT&&(qe=i.RGB16I),Te===i.INT&&(qe=i.RGB32I)),Z===i.RGBA_INTEGER&&(Te===i.UNSIGNED_BYTE&&(qe=i.RGBA8UI),Te===i.UNSIGNED_SHORT&&(qe=i.RGBA16UI),Te===i.UNSIGNED_INT&&(qe=i.RGBA32UI),Te===i.BYTE&&(qe=i.RGBA8I),Te===i.SHORT&&(qe=i.RGBA16I),Te===i.INT&&(qe=i.RGBA32I)),Z===i.RGB&&(Te===i.UNSIGNED_SHORT&&Tt&&(qe=Tt.RGB16_EXT),Te===i.SHORT&&Tt&&(qe=Tt.RGB16_SNORM_EXT),Te===i.UNSIGNED_INT_5_9_9_9_REV&&(qe=i.RGB9_E5),Te===i.UNSIGNED_INT_10F_11F_11F_REV&&(qe=i.R11F_G11F_B10F)),Z===i.RGBA){let Je=vt?n0:ln.getTransfer(Ge);Te===i.FLOAT&&(qe=i.RGBA32F),Te===i.HALF_FLOAT&&(qe=i.RGBA16F),Te===i.UNSIGNED_BYTE&&(qe=Je===kt?i.SRGB8_ALPHA8:i.RGBA8),Te===i.UNSIGNED_SHORT&&Tt&&(qe=Tt.RGBA16_EXT),Te===i.SHORT&&Tt&&(qe=Tt.RGBA16_SNORM_EXT),Te===i.UNSIGNED_SHORT_4_4_4_4&&(qe=i.RGBA4),Te===i.UNSIGNED_SHORT_5_5_5_1&&(qe=i.RGB5_A1)}return(qe===i.R16F||qe===i.R32F||qe===i.RG16F||qe===i.RG32F||qe===i.RGBA16F||qe===i.RGBA32F)&&e.get("EXT_color_buffer_float"),qe}function F(le,Z){let Te;return le?Z===null||Z===xi||Z===ua?Te=i.DEPTH24_STENCIL8:Z===cr?Te=i.DEPTH32F_STENCIL8:Z===wl&&(Te=i.DEPTH24_STENCIL8,Xe("DepthTexture: 16 bit depth attachment is not supported with stencil. Using 24-bit attachment.")):Z===null||Z===xi||Z===ua?Te=i.DEPTH_COMPONENT24:Z===cr?Te=i.DEPTH_COMPONENT32F:Z===wl&&(Te=i.DEPTH_COMPONENT16),Te}function D(le,Z){return T(le)===!0||le.isFramebufferTexture&&le.minFilter!==Ti&&le.minFilter!==Mi?Math.log2(Math.max(Z.width,Z.height))+1:le.mipmaps!==void 0&&le.mipmaps.length>0?le.mipmaps.length:le.isCompressedTexture&&Array.isArray(le.image)?Z.mipmaps.length:1}function L(le){let Z=le.target;Z.removeEventListener("dispose",L),B(Z),Z.isVideoTexture&&u.delete(Z),Z.isHTMLTexture&&f.delete(Z)}function C(le){let Z=le.target;Z.removeEventListener("dispose",C),z(Z)}function B(le){let Z=n.get(le);if(Z.__webglInit===void 0)return;let Te=le.source,Ie=A.get(Te);if(Ie){let Ge=Ie[Z.__cacheKey];Ge.usedTimes--,Ge.usedTimes===0&&k(le),Object.keys(Ie).length===0&&A.delete(Te)}n.remove(le)}function k(le){let Z=n.get(le);i.deleteTexture(Z.__webglTexture);let Te=le.source,Ie=A.get(Te);delete Ie[Z.__cacheKey],o.memory.textures--}function z(le){let Z=n.get(le);if(le.depthTexture&&(le.depthTexture.dispose(),n.remove(le.depthTexture)),le.isWebGLCubeRenderTarget)for(let Ie=0;Ie<6;Ie++){if(Array.isArray(Z.__webglFramebuffer[Ie]))for(let Ge=0;Ge<Z.__webglFramebuffer[Ie].length;Ge++)i.deleteFramebuffer(Z.__webglFramebuffer[Ie][Ge]);else i.deleteFramebuffer(Z.__webglFramebuffer[Ie]);Z.__webglDepthbuffer&&i.deleteRenderbuffer(Z.__webglDepthbuffer[Ie])}else{if(Array.isArray(Z.__webglFramebuffer))for(let Ie=0;Ie<Z.__webglFramebuffer.length;Ie++)i.deleteFramebuffer(Z.__webglFramebuffer[Ie]);else i.deleteFramebuffer(Z.__webglFramebuffer);if(Z.__webglDepthbuffer&&i.deleteRenderbuffer(Z.__webglDepthbuffer),Z.__webglMultisampledFramebuffer&&i.deleteFramebuffer(Z.__webglMultisampledFramebuffer),Z.__webglColorRenderbuffer)for(let Ie=0;Ie<Z.__webglColorRenderbuffer.length;Ie++)Z.__webglColorRenderbuffer[Ie]&&i.deleteRenderbuffer(Z.__webglColorRenderbuffer[Ie]);Z.__webglDepthRenderbuffer&&i.deleteRenderbuffer(Z.__webglDepthRenderbuffer)}let Te=le.textures;for(let Ie=0,Ge=Te.length;Ie<Ge;Ie++){let vt=n.get(Te[Ie]);vt.__webglTexture&&(i.deleteTexture(vt.__webglTexture),o.memory.textures--),n.remove(Te[Ie])}n.remove(le)}let G=0;function W(){G=0}function Y(){return G}function H(le){G=le}function $(){let le=G;return le>=r.maxTextures&&Xe("WebGLTextures: Trying to use "+le+" texture units while this GPU supports only "+r.maxTextures),G+=1,le}function J(le){let Z=[];return Z.push(le.wrapS),Z.push(le.wrapT),Z.push(le.wrapR||0),Z.push(le.magFilter),Z.push(le.minFilter),Z.push(le.anisotropy),Z.push(le.internalFormat),Z.push(le.format),Z.push(le.type),Z.push(le.generateMipmaps),Z.push(le.premultiplyAlpha),Z.push(le.flipY),Z.push(le.unpackAlignment),Z.push(le.colorSpace),Z.join()}function te(le,Z){let Te=n.get(le);if(le.isVideoTexture&&_e(le),le.isRenderTargetTexture===!1&&le.isExternalTexture!==!0&&le.version>0&&Te.__version!==le.version){let Ie=le.image;if(Ie===null)Xe("WebGLRenderer: Texture marked for update but no image data found.");else if(Ie.complete===!1)Xe("WebGLRenderer: Texture marked for update but image is incomplete");else{Mt(Te,le,Z);return}}else le.isExternalTexture&&(Te.__webglTexture=le.sourceTexture?le.sourceTexture:null);t.bindTexture(i.TEXTURE_2D,Te.__webglTexture,i.TEXTURE0+Z)}function ce(le,Z){let Te=n.get(le);if(le.isRenderTargetTexture===!1&&le.version>0&&Te.__version!==le.version){Mt(Te,le,Z);return}else le.isExternalTexture&&(Te.__webglTexture=le.sourceTexture?le.sourceTexture:null);t.bindTexture(i.TEXTURE_2D_ARRAY,Te.__webglTexture,i.TEXTURE0+Z)}function he(le,Z){let Te=n.get(le);if(le.isRenderTargetTexture===!1&&le.version>0&&Te.__version!==le.version){Mt(Te,le,Z);return}t.bindTexture(i.TEXTURE_3D,Te.__webglTexture,i.TEXTURE0+Z)}function ve(le,Z){let Te=n.get(le);if(le.isCubeDepthTexture!==!0&&le.version>0&&Te.__version!==le.version){Et(Te,le,Z);return}t.bindTexture(i.TEXTURE_CUBE_MAP,Te.__webglTexture,i.TEXTURE0+Z)}let Re={[Ed]:i.REPEAT,[la]:i.CLAMP_TO_EDGE,[Md]:i.MIRRORED_REPEAT},Qe={[Ti]:i.NEAREST,[Pb]:i.NEAREST_MIPMAP_NEAREST,[qc]:i.NEAREST_MIPMAP_LINEAR,[Mi]:i.LINEAR,[A0]:i.LINEAR_MIPMAP_NEAREST,[Go]:i.LINEAR_MIPMAP_LINEAR},Fe={[Db]:i.NEVER,[Bb]:i.ALWAYS,[h_]:i.LESS,[Xh]:i.LEQUAL,[Nb]:i.EQUAL,[Fu]:i.GEQUAL,[ug]:i.GREATER,[Fb]:i.NOTEQUAL};function mt(le,Z){if(Z.type===cr&&e.has("OES_texture_float_linear")===!1&&(Z.magFilter===Mi||Z.magFilter===A0||Z.magFilter===qc||Z.magFilter===Go||Z.minFilter===Mi||Z.minFilter===A0||Z.minFilter===qc||Z.minFilter===Go)&&Xe("WebGLRenderer: Unable to use linear filtering with floating point textures. OES_texture_float_linear not supported on this device."),i.texParameteri(le,i.TEXTURE_WRAP_S,Re[Z.wrapS]),i.texParameteri(le,i.TEXTURE_WRAP_T,Re[Z.wrapT]),(le===i.TEXTURE_3D||le===i.TEXTURE_2D_ARRAY)&&i.texParameteri(le,i.TEXTURE_WRAP_R,Re[Z.wrapR]),i.texParameteri(le,i.TEXTURE_MAG_FILTER,Qe[Z.magFilter]),i.texParameteri(le,i.TEXTURE_MIN_FILTER,Qe[Z.minFilter]),Z.compareFunction&&(i.texParameteri(le,i.TEXTURE_COMPARE_MODE,i.COMPARE_REF_TO_TEXTURE),i.texParameteri(le,i.TEXTURE_COMPARE_FUNC,Fe[Z.compareFunction])),e.has("EXT_texture_filter_anisotropic")===!0){if(Z.magFilter===Ti||Z.minFilter!==qc&&Z.minFilter!==Go||Z.type===cr&&e.has("OES_texture_float_linear")===!1)return;if(Z.anisotropy>1||n.get(Z).__currentAnisotropy){let Te=e.get("EXT_texture_filter_anisotropic");i.texParameterf(le,Te.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(Z.anisotropy,r.getMaxAnisotropy())),n.get(Z).__currentAnisotropy=Z.anisotropy}}}function Ee(le,Z){let Te=!1;le.__webglInit===void 0&&(le.__webglInit=!0,Z.addEventListener("dispose",L));let Ie=Z.source,Ge=A.get(Ie);Ge===void 0&&(Ge={},A.set(Ie,Ge));let vt=J(Z);if(vt!==le.__cacheKey){Ge[vt]===void 0&&(Ge[vt]={texture:i.createTexture(),usedTimes:0},o.memory.textures++,Te=!0),Ge[vt].usedTimes++;let Tt=Ge[le.__cacheKey];Tt!==void 0&&(Ge[le.__cacheKey].usedTimes--,Tt.usedTimes===0&&k(Z)),le.__cacheKey=vt,le.__webglTexture=Ge[vt].texture}return Te}function Ve(le,Z,Te){return Math.floor(Math.floor(le/Te)/Z)}function Ye(le,Z,Te,Ie){let vt=le.updateRanges;if(vt.length===0)t.texSubImage2D(i.TEXTURE_2D,0,0,0,Z.width,Z.height,Te,Ie,Z.data);else{vt.sort((rn,Lt)=>rn.start-Lt.start);let Tt=0;for(let rn=1;rn<vt.length;rn++){let Lt=vt[Tt],Rt=vt[rn],fn=Lt.start+Lt.count,wn=Ve(Rt.start,Z.width,4),Dn=Ve(Lt.start,Z.width,4);Rt.start<=fn+1&&wn===Dn&&Ve(Rt.start+Rt.count-1,Z.width,4)===wn?Lt.count=Math.max(Lt.count,Rt.start+Rt.count-Lt.start):(++Tt,vt[Tt]=Rt)}vt.length=Tt+1;let qe=t.getParameter(i.UNPACK_ROW_LENGTH),Je=t.getParameter(i.UNPACK_SKIP_PIXELS),It=t.getParameter(i.UNPACK_SKIP_ROWS);t.pixelStorei(i.UNPACK_ROW_LENGTH,Z.width);for(let rn=0,Lt=vt.length;rn<Lt;rn++){let Rt=vt[rn],fn=Math.floor(Rt.start/4),wn=Math.ceil(Rt.count/4),Dn=fn%Z.width,ye=Math.floor(fn/Z.width),wt=wn,Ze=1;t.pixelStorei(i.UNPACK_SKIP_PIXELS,Dn),t.pixelStorei(i.UNPACK_SKIP_ROWS,ye),t.texSubImage2D(i.TEXTURE_2D,0,Dn,ye,wt,Ze,Te,Ie,Z.data)}le.clearUpdateRanges(),t.pixelStorei(i.UNPACK_ROW_LENGTH,qe),t.pixelStorei(i.UNPACK_SKIP_PIXELS,Je),t.pixelStorei(i.UNPACK_SKIP_ROWS,It)}}function Mt(le,Z,Te){let Ie=i.TEXTURE_2D;(Z.isDataArrayTexture||Z.isCompressedArrayTexture)&&(Ie=i.TEXTURE_2D_ARRAY),Z.isData3DTexture&&(Ie=i.TEXTURE_3D);let Ge=Ee(le,Z),vt=Z.source;t.bindTexture(Ie,le.__webglTexture,i.TEXTURE0+Te);let Tt=n.get(vt);if(vt.version!==Tt.__version||Ge===!0){if(t.activeTexture(i.TEXTURE0+Te),(typeof ImageBitmap<"u"&&Z.image instanceof ImageBitmap)===!1){let Ze=ln.getPrimaries(ln.workingColorSpace),St=Z.colorSpace===ha?null:ln.getPrimaries(Z.colorSpace),Bt=Z.colorSpace===ha||Ze===St?i.NONE:i.BROWSER_DEFAULT_WEBGL;t.pixelStorei(i.UNPACK_FLIP_Y_WEBGL,Z.flipY),t.pixelStorei(i.UNPACK_PREMULTIPLY_ALPHA_WEBGL,Z.premultiplyAlpha),t.pixelStorei(i.UNPACK_COLORSPACE_CONVERSION_WEBGL,Bt)}t.pixelStorei(i.UNPACK_ALIGNMENT,Z.unpackAlignment);let Je=S(Z.image,!1,r.maxTextureSize);Je=vi(Z,Je);let It=s.convert(Z.format,Z.colorSpace),rn=s.convert(Z.type),Lt=P(Z.internalFormat,It,rn,Z.normalized,Z.colorSpace,Z.isVideoTexture);mt(Ie,Z);let Rt,fn=Z.mipmaps,wn=Z.isVideoTexture!==!0,Dn=Tt.__version===void 0||Ge===!0,ye=vt.dataReady,wt=D(Z,Je);if(Z.isDepthTexture)Lt=F(Z.format===xo,Z.type),Dn&&(wn?t.texStorage2D(i.TEXTURE_2D,1,Lt,Je.width,Je.height):t.texImage2D(i.TEXTURE_2D,0,Lt,Je.width,Je.height,0,It,rn,null));else if(Z.isDataTexture)if(fn.length>0){wn&&Dn&&t.texStorage2D(i.TEXTURE_2D,wt,Lt,fn[0].width,fn[0].height);for(let Ze=0,St=fn.length;Ze<St;Ze++)Rt=fn[Ze],wn?ye&&t.texSubImage2D(i.TEXTURE_2D,Ze,0,0,Rt.width,Rt.height,It,rn,Rt.data):t.texImage2D(i.TEXTURE_2D,Ze,Lt,Rt.width,Rt.height,0,It,rn,Rt.data);Z.generateMipmaps=!1}else wn?(Dn&&t.texStorage2D(i.TEXTURE_2D,wt,Lt,Je.width,Je.height),ye&&Ye(Z,Je,It,rn)):t.texImage2D(i.TEXTURE_2D,0,Lt,Je.width,Je.height,0,It,rn,Je.data);else if(Z.isCompressedTexture)if(Z.isCompressedArrayTexture){wn&&Dn&&t.texStorage3D(i.TEXTURE_2D_ARRAY,wt,Lt,fn[0].width,fn[0].height,Je.depth);for(let Ze=0,St=fn.length;Ze<St;Ze++)if(Rt=fn[Ze],Z.format!==Or)if(It!==null)if(wn){if(ye)if(Z.layerUpdates.size>0){let Bt=Ub(Rt.width,Rt.height,Z.format,Z.type);for(let ut of Z.layerUpdates){let Ce=Rt.data.subarray(ut*Bt/Rt.data.BYTES_PER_ELEMENT,(ut+1)*Bt/Rt.data.BYTES_PER_ELEMENT);t.compressedTexSubImage3D(i.TEXTURE_2D_ARRAY,Ze,0,0,ut,Rt.width,Rt.height,1,It,Ce)}Z.clearLayerUpdates()}else t.compressedTexSubImage3D(i.TEXTURE_2D_ARRAY,Ze,0,0,0,Rt.width,Rt.height,Je.depth,It,Rt.data)}else t.compressedTexImage3D(i.TEXTURE_2D_ARRAY,Ze,Lt,Rt.width,Rt.height,Je.depth,0,Rt.data,0,0);else Xe("WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()");else wn?ye&&t.texSubImage3D(i.TEXTURE_2D_ARRAY,Ze,0,0,0,Rt.width,Rt.height,Je.depth,It,rn,Rt.data):t.texImage3D(i.TEXTURE_2D_ARRAY,Ze,Lt,Rt.width,Rt.height,Je.depth,0,It,rn,Rt.data)}else{wn&&Dn&&t.texStorage2D(i.TEXTURE_2D,wt,Lt,fn[0].width,fn[0].height);for(let Ze=0,St=fn.length;Ze<St;Ze++)Rt=fn[Ze],Z.format!==Or?It!==null?wn?ye&&t.compressedTexSubImage2D(i.TEXTURE_2D,Ze,0,0,Rt.width,Rt.height,It,Rt.data):t.compressedTexImage2D(i.TEXTURE_2D,Ze,Lt,Rt.width,Rt.height,0,Rt.data):Xe("WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):wn?ye&&t.texSubImage2D(i.TEXTURE_2D,Ze,0,0,Rt.width,Rt.height,It,rn,Rt.data):t.texImage2D(i.TEXTURE_2D,Ze,Lt,Rt.width,Rt.height,0,It,rn,Rt.data)}else if(Z.isDataArrayTexture)if(wn){if(Dn&&t.texStorage3D(i.TEXTURE_2D_ARRAY,wt,Lt,Je.width,Je.height,Je.depth),ye)if(Z.layerUpdates.size>0){let Ze=Ub(Je.width,Je.height,Z.format,Z.type);for(let St of Z.layerUpdates){let Bt=Je.data.subarray(St*Ze/Je.data.BYTES_PER_ELEMENT,(St+1)*Ze/Je.data.BYTES_PER_ELEMENT);t.texSubImage3D(i.TEXTURE_2D_ARRAY,0,0,0,St,Je.width,Je.height,1,It,rn,Bt)}Z.clearLayerUpdates()}else t.texSubImage3D(i.TEXTURE_2D_ARRAY,0,0,0,0,Je.width,Je.height,Je.depth,It,rn,Je.data)}else t.texImage3D(i.TEXTURE_2D_ARRAY,0,Lt,Je.width,Je.height,Je.depth,0,It,rn,Je.data);else if(Z.isData3DTexture)wn?(Dn&&t.texStorage3D(i.TEXTURE_3D,wt,Lt,Je.width,Je.height,Je.depth),ye&&t.texSubImage3D(i.TEXTURE_3D,0,0,0,0,Je.width,Je.height,Je.depth,It,rn,Je.data)):t.texImage3D(i.TEXTURE_3D,0,Lt,Je.width,Je.height,Je.depth,0,It,rn,Je.data);else if(Z.isFramebufferTexture){if(Dn)if(wn)t.texStorage2D(i.TEXTURE_2D,wt,Lt,Je.width,Je.height);else{let Ze=Je.width,St=Je.height;for(let Bt=0;Bt<wt;Bt++)t.texImage2D(i.TEXTURE_2D,Bt,Lt,Ze,St,0,It,rn,null),Ze>>=1,St>>=1}}else if(Z.isHTMLTexture){if("texElementImage2D"in i){let Ze=i.canvas;if(Ze.hasAttribute("layoutsubtree")||Ze.setAttribute("layoutsubtree","true"),Je.parentNode!==Ze){Ze.appendChild(Je),f.add(Z),Ze.onpaint=St=>{let Bt=St.changedElements;for(let ut of f)Bt.includes(ut.image)&&(ut.needsUpdate=!0)},Ze.requestPaint();return}if(i.texElementImage2D.length===3)i.texElementImage2D(i.TEXTURE_2D,i.RGBA8,Je);else{let Bt=i.RGBA,ut=i.RGBA,Ce=i.UNSIGNED_BYTE;i.texElementImage2D(i.TEXTURE_2D,0,Bt,ut,Ce,Je)}i.texParameteri(i.TEXTURE_2D,i.TEXTURE_MIN_FILTER,i.LINEAR),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_S,i.CLAMP_TO_EDGE),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_T,i.CLAMP_TO_EDGE)}}else if(fn.length>0){if(wn&&Dn){let Ze=zn(fn[0]);t.texStorage2D(i.TEXTURE_2D,wt,Lt,Ze.width,Ze.height)}for(let Ze=0,St=fn.length;Ze<St;Ze++)Rt=fn[Ze],wn?ye&&t.texSubImage2D(i.TEXTURE_2D,Ze,0,0,It,rn,Rt):t.texImage2D(i.TEXTURE_2D,Ze,Lt,It,rn,Rt);Z.generateMipmaps=!1}else if(wn){if(Dn){let Ze=zn(Je);t.texStorage2D(i.TEXTURE_2D,wt,Lt,Ze.width,Ze.height)}ye&&t.texSubImage2D(i.TEXTURE_2D,0,0,0,It,rn,Je)}else t.texImage2D(i.TEXTURE_2D,0,Lt,It,rn,Je);T(Z)&&R(Ie),Tt.__version=vt.version,Z.onUpdate&&Z.onUpdate(Z)}le.__version=Z.version}function Et(le,Z,Te){if(Z.image.length!==6)return;let Ie=Ee(le,Z),Ge=Z.source;t.bindTexture(i.TEXTURE_CUBE_MAP,le.__webglTexture,i.TEXTURE0+Te);let vt=n.get(Ge);if(Ge.version!==vt.__version||Ie===!0){t.activeTexture(i.TEXTURE0+Te);let Tt=ln.getPrimaries(ln.workingColorSpace),qe=Z.colorSpace===ha?null:ln.getPrimaries(Z.colorSpace),Je=Z.colorSpace===ha||Tt===qe?i.NONE:i.BROWSER_DEFAULT_WEBGL;t.pixelStorei(i.UNPACK_FLIP_Y_WEBGL,Z.flipY),t.pixelStorei(i.UNPACK_PREMULTIPLY_ALPHA_WEBGL,Z.premultiplyAlpha),t.pixelStorei(i.UNPACK_ALIGNMENT,Z.unpackAlignment),t.pixelStorei(i.UNPACK_COLORSPACE_CONVERSION_WEBGL,Je);let It=Z.isCompressedTexture||Z.image[0].isCompressedTexture,rn=Z.image[0]&&Z.image[0].isDataTexture,Lt=[];for(let ut=0;ut<6;ut++)!It&&!rn?Lt[ut]=S(Z.image[ut],!0,r.maxCubemapSize):Lt[ut]=rn?Z.image[ut].image:Z.image[ut],Lt[ut]=vi(Z,Lt[ut]);let Rt=Lt[0],fn=s.convert(Z.format,Z.colorSpace),wn=s.convert(Z.type),Dn=P(Z.internalFormat,fn,wn,Z.normalized,Z.colorSpace),ye=Z.isVideoTexture!==!0,wt=vt.__version===void 0||Ie===!0,Ze=Ge.dataReady,St=D(Z,Rt);mt(i.TEXTURE_CUBE_MAP,Z);let Bt;if(It){ye&&wt&&t.texStorage2D(i.TEXTURE_CUBE_MAP,St,Dn,Rt.width,Rt.height);for(let ut=0;ut<6;ut++){Bt=Lt[ut].mipmaps;for(let Ce=0;Ce<Bt.length;Ce++){let Yt=Bt[Ce];Z.format!==Or?fn!==null?ye?Ze&&t.compressedTexSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+ut,Ce,0,0,Yt.width,Yt.height,fn,Yt.data):t.compressedTexImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+ut,Ce,Dn,Yt.width,Yt.height,0,Yt.data):Xe("WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):ye?Ze&&t.texSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+ut,Ce,0,0,Yt.width,Yt.height,fn,wn,Yt.data):t.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+ut,Ce,Dn,Yt.width,Yt.height,0,fn,wn,Yt.data)}}}else{if(Bt=Z.mipmaps,ye&&wt){Bt.length>0&&St++;let ut=zn(Lt[0]);t.texStorage2D(i.TEXTURE_CUBE_MAP,St,Dn,ut.width,ut.height)}for(let ut=0;ut<6;ut++)if(rn){ye?Ze&&t.texSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+ut,0,0,0,Lt[ut].width,Lt[ut].height,fn,wn,Lt[ut].data):t.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+ut,0,Dn,Lt[ut].width,Lt[ut].height,0,fn,wn,Lt[ut].data);for(let Ce=0;Ce<Bt.length;Ce++){let nr=Bt[Ce].image[ut].image;ye?Ze&&t.texSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+ut,Ce+1,0,0,nr.width,nr.height,fn,wn,nr.data):t.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+ut,Ce+1,Dn,nr.width,nr.height,0,fn,wn,nr.data)}}else{ye?Ze&&t.texSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+ut,0,0,0,fn,wn,Lt[ut]):t.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+ut,0,Dn,fn,wn,Lt[ut]);for(let Ce=0;Ce<Bt.length;Ce++){let Yt=Bt[Ce];ye?Ze&&t.texSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+ut,Ce+1,0,0,fn,wn,Yt.image[ut]):t.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+ut,Ce+1,Dn,fn,wn,Yt.image[ut])}}}T(Z)&&R(i.TEXTURE_CUBE_MAP),vt.__version=Ge.version,Z.onUpdate&&Z.onUpdate(Z)}le.__version=Z.version}function Pt(le,Z,Te,Ie,Ge,vt){let Tt=s.convert(Te.format,Te.colorSpace),qe=s.convert(Te.type),Je=P(Te.internalFormat,Tt,qe,Te.normalized,Te.colorSpace),It=n.get(Z),rn=n.get(Te);if(rn.__renderTarget=Z,!It.__hasExternalTextures){let Lt=Math.max(1,Z.width>>vt),Rt=Math.max(1,Z.height>>vt);Ge===i.TEXTURE_3D||Ge===i.TEXTURE_2D_ARRAY?t.texImage3D(Ge,vt,Je,Lt,Rt,Z.depth,0,Tt,qe,null):t.texImage2D(Ge,vt,Je,Lt,Rt,0,Tt,qe,null)}t.bindFramebuffer(i.FRAMEBUFFER,le),bn(Z)?a.framebufferTexture2DMultisampleEXT(i.FRAMEBUFFER,Ie,Ge,rn.__webglTexture,0,tn(Z)):(Ge===i.TEXTURE_2D||Ge>=i.TEXTURE_CUBE_MAP_POSITIVE_X&&Ge<=i.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&i.framebufferTexture2D(i.FRAMEBUFFER,Ie,Ge,rn.__webglTexture,vt),t.bindFramebuffer(i.FRAMEBUFFER,null)}function dn(le,Z,Te){if(i.bindRenderbuffer(i.RENDERBUFFER,le),Z.depthBuffer){let Ie=Z.depthTexture,Ge=Ie&&Ie.isDepthTexture?Ie.type:null,vt=F(Z.stencilBuffer,Ge),Tt=Z.stencilBuffer?i.DEPTH_STENCIL_ATTACHMENT:i.DEPTH_ATTACHMENT;bn(Z)?a.renderbufferStorageMultisampleEXT(i.RENDERBUFFER,tn(Z),vt,Z.width,Z.height):Te?i.renderbufferStorageMultisample(i.RENDERBUFFER,tn(Z),vt,Z.width,Z.height):i.renderbufferStorage(i.RENDERBUFFER,vt,Z.width,Z.height),i.framebufferRenderbuffer(i.FRAMEBUFFER,Tt,i.RENDERBUFFER,le)}else{let Ie=Z.textures;for(let Ge=0;Ge<Ie.length;Ge++){let vt=Ie[Ge],Tt=s.convert(vt.format,vt.colorSpace),qe=s.convert(vt.type),Je=P(vt.internalFormat,Tt,qe,vt.normalized,vt.colorSpace);bn(Z)?a.renderbufferStorageMultisampleEXT(i.RENDERBUFFER,tn(Z),Je,Z.width,Z.height):Te?i.renderbufferStorageMultisample(i.RENDERBUFFER,tn(Z),Je,Z.width,Z.height):i.renderbufferStorage(i.RENDERBUFFER,Je,Z.width,Z.height)}}i.bindRenderbuffer(i.RENDERBUFFER,null)}function Gt(le,Z,Te){let Ie=Z.isWebGLCubeRenderTarget===!0;if(t.bindFramebuffer(i.FRAMEBUFFER,le),!(Z.depthTexture&&Z.depthTexture.isDepthTexture))throw new Error("THREE.WebGLTextures: renderTarget.depthTexture must be an instance of THREE.DepthTexture.");let Ge=n.get(Z.depthTexture);if(Ge.__renderTarget=Z,(!Ge.__webglTexture||Z.depthTexture.image.width!==Z.width||Z.depthTexture.image.height!==Z.height)&&(Z.depthTexture.image.width=Z.width,Z.depthTexture.image.height=Z.height,Z.depthTexture.needsUpdate=!0),Ie){if(Ge.__webglInit===void 0&&(Ge.__webglInit=!0,Z.depthTexture.addEventListener("dispose",L)),Ge.__webglTexture===void 0){Ge.__webglTexture=i.createTexture(),t.bindTexture(i.TEXTURE_CUBE_MAP,Ge.__webglTexture),mt(i.TEXTURE_CUBE_MAP,Z.depthTexture);let It=s.convert(Z.depthTexture.format),rn=s.convert(Z.depthTexture.type),Lt;Z.depthTexture.format===Vs?Lt=i.DEPTH_COMPONENT24:Z.depthTexture.format===xo&&(Lt=i.DEPTH24_STENCIL8);for(let Rt=0;Rt<6;Rt++)i.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+Rt,0,Lt,Z.width,Z.height,0,It,rn,null)}}else te(Z.depthTexture,0);let vt=Ge.__webglTexture,Tt=tn(Z),qe=Ie?i.TEXTURE_CUBE_MAP_POSITIVE_X+Te:i.TEXTURE_2D,Je=Z.depthTexture.format===xo?i.DEPTH_STENCIL_ATTACHMENT:i.DEPTH_ATTACHMENT;if(Z.depthTexture.format===Vs)bn(Z)?a.framebufferTexture2DMultisampleEXT(i.FRAMEBUFFER,Je,qe,vt,0,Tt):i.framebufferTexture2D(i.FRAMEBUFFER,Je,qe,vt,0);else if(Z.depthTexture.format===xo)bn(Z)?a.framebufferTexture2DMultisampleEXT(i.FRAMEBUFFER,Je,qe,vt,0,Tt):i.framebufferTexture2D(i.FRAMEBUFFER,Je,qe,vt,0);else throw new Error("THREE.WebGLTextures: Unknown depthTexture format.")}function $e(le){let Z=n.get(le),Te=le.isWebGLCubeRenderTarget===!0;if(Z.__boundDepthTexture!==le.depthTexture){let Ie=le.depthTexture;if(Z.__depthDisposeCallback&&Z.__depthDisposeCallback(),Ie){let Ge=()=>{delete Z.__boundDepthTexture,delete Z.__depthDisposeCallback,Ie.removeEventListener("dispose",Ge)};Ie.addEventListener("dispose",Ge),Z.__depthDisposeCallback=Ge}Z.__boundDepthTexture=Ie}if(le.depthTexture&&!Z.__autoAllocateDepthBuffer)if(Te)for(let Ie=0;Ie<6;Ie++)Gt(Z.__webglFramebuffer[Ie],le,Ie);else{let Ie=le.texture.mipmaps;Ie&&Ie.length>0?Gt(Z.__webglFramebuffer[0],le,0):Gt(Z.__webglFramebuffer,le,0)}else if(Te){Z.__webglDepthbuffer=[];for(let Ie=0;Ie<6;Ie++)if(t.bindFramebuffer(i.FRAMEBUFFER,Z.__webglFramebuffer[Ie]),Z.__webglDepthbuffer[Ie]===void 0)Z.__webglDepthbuffer[Ie]=i.createRenderbuffer(),dn(Z.__webglDepthbuffer[Ie],le,!1);else{let Ge=le.stencilBuffer?i.DEPTH_STENCIL_ATTACHMENT:i.DEPTH_ATTACHMENT,vt=Z.__webglDepthbuffer[Ie];i.bindRenderbuffer(i.RENDERBUFFER,vt),i.framebufferRenderbuffer(i.FRAMEBUFFER,Ge,i.RENDERBUFFER,vt)}}else{let Ie=le.texture.mipmaps;if(Ie&&Ie.length>0?t.bindFramebuffer(i.FRAMEBUFFER,Z.__webglFramebuffer[0]):t.bindFramebuffer(i.FRAMEBUFFER,Z.__webglFramebuffer),Z.__webglDepthbuffer===void 0)Z.__webglDepthbuffer=i.createRenderbuffer(),dn(Z.__webglDepthbuffer,le,!1);else{let Ge=le.stencilBuffer?i.DEPTH_STENCIL_ATTACHMENT:i.DEPTH_ATTACHMENT,vt=Z.__webglDepthbuffer;i.bindRenderbuffer(i.RENDERBUFFER,vt),i.framebufferRenderbuffer(i.FRAMEBUFFER,Ge,i.RENDERBUFFER,vt)}}t.bindFramebuffer(i.FRAMEBUFFER,null)}function ot(le,Z,Te){let Ie=n.get(le);Z!==void 0&&Pt(Ie.__webglFramebuffer,le,le.texture,i.COLOR_ATTACHMENT0,i.TEXTURE_2D,0),Te!==void 0&&$e(le)}function nt(le){let Z=le.texture,Te=n.get(le),Ie=n.get(Z);le.addEventListener("dispose",C);let Ge=le.textures,vt=le.isWebGLCubeRenderTarget===!0,Tt=Ge.length>1;if(Tt||(Ie.__webglTexture===void 0&&(Ie.__webglTexture=i.createTexture()),Ie.__version=Z.version,o.memory.textures++),vt){Te.__webglFramebuffer=[];for(let qe=0;qe<6;qe++)if(Z.mipmaps&&Z.mipmaps.length>0){Te.__webglFramebuffer[qe]=[];for(let Je=0;Je<Z.mipmaps.length;Je++)Te.__webglFramebuffer[qe][Je]=i.createFramebuffer()}else Te.__webglFramebuffer[qe]=i.createFramebuffer()}else{if(Z.mipmaps&&Z.mipmaps.length>0){Te.__webglFramebuffer=[];for(let qe=0;qe<Z.mipmaps.length;qe++)Te.__webglFramebuffer[qe]=i.createFramebuffer()}else Te.__webglFramebuffer=i.createFramebuffer();if(Tt)for(let qe=0,Je=Ge.length;qe<Je;qe++){let It=n.get(Ge[qe]);It.__webglTexture===void 0&&(It.__webglTexture=i.createTexture(),o.memory.textures++)}if(le.samples>0&&bn(le)===!1){Te.__webglMultisampledFramebuffer=i.createFramebuffer(),Te.__webglColorRenderbuffer=[],t.bindFramebuffer(i.FRAMEBUFFER,Te.__webglMultisampledFramebuffer);for(let qe=0;qe<Ge.length;qe++){let Je=Ge[qe];Te.__webglColorRenderbuffer[qe]=i.createRenderbuffer(),i.bindRenderbuffer(i.RENDERBUFFER,Te.__webglColorRenderbuffer[qe]);let It=s.convert(Je.format,Je.colorSpace),rn=s.convert(Je.type),Lt=P(Je.internalFormat,It,rn,Je.normalized,Je.colorSpace,le.isXRRenderTarget===!0),Rt=tn(le);i.renderbufferStorageMultisample(i.RENDERBUFFER,Rt,Lt,le.width,le.height),i.framebufferRenderbuffer(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0+qe,i.RENDERBUFFER,Te.__webglColorRenderbuffer[qe])}i.bindRenderbuffer(i.RENDERBUFFER,null),le.depthBuffer&&(Te.__webglDepthRenderbuffer=i.createRenderbuffer(),dn(Te.__webglDepthRenderbuffer,le,!0)),t.bindFramebuffer(i.FRAMEBUFFER,null)}}if(vt){t.bindTexture(i.TEXTURE_CUBE_MAP,Ie.__webglTexture),mt(i.TEXTURE_CUBE_MAP,Z);for(let qe=0;qe<6;qe++)if(Z.mipmaps&&Z.mipmaps.length>0)for(let Je=0;Je<Z.mipmaps.length;Je++)Pt(Te.__webglFramebuffer[qe][Je],le,Z,i.COLOR_ATTACHMENT0,i.TEXTURE_CUBE_MAP_POSITIVE_X+qe,Je);else Pt(Te.__webglFramebuffer[qe],le,Z,i.COLOR_ATTACHMENT0,i.TEXTURE_CUBE_MAP_POSITIVE_X+qe,0);T(Z)&&R(i.TEXTURE_CUBE_MAP),t.unbindTexture()}else if(Tt){for(let qe=0,Je=Ge.length;qe<Je;qe++){let It=Ge[qe],rn=n.get(It),Lt=i.TEXTURE_2D;(le.isWebGL3DRenderTarget||le.isWebGLArrayRenderTarget)&&(Lt=le.isWebGL3DRenderTarget?i.TEXTURE_3D:i.TEXTURE_2D_ARRAY),t.bindTexture(Lt,rn.__webglTexture),mt(Lt,It),Pt(Te.__webglFramebuffer,le,It,i.COLOR_ATTACHMENT0+qe,Lt,0),T(It)&&R(Lt)}t.unbindTexture()}else{let qe=i.TEXTURE_2D;if((le.isWebGL3DRenderTarget||le.isWebGLArrayRenderTarget)&&(qe=le.isWebGL3DRenderTarget?i.TEXTURE_3D:i.TEXTURE_2D_ARRAY),t.bindTexture(qe,Ie.__webglTexture),mt(qe,Z),Z.mipmaps&&Z.mipmaps.length>0)for(let Je=0;Je<Z.mipmaps.length;Je++)Pt(Te.__webglFramebuffer[Je],le,Z,i.COLOR_ATTACHMENT0,qe,Je);else Pt(Te.__webglFramebuffer,le,Z,i.COLOR_ATTACHMENT0,qe,0);T(Z)&&R(qe),t.unbindTexture()}le.depthBuffer&&$e(le)}function bt(le){let Z=le.textures;for(let Te=0,Ie=Z.length;Te<Ie;Te++){let Ge=Z[Te];if(T(Ge)){let vt=I(le),Tt=n.get(Ge).__webglTexture;t.bindTexture(vt,Tt),R(vt),t.unbindTexture()}}}let yt=[],hn=[];function en(le){if(le.samples>0){if(bn(le)===!1){let Z=le.textures,Te=le.width,Ie=le.height,Ge=i.COLOR_BUFFER_BIT,vt=le.stencilBuffer?i.DEPTH_STENCIL_ATTACHMENT:i.DEPTH_ATTACHMENT,Tt=n.get(le),qe=Z.length>1;if(qe)for(let It=0;It<Z.length;It++)t.bindFramebuffer(i.FRAMEBUFFER,Tt.__webglMultisampledFramebuffer),i.framebufferRenderbuffer(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0+It,i.RENDERBUFFER,null),t.bindFramebuffer(i.FRAMEBUFFER,Tt.__webglFramebuffer),i.framebufferTexture2D(i.DRAW_FRAMEBUFFER,i.COLOR_ATTACHMENT0+It,i.TEXTURE_2D,null,0);t.bindFramebuffer(i.READ_FRAMEBUFFER,Tt.__webglMultisampledFramebuffer);let Je=le.texture.mipmaps;Je&&Je.length>0?t.bindFramebuffer(i.DRAW_FRAMEBUFFER,Tt.__webglFramebuffer[0]):t.bindFramebuffer(i.DRAW_FRAMEBUFFER,Tt.__webglFramebuffer);for(let It=0;It<Z.length;It++){if(le.resolveDepthBuffer&&(le.depthBuffer&&(Ge|=i.DEPTH_BUFFER_BIT),le.stencilBuffer&&le.resolveStencilBuffer&&(Ge|=i.STENCIL_BUFFER_BIT)),qe){i.framebufferRenderbuffer(i.READ_FRAMEBUFFER,i.COLOR_ATTACHMENT0,i.RENDERBUFFER,Tt.__webglColorRenderbuffer[It]);let rn=n.get(Z[It]).__webglTexture;i.framebufferTexture2D(i.DRAW_FRAMEBUFFER,i.COLOR_ATTACHMENT0,i.TEXTURE_2D,rn,0)}i.blitFramebuffer(0,0,Te,Ie,0,0,Te,Ie,Ge,i.NEAREST),l===!0&&(yt.length=0,hn.length=0,yt.push(i.COLOR_ATTACHMENT0+It),le.depthBuffer&&le.resolveDepthBuffer===!1&&(yt.push(vt),hn.push(vt),i.invalidateFramebuffer(i.DRAW_FRAMEBUFFER,hn)),i.invalidateFramebuffer(i.READ_FRAMEBUFFER,yt))}if(t.bindFramebuffer(i.READ_FRAMEBUFFER,null),t.bindFramebuffer(i.DRAW_FRAMEBUFFER,null),qe)for(let It=0;It<Z.length;It++){t.bindFramebuffer(i.FRAMEBUFFER,Tt.__webglMultisampledFramebuffer),i.framebufferRenderbuffer(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0+It,i.RENDERBUFFER,Tt.__webglColorRenderbuffer[It]);let rn=n.get(Z[It]).__webglTexture;t.bindFramebuffer(i.FRAMEBUFFER,Tt.__webglFramebuffer),i.framebufferTexture2D(i.DRAW_FRAMEBUFFER,i.COLOR_ATTACHMENT0+It,i.TEXTURE_2D,rn,0)}t.bindFramebuffer(i.DRAW_FRAMEBUFFER,Tt.__webglMultisampledFramebuffer)}else if(le.depthBuffer&&le.resolveDepthBuffer===!1&&l){let Z=le.stencilBuffer?i.DEPTH_STENCIL_ATTACHMENT:i.DEPTH_ATTACHMENT;i.invalidateFramebuffer(i.DRAW_FRAMEBUFFER,[Z])}}}function tn(le){return Math.min(r.maxSamples,le.samples)}function bn(le){let Z=n.get(le);return le.samples>0&&e.has("WEBGL_multisampled_render_to_texture")===!0&&Z.__useRenderToTexture!==!1}function _e(le){let Z=o.render.frame;u.get(le)!==Z&&(u.set(le,Z),le.update())}function vi(le,Z){let Te=le.colorSpace,Ie=le.format,Ge=le.type;return le.isCompressedTexture===!0||le.isVideoTexture===!0||Te!==t0&&Te!==ha&&(ln.getTransfer(Te)===kt?(Ie!==Or||Ge!==Ji)&&Xe("WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):ze("WebGLTextures: Unsupported texture color space:",Te)),Z}function zn(le){return typeof HTMLImageElement<"u"&&le instanceof HTMLImageElement?(c.width=le.naturalWidth||le.width,c.height=le.naturalHeight||le.height):typeof VideoFrame<"u"&&le instanceof VideoFrame?(c.width=le.displayWidth,c.height=le.displayHeight):(c.width=le.width,c.height=le.height),c}this.allocateTextureUnit=$,this.resetTextureUnits=W,this.getTextureUnits=Y,this.setTextureUnits=H,this.setTexture2D=te,this.setTexture2DArray=ce,this.setTexture3D=he,this.setTextureCube=ve,this.rebindTextures=ot,this.setupRenderTarget=nt,this.updateRenderTargetMipmap=bt,this.updateMultisampleRenderTarget=en,this.setupDepthRenderbuffer=$e,this.setupFrameBufferTexture=Pt,this.useMultisampledRTT=bn,this.isReversedDepthBuffer=function(){return t.buffers.depth.getReversed()}}function qxe(i,e){function t(n,r=ha){let s,o=ln.getTransfer(r);if(n===Ji)return i.UNSIGNED_BYTE;if(n===ng)return i.UNSIGNED_SHORT_4_4_4_4;if(n===ig)return i.UNSIGNED_SHORT_5_5_5_1;if(n===rg)return i.UNSIGNED_INT_5_9_9_9_REV;if(n===sg)return i.UNSIGNED_INT_10F_11F_11F_REV;if(n===Oh)return i.BYTE;if(n===Uh)return i.SHORT;if(n===wl)return i.UNSIGNED_SHORT;if(n===Kr)return i.INT;if(n===xi)return i.UNSIGNED_INT;if(n===cr)return i.FLOAT;if(n===Wi)return i.HALF_FLOAT;if(n===u_)return i.ALPHA;if(n===Nd)return i.RGB;if(n===Or)return i.RGBA;if(n===Vs)return i.DEPTH_COMPONENT;if(n===xo)return i.DEPTH_STENCIL;if(n===Fd)return i.RED;if(n===kh)return i.RED_INTEGER;if(n===Ws)return i.RG;if(n===zh)return i.RG_INTEGER;if(n===g0)return i.RGBA_INTEGER;if(n===Vh||n===Gh||n===qh||n===Hh)if(o===kt)if(s=e.get("WEBGL_compressed_texture_s3tc_srgb"),s!==null){if(n===Vh)return s.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(n===Gh)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(n===qh)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(n===Hh)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(s=e.get("WEBGL_compressed_texture_s3tc"),s!==null){if(n===Vh)return s.COMPRESSED_RGB_S3TC_DXT1_EXT;if(n===Gh)return s.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(n===qh)return s.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(n===Hh)return s.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(n===og||n===ag||n===lg||n===cg)if(s=e.get("WEBGL_compressed_texture_pvrtc"),s!==null){if(n===og)return s.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(n===ag)return s.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(n===lg)return s.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(n===cg)return s.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(n===v0||n===_0||n===x0||n===y0||n===b0||n===Wh||n===w0)if(s=e.get("WEBGL_compressed_texture_etc"),s!==null){if(n===v0||n===_0)return o===kt?s.COMPRESSED_SRGB8_ETC2:s.COMPRESSED_RGB8_ETC2;if(n===x0)return o===kt?s.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:s.COMPRESSED_RGBA8_ETC2_EAC;if(n===y0)return s.COMPRESSED_R11_EAC;if(n===b0)return s.COMPRESSED_SIGNED_R11_EAC;if(n===Wh)return s.COMPRESSED_RG11_EAC;if(n===w0)return s.COMPRESSED_SIGNED_RG11_EAC}else return null;if(n===S0||n===T0||n===E0||n===M0||n===C0||n===R0||n===P0||n===I0||n===L0||n===D0||n===N0||n===F0||n===B0||n===O0)if(s=e.get("WEBGL_compressed_texture_astc"),s!==null){if(n===S0)return o===kt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:s.COMPRESSED_RGBA_ASTC_4x4_KHR;if(n===T0)return o===kt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:s.COMPRESSED_RGBA_ASTC_5x4_KHR;if(n===E0)return o===kt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:s.COMPRESSED_RGBA_ASTC_5x5_KHR;if(n===M0)return o===kt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:s.COMPRESSED_RGBA_ASTC_6x5_KHR;if(n===C0)return o===kt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:s.COMPRESSED_RGBA_ASTC_6x6_KHR;if(n===R0)return o===kt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:s.COMPRESSED_RGBA_ASTC_8x5_KHR;if(n===P0)return o===kt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:s.COMPRESSED_RGBA_ASTC_8x6_KHR;if(n===I0)return o===kt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:s.COMPRESSED_RGBA_ASTC_8x8_KHR;if(n===L0)return o===kt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:s.COMPRESSED_RGBA_ASTC_10x5_KHR;if(n===D0)return o===kt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:s.COMPRESSED_RGBA_ASTC_10x6_KHR;if(n===N0)return o===kt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:s.COMPRESSED_RGBA_ASTC_10x8_KHR;if(n===F0)return o===kt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:s.COMPRESSED_RGBA_ASTC_10x10_KHR;if(n===B0)return o===kt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:s.COMPRESSED_RGBA_ASTC_12x10_KHR;if(n===O0)return o===kt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:s.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(n===U0||n===k0||n===z0)if(s=e.get("EXT_texture_compression_bptc"),s!==null){if(n===U0)return o===kt?s.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:s.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(n===k0)return s.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(n===z0)return s.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}else return null;if(n===V0||n===G0||n===jh||n===q0)if(s=e.get("EXT_texture_compression_rgtc"),s!==null){if(n===V0)return s.COMPRESSED_RED_RGTC1_EXT;if(n===G0)return s.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(n===jh)return s.COMPRESSED_RED_GREEN_RGTC2_EXT;if(n===q0)return s.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return n===ua?i.UNSIGNED_INT_24_8:i[n]!==void 0?i[n]:null}return{convert:t}}var Hxe=`40944094 void main() {40954095 40964096 gl_Position = vec4( position, 1.0 );40974097 4098-}`,uxe=`4098+}`,Wxe=`40994099 uniform sampler2DArray depthColor;41004100 uniform float depthWidth;41014101 uniform float depthHeight;@@ -4114,23 +4114,23 @@ void main() {
41144114 41154115 }41164116 4117-}`,_F=class{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(e,t){if(this.texture===null){let n=new I2(e.texture);(e.depthNear!==t.depthNear||e.depthFar!==t.depthFar)&&(this.depthNear=e.depthNear,this.depthFar=e.depthFar),this.texture=n}}getMesh(e){if(this.texture!==null&&this.mesh===null){let t=e.cameras[0].viewport,n=new ds({vertexShader:cxe,fragmentShader:uxe,uniforms:{depthColor:{value:this.texture},depthWidth:{value:t.z},depthHeight:{value:t.w}}});this.mesh=new Hn(new HA(20,20),n)}return this.mesh}reset(){this.texture=null,this.mesh=null}getDepthTexture(){return this.texture}},xF=class extends la{constructor(e,t){super();let n=this,r=null,s=1,o=null,a="local-floor",l=1,c=null,u=null,f=null,d=null,A=null,y=null,w=typeof XRWebGLBinding<"u",S=new _F,T={},R=t.getContextAttributes(),P=null,I=null,F=[],D=[],L=new Oe,C=null,B=new $r;B.viewport=new xn;let k=new $r;k.viewport=new xn;let z=[B,k],G=new t_,W=null,Y=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(Ee){let Ve=F[Ee];return Ve===void 0&&(Ve=new e0,F[Ee]=Ve),Ve.getTargetRaySpace()},this.getControllerGrip=function(Ee){let Ve=F[Ee];return Ve===void 0&&(Ve=new e0,F[Ee]=Ve),Ve.getGripSpace()},this.getHand=function(Ee){let Ve=F[Ee];return Ve===void 0&&(Ve=new e0,F[Ee]=Ve),Ve.getHandSpace()};function H(Ee){let Ve=D.indexOf(Ee.inputSource);if(Ve===-1)return;let Ye=F[Ve];Ye!==void 0&&(Ye.update(Ee.inputSource,Ee.frame,c||o),Ye.dispatchEvent({type:Ee.type,data:Ee.inputSource}))}function $(){r.removeEventListener("select",H),r.removeEventListener("selectstart",H),r.removeEventListener("selectend",H),r.removeEventListener("squeeze",H),r.removeEventListener("squeezestart",H),r.removeEventListener("squeezeend",H),r.removeEventListener("end",$),r.removeEventListener("inputsourceschange",J);for(let Ee=0;Ee<F.length;Ee++){let Ve=D[Ee];Ve!==null&&(D[Ee]=null,F[Ee].disconnect(Ve))}W=null,Y=null,S.reset();for(let Ee in T)delete T[Ee];e.setRenderTarget(P),A=null,d=null,f=null,r=null,I=null,mt.stop(),n.isPresenting=!1,e.setPixelRatio(C),e.setSize(L.width,L.height,!1),n.dispatchEvent({type:"sessionend"})}this.setFramebufferScaleFactor=function(Ee){s=Ee,n.isPresenting===!0&&Xe("WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(Ee){a=Ee,n.isPresenting===!0&&Xe("WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return c||o},this.setReferenceSpace=function(Ee){c=Ee},this.getBaseLayer=function(){return d!==null?d:A},this.getBinding=function(){return f===null&&w&&(f=new XRWebGLBinding(r,t)),f},this.getFrame=function(){return y},this.getSession=function(){return r},this.setSession=async function(Ee){if(r=Ee,r!==null){if(P=e.getRenderTarget(),r.addEventListener("select",H),r.addEventListener("selectstart",H),r.addEventListener("selectend",H),r.addEventListener("squeeze",H),r.addEventListener("squeezestart",H),r.addEventListener("squeezeend",H),r.addEventListener("end",$),r.addEventListener("inputsourceschange",J),R.xrCompatible!==!0&&await t.makeXRCompatible(),C=e.getPixelRatio(),e.getSize(L),w&&"createProjectionLayer"in XRWebGLBinding.prototype){let Ye=null,Mt=null,Et=null;R.depth&&(Et=R.stencil?t.DEPTH24_STENCIL8:t.DEPTH_COMPONENT24,Ye=R.stencil?xo:Gs,Mt=R.stencil?ca:xi);let It={colorFormat:t.RGBA8,depthFormat:Et,scaleFactor:s};f=this.getBinding(),d=f.createProjectionLayer(It),r.updateRenderState({layers:[d]}),e.setPixelRatio(1),e.setSize(d.textureWidth,d.textureHeight,!1),I=new Ba(d.textureWidth,d.textureHeight,{format:Or,type:Ji,depthTexture:new Cs(d.textureWidth,d.textureHeight,Mt,void 0,void 0,void 0,void 0,void 0,void 0,Ye),stencilBuffer:R.stencil,colorSpace:e.outputColorSpace,samples:R.antialias?4:0,resolveDepthBuffer:d.ignoreDepthValues===!1,resolveStencilBuffer:d.ignoreDepthValues===!1})}else{let Ye={antialias:R.antialias,alpha:!0,depth:R.depth,stencil:R.stencil,framebufferScaleFactor:s};A=new XRWebGLLayer(r,t,Ye),r.updateRenderState({baseLayer:A}),e.setPixelRatio(1),e.setSize(A.framebufferWidth,A.framebufferHeight,!1),I=new Ba(A.framebufferWidth,A.framebufferHeight,{format:Or,type:Ji,colorSpace:e.outputColorSpace,stencilBuffer:R.stencil,resolveDepthBuffer:A.ignoreDepthValues===!1,resolveStencilBuffer:A.ignoreDepthValues===!1})}I.isXRRenderTarget=!0,this.setFoveation(l),c=null,o=await r.requestReferenceSpace(a),mt.setContext(r),mt.start(),n.isPresenting=!0,n.dispatchEvent({type:"sessionstart"})}},this.getEnvironmentBlendMode=function(){if(r!==null)return r.environmentBlendMode},this.getDepthTexture=function(){return S.getDepthTexture()};function J(Ee){for(let Ve=0;Ve<Ee.removed.length;Ve++){let Ye=Ee.removed[Ve],Mt=D.indexOf(Ye);Mt>=0&&(D[Mt]=null,F[Mt].disconnect(Ye))}for(let Ve=0;Ve<Ee.added.length;Ve++){let Ye=Ee.added[Ve],Mt=D.indexOf(Ye);if(Mt===-1){for(let It=0;It<F.length;It++)if(It>=D.length){D.push(Ye),Mt=It;break}else if(D[It]===null){D[It]=Ye,Mt=It;break}if(Mt===-1)break}let Et=F[Mt];Et&&Et.connect(Ye)}}let te=new re,ce=new re;function he(Ee,Ve,Ye){te.setFromMatrixPosition(Ve.matrixWorld),ce.setFromMatrixPosition(Ye.matrixWorld);let Mt=te.distanceTo(ce),Et=Ve.projectionMatrix.elements,It=Ye.projectionMatrix.elements,dn=Et[14]/(Et[10]-1),Gt=Et[14]/(Et[10]+1),$e=(Et[9]+1)/Et[5],ot=(Et[9]-1)/Et[5],nt=(Et[8]-1)/Et[0],bt=(It[8]+1)/It[0],yt=dn*nt,hn=dn*bt,tn=Mt/(-nt+bt),nn=tn*-nt;if(Ve.matrixWorld.decompose(Ee.position,Ee.quaternion,Ee.scale),Ee.translateX(nn),Ee.translateZ(tn),Ee.matrixWorld.compose(Ee.position,Ee.quaternion,Ee.scale),Ee.matrixWorldInverse.copy(Ee.matrixWorld).invert(),Et[10]===-1)Ee.projectionMatrix.copy(Ve.projectionMatrix),Ee.projectionMatrixInverse.copy(Ve.projectionMatrixInverse);else{let bn=dn+tn,_e=Gt+tn,vi=yt-nn,zn=hn+(Mt-nn),le=$e*Gt/_e*bn,Z=ot*Gt/_e*bn;Ee.projectionMatrix.makePerspective(vi,zn,le,Z,bn,_e),Ee.projectionMatrixInverse.copy(Ee.projectionMatrix).invert()}}function ve(Ee,Ve){Ve===null?Ee.matrixWorld.copy(Ee.matrix):Ee.matrixWorld.multiplyMatrices(Ve.matrixWorld,Ee.matrix),Ee.matrixWorldInverse.copy(Ee.matrixWorld).invert()}this.updateCamera=function(Ee){if(r===null)return;let Ve=Ee.near,Ye=Ee.far;S.texture!==null&&(S.depthNear>0&&(Ve=S.depthNear),S.depthFar>0&&(Ye=S.depthFar)),G.near=k.near=B.near=Ve,G.far=k.far=B.far=Ye,(W!==G.near||Y!==G.far)&&(r.updateRenderState({depthNear:G.near,depthFar:G.far}),W=G.near,Y=G.far),G.layers.mask=Ee.layers.mask|6,B.layers.mask=G.layers.mask&-5,k.layers.mask=G.layers.mask&-3;let Mt=Ee.parent,Et=G.cameras;ve(G,Mt);for(let It=0;It<Et.length;It++)ve(Et[It],Mt);Et.length===2?he(G,B,k):G.projectionMatrix.copy(B.projectionMatrix),Re(Ee,G,Mt)};function Re(Ee,Ve,Ye){Ye===null?Ee.matrix.copy(Ve.matrixWorld):(Ee.matrix.copy(Ye.matrixWorld),Ee.matrix.invert(),Ee.matrix.multiply(Ve.matrixWorld)),Ee.matrix.decompose(Ee.position,Ee.quaternion,Ee.scale),Ee.updateMatrixWorld(!0),Ee.projectionMatrix.copy(Ve.projectionMatrix),Ee.projectionMatrixInverse.copy(Ve.projectionMatrixInverse),Ee.isPerspectiveCamera&&(Ee.fov=Td*2*Math.atan(1/Ee.projectionMatrix.elements[5]),Ee.zoom=1)}this.getCamera=function(){return G},this.getFoveation=function(){if(!(d===null&&A===null))return l},this.setFoveation=function(Ee){l=Ee,d!==null&&(d.fixedFoveation=Ee),A!==null&&A.fixedFoveation!==void 0&&(A.fixedFoveation=Ee)},this.hasDepthSensing=function(){return S.texture!==null},this.getDepthSensingMesh=function(){return S.getMesh(G)},this.getCameraTexture=function(Ee){return T[Ee]};let Qe=null;function Fe(Ee,Ve){if(u=Ve.getViewerPose(c||o),y=Ve,u!==null){let Ye=u.views;A!==null&&(e.setRenderTargetFramebuffer(I,A.framebuffer),e.setRenderTarget(I));let Mt=!1;Ye.length!==G.cameras.length&&(G.cameras.length=0,Mt=!0);for(let Gt=0;Gt<Ye.length;Gt++){let $e=Ye[Gt],ot=null;if(A!==null)ot=A.getViewport($e);else{let bt=f.getViewSubImage(d,$e);ot=bt.viewport,Gt===0&&(e.setRenderTargetTextures(I,bt.colorTexture,bt.depthStencilTexture),e.setRenderTarget(I))}let nt=z[Gt];nt===void 0&&(nt=new $r,nt.layers.enable(Gt),nt.viewport=new xn,z[Gt]=nt),nt.matrix.fromArray($e.transform.matrix),nt.matrix.decompose(nt.position,nt.quaternion,nt.scale),nt.projectionMatrix.fromArray($e.projectionMatrix),nt.projectionMatrixInverse.copy(nt.projectionMatrix).invert(),nt.viewport.set(ot.x,ot.y,ot.width,ot.height),Gt===0&&(G.matrix.copy(nt.matrix),G.matrix.decompose(G.position,G.quaternion,G.scale)),Mt===!0&&G.cameras.push(nt)}let Et=r.enabledFeatures;if(Et&&Et.includes("depth-sensing")&&r.depthUsage=="gpu-optimized"&&w){f=n.getBinding();let Gt=f.getDepthInformation(Ye[0]);Gt&&Gt.isValid&&Gt.texture&&S.init(Gt,r.renderState)}if(Et&&Et.includes("camera-access")&&w){e.state.unbindTexture(),f=n.getBinding();for(let Gt=0;Gt<Ye.length;Gt++){let $e=Ye[Gt].camera;if($e){let ot=T[$e];ot||(ot=new I2,T[$e]=ot);let nt=f.getCameraImage($e);ot.sourceTexture=nt}}}}for(let Ye=0;Ye<F.length;Ye++){let Mt=D[Ye],Et=F[Ye];Mt!==null&&Et!==void 0&&Et.update(Mt,Ve,c||o)}Qe&&Qe(Ee,Ve),Ve.detectedPlanes&&n.dispatchEvent({type:"planesdetected",data:Ve}),y=null}let mt=new NZ;mt.setAnimationLoop(Fe),this.setAnimationLoop=function(Ee){Qe=Ee},this.dispose=function(){}}},hxe=new cn,zZ=new Mn;zZ.set(-1,0,0,0,1,0,0,0,1);function fxe(i,e){function t(S,T){S.matrixAutoUpdate===!0&&S.updateMatrix(),T.value.copy(S.matrix)}function n(S,T){T.color.getRGB(S.fogColor.value,Q8(i)),T.isFog?(S.fogNear.value=T.near,S.fogFar.value=T.far):T.isFogExp2&&(S.fogDensity.value=T.density)}function r(S,T,R,P,I){T.isNodeMaterial?T.uniformsNeedUpdate=!1:T.isMeshBasicMaterial?s(S,T):T.isMeshLambertMaterial?(s(S,T),T.envMap&&(S.envMapIntensity.value=T.envMapIntensity)):T.isMeshToonMaterial?(s(S,T),f(S,T)):T.isMeshPhongMaterial?(s(S,T),u(S,T),T.envMap&&(S.envMapIntensity.value=T.envMapIntensity)):T.isMeshStandardMaterial?(s(S,T),d(S,T),T.isMeshPhysicalMaterial&&A(S,T,I)):T.isMeshMatcapMaterial?(s(S,T),y(S,T)):T.isMeshDepthMaterial?s(S,T):T.isMeshDistanceMaterial?(s(S,T),w(S,T)):T.isMeshNormalMaterial?s(S,T):T.isLineBasicMaterial?(o(S,T),T.isLineDashedMaterial&&a(S,T)):T.isPointsMaterial?l(S,T,R,P):T.isSpriteMaterial?c(S,T):T.isShadowMaterial?(S.color.value.copy(T.color),S.opacity.value=T.opacity):T.isShaderMaterial&&(T.uniformsNeedUpdate=!1)}function s(S,T){S.opacity.value=T.opacity,T.color&&S.diffuse.value.copy(T.color),T.emissive&&S.emissive.value.copy(T.emissive).multiplyScalar(T.emissiveIntensity),T.map&&(S.map.value=T.map,t(T.map,S.mapTransform)),T.alphaMap&&(S.alphaMap.value=T.alphaMap,t(T.alphaMap,S.alphaMapTransform)),T.bumpMap&&(S.bumpMap.value=T.bumpMap,t(T.bumpMap,S.bumpMapTransform),S.bumpScale.value=T.bumpScale,T.side===mi&&(S.bumpScale.value*=-1)),T.normalMap&&(S.normalMap.value=T.normalMap,t(T.normalMap,S.normalMapTransform),S.normalScale.value.copy(T.normalScale),T.side===mi&&S.normalScale.value.negate()),T.displacementMap&&(S.displacementMap.value=T.displacementMap,t(T.displacementMap,S.displacementMapTransform),S.displacementScale.value=T.displacementScale,S.displacementBias.value=T.displacementBias),T.emissiveMap&&(S.emissiveMap.value=T.emissiveMap,t(T.emissiveMap,S.emissiveMapTransform)),T.specularMap&&(S.specularMap.value=T.specularMap,t(T.specularMap,S.specularMapTransform)),T.alphaTest>0&&(S.alphaTest.value=T.alphaTest);let R=e.get(T),P=R.envMap,I=R.envMapRotation;P&&(S.envMap.value=P,S.envMapRotation.value.setFromMatrix4(hxe.makeRotationFromEuler(I)).transpose(),P.isCubeTexture&&P.isRenderTargetTexture===!1&&S.envMapRotation.value.premultiply(zZ),S.reflectivity.value=T.reflectivity,S.ior.value=T.ior,S.refractionRatio.value=T.refractionRatio),T.lightMap&&(S.lightMap.value=T.lightMap,S.lightMapIntensity.value=T.lightMapIntensity,t(T.lightMap,S.lightMapTransform)),T.aoMap&&(S.aoMap.value=T.aoMap,S.aoMapIntensity.value=T.aoMapIntensity,t(T.aoMap,S.aoMapTransform))}function o(S,T){S.diffuse.value.copy(T.color),S.opacity.value=T.opacity,T.map&&(S.map.value=T.map,t(T.map,S.mapTransform))}function a(S,T){S.dashSize.value=T.dashSize,S.totalSize.value=T.dashSize+T.gapSize,S.scale.value=T.scale}function l(S,T,R,P){S.diffuse.value.copy(T.color),S.opacity.value=T.opacity,S.size.value=T.size*R,S.scale.value=P*.5,T.map&&(S.map.value=T.map,t(T.map,S.uvTransform)),T.alphaMap&&(S.alphaMap.value=T.alphaMap,t(T.alphaMap,S.alphaMapTransform)),T.alphaTest>0&&(S.alphaTest.value=T.alphaTest)}function c(S,T){S.diffuse.value.copy(T.color),S.opacity.value=T.opacity,S.rotation.value=T.rotation,T.map&&(S.map.value=T.map,t(T.map,S.mapTransform)),T.alphaMap&&(S.alphaMap.value=T.alphaMap,t(T.alphaMap,S.alphaMapTransform)),T.alphaTest>0&&(S.alphaTest.value=T.alphaTest)}function u(S,T){S.specular.value.copy(T.specular),S.shininess.value=Math.max(T.shininess,1e-4)}function f(S,T){T.gradientMap&&(S.gradientMap.value=T.gradientMap)}function d(S,T){S.metalness.value=T.metalness,T.metalnessMap&&(S.metalnessMap.value=T.metalnessMap,t(T.metalnessMap,S.metalnessMapTransform)),S.roughness.value=T.roughness,T.roughnessMap&&(S.roughnessMap.value=T.roughnessMap,t(T.roughnessMap,S.roughnessMapTransform)),T.envMap&&(S.envMapIntensity.value=T.envMapIntensity)}function A(S,T,R){S.ior.value=T.ior,T.sheen>0&&(S.sheenColor.value.copy(T.sheenColor).multiplyScalar(T.sheen),S.sheenRoughness.value=T.sheenRoughness,T.sheenColorMap&&(S.sheenColorMap.value=T.sheenColorMap,t(T.sheenColorMap,S.sheenColorMapTransform)),T.sheenRoughnessMap&&(S.sheenRoughnessMap.value=T.sheenRoughnessMap,t(T.sheenRoughnessMap,S.sheenRoughnessMapTransform))),T.clearcoat>0&&(S.clearcoat.value=T.clearcoat,S.clearcoatRoughness.value=T.clearcoatRoughness,T.clearcoatMap&&(S.clearcoatMap.value=T.clearcoatMap,t(T.clearcoatMap,S.clearcoatMapTransform)),T.clearcoatRoughnessMap&&(S.clearcoatRoughnessMap.value=T.clearcoatRoughnessMap,t(T.clearcoatRoughnessMap,S.clearcoatRoughnessMapTransform)),T.clearcoatNormalMap&&(S.clearcoatNormalMap.value=T.clearcoatNormalMap,t(T.clearcoatNormalMap,S.clearcoatNormalMapTransform),S.clearcoatNormalScale.value.copy(T.clearcoatNormalScale),T.side===mi&&S.clearcoatNormalScale.value.negate())),T.dispersion>0&&(S.dispersion.value=T.dispersion),T.iridescence>0&&(S.iridescence.value=T.iridescence,S.iridescenceIOR.value=T.iridescenceIOR,S.iridescenceThicknessMinimum.value=T.iridescenceThicknessRange[0],S.iridescenceThicknessMaximum.value=T.iridescenceThicknessRange[1],T.iridescenceMap&&(S.iridescenceMap.value=T.iridescenceMap,t(T.iridescenceMap,S.iridescenceMapTransform)),T.iridescenceThicknessMap&&(S.iridescenceThicknessMap.value=T.iridescenceThicknessMap,t(T.iridescenceThicknessMap,S.iridescenceThicknessMapTransform))),T.transmission>0&&(S.transmission.value=T.transmission,S.transmissionSamplerMap.value=R.texture,S.transmissionSamplerSize.value.set(R.width,R.height),T.transmissionMap&&(S.transmissionMap.value=T.transmissionMap,t(T.transmissionMap,S.transmissionMapTransform)),S.thickness.value=T.thickness,T.thicknessMap&&(S.thicknessMap.value=T.thicknessMap,t(T.thicknessMap,S.thicknessMapTransform)),S.attenuationDistance.value=T.attenuationDistance,S.attenuationColor.value.copy(T.attenuationColor)),T.anisotropy>0&&(S.anisotropyVector.value.set(T.anisotropy*Math.cos(T.anisotropyRotation),T.anisotropy*Math.sin(T.anisotropyRotation)),T.anisotropyMap&&(S.anisotropyMap.value=T.anisotropyMap,t(T.anisotropyMap,S.anisotropyMapTransform))),S.specularIntensity.value=T.specularIntensity,S.specularColor.value.copy(T.specularColor),T.specularColorMap&&(S.specularColorMap.value=T.specularColorMap,t(T.specularColorMap,S.specularColorMapTransform)),T.specularIntensityMap&&(S.specularIntensityMap.value=T.specularIntensityMap,t(T.specularIntensityMap,S.specularIntensityMapTransform))}function y(S,T){T.matcap&&(S.matcap.value=T.matcap)}function w(S,T){let R=e.get(T).light;S.referencePosition.value.setFromMatrixPosition(R.matrixWorld),S.nearDistance.value=R.shadow.camera.near,S.farDistance.value=R.shadow.camera.far}return{refreshFogUniforms:n,refreshMaterialUniforms:r}}function dxe(i,e,t,n){let r={},s={},o=[],a=i.getParameter(i.MAX_UNIFORM_BUFFER_BINDINGS);function l(I,F){let D=F.program;n.uniformBlockBinding(I,D)}function c(I,F){let D=r[I.id];D===void 0&&(S(I),D=u(I),r[I.id]=D,I.addEventListener("dispose",R));let L=F.program;n.updateUBOMapping(I,L);let C=e.render.frame;s[I.id]!==C&&(d(I),s[I.id]=C)}function u(I){let F=f();I.__bindingPointIndex=F;let D=i.createBuffer(),L=I.__size,C=I.usage;return i.bindBuffer(i.UNIFORM_BUFFER,D),i.bufferData(i.UNIFORM_BUFFER,L,C),i.bindBuffer(i.UNIFORM_BUFFER,null),i.bindBufferBase(i.UNIFORM_BUFFER,F,D),D}function f(){for(let I=0;I<a;I++)if(o.indexOf(I)===-1)return o.push(I),I;return ze("WebGLRenderer: Maximum number of simultaneously usable uniforms groups reached."),0}function d(I){let F=r[I.id],D=I.uniforms,L=I.__cache;i.bindBuffer(i.UNIFORM_BUFFER,F);for(let C=0,B=D.length;C<B;C++){let k=D[C];if(Array.isArray(k))for(let z=0,G=k.length;z<G;z++)A(k[z],C,z,L);else A(k,C,0,L)}i.bindBuffer(i.UNIFORM_BUFFER,null)}function A(I,F,D,L){if(w(I,F,D,L)===!0){let C=I.__offset,B=I.value;if(Array.isArray(B)){let k=0;for(let z=0;z<B.length;z++){let G=B[z],W=T(G);y(G,I.__data,k),typeof G!="number"&&typeof G!="boolean"&&!G.isMatrix3&&!ArrayBuffer.isView(G)&&(k+=W.storage/Float32Array.BYTES_PER_ELEMENT)}}else y(B,I.__data,0);i.bufferSubData(i.UNIFORM_BUFFER,C,I.__data)}}function y(I,F,D){typeof I=="number"||typeof I=="boolean"?F[0]=I:I.isMatrix3?(F[0]=I.elements[0],F[1]=I.elements[1],F[2]=I.elements[2],F[3]=0,F[4]=I.elements[3],F[5]=I.elements[4],F[6]=I.elements[5],F[7]=0,F[8]=I.elements[6],F[9]=I.elements[7],F[10]=I.elements[8],F[11]=0):ArrayBuffer.isView(I)?F.set(new I.constructor(I.buffer,I.byteOffset,F.length)):I.toArray(F,D)}function w(I,F,D,L){let C=I.value,B=F+"_"+D;if(L[B]===void 0)return typeof C=="number"||typeof C=="boolean"?L[B]=C:ArrayBuffer.isView(C)?L[B]=C.slice():L[B]=C.clone(),!0;{let k=L[B];if(typeof C=="number"||typeof C=="boolean"){if(k!==C)return L[B]=C,!0}else{if(ArrayBuffer.isView(C))return!0;if(k.equals(C)===!1)return k.copy(C),!0}}return!1}function S(I){let F=I.uniforms,D=0,L=16;for(let B=0,k=F.length;B<k;B++){let z=Array.isArray(F[B])?F[B]:[F[B]];for(let G=0,W=z.length;G<W;G++){let Y=z[G],H=Array.isArray(Y.value)?Y.value:[Y.value];for(let $=0,J=H.length;$<J;$++){let te=H[$],ce=T(te),he=D%L,ve=he%ce.boundary,Re=he+ve;D+=ve,Re!==0&&L-Re<ce.storage&&(D+=L-Re),Y.__data=new Float32Array(ce.storage/Float32Array.BYTES_PER_ELEMENT),Y.__offset=D,D+=ce.storage}}}let C=D%L;return C>0&&(D+=L-C),I.__size=D,I.__cache={},this}function T(I){let F={boundary:0,storage:0};return typeof I=="number"||typeof I=="boolean"?(F.boundary=4,F.storage=4):I.isVector2?(F.boundary=8,F.storage=8):I.isVector3||I.isColor?(F.boundary=16,F.storage=12):I.isVector4?(F.boundary=16,F.storage=16):I.isMatrix3?(F.boundary=48,F.storage=48):I.isMatrix4?(F.boundary=64,F.storage=64):I.isTexture?Xe("WebGLRenderer: Texture samplers can not be part of an uniforms group."):ArrayBuffer.isView(I)?(F.boundary=16,F.storage=I.byteLength):Xe("WebGLRenderer: Unsupported uniform value type.",I),F}function R(I){let F=I.target;F.removeEventListener("dispose",R);let D=o.indexOf(F.__bindingPointIndex);o.splice(D,1),i.deleteBuffer(r[F.id]),delete r[F.id],delete s[F.id]}function P(){for(let I in r)i.deleteBuffer(r[I]);o=[],r={},s={}}return{bind:l,update:c,dispose:P}}var pxe=new Uint16Array([12469,15057,12620,14925,13266,14620,13807,14376,14323,13990,14545,13625,14713,13328,14840,12882,14931,12528,14996,12233,15039,11829,15066,11525,15080,11295,15085,10976,15082,10705,15073,10495,13880,14564,13898,14542,13977,14430,14158,14124,14393,13732,14556,13410,14702,12996,14814,12596,14891,12291,14937,11834,14957,11489,14958,11194,14943,10803,14921,10506,14893,10278,14858,9960,14484,14039,14487,14025,14499,13941,14524,13740,14574,13468,14654,13106,14743,12678,14818,12344,14867,11893,14889,11509,14893,11180,14881,10751,14852,10428,14812,10128,14765,9754,14712,9466,14764,13480,14764,13475,14766,13440,14766,13347,14769,13070,14786,12713,14816,12387,14844,11957,14860,11549,14868,11215,14855,10751,14825,10403,14782,10044,14729,9651,14666,9352,14599,9029,14967,12835,14966,12831,14963,12804,14954,12723,14936,12564,14917,12347,14900,11958,14886,11569,14878,11247,14859,10765,14828,10401,14784,10011,14727,9600,14660,9289,14586,8893,14508,8533,15111,12234,15110,12234,15104,12216,15092,12156,15067,12010,15028,11776,14981,11500,14942,11205,14902,10752,14861,10393,14812,9991,14752,9570,14682,9252,14603,8808,14519,8445,14431,8145,15209,11449,15208,11451,15202,11451,15190,11438,15163,11384,15117,11274,15055,10979,14994,10648,14932,10343,14871,9936,14803,9532,14729,9218,14645,8742,14556,8381,14461,8020,14365,7603,15273,10603,15272,10607,15267,10619,15256,10631,15231,10614,15182,10535,15118,10389,15042,10167,14963,9787,14883,9447,14800,9115,14710,8665,14615,8318,14514,7911,14411,7507,14279,7198,15314,9675,15313,9683,15309,9712,15298,9759,15277,9797,15229,9773,15166,9668,15084,9487,14995,9274,14898,8910,14800,8539,14697,8234,14590,7790,14479,7409,14367,7067,14178,6621,15337,8619,15337,8631,15333,8677,15325,8769,15305,8871,15264,8940,15202,8909,15119,8775,15022,8565,14916,8328,14804,8009,14688,7614,14569,7287,14448,6888,14321,6483,14088,6171,15350,7402,15350,7419,15347,7480,15340,7613,15322,7804,15287,7973,15229,8057,15148,8012,15046,7846,14933,7611,14810,7357,14682,7069,14552,6656,14421,6316,14251,5948,14007,5528,15356,5942,15356,5977,15353,6119,15348,6294,15332,6551,15302,6824,15249,7044,15171,7122,15070,7050,14949,6861,14818,6611,14679,6349,14538,6067,14398,5651,14189,5311,13935,4958,15359,4123,15359,4153,15356,4296,15353,4646,15338,5160,15311,5508,15263,5829,15188,6042,15088,6094,14966,6001,14826,5796,14678,5543,14527,5287,14377,4985,14133,4586,13869,4257,15360,1563,15360,1642,15358,2076,15354,2636,15341,3350,15317,4019,15273,4429,15203,4732,15105,4911,14981,4932,14836,4818,14679,4621,14517,4386,14359,4156,14083,3795,13808,3437,15360,122,15360,137,15358,285,15355,636,15344,1274,15322,2177,15281,2765,15215,3223,15120,3451,14995,3569,14846,3567,14681,3466,14511,3305,14344,3121,14037,2800,13753,2467,15360,0,15360,1,15359,21,15355,89,15346,253,15325,479,15287,796,15225,1148,15133,1492,15008,1749,14856,1882,14685,1886,14506,1783,14324,1608,13996,1398,13702,1183]),$h=null;function mxe(){return $h===null&&($h=new kA(pxe,16,16,js,Wi),$h.name="DFG_LUT",$h.minFilter=Mi,$h.magFilter=Mi,$h.wrapS=aa,$h.wrapT=aa,$h.generateMipmaps=!1,$h.needsUpdate=!0),$h}var UM=class{constructor(e={}){let{canvas:t=DM(),context:n=null,depth:r=!0,stencil:s=!1,alpha:o=!1,antialias:a=!1,premultipliedAlpha:l=!0,preserveDrawingBuffer:c=!1,powerPreference:u="default",failIfMajorPerformanceCaveat:f=!1,reversedDepthBuffer:d=!1,outputBufferType:A=Ji}=e;this.isWebGLRenderer=!0;let y;if(n!==null){if(typeof WebGLRenderingContext<"u"&&n instanceof WebGLRenderingContext)throw new Error("THREE.WebGLRenderer: WebGL 1 is not supported since r163.");y=n.getContextAttributes().alpha}else y=o;let w=A,S=new Set([d0,zh,kh]),T=new Set([Ji,xi,bl,ca,KA,QA]),R=new Uint32Array(4),P=new Int32Array(4),I=new re,F=null,D=null,L=[],C=[],B=null;this.domElement=t,this.debug={checkShaderErrors:!0,onShaderError:null},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this.toneMapping=ao,this.toneMappingExposure=1,this.transmissionResolutionScale=1;let k=this,z=!1,G=null,W=null,Y=null,H=null;this._outputColorSpace=Fr;let $=0,J=0,te=null,ce=-1,he=null,ve=new xn,Re=new xn,Qe=null,Fe=new zt(0),mt=0,Ee=t.width,Ve=t.height,Ye=1,Mt=null,Et=null,It=new xn(0,0,Ee,Ve),dn=new xn(0,0,Ee,Ve),Gt=!1,$e=new zc,ot=!1,nt=!1,bt=new cn,yt=new re,hn=new xn,tn={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0},nn=!1;function bn(){return te===null?Ye:1}let _e=n;function vi(ne,Se){return t.getContext(ne,Se)}try{let ne={alpha:!0,depth:r,stencil:s,antialias:a,premultipliedAlpha:l,preserveDrawingBuffer:c,powerPreference:u,failIfMajorPerformanceCaveat:f};if("setAttribute"in t&&t.setAttribute("data-engine",`three.js r${"185"}`),t.addEventListener("webglcontextlost",nr,!1),t.addEventListener("webglcontextrestored",Fn,!1),t.addEventListener("webglcontextcreationerror",is,!1),_e===null){let Se="webgl2";if(_e=vi(Se,ne),_e===null)throw vi(Se)?new Error("THREE.WebGLRenderer: Error creating WebGL context with your selected attributes."):new Error("THREE.WebGLRenderer: Error creating WebGL context.")}}catch(ne){throw ze("WebGLRenderer: "+ne.message),ne}let zn,le,Z,Te,Pe,Ge,vt,Tt,qe,Je,Pt,sn,Lt,Rt,fn,wn,Dn,ye,wt,Ze,St,Bt,ut;function Ce(){zn=new bve(_e),zn.init(),St=new lxe(_e,zn),le=new pve(_e,zn,e,St),Z=new oxe(_e,zn),le.reversedDepthBuffer&&d&&Z.buffers.depth.setReversed(!0),W=_e.createFramebuffer(),Y=_e.createFramebuffer(),H=_e.createFramebuffer(),Te=new Tve(_e),Pe=new j_e,Ge=new axe(_e,zn,Z,Pe,le,St,Te),vt=new yve(k),Tt=new RAe(_e),Bt=new fve(_e,Tt),qe=new wve(_e,Tt,Te,Bt),Je=new Mve(_e,qe,Tt,Bt,Te),ye=new Eve(_e,le,Ge),fn=new mve(Pe),Pt=new W_e(k,vt,zn,le,Bt,fn),sn=new fxe(k,Pe),Lt=new $_e,Rt=new exe(zn),Dn=new hve(k,vt,Z,Je,y,l),wn=new sxe(k,Je,le),ut=new dxe(_e,Te,le,Z),wt=new dve(_e,zn,Te),Ze=new Sve(_e,zn,Te),Te.programs=Pt.programs,k.capabilities=le,k.extensions=zn,k.properties=Pe,k.renderLists=Lt,k.shadowMap=wn,k.state=Z,k.info=Te}Ce(),w!==Ji&&(B=new Rve(w,t.width,t.height,a,r,s));let Yt=new xF(k,_e);this.xr=Yt,this.getContext=function(){return _e},this.getContextAttributes=function(){return _e.getContextAttributes()},this.forceContextLoss=function(){let ne=zn.get("WEBGL_lose_context");ne&&ne.loseContext()},this.forceContextRestore=function(){let ne=zn.get("WEBGL_lose_context");ne&&ne.restoreContext()},this.getPixelRatio=function(){return Ye},this.setPixelRatio=function(ne){ne!==void 0&&(Ye=ne,this.setSize(Ee,Ve,!1))},this.getSize=function(ne){return ne.set(Ee,Ve)},this.setSize=function(ne,Se,ke=!0){if(Yt.isPresenting){Xe("WebGLRenderer: Can't change size while VR device is presenting.");return}Ee=ne,Ve=Se,t.width=Math.floor(ne*Ye),t.height=Math.floor(Se*Ye),ke===!0&&(t.style.width=ne+"px",t.style.height=Se+"px"),B!==null&&B.setSize(t.width,t.height),this.setViewport(0,0,ne,Se)},this.getDrawingBufferSize=function(ne){return ne.set(Ee*Ye,Ve*Ye).floor()},this.setDrawingBufferSize=function(ne,Se,ke){Ee=ne,Ve=Se,Ye=ke,t.width=Math.floor(ne*ke),t.height=Math.floor(Se*ke),this.setViewport(0,0,ne,Se)},this.setEffects=function(ne){if(w===Ji){ze("WebGLRenderer: setEffects() requires outputBufferType set to HalfFloatType or FloatType.");return}if(ne){for(let Se=0;Se<ne.length;Se++)if(ne[Se].isOutputPass===!0){Xe("WebGLRenderer: OutputPass is not needed in setEffects(). Tone mapping and color space conversion are applied automatically.");break}}B.setEffects(ne||[])},this.getCurrentViewport=function(ne){return ne.copy(ve)},this.getViewport=function(ne){return ne.copy(It)},this.setViewport=function(ne,Se,ke,De){ne.isVector4?It.set(ne.x,ne.y,ne.z,ne.w):It.set(ne,Se,ke,De),Z.viewport(ve.copy(It).multiplyScalar(Ye).round())},this.getScissor=function(ne){return ne.copy(dn)},this.setScissor=function(ne,Se,ke,De){ne.isVector4?dn.set(ne.x,ne.y,ne.z,ne.w):dn.set(ne,Se,ke,De),Z.scissor(Re.copy(dn).multiplyScalar(Ye).round())},this.getScissorTest=function(){return Gt},this.setScissorTest=function(ne){Z.setScissorTest(Gt=ne)},this.setOpaqueSort=function(ne){Mt=ne},this.setTransparentSort=function(ne){Et=ne},this.getClearColor=function(ne){return ne.copy(Dn.getClearColor())},this.setClearColor=function(){Dn.setClearColor(...arguments)},this.getClearAlpha=function(){return Dn.getClearAlpha()},this.setClearAlpha=function(){Dn.setClearAlpha(...arguments)},this.clear=function(ne=!0,Se=!0,ke=!0){let De=0;if(ne){let Ne=!1;if(te!==null){let qt=te.texture.format;Ne=S.has(qt)}if(Ne){let qt=te.texture.type,Qt=T.has(qt),Vt=Dn.getClearColor(),on=Dn.getClearAlpha(),pn=Vt.r,Wn=Vt.g,Jn=Vt.b;Qt?(R[0]=pn,R[1]=Wn,R[2]=Jn,R[3]=on,_e.clearBufferuiv(_e.COLOR,0,R)):(P[0]=pn,P[1]=Wn,P[2]=Jn,P[3]=on,_e.clearBufferiv(_e.COLOR,0,P))}else De|=_e.COLOR_BUFFER_BIT}Se&&(De|=_e.DEPTH_BUFFER_BIT,this.state.buffers.depth.setMask(!0)),ke&&(De|=_e.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(4294967295)),De!==0&&_e.clear(De)},this.clearColor=function(){this.clear(!0,!1,!1)},this.clearDepth=function(){this.clear(!1,!0,!1)},this.clearStencil=function(){this.clear(!1,!1,!0)},this.setNodesHandler=function(ne){ne.setRenderer(this),G=ne},this.dispose=function(){t.removeEventListener("webglcontextlost",nr,!1),t.removeEventListener("webglcontextrestored",Fn,!1),t.removeEventListener("webglcontextcreationerror",is,!1),Dn.dispose(),Lt.dispose(),Rt.dispose(),Pe.dispose(),vt.dispose(),Je.dispose(),Bt.dispose(),ut.dispose(),Pt.dispose(),Yt.dispose(),Yt.removeEventListener("sessionstart",Ks),Yt.removeEventListener("sessionend",Bl),nh.stop()};function nr(ne){ne.preventDefault(),NA("WebGLRenderer: Context Lost."),z=!0}function Fn(){NA("WebGLRenderer: Context Restored."),z=!1;let ne=Te.autoReset,Se=wn.enabled,ke=wn.autoUpdate,De=wn.needsUpdate,Ne=wn.type;Ce(),Te.autoReset=ne,wn.enabled=Se,wn.autoUpdate=ke,wn.needsUpdate=De,wn.type=Ne}function is(ne){ze("WebGLRenderer: A WebGL context could not be created. Reason: ",ne.statusMessage)}function Pr(ne){let Se=ne.target;Se.removeEventListener("dispose",Pr),Nl(Se)}function Nl(ne){wa(ne),Pe.remove(ne)}function wa(ne){let Se=Pe.get(ne).programs;Se!==void 0&&(Se.forEach(function(ke){Pt.releaseProgram(ke)}),ne.isShaderMaterial&&Pt.releaseShaderCache(ne))}this.renderBufferDirect=function(ne,Se,ke,De,Ne,qt){Se===null&&(Se=tn);let Qt=Ne.isMesh&&Ne.matrixWorld.determinantAffine()<0,Vt=wG(ne,Se,ke,De,Ne);Z.setMaterial(De,Qt);let on=ke.index,pn=1;if(De.wireframe===!0){if(on=qe.getWireframeAttribute(ke),on===void 0)return;pn=2}let Wn=ke.drawRange,Jn=ke.attributes.position,gn=Wn.start*pn,Yi=(Wn.start+Wn.count)*pn;qt!==null&&(gn=Math.max(gn,qt.start*pn),Yi=Math.min(Yi,(qt.start+qt.count)*pn)),on!==null?(gn=Math.max(gn,0),Yi=Math.min(Yi,on.count)):Jn!=null&&(gn=Math.max(gn,0),Yi=Math.min(Yi,Jn.count));let rs=Yi-gn;if(rs<0||rs===1/0)return;Bt.setup(Ne,De,Vt,ke,on);let qr,ir=wt;if(on!==null&&(qr=Tt.get(on),ir=Ze,ir.setIndex(qr)),Ne.isMesh)De.wireframe===!0?(Z.setLineWidth(De.wireframeLinewidth*bn()),ir.setMode(_e.LINES)):ir.setMode(_e.TRIANGLES);else if(Ne.isLine){let Co=De.linewidth;Co===void 0&&(Co=1),Z.setLineWidth(Co*bn()),Ne.isLineSegments?ir.setMode(_e.LINES):Ne.isLineLoop?ir.setMode(_e.LINE_LOOP):ir.setMode(_e.LINE_STRIP)}else Ne.isPoints?ir.setMode(_e.POINTS):Ne.isSprite&&ir.setMode(_e.TRIANGLES);if(Ne.isBatchedMesh)if(zn.get("WEBGL_multi_draw"))ir.renderMultiDraw(Ne._multiDrawStarts,Ne._multiDrawCounts,Ne._multiDrawCount);else{let Co=Ne._multiDrawStarts,Zt=Ne._multiDrawCounts,rl=Ne._multiDrawCount,yi=on?Tt.get(on).bytesPerElement:1,Ol=Pe.get(De).currentProgram.getUniforms();for(let lu=0;lu<rl;lu++)Ol.setValue(_e,"_gl_DrawID",lu),ir.render(Co[lu]/yi,Zt[lu])}else if(Ne.isInstancedMesh)ir.renderInstances(gn,rs,Ne.count);else if(ke.isInstancedBufferGeometry){let Co=ke._maxInstanceCount!==void 0?ke._maxInstanceCount:1/0,Zt=Math.min(ke.instanceCount,Co);ir.renderInstances(gn,rs,Zt)}else ir.render(gn,rs)};function Fl(ne,Se,ke){ne.transparent===!0&&ne.side===gr&&ne.forceSinglePass===!1?(ne.side=mi,ne.needsUpdate=!0,Bx(ne,Se,ke),ne.side=ko,ne.needsUpdate=!0,Bx(ne,Se,ke),ne.side=gr):Bx(ne,Se,ke)}this.compile=function(ne,Se,ke=null){ke===null&&(ke=ne),D=Rt.get(ke),D.init(Se),C.push(D),ke.traverseVisible(function(Ne){Ne.isLight&&Ne.layers.test(Se.layers)&&(D.pushLight(Ne),Ne.castShadow&&D.pushShadow(Ne))}),ne!==ke&&ne.traverseVisible(function(Ne){Ne.isLight&&Ne.layers.test(Se.layers)&&(D.pushLight(Ne),Ne.castShadow&&D.pushShadow(Ne))}),D.setupLights();let De=new Set;return ne.traverse(function(Ne){if(!(Ne.isMesh||Ne.isPoints||Ne.isLine||Ne.isSprite))return;let qt=Ne.material;if(qt)if(Array.isArray(qt))for(let Qt=0;Qt<qt.length;Qt++){let Vt=qt[Qt];Fl(Vt,ke,Ne),De.add(Vt)}else Fl(qt,ke,Ne),De.add(qt)}),D=C.pop(),De},this.compileAsync=function(ne,Se,ke=null){let De=this.compile(ne,Se,ke);return new Promise(Ne=>{function qt(){if(De.forEach(function(Qt){Pe.get(Qt).currentProgram.isReady()&&De.delete(Qt)}),De.size===0){Ne(ne);return}setTimeout(qt,10)}zn.get("KHR_parallel_shader_compile")!==null?qt():setTimeout(qt,10)})};let il=null;function _r(ne){il&&il(ne)}function Ks(){nh.stop()}function Bl(){nh.start()}let nh=new NZ;nh.setAnimationLoop(_r),typeof self<"u"&&nh.setContext(self),this.setAnimationLoop=function(ne){il=ne,Yt.setAnimationLoop(ne),ne===null?nh.stop():nh.start()},Yt.addEventListener("sessionstart",Ks),Yt.addEventListener("sessionend",Bl),this.render=function(ne,Se){if(Se!==void 0&&Se.isCamera!==!0){ze("WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(z===!0)return;G!==null&&G.renderStart(ne,Se);let ke=Yt.enabled===!0&&Yt.isPresenting===!0,De=B!==null&&(te===null||ke)&&B.begin(k,te);if(ne.matrixWorldAutoUpdate===!0&&ne.updateMatrixWorld(),Se.parent===null&&Se.matrixWorldAutoUpdate===!0&&Se.updateMatrixWorld(),Yt.enabled===!0&&Yt.isPresenting===!0&&(B===null||B.isCompositing()===!1)&&(Yt.cameraAutoUpdate===!0&&Yt.updateCamera(Se),Se=Yt.getCamera()),ne.isScene===!0&&ne.onBeforeRender(k,ne,Se,te),D=Rt.get(ne,C.length),D.init(Se),D.state.textureUnits=Ge.getTextureUnits(),C.push(D),bt.multiplyMatrices(Se.projectionMatrix,Se.matrixWorldInverse),$e.setFromProjectionMatrix(bt,Uo,Se.reversedDepth),nt=this.localClippingEnabled,ot=fn.init(this.clippingPlanes,nt),F=Lt.get(ne,L.length),F.init(),L.push(F),Yt.enabled===!0&&Yt.isPresenting===!0){let Qt=k.xr.getDepthSensingMesh();Qt!==null&&YS(Qt,Se,-1/0,k.sortObjects)}YS(ne,Se,0,k.sortObjects),F.finish(),k.sortObjects===!0&&F.sort(Mt,Et,Se.reversedDepth),nn=Yt.enabled===!1||Yt.isPresenting===!1||Yt.hasDepthSensing()===!1,nn&&Dn.addToRenderList(F,ne),this.info.render.frame++,this.info.autoReset===!0&&this.info.reset(),ot===!0&&fn.beginShadows();let Ne=D.state.shadowsArray;if(wn.render(Ne,ne,Se),ot===!0&&fn.endShadows(),(De&&B.hasRenderPass())===!1){let Qt=F.opaque,Vt=F.transmissive;if(D.setupLights(),Se.isArrayCamera){let on=Se.cameras;if(Vt.length>0)for(let pn=0,Wn=on.length;pn<Wn;pn++){let Jn=on[pn];VP(Qt,Vt,ne,Jn)}nn&&Dn.render(ne);for(let pn=0,Wn=on.length;pn<Wn;pn++){let Jn=on[pn];zP(F,ne,Jn,Jn.viewport)}}else Vt.length>0&&VP(Qt,Vt,ne,Se),nn&&Dn.render(ne),zP(F,ne,Se)}te!==null&&J===0&&(Ge.updateMultisampleRenderTarget(te),Ge.updateRenderTargetMipmap(te)),De&&B.end(k),ne.isScene===!0&&ne.onAfterRender(k,ne,Se),Bt.resetDefaultState(),ce=-1,he=null,C.pop(),C.length>0?(D=C[C.length-1],Ge.setTextureUnits(D.state.textureUnits),ot===!0&&fn.setGlobalState(k.clippingPlanes,D.state.camera)):D=null,L.pop(),L.length>0?F=L[L.length-1]:F=null,G!==null&&G.renderEnd()};function YS(ne,Se,ke,De){if(ne.visible===!1)return;if(ne.layers.test(Se.layers)){if(ne.isGroup)ke=ne.renderOrder;else if(ne.isLOD)ne.autoUpdate===!0&&ne.update(Se);else if(ne.isLightProbeGrid)D.pushLightProbeGrid(ne);else if(ne.isLight)D.pushLight(ne),ne.castShadow&&D.pushShadow(ne);else if(ne.isSprite){if(!ne.frustumCulled||$e.intersectsSprite(ne)){De&&hn.setFromMatrixPosition(ne.matrixWorld).applyMatrix4(bt);let Qt=Je.update(ne),Vt=ne.material;Vt.visible&&F.push(ne,Qt,Vt,ke,hn.z,null)}}else if((ne.isMesh||ne.isLine||ne.isPoints)&&(!ne.frustumCulled||$e.intersectsObject(ne))){let Qt=Je.update(ne),Vt=ne.material;if(De&&(ne.boundingSphere!==void 0?(ne.boundingSphere===null&&ne.computeBoundingSphere(),hn.copy(ne.boundingSphere.center)):(Qt.boundingSphere===null&&Qt.computeBoundingSphere(),hn.copy(Qt.boundingSphere.center)),hn.applyMatrix4(ne.matrixWorld).applyMatrix4(bt)),Array.isArray(Vt)){let on=Qt.groups;for(let pn=0,Wn=on.length;pn<Wn;pn++){let Jn=on[pn],gn=Vt[Jn.materialIndex];gn&&gn.visible&&F.push(ne,Qt,gn,ke,hn.z,Jn)}}else Vt.visible&&F.push(ne,Qt,Vt,ke,hn.z,null)}}let qt=ne.children;for(let Qt=0,Vt=qt.length;Qt<Vt;Qt++)YS(qt[Qt],Se,ke,De)}function zP(ne,Se,ke,De){let{opaque:Ne,transmissive:qt,transparent:Qt}=ne;D.setupLightsView(ke),ot===!0&&fn.setGlobalState(k.clippingPlanes,ke),De&&Z.viewport(ve.copy(De)),Ne.length>0&&Fx(Ne,Se,ke),qt.length>0&&Fx(qt,Se,ke),Qt.length>0&&Fx(Qt,Se,ke),Z.buffers.depth.setTest(!0),Z.buffers.depth.setMask(!0),Z.buffers.color.setMask(!0),Z.setPolygonOffset(!1)}function VP(ne,Se,ke,De){if((ke.isScene===!0?ke.overrideMaterial:null)!==null)return;if(D.state.transmissionRenderTarget[De.id]===void 0){let gn=zn.has("EXT_color_buffer_half_float")||zn.has("EXT_color_buffer_float");D.state.transmissionRenderTarget[De.id]=new Ba(1,1,{generateMipmaps:!0,type:gn?Wi:Ji,minFilter:Vo,samples:Math.max(4,le.samples),stencilBuffer:s,resolveDepthBuffer:!1,resolveStencilBuffer:!1,colorSpace:ln.workingColorSpace})}let qt=D.state.transmissionRenderTarget[De.id],Qt=De.viewport||ve;qt.setSize(Qt.z*k.transmissionResolutionScale,Qt.w*k.transmissionResolutionScale);let Vt=k.getRenderTarget(),on=k.getActiveCubeFace(),pn=k.getActiveMipmapLevel();k.setRenderTarget(qt),k.getClearColor(Fe),mt=k.getClearAlpha(),mt<1&&k.setClearColor(16777215,.5),k.clear(),nn&&Dn.render(ke);let Wn=k.toneMapping;k.toneMapping=ao;let Jn=De.viewport;if(De.viewport!==void 0&&(De.viewport=void 0),D.setupLightsView(De),ot===!0&&fn.setGlobalState(k.clippingPlanes,De),Fx(ne,ke,De),Ge.updateMultisampleRenderTarget(qt),Ge.updateRenderTargetMipmap(qt),zn.has("WEBGL_multisampled_render_to_texture")===!1){let gn=!1;for(let Yi=0,rs=Se.length;Yi<rs;Yi++){let qr=Se[Yi],{object:ir,geometry:Co,material:Zt,group:rl}=qr;if(Zt.side===gr&&ir.layers.test(De.layers)){let yi=Zt.side;Zt.side=mi,Zt.needsUpdate=!0,GP(ir,ke,De,Co,Zt,rl),Zt.side=yi,Zt.needsUpdate=!0,gn=!0}}gn===!0&&(Ge.updateMultisampleRenderTarget(qt),Ge.updateRenderTargetMipmap(qt))}k.setRenderTarget(Vt,on,pn),k.setClearColor(Fe,mt),Jn!==void 0&&(De.viewport=Jn),k.toneMapping=Wn}function Fx(ne,Se,ke){let De=Se.isScene===!0?Se.overrideMaterial:null;for(let Ne=0,qt=ne.length;Ne<qt;Ne++){let Qt=ne[Ne],{object:Vt,geometry:on,group:pn}=Qt,Wn=Qt.material;Wn.allowOverride===!0&&De!==null&&(Wn=De),Vt.layers.test(ke.layers)&&GP(Vt,Se,ke,on,Wn,pn)}}function GP(ne,Se,ke,De,Ne,qt){ne.onBeforeRender(k,Se,ke,De,Ne,qt),ne.modelViewMatrix.multiplyMatrices(ke.matrixWorldInverse,ne.matrixWorld),ne.normalMatrix.getNormalMatrix(ne.modelViewMatrix),Ne.onBeforeRender(k,Se,ke,De,ne,qt),Ne.transparent===!0&&Ne.side===gr&&Ne.forceSinglePass===!1?(Ne.side=mi,Ne.needsUpdate=!0,k.renderBufferDirect(ke,Se,De,Ne,ne,qt),Ne.side=ko,Ne.needsUpdate=!0,k.renderBufferDirect(ke,Se,De,Ne,ne,qt),Ne.side=gr):k.renderBufferDirect(ke,Se,De,Ne,ne,qt),ne.onAfterRender(k,Se,ke,De,Ne,qt)}function Bx(ne,Se,ke){Se.isScene!==!0&&(Se=tn);let De=Pe.get(ne),Ne=D.state.lights,qt=D.state.shadowsArray,Qt=Ne.state.version,Vt=Pt.getParameters(ne,Ne.state,qt,Se,ke,D.state.lightProbeGridArray),on=Pt.getProgramCacheKey(Vt),pn=De.programs;De.environment=ne.isMeshStandardMaterial||ne.isMeshLambertMaterial||ne.isMeshPhongMaterial?Se.environment:null,De.fog=Se.fog;let Wn=ne.isMeshStandardMaterial||ne.isMeshLambertMaterial&&!ne.envMap||ne.isMeshPhongMaterial&&!ne.envMap;De.envMap=vt.get(ne.envMap||De.environment,Wn),De.envMapRotation=De.environment!==null&&ne.envMap===null?Se.environmentRotation:ne.envMapRotation,pn===void 0&&(ne.addEventListener("dispose",Pr),pn=new Map,De.programs=pn);let Jn=pn.get(on);if(Jn!==void 0){if(De.currentProgram===Jn&&De.lightsStateVersion===Qt)return HP(ne,Vt),Jn}else Vt.uniforms=Pt.getUniforms(ne),G!==null&&ne.isNodeMaterial&&G.build(ne,ke,Vt),ne.onBeforeCompile(Vt,k),Jn=Pt.acquireProgram(Vt,on),pn.set(on,Jn),De.uniforms=Vt.uniforms;let gn=De.uniforms;return(!ne.isShaderMaterial&&!ne.isRawShaderMaterial||ne.clipping===!0)&&(gn.clippingPlanes=fn.uniform),HP(ne,Vt),De.needsLights=TG(ne),De.lightsStateVersion=Qt,De.needsLights&&(gn.ambientLightColor.value=Ne.state.ambient,gn.lightProbe.value=Ne.state.probe,gn.directionalLights.value=Ne.state.directional,gn.directionalLightShadows.value=Ne.state.directionalShadow,gn.spotLights.value=Ne.state.spot,gn.spotLightShadows.value=Ne.state.spotShadow,gn.rectAreaLights.value=Ne.state.rectArea,gn.ltc_1.value=Ne.state.rectAreaLTC1,gn.ltc_2.value=Ne.state.rectAreaLTC2,gn.pointLights.value=Ne.state.point,gn.pointLightShadows.value=Ne.state.pointShadow,gn.hemisphereLights.value=Ne.state.hemi,gn.directionalShadowMatrix.value=Ne.state.directionalShadowMatrix,gn.spotLightMatrix.value=Ne.state.spotLightMatrix,gn.spotLightMap.value=Ne.state.spotLightMap,gn.pointShadowMatrix.value=Ne.state.pointShadowMatrix),De.lightProbeGrid=D.state.lightProbeGridArray.length>0,De.currentProgram=Jn,De.uniformsList=null,Jn}function qP(ne){if(ne.uniformsList===null){let Se=ne.currentProgram.getUniforms();ne.uniformsList=l_.seqWithValue(Se.seq,ne.uniforms)}return ne.uniformsList}function HP(ne,Se){let ke=Pe.get(ne);ke.outputColorSpace=Se.outputColorSpace,ke.batching=Se.batching,ke.batchingColor=Se.batchingColor,ke.instancing=Se.instancing,ke.instancingColor=Se.instancingColor,ke.instancingMorph=Se.instancingMorph,ke.skinning=Se.skinning,ke.morphTargets=Se.morphTargets,ke.morphNormals=Se.morphNormals,ke.morphColors=Se.morphColors,ke.morphTargetsCount=Se.morphTargetsCount,ke.numClippingPlanes=Se.numClippingPlanes,ke.numIntersection=Se.numClipIntersection,ke.vertexAlphas=Se.vertexAlphas,ke.vertexTangents=Se.vertexTangents,ke.toneMapping=Se.toneMapping}function bG(ne,Se){if(ne.length===0)return null;if(ne.length===1)return ne[0].texture!==null?ne[0]:null;I.setFromMatrixPosition(Se.matrixWorld);for(let ke=0,De=ne.length;ke<De;ke++){let Ne=ne[ke];if(Ne.texture!==null&&Ne.boundingBox.containsPoint(I))return Ne}return null}function wG(ne,Se,ke,De,Ne){Se.isScene!==!0&&(Se=tn),Ge.resetTextureUnits();let qt=Se.fog,Qt=De.isMeshStandardMaterial||De.isMeshLambertMaterial||De.isMeshPhongMaterial?Se.environment:null,Vt=te===null?k.outputColorSpace:te.isXRRenderTarget===!0?te.texture.colorSpace:ln.workingColorSpace,on=De.isMeshStandardMaterial||De.isMeshLambertMaterial&&!De.envMap||De.isMeshPhongMaterial&&!De.envMap,pn=vt.get(De.envMap||Qt,on),Wn=De.vertexColors===!0&&!!ke.attributes.color&&ke.attributes.color.itemSize===4,Jn=!!ke.attributes.tangent&&(!!De.normalMap||De.anisotropy>0),gn=!!ke.morphAttributes.position,Yi=!!ke.morphAttributes.normal,rs=!!ke.morphAttributes.color,qr=ao;De.toneMapped&&(te===null||te.isXRRenderTarget===!0)&&(qr=k.toneMapping);let ir=ke.morphAttributes.position||ke.morphAttributes.normal||ke.morphAttributes.color,Co=ir!==void 0?ir.length:0,Zt=Pe.get(De),rl=D.state.lights;if(ot===!0&&(nt===!0||ne!==he)){let pr=ne===he&&De.id===ce;fn.setState(De,ne,pr)}let yi=!1;De.version===Zt.__version?(Zt.needsLights&&Zt.lightsStateVersion!==rl.state.version||Zt.outputColorSpace!==Vt||Ne.isBatchedMesh&&Zt.batching===!1||!Ne.isBatchedMesh&&Zt.batching===!0||Ne.isBatchedMesh&&Zt.batchingColor===!0&&Ne.colorTexture===null||Ne.isBatchedMesh&&Zt.batchingColor===!1&&Ne.colorTexture!==null||Ne.isInstancedMesh&&Zt.instancing===!1||!Ne.isInstancedMesh&&Zt.instancing===!0||Ne.isSkinnedMesh&&Zt.skinning===!1||!Ne.isSkinnedMesh&&Zt.skinning===!0||Ne.isInstancedMesh&&Zt.instancingColor===!0&&Ne.instanceColor===null||Ne.isInstancedMesh&&Zt.instancingColor===!1&&Ne.instanceColor!==null||Ne.isInstancedMesh&&Zt.instancingMorph===!0&&Ne.morphTexture===null||Ne.isInstancedMesh&&Zt.instancingMorph===!1&&Ne.morphTexture!==null||Zt.envMap!==pn||De.fog===!0&&Zt.fog!==qt||Zt.numClippingPlanes!==void 0&&(Zt.numClippingPlanes!==fn.numPlanes||Zt.numIntersection!==fn.numIntersection)||Zt.vertexAlphas!==Wn||Zt.vertexTangents!==Jn||Zt.morphTargets!==gn||Zt.morphNormals!==Yi||Zt.morphColors!==rs||Zt.toneMapping!==qr||Zt.morphTargetsCount!==Co||!!Zt.lightProbeGrid!=D.state.lightProbeGridArray.length>0)&&(yi=!0):(yi=!0,Zt.__version=De.version);let Ol=Zt.currentProgram;yi===!0&&(Ol=Bx(De,Se,Ne),G&&De.isNodeMaterial&&G.onUpdateProgram(De,Ol,Zt));let lu=!1,Uf=!1,Lm=!1,rr=Ol.getUniforms(),ss=Zt.uniforms;if(Z.useProgram(Ol.program)&&(lu=!0,Uf=!0,Lm=!0),De.id!==ce&&(ce=De.id,Uf=!0),Zt.needsLights){let pr=bG(D.state.lightProbeGridArray,Ne);Zt.lightProbeGrid!==pr&&(Zt.lightProbeGrid=pr,Uf=!0)}if(lu||he!==ne){Z.buffers.depth.getReversed()&&ne.reversedDepth!==!0&&(ne._reversedDepth=!0,ne.updateProjectionMatrix()),rr.setValue(_e,"projectionMatrix",ne.projectionMatrix),rr.setValue(_e,"viewMatrix",ne.matrixWorldInverse);let zf=rr.map.cameraPosition;zf!==void 0&&zf.setValue(_e,yt.setFromMatrixPosition(ne.matrixWorld)),le.logarithmicDepthBuffer&&rr.setValue(_e,"logDepthBufFC",2/(Math.log(ne.far+1)/Math.LN2)),(De.isMeshPhongMaterial||De.isMeshToonMaterial||De.isMeshLambertMaterial||De.isMeshBasicMaterial||De.isMeshStandardMaterial||De.isShaderMaterial)&&rr.setValue(_e,"isOrthographic",ne.isOrthographicCamera===!0),he!==ne&&(he=ne,Uf=!0,Lm=!0)}if(Zt.needsLights&&(rl.state.directionalShadowMap.length>0&&rr.setValue(_e,"directionalShadowMap",rl.state.directionalShadowMap,Ge),rl.state.spotShadowMap.length>0&&rr.setValue(_e,"spotShadowMap",rl.state.spotShadowMap,Ge),rl.state.pointShadowMap.length>0&&rr.setValue(_e,"pointShadowMap",rl.state.pointShadowMap,Ge)),Ne.isSkinnedMesh){rr.setOptional(_e,Ne,"bindMatrix"),rr.setOptional(_e,Ne,"bindMatrixInverse");let pr=Ne.skeleton;pr&&(pr.boneTexture===null&&pr.computeBoneTexture(),rr.setValue(_e,"boneTexture",pr.boneTexture,Ge))}Ne.isBatchedMesh&&(rr.setOptional(_e,Ne,"batchingTexture"),rr.setValue(_e,"batchingTexture",Ne._matricesTexture,Ge),rr.setOptional(_e,Ne,"batchingIdTexture"),rr.setValue(_e,"batchingIdTexture",Ne._indirectTexture,Ge),rr.setOptional(_e,Ne,"batchingColorTexture"),Ne._colorsTexture!==null&&rr.setValue(_e,"batchingColorTexture",Ne._colorsTexture,Ge));let kf=ke.morphAttributes;if((kf.position!==void 0||kf.normal!==void 0||kf.color!==void 0)&&ye.update(Ne,ke,Ol),(Uf||Zt.receiveShadow!==Ne.receiveShadow)&&(Zt.receiveShadow=Ne.receiveShadow,rr.setValue(_e,"receiveShadow",Ne.receiveShadow)),(De.isMeshStandardMaterial||De.isMeshLambertMaterial||De.isMeshPhongMaterial)&&De.envMap===null&&Se.environment!==null&&(ss.envMapIntensity.value=Se.environmentIntensity),ss.dfgLUT!==void 0&&(ss.dfgLUT.value=mxe()),Uf){if(rr.setValue(_e,"toneMappingExposure",k.toneMappingExposure),Zt.needsLights&&SG(ss,Lm),qt&&De.fog===!0&&sn.refreshFogUniforms(ss,qt),sn.refreshMaterialUniforms(ss,De,Ye,Ve,D.state.transmissionRenderTarget[ne.id]),Zt.needsLights&&Zt.lightProbeGrid){let pr=Zt.lightProbeGrid;ss.probesSH.value=pr.texture,ss.probesMin.value.copy(pr.boundingBox.min),ss.probesMax.value.copy(pr.boundingBox.max),ss.probesResolution.value.copy(pr.resolution)}l_.upload(_e,qP(Zt),ss,Ge)}if(De.isShaderMaterial&&De.uniformsNeedUpdate===!0&&(l_.upload(_e,qP(Zt),ss,Ge),De.uniformsNeedUpdate=!1),De.isSpriteMaterial&&rr.setValue(_e,"center",Ne.center),rr.setValue(_e,"modelViewMatrix",Ne.modelViewMatrix),rr.setValue(_e,"normalMatrix",Ne.normalMatrix),rr.setValue(_e,"modelMatrix",Ne.matrixWorld),De.uniformsGroups!==void 0){let pr=De.uniformsGroups;for(let zf=0,Dm=pr.length;zf<Dm;zf++){let WP=pr[zf];ut.update(WP,Ol),ut.bind(WP,Ol)}}return Ol}function SG(ne,Se){ne.ambientLightColor.needsUpdate=Se,ne.lightProbe.needsUpdate=Se,ne.directionalLights.needsUpdate=Se,ne.directionalLightShadows.needsUpdate=Se,ne.pointLights.needsUpdate=Se,ne.pointLightShadows.needsUpdate=Se,ne.spotLights.needsUpdate=Se,ne.spotLightShadows.needsUpdate=Se,ne.rectAreaLights.needsUpdate=Se,ne.hemisphereLights.needsUpdate=Se}function TG(ne){return ne.isMeshLambertMaterial||ne.isMeshToonMaterial||ne.isMeshPhongMaterial||ne.isMeshStandardMaterial||ne.isShadowMaterial||ne.isShaderMaterial&&ne.lights===!0}this.getActiveCubeFace=function(){return $},this.getActiveMipmapLevel=function(){return J},this.getRenderTarget=function(){return te},this.setRenderTargetTextures=function(ne,Se,ke){let De=Pe.get(ne);De.__autoAllocateDepthBuffer=ne.resolveDepthBuffer===!1,De.__autoAllocateDepthBuffer===!1&&(De.__useRenderToTexture=!1),Pe.get(ne.texture).__webglTexture=Se,Pe.get(ne.depthTexture).__webglTexture=De.__autoAllocateDepthBuffer?void 0:ke,De.__hasExternalTextures=!0},this.setRenderTargetFramebuffer=function(ne,Se){let ke=Pe.get(ne);ke.__webglFramebuffer=Se,ke.__useDefaultFramebuffer=Se===void 0},this.setRenderTarget=function(ne,Se=0,ke=0){te=ne,$=Se,J=ke;let De=null,Ne=!1,qt=!1;if(ne){let Vt=Pe.get(ne);if(Vt.__useDefaultFramebuffer!==void 0){Z.bindFramebuffer(_e.FRAMEBUFFER,Vt.__webglFramebuffer),ve.copy(ne.viewport),Re.copy(ne.scissor),Qe=ne.scissorTest,Z.viewport(ve),Z.scissor(Re),Z.setScissorTest(Qe),ce=-1;return}else if(Vt.__webglFramebuffer===void 0)Ge.setupRenderTarget(ne);else if(Vt.__hasExternalTextures)Ge.rebindTextures(ne,Pe.get(ne.texture).__webglTexture,Pe.get(ne.depthTexture).__webglTexture);else if(ne.depthBuffer){let Wn=ne.depthTexture;if(Vt.__boundDepthTexture!==Wn){if(Wn!==null&&Pe.has(Wn)&&(ne.width!==Wn.image.width||ne.height!==Wn.image.height))throw new Error("THREE.WebGLRenderer: Attached DepthTexture is initialized to the incorrect size.");Ge.setupDepthRenderbuffer(ne)}}let on=ne.texture;(on.isData3DTexture||on.isDataArrayTexture||on.isCompressedArrayTexture)&&(qt=!0);let pn=Pe.get(ne).__webglFramebuffer;ne.isWebGLCubeRenderTarget?(Array.isArray(pn[Se])?De=pn[Se][ke]:De=pn[Se],Ne=!0):ne.samples>0&&Ge.useMultisampledRTT(ne)===!1?De=Pe.get(ne).__webglMultisampledFramebuffer:Array.isArray(pn)?De=pn[ke]:De=pn,ve.copy(ne.viewport),Re.copy(ne.scissor),Qe=ne.scissorTest}else ve.copy(It).multiplyScalar(Ye).floor(),Re.copy(dn).multiplyScalar(Ye).floor(),Qe=Gt;if(ke!==0&&(De=W),Z.bindFramebuffer(_e.FRAMEBUFFER,De)&&Z.drawBuffers(ne,De),Z.viewport(ve),Z.scissor(Re),Z.setScissorTest(Qe),Ne){let Vt=Pe.get(ne.texture);_e.framebufferTexture2D(_e.FRAMEBUFFER,_e.COLOR_ATTACHMENT0,_e.TEXTURE_CUBE_MAP_POSITIVE_X+Se,Vt.__webglTexture,ke)}else if(qt){let Vt=Se;for(let on=0;on<ne.textures.length;on++){let pn=Pe.get(ne.textures[on]);_e.framebufferTextureLayer(_e.FRAMEBUFFER,_e.COLOR_ATTACHMENT0+on,pn.__webglTexture,ke,Vt)}}else if(ne!==null&&ke!==0){let Vt=Pe.get(ne.texture);_e.framebufferTexture2D(_e.FRAMEBUFFER,_e.COLOR_ATTACHMENT0,_e.TEXTURE_2D,Vt.__webglTexture,ke)}ce=-1},this.readRenderTargetPixels=function(ne,Se,ke,De,Ne,qt,Qt,Vt=0){if(!(ne&&ne.isWebGLRenderTarget)){ze("WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let on=Pe.get(ne).__webglFramebuffer;if(ne.isWebGLCubeRenderTarget&&Qt!==void 0&&(on=on[Qt]),on){Z.bindFramebuffer(_e.FRAMEBUFFER,on);try{let pn=ne.textures[Vt],Wn=pn.format,Jn=pn.type;if(ne.textures.length>1&&_e.readBuffer(_e.COLOR_ATTACHMENT0+Vt),!le.textureFormatReadable(Wn)){ze("WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}if(!le.textureTypeReadable(Jn)){ze("WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}Se>=0&&Se<=ne.width-De&&ke>=0&&ke<=ne.height-Ne&&_e.readPixels(Se,ke,De,Ne,St.convert(Wn),St.convert(Jn),qt)}finally{let pn=te!==null?Pe.get(te).__webglFramebuffer:null;Z.bindFramebuffer(_e.FRAMEBUFFER,pn)}}},this.readRenderTargetPixelsAsync=async function(ne,Se,ke,De,Ne,qt,Qt,Vt=0){if(!(ne&&ne.isWebGLRenderTarget))throw new Error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let on=Pe.get(ne).__webglFramebuffer;if(ne.isWebGLCubeRenderTarget&&Qt!==void 0&&(on=on[Qt]),on)if(Se>=0&&Se<=ne.width-De&&ke>=0&&ke<=ne.height-Ne){Z.bindFramebuffer(_e.FRAMEBUFFER,on);let pn=ne.textures[Vt],Wn=pn.format,Jn=pn.type;if(ne.textures.length>1&&_e.readBuffer(_e.COLOR_ATTACHMENT0+Vt),!le.textureFormatReadable(Wn))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.");if(!le.textureTypeReadable(Jn))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type.");let gn=_e.createBuffer();_e.bindBuffer(_e.PIXEL_PACK_BUFFER,gn),_e.bufferData(_e.PIXEL_PACK_BUFFER,qt.byteLength,_e.STREAM_READ),_e.readPixels(Se,ke,De,Ne,St.convert(Wn),St.convert(Jn),0);let Yi=te!==null?Pe.get(te).__webglFramebuffer:null;Z.bindFramebuffer(_e.FRAMEBUFFER,Yi);let rs=_e.fenceSync(_e.SYNC_GPU_COMMANDS_COMPLETE,0);return _e.flush(),await iZ(_e,rs,4),_e.bindBuffer(_e.PIXEL_PACK_BUFFER,gn),_e.getBufferSubData(_e.PIXEL_PACK_BUFFER,0,qt),_e.deleteBuffer(gn),_e.deleteSync(rs),qt}else throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: requested read bounds are out of range.")},this.copyFramebufferToTexture=function(ne,Se=null,ke=0){let De=Math.pow(2,-ke),Ne=Math.floor(ne.image.width*De),qt=Math.floor(ne.image.height*De),Qt=Se!==null?Se.x:0,Vt=Se!==null?Se.y:0;Ge.setTexture2D(ne,0),_e.copyTexSubImage2D(_e.TEXTURE_2D,ke,0,0,Qt,Vt,Ne,qt),Z.unbindTexture()},this.copyTextureToTexture=function(ne,Se,ke=null,De=null,Ne=0,qt=0){let Qt,Vt,on,pn,Wn,Jn,gn,Yi,rs,qr=ne.isCompressedTexture?ne.mipmaps[qt]:ne.image;if(ke!==null)Qt=ke.max.x-ke.min.x,Vt=ke.max.y-ke.min.y,on=ke.isBox3?ke.max.z-ke.min.z:1,pn=ke.min.x,Wn=ke.min.y,Jn=ke.isBox3?ke.min.z:0;else{let ss=Math.pow(2,-Ne);Qt=Math.floor(qr.width*ss),Vt=Math.floor(qr.height*ss),ne.isDataArrayTexture?on=qr.depth:ne.isData3DTexture?on=Math.floor(qr.depth*ss):on=1,pn=0,Wn=0,Jn=0}De!==null?(gn=De.x,Yi=De.y,rs=De.z):(gn=0,Yi=0,rs=0);let ir=St.convert(Se.format),Co=St.convert(Se.type),Zt;Se.isData3DTexture?(Ge.setTexture3D(Se,0),Zt=_e.TEXTURE_3D):Se.isDataArrayTexture||Se.isCompressedArrayTexture?(Ge.setTexture2DArray(Se,0),Zt=_e.TEXTURE_2D_ARRAY):(Ge.setTexture2D(Se,0),Zt=_e.TEXTURE_2D),Z.activeTexture(_e.TEXTURE0),Z.pixelStorei(_e.UNPACK_FLIP_Y_WEBGL,Se.flipY),Z.pixelStorei(_e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,Se.premultiplyAlpha),Z.pixelStorei(_e.UNPACK_ALIGNMENT,Se.unpackAlignment);let rl=Z.getParameter(_e.UNPACK_ROW_LENGTH),yi=Z.getParameter(_e.UNPACK_IMAGE_HEIGHT),Ol=Z.getParameter(_e.UNPACK_SKIP_PIXELS),lu=Z.getParameter(_e.UNPACK_SKIP_ROWS),Uf=Z.getParameter(_e.UNPACK_SKIP_IMAGES);Z.pixelStorei(_e.UNPACK_ROW_LENGTH,qr.width),Z.pixelStorei(_e.UNPACK_IMAGE_HEIGHT,qr.height),Z.pixelStorei(_e.UNPACK_SKIP_PIXELS,pn),Z.pixelStorei(_e.UNPACK_SKIP_ROWS,Wn),Z.pixelStorei(_e.UNPACK_SKIP_IMAGES,Jn);let Lm=ne.isDataArrayTexture||ne.isData3DTexture,rr=Se.isDataArrayTexture||Se.isData3DTexture;if(ne.isDepthTexture){let ss=Pe.get(ne),kf=Pe.get(Se),pr=Pe.get(ss.__renderTarget),zf=Pe.get(kf.__renderTarget);Z.bindFramebuffer(_e.READ_FRAMEBUFFER,pr.__webglFramebuffer),Z.bindFramebuffer(_e.DRAW_FRAMEBUFFER,zf.__webglFramebuffer);for(let Dm=0;Dm<on;Dm++)Lm&&(_e.framebufferTextureLayer(_e.READ_FRAMEBUFFER,_e.COLOR_ATTACHMENT0,Pe.get(ne).__webglTexture,Ne,Jn+Dm),_e.framebufferTextureLayer(_e.DRAW_FRAMEBUFFER,_e.COLOR_ATTACHMENT0,Pe.get(Se).__webglTexture,qt,rs+Dm)),_e.blitFramebuffer(pn,Wn,Qt,Vt,gn,Yi,Qt,Vt,_e.DEPTH_BUFFER_BIT,_e.NEAREST);Z.bindFramebuffer(_e.READ_FRAMEBUFFER,null),Z.bindFramebuffer(_e.DRAW_FRAMEBUFFER,null)}else if(Ne!==0||ne.isRenderTargetTexture||Pe.has(ne)){let ss=Pe.get(ne),kf=Pe.get(Se);Z.bindFramebuffer(_e.READ_FRAMEBUFFER,Y),Z.bindFramebuffer(_e.DRAW_FRAMEBUFFER,H);for(let pr=0;pr<on;pr++)Lm?_e.framebufferTextureLayer(_e.READ_FRAMEBUFFER,_e.COLOR_ATTACHMENT0,ss.__webglTexture,Ne,Jn+pr):_e.framebufferTexture2D(_e.READ_FRAMEBUFFER,_e.COLOR_ATTACHMENT0,_e.TEXTURE_2D,ss.__webglTexture,Ne),rr?_e.framebufferTextureLayer(_e.DRAW_FRAMEBUFFER,_e.COLOR_ATTACHMENT0,kf.__webglTexture,qt,rs+pr):_e.framebufferTexture2D(_e.DRAW_FRAMEBUFFER,_e.COLOR_ATTACHMENT0,_e.TEXTURE_2D,kf.__webglTexture,qt),Ne!==0?_e.blitFramebuffer(pn,Wn,Qt,Vt,gn,Yi,Qt,Vt,_e.COLOR_BUFFER_BIT,_e.NEAREST):rr?_e.copyTexSubImage3D(Zt,qt,gn,Yi,rs+pr,pn,Wn,Qt,Vt):_e.copyTexSubImage2D(Zt,qt,gn,Yi,pn,Wn,Qt,Vt);Z.bindFramebuffer(_e.READ_FRAMEBUFFER,null),Z.bindFramebuffer(_e.DRAW_FRAMEBUFFER,null)}else rr?ne.isDataTexture||ne.isData3DTexture?_e.texSubImage3D(Zt,qt,gn,Yi,rs,Qt,Vt,on,ir,Co,qr.data):Se.isCompressedArrayTexture?_e.compressedTexSubImage3D(Zt,qt,gn,Yi,rs,Qt,Vt,on,ir,qr.data):_e.texSubImage3D(Zt,qt,gn,Yi,rs,Qt,Vt,on,ir,Co,qr):ne.isDataTexture?_e.texSubImage2D(_e.TEXTURE_2D,qt,gn,Yi,Qt,Vt,ir,Co,qr.data):ne.isCompressedTexture?_e.compressedTexSubImage2D(_e.TEXTURE_2D,qt,gn,Yi,qr.width,qr.height,ir,qr.data):_e.texSubImage2D(_e.TEXTURE_2D,qt,gn,Yi,Qt,Vt,ir,Co,qr);Z.pixelStorei(_e.UNPACK_ROW_LENGTH,rl),Z.pixelStorei(_e.UNPACK_IMAGE_HEIGHT,yi),Z.pixelStorei(_e.UNPACK_SKIP_PIXELS,Ol),Z.pixelStorei(_e.UNPACK_SKIP_ROWS,lu),Z.pixelStorei(_e.UNPACK_SKIP_IMAGES,Uf),qt===0&&Se.generateMipmaps&&_e.generateMipmap(Zt),Z.unbindTexture()},this.initRenderTarget=function(ne){Pe.get(ne).__webglFramebuffer===void 0&&Ge.setupRenderTarget(ne)},this.initTexture=function(ne){ne.isCubeTexture?Ge.setTextureCube(ne,0):ne.isData3DTexture?Ge.setTexture3D(ne,0):ne.isDataArrayTexture||ne.isCompressedArrayTexture?Ge.setTexture2DArray(ne,0):Ge.setTexture2D(ne,0),Z.unbindTexture()},this.resetState=function(){$=0,J=0,te=null,Z.reset(),Bt.reset()},typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return Uo}get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(e){this._outputColorSpace=e;let t=this.getContext();t.drawingBufferColorSpace=ln._getDrawingBufferColorSpace(e),t.unpackColorSpace=ln._getUnpackColorSpace()}};var VM=class extends lr{constructor(e=document.createElement("div")){super(),this.isCSS2DObject=!0,this.element=e,this.element.style.position="absolute",this.element.style.userSelect="none",this.element.setAttribute("draggable",!1),this.center=new Oe(.5,.5),this.addEventListener("removed",function(){this.traverse(function(t){t.element&&t.element instanceof t.element.ownerDocument.defaultView.Element&&t.element.parentNode!==null&&t.element.remove()})})}copy(e,t){return super.copy(e,t),this.element=e.element.cloneNode(!0),this.center=e.center,this}},u_=new re,VZ=new cn,GZ=new cn,qZ=new re,HZ=new re,GM=class{constructor(e={}){let t=this,n,r,s,o,a={objects:new WeakMap},l=e.element!==void 0?e.element:document.createElement("div");l.style.overflow="hidden",this.domElement=l,this.sortObjects=!0,this.getSize=function(){return{width:n,height:r}},this.render=function(y,w){y.matrixWorldAutoUpdate===!0&&y.updateMatrixWorld(),w.parent===null&&w.matrixWorldAutoUpdate===!0&&w.updateMatrixWorld(),VZ.copy(w.matrixWorldInverse),GZ.multiplyMatrices(w.projectionMatrix,VZ),u(y,y,w),this.sortObjects&&A(y)},this.setSize=function(y,w){n=y,r=w,s=n/2,o=r/2,l.style.width=y+"px",l.style.height=w+"px"};function c(y){y.isCSS2DObject&&(y.element.style.display="none");for(let w=0,S=y.children.length;w<S;w++)c(y.children[w])}function u(y,w,S){if(y.visible===!1){c(y);return}if(y.isCSS2DObject){u_.setFromMatrixPosition(y.matrixWorld),u_.applyMatrix4(GZ);let T=u_.z>=-1&&u_.z<=1&&y.layers.test(S.layers)===!0,R=y.element;R.style.display=T===!0?"":"none",T===!0&&(y.onBeforeRender(t,w,S),R.style.transform="translate("+-100*y.center.x+"%,"+-100*y.center.y+"%)translate("+(u_.x*s+s)+"px,"+(-u_.y*o+o)+"px)",R.parentNode!==l&&l.appendChild(R),y.onAfterRender(t,w,S));let P={distanceToCameraSquared:f(S,y)};a.objects.set(y,P)}for(let T=0,R=y.children.length;T<R;T++)u(y.children[T],w,S)}function f(y,w){return qZ.setFromMatrixPosition(y.matrixWorld),HZ.setFromMatrixPosition(w.matrixWorld),qZ.distanceToSquared(HZ)}function d(y){let w=[];return y.traverseVisible(function(S){S.isCSS2DObject&&w.push(S)}),w}function A(y){let w=d(y).sort(function(T,R){if(T.renderOrder!==R.renderOrder)return R.renderOrder-T.renderOrder;let P=a.objects.get(T).distanceToCameraSquared,I=a.objects.get(R).distanceToCameraSquared;return P-I}),S=w.length;for(let T=0,R=w.length;T<R;T++)w[T].element.style.zIndex=S-T}}};function Axe(i){var e=typeof i;return i!=null&&(e=="object"||e=="function")}var Bb=Axe;var gxe=typeof global=="object"&&global&&global.Object===Object&&global,WZ=gxe;var vxe=typeof self=="object"&&self&&self.Object===Object&&self,_xe=WZ||vxe||Function("return this")(),qM=_xe;var xxe=function(){return qM.Date.now()},HM=xxe;var yxe=/\s/;function bxe(i){for(var e=i.length;e--&&yxe.test(i.charAt(e)););return e}var jZ=bxe;var wxe=/^\s+/;function Sxe(i){return i&&i.slice(0,jZ(i)+1).replace(wxe,"")}var XZ=Sxe;var Txe=qM.Symbol,h_=Txe;var $Z=Object.prototype,Exe=$Z.hasOwnProperty,Mxe=$Z.toString,Ob=h_?h_.toStringTag:void 0;function Cxe(i){var e=Exe.call(i,Ob),t=i[Ob];try{i[Ob]=void 0;var n=!0}catch{}var r=Mxe.call(i);return n&&(e?i[Ob]=t:delete i[Ob]),r}var YZ=Cxe;var Rxe=Object.prototype,Ixe=Rxe.toString;function Pxe(i){return Ixe.call(i)}var ZZ=Pxe;var Lxe="[object Null]",Dxe="[object Undefined]",KZ=h_?h_.toStringTag:void 0;function Nxe(i){return i==null?i===void 0?Dxe:Lxe:KZ&&KZ in Object(i)?YZ(i):ZZ(i)}var QZ=Nxe;function Fxe(i){return i!=null&&typeof i=="object"}var JZ=Fxe;var Bxe="[object Symbol]";function Oxe(i){return typeof i=="symbol"||JZ(i)&&QZ(i)==Bxe}var eK=Oxe;var tK=NaN,Uxe=/^[-+]0x[0-9a-f]+$/i,kxe=/^0b[01]+$/i,zxe=/^0o[0-7]+$/i,Vxe=parseInt;function Gxe(i){if(typeof i=="number")return i;if(eK(i))return tK;if(Bb(i)){var e=typeof i.valueOf=="function"?i.valueOf():i;i=Bb(e)?e+"":e}if(typeof i!="string")return i===0?i:+i;i=XZ(i);var t=kxe.test(i);return t||zxe.test(i)?Vxe(i.slice(2),t?2:8):Uxe.test(i)?tK:+i}var yF=Gxe;var qxe="Expected a function",Hxe=Math.max,Wxe=Math.min;function jxe(i,e,t){var n,r,s,o,a,l,c=0,u=!1,f=!1,d=!0;if(typeof i!="function")throw new TypeError(qxe);e=yF(e)||0,Bb(t)&&(u=!!t.leading,f="maxWait"in t,s=f?Hxe(yF(t.maxWait)||0,e):s,d="trailing"in t?!!t.trailing:d);function A(D){var L=n,C=r;return n=r=void 0,c=D,o=i.apply(C,L),o}function y(D){return c=D,a=setTimeout(T,e),u?A(D):o}function w(D){var L=D-l,C=D-c,B=e-L;return f?Wxe(B,s-C):B}function S(D){var L=D-l,C=D-c;return l===void 0||L>=e||L<0||f&&C>=s}function T(){var D=HM();if(S(D))return R(D);a=setTimeout(T,w(D))}function R(D){return a=void 0,d&&n?A(D):(n=r=void 0,o)}function P(){a!==void 0&&clearTimeout(a),c=0,n=l=r=a=void 0}function I(){return a===void 0?o:R(HM())}function F(){var D=HM(),L=S(D);if(n=arguments,r=this,l=D,L){if(a===void 0)return y(l);if(f)return clearTimeout(a),a=setTimeout(T,e),A(l)}return a===void 0&&(a=setTimeout(T,e)),o}return F.cancel=P,F.flush=I,F}var nK=jxe;function iK(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 Xxe(i){if(Array.isArray(i))return i}function $xe(i,e){if(!(i instanceof e))throw new TypeError("Cannot call a class as a function")}function Yxe(i,e,t){return Object.defineProperty(i,"prototype",{writable:!1}),i}function Zxe(i,e){var t=i==null?null:typeof Symbol<"u"&&i[Symbol.iterator]||i["@@iterator"];if(t!=null){var n,r,s,o,a=[],l=!0,c=!1;try{if(s=(t=t.call(i)).next,e!==0)for(;!(l=(n=s.call(t)).done)&&(a.push(n.value),a.length!==e);l=!0);}catch(u){c=!0,r=u}finally{try{if(!l&&t.return!=null&&(o=t.return(),Object(o)!==o))return}finally{if(c)throw r}}return a}}function Kxe(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.4118-In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Qxe(i,e){return Xxe(i)||Zxe(i,e)||Jxe(i,e)||Kxe()}function Jxe(i,e){if(i){if(typeof i=="string")return iK(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)?iK(i,e):void 0}}var eye=Yxe(function i(e,t){var n=t.default,r=n===void 0?null:n,s=t.triggerUpdate,o=s===void 0?!0:s,a=t.onChange,l=a===void 0?function(c,u){}:a;$xe(this,i),this.name=e,this.defaultVal=r,this.triggerUpdate=o,this.onChange=l});function Kr(i){var e=i.stateInit,t=e===void 0?function(){return{}}:e,n=i.props,r=n===void 0?{}:n,s=i.methods,o=s===void 0?{}:s,a=i.aliases,l=a===void 0?{}:a,c=i.init,u=c===void 0?function(){}:c,f=i.update,d=f===void 0?function(){}:f,A=Object.keys(r).map(function(y){return new eye(y,r[y])});return function y(){for(var w=arguments.length,S=new Array(w),T=0;T<w;T++)S[T]=arguments[T];var R=!!(this instanceof y&&this.constructor),P=R?S.shift():void 0,I=S[0],F=I===void 0?{}:I,D=Object.assign({},t instanceof Function?t(F):t,{initialised:!1}),L={};function C(z){return B(z,F),k(),C}var B=function(G,W){u.call(C,G,D,W),D.initialised=!0},k=nK(function(){D.initialised&&(d.call(C,D,L),L={})},1);return A.forEach(function(z){C[z.name]=G(z);function G(W){var Y=W.name,H=W.triggerUpdate,$=H===void 0?!1:H,J=W.onChange,te=J===void 0?function(ve,Re){}:J,ce=W.defaultVal,he=ce===void 0?null:ce;return function(ve){var Re=D[Y];if(!arguments.length)return Re;var Qe=ve===void 0?he:ve;return D[Y]=Qe,te.call(C,Qe,D,Re),!L.hasOwnProperty(Y)&&(L[Y]=Re),$&&k(),C}}}),Object.keys(o).forEach(function(z){C[z]=function(){for(var G,W=arguments.length,Y=new Array(W),H=0;H<W;H++)Y[H]=arguments[H];return(G=o[z]).call.apply(G,[C,D].concat(Y))}}),Object.entries(l).forEach(function(z){var G=Qxe(z,2),W=G[0],Y=G[1];return C[W]=C[Y]}),C.resetProps=function(){return A.forEach(function(z){C[z.name](z.defaultVal)}),C},C.resetProps(),D._rerender=k,R&&P&&C(P),C}}var Qr=Object.freeze({Linear:Object.freeze({None:function(i){return i},In:function(i){return i},Out:function(i){return i},InOut:function(i){return i}}),Quadratic:Object.freeze({In:function(i){return i*i},Out:function(i){return i*(2-i)},InOut:function(i){return(i*=2)<1?.5*i*i:-.5*(--i*(i-2)-1)}}),Cubic:Object.freeze({In:function(i){return i*i*i},Out:function(i){return--i*i*i+1},InOut:function(i){return(i*=2)<1?.5*i*i*i:.5*((i-=2)*i*i+2)}}),Quartic:Object.freeze({In:function(i){return i*i*i*i},Out:function(i){return 1- --i*i*i*i},InOut:function(i){return(i*=2)<1?.5*i*i*i*i:-.5*((i-=2)*i*i*i-2)}}),Quintic:Object.freeze({In:function(i){return i*i*i*i*i},Out:function(i){return--i*i*i*i*i+1},InOut:function(i){return(i*=2)<1?.5*i*i*i*i*i:.5*((i-=2)*i*i*i*i+2)}}),Sinusoidal:Object.freeze({In:function(i){return 1-Math.sin((1-i)*Math.PI/2)},Out:function(i){return Math.sin(i*Math.PI/2)},InOut:function(i){return .5*(1-Math.sin(Math.PI*(.5-i)))}}),Exponential:Object.freeze({In:function(i){return i===0?0:Math.pow(1024,i-1)},Out:function(i){return i===1?1:1-Math.pow(2,-10*i)},InOut:function(i){return i===0?0:i===1?1:(i*=2)<1?.5*Math.pow(1024,i-1):.5*(-Math.pow(2,-10*(i-1))+2)}}),Circular:Object.freeze({In:function(i){return 1-Math.sqrt(1-i*i)},Out:function(i){return Math.sqrt(1- --i*i)},InOut:function(i){return(i*=2)<1?-.5*(Math.sqrt(1-i*i)-1):.5*(Math.sqrt(1-(i-=2)*i)+1)}}),Elastic:Object.freeze({In:function(i){return i===0?0:i===1?1:-Math.pow(2,10*(i-1))*Math.sin((i-1.1)*5*Math.PI)},Out:function(i){return i===0?0:i===1?1:Math.pow(2,-10*i)*Math.sin((i-.1)*5*Math.PI)+1},InOut:function(i){return i===0?0:i===1?1:(i*=2,i<1?-.5*Math.pow(2,10*(i-1))*Math.sin((i-1.1)*5*Math.PI):.5*Math.pow(2,-10*(i-1))*Math.sin((i-1.1)*5*Math.PI)+1)}}),Back:Object.freeze({In:function(i){var e=1.70158;return i===1?1:i*i*((e+1)*i-e)},Out:function(i){var e=1.70158;return i===0?0:--i*i*((e+1)*i+e)+1},InOut:function(i){var e=2.5949095;return(i*=2)<1?.5*(i*i*((e+1)*i-e)):.5*((i-=2)*i*((e+1)*i+e)+2)}}),Bounce:Object.freeze({In:function(i){return 1-Qr.Bounce.Out(1-i)},Out:function(i){return i<.36363636363636365?7.5625*i*i:i<.7272727272727273?7.5625*(i-=.5454545454545454)*i+.75:i<.9090909090909091?7.5625*(i-=.8181818181818182)*i+.9375:7.5625*(i-=.9545454545454546)*i+.984375},InOut:function(i){return i<.5?Qr.Bounce.In(i*2)*.5:Qr.Bounce.Out(i*2-1)*.5+.5}}),generatePow:function(i){return i===void 0&&(i=4),i=i<Number.EPSILON?Number.EPSILON:i,i=i>1e4?1e4:i,{In:function(e){return Math.pow(e,i)},Out:function(e){return 1-Math.pow(1-e,i)},InOut:function(e){return e<.5?Math.pow(e*2,i)/2:(1-Math.pow(2-e*2,i))/2+.5}}}}),Ub=function(){return performance.now()},hg=(function(){function i(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this._tweens={},this._tweensAddedDuringUpdate={},this.add.apply(this,e)}return i.prototype.getAll=function(){var e=this;return Object.keys(this._tweens).map(function(t){return e._tweens[t]})},i.prototype.removeAll=function(){this._tweens={}},i.prototype.add=function(){for(var e,t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];for(var r=0,s=t;r<s.length;r++){var o=s[r];(e=o._group)===null||e===void 0||e.remove(o),o._group=this,this._tweens[o.getId()]=o,this._tweensAddedDuringUpdate[o.getId()]=o}},i.prototype.remove=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];for(var n=0,r=e;n<r.length;n++){var s=r[n];s._group=void 0,delete this._tweens[s.getId()],delete this._tweensAddedDuringUpdate[s.getId()]}},i.prototype.allStopped=function(){return this.getAll().every(function(e){return!e.isPlaying()})},i.prototype.update=function(e,t){e===void 0&&(e=Ub()),t===void 0&&(t=!0);var n=Object.keys(this._tweens);if(n.length!==0)for(;n.length>0;){this._tweensAddedDuringUpdate={};for(var r=0;r<n.length;r++){var s=this._tweens[n[r]],o=!t;s&&s.update(e,o)===!1&&!t&&this.remove(s)}n=Object.keys(this._tweensAddedDuringUpdate)}},i})(),f_={Linear:function(i,e){var t=i.length-1,n=t*e,r=Math.floor(n),s=f_.Utils.Linear;return e<0?s(i[0],i[1],n):e>1?s(i[t],i[t-1],t-n):s(i[r],i[r+1>t?t:r+1],n-r)},Bezier:function(i,e){for(var t=0,n=i.length-1,r=Math.pow,s=f_.Utils.Bernstein,o=0;o<=n;o++)t+=r(1-e,n-o)*r(e,o)*i[o]*s(n,o);return t},CatmullRom:function(i,e){var t=i.length-1,n=t*e,r=Math.floor(n),s=f_.Utils.CatmullRom;return i[0]===i[t]?(e<0&&(r=Math.floor(n=t*(1+e))),s(i[(r-1+t)%t],i[r],i[(r+1)%t],i[(r+2)%t],n-r)):e<0?i[0]-(s(i[0],i[0],i[1],i[1],-n)-i[0]):e>1?i[t]-(s(i[t],i[t],i[t-1],i[t-1],n-t)-i[t]):s(i[r?r-1:0],i[r],i[t<r+1?t:r+1],i[t<r+2?t:r+2],n-r)},Utils:{Linear:function(i,e,t){return(e-i)*t+i},Bernstein:function(i,e){var t=f_.Utils.Factorial;return t(i)/t(e)/t(i-e)},Factorial:(function(){var i=[1];return function(e){var t=1;if(i[e])return i[e];for(var n=e;n>1;n--)t*=n;return i[e]=t,t}})(),CatmullRom:function(i,e,t,n,r){var s=(t-i)*.5,o=(n-e)*.5,a=r*r,l=r*a;return(2*e-2*t+s+o)*l+(-3*e+3*t-2*s-o)*a+s*r+e}}},rK=(function(){function i(){}return i.nextId=function(){return i._nextId++},i._nextId=0,i})(),bF=new hg,uo=(function(){function i(e,t){this._isPaused=!1,this._pauseStart=0,this._valuesStart={},this._valuesEnd={},this._valuesStartRepeat={},this._duration=1e3,this._isDynamic=!1,this._initialRepeat=0,this._repeat=0,this._yoyo=!1,this._isPlaying=!1,this._reversed=!1,this._delayTime=0,this._startTime=0,this._easingFunction=Qr.Linear.None,this._interpolationFunction=f_.Linear,this._chainedTweens=[],this._onStartCallbackFired=!1,this._onEveryStartCallbackFired=!1,this._id=rK.nextId(),this._isChainStopped=!1,this._propertiesAreSetUp=!1,this._goToEnd=!1,this._object=e,typeof t=="object"?(this._group=t,t.add(this)):t===!0&&(this._group=bF,bF.add(this))}return i.prototype.getId=function(){return this._id},i.prototype.isPlaying=function(){return this._isPlaying},i.prototype.isPaused=function(){return this._isPaused},i.prototype.getDuration=function(){return this._duration},i.prototype.to=function(e,t){if(t===void 0&&(t=1e3),this._isPlaying)throw new Error("Can not call Tween.to() while Tween is already started or paused. Stop the Tween first.");return this._valuesEnd=e,this._propertiesAreSetUp=!1,this._duration=t<0?0:t,this},i.prototype.duration=function(e){return e===void 0&&(e=1e3),this._duration=e<0?0:e,this},i.prototype.dynamic=function(e){return e===void 0&&(e=!1),this._isDynamic=e,this},i.prototype.start=function(e,t){if(e===void 0&&(e=Ub()),t===void 0&&(t=!1),this._isPlaying)return this;if(this._repeat=this._initialRepeat,this._reversed){this._reversed=!1;for(var n in this._valuesStartRepeat)this._swapEndStartRepeatValues(n),this._valuesStart[n]=this._valuesStartRepeat[n]}if(this._isPlaying=!0,this._isPaused=!1,this._onStartCallbackFired=!1,this._onEveryStartCallbackFired=!1,this._isChainStopped=!1,this._startTime=e,this._startTime+=this._delayTime,!this._propertiesAreSetUp||t){if(this._propertiesAreSetUp=!0,!this._isDynamic){var r={};for(var s in this._valuesEnd)r[s]=this._valuesEnd[s];this._valuesEnd=r}this._setupProperties(this._object,this._valuesStart,this._valuesEnd,this._valuesStartRepeat,t)}return this},i.prototype.startFromCurrentValues=function(e){return this.start(e,!0)},i.prototype._setupProperties=function(e,t,n,r,s){for(var o in n){var a=e[o],l=Array.isArray(a),c=l?"array":typeof a,u=!l&&Array.isArray(n[o]);if(!(c==="undefined"||c==="function")){if(u){var f=n[o];if(f.length===0)continue;for(var d=[a],A=0,y=f.length;A<y;A+=1){var w=this._handleRelativeValue(a,f[A]);if(isNaN(w)){u=!1,console.warn("Found invalid interpolation list. Skipping.");break}d.push(w)}u&&(n[o]=d)}if((c==="object"||l)&&a&&!u){t[o]=l?[]:{};var S=a;for(var T in S)t[o][T]=S[T];r[o]=l?[]:{};var f=n[o];if(!this._isDynamic){var R={};for(var T in f)R[T]=f[T];n[o]=f=R}this._setupProperties(S,t[o],f,r[o],s)}else(typeof t[o]>"u"||s)&&(t[o]=a),l||(t[o]*=1),u?r[o]=n[o].slice().reverse():r[o]=t[o]||0}}},i.prototype.stop=function(){return this._isChainStopped||(this._isChainStopped=!0,this.stopChainedTweens()),this._isPlaying?(this._isPlaying=!1,this._isPaused=!1,this._onStopCallback&&this._onStopCallback(this._object),this):this},i.prototype.end=function(){return this._goToEnd=!0,this.update(this._startTime+this._duration),this},i.prototype.pause=function(e){return e===void 0&&(e=Ub()),this._isPaused||!this._isPlaying?this:(this._isPaused=!0,this._pauseStart=e,this)},i.prototype.resume=function(e){return e===void 0&&(e=Ub()),!this._isPaused||!this._isPlaying?this:(this._isPaused=!1,this._startTime+=e-this._pauseStart,this._pauseStart=0,this)},i.prototype.stopChainedTweens=function(){for(var e=0,t=this._chainedTweens.length;e<t;e++)this._chainedTweens[e].stop();return this},i.prototype.group=function(e){return e?(e.add(this),this):(console.warn("tween.group() without args has been removed, use group.add(tween) instead."),this)},i.prototype.remove=function(){var e;return(e=this._group)===null||e===void 0||e.remove(this),this},i.prototype.delay=function(e){return e===void 0&&(e=0),this._delayTime=e,this},i.prototype.repeat=function(e){return e===void 0&&(e=0),this._initialRepeat=e,this._repeat=e,this},i.prototype.repeatDelay=function(e){return this._repeatDelayTime=e,this},i.prototype.yoyo=function(e){return e===void 0&&(e=!1),this._yoyo=e,this},i.prototype.easing=function(e){return e===void 0&&(e=Qr.Linear.None),this._easingFunction=e,this},i.prototype.interpolation=function(e){return e===void 0&&(e=f_.Linear),this._interpolationFunction=e,this},i.prototype.chain=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return this._chainedTweens=e,this},i.prototype.onStart=function(e){return this._onStartCallback=e,this},i.prototype.onEveryStart=function(e){return this._onEveryStartCallback=e,this},i.prototype.onUpdate=function(e){return this._onUpdateCallback=e,this},i.prototype.onRepeat=function(e){return this._onRepeatCallback=e,this},i.prototype.onComplete=function(e){return this._onCompleteCallback=e,this},i.prototype.onStop=function(e){return this._onStopCallback=e,this},i.prototype.update=function(e,t){var n=this,r;if(e===void 0&&(e=Ub()),t===void 0&&(t=i.autoStartOnUpdate),this._isPaused)return!0;var s;if(!this._goToEnd&&!this._isPlaying)if(t)this.start(e,!0);else return!1;if(this._goToEnd=!1,e<this._startTime)return!0;this._onStartCallbackFired===!1&&(this._onStartCallback&&this._onStartCallback(this._object),this._onStartCallbackFired=!0),this._onEveryStartCallbackFired===!1&&(this._onEveryStartCallback&&this._onEveryStartCallback(this._object),this._onEveryStartCallbackFired=!0);var o=e-this._startTime,a=this._duration+((r=this._repeatDelayTime)!==null&&r!==void 0?r:this._delayTime),l=this._duration+this._repeat*a,c=function(){if(n._duration===0||o>l)return 1;var w=Math.trunc(o/a),S=o-w*a,T=Math.min(S/n._duration,1);return T===0&&o===n._duration?1:T},u=c(),f=this._easingFunction(u);if(this._updateProperties(this._object,this._valuesStart,this._valuesEnd,f),this._onUpdateCallback&&this._onUpdateCallback(this._object,u),this._duration===0||o>=this._duration)if(this._repeat>0){var d=Math.min(Math.trunc((o-this._duration)/a)+1,this._repeat);isFinite(this._repeat)&&(this._repeat-=d);for(s in this._valuesStartRepeat)!this._yoyo&&typeof this._valuesEnd[s]=="string"&&(this._valuesStartRepeat[s]=this._valuesStartRepeat[s]+parseFloat(this._valuesEnd[s])),this._yoyo&&this._swapEndStartRepeatValues(s),this._valuesStart[s]=this._valuesStartRepeat[s];return this._yoyo&&(this._reversed=!this._reversed),this._startTime+=a*d,this._onRepeatCallback&&this._onRepeatCallback(this._object),this._onEveryStartCallbackFired=!1,!0}else{this._onCompleteCallback&&this._onCompleteCallback(this._object);for(var A=0,y=this._chainedTweens.length;A<y;A++)this._chainedTweens[A].start(this._startTime+this._duration,!1);return this._isPlaying=!1,!1}return!0},i.prototype._updateProperties=function(e,t,n,r){for(var s in n)if(t[s]!==void 0){var o=t[s]||0,a=n[s],l=Array.isArray(e[s]),c=Array.isArray(a),u=!l&&c;u?e[s]=this._interpolationFunction(a,r):typeof a=="object"&&a?this._updateProperties(e[s],o,a,r):(a=this._handleRelativeValue(o,a),typeof a=="number"&&(e[s]=o+(a-o)*r))}},i.prototype._handleRelativeValue=function(e,t){return typeof t!="string"?t:t.charAt(0)==="+"||t.charAt(0)==="-"?e+parseFloat(t):parseFloat(t)},i.prototype._swapEndStartRepeatValues=function(e){var t=this._valuesStartRepeat[e],n=this._valuesEnd[e];typeof n=="string"?this._valuesStartRepeat[e]=this._valuesStartRepeat[e]+parseFloat(n):this._valuesStartRepeat[e]=this._valuesEnd[e],this._valuesEnd[e]=t},i.autoStartOnUpdate=!1,i})();var yQe=rK.nextId,Yh=bF,bQe=Yh.getAll.bind(Yh),wQe=Yh.removeAll.bind(Yh),SQe=Yh.add.bind(Yh),TQe=Yh.remove.bind(Yh),EQe=Yh.update.bind(Yh);function sK(i){let e=+this._x.call(null,i),t=+this._y.call(null,i),n=+this._z.call(null,i);return oK(this.cover(e,t,n),e,t,n,i)}function oK(i,e,t,n,r){if(isNaN(e)||isNaN(t)||isNaN(n))return i;var s,o=i._root,a={data:r},l=i._x0,c=i._y0,u=i._z0,f=i._x1,d=i._y1,A=i._z1,y,w,S,T,R,P,I,F,D,L,C;if(!o)return i._root=a,i;for(;o.length;)if((I=e>=(y=(l+f)/2))?l=y:f=y,(F=t>=(w=(c+d)/2))?c=w:d=w,(D=n>=(S=(u+A)/2))?u=S:A=S,s=o,!(o=o[L=D<<2|F<<1|I]))return s[L]=a,i;if(T=+i._x.call(null,o.data),R=+i._y.call(null,o.data),P=+i._z.call(null,o.data),e===T&&t===R&&n===P)return a.next=o,s?s[L]=a:i._root=a,i;do s=s?s[L]=new Array(8):i._root=new Array(8),(I=e>=(y=(l+f)/2))?l=y:f=y,(F=t>=(w=(c+d)/2))?c=w:d=w,(D=n>=(S=(u+A)/2))?u=S:A=S;while((L=D<<2|F<<1|I)===(C=(P>=S)<<2|(R>=w)<<1|T>=y));return s[C]=o,s[L]=a,i}function aK(i){Array.isArray(i)||(i=Array.from(i));let e=i.length,t=new Float64Array(e),n=new Float64Array(e),r=new Float64Array(e),s=1/0,o=1/0,a=1/0,l=-1/0,c=-1/0,u=-1/0;for(let f=0,d,A,y,w;f<e;++f)isNaN(A=+this._x.call(null,d=i[f]))||isNaN(y=+this._y.call(null,d))||isNaN(w=+this._z.call(null,d))||(t[f]=A,n[f]=y,r[f]=w,A<s&&(s=A),A>l&&(l=A),y<o&&(o=y),y>c&&(c=y),w<a&&(a=w),w>u&&(u=w));if(s>l||o>c||a>u)return this;this.cover(s,o,a).cover(l,c,u);for(let f=0;f<e;++f)oK(this,t[f],n[f],r[f],i[f]);return this}function lK(i,e,t){if(isNaN(i=+i)||isNaN(e=+e)||isNaN(t=+t))return this;var n=this._x0,r=this._y0,s=this._z0,o=this._x1,a=this._y1,l=this._z1;if(isNaN(n))o=(n=Math.floor(i))+1,a=(r=Math.floor(e))+1,l=(s=Math.floor(t))+1;else{for(var c=o-n||1,u=this._root,f,d;n>i||i>=o||r>e||e>=a||s>t||t>=l;)switch(d=(t<s)<<2|(e<r)<<1|i<n,f=new Array(8),f[d]=u,u=f,c*=2,d){case 0:o=n+c,a=r+c,l=s+c;break;case 1:n=o-c,a=r+c,l=s+c;break;case 2:o=n+c,r=a-c,l=s+c;break;case 3:n=o-c,r=a-c,l=s+c;break;case 4:o=n+c,a=r+c,s=l-c;break;case 5:n=o-c,a=r+c,s=l-c;break;case 6:o=n+c,r=a-c,s=l-c;break;case 7:n=o-c,r=a-c,s=l-c;break}this._root&&this._root.length&&(this._root=u)}return this._x0=n,this._y0=r,this._z0=s,this._x1=o,this._y1=a,this._z1=l,this}function cK(){var i=[];return this.visit(function(e){if(!e.length)do i.push(e.data);while(e=e.next)}),i}function uK(i){return arguments.length?this.cover(+i[0][0],+i[0][1],+i[0][2]).cover(+i[1][0],+i[1][1],+i[1][2]):isNaN(this._x0)?void 0:[[this._x0,this._y0,this._z0],[this._x1,this._y1,this._z1]]}function ji(i,e,t,n,r,s,o){this.node=i,this.x0=e,this.y0=t,this.z0=n,this.x1=r,this.y1=s,this.z1=o}function hK(i,e,t,n){var r,s=this._x0,o=this._y0,a=this._z0,l,c,u,f,d,A,y=this._x1,w=this._y1,S=this._z1,T=[],R=this._root,P,I;for(R&&T.push(new ji(R,s,o,a,y,w,S)),n==null?n=1/0:(s=i-n,o=e-n,a=t-n,y=i+n,w=e+n,S=t+n,n*=n);P=T.pop();)if(!(!(R=P.node)||(l=P.x0)>y||(c=P.y0)>w||(u=P.z0)>S||(f=P.x1)<s||(d=P.y1)<o||(A=P.z1)<a))if(R.length){var F=(l+f)/2,D=(c+d)/2,L=(u+A)/2;T.push(new ji(R[7],F,D,L,f,d,A),new ji(R[6],l,D,L,F,d,A),new ji(R[5],F,c,L,f,D,A),new ji(R[4],l,c,L,F,D,A),new ji(R[3],F,D,u,f,d,L),new ji(R[2],l,D,u,F,d,L),new ji(R[1],F,c,u,f,D,L),new ji(R[0],l,c,u,F,D,L)),(I=(t>=L)<<2|(e>=D)<<1|i>=F)&&(P=T[T.length-1],T[T.length-1]=T[T.length-1-I],T[T.length-1-I]=P)}else{var C=i-+this._x.call(null,R.data),B=e-+this._y.call(null,R.data),k=t-+this._z.call(null,R.data),z=C*C+B*B+k*k;if(z<n){var G=Math.sqrt(n=z);s=i-G,o=e-G,a=t-G,y=i+G,w=e+G,S=t+G,r=R.data}}return r}var tye=(i,e,t,n,r,s)=>Math.sqrt((i-n)**2+(e-r)**2+(t-s)**2);function fK(i,e,t,n){let r=[],s=i-n,o=e-n,a=t-n,l=i+n,c=e+n,u=t+n;return this.visit((f,d,A,y,w,S,T)=>{if(!f.length)do{let R=f.data;tye(i,e,t,this._x(R),this._y(R),this._z(R))<=n&&r.push(R)}while(f=f.next);return d>l||A>c||y>u||w<s||S<o||T<a}),r}function dK(i){if(isNaN(d=+this._x.call(null,i))||isNaN(A=+this._y.call(null,i))||isNaN(y=+this._z.call(null,i)))return this;var e,t=this._root,n,r,s,o=this._x0,a=this._y0,l=this._z0,c=this._x1,u=this._y1,f=this._z1,d,A,y,w,S,T,R,P,I,F,D;if(!t)return this;if(t.length)for(;;){if((R=d>=(w=(o+c)/2))?o=w:c=w,(P=A>=(S=(a+u)/2))?a=S:u=S,(I=y>=(T=(l+f)/2))?l=T:f=T,e=t,!(t=t[F=I<<2|P<<1|R]))return this;if(!t.length)break;(e[F+1&7]||e[F+2&7]||e[F+3&7]||e[F+4&7]||e[F+5&7]||e[F+6&7]||e[F+7&7])&&(n=e,D=F)}for(;t.data!==i;)if(r=t,!(t=t.next))return this;return(s=t.next)&&delete t.next,r?(s?r.next=s:delete r.next,this):e?(s?e[F]=s:delete e[F],(t=e[0]||e[1]||e[2]||e[3]||e[4]||e[5]||e[6]||e[7])&&t===(e[7]||e[6]||e[5]||e[4]||e[3]||e[2]||e[1]||e[0])&&!t.length&&(n?n[D]=t:this._root=t),this):(this._root=s,this)}function pK(i){for(var e=0,t=i.length;e<t;++e)this.remove(i[e]);return this}function mK(){return this._root}function AK(){var i=0;return this.visit(function(e){if(!e.length)do++i;while(e=e.next)}),i}function gK(i){var e=[],t,n=this._root,r,s,o,a,l,c,u;for(n&&e.push(new ji(n,this._x0,this._y0,this._z0,this._x1,this._y1,this._z1));t=e.pop();)if(!i(n=t.node,s=t.x0,o=t.y0,a=t.z0,l=t.x1,c=t.y1,u=t.z1)&&n.length){var f=(s+l)/2,d=(o+c)/2,A=(a+u)/2;(r=n[7])&&e.push(new ji(r,f,d,A,l,c,u)),(r=n[6])&&e.push(new ji(r,s,d,A,f,c,u)),(r=n[5])&&e.push(new ji(r,f,o,A,l,d,u)),(r=n[4])&&e.push(new ji(r,s,o,A,f,d,u)),(r=n[3])&&e.push(new ji(r,f,d,a,l,c,A)),(r=n[2])&&e.push(new ji(r,s,d,a,f,c,A)),(r=n[1])&&e.push(new ji(r,f,o,a,l,d,A)),(r=n[0])&&e.push(new ji(r,s,o,a,f,d,A))}return this}function vK(i){var e=[],t=[],n;for(this._root&&e.push(new ji(this._root,this._x0,this._y0,this._z0,this._x1,this._y1,this._z1));n=e.pop();){var r=n.node;if(r.length){var s,o=n.x0,a=n.y0,l=n.z0,c=n.x1,u=n.y1,f=n.z1,d=(o+c)/2,A=(a+u)/2,y=(l+f)/2;(s=r[0])&&e.push(new ji(s,o,a,l,d,A,y)),(s=r[1])&&e.push(new ji(s,d,a,l,c,A,y)),(s=r[2])&&e.push(new ji(s,o,A,l,d,u,y)),(s=r[3])&&e.push(new ji(s,d,A,l,c,u,y)),(s=r[4])&&e.push(new ji(s,o,a,y,d,A,f)),(s=r[5])&&e.push(new ji(s,d,a,y,c,A,f)),(s=r[6])&&e.push(new ji(s,o,A,y,d,u,f)),(s=r[7])&&e.push(new ji(s,d,A,y,c,u,f))}t.push(n)}for(;n=t.pop();)i(n.node,n.x0,n.y0,n.z0,n.x1,n.y1,n.z1);return this}function _K(i){return i[0]}function xK(i){return arguments.length?(this._x=i,this):this._x}function yK(i){return i[1]}function bK(i){return arguments.length?(this._y=i,this):this._y}function wK(i){return i[2]}function SK(i){return arguments.length?(this._z=i,this):this._z}function kb(i,e,t,n){var r=new wF(e??_K,t??yK,n??wK,NaN,NaN,NaN,NaN,NaN,NaN);return i==null?r:r.addAll(i)}function wF(i,e,t,n,r,s,o,a,l){this._x=i,this._y=e,this._z=t,this._x0=n,this._y0=r,this._z0=s,this._x1=o,this._y1=a,this._z1=l,this._root=void 0}function TK(i){for(var e={data:i.data},t=e;i=i.next;)t=t.next={data:i.data};return e}var Go=kb.prototype=wF.prototype;Go.copy=function(){var i=new wF(this._x,this._y,this._z,this._x0,this._y0,this._z0,this._x1,this._y1,this._z1),e=this._root,t,n;if(!e)return i;if(!e.length)return i._root=TK(e),i;for(t=[{source:e,target:i._root=new Array(8)}];e=t.pop();)for(var r=0;r<8;++r)(n=e.source[r])&&(n.length?t.push({source:n,target:e.target[r]=new Array(8)}):e.target[r]=TK(n));return i};Go.add=sK;Go.addAll=aK;Go.cover=lK;Go.data=cK;Go.extent=uK;Go.find=hK;Go.findAllWithinRadius=fK;Go.remove=dK;Go.removeAll=pK;Go.root=mK;Go.size=AK;Go.visit=gK;Go.visitAfter=vK;Go.x=xK;Go.y=bK;Go.z=SK;function fg(i,e){return i==null||e==null?NaN:i<e?-1:i>e?1:i>=e?0:NaN}function SF(i,e){return i==null||e==null?NaN:e<i?-1:e>i?1:e>=i?0:NaN}function WM(i){let e,t,n;i.length!==2?(e=fg,t=(a,l)=>fg(i(a),l),n=(a,l)=>i(a)-l):(e=i===fg||i===SF?i:nye,t=i,n=i);function r(a,l,c=0,u=a.length){if(c<u){if(e(l,l)!==0)return u;do{let f=c+u>>>1;t(a[f],l)<0?c=f+1:u=f}while(c<u)}return c}function s(a,l,c=0,u=a.length){if(c<u){if(e(l,l)!==0)return u;do{let f=c+u>>>1;t(a[f],l)<=0?c=f+1:u=f}while(c<u)}return c}function o(a,l,c=0,u=a.length){let f=r(a,l,c,u-1);return f>c&&n(a[f-1],l)>-n(a[f],l)?f-1:f}return{left:r,center:o,right:s}}function nye(){return 0}function TF(i){return i===null?NaN:+i}var EK=WM(fg),MK=EK.right,iye=EK.left,rye=WM(TF).center,zb=MK;function V0(i,e){let t,n;if(e===void 0)for(let r of i)r!=null&&(t===void 0?r>=r&&(t=n=r):(t>r&&(t=r),n<r&&(n=r)));else{let r=-1;for(let s of i)(s=e(s,++r,i))!=null&&(t===void 0?s>=s&&(t=n=s):(t>s&&(t=s),n<s&&(n=s)))}return[t,n]}var qo=class{constructor(){this._partials=new Float64Array(32),this._n=0}add(e){let t=this._partials,n=0;for(let r=0;r<this._n&&r<32;r++){let s=t[r],o=e+s,a=Math.abs(e)<Math.abs(s)?e-(o-s):s-(o-e);a&&(t[n++]=a),e=o}return t[n]=e,this._n=n+1,this}valueOf(){let e=this._partials,t=this._n,n,r,s,o=0;if(t>0){for(o=e[--t];t>0&&(n=o,r=e[--t],o=n+r,s=r-(o-n),!s););t>0&&(s<0&&e[t-1]<0||s>0&&e[t-1]>0)&&(r=s*2,n=o+r,r==n-o&&(o=n))}return o}};var sye=Math.sqrt(50),oye=Math.sqrt(10),aye=Math.sqrt(2);function jM(i,e,t){let n=(e-i)/Math.max(0,t),r=Math.floor(Math.log10(n)),s=n/Math.pow(10,r),o=s>=sye?10:s>=oye?5:s>=aye?2:1,a,l,c;return r<0?(c=Math.pow(10,-r)/o,a=Math.round(i*c),l=Math.round(e*c),a/c<i&&++a,l/c>e&&--l,c=-c):(c=Math.pow(10,r)*o,a=Math.round(i/c),l=Math.round(e/c),a*c<i&&++a,l*c>e&&--l),l<a&&.5<=t&&t<2?jM(i,e,t*2):[a,l,c]}function XM(i,e,t){if(e=+e,i=+i,t=+t,!(t>0))return[];if(i===e)return[i];let n=e<i,[r,s,o]=n?jM(e,i,t):jM(i,e,t);if(!(s>=r))return[];let a=s-r+1,l=new Array(a);if(n)if(o<0)for(let c=0;c<a;++c)l[c]=(s-c)/-o;else for(let c=0;c<a;++c)l[c]=(s-c)*o;else if(o<0)for(let c=0;c<a;++c)l[c]=(r+c)/-o;else for(let c=0;c<a;++c)l[c]=(r+c)*o;return l}function Vb(i,e,t){return e=+e,i=+i,t=+t,jM(i,e,t)[2]}function EF(i,e,t){e=+e,i=+i,t=+t;let n=e<i,r=n?Vb(e,i,t):Vb(i,e,t);return(n?-1:1)*(r<0?1/-r:r)}function $M(i,e){let t;if(e===void 0)for(let n of i)n!=null&&(t<n||t===void 0&&n>=n)&&(t=n);else{let n=-1;for(let r of i)(r=e(r,++n,i))!=null&&(t<r||t===void 0&&r>=r)&&(t=r)}return t}function YM(i,e){let t=0,n=0;if(e===void 0)for(let r of i)r!=null&&(r=+r)>=r&&(++t,n+=r);else{let r=-1;for(let s of i)(s=e(s,++r,i))!=null&&(s=+s)>=s&&(++t,n+=s)}if(t)return n/t}function*lye(i){for(let e of i)yield*e}function Zh(i){return Array.from(lye(i))}function Nd(i,e,t){i=+i,e=+e,t=(r=arguments.length)<2?(e=i,i=0,1):r<3?1:+t;for(var n=-1,r=Math.max(0,Math.ceil((e-i)/t))|0,s=new Array(r);++n<r;)s[n]=i+n*t;return s}function ZM(i,e){let t=0;if(e===void 0)for(let n of i)(n=+n)&&(t+=n);else{let n=-1;for(let r of i)(r=+e(r,++n,i))&&(t+=r)}return t}function KM(i,e){switch(arguments.length){case 0:break;case 1:this.range(i);break;default:this.range(e).domain(i);break}return this}function QM(i,e,t){i.prototype=e.prototype=t,t.constructor=i}function MF(i,e){var t=Object.create(i.prototype);for(var n in e)t[n]=e[n];return t}function Hb(){}var Gb=.7,tC=1/Gb,d_="\\s*([+-]?\\d+)\\s*",qb="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",Kh="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",cye=/^#([0-9a-f]{3,8})$/,uye=new RegExp(`^rgb\\(${d_},${d_},${d_}\\)$`),hye=new RegExp(`^rgb\\(${Kh},${Kh},${Kh}\\)$`),fye=new RegExp(`^rgba\\(${d_},${d_},${d_},${qb}\\)$`),dye=new RegExp(`^rgba\\(${Kh},${Kh},${Kh},${qb}\\)$`),pye=new RegExp(`^hsl\\(${qb},${Kh},${Kh}\\)$`),mye=new RegExp(`^hsla\\(${qb},${Kh},${Kh},${qb}\\)$`),CK={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};QM(Hb,Uu,{copy(i){return Object.assign(new this.constructor,this,i)},displayable(){return this.rgb().displayable()},hex:RK,formatHex:RK,formatHex8:Aye,formatHsl:gye,formatRgb:IK,toString:IK});function RK(){return this.rgb().formatHex()}function Aye(){return this.rgb().formatHex8()}function gye(){return BK(this).formatHsl()}function IK(){return this.rgb().formatRgb()}function Uu(i){var e,t;return i=(i+"").trim().toLowerCase(),(e=cye.exec(i))?(t=e[1].length,e=parseInt(e[1],16),t===6?PK(e):t===3?new wl(e>>8&15|e>>4&240,e>>4&15|e&240,(e&15)<<4|e&15,1):t===8?JM(e>>24&255,e>>16&255,e>>8&255,(e&255)/255):t===4?JM(e>>12&15|e>>8&240,e>>8&15|e>>4&240,e>>4&15|e&240,((e&15)<<4|e&15)/255):null):(e=uye.exec(i))?new wl(e[1],e[2],e[3],1):(e=hye.exec(i))?new wl(e[1]*255/100,e[2]*255/100,e[3]*255/100,1):(e=fye.exec(i))?JM(e[1],e[2],e[3],e[4]):(e=dye.exec(i))?JM(e[1]*255/100,e[2]*255/100,e[3]*255/100,e[4]):(e=pye.exec(i))?NK(e[1],e[2]/100,e[3]/100,1):(e=mye.exec(i))?NK(e[1],e[2]/100,e[3]/100,e[4]):CK.hasOwnProperty(i)?PK(CK[i]):i==="transparent"?new wl(NaN,NaN,NaN,0):null}function PK(i){return new wl(i>>16&255,i>>8&255,i&255,1)}function JM(i,e,t,n){return n<=0&&(i=e=t=NaN),new wl(i,e,t,n)}function vye(i){return i instanceof Hb||(i=Uu(i)),i?(i=i.rgb(),new wl(i.r,i.g,i.b,i.opacity)):new wl}function p_(i,e,t,n){return arguments.length===1?vye(i):new wl(i,e,t,n??1)}function wl(i,e,t,n){this.r=+i,this.g=+e,this.b=+t,this.opacity=+n}QM(wl,p_,MF(Hb,{brighter(i){return i=i==null?tC:Math.pow(tC,i),new wl(this.r*i,this.g*i,this.b*i,this.opacity)},darker(i){return i=i==null?Gb:Math.pow(Gb,i),new wl(this.r*i,this.g*i,this.b*i,this.opacity)},rgb(){return this},clamp(){return new wl(pg(this.r),pg(this.g),pg(this.b),nC(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:LK,formatHex:LK,formatHex8:_ye,formatRgb:DK,toString:DK}));function LK(){return`#${dg(this.r)}${dg(this.g)}${dg(this.b)}`}function _ye(){return`#${dg(this.r)}${dg(this.g)}${dg(this.b)}${dg((isNaN(this.opacity)?1:this.opacity)*255)}`}function DK(){let i=nC(this.opacity);return`${i===1?"rgb(":"rgba("}${pg(this.r)}, ${pg(this.g)}, ${pg(this.b)}${i===1?")":`, ${i})`}`}function nC(i){return isNaN(i)?1:Math.max(0,Math.min(1,i))}function pg(i){return Math.max(0,Math.min(255,Math.round(i)||0))}function dg(i){return i=pg(i),(i<16?"0":"")+i.toString(16)}function NK(i,e,t,n){return n<=0?i=e=t=NaN:t<=0||t>=1?i=e=NaN:e<=0&&(i=NaN),new Ou(i,e,t,n)}function BK(i){if(i instanceof Ou)return new Ou(i.h,i.s,i.l,i.opacity);if(i instanceof Hb||(i=Uu(i)),!i)return new Ou;if(i instanceof Ou)return i;i=i.rgb();var e=i.r/255,t=i.g/255,n=i.b/255,r=Math.min(e,t,n),s=Math.max(e,t,n),o=NaN,a=s-r,l=(s+r)/2;return a?(e===s?o=(t-n)/a+(t<n)*6:t===s?o=(n-e)/a+2:o=(e-t)/a+4,a/=l<.5?s+r:2-s-r,o*=60):a=l>0&&l<1?0:o,new Ou(o,a,l,i.opacity)}function OK(i,e,t,n){return arguments.length===1?BK(i):new Ou(i,e,t,n??1)}function Ou(i,e,t,n){this.h=+i,this.s=+e,this.l=+t,this.opacity=+n}QM(Ou,OK,MF(Hb,{brighter(i){return i=i==null?tC:Math.pow(tC,i),new Ou(this.h,this.s,this.l*i,this.opacity)},darker(i){return i=i==null?Gb:Math.pow(Gb,i),new Ou(this.h,this.s,this.l*i,this.opacity)},rgb(){var i=this.h%360+(this.h<0)*360,e=isNaN(i)||isNaN(this.s)?0:this.s,t=this.l,n=t+(t<.5?t:1-t)*e,r=2*t-n;return new wl(CF(i>=240?i-240:i+120,r,n),CF(i,r,n),CF(i<120?i+240:i-120,r,n),this.opacity)},clamp(){return new Ou(FK(this.h),eC(this.s),eC(this.l),nC(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){let i=nC(this.opacity);return`${i===1?"hsl(":"hsla("}${FK(this.h)}, ${eC(this.s)*100}%, ${eC(this.l)*100}%${i===1?")":`, ${i})`}`}}));function FK(i){return i=(i||0)%360,i<0?i+360:i}function eC(i){return Math.max(0,Math.min(1,i||0))}function CF(i,e,t){return(i<60?e+(t-e)*i/60:i<180?t:i<240?e+(t-e)*(240-i)/60:e)*255}function RF(i,e,t,n,r){var s=i*i,o=s*i;return((1-3*i+3*s-o)*e+(4-6*s+3*o)*t+(1+3*i+3*s-3*o)*n+o*r)/6}function UK(i){var e=i.length-1;return function(t){var n=t<=0?t=0:t>=1?(t=1,e-1):Math.floor(t*e),r=i[n],s=i[n+1],o=n>0?i[n-1]:2*r-s,a=n<e-1?i[n+2]:2*s-r;return RF((t-n/e)*e,o,r,s,a)}}function kK(i){var e=i.length;return function(t){var n=Math.floor(((t%=1)<0?++t:t)*e),r=i[(n+e-1)%e],s=i[n%e],o=i[(n+1)%e],a=i[(n+2)%e];return RF((t-n/e)*e,r,s,o,a)}}var Wb=i=>()=>i;function xye(i,e){return function(t){return i+t*e}}function yye(i,e,t){return i=Math.pow(i,t),e=Math.pow(e,t)-i,t=1/t,function(n){return Math.pow(i+n*e,t)}}function zK(i){return(i=+i)==1?iC:function(e,t){return t-e?yye(e,t,i):Wb(isNaN(e)?t:e)}}function iC(i,e){var t=e-i;return t?xye(i,t):Wb(isNaN(i)?e:i)}var IF=(function i(e){var t=zK(e);function n(r,s){var o=t((r=p_(r)).r,(s=p_(s)).r),a=t(r.g,s.g),l=t(r.b,s.b),c=iC(r.opacity,s.opacity);return function(u){return r.r=o(u),r.g=a(u),r.b=l(u),r.opacity=c(u),r+""}}return n.gamma=i,n})(1);function VK(i){return function(e){var t=e.length,n=new Array(t),r=new Array(t),s=new Array(t),o,a;for(o=0;o<t;++o)a=p_(e[o]),n[o]=a.r||0,r[o]=a.g||0,s[o]=a.b||0;return n=i(n),r=i(r),s=i(s),a.opacity=1,function(l){return a.r=n(l),a.g=r(l),a.b=s(l),a+""}}}var tet=VK(UK),net=VK(kK);function rC(i,e){e||(e=[]);var t=i?Math.min(e.length,i.length):0,n=e.slice(),r;return function(s){for(r=0;r<t;++r)n[r]=i[r]*(1-s)+e[r]*s;return n}}function sC(i){return ArrayBuffer.isView(i)&&!(i instanceof DataView)}function PF(i,e){return(sC(e)?rC:LF)(i,e)}function LF(i,e){var t=e?e.length:0,n=i?Math.min(t,i.length):0,r=new Array(n),s=new Array(t),o;for(o=0;o<n;++o)r[o]=mg(i[o],e[o]);for(;o<t;++o)s[o]=e[o];return function(a){for(o=0;o<n;++o)s[o]=r[o](a);return s}}function GK(i,e){var t=new Date;return i=+i,e=+e,function(n){return t.setTime(i*(1-n)+e*n),t}}function Qh(i,e){return i=+i,e=+e,function(t){return i*(1-t)+e*t}}function qK(i,e){var t={},n={},r;(i===null||typeof i!="object")&&(i={}),(e===null||typeof e!="object")&&(e={});for(r in e)r in i?t[r]=mg(i[r],e[r]):n[r]=e[r];return function(s){for(r in t)n[r]=t[r](s);return n}}var NF=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,DF=new RegExp(NF.source,"g");function bye(i){return function(){return i}}function wye(i){return function(e){return i(e)+""}}function HK(i,e){var t=NF.lastIndex=DF.lastIndex=0,n,r,s,o=-1,a=[],l=[];for(i=i+"",e=e+"";(n=NF.exec(i))&&(r=DF.exec(e));)(s=r.index)>t&&(s=e.slice(t,s),a[o]?a[o]+=s:a[++o]=s),(n=n[0])===(r=r[0])?a[o]?a[o]+=r:a[++o]=r:(a[++o]=null,l.push({i:o,x:Qh(n,r)})),t=DF.lastIndex;return t<e.length&&(s=e.slice(t),a[o]?a[o]+=s:a[++o]=s),a.length<2?l[0]?wye(l[0].x):bye(e):(e=l.length,function(c){for(var u=0,f;u<e;++u)a[(f=l[u]).i]=f.x(c);return a.join("")})}function mg(i,e){var t=typeof e,n;return e==null||t==="boolean"?Wb(e):(t==="number"?Qh:t==="string"?(n=Uu(e))?(e=n,IF):HK:e instanceof Uu?IF:e instanceof Date?GK:sC(e)?rC:Array.isArray(e)?LF:typeof e.valueOf!="function"&&typeof e.toString!="function"||isNaN(e)?qK:Qh)(i,e)}function FF(i,e){return i=+i,e=+e,function(t){return Math.round(i*(1-t)+e*t)}}function BF(i){return function(){return i}}function OF(i){return+i}var WK=[0,1];function m_(i){return i}function UF(i,e){return(e-=i=+i)?function(t){return(t-i)/e}:BF(isNaN(e)?NaN:.5)}function Sye(i,e){var t;return i>e&&(t=i,i=e,e=t),function(n){return Math.max(i,Math.min(e,n))}}function Tye(i,e,t){var n=i[0],r=i[1],s=e[0],o=e[1];return r<n?(n=UF(r,n),s=t(o,s)):(n=UF(n,r),s=t(s,o)),function(a){return s(n(a))}}function Eye(i,e,t){var n=Math.min(i.length,e.length)-1,r=new Array(n),s=new Array(n),o=-1;for(i[n]<i[0]&&(i=i.slice().reverse(),e=e.slice().reverse());++o<n;)r[o]=UF(i[o],i[o+1]),s[o]=t(e[o],e[o+1]);return function(a){var l=zb(i,a,1,n)-1;return s[l](r[l](a))}}function jK(i,e){return e.domain(i.domain()).range(i.range()).interpolate(i.interpolate()).clamp(i.clamp()).unknown(i.unknown())}function Mye(){var i=WK,e=WK,t=mg,n,r,s,o=m_,a,l,c;function u(){var d=Math.min(i.length,e.length);return o!==m_&&(o=Sye(i[0],i[d-1])),a=d>2?Eye:Tye,l=c=null,f}function f(d){return d==null||isNaN(d=+d)?s:(l||(l=a(i.map(n),e,t)))(n(o(d)))}return f.invert=function(d){return o(r((c||(c=a(e,i.map(n),Qh)))(d)))},f.domain=function(d){return arguments.length?(i=Array.from(d,OF),u()):i.slice()},f.range=function(d){return arguments.length?(e=Array.from(d),u()):e.slice()},f.rangeRound=function(d){return e=Array.from(d),t=FF,u()},f.clamp=function(d){return arguments.length?(o=d?!0:m_,u()):o!==m_},f.interpolate=function(d){return arguments.length?(t=d,u()):t},f.unknown=function(d){return arguments.length?(s=d,f):s},function(d,A){return n=d,r=A,u()}}function kF(){return Mye()(m_,m_)}function XK(i){return Math.abs(i=Math.round(i))>=1e21?i.toLocaleString("en").replace(/,/g,""):i.toString(10)}function Ag(i,e){if(!isFinite(i)||i===0)return null;var t=(i=e?i.toExponential(e-1):i.toExponential()).indexOf("e"),n=i.slice(0,t);return[n.length>1?n[0]+n.slice(2):n,+i.slice(t+1)]}function Jh(i){return i=Ag(Math.abs(i)),i?i[1]:NaN}function $K(i,e){return function(t,n){for(var r=t.length,s=[],o=0,a=i[0],l=0;r>0&&a>0&&(l+a+1>n&&(a=Math.max(1,n-l)),s.push(t.substring(r-=a,r+a)),!((l+=a+1)>n));)a=i[o=(o+1)%i.length];return s.reverse().join(e)}}function YK(i){return function(e){return e.replace(/[0-9]/g,function(t){return i[+t]})}}var Cye=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function G0(i){if(!(e=Cye.exec(i)))throw new Error("invalid format: "+i);var e;return new oC({fill:e[1],align:e[2],sign:e[3],symbol:e[4],zero:e[5],width:e[6],comma:e[7],precision:e[8]&&e[8].slice(1),trim:e[9],type:e[10]})}G0.prototype=oC.prototype;function oC(i){this.fill=i.fill===void 0?" ":i.fill+"",this.align=i.align===void 0?">":i.align+"",this.sign=i.sign===void 0?"-":i.sign+"",this.symbol=i.symbol===void 0?"":i.symbol+"",this.zero=!!i.zero,this.width=i.width===void 0?void 0:+i.width,this.comma=!!i.comma,this.precision=i.precision===void 0?void 0:+i.precision,this.trim=!!i.trim,this.type=i.type===void 0?"":i.type+""}oC.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(this.width===void 0?"":Math.max(1,this.width|0))+(this.comma?",":"")+(this.precision===void 0?"":"."+Math.max(0,this.precision|0))+(this.trim?"~":"")+this.type};function ZK(i){e:for(var e=i.length,t=1,n=-1,r;t<e;++t)switch(i[t]){case".":n=r=t;break;case"0":n===0&&(n=t),r=t;break;default:if(!+i[t])break e;n>0&&(n=0);break}return n>0?i.slice(0,n)+i.slice(r+1):i}var jb;function KK(i,e){var t=Ag(i,e);if(!t)return jb=void 0,i.toPrecision(e);var n=t[0],r=t[1],s=r-(jb=Math.max(-8,Math.min(8,Math.floor(r/3)))*3)+1,o=n.length;return s===o?n:s>o?n+new Array(s-o+1).join("0"):s>0?n.slice(0,s)+"."+n.slice(s):"0."+new Array(1-s).join("0")+Ag(i,Math.max(0,e+s-1))[0]}function zF(i,e){var t=Ag(i,e);if(!t)return i+"";var n=t[0],r=t[1];return r<0?"0."+new Array(-r).join("0")+n:n.length>r+1?n.slice(0,r+1)+"."+n.slice(r+1):n+new Array(r-n.length+2).join("0")}var VF={"%":(i,e)=>(i*100).toFixed(e),b:i=>Math.round(i).toString(2),c:i=>i+"",d:XK,e:(i,e)=>i.toExponential(e),f:(i,e)=>i.toFixed(e),g:(i,e)=>i.toPrecision(e),o:i=>Math.round(i).toString(8),p:(i,e)=>zF(i*100,e),r:zF,s:KK,X:i=>Math.round(i).toString(16).toUpperCase(),x:i=>Math.round(i).toString(16)};function GF(i){return i}var QK=Array.prototype.map,JK=["y","z","a","f","p","n","\xB5","m","","k","M","G","T","P","E","Z","Y"];function eQ(i){var e=i.grouping===void 0||i.thousands===void 0?GF:$K(QK.call(i.grouping,Number),i.thousands+""),t=i.currency===void 0?"":i.currency[0]+"",n=i.currency===void 0?"":i.currency[1]+"",r=i.decimal===void 0?".":i.decimal+"",s=i.numerals===void 0?GF:YK(QK.call(i.numerals,String)),o=i.percent===void 0?"%":i.percent+"",a=i.minus===void 0?"\u2212":i.minus+"",l=i.nan===void 0?"NaN":i.nan+"";function c(f,d){f=G0(f);var A=f.fill,y=f.align,w=f.sign,S=f.symbol,T=f.zero,R=f.width,P=f.comma,I=f.precision,F=f.trim,D=f.type;D==="n"?(P=!0,D="g"):VF[D]||(I===void 0&&(I=12),F=!0,D="g"),(T||A==="0"&&y==="=")&&(T=!0,A="0",y="=");var L=(d&&d.prefix!==void 0?d.prefix:"")+(S==="$"?t:S==="#"&&/[boxX]/.test(D)?"0"+D.toLowerCase():""),C=(S==="$"?n:/[%p]/.test(D)?o:"")+(d&&d.suffix!==void 0?d.suffix:""),B=VF[D],k=/[defgprs%]/.test(D);I=I===void 0?6:/[gprs]/.test(D)?Math.max(1,Math.min(21,I)):Math.max(0,Math.min(20,I));function z(G){var W=L,Y=C,H,$,J;if(D==="c")Y=B(G)+Y,G="";else{G=+G;var te=G<0||1/G<0;if(G=isNaN(G)?l:B(Math.abs(G),I),F&&(G=ZK(G)),te&&+G==0&&w!=="+"&&(te=!1),W=(te?w==="("?w:a:w==="-"||w==="("?"":w)+W,Y=(D==="s"&&!isNaN(G)&&jb!==void 0?JK[8+jb/3]:"")+Y+(te&&w==="("?")":""),k){for(H=-1,$=G.length;++H<$;)if(J=G.charCodeAt(H),48>J||J>57){Y=(J===46?r+G.slice(H+1):G.slice(H))+Y,G=G.slice(0,H);break}}}P&&!T&&(G=e(G,1/0));var ce=W.length+G.length+Y.length,he=ce<R?new Array(R-ce+1).join(A):"";switch(P&&T&&(G=e(he+G,he.length?R-Y.length:1/0),he=""),y){case"<":G=W+G+Y+he;break;case"=":G=W+he+G+Y;break;case"^":G=he.slice(0,ce=he.length>>1)+W+G+Y+he.slice(ce);break;default:G=he+W+G+Y;break}return s(G)}return z.toString=function(){return f+""},z}function u(f,d){var A=Math.max(-8,Math.min(8,Math.floor(Jh(d)/3)))*3,y=Math.pow(10,-A),w=c((f=G0(f),f.type="f",f),{suffix:JK[8+A/3]});return function(S){return w(y*S)}}return{format:c,formatPrefix:u}}var aC,lC,cC;qF({thousands:",",grouping:[3],currency:["$",""]});function qF(i){return aC=eQ(i),lC=aC.format,cC=aC.formatPrefix,aC}function HF(i){return Math.max(0,-Jh(Math.abs(i)))}function WF(i,e){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(Jh(e)/3)))*3-Jh(Math.abs(i)))}function jF(i,e){return i=Math.abs(i),e=Math.abs(e)-i,Math.max(0,Jh(e)-Jh(i))+1}function XF(i,e,t,n){var r=EF(i,e,t),s;switch(n=G0(n??",f"),n.type){case"s":{var o=Math.max(Math.abs(i),Math.abs(e));return n.precision==null&&!isNaN(s=WF(r,o))&&(n.precision=s),cC(n,o)}case"":case"e":case"g":case"p":case"r":{n.precision==null&&!isNaN(s=jF(r,Math.max(Math.abs(i),Math.abs(e))))&&(n.precision=s-(n.type==="e"));break}case"f":case"%":{n.precision==null&&!isNaN(s=HF(r))&&(n.precision=s-(n.type==="%")*2);break}}return lC(n)}function $F(i){var e=i.domain;return i.ticks=function(t){var n=e();return XM(n[0],n[n.length-1],t??10)},i.tickFormat=function(t,n){var r=e();return XF(r[0],r[r.length-1],t??10,n)},i.nice=function(t){t==null&&(t=10);var n=e(),r=0,s=n.length-1,o=n[r],a=n[s],l,c,u=10;for(a<o&&(c=o,o=a,a=c,c=r,r=s,s=c);u-- >0;){if(c=Vb(o,a,t),c===l)return n[r]=o,n[s]=a,e(n);if(c>0)o=Math.floor(o/c)*c,a=Math.ceil(a/c)*c;else if(c<0)o=Math.ceil(o*c)/c,a=Math.floor(a*c)/c;else break;l=c}return i},i}function Sl(){var i=kF();return i.copy=function(){return jK(i,Sl())},KM.apply(i,arguments),$F(i)}function Xb(){var i=0,e=1,t=1,n=[.5],r=[0,1],s;function o(l){return l!=null&&l<=l?r[zb(n,l,0,t)]:s}function a(){var l=-1;for(n=new Array(t);++l<t;)n[l]=((l+1)*e-(l-t)*i)/(t+1);return o}return o.domain=function(l){return arguments.length?([i,e]=l,i=+i,e=+e,a()):[i,e]},o.range=function(l){return arguments.length?(t=(r=Array.from(l)).length-1,a()):r.slice()},o.invertExtent=function(l){var c=r.indexOf(l);return c<0?[NaN,NaN]:c<1?[i,n[0]]:c>=t?[n[t-1],e]:[n[c-1],n[c]]},o.unknown=function(l){return arguments.length&&(s=l),o},o.thresholds=function(){return n.slice()},o.copy=function(){return Xb().domain([i,e]).range(r).unknown(s)},KM.apply($F(o),arguments)}var Pn=1e-6,gg=1e-12,ri=Math.PI,yo=ri/2,A_=ri/4,bo=ri*2,ur=180/ri,_n=ri/180,si=Math.abs,g_=Math.atan,Rs=Math.atan2,mn=Math.cos,$b=Math.ceil,tQ=Math.exp;var uC=Math.hypot,nQ=Math.log;var un=Math.sin,iQ=Math.sign||function(i){return i>0?1:i<0?-1:0},Ho=Math.sqrt,rQ=Math.tan;function sQ(i){return i>1?0:i<-1?ri:Math.acos(i)}function fa(i){return i>1?yo:i<-1?-yo:Math.asin(i)}function YF(i){return(i=un(i/2))*i}function ms(){}function hC(i,e){i&&aQ.hasOwnProperty(i.type)&&aQ[i.type](i,e)}var oQ={Feature:function(i,e){hC(i.geometry,e)},FeatureCollection:function(i,e){for(var t=i.features,n=-1,r=t.length;++n<r;)hC(t[n].geometry,e)}},aQ={Sphere:function(i,e){e.sphere()},Point:function(i,e){i=i.coordinates,e.point(i[0],i[1],i[2])},MultiPoint:function(i,e){for(var t=i.coordinates,n=-1,r=t.length;++n<r;)i=t[n],e.point(i[0],i[1],i[2])},LineString:function(i,e){ZF(i.coordinates,e,0)},MultiLineString:function(i,e){for(var t=i.coordinates,n=-1,r=t.length;++n<r;)ZF(t[n],e,0)},Polygon:function(i,e){lQ(i.coordinates,e)},MultiPolygon:function(i,e){for(var t=i.coordinates,n=-1,r=t.length;++n<r;)lQ(t[n],e)},GeometryCollection:function(i,e){for(var t=i.geometries,n=-1,r=t.length;++n<r;)hC(t[n],e)}};function ZF(i,e,t){var n=-1,r=i.length-t,s;for(e.lineStart();++n<r;)s=i[n],e.point(s[0],s[1],s[2]);e.lineEnd()}function lQ(i,e){var t=-1,n=i.length;for(e.polygonStart();++t<n;)ZF(i[t],e,1);e.polygonEnd()}function q0(i,e){i&&oQ.hasOwnProperty(i.type)?oQ[i.type](i,e):hC(i,e)}var Yb=new qo,cQ=new qo,uQ,hQ,KF,QF,JF,ef={point:ms,lineStart:ms,lineEnd:ms,polygonStart:function(){Yb=new qo,ef.lineStart=Rye,ef.lineEnd=Iye},polygonEnd:function(){var i=+Yb;cQ.add(i<0?bo+i:i),this.lineStart=this.lineEnd=this.point=ms},sphere:function(){cQ.add(bo)}};function Rye(){ef.point=Pye}function Iye(){fQ(uQ,hQ)}function Pye(i,e){ef.point=fQ,uQ=i,hQ=e,i*=_n,e*=_n,KF=i,QF=mn(e=e/2+A_),JF=un(e)}function fQ(i,e){i*=_n,e*=_n,e=e/2+A_;var t=i-KF,n=t>=0?1:-1,r=n*t,s=mn(e),o=un(e),a=JF*o,l=QF*s+a*mn(r),c=a*n*un(r);Yb.add(Rs(c,l)),KF=i,QF=s,JF=o}function vg(i){return[Rs(i[1],i[0]),fa(i[2])]}function Wc(i){var e=i[0],t=i[1],n=mn(t);return[n*mn(e),n*un(e),un(t)]}function Zb(i,e){return i[0]*e[0]+i[1]*e[1]+i[2]*e[2]}function Fd(i,e){return[i[1]*e[2]-i[2]*e[1],i[2]*e[0]-i[0]*e[2],i[0]*e[1]-i[1]*e[0]]}function fC(i,e){i[0]+=e[0],i[1]+=e[1],i[2]+=e[2]}function Kb(i,e){return[i[0]*e,i[1]*e,i[2]*e]}function _g(i){var e=Ho(i[0]*i[0]+i[1]*i[1]+i[2]*i[2]);i[0]/=e,i[1]/=e,i[2]/=e}var Jr,Tl,As,ec,xg,AQ,gQ,v_,Qb,H0,Od,Bd={point:eB,lineStart:dQ,lineEnd:pQ,polygonStart:function(){Bd.point=_Q,Bd.lineStart=Lye,Bd.lineEnd=Dye,Qb=new qo,ef.polygonStart()},polygonEnd:function(){ef.polygonEnd(),Bd.point=eB,Bd.lineStart=dQ,Bd.lineEnd=pQ,Yb<0?(Jr=-(As=180),Tl=-(ec=90)):Qb>Pn?ec=90:Qb<-Pn&&(Tl=-90),Od[0]=Jr,Od[1]=As},sphere:function(){Jr=-(As=180),Tl=-(ec=90)}};function eB(i,e){H0.push(Od=[Jr=i,As=i]),e<Tl&&(Tl=e),e>ec&&(ec=e)}function vQ(i,e){var t=Wc([i*_n,e*_n]);if(v_){var n=Fd(v_,t),r=[n[1],-n[0],0],s=Fd(r,n);_g(s),s=vg(s);var o=i-xg,a=o>0?1:-1,l=s[0]*ur*a,c,u=si(o)>180;u^(a*xg<l&&l<a*i)?(c=s[1]*ur,c>ec&&(ec=c)):(l=(l+360)%360-180,u^(a*xg<l&&l<a*i)?(c=-s[1]*ur,c<Tl&&(Tl=c)):(e<Tl&&(Tl=e),e>ec&&(ec=e))),u?i<xg?Jl(Jr,i)>Jl(Jr,As)&&(As=i):Jl(i,As)>Jl(Jr,As)&&(Jr=i):As>=Jr?(i<Jr&&(Jr=i),i>As&&(As=i)):i>xg?Jl(Jr,i)>Jl(Jr,As)&&(As=i):Jl(i,As)>Jl(Jr,As)&&(Jr=i)}else H0.push(Od=[Jr=i,As=i]);e<Tl&&(Tl=e),e>ec&&(ec=e),v_=t,xg=i}function dQ(){Bd.point=vQ}function pQ(){Od[0]=Jr,Od[1]=As,Bd.point=eB,v_=null}function _Q(i,e){if(v_){var t=i-xg;Qb.add(si(t)>180?t+(t>0?360:-360):t)}else AQ=i,gQ=e;ef.point(i,e),vQ(i,e)}function Lye(){ef.lineStart()}function Dye(){_Q(AQ,gQ),ef.lineEnd(),si(Qb)>Pn&&(Jr=-(As=180)),Od[0]=Jr,Od[1]=As,v_=null}function Jl(i,e){return(e-=i)<0?e+360:e}function Nye(i,e){return i[0]-e[0]}function mQ(i,e){return i[0]<=i[1]?i[0]<=e&&e<=i[1]:e<i[0]||i[1]<e}function dC(i){var e,t,n,r,s,o,a;if(ec=As=-(Jr=Tl=1/0),H0=[],q0(i,Bd),t=H0.length){for(H0.sort(Nye),e=1,n=H0[0],s=[n];e<t;++e)r=H0[e],mQ(n,r[0])||mQ(n,r[1])?(Jl(n[0],r[1])>Jl(n[0],n[1])&&(n[1]=r[1]),Jl(r[0],n[1])>Jl(n[0],n[1])&&(n[0]=r[0])):s.push(n=r);for(o=-1/0,t=s.length-1,e=0,n=s[t];e<=t;n=r,++e)r=s[e],(a=Jl(n[1],r[0]))>o&&(o=a,Jr=r[0],As=n[1])}return H0=Od=null,Jr===1/0||Tl===1/0?[[NaN,NaN],[NaN,NaN]]:[[Jr,Tl],[As,ec]]}var Jb,pC,mC,AC,gC,vC,_C,xC,tB,nB,iB,bQ,wQ,Ha,Wa,ja,ku={sphere:ms,point:rB,lineStart:xQ,lineEnd:yQ,polygonStart:function(){ku.lineStart=Oye,ku.lineEnd=Uye},polygonEnd:function(){ku.lineStart=xQ,ku.lineEnd=yQ}};function rB(i,e){i*=_n,e*=_n;var t=mn(e);ew(t*mn(i),t*un(i),un(e))}function ew(i,e,t){++Jb,mC+=(i-mC)/Jb,AC+=(e-AC)/Jb,gC+=(t-gC)/Jb}function xQ(){ku.point=Fye}function Fye(i,e){i*=_n,e*=_n;var t=mn(e);Ha=t*mn(i),Wa=t*un(i),ja=un(e),ku.point=Bye,ew(Ha,Wa,ja)}function Bye(i,e){i*=_n,e*=_n;var t=mn(e),n=t*mn(i),r=t*un(i),s=un(e),o=Rs(Ho((o=Wa*s-ja*r)*o+(o=ja*n-Ha*s)*o+(o=Ha*r-Wa*n)*o),Ha*n+Wa*r+ja*s);pC+=o,vC+=o*(Ha+(Ha=n)),_C+=o*(Wa+(Wa=r)),xC+=o*(ja+(ja=s)),ew(Ha,Wa,ja)}function yQ(){ku.point=rB}function Oye(){ku.point=kye}function Uye(){SQ(bQ,wQ),ku.point=rB}function kye(i,e){bQ=i,wQ=e,i*=_n,e*=_n,ku.point=SQ;var t=mn(e);Ha=t*mn(i),Wa=t*un(i),ja=un(e),ew(Ha,Wa,ja)}function SQ(i,e){i*=_n,e*=_n;var t=mn(e),n=t*mn(i),r=t*un(i),s=un(e),o=Wa*s-ja*r,a=ja*n-Ha*s,l=Ha*r-Wa*n,c=uC(o,a,l),u=fa(c),f=c&&-u/c;tB.add(f*o),nB.add(f*a),iB.add(f*l),pC+=u,vC+=u*(Ha+(Ha=n)),_C+=u*(Wa+(Wa=r)),xC+=u*(ja+(ja=s)),ew(Ha,Wa,ja)}function yC(i){Jb=pC=mC=AC=gC=vC=_C=xC=0,tB=new qo,nB=new qo,iB=new qo,q0(i,ku);var e=+tB,t=+nB,n=+iB,r=uC(e,t,n);return r<gg&&(e=vC,t=_C,n=xC,pC<Pn&&(e=mC,t=AC,n=gC),r=uC(e,t,n),r<gg)?[NaN,NaN]:[Rs(t,e)*ur,fa(n/r)*ur]}function tw(i,e){function t(n,r){return n=i(n,r),e(n[0],n[1])}return i.invert&&e.invert&&(t.invert=function(n,r){return n=e.invert(n,r),n&&i.invert(n[0],n[1])}),t}function sB(i,e){return si(i)>ri&&(i-=Math.round(i/bo)*bo),[i,e]}sB.invert=sB;function oB(i,e,t){return(i%=bo)?e||t?tw(EQ(i),MQ(e,t)):EQ(i):e||t?MQ(e,t):sB}function TQ(i){return function(e,t){return e+=i,si(e)>ri&&(e-=Math.round(e/bo)*bo),[e,t]}}function EQ(i){var e=TQ(i);return e.invert=TQ(-i),e}function MQ(i,e){var t=mn(i),n=un(i),r=mn(e),s=un(e);function o(a,l){var c=mn(l),u=mn(a)*c,f=un(a)*c,d=un(l),A=d*t+u*n;return[Rs(f*r-A*s,u*t-d*n),fa(A*r+f*s)]}return o.invert=function(a,l){var c=mn(l),u=mn(a)*c,f=un(a)*c,d=un(l),A=d*r-f*s;return[Rs(f*r+d*s,u*t+A*n),fa(A*t-u*n)]},o}function aB(i){i=oB(i[0]*_n,i[1]*_n,i.length>2?i[2]*_n:0);function e(t){return t=i(t[0]*_n,t[1]*_n),t[0]*=ur,t[1]*=ur,t}return e.invert=function(t){return t=i.invert(t[0]*_n,t[1]*_n),t[0]*=ur,t[1]*=ur,t},e}function RQ(i,e,t,n,r,s){if(t){var o=mn(e),a=un(e),l=n*t;r==null?(r=e+n*bo,s=e-l/2):(r=CQ(o,r),s=CQ(o,s),(n>0?r<s:r>s)&&(r+=n*bo));for(var c,u=r;n>0?u>s:u<s;u-=l)c=vg([o,-a*mn(u),-a*un(u)]),i.point(c[0],c[1])}}function CQ(i,e){e=Wc(e),e[0]-=i,_g(e);var t=sQ(-e[1]);return((-e[2]<0?-t:t)+bo-Pn)%bo}function bC(){var i=[],e;return{point:function(t,n,r){e.push([t,n,r])},lineStart:function(){i.push(e=[])},lineEnd:ms,rejoin:function(){i.length>1&&i.push(i.pop().concat(i.shift()))},result:function(){var t=i;return i=[],e=null,t}}}function __(i,e){return si(i[0]-e[0])<Pn&&si(i[1]-e[1])<Pn}function wC(i,e,t,n){this.x=i,this.z=e,this.o=t,this.e=n,this.v=!1,this.n=this.p=null}function SC(i,e,t,n,r){var s=[],o=[],a,l;if(i.forEach(function(y){if(!((w=y.length-1)<=0)){var w,S=y[0],T=y[w],R;if(__(S,T)){if(!S[2]&&!T[2]){for(r.lineStart(),a=0;a<w;++a)r.point((S=y[a])[0],S[1]);r.lineEnd();return}T[0]+=2*Pn}s.push(R=new wC(S,y,null,!0)),o.push(R.o=new wC(S,null,R,!1)),s.push(R=new wC(T,y,null,!1)),o.push(R.o=new wC(T,null,R,!0))}}),!!s.length){for(o.sort(e),IQ(s),IQ(o),a=0,l=o.length;a<l;++a)o[a].e=t=!t;for(var c=s[0],u,f;;){for(var d=c,A=!0;d.v;)if((d=d.n)===c)return;u=d.z,r.lineStart();do{if(d.v=d.o.v=!0,d.e){if(A)for(a=0,l=u.length;a<l;++a)r.point((f=u[a])[0],f[1]);else n(d.x,d.n.x,1,r);d=d.n}else{if(A)for(u=d.p.z,a=u.length-1;a>=0;--a)r.point((f=u[a])[0],f[1]);else n(d.x,d.p.x,-1,r);d=d.p}d=d.o,u=d.z,A=!A}while(!d.v);r.lineEnd()}}}function IQ(i){if(e=i.length){for(var e,t=0,n=i[0],r;++t<e;)n.n=r=i[t],r.p=n,n=r;n.n=r=i[0],r.p=n}}function lB(i){return si(i[0])<=ri?i[0]:iQ(i[0])*((si(i[0])+ri)%bo-ri)}function TC(i,e){var t=lB(e),n=e[1],r=un(n),s=[un(t),-mn(t),0],o=0,a=0,l=new qo;r===1?n=yo+Pn:r===-1&&(n=-yo-Pn);for(var c=0,u=i.length;c<u;++c)if(d=(f=i[c]).length)for(var f,d,A=f[d-1],y=lB(A),w=A[1]/2+A_,S=un(w),T=mn(w),R=0;R<d;++R,y=I,S=D,T=L,A=P){var P=f[R],I=lB(P),F=P[1]/2+A_,D=un(F),L=mn(F),C=I-y,B=C>=0?1:-1,k=B*C,z=k>ri,G=S*D;if(l.add(Rs(G*B*un(k),T*L+G*mn(k))),o+=z?C+B*bo:C,z^y>=t^I>=t){var W=Fd(Wc(A),Wc(P));_g(W);var Y=Fd(s,W);_g(Y);var H=(z^C>=0?-1:1)*fa(Y[2]);(n>H||n===H&&(W[0]||W[1]))&&(a+=z^C>=0?1:-1)}}return(o<-Pn||o<Pn&&l<-gg)^a&1}function EC(i,e,t,n){return function(r){var s=e(r),o=bC(),a=e(o),l=!1,c,u,f,d={point:A,lineStart:w,lineEnd:S,polygonStart:function(){d.point=T,d.lineStart=R,d.lineEnd=P,u=[],c=[]},polygonEnd:function(){d.point=A,d.lineStart=w,d.lineEnd=S,u=Zh(u);var I=TC(c,n);u.length?(l||(r.polygonStart(),l=!0),SC(u,Vye,I,t,r)):I&&(l||(r.polygonStart(),l=!0),r.lineStart(),t(null,null,1,r),r.lineEnd()),l&&(r.polygonEnd(),l=!1),u=c=null},sphere:function(){r.polygonStart(),r.lineStart(),t(null,null,1,r),r.lineEnd(),r.polygonEnd()}};function A(I,F){i(I,F)&&r.point(I,F)}function y(I,F){s.point(I,F)}function w(){d.point=y,s.lineStart()}function S(){d.point=A,s.lineEnd()}function T(I,F){f.push([I,F]),a.point(I,F)}function R(){a.lineStart(),f=[]}function P(){T(f[0][0],f[0][1]),a.lineEnd();var I=a.clean(),F=o.result(),D,L=F.length,C,B,k;if(f.pop(),c.push(f),f=null,!!L){if(I&1){if(B=F[0],(C=B.length-1)>0){for(l||(r.polygonStart(),l=!0),r.lineStart(),D=0;D<C;++D)r.point((k=B[D])[0],k[1]);r.lineEnd()}return}L>1&&I&2&&F.push(F.pop().concat(F.shift())),u.push(F.filter(zye))}}return d}}function zye(i){return i.length>1}function Vye(i,e){return((i=i.x)[0]<0?i[1]-yo-Pn:yo-i[1])-((e=e.x)[0]<0?e[1]-yo-Pn:yo-e[1])}var cB=EC(function(){return!0},Gye,Hye,[-ri,-yo]);function Gye(i){var e=NaN,t=NaN,n=NaN,r;return{lineStart:function(){i.lineStart(),r=1},point:function(s,o){var a=s>0?ri:-ri,l=si(s-e);si(l-ri)<Pn?(i.point(e,t=(t+o)/2>0?yo:-yo),i.point(n,t),i.lineEnd(),i.lineStart(),i.point(a,t),i.point(s,t),r=0):n!==a&&l>=ri&&(si(e-n)<Pn&&(e-=n*Pn),si(s-a)<Pn&&(s-=a*Pn),t=qye(e,t,s,o),i.point(n,t),i.lineEnd(),i.lineStart(),i.point(a,t),r=0),i.point(e=s,t=o),n=a},lineEnd:function(){i.lineEnd(),e=t=NaN},clean:function(){return 2-r}}}function qye(i,e,t,n){var r,s,o=un(i-t);return si(o)>Pn?g_((un(e)*(s=mn(n))*un(t)-un(n)*(r=mn(e))*un(i))/(r*s*o)):(e+n)/2}function Hye(i,e,t,n){var r;if(i==null)r=t*yo,n.point(-ri,r),n.point(0,r),n.point(ri,r),n.point(ri,0),n.point(ri,-r),n.point(0,-r),n.point(-ri,-r),n.point(-ri,0),n.point(-ri,r);else if(si(i[0]-e[0])>Pn){var s=i[0]<e[0]?ri:-ri;r=t*s/2,n.point(-s,r),n.point(0,r),n.point(s,r)}else n.point(e[0],e[1])}function PQ(i){var e=mn(i),t=2*_n,n=e>0,r=si(e)>Pn;function s(u,f,d,A){RQ(A,i,t,d,u,f)}function o(u,f){return mn(u)*mn(f)>e}function a(u){var f,d,A,y,w;return{lineStart:function(){y=A=!1,w=1},point:function(S,T){var R=[S,T],P,I=o(S,T),F=n?I?0:c(S,T):I?c(S+(S<0?ri:-ri),T):0;if(!f&&(y=A=I)&&u.lineStart(),I!==A&&(P=l(f,R),(!P||__(f,P)||__(R,P))&&(R[2]=1)),I!==A)w=0,I?(u.lineStart(),P=l(R,f),u.point(P[0],P[1])):(P=l(f,R),u.point(P[0],P[1],2),u.lineEnd()),f=P;else if(r&&f&&n^I){var D;!(F&d)&&(D=l(R,f,!0))&&(w=0,n?(u.lineStart(),u.point(D[0][0],D[0][1]),u.point(D[1][0],D[1][1]),u.lineEnd()):(u.point(D[1][0],D[1][1]),u.lineEnd(),u.lineStart(),u.point(D[0][0],D[0][1],3)))}I&&(!f||!__(f,R))&&u.point(R[0],R[1]),f=R,A=I,d=F},lineEnd:function(){A&&u.lineEnd(),f=null},clean:function(){return w|(y&&A)<<1}}}function l(u,f,d){var A=Wc(u),y=Wc(f),w=[1,0,0],S=Fd(A,y),T=Zb(S,S),R=S[0],P=T-R*R;if(!P)return!d&&u;var I=e*T/P,F=-e*R/P,D=Fd(w,S),L=Kb(w,I),C=Kb(S,F);fC(L,C);var B=D,k=Zb(L,B),z=Zb(B,B),G=k*k-z*(Zb(L,L)-1);if(!(G<0)){var W=Ho(G),Y=Kb(B,(-k-W)/z);if(fC(Y,L),Y=vg(Y),!d)return Y;var H=u[0],$=f[0],J=u[1],te=f[1],ce;$<H&&(ce=H,H=$,$=ce);var he=$-H,ve=si(he-ri)<Pn,Re=ve||he<Pn;if(!ve&&te<J&&(ce=J,J=te,te=ce),Re?ve?J+te>0^Y[1]<(si(Y[0]-H)<Pn?J:te):J<=Y[1]&&Y[1]<=te:he>ri^(H<=Y[0]&&Y[0]<=$)){var Qe=Kb(B,(-k+W)/z);return fC(Qe,L),[Y,vg(Qe)]}}}function c(u,f){var d=n?i:ri-i,A=0;return u<-d?A|=1:u>d&&(A|=2),f<-d?A|=4:f>d&&(A|=8),A}return EC(o,a,s,n?[0,-i]:[-ri,i-ri])}function LQ(i,e,t,n,r,s){var o=i[0],a=i[1],l=e[0],c=e[1],u=0,f=1,d=l-o,A=c-a,y;if(y=t-o,!(!d&&y>0)){if(y/=d,d<0){if(y<u)return;y<f&&(f=y)}else if(d>0){if(y>f)return;y>u&&(u=y)}if(y=r-o,!(!d&&y<0)){if(y/=d,d<0){if(y>f)return;y>u&&(u=y)}else if(d>0){if(y<u)return;y<f&&(f=y)}if(y=n-a,!(!A&&y>0)){if(y/=A,A<0){if(y<u)return;y<f&&(f=y)}else if(A>0){if(y>f)return;y>u&&(u=y)}if(y=s-a,!(!A&&y<0)){if(y/=A,A<0){if(y>f)return;y>u&&(u=y)}else if(A>0){if(y<u)return;y<f&&(f=y)}return u>0&&(i[0]=o+u*d,i[1]=a+u*A),f<1&&(e[0]=o+f*d,e[1]=a+f*A),!0}}}}}var nw=1e9,MC=-nw;function uB(i,e,t,n){function r(c,u){return i<=c&&c<=t&&e<=u&&u<=n}function s(c,u,f,d){var A=0,y=0;if(c==null||(A=o(c,f))!==(y=o(u,f))||l(c,u)<0^f>0)do d.point(A===0||A===3?i:t,A>1?n:e);while((A=(A+f+4)%4)!==y);else d.point(u[0],u[1])}function o(c,u){return si(c[0]-i)<Pn?u>0?0:3:si(c[0]-t)<Pn?u>0?2:1:si(c[1]-e)<Pn?u>0?1:0:u>0?3:2}function a(c,u){return l(c.x,u.x)}function l(c,u){var f=o(c,1),d=o(u,1);return f!==d?f-d:f===0?u[1]-c[1]:f===1?c[0]-u[0]:f===2?c[1]-u[1]:u[0]-c[0]}return function(c){var u=c,f=bC(),d,A,y,w,S,T,R,P,I,F,D,L={point:C,lineStart:G,lineEnd:W,polygonStart:k,polygonEnd:z};function C(H,$){r(H,$)&&u.point(H,$)}function B(){for(var H=0,$=0,J=A.length;$<J;++$)for(var te=A[$],ce=1,he=te.length,ve=te[0],Re,Qe,Fe=ve[0],mt=ve[1];ce<he;++ce)Re=Fe,Qe=mt,ve=te[ce],Fe=ve[0],mt=ve[1],Qe<=n?mt>n&&(Fe-Re)*(n-Qe)>(mt-Qe)*(i-Re)&&++H:mt<=n&&(Fe-Re)*(n-Qe)<(mt-Qe)*(i-Re)&&--H;return H}function k(){u=f,d=[],A=[],D=!0}function z(){var H=B(),$=D&&H,J=(d=Zh(d)).length;($||J)&&(c.polygonStart(),$&&(c.lineStart(),s(null,null,1,c),c.lineEnd()),J&&SC(d,a,H,s,c),c.polygonEnd()),u=c,d=A=y=null}function G(){L.point=Y,A&&A.push(y=[]),F=!0,I=!1,R=P=NaN}function W(){d&&(Y(w,S),T&&I&&f.rejoin(),d.push(f.result())),L.point=C,I&&u.lineEnd()}function Y(H,$){var J=r(H,$);if(A&&y.push([H,$]),F)w=H,S=$,T=J,F=!1,J&&(u.lineStart(),u.point(H,$));else if(J&&I)u.point(H,$);else{var te=[R=Math.max(MC,Math.min(nw,R)),P=Math.max(MC,Math.min(nw,P))],ce=[H=Math.max(MC,Math.min(nw,H)),$=Math.max(MC,Math.min(nw,$))];LQ(te,ce,i,e,t,n)?(I||(u.lineStart(),u.point(te[0],te[1])),u.point(ce[0],ce[1]),J||u.lineEnd(),D=!1):J&&(u.lineStart(),u.point(H,$),D=!1)}R=H,P=$,I=J}return L}}var hB,fB,CC,RC,x_={sphere:ms,point:ms,lineStart:Wye,lineEnd:ms,polygonStart:ms,polygonEnd:ms};function Wye(){x_.point=Xye,x_.lineEnd=jye}function jye(){x_.point=x_.lineEnd=ms}function Xye(i,e){i*=_n,e*=_n,fB=i,CC=un(e),RC=mn(e),x_.point=$ye}function $ye(i,e){i*=_n,e*=_n;var t=un(e),n=mn(e),r=si(i-fB),s=mn(r),o=un(r),a=n*o,l=RC*t-CC*n*s,c=CC*t+RC*n*s;hB.add(Rs(Ho(a*a+l*l),c)),fB=i,CC=t,RC=n}function DQ(i){return hB=new qo,q0(i,x_),+hB}var dB=[null,null],Yye={type:"LineString",coordinates:dB};function El(i,e){return dB[0]=i,dB[1]=e,DQ(Yye)}var NQ={Feature:function(i,e){return IC(i.geometry,e)},FeatureCollection:function(i,e){for(var t=i.features,n=-1,r=t.length;++n<r;)if(IC(t[n].geometry,e))return!0;return!1}},FQ={Sphere:function(){return!0},Point:function(i,e){return BQ(i.coordinates,e)},MultiPoint:function(i,e){for(var t=i.coordinates,n=-1,r=t.length;++n<r;)if(BQ(t[n],e))return!0;return!1},LineString:function(i,e){return OQ(i.coordinates,e)},MultiLineString:function(i,e){for(var t=i.coordinates,n=-1,r=t.length;++n<r;)if(OQ(t[n],e))return!0;return!1},Polygon:function(i,e){return UQ(i.coordinates,e)},MultiPolygon:function(i,e){for(var t=i.coordinates,n=-1,r=t.length;++n<r;)if(UQ(t[n],e))return!0;return!1},GeometryCollection:function(i,e){for(var t=i.geometries,n=-1,r=t.length;++n<r;)if(IC(t[n],e))return!0;return!1}};function IC(i,e){return i&&FQ.hasOwnProperty(i.type)?FQ[i.type](i,e):!1}function BQ(i,e){return El(i,e)===0}function OQ(i,e){for(var t,n,r,s=0,o=i.length;s<o;s++){if(n=El(i[s],e),n===0||s>0&&(r=El(i[s],i[s-1]),r>0&&t<=r&&n<=r&&(t+n-r)*(1-Math.pow((t-n)/r,2))<gg*r))return!0;t=n}return!1}function UQ(i,e){return!!TC(i.map(Zye),kQ(e))}function Zye(i){return i=i.map(kQ),i.pop(),i}function kQ(i){return[i[0]*_n,i[1]*_n]}function pB(i,e){return(i&&NQ.hasOwnProperty(i.type)?NQ[i.type]:IC)(i,e)}function zQ(i,e,t){var n=Nd(i,e-Pn,t).concat(e);return function(r){return n.map(function(s){return[r,s]})}}function VQ(i,e,t){var n=Nd(i,e-Pn,t).concat(e);return function(r){return n.map(function(s){return[s,r]})}}function mB(){var i,e,t,n,r,s,o,a,l=10,c=l,u=90,f=360,d,A,y,w,S=2.5;function T(){return{type:"MultiLineString",coordinates:R()}}function R(){return Nd($b(n/u)*u,t,u).map(y).concat(Nd($b(a/f)*f,o,f).map(w)).concat(Nd($b(e/l)*l,i,l).filter(function(P){return si(P%u)>Pn}).map(d)).concat(Nd($b(s/c)*c,r,c).filter(function(P){return si(P%f)>Pn}).map(A))}return T.lines=function(){return R().map(function(P){return{type:"LineString",coordinates:P}})},T.outline=function(){return{type:"Polygon",coordinates:[y(n).concat(w(o).slice(1),y(t).reverse().slice(1),w(a).reverse().slice(1))]}},T.extent=function(P){return arguments.length?T.extentMajor(P).extentMinor(P):T.extentMinor()},T.extentMajor=function(P){return arguments.length?(n=+P[0][0],t=+P[1][0],a=+P[0][1],o=+P[1][1],n>t&&(P=n,n=t,t=P),a>o&&(P=a,a=o,o=P),T.precision(S)):[[n,a],[t,o]]},T.extentMinor=function(P){return arguments.length?(e=+P[0][0],i=+P[1][0],s=+P[0][1],r=+P[1][1],e>i&&(P=e,e=i,i=P),s>r&&(P=s,s=r,r=P),T.precision(S)):[[e,s],[i,r]]},T.step=function(P){return arguments.length?T.stepMajor(P).stepMinor(P):T.stepMinor()},T.stepMajor=function(P){return arguments.length?(u=+P[0],f=+P[1],T):[u,f]},T.stepMinor=function(P){return arguments.length?(l=+P[0],c=+P[1],T):[l,c]},T.precision=function(P){return arguments.length?(S=+P,d=zQ(s,r,90),A=VQ(e,i,S),y=zQ(a,o,90),w=VQ(n,t,S),T):S},T.extentMajor([[-180,-90+Pn],[180,90-Pn]]).extentMinor([[-180,-80-Pn],[180,80+Pn]])}function AB(){return mB()()}function yg(i,e){var t=i[0]*_n,n=i[1]*_n,r=e[0]*_n,s=e[1]*_n,o=mn(n),a=un(n),l=mn(s),c=un(s),u=o*mn(t),f=o*un(t),d=l*mn(r),A=l*un(r),y=2*fa(Ho(YF(s-n)+o*l*YF(r-t))),w=un(y),S=y?function(T){var R=un(T*=y)/w,P=un(y-T)/w,I=P*u+R*d,F=P*f+R*A,D=P*a+R*c;return[Rs(F,I)*ur,Rs(D,Ho(I*I+F*F))*ur]}:function(){return[t*ur,n*ur]};return S.distance=y,S}var gB=i=>i;var y_=1/0,PC=y_,iw=-y_,LC=iw,Kye={point:Qye,lineStart:ms,lineEnd:ms,polygonStart:ms,polygonEnd:ms,result:function(){var i=[[y_,PC],[iw,LC]];return iw=LC=-(PC=y_=1/0),i}};function Qye(i,e){i<y_&&(y_=i),i>iw&&(iw=i),e<PC&&(PC=e),e>LC&&(LC=e)}var vB=Kye;function rw(i){return function(e){var t=new _B;for(var n in i)t[n]=i[n];return t.stream=e,t}}function _B(){}_B.prototype={constructor:_B,point:function(i,e){this.stream.point(i,e)},sphere:function(){this.stream.sphere()},lineStart:function(){this.stream.lineStart()},lineEnd:function(){this.stream.lineEnd()},polygonStart:function(){this.stream.polygonStart()},polygonEnd:function(){this.stream.polygonEnd()}};function xB(i,e,t){var n=i.clipExtent&&i.clipExtent();return i.scale(150).translate([0,0]),n!=null&&i.clipExtent(null),q0(t,i.stream(vB)),e(vB.result()),n!=null&&i.clipExtent(n),i}function yB(i,e,t){return xB(i,function(n){var r=e[1][0]-e[0][0],s=e[1][1]-e[0][1],o=Math.min(r/(n[1][0]-n[0][0]),s/(n[1][1]-n[0][1])),a=+e[0][0]+(r-o*(n[1][0]+n[0][0]))/2,l=+e[0][1]+(s-o*(n[1][1]+n[0][1]))/2;i.scale(150*o).translate([a,l])},t)}function GQ(i,e,t){return yB(i,[[0,0],e],t)}function qQ(i,e,t){return xB(i,function(n){var r=+e,s=r/(n[1][0]-n[0][0]),o=(r-s*(n[1][0]+n[0][0]))/2,a=-s*n[0][1];i.scale(150*s).translate([o,a])},t)}function HQ(i,e,t){return xB(i,function(n){var r=+e,s=r/(n[1][1]-n[0][1]),o=-s*n[0][0],a=(r-s*(n[1][1]+n[0][1]))/2;i.scale(150*s).translate([o,a])},t)}var WQ=16,Jye=mn(30*_n);function bB(i,e){return+e?t2e(i,e):e2e(i)}function e2e(i){return rw({point:function(e,t){e=i(e,t),this.stream.point(e[0],e[1])}})}function t2e(i,e){function t(n,r,s,o,a,l,c,u,f,d,A,y,w,S){var T=c-n,R=u-r,P=T*T+R*R;if(P>4*e&&w--){var I=o+d,F=a+A,D=l+y,L=Ho(I*I+F*F+D*D),C=fa(D/=L),B=si(si(D)-1)<Pn||si(s-f)<Pn?(s+f)/2:Rs(F,I),k=i(B,C),z=k[0],G=k[1],W=z-n,Y=G-r,H=R*W-T*Y;(H*H/P>e||si((T*W+R*Y)/P-.5)>.3||o*d+a*A+l*y<Jye)&&(t(n,r,s,o,a,l,z,G,B,I/=L,F/=L,D,w,S),S.point(z,G),t(z,G,B,I,F,D,c,u,f,d,A,y,w,S))}}return function(n){var r,s,o,a,l,c,u,f,d,A,y,w,S={point:T,lineStart:R,lineEnd:I,polygonStart:function(){n.polygonStart(),S.lineStart=F},polygonEnd:function(){n.polygonEnd(),S.lineStart=R}};function T(C,B){C=i(C,B),n.point(C[0],C[1])}function R(){f=NaN,S.point=P,n.lineStart()}function P(C,B){var k=Wc([C,B]),z=i(C,B);t(f,d,u,A,y,w,f=z[0],d=z[1],u=C,A=k[0],y=k[1],w=k[2],WQ,n),n.point(f,d)}function I(){S.point=T,n.lineEnd()}function F(){R(),S.point=D,S.lineEnd=L}function D(C,B){P(r=C,B),s=f,o=d,a=A,l=y,c=w,S.point=P}function L(){t(f,d,u,A,y,w,s,o,r,a,l,c,WQ,n),S.lineEnd=I,I()}return S}}var n2e=rw({point:function(i,e){this.stream.point(i*_n,e*_n)}});function i2e(i){return rw({point:function(e,t){var n=i(e,t);return this.stream.point(n[0],n[1])}})}function r2e(i,e,t,n,r){function s(o,a){return o*=n,a*=r,[e+i*o,t-i*a]}return s.invert=function(o,a){return[(o-e)/i*n,(t-a)/i*r]},s}function jQ(i,e,t,n,r,s){if(!s)return r2e(i,e,t,n,r);var o=mn(s),a=un(s),l=o*i,c=a*i,u=o/i,f=a/i,d=(a*t-o*e)/i,A=(a*e+o*t)/i;function y(w,S){return w*=n,S*=r,[l*w-c*S+e,t-c*w-l*S]}return y.invert=function(w,S){return[n*(u*w-f*S+d),r*(A-f*w-u*S)]},y}function wB(i){return s2e(function(){return i})()}function s2e(i){var e,t=150,n=480,r=250,s=0,o=0,a=0,l=0,c=0,u,f=0,d=1,A=1,y=null,w=cB,S=null,T,R,P,I=gB,F=.5,D,L,C,B,k;function z(H){return C(H[0]*_n,H[1]*_n)}function G(H){return H=C.invert(H[0],H[1]),H&&[H[0]*ur,H[1]*ur]}z.stream=function(H){return B&&k===H?B:B=n2e(i2e(u)(w(D(I(k=H)))))},z.preclip=function(H){return arguments.length?(w=H,y=void 0,Y()):w},z.postclip=function(H){return arguments.length?(I=H,S=T=R=P=null,Y()):I},z.clipAngle=function(H){return arguments.length?(w=+H?PQ(y=H*_n):(y=null,cB),Y()):y*ur},z.clipExtent=function(H){return arguments.length?(I=H==null?(S=T=R=P=null,gB):uB(S=+H[0][0],T=+H[0][1],R=+H[1][0],P=+H[1][1]),Y()):S==null?null:[[S,T],[R,P]]},z.scale=function(H){return arguments.length?(t=+H,W()):t},z.translate=function(H){return arguments.length?(n=+H[0],r=+H[1],W()):[n,r]},z.center=function(H){return arguments.length?(s=H[0]%360*_n,o=H[1]%360*_n,W()):[s*ur,o*ur]},z.rotate=function(H){return arguments.length?(a=H[0]%360*_n,l=H[1]%360*_n,c=H.length>2?H[2]%360*_n:0,W()):[a*ur,l*ur,c*ur]},z.angle=function(H){return arguments.length?(f=H%360*_n,W()):f*ur},z.reflectX=function(H){return arguments.length?(d=H?-1:1,W()):d<0},z.reflectY=function(H){return arguments.length?(A=H?-1:1,W()):A<0},z.precision=function(H){return arguments.length?(D=bB(L,F=H*H),Y()):Ho(F)},z.fitExtent=function(H,$){return yB(z,H,$)},z.fitSize=function(H,$){return GQ(z,H,$)},z.fitWidth=function(H,$){return qQ(z,H,$)},z.fitHeight=function(H,$){return HQ(z,H,$)};function W(){var H=jQ(t,0,0,d,A,f).apply(null,e(s,o)),$=jQ(t,n-H[0],r-H[1],d,A,f);return u=oB(a,l,c),L=tw(e,$),C=tw(u,L),D=bB(L,F),Y()}function Y(){return B=k=null,z}return function(){return e=i.apply(this,arguments),z.invert=e.invert&&G,W()}}function XQ(i){return function(e,t){var n=Ho(e*e+t*t),r=i(n),s=un(r),o=mn(r);return[Rs(e*s,n*o),fa(n&&t*s/n)]}}function sw(i,e){return[i,nQ(rQ((yo+e)/2))]}sw.invert=function(i,e){return[i,2*g_(tQ(e))-yo]};function SB(i,e){var t=mn(e),n=1+mn(i)*t;return[t*un(i)/n,un(e)/n]}SB.invert=XQ(function(i){return 2*g_(i)});function TB(){return wB(SB).scale(250).clipAngle(142)}function CB(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 o2e(i){if(Array.isArray(i))return i}function a2e(i){if(Array.isArray(i))return CB(i)}function ow(i,e,t){if(typeof i=="function"?i===e:i.has(e))return arguments.length<3?e:t;throw new TypeError("Private element is not present on this object")}function l2e(i){if(i===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return i}function c2e(i,e,t){return e=BC(e),_2e(i,QQ()?Reflect.construct(e,[],BC(i).constructor):e.apply(i,t))}function KQ(i,e){if(e.has(i))throw new TypeError("Cannot initialize the same private elements twice on an object")}function u2e(i,e){if(!(i instanceof e))throw new TypeError("Cannot call a class as a function")}function oi(i,e){return i.get(ow(i,e))}function W0(i,e,t){KQ(i,e),e.set(i,t)}function j0(i,e,t){return i.set(ow(i,e),t),t}function h2e(i,e){KQ(i,e),e.add(i)}function f2e(i,e){for(var t=0;t<e.length;t++){var n=e[t];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(i,eJ(n.key),n)}}function d2e(i,e,t){return e&&f2e(i.prototype,e),Object.defineProperty(i,"prototype",{writable:!1}),i}function b_(i,e,t){return(e=eJ(e))in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function BC(i){return BC=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},BC(i)}function p2e(i,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");i.prototype=Object.create(e&&e.prototype,{constructor:{value:i,writable:!0,configurable:!0}}),Object.defineProperty(i,"prototype",{writable:!1}),e&&RB(i,e)}function QQ(){try{var i=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(QQ=function(){return!!i})()}function m2e(i){if(typeof Symbol<"u"&&i[Symbol.iterator]!=null||i["@@iterator"]!=null)return Array.from(i)}function A2e(i,e){var t=i==null?null:typeof Symbol<"u"&&i[Symbol.iterator]||i["@@iterator"];if(t!=null){var n,r,s,o,a=[],l=!0,c=!1;try{if(s=(t=t.call(i)).next,e!==0)for(;!(l=(n=s.call(t)).done)&&(a.push(n.value),a.length!==e);l=!0);}catch(u){c=!0,r=u}finally{try{if(!l&&t.return!=null&&(o=t.return(),Object(o)!==o))return}finally{if(c)throw r}}return a}}function g2e(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.4119-In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function v2e(){throw new TypeError(`Invalid attempt to spread non-iterable instance.4120-In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function _2e(i,e){if(e&&(typeof e=="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return l2e(i)}function RB(i,e){return RB=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,n){return t.__proto__=n,t},RB(i,e)}function FC(i,e){return o2e(i)||A2e(i,e)||tJ(i,e)||g2e()}function JQ(i){return a2e(i)||m2e(i)||tJ(i)||v2e()}function x2e(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 String(i)}function eJ(i){var e=x2e(i,"string");return typeof e=="symbol"?e:e+""}function tJ(i,e){if(i){if(typeof i=="string")return CB(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)?CB(i,e):void 0}}var nJ=function(e){e instanceof Array?e.forEach(nJ):(e.map&&e.map.dispose(),e.dispose())},IB=function(e){e.geometry&&e.geometry.dispose(),e.material&&nJ(e.material),e.texture&&e.texture.dispose(),e.children&&e.children.forEach(IB)};function iJ(i,e,t){var n=(90-i)*Math.PI/180,r=(90-e)*Math.PI/180;return{x:t*Math.sin(n)*Math.cos(r),y:t*Math.cos(n),z:t*Math.sin(n)*Math.sin(r)}}function y2e(i){var e=i.x,t=i.y,n=i.z,r=Math.sqrt(e*e+t*t+n*n),s=Math.acos(t/r),o=Math.atan2(n,e);return{lat:90-s*180/Math.PI,lng:90-o*180/Math.PI-(o<-Math.PI/2?360:0),r}}function bg(i){return i*Math.PI/180}var rJ=function(e){return 1-(sw(0,(.5-e)*Math.PI)[1]/Math.PI+1)/2},EB=function(e){return Math.max(0,Math.min(1,rJ(e)))},$Q=function(e){return .5-sw.invert(0,(2*(1-e)-1)*Math.PI)[1]/Math.PI},b2e=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]:1,r=Sl().domain([1,0]).range([t,n]).clamp(!0),s=Sl().domain([EB(t),EB(n)]).range([1,0]).clamp(!0),o=function(f){return s(EB(r(f)))},a=e.array,l=0,c=a.length;l<c;l+=2)a[l+1]=o(a[l+1]);e.needsUpdate=!0},YQ=function(e,t,n,r){var s=Math.pow(2,e),o=Math.max(0,Math.min(s-1,Math.floor((n+180)*s/360))),a=(90-r)/180;t&&(a=Math.max(0,Math.min(1,rJ(a))));var l=Math.floor(a*s);return[o,l]},PB=function(e,t){for(var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:0,s=arguments.length>4?arguments[4]:void 0,o=arguments.length>5?arguments[5]:void 0,a=[],l=Math.pow(2,e),c=360/l,u=180/l,f=s===void 0?l-1:s,d=o===void 0?l-1:o,A=n,y=Math.min(l-1,f);A<=y;A++)for(var w=r,S=Math.min(l-1,d);w<=S;w++){var T=w,R=u;if(t){T=w===0?w:$Q(w/l)*l;var P=w+1===l?w+1:$Q((w+1)/l)*l;R=(P-T)*180/l}var I=-180+(A+.5)*c,F=90-(T*180/l+R/2),D=R;a.push({x:A,y:w,lng:I,lat:F,latLen:D})}return a},w2e=6,S2e=7,T2e=3,E2e=90,tf=new WeakMap,X0=new WeakMap,MB=new WeakMap,DC=new WeakMap,jc=new WeakMap,OC=new WeakMap,w_=new WeakMap,wg=new WeakMap,NC=new WeakSet,sJ=(function(i){function e(t){var n,r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},s=r.tileUrl,o=r.minLevel,a=o===void 0?0:o,l=r.maxLevel,c=l===void 0?17:l,u=r.mercatorProjection,f=u===void 0?!0:u;return u2e(this,e),n=c2e(this,e),h2e(n,NC),W0(n,tf,void 0),W0(n,X0,void 0),W0(n,MB,void 0),W0(n,DC,void 0),W0(n,jc,{}),W0(n,OC,void 0),W0(n,w_,void 0),W0(n,wg,void 0),b_(n,"minLevel",void 0),b_(n,"maxLevel",void 0),b_(n,"thresholds",JQ(new Array(30)).map(function(d,A){return 8/Math.pow(2,A)})),b_(n,"curvatureResolution",5),b_(n,"tileMargin",0),b_(n,"clearTiles",function(){Object.values(oi(jc,n)).forEach(function(d){d.forEach(function(A){A.obj&&(n.remove(A.obj),IB(A.obj),delete A.obj)})}),j0(jc,n,{})}),j0(tf,n,t),n.tileUrl=s,j0(X0,n,f),n.minLevel=a,n.maxLevel=c,n.level=0,n.add(j0(wg,n,new Hn(new za(oi(tf,n)*.99,180,90),new fs({color:0})))),oi(wg,n).visible=!1,oi(wg,n).material.polygonOffset=!0,oi(wg,n).material.polygonOffsetUnits=3,oi(wg,n).material.polygonOffsetFactor=1,n}return p2e(e,i),d2e(e,[{key:"tileUrl",get:function(){return oi(MB,this)},set:function(n){j0(MB,this,n),this.updatePov(oi(w_,this))}},{key:"level",get:function(){return oi(DC,this)},set:function(n){var r,s=this;oi(jc,this)[n]||ow(NC,this,M2e).call(this,n);var o=oi(DC,this);if(j0(DC,this,n),!(n===o||o===void 0)){if(oi(wg,this).visible=n>0,oi(jc,this)[n].forEach(function(l){return l.obj&&(l.obj.material.depthWrite=!0)}),o<n&&((r=oi(jc,this)[o])===null||r===void 0||r.forEach(function(l){return l.obj&&(l.obj.material.depthWrite=!1)})),o>n)for(var a=n+1;a<=o;a++)oi(jc,this)[a]&&oi(jc,this)[a].forEach(function(l){l.obj&&(s.remove(l.obj),IB(l.obj),delete l.obj)});ow(NC,this,ZQ).call(this)}}},{key:"updatePov",value:function(n){var r=this;if(!(!n||!(n instanceof Cd))){j0(w_,this,n);var s;if(j0(OC,this,function(u){if(!u.hullPnts){var f=360/Math.pow(2,r.level),d=u.lng,A=u.lat,y=u.latLen,w=d-f/2,S=d+f/2,T=A-y/2,R=A+y/2;u.hullPnts=[[A,d],[T,w],[R,w],[T,S],[R,S]].map(function(P){var I=FC(P,2),F=I[0],D=I[1];return iJ(F,D,oi(tf,r))}).map(function(P){var I=P.x,F=P.y,D=P.z;return new re(I,F,D)})}return s||(s=new zc,n.updateMatrix(),n.updateMatrixWorld(),s.setFromProjectionMatrix(new cn().multiplyMatrices(n.projectionMatrix,n.matrixWorldInverse))),u.hullPnts.some(function(P){return s.containsPoint(P.clone().applyMatrix4(r.matrixWorld))})}),this.tileUrl){var o=n.position.clone(),a=o.distanceTo(this.getWorldPosition(new re)),l=(a-oi(tf,this))/oi(tf,this),c=this.thresholds.findIndex(function(u){return u&&u<=l});this.level=Math.min(this.maxLevel,Math.max(this.minLevel,c<0?this.thresholds.length:c)),ow(NC,this,ZQ).call(this)}}}}])})(Br);function M2e(i){var e=this;if(i>S2e){oi(jc,this)[i]=[];return}var t=oi(jc,this)[i]=PB(i,oi(X0,this));t.forEach(function(n){return n.centroid=iJ(n.lat,n.lng,oi(tf,e))}),t.octree=kb().x(function(n){return n.centroid.x}).y(function(n){return n.centroid.y}).z(function(n){return n.centroid.z}).addAll(t)}function ZQ(){var i=this;if(!(!this.tileUrl||this.level===void 0||!oi(jc,this).hasOwnProperty(this.level))&&!(!oi(OC,this)&&this.level>w2e)){var e=oi(jc,this)[this.level];if(oi(w_,this)){var t=this.worldToLocal(oi(w_,this).position.clone());if(e.octree){var n,r=this.worldToLocal(oi(w_,this).position.clone()),s=(r.length()-oi(tf,this))*T2e;e=(n=e.octree).findAllWithinRadius.apply(n,JQ(r).concat([s]))}else{var o=y2e(t),a=(o.r/oi(tf,this)-1)*E2e,l=a/Math.cos(bg(o.lat)),c=[o.lng-l,o.lng+l],u=[o.lat+a,o.lat-a],f=YQ(this.level,oi(X0,this),c[0],u[0]),d=FC(f,2),A=d[0],y=d[1],w=YQ(this.level,oi(X0,this),c[1],u[1]),S=FC(w,2),T=S[0],R=S[1];!e.record&&(e.record={});var P=e.record;if(!P.hasOwnProperty("".concat(Math.round((A+T)/2),"_").concat(Math.round((y+R)/2))))e=PB(this.level,oi(X0,this),A,y,T,R).map(function(C){var B="".concat(C.x,"_").concat(C.y);return P.hasOwnProperty(B)?P[B]:(P[B]=C,e.push(C),C)});else{for(var I=[],F=A;F<=T;F++)for(var D=y;D<=R;D++){var L="".concat(F,"_").concat(D);P.hasOwnProperty(L)||(P[L]=PB(this.level,oi(X0,this),F,D,F,D)[0],e.push(P[L])),I.push(P[L])}e=I}}}e.filter(function(C){return!C.obj}).filter(oi(OC,this)||function(){return!0}).forEach(function(C){var B=C.x,k=C.y,z=C.lng,G=C.lat,W=C.latLen,Y=360/Math.pow(2,i.level);if(!C.obj){var H=Y*(1-i.tileMargin),$=W*(1-i.tileMargin),J=bg(z),te=bg(-G),ce=new Hn(new za(oi(tf,i),Math.ceil(H/i.curvatureResolution),Math.ceil($/i.curvatureResolution),bg(90-H/2)+J,bg(H),bg(90-$/2)+te,bg($)),new Va);if(oi(X0,i)){var he=[G+W/2,G-W/2].map(function(Fe){return .5-Fe/180}),ve=FC(he,2),Re=ve[0],Qe=ve[1];b2e(ce.geometry.attributes.uv,Re,Qe)}C.obj=ce}C.loading||(C.loading=!0,new yl().load(i.tileUrl(B,k,i.level),function(Fe){var mt=C.obj;mt&&(Fe.colorSpace=Fr,mt.material.map=Fe,mt.material.color=null,mt.material.needsUpdate=!0,i.add(mt)),C.loading=!1}))})}}var uw=new Set,LB=!1;function kB(i,e,t=2){let n=e&&e.length,r=n?e[0]*t:i.length;uw.size&&uw.clear();let s=cJ(i,0,r,t,!0),o=[];if(!s||s.next===s.prev)return o;let a=0,l=0,c=0;if(n&&(s=L2e(i,e,s,t)),i.length>80*t){a=i[0],l=i[1];let u=a,f=l;for(let d=t;d<r;d+=t){let A=i[d],y=i[d+1];A<a&&(a=A),y<l&&(l=y),A>u&&(u=A),y>f&&(f=y)}c=Math.max(u-a,f-l),c=c!==0?32767/c:0}return DB(s,o,a,l,c),o}function cJ(i,e,t,n,r){let s=null;if(r===W2e(i,e,t,n)>0)for(let o=e;o<t;o+=n)s=lJ(o/n|0,i[o],i[o+1],s);else for(let o=t-n;o>=e;o-=n)s=lJ(o/n|0,i[o],i[o+1],s);return s&&hw(s,s.next)&&(dw(s),s=s.next),s}function Tg(i,e=i){let t=e===i,n=i,r;do r=!1,n!==n.next&&(uw.size===0||!uw.has(n))&&(hw(n,n.next)||Xs(n.prev,n,n.next)===0)?((t||n===e)&&(e=n.prev),LB=!0,dw(n),n=n.prev,r=!0):(t||n!==e)&&(n=n.next,r=!t);while(r||n!==e);return e}function DB(i,e,t,n,r){r&&k2e(i,t,n,r);let s=i,o=!1;for(;i.prev!==i.next;){let a=i.prev,l=i.next;if(Xs(a,i,l)<0&&(r?R2e(i,t,n,r):C2e(i))){e.push(a.i,i.i,l.i),dw(i),i=l,s=l;continue}if(i=l,i===s){if(LB=!1,i=Tg(i),LB){s=i;continue}if(!o){i=I2e(i,e),s=i,o=!0;continue}P2e(i,e,t,n,r);break}}}function C2e(i){let e=i.prev,t=i,n=i.next,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),d=Math.max(r,s,o),A=Math.max(a,l,c),y=n.next;for(;y!==e;){if(y.x>=u&&y.x<=d&&y.y>=f&&y.y<=A&&!(r===y.x&&a===y.y)&&VC(r,a,s,l,o,c,y.x,y.y)&&Xs(y.prev,y,y.next)>=0)return!1;y=y.next}return!0}function R2e(i,e,t,n){let r=i.prev,s=i,o=i.next,a=r.x,l=s.x,c=o.x,u=r.y,f=s.y,d=o.y,A=Math.min(a,l,c),y=Math.min(u,f,d),w=Math.max(a,l,c),S=Math.max(u,f,d),T=OB(A,y,e,t,n),R=OB(w,S,e,t,n),P=i.prevZ;for(;P&&P.z>=T;){if(P.x>=A&&P.x<=w&&P.y>=y&&P.y<=S&&P!==o&&!(a===P.x&&u===P.y)&&VC(a,u,l,f,c,d,P.x,P.y)&&Xs(P.prev,P,P.next)>=0)return!1;P=P.prevZ}let I=i.nextZ;for(;I&&I.z<=R;){if(I.x>=A&&I.x<=w&&I.y>=y&&I.y<=S&&I!==o&&!(a===I.x&&u===I.y)&&VC(a,u,l,f,c,d,I.x,I.y)&&Xs(I.prev,I,I.next)>=0)return!1;I=I.nextZ}return!0}function I2e(i,e){let t=i,n=!1;do{let r=t.prev,s=t.next.next;fJ(r,t,t.next,s,!1)&&fw(r,s)&&fw(s,r)&&(e.push(r.i,t.i,s.i),dw(t),dw(t.next),t=i=s,n=!0),t=t.next}while(t!==i);return n?Tg(t):t}function P2e(i,e,t,n,r){let s=i;do{let o=s.next.next;for(;o!==s.prev;){if(s.i!==o.i&&G2e(s,o)){let a=dJ(s,o);s=Tg(s,s.next),a=Tg(a,a.next),DB(s,e,t,n,r),DB(a,e,t,n,r);return}o=o.next}s=s.next}while(s!==i)}var NB=!1;function L2e(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=cJ(i,a,l,n,!1);c===c.next&&uw.add(c),r.push(V2e(c))}r.sort(D2e),F2e(i.length/n,e.length),hJ(t,t),NB=!0;for(let s=0;s<r.length;s++)t=N2e(r[s],t);return NB=!1,Tg(t)}function D2e(i,e){return i.x-e.x||i.y-e.y||(i.next.y-i.y)/(i.next.x-i.x)-(e.next.y-e.y)/(e.next.x-e.x)}function N2e(i,e){let t=O2e(i,e);if(!t)return e;let n=dJ(t,i),r=n.next;return hJ(t,r.next),Tg(n,n.next),Tg(t,t.next)}var uJ=16,gs=new Float64Array(0),zC=0,FB=[],BB=[];function F2e(i,e){let t=Math.ceil((i+2*e)/uJ)+e+2;gs.length<t*4&&(gs=new Float64Array(t*4)),zC=0}function hJ(i,e){let t=i;do{let n=zC++;FB[n]=t;let r=1/0,s=1/0,o=-1/0,a=-1/0,l=0;do{let u=t.next;t.z=n,t.x<r&&(r=t.x),t.x>o&&(o=t.x),t.y<s&&(s=t.y),t.y>a&&(a=t.y),u.x<r&&(r=u.x),u.x>o&&(o=u.x),u.y<s&&(s=u.y),u.y>a&&(a=u.y),t=u}while(++l<uJ&&t!==e);BB[n]=t;let c=n*4;gs[c]=r,gs[c+1]=s,gs[c+2]=o,gs[c+3]=a}while(t!==e)}function B2e(i,e){let t=i.z*4;e.x<gs[t]&&(gs[t]=e.x),e.y<gs[t+1]&&(gs[t+1]=e.y),e.x>gs[t+2]&&(gs[t+2]=e.x),e.y>gs[t+3]&&(gs[t+3]=e.y)}function oJ(i){let e=BB[i];for(;e.prev.next!==e;)e=e.next;return BB[i]=e,e}function aJ(i){let e=FB[i];for(;e.prev.next!==e;)e=e.next;return FB[i]=e,e}function O2e(i,e){let t=e,n=i.x,r=i.y,s=-1/0,o;if(hw(i,t))return t;for(let d=0,A=0;d<zC;d++,A+=4){if(r<gs[A+1]||r>gs[A+3]||gs[A]>n||gs[A+2]<=s)continue;let y=oJ(d);t=aJ(d);do{if(t.prev.next===t){if(hw(i,t.next))return t.next;if(r<=t.y&&r>=t.next.y&&t.next.y!==t.y){let w=t.x+(r-t.y)*(t.next.x-t.x)/(t.next.y-t.y);if(w<=n&&w>s&&(s=w,o=t.x<t.next.x?t:t.next,w===n))return o}}t=t.next}while(t!==y)}if(!o)return null;let a=o.x,l=o.y,c=Math.min(r,l),u=Math.max(r,l),f=1/0;for(let d=0,A=0;d<zC;d++,A+=4){if(gs[A+2]<a||gs[A]>n||gs[A+3]<c||gs[A+1]>u)continue;let y=oJ(d);t=aJ(d);do{if(t.prev.next===t&&n>=t.x&&t.x>=a&&n!==t.x&&VC(r<l?n:s,r,a,l,r<l?s:n,r,t.x,t.y)){let w=Math.abs(r-t.y)/(n-t.x);(fw(t,i)||t.y===r&&t.next.y===r&&t.next.x>n)&&(w<f||w===f&&(t.x>o.x||t.x===o.x&&U2e(o,t)))&&(o=t,f=w)}t=t.next}while(t!==y)}return o}function U2e(i,e){return Xs(i.prev,i,e.prev)<0&&Xs(e.next,i,i.next)<0}var Xc=[],aw=[],Sg=new Uint32Array(0),lw=new Uint32Array(0),cw=new Uint32Array(256);function k2e(i,e,t,n){let r=i,s=0;do r.z=OB(r.x,r.y,e,t,n),Xc[s++]=r,r=r.next;while(r!==i);z2e(s);let o=null;for(let a=0;a<s;a++){let l=Xc[a];l.prevZ=o,o&&(o.nextZ=l),o=l}o.nextZ=null}function z2e(i){if(i<=32){for(let e=1;e<i;e++){let t=Xc[e],n=t.z,r=e-1;for(;r>=0&&Xc[r].z>n;)Xc[r+1]=Xc[r],r--;Xc[r+1]=t}return}Sg.length<i&&(Sg=new Uint32Array(i),lw=new Uint32Array(i),aw=new Array(i));for(let e=0;e<i;e++)Sg[e]=Xc[e].z;UC(i,Xc,Sg,aw,lw,0),UC(i,aw,lw,Xc,Sg,8),UC(i,Xc,Sg,aw,lw,16),UC(i,aw,lw,Xc,Sg,24)}function UC(i,e,t,n,r,s){cw.fill(0);for(let a=0;a<i;a++)cw[t[a]>>>s&255]++;let o=0;for(let a=0;a<256;a++){let l=cw[a];cw[a]=o,o+=l}for(let a=0;a<i;a++){let l=t[a],c=cw[l>>>s&255]++;n[c]=e[a],r[c]=l}}function OB(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 V2e(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 VC(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 G2e(i,e){let t=hw(i,e)&&Xs(i.prev,i,i.next)>0&&Xs(e.prev,e,e.next)>0;return i.next.i!==e.i&&(t||fw(i,e)&&fw(e,i)&&(Xs(i.prev,i,e.prev)!==0||Xs(i,e.prev,e)!==0))&&!q2e(i,e)&&(t||H2e(i,e))}function Xs(i,e,t){return(e.y-i.y)*(t.x-e.x)-(e.x-i.x)*(t.y-e.y)}function hw(i,e){return i.x===e.x&&i.y===e.y}function fJ(i,e,t,n,r=!0){let s=Xs(i,e,t),o=Xs(i,e,n),a=Xs(t,n,i),l=Xs(t,n,e);return(s>0&&o<0||s<0&&o>0)&&(a>0&&l<0||a<0&&l>0)?!0:r?!!(s===0&&kC(i,t,e)||o===0&&kC(i,n,e)||a===0&&kC(t,i,n)||l===0&&kC(t,e,n)):!1}function kC(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 q2e(i,e){let t=Math.min(i.x,e.x),n=Math.max(i.x,e.x),r=Math.min(i.y,e.y),s=Math.max(i.y,e.y),o=i;do{let a=o.next;if(o.x>n&&a.x>n||o.x<t&&a.x<t||o.y>s&&a.y>s||o.y<r&&a.y<r){o=a;continue}if(o.i!==i.i&&a.i!==i.i&&o.i!==e.i&&a.i!==e.i&&fJ(o,a,i,e))return!0;o=a}while(o!==i);return!1}function fw(i,e){return Xs(i.prev,i,i.next)<0?Xs(i,e,i.next)>=0&&Xs(i,i.prev,e)>=0:Xs(i,e,i.prev)<0||Xs(i,i.next,e)<0}function H2e(i,e){let t=i,n=!1,r=(i.x+e.x)/2,s=(i.y+e.y)/2;do{let o=t.next;t.y>s!=o.y>s&&r<(o.x-t.x)*(s-t.y)/(o.y-t.y)+t.x&&(n=!n),t=o}while(t!==i);return n}function dJ(i,e){let t=UB(i.i,i.x,i.y),n=UB(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 lJ(i,e,t,n){let r=UB(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 dw(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),NB&&B2e(i.prev,i.next)}function UB(i,e,t){return{i,x:e,y:t,prev:null,next:null,z:0,prevZ:null,nextZ:null}}function W2e(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}function S_(i){let e=[],t=[],n=i[0][0].length,r=0,s=0;for(let o of i){for(let a of o)for(let l=0;l<n;l++)e.push(a[l]);s&&(r+=s,t.push(r)),s=o.length}return{vertices:e,holes:t,dimensions:n}}function VB(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 j2e(i){if(Array.isArray(i))return i}function X2e(i){if(Array.isArray(i))return VB(i)}function $2e(i){if(i===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return i}function Y2e(i,e,t){return e=GC(e),rbe(i,AJ()?Reflect.construct(e,[],GC(i).constructor):e.apply(i,t))}function Z2e(i,e){if(!(i instanceof e))throw new TypeError("Cannot call a class as a function")}function K2e(i,e,t){return Object.defineProperty(i,"prototype",{writable:!1}),i}function Q2e(i,e){var t=typeof Symbol<"u"&&i[Symbol.iterator]||i["@@iterator"];if(!t){if(Array.isArray(i)||(t=HB(i))||e){t&&(i=t);var n=0,r=function(){};return{s:r,n:function(){return n>=i.length?{done:!0}:{done:!1,value:i[n++]}},e:function(l){throw l},f:r}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.4121-In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var s,o=!0,a=!1;return{s:function(){t=t.call(i)},n:function(){var l=t.next();return o=l.done,l},e:function(l){a=!0,s=l},f:function(){try{o||t.return==null||t.return()}finally{if(a)throw s}}}}function GC(i){return GC=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},GC(i)}function J2e(i,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");i.prototype=Object.create(e&&e.prototype,{constructor:{value:i,writable:!0,configurable:!0}}),Object.defineProperty(i,"prototype",{writable:!1}),e&&GB(i,e)}function AJ(){try{var i=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(AJ=function(){return!!i})()}function ebe(i){if(typeof Symbol<"u"&&i[Symbol.iterator]!=null||i["@@iterator"]!=null)return Array.from(i)}function tbe(i,e){var t=i==null?null:typeof Symbol<"u"&&i[Symbol.iterator]||i["@@iterator"];if(t!=null){var n,r,s,o,a=[],l=!0,c=!1;try{if(s=(t=t.call(i)).next,e===0){if(Object(t)!==t)return;l=!1}else for(;!(l=(n=s.call(t)).done)&&(a.push(n.value),a.length!==e);l=!0);}catch(u){c=!0,r=u}finally{try{if(!l&&t.return!=null&&(o=t.return(),Object(o)!==o))return}finally{if(c)throw r}}return a}}function nbe(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.4122-In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function ibe(){throw new TypeError(`Invalid attempt to spread non-iterable instance.4123-In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function rbe(i,e){if(e&&(typeof e=="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return $2e(i)}function GB(i,e){return GB=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,n){return t.__proto__=n,t},GB(i,e)}function pw(i,e){return j2e(i)||tbe(i,e)||HB(i,e)||nbe()}function sbe(i){return X2e(i)||ebe(i)||HB(i)||ibe()}function HB(i,e){if(i){if(typeof i=="string")return VB(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)?VB(i,e):void 0}}var pJ=function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,n=[],r=null;return e.forEach(function(s){if(r){var o=El(s,r)*180/Math.PI;if(o>t)for(var a=yg(r,s),l=r.length>2||s.length>2?Qh(r[2]||0,s[2]||0):null,c=l?function(d){return[].concat(sbe(a(d)),[l(d)])}:a,u=1/Math.ceil(o/t),f=u;f<1;)n.push(c(f)),f+=u}n.push(r=s)}),n},qB=typeof window<"u"&&window.THREE?window.THREE:{BufferGeometry:Xn,Float32BufferAttribute:Ln},obe=new qB.BufferGeometry().setAttribute?"setAttribute":"addAttribute",WB=(function(i){function e(t){var n,r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,s=arguments.length>2&&arguments[2]!==void 0?arguments[2]:5;Z2e(this,e),n=Y2e(this,e),n.type="GeoJsonGeometry",n.parameters={geoJson:t,radius:r,resolution:s};var o=({Point:u,MultiPoint:f,LineString:d,MultiLineString:A,Polygon:y,MultiPolygon:w}[t.type]||function(){return[]})(t.coordinates,r),a=[],l=[],c=0;o.forEach(function(S){var T=a.length;mw({indices:a,vertices:l},S),n.addGroup(T,a.length-T,c++)}),a.length&&n.setIndex(a),l.length&&n[obe]("position",new qB.Float32BufferAttribute(l,3));function u(S,T){var R=zB(S[1],S[0],T+(S[2]||0)),P=[];return[{vertices:R,indices:P}]}function f(S,T){var R={vertices:[],indices:[]};return S.map(function(P){return u(P,T)}).forEach(function(P){var I=pw(P,1),F=I[0];mw(R,F)}),[R]}function d(S,T){for(var R=pJ(S,s).map(function(C){var B=pw(C,3),k=B[0],z=B[1],G=B[2],W=G===void 0?0:G;return zB(z,k,T+W)}),P=S_([R]),I=P.vertices,F=Math.round(I.length/3),D=[],L=1;L<F;L++)D.push(L-1,L);return[{vertices:I,indices:D}]}function A(S,T){var R={vertices:[],indices:[]};return S.map(function(P){return d(P,T)}).forEach(function(P){var I=pw(P,1),F=I[0];mw(R,F)}),[R]}function y(S,T){for(var R=S.map(function(H){return pJ(H,s).map(function($){var J=pw($,3),te=J[0],ce=J[1],he=J[2],ve=he===void 0?0:he;return zB(ce,te,T+ve)})}),P=S_(R),I=P.vertices,F=P.holes,D=F[0]||1/0,L=I.slice(0,D*3),C=I.slice(D*3),B=new Set(F),k=Math.round(I.length/3),z=[],G=[],W=1;W<k;W++)B.has(W)||(W<D?z.push(W-1,W):G.push(W-1-D,W-D));var Y=[{indices:z,vertices:L}];return F.length&&Y.push({indices:G,vertices:C}),Y}function w(S,T){var R={vertices:[],indices:[]},P={vertices:[],indices:[]};S.map(function(F){return y(F,T)}).forEach(function(F){var D=pw(F,2),L=D[0],C=D[1];mw(R,L),C&&mw(P,C)});var I=[R];return P.vertices.length&&I.push(P),I}return n}return J2e(e,i),K2e(e)})(qB.BufferGeometry);function mw(i,e){var t=Math.round(i.vertices.length/3);mJ(i.vertices,e.vertices),mJ(i.indices,e.indices.map(function(n){return n+t}))}function mJ(i,e){var t=Q2e(e),n;try{for(t.s();!(n=t.n()).done;){var r=n.value;i.push(r)}}catch(s){t.e(s)}finally{t.f()}}function zB(i,e){var t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,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 Aw={};zue(Aw,{computeMikkTSpaceTangents:()=>abe,computeMorphedAttributes:()=>mbe,deepCloneAttribute:()=>cbe,deinterleaveAttribute:()=>qC,deinterleaveGeometry:()=>hbe,estimateBytesUsed:()=>fbe,interleaveAttributes:()=>ube,mergeAttributes:()=>jB,mergeGeometries:()=>lbe,mergeGroups:()=>Abe,mergeVertices:()=>dbe,toCreasedNormals:()=>gbe,toTrianglesDrawMode:()=>pbe});function abe(i,e,t=!0){if(!e||!e.isReady)throw new Error("THREE.BufferGeometryUtils: Initialized MikkTSpace library required.");if(!i.hasAttribute("position")||!i.hasAttribute("normal")||!i.hasAttribute("uv"))throw new Error('THREE.BufferGeometryUtils: Tangents require "position", "normal", and "uv" attributes.');function n(o){if(o.normalized||o.isInterleavedBufferAttribute){let a=new Float32Array(o.count*o.itemSize);for(let l=0,c=0;l<o.count;l++)a[c++]=o.getX(l),a[c++]=o.getY(l),o.itemSize>2&&(a[c++]=o.getZ(l));return a}return o.array instanceof Float32Array?o.array:new Float32Array(o.array)}let r=i.index?i.toNonIndexed():i,s=e.generateTangents(n(r.attributes.position),n(r.attributes.normal),n(r.attributes.uv));if(t)for(let o=3;o<s.length;o+=4)s[o]*=-1;return r.setAttribute("tangent",new Hi(s,4)),i!==r&&i.copy(r),i}function lbe(i,e=!1){let t=i[0].index!==null,n=new Set(Object.keys(i[0].attributes)),r=new Set(Object.keys(i[0].morphAttributes)),s={},o={},a=i[0].morphTargetsRelative,l=new Xn,c=0;for(let u=0;u<i.length;++u){let f=i[u],d=0;if(t!==(f.index!==null))return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+u+". All geometries must have compatible attributes; make sure index attribute exists among all geometries, or in none of them."),null;for(let A in f.attributes){if(!n.has(A))return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+u+'. All geometries must have compatible attributes; make sure "'+A+'" attribute exists among all geometries, or in none of them.'),null;s[A]===void 0&&(s[A]=[]),s[A].push(f.attributes[A]),d++}if(d!==n.size)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+u+". Make sure all geometries have the same number of attributes."),null;if(a!==f.morphTargetsRelative)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+u+". .morphTargetsRelative must be consistent throughout all geometries."),null;for(let A in f.morphAttributes){if(!r.has(A))return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+u+". .morphAttributes must be consistent throughout all geometries."),null;o[A]===void 0&&(o[A]=[]),o[A].push(f.morphAttributes[A])}if(e){let A;if(t)A=f.index.count;else if(f.attributes.position!==void 0)A=f.attributes.position.count;else return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+u+". The geometry must have either an index or a position attribute"),null;l.addGroup(c,A,u),c+=A}}if(t){let u=0,f=[];for(let d=0;d<i.length;++d){let A=i[d].index;for(let y=0;y<A.count;++y)f.push(A.getX(y)+u);u+=i[d].attributes.position.count}l.setIndex(f)}for(let u in s){let f=jB(s[u]);if(!f)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed while trying to merge the "+u+" attribute."),null;l.setAttribute(u,f)}for(let u in o){let f=o[u][0].length;if(f!==0){l.morphAttributes=l.morphAttributes||{},l.morphAttributes[u]=[];for(let d=0;d<f;++d){let A=[];for(let w=0;w<o[u].length;++w)A.push(o[u][w][d]);let y=jB(A);if(!y)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed while trying to merge the "+u+" morphAttribute."),null;l.morphAttributes[u].push(y)}}}return l}function jB(i){let e,t,n,r=-1,s=0;for(let c=0;c<i.length;++c){let u=i[c];if(e===void 0&&(e=u.array.constructor),e!==u.array.constructor)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.array must be of consistent array types across matching attributes."),null;if(t===void 0&&(t=u.itemSize),t!==u.itemSize)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.itemSize must be consistent across matching attributes."),null;if(n===void 0&&(n=u.normalized),n!==u.normalized)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.normalized must be consistent across matching attributes."),null;if(r===-1&&(r=u.gpuType),r!==u.gpuType)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.gpuType must be consistent across matching attributes."),null;s+=u.count*t}let o=new e(s),a=new Hi(o,t,n),l=0;for(let c=0;c<i.length;++c){let u=i[c];if(u.isInterleavedBufferAttribute){let f=l/t;for(let d=0,A=u.count;d<A;d++)for(let y=0;y<t;y++){let w=u.getComponent(d,y);a.setComponent(d+f,y,w)}}else o.set(u.array,l);l+=u.count*t}return r!==void 0&&(a.gpuType=r),a}function cbe(i){return i.isInstancedInterleavedBufferAttribute||i.isInterleavedBufferAttribute?qC(i):i.isInstancedBufferAttribute?new Yl().copy(i):new Hi().copy(i)}function ube(i){let e,t=0,n=0;for(let c=0,u=i.length;c<u;++c){let f=i[c];if(e===void 0&&(e=f.array.constructor),e!==f.array.constructor)return console.error("AttributeBuffers of different types cannot be interleaved"),null;t+=f.array.length,n+=f.itemSize}let r=new Ed(new e(t),n),s=0,o=[],a=["getX","getY","getZ","getW"],l=["setX","setY","setZ","setW"];for(let c=0,u=i.length;c<u;c++){let f=i[c],d=f.itemSize,A=f.count,y=new zo(r,d,s,f.normalized);o.push(y),s+=d;for(let w=0;w<A;w++)for(let S=0;S<d;S++)y[l[S]](w,f[a[S]](w))}return o}function qC(i){let e=i.data.array.constructor,t=i.count,n=i.itemSize,r=i.normalized,s=new e(t*n),o;i.isInstancedInterleavedBufferAttribute?o=new Yl(s,n,r,i.meshPerAttribute):o=new Hi(s,n,r);for(let a=0;a<t;a++)o.setX(a,i.getX(a)),n>=2&&o.setY(a,i.getY(a)),n>=3&&o.setZ(a,i.getZ(a)),n>=4&&o.setW(a,i.getW(a));return o}function hbe(i){let e=i.attributes,t=i.morphTargets,n=new Map;for(let r in e){let s=e[r];s.isInterleavedBufferAttribute&&(n.has(s)||n.set(s,qC(s)),e[r]=n.get(s))}for(let r in t){let s=t[r];s.isInterleavedBufferAttribute&&(n.has(s)||n.set(s,qC(s)),t[r]=n.get(s))}}function fbe(i){let e=0;for(let n in i.attributes){let r=i.getAttribute(n);e+=r.count*r.itemSize*r.array.BYTES_PER_ELEMENT}let t=i.getIndex();return e+=t?t.count*t.itemSize*t.array.BYTES_PER_ELEMENT:0,e}function dbe(i,e=1e-4){e=Math.max(e,Number.EPSILON);let t={},n=i.getIndex(),r=i.getAttribute("position"),s=n?n.count:r.count,o=0,a=Object.keys(i.attributes),l={},c={},u=[],f=["getX","getY","getZ","getW"],d=["setX","setY","setZ","setW"];for(let R=0,P=a.length;R<P;R++){let I=a[R],F=i.attributes[I];l[I]=new F.constructor(new F.array.constructor(F.count*F.itemSize),F.itemSize,F.normalized);let D=i.morphAttributes[I];D&&(c[I]||(c[I]=[]),D.forEach((L,C)=>{let B=new L.array.constructor(L.count*L.itemSize);c[I][C]=new L.constructor(B,L.itemSize,L.normalized)}))}let A=e*.5,y=Math.log10(1/e),w=Math.pow(10,y),S=A*w;for(let R=0;R<s;R++){let P=n?n.getX(R):R,I="";for(let F=0,D=a.length;F<D;F++){let L=a[F],C=i.getAttribute(L),B=C.itemSize;for(let k=0;k<B;k++)I+=`${~~(C[f[k]](P)*w+S)},`}if(I in t)u.push(t[I]);else{for(let F=0,D=a.length;F<D;F++){let L=a[F],C=i.getAttribute(L),B=i.morphAttributes[L],k=C.itemSize,z=l[L],G=c[L];for(let W=0;W<k;W++){let Y=f[W],H=d[W];if(z[H](o,C[Y](P)),B)for(let $=0,J=B.length;$<J;$++)G[$][H](o,B[$][Y](P))}}t[I]=o,u.push(o),o++}}let T=i.clone();for(let R in i.attributes){let P=l[R];if(T.setAttribute(R,new P.constructor(P.array.slice(0,o*P.itemSize),P.itemSize,P.normalized)),R in c)for(let I=0;I<c[R].length;I++){let F=c[R][I];T.morphAttributes[R][I]=new F.constructor(F.array.slice(0,o*F.itemSize),F.itemSize,F.normalized)}}return T.setIndex(u),T}function pbe(i,e){if(e===P8)return console.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles."),i;if(e===IM||e===L8){let t=i.getIndex();if(t===null){let o=[],a=i.getAttribute("position");if(a!==void 0){for(let l=0;l<a.count;l++)o.push(l);i.setIndex(o),t=i.getIndex()}else return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Undefined position attribute. Processing not possible."),i}let n=t.count-2,r=[];if(e===IM)for(let o=1;o<=n;o++)r.push(t.getX(0)),r.push(t.getX(o)),r.push(t.getX(o+1));else for(let o=0;o<n;o++)o%2===0?(r.push(t.getX(o)),r.push(t.getX(o+1)),r.push(t.getX(o+2))):(r.push(t.getX(o+2)),r.push(t.getX(o+1)),r.push(t.getX(o)));r.length/3!==n&&console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unable to generate correct amount of triangles.");let s=i.clone();return s.setIndex(r),s.clearGroups(),s}else return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unknown draw mode:",e),i}function mbe(i){let e=new re,t=new re,n=new re,r=new re,s=new re,o=new re,a=new re,l=new re,c=new re;function u(ce,he,ve,Re,Qe,Fe,mt,Ee){e.fromBufferAttribute(he,Qe),t.fromBufferAttribute(he,Fe),n.fromBufferAttribute(he,mt);let Ve=ce.morphTargetInfluences;if(ve&&Ve){a.set(0,0,0),l.set(0,0,0),c.set(0,0,0);for(let Ye=0,Mt=ve.length;Ye<Mt;Ye++){let Et=Ve[Ye],It=ve[Ye];Et!==0&&(r.fromBufferAttribute(It,Qe),s.fromBufferAttribute(It,Fe),o.fromBufferAttribute(It,mt),Re?(a.addScaledVector(r,Et),l.addScaledVector(s,Et),c.addScaledVector(o,Et)):(a.addScaledVector(r.sub(e),Et),l.addScaledVector(s.sub(t),Et),c.addScaledVector(o.sub(n),Et)))}e.add(a),t.add(l),n.add(c)}ce.isSkinnedMesh&&(ce.applyBoneTransform(Qe,e),ce.applyBoneTransform(Fe,t),ce.applyBoneTransform(mt,n)),Ee[Qe*3+0]=e.x,Ee[Qe*3+1]=e.y,Ee[Qe*3+2]=e.z,Ee[Fe*3+0]=t.x,Ee[Fe*3+1]=t.y,Ee[Fe*3+2]=t.z,Ee[mt*3+0]=n.x,Ee[mt*3+1]=n.y,Ee[mt*3+2]=n.z}let f=i.geometry,d=i.material,A,y,w,S=f.index,T=f.attributes.position,R=f.morphAttributes.position,P=f.morphTargetsRelative,I=f.attributes.normal,F=f.morphAttributes.normal,D=f.groups,L=f.drawRange,C,B,k,z,G,W,Y,H=new Float32Array(T.count*T.itemSize),$=new Float32Array(I.count*I.itemSize);if(S!==null)if(Array.isArray(d))for(C=0,k=D.length;C<k;C++)for(G=D[C],W=Math.max(G.start,L.start),Y=Math.min(G.start+G.count,L.start+L.count),B=W,z=Y;B<z;B+=3)A=S.getX(B),y=S.getX(B+1),w=S.getX(B+2),u(i,T,R,P,A,y,w,H),u(i,I,F,P,A,y,w,$);else for(W=Math.max(0,L.start),Y=Math.min(S.count,L.start+L.count),C=W,k=Y;C<k;C+=3)A=S.getX(C),y=S.getX(C+1),w=S.getX(C+2),u(i,T,R,P,A,y,w,H),u(i,I,F,P,A,y,w,$);else if(Array.isArray(d))for(C=0,k=D.length;C<k;C++)for(G=D[C],W=Math.max(G.start,L.start),Y=Math.min(G.start+G.count,L.start+L.count),B=W,z=Y;B<z;B+=3)A=B,y=B+1,w=B+2,u(i,T,R,P,A,y,w,H),u(i,I,F,P,A,y,w,$);else for(W=Math.max(0,L.start),Y=Math.min(T.count,L.start+L.count),C=W,k=Y;C<k;C+=3)A=C,y=C+1,w=C+2,u(i,T,R,P,A,y,w,H),u(i,I,F,P,A,y,w,$);let J=new Ln(H,3),te=new Ln($,3);return{positionAttribute:T,normalAttribute:I,morphedPositionAttribute:J,morphedNormalAttribute:te}}function Abe(i){if(i.groups.length===0)return console.warn("THREE.BufferGeometryUtils.mergeGroups(): No groups are defined. Nothing to merge."),i;let e=i.groups;if(e=e.sort((o,a)=>o.materialIndex!==a.materialIndex?o.materialIndex-a.materialIndex:o.start-a.start),i.getIndex()===null){let o=i.getAttribute("position"),a=[];for(let l=0;l<o.count;l+=3)a.push(l,l+1,l+2);i.setIndex(a)}let t=i.getIndex(),n=[];for(let o=0;o<e.length;o++){let a=e[o],l=a.start,c=l+a.count;for(let u=l;u<c;u++)n.push(t.getX(u))}i.dispose(),i.setIndex(n);let r=0;for(let o=0;o<e.length;o++){let a=e[o];a.start=r,r+=a.count}let s=e[0];i.groups=[s];for(let o=1;o<e.length;o++){let a=e[o];s.materialIndex===a.materialIndex?s.count+=a.count:(s=a,i.groups.push(s))}return i}function gbe(i,e=Math.PI/3){let t=i.index?i.toNonIndexed():i,n=t.attributes.position,r=n.count,s;if(n.isBufferAttribute===!0&&n.itemSize===3&&n.normalized===!1)s=n.array;else{s=new Float64Array(r*3);for(let I=0;I<r;I++)s[3*I+0]=n.getX(I),s[3*I+1]=n.getY(I),s[3*I+2]=n.getZ(I)}let o=Math.cos(e),a=(1+1e-10)*100,l=r/3,c=new Float64Array(l*3);for(let I=0;I<l;I++){let F=9*I,D=s[F+0],L=s[F+1],C=s[F+2],B=s[F+3],k=s[F+4],z=s[F+5],G=s[F+6],W=s[F+7],Y=s[F+8],H=G-B,$=W-k,J=Y-z,te=D-B,ce=L-k,he=C-z,ve=$*he-J*ce,Re=J*te-H*he,Qe=H*ce-$*te,Fe=1/(Math.sqrt(ve*ve+Re*Re+Qe*Qe)||1);c[3*I+0]=ve*Fe,c[3*I+1]=Re*Fe,c[3*I+2]=Qe*Fe}let u=new Int32Array(r),f=new Int32Array(r*3),d=1;for(;d<r*2;)d<<=1;let A=d-1,y=new Int32Array(d),w=0;for(let I=0;I<r;I++){let F=3*I,D=~~(s[F+0]*a),L=~~(s[F+1]*a),C=~~(s[F+2]*a),B=(Math.imul(D,73856093)^Math.imul(L,19349663)^Math.imul(C,83492791))&A;for(;;){let k=y[B];if(k===0){let G=3*w;f[G+0]=D,f[G+1]=L,f[G+2]=C,y[B]=w+1,u[I]=w++;break}let z=3*(k-1);if(f[z+0]===D&&f[z+1]===L&&f[z+2]===C){u[I]=k-1;break}B=B+1&A}}let S=new Int32Array(w+1);for(let I=0;I<r;I++)S[u[I]+1]++;for(let I=0;I<w;I++)S[I+1]+=S[I];let T=new Int32Array(r),R=S.slice(0,w);for(let I=0;I<l;I++){let F=3*I;T[R[u[F+0]]++]=I,T[R[u[F+1]]++]=I,T[R[u[F+2]]++]=I}let P=new Float32Array(r*3);for(let I=0;I<l;I++){let F=3*I,D=c[F+0],L=c[F+1],C=c[F+2];for(let B=0;B<3;B++){let k=F+B,z=u[k],G=0,W=0,Y=0;for(let $=S[z],J=S[z+1];$<J;$++){let te=3*T[$],ce=c[te+0],he=c[te+1],ve=c[te+2];D*ce+L*he+C*ve>o&&(G+=ce,W+=he,Y+=ve)}let H=1/(Math.sqrt(G*G+W*W+Y*Y)||1);P[3*k+0]=G*H,P[3*k+1]=W*H,P[3*k+2]=Y*H}}return t.setAttribute("normal",new Hi(P,3,!1)),t}var st=(function(i){return typeof i=="function"?i:typeof i=="string"?function(e){return e[i]}:function(e){return i}});function HC(i){"@babel/helpers - typeof";return HC=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},HC(i)}var vbe=/^\s+/,_be=/\s+$/;function An(i,e){if(i=i||"",e=e||{},i instanceof An)return i;if(!(this instanceof An))return new An(i,e);var t=xbe(i);this._originalInput=i,this._r=t.r,this._g=t.g,this._b=t.b,this._a=t.a,this._roundA=Math.round(100*this._a)/100,this._format=e.format||t.format,this._gradientType=e.gradientType,this._r<1&&(this._r=Math.round(this._r)),this._g<1&&(this._g=Math.round(this._g)),this._b<1&&(this._b=Math.round(this._b)),this._ok=t.ok}An.prototype={isDark:function(){return this.getBrightness()<128},isLight:function(){return!this.isDark()},isValid:function(){return this._ok},getOriginalInput:function(){return this._originalInput},getFormat:function(){return this._format},getAlpha:function(){return this._a},getBrightness:function(){var e=this.toRgb();return(e.r*299+e.g*587+e.b*114)/1e3},getLuminance:function(){var e=this.toRgb(),t,n,r,s,o,a;return t=e.r/255,n=e.g/255,r=e.b/255,t<=.03928?s=t/12.92:s=Math.pow((t+.055)/1.055,2.4),n<=.03928?o=n/12.92:o=Math.pow((n+.055)/1.055,2.4),r<=.03928?a=r/12.92:a=Math.pow((r+.055)/1.055,2.4),.2126*s+.7152*o+.0722*a},setAlpha:function(e){return this._a=wJ(e),this._roundA=Math.round(100*this._a)/100,this},toHsv:function(){var e=vJ(this._r,this._g,this._b);return{h:e.h*360,s:e.s,v:e.v,a:this._a}},toHsvString:function(){var e=vJ(this._r,this._g,this._b),t=Math.round(e.h*360),n=Math.round(e.s*100),r=Math.round(e.v*100);return this._a==1?"hsv("+t+", "+n+"%, "+r+"%)":"hsva("+t+", "+n+"%, "+r+"%, "+this._roundA+")"},toHsl:function(){var e=gJ(this._r,this._g,this._b);return{h:e.h*360,s:e.s,l:e.l,a:this._a}},toHslString:function(){var e=gJ(this._r,this._g,this._b),t=Math.round(e.h*360),n=Math.round(e.s*100),r=Math.round(e.l*100);return this._a==1?"hsl("+t+", "+n+"%, "+r+"%)":"hsla("+t+", "+n+"%, "+r+"%, "+this._roundA+")"},toHex:function(e){return _J(this._r,this._g,this._b,e)},toHexString:function(e){return"#"+this.toHex(e)},toHex8:function(e){return Sbe(this._r,this._g,this._b,this._a,e)},toHex8String:function(e){return"#"+this.toHex8(e)},toRgb:function(){return{r:Math.round(this._r),g:Math.round(this._g),b:Math.round(this._b),a:this._a}},toRgbString:function(){return this._a==1?"rgb("+Math.round(this._r)+", "+Math.round(this._g)+", "+Math.round(this._b)+")":"rgba("+Math.round(this._r)+", "+Math.round(this._g)+", "+Math.round(this._b)+", "+this._roundA+")"},toPercentageRgb:function(){return{r:Math.round(Ur(this._r,255)*100)+"%",g:Math.round(Ur(this._g,255)*100)+"%",b:Math.round(Ur(this._b,255)*100)+"%",a:this._a}},toPercentageRgbString:function(){return this._a==1?"rgb("+Math.round(Ur(this._r,255)*100)+"%, "+Math.round(Ur(this._g,255)*100)+"%, "+Math.round(Ur(this._b,255)*100)+"%)":"rgba("+Math.round(Ur(this._r,255)*100)+"%, "+Math.round(Ur(this._g,255)*100)+"%, "+Math.round(Ur(this._b,255)*100)+"%, "+this._roundA+")"},toName:function(){return this._a===0?"transparent":this._a<1?!1:Bbe[_J(this._r,this._g,this._b,!0)]||!1},toFilter:function(e){var t="#"+xJ(this._r,this._g,this._b,this._a),n=t,r=this._gradientType?"GradientType = 1, ":"";if(e){var s=An(e);n="#"+xJ(s._r,s._g,s._b,s._a)}return"progid:DXImageTransform.Microsoft.gradient("+r+"startColorstr="+t+",endColorstr="+n+")"},toString:function(e){var t=!!e;e=e||this._format;var n=!1,r=this._a<1&&this._a>=0,s=!t&&r&&(e==="hex"||e==="hex6"||e==="hex3"||e==="hex4"||e==="hex8"||e==="name");return s?e==="name"&&this._a===0?this.toName():this.toRgbString():(e==="rgb"&&(n=this.toRgbString()),e==="prgb"&&(n=this.toPercentageRgbString()),(e==="hex"||e==="hex6")&&(n=this.toHexString()),e==="hex3"&&(n=this.toHexString(!0)),e==="hex4"&&(n=this.toHex8String(!0)),e==="hex8"&&(n=this.toHex8String()),e==="name"&&(n=this.toName()),e==="hsl"&&(n=this.toHslString()),e==="hsv"&&(n=this.toHsvString()),n||this.toHexString())},clone:function(){return An(this.toString())},_applyModification:function(e,t){var n=e.apply(null,[this].concat([].slice.call(t)));return this._r=n._r,this._g=n._g,this._b=n._b,this.setAlpha(n._a),this},lighten:function(){return this._applyModification(Cbe,arguments)},brighten:function(){return this._applyModification(Rbe,arguments)},darken:function(){return this._applyModification(Ibe,arguments)},desaturate:function(){return this._applyModification(Tbe,arguments)},saturate:function(){return this._applyModification(Ebe,arguments)},greyscale:function(){return this._applyModification(Mbe,arguments)},spin:function(){return this._applyModification(Pbe,arguments)},_applyCombination:function(e,t){return e.apply(null,[this].concat([].slice.call(t)))},analogous:function(){return this._applyCombination(Nbe,arguments)},complement:function(){return this._applyCombination(Lbe,arguments)},monochromatic:function(){return this._applyCombination(Fbe,arguments)},splitcomplement:function(){return this._applyCombination(Dbe,arguments)},triad:function(){return this._applyCombination(yJ,[3])},tetrad:function(){return this._applyCombination(yJ,[4])}};An.fromRatio=function(i,e){if(HC(i)=="object"){var t={};for(var n in i)i.hasOwnProperty(n)&&(n==="a"?t[n]=i[n]:t[n]=gw(i[n]));i=t}return An(i,e)};function xbe(i){var e={r:0,g:0,b:0},t=1,n=null,r=null,s=null,o=!1,a=!1;return typeof i=="string"&&(i=zbe(i)),HC(i)=="object"&&(Ud(i.r)&&Ud(i.g)&&Ud(i.b)?(e=ybe(i.r,i.g,i.b),o=!0,a=String(i.r).substr(-1)==="%"?"prgb":"rgb"):Ud(i.h)&&Ud(i.s)&&Ud(i.v)?(n=gw(i.s),r=gw(i.v),e=wbe(i.h,n,r),o=!0,a="hsv"):Ud(i.h)&&Ud(i.s)&&Ud(i.l)&&(n=gw(i.s),s=gw(i.l),e=bbe(i.h,n,s),o=!0,a="hsl"),i.hasOwnProperty("a")&&(t=i.a)),t=wJ(t),{ok:o,format:i.format||a,r:Math.min(255,Math.max(e.r,0)),g:Math.min(255,Math.max(e.g,0)),b:Math.min(255,Math.max(e.b,0)),a:t}}function ybe(i,e,t){return{r:Ur(i,255)*255,g:Ur(e,255)*255,b:Ur(t,255)*255}}function gJ(i,e,t){i=Ur(i,255),e=Ur(e,255),t=Ur(t,255);var n=Math.max(i,e,t),r=Math.min(i,e,t),s,o,a=(n+r)/2;if(n==r)s=o=0;else{var l=n-r;switch(o=a>.5?l/(2-n-r):l/(n+r),n){case i:s=(e-t)/l+(e<t?6:0);break;case e:s=(t-i)/l+2;break;case t:s=(i-e)/l+4;break}s/=6}return{h:s,s:o,l:a}}function bbe(i,e,t){var n,r,s;i=Ur(i,360),e=Ur(e,100),t=Ur(t,100);function o(c,u,f){return f<0&&(f+=1),f>1&&(f-=1),f<1/6?c+(u-c)*6*f:f<1/2?u:f<2/3?c+(u-c)*(2/3-f)*6:c}if(e===0)n=r=s=t;else{var a=t<.5?t*(1+e):t+e-t*e,l=2*t-a;n=o(l,a,i+1/3),r=o(l,a,i),s=o(l,a,i-1/3)}return{r:n*255,g:r*255,b:s*255}}function vJ(i,e,t){i=Ur(i,255),e=Ur(e,255),t=Ur(t,255);var n=Math.max(i,e,t),r=Math.min(i,e,t),s,o,a=n,l=n-r;if(o=n===0?0:l/n,n==r)s=0;else{switch(n){case i:s=(e-t)/l+(e<t?6:0);break;case e:s=(t-i)/l+2;break;case t:s=(i-e)/l+4;break}s/=6}return{h:s,s:o,v:a}}function wbe(i,e,t){i=Ur(i,360)*6,e=Ur(e,100),t=Ur(t,100);var n=Math.floor(i),r=i-n,s=t*(1-e),o=t*(1-r*e),a=t*(1-(1-r)*e),l=n%6,c=[t,o,s,s,a,t][l],u=[a,t,t,o,s,s][l],f=[s,s,a,t,t,o][l];return{r:c*255,g:u*255,b:f*255}}function _J(i,e,t,n){var r=[Vu(Math.round(i).toString(16)),Vu(Math.round(e).toString(16)),Vu(Math.round(t).toString(16))];return n&&r[0].charAt(0)==r[0].charAt(1)&&r[1].charAt(0)==r[1].charAt(1)&&r[2].charAt(0)==r[2].charAt(1)?r[0].charAt(0)+r[1].charAt(0)+r[2].charAt(0):r.join("")}function Sbe(i,e,t,n,r){var s=[Vu(Math.round(i).toString(16)),Vu(Math.round(e).toString(16)),Vu(Math.round(t).toString(16)),Vu(SJ(n))];return r&&s[0].charAt(0)==s[0].charAt(1)&&s[1].charAt(0)==s[1].charAt(1)&&s[2].charAt(0)==s[2].charAt(1)&&s[3].charAt(0)==s[3].charAt(1)?s[0].charAt(0)+s[1].charAt(0)+s[2].charAt(0)+s[3].charAt(0):s.join("")}function xJ(i,e,t,n){var r=[Vu(SJ(n)),Vu(Math.round(i).toString(16)),Vu(Math.round(e).toString(16)),Vu(Math.round(t).toString(16))];return r.join("")}An.equals=function(i,e){return!i||!e?!1:An(i).toRgbString()==An(e).toRgbString()};An.random=function(){return An.fromRatio({r:Math.random(),g:Math.random(),b:Math.random()})};function Tbe(i,e){e=e===0?0:e||10;var t=An(i).toHsl();return t.s-=e/100,t.s=WC(t.s),An(t)}function Ebe(i,e){e=e===0?0:e||10;var t=An(i).toHsl();return t.s+=e/100,t.s=WC(t.s),An(t)}function Mbe(i){return An(i).desaturate(100)}function Cbe(i,e){e=e===0?0:e||10;var t=An(i).toHsl();return t.l+=e/100,t.l=WC(t.l),An(t)}function Rbe(i,e){e=e===0?0:e||10;var t=An(i).toRgb();return t.r=Math.max(0,Math.min(255,t.r-Math.round(255*-(e/100)))),t.g=Math.max(0,Math.min(255,t.g-Math.round(255*-(e/100)))),t.b=Math.max(0,Math.min(255,t.b-Math.round(255*-(e/100)))),An(t)}function Ibe(i,e){e=e===0?0:e||10;var t=An(i).toHsl();return t.l-=e/100,t.l=WC(t.l),An(t)}function Pbe(i,e){var t=An(i).toHsl(),n=(t.h+e)%360;return t.h=n<0?360+n:n,An(t)}function Lbe(i){var e=An(i).toHsl();return e.h=(e.h+180)%360,An(e)}function yJ(i,e){if(isNaN(e)||e<=0)throw new Error("Argument to polyad must be a positive number");for(var t=An(i).toHsl(),n=[An(i)],r=360/e,s=1;s<e;s++)n.push(An({h:(t.h+s*r)%360,s:t.s,l:t.l}));return n}function Dbe(i){var e=An(i).toHsl(),t=e.h;return[An(i),An({h:(t+72)%360,s:e.s,l:e.l}),An({h:(t+216)%360,s:e.s,l:e.l})]}function Nbe(i,e,t){e=e||6,t=t||30;var n=An(i).toHsl(),r=360/t,s=[An(i)];for(n.h=(n.h-(r*e>>1)+720)%360;--e;)n.h=(n.h+r)%360,s.push(An(n));return s}function Fbe(i,e){e=e||6;for(var t=An(i).toHsv(),n=t.h,r=t.s,s=t.v,o=[],a=1/e;e--;)o.push(An({h:n,s:r,v:s})),s=(s+a)%1;return o}An.mix=function(i,e,t){t=t===0?0:t||50;var n=An(i).toRgb(),r=An(e).toRgb(),s=t/100,o={r:(r.r-n.r)*s+n.r,g:(r.g-n.g)*s+n.g,b:(r.b-n.b)*s+n.b,a:(r.a-n.a)*s+n.a};return An(o)};An.readability=function(i,e){var t=An(i),n=An(e);return(Math.max(t.getLuminance(),n.getLuminance())+.05)/(Math.min(t.getLuminance(),n.getLuminance())+.05)};An.isReadable=function(i,e,t){var n=An.readability(i,e),r,s;switch(s=!1,r=Vbe(t),r.level+r.size){case"AAsmall":case"AAAlarge":s=n>=4.5;break;case"AAlarge":s=n>=3;break;case"AAAsmall":s=n>=7;break}return s};An.mostReadable=function(i,e,t){var n=null,r=0,s,o,a,l;t=t||{},o=t.includeFallbackColors,a=t.level,l=t.size;for(var c=0;c<e.length;c++)s=An.readability(i,e[c]),s>r&&(r=s,n=An(e[c]));return An.isReadable(i,n,{level:a,size:l})||!o?n:(t.includeFallbackColors=!1,An.mostReadable(i,["#fff","#000"],t))};var XB=An.names={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"0ff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000",blanchedalmond:"ffebcd",blue:"00f",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",burntsienna:"ea7e5d",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"0ff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkgrey:"a9a9a9",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkslategrey:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dimgrey:"696969",dodgerblue:"1e90ff",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"f0f",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",grey:"808080",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgray:"d3d3d3",lightgreen:"90ee90",lightgrey:"d3d3d3",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslategray:"789",lightslategrey:"789",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"0f0",limegreen:"32cd32",linen:"faf0e6",magenta:"f0f",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370db",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"db7093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",rebeccapurple:"663399",red:"f00",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",slategrey:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",wheat:"f5deb3",white:"fff",whitesmoke:"f5f5f5",yellow:"ff0",yellowgreen:"9acd32"},Bbe=An.hexNames=Obe(XB);function Obe(i){var e={};for(var t in i)i.hasOwnProperty(t)&&(e[i[t]]=t);return e}function wJ(i){return i=parseFloat(i),(isNaN(i)||i<0||i>1)&&(i=1),i}function Ur(i,e){Ube(i)&&(i="100%");var t=kbe(i);return i=Math.min(e,Math.max(0,parseFloat(i))),t&&(i=parseInt(i*e,10)/100),Math.abs(i-e)<1e-6?1:i%e/parseFloat(e)}function WC(i){return Math.min(1,Math.max(0,i))}function tc(i){return parseInt(i,16)}function Ube(i){return typeof i=="string"&&i.indexOf(".")!=-1&&parseFloat(i)===1}function kbe(i){return typeof i=="string"&&i.indexOf("%")!=-1}function Vu(i){return i.length==1?"0"+i:""+i}function gw(i){return i<=1&&(i=i*100+"%"),i}function SJ(i){return Math.round(parseFloat(i)*255).toString(16)}function bJ(i){return tc(i)/255}var zu=(function(){var i="[-\\+]?\\d+%?",e="[-\\+]?\\d*\\.\\d+%?",t="(?:"+e+")|(?:"+i+")",n="[\\s|\\(]+("+t+")[,|\\s]+("+t+")[,|\\s]+("+t+")\\s*\\)?",r="[\\s|\\(]+("+t+")[,|\\s]+("+t+")[,|\\s]+("+t+")[,|\\s]+("+t+")\\s*\\)?";return{CSS_UNIT:new RegExp(t),rgb:new RegExp("rgb"+n),rgba:new RegExp("rgba"+r),hsl:new RegExp("hsl"+n),hsla:new RegExp("hsla"+r),hsv:new RegExp("hsv"+n),hsva:new RegExp("hsva"+r),hex3:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex6:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,hex4:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex8:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/}})();function Ud(i){return!!zu.CSS_UNIT.exec(i)}function zbe(i){i=i.replace(vbe,"").replace(_be,"").toLowerCase();var e=!1;if(XB[i])i=XB[i],e=!0;else if(i=="transparent")return{r:0,g:0,b:0,a:0,format:"name"};var t;return(t=zu.rgb.exec(i))?{r:t[1],g:t[2],b:t[3]}:(t=zu.rgba.exec(i))?{r:t[1],g:t[2],b:t[3],a:t[4]}:(t=zu.hsl.exec(i))?{h:t[1],s:t[2],l:t[3]}:(t=zu.hsla.exec(i))?{h:t[1],s:t[2],l:t[3],a:t[4]}:(t=zu.hsv.exec(i))?{h:t[1],s:t[2],v:t[3]}:(t=zu.hsva.exec(i))?{h:t[1],s:t[2],v:t[3],a:t[4]}:(t=zu.hex8.exec(i))?{r:tc(t[1]),g:tc(t[2]),b:tc(t[3]),a:bJ(t[4]),format:e?"name":"hex8"}:(t=zu.hex6.exec(i))?{r:tc(t[1]),g:tc(t[2]),b:tc(t[3]),format:e?"name":"hex"}:(t=zu.hex4.exec(i))?{r:tc(t[1]+""+t[1]),g:tc(t[2]+""+t[2]),b:tc(t[3]+""+t[3]),a:bJ(t[4]+""+t[4]),format:e?"name":"hex8"}:(t=zu.hex3.exec(i))?{r:tc(t[1]+""+t[1]),g:tc(t[2]+""+t[2]),b:tc(t[3]+""+t[3]),format:e?"name":"hex"}:!1}function Vbe(i){var e,t;return i=i||{level:"AA",size:"small"},e=(i.level||"AA").toUpperCase(),t=(i.size||"small").toLowerCase(),e!=="AA"&&e!=="AAA"&&(e="AA"),t!=="small"&&t!=="large"&&(t="small"),{level:e,size:t}}function KB(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 Gbe(i){if(Array.isArray(i))return i}function qbe(i){if(Array.isArray(i))return KB(i)}function TJ(i,e,t){if(typeof i=="function"?i===e:i.has(e))return arguments.length<3?e:t;throw new TypeError("Private element is not present on this object")}function Hbe(i,e){if(e.has(i))throw new TypeError("Cannot initialize the same private elements twice on an object")}function Wbe(i,e){if(!(i instanceof e))throw new TypeError("Cannot call a class as a function")}function da(i,e){return i.get(TJ(i,e))}function T_(i,e,t){Hbe(i,e),e.set(i,t)}function jC(i,e,t){return i.set(TJ(i,e),t),t}function jbe(i,e){for(var t=0;t<e.length;t++){var n=e[t];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(i,twe(n.key),n)}}function Xbe(i,e,t){return e&&jbe(i.prototype,e),Object.defineProperty(i,"prototype",{writable:!1}),i}function $be(i){if(typeof Symbol<"u"&&i[Symbol.iterator]!=null||i["@@iterator"]!=null)return Array.from(i)}function Ybe(i,e){var t=i==null?null:typeof Symbol<"u"&&i[Symbol.iterator]||i["@@iterator"];if(t!=null){var n,r,s,o,a=[],l=!0,c=!1;try{if(s=(t=t.call(i)).next,e!==0)for(;!(l=(n=s.call(t)).done)&&(a.push(n.value),a.length!==e);l=!0);}catch(u){c=!0,r=u}finally{try{if(!l&&t.return!=null&&(o=t.return(),Object(o)!==o))return}finally{if(c)throw r}}return a}}function Zbe(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.4124-In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Kbe(){throw new TypeError(`Invalid attempt to spread non-iterable instance.4125-In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Qbe(i,e){return Gbe(i)||Ybe(i,e)||EJ(i,e)||Zbe()}function Jbe(i){return qbe(i)||$be(i)||EJ(i)||Kbe()}function ewe(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 String(i)}function twe(i){var e=ewe(i,"string");return typeof e=="symbol"?e:e+""}function EJ(i,e){if(i){if(typeof i=="string")return KB(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)?KB(i,e):void 0}}var E_=new WeakMap,vw=new WeakMap,M_=new WeakMap,$B=new WeakMap,YB=new WeakMap,ZB=new WeakMap,MJ=(function(){function i(){Wbe(this,i),T_(this,E_,new Map),T_(this,vw,new Map),T_(this,M_,function(e){return e}),T_(this,$B,function(){return{}}),T_(this,YB,function(){}),T_(this,ZB,function(){})}return Xbe(i,[{key:"getObj",value:function(t){return da(E_,this).get(da(M_,this).call(this,t))}},{key:"getData",value:function(t){return da(vw,this).get(t)}},{key:"entries",value:function(){return Jbe(da(vw,this).entries()).map(function(t){var n=Qbe(t,2),r=n[0],s=n[1];return[s,r]})}},{key:"id",value:function(t){return jC(M_,this,st(t)),this}},{key:"onCreateObj",value:function(t){return jC($B,this,t),this}},{key:"onUpdateObj",value:function(t){return jC(YB,this,t),this}},{key:"onRemoveObj",value:function(t){return jC(ZB,this,t),this}},{key:"digest",value:function(t){var n=this;t.filter(function(s){return!da(E_,n).has(da(M_,n).call(n,s))}).forEach(function(s){var o=da($B,n).call(n,s);da(E_,n).set(da(M_,n).call(n,s),o),da(vw,n).set(o,s)});var r=new Map(t.map(function(s){return[da(M_,n).call(n,s),s]}));return da(E_,this).forEach(function(s,o){r.has(o)?da(YB,n).call(n,s,r.get(o)):(da(ZB,n).call(n,s,o),da(E_,n).delete(o),da(vw,n).delete(s))}),this}},{key:"clear",value:function(){return this.digest([]),this}}])})();var u1=vq(CJ(),1);var Ei=11102230246251565e-32,$s=134217729,xw=(3+8*Ei)*Ei;function Eg(i,e,t,n,r){let s,o,a,l,c=e[0],u=n[0],f=0,d=0;u>c==u>-c?(s=c,c=e[++f]):(s=u,u=n[++d]);let A=0;if(f<i&&d<t)for(u>c==u>-c?(o=c+s,a=s-(o-c),c=e[++f]):(o=u+s,a=s-(o-u),u=n[++d]),s=o,a!==0&&(r[A++]=a);f<i&&d<t;)u>c==u>-c?(o=s+c,l=o-s,a=s-(o-l)+(c-l),c=e[++f]):(o=s+u,l=o-s,a=s-(o-l)+(u-l),u=n[++d]),s=o,a!==0&&(r[A++]=a);for(;f<i;)o=s+c,l=o-s,a=s-(o-l)+(c-l),c=e[++f],s=o,a!==0&&(r[A++]=a);for(;d<t;)o=s+u,l=o-s,a=s-(o-l)+(u-l),u=n[++d],s=o,a!==0&&(r[A++]=a);return(s!==0||A===0)&&(r[A++]=s),A}function yw(i,e){let t=e[0];for(let n=1;n<i;n++)t+=e[n];return t}function ht(i){return new Float64Array(i)}var nwe=(3+16*Ei)*Ei,iwe=(2+12*Ei)*Ei,rwe=(9+64*Ei)*Ei*Ei,C_=ht(4),RJ=ht(8),IJ=ht(12),PJ=ht(16),Xa=ht(4);function swe(i,e,t,n,r,s,o){let a,l,c,u,f,d,A,y,w,S,T,R,P,I,F,D,L,C,B=i-r,k=t-r,z=e-s,G=n-s;I=B*G,d=$s*B,A=d-(d-B),y=B-A,d=$s*G,w=d-(d-G),S=G-w,F=y*S-(I-A*w-y*w-A*S),D=z*k,d=$s*z,A=d-(d-z),y=z-A,d=$s*k,w=d-(d-k),S=k-w,L=y*S-(D-A*w-y*w-A*S),T=F-L,f=F-T,C_[0]=F-(T+f)+(f-L),R=I+T,f=R-I,P=I-(R-f)+(T-f),T=P-D,f=P-T,C_[1]=P-(T+f)+(f-D),C=R+T,f=C-R,C_[2]=R-(C-f)+(T-f),C_[3]=C;let W=yw(4,C_),Y=iwe*o;if(W>=Y||-W>=Y||(f=i-B,a=i-(B+f)+(f-r),f=t-k,c=t-(k+f)+(f-r),f=e-z,l=e-(z+f)+(f-s),f=n-G,u=n-(G+f)+(f-s),a===0&&l===0&&c===0&&u===0)||(Y=rwe*o+xw*Math.abs(W),W+=B*u+G*a-(z*c+k*l),W>=Y||-W>=Y))return W;I=a*G,d=$s*a,A=d-(d-a),y=a-A,d=$s*G,w=d-(d-G),S=G-w,F=y*S-(I-A*w-y*w-A*S),D=l*k,d=$s*l,A=d-(d-l),y=l-A,d=$s*k,w=d-(d-k),S=k-w,L=y*S-(D-A*w-y*w-A*S),T=F-L,f=F-T,Xa[0]=F-(T+f)+(f-L),R=I+T,f=R-I,P=I-(R-f)+(T-f),T=P-D,f=P-T,Xa[1]=P-(T+f)+(f-D),C=R+T,f=C-R,Xa[2]=R-(C-f)+(T-f),Xa[3]=C;let H=Eg(4,C_,4,Xa,RJ);I=B*u,d=$s*B,A=d-(d-B),y=B-A,d=$s*u,w=d-(d-u),S=u-w,F=y*S-(I-A*w-y*w-A*S),D=z*c,d=$s*z,A=d-(d-z),y=z-A,d=$s*c,w=d-(d-c),S=c-w,L=y*S-(D-A*w-y*w-A*S),T=F-L,f=F-T,Xa[0]=F-(T+f)+(f-L),R=I+T,f=R-I,P=I-(R-f)+(T-f),T=P-D,f=P-T,Xa[1]=P-(T+f)+(f-D),C=R+T,f=C-R,Xa[2]=R-(C-f)+(T-f),Xa[3]=C;let $=Eg(H,RJ,4,Xa,IJ);I=a*u,d=$s*a,A=d-(d-a),y=a-A,d=$s*u,w=d-(d-u),S=u-w,F=y*S-(I-A*w-y*w-A*S),D=l*c,d=$s*l,A=d-(d-l),y=l-A,d=$s*c,w=d-(d-c),S=c-w,L=y*S-(D-A*w-y*w-A*S),T=F-L,f=F-T,Xa[0]=F-(T+f)+(f-L),R=I+T,f=R-I,P=I-(R-f)+(T-f),T=P-D,f=P-T,Xa[1]=P-(T+f)+(f-D),C=R+T,f=C-R,Xa[2]=R-(C-f)+(T-f),Xa[3]=C;let J=Eg($,IJ,4,Xa,PJ);return PJ[J-1]}function $0(i,e,t,n,r,s){let o=(e-s)*(t-r),a=(i-r)*(n-s),l=o-a,c=Math.abs(o+a);return Math.abs(l)>=nwe*c?l:-swe(i,e,t,n,r,s,c)}var prt=(7+56*Ei)*Ei,mrt=(3+28*Ei)*Ei,Art=(26+288*Ei)*Ei*Ei,grt=ht(4),vrt=ht(4),_rt=ht(4),xrt=ht(4),yrt=ht(4),brt=ht(4),wrt=ht(4),Srt=ht(4),Trt=ht(4),Ert=ht(8),Mrt=ht(8),Crt=ht(8),Rrt=ht(4),Irt=ht(8),Prt=ht(8),Lrt=ht(16),Drt=ht(12),Nrt=ht(192),Frt=ht(192);var Urt=(10+96*Ei)*Ei,krt=(4+48*Ei)*Ei,zrt=(44+576*Ei)*Ei*Ei,Vrt=ht(4),Grt=ht(4),qrt=ht(4),Hrt=ht(4),Wrt=ht(4),jrt=ht(4),Xrt=ht(4),$rt=ht(4),Yrt=ht(8),Zrt=ht(8),Krt=ht(8),Qrt=ht(8),Jrt=ht(8),est=ht(8),tst=ht(8),nst=ht(8),ist=ht(8),rst=ht(4),sst=ht(4),ost=ht(4),ast=ht(8),lst=ht(16),cst=ht(16),ust=ht(16),hst=ht(32),fst=ht(32),dst=ht(48),pst=ht(64),mst=ht(1152),Ast=ht(1152);var xst=(16+224*Ei)*Ei,yst=(5+72*Ei)*Ei,bst=(71+1408*Ei)*Ei*Ei,wst=ht(4),Sst=ht(4),Tst=ht(4),Est=ht(4),Mst=ht(4),Cst=ht(4),Rst=ht(4),Ist=ht(4),Pst=ht(4),Lst=ht(4),Dst=ht(24),Nst=ht(24),Fst=ht(24),Bst=ht(24),Ost=ht(24),Ust=ht(24),kst=ht(24),zst=ht(24),Vst=ht(24),Gst=ht(24),qst=ht(1152),Hst=ht(1152),Wst=ht(1152),jst=ht(1152),Xst=ht(1152),$st=ht(2304),Yst=ht(2304),Zst=ht(3456),Kst=ht(5760),Qst=ht(8),Jst=ht(8),eot=ht(8),tot=ht(16),not=ht(24),iot=ht(48),rot=ht(48),sot=ht(96),oot=ht(192),aot=ht(384),lot=ht(384),cot=ht(384),uot=ht(768);var hot=ht(96),fot=ht(96),dot=ht(96),pot=ht(1152);var DJ=Math.pow(2,-52),XC=new Uint32Array(512),Y0=class i{static from(e,t=hwe,n=fwe){let r=e.length,s=new Float64Array(r*2);for(let o=0;o<r;o++){let a=e[o];s[2*o]=t(a),s[2*o+1]=n(a)}return new i(s)}constructor(e){let t=e.length>>1;if(t>0&&typeof e[0]!="number")throw new Error("Expected coords to contain numbers.");this.coords=e;let n=Math.max(2*t-5,0);this._triangles=new Uint32Array(n*3),this._halfedges=new Int32Array(n*3),this._hashSize=Math.ceil(Math.sqrt(t)),this._hullPrev=new Uint32Array(t),this._hullNext=new Uint32Array(t),this._hullTri=new Uint32Array(t),this._hullHash=new Int32Array(this._hashSize),this._ids=new Uint32Array(t),this._dists=new Float64Array(t),this.trianglesLen=0,this._cx=0,this._cy=0,this._hullStart=0,this.hull=this._triangles,this.triangles=this._triangles,this.halfedges=this._halfedges,this.update()}update(){let{coords:e,_hullPrev:t,_hullNext:n,_hullTri:r,_hullHash:s}=this,o=e.length>>1,a=1/0,l=1/0,c=-1/0,u=-1/0;for(let B=0;B<o;B++){let k=e[2*B],z=e[2*B+1];k<a&&(a=k),z<l&&(l=z),k>c&&(c=k),z>u&&(u=z),this._ids[B]=B}let f=(a+c)/2,d=(l+u)/2,A=0,y=0,w=0;for(let B=0,k=1/0;B<o;B++){let z=JB(f,d,e[2*B],e[2*B+1]);z<k&&(A=B,k=z)}let S=e[2*A],T=e[2*A+1];for(let B=0,k=1/0;B<o;B++){if(B===A)continue;let z=JB(S,T,e[2*B],e[2*B+1]);z<k&&z>0&&(y=B,k=z)}let R=e[2*y],P=e[2*y+1],I=1/0;for(let B=0;B<o;B++){if(B===A||B===y)continue;let k=cwe(S,T,R,P,e[2*B],e[2*B+1]);k<I&&(w=B,I=k)}let F=e[2*w],D=e[2*w+1];if(I===1/0){for(let z=0;z<o;z++)this._dists[z]=e[2*z]-e[0]||e[2*z+1]-e[1];R_(this._ids,this._dists,0,o-1);let B=new Uint32Array(o),k=0;for(let z=0,G=-1/0;z<o;z++){let W=this._ids[z],Y=this._dists[W];Y>G&&(B[k++]=W,G=Y)}this.hull=B.subarray(0,k),this.triangles=new Uint32Array(0),this.halfedges=new Int32Array(0);return}if($0(S,T,R,P,F,D)<0){let B=y,k=R,z=P;y=w,R=F,P=D,w=B,F=k,D=z}let L=uwe(S,T,R,P,F,D);this._cx=L.x,this._cy=L.y;for(let B=0;B<o;B++)this._dists[B]=JB(e[2*B],e[2*B+1],L.x,L.y);R_(this._ids,this._dists,0,o-1),this._hullStart=A;let C=3;n[A]=t[w]=y,n[y]=t[A]=w,n[w]=t[y]=A,r[A]=0,r[y]=1,r[w]=2,s.fill(-1),s[this._hashKey(S,T)]=A,s[this._hashKey(R,P)]=y,s[this._hashKey(F,D)]=w,this.trianglesLen=0,this._addTriangle(A,y,w,-1,-1,-1);for(let B=0,k=0,z=0;B<this._ids.length;B++){let G=this._ids[B],W=e[2*G],Y=e[2*G+1];if(B>0&&Math.abs(W-k)<=DJ&&Math.abs(Y-z)<=DJ||(k=W,z=Y,G===A||G===y||G===w))continue;let H=0;for(let he=0,ve=this._hashKey(W,Y);he<this._hashSize&&(H=s[(ve+he)%this._hashSize],!(H!==-1&&H!==n[H]));he++);H=t[H];let $=H,J;for(;J=n[$],$0(W,Y,e[2*$],e[2*$+1],e[2*J],e[2*J+1])>=0;)if($=J,$===H){$=-1;break}if($===-1)continue;let te=this._addTriangle($,G,n[$],-1,-1,r[$]);r[G]=this._legalize(te+2),r[$]=te,C++;let ce=n[$];for(;J=n[ce],$0(W,Y,e[2*ce],e[2*ce+1],e[2*J],e[2*J+1])<0;)te=this._addTriangle(ce,G,J,r[G],-1,r[ce]),r[G]=this._legalize(te+2),n[ce]=ce,C--,ce=J;if($===H)for(;J=t[$],$0(W,Y,e[2*J],e[2*J+1],e[2*$],e[2*$+1])<0;)te=this._addTriangle(J,G,$,-1,r[$],r[J]),this._legalize(te+2),r[J]=te,n[$]=$,C--,$=J;this._hullStart=t[G]=$,n[$]=t[ce]=G,n[G]=ce,s[this._hashKey(W,Y)]=G,s[this._hashKey(e[2*$],e[2*$+1])]=$}this.hull=new Uint32Array(C);for(let B=0,k=this._hullStart;B<C;B++)this.hull[B]=k,k=n[k];this.triangles=this._triangles.subarray(0,this.trianglesLen),this.halfedges=this._halfedges.subarray(0,this.trianglesLen)}_hashKey(e,t){return Math.floor(awe(e-this._cx,t-this._cy)*this._hashSize)%this._hashSize}_legalize(e){let{_triangles:t,_halfedges:n,coords:r}=this,s=0,o=0;for(;;){let a=n[e],l=e-e%3;if(o=l+(e+2)%3,a===-1){if(s===0)break;e=XC[--s];continue}let c=a-a%3,u=l+(e+1)%3,f=c+(a+2)%3,d=t[o],A=t[e],y=t[u],w=t[f];if(lwe(r[2*d],r[2*d+1],r[2*A],r[2*A+1],r[2*y],r[2*y+1],r[2*w],r[2*w+1])){t[e]=w,t[a]=d;let T=n[f];if(T===-1){let P=this._hullStart;do{if(this._hullTri[P]===f){this._hullTri[P]=e;break}P=this._hullPrev[P]}while(P!==this._hullStart)}this._link(e,T),this._link(a,n[o]),this._link(o,f);let R=c+(a+1)%3;s<XC.length&&(XC[s++]=R)}else{if(s===0)break;e=XC[--s]}}return o}_link(e,t){this._halfedges[e]=t,t!==-1&&(this._halfedges[t]=e)}_addTriangle(e,t,n,r,s,o){let a=this.trianglesLen;return this._triangles[a]=e,this._triangles[a+1]=t,this._triangles[a+2]=n,this._link(a,r),this._link(a+1,s),this._link(a+2,o),this.trianglesLen+=3,a}};function awe(i,e){let t=i/(Math.abs(i)+Math.abs(e));return(e>0?3-t:1+t)/4}function JB(i,e,t,n){let r=i-t,s=e-n;return r*r+s*s}function lwe(i,e,t,n,r,s,o,a){let l=i-o,c=e-a,u=t-o,f=n-a,d=r-o,A=s-a,y=l*l+c*c,w=u*u+f*f,S=d*d+A*A;return l*(f*S-w*A)-c*(u*S-w*d)+y*(u*A-f*d)<0}function cwe(i,e,t,n,r,s){let o=t-i,a=n-e,l=r-i,c=s-e,u=o*o+a*a,f=l*l+c*c,d=.5/(o*c-a*l),A=(c*u-a*f)*d,y=(o*f-l*u)*d;return A*A+y*y}function uwe(i,e,t,n,r,s){let o=t-i,a=n-e,l=r-i,c=s-e,u=o*o+a*a,f=l*l+c*c,d=.5/(o*c-a*l),A=i+(c*u-a*f)*d,y=e+(o*f-l*u)*d;return{x:A,y}}function R_(i,e,t,n){if(n-t<=20)for(let r=t+1;r<=n;r++){let s=i[r],o=e[s],a=r-1;for(;a>=t&&e[i[a]]>o;)i[a+1]=i[a--];i[a+1]=s}else{let r=t+n>>1,s=t+1,o=n;bw(i,r,s),e[i[t]]>e[i[n]]&&bw(i,t,n),e[i[s]]>e[i[n]]&&bw(i,s,n),e[i[t]]>e[i[s]]&&bw(i,t,s);let a=i[s],l=e[a];for(;;){do s++;while(e[i[s]]<l);do o--;while(e[i[o]]>l);if(o<s)break;bw(i,s,o)}i[t+1]=i[o],i[o]=a,n-s+1>=o-t?(R_(i,e,s,n),R_(i,e,t,o-1)):(R_(i,e,t,o-1),R_(i,e,s,n))}}function bw(i,e,t){let n=i[e];i[e]=i[t],i[t]=n}function hwe(i){return i[0]}function fwe(i){return i[1]}function NJ(i,e){var t,n,r=0,s,o,a,l,c,u,f,d=i[0],A=i[1],y=e.length;for(t=0;t<y;t++){n=0;var w=e[t],S=w.length-1;if(u=w[0],u[0]!==w[S][0]&&u[1]!==w[S][1])throw new Error("First and last coordinates in a ring must be the same");for(o=u[0]-d,a=u[1]-A,n;n<S;n++){if(f=w[n+1],l=f[0]-d,c=f[1]-A,a===0&&c===0){if(l<=0&&o>=0||o<=0&&l>=0)return 0}else if(c>=0&&a<=0||c<=0&&a>=0){if(s=$0(o,l,a,c,0,0),s===0)return 0;(s>0&&c>0&&a<=0||s<0&&c<=0&&a>0)&&r++}u=f,a=c,o=l}}return r%2!==0}function FJ(i){if(!i)throw new Error("coord is required");if(!Array.isArray(i)){if(i.type==="Feature"&&i.geometry!==null&&i.geometry.type==="Point")return[...i.geometry.coordinates];if(i.type==="Point")return[...i.coordinates]}if(Array.isArray(i)&&i.length>=2&&!Array.isArray(i[0])&&!Array.isArray(i[1]))return[...i];throw new Error("coord must be GeoJSON Point or an Array of numbers")}function BJ(i){return i.type==="Feature"?i.geometry:i}function dwe(i,e,t={}){if(!i)throw new Error("point is required");if(!e)throw new Error("polygon is required");let n=FJ(i),r=BJ(e),s=r.type,o=e.bbox,a=r.coordinates;if(o&&pwe(n,o)===!1)return!1;s==="Polygon"&&(a=[a]);let l=!1;for(var c=0;c<a.length;++c){let u=NJ(n,a[c]);if(u===0)return!t.ignoreBoundary;u&&(l=!0)}return l}function pwe(i,e){return e[0]<=i[0]&&e[1]<=i[1]&&e[2]>=i[0]&&e[3]>=i[1]}var OJ=dwe;var $c=class{constructor(){this._x0=this._y0=this._x1=this._y1=null,this._=""}moveTo(e,t){this._+=`M${this._x0=this._x1=+e},${this._y0=this._y1=+t}`}closePath(){this._x1!==null&&(this._x1=this._x0,this._y1=this._y0,this._+="Z")}lineTo(e,t){this._+=`L${this._x1=+e},${this._y1=+t}`}arc(e,t,n){e=+e,t=+t,n=+n;let r=e+n,s=t;if(n<0)throw new Error("negative radius");this._x1===null?this._+=`M${r},${s}`:(Math.abs(this._x1-r)>1e-6||Math.abs(this._y1-s)>1e-6)&&(this._+="L"+r+","+s),n&&(this._+=`A${n},${n},0,1,1,${e-n},${t}A${n},${n},0,1,1,${this._x1=r},${this._y1=s}`)}rect(e,t,n,r){this._+=`M${this._x0=this._x1=+e},${this._y0=this._y1=+t}h${+n}v${+r}h${-n}Z`}value(){return this._||null}};var Z0=class{constructor(){this._=[]}moveTo(e,t){this._.push([e,t])}closePath(){this._.push(this._[0].slice())}lineTo(e,t){this._.push([e,t])}value(){return this._.length?this._:null}};var ww=class{constructor(e,[t,n,r,s]=[0,0,960,500]){if(!((r=+r)>=(t=+t))||!((s=+s)>=(n=+n)))throw new Error("invalid bounds");this.delaunay=e,this._circumcenters=new Float64Array(e.points.length*2),this.vectors=new Float64Array(e.points.length*2),this.xmax=r,this.xmin=t,this.ymax=s,this.ymin=n,this._init()}update(){return this.delaunay.update(),this._init(),this}_init(){let{delaunay:{points:e,hull:t,triangles:n},vectors:r}=this,s,o,a=this.circumcenters=this._circumcenters.subarray(0,n.length/3*2);for(let w=0,S=0,T=n.length,R,P;w<T;w+=3,S+=2){let I=n[w]*2,F=n[w+1]*2,D=n[w+2]*2,L=e[I],C=e[I+1],B=e[F],k=e[F+1],z=e[D],G=e[D+1],W=B-L,Y=k-C,H=z-L,$=G-C,J=(W*$-Y*H)*2;if(Math.abs(J)<1e-9){if(s===void 0){s=o=0;for(let ce of t)s+=e[ce*2],o+=e[ce*2+1];s/=t.length,o/=t.length}let te=1e9*Math.sign((s-L)*$-(o-C)*H);R=(L+z)/2-te*$,P=(C+G)/2+te*H}else{let te=1/J,ce=W*W+Y*Y,he=H*H+$*$;R=L+($*ce-Y*he)*te,P=C+(W*he-H*ce)*te}a[S]=R,a[S+1]=P}let l=t[t.length-1],c,u=l*4,f,d=e[2*l],A,y=e[2*l+1];r.fill(0);for(let w=0;w<t.length;++w)l=t[w],c=u,f=d,A=y,u=l*4,d=e[2*l],y=e[2*l+1],r[c+2]=r[u]=A-y,r[c+3]=r[u+1]=d-f}render(e){let t=e==null?e=new $c:void 0,{delaunay:{halfedges:n,inedges:r,hull:s},circumcenters:o,vectors:a}=this;if(s.length<=1)return null;for(let u=0,f=n.length;u<f;++u){let d=n[u];if(d<u)continue;let A=Math.floor(u/3)*2,y=Math.floor(d/3)*2,w=o[A],S=o[A+1],T=o[y],R=o[y+1];this._renderSegment(w,S,T,R,e)}let l,c=s[s.length-1];for(let u=0;u<s.length;++u){l=c,c=s[u];let f=Math.floor(r[c]/3)*2,d=o[f],A=o[f+1],y=l*4,w=this._project(d,A,a[y+2],a[y+3]);w&&this._renderSegment(d,A,w[0],w[1],e)}return t&&t.value()}renderBounds(e){let t=e==null?e=new $c:void 0;return e.rect(this.xmin,this.ymin,this.xmax-this.xmin,this.ymax-this.ymin),t&&t.value()}renderCell(e,t){let n=t==null?t=new $c:void 0,r=this._clip(e);if(r===null||!r.length)return;t.moveTo(r[0],r[1]);let s=r.length;for(;r[0]===r[s-2]&&r[1]===r[s-1]&&s>1;)s-=2;for(let o=2;o<s;o+=2)(r[o]!==r[o-2]||r[o+1]!==r[o-1])&&t.lineTo(r[o],r[o+1]);return t.closePath(),n&&n.value()}*cellPolygons(){let{delaunay:{points:e}}=this;for(let t=0,n=e.length/2;t<n;++t){let r=this.cellPolygon(t);r&&(r.index=t,yield r)}}cellPolygon(e){let t=new Z0;return this.renderCell(e,t),t.value()}_renderSegment(e,t,n,r,s){let o,a=this._regioncode(e,t),l=this._regioncode(n,r);a===0&&l===0?(s.moveTo(e,t),s.lineTo(n,r)):(o=this._clipSegment(e,t,n,r,a,l))&&(s.moveTo(o[0],o[1]),s.lineTo(o[2],o[3]))}contains(e,t,n){return t=+t,t!==t||(n=+n,n!==n)?!1:this.delaunay._step(e,t,n)===e}*neighbors(e){let t=this._clip(e);if(t)for(let n of this.delaunay.neighbors(e)){let r=this._clip(n);if(r){e:for(let s=0,o=t.length;s<o;s+=2)for(let a=0,l=r.length;a<l;a+=2)if(t[s]===r[a]&&t[s+1]===r[a+1]&&t[(s+2)%o]===r[(a+l-2)%l]&&t[(s+3)%o]===r[(a+l-1)%l]){yield n;break e}}}}_cell(e){let{circumcenters:t,delaunay:{inedges:n,halfedges:r,triangles:s}}=this,o=n[e];if(o===-1)return null;let a=[],l=o;do{let c=Math.floor(l/3);if(a.push(t[c*2],t[c*2+1]),l=l%3===2?l-2:l+1,s[l]!==e)break;l=r[l]}while(l!==o&&l!==-1);return a}_clip(e){if(e===0&&this.delaunay.hull.length===1)return[this.xmax,this.ymin,this.xmax,this.ymax,this.xmin,this.ymax,this.xmin,this.ymin];let t=this._cell(e);if(t===null)return null;let{vectors:n}=this,r=e*4;return this._simplify(n[r]||n[r+1]?this._clipInfinite(e,t,n[r],n[r+1],n[r+2],n[r+3]):this._clipFinite(e,t))}_clipFinite(e,t){let n=t.length,r=null,s,o,a=t[n-2],l=t[n-1],c,u=this._regioncode(a,l),f,d=0;for(let A=0;A<n;A+=2)if(s=a,o=l,a=t[A],l=t[A+1],c=u,u=this._regioncode(a,l),c===0&&u===0)f=d,d=0,r?r.push(a,l):r=[a,l];else{let y,w,S,T,R;if(c===0){if((y=this._clipSegment(s,o,a,l,c,u))===null)continue;[w,S,T,R]=y}else{if((y=this._clipSegment(a,l,s,o,u,c))===null)continue;[T,R,w,S]=y,f=d,d=this._edgecode(w,S),f&&d&&this._edge(e,f,d,r,r.length),r?r.push(w,S):r=[w,S]}f=d,d=this._edgecode(T,R),f&&d&&this._edge(e,f,d,r,r.length),r?r.push(T,R):r=[T,R]}if(r)f=d,d=this._edgecode(r[0],r[1]),f&&d&&this._edge(e,f,d,r,r.length);else if(this.contains(e,(this.xmin+this.xmax)/2,(this.ymin+this.ymax)/2))return[this.xmax,this.ymin,this.xmax,this.ymax,this.xmin,this.ymax,this.xmin,this.ymin];return r}_clipSegment(e,t,n,r,s,o){let a=s<o;for(a&&([e,t,n,r,s,o]=[n,r,e,t,o,s]);;){if(s===0&&o===0)return a?[n,r,e,t]:[e,t,n,r];if(s&o)return null;let l,c,u=s||o;u&8?(l=e+(n-e)*(this.ymax-t)/(r-t),c=this.ymax):u&4?(l=e+(n-e)*(this.ymin-t)/(r-t),c=this.ymin):u&2?(c=t+(r-t)*(this.xmax-e)/(n-e),l=this.xmax):(c=t+(r-t)*(this.xmin-e)/(n-e),l=this.xmin),s?(e=l,t=c,s=this._regioncode(e,t)):(n=l,r=c,o=this._regioncode(n,r))}}_clipInfinite(e,t,n,r,s,o){let a=Array.from(t),l;if((l=this._project(a[0],a[1],n,r))&&a.unshift(l[0],l[1]),(l=this._project(a[a.length-2],a[a.length-1],s,o))&&a.push(l[0],l[1]),a=this._clipFinite(e,a))for(let c=0,u=a.length,f,d=this._edgecode(a[u-2],a[u-1]);c<u;c+=2)f=d,d=this._edgecode(a[c],a[c+1]),f&&d&&(c=this._edge(e,f,d,a,c),u=a.length);else this.contains(e,(this.xmin+this.xmax)/2,(this.ymin+this.ymax)/2)&&(a=[this.xmin,this.ymin,this.xmax,this.ymin,this.xmax,this.ymax,this.xmin,this.ymax]);return a}_edge(e,t,n,r,s){for(;t!==n;){let o,a;switch(t){case 5:t=4;continue;case 4:t=6,o=this.xmax,a=this.ymin;break;case 6:t=2;continue;case 2:t=10,o=this.xmax,a=this.ymax;break;case 10:t=8;continue;case 8:t=9,o=this.xmin,a=this.ymax;break;case 9:t=1;continue;case 1:t=5,o=this.xmin,a=this.ymin;break}(r[s]!==o||r[s+1]!==a)&&this.contains(e,o,a)&&(r.splice(s,0,o,a),s+=2)}return s}_project(e,t,n,r){let s=1/0,o,a,l;if(r<0){if(t<=this.ymin)return null;(o=(this.ymin-t)/r)<s&&(l=this.ymin,a=e+(s=o)*n)}else if(r>0){if(t>=this.ymax)return null;(o=(this.ymax-t)/r)<s&&(l=this.ymax,a=e+(s=o)*n)}if(n>0){if(e>=this.xmax)return null;(o=(this.xmax-e)/n)<s&&(a=this.xmax,l=t+(s=o)*r)}else if(n<0){if(e<=this.xmin)return null;(o=(this.xmin-e)/n)<s&&(a=this.xmin,l=t+(s=o)*r)}return[a,l]}_edgecode(e,t){return(e===this.xmin?1:e===this.xmax?2:0)|(t===this.ymin?4:t===this.ymax?8:0)}_regioncode(e,t){return(e<this.xmin?1:e>this.xmax?2:0)|(t<this.ymin?4:t>this.ymax?8:0)}_simplify(e){if(e&&e.length>4){for(let t=0;t<e.length;t+=2){let n=(t+2)%e.length,r=(t+4)%e.length;(e[t]===e[n]&&e[n]===e[r]||e[t+1]===e[n+1]&&e[n+1]===e[r+1])&&(e.splice(n,2),t-=2)}e.length||(e=null)}return e}};var mwe=2*Math.PI,I_=Math.pow;function Awe(i){return i[0]}function gwe(i){return i[1]}function vwe(i){let{triangles:e,coords:t}=i;for(let n=0;n<e.length;n+=3){let r=2*e[n],s=2*e[n+1],o=2*e[n+2];if((t[o]-t[r])*(t[s+1]-t[r+1])-(t[s]-t[r])*(t[o+1]-t[r+1])>1e-10)return!1}return!0}function _we(i,e,t){return[i+Math.sin(i+e)*t,e+Math.cos(i-e)*t]}var P_=class i{static from(e,t=Awe,n=gwe,r){return new i("length"in e?xwe(e,t,n,r):Float64Array.from(ywe(e,t,n,r)))}constructor(e){this._delaunator=new Y0(e),this.inedges=new Int32Array(e.length/2),this._hullIndex=new Int32Array(e.length/2),this.points=this._delaunator.coords,this._init()}update(){return this._delaunator.update(),this._init(),this}_init(){let e=this._delaunator,t=this.points;if(e.hull&&e.hull.length>2&&vwe(e)){this.collinear=Int32Array.from({length:t.length/2},(d,A)=>A).sort((d,A)=>t[2*d]-t[2*A]||t[2*d+1]-t[2*A+1]);let l=this.collinear[0],c=this.collinear[this.collinear.length-1],u=[t[2*l],t[2*l+1],t[2*c],t[2*c+1]],f=1e-8*Math.hypot(u[3]-u[1],u[2]-u[0]);for(let d=0,A=t.length/2;d<A;++d){let y=_we(t[2*d],t[2*d+1],f);t[2*d]=y[0],t[2*d+1]=y[1]}this._delaunator=new Y0(t)}else delete this.collinear;let n=this.halfedges=this._delaunator.halfedges,r=this.hull=this._delaunator.hull,s=this.triangles=this._delaunator.triangles,o=this.inedges.fill(-1),a=this._hullIndex.fill(-1);for(let l=0,c=n.length;l<c;++l){let u=s[l%3===2?l-2:l+1];(n[l]===-1||o[u]===-1)&&(o[u]=l)}for(let l=0,c=r.length;l<c;++l)a[r[l]]=l;r.length<=2&&r.length>0&&(this.triangles=new Int32Array(3).fill(-1),this.halfedges=new Int32Array(3).fill(-1),this.triangles[0]=r[0],o[r[0]]=1,r.length===2&&(o[r[1]]=0,this.triangles[1]=r[1],this.triangles[2]=r[1]))}voronoi(e){return new ww(this,e)}*neighbors(e){let{inedges:t,hull:n,_hullIndex:r,halfedges:s,triangles:o,collinear:a}=this;if(a){let f=a.indexOf(e);f>0&&(yield a[f-1]),f<a.length-1&&(yield a[f+1]);return}let l=t[e];if(l===-1)return;let c=l,u=-1;do{if(yield u=o[c],c=c%3===2?c-2:c+1,o[c]!==e)return;if(c=s[c],c===-1){let f=n[(r[e]+1)%n.length];f!==u&&(yield f);return}}while(c!==l)}find(e,t,n=0){if(e=+e,e!==e||(t=+t,t!==t))return-1;let r=n,s;for(;(s=this._step(n,e,t))>=0&&s!==n&&s!==r;)n=s;return s}_step(e,t,n){let{inedges:r,hull:s,_hullIndex:o,halfedges:a,triangles:l,points:c}=this;if(r[e]===-1||!c.length)return(e+1)%(c.length>>1);let u=e,f=I_(t-c[e*2],2)+I_(n-c[e*2+1],2),d=r[e],A=d;do{let y=l[A],w=I_(t-c[y*2],2)+I_(n-c[y*2+1],2);if(w<f&&(f=w,u=y),A=A%3===2?A-2:A+1,l[A]!==e)break;if(A=a[A],A===-1){if(A=s[(o[e]+1)%s.length],A!==y&&I_(t-c[A*2],2)+I_(n-c[A*2+1],2)<f)return A;break}}while(A!==d);return u}render(e){let t=e==null?e=new $c:void 0,{points:n,halfedges:r,triangles:s}=this;for(let o=0,a=r.length;o<a;++o){let l=r[o];if(l<o)continue;let c=s[o]*2,u=s[l]*2;e.moveTo(n[c],n[c+1]),e.lineTo(n[u],n[u+1])}return this.renderHull(e),t&&t.value()}renderPoints(e,t){t===void 0&&(!e||typeof e.moveTo!="function")&&(t=e,e=null),t=t==null?2:+t;let n=e==null?e=new $c:void 0,{points:r}=this;for(let s=0,o=r.length;s<o;s+=2){let a=r[s],l=r[s+1];e.moveTo(a+t,l),e.arc(a,l,t,0,mwe)}return n&&n.value()}renderHull(e){let t=e==null?e=new $c:void 0,{hull:n,points:r}=this,s=n[0]*2,o=n.length;e.moveTo(r[s],r[s+1]);for(let a=1;a<o;++a){let l=2*n[a];e.lineTo(r[l],r[l+1])}return e.closePath(),t&&t.value()}hullPolygon(){let e=new Z0;return this.renderHull(e),e.value()}renderTriangle(e,t){let n=t==null?t=new $c:void 0,{points:r,triangles:s}=this,o=s[e*=3]*2,a=s[e+1]*2,l=s[e+2]*2;return t.moveTo(r[o],r[o+1]),t.lineTo(r[a],r[a+1]),t.lineTo(r[l],r[l+1]),t.closePath(),n&&n.value()}*trianglePolygons(){let{triangles:e}=this;for(let t=0,n=e.length/3;t<n;++t)yield this.trianglePolygon(t)}trianglePolygon(e){let t=new Z0;return this.renderTriangle(e,t),t.value()}};function xwe(i,e,t,n){let r=i.length,s=new Float64Array(r*2);for(let o=0;o<r;++o){let a=i[o];s[o*2]=e.call(n,a,o,i),s[o*2+1]=t.call(n,a,o,i)}return s}function*ywe(i,e,t,n){let r=0;for(let s of i)yield e.call(n,s,r,i),yield t.call(n,s,r,i),++r}var Sw=Math.PI,UJ=Sw/2,$ot=Sw/4,Yot=Sw*2,eO=180/Sw,tO=Sw/180;var nO=Math.atan2,$C=Math.cos;var kJ=Math.max,zJ=Math.min;var YC=Math.sin,VJ=Math.sign||function(i){return i>0?1:i<0?-1:0},ZC=Math.sqrt;function iO(i){return i>1?UJ:i<-1?-UJ:Math.asin(i)}function rO(i,e){return i[0]*e[0]+i[1]*e[1]+i[2]*e[2]}function Ml(i,e){return[i[1]*e[2]-i[2]*e[1],i[2]*e[0]-i[0]*e[2],i[0]*e[1]-i[1]*e[0]]}function Tw(i,e){return[i[0]+e[0],i[1]+e[1],i[2]+e[2]]}function Ew(i){var e=ZC(i[0]*i[0]+i[1]*i[1]+i[2]*i[2]);return[i[0]/e,i[1]/e,i[2]/e]}function sO(i){return[nO(i[1],i[0])*eO,iO(kJ(-1,zJ(1,i[2])))*eO]}function nf(i){let e=i[0]*tO,t=i[1]*tO,n=$C(t);return[n*$C(e),n*YC(e),YC(t)]}function KC(i){return i=i.map(e=>nf(e)),rO(i[0],Ml(i[2],i[1]))}function qJ(i){let e=wwe(i),t=Twe(e),n=Swe(t,i),r=Mwe(t,i.length),s=bwe(r,i),o=Ewe(t,i),{polygons:a,centers:l}=Cwe(o,t,i),c=Rwe(a),u=Pwe(t,i),f=Iwe(n,t);return{delaunay:e,edges:n,triangles:t,centers:l,neighbors:r,polygons:a,mesh:c,hull:u,urquhart:f,find:s}}function bwe(i,e){function t(n,r){let s=n[0]-r[0],o=n[1]-r[1],a=n[2]-r[2];return s*s+o*o+a*a}return function(r,s,o){o===void 0&&(o=0);let a,l,c=o,u=nf([r,s]);do a=o,o=null,l=t(u,nf(e[a])),i[a].forEach(f=>{let d=t(u,nf(e[f]));if(d<l){l=d,o=f,c=f;return}});while(o!==null);return c}}function wwe(i){if(i.length<2)return{};let e=0;for(;isNaN(i[e][0]+i[e][1])&&e++<i.length;);let t=aB(i[e]),n=TB().translate([0,0]).scale(1).rotate(t.invert([180,0]));i=i.map(n);let r=[],s=1;for(let d=0,A=i.length;d<A;d++){let y=i[d][0]**2+i[d][1]**2;!isFinite(y)||y>1e32?r.push(d):y>s&&(s=y)}let o=1e6*ZC(s);r.forEach(d=>i[d]=[o,0]),i.push([0,o]),i.push([-o,0]),i.push([0,-o]);let a=P_.from(i);a.projection=n;let{triangles:l,halfedges:c,inedges:u}=a,f=[];for(let d=0,A=c.length;d<A;d++)if(c[d]<0){let y=d%3==2?d-2:d+1,w=d%3==0?d+2:d-1,S=c[y],T=c[w];c[S]=T,c[T]=S,c[y]=c[w]=-1,l[d]=l[y]=l[w]=e,u[l[S]]=S%3==0?S+2:S-1,u[l[T]]=T%3==0?T+2:T-1,f.push(Math.min(d,y,w)),d+=2-d%3}else l[d]>i.length-3-1&&(l[d]=e);return a}function Swe(i,e){let t=new Set;return e.length===2?[[0,1]]:(i.forEach(n=>{if(n[0]!==n[1]&&!(KC(n.map(r=>e[r]))<0))for(let r=0,s;r<3;r++)s=(r+1)%3,t.add(V0([n[r],n[s]]).join("-"))}),Array.from(t,n=>n.split("-").map(Number)))}function Twe(i){let{triangles:e}=i;if(!e)return[];let t=[];for(let n=0,r=e.length/3;n<r;n++){let s=e[3*n],o=e[3*n+1],a=e[3*n+2];s!==o&&o!==a&&t.push([s,a,o])}return t}function Ewe(i,e){return i.map(t=>{let n=t.map(s=>e[s]).map(nf),r=Tw(Tw(Ml(n[1],n[0]),Ml(n[2],n[1])),Ml(n[0],n[2]));return sO(Ew(r))})}function Mwe(i,e){let t=[];return i.forEach(n=>{for(let r=0;r<3;r++){let s=n[r],o=n[(r+1)%3];t[s]=t[s]||[],t[s].push(o)}}),i.length===0&&(e===2?(t[0]=[1],t[1]=[0]):e===1&&(t[0]=[])),t}function Cwe(i,e,t){let n=[],r=i.slice();if(e.length===0){if(t.length<2)return{polygons:n,centers:r};if(t.length===2){let a=nf(t[0]),l=nf(t[1]),c=Ew(Tw(a,l)),u=Ew(Ml(a,l)),f=Ml(c,u),d=[c,Ml(c,f),Ml(Ml(c,f),f),Ml(Ml(Ml(c,f),f),f)].map(sO).map(o);return n.push(d),n.push(d.slice().reverse()),{polygons:n,centers:r}}}e.forEach((a,l)=>{for(let c=0;c<3;c++){let u=a[c],f=a[(c+1)%3],d=a[(c+2)%3];n[u]=n[u]||[],n[u].push([f,d,l,[u,f,d]])}});let s=n.map(a=>{let l=[a[0][2]],c=a[0][1];for(let u=1;u<a.length;u++)for(let f=0;f<a.length;f++)if(a[f][0]==c){c=a[f][1],l.push(a[f][2]);break}if(l.length>2)return l;if(l.length==2){let u=GJ(t[a[0][3][0]],t[a[0][3][1]],r[l[0]]),f=GJ(t[a[0][3][2]],t[a[0][3][0]],r[l[0]]),d=o(u),A=o(f);return[l[0],A,l[1],d]}});function o(a){let l=-1;return r.slice(e.length,1/0).forEach((c,u)=>{c[0]===a[0]&&c[1]===a[1]&&(l=u+e.length)}),l<0&&(l=r.length,r.push(a)),l}return{polygons:s,centers:r}}function GJ(i,e,t){i=nf(i),e=nf(e),t=nf(t);let n=VJ(rO(Ml(e,i),t));return sO(Ew(Tw(i,e)).map(r=>n*r))}function Rwe(i){let e=[];return i.forEach(t=>{if(!t)return;let n=t[t.length-1];for(let r of t)r>n&&e.push([n,r]),n=r}),e}function Iwe(i,e){return function(t){let n=new Map,r=new Map;return i.forEach((s,o)=>{let a=s.join("-");n.set(a,t[o]),r.set(a,!0)}),e.forEach(s=>{let o=0,a=-1;for(let l=0;l<3;l++){let c=V0([s[l],s[(l+1)%3]]).join("-");n.get(c)>o&&(o=n.get(c),a=c)}r.set(a,!1)}),i.map(s=>r.get(s.join("-")))}}function Pwe(i,e){let t=new Set,n=[];i.map(a=>{if(!(KC(a.map(l=>e[l>e.length?0:l]))>1e-12))for(let l=0;l<3;l++){let c=[a[l],a[(l+1)%3]],u=`${c[0]}-${c[1]}`;t.has(u)?t.delete(u):t.add(`${c[1]}-${c[0]}`)}});let r=new Map,s;if(t.forEach(a=>{a=a.split("-").map(Number),r.set(a[0],a[1]),s=a[0]}),s===void 0)return n;let o=s;do{n.push(o);let a=r.get(o);r.set(o,-1),o=a}while(o>-1&&o!==s);return n}function oO(i){let e=function(t){if(e.delaunay=null,e._data=t,typeof e._data=="object"&&e._data.type==="FeatureCollection"&&(e._data=e._data.features),typeof e._data=="object"){let n=e._data.map(r=>[e._vx(r),e._vy(r),r]).filter(r=>isFinite(r[0]+r[1]));e.points=n.map(r=>[r[0],r[1]]),e.valid=n.map(r=>r[2]),e.delaunay=qJ(e.points)}return e};return e._vx=function(t){if(typeof t=="object"&&"type"in t)return yC(t)[0];if(0 in t)return t[0]},e._vy=function(t){if(typeof t=="object"&&"type"in t)return yC(t)[1];if(1 in t)return t[1]},e.x=function(t){return t?(e._vx=t,e):e._vx},e.y=function(t){return t?(e._vy=t,e):e._vy},e.polygons=function(t){if(t!==void 0&&e(t),!e.delaunay)return!1;let n={type:"FeatureCollection",features:[]};return e.valid.length===0||(e.delaunay.polygons.forEach((r,s)=>n.features.push({type:"Feature",geometry:r?{type:"Polygon",coordinates:[[...r,r[0]].map(o=>e.delaunay.centers[o])]}:null,properties:{site:e.valid[s],sitecoordinates:e.points[s],neighbours:e.delaunay.neighbors[s]}})),e.valid.length===1&&n.features.push({type:"Feature",geometry:{type:"Sphere"},properties:{site:e.valid[0],sitecoordinates:e.points[0],neighbours:[]}})),n},e.triangles=function(t){return t!==void 0&&e(t),e.delaunay?{type:"FeatureCollection",features:e.delaunay.triangles.map((n,r)=>(n=n.map(s=>e.points[s]),n.center=e.delaunay.centers[r],n)).filter(n=>KC(n)>0).map(n=>({type:"Feature",properties:{circumcenter:n.center},geometry:{type:"Polygon",coordinates:[[...n,n[0]]]}}))}:!1},e.links=function(t){if(t!==void 0&&e(t),!e.delaunay)return!1;let n=e.delaunay.edges.map(s=>El(e.points[s[0]],e.points[s[1]])),r=e.delaunay.urquhart(n);return{type:"FeatureCollection",features:e.delaunay.edges.map((s,o)=>({type:"Feature",properties:{source:e.valid[s[0]],target:e.valid[s[1]],length:n[o],urquhart:!!r[o]},geometry:{type:"LineString",coordinates:[e.points[s[0]],e.points[s[1]]]}}))}},e.mesh=function(t){return t!==void 0&&e(t),e.delaunay?{type:"MultiLineString",coordinates:e.delaunay.edges.map(n=>[e.points[n[0]],e.points[n[1]]])}:!1},e.cellMesh=function(t){if(t!==void 0&&e(t),!e.delaunay)return!1;let{centers:n,polygons:r}=e.delaunay,s=[];for(let o of r)if(o)for(let a=o.length,l=o[a-1],c=o[0],u=0;u<a;l=c,c=o[++u])c>l&&s.push([n[l],n[c]]);return{type:"MultiLineString",coordinates:s}},e._found=void 0,e.find=function(t,n,r){if(e._found=e.delaunay.find(t,n,e._found),!r||El([t,n],e.points[e._found])<r)return e._found},e.hull=function(t){t!==void 0&&e(t);let n=e.delaunay.hull,r=e.points;return n.length===0?null:{type:"Polygon",coordinates:[[...n.map(s=>r[s]),r[n[0]]]]}},i?e(i):e}function lO(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 Lwe(i){if(Array.isArray(i))return i}function Dwe(i){if(Array.isArray(i))return lO(i)}function Nwe(i){if(i===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return i}function Fwe(i,e,t){return e=JC(e),qwe(i,WJ()?Reflect.construct(e,[],JC(i).constructor):e.apply(i,t))}function Bwe(i,e){if(!(i instanceof e))throw new TypeError("Cannot call a class as a function")}function Owe(i,e,t){return Object.defineProperty(i,"prototype",{writable:!1}),i}function JC(i){return JC=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},JC(i)}function Uwe(i,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");i.prototype=Object.create(e&&e.prototype,{constructor:{value:i,writable:!0,configurable:!0}}),Object.defineProperty(i,"prototype",{writable:!1}),e&&cO(i,e)}function WJ(){try{var i=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(WJ=function(){return!!i})()}function kwe(i){if(typeof Symbol<"u"&&i[Symbol.iterator]!=null||i["@@iterator"]!=null)return Array.from(i)}function zwe(i,e){var t=i==null?null:typeof Symbol<"u"&&i[Symbol.iterator]||i["@@iterator"];if(t!=null){var n,r,s,o,a=[],l=!0,c=!1;try{if(s=(t=t.call(i)).next,e!==0)for(;!(l=(n=s.call(t)).done)&&(a.push(n.value),a.length!==e);l=!0);}catch(u){c=!0,r=u}finally{try{if(!l&&t.return!=null&&(o=t.return(),Object(o)!==o))return}finally{if(c)throw r}}return a}}function Vwe(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.4126-In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Gwe(){throw new TypeError(`Invalid attempt to spread non-iterable instance.4127-In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function qwe(i,e){if(e&&(typeof e=="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Nwe(i)}function cO(i,e){return cO=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,n){return t.__proto__=n,t},cO(i,e)}function rf(i,e){return Lwe(i)||zwe(i,e)||jJ(i,e)||Vwe()}function aO(i){return Dwe(i)||kwe(i)||jJ(i)||Gwe()}function jJ(i,e){if(i){if(typeof i=="string")return lO(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)?lO(i,e):void 0}}function Hwe(i){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},t=e.resolution,n=t===void 0?1/0:t,r=Wwe(i,n),s=Zh(r),o=jwe(i,n),a=[].concat(aO(s),aO(o)),l={type:"Polygon",coordinates:i},c=dC(l),u=rf(c,2),f=rf(u[0],2),d=f[0],A=f[1],y=rf(u[1],2),w=y[0],S=y[1],T=d>w||S>=89||A<=-89,R=[];if(T){var P=oO(a).triangles(),I=new Map(a.map(function(J,te){var ce=rf(J,2),he=ce[0],ve=ce[1];return["".concat(he,"-").concat(ve),te]}));P.features.forEach(function(J){var te,ce=J.geometry.coordinates[0].slice(0,3).reverse(),he=[];if(ce.forEach(function(Re){var Qe=rf(Re,2),Fe=Qe[0],mt=Qe[1],Ee="".concat(Fe,"-").concat(mt);I.has(Ee)&&he.push(I.get(Ee))}),he.length===3){if(he.some(function(Re){return Re<s.length})){var ve=J.properties.circumcenter;if(!uO(ve,l,T))return}(te=R).push.apply(te,he)}})}else if(o.length)for(var B=Y0.from(a),k=function(te){var ce,he=[2,1,0].map(function(Qe){return B.triangles[te+Qe]}),ve=he.map(function(Qe){return a[Qe]});if(he.some(function(Qe){return Qe<s.length})){var Re=[0,1].map(function(Qe){return YM(ve,function(Fe){return Fe[Qe]})});if(!uO(Re,l,T))return 1}(ce=R).push.apply(ce,aO(he))},z=0,G=B.triangles.length;z<G;z+=3)k(z);else{var F=S_(r),D=F.vertices,L=F.holes,C=L===void 0?[]:L;R=kB(D,C,2)}var W=Sl(V0(a,function(J){return J[0]}),[0,1]),Y=Sl(V0(a,function(J){return J[1]}),[0,1]),H=a.map(function(J){var te=rf(J,2),ce=te[0],he=te[1];return[W(ce),Y(he)]}),$={points:a,indices:R,uvs:H};return{contour:r,triangles:$}}function Wwe(i,e){return i.map(function(t){var n=[],r;return t.forEach(function(s){if(r){var o=El(s,r)*180/Math.PI;if(o>e)for(var a=yg(r,s),l=1/Math.ceil(o/e),c=l;c<1;)n.push(a(c)),c+=l}n.push(r=s)}),n})}function jwe(i,e){var t={type:"Polygon",coordinates:i},n=dC(t),r=rf(n,2),s=rf(r[0],2),o=s[0],a=s[1],l=rf(r[1],2),c=l[0],u=l[1];if(Math.min(Math.abs(c-o),Math.abs(u-a))<e)return[];var f=o>c||u>=89||a<=-89;return Xwe(e,{minLng:o,maxLng:c,minLat:a,maxLat:u}).filter(function(d){return uO(d,t,f)})}function Xwe(i){for(var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},t=e.minLng,n=e.maxLng,r=e.minLat,s=e.maxLat,o=Math.round(Math.pow(360/i,2)/Math.PI),a=(1+Math.sqrt(5))/2,l=function(T){return T/a*360%360-180},c=function(T){return Math.acos(2*T/o-1)/Math.PI*180-90},u=function(T){return o*(Math.cos((T+90)*Math.PI/180)+1)/2},f=[s!==void 0?Math.ceil(u(s)):0,r!==void 0?Math.floor(u(r)):o-1],d=t===void 0&&n===void 0?function(){return!0}:t===void 0?function(S){return S<=n}:n===void 0?function(S){return S>=t}:n>=t?function(S){return S>=t&&S<=n}:function(S){return S>=t||S<=n},A=[],y=f[0];y<=f[1];y++){var w=l(y);d(w)&&A.push([w,c(y)])}return A}function uO(i,e){var t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;return t?pB(e,i):OJ(i,e)}var QC=window.THREE?window.THREE:{BufferGeometry:Xn,Float32BufferAttribute:Ln},HJ=new QC.BufferGeometry().setAttribute?"setAttribute":"addAttribute",eR=(function(i){function e(t,n,r,s,o,a,l){var c;Bwe(this,e),c=Fwe(this,e),c.type="ConicPolygonGeometry",c.parameters={polygonGeoJson:t,bottomHeight:n,topHeight:r,closedBottom:s,closedTop:o,includeSides:a,curvatureResolution:l},n=n||0,r=r||1,s=s!==void 0?s:!0,o=o!==void 0?o:!0,a=a!==void 0?a:!0,l=l||5;var u=Hwe(t,{resolution:l}),f=u.contour,d=u.triangles,A=Zh(d.uvs),y=[],w=[],S=[],T=0,R=function(L){var C=Math.round(y.length/3),B=S.length;y=y.concat(L.vertices),w=w.concat(L.uvs),S=S.concat(C?L.indices.map(function(k){return k+C}):L.indices),c.addGroup(B,S.length-B,T++)};a&&R(I()),s&&R(F(n,!1)),o&&R(F(r,!0)),c.setIndex(S),c[HJ]("position",new QC.Float32BufferAttribute(y,3)),c[HJ]("uv",new QC.Float32BufferAttribute(w,2)),c.computeVertexNormals();function P(D,L){var C=typeof L=="function"?L:function(){return L},B=D.map(function(k){return k.map(function(z){var G=rf(z,2),W=G[0],Y=G[1];return $we(Y,W,C(W,Y))})});return S_(B)}function I(){for(var D=P(f,n),L=D.vertices,C=D.holes,B=P(f,r),k=B.vertices,z=Zh([k,L]),G=Math.round(k.length/3),W=new Set(C),Y=0,H=[],$=0;$<G;$++){var J=$+1;if(J===G)J=Y;else if(W.has(J)){var te=J;J=Y,Y=te}H.push($,$+G,J+G),H.push(J+G,J,$)}for(var ce=[],he=1;he>=0;he--)for(var ve=0;ve<G;ve+=1)ce.push(ve/(G-1),he);return{indices:H,vertices:z,uvs:ce}}function F(D){var L=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return{indices:L?d.indices:d.indices.slice().reverse(),vertices:P([d.points],D).vertices,uvs:A}}return c}return Uwe(e,i),Owe(e)})(QC.BufferGeometry);function $we(i,e){var t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,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)]}function hO(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 Ywe(i){if(Array.isArray(i))return i}function Zwe(i){if(Array.isArray(i))return hO(i)}function Kwe(i){if(typeof Symbol<"u"&&i[Symbol.iterator]!=null||i["@@iterator"]!=null)return Array.from(i)}function Qwe(i,e){var t=i==null?null:typeof Symbol<"u"&&i[Symbol.iterator]||i["@@iterator"];if(t!=null){var n,r,s,o,a=[],l=!0,c=!1;try{if(s=(t=t.call(i)).next,e!==0)for(;!(l=(n=s.call(t)).done)&&(a.push(n.value),a.length!==e);l=!0);}catch(u){c=!0,r=u}finally{try{if(!l&&t.return!=null&&(o=t.return(),Object(o)!==o))return}finally{if(c)throw r}}return a}}function Jwe(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.4128-In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function eSe(){throw new TypeError(`Invalid attempt to spread non-iterable instance.4129-In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function tSe(i,e){if(i==null)return{};var t,n,r=nSe(i,e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(i);for(n=0;n<s.length;n++)t=s[n],e.includes(t)||{}.propertyIsEnumerable.call(i,t)&&(r[t]=i[t])}return r}function nSe(i,e){if(i==null)return{};var t={};for(var n in i)if({}.hasOwnProperty.call(i,n)){if(e.includes(n))continue;t[n]=i[n]}return t}function iSe(i,e){return Ywe(i)||Qwe(i,e)||XJ(i,e)||Jwe()}function rSe(i){return Zwe(i)||Kwe(i)||XJ(i)||eSe()}function sSe(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 String(i)}function oSe(i){var e=sSe(i,"string");return typeof e=="symbol"?e:e+""}function XJ(i,e){if(i){if(typeof i=="string")return hO(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)?hO(i,e):void 0}}var $J=(function(){var i=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,n=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1,r=(e instanceof Array?e.length?e:[void 0]:[e]).map(function(a){return{keyAccessor:a,isProp:!(a instanceof Function)}}),s=i.reduce(function(a,l){var c=a,u=l;return r.forEach(function(f,d){var A=f.keyAccessor,y=f.isProp,w;if(y){var S=u,T=S[A],R=tSe(S,[A].map(oSe));w=T,u=R}else w=A(u,d);d+1<r.length?(c.hasOwnProperty(w)||(c[w]={}),c=c[w]):t?(c.hasOwnProperty(w)||(c[w]=[]),c[w].push(u)):c[w]=u}),a},{});t instanceof Function&&(function a(l){var c=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1;c===r.length?Object.keys(l).forEach(function(u){return l[u]=t(l[u])}):Object.values(l).forEach(function(u){return a(u,c+1)})})(s);var o=s;return n&&(o=[],(function a(l){var c=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[];c.length===r.length?o.push({keys:c,vals:l}):Object.entries(l).forEach(function(u){var f=iSe(u,2),d=f[0],A=f[1];return a(A,[].concat(rSe(c),[d]))})})(s),e instanceof Array&&e.length===0&&o.length===1&&(o[0].keys=[])),o});var Ai=(function(i){i=i||{};var e=typeof i<"u"?i:{},t={},n;for(n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);var r=[],s="";function o(Le){return e.locateFile?e.locateFile(Le,s):s+Le}var a;typeof document<"u"&&document.currentScript&&(s=document.currentScript.src),s.indexOf("blob:")!==0?s=s.substr(0,s.lastIndexOf("/")+1):s="",a=function(it,Dt,He){var h=new XMLHttpRequest;h.open("GET",it,!0),h.responseType="arraybuffer",h.onload=function(){if(h.status==200||h.status==0&&h.response){Dt(h.response);return}var Ii=St(it);if(Ii){Dt(Ii.buffer);return}He()},h.onerror=He,h.send(null)};var l=e.print||console.log.bind(console),c=e.printErr||console.warn.bind(console);for(n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);t=null,e.arguments&&(r=e.arguments);var u=0,f=function(Le){u=Le},d=function(){return u},A=8;function y(Le,it,Dt,He){switch(Dt=Dt||"i8",Dt.charAt(Dt.length-1)==="*"&&(Dt="i32"),Dt){case"i1":Y[Le>>0]=it;break;case"i8":Y[Le>>0]=it;break;case"i16":$[Le>>1]=it;break;case"i32":te[Le>>2]=it;break;case"i64":Ge=[it>>>0,(Pe=it,+bt(Pe)>=1?Pe>0?(tn(+hn(Pe/4294967296),4294967295)|0)>>>0:~~+yt((Pe-+(~~Pe>>>0))/4294967296)>>>0:0)],te[Le>>2]=Ge[0],te[Le+4>>2]=Ge[1];break;case"float":he[Le>>2]=it;break;case"double":ve[Le>>3]=it;break;default:Nm("invalid type for setValue: "+Dt)}}function w(Le,it,Dt){switch(it=it||"i8",it.charAt(it.length-1)==="*"&&(it="i32"),it){case"i1":return Y[Le>>0];case"i8":return Y[Le>>0];case"i16":return $[Le>>1];case"i32":return te[Le>>2];case"i64":return te[Le>>2];case"float":return he[Le>>2];case"double":return ve[Le>>3];default:Nm("invalid type for getValue: "+it)}return null}var S=!1;function T(Le,it){Le||Nm("Assertion failed: "+it)}function R(Le){var it=e["_"+Le];return T(it,"Cannot call unknown function "+Le+", make sure it is exported"),it}function P(Le,it,Dt,He,h){var sr={string:function(ii){var zi=0;if(ii!=null&&ii!==0){var KS=(ii.length<<2)+1;zi=EG(KS),B(ii,zi,KS)}return zi},array:function(ii){var zi=EG(ii.length);return z(ii,zi),zi}};function Ii(ii){return it==="string"?L(ii):it==="boolean"?!!ii:ii}var ie=R(Le),or=[],sl=0;if(He)for(var fo=0;fo<He.length;fo++){var Qs=sr[Dt[fo]];Qs?(sl===0&&(sl=Zle()),or[fo]=Qs(He[fo])):or[fo]=He[fo]}var bs=ie.apply(null,or);return bs=Ii(bs),sl!==0&&Yle(sl),bs}function I(Le,it,Dt,He){Dt=Dt||[];var h=Dt.every(function(Ii){return Ii==="number"}),sr=it!=="string";return sr&&h&&!He?R(Le):function(){return P(Le,it,Dt,arguments,He)}}var F=typeof TextDecoder<"u"?new TextDecoder("utf8"):void 0;function D(Le,it,Dt){for(var He=it+Dt,h=it;Le[h]&&!(h>=He);)++h;if(h-it>16&&Le.subarray&&F)return F.decode(Le.subarray(it,h));for(var sr="";it<h;){var Ii=Le[it++];if(!(Ii&128)){sr+=String.fromCharCode(Ii);continue}var ie=Le[it++]&63;if((Ii&224)==192){sr+=String.fromCharCode((Ii&31)<<6|ie);continue}var or=Le[it++]&63;if((Ii&240)==224?Ii=(Ii&15)<<12|ie<<6|or:Ii=(Ii&7)<<18|ie<<12|or<<6|Le[it++]&63,Ii<65536)sr+=String.fromCharCode(Ii);else{var sl=Ii-65536;sr+=String.fromCharCode(55296|sl>>10,56320|sl&1023)}}return sr}function L(Le,it){return Le?D(H,Le,it):""}function C(Le,it,Dt,He){if(!(He>0))return 0;for(var h=Dt,sr=Dt+He-1,Ii=0;Ii<Le.length;++Ii){var ie=Le.charCodeAt(Ii);if(ie>=55296&&ie<=57343){var or=Le.charCodeAt(++Ii);ie=65536+((ie&1023)<<10)|or&1023}if(ie<=127){if(Dt>=sr)break;it[Dt++]=ie}else if(ie<=2047){if(Dt+1>=sr)break;it[Dt++]=192|ie>>6,it[Dt++]=128|ie&63}else if(ie<=65535){if(Dt+2>=sr)break;it[Dt++]=224|ie>>12,it[Dt++]=128|ie>>6&63,it[Dt++]=128|ie&63}else{if(Dt+3>=sr)break;it[Dt++]=240|ie>>18,it[Dt++]=128|ie>>12&63,it[Dt++]=128|ie>>6&63,it[Dt++]=128|ie&63}}return it[Dt]=0,Dt-h}function B(Le,it,Dt){return C(Le,H,it,Dt)}var k=typeof TextDecoder<"u"?new TextDecoder("utf-16le"):void 0;function z(Le,it){Y.set(Le,it)}function G(Le,it){return Le%it>0&&(Le+=it-Le%it),Le}var W,Y,H,$,J,te,ce,he,ve;function Re(Le){W=Le,e.HEAP8=Y=new Int8Array(Le),e.HEAP16=$=new Int16Array(Le),e.HEAP32=te=new Int32Array(Le),e.HEAPU8=H=new Uint8Array(Le),e.HEAPU16=J=new Uint16Array(Le),e.HEAPU32=ce=new Uint32Array(Le),e.HEAPF32=he=new Float32Array(Le),e.HEAPF64=ve=new Float64Array(Le)}var Qe=5271296,Fe=28384,mt=e.TOTAL_MEMORY||33554432;e.buffer?W=e.buffer:W=new ArrayBuffer(mt),mt=W.byteLength,Re(W),te[Fe>>2]=Qe;function Ee(Le){for(;Le.length>0;){var it=Le.shift();if(typeof it=="function"){it();continue}var Dt=it.func;typeof Dt=="number"?it.arg===void 0?e.dynCall_v(Dt):e.dynCall_vi(Dt,it.arg):Dt(it.arg===void 0?null:it.arg)}}var Ve=[],Ye=[],Mt=[],Et=[];function It(){if(e.preRun)for(typeof e.preRun=="function"&&(e.preRun=[e.preRun]);e.preRun.length;)ot(e.preRun.shift());Ee(Ve)}function dn(){Ee(Ye)}function Gt(){Ee(Mt)}function $e(){if(e.postRun)for(typeof e.postRun=="function"&&(e.postRun=[e.postRun]);e.postRun.length;)nt(e.postRun.shift());Ee(Et)}function ot(Le){Ve.unshift(Le)}function nt(Le){Et.unshift(Le)}var bt=Math.abs,yt=Math.ceil,hn=Math.floor,tn=Math.min,nn=0,bn=null,_e=null;function vi(Le){nn++,e.monitorRunDependencies&&e.monitorRunDependencies(nn)}function zn(Le){if(nn--,e.monitorRunDependencies&&e.monitorRunDependencies(nn),nn==0&&(bn!==null&&(clearInterval(bn),bn=null),_e)){var it=_e;_e=null,it()}}e.preloadedImages={},e.preloadedAudios={};var le=null,Z="data:application/octet-stream;base64,";function Te(Le){return String.prototype.startsWith?Le.startsWith(Z):Le.indexOf(Z)===0}var Pe,Ge;le="data:application/octet-stream;base64,AAAAAAAAAAAAAAAAAQAAAAIAAAADAAAABAAAAAUAAAAGAAAAAQAAAAQAAAADAAAABgAAAAUAAAACAAAAAAAAAAIAAAADAAAAAQAAAAQAAAAGAAAAAAAAAAUAAAADAAAABgAAAAQAAAAFAAAAAAAAAAEAAAACAAAABAAAAAUAAAAGAAAAAAAAAAIAAAADAAAAAQAAAAUAAAACAAAAAAAAAAEAAAADAAAABgAAAAQAAAAGAAAAAAAAAAUAAAACAAAAAQAAAAQAAAADAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAEAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAIAAAADAAAAAAAAAAAAAAACAAAAAAAAAAEAAAADAAAAAwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAABAAAAAYAAAAAAAAABQAAAAAAAAAAAAAABAAAAAUAAAAAAAAAAAAAAAAAAAACAAAAAAAAAAYAAAAAAAAABgAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAgAAAAMAAAAEAAAABQAAAAYAAAABAAAAAgAAAAMAAAAEAAAABQAAAAYAAAAAAAAAAgAAAAMAAAAEAAAABQAAAAYAAAAAAAAAAQAAAAMAAAAEAAAABQAAAAYAAAAAAAAAAQAAAAIAAAAEAAAABQAAAAYAAAAAAAAAAQAAAAIAAAADAAAABQAAAAYAAAAAAAAAAQAAAAIAAAADAAAABAAAAAYAAAAAAAAAAQAAAAIAAAADAAAABAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAwAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAgAAAAIAAAAAAAAAAAAAAAYAAAAAAAAAAwAAAAIAAAADAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAFAAAABAAAAAAAAAABAAAAAAAAAAAAAAAFAAAABQAAAAAAAAAAAAAAAAAAAAYAAAAAAAAABAAAAAAAAAAGAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAFAAAAAgAAAAQAAAADAAAACAAAAAEAAAAHAAAABgAAAAkAAAAAAAAAAwAAAAIAAAACAAAABgAAAAoAAAALAAAAAAAAAAEAAAAFAAAAAwAAAA0AAAABAAAABwAAAAQAAAAMAAAAAAAAAAQAAAB/AAAADwAAAAgAAAADAAAAAAAAAAwAAAAFAAAAAgAAABIAAAAKAAAACAAAAAAAAAAQAAAABgAAAA4AAAALAAAAEQAAAAEAAAAJAAAAAgAAAAcAAAAVAAAACQAAABMAAAADAAAADQAAAAEAAAAIAAAABQAAABYAAAAQAAAABAAAAAAAAAAPAAAACQAAABMAAAAOAAAAFAAAAAEAAAAHAAAABgAAAAoAAAALAAAAGAAAABcAAAAFAAAAAgAAABIAAAALAAAAEQAAABcAAAAZAAAAAgAAAAYAAAAKAAAADAAAABwAAAANAAAAGgAAAAQAAAAPAAAAAwAAAA0AAAAaAAAAFQAAAB0AAAADAAAADAAAAAcAAAAOAAAAfwAAABEAAAAbAAAACQAAABQAAAAGAAAADwAAABYAAAAcAAAAHwAAAAQAAAAIAAAADAAAABAAAAASAAAAIQAAAB4AAAAIAAAABQAAABYAAAARAAAACwAAAA4AAAAGAAAAIwAAABkAAAAbAAAAEgAAABgAAAAeAAAAIAAAAAUAAAAKAAAAEAAAABMAAAAiAAAAFAAAACQAAAAHAAAAFQAAAAkAAAAUAAAADgAAABMAAAAJAAAAKAAAABsAAAAkAAAAFQAAACYAAAATAAAAIgAAAA0AAAAdAAAABwAAABYAAAAQAAAAKQAAACEAAAAPAAAACAAAAB8AAAAXAAAAGAAAAAsAAAAKAAAAJwAAACUAAAAZAAAAGAAAAH8AAAAgAAAAJQAAAAoAAAAXAAAAEgAAABkAAAAXAAAAEQAAAAsAAAAtAAAAJwAAACMAAAAaAAAAKgAAAB0AAAArAAAADAAAABwAAAANAAAAGwAAACgAAAAjAAAALgAAAA4AAAAUAAAAEQAAABwAAAAfAAAAKgAAACwAAAAMAAAADwAAABoAAAAdAAAAKwAAACYAAAAvAAAADQAAABoAAAAVAAAAHgAAACAAAAAwAAAAMgAAABAAAAASAAAAIQAAAB8AAAApAAAALAAAADUAAAAPAAAAFgAAABwAAAAgAAAAHgAAABgAAAASAAAANAAAADIAAAAlAAAAIQAAAB4AAAAxAAAAMAAAABYAAAAQAAAAKQAAACIAAAATAAAAJgAAABUAAAA2AAAAJAAAADMAAAAjAAAALgAAAC0AAAA4AAAAEQAAABsAAAAZAAAAJAAAABQAAAAiAAAAEwAAADcAAAAoAAAANgAAACUAAAAnAAAANAAAADkAAAAYAAAAFwAAACAAAAAmAAAAfwAAACIAAAAzAAAAHQAAAC8AAAAVAAAAJwAAACUAAAAZAAAAFwAAADsAAAA5AAAALQAAACgAAAAbAAAAJAAAABQAAAA8AAAALgAAADcAAAApAAAAMQAAADUAAAA9AAAAFgAAACEAAAAfAAAAKgAAADoAAAArAAAAPgAAABwAAAAsAAAAGgAAACsAAAA+AAAALwAAAEAAAAAaAAAAKgAAAB0AAAAsAAAANQAAADoAAABBAAAAHAAAAB8AAAAqAAAALQAAACcAAAAjAAAAGQAAAD8AAAA7AAAAOAAAAC4AAAA8AAAAOAAAAEQAAAAbAAAAKAAAACMAAAAvAAAAJgAAACsAAAAdAAAARQAAADMAAABAAAAAMAAAADEAAAAeAAAAIQAAAEMAAABCAAAAMgAAADEAAAB/AAAAPQAAAEIAAAAhAAAAMAAAACkAAAAyAAAAMAAAACAAAAAeAAAARgAAAEMAAAA0AAAAMwAAAEUAAAA2AAAARwAAACYAAAAvAAAAIgAAADQAAAA5AAAARgAAAEoAAAAgAAAAJQAAADIAAAA1AAAAPQAAAEEAAABLAAAAHwAAACkAAAAsAAAANgAAAEcAAAA3AAAASQAAACIAAAAzAAAAJAAAADcAAAAoAAAANgAAACQAAABIAAAAPAAAAEkAAAA4AAAARAAAAD8AAABNAAAAIwAAAC4AAAAtAAAAOQAAADsAAABKAAAATgAAACUAAAAnAAAANAAAADoAAAB/AAAAPgAAAEwAAAAsAAAAQQAAACoAAAA7AAAAPwAAAE4AAABPAAAAJwAAAC0AAAA5AAAAPAAAAEgAAABEAAAAUAAAACgAAAA3AAAALgAAAD0AAAA1AAAAMQAAACkAAABRAAAASwAAAEIAAAA+AAAAKwAAADoAAAAqAAAAUgAAAEAAAABMAAAAPwAAAH8AAAA4AAAALQAAAE8AAAA7AAAATQAAAEAAAAAvAAAAPgAAACsAAABUAAAARQAAAFIAAABBAAAAOgAAADUAAAAsAAAAVgAAAEwAAABLAAAAQgAAAEMAAABRAAAAVQAAADEAAAAwAAAAPQAAAEMAAABCAAAAMgAAADAAAABXAAAAVQAAAEYAAABEAAAAOAAAADwAAAAuAAAAWgAAAE0AAABQAAAARQAAADMAAABAAAAALwAAAFkAAABHAAAAVAAAAEYAAABDAAAANAAAADIAAABTAAAAVwAAAEoAAABHAAAAWQAAAEkAAABbAAAAMwAAAEUAAAA2AAAASAAAAH8AAABJAAAANwAAAFAAAAA8AAAAWAAAAEkAAABbAAAASAAAAFgAAAA2AAAARwAAADcAAABKAAAATgAAAFMAAABcAAAANAAAADkAAABGAAAASwAAAEEAAAA9AAAANQAAAF4AAABWAAAAUQAAAEwAAABWAAAAUgAAAGAAAAA6AAAAQQAAAD4AAABNAAAAPwAAAEQAAAA4AAAAXQAAAE8AAABaAAAATgAAAEoAAAA7AAAAOQAAAF8AAABcAAAATwAAAE8AAABOAAAAPwAAADsAAABdAAAAXwAAAE0AAABQAAAARAAAAEgAAAA8AAAAYwAAAFoAAABYAAAAUQAAAFUAAABeAAAAZQAAAD0AAABCAAAASwAAAFIAAABgAAAAVAAAAGIAAAA+AAAATAAAAEAAAABTAAAAfwAAAEoAAABGAAAAZAAAAFcAAABcAAAAVAAAAEUAAABSAAAAQAAAAGEAAABZAAAAYgAAAFUAAABXAAAAZQAAAGYAAABCAAAAQwAAAFEAAABWAAAATAAAAEsAAABBAAAAaAAAAGAAAABeAAAAVwAAAFMAAABmAAAAZAAAAEMAAABGAAAAVQAAAFgAAABIAAAAWwAAAEkAAABjAAAAUAAAAGkAAABZAAAAYQAAAFsAAABnAAAARQAAAFQAAABHAAAAWgAAAE0AAABQAAAARAAAAGoAAABdAAAAYwAAAFsAAABJAAAAWQAAAEcAAABpAAAAWAAAAGcAAABcAAAAUwAAAE4AAABKAAAAbAAAAGQAAABfAAAAXQAAAE8AAABaAAAATQAAAG0AAABfAAAAagAAAF4AAABWAAAAUQAAAEsAAABrAAAAaAAAAGUAAABfAAAAXAAAAE8AAABOAAAAbQAAAGwAAABdAAAAYAAAAGgAAABiAAAAbgAAAEwAAABWAAAAUgAAAGEAAAB/AAAAYgAAAFQAAABnAAAAWQAAAG8AAABiAAAAbgAAAGEAAABvAAAAUgAAAGAAAABUAAAAYwAAAFAAAABpAAAAWAAAAGoAAABaAAAAcQAAAGQAAABmAAAAUwAAAFcAAABsAAAAcgAAAFwAAABlAAAAZgAAAGsAAABwAAAAUQAAAFUAAABeAAAAZgAAAGUAAABXAAAAVQAAAHIAAABwAAAAZAAAAGcAAABbAAAAYQAAAFkAAAB0AAAAaQAAAG8AAABoAAAAawAAAG4AAABzAAAAVgAAAF4AAABgAAAAaQAAAFgAAABnAAAAWwAAAHEAAABjAAAAdAAAAGoAAABdAAAAYwAAAFoAAAB1AAAAbQAAAHEAAABrAAAAfwAAAGUAAABeAAAAcwAAAGgAAABwAAAAbAAAAGQAAABfAAAAXAAAAHYAAAByAAAAbQAAAG0AAABsAAAAXQAAAF8AAAB1AAAAdgAAAGoAAABuAAAAYgAAAGgAAABgAAAAdwAAAG8AAABzAAAAbwAAAGEAAABuAAAAYgAAAHQAAABnAAAAdwAAAHAAAABrAAAAZgAAAGUAAAB4AAAAcwAAAHIAAABxAAAAYwAAAHQAAABpAAAAdQAAAGoAAAB5AAAAcgAAAHAAAABkAAAAZgAAAHYAAAB4AAAAbAAAAHMAAABuAAAAawAAAGgAAAB4AAAAdwAAAHAAAAB0AAAAZwAAAHcAAABvAAAAcQAAAGkAAAB5AAAAdQAAAH8AAABtAAAAdgAAAHEAAAB5AAAAagAAAHYAAAB4AAAAbAAAAHIAAAB1AAAAeQAAAG0AAAB3AAAAbwAAAHMAAABuAAAAeQAAAHQAAAB4AAAAeAAAAHMAAAByAAAAcAAAAHkAAAB3AAAAdgAAAHkAAAB0AAAAeAAAAHcAAAB1AAAAcQAAAHYAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAABAAAABQAAAAEAAAAAAAAAAAAAAAEAAAAAAAAAAQAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAACAAAABQAAAAEAAAAAAAAA/////wEAAAAAAAAAAwAAAAQAAAACAAAAAAAAAAAAAAABAAAAAAAAAAEAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAMAAAAFAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAFAAAAAQAAAAAAAAAAAAAAAQAAAAMAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAEAAAADAAAAAAAAAAAAAAABAAAAAAAAAAMAAAADAAAAAwAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAADAAAABQAAAAEAAAAAAAAAAAAAAAEAAAAAAAAAAQAAAAAAAAABAAAAAAAAAP////8DAAAAAAAAAAUAAAACAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAEAAAABQAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAMAAAADAAAAAwAAAAMAAAAAAAAAAwAAAAAAAAAAAAAAAAAAAAMAAAAFAAAABQAAAAAAAAAAAAAAAwAAAAMAAAADAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAADAAAAAwAAAAAAAAADAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAFAAAABQAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAQAAAAAAAAABAAAAAAAAAAMAAAADAAAAAwAAAAAAAAADAAAAAAAAAAAAAAD/////AwAAAAAAAAAFAAAAAgAAAAAAAAAAAAAAAAAAAAAAAAADAAAAAAAAAAAAAAADAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAADAAAAAAAAAAAAAAAAAAAAAwAAAAMAAAAAAAAAAAAAAAEAAAAAAAAAAQAAAAAAAAABAAAAAAAAAAAAAAABAAAAAwAAAAAAAAAAAAAAAQAAAAAAAAADAAAAAwAAAAMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAMAAAADAAAAAwAAAAMAAAAAAAAAAwAAAAAAAAAAAAAAAQAAAAMAAAAAAAAAAAAAAAEAAAAAAAAAAwAAAAMAAAADAAAAAwAAAAAAAAADAAAAAAAAAAAAAAADAAAAAAAAAAMAAAAAAAAAAwAAAAAAAAAAAAAAAAAAAAMAAAAAAAAAAAAAAAMAAAAAAAAAAwAAAAAAAAAAAAAAAAAAAAMAAAADAAAAAAAAAP////8DAAAAAAAAAAUAAAACAAAAAAAAAAAAAAADAAAAAAAAAAAAAAADAAAAAwAAAAAAAAAAAAAAAwAAAAAAAAAAAAAAAwAAAAMAAAAAAAAAAAAAAAAAAAAAAAAAAwAAAAUAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAFAAAABQAAAAAAAAAAAAAAAwAAAAMAAAADAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAwAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAwAAAAAAAAAAAAAAAwAAAAMAAAAAAAAAAAAAAAAAAAADAAAAAAAAAAMAAAAAAAAAAAAAAAMAAAADAAAAAwAAAAAAAAADAAAAAAAAAAAAAAADAAAAAwAAAAMAAAAAAAAAAwAAAAAAAAAAAAAA/////wMAAAAAAAAABQAAAAIAAAAAAAAAAAAAAAAAAAAAAAAAAwAAAAAAAAAAAAAAAwAAAAAAAAADAAAAAAAAAAAAAAAAAAAAAwAAAAMAAAAAAAAAAAAAAAMAAAAAAAAAAwAAAAAAAAADAAAAAAAAAAMAAAADAAAAAwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAwAAAAAAAAADAAAAAAAAAAMAAAAAAAAAAAAAAAMAAAAAAAAAAAAAAAMAAAADAAAAAAAAAAMAAAADAAAAAwAAAAAAAAAAAAAAAwAAAAAAAAAAAAAAAAAAAAMAAAAAAAAAAwAAAAAAAAAAAAAA/////wMAAAAAAAAABQAAAAIAAAAAAAAAAAAAAAMAAAADAAAAAwAAAAMAAAADAAAAAAAAAAAAAAADAAAAAwAAAAMAAAADAAAAAwAAAAAAAAAAAAAAAwAAAAMAAAADAAAAAwAAAAAAAAADAAAAAAAAAAMAAAADAAAAAwAAAAMAAAAAAAAAAwAAAAAAAAD/////AwAAAAAAAAAFAAAAAgAAAAAAAAAAAAAAAAAAAAAAAAADAAAAAAAAAAAAAAADAAAAAAAAAAMAAAADAAAAAwAAAAAAAAADAAAAAAAAAAAAAAADAAAAAAAAAAAAAAAAAAAAAwAAAAMAAAAAAAAAAwAAAAAAAAAAAAAAAwAAAAMAAAAAAAAAAAAAAAMAAAADAAAAAwAAAAAAAAAAAAAAAAAAAAAAAAADAAAAAAAAAAAAAAADAAAAAwAAAAAAAAAAAAAAAAAAAAMAAAAAAAAAAAAAAAMAAAADAAAAAAAAAAAAAAAAAAAAAwAAAAAAAAADAAAAAAAAAAAAAAD/////AwAAAAAAAAAFAAAAAgAAAAAAAAAAAAAAAwAAAAMAAAADAAAAAAAAAAAAAAADAAAAAAAAAAMAAAADAAAAAwAAAAAAAAAAAAAAAwAAAAAAAAAAAAAAAAAAAAMAAAAAAAAAAAAAAAMAAAAAAAAAAwAAAAAAAAAAAAAAAAAAAAMAAAADAAAAAAAAAAAAAAAAAAAAAwAAAAAAAAAFAAAAAAAAAAAAAAADAAAAAwAAAAMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAADAAAAAQAAAAAAAAABAAAAAAAAAAAAAAABAAAAAwAAAAEAAAAAAAAAAQAAAAAAAAAAAAAAAwAAAAAAAAADAAAAAAAAAAMAAAAAAAAAAAAAAAMAAAAAAAAAAwAAAAAAAAADAAAAAAAAAP////8DAAAAAAAAAAUAAAACAAAAAAAAAAAAAAAAAAAAAwAAAAAAAAAAAAAAAwAAAAMAAAAAAAAAAAAAAAAAAAADAAAAAAAAAAMAAAAAAAAAAAAAAAMAAAAAAAAAAAAAAAMAAAADAAAAAAAAAAAAAAADAAAAAwAAAAMAAAADAAAAAwAAAAAAAAAAAAAAAAAAAAAAAAADAAAAAAAAAAUAAAAAAAAAAAAAAAMAAAADAAAAAwAAAAMAAAADAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAwAAAAMAAAADAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAwAAAAAAAAAFAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAFAAAABQAAAAAAAAAAAAAAAAAAAAMAAAAAAAAAAAAAAAMAAAADAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAMAAAAAAAAAAwAAAAAAAAAAAAAA/////wMAAAAAAAAABQAAAAIAAAAAAAAAAAAAAAMAAAADAAAAAwAAAAAAAAAAAAAAAwAAAAAAAAAFAAAAAAAAAAAAAAAFAAAABQAAAAAAAAAAAAAAAAAAAAEAAAADAAAAAQAAAAAAAAABAAAAAAAAAAMAAAADAAAAAwAAAAAAAAAAAAAAAwAAAAAAAAADAAAAAwAAAAMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAADAAAAAQAAAAAAAAABAAAAAAAAAAMAAAADAAAAAwAAAAMAAAADAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAEAAAAAAAAAAwAAAAUAAAABAAAAAAAAAP////8DAAAAAAAAAAUAAAACAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAFAAAABQAAAAAAAAAAAAAAAAAAAAEAAAAAAAAABAAAAAUAAAABAAAAAAAAAAMAAAADAAAAAwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAADAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAIAAAAFAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAEAAAADAAAAAQAAAAAAAAABAAAAAAAAAAUAAAAAAAAAAAAAAAUAAAAFAAAAAAAAAAAAAAD/////AQAAAAAAAAADAAAABAAAAAIAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAUAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAFAAAAAAAAAAAAAAAFAAAABQAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAQAAAAUAAAABAAAAAAAAAAAAAAABAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAgAAAAEAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAIAAAAAAAAAAAAAAAEAAAD//////////wEAAAABAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAQAAAAEAAAAAAAAAAAAAAAAAAAADAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAwAAAAEAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAsAAAACAAAAAAAAAAAAAAABAAAAAgAAAAYAAAAEAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAYAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAgAAAAAAAAABAAAAAQAAAAAAAAAAAAAAAAAAAAcAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAACAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAYAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAKAAAAAgAAAAAAAAAAAAAAAQAAAAEAAAAFAAAABgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAALAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAEAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAABAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAABwAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAsAAAABAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACgAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAwAAAACAAAAAAAAAAAAAAABAAAAAwAAAAcAAAAGAAAAAQAAAAAAAAABAAAAAAAAAAAAAAAAAAAABwAAAAEAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAADAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAwAAAAAAAAABAAAAAQAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAGAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAgAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAADgAAAAIAAAAAAAAAAAAAAAEAAAAAAAAACQAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACgAAAAEAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAQAAAAEAAAAAAAAAAAAAAAAAAAAMAAAAAQAAAAEAAAAAAAAAAAAAAAAAAAAAAAAABwAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAsAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAKAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADQAAAAIAAAAAAAAAAAAAAAEAAAAEAAAACAAAAAoAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAALAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAACQAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAgAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAGAAAAAgAAAAAAAAAAAAAAAQAAAAsAAAAPAAAACAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAkAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAOAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAEAAAAAAAAAAQAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAQAAAAEAAAAAAAAAAAAAAAAAAAAIAAAAAQAAAAAAAAABAAAAAAAAAAAAAAAAAAAABQAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAAAAgAAAAAAAAAAAAAAAQAAAAwAAAAQAAAADAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAoAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAJAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADQAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAPAAAAAAAAAAEAAAABAAAAAAAAAAAAAAAAAAAADwAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAQAAAAEAAAAAAAAAAAAAAAAAAAAAAAAADQAAAAEAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAACAAAAAAAAAAAAAAABAAAACgAAABMAAAAIAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAkAAAABAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAEQAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAwAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEQAAAAAAAAABAAAAAQAAAAAAAAAAAAAAAAAAAA8AAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAQAAAAAQAAAAAAAAABAAAAAAAAAAAAAAAAAAAACQAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAANAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACAAAAAIAAAAAAAAAAAAAAAEAAAANAAAAEQAAAA0AAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAARAAAAAQAAAAAAAAABAAAAAAAAAAAAAAAAAAAAEwAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAA4AAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAATAAAAAAAAAAEAAAABAAAAAAAAAAAAAAAAAAAAEQAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAA0AAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAARAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAkAAAACAAAAAAAAAAAAAAABAAAADgAAABIAAAAPAAAAAQAAAAAAAAABAAAAAAAAAAAAAAAAAAAADwAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABIAAAAAAAAAAQAAAAEAAAAAAAAAAAAAAAAAAAASAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAEwAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAABEAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAATAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEgAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAABIAAAABAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAATAAAAAgAAAAAAAAAAAAAAAQAAAP//////////EwAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAATAAAAAQAAAAAAAAABAAAAAAAAAAAAAAAAAAAAEgAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAASAAAAAAAAABgAAAAAAAAAIQAAAAAAAAAeAAAAAAAAACAAAAADAAAAMQAAAAEAAAAwAAAAAwAAADIAAAADAAAACAAAAAAAAAAFAAAABQAAAAoAAAAFAAAAFgAAAAAAAAAQAAAAAAAAABIAAAAAAAAAKQAAAAEAAAAhAAAAAAAAAB4AAAAAAAAABAAAAAAAAAAAAAAABQAAAAIAAAAFAAAADwAAAAEAAAAIAAAAAAAAAAUAAAAFAAAAHwAAAAEAAAAWAAAAAAAAABAAAAAAAAAAAgAAAAAAAAAGAAAAAAAAAA4AAAAAAAAACgAAAAAAAAALAAAAAAAAABEAAAADAAAAGAAAAAEAAAAXAAAAAwAAABkAAAADAAAAAAAAAAAAAAABAAAABQAAAAkAAAAFAAAABQAAAAAAAAACAAAAAAAAAAYAAAAAAAAAEgAAAAEAAAAKAAAAAAAAAAsAAAAAAAAABAAAAAEAAAADAAAABQAAAAcAAAAFAAAACAAAAAEAAAAAAAAAAAAAAAEAAAAFAAAAEAAAAAEAAAAFAAAAAAAAAAIAAAAAAAAABwAAAAAAAAAVAAAAAAAAACYAAAAAAAAACQAAAAAAAAATAAAAAAAAACIAAAADAAAADgAAAAEAAAAUAAAAAwAAACQAAAADAAAAAwAAAAAAAAANAAAABQAAAB0AAAAFAAAAAQAAAAAAAAAHAAAAAAAAABUAAAAAAAAABgAAAAEAAAAJAAAAAAAAABMAAAAAAAAABAAAAAIAAAAMAAAABQAAABoAAAAFAAAAAAAAAAEAAAADAAAAAAAAAA0AAAAFAAAAAgAAAAEAAAABAAAAAAAAAAcAAAAAAAAAGgAAAAAAAAAqAAAAAAAAADoAAAAAAAAAHQAAAAAAAAArAAAAAAAAAD4AAAADAAAAJgAAAAEAAAAvAAAAAwAAAEAAAAADAAAADAAAAAAAAAAcAAAABQAAACwAAAAFAAAADQAAAAAAAAAaAAAAAAAAACoAAAAAAAAAFQAAAAEAAAAdAAAAAAAAACsAAAAAAAAABAAAAAMAAAAPAAAABQAAAB8AAAAFAAAAAwAAAAEAAAAMAAAAAAAAABwAAAAFAAAABwAAAAEAAAANAAAAAAAAABoAAAAAAAAAHwAAAAAAAAApAAAAAAAAADEAAAAAAAAALAAAAAAAAAA1AAAAAAAAAD0AAAADAAAAOgAAAAEAAABBAAAAAwAAAEsAAAADAAAADwAAAAAAAAAWAAAABQAAACEAAAAFAAAAHAAAAAAAAAAfAAAAAAAAACkAAAAAAAAAKgAAAAEAAAAsAAAAAAAAADUAAAAAAAAABAAAAAQAAAAIAAAABQAAABAAAAAFAAAADAAAAAEAAAAPAAAAAAAAABYAAAAFAAAAGgAAAAEAAAAcAAAAAAAAAB8AAAAAAAAAMgAAAAAAAAAwAAAAAAAAADEAAAADAAAAIAAAAAAAAAAeAAAAAwAAACEAAAADAAAAGAAAAAMAAAASAAAAAwAAABAAAAADAAAARgAAAAAAAABDAAAAAAAAAEIAAAADAAAANAAAAAMAAAAyAAAAAAAAADAAAAAAAAAAJQAAAAMAAAAgAAAAAAAAAB4AAAADAAAAUwAAAAAAAABXAAAAAwAAAFUAAAADAAAASgAAAAMAAABGAAAAAAAAAEMAAAAAAAAAOQAAAAEAAAA0AAAAAwAAADIAAAAAAAAAGQAAAAAAAAAXAAAAAAAAABgAAAADAAAAEQAAAAAAAAALAAAAAwAAAAoAAAADAAAADgAAAAMAAAAGAAAAAwAAAAIAAAADAAAALQAAAAAAAAAnAAAAAAAAACUAAAADAAAAIwAAAAMAAAAZAAAAAAAAABcAAAAAAAAAGwAAAAMAAAARAAAAAAAAAAsAAAADAAAAPwAAAAAAAAA7AAAAAwAAADkAAAADAAAAOAAAAAMAAAAtAAAAAAAAACcAAAAAAAAALgAAAAMAAAAjAAAAAwAAABkAAAAAAAAAJAAAAAAAAAAUAAAAAAAAAA4AAAADAAAAIgAAAAAAAAATAAAAAwAAAAkAAAADAAAAJgAAAAMAAAAVAAAAAwAAAAcAAAADAAAANwAAAAAAAAAoAAAAAAAAABsAAAADAAAANgAAAAMAAAAkAAAAAAAAABQAAAAAAAAAMwAAAAMAAAAiAAAAAAAAABMAAAADAAAASAAAAAAAAAA8AAAAAwAAAC4AAAADAAAASQAAAAMAAAA3AAAAAAAAACgAAAAAAAAARwAAAAMAAAA2AAAAAwAAACQAAAAAAAAAQAAAAAAAAAAvAAAAAAAAACYAAAADAAAAPgAAAAAAAAArAAAAAwAAAB0AAAADAAAAOgAAAAMAAAAqAAAAAwAAABoAAAADAAAAVAAAAAAAAABFAAAAAAAAADMAAAADAAAAUgAAAAMAAABAAAAAAAAAAC8AAAAAAAAATAAAAAMAAAA+AAAAAAAAACsAAAADAAAAYQAAAAAAAABZAAAAAwAAAEcAAAADAAAAYgAAAAMAAABUAAAAAAAAAEUAAAAAAAAAYAAAAAMAAABSAAAAAwAAAEAAAAAAAAAASwAAAAAAAABBAAAAAAAAADoAAAADAAAAPQAAAAAAAAA1AAAAAwAAACwAAAADAAAAMQAAAAMAAAApAAAAAwAAAB8AAAADAAAAXgAAAAAAAABWAAAAAAAAAEwAAAADAAAAUQAAAAMAAABLAAAAAAAAAEEAAAAAAAAAQgAAAAMAAAA9AAAAAAAAADUAAAADAAAAawAAAAAAAABoAAAAAwAAAGAAAAADAAAAZQAAAAMAAABeAAAAAAAAAFYAAAAAAAAAVQAAAAMAAABRAAAAAwAAAEsAAAAAAAAAOQAAAAAAAAA7AAAAAAAAAD8AAAADAAAASgAAAAAAAABOAAAAAwAAAE8AAAADAAAAUwAAAAMAAABcAAAAAwAAAF8AAAADAAAAJQAAAAAAAAAnAAAAAwAAAC0AAAADAAAANAAAAAAAAAA5AAAAAAAAADsAAAAAAAAARgAAAAMAAABKAAAAAAAAAE4AAAADAAAAGAAAAAAAAAAXAAAAAwAAABkAAAADAAAAIAAAAAMAAAAlAAAAAAAAACcAAAADAAAAMgAAAAMAAAA0AAAAAAAAADkAAAAAAAAALgAAAAAAAAA8AAAAAAAAAEgAAAADAAAAOAAAAAAAAABEAAAAAwAAAFAAAAADAAAAPwAAAAMAAABNAAAAAwAAAFoAAAADAAAAGwAAAAAAAAAoAAAAAwAAADcAAAADAAAAIwAAAAAAAAAuAAAAAAAAADwAAAAAAAAALQAAAAMAAAA4AAAAAAAAAEQAAAADAAAADgAAAAAAAAAUAAAAAwAAACQAAAADAAAAEQAAAAMAAAAbAAAAAAAAACgAAAADAAAAGQAAAAMAAAAjAAAAAAAAAC4AAAAAAAAARwAAAAAAAABZAAAAAAAAAGEAAAADAAAASQAAAAAAAABbAAAAAwAAAGcAAAADAAAASAAAAAMAAABYAAAAAwAAAGkAAAADAAAAMwAAAAAAAABFAAAAAwAAAFQAAAADAAAANgAAAAAAAABHAAAAAAAAAFkAAAAAAAAANwAAAAMAAABJAAAAAAAAAFsAAAADAAAAJgAAAAAAAAAvAAAAAwAAAEAAAAADAAAAIgAAAAMAAAAzAAAAAAAAAEUAAAADAAAAJAAAAAMAAAA2AAAAAAAAAEcAAAAAAAAAYAAAAAAAAABoAAAAAAAAAGsAAAADAAAAYgAAAAAAAABuAAAAAwAAAHMAAAADAAAAYQAAAAMAAABvAAAAAwAAAHcAAAADAAAATAAAAAAAAABWAAAAAwAAAF4AAAADAAAAUgAAAAAAAABgAAAAAAAAAGgAAAAAAAAAVAAAAAMAAABiAAAAAAAAAG4AAAADAAAAOgAAAAAAAABBAAAAAwAAAEsAAAADAAAAPgAAAAMAAABMAAAAAAAAAFYAAAADAAAAQAAAAAMAAABSAAAAAAAAAGAAAAAAAAAAVQAAAAAAAABXAAAAAAAAAFMAAAADAAAAZQAAAAAAAABmAAAAAwAAAGQAAAADAAAAawAAAAMAAABwAAAAAwAAAHIAAAADAAAAQgAAAAAAAABDAAAAAwAAAEYAAAADAAAAUQAAAAAAAABVAAAAAAAAAFcAAAAAAAAAXgAAAAMAAABlAAAAAAAAAGYAAAADAAAAMQAAAAAAAAAwAAAAAwAAADIAAAADAAAAPQAAAAMAAABCAAAAAAAAAEMAAAADAAAASwAAAAMAAABRAAAAAAAAAFUAAAAAAAAAXwAAAAAAAABcAAAAAAAAAFMAAAAAAAAATwAAAAAAAABOAAAAAAAAAEoAAAADAAAAPwAAAAEAAAA7AAAAAwAAADkAAAADAAAAbQAAAAAAAABsAAAAAAAAAGQAAAAFAAAAXQAAAAEAAABfAAAAAAAAAFwAAAAAAAAATQAAAAEAAABPAAAAAAAAAE4AAAAAAAAAdQAAAAQAAAB2AAAABQAAAHIAAAAFAAAAagAAAAEAAABtAAAAAAAAAGwAAAAAAAAAWgAAAAEAAABdAAAAAQAAAF8AAAAAAAAAWgAAAAAAAABNAAAAAAAAAD8AAAAAAAAAUAAAAAAAAABEAAAAAAAAADgAAAADAAAASAAAAAEAAAA8AAAAAwAAAC4AAAADAAAAagAAAAAAAABdAAAAAAAAAE8AAAAFAAAAYwAAAAEAAABaAAAAAAAAAE0AAAAAAAAAWAAAAAEAAABQAAAAAAAAAEQAAAAAAAAAdQAAAAMAAABtAAAABQAAAF8AAAAFAAAAcQAAAAEAAABqAAAAAAAAAF0AAAAAAAAAaQAAAAEAAABjAAAAAQAAAFoAAAAAAAAAaQAAAAAAAABYAAAAAAAAAEgAAAAAAAAAZwAAAAAAAABbAAAAAAAAAEkAAAADAAAAYQAAAAEAAABZAAAAAwAAAEcAAAADAAAAcQAAAAAAAABjAAAAAAAAAFAAAAAFAAAAdAAAAAEAAABpAAAAAAAAAFgAAAAAAAAAbwAAAAEAAABnAAAAAAAAAFsAAAAAAAAAdQAAAAIAAABqAAAABQAAAFoAAAAFAAAAeQAAAAEAAABxAAAAAAAAAGMAAAAAAAAAdwAAAAEAAAB0AAAAAQAAAGkAAAAAAAAAdwAAAAAAAABvAAAAAAAAAGEAAAAAAAAAcwAAAAAAAABuAAAAAAAAAGIAAAADAAAAawAAAAEAAABoAAAAAwAAAGAAAAADAAAAeQAAAAAAAAB0AAAAAAAAAGcAAAAFAAAAeAAAAAEAAAB3AAAAAAAAAG8AAAAAAAAAcAAAAAEAAABzAAAAAAAAAG4AAAAAAAAAdQAAAAEAAABxAAAABQAAAGkAAAAFAAAAdgAAAAEAAAB5AAAAAAAAAHQAAAAAAAAAcgAAAAEAAAB4AAAAAQAAAHcAAAAAAAAAcgAAAAAAAABwAAAAAAAAAGsAAAAAAAAAZAAAAAAAAABmAAAAAAAAAGUAAAADAAAAUwAAAAEAAABXAAAAAwAAAFUAAAADAAAAdgAAAAAAAAB4AAAAAAAAAHMAAAAFAAAAbAAAAAEAAAByAAAAAAAAAHAAAAAAAAAAXAAAAAEAAABkAAAAAAAAAGYAAAAAAAAAdQAAAAAAAAB5AAAABQAAAHcAAAAFAAAAbQAAAAEAAAB2AAAAAAAAAHgAAAAAAAAAXwAAAAEAAABsAAAAAQAAAHIAAAAAAAAAGC1EVPsh+T8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABgtRFT7Ifk/GC1EVPsh+T8AAAAAAAAAAAAAAAAAAAAAGC1EVPsh+T8AAAAAAAAAABgtRFT7IQlAGC1EVPsh+T8AAAAAAAAAAAAAAAAAAAAAGC1EVPshCUAAAAAAAAAAABgtRFT7Ifm/GC1EVPsh+T8AAAAAAAAAAAAAAAAAAAAAGC1EVPsh+b8AAAAAAAAAAAAAAAAAAAAAGC1EVPsh+b8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABgtRFT7Ifm/GC1EVPsh+b8AAAAAAAAAAAAAAAAAAAAAGC1EVPsh+b8AAAAAAAAAABgtRFT7IQnAGC1EVPsh+b8AAAAAAAAAAAAAAAAAAAAAGC1EVPshCcAAAAAAAAAAABgtRFT7Ifk/GC1EVPsh+b8AAAAAAAAAAAAAAAAAAAAAGC1EVPsh+T8AAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAGAAAAAgAAAAUAAAABAAAABAAAAAAAAAAAAAAABQAAAAMAAAABAAAABgAAAAQAAAACAAAAAAAAAMpi5RexJsw/BlIKPVwR5T95Wyu0/QjnP5PjoT7YYcu/mBhKZ6zrwj8wRYS7NebuP3qW6geh+Ls/SLrixebL3r+pcyymN9XrPwmkNHp7xec/GWNMZVAA17+82s+x2BLiPwn2ytbJ9ek/LgEH1sMS1j8yp/2LhTfeP+SnWwtQBbu/d38gkp5X7z8ytsuHaADGPzUYObdf1+m/7IauECWhwz+cjSACjzniP76Z+wUhN9K/1+GEKzup67+/GYr/04baPw6idWOvsuc/ZedTWsRa5b/EJQOuRzi0v/OncYhHPes/h49PixY53j+i8wWfC03Nvw2idWOvsue/ZedTWsRa5T/EJQOuRzi0P/KncYhHPeu/iY9PixY53r+i8wWfC03NP9anWwtQBbs/d38gkp5X778ytsuHaADGvzUYObdf1+k/74auECWhw7+cjSACjzniv8CZ+wUhN9I/1uGEKzup6z+/GYr/04bavwmkNHp7xee/F2NMZVAA1z+82s+x2BLivwr2ytbJ9em/KwEH1sMS1r8yp/2LhTfev81i5RexJsy/BlIKPVwR5b95Wyu0/Qjnv5DjoT7YYcs/nBhKZ6zrwr8wRYS7Nebuv3OW6geh+Lu/SLrixebL3j+pcyymN9Xrv8rHIFfWehZAMBwUdlo0DECTUc17EOb2PxpVB1SWChdAzjbhb9pTDUDQhmdvECX5P9FlMKCC9+g/IIAzjELgE0DajDngMv8GQFhWDmDPjNs/y1guLh96EkAxPi8k7DIEQJCc4URlhRhA3eLKKLwkEECqpNAyTBD/P6xpjXcDiwVAFtl//cQm4z+Ibt3XKiYTQM7mCLUb3QdAoM1t8yVv7D8aLZv2Nk8UQEAJPV5nQwxAtSsfTCoE9z9TPjXLXIIWQBVanC5W9AtAYM3d7Adm9j++5mQz1FoWQBUThyaVBghAwH5muQsV7T89Q1qv82MUQJoWGOfNuBdAzrkClkmwDkDQjKq77t37Py+g0dtitsE/ZwAMTwVPEUBojepluNwBQGYbtuW+t9w/HNWIJs6MEkDTNuQUSlgEQKxktPP5TcQ/ixbLB8JjEUCwuWjXMQYCQAS/R09FkRdAowpiZjhhDkB7LmlczD/7P01iQmhhsAVAnrtTwDy84z/Z6jfQ2TgTQChOCXMnWwpAhrW3daoz8z/HYJvVPI4VQLT3ik5FcA5Angi7LOZd+z+NNVzDy5gXQBXdvVTFUA1AYNMgOeYe+T8+qHXGCwkXQKQTOKwa5AJA8gFVoEMW0T+FwzJyttIRQAEAAAD/////BwAAAP////8xAAAA/////1cBAAD/////YQkAAP////+nQQAA/////5HLAQD/////95AMAP/////B9lcAAAAAAAAAAAAAAAAAAgAAAP////8OAAAA/////2IAAAD/////rgIAAP/////CEgAA/////06DAAD/////IpcDAP/////uIRkA/////4LtrwAAAAAAAAAAAAAAAAAAAAAAAgAAAP//////////AQAAAAMAAAD//////////////////////////////////////////////////////////////////////////wEAAAAAAAAAAgAAAP///////////////wMAAAD//////////////////////////////////////////////////////////////////////////wEAAAAAAAAAAgAAAP///////////////wMAAAD//////////////////////////////////////////////////////////////////////////wEAAAAAAAAAAgAAAP///////////////wMAAAD//////////////////////////////////////////////////////////wIAAAD//////////wEAAAAAAAAA/////////////////////wMAAAD/////////////////////////////////////////////////////AwAAAP////////////////////8AAAAA/////////////////////wEAAAD///////////////8CAAAA////////////////////////////////AwAAAP////////////////////8AAAAA////////////////AgAAAAEAAAD/////////////////////////////////////////////////////AwAAAP////////////////////8AAAAA////////////////AgAAAAEAAAD/////////////////////////////////////////////////////AwAAAP////////////////////8AAAAA////////////////AgAAAAEAAAD/////////////////////////////////////////////////////AwAAAP////////////////////8AAAAA////////////////AgAAAAEAAAD/////////////////////////////////////////////////////AQAAAAIAAAD///////////////8AAAAA/////////////////////wMAAAD/////////////////////////////////////////////////////AQAAAAIAAAD///////////////8AAAAA/////////////////////wMAAAD/////////////////////////////////////////////////////AQAAAAIAAAD///////////////8AAAAA/////////////////////wMAAAD/////////////////////////////////////////////////////AQAAAAIAAAD///////////////8AAAAA/////////////////////wMAAAD///////////////////////////////8CAAAA////////////////AQAAAP////////////////////8AAAAA/////////////////////wMAAAD/////////////////////////////////////////////////////AwAAAP////////////////////8AAAAAAQAAAP//////////AgAAAP//////////////////////////////////////////////////////////AwAAAP///////////////wIAAAAAAAAAAQAAAP//////////////////////////////////////////////////////////////////////////AwAAAP///////////////wIAAAAAAAAAAQAAAP//////////////////////////////////////////////////////////////////////////AwAAAP///////////////wIAAAAAAAAAAQAAAP//////////////////////////////////////////////////////////////////////////AwAAAAEAAAD//////////wIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAgAAAAAAAAACAAAAAQAAAAEAAAACAAAAAgAAAAAAAAAFAAAABQAAAAAAAAACAAAAAgAAAAMAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACAAAAAAAAAAIAAAABAAAAAgAAAAIAAAACAAAAAAAAAAUAAAAGAAAAAAAAAAIAAAACAAAAAwAAAAIAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAIAAAAAAAAAAgAAAAEAAAADAAAAAgAAAAIAAAAAAAAABQAAAAcAAAAAAAAAAgAAAAIAAAADAAAAAwAAAAAAAAAAAAAAAAAAAAAAAAACAAAAAgAAAAAAAAACAAAAAQAAAAQAAAACAAAAAgAAAAAAAAAFAAAACAAAAAAAAAACAAAAAgAAAAMAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAACAAAAAAAAAAIAAAABAAAAAAAAAAIAAAACAAAAAAAAAAUAAAAJAAAAAAAAAAIAAAACAAAAAwAAAAUAAAAAAAAAAAAAAAAAAAAAAAAACgAAAAIAAAACAAAAAAAAAAMAAAAOAAAAAgAAAAAAAAACAAAAAwAAAAAAAAAAAAAAAgAAAAIAAAADAAAABgAAAAAAAAAAAAAAAAAAAAAAAAALAAAAAgAAAAIAAAAAAAAAAwAAAAoAAAACAAAAAAAAAAIAAAADAAAAAQAAAAAAAAACAAAAAgAAAAMAAAAHAAAAAAAAAAAAAAAAAAAAAAAAAAwAAAACAAAAAgAAAAAAAAADAAAACwAAAAIAAAAAAAAAAgAAAAMAAAACAAAAAAAAAAIAAAACAAAAAwAAAAgAAAAAAAAAAAAAAAAAAAAAAAAADQAAAAIAAAACAAAAAAAAAAMAAAAMAAAAAgAAAAAAAAACAAAAAwAAAAMAAAAAAAAAAgAAAAIAAAADAAAACQAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAgAAAAIAAAAAAAAAAwAAAA0AAAACAAAAAAAAAAIAAAADAAAABAAAAAAAAAACAAAAAgAAAAMAAAAKAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAACAAAAAgAAAAAAAAADAAAABgAAAAIAAAAAAAAAAgAAAAMAAAAPAAAAAAAAAAIAAAACAAAAAwAAAAsAAAAAAAAAAAAAAAAAAAAAAAAABgAAAAIAAAACAAAAAAAAAAMAAAAHAAAAAgAAAAAAAAACAAAAAwAAABAAAAAAAAAAAgAAAAIAAAADAAAADAAAAAAAAAAAAAAAAAAAAAAAAAAHAAAAAgAAAAIAAAAAAAAAAwAAAAgAAAACAAAAAAAAAAIAAAADAAAAEQAAAAAAAAACAAAAAgAAAAMAAAANAAAAAAAAAAAAAAAAAAAAAAAAAAgAAAACAAAAAgAAAAAAAAADAAAACQAAAAIAAAAAAAAAAgAAAAMAAAASAAAAAAAAAAIAAAACAAAAAwAAAA4AAAAAAAAAAAAAAAAAAAAAAAAACQAAAAIAAAACAAAAAAAAAAMAAAAFAAAAAgAAAAAAAAACAAAAAwAAABMAAAAAAAAAAgAAAAIAAAADAAAADwAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAgAAAAAAAAACAAAAAQAAABMAAAACAAAAAgAAAAAAAAAFAAAACgAAAAAAAAACAAAAAgAAAAMAAAAQAAAAAAAAAAAAAAAAAAAAAAAAABEAAAACAAAAAAAAAAIAAAABAAAADwAAAAIAAAACAAAAAAAAAAUAAAALAAAAAAAAAAIAAAACAAAAAwAAABEAAAAAAAAAAAAAAAAAAAAAAAAAEgAAAAIAAAAAAAAAAgAAAAEAAAAQAAAAAgAAAAIAAAAAAAAABQAAAAwAAAAAAAAAAgAAAAIAAAADAAAAEgAAAAAAAAAAAAAAAAAAAAAAAAATAAAAAgAAAAAAAAACAAAAAQAAABEAAAACAAAAAgAAAAAAAAAFAAAADQAAAAAAAAACAAAAAgAAAAMAAAATAAAAAAAAAAAAAAAAAAAAAAAAAA8AAAACAAAAAAAAAAIAAAABAAAAEgAAAAIAAAACAAAAAAAAAAUAAAAOAAAAAAAAAAIAAAACAAAAAwAAAAIAAAABAAAAAAAAAAEAAAACAAAAAAAAAAAAAAACAAAAAQAAAAAAAAABAAAAAgAAAAEAAAAAAAAAAgAAAAAAAAAFAAAABAAAAAAAAAABAAAABQAAAAAAAAAAAAAABQAAAAQAAAAAAAAAAQAAAAUAAAAEAAAAAAAAAAUAAAAAAAAAAgAAAAEAAAAAAAAAAQAAAAIAAAAAAAAAAAAAAAIAAAABAAAAAAAAAAEAAAACAAAAAQAAAAAAAAACAAAAAgAAAAAAAAABAAAAAAAAAAAAAAAFAAAABAAAAAAAAAABAAAABQAAAAAAAAAAAAAABQAAAAQAAAAAAAAAAQAAAAUAAAAEAAAAAAAAAAUAAAAFAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAQAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAABAAAAAAAAAAABAAAAAAEAAAAAAAAAAAEAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAQAAAAAAAAAAAAEAAAAAAAAAAAAAOgehWlKfUEEz1zLi+JsiQa2og3wcMfVAWCbHorc0yEDi+Yn/Y6mbQJ11/mfsnG9At6bnG4UQQkBvMCQWKqUUQJVmwwswmOc/3hVgVBL3uj//qqOEOdGOPw/WDN4gnGE/H3ANkCUgND+AA8btKgAHPwTXBqJVSdo+XfRQAqsKrj4fc+zLYbSPQklEmCZHv2FCUP+uDso1NEKYtPhwphUHQptxnyFXYdpB7CddZAMmrkGAt1AxSTqBQUibBVdTsFNBSuX3MV+AJkFocv82SLf5QAqmgj7AY81A23VDSEnLoEDGEJVSeDFzQDYrqvBk70VA8U157pcRGUBWfEF+ZKbsP6phvycGBZRAJbod0OgwfkCp+L8jatBmQCjl3pGrPlFAfMWm114SOkButwtqS7UjQHQwbcjXyw1A8jnLuuyA9j9KwjL0VwHhPyotk0lcs8k/Q5PvEs9rsz+SfsOQEVqdPzUAKDojLoY/WJz/kcjCcD8YFu070FRZPyoLC2BdJEM/YOXQAuiMM0HIBz1bw3sdQdV46aaHRwZByatzjDPX8EDb3Jie8HXZQCJxj6ULP8NAUaG6uRAZrUCWdmou5/mVQLb9huRPm4BAhvoCHygZaUCuX/I3SPdSQC9/bC/1qTxAfKxsYQ6pJUCuslH+N14QQMS/cv7SvPg/Ol8maYKx4j8AAAAA/////wAAAAAAAAAAAAAAAAAAAAAAAAAA/////////////////////////////////////wAAAAD/////AAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAA/////wAAAAAAAAAAAQAAAAEAAAAAAAAAAAAAAP////8AAAAABQAAAAAAAAAAAAAAAAAAAAAAAAD/////BQAAAAUAAAAAAAAAAAAAAAAAAAAAAAAA/////wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAP////////////////////////////////////8AAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD/////////////////////////////////////AAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAABQAAAAEAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA/////////////////////////////////////wAAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAEAAAABAAAAAQAAAAAAAAABAAAAAAAAAAUAAAABAAAAAQAAAAAAAAAAAAAAAQAAAAEAAAAAAAAAAQAAAAEAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQEAAAAAAAEAAQAAAQEAAAAAAAEAAAABAAAAAQABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAABAAAAAAAAAAAAAAABAAAAAQAAAAEAAAAAAAAAAAAAAAEAAAAAAAAAAQAAAAEAAAABAAAAAAAAAAAAAAAAAAAAAAAAAKriWFiWZfg/Y2nmTbY/8z8MHSPSqmnjv6hnn18HR3c/quJYWJZl+D/jq5TzDdzyPwwdI9KqaeO/u0kC1eFSBECq4lhYlmX4P69pJmt7c/E/NnkJi6jSBsDESFlzKkr6P33ArMz7sfY/o2q2uqM08D+oZ59fB0d3PzEqCi3qrvK/kmm4ANp49D+4wS2wzhzvP9WJvyAnx+E/upcY75RVx7+95t+9y0T1P9L18g1caO0/k6CkRyVzAEBf99+e/GjxP6QMsuuLQ/U/PlP4Qr8q7j8Mb/GO2GMCwLl2K/DQIghAePiwytEp9D9UHrsuI/nqPzjMedJ+yuy/k6xgf58n/L+XoQtn22DzP2lzCnsYk+s/JhUSDI4P8z+8lFcBhgTcPxOqKRxEX/M/89MEdoPQ6j8OKQaXDob7vzWwNvblgAPAzGkxMcl88j9Nm4okPkbpP0vI89vxSgRAdac2Z6W2/T+6UFOMC3zyP/+2XEF3hug/QqhELwGKCMAwdlQerEoEQFcr/B+VnvE/hB1hfFzT5j8wdsE/Da64P0hIvnF/sOC/KH/hrXUg8T9bI5OQHaLlP+mYzla7td6/CtKG6iOm8b8FW3TV8oXwP8ORhtNuJ+c/q8JrTMz/AcC8PaUl+PUFwAXv9rkMT/A/m+sAswr15D+7hk/O3yvkP6c/yVsOHKI/qqAX9idJ8D/8hNz1KNPiP7xSXh3Ggvg/epbkiKr57T/23/LB1GLvP4GTTeNZi+M/W4TqlTheBcDupZgIdYUIQGwlcW3YZO8/tQvDXQ3H4j8Bt+sf9DkAQMdFie+nNvg/Z5Uh1wDX7j9h5X2d4KjhPxMJ1ZVT4Pa/evqB8xB//7+W183U9QLsPwzNxsC7AOA/af/LqCnK/r/lPceQ0FQDwHoY0nYIW+w/bHNSHrTg4D/DFcMAdabuv2sz5Ojhnve/FvLf01HN6z/tEDL2Hz/gP0bBv0KUhPA/pd7sEnMc4D8EGon4Lo7sP5NVbYtSON8/DAMC50odBkB+Z2J8MGYCQIhlM1gubOo/FssiPwWy4D8OIlGqRnkCQAd1vopp6f4/QS1keLLK6T9rfoBuT7LZP3KQbH5ugwjAjqVPXTmbBUBL/JxcqR3qP3oSeovuktg/Y6pRhJmqy7+0kwuU0Yjmv2wvsfFmQ+g/R98lJFqQ2T/IGb5gjLkCwK3mNff3kQbAqDznPFM86T+iiP0FfsvYP7fzKG6Mls0/h7+at2btzL8tsUTgk+LmP/YEIrTDINU/WmwKoVjA5L9aC02r6FHxvzzFCT/Qg+Y/nx0V97en0j8+1toJOm77P1kZ7h8KjfQ/GBbbqxgk5j9RGXM79G/SP+beHsWmweQ/9REi4eX0xD/V9s+kmMHkP+pb9yNs09A/c5ERjVDTAECqEr3OBCH7P14ILfMECOU/piRx4P8P0j+JYU//bfL0Pw62fw28B+w/l5YW2Ga45D9+CyKRbenOP5cH6fHy1/S/o/egk03++r91nTYRL/bjP3fHN6OJVdA/7xXQh1XLBcAB3g6tBdUIQKW2KnGYjeQ/SqIpagclyz8F9P3YgNL6v9H6NBsZ8QDAW2k5L5Qs4z/0axa1l6zLP1GE65Mu4wNAwfX+BYmWAEBBgJP90M3hP6/03qhPLdA/zqo5bJz2778/ESlPCTn1v7JkhGyvzuE/DM7sj5twwz/6xbXLavYGQH29RFRGkgNA7bOXVSJ54T9fEhTHO/TDP+8t+HMOiwDAxa0SbGTtA8Atii7y0mLgP4cecHFB3sM/uPUpyv+K7j8nktD1/WvhP2cWmi772d8/Fj7uU9kEvD8oKOESLzKmvwSdCqrHdNu/XCluGsvI3T929OW5md+uP9dP6rXcZNq/gXM+ggzL6b+eKjsPgJncP6i1e9aVu7E/2CnPNJyD1D/DnyGgSe+xvy8k7g9bp9s/nYmLvHn1sz9cFOwApH8IwGa6Mjy9cgZAJr95SiSW2z8rCkhOFvqdP3SIKmO/UwPAEy0zkN7bBsCds8Hg/13YP1zv413hVGi/FVtqixSn6L9XAPQGul3yv7SGu2BoCNk/n94bv7Maj79p13T6X9z3P45MPCW3WvI/rU/8/LRj1T9cgR6SXd+ZPymL2DstbPI/8s/pAkIz6z/fmoB+8efYPz2XyfWgYaa/6wys72AW/j8LZImhgrf3P729Zla/n9U/ySB8B3PBqL8O2nhevvbxv17+5A+n6fe/YrGIqEGB1T+wCEGbkhaxv989QHVE5wFAzd12PTu3/T9AHUPZY2DUP3SQDST0zq2/JCxAlIoj5T+Mhe1IJkrQP/cRpl8QhtU/amc4seFts79khiUSVaz3vxYfWtjPwf2/CHscxQqD0j/ctUBQ9my3v0POnFiyXv2/pjjn2Ju/AcDk45DwBhPRP/GjwlCrv7m/aT2ciwolBsAQOzHr/wUJQCzpq5UYvtI/gDCf3SlCwb+4i7S+mukEQBDA1f8mowFA2utnRN3KyT9T+9EYAVG6v9/IVZ0enrE/7NbRtdGfzr/8y8GpRz7LP3U0vTSk18e/JzHEcwiBB0AGm8Q7AJkEQNLciyt4Esk/gLou5zoQxr+RrOfM91oBwEzd36KybgTAgLou5zoQxj/S3IsreBLJv1gCch0OHO8/FD+RxSLN4j91NL00pNfHP/zLwalHPsu/nL7/By4Pyr8tSP5h7CPiv1P70RgBUbo/2utnRN3Kyb/KfllfCpUIwLkP5zj+NwdAgDCf3SlCwT8s6auVGL7Sv2aFPlaC4eC/XrS5UVH77b/xo8JQq7+5P+TjkPAGE9G/Q30/RYbn1z8FF/ISafuLv9y1QFD2bLc/CHscxQqD0r/fi+tPROX0P6vRc+19ie0/amc4seFtsz/3EaZfEIbVv77TYpahl/o/DDsu0CaC9D90kA0k9M6tP0AdQ9ljYNS/CCI0rxjZA8BgfCaLthgHwLAIQZuSFrE/YrGIqEGB1b8kvQ982+rsv4J8EWu7jPS/ySB8B3PBqD+9vWZWv5/VvwrAByWcJgBAxFujmE9a+j89l8n1oGGmP9+agH7x59i/N03cuJUt9L8X9v4GdIz6v1yBHpJd35m/rU/8/LRj1b8mz69sydf/vyu5idMqVQLAn94bv7Majz8AhrtgaAjZv+aCE66WZ/q/lA1Mgz/p/79c7+Nd4VRoP52zweD/Xdi/TJZpMTb4AkDLWZShPOb/PysKSE4W+p2/Jr95SiSW27/PkmbE7zjnP6UAiCDmMNI/nYmLvHn1s78vJO4PW6fbv5MWA2vqSrQ/V5WLwPB51b+otXvWlbuxv54qOw+Amdy/1keqzYeRBsApIEMHgZIIQHb05bmZ366/XCluGsvI3b8W44a9X9UFQEeQtDM4rwJAFj7uU9kEvL9nFpou+9nfv3Co+JcyyQhAcdkCX2KzBUCHHnBxQd7Dvy2KLvLSYuC/o6+5YTt/AcCHCNDW+8YEwF8SFMc79MO/7bOXVSJ54b9E/pfA2S3xPzD9xaBb0uQ/DM7sj5tww7+yZIRsr87hv7c4c0SEXNG/Tr79/9M+5r+v9N6oTy3Qv5uAk/3QzeG/XcI1OVQkAUAQSV9Z7Qr9P/RrFrWXrMu/W2k5L5Qs479Zo2IBM/vkv6FuipzkFvG/SqIpagcly7+ltipxmI3kv0pmis91cfc/gWQecsRh8D93xzejiVXQv3WdNhEv9uO/D7mgYy612j+PyVPNaT2jv34LIpFt6c6/l5YW2Ga45L+LUp+2A2z9P39i5xSpRfc/piRx4P8P0r9eCC3zBAjlv5n4OKmIUf2/jj/kUAwgAsDqW/cjbNPQv9X2z6SYweS/aTdljlWd8L94R8vZ8SL3v1EZczv0b9K/GBbbqxgk5r9XdfyikfEDwPILMvas0gfAnx0V97en0r88xQk/0IPmvxGErZ681fa/9kCaiOy2/b/2BCK0wyDVvy2xROCT4ua/+5EBLOXxA0B7p53+BnkAQKKI/QV+y9i/qDznPFM86b/snWGNkkgHwC+ByugkUwdAR98lJFqQ2b9sL7HxZkPovyJNGM67oek/HzNy6BqA1D96EnqL7pLYv0v8nFypHeq/axL/u1FnB0AkSEHvxn8DQGt+gG5Pstm/QS1keLLK6b/Sk/O6mtGzPxU8pLcPNty/FssiPwWy4L+IZTNYLmzqvw4szKfSouq/G+XJHY1a87+TVW2LUjjfvwQaifgujuy/3VARaoMl2L9NFodfK+/qv+0QMvYfP+C/FvLf01HN67+ETOQysd8AwH71iI/eGgXAbHNSHrTg4L96GNJ2CFvsv6BnExReeAFA5CakvxSl+j8MzcbAuwDgv5bXzdT1Auy/uVq8/8x58z+uvPMNqzTnP2HlfZ3gqOG/Z5Uh1wDX7r8PUbMSo2P7P9VfBrXlxPI/tQvDXQ3H4r9sJXFt2GTvvyDssGgO0PG/WxT/uE4N+r+Bk03jWYvjv/bf8sHUYu+/rUXN8hUe3j9m5HB1yZCzv/yE3PUo0+K/qqAX9idJ8L9mByqLMMH5v4kHC7KQowHAm+sAswr15L8F7/a5DE/wv2JLsGADFwTAKQjVGovZCMDDkYbTbifnvwVbdNXyhfC/malhH7yI7D+oevd0GWDZP1sjk5AdouW/KH/hrXUg8b8KWmrpQ0sFQAzEAF/pTgBAhB1hfFzT5r9XK/wflZ7xv18hRuqKXAjA/5rUd9v1BED/tlxBd4bov7pQU4wLfPK/4pnwn0T/sj/c277XPF3jv02biiQ+Rum/zGkxMcl88r8Yk0HhJVzjv62yUUFRjfS/89MEdoPQ6r8TqikcRF/zvxQxghHovfY/cfM1eFWE5j9pcwp7GJPrv5ehC2fbYPO/KUV2nGg0/795OhmUaqEFwFQeuy4j+eq/ePiwytEp9L8DuqWfW+8BQLytJylXHPY/PlP4Qr8q7r+kDLLri0P1vxT4ShWL+Oo/DMsWg0zlv7/S9fINXGjtv73m373LRPW/+xg/Gaxd8b94MdQEfW0AwLjBLbDOHO+/kmm4ANp49L+cShSMMbAEwKyjUgWirAdAo2q2uqM08L99wKzM+7H2v3RdlNBXFgnA8S9+ewyV/z+vaSZre3Pxv6riWFiWZfi/2J7VSZZ60j+LES81zPn3v+OrlPMN3PK/quJYWJZl+L/OZbufkEcEQLCNB/1lPOO/Y2nmTbY/87+q4lhYlmX4v7CNB/1lPOO/zmW7n5BHBEBwKD1Aa57LP/XsSsw7RbU/PMDPJGsfoD/TqningGKIPzFtCLYmb3I/qYfrJr7eWz9pQmleXRFFP0rWlJkA2i8/pCvcttgTGD9Dt8IWbjMCPyCG4GRlhOs+1JI2GhDN1D7ns8cGvXK/Pi8m8UTJxac+hNTfA2z4kT7GI8kjLyt7Pv//////HwAI//////8zEAj/////fzIgCP////9vMjAI/////2MyQAj///8/YjJQCP///zdiMmAI////M2IycAj//78zYjKACP//qzNiMpAI/3+rM2IyoAj/D6szYjKwCP8DqzNiMsAIvwOrM2Iy0AifA6szYjLgCJkDqzNiMvAI//////8/Dwj//////ysfCP////9/KS8I/////z8pPwj/////OSlPCP///z84KV8I////Dzgpbwj///8OOCl/CP//Hw44KY8I//8PDjgpnwj/fw0OOCmvCP8PDQ44Kb8I/w0NDjgpzwj/DA0OOCnfCMcMDQ44Ke8IxAwNDjgp/wgHAAAABwAAAAEAAAACAAAABAAAAAMAAAAAAAAAAAAAAAcAAAADAAAAAQAAAAIAAAAFAAAABAAAAAAAAAAAAAAABAAAAAQAAAAAAAAAAgAAAAEAAAADAAAADgAAAAYAAAALAAAAAgAAAAcAAAABAAAAGAAAAAUAAAAKAAAAAQAAAAYAAAAAAAAAJgAAAAcAAAAMAAAAAwAAAAgAAAACAAAAMQAAAAkAAAAOAAAAAAAAAAUAAAAEAAAAOgAAAAgAAAANAAAABAAAAAkAAAADAAAAPwAAAAsAAAAGAAAADwAAAAoAAAAQAAAASAAAAAwAAAAHAAAAEAAAAAsAAAARAAAAUwAAAAoAAAAFAAAAEwAAAA4AAAAPAAAAYQAAAA0AAAAIAAAAEQAAAAwAAAASAAAAawAAAA4AAAAJAAAAEgAAAA0AAAATAAAAdQAAAA8AAAATAAAAEQAAABIAAAAQAAAABgAAAAIAAAADAAAABQAAAAQAAAAAAAAAAAAAAAAAAAAGAAAAAgAAAAMAAAABAAAABQAAAAQAAAAAAAAAAAAAAAcAAAAFAAAAAwAAAAQAAAABAAAAAAAAAAIAAAAAAAAAAgAAAAMAAAABAAAABQAAAAQAAAAGAAAAAAAAAAAAAAAYLURU+yH5PxgtRFT7Ifm/GC1EVPshCUAYLURU+yEJwGFsZ29zLmMAaDNOZWlnaGJvclJvdGF0aW9ucwBjZWxsc1RvTXVsdGlQb2x5LmMAY2VsbFRvRWRnZUFyY3MAAAEDAgQABAMFAQJjYW5jZWxBcmNQYWlycwBjcmVhdGVTb3J0YWJsZUxvb3AAZGlyZWN0ZWRFZGdlLmMAZGlyZWN0ZWRFZGdlVG9Cb3VuZGFyeQBhZGphY2VudEZhY2VEaXJbdG1wRmlqay5mYWNlXVtmaWprLmZhY2VdID09IEtJAGZhY2VpamsuYwBfZmFjZUlqa1BlbnRUb0NlbGxCb3VuZGFyeQBhZGphY2VudEZhY2VEaXJbY2VudGVySUpLLmZhY2VdW2ZhY2UyXSA9PSBLSQBfZmFjZUlqa1RvQ2VsbEJvdW5kYXJ5AGgzSW5kZXguYwBjb21wYWN0Q2VsbHMAdmVjM1RvQ2VsbABjZWxsVG9DaGlsZFBvcwB2YWxpZGF0ZUNoaWxkUG9zAHJldkRpciAhPSBJTlZBTElEX0RJR0lUAGxvY2FsaWouYwBjZWxsVG9Mb2NhbElqawBiYXNlQ2VsbCAhPSBvcmlnaW5CYXNlQ2VsbAAhKG9yaWdpbk9uUGVudCAmJiBpbmRleE9uUGVudCkAYmFzZUNlbGwgPT0gb3JpZ2luQmFzZUNlbGwALi4vaW5jbHVkZS9jb29yZGlqay5oAF91cEFwN0NoZWNrZWQAX3VwQXA3ckNoZWNrZWQAYmFzZUNlbGwgIT0gSU5WQUxJRF9CQVNFX0NFTEwAbG9jYWxJamtUb0NlbGwAIV9pc0Jhc2VDZWxsUGVudGFnb24oYmFzZUNlbGwpAGJhc2VDZWxsUm90YXRpb25zID49IDAAZ3JpZFBhdGhDZWxsc0ludGVycG9sYXRlAHBvbHlmaWxsLmMAaXRlclN0ZXBQb2x5Z29uQ29tcGFjdAAwAHZlcnRleC5jAHZlcnRleFJvdGF0aW9ucwBjZWxsVG9WZXJ0ZXg=";var vt=28400;function Tt(Le){return Le}function qe(Le){var it=/\b__Z[\w\d_]+/g;return Le.replace(it,function(Dt){var He=Dt;return Dt===He?Dt:He+" ["+Dt+"]"})}function Je(){var Le=new Error;if(!Le.stack){try{throw new Error(0)}catch(it){Le=it}if(!Le.stack)return"(no stack trace available)"}return Le.stack.toString()}function Pt(){var Le=Je();return e.extraStackTrace&&(Le+=`4130-`+e.extraStackTrace()),qe(Le)}function sn(Le,it,Dt,He){Nm("Assertion failed: "+L(Le)+", at: "+[it?L(it):"unknown filename",Dt,He?L(He):"unknown function"])}function Lt(){return Y.length}function Rt(Le,it,Dt){H.set(H.subarray(it,it+Dt),Le)}function fn(Le){return e.___errno_location&&(te[e.___errno_location()>>2]=Le),Le}function wn(Le){Nm("OOM")}function Dn(Le){try{var it=new ArrayBuffer(Le);return it.byteLength!=Le?void 0:(new Int8Array(it).set(Y),on(it),Re(it),1)}catch{}}function ye(Le){var it=Lt(),Dt=16777216,He=2147483648-Dt;if(Le>He)return!1;for(var h=16777216,sr=Math.max(it,h);sr<Le;)sr<=536870912?sr=G(2*sr,Dt):sr=Math.min(G((3*sr+2147483648)/4,Dt),He);var Ii=Dn(sr);return!!Ii}var wt=typeof atob=="function"?atob:function(Le){var it="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",Dt="",He,h,sr,Ii,ie,or,sl,fo=0;Le=Le.replace(/[^A-Za-z0-9\+\/\=]/g,"");do Ii=it.indexOf(Le.charAt(fo++)),ie=it.indexOf(Le.charAt(fo++)),or=it.indexOf(Le.charAt(fo++)),sl=it.indexOf(Le.charAt(fo++)),He=Ii<<2|ie>>4,h=(ie&15)<<4|or>>2,sr=(or&3)<<6|sl,Dt=Dt+String.fromCharCode(He),or!==64&&(Dt=Dt+String.fromCharCode(h)),sl!==64&&(Dt=Dt+String.fromCharCode(sr));while(fo<Le.length);return Dt};function Ze(Le){try{for(var it=wt(Le),Dt=new Uint8Array(it.length),He=0;He<it.length;++He)Dt[He]=it.charCodeAt(He);return Dt}catch{throw new Error("Converting base64 string to bytes failed.")}}function St(Le){if(Te(Le))return Ze(Le.slice(Z.length))}var Bt={Math,Int8Array,Int32Array,Uint8Array,Float32Array,Float64Array},ut={a:Nm,b:f,c:d,d:sn,e:fn,f:Lt,g:Rt,h:ye,i:wn,j:Tt,k:qe,l:Dn,m:Je,n:Pt,o:vt,p:Fe},Ce=(function(Le,it,Dt){"almost asm";var He=new Le.Int8Array(Dt),h=new Le.Int32Array(Dt),sr=new Le.Uint8Array(Dt),Ii=new Le.Float32Array(Dt),ie=new Le.Float64Array(Dt),or=it.o|0,sl=it.p|0,fo=Le.Math.floor,Qs=Le.Math.abs,bs=Le.Math.sqrt,ii=Le.Math.cos,zi=Le.Math.sin,KS=Le.Math.tan,Kle=Le.Math.acos,Ox=Le.Math.asin,IG=Le.Math.atan,Sa=Le.Math.atan2,m1=Le.Math.ceil,ol=Le.Math.imul,$P=Le.Math.min,Qle=Le.Math.max,Vf=Le.Math.clz32,Jle=it.a,On=it.b,ee=it.c,di=it.d,PG=it.e,ece=it.f,tce=it.g,nce=it.h,ice=it.i,Q=28416;function rce(p){return He=new Int8Array(p),sr=new Uint8Array(p),h=new Int32Array(p),Ii=new Float32Array(p),ie=new Float64Array(p),Dt=p,!0}function sce(p){p=p|0;var m=0;return m=Q,Q=Q+p|0,Q=Q+15&-16,m|0}function oce(){return Q|0}function ace(p){p=p|0,Q=p}function lce(p,m){p=p|0,m=m|0,Q=p}function cce(p,m){p=p|0,m=m|0;var g=0,_=0,v=0;return(p|0)<0?(m=2,m|0):(p|0)>13780509?(m=tT(15,m)|0,m|0):(g=((p|0)<0)<<31>>31,v=br(p|0,g|0,3,0)|0,_=ee()|0,g=At(p|0,g|0,1,0)|0,g=br(v|0,_|0,g|0,ee()|0)|0,g=At(g|0,ee()|0,1,0)|0,p=ee()|0,h[m>>2]=g,h[m+4>>2]=p,m=0,m|0)}function LG(p,m,g,_){return p=p|0,m=m|0,g=g|0,_=_|0,DG(p,m,g,_,0)|0}function DG(p,m,g,_,v){p=p|0,m=m|0,g=g|0,_=_|0,v=v|0;var x=0,b=0,E=0,M=0,N=0;if(M=Q,Q=Q+16|0,b=M,!(NG(p,m,g,_,v)|0))return _=0,Q=M,_|0;do if((g|0)>=0){if((g|0)>13780509){if(x=tT(15,b)|0,x|0)break;E=b,b=h[E>>2]|0,E=h[E+4>>2]|0}else x=((g|0)<0)<<31>>31,N=br(g|0,x|0,3,0)|0,E=ee()|0,x=At(g|0,x|0,1,0)|0,x=br(N|0,E|0,x|0,ee()|0)|0,x=At(x|0,ee()|0,1,0)|0,E=ee()|0,h[b>>2]=x,h[b+4>>2]=E,b=x;if(sp(_|0,0,b<<3|0)|0,v|0){sp(v|0,0,b<<2|0)|0,x=ih(p,m,g,_,v,b,E,0)|0;break}x=Ta(b,4)|0,x?(N=ih(p,m,g,_,x,b,E,0)|0,_t(x),x=N):x=13}else x=2;while(!1);return N=x,Q=M,N|0}function NG(p,m,g,_,v){p=p|0,m=m|0,g=g|0,_=_|0,v=v|0;var x=0,b=0,E=0,M=0,N=0,O=0,q=0,j=0,X=0,K=0,ae=0;if(ae=Q,Q=Q+16|0,X=ae,K=ae+8|0,j=X,h[j>>2]=p,h[j+4>>2]=m,(g|0)<0)return K=2,Q=ae,K|0;if(x=_,h[x>>2]=p,h[x+4>>2]=m,x=(v|0)!=0,x&&(h[v>>2]=0),Zi(p,m)|0)return K=9,Q=ae,K|0;h[K>>2]=0;e:do if((g|0)>=1)if(x)for(O=1,N=0,q=0,j=1,x=p;;){if(!(N|q)){if(x=Js(x,m,4,K,X)|0,x|0)break e;if(m=X,x=h[m>>2]|0,m=h[m+4>>2]|0,Zi(x,m)|0){x=9;break e}}if(x=Js(x,m,h[26864+(q<<2)>>2]|0,K,X)|0,x|0)break e;if(m=X,x=h[m>>2]|0,m=h[m+4>>2]|0,p=_+(O<<3)|0,h[p>>2]=x,h[p+4>>2]=m,h[v+(O<<2)>>2]=j,p=N+1|0,b=(p|0)==(j|0),E=q+1|0,M=(E|0)==6,Zi(x,m)|0){x=9;break e}if(j=j+(M&b&1)|0,(j|0)>(g|0)){x=0;break}else O=O+1|0,N=b?0:p,q=b?M?0:E:q}else for(O=1,N=0,q=0,j=1,x=p;;){if(!(N|q)){if(x=Js(x,m,4,K,X)|0,x|0)break e;if(m=X,x=h[m>>2]|0,m=h[m+4>>2]|0,Zi(x,m)|0){x=9;break e}}if(x=Js(x,m,h[26864+(q<<2)>>2]|0,K,X)|0,x|0)break e;if(m=X,x=h[m>>2]|0,m=h[m+4>>2]|0,p=_+(O<<3)|0,h[p>>2]=x,h[p+4>>2]=m,p=N+1|0,b=(p|0)==(j|0),E=q+1|0,M=(E|0)==6,Zi(x,m)|0){x=9;break e}if(j=j+(M&b&1)|0,(j|0)>(g|0)){x=0;break}else O=O+1|0,N=b?0:p,q=b?M?0:E:q}else x=0;while(!1);return K=x,Q=ae,K|0}function ih(p,m,g,_,v,x,b,E){p=p|0,m=m|0,g=g|0,_=_|0,v=v|0,x=x|0,b=b|0,E=E|0;var M=0,N=0,O=0,q=0,j=0,X=0,K=0,ae=0,ue=0,xe=0;if(ae=Q,Q=Q+16|0,X=ae+8|0,K=ae,M=Gf(p|0,m|0,x|0,b|0)|0,O=ee()|0,q=_+(M<<3)|0,ue=q,xe=h[ue>>2]|0,ue=h[ue+4>>2]|0,N=(xe|0)==(p|0)&(ue|0)==(m|0),!((xe|0)==0&(ue|0)==0|N))do M=At(M|0,O|0,1,0)|0,M=rp(M|0,ee()|0,x|0,b|0)|0,O=ee()|0,q=_+(M<<3)|0,xe=q,ue=h[xe>>2]|0,xe=h[xe+4>>2]|0,N=(ue|0)==(p|0)&(xe|0)==(m|0);while(!((ue|0)==0&(xe|0)==0|N));if(M=v+(M<<2)|0,N&&(h[M>>2]|0)<=(E|0)||(xe=q,h[xe>>2]=p,h[xe+4>>2]=m,h[M>>2]=E,(E|0)>=(g|0)))return xe=0,Q=ae,xe|0;switch(N=E+1|0,h[X>>2]=0,M=Js(p,m,2,X,K)|0,M|0){case 9:{j=9;break}case 0:{M=K,M=ih(h[M>>2]|0,h[M+4>>2]|0,g,_,v,x,b,N)|0,M||(j=9);break}default:}e:do if((j|0)==9){switch(h[X>>2]=0,M=Js(p,m,3,X,K)|0,M|0){case 9:break;case 0:{if(M=K,M=ih(h[M>>2]|0,h[M+4>>2]|0,g,_,v,x,b,N)|0,M|0)break e;break}default:break e}switch(h[X>>2]=0,M=Js(p,m,1,X,K)|0,M|0){case 9:break;case 0:{if(M=K,M=ih(h[M>>2]|0,h[M+4>>2]|0,g,_,v,x,b,N)|0,M|0)break e;break}default:break e}switch(h[X>>2]=0,M=Js(p,m,5,X,K)|0,M|0){case 9:break;case 0:{if(M=K,M=ih(h[M>>2]|0,h[M+4>>2]|0,g,_,v,x,b,N)|0,M|0)break e;break}default:break e}switch(h[X>>2]=0,M=Js(p,m,4,X,K)|0,M|0){case 9:break;case 0:{if(M=K,M=ih(h[M>>2]|0,h[M+4>>2]|0,g,_,v,x,b,N)|0,M|0)break e;break}default:break e}switch(h[X>>2]=0,M=Js(p,m,6,X,K)|0,M|0){case 9:break;case 0:{if(M=K,M=ih(h[M>>2]|0,h[M+4>>2]|0,g,_,v,x,b,N)|0,M|0)break e;break}default:break e}return xe=0,Q=ae,xe|0}while(!1);return xe=M,Q=ae,xe|0}function Js(p,m,g,_,v){p=p|0,m=m|0,g=g|0,_=_|0,v=v|0;var x=0,b=0,E=0,M=0,N=0,O=0,q=0,j=0,X=0,K=0;if(g>>>0>6)return v=1,v|0;b=(h[_>>2]|0)%6|0,h[_>>2]=b;e:do if((b|0)>0)for(x=0;;){switch(g|0){case 1:{g=5;break}case 5:{g=4;break}case 4:{g=6;break}case 6:{g=2;break}case 2:{g=3;break}case 3:{g=1;break}default:}if(x=x+1|0,(x|0)==(b|0))break e}while(!1);if(q=tt(p|0,m|0,45)|0,ee()|0,O=q&127,O>>>0>121)return v=5,v|0;M=al(p,m)|0,x=tt(p|0,m|0,52)|0,ee()|0,x=x&15;e:do if(!x)N=15;else{for(;;){if(b=(15-x|0)*3|0,E=tt(p|0,m|0,b|0)|0,ee()|0,E=E&7,(E|0)==7){m=5;break}if(K=(gc(x)|0)==0,x=x+-1|0,j=ft(7,0,b|0)|0,m=m&~(ee()|0),X=ft(h[(K?432:16)+(E*28|0)+(g<<2)>>2]|0,0,b|0)|0,b=ee()|0,g=h[(K?640:224)+(E*28|0)+(g<<2)>>2]|0,p=X|p&~j,m=b|m,!g){g=0;break e}if(!x){N=15;break e}}return m|0}while(!1);(N|0)==15&&(K=h[848+(O*28|0)+(g<<2)>>2]|0,X=ft(K|0,0,45)|0,p=X|p,m=ee()|0|m&-1040385,g=h[4272+(O*28|0)+(g<<2)>>2]|0,(K&127|0)==127&&(K=ft(h[848+(O*28|0)+20>>2]|0,0,45)|0,m=ee()|0|m&-1040385,g=h[4272+(O*28|0)+20>>2]|0,p=Fm(K|p,m)|0,m=ee()|0,h[_>>2]=(h[_>>2]|0)+1)),E=tt(p|0,m|0,45)|0,ee()|0,E=E&127;e:do if(xr(E)|0){t:do if((al(p,m)|0)==1){if((O|0)!=(E|0))if(UG(E,h[7696+(O*28|0)>>2]|0)|0){p=oL(p,m)|0,b=1,m=ee()|0;break}else di(27634,26928,533,26936);switch(M|0){case 3:{p=Fm(p,m)|0,m=ee()|0,h[_>>2]=(h[_>>2]|0)+1,b=0;break t}case 5:{p=oL(p,m)|0,m=ee()|0,h[_>>2]=(h[_>>2]|0)+5,b=0;break t}case 0:return K=9,K|0;default:return K=1,K|0}}else b=0;while(!1);if((g|0)>0){x=0;do p=sL(p,m)|0,m=ee()|0,x=x+1|0;while((x|0)!=(g|0))}if((O|0)!=(E|0)){if(!(YP(E)|0)){if((b|0)!=0|(al(p,m)|0)!=5)break;h[_>>2]=(h[_>>2]|0)+1;break}switch(q&127){case 8:case 118:break e;default:}(al(p,m)|0)!=3&&(h[_>>2]=(h[_>>2]|0)+1)}}else if((g|0)>0){x=0;do p=Fm(p,m)|0,m=ee()|0,x=x+1|0;while((x|0)!=(g|0))}while(!1);return h[_>>2]=((h[_>>2]|0)+g|0)%6|0,K=v,h[K>>2]=p,h[K+4>>2]=m,K=0,K|0}function uce(p,m,g,_){return p=p|0,m=m|0,g=g|0,_=_|0,FG(p,m,g,_)|0?(sp(_|0,0,g*48|0)|0,_=hce(p,m,g,_)|0,_|0):(_=0,_|0)}function FG(p,m,g,_){p=p|0,m=m|0,g=g|0,_=_|0;var v=0,x=0,b=0,E=0,M=0,N=0,O=0,q=0,j=0,X=0,K=0;if(K=Q,Q=Q+16|0,j=K,X=K+8|0,q=j,h[q>>2]=p,h[q+4>>2]=m,(g|0)<0)return X=2,Q=K,X|0;if(!g)return X=_,h[X>>2]=p,h[X+4>>2]=m,X=0,Q=K,X|0;h[X>>2]=0;e:do if(Zi(p,m)|0)p=9;else{v=0,q=p;do{if(p=Js(q,m,4,X,j)|0,p|0)break e;if(m=j,q=h[m>>2]|0,m=h[m+4>>2]|0,v=v+1|0,Zi(q,m)|0){p=9;break e}}while((v|0)<(g|0));O=_,h[O>>2]=q,h[O+4>>2]=m,O=g+-1|0,N=0,p=1;do{if(v=26864+(N<<2)|0,(N|0)==5)for(b=h[v>>2]|0,x=0,v=p;;){if(p=j,p=Js(h[p>>2]|0,h[p+4>>2]|0,b,X,j)|0,p|0)break e;if((x|0)!=(O|0))if(M=j,E=h[M>>2]|0,M=h[M+4>>2]|0,p=_+(v<<3)|0,h[p>>2]=E,h[p+4>>2]=M,!(Zi(E,M)|0))p=v+1|0;else{p=9;break e}else p=v;if(x=x+1|0,(x|0)>=(g|0))break;v=p}else for(b=j,M=h[v>>2]|0,E=0,v=p,x=h[b>>2]|0,b=h[b+4>>2]|0;;){if(p=Js(x,b,M,X,j)|0,p|0)break e;if(b=j,x=h[b>>2]|0,b=h[b+4>>2]|0,p=_+(v<<3)|0,h[p>>2]=x,h[p+4>>2]=b,p=v+1|0,Zi(x,b)|0){p=9;break e}if(E=E+1|0,(E|0)>=(g|0))break;v=p}N=N+1|0}while(N>>>0<6);p=j,p=(q|0)==(h[p>>2]|0)&&(m|0)==(h[p+4>>2]|0)?0:9}while(!1);return X=p,Q=K,X|0}function hce(p,m,g,_){p=p|0,m=m|0,g=g|0,_=_|0;var v=0,x=0,b=0,E=0,M=0,N=0,O=0,q=0,j=0;if(q=Q,Q=Q+16|0,b=q,!g)return h[_>>2]=p,h[_+4>>2]=m,_=0,Q=q,_|0;do if((g|0)>=0){if((g|0)>13780509){if(v=tT(15,b)|0,v|0)break;x=b,v=h[x>>2]|0,x=h[x+4>>2]|0}else v=((g|0)<0)<<31>>31,O=br(g|0,v|0,3,0)|0,x=ee()|0,v=At(g|0,v|0,1,0)|0,v=br(O|0,x|0,v|0,ee()|0)|0,v=At(v|0,ee()|0,1,0)|0,x=ee()|0,O=b,h[O>>2]=v,h[O+4>>2]=x;if(N=Ta(v,8)|0,!N)v=13;else{if(O=Ta(v,4)|0,!O){_t(N),v=13;break}if(v=ih(p,m,g,N,O,v,x,0)|0,v|0){_t(N),_t(O);break}if(m=h[b>>2]|0,b=h[b+4>>2]|0,(b|0)>0|(b|0)==0&m>>>0>0){v=0,E=0,M=0;do p=N+(E<<3)|0,x=h[p>>2]|0,p=h[p+4>>2]|0,!((x|0)==0&(p|0)==0)&&(h[O+(E<<2)>>2]|0)==(g|0)&&(j=_+(v<<3)|0,h[j>>2]=x,h[j+4>>2]=p,v=v+1|0),E=At(E|0,M|0,1,0)|0,M=ee()|0;while((M|0)<(b|0)|(M|0)==(b|0)&E>>>0<m>>>0)}_t(N),_t(O),v=0}}else v=2;while(!1);return j=v,Q=q,j|0}function QS(p,m,g,_){p=p|0,m=m|0,g=g|0,_=_|0;var v=0,x=0,b=0,E=0,M=0,N=0;for(E=Q,Q=Q+16|0,x=E,b=E+8|0,v=(Zi(p,m)|0)==0,v=v?1:2;;){if(h[b>>2]=0,N=(Js(p,m,v,b,x)|0)==0,M=x,N&((h[M>>2]|0)==(g|0)?(h[M+4>>2]|0)==(_|0):0)){p=4;break}if(v=v+1|0,v>>>0>=7){v=7,p=4;break}}return(p|0)==4?(Q=E,v|0):0}function fce(p,m,g,_){p=p|0,m=m|0,g=g|0,_=_|0;var v=0,x=0,b=0,E=0,M=0,N=0;if(E=Q,Q=Q+48|0,v=E+16|0,x=E+8|0,b=E,g=Wx(g)|0,g|0)return b=g,Q=E,b|0;if(N=p,M=h[N+4>>2]|0,g=x,h[g>>2]=h[N>>2],h[g+4>>2]=M,nq(x,v),g=GG(v,m,b)|0,!g){if(m=h[x>>2]|0,x=h[p+8>>2]|0,(x|0)>0){v=h[p+12>>2]|0,g=0;do m=(h[v+(g<<3)>>2]|0)+m|0,g=g+1|0;while((g|0)<(x|0))}g=b,v=h[g>>2]|0,g=h[g+4>>2]|0,x=((m|0)<0)<<31>>31,(g|0)<(x|0)|(g|0)==(x|0)&v>>>0<m>>>0?(g=b,h[g>>2]=m,h[g+4>>2]=x,g=x):m=v,M=At(m|0,g|0,12,0)|0,N=ee()|0,g=b,h[g>>2]=M,h[g+4>>2]=N,g=_,h[g>>2]=M,h[g+4>>2]=N,g=0}return N=g,Q=E,N|0}function BG(p,m,g,_,v,x,b){p=p|0,m=m|0,g=g|0,_=_|0,v=v|0,x=x|0,b=b|0;var E=0,M=0,N=0,O=0,q=0,j=0,X=0,K=0,ae=0,ue=0,xe=0,se=0,we=0,Ae=0,Be=0,Ke=0,Me=0,be=0,gt=0,je=0,Ut=0,lt=0,pt=0,pi=0,bi=0,Ro=0,Vn=0,wi=0,Ea=0;if(bi=Q,Q=Q+64|0,Ut=bi+48|0,lt=bi+32|0,pt=bi+24|0,Be=bi+8|0,Ke=bi,M=h[p>>2]|0,(M|0)<=0)return pi=0,Q=bi,pi|0;for(Me=p+4|0,be=Ut+8|0,gt=lt+8|0,je=Be+8|0,E=0,we=0;;){N=h[Me>>2]|0,se=N+(we<<4)|0,h[Ut>>2]=h[se>>2],h[Ut+4>>2]=h[se+4>>2],h[Ut+8>>2]=h[se+8>>2],h[Ut+12>>2]=h[se+12>>2],(we|0)==(M+-1|0)?(h[lt>>2]=h[N>>2],h[lt+4>>2]=h[N+4>>2],h[lt+8>>2]=h[N+8>>2],h[lt+12>>2]=h[N+12>>2]):(se=N+(we+1<<4)|0,h[lt>>2]=h[se>>2],h[lt+4>>2]=h[se+4>>2],h[lt+8>>2]=h[se+8>>2],h[lt+12>>2]=h[se+12>>2]),M=Mce(Ut,lt,_,pt)|0;e:do if(M)N=0,E=M;else if(M=pt,N=h[M>>2]|0,M=h[M+4>>2]|0,(M|0)>0|(M|0)==0&N>>>0>0){xe=0,se=0;t:for(;;){if(Vn=1/(+(N>>>0)+4294967296*+(M|0)),Ea=+ie[Ut>>3],M=eo(N|0,M|0,xe|0,se|0)|0,wi=+(M>>>0)+4294967296*+(ee()|0),Ro=+(xe>>>0)+4294967296*+(se|0),ie[Be>>3]=Vn*(Ea*wi)+Vn*(+ie[lt>>3]*Ro),ie[je>>3]=Vn*(+ie[be>>3]*wi)+Vn*(+ie[gt>>3]*Ro),M=aL(Be,_,Ke)|0,M|0){E=M;break}ue=Ke,ae=h[ue>>2]|0,ue=h[ue+4>>2]|0,j=Gf(ae|0,ue|0,m|0,g|0)|0,O=ee()|0,M=b+(j<<3)|0,q=M,N=h[q>>2]|0,q=h[q+4>>2]|0;n:do if((N|0)==0&(q|0)==0)Ae=M,pi=16;else for(X=0,K=0;;){if((X|0)>(g|0)|(X|0)==(g|0)&K>>>0>m>>>0){E=1;break t}if((N|0)==(ae|0)&(q|0)==(ue|0))break n;if(M=At(j|0,O|0,1,0)|0,j=rp(M|0,ee()|0,m|0,g|0)|0,O=ee()|0,K=At(K|0,X|0,1,0)|0,X=ee()|0,M=b+(j<<3)|0,q=M,N=h[q>>2]|0,q=h[q+4>>2]|0,(N|0)==0&(q|0)==0){Ae=M,pi=16;break}}while(!1);if((pi|0)==16&&(pi=0,!((ae|0)==0&(ue|0)==0))&&(K=Ae,h[K>>2]=ae,h[K+4>>2]=ue,K=x+(h[v>>2]<<3)|0,h[K>>2]=ae,h[K+4>>2]=ue,K=v,K=At(h[K>>2]|0,h[K+4>>2]|0,1,0)|0,ae=ee()|0,ue=v,h[ue>>2]=K,h[ue+4>>2]=ae),xe=At(xe|0,se|0,1,0)|0,se=ee()|0,M=pt,N=h[M>>2]|0,M=h[M+4>>2]|0,!((M|0)>(se|0)|(M|0)==(se|0)&N>>>0>xe>>>0)){N=1;break e}}N=0}else N=1;while(!1);if(we=we+1|0,!N){pi=21;break}if(M=h[p>>2]|0,(we|0)>=(M|0)){E=0,pi=21;break}}return(pi|0)==21?(Q=bi,E|0):0}function dce(p,m,g,_){p=p|0,m=m|0,g=g|0,_=_|0;var v=0,x=0,b=0,E=0,M=0,N=0,O=0,q=0,j=0,X=0,K=0,ae=0,ue=0,xe=0,se=0,we=0,Ae=0,Be=0,Ke=0,Me=0,be=0,gt=0,je=0,Ut=0,lt=0,pt=0,pi=0,bi=0,Ro=0,Vn=0,wi=0;if(wi=Q,Q=Q+112|0,pi=wi+80|0,M=wi+72|0,bi=wi,Ro=wi+56|0,v=Wx(g)|0,v|0)return Vn=v,Q=wi,Vn|0;if(N=p+8|0,Vn=yr((h[N>>2]<<5)+32|0)|0,!Vn)return Vn=13,Q=wi,Vn|0;if(pL(p,Vn),v=Wx(g)|0,!v){if(lt=p,pt=h[lt+4>>2]|0,v=M,h[v>>2]=h[lt>>2],h[v+4>>2]=pt,nq(M,pi),v=GG(pi,m,bi)|0,v)lt=0,pt=0;else{if(v=h[M>>2]|0,x=h[N>>2]|0,(x|0)>0){b=h[p+12>>2]|0,g=0;do v=(h[b+(g<<3)>>2]|0)+v|0,g=g+1|0;while((g|0)!=(x|0));g=v}else g=v;v=bi,x=h[v>>2]|0,v=h[v+4>>2]|0,b=((g|0)<0)<<31>>31,(v|0)<(b|0)|(v|0)==(b|0)&x>>>0<g>>>0?(v=bi,h[v>>2]=g,h[v+4>>2]=b,v=b):g=x,lt=At(g|0,v|0,12,0)|0,pt=ee()|0,v=bi,h[v>>2]=lt,h[v+4>>2]=pt,v=0}if(!v){if(g=Ta(lt,8)|0,!g)return _t(Vn),Vn=13,Q=wi,Vn|0;if(E=Ta(lt,8)|0,!E)return _t(Vn),_t(g),Vn=13,Q=wi,Vn|0;je=pi,h[je>>2]=0,h[je+4>>2]=0,je=p,Ut=h[je+4>>2]|0,v=M,h[v>>2]=h[je>>2],h[v+4>>2]=Ut,v=BG(M,lt,pt,m,pi,g,E)|0;e:do if(v)_t(g),_t(E),_t(Vn);else{t:do if((h[N>>2]|0)>0){for(b=p+12|0,x=0;v=BG((h[b>>2]|0)+(x<<3)|0,lt,pt,m,pi,g,E)|0,x=x+1|0,!(v|0);)if((x|0)>=(h[N>>2]|0))break t;_t(g),_t(E),_t(Vn);break e}while(!1);(pt|0)>0|(pt|0)==0<>>>0>0&&sp(E|0,0,lt<<3|0)|0,Ut=pi,je=h[Ut+4>>2]|0;t:do if((je|0)>0|(je|0)==0&(h[Ut>>2]|0)>>>0>0){Me=g,be=E,gt=g,je=E,Ut=g,v=g,Ae=g,Be=E,Ke=E,g=E;n:for(;;){for(ue=0,xe=0,se=0,we=0,x=0,b=0;;){E=bi,M=E+56|0;do h[E>>2]=0,E=E+4|0;while((E|0)<(M|0));if(m=Me+(ue<<3)|0,N=h[m>>2]|0,m=h[m+4>>2]|0,NG(N,m,1,bi,0)|0){E=bi,M=E+56|0;do h[E>>2]=0,E=E+4|0;while((E|0)<(M|0));E=Ta(7,4)|0,E|0&&(ih(N,m,1,bi,E,7,0,0)|0,_t(E))}for(ae=0;;){K=bi+(ae<<3)|0,X=h[K>>2]|0,K=h[K+4>>2]|0;i:do if((X|0)==0&(K|0)==0)E=x,M=b;else{if(O=Gf(X|0,K|0,lt|0,pt|0)|0,N=ee()|0,E=_+(O<<3)|0,m=E,M=h[m>>2]|0,m=h[m+4>>2]|0,!((M|0)==0&(m|0)==0)){q=0,j=0;do{if((q|0)>(pt|0)|(q|0)==(pt|0)&j>>>0>lt>>>0)break n;if((M|0)==(X|0)&(m|0)==(K|0)){E=x,M=b;break i}E=At(O|0,N|0,1,0)|0,O=rp(E|0,ee()|0,lt|0,pt|0)|0,N=ee()|0,j=At(j|0,q|0,1,0)|0,q=ee()|0,E=_+(O<<3)|0,m=E,M=h[m>>2]|0,m=h[m+4>>2]|0}while(!((M|0)==0&(m|0)==0))}if((X|0)==0&(K|0)==0){E=x,M=b;break}v1(X,K,Ro)|0,mL(p,Vn,Ro)|0&&(j=At(x|0,b|0,1,0)|0,b=ee()|0,q=E,h[q>>2]=X,h[q+4>>2]=K,x=be+(x<<3)|0,h[x>>2]=X,h[x+4>>2]=K,x=j),E=x,M=b}while(!1);if(ae=ae+1|0,ae>>>0>=7)break;x=E,b=M}if(ue=At(ue|0,xe|0,1,0)|0,xe=ee()|0,se=At(se|0,we|0,1,0)|0,we=ee()|0,b=pi,x=h[b>>2]|0,b=h[b+4>>2]|0,(we|0)<(b|0)|(we|0)==(b|0)&se>>>0<x>>>0)x=E,b=M;else break}if((b|0)>0|(b|0)==0&x>>>0>0){x=0,b=0;do we=Me+(x<<3)|0,h[we>>2]=0,h[we+4>>2]=0,x=At(x|0,b|0,1,0)|0,b=ee()|0,we=pi,se=h[we+4>>2]|0;while((b|0)<(se|0)|((b|0)==(se|0)?x>>>0<(h[we>>2]|0)>>>0:0))}if(we=pi,h[we>>2]=E,h[we+4>>2]=M,(M|0)>0|(M|0)==0&E>>>0>0)ae=g,ue=Ke,xe=Ut,se=Be,we=be,g=Ae,Ke=v,Be=gt,Ae=ae,v=ue,Ut=je,je=xe,gt=se,be=Me,Me=we;else break t}_t(gt),_t(je),_t(Vn),v=1;break e}else v=E;while(!1);_t(Vn),_t(g),_t(v),v=0}while(!1);return Vn=v,Q=wi,Vn|0}}return _t(Vn),Vn=v,Q=wi,Vn|0}function pce(p,m,g){p=p|0,m=m|0,g=g|0;var _=0,v=0,x=0,b=0,E=0,M=0,N=0;if(E=Q,Q=Q+16|0,b=E,p=Rce(p,m,((m|0)<0)<<31>>31,b)|0,p|0)return b=p,Q=E,b|0;if(x=uue(b,g)|0,g=b+4|0,(h[b>>2]|0)>0){m=0;do{if(v=h[g>>2]|0,_=v+(m<<4)+4|0,_t(h[_>>2]|0),h[_>>2]=0,h[v+(m<<4)>>2]=0,_=v+(m<<4)+8|0,v=v+(m<<4)+12|0,(h[_>>2]|0)>0){p=0;do M=h[v>>2]|0,N=M+(p<<3)+4|0,_t(h[N>>2]|0),h[N>>2]=0,h[M+(p<<3)>>2]=0,p=p+1|0;while((p|0)<(h[_>>2]|0))}_t(h[v>>2]|0),h[v>>2]=0,h[_>>2]=0,m=m+1|0}while((m|0)<(h[b>>2]|0))}return _t(h[g>>2]|0),h[g>>2]=0,h[b>>2]=0,N=x,Q=E,N|0}function Ac(p,m){p=p|0,m=m|0;var g=0,_=0,v=0,x=0,b=0,E=0,M=0,N=0,O=0,q=0;if(b=h[p>>2]|0,(b|0)<=0)return v=0,_=0,b=v<0,_=12.566370614359172-_,_=v+_,v=b?_:v,ie[m>>3]=v,0;if(x=h[p+4>>2]|0,p=(b|0)!=1&1,E=+ie[x>>3]*.5+.7853981633974483,v=+ie[x+(p<<4)>>3]*.5+.7853981633974483,g=+zi(+E)*+zi(+v),_=+ie[x+(p<<4)+8>>3]-+ie[x+8>>3],g=+Sa(+(+zi(+_)*g),+(+ii(+E)*+ii(+v)+ +ii(+_)*g))*-2,_=g+0,g=_-g,(b|0)==1)return E=_,v=g,b=E<0,v=12.566370614359172-v,v=E+v,E=b?v:E,ie[m>>3]=E,0;for(p=1,v=_;O=p,p=p+1|0,q=(p|0)%(b|0)|0,N=+ie[x+(O<<4)>>3]*.5+.7853981633974483,M=+ie[x+(q<<4)>>3]*.5+.7853981633974483,_=+zi(+N)*+zi(+M),E=+ie[x+(q<<4)+8>>3]-+ie[x+(O<<4)+8>>3],g=+Sa(+(+zi(+E)*_),+(+ii(+N)*+ii(+M)+ +ii(+E)*_))*-2-g,_=v+g,g=_-v-g,!((p|0)>=(b|0));)v=_;return q=_<0,N=12.566370614359172-g,N=_+N,N=q?N:_,ie[m>>3]=N,0}function mce(p,m,g){p=p|0,m=m|0,g=g|0;var _=0,v=0,x=0,b=0;return b=Q,Q=Q+192|0,_=b+176|0,v=b,x=b+168|0,p=Bm(p,m,v)|0,p|0?(x=p,Q=b,x|0):(h[x>>2]=h[v>>2],h[x+4>>2]=v+8,h[_>>2]=h[x>>2],h[_+4>>2]=h[x+4>>2],Ac(_,g)|0,x=0,Q=b,x|0)}function Ace(p,m,g){p=p|0,m=m|0,g=g|0;var _=0,v=0,x=0,b=0;return b=Q,Q=Q+192|0,_=b+176|0,v=b,x=b+168|0,p=Bm(p,m,v)|0,p?(x=p,Q=b,x|0):(h[x>>2]=h[v>>2],h[x+4>>2]=v+8,h[_>>2]=h[x>>2],h[_+4>>2]=h[x+4>>2],Ac(_,g)|0,ie[g>>3]=+ie[g>>3]*4058973249931477e-8,x=0,Q=b,x|0)}function gce(p,m,g){p=p|0,m=m|0,g=g|0;var _=0,v=0,x=0,b=0;return b=Q,Q=Q+192|0,_=b+176|0,v=b,x=b+168|0,p=Bm(p,m,v)|0,p?(x=p,Q=b,x|0):(h[x>>2]=h[v>>2],h[x+4>>2]=v+8,h[_>>2]=h[x>>2],h[_+4>>2]=h[x+4>>2],Ac(_,g)|0,ie[g>>3]=+ie[g>>3]*4058973249931477e-8*1e6,x=0,Q=b,x|0)}function xr(p){return p=p|0,p>>>0>121?(p=0,p|0):(p=h[7696+(p*28|0)+16>>2]|0,p|0)}function YP(p){return p=p|0,(p|0)==4|(p|0)==117|0}function OG(p){return p=p|0,h[11120+((h[p>>2]|0)*216|0)+((h[p+4>>2]|0)*72|0)+((h[p+8>>2]|0)*24|0)+(h[p+12>>2]<<3)>>2]|0}function vce(p){return p=p|0,h[11120+((h[p>>2]|0)*216|0)+((h[p+4>>2]|0)*72|0)+((h[p+8>>2]|0)*24|0)+(h[p+12>>2]<<3)+4>>2]|0}function _ce(p,m){p=p|0,m=m|0,p=7696+(p*28|0)|0,h[m>>2]=h[p>>2],h[m+4>>2]=h[p+4>>2],h[m+8>>2]=h[p+8>>2],h[m+12>>2]=h[p+12>>2]}function xce(p,m){p=p|0,m=m|0;var g=0,_=0;if(m>>>0>20)return m=-1,m|0;do if((h[11120+(m*216|0)>>2]|0)!=(p|0))if((h[11120+(m*216|0)+8>>2]|0)!=(p|0))if((h[11120+(m*216|0)+16>>2]|0)!=(p|0))if((h[11120+(m*216|0)+24>>2]|0)!=(p|0))if((h[11120+(m*216|0)+32>>2]|0)!=(p|0))if((h[11120+(m*216|0)+40>>2]|0)!=(p|0))if((h[11120+(m*216|0)+48>>2]|0)!=(p|0))if((h[11120+(m*216|0)+56>>2]|0)!=(p|0))if((h[11120+(m*216|0)+64>>2]|0)!=(p|0))if((h[11120+(m*216|0)+72>>2]|0)!=(p|0))if((h[11120+(m*216|0)+80>>2]|0)!=(p|0))if((h[11120+(m*216|0)+88>>2]|0)!=(p|0))if((h[11120+(m*216|0)+96>>2]|0)!=(p|0))if((h[11120+(m*216|0)+104>>2]|0)!=(p|0))if((h[11120+(m*216|0)+112>>2]|0)!=(p|0))if((h[11120+(m*216|0)+120>>2]|0)!=(p|0))if((h[11120+(m*216|0)+128>>2]|0)!=(p|0))if((h[11120+(m*216|0)+136>>2]|0)==(p|0))p=2,g=1,_=2;else{if((h[11120+(m*216|0)+144>>2]|0)==(p|0)){p=0,g=2,_=0;break}if((h[11120+(m*216|0)+152>>2]|0)==(p|0)){p=0,g=2,_=1;break}if((h[11120+(m*216|0)+160>>2]|0)==(p|0)){p=0,g=2,_=2;break}if((h[11120+(m*216|0)+168>>2]|0)==(p|0)){p=1,g=2,_=0;break}if((h[11120+(m*216|0)+176>>2]|0)==(p|0)){p=1,g=2,_=1;break}if((h[11120+(m*216|0)+184>>2]|0)==(p|0)){p=1,g=2,_=2;break}if((h[11120+(m*216|0)+192>>2]|0)==(p|0)){p=2,g=2,_=0;break}if((h[11120+(m*216|0)+200>>2]|0)==(p|0)){p=2,g=2,_=1;break}if((h[11120+(m*216|0)+208>>2]|0)==(p|0)){p=2,g=2,_=2;break}else p=-1;return p|0}else p=2,g=1,_=1;else p=2,g=1,_=0;else p=1,g=1,_=2;else p=1,g=1,_=1;else p=1,g=1,_=0;else p=0,g=1,_=2;else p=0,g=1,_=1;else p=0,g=1,_=0;else p=2,g=0,_=2;else p=2,g=0,_=1;else p=2,g=0,_=0;else p=1,g=0,_=2;else p=1,g=0,_=1;else p=1,g=0,_=0;else p=0,g=0,_=2;else p=0,g=0,_=1;else p=0,g=0,_=0;while(!1);return m=h[11120+(m*216|0)+(g*72|0)+(p*24|0)+(_<<3)+4>>2]|0,m|0}function UG(p,m){return p=p|0,m=m|0,(h[7696+(p*28|0)+20>>2]|0)==(m|0)?(m=1,m|0):(m=(h[7696+(p*28|0)+24>>2]|0)==(m|0),m|0)}function ZP(p,m){return p=p|0,m=m|0,h[848+(p*28|0)+(m<<2)>>2]|0}function KP(p,m){return p=p|0,m=m|0,(h[848+(p*28|0)>>2]|0)==(m|0)?(m=0,m|0):(h[848+(p*28|0)+4>>2]|0)==(m|0)?(m=1,m|0):(h[848+(p*28|0)+8>>2]|0)==(m|0)?(m=2,m|0):(h[848+(p*28|0)+12>>2]|0)==(m|0)?(m=3,m|0):(h[848+(p*28|0)+16>>2]|0)==(m|0)?(m=4,m|0):(h[848+(p*28|0)+20>>2]|0)==(m|0)?(m=5,m|0):((h[848+(p*28|0)+24>>2]|0)==(m|0)?6:7)|0}function yce(){return 122}function bce(p){p=p|0;var m=0,g=0,_=0;m=0;do ft(m|0,0,45)|0,_=ee()|0|134225919,g=p+(m<<3)|0,h[g>>2]=-1,h[g+4>>2]=_,m=m+1|0;while((m|0)!=122);return 0}function wce(p){p=p|0;var m=0,g=0,_=0;return _=+ie[p+16>>3],g=+ie[p+24>>3],m=_-g,+(_<g?m+6.283185307179586:m)}function Sce(p){return p=p|0,+ie[p+16>>3]<+ie[p+24>>3]|0}function Tce(p){return p=p|0,+(+ie[p>>3]-+ie[p+8>>3])}function kG(p,m){p=p|0,m=m|0;var g=0,_=0,v=0;return g=+ie[m>>3],!(g>=+ie[p+8>>3])||!(g<=+ie[p>>3])?(m=0,m|0):(_=+ie[p+16>>3],g=+ie[p+24>>3],v=+ie[m+8>>3],m=v>=g,p=v<=_&1,_<g?m&&(p=1):m||(p=0),m=(p|0)!=0,m|0)}function QP(p,m){p=p|0,m=m|0;var g=0,_=0,v=0,x=0,b=0,E=0,M=0,N=0,O=0;return+ie[p>>3]<+ie[m+8>>3]||+ie[p+8>>3]>+ie[m>>3]?(_=0,_|0):(x=+ie[p+16>>3],g=p+24|0,O=+ie[g>>3],b=x<O,_=m+16|0,N=+ie[_>>3],v=m+24|0,M=+ie[v>>3],E=N<M,m=O-N<M-x,p=b?E|m?1:2:0,m=E?b?1:m?2:1:0,x=+Ul(x,p),x<+Ul(+ie[v>>3],m)||(O=+Ul(+ie[g>>3],p),O>+Ul(+ie[_>>3],m))?(E=0,E|0):(E=1,E|0))}function Ece(p,m,g,_){p=p|0,m=m|0,g=g|0,_=_|0;var v=0,x=0,b=0,E=0,M=0;x=+ie[p+16>>3],M=+ie[p+24>>3],p=x<M,E=+ie[m+16>>3],b=+ie[m+24>>3],v=E<b,m=M-E<b-x,h[g>>2]=p?v|m?1:2:0,h[_>>2]=v?p?1:m?2:1:0}function zG(p,m){p=p|0,m=m|0;var g=0,_=0,v=0,x=0,b=0,E=0,M=0,N=0,O=0;return+ie[p>>3]<+ie[m>>3]||+ie[p+8>>3]>+ie[m+8>>3]?(_=0,_|0):(_=p+16|0,M=+ie[_>>3],x=+ie[p+24>>3],b=M<x,g=m+16|0,O=+ie[g>>3],v=m+24|0,N=+ie[v>>3],E=O<N,m=x-O<N-M,p=b?E|m?1:2:0,m=E?b?1:m?2:1:0,x=+Ul(x,p),x<=+Ul(+ie[v>>3],m)?(O=+Ul(+ie[_>>3],p),E=O>=+Ul(+ie[g>>3],m),E|0):(E=0,E|0))}function VG(p,m){p=p|0,m=m|0;var g=0,_=0,v=0,x=0,b=0,E=0;v=Q,Q=Q+176|0,_=v,h[_>>2]=4,E=+ie[m>>3],ie[_+8>>3]=E,x=+ie[m+16>>3],ie[_+16>>3]=x,ie[_+24>>3]=E,E=+ie[m+24>>3],ie[_+32>>3]=E,b=+ie[m+8>>3],ie[_+40>>3]=b,ie[_+48>>3]=E,ie[_+56>>3]=b,ie[_+64>>3]=x,m=_+72|0,g=m+96|0;do h[m>>2]=0,m=m+4|0;while((m|0)<(g|0));cu(p|0,_|0,168)|0,Q=v}function GG(p,m,g){p=p|0,m=m|0,g=g|0;var _=0,v=0,x=0,b=0,E=0,M=0,N=0,O=0,q=0,j=0,X=0,K=0,ae=0,ue=0;K=Q,Q=Q+288|0,O=K+264|0,q=K+96|0,N=K,E=N,M=E+96|0;do h[E>>2]=0,E=E+4|0;while((E|0)<(M|0));return m=cL(m,N)|0,m|0?(X=m,Q=K,X|0):(M=N,N=h[M>>2]|0,M=h[M+4>>2]|0,v1(N,M,O)|0,Bm(N,M,q)|0,b=+Gx(O,q+8|0),ie[O>>3]=+ie[p>>3],M=O+8|0,ie[M>>3]=+ie[p+16>>3],ie[q>>3]=+ie[p+8>>3],N=q+8|0,ie[N>>3]=+ie[p+24>>3],v=+Gx(O,q),ue=+ie[M>>3]-+ie[N>>3],x=+Qs(+ue),ae=+ie[O>>3]-+ie[q>>3],_=+Qs(+ae),!(ue==0|ae==0)&&(ue=+mq(+x,+_),ue=+m1(+(v*v/+lT(+(ue/+lT(+x,+_)),3)/(b*(b*2.59807621135)*.8))),ie[or>>3]=ue,j=~~ue>>>0,X=+Qs(ue)>=1?ue>0?~~+$P(+fo(ue/4294967296),4294967295)>>>0:~~+m1((ue-+(~~ue>>>0))/4294967296)>>>0:0,(h[or+4>>2]&2146435072|0)!=2146435072)?(q=(j|0)==0&(X|0)==0,m=g,h[m>>2]=q?1:j,h[m+4>>2]=q?0:X,m=0):m=1,X=m,Q=K,X|0)}function Mce(p,m,g,_){p=p|0,m=m|0,g=g|0,_=_|0;var v=0,x=0,b=0,E=0,M=0,N=0,O=0;N=Q,Q=Q+288|0,b=N+264|0,E=N+96|0,M=N,v=M,x=v+96|0;do h[v>>2]=0,v=v+4|0;while((v|0)<(x|0));return g=cL(g,M)|0,g|0?(_=g,Q=N,_|0):(g=M,v=h[g>>2]|0,g=h[g+4>>2]|0,v1(v,g,b)|0,Bm(v,g,E)|0,O=+Gx(b,E+8|0),O=+m1(+(+Gx(p,m)/(O*2))),ie[or>>3]=O,g=~~O>>>0,v=+Qs(O)>=1?O>0?~~+$P(+fo(O/4294967296),4294967295)>>>0:~~+m1((O-+(~~O>>>0))/4294967296)>>>0:0,(h[or+4>>2]&2146435072|0)==2146435072?(_=1,Q=N,_|0):(M=(g|0)==0&(v|0)==0,h[_>>2]=M?1:g,h[_+4>>2]=M?0:v,_=0,Q=N,_|0))}function Cce(p,m){p=p|0,m=+m;var g=0,_=0,v=0,x=0,b=0,E=0,M=0,N=0,O=0;x=p+16|0,b=+ie[x>>3],g=p+24|0,v=+ie[g>>3],_=b-v,_=b<v?_+6.283185307179586:_,N=+ie[p>>3],E=p+8|0,M=+ie[E>>3],O=N-M,_=(_*m-_)*.5,m=(O*m-O)*.5,N=N+m,ie[p>>3]=N>1.5707963267948966?1.5707963267948966:N,m=M-m,ie[E>>3]=m<-1.5707963267948966?-1.5707963267948966:m,m=b+_,m=m>3.141592653589793?m+-6.283185307179586:m,ie[x>>3]=m<-3.141592653589793?m+6.283185307179586:m,m=v-_,m=m>3.141592653589793?m+-6.283185307179586:m,ie[g>>3]=m<-3.141592653589793?m+6.283185307179586:m}function Rce(p,m,g,_){p=p|0,m=m|0,g=g|0,_=_|0;var v=0,x=0,b=0,E=0,M=0,N=0,O=0,q=0,j=0,X=0,K=0,ae=0,ue=0,xe=0,se=0,we=0,Ae=0,Be=0,Ke=0,Me=0,be=0,gt=0,je=0,Ut=0,lt=0,pt=0;if(pt=Q,Q=Q+224|0,gt=pt,Be=pt+48|0,M=(g|0)>0|(g|0)==0&m>>>0>0,M&(g>>>0>0|(g|0)==0&m>>>0>17895697))return lt=14,Q=pt,lt|0;if((g|0)<0)return lt=2,Q=pt,lt|0;if((m|0)==0&(g|0)==0)return h[_>>2]=0,h[_+4>>2]=0,lt=0,Q=pt,lt|0;for(v=p,v=nL(h[v>>2]|0,h[v+4>>2]|0)|0,b=0,E=0;;){if(x=p+(b<<3)|0,lt=x,!(eT(h[lt>>2]|0,h[lt+4>>2]|0)|0)){v=5,je=159;break}if(lt=x,lt=(nL(h[lt>>2]|0,h[lt+4>>2]|0)|0)==(v|0),b=At(b|0,E|0,1,0)|0,E=ee()|0,!lt){v=12,je=159;break}if(!((E|0)<(g|0)|(E|0)==(g|0)&b>>>0<m>>>0)){je=8;break}}if((je|0)==8){do if((g|0)>0|(g|0)==0&m>>>0>1){if(v=m<<3,b=yr(v)|0,!b)return lt=13,Q=pt,lt|0;for(cu(b|0,p|0,v|0)|0,rT(b,m,8,1),v=1,x=0;Ut=b+(v<<3)|0,lt=b+(v+-1<<3)|0,lt=(h[Ut>>2]|0)==(h[lt>>2]|0)?(h[Ut+4>>2]|0)==(h[lt+4>>2]|0):0,v=At(v|0,x|0,1,0)|0,x=ee()|0,!lt;)if(!((x|0)<(g|0)|(x|0)==(g|0)&v>>>0<m>>>0)){je=14;break}if((je|0)==14){_t(b);break}return _t(b),lt=10,Q=pt,lt|0}while(!1);if(v=br(m|0,g|0,6,0)|0,x=ee()|0,M){b=0,E=0;do lt=p+(E<<3)|0,lt=((Zi(h[lt>>2]|0,h[lt+4>>2]|0)|0)!=0)<<31>>31,v=At(v|0,x|0,lt|0,((lt|0)<0)<<31>>31|0)|0,x=ee()|0,E=At(E|0,b|0,1,0)|0,b=ee()|0;while((b|0)<(g|0)|(b|0)==(g|0)&E>>>0<m>>>0);Ae=v,we=x}else Ae=v,we=x;if(xe=br(Ae|0,we|0,10,0)|0,se=ee()|0,Ut=yr(Ae<<5)|0,!Ut)return lt=13,Q=pt,lt|0;if(lt=Ta(xe,4)|0,!lt)return _t(Ut),lt=13,Q=pt,lt|0;e:do if(M){for(be=p,JP(h[be>>2]|0,h[be+4>>2]|0,gt)|0,X=Ut,K=0,ae=0,v=0,ue=0;;){M=gt,M=(h[M>>2]|0)==0&(h[M+4>>2]|0)==0,x=M?26990:26995,b=M?5:6,E=0,M=gt+((M&1)<<3)|0,N=At(b|0,E|0,-1,-1)|0,O=ee()|0,q=0,j=0;do Me=M+(q<<3)|0,Ke=h[Me+4>>2]|0,be=X+(q<<5)|0,h[be>>2]=h[Me>>2],h[be+4>>2]=Ke,He[X+(q<<5)+9>>0]=0,He[X+(q<<5)+8>>0]=0,h[X+(q<<5)+20>>2]=X,be=X+(q<<5)+24|0,h[be>>2]=1,h[be+4>>2]=0,be=He[x+q>>0]|0,Ke=At(N|0,O|0,q|0,j|0)|0,Ke=Gf(Ke|0,ee()|0,b|0,E|0)|0,ee()|0,Ke=He[x+Ke>>0]|0,q=At(q|0,j|0,1,0)|0,j=ee()|0,Me=He[x+((q|0)==(b|0)&(j|0)==(E|0)?0:q)>>0]|0,be=be&255,h[X+(be<<5)+16>>2]=X+((Ke&255)<<5),h[X+(be<<5)+12>>2]=X+((Me&255)<<5);while(j>>>0<E>>>0|(j|0)==(E|0)&q>>>0<b>>>0);if(K=At(K|0,ae|0,1,0)|0,ae=ee()|0,v=At(b|0,E|0,v|0,ue|0)|0,ue=ee()|0,!((ae|0)<(g|0)|(ae|0)==(g|0)&K>>>0<m>>>0))break e;be=p+(K<<3)|0,JP(h[be>>2]|0,h[be+4>>2]|0,gt)|0||(X=Ut+(v<<5)|0)}di(27634,26956,108,26975)}while(!1);if((we|0)>0|(we|0)==0&Ae>>>0>0){E=0,M=0;do{if(x=Ut+(E<<5)|0,b=h[x>>2]|0,x=h[x+4>>2]|0,v=tt(b|0,x|0,30)|0,x=br(v^b|0,(ee()|0)^x|0,484763065,-1084733587)|0,b=ee()|0,v=tt(x|0,b|0,27)|0,b=br(v^x|0,(ee()|0)^b|0,321982955,-1798288965)|0,x=ee()|0,v=tt(b|0,x|0,31)|0,x=Gf(v^b|0,(ee()|0)^x|0,xe|0,se|0)|0,b=ee()|0,v=lt+(x<<2)|0,h[v>>2]|0)do v=At(x|0,b|0,1,0)|0,x=rp(v|0,ee()|0,xe|0,se|0)|0,b=ee()|0,v=lt+(x<<2)|0;while((h[v>>2]|0)!=0);h[v>>2]=Ut+(E<<5),E=At(E|0,M|0,1,0)|0,M=ee()|0}while((M|0)<(we|0)|(M|0)==(we|0)&E>>>0<Ae>>>0);q=0,j=0;do{if(E=Ut+(q<<5)|0,M=Ut+(q<<5)+9|0,!(He[M>>0]|0)){if(be=E,HG(h[be>>2]|0,h[be+4>>2]|0,gt)|0){je=39;break}O=gt,N=h[O>>2]|0,O=h[O+4>>2]|0,x=tt(N|0,O|0,30)|0,x=br(x^N|0,(ee()|0)^O|0,484763065,-1084733587)|0,b=ee()|0,v=tt(x|0,b|0,27)|0,b=br(v^x|0,(ee()|0)^b|0,321982955,-1798288965)|0,x=ee()|0,v=tt(b|0,x|0,31)|0,x=Gf(v^b|0,(ee()|0)^x|0,xe|0,se|0)|0,b=ee()|0,v=h[lt+(x<<2)>>2]|0;e:do if(v|0){for(;be=v,!((h[be>>2]|0)==(N|0)&&(h[be+4>>2]|0)==(O|0));)if(v=At(x|0,b|0,1,0)|0,x=rp(v|0,ee()|0,xe|0,se|0)|0,b=ee()|0,v=h[lt+(x<<2)>>2]|0,!v)break e;He[M>>0]=1,He[v+9>>0]=1,x=v+16|0,be=Ut+(q<<5)+12|0,h[(h[be>>2]|0)+16>>2]=h[x>>2],g=v+12|0,Me=h[Ut+(q<<5)+16>>2]|0,h[Me+12>>2]=h[g>>2],h[(h[g>>2]|0)+16>>2]=Me,h[(h[x>>2]|0)+12>>2]=h[be>>2],x=JS(E)|0,be=JS(v)|0,v=x+24|0,g=h[v+4>>2]|0,Me=be+24|0,Ke=h[Me+4>>2]|0,Me=(g|0)<(Ke|0)|((g|0)==(Ke|0)?(h[v>>2]|0)>>>0<(h[Me>>2]|0)>>>0:0),v=Me?x:be,x=Me?be:x,(x|0)!=(v|0)&&(Ke=v+24|0,be=x+24|0,Me=be,Ke=At(h[Me>>2]|0,h[Me+4>>2]|0,h[Ke>>2]|0,h[Ke+4>>2]|0)|0,Me=ee()|0,h[be>>2]=Ke,h[be+4>>2]=Me,h[v+20>>2]=x)}while(!1)}q=At(q|0,j|0,1,0)|0,j=ee()|0}while((j|0)<(we|0)|(j|0)==(we|0)&q>>>0<Ae>>>0);(je|0)==39&&di(27634,26956,258,27001),v=0,x=0;do He[Ut+(v<<5)+8>>0]=0,v=At(v|0,x|0,1,0)|0,x=ee()|0;while((x|0)<(we|0)|(x|0)==(we|0)&v>>>0<Ae>>>0);for(N=0,b=0,M=0,O=0;;){if(v=Ut+(N<<5)|0,(He[Ut+(N<<5)+8>>0]|0)==0&&(He[Ut+(N<<5)+9>>0]|0)==0){E=v,x=h[E>>2]|0,E=h[E+4>>2]|0;do He[v+8>>0]=1,v=h[v+12>>2]|0,be=v;while(!((h[be>>2]|0)==(x|0)&&(h[be+4>>2]|0)==(E|0)));b=At(b|0,M|0,1,0)|0,E=ee()|0}else E=M;if(N=At(N|0,O|0,1,0)|0,O=ee()|0,(O|0)<(we|0)|(O|0)==(we|0)&N>>>0<Ae>>>0)M=E;else break}v=0,x=0;do He[Ut+(v<<5)+8>>0]=0,v=At(v|0,x|0,1,0)|0,x=ee()|0;while((x|0)<(we|0)|(x|0)==(we|0)&v>>>0<Ae>>>0);Me=b,Ke=E,v=1}else Me=0,Ke=0,v=0;be=yr(Me*24|0)|0;e:do if(be|0){t:do if(v){p=0,xe=0,g=0,m=0;n:for(;;){if(v=Ut+(p<<5)|0,(He[Ut+(p<<5)+8>>0]|0)==0&&(He[Ut+(p<<5)+9>>0]|0)==0){ue=v,ae=h[ue>>2]|0,ue=h[ue+4>>2]|0,x=0,b=0;do x=At(x|0,b|0,2,0)|0,b=ee()|0,v=h[v+12>>2]|0,se=v;while(!((h[se>>2]|0)==(ae|0)&&(h[se+4>>2]|0)==(ue|0)));if(K=yr(x<<4)|0,!K)break;x=ae,b=ue,X=0,j=0,E=0,M=0;do{if(Ux(x,b,Be)|0){je=69;break n}if(se=h[Be>>2]|0,O=se+-1|0,q=((O|0)<0)<<31>>31,(se|0)>1){b=E,N=0,x=M,E=0;do se=K+(b<<4)|0,M=Be+8+(N<<4)|0,h[se>>2]=h[M>>2],h[se+4>>2]=h[M+4>>2],h[se+8>>2]=h[M+8>>2],h[se+12>>2]=h[M+12>>2],b=At(b|0,x|0,1,0)|0,x=ee()|0,N=At(N|0,E|0,1,0)|0,E=ee()|0;while((E|0)<(q|0)|(E|0)==(q|0)&N>>>0<O>>>0);E=b,M=x}X=At(X|0,j|0,O|0,q|0)|0,j=ee()|0,He[v+8>>0]=1,v=h[v+12>>2]|0,b=v,x=h[b>>2]|0,b=h[b+4>>2]|0}while(!((x|0)==(ae|0)&(b|0)==(ue|0)));if(x=Iue(K,X<<4)|0,!x){je=75;break}ue=JS(v)|0,se=h[ue+4>>2]|0,v=be+(g*24|0)|0,h[v>>2]=h[ue>>2],h[v+4>>2]=se,v=be+(g*24|0)+16|0,h[v>>2]=X,h[be+(g*24|0)+20>>2]=x,h[gt>>2]=h[v>>2],h[gt+4>>2]=h[v+4>>2],Ac(gt,be+(g*24|0)+8|0)|0,x=At(g|0,xe|0,1,0)|0,v=ee()|0}else x=g,v=xe;if(p=At(p|0,m|0,1,0)|0,m=ee()|0,(m|0)<(we|0)|(m|0)==(we|0)&p>>>0<Ae>>>0)xe=v,g=x;else break t}if((je|0)==69?di(27634,26956,351,27016):(je|0)==75&&_t(K),(xe|0)>0|(xe|0)==0&g>>>0>0)for(E=0,M=0,v=g,b=xe;x=h[be+(E*24|0)+20>>2]|0,x?(_t(x),x=xe,v=g):x=b,E=At(E|0,M|0,1,0)|0,M=ee()|0,(M|0)<(x|0)|(M|0)==(x|0)&E>>>0<v>>>0;)b=x;_t(be);break e}while(!1);rT(be,Me,24,2);t:do if((Me|0)==0&(Ke|0)==0){if(se=yr(192)|0,se|0){if(h[se+16>>2]=0,h[se+20>>2]=0,j=se+8|0,h[j>>2]=3,v=yr(48)|0,X=se+12|0,h[X>>2]=v,v|0){h[v>>2]=h[3860],h[v+4>>2]=h[3861],h[v+8>>2]=h[3862],h[v+12>>2]=h[3863],q=v+16|0,h[q>>2]=h[3864],h[q+4>>2]=h[3865],h[q+8>>2]=h[3866],h[q+12>>2]=h[3867],q=v+32|0,h[q>>2]=h[3868],h[q+4>>2]=h[3869],h[q+8>>2]=h[3870],h[q+12>>2]=h[3871],h[gt>>2]=h[j>>2],h[gt+4>>2]=h[j+4>>2],Ac(gt,se)|0,h[se+40>>2]=0,h[se+44>>2]=0,q=se+32|0,h[q>>2]=3,v=yr(48)|0,K=se+36|0,h[K>>2]=v;do if(!v)E=0,M=1;else{if(h[v>>2]=h[3872],h[v+4>>2]=h[3873],h[v+8>>2]=h[3874],h[v+12>>2]=h[3875],O=v+16|0,h[O>>2]=h[3876],h[O+4>>2]=h[3877],h[O+8>>2]=h[3878],h[O+12>>2]=h[3879],O=v+32|0,h[O>>2]=h[3880],h[O+4>>2]=h[3881],h[O+8>>2]=h[3882],h[O+12>>2]=h[3883],h[gt>>2]=h[q>>2],h[gt+4>>2]=h[q+4>>2],Ac(gt,se+24|0)|0,h[se+64>>2]=0,h[se+68>>2]=0,O=se+56|0,h[O>>2]=3,v=yr(48)|0,ae=se+60|0,h[ae>>2]=v,!v){E=0,M=2;break}if(h[v>>2]=h[3884],h[v+4>>2]=h[3885],h[v+8>>2]=h[3886],h[v+12>>2]=h[3887],N=v+16|0,h[N>>2]=h[3888],h[N+4>>2]=h[3889],h[N+8>>2]=h[3890],h[N+12>>2]=h[3891],N=v+32|0,h[N>>2]=h[3892],h[N+4>>2]=h[3893],h[N+8>>2]=h[3894],h[N+12>>2]=h[3895],h[gt>>2]=h[O>>2],h[gt+4>>2]=h[O+4>>2],Ac(gt,se+48|0)|0,h[se+88>>2]=0,h[se+92>>2]=0,N=se+80|0,h[N>>2]=3,v=yr(48)|0,ue=se+84|0,h[ue>>2]=v,!v){E=0,M=3;break}if(h[v>>2]=h[3896],h[v+4>>2]=h[3897],h[v+8>>2]=h[3898],h[v+12>>2]=h[3899],M=v+16|0,h[M>>2]=h[3900],h[M+4>>2]=h[3901],h[M+8>>2]=h[3902],h[M+12>>2]=h[3903],M=v+32|0,h[M>>2]=h[3904],h[M+4>>2]=h[3905],h[M+8>>2]=h[3906],h[M+12>>2]=h[3907],h[gt>>2]=h[N>>2],h[gt+4>>2]=h[N+4>>2],Ac(gt,se+72|0)|0,h[se+112>>2]=0,h[se+116>>2]=0,M=se+104|0,h[M>>2]=3,v=yr(48)|0,p=se+108|0,h[p>>2]=v,!v){E=0,M=4;break}if(h[v>>2]=h[3908],h[v+4>>2]=h[3909],h[v+8>>2]=h[3910],h[v+12>>2]=h[3911],E=v+16|0,h[E>>2]=h[3912],h[E+4>>2]=h[3913],h[E+8>>2]=h[3914],h[E+12>>2]=h[3915],E=v+32|0,h[E>>2]=h[3916],h[E+4>>2]=h[3917],h[E+8>>2]=h[3918],h[E+12>>2]=h[3919],h[gt>>2]=h[M>>2],h[gt+4>>2]=h[M+4>>2],Ac(gt,se+96|0)|0,h[se+136>>2]=0,h[se+140>>2]=0,E=se+128|0,h[E>>2]=3,v=yr(48)|0,m=se+132|0,h[m>>2]=v,!v){E=0,M=5;break}if(h[v>>2]=h[3920],h[v+4>>2]=h[3921],h[v+8>>2]=h[3922],h[v+12>>2]=h[3923],b=v+16|0,h[b>>2]=h[3924],h[b+4>>2]=h[3925],h[b+8>>2]=h[3926],h[b+12>>2]=h[3927],b=v+32|0,h[b>>2]=h[3928],h[b+4>>2]=h[3929],h[b+8>>2]=h[3930],h[b+12>>2]=h[3931],h[gt>>2]=h[E>>2],h[gt+4>>2]=h[E+4>>2],Ac(gt,se+120|0)|0,h[se+160>>2]=0,h[se+164>>2]=0,b=se+152|0,h[b>>2]=3,v=yr(48)|0,g=se+156|0,h[g>>2]=v,!v){E=0,M=6;break}if(h[v>>2]=h[3932],h[v+4>>2]=h[3933],h[v+8>>2]=h[3934],h[v+12>>2]=h[3935],x=v+16|0,h[x>>2]=h[3936],h[x+4>>2]=h[3937],h[x+8>>2]=h[3938],h[x+12>>2]=h[3939],x=v+32|0,h[x>>2]=h[3940],h[x+4>>2]=h[3941],h[x+8>>2]=h[3942],h[x+12>>2]=h[3943],h[gt>>2]=h[b>>2],h[gt+4>>2]=h[b+4>>2],Ac(gt,se+144|0)|0,h[se+184>>2]=0,h[se+188>>2]=0,x=se+176|0,h[x>>2]=3,v=yr(48)|0,xe=se+180|0,h[xe>>2]=v,!v){E=0,M=7;break}if(h[v>>2]=h[3944],h[v+4>>2]=h[3945],h[v+8>>2]=h[3946],h[v+12>>2]=h[3947],Be=v+16|0,h[Be>>2]=h[3948],h[Be+4>>2]=h[3949],h[Be+8>>2]=h[3950],h[Be+12>>2]=h[3951],v=v+32|0,h[v>>2]=h[3952],h[v+4>>2]=h[3953],h[v+8>>2]=h[3954],h[v+12>>2]=h[3955],h[gt>>2]=h[x>>2],h[gt+4>>2]=h[x+4>>2],Ac(gt,se+168|0)|0,rT(se,8,24,3),v=yr(128)|0,h[_+4>>2]=v,v|0){h[_>>2]=8,h[v>>2]=h[j>>2],h[v+4>>2]=h[j+4>>2],h[v+8>>2]=h[j+8>>2],h[v+12>>2]=h[j+12>>2],je=v+16|0,h[je>>2]=h[q>>2],h[je+4>>2]=h[q+4>>2],h[je+8>>2]=h[q+8>>2],h[je+12>>2]=h[q+12>>2],je=v+32|0,h[je>>2]=h[O>>2],h[je+4>>2]=h[O+4>>2],h[je+8>>2]=h[O+8>>2],h[je+12>>2]=h[O+12>>2],je=v+48|0,h[je>>2]=h[N>>2],h[je+4>>2]=h[N+4>>2],h[je+8>>2]=h[N+8>>2],h[je+12>>2]=h[N+12>>2],je=v+64|0,h[je>>2]=h[M>>2],h[je+4>>2]=h[M+4>>2],h[je+8>>2]=h[M+8>>2],h[je+12>>2]=h[M+12>>2],je=v+80|0,h[je>>2]=h[E>>2],h[je+4>>2]=h[E+4>>2],h[je+8>>2]=h[E+8>>2],h[je+12>>2]=h[E+12>>2],je=v+96|0,h[je>>2]=h[b>>2],h[je+4>>2]=h[b+4>>2],h[je+8>>2]=h[b+8>>2],h[je+12>>2]=h[b+12>>2],je=v+112|0,h[je>>2]=h[x>>2],h[je+4>>2]=h[x+4>>2],h[je+8>>2]=h[x+8>>2],h[je+12>>2]=h[x+12>>2],_t(se),je=158;break t}v=h[X>>2]|0,v|0&&_t(v),v=h[K>>2]|0,v|0&&_t(v),v=h[ae>>2]|0,v|0&&_t(v),v=h[ue>>2]|0,v|0&&_t(v),v=h[p>>2]|0,v|0&&_t(v),v=h[m>>2]|0,v|0&&_t(v),v=h[g>>2]|0,v|0&&_t(v),v=h[xe>>2]|0,v|0&&_t(v),_t(se);break t}while(!1);v=0,b=0;do x=h[se+(v*24|0)+12>>2]|0,x|0&&_t(x),v=At(v|0,b|0,1,0)|0,b=ee()|0;while(b>>>0<E>>>0|(b|0)==(E|0)&v>>>0<M>>>0)}_t(se),je=152}}else{if((Ke|0)>0|(Ke|0)==0&Me>>>0>0){b=0,E=0,M=0,x=0,v=0,N=0;do Be=be+(b*24|0)|0,gt=E,E=h[Be>>2]|0,je=M,M=h[Be+4>>2]|0,x=At(x|0,v|0,((E|0)!=(gt|0)|(M|0)!=(je|0))&1|0,0)|0,v=ee()|0,b=At(b|0,N|0,1,0)|0,N=ee()|0;while((N|0)<(Ke|0)|(N|0)==(Ke|0)&b>>>0<Me>>>0);ue=x,ae=v}else ue=0,ae=0;if(p=yr(ue*24|0)|0,p){n:do if((Ke|0)>=0){for(j=0,X=0,x=0,b=0,K=0,E=0;;){if(!((j|0)==(Me|0)&(X|0)==(Ke|0))&&(gt=be+(x*24|0)|0,je=be+(j*24|0)|0,(h[gt>>2]|0)==(h[je>>2]|0)?(h[gt+4>>2]|0)==(h[je+4>>2]|0):0))v=K;else{if(O=be+(x*24|0)|0,je=eo(j|0,X|0,x|0,b|0)|0,gt=ee()|0,q=At(je|0,gt|0,-1,-1)|0,b=ee()|0,(gt|0)>0|(gt|0)==0&je>>>0>1){if(v=yr(q<<3)|0,!v)break;M=0,N=0;do je=M,M=At(M|0,N|0,1,0)|0,N=ee()|0,Be=O+(M*24|0)+16|0,gt=h[Be+4>>2]|0,je=v+(je<<3)|0,h[je>>2]=h[Be>>2],h[je+4>>2]=gt;while((N|0)<(b|0)|(N|0)==(b|0)&M>>>0<q>>>0)}else v=0;gt=be+(x*24|0)+16|0,je=h[gt+4>>2]|0,b=p+(E*24|0)+8|0,h[b>>2]=h[gt>>2],h[b+4>>2]=je,h[p+(E*24|0)+16>>2]=q,h[p+(E*24|0)+20>>2]=v,ie[p+(E*24|0)>>3]=+ie[be+(x*24|0)+8>>3],E=At(E|0,K|0,1,0)|0,x=j,b=X,v=ee()|0}if(je=j,j=At(j|0,X|0,1,0)|0,gt=X,X=ee()|0,(gt|0)<(Ke|0)|(gt|0)==(Ke|0)&je>>>0<Me>>>0)K=v;else break n}if((K|0)>0|(K|0)==0&E>>>0>0){v=0,b=0;do x=h[p+(v*24|0)+20>>2]|0,x|0&&_t(x),v=At(v|0,b|0,1,0)|0,b=ee()|0;while((b|0)<(K|0)|(b|0)==(K|0)&v>>>0<E>>>0)}_t(p),je=152;break t}while(!1);if(rT(p,ue,24,3),v=yr(ue<<4)|0,b=_+4|0,h[b>>2]=v,v){h[_>>2]=ue;do if((ae|0)>0|(ae|0)==0&ue>>>0>0){if(_=p+8|0,h[v>>2]=h[_>>2],h[v+4>>2]=h[_+4>>2],h[v+8>>2]=h[_+8>>2],h[v+12>>2]=h[_+12>>2],(ue|0)==1&(ae|0)==0||(_=v+16|0,je=p+32|0,h[_>>2]=h[je>>2],h[_+4>>2]=h[je+4>>2],h[_+8>>2]=h[je+8>>2],h[_+12>>2]=h[je+12>>2],!((ae|0)>0|(ae|0)==0&ue>>>0>2)))break;v=2,x=0;do _=(h[b>>2]|0)+(v<<4)|0,je=p+(v*24|0)+8|0,h[_>>2]=h[je>>2],h[_+4>>2]=h[je+4>>2],h[_+8>>2]=h[je+8>>2],h[_+12>>2]=h[je+12>>2],v=At(v|0,x|0,1,0)|0,x=ee()|0;while((x|0)<(ae|0)|(x|0)==(ae|0)&v>>>0<ue>>>0)}while(!1);_t(p),je=158;break}else{if((ae|0)>0|(ae|0)==0&ue>>>0>0){v=0,b=0;do x=h[p+(v*24|0)+20>>2]|0,x|0&&_t(x),v=At(v|0,b|0,1,0)|0,b=ee()|0;while((b|0)<(ae|0)|(b|0)==(ae|0)&v>>>0<ue>>>0)}_t(p),je=152;break}}else je=152}while(!1);if((je|0)==158)return _t(Ut),_t(lt),_t(be),lt=0,Q=pt,lt|0;if((je|0)==152&&(Ke|0)>0|(Ke|0)==0&Me>>>0>0)for(E=0,M=0,v=Me,b=Ke;x=h[be+(E*24|0)+20>>2]|0,x?(_t(x),x=Ke,v=Me):x=b,E=At(E|0,M|0,1,0)|0,M=ee()|0,(M|0)<(x|0)|(M|0)==(x|0)&E>>>0<v>>>0;)b=x;return _t(be),_t(Ut),_t(lt),lt=13,Q=pt,lt|0}while(!1);return _t(Ut),_t(lt),lt=13,Q=pt,lt|0}else if((je|0)==159)return Q=pt,v|0;return 0}function Ice(p,m){p=p|0,m=m|0;var g=0,_=0;return _=p,p=h[_>>2]|0,_=h[_+4>>2]|0,g=m,m=h[g>>2]|0,g=h[g+4>>2]|0,(_>>>0<g>>>0|(_|0)==(g|0)&p>>>0<m>>>0?-1:(_>>>0>g>>>0|(_|0)==(g|0)&p>>>0>m>>>0)&1)|0}function JS(p){p=p|0;var m=0,g=0;return m=p+20|0,g=h[m>>2]|0,(g|0)==(p|0)?p|0:(g=JS(g)|0,h[m>>2]=g,g|0)}function Pce(p,m){p=p|0,m=m|0;var g=0,_=0,v=0,x=0,b=0,E=0;return E=p,b=h[E>>2]|0,E=h[E+4>>2]|0,x=m,v=h[x>>2]|0,x=h[x+4>>2]|0,E>>>0<x>>>0|(E|0)==(x|0)&b>>>0<v>>>0?(m=-1,m|0):E>>>0>x>>>0|(E|0)==(x|0)&b>>>0>v>>>0?(m=1,m|0):(_=+ie[p+8>>3],g=+ie[m+8>>3],_<g?(m=-1,m|0):(m=_>g&1,m|0))}function Lce(p,m){p=p|0,m=m|0;var g=0,_=0;return _=+ie[p>>3],g=+ie[m>>3],(_>g?-1:_<g&1)|0}function Dce(p,m,g,_,v){p=p|0,m=m|0,g=g|0,_=_|0,v=v|0;var x=0,b=0,E=0,M=0,N=0,O=0,q=0;if(q=Q,Q=Q+64|0,O=q,E=q+56|0,!(!0&(m&2013265920|0)==134217728&(!0&(_&2013265920|0)==134217728)))return v=5,Q=q,v|0;if((p|0)==(g|0)&(m|0)==(_|0))return h[v>>2]=0,v=0,Q=q,v|0;if(b=tt(p|0,m|0,52)|0,ee()|0,b=b&15,N=tt(g|0,_|0,52)|0,ee()|0,(b|0)!=(N&15|0))return v=12,Q=q,v|0;if(x=b+-1|0,b>>>0>1){rL(p,m,x,O)|0,rL(g,_,x,E)|0,N=O,M=h[N>>2]|0,N=h[N+4>>2]|0;e:do if((M|0)==(h[E>>2]|0)&&(N|0)==(h[E+4>>2]|0)){b=(b^15)*3|0,x=tt(p|0,m|0,b|0)|0,ee()|0,x=x&7,b=tt(g|0,_|0,b|0)|0,ee()|0,b=b&7;do if((x|0)==0|(b|0)==0)h[v>>2]=1,x=0;else if((x|0)==7)x=5;else{if((x|0)==1|(b|0)==1&&Zi(M,N)|0){x=5;break}if((h[15824+(x<<2)>>2]|0)!=(b|0)&&(h[15856+(x<<2)>>2]|0)!=(b|0))break e;h[v>>2]=1,x=0}while(!1);return v=x,Q=q,v|0}while(!1)}x=O,b=x+56|0;do h[x>>2]=0,x=x+4|0;while((x|0)<(b|0));return LG(p,m,1,O)|0,m=O,!((h[m>>2]|0)==(g|0)&&(h[m+4>>2]|0)==(_|0))&&(m=O+8|0,!((h[m>>2]|0)==(g|0)&&(h[m+4>>2]|0)==(_|0)))&&(m=O+16|0,!((h[m>>2]|0)==(g|0)&&(h[m+4>>2]|0)==(_|0)))&&(m=O+24|0,!((h[m>>2]|0)==(g|0)&&(h[m+4>>2]|0)==(_|0)))&&(m=O+32|0,!((h[m>>2]|0)==(g|0)&&(h[m+4>>2]|0)==(_|0)))&&(m=O+40|0,!((h[m>>2]|0)==(g|0)&&(h[m+4>>2]|0)==(_|0)))?(x=O+48|0,x=((h[x>>2]|0)==(g|0)?(h[x+4>>2]|0)==(_|0):0)&1):x=1,h[v>>2]=x,v=0,Q=q,v|0}function Nce(p,m,g,_,v){return p=p|0,m=m|0,g=g|0,_=_|0,v=v|0,g=QS(p,m,g,_)|0,(g|0)==7?(v=11,v|0):(_=ft(g|0,0,56)|0,m=m&-2130706433|(ee()|0)|268435456,h[v>>2]=p|_,h[v+4>>2]=m,v=0,v|0)}function Fce(p,m,g){return p=p|0,m=m|0,g=g|0,!0&(m&2013265920|0)==268435456?(h[g>>2]=p,h[g+4>>2]=m&-2130706433|134217728,g=0,g|0):(g=6,g|0)}function Bce(p,m,g){p=p|0,m=m|0,g=g|0;var _=0,v=0,x=0;return v=Q,Q=Q+16|0,_=v,h[_>>2]=0,!0&(m&2013265920|0)==268435456?(x=tt(p|0,m|0,56)|0,ee()|0,_=Js(p,m&-2130706433|134217728,x&7,_,g)|0,Q=v,_|0):(_=6,Q=v,_|0)}function qG(p,m){p=p|0,m=m|0;var g=0;switch(g=tt(p|0,m|0,56)|0,ee()|0,g&7){case 0:case 7:return g=0,g|0;default:}return g=m&-2130706433|134217728,!(!0&(m&2013265920|0)==268435456)||!0&(m&117440512|0)==16777216&(Zi(p,g)|0)!=0?(g=0,g|0):(g=eT(p,g)|0,g|0)}function Oce(p,m,g){p=p|0,m=m|0,g=g|0;var _=0,v=0,x=0,b=0;return v=Q,Q=Q+16|0,_=v,!0&(m&2013265920|0)==268435456?(x=m&-2130706433|134217728,b=g,h[b>>2]=p,h[b+4>>2]=x,h[_>>2]=0,m=tt(p|0,m|0,56)|0,ee()|0,_=Js(p,x,m&7,_,g+8|0)|0,Q=v,_|0):(_=6,Q=v,_|0)}function JP(p,m,g){p=p|0,m=m|0,g=g|0;var _=0,v=0;return v=(Zi(p,m)|0)==0,m=m&-2130706433,_=g,h[_>>2]=v?p:0,h[_+4>>2]=v?m|285212672:0,_=g+8|0,h[_>>2]=p,h[_+4>>2]=m|301989888,_=g+16|0,h[_>>2]=p,h[_+4>>2]=m|318767104,_=g+24|0,h[_>>2]=p,h[_+4>>2]=m|335544320,_=g+32|0,h[_>>2]=p,h[_+4>>2]=m|352321536,g=g+40|0,h[g>>2]=p,h[g+4>>2]=m|369098752,0}function Ux(p,m,g){p=p|0,m=m|0,g=g|0;var _=0,v=0,x=0,b=0;return b=Q,Q=Q+16|0,v=b,x=m&-2130706433|134217728,!0&(m&2013265920|0)==268435456?(_=tt(p|0,m|0,56)|0,ee()|0,_=Mue(p,x,_&7)|0,(_|0)==-1?(h[g>>2]=0,x=6,Q=b,x|0):(g1(p,x,v)|0&&di(27634,27035,282,27050),m=tt(p|0,m|0,52)|0,ee()|0,m=m&15,Zi(p,x)|0?eL(v,m,_,2,g):tL(v,m,_,2,g),x=0,Q=b,x|0)):(x=6,Q=b,x|0)}function HG(p,m,g){p=p|0,m=m|0,g=g|0;var _=0,v=0,x=0,b=0;return b=Q,Q=Q+16|0,_=b+8|0,v=b,x=m&-2130706433|134217728,!0&(m&2013265920|0)==268435456?(h[_>>2]=0,m=tt(p|0,m|0,56)|0,ee()|0,m=Js(p,x,m&7,_,v)|0,m|0?(g=m,Q=b,g|0):(_=h[v>>2]|0,v=h[v+4>>2]|0,m=QS(_,v,p,x)|0,(m|0)==7?(g=11,Q=b,g|0):(p=ft(m|0,0,56)|0,x=v&-2130706433|(ee()|0)|268435456,h[g>>2]=_|p,h[g+4>>2]=x,g=0,Q=b,g|0))):(g=6,Q=b,g|0)}function Uce(p,m,g){p=p|0,m=m|0,g=g|0;var _=0,v=0,x=0,b=0,E=0,M=0,N=0,O=0,q=0,j=0,X=0,K=0,ae=0,ue=0,xe=0,se=0,we=0,Ae=0,Be=0;h[g>>2]=0,N=+ie[p>>3],O=+ie[p+8>>3],M=+ie[p+16>>3],v=0,x=5,_=5,p=0;do ae=+ie[15888+(v*24|0)>>3]-N,K=+ie[15888+(v*24|0)+8>>3]-O,b=+ie[15888+(v*24|0)+16>>3]-M,b=ae*ae+K*K+b*b,b<_&&(h[g>>2]=v,x=b,p=v,_=b),v=v+1|0;while((v|0)!=20);if(x=+Kle(+(1-x*.5)),x<1e-16)M=0,b=0;else{if(Ae=+ie[16368+(p*24|0)>>3],se=+ie[15888+(p*24|0)>>3],we=+ie[15888+(p*24|0)+8>>3],xe=+ie[15888+(p*24|0)+16>>3],Be=-(xe+(se*0+we*0)),b=se*Be+0,ae=we*Be+0,Be=xe*Be+1,ue=+bs(+(Be*Be+(b*b+ae*ae))),ue=ue>0?1/ue:0,b=b*ue,ae=ae*ue,ue=Be*ue,Be=-(N*se+O*we+M*xe),K=N+se*Be,_=O+we*Be,N=M+xe*Be,O=+bs(+(N*N+(K*K+_*_))),O=O>0?1/O:0,K=K*O,_=_*O,O=N*O,_=+Vx(Ae-+Vx(+Sa(+(O*(we*b-se*ae)+(K*(xe*ae-we*ue)+_*(se*ue-xe*b))),+(ue*O+(b*K+ae*_))))),gc(m)|0?b=+Vx(_+-.3334731722518321):b=_,_=+KS(+x)*2.618033988749896,(m|0)>0){p=0;do _=_*2.6457513110645907,p=p+1|0;while((p|0)!=(m|0))}M=+ii(+b)*_,b=+zi(+b)*_}m=g+4|0,X=g+12|0,h[X>>2]=0,x=+Qs(+b)*1.1547005383792515,_=+Qs(+M)+x*.5,p=~~_,v=~~x,_=_-+(p|0),x=x-+(v|0);do if(_<.5)if(_<.3333333333333333)if(h[m>>2]=p,x<(_+1)*.5){h[g+8>>2]=v;break}else{v=v+1|0,h[g+8>>2]=v;break}else if(Be=1-_,v=(!(x<Be)&1)+v|0,h[g+8>>2]=v,Be<=x&x<_*2){p=p+1|0,h[m>>2]=p;break}else{h[m>>2]=p;break}else{if(!(_<.6666666666666666))if(p=p+1|0,h[m>>2]=p,x<_*.5){h[g+8>>2]=v;break}else{v=v+1|0,h[g+8>>2]=v;break}if(x<1-_){if(h[g+8>>2]=v,_*2+-1<x){h[m>>2]=p;break}}else v=v+1|0,h[g+8>>2]=v;p=p+1|0,h[m>>2]=p}while(!1);do if(M<0)if(v&1){j=(v+1|0)/2|0,j=eo(p|0,((p|0)<0)<<31>>31|0,j|0,((j|0)<0)<<31>>31|0)|0,p=~~(+(p|0)-((+(j>>>0)+4294967296*+(ee()|0))*2+1)),h[m>>2]=p,j=m;break}else{j=(v|0)/2|0,j=eo(p|0,((p|0)<0)<<31>>31|0,j|0,((j|0)<0)<<31>>31|0)|0,p=~~(+(p|0)-(+(j>>>0)+4294967296*+(ee()|0))*2),h[m>>2]=p,j=m;break}else j=m;while(!1);q=g+8|0,m=0-v|0,b<0?(g=p-((v<<1|1|0)/2|0)|0,h[j>>2]=g,h[q>>2]=m,v=m):g=p,p=v-g|0,m=0-g|0,(g|0)<0?(h[q>>2]=p,h[X>>2]=m,h[j>>2]=0,E=0):(p=v,E=g,m=0),g=E-p|0,v=m-p|0,(p|0)<0?(h[j>>2]=g,h[X>>2]=v,h[q>>2]=0,E=g,p=0):v=m,g=E-v|0,m=p-v|0,(v|0)<0?(h[j>>2]=g,h[q>>2]=m,h[X>>2]=0,v=0):(m=p,g=E),p=(m|0)<(g|0)?m:g,p=(v|0)<(p|0)?v:p,!((p|0)<=0)&&(h[j>>2]=g-p,h[q>>2]=m-p,h[X>>2]=v-p)}function kce(p,m,g){p=p|0,m=m|0,g=g|0;var _=0,v=0,x=0,b=0;_=Q,Q=Q+16|0,v=_,b=h[p+12>>2]|0,x=+((h[p+8>>2]|0)-b|0),ie[v>>3]=+((h[p+4>>2]|0)-b|0)-x*.5,ie[v+8>>3]=x*.8660254037844386,kx(v,h[p>>2]|0,m,0,g),Q=_}function kx(p,m,g,_,v){p=p|0,m=m|0,g=g|0,_=_|0,v=v|0;var x=0,b=0,E=0,M=0,N=0,O=0,q=0,j=0,X=0,K=0,ae=0,ue=0;if(x=+Eue(p),x<1e-16){m=15888+(m*24|0)|0,h[v>>2]=h[m>>2],h[v+4>>2]=h[m+4>>2],h[v+8>>2]=h[m+8>>2],h[v+12>>2]=h[m+12>>2],h[v+16>>2]=h[m+16>>2],h[v+20>>2]=h[m+20>>2];return}if(b=+Sa(+ +ie[p+8>>3],+ +ie[p>>3]),(g|0)>0){p=0;do x=x*.37796447300922725,p=p+1|0;while((p|0)!=(g|0))}E=x*.3333333333333333,_?(g=(gc(g)|0)==0,x=+IG(+((g?E:E*.37796447300922725)*.381966011250105))):(x=+IG(+(x*.381966011250105)),gc(g)|0&&(b=+Vx(b+.3334731722518321))),q=+Vx(+ie[16368+(m*24|0)>>3]-b),E=+ie[15888+(m*24|0)>>3],O=+ie[15888+(m*24|0)+8>>3],ae=+ie[15888+(m*24|0)+16>>3],X=-(ae+(E*0+O*0)),N=E*X+0,b=O*X+0,X=ae*X+1,j=+bs(+(X*X+(N*N+b*b))),j=j>0?1/j:0,N=N*j,b=b*j,j=X*j,X=+ii(+q),q=+zi(+q),ue=+ii(+x),K=+zi(+x),M=ue*E+K*(X*N+q*(ae*b-O*j)),x=ue*O+K*(X*b+q*(E*j-ae*N)),b=ue*ae+K*(X*j+q*(O*N-E*b)),E=+bs(+(b*b+(M*M+x*x))),E=E>0?1/E:0,ie[v>>3]=M*E,ie[v+8>>3]=x*E,ie[v+16>>3]=b*E}function eL(p,m,g,_,v){p=p|0,m=m|0,g=g|0,_=_|0,v=v|0;var x=0,b=0,E=0,M=0,N=0,O=0,q=0,j=0,X=0,K=0,ae=0,ue=0,xe=0,se=0,we=0,Ae=0,Be=0,Ke=0,Me=0,be=0,gt=0,je=0,Ut=0,lt=0,pt=0,pi=0,bi=0,Ro=0,Vn=0,wi=0,Ea=0,Bs=0,os=0,Os=0,ws=0,ll=0,po=0,mo=0,_c=0,Io=0,Pi=0,Om=0;if(ll=Q,Q=Q+256|0,x=ll+240|0,pi=ll+224|0,os=ll,Os=ll+208|0,ws=ll+192|0,bi=ll+168|0,Ro=ll+152|0,Vn=ll+136|0,wi=ll+120|0,Ea=ll+104|0,Bs=ll+80|0,h[x>>2]=m,h[pi>>2]=h[p>>2],h[pi+4>>2]=h[p+4>>2],h[pi+8>>2]=h[p+8>>2],h[pi+12>>2]=h[p+12>>2],WG(pi,x,os),h[v>>2]=0,pi=_+g+((_|0)==5&1)|0,(pi|0)<=(g|0)){Q=ll;return}Ae=h[x>>2]|0,we=Os+4|0,xe=Os+8|0,se=Os+12|0,Be=ws+8|0,Ke=g+5|0,Me=16848+(Ae<<2)|0,be=bi+8|0,gt=16928+(Ae<<2)|0,je=Ro+8|0,Ut=Vn+8|0,lt=wi+8|0,pt=ws+8|0,X=bi+8|0,ae=bi+16|0,K=Bs+8|0,ue=Bs+16|0,j=g,_=0,b=0,E=0,M=0;e:for(;;){q=os+(((j|0)%5|0)<<4)|0,h[Os>>2]=h[q>>2],h[Os+4>>2]=h[q+4>>2],h[Os+8>>2]=h[q+8>>2],h[Os+12>>2]=h[q+12>>2];do;while((A1(Os,Ae,0,1)|0)==2);if((j|0)>(g|0)&(gc(m)|0)!=0){if(q=h[Os>>2]|0,p=h[we>>2]|0,N=h[xe>>2]|0,x=h[se>>2]|0,po=+(E-M|0),ie[ws>>3]=+(b-M|0)-po*.5,ie[Be>>3]=po*.8660254037844386,M=h[17008+(q*80|0)+(_<<2)>>2]|0,O=h[18608+(q*80|0)+(M*20|0)>>2]|0,E=h[18608+(q*80|0)+(M*20|0)+16>>2]|0,(E|0)>0){b=0,_=N;do Io=x+p|0,Pi=(Io|0)<0,N=_+p-(Pi?Io:0)|0,_c=(N|0)<0,mo=x+_-(Pi?Io:0)-(_c?N:0)|0,x=(mo|0)<0,p=(Pi?0:Io)-(_c?N:0)-(x?mo:0)|0,_=(_c?0:N)-(x?mo:0)|0,mo=x?0:mo,x=(_|0)<(p|0)?_:p,x=(mo|0)<(x|0)?mo:x,N=(x|0)>0,p=p-(N?x:0)|0,_=_-(N?x:0)|0,x=mo-(N?x:0)|0,b=b+1|0;while((b|0)<(E|0))}else _=N;switch(Pi=(h[Me>>2]|0)*3|0,mo=(ol(Pi,h[18608+(q*80|0)+(M*20|0)+4>>2]|0)|0)+p|0,N=(ol(Pi,h[18608+(q*80|0)+(M*20|0)+8>>2]|0)|0)+_|0,Pi=(ol(Pi,h[18608+(q*80|0)+(M*20|0)+12>>2]|0)|0)+x|0,M=(mo|0)<0,N=N-(M?mo:0)|0,_c=(N|0)<0,Pi=Pi+(M?0-mo|0:0)+(_c?0-N|0:0)|0,Io=(Pi|0)<0,mo=(M?0:mo)-(_c?N:0)-(Io?Pi:0)|0,N=(_c?0:N)-(Io?Pi:0)|0,Pi=Io?0:Pi,Io=(N|0)<(mo|0)?N:mo,Io=(Pi|0)<(Io|0)?Pi:Io,_c=(Io|0)>0,Pi=Pi-(_c?Io:0)|0,po=+(N-(_c?Io:0)-Pi|0),ie[bi>>3]=+(mo-(_c?Io:0)-Pi|0)-po*.5,ie[be>>3]=po*.8660254037844386,po=+(h[gt>>2]|0),ie[Ro>>3]=po*3,ie[je>>3]=0,Om=po*-1.5,ie[Vn>>3]=Om,ie[Ut>>3]=po*2.598076211353316,ie[wi>>3]=Om,ie[lt>>3]=po*-2.598076211353316,h[17008+(O*80|0)+(q<<2)>>2]|0){case 1:{p=Vn,_=Ro;break}case 3:{p=wi,_=Vn;break}case 2:{p=Ro,_=wi;break}default:{p=12;break e}}sq(ws,bi,_,p,Ea),kx(Ea,O,Ae,1,Bs),Pi=h[v>>2]|0,po=+Ox(+ +ie[ue>>3]),Om=+Sa(+ +ie[K>>3],+ +ie[Bs>>3]),ie[v+8+(Pi<<4)>>3]=po,ie[v+8+(Pi<<4)+8>>3]=Om,h[v>>2]=(h[v>>2]|0)+1}if((j|0)<(Ke|0)&&(Pi=h[se>>2]|0,po=+((h[xe>>2]|0)-Pi|0),ie[ws>>3]=+((h[we>>2]|0)-Pi|0)-po*.5,ie[pt>>3]=po*.8660254037844386,kx(ws,h[Os>>2]|0,Ae,1,bi),Pi=h[v>>2]|0,po=+Ox(+ +ie[ae>>3]),Om=+Sa(+ +ie[X>>3],+ +ie[bi>>3]),ie[v+8+(Pi<<4)>>3]=po,ie[v+8+(Pi<<4)+8>>3]=Om,h[v>>2]=(h[v>>2]|0)+1),j=j+1|0,(j|0)>=(pi|0)){p=3;break}else _=h[Os>>2]|0,b=h[we>>2]|0,E=h[xe>>2]|0,M=h[se>>2]|0}if((p|0)==3){Q=ll;return}else(p|0)==12&&di(27073,27120,599,27130)}function WG(p,m,g){p=p|0,m=m|0,g=g|0;var _=0,v=0,x=0,b=0,E=0,M=0,N=0,O=0,q=0,j=0,X=0,K=0;K=Q,Q=Q+128|0,_=K+64|0,v=K,x=_,b=20208,E=x+60|0;do h[x>>2]=h[b>>2],x=x+4|0,b=b+4|0;while((x|0)<(E|0));x=v,b=20272,E=x+60|0;do h[x>>2]=h[b>>2],x=x+4|0,b=b+4|0;while((x|0)<(E|0));if(O=(gc(h[m>>2]|0)|0)==0,O=O?_:v,X=p+4|0,x=h[X>>2]|0,q=p+8|0,_=h[q>>2]|0,j=p+12|0,v=h[j>>2]|0,b=_+(x<<1)|0,h[X>>2]=b,_=v+(_<<1)|0,h[q>>2]=_,x=(v<<1)+x|0,h[j>>2]=x,v=_-b|0,E=x-b|0,(b|0)<0&&(h[q>>2]=v,h[j>>2]=E,h[X>>2]=0,_=v,b=0,x=E),E=b-_|0,v=x-_|0,(_|0)<0?(h[X>>2]=E,h[j>>2]=v,h[q>>2]=0,_=0):(v=x,E=b),b=E-v|0,x=_-v|0,(v|0)<0?(h[X>>2]=b,h[q>>2]=x,h[j>>2]=0,v=0):(x=_,b=E),_=(x|0)<(b|0)?x:b,_=(v|0)<(_|0)?v:_,(_|0)>0&&(v=v-_|0,x=x-_|0,b=b-_|0,h[X>>2]=b,h[q>>2]=x,h[j>>2]=v),M=(x<<1)+b|0,E=v+(b<<1)|0,h[X>>2]=E,h[q>>2]=M,x=(v<<1)+x|0,h[j>>2]=x,_=M-E|0,v=x-E|0,(E|0)<0?(h[q>>2]=_,h[j>>2]=v,h[X>>2]=0,E=0,x=v):_=M,b=E-_|0,v=x-_|0,(_|0)<0?(h[X>>2]=b,h[j>>2]=v,h[q>>2]=0,E=b,_=0):v=x,b=E-v|0,x=_-v|0,(v|0)<0?(h[X>>2]=b,h[q>>2]=x,h[j>>2]=0,v=0):(x=_,b=E),_=(x|0)<(b|0)?x:b,_=(v|0)<(_|0)?v:_,(_|0)>0&&(h[X>>2]=b-_,h[q>>2]=x-_,h[j>>2]=v-_),gc(h[m>>2]|0)|0&&(x=h[X>>2]|0,b=h[q>>2]|0,v=h[j>>2]|0,_=(b*3|0)+x|0,x=v+(x*3|0)|0,h[X>>2]=x,h[q>>2]=_,b=(v*3|0)+b|0,h[j>>2]=b,v=_-x|0,E=b-x|0,(x|0)<0?(h[q>>2]=v,h[j>>2]=E,h[X>>2]=0,_=v,M=0):(M=x,E=b),x=M-_|0,v=E-_|0,(_|0)<0?(h[X>>2]=x,h[j>>2]=v,h[q>>2]=0,M=x,b=0):(b=_,v=E),x=M-v|0,_=b-v|0,(v|0)<0?(h[X>>2]=x,h[q>>2]=_,h[j>>2]=0,b=_,v=0):x=M,_=(b|0)<(x|0)?b:x,_=(v|0)<(_|0)?v:_,(_|0)>0&&(h[X>>2]=x-_,h[q>>2]=b-_,h[j>>2]=v-_),h[m>>2]=(h[m>>2]|0)+1),h[g>>2]=h[p>>2],v=h[q>>2]|0,_=h[j>>2]|0,m=h[O+4>>2]|0,N=h[O+8>>2]|0,b=(h[O>>2]|0)+(h[X>>2]|0)|0,M=g+4|0,h[M>>2]=b,v=m+v|0,m=g+8|0,h[m>>2]=v,_=N+_|0,N=g+12|0,h[N>>2]=_,x=v-b|0,(b|0)<0&&(_=_-b|0,h[m>>2]=x,h[N>>2]=_,h[M>>2]=0,v=x,b=0),(v|0)<0&&(b=b-v|0,h[M>>2]=b,_=_-v|0,h[N>>2]=_,h[m>>2]=0,v=0),E=b-_|0,x=v-_|0,(_|0)<0?(h[M>>2]=E,h[m>>2]=x,h[N>>2]=0,b=E,_=0):x=v,v=(x|0)<(b|0)?x:b,v=(_|0)<(v|0)?_:v,(v|0)>0&&(h[M>>2]=b-v,h[m>>2]=x-v,h[N>>2]=_-v),h[g+16>>2]=h[p>>2],v=h[q>>2]|0,_=h[j>>2]|0,m=h[O+16>>2]|0,N=h[O+20>>2]|0,b=(h[O+12>>2]|0)+(h[X>>2]|0)|0,M=g+20|0,h[M>>2]=b,v=m+v|0,m=g+24|0,h[m>>2]=v,_=N+_|0,N=g+28|0,h[N>>2]=_,x=v-b|0,(b|0)<0&&(_=_-b|0,h[m>>2]=x,h[N>>2]=_,h[M>>2]=0,v=x,b=0),(v|0)<0&&(b=b-v|0,h[M>>2]=b,_=_-v|0,h[N>>2]=_,h[m>>2]=0,v=0),E=b-_|0,x=v-_|0,(_|0)<0?(h[M>>2]=E,h[m>>2]=x,h[N>>2]=0,b=E,_=0):x=v,v=(x|0)<(b|0)?x:b,v=(_|0)<(v|0)?_:v,(v|0)>0&&(h[M>>2]=b-v,h[m>>2]=x-v,h[N>>2]=_-v),h[g+32>>2]=h[p>>2],v=h[q>>2]|0,_=h[j>>2]|0,m=h[O+28>>2]|0,N=h[O+32>>2]|0,b=(h[O+24>>2]|0)+(h[X>>2]|0)|0,M=g+36|0,h[M>>2]=b,v=m+v|0,m=g+40|0,h[m>>2]=v,_=N+_|0,N=g+44|0,h[N>>2]=_,x=v-b|0,(b|0)<0&&(_=_-b|0,h[m>>2]=x,h[N>>2]=_,h[M>>2]=0,v=x,b=0),(v|0)<0&&(b=b-v|0,h[M>>2]=b,_=_-v|0,h[N>>2]=_,h[m>>2]=0,v=0),E=b-_|0,x=v-_|0,(_|0)<0?(h[M>>2]=E,h[m>>2]=x,h[N>>2]=0,b=E,_=0):x=v,v=(x|0)<(b|0)?x:b,v=(_|0)<(v|0)?_:v,(v|0)>0&&(h[M>>2]=b-v,h[m>>2]=x-v,h[N>>2]=_-v),h[g+48>>2]=h[p>>2],v=h[q>>2]|0,_=h[j>>2]|0,m=h[O+40>>2]|0,N=h[O+44>>2]|0,b=(h[O+36>>2]|0)+(h[X>>2]|0)|0,M=g+52|0,h[M>>2]=b,v=m+v|0,m=g+56|0,h[m>>2]=v,_=N+_|0,N=g+60|0,h[N>>2]=_,x=v-b|0,(b|0)<0&&(_=_-b|0,h[m>>2]=x,h[N>>2]=_,h[M>>2]=0,v=x,b=0),(v|0)<0&&(b=b-v|0,h[M>>2]=b,_=_-v|0,h[N>>2]=_,h[m>>2]=0,v=0),E=b-_|0,x=v-_|0,(_|0)<0?(h[M>>2]=E,h[m>>2]=x,h[N>>2]=0,b=E,_=0):x=v,v=(x|0)<(b|0)?x:b,v=(_|0)<(v|0)?_:v,(v|0)>0&&(h[M>>2]=b-v,h[m>>2]=x-v,h[N>>2]=_-v),h[g+64>>2]=h[p>>2],x=h[q>>2]|0,_=h[j>>2]|0,N=h[O+52>>2]|0,M=h[O+56>>2]|0,b=(h[O+48>>2]|0)+(h[X>>2]|0)|0,m=g+68|0,h[m>>2]=b,x=N+x|0,N=g+72|0,h[N>>2]=x,_=M+_|0,M=g+76|0,h[M>>2]=_,v=x-b|0,(b|0)<0?(_=_-b|0,h[N>>2]=v,h[M>>2]=_,h[m>>2]=0,x=0):(v=x,x=b),(v|0)<0&&(x=x-v|0,h[m>>2]=x,_=_-v|0,h[M>>2]=_,h[N>>2]=0,v=0),E=x-_|0,b=v-_|0,(_|0)<0?(h[m>>2]=E,h[N>>2]=b,h[M>>2]=0,x=E,_=0):b=v,v=(b|0)<(x|0)?b:x,v=(_|0)<(v|0)?_:v,(v|0)<=0){Q=K;return}h[m>>2]=x-v,h[N>>2]=b-v,h[M>>2]=_-v,Q=K}function A1(p,m,g,_){p=p|0,m=m|0,g=g|0,_=_|0;var v=0,x=0,b=0,E=0,M=0,N=0,O=0,q=0,j=0,X=0,K=0,ae=0,ue=0,xe=0;if(j=h[16928+(m<<2)>>2]|0,q=(_|0)!=0,j=q?j*3|0:j,O=p+4|0,E=h[O>>2]|0,N=p+8|0,x=h[N>>2]|0,q){if(b=p+12|0,_=h[b>>2]|0,v=x+E+_|0,(v|0)==(j|0))return j=1,j|0;M=b}else M=p+12|0,v=h[M>>2]|0,_=v,v=x+E+v|0;if((v|0)<=(j|0))return j=0,j|0;do if((_|0)>0){if(v=h[p>>2]|0,(x|0)>0){v=18608+(v*80|0)+60|0,b=E;break}v=18608+(v*80|0)+40|0,g?(b=E-j|0,g=x+b|0,X=(g|0)<0,x=_+x-(X?g:0)|0,E=(x|0)<0,_=_+b-(X?g:0)-(E?x:0)|0,b=(_|0)<0,g=(X?0:g)-(E?x:0)-(b?_:0)|0,x=(E?0:x)-(b?_:0)|0,_=b?0:_,b=(x|0)<(g|0)?x:g,b=(_|0)<(b|0)?_:b,E=(b|0)>0,x=x-(E?b:0)|0,_=_-(E?b:0)|0,b=g-(E?b:0)+j|0,h[O>>2]=b,h[N>>2]=x,h[M>>2]=_):b=E}else v=18608+((h[p>>2]|0)*80|0)+20|0,b=E;while(!1);if(h[p>>2]=h[v>>2],E=h[v+16>>2]|0,(E|0)>0){g=0;do X=_+b|0,K=(X|0)<0,xe=K?X:0,ae=x+b-xe|0,ue=(ae|0)<0,p=ue?ae:0,b=_+x-xe-p|0,x=(b|0)<0,_=x?0:b,b=x?b:0,x=(ue?0:ae)-b|0,b=(K?0:X)-p-b|0,p=(x|0)<(b|0)?x:b,p=(_|0)<(p|0)?_:p,(p|0)>0&&(b=b-p|0,x=x-p|0,_=_-p|0),g=g+1|0;while((g|0)<(E|0));h[O>>2]=b,h[N>>2]=x,h[M>>2]=_}return ae=h[16848+(m<<2)>>2]|0,ae=q?ae*3|0:ae,ue=ol(ae,h[v+8>>2]|0)|0,xe=ol(ae,h[v+12>>2]|0)|0,b=(ol(ae,h[v+4>>2]|0)|0)+b|0,h[O>>2]=b,x=ue+x|0,h[N>>2]=x,_=xe+_|0,h[M>>2]=_,v=x-b|0,(b|0)<0?(_=_-b|0,h[N>>2]=v,h[M>>2]=_,h[O>>2]=0,x=0):(v=x,x=b),(v|0)<0?(p=x-v|0,h[O>>2]=p,_=_-v|0,h[M>>2]=_,h[N>>2]=0,b=0):(p=x,b=v),x=p-_|0,v=b-_|0,(_|0)<0?(h[O>>2]=x,h[N>>2]=v,h[M>>2]=0,_=0):(v=b,x=p),b=(v|0)<(x|0)?v:x,b=(_|0)<(b|0)?_:b,(b|0)>0&&(x=x-b|0,v=v-b|0,_=_-b|0,h[O>>2]=x,h[N>>2]=v,h[M>>2]=_),q?(xe=(v+x+_|0)==(j|0)?1:2,xe|0):(xe=2,xe|0)}function zce(p,m){p=p|0,m=m|0;var g=0;do g=A1(p,m,0,1)|0;while((g|0)==2);return g|0}function tL(p,m,g,_,v){p=p|0,m=m|0,g=g|0,_=_|0,v=v|0;var x=0,b=0,E=0,M=0,N=0,O=0,q=0,j=0,X=0,K=0,ae=0,ue=0,xe=0,se=0,we=0,Ae=0,Be=0,Ke=0,Me=0,be=0,gt=0,je=0,Ut=0,lt=0,pt=0,pi=0,bi=0,Ro=0,Vn=0,wi=0,Ea=0,Bs=0,os=0,Os=0,ws=0;if(Bs=Q,Q=Q+272|0,x=Bs+256|0,b=Bs+240|0,Vn=Bs,wi=Bs+224|0,Ea=Bs+208|0,je=Bs+184|0,Ut=Bs+168|0,lt=Bs+152|0,pt=Bs+136|0,pi=Bs+120|0,bi=Bs+96|0,h[x>>2]=m,h[b>>2]=h[p>>2],h[b+4>>2]=h[p+4>>2],h[b+8>>2]=h[p+8>>2],h[b+12>>2]=h[p+12>>2],jG(b,x,Vn),h[v>>2]=0,gt=_+g+((_|0)==6&1)|0,(gt|0)<=(g|0)){Q=Bs;return}xe=h[x>>2]|0,se=g+6|0,we=Ea+8|0,Ae=je+8|0,Be=16928+(xe<<2)|0,Ke=Ut+8|0,Me=lt+8|0,be=pt+8|0,ae=h[b>>2]|0,j=wi+4|0,X=wi+8|0,K=wi+12|0,ue=Ea+8|0,M=je+8|0,O=je+16|0,N=bi+8|0,q=bi+16|0,b=0,E=g,_=-1;e:for(;;){if(x=(E|0)%6|0,p=Vn+(x<<4)|0,h[wi>>2]=h[p>>2],h[wi+4>>2]=h[p+4>>2],h[wi+8>>2]=h[p+8>>2],h[wi+12>>2]=h[p+12>>2],p=b,b=A1(wi,xe,0,1)|0,(E|0)>(g|0)&(gc(m)|0)!=0&&(Ro=h[wi>>2]|0,(p|0)!=1&(Ro|0)!=(_|0))){switch(ws=(x+5|0)%6|0,p=h[Vn+(ws<<4)+12>>2]|0,os=+((h[Vn+(ws<<4)+8>>2]|0)-p|0),ie[Ea>>3]=+((h[Vn+(ws<<4)+4>>2]|0)-p|0)-os*.5,ie[we>>3]=os*.8660254037844386,p=h[Vn+(x<<4)+12>>2]|0,os=+((h[Vn+(x<<4)+8>>2]|0)-p|0),ie[je>>3]=+((h[Vn+(x<<4)+4>>2]|0)-p|0)-os*.5,ie[Ae>>3]=os*.8660254037844386,os=+(h[Be>>2]|0),ie[Ut>>3]=os*3,ie[Ke>>3]=0,Os=os*-1.5,ie[lt>>3]=Os,ie[Me>>3]=os*2.598076211353316,ie[pt>>3]=Os,ie[be>>3]=os*-2.598076211353316,h[17008+(ae*80|0)+(((_|0)==(ae|0)?Ro:_)<<2)>>2]|0){case 1:{p=lt,_=Ut;break}case 3:{p=pt,_=lt;break}case 2:{p=Ut,_=pt;break}default:{p=8;break e}}sq(Ea,je,_,p,pi),!(oq(Ea,pi)|0)&&!(oq(je,pi)|0)&&(kx(pi,ae,xe,1,bi),ws=h[v>>2]|0,os=+Ox(+ +ie[q>>3]),Os=+Sa(+ +ie[N>>3],+ +ie[bi>>3]),ie[v+8+(ws<<4)>>3]=os,ie[v+8+(ws<<4)+8>>3]=Os,h[v>>2]=(h[v>>2]|0)+1)}if((E|0)<(se|0)&&(ws=h[K>>2]|0,os=+((h[X>>2]|0)-ws|0),ie[Ea>>3]=+((h[j>>2]|0)-ws|0)-os*.5,ie[ue>>3]=os*.8660254037844386,kx(Ea,h[wi>>2]|0,xe,1,je),ws=h[v>>2]|0,os=+Ox(+ +ie[O>>3]),Os=+Sa(+ +ie[M>>3],+ +ie[je>>3]),ie[v+8+(ws<<4)>>3]=os,ie[v+8+(ws<<4)+8>>3]=Os,h[v>>2]=(h[v>>2]|0)+1),E=E+1|0,(E|0)>=(gt|0)){p=3;break}else _=h[wi>>2]|0}if((p|0)==3){Q=Bs;return}else(p|0)==8&&di(27157,27120,766,27202)}function jG(p,m,g){p=p|0,m=m|0,g=g|0;var _=0,v=0,x=0,b=0,E=0,M=0,N=0,O=0,q=0,j=0,X=0,K=0,ae=0;ae=Q,Q=Q+160|0,_=ae+80|0,v=ae,x=_,b=20336,E=x+72|0;do h[x>>2]=h[b>>2],x=x+4|0,b=b+4|0;while((x|0)<(E|0));x=v,b=20416,E=x+72|0;do h[x>>2]=h[b>>2],x=x+4|0,b=b+4|0;while((x|0)<(E|0));q=(gc(h[m>>2]|0)|0)==0,q=q?_:v,K=p+4|0,x=h[K>>2]|0,j=p+8|0,_=h[j>>2]|0,X=p+12|0,v=h[X>>2]|0,b=_+(x<<1)|0,h[K>>2]=b,_=v+(_<<1)|0,h[j>>2]=_,x=(v<<1)+x|0,h[X>>2]=x,v=_-b|0,E=x-b|0,(b|0)<0&&(h[j>>2]=v,h[X>>2]=E,h[K>>2]=0,_=v,b=0,x=E),E=b-_|0,v=x-_|0,(_|0)<0?(h[K>>2]=E,h[X>>2]=v,h[j>>2]=0,_=0):(v=x,E=b),b=E-v|0,x=_-v|0,(v|0)<0?(h[K>>2]=b,h[j>>2]=x,h[X>>2]=0,v=0):(x=_,b=E),_=(x|0)<(b|0)?x:b,_=(v|0)<(_|0)?v:_,(_|0)>0&&(v=v-_|0,x=x-_|0,b=b-_|0,h[K>>2]=b,h[j>>2]=x,h[X>>2]=v),M=(x<<1)+b|0,E=v+(b<<1)|0,h[K>>2]=E,h[j>>2]=M,x=(v<<1)+x|0,h[X>>2]=x,_=M-E|0,v=x-E|0,(E|0)<0?(h[j>>2]=_,h[X>>2]=v,h[K>>2]=0,E=0,x=v):_=M,b=E-_|0,v=x-_|0,(_|0)<0?(h[K>>2]=b,h[X>>2]=v,h[j>>2]=0,E=b,_=0):v=x,b=E-v|0,x=_-v|0,(v|0)<0?(h[K>>2]=b,h[j>>2]=x,h[X>>2]=0,v=0):(x=_,b=E),_=(x|0)<(b|0)?x:b,_=(v|0)<(_|0)?v:_,(_|0)>0&&(h[K>>2]=b-_,h[j>>2]=x-_,h[X>>2]=v-_),gc(h[m>>2]|0)|0&&(x=h[K>>2]|0,b=h[j>>2]|0,v=h[X>>2]|0,_=(b*3|0)+x|0,x=v+(x*3|0)|0,h[K>>2]=x,h[j>>2]=_,b=(v*3|0)+b|0,h[X>>2]=b,v=_-x|0,E=b-x|0,(x|0)<0?(h[j>>2]=v,h[X>>2]=E,h[K>>2]=0,_=v,M=0):(M=x,E=b),x=M-_|0,v=E-_|0,(_|0)<0?(h[K>>2]=x,h[X>>2]=v,h[j>>2]=0,M=x,b=0):(b=_,v=E),x=M-v|0,_=b-v|0,(v|0)<0?(h[K>>2]=x,h[j>>2]=_,h[X>>2]=0,b=_,v=0):x=M,_=(b|0)<(x|0)?b:x,_=(v|0)<(_|0)?v:_,(_|0)>0&&(h[K>>2]=x-_,h[j>>2]=b-_,h[X>>2]=v-_),h[m>>2]=(h[m>>2]|0)+1),M=0;do h[g+(M<<4)>>2]=h[p>>2],v=h[j>>2]|0,_=h[X>>2]|0,N=h[q+(M*12|0)+4>>2]|0,O=h[q+(M*12|0)+8>>2]|0,b=(h[q+(M*12|0)>>2]|0)+(h[K>>2]|0)|0,m=g+(M<<4)+4|0,h[m>>2]=b,v=N+v|0,N=g+(M<<4)+8|0,h[N>>2]=v,_=O+_|0,O=g+(M<<4)+12|0,h[O>>2]=_,x=v-b|0,(b|0)<0&&(_=_-b|0,h[N>>2]=x,h[O>>2]=_,h[m>>2]=0,v=x,b=0),(v|0)<0&&(b=b-v|0,h[m>>2]=b,_=_-v|0,h[O>>2]=_,h[N>>2]=0,v=0),E=b-_|0,x=v-_|0,(_|0)<0?(h[m>>2]=E,h[N>>2]=x,h[O>>2]=0,b=E,_=0):x=v,v=(x|0)<(b|0)?x:b,v=(_|0)<(v|0)?_:v,(v|0)>0&&(h[m>>2]=b-v,h[N>>2]=x-v,h[O>>2]=_-v),M=M+1|0;while((M|0)!=6);Q=ae}function nL(p,m){return p=p|0,m=m|0,m=tt(p|0,m|0,52)|0,ee()|0,m&15|0}function XG(p,m){return p=p|0,m=m|0,m=tt(p|0,m|0,45)|0,ee()|0,m&127|0}function Vce(p,m,g,_){return p=p|0,m=m|0,g=g|0,_=_|0,(g+-1|0)>>>0>14?(_=4,_|0):(g=tt(p|0,m|0,(15-g|0)*3|0)|0,ee()|0,h[_>>2]=g&7,_=0,_|0)}function Gce(p,m,g,_){p=p|0,m=m|0,g=g|0,_=_|0;var v=0,x=0,b=0,E=0,M=0,N=0;if(p>>>0>15)return _=4,_|0;if(m>>>0>121)return _=17,_|0;b=ft(p|0,0,52)|0,v=ee()|0,E=ft(m|0,0,45)|0,v=v|(ee()|0)|134225919;e:do if((p|0)>=1){for(E=1,b=(He[20496+m>>0]|0)!=0,x=-1;;){if(m=h[g+(E+-1<<2)>>2]|0,m>>>0>6){v=18,m=10;break}if(!((m|0)==0|b^1))if((m|0)==1){v=19,m=10;break}else b=0;if(N=(15-E|0)*3|0,M=ft(7,0,N|0)|0,v=v&~(ee()|0),m=ft(m|0,((m|0)<0)<<31>>31|0,N|0)|0,x=m|x&~M,v=ee()|0|v,(E|0)<(p|0))E=E+1|0;else break e}if((m|0)==10)return v|0}else x=-1;while(!1);return N=_,h[N>>2]=x,h[N+4>>2]=v,N=0,N|0}function eT(p,m){p=p|0,m=m|0;var g=0,_=0,v=0,x=0,b=0;return!(!0&(m&-16777216|0)==134217728)||(_=tt(p|0,m|0,52)|0,ee()|0,_=_&15,g=tt(p|0,m|0,45)|0,ee()|0,g=g&127,g>>>0>121)?(p=0,p|0):(b=(_^15)*3|0,v=tt(p|0,m|0,b|0)|0,b=ft(v|0,ee()|0,b|0)|0,v=ee()|0,x=eo(-1227133514,-1171,b|0,v|0)|0,!((b&613566756&x|0)==0&(v&4681&(ee()|0)|0)==0)||(b=(_*3|0)+19|0,x=ft(~p|0,~m|0,b|0)|0,b=tt(x|0,ee()|0,b|0)|0,!((_|0)==15|(b|0)==0&(ee()|0)==0))?(b=0,b|0):!(He[20496+g>>0]|0)||(m=m&8191,(p|0)==0&(m|0)==0)?(b=1,b|0):(b=vL(p|0,m|0,0)|0,ee()|0,((63-b|0)%3|0|0)!=0|0))}function qce(p,m){p=p|0,m=m|0;var g=0,_=0,v=0,x=0,b=0;return!0&(m&-16777216|0)==134217728&&(_=tt(p|0,m|0,52)|0,ee()|0,_=_&15,g=tt(p|0,m|0,45)|0,ee()|0,g=g&127,g>>>0<=121)&&(b=(_^15)*3|0,v=tt(p|0,m|0,b|0)|0,b=ft(v|0,ee()|0,b|0)|0,v=ee()|0,x=eo(-1227133514,-1171,b|0,v|0)|0,(b&613566756&x|0)==0&(v&4681&(ee()|0)|0)==0)&&(b=(_*3|0)+19|0,x=ft(~p|0,~m|0,b|0)|0,b=tt(x|0,ee()|0,b|0)|0,(_|0)==15|(b|0)==0&(ee()|0)==0)&&(!(He[20496+g>>0]|0)||(g=m&8191,(p|0)==0&(g|0)==0)||(b=vL(p|0,g|0,0)|0,ee()|0,(63-b|0)%3|0|0))||qG(p,m)|0?(b=1,b|0):(b=(aq(p,m)|0)!=0&1,b|0)}function iL(p,m,g,_){p=p|0,m=m|0,g=g|0,_=_|0;var v=0,x=0,b=0,E=0;if(v=ft(m|0,0,52)|0,x=ee()|0,g=ft(g|0,0,45)|0,g=x|(ee()|0)|134225919,(m|0)<1){x=-1,_=g,m=p,h[m>>2]=x,p=p+4|0,h[p>>2]=_;return}for(x=1,v=-1;b=(15-x|0)*3|0,E=ft(7,0,b|0)|0,g=g&~(ee()|0),b=ft(_|0,0,b|0)|0,v=v&~E|b,g=g|(ee()|0),(x|0)!=(m|0);)x=x+1|0;E=p,b=E,h[b>>2]=v,E=E+4|0,h[E>>2]=g}function rL(p,m,g,_){p=p|0,m=m|0,g=g|0,_=_|0;var v=0,x=0;if(x=tt(p|0,m|0,52)|0,ee()|0,x=x&15,g>>>0>15)return _=4,_|0;if((x|0)<(g|0))return _=12,_|0;if((x|0)==(g|0))return h[_>>2]=p,h[_+4>>2]=m,_=0,_|0;if(v=ft(g|0,0,52)|0,v=v|p,p=ee()|0|m&-15728641,(x|0)>(g|0))do m=ft(7,0,(14-g|0)*3|0)|0,g=g+1|0,v=m|v,p=ee()|0|p;while((g|0)<(x|0));return h[_>>2]=v,h[_+4>>2]=p,_=0,_|0}function zx(p,m,g,_){p=p|0,m=m|0,g=g|0,_=_|0;var v=0,x=0,b=0;if(x=tt(p|0,m|0,52)|0,ee()|0,x=x&15,!((g|0)<16&(x|0)<=(g|0)))return _=4,_|0;v=g-x|0,g=tt(p|0,m|0,45)|0,ee()|0;e:do if(!(xr(g&127)|0))g=np(7,0,v,((v|0)<0)<<31>>31)|0,v=ee()|0;else{t:do if(x|0){for(g=1;b=ft(7,0,(15-g|0)*3|0)|0,!!((b&p|0)==0&((ee()|0)&m|0)==0);)if(g>>>0<x>>>0)g=g+1|0;else break t;g=np(7,0,v,((v|0)<0)<<31>>31)|0,v=ee()|0;break e}while(!1);g=np(7,0,v,((v|0)<0)<<31>>31)|0,g=br(g|0,ee()|0,5,0)|0,g=At(g|0,ee()|0,-5,-1)|0,g=ip(g|0,ee()|0,6,0)|0,g=At(g|0,ee()|0,1,0)|0,v=ee()|0}while(!1);return b=_,h[b>>2]=g,h[b+4>>2]=v,b=0,b|0}function Zi(p,m){p=p|0,m=m|0;var g=0,_=0,v=0;if(v=tt(p|0,m|0,45)|0,ee()|0,!(xr(v&127)|0))return v=0,v|0;v=tt(p|0,m|0,52)|0,ee()|0,v=v&15;e:do if(!v)g=0;else for(_=1;;){if(g=tt(p|0,m|0,(15-_|0)*3|0)|0,ee()|0,g=g&7,g|0)break e;if(_>>>0<v>>>0)_=_+1|0;else{g=0;break}}while(!1);return v=(g|0)==0&1,v|0}function Hce(p,m,g,_){p=p|0,m=m|0,g=g|0,_=_|0;var v=0,x=0,b=0,E=0;if(b=Q,Q=Q+16|0,x=b,uL(x,p,m,g),m=x,p=h[m>>2]|0,m=h[m+4>>2]|0,(p|0)==0&(m|0)==0)return Q=b,0;v=0,g=0;do E=_+(v<<3)|0,h[E>>2]=p,h[E+4>>2]=m,v=At(v|0,g|0,1,0)|0,g=ee()|0,hL(x),E=x,p=h[E>>2]|0,m=h[E+4>>2]|0;while(!((p|0)==0&(m|0)==0));return Q=b,0}function $G(p,m,g,_){return p=p|0,m=m|0,g=g|0,_=_|0,(_|0)<(g|0)?(g=m,_=p,On(g|0),_|0):(g=ft(-1,-1,((_-g|0)*3|0)+3|0)|0,_=ft(~g|0,~(ee()|0)|0,(15-_|0)*3|0)|0,g=~(ee()|0)&m,_=~_&p,On(g|0),_|0)}function YG(p,m,g,_){p=p|0,m=m|0,g=g|0,_=_|0;var v=0;return v=tt(p|0,m|0,52)|0,ee()|0,v=v&15,(g|0)<16&(v|0)<=(g|0)?((v|0)<(g|0)&&(v=ft(-1,-1,((g+-1-v|0)*3|0)+3|0)|0,v=ft(~v|0,~(ee()|0)|0,(15-g|0)*3|0)|0,m=~(ee()|0)&m,p=~v&p),v=ft(g|0,0,52)|0,g=m&-15728641|(ee()|0),h[_>>2]=p|v,h[_+4>>2]=g,_=0,_|0):(_=4,_|0)}function Wce(p,m,g,_){p=p|0,m=m|0,g=g|0,_=_|0;var v=0,x=0,b=0,E=0,M=0,N=0,O=0,q=0,j=0,X=0,K=0,ae=0,ue=0,xe=0,se=0,we=0,Ae=0,Be=0,Ke=0,Me=0,be=0,gt=0,je=0,Ut=0,lt=0,pt=0;if((g|0)==0&(_|0)==0)return pt=0,pt|0;if(v=p,x=h[v>>2]|0,v=h[v+4>>2]|0,!0&(v&15728640|0)==0){if(!((_|0)>0|(_|0)==0&g>>>0>0)||(pt=m,h[pt>>2]=x,h[pt+4>>2]=v,(g|0)==1&(_|0)==0))return pt=0,pt|0;v=1,x=0;do Ut=p+(v<<3)|0,lt=h[Ut+4>>2]|0,pt=m+(v<<3)|0,h[pt>>2]=h[Ut>>2],h[pt+4>>2]=lt,v=At(v|0,x|0,1,0)|0,x=ee()|0;while((x|0)<(_|0)|(x|0)==(_|0)&v>>>0<g>>>0);return v=0,v|0}if(je=g<<3,lt=yr(je)|0,!lt)return pt=13,pt|0;if(cu(lt|0,p|0,je|0)|0,Ut=Ta(g,8)|0,!Ut)return _t(lt),pt=13,pt|0;e:for(;;){v=lt,N=h[v>>2]|0,v=h[v+4>>2]|0,be=tt(N|0,v|0,52)|0,ee()|0,be=be&15,gt=be+-1|0,Me=(be|0)!=0,Ke=(_|0)>0|(_|0)==0&g>>>0>0;t:do if(Me&Ke){if(se=ft(gt|0,0,52)|0,we=ee()|0,gt>>>0>15){if(!((N|0)==0&(v|0)==0)){pt=16;break e}for(x=0,p=0;;){if(x=At(x|0,p|0,1,0)|0,p=ee()|0,!((p|0)<(_|0)|(p|0)==(_|0)&x>>>0<g>>>0))break t;if(b=lt+(x<<3)|0,Be=h[b>>2]|0,b=h[b+4>>2]|0,!((Be|0)==0&(b|0)==0)){v=b,pt=16;break e}}}for(E=N,p=v,x=0,b=0;;){if(!((E|0)==0&(p|0)==0)){if(!(!0&(p&117440512|0)==0)){pt=21;break e}if(O=tt(E|0,p|0,52)|0,ee()|0,O=O&15,(O|0)<(gt|0)){v=12,pt=27;break e}if((O|0)!=(gt|0)&&(E=E|se,p=p&-15728641|we,O>>>0>=be>>>0)){M=gt;do Be=ft(7,0,(14-M|0)*3|0)|0,M=M+1|0,E=Be|E,p=ee()|0|p;while(M>>>0<O>>>0)}if(j=Gf(E|0,p|0,g|0,_|0)|0,X=ee()|0,M=Ut+(j<<3)|0,O=M,q=h[O>>2]|0,O=h[O+4>>2]|0,!((q|0)==0&(O|0)==0)){ue=0,xe=0;do{if((ue|0)>(_|0)|(ue|0)==(_|0)&xe>>>0>g>>>0){pt=31;break e}if((q|0)==(E|0)&(O&-117440513|0)==(p|0)){K=tt(q|0,O|0,56)|0,ee()|0,K=K&7,ae=K+1|0,Be=tt(q|0,O|0,45)|0,ee()|0;n:do if(!(xr(Be&127)|0))O=7;else{if(q=tt(q|0,O|0,52)|0,ee()|0,q=q&15,!q){O=6;break}for(O=1;;){if(Be=ft(7,0,(15-O|0)*3|0)|0,!((Be&E|0)==0&((ee()|0)&p|0)==0)){O=7;break n}if(O>>>0<q>>>0)O=O+1|0;else{O=6;break}}}while(!1);if((K+2|0)>>>0>O>>>0){pt=41;break e}Be=ft(ae|0,0,56)|0,p=ee()|0|p&-117440513,Ae=M,h[Ae>>2]=0,h[Ae+4>>2]=0,E=Be|E}else j=At(j|0,X|0,1,0)|0,j=rp(j|0,ee()|0,g|0,_|0)|0,X=ee()|0;xe=At(xe|0,ue|0,1,0)|0,ue=ee()|0,M=Ut+(j<<3)|0,O=M,q=h[O>>2]|0,O=h[O+4>>2]|0}while(!((q|0)==0&(O|0)==0))}Be=M,h[Be>>2]=E,h[Be+4>>2]=p}if(x=At(x|0,b|0,1,0)|0,b=ee()|0,!((b|0)<(_|0)|(b|0)==(_|0)&x>>>0<g>>>0))break t;p=lt+(x<<3)|0,E=h[p>>2]|0,p=h[p+4>>2]|0}}while(!1);if(Be=At(g|0,_|0,5,0)|0,Ae=ee()|0,Ae>>>0<0|(Ae|0)==0&Be>>>0<11){pt=85;break}if(Be=ip(g|0,_|0,6,0)|0,ee()|0,Be=Ta(Be,8)|0,!Be){pt=48;break}do if(Ke){for(ae=0,p=0,K=0,ue=0;;){if(O=Ut+(ae<<3)|0,b=O,x=h[b>>2]|0,b=h[b+4>>2]|0,(x|0)==0&(b|0)==0)Ae=K;else{q=tt(x|0,b|0,56)|0,ee()|0,q=q&7,E=q+1|0,j=b&-117440513,Ae=tt(x|0,b|0,45)|0,ee()|0;t:do if(xr(Ae&127)|0){if(X=tt(x|0,b|0,52)|0,ee()|0,X=X&15,X|0)for(M=1;;){if(Ae=ft(7,0,(15-M|0)*3|0)|0,!((x&Ae|0)==0&(j&(ee()|0)|0)==0))break t;if(M>>>0<X>>>0)M=M+1|0;else break}b=ft(E|0,0,56)|0,x=b|x,b=ee()|0|j,E=O,h[E>>2]=x,h[E+4>>2]=b,E=q+2|0}while(!1);(E|0)==7?(Ae=Be+(p<<3)|0,h[Ae>>2]=x,h[Ae+4>>2]=b&-117440513,p=At(p|0,K|0,1,0)|0,Ae=ee()|0):Ae=K}if(ae=At(ae|0,ue|0,1,0)|0,ue=ee()|0,(ue|0)<(_|0)|(ue|0)==(_|0)&ae>>>0<g>>>0)K=Ae;else break}if(Ke){if(xe=gt>>>0>15,se=ft(gt|0,0,52)|0,we=ee()|0,!Me){for(x=0,M=0,E=0,b=0;(N|0)==0&(v|0)==0||(gt=m+(x<<3)|0,h[gt>>2]=N,h[gt+4>>2]=v,x=At(x|0,M|0,1,0)|0,M=ee()|0),E=At(E|0,b|0,1,0)|0,b=ee()|0,!!((b|0)<(_|0)|(b|0)==(_|0)&E>>>0<g>>>0);)v=lt+(E<<3)|0,N=h[v>>2]|0,v=h[v+4>>2]|0;v=Ae;break}for(x=0,M=0,b=0,E=0;;){do if(!((N|0)==0&(v|0)==0)){if(X=tt(N|0,v|0,52)|0,ee()|0,X=X&15,xe|(X|0)<(gt|0)){pt=80;break e}if((X|0)!=(gt|0)){if(O=N|se,q=v&-15728641|we,X>>>0>=be>>>0){j=gt;do Me=ft(7,0,(14-j|0)*3|0)|0,j=j+1|0,O=Me|O,q=ee()|0|q;while(j>>>0<X>>>0)}}else O=N,q=v;K=Gf(O|0,q|0,g|0,_|0)|0,j=0,X=0,ue=ee()|0;do{if((j|0)>(_|0)|(j|0)==(_|0)&X>>>0>g>>>0){pt=81;break e}if(Me=Ut+(K<<3)|0,ae=h[Me+4>>2]|0,(ae&-117440513|0)==(q|0)&&(h[Me>>2]|0)==(O|0)){pt=65;break}Me=At(K|0,ue|0,1,0)|0,K=rp(Me|0,ee()|0,g|0,_|0)|0,ue=ee()|0,X=At(X|0,j|0,1,0)|0,j=ee()|0,Me=Ut+(K<<3)|0}while(!((h[Me>>2]|0)==(O|0)&&(h[Me+4>>2]|0)==(q|0)));if((pt|0)==65&&(pt=0,!0&(ae&117440512|0)==100663296))break;Me=m+(x<<3)|0,h[Me>>2]=N,h[Me+4>>2]=v,x=At(x|0,M|0,1,0)|0,M=ee()|0}while(!1);if(b=At(b|0,E|0,1,0)|0,E=ee()|0,!((E|0)<(_|0)|(E|0)==(_|0)&b>>>0<g>>>0))break;v=lt+(b<<3)|0,N=h[v>>2]|0,v=h[v+4>>2]|0}v=Ae}else x=0,v=Ae}else x=0,p=0,v=0;while(!1);if(sp(Ut|0,0,je|0)|0,cu(lt|0,Be|0,p<<3|0)|0,_t(Be),(p|0)==0&(v|0)==0){pt=89;break}else m=m+(x<<3)|0,_=v,g=p}if((pt|0)==16)!0&(v&117440512|0)==0?(v=4,pt=27):pt=21;else if((pt|0)==31)di(27634,27225,620,27235);else{if((pt|0)==41)return _t(lt),_t(Ut),pt=10,pt|0;if((pt|0)==48)return _t(lt),_t(Ut),pt=13,pt|0;(pt|0)==80?di(27634,27225,711,27235):(pt|0)==81?di(27634,27225,723,27235):(pt|0)==85&&(cu(m|0,lt|0,g<<3|0)|0,pt=89)}return(pt|0)==21?(_t(lt),_t(Ut),pt=5,pt|0):(pt|0)==27?(_t(lt),_t(Ut),pt=v,pt|0):(pt|0)==89?(_t(lt),_t(Ut),pt=0,pt|0):0}function jce(p,m,g,_,v,x,b){p=p|0,m=m|0,g=g|0,_=_|0,v=v|0,x=x|0,b=b|0;var E=0,M=0,N=0,O=0,q=0,j=0,X=0,K=0,ae=0;if(ae=Q,Q=Q+16|0,K=ae,!((g|0)>0|(g|0)==0&m>>>0>0))return K=0,Q=ae,K|0;if((b|0)>=16)return K=12,Q=ae,K|0;j=0,X=0,q=0,E=0;e:for(;;){if(N=p+(j<<3)|0,M=h[N>>2]|0,N=h[N+4>>2]|0,O=tt(M|0,N|0,52)|0,ee()|0,(O&15|0)>(b|0)){E=12,M=11;break}if(uL(K,M,N,b),O=K,N=h[O>>2]|0,O=h[O+4>>2]|0,(N|0)==0&(O|0)==0)M=q;else{M=q;do{if(!((E|0)<(x|0)|(E|0)==(x|0)&M>>>0<v>>>0)){M=10;break e}q=_+(M<<3)|0,h[q>>2]=N,h[q+4>>2]=O,M=At(M|0,E|0,1,0)|0,E=ee()|0,hL(K),q=K,N=h[q>>2]|0,O=h[q+4>>2]|0}while(!((N|0)==0&(O|0)==0))}if(j=At(j|0,X|0,1,0)|0,X=ee()|0,(X|0)<(g|0)|(X|0)==(g|0)&j>>>0<m>>>0)q=M;else{E=0,M=11;break}}return(M|0)==10?(K=14,Q=ae,K|0):(M|0)==11?(Q=ae,E|0):0}function Xce(p,m,g,_,v){p=p|0,m=m|0,g=g|0,_=_|0,v=v|0;var x=0,b=0,E=0,M=0,N=0,O=0,q=0,j=0;j=Q,Q=Q+16|0,q=j;e:do if((g|0)>0|(g|0)==0&m>>>0>0){for(N=0,b=0,x=0,O=0;;){if(M=p+(N<<3)|0,E=h[M>>2]|0,M=h[M+4>>2]|0,!((E|0)==0&(M|0)==0)&&(M=(zx(E,M,_,q)|0)==0,E=q,b=At(h[E>>2]|0,h[E+4>>2]|0,b|0,x|0)|0,x=ee()|0,!M)){x=12;break}if(N=At(N|0,O|0,1,0)|0,O=ee()|0,!((O|0)<(g|0)|(O|0)==(g|0)&N>>>0<m>>>0))break e}return Q=j,x|0}else b=0,x=0;while(!1);return h[v>>2]=b,h[v+4>>2]=x,v=0,Q=j,v|0}function $ce(p,m){return p=p|0,m=m|0,m=tt(p|0,m|0,52)|0,ee()|0,m&1|0}function al(p,m){p=p|0,m=m|0;var g=0,_=0,v=0;if(v=tt(p|0,m|0,52)|0,ee()|0,v=v&15,!v)return v=0,v|0;for(_=1;;){if(g=tt(p|0,m|0,(15-_|0)*3|0)|0,ee()|0,g=g&7,g|0){_=5;break}if(_>>>0<v>>>0)_=_+1|0;else{g=0,_=5;break}}return(_|0)==5?g|0:0}function sL(p,m){p=p|0,m=m|0;var g=0,_=0,v=0,x=0,b=0,E=0,M=0,N=0,O=0;if(O=tt(p|0,m|0,52)|0,ee()|0,O=O&15,!O)return N=m,O=p,On(N|0),O|0;for(N=1,g=0;;){switch(_=(15-N|0)*3|0,E=ft(7,0,_|0)|0,M=ee()|0,x=p&~E,b=m&~M,p=tt(p|0,m|0,_|0)|0,ee()|0,p&7){case 1:{p=5;break}case 5:{p=4;break}case 4:{p=6;break}case 6:{p=2;break}case 2:{p=3;break}case 3:{p=1;break}default:p=p&7}_=ft(p|0,0,_|0)|0,v=ee()|0,p=_|x,m=v|b;e:do if(!g)if((_&E|0)==0&(v&M|0)==0)g=0;else if(b=tt(p|0,m|0,52)|0,ee()|0,b=b&15,!b)g=1;else{g=1;t:for(;;){switch(M=tt(p|0,m|0,(15-g|0)*3|0)|0,ee()|0,M&7){case 1:break t;case 0:break;default:{g=1;break e}}if(g>>>0<b>>>0)g=g+1|0;else{g=1;break e}}for(x=1;;){switch(v=(15-x|0)*3|0,g=tt(p|0,m|0,v|0)|0,ee()|0,_=ft(7,0,v|0)|0,_=p&~_,m=m&~(ee()|0),g&7){case 1:{p=5;break}case 5:{p=4;break}case 4:{p=6;break}case 6:{p=2;break}case 2:{p=3;break}case 3:{p=1;break}default:p=g&7}if(p=ft(p|0,0,v|0)|0,p=p|_,m=ee()|0|m,x>>>0<b>>>0)x=x+1|0;else{g=1;break e}}}while(!1);if(N>>>0<O>>>0)N=N+1|0;else break}return On(m|0),p|0}function Fm(p,m){p=p|0,m=m|0;var g=0,_=0,v=0,x=0,b=0;if(b=tt(p|0,m|0,52)|0,ee()|0,b=b&15,!b)return x=m,b=p,On(x|0),b|0;for(x=1;;){switch(v=(15-x|0)*3|0,g=tt(p|0,m|0,v|0)|0,ee()|0,_=ft(7,0,v|0)|0,_=p&~_,m=m&~(ee()|0),g&7){case 1:{p=5;break}case 5:{p=4;break}case 4:{p=6;break}case 6:{p=2;break}case 2:{p=3;break}case 3:{p=1;break}default:p=g&7}if(p=ft(p|0,0,v|0)|0,p=p|_,m=ee()|0|m,x>>>0<b>>>0)x=x+1|0;else break}return On(m|0),p|0}function Yce(p,m){p=p|0,m=m|0;var g=0,_=0,v=0,x=0,b=0,E=0,M=0,N=0,O=0;if(O=tt(p|0,m|0,52)|0,ee()|0,O=O&15,!O)return N=m,O=p,On(N|0),O|0;for(N=1,g=0;;){switch(_=(15-N|0)*3|0,E=ft(7,0,_|0)|0,M=ee()|0,x=p&~E,b=m&~M,p=tt(p|0,m|0,_|0)|0,ee()|0,p&7){case 1:{p=3;break}case 3:{p=2;break}case 2:{p=6;break}case 6:{p=4;break}case 4:{p=5;break}case 5:{p=1;break}default:p=p&7}_=ft(p|0,0,_|0)|0,v=ee()|0,p=_|x,m=v|b;e:do if(!g)if((_&E|0)==0&(v&M|0)==0)g=0;else if(b=tt(p|0,m|0,52)|0,ee()|0,b=b&15,!b)g=1;else{g=1;t:for(;;){switch(M=tt(p|0,m|0,(15-g|0)*3|0)|0,ee()|0,M&7){case 1:break t;case 0:break;default:{g=1;break e}}if(g>>>0<b>>>0)g=g+1|0;else{g=1;break e}}for(x=1;;){switch(g=(15-x|0)*3|0,_=ft(7,0,g|0)|0,_=p&~_,v=m&~(ee()|0),p=tt(p|0,m|0,g|0)|0,ee()|0,p&7){case 1:{p=3;break}case 3:{p=2;break}case 2:{p=6;break}case 6:{p=4;break}case 4:{p=5;break}case 5:{p=1;break}default:p=p&7}if(p=ft(p|0,0,g|0)|0,p=p|_,m=ee()|0|v,x>>>0<b>>>0)x=x+1|0;else{g=1;break e}}}while(!1);if(N>>>0<O>>>0)N=N+1|0;else break}return On(m|0),p|0}function oL(p,m){p=p|0,m=m|0;var g=0,_=0,v=0,x=0,b=0;if(b=tt(p|0,m|0,52)|0,ee()|0,b=b&15,!b)return x=m,b=p,On(x|0),b|0;for(x=1;;){switch(_=(15-x|0)*3|0,g=ft(7,0,_|0)|0,g=p&~g,v=m&~(ee()|0),p=tt(p|0,m|0,_|0)|0,ee()|0,p&7){case 1:{p=3;break}case 3:{p=2;break}case 2:{p=6;break}case 6:{p=4;break}case 4:{p=5;break}case 5:{p=1;break}default:p=p&7}if(p=ft(p|0,0,_|0)|0,p=p|g,m=ee()|0|v,x>>>0<b>>>0)x=x+1|0;else break}return On(m|0),p|0}function Zce(p,m){p=p|0,m=m|0;var g=0,_=0,v=0,x=0,b=0,E=0,M=0,N=0,O=0,q=0,j=0,X=0,K=0,ae=0,ue=0,xe=0,se=0,we=0,Ae=0,Be=0,Ke=0,Me=0;if(Ae=Q,Q=Q+16|0,we=Ae,ft(m|0,0,52)|0,g=ee()|0|134225919,!m)return(h[p+4>>2]|0)>2||(h[p+8>>2]|0)>2||(h[p+12>>2]|0)>2?(se=0,we=0,On(se|0),Q=Ae,we|0):(ft(OG(p)|0,0,45)|0,se=ee()|0|g,we=-1,On(se|0),Q=Ae,we|0);h[we>>2]=h[p>>2],h[we+4>>2]=h[p+4>>2],h[we+8>>2]=h[p+8>>2],h[we+12>>2]=h[p+12>>2],se=we+4|0;e:do if((m|0)>0)for(ae=we+8|0,ue=we+12|0,K=m,q=h[ae>>2]|0,j=h[ue>>2]|0,m=-1,O=h[we+4>>2]|0;;){X=K,K=K+-1|0,p=O-j|0,_=q-j|0,X&1?(x=rh(+((p*3|0)-_|0)*.14285714285714285)|0,h[se>>2]=x,p=rh(+((_<<1)+p|0)*.14285714285714285)|0,h[ae>>2]=p,h[ue>>2]=0,_=p-x|0,v=0-x|0,(x|0)<0?(h[ae>>2]=_,h[ue>>2]=v,h[se>>2]=0,p=_,b=0):(b=x,v=0),x=b-p|0,_=v-p|0,(p|0)<0?(h[se>>2]=x,h[ue>>2]=_,h[ae>>2]=0,b=x,x=0):(_=v,x=p),p=b-_|0,v=x-_|0,(_|0)<0?(h[se>>2]=p,h[ae>>2]=v,h[ue>>2]=0,x=0):(v=x,p=b,x=_),_=(v|0)<(p|0)?v:p,_=(x|0)<(_|0)?x:_,(_|0)>0&&(x=x-_|0,v=v-_|0,p=p-_|0,h[se>>2]=p,h[ae>>2]=v,h[ue>>2]=x),Ke=v+(p*3|0)|0,Be=(Ke|0)<0,N=x+(v*3|0)-(Be?Ke:0)|0,M=(N|0)<0,_=(x*3|0)+p-(Be?Ke:0)-(M?N:0)|0,E=(_|0)<0,Me=E?0:_,b=(M?0:N)-(E?_:0)|0,_=(Be?0:Ke)-(M?N:0)-(E?_:0)|0,E=(b|0)<(_|0)?b:_,E=(Me|0)<(E|0)?Me:E,N=(E|0)>0,M=N?E:0,b=b-(N?E:0)|0,E=Me-(N?E:0)|0,N=x):(E=rh(+((p<<1)+_|0)*.14285714285714285)|0,h[se>>2]=E,v=rh(+((_*3|0)-p|0)*.14285714285714285)|0,h[ae>>2]=v,h[ue>>2]=0,_=v-E|0,p=0-E|0,(E|0)<0?(h[ae>>2]=_,h[ue>>2]=p,h[se>>2]=0,v=_,E=0):p=0,b=E-v|0,_=p-v|0,(v|0)<0?(h[se>>2]=b,h[ue>>2]=_,h[ae>>2]=0,x=_,v=0):(x=p,b=E),p=b-x|0,_=v-x|0,(x|0)<0?(h[se>>2]=p,h[ae>>2]=_,h[ue>>2]=0,v=_,x=0):p=b,_=(v|0)<(p|0)?v:p,_=(x|0)<(_|0)?x:_,(_|0)>0&&(x=x-_|0,v=v-_|0,p=p-_|0,h[se>>2]=p,h[ae>>2]=v,h[ue>>2]=x),Ke=x+(p*3|0)|0,Me=(Ke|0)<0,N=(v*3|0)+p-(Me?Ke:0)|0,M=(N|0)<0,_=(x*3|0)+v-(Me?Ke:0)-(M?N:0)|0,E=(_|0)<0,Be=E?0:_,b=(M?0:N)-(E?_:0)|0,_=(Me?0:Ke)-(M?N:0)-(E?_:0)|0,E=(b|0)<(_|0)?b:_,E=(Be|0)<(E|0)?Be:E,N=(E|0)>0,M=N?E:0,b=b-(N?E:0)|0,E=Be-(N?E:0)|0,N=x),_=O+(M-_)|0,x=(_|0)<0,M=q-b-(x?_:0)|0,b=(M|0)<0,j=j-E+(x?0-_|0:0)+(b?0-M|0:0)|0,O=(j|0)<0,E=O?0:j,Me=(b?0:M)-(O?j:0)|0,j=(x?0:_)-(b?M:0)-(O?j:0)|0,O=(Me|0)<(j|0)?Me:j,O=(E|0)<(O|0)?E:O,M=(O|0)>0,j=j-(M?O:0)|0,b=(15-X|0)*3|0,_=ft(7,0,b|0)|0,_=m&~_,x=g&~(ee()|0),q=(j|0)<0,Ke=q?j:0,Me=Me-(M?O:0)-Ke|0,Be=(Me|0)<0,Ke=(Be?0-Me|0:0)+(E-(M?O:0)-Ke)|0,g=(Ke|0)<0,m=g?0:Ke,Ke=g?Ke:0,g=(Be?0:Me)-Ke|0,Ke=(q?0:j)-(Be?Me:0)-Ke|0,Me=(g|0)<(Ke|0)?g:Ke,Me=(m|0)<(Me|0)?m:Me,Me=(Me|0)>0?Me:0,m=m-Me|0,g=g-Me|0;t:do switch(Ke-Me|0){case 0:switch(g|0){case 0:{m=(m|0)==0?0:(m|0)==1?1:7;break t}case 1:{m=(m|0)==0?2:(m|0)==1?3:7;break t}default:{xe=36;break t}}case 1:switch(g|0){case 0:{m=(m|0)==0?4:(m|0)==1?5:7;break t}case 1:if(m){xe=36;break t}else{m=6;break t}default:{xe=36;break t}}default:xe=36}while(!1);if((xe|0)==36&&(xe=0,m=7),m=ft(m|0,0,b|0)|0,m=m|_,g=ee()|0|x,(X|0)<=1)break e;q=v,j=N,O=p}else m=-1,p=h[se>>2]|0;while(!1);e:do if((p|0)<=2&&(h[we+8>>2]|0)<=2&&(h[we+12>>2]|0)<=2){if(_=OG(we)|0,p=ft(_|0,0,45)|0,m=p|m,p=ee()|0|g&-1040385,M=vce(we)|0,!(xr(_)|0)){if((M|0)<=0)break;for(E=0;;){b=tt(m|0,p|0,52)|0,ee()|0,b=b&15;t:do if(b)for(x=1;;){switch(v=(15-x|0)*3|0,g=tt(m|0,p|0,v|0)|0,ee()|0,_=ft(7,0,v|0)|0,m=m&~_,_=p&~(ee()|0),g&7){case 1:{p=5;break}case 5:{p=4;break}case 4:{p=6;break}case 6:{p=2;break}case 2:{p=3;break}case 3:{p=1;break}default:p=g&7}if(p=ft(p|0,0,v|0)|0,m=p|m,p=ee()|0|_,x>>>0<b>>>0)x=x+1|0;else break t}while(!1);if(E=E+1|0,(E|0)==(M|0))break e}}b=tt(m|0,p|0,52)|0,ee()|0,b=b&15;t:do if(b){g=1;n:for(;;){switch(Me=tt(m|0,p|0,(15-g|0)*3|0)|0,ee()|0,Me&7){case 1:break n;case 0:break;default:break t}if(g>>>0<b>>>0)g=g+1|0;else break t}if(UG(_,h[we>>2]|0)|0)for(x=1;;){switch(g=(15-x|0)*3|0,_=ft(7,0,g|0)|0,_=m&~_,v=p&~(ee()|0),p=tt(m|0,p|0,g|0)|0,ee()|0,p&7){case 1:{p=3;break}case 3:{p=2;break}case 2:{p=6;break}case 6:{p=4;break}case 4:{p=5;break}case 5:{p=1;break}default:p=p&7}if(m=ft(p|0,0,g|0)|0,m=m|_,p=ee()|0|v,x>>>0<b>>>0)x=x+1|0;else break t}else for(x=1;;){switch(v=(15-x|0)*3|0,g=tt(m|0,p|0,v|0)|0,ee()|0,_=ft(7,0,v|0)|0,m=m&~_,_=p&~(ee()|0),g&7){case 1:{p=5;break}case 5:{p=4;break}case 4:{p=6;break}case 6:{p=2;break}case 2:{p=3;break}case 3:{p=1;break}default:p=g&7}if(p=ft(p|0,0,v|0)|0,m=p|m,p=ee()|0|_,x>>>0<b>>>0)x=x+1|0;else break t}}while(!1);if((M|0)>0){g=0;do m=sL(m,p)|0,p=ee()|0,g=g+1|0;while((g|0)!=(M|0))}}else m=0,p=0;while(!1);return Ke=p,Me=m,On(Ke|0),Q=Ae,Me|0}function gc(p){return p=p|0,(p|0)%2|0|0}function aL(p,m,g){p=p|0,m=m|0,g=g|0;var _=0,v=0,x=0,b=0,E=0,M=0,N=0,O=0,q=0;if(O=Q,Q=Q+64|0,E=O+24|0,M=O+48|0,N=O,m>>>0>15)return N=4,Q=O,N|0;if(x=+ie[p>>3],ie[or>>3]=x,(h[or+4>>2]&2146435072|0)==2146435072||(_=+ie[p+8>>3],ie[or>>3]=_,(h[or+4>>2]&2146435072|0)==2146435072))return N=3,Q=O,N|0;v=+ii(+x),q=v*+ii(+_),v=v*+zi(+_),_=+zi(+x),ie[N>>3]=q,ie[N+8>>3]=v,ie[N+16>>3]=_,ie[or>>3]=q;do if((h[or+4>>2]&2146435072|0)!=2146435072&&(ie[or>>3]=_,p=h[or+4>>2]|0,ie[or>>3]=v,!((h[or+4>>2]&2146435072|0)==2146435072|!0&(p&2146435072|0)==2146435072)))if(h[E>>2]=h[N>>2],h[E+4>>2]=h[N+4>>2],h[E+8>>2]=h[N+8>>2],h[E+12>>2]=h[N+12>>2],h[E+16>>2]=h[N+16>>2],h[E+20>>2]=h[N+20>>2],Uce(E,m,M),M=Zce(M,m)|0,N=ee()|0,h[g>>2]=M,h[g+4>>2]=N,(M|0)==0&(N|0)==0)di(27634,27225,1073,27248);else{b=0;break}else b=2;while(!1);return N=b,Q=O,N|0}function lL(p,m,g){p=p|0,m=m|0,g=g|0;var _=0,v=0,x=0,b=0,E=0,M=0,N=0,O=0,q=0,j=0,X=0,K=0;if(X=g+4|0,K=tt(p|0,m|0,52)|0,ee()|0,K=K&15,j=tt(p|0,m|0,45)|0,ee()|0,_=(K|0)==0,xr(j&127)|0){if(_)return K=1,K|0;_=1}else{if(_)return K=0,K|0;(h[X>>2]|0)==0&&(h[g+8>>2]|0)==0?_=(h[g+12>>2]|0)!=0&1:_=1}for(j=g+8|0,q=g+12|0,O=1,g=h[X>>2]|0,b=h[j>>2]|0,x=h[q>>2]|0;v=g*3|0,E=b*3|0,N=x*3|0,O&1?(M=b+v|0,h[X>>2]=M,x=x+E|0,h[j>>2]=x,v=N+g|0,h[q>>2]=v,g=x-M|0,b=v-M|0,(M|0)<0?(h[j>>2]=g,h[q>>2]=b,h[X>>2]=0,E=0,v=b):(g=x,E=M),b=E-g|0,x=v-g|0,(g|0)<0?(h[X>>2]=b,h[q>>2]=x,h[j>>2]=0,E=b,v=0):(x=v,v=g),g=E-x|0,b=v-x|0,(x|0)<0?(h[X>>2]=g,h[j>>2]=b,h[q>>2]=0,x=0):(b=v,g=E),v=(b|0)<(g|0)?b:g,v=(x|0)<(v|0)?x:v,(v|0)>0&&(x=x-v|0,b=b-v|0,g=g-v|0,h[X>>2]=g,h[j>>2]=b,h[q>>2]=x)):(M=E+g|0,E=x+v|0,h[X>>2]=E,h[j>>2]=M,v=N+b|0,h[q>>2]=v,g=M-E|0,x=v-E|0,(E|0)<0?(h[j>>2]=g,h[q>>2]=x,h[X>>2]=0,E=0,v=x):g=M,b=E-g|0,x=v-g|0,(g|0)<0?(h[X>>2]=b,h[q>>2]=x,h[j>>2]=0,E=b,v=0):(x=v,v=g),g=E-x|0,b=v-x|0,(x|0)<0?(h[X>>2]=g,h[j>>2]=b,h[q>>2]=0,x=0):(b=v,g=E),v=(b|0)<(g|0)?b:g,v=(x|0)<(v|0)?x:v,(v|0)>0&&(x=x-v|0,b=b-v|0,g=g-v|0,h[X>>2]=g,h[j>>2]=b,h[q>>2]=x)),v=tt(p|0,m|0,(15-O|0)*3|0)|0,ee()|0,v=v&7,(v+-1|0)>>>0<6&&(M=h[22032+(v*12|0)+4>>2]|0,N=h[22032+(v*12|0)+8>>2]|0,E=(h[22032+(v*12|0)>>2]|0)+g|0,h[X>>2]=E,b=M+b|0,h[j>>2]=b,g=N+x|0,h[q>>2]=g,x=b-E|0,v=g-E|0,(E|0)<0&&(h[j>>2]=x,h[q>>2]=v,h[X>>2]=0,E=0,g=v,b=x),v=E-b|0,x=g-b|0,(b|0)<0?(h[X>>2]=v,h[q>>2]=x,h[j>>2]=0,E=v,b=0):x=g,g=E-x|0,v=b-x|0,(x|0)<0?(h[X>>2]=g,h[j>>2]=v,h[q>>2]=0,b=v,x=0):g=E,v=(b|0)<(g|0)?b:g,v=(x|0)<(v|0)?x:v,(v|0)>0&&(x=x-v|0,b=b-v|0,g=g-v|0,h[X>>2]=g,h[j>>2]=b,h[q>>2]=x)),O>>>0<K>>>0;)O=O+1|0;return _|0}function g1(p,m,g){p=p|0,m=m|0,g=g|0;var _=0,v=0,x=0,b=0,E=0,M=0,N=0,O=0,q=0,j=0,X=0,K=0;if(K=Q,Q=Q+16|0,q=K,j=tt(p|0,m|0,45)|0,ee()|0,j=j&127,j>>>0>121)return h[g>>2]=0,h[g+4>>2]=0,h[g+8>>2]=0,h[g+12>>2]=0,X=5,Q=K,X|0;e:do if((xr(j)|0)!=0&&(E=tt(p|0,m|0,52)|0,ee()|0,E=E&15,(E|0)!=0)){_=1;t:for(;;){switch(X=tt(p|0,m|0,(15-_|0)*3|0)|0,ee()|0,X&7){case 5:break t;case 0:break;default:{N=m;break e}}if(_>>>0<E>>>0)_=_+1|0;else{N=m;break e}}for(b=1,_=m;;){switch(m=(15-b|0)*3|0,v=ft(7,0,m|0)|0,v=p&~v,x=_&~(ee()|0),_=tt(p|0,_|0,m|0)|0,ee()|0,_&7){case 1:{_=3;break}case 3:{_=2;break}case 2:{_=6;break}case 6:{_=4;break}case 4:{_=5;break}case 5:{_=1;break}default:_=_&7}if(p=ft(_|0,0,m|0)|0,p=p|v,_=ee()|0|x,b>>>0<E>>>0)b=b+1|0;else{N=_;break e}}}else N=m;while(!1);if(X=7696+(j*28|0)|0,h[g>>2]=h[X>>2],h[g+4>>2]=h[X+4>>2],h[g+8>>2]=h[X+8>>2],h[g+12>>2]=h[X+12>>2],!(lL(p,N,g)|0))return X=0,Q=K,X|0;if(X=g+4|0,h[q>>2]=h[X>>2],h[q+4>>2]=h[X+4>>2],h[q+8>>2]=h[X+8>>2],M=tt(p|0,N|0,52)|0,ee()|0,O=M&15,M&1?(x=h[X>>2]|0,E=g+8|0,v=h[E>>2]|0,M=g+12|0,m=h[M>>2]|0,_=(v*3|0)+x|0,x=m+(x*3|0)|0,h[X>>2]=x,h[E>>2]=_,v=(m*3|0)+v|0,h[M>>2]=v,m=_-x|0,b=v-x|0,(x|0)<0&&(h[E>>2]=m,h[M>>2]=b,h[X>>2]=0,_=m,x=0,v=b),b=x-_|0,m=v-_|0,(_|0)<0?(h[X>>2]=b,h[M>>2]=m,h[E>>2]=0,_=0):(m=v,b=x),x=b-m|0,v=_-m|0,(m|0)<0?(h[X>>2]=x,h[E>>2]=v,h[M>>2]=0,m=0):(v=_,x=b),_=(v|0)<(x|0)?v:x,_=(m|0)<(_|0)?m:_,(_|0)>0&&(h[X>>2]=x-_,h[E>>2]=v-_,h[M>>2]=m-_),v=O+1|0):v=O,!(xr(j)|0))_=0;else{e:do if(!O)_=0;else for(m=1;;){if(_=tt(p|0,N|0,(15-m|0)*3|0)|0,ee()|0,_=_&7,_|0)break e;if(m>>>0<O>>>0)m=m+1|0;else{_=0;break}}while(!1);_=(_|0)==4&1}if(!(A1(g,v,_,0)|0))(v|0)!=(O|0)&&(h[X>>2]=h[q>>2],h[X+4>>2]=h[q+4>>2],h[X+8>>2]=h[q+8>>2]);else{if(xr(j)|0)do;while((A1(g,v,0,0)|0)!=0);(v|0)!=(O|0)&&(E=g+12|0,p=h[E>>2]|0,_=(h[X>>2]|0)-p|0,b=g+8|0,p=(h[b>>2]|0)-p|0,m=rh(+((_<<1)+p|0)*.14285714285714285)|0,h[X>>2]=m,_=rh(+((p*3|0)-_|0)*.14285714285714285)|0,h[b>>2]=_,h[E>>2]=0,p=_-m|0,v=0-m|0,(m|0)<0?(h[b>>2]=p,h[E>>2]=v,h[X>>2]=0,_=p,m=0):v=0,x=m-_|0,p=v-_|0,(_|0)<0?(h[X>>2]=x,h[E>>2]=p,h[b>>2]=0,m=x,_=0):p=v,x=m-p|0,v=_-p|0,(p|0)<0?(h[X>>2]=x,h[b>>2]=v,h[E>>2]=0,m=x,p=0):v=_,_=(v|0)<(m|0)?v:m,_=(p|0)<(_|0)?p:_,(_|0)>0&&(h[X>>2]=m-_,h[b>>2]=v-_,h[E>>2]=p-_))}return X=0,Q=K,X|0}function v1(p,m,g){p=p|0,m=m|0,g=g|0;var _=0,v=0,x=0,b=0,E=0,M=0;return b=Q,Q=Q+48|0,_=b+24|0,v=b,x=g1(p,m,_)|0,x?(Q=b,x|0):(x=tt(p|0,m|0,52)|0,ee()|0,kce(_,x&15,v),M=+Ox(+ +ie[v+16>>3]),E=+Sa(+ +ie[v+8>>3],+ +ie[v>>3]),ie[g>>3]=M,ie[g+8>>3]=E,x=0,Q=b,x|0)}function Bm(p,m,g){p=p|0,m=m|0,g=g|0;var _=0,v=0,x=0,b=0,E=0;if(b=Q,Q=Q+16|0,x=b,_=g1(p,m,x)|0,_|0)return x=_,Q=b,x|0;_=tt(p|0,m|0,45)|0,ee()|0,_=(xr(_&127)|0)==0,v=tt(p|0,m|0,52)|0,ee()|0,v=v&15;e:do if(!_){if(v|0)for(_=1;;){if(E=ft(7,0,(15-_|0)*3|0)|0,!((E&p|0)==0&((ee()|0)&m|0)==0))break e;if(_>>>0<v>>>0)_=_+1|0;else break}return eL(x,v,0,5,g),E=0,Q=b,E|0}while(!1);return tL(x,v,0,6,g),E=0,Q=b,E|0}function Kce(p,m,g){p=p|0,m=m|0,g=g|0;var _=0,v=0,x=0;if(v=tt(p|0,m|0,45)|0,ee()|0,!(xr(v&127)|0))return v=2,h[g>>2]=v,0;if(v=tt(p|0,m|0,52)|0,ee()|0,v=v&15,!v)return v=5,h[g>>2]=v,0;for(_=1;;){if(x=ft(7,0,(15-_|0)*3|0)|0,!((x&p|0)==0&((ee()|0)&m|0)==0)){_=2,p=6;break}if(_>>>0<v>>>0)_=_+1|0;else{_=5,p=6;break}}return(p|0)==6&&(h[g>>2]=_),0}function ZG(p,m,g){p=p|0,m=m|0,g=g|0;var _=0,v=0,x=0,b=0,E=0,M=0,N=0,O=0,q=0;q=Q,Q=Q+128|0,N=q+112|0,x=q+96|0,O=q,v=tt(p|0,m|0,52)|0,ee()|0,E=v&15,h[N>>2]=E,b=tt(p|0,m|0,45)|0,ee()|0,b=b&127;e:do if(xr(b)|0){if(E|0)for(_=1;;){if(M=ft(7,0,(15-_|0)*3|0)|0,!((M&p|0)==0&((ee()|0)&m|0)==0)){v=0;break e}if(_>>>0<E>>>0)_=_+1|0;else break}if(v&1)v=1;else return M=ft(E+1|0,0,52)|0,O=ee()|0|m&-15728641,N=ft(7,0,(14-E|0)*3|0)|0,O=ZG((M|p)&~N,O&~(ee()|0),g)|0,Q=q,O|0}else v=0;while(!1);if(_=g1(p,m,x)|0,!_){v?(WG(x,N,O),M=5):(jG(x,N,O),M=6);e:do if(xr(b)|0)if(!E)p=5;else for(_=1;;){if(b=ft(7,0,(15-_|0)*3|0)|0,!((b&p|0)==0&((ee()|0)&m|0)==0)){p=2;break e}if(_>>>0<E>>>0)_=_+1|0;else{p=5;break}}else p=2;while(!1);sp(g|0,-1,p<<2|0)|0;e:do if(v)for(x=0;;){if(b=O+(x<<4)|0,zce(b,h[N>>2]|0)|0,b=h[b>>2]|0,E=h[g>>2]|0,(E|0)==-1|(E|0)==(b|0))_=g;else{v=0;do{if(v=v+1|0,v>>>0>=p>>>0){_=1;break e}_=g+(v<<2)|0,E=h[_>>2]|0}while(!((E|0)==-1|(E|0)==(b|0)))}if(h[_>>2]=b,x=x+1|0,x>>>0>=M>>>0){_=0;break}}else for(x=0;;){if(b=O+(x<<4)|0,A1(b,h[N>>2]|0,0,1)|0,b=h[b>>2]|0,E=h[g>>2]|0,(E|0)==-1|(E|0)==(b|0))_=g;else{v=0;do{if(v=v+1|0,v>>>0>=p>>>0){_=1;break e}_=g+(v<<2)|0,E=h[_>>2]|0}while(!((E|0)==-1|(E|0)==(b|0)))}if(h[_>>2]=b,x=x+1|0,x>>>0>=M>>>0){_=0;break}}while(!1)}return O=_,Q=q,O|0}function Qce(){return 12}function cL(p,m){p=p|0,m=m|0;var g=0,_=0,v=0,x=0,b=0,E=0,M=0;if(p>>>0>15)return E=4,E|0;if(ft(p|0,0,52)|0,E=ee()|0|134225919,!p){g=0,_=0;do xr(_)|0&&(ft(_|0,0,45)|0,b=E|(ee()|0),p=m+(g<<3)|0,h[p>>2]=-1,h[p+4>>2]=b,g=g+1|0),_=_+1|0;while((_|0)!=122);return g=0,g|0}g=0,b=0;do{if(xr(b)|0){for(ft(b|0,0,45)|0,_=1,v=-1,x=E|(ee()|0);M=ft(7,0,(15-_|0)*3|0)|0,v=v&~M,x=x&~(ee()|0),(_|0)!=(p|0);)_=_+1|0;M=m+(g<<3)|0,h[M>>2]=v,h[M+4>>2]=x,g=g+1|0}b=b+1|0}while((b|0)!=122);return g=0,g|0}function Jce(p,m,g,_){p=p|0,m=m|0,g=g|0,_=_|0;var v=0,x=0,b=0,E=0,M=0,N=0,O=0,q=0,j=0,X=0,K=0,ae=0,ue=0,xe=0,se=0;if(se=Q,Q=Q+16|0,ue=se,xe=tt(p|0,m|0,52)|0,ee()|0,xe=xe&15,g>>>0>15)return xe=4,Q=se,xe|0;if((xe|0)<(g|0))return xe=12,Q=se,xe|0;if((xe|0)!=(g|0))if(x=ft(g|0,0,52)|0,x=x|p,E=ee()|0|m&-15728641,(xe|0)>(g|0)){M=g;do ae=ft(7,0,(14-M|0)*3|0)|0,M=M+1|0,x=ae|x,E=ee()|0|E;while((M|0)<(xe|0));ae=x}else ae=x;else ae=p,E=m;K=tt(ae|0,E|0,45)|0,ee()|0;e:do if(xr(K&127)|0){if(M=tt(ae|0,E|0,52)|0,ee()|0,M=M&15,M|0)for(x=1;;){if(K=ft(7,0,(15-x|0)*3|0)|0,!((K&ae|0)==0&((ee()|0)&E|0)==0)){N=33;break e}if(x>>>0<M>>>0)x=x+1|0;else break}if(K=_,h[K>>2]=0,h[K+4>>2]=0,(xe|0)>(g|0)){for(K=m&-15728641,X=xe;;){if(j=X,X=X+-1|0,X>>>0>15|(xe|0)<(X|0)){N=19;break}if((xe|0)!=(X|0))if(x=ft(X|0,0,52)|0,x=x|p,M=ee()|0|K,(xe|0)<(j|0))q=x;else{N=X;do q=ft(7,0,(14-N|0)*3|0)|0,N=N+1|0,x=q|x,M=ee()|0|M;while((N|0)<(xe|0));q=x}else q=p,M=m;if(O=tt(q|0,M|0,45)|0,ee()|0,!(xr(O&127)|0))x=0;else{O=tt(q|0,M|0,52)|0,ee()|0,O=O&15;t:do if(!O)x=0;else for(N=1;;){if(x=tt(q|0,M|0,(15-N|0)*3|0)|0,ee()|0,x=x&7,x|0)break t;if(N>>>0<O>>>0)N=N+1|0;else{x=0;break}}while(!1);x=(x|0)==0&1}if(M=tt(p|0,m|0,(15-j|0)*3|0)|0,ee()|0,M=M&7,(M|0)==7){v=5,N=42;break}if(x=(x|0)!=0,(M|0)==1&x){v=5,N=42;break}if(q=M+(((M|0)!=0&x)<<31>>31)|0,q|0&&(N=xe-j|0,N=np(7,0,N,((N|0)<0)<<31>>31)|0,O=ee()|0,x?(x=br(N|0,O|0,5,0)|0,x=At(x|0,ee()|0,-5,-1)|0,x=ip(x|0,ee()|0,6,0)|0,x=At(x|0,ee()|0,1,0)|0,M=ee()|0):(x=N,M=O),j=q+-1|0,j=br(N|0,O|0,j|0,((j|0)<0)<<31>>31|0)|0,j=At(x|0,M|0,j|0,ee()|0)|0,q=ee()|0,O=_,O=At(j|0,q|0,h[O>>2]|0,h[O+4>>2]|0)|0,q=ee()|0,j=_,h[j>>2]=O,h[j+4>>2]=q),(X|0)<=(g|0)){N=37;break}}if((N|0)==19)di(27634,27225,1407,27259);else if((N|0)==37){b=_,v=h[b+4>>2]|0,b=h[b>>2]|0;break}else if((N|0)==42)return Q=se,v|0}else v=0,b=0}else N=33;while(!1);e:do if((N|0)==33)if(K=_,h[K>>2]=0,h[K+4>>2]=0,(xe|0)>(g|0)){for(x=xe;;){if(v=tt(p|0,m|0,(15-x|0)*3|0)|0,ee()|0,v=v&7,(v|0)==7){v=5;break}if(b=xe-x|0,b=np(7,0,b,((b|0)<0)<<31>>31)|0,v=br(b|0,ee()|0,v|0,0)|0,b=ee()|0,K=_,b=At(h[K>>2]|0,h[K+4>>2]|0,v|0,b|0)|0,v=ee()|0,K=_,h[K>>2]=b,h[K+4>>2]=v,x=x+-1|0,(x|0)<=(g|0))break e}return Q=se,v|0}else v=0,b=0;while(!1);return zx(ae,E,xe,ue)|0&&di(27634,27225,1367,27274),xe=ue,ue=h[xe+4>>2]|0,((v|0)>-1|(v|0)==-1&b>>>0>4294967295)&((ue|0)>(v|0)|((ue|0)==(v|0)?(h[xe>>2]|0)>>>0>b>>>0:0))?(xe=0,Q=se,xe|0):(di(27634,27225,1447,27259),0)}function eue(p,m,g,_,v,x){p=p|0,m=m|0,g=g|0,_=_|0,v=v|0,x=x|0;var b=0,E=0,M=0,N=0,O=0,q=0,j=0,X=0,K=0,ae=0;if(q=Q,Q=Q+16|0,b=q,v>>>0>15)return x=4,Q=q,x|0;if(E=tt(g|0,_|0,52)|0,ee()|0,E=E&15,(E|0)>(v|0))return x=12,Q=q,x|0;if(zx(g,_,v,b)|0&&di(27634,27225,1367,27274),O=b,N=h[O+4>>2]|0,!(((m|0)>-1|(m|0)==-1&p>>>0>4294967295)&((N|0)>(m|0)|((N|0)==(m|0)?(h[O>>2]|0)>>>0>p>>>0:0))))return x=2,Q=q,x|0;O=v-E|0,v=ft(v|0,0,52)|0,M=ee()|0|_&-15728641,N=x,h[N>>2]=v|g,h[N+4>>2]=M,N=tt(g|0,_|0,45)|0,ee()|0;e:do if(xr(N&127)|0){if(E|0)for(b=1;;){if(N=ft(7,0,(15-b|0)*3|0)|0,!((N&g|0)==0&((ee()|0)&_|0)==0))break e;if(b>>>0<E>>>0)b=b+1|0;else break}if((O|0)<1)return x=0,Q=q,x|0;for(N=E^15,_=-1,M=1,b=1;;){E=O-M|0,E=np(7,0,E,((E|0)<0)<<31>>31)|0,g=ee()|0;do if(b)if(b=br(E|0,g|0,5,0)|0,b=At(b|0,ee()|0,-5,-1)|0,b=ip(b|0,ee()|0,6,0)|0,v=ee()|0,(m|0)>(v|0)|(m|0)==(v|0)&p>>>0>b>>>0){m=At(p|0,m|0,-1,-1)|0,m=eo(m|0,ee()|0,b|0,v|0)|0,b=ee()|0,j=x,K=h[j>>2]|0,j=h[j+4>>2]|0,ae=(N+_|0)*3|0,X=ft(7,0,ae|0)|0,j=j&~(ee()|0),_=ip(m|0,b|0,E|0,g|0)|0,p=ee()|0,v=At(_|0,p|0,2,0)|0,ae=ft(v|0,ee()|0,ae|0)|0,j=ee()|0|j,v=x,h[v>>2]=ae|K&~X,h[v+4>>2]=j,p=br(_|0,p|0,E|0,g|0)|0,p=eo(m|0,b|0,p|0,ee()|0)|0,b=0,m=ee()|0;break}else{ae=x,X=h[ae>>2]|0,ae=h[ae+4>>2]|0,K=ft(7,0,(N+_|0)*3|0)|0,ae=ae&~(ee()|0),b=x,h[b>>2]=X&~K,h[b+4>>2]=ae,b=1;break}else X=x,v=h[X>>2]|0,X=h[X+4>>2]|0,_=(N+_|0)*3|0,j=ft(7,0,_|0)|0,X=X&~(ee()|0),ae=ip(p|0,m|0,E|0,g|0)|0,b=ee()|0,_=ft(ae|0,b|0,_|0)|0,X=ee()|0|X,K=x,h[K>>2]=_|v&~j,h[K+4>>2]=X,b=br(ae|0,b|0,E|0,g|0)|0,p=eo(p|0,m|0,b|0,ee()|0)|0,b=0,m=ee()|0;while(!1);if((O|0)>(M|0))_=~M,M=M+1|0;else{m=0;break}}return Q=q,m|0}while(!1);if((O|0)<1)return ae=0,Q=q,ae|0;for(v=E^15,b=1;;)if(K=O-b|0,K=np(7,0,K,((K|0)<0)<<31>>31)|0,ae=ee()|0,M=x,g=h[M>>2]|0,M=h[M+4>>2]|0,E=(v-b|0)*3|0,_=ft(7,0,E|0)|0,M=M&~(ee()|0),j=ip(p|0,m|0,K|0,ae|0)|0,X=ee()|0,E=ft(j|0,X|0,E|0)|0,M=ee()|0|M,N=x,h[N>>2]=E|g&~_,h[N+4>>2]=M,ae=br(j|0,X|0,K|0,ae|0)|0,p=eo(p|0,m|0,ae|0,ee()|0)|0,m=ee()|0,(O|0)<=(b|0)){m=0;break}else b=b+1|0;return Q=q,m|0}function uL(p,m,g,_){p=p|0,m=m|0,g=g|0,_=_|0;var v=0,x=0,b=0;v=tt(m|0,g|0,52)|0,ee()|0,v=v&15,(m|0)==0&(g|0)==0|((_|0)>15|(v|0)>(_|0))?(x=-1,m=-1,g=0,v=0):(m=$G(m,g,v+1|0,_)|0,b=(ee()|0)&-15728641,g=ft(_|0,0,52)|0,g=m|g,b=b|(ee()|0),m=(Zi(g,b)|0)==0,x=v,m=m?-1:_,v=b),b=p,h[b>>2]=g,h[b+4>>2]=v,h[p+8>>2]=x,h[p+12>>2]=m}function KG(p,m,g,_){p=p|0,m=m|0,g=g|0,_=_|0;var v=0,x=0;if(v=tt(p|0,m|0,52)|0,ee()|0,v=v&15,x=_+8|0,h[x>>2]=v,(p|0)==0&(m|0)==0|((g|0)>15|(v|0)>(g|0))){g=_,h[g>>2]=0,h[g+4>>2]=0,h[x>>2]=-1,h[_+12>>2]=-1;return}if(p=$G(p,m,v+1|0,g)|0,x=(ee()|0)&-15728641,v=ft(g|0,0,52)|0,v=p|v,x=x|(ee()|0),p=_,h[p>>2]=v,h[p+4>>2]=x,p=_+12|0,Zi(v,x)|0){h[p>>2]=g;return}else{h[p>>2]=-1;return}}function hL(p){p=p|0;var m=0,g=0,_=0,v=0,x=0,b=0,E=0,M=0,N=0;if(g=p,m=h[g>>2]|0,g=h[g+4>>2]|0,!((m|0)==0&(g|0)==0)&&(_=tt(m|0,g|0,52)|0,ee()|0,_=_&15,E=ft(1,0,(_^15)*3|0)|0,m=At(E|0,ee()|0,m|0,g|0)|0,g=ee()|0,E=p,h[E>>2]=m,h[E+4>>2]=g,E=p+8|0,b=h[E>>2]|0,!((_|0)<(b|0)))){for(M=p+12|0,x=_;;){if((x|0)==(b|0)){_=5;break}if(N=(x|0)==(h[M>>2]|0),v=(15-x|0)*3|0,_=tt(m|0,g|0,v|0)|0,ee()|0,_=_&7,N&((_|0)==1&!0)){_=7;break}if(!((_|0)==7&!0)){_=10;break}if(N=ft(1,0,v|0)|0,m=At(m|0,g|0,N|0,ee()|0)|0,g=ee()|0,N=p,h[N>>2]=m,h[N+4>>2]=g,(x|0)>(b|0))x=x+-1|0;else{_=10;break}}if((_|0)==5){N=p,h[N>>2]=0,h[N+4>>2]=0,h[E>>2]=-1,h[M>>2]=-1;return}else if((_|0)==7){b=ft(1,0,v|0)|0,b=At(m|0,g|0,b|0,ee()|0)|0,E=ee()|0,N=p,h[N>>2]=b,h[N+4>>2]=E,h[M>>2]=x+-1;return}else if((_|0)==10)return}}function Vx(p){p=+p;var m=0;return m=p<0?p+6.283185307179586:p,+(p>=6.283185307179586?m+-6.283185307179586:m)}function Ul(p,m){switch(p=+p,m=m|0,m|0){case 1:{p=p<0?p+6.283185307179586:p;break}case 2:{p=p>0?p+-6.283185307179586:p;break}default:}return+p}function tue(p,m){p=p|0,m=m|0;var g=0,_=0,v=0,x=0;return v=+ie[m>>3],_=+ie[p>>3],x=+zi(+((v-_)*.5)),g=+zi(+((+ie[m+8>>3]-+ie[p+8>>3])*.5)),g=x*x+g*(+ii(+v)*+ii(+_)*g),+(+Sa(+ +bs(+g),+ +bs(+(1-g)))*2)}function Gx(p,m){p=p|0,m=m|0;var g=0,_=0,v=0,x=0;return v=+ie[m>>3],_=+ie[p>>3],x=+zi(+((v-_)*.5)),g=+zi(+((+ie[m+8>>3]-+ie[p+8>>3])*.5)),g=x*x+g*(+ii(+v)*+ii(+_)*g),+(+Sa(+ +bs(+g),+ +bs(+(1-g)))*2*6371.007180918475)}function nue(p,m){p=p|0,m=m|0;var g=0,_=0,v=0,x=0;return v=+ie[m>>3],_=+ie[p>>3],x=+zi(+((v-_)*.5)),g=+zi(+((+ie[m+8>>3]-+ie[p+8>>3])*.5)),g=x*x+g*(+ii(+v)*+ii(+_)*g),+(+Sa(+ +bs(+g),+ +bs(+(1-g)))*2*6371.007180918475*1e3)}function QG(p,m){return p=p|0,m=m|0,p>>>0>15?(m=4,m|0):(ie[m>>3]=+ie[20624+(p<<3)>>3],m=0,m|0)}function iue(p,m){return p=p|0,m=m|0,p>>>0>15?(m=4,m|0):(ie[m>>3]=+ie[20752+(p<<3)>>3],m=0,m|0)}function rue(p,m){return p=p|0,m=m|0,p>>>0>15?(m=4,m|0):(ie[m>>3]=+ie[20880+(p<<3)>>3],m=0,m|0)}function sue(p,m){return p=p|0,m=m|0,p>>>0>15?(m=4,m|0):(ie[m>>3]=+ie[21008+(p<<3)>>3],m=0,m|0)}function tT(p,m){p=p|0,m=m|0;var g=0;return p>>>0>15?(m=4,m|0):(g=np(7,0,p,((p|0)<0)<<31>>31)|0,g=br(g|0,ee()|0,120,0)|0,p=ee()|0,h[m>>2]=g|2,h[m+4>>2]=p,m=0,m|0)}function oue(p,m,g){p=p|0,m=m|0,g=g|0;var _=0,v=0,x=0,b=0,E=0,M=0,N=0,O=0;if(E=Q,Q=Q+176|0,b=E,p=Ux(p,m,b)|0,p|0)return b=p,Q=E,b|0;if(ie[g>>3]=0,p=h[b>>2]|0,(p|0)<=1)return b=0,Q=E,b|0;m=p+-1|0,p=0,_=+ie[b+8>>3],v=+ie[b+16>>3],x=0;do p=p+1|0,N=_,_=+ie[b+8+(p<<4)>>3],O=+zi(+((_-N)*.5)),M=v,v=+ie[b+8+(p<<4)+8>>3],M=+zi(+((v-M)*.5)),M=O*O+M*(+ii(+_)*+ii(+N)*M),x=x+ +Sa(+ +bs(+M),+ +bs(+(1-M)))*2;while((p|0)<(m|0));return ie[g>>3]=x,b=0,Q=E,b|0}function aue(p,m,g){p=p|0,m=m|0,g=g|0;var _=0,v=0,x=0,b=0,E=0,M=0,N=0,O=0;if(E=Q,Q=Q+176|0,b=E,p=Ux(p,m,b)|0,p|0)return b=p,x=+ie[g>>3],x=x*6371.007180918475,ie[g>>3]=x,Q=E,b|0;if(ie[g>>3]=0,p=h[b>>2]|0,(p|0)<=1)return b=0,x=0,x=x*6371.007180918475,ie[g>>3]=x,Q=E,b|0;m=p+-1|0,p=0,_=+ie[b+8>>3],v=+ie[b+16>>3],x=0;do p=p+1|0,N=_,_=+ie[b+8+(p<<4)>>3],O=+zi(+((_-N)*.5)),M=v,v=+ie[b+8+(p<<4)+8>>3],M=+zi(+((v-M)*.5)),M=O*O+M*(+ii(+N)*+ii(+_)*M),x=x+ +Sa(+ +bs(+M),+ +bs(+(1-M)))*2;while((p|0)!=(m|0));return ie[g>>3]=x,b=0,O=x,O=O*6371.007180918475,ie[g>>3]=O,Q=E,b|0}function lue(p,m,g){p=p|0,m=m|0,g=g|0;var _=0,v=0,x=0,b=0,E=0,M=0,N=0,O=0;if(E=Q,Q=Q+176|0,b=E,p=Ux(p,m,b)|0,p|0)return b=p,x=+ie[g>>3],x=x*6371.007180918475,x=x*1e3,ie[g>>3]=x,Q=E,b|0;if(ie[g>>3]=0,p=h[b>>2]|0,(p|0)<=1)return b=0,x=0,x=x*6371.007180918475,x=x*1e3,ie[g>>3]=x,Q=E,b|0;m=p+-1|0,p=0,_=+ie[b+8>>3],v=+ie[b+16>>3],x=0;do p=p+1|0,N=_,_=+ie[b+8+(p<<4)>>3],O=+zi(+((_-N)*.5)),M=v,v=+ie[b+8+(p<<4)+8>>3],M=+zi(+((v-M)*.5)),M=O*O+M*(+ii(+N)*+ii(+_)*M),x=x+ +Sa(+ +bs(+M),+ +bs(+(1-M)))*2;while((p|0)!=(m|0));return ie[g>>3]=x,b=0,O=x,O=O*6371.007180918475,O=O*1e3,ie[g>>3]=O,Q=E,b|0}function cue(p){p=p|0;var m=0,g=0,_=0,v=0,x=0,b=0,E=0;if(p)for(x=p+4|0,b=p+8|0,_=1,v=p;;){if(m=h[v>>2]|0,m|0)do{if(g=h[m>>2]|0,g|0)do E=g,g=h[g+16>>2]|0,_t(E);while((g|0)!=0);E=m,m=h[m+8>>2]|0,_t(E)}while((m|0)!=0);if(m=v,v=h[v+8>>2]|0,_?(h[p>>2]=0,h[x>>2]=0,h[b>>2]=0):_t(m),v)_=0;else break}}function uue(p,m){p=p|0,m=m|0;var g=0,_=0,v=0,x=0,b=0,E=0,M=0,N=0,O=0,q=0,j=0,X=0,K=0,ae=0,ue=0,xe=0;if(h[m>>2]=0,ue=m+4|0,h[ue>>2]=0,xe=m+8|0,h[xe>>2]=0,ae=h[p>>2]|0,(ae|0)<=0)return m=0,m|0;K=p+4|0,p=m,X=0;e:for(;;){if(X){if(g=Ta(1,12)|0,!g){g=5;break}h[p+8>>2]=g,p=g}if(M=h[K>>2]|0,N=Ta(1,12)|0,!N){p=13,g=37;break}if(j=p+4|0,_=h[j>>2]|0,h[((_|0)==0?p:_+8|0)>>2]=N,h[j>>2]=N,_=h[M+(X<<4)>>2]|0,(_|0)<3){p=1,g=37;break}v=M+(X<<4)+4|0,x=N+4|0,g=0,b=0;do{if(E=b,b=yr(24)|0,!b){p=13,g=37;break e}_L(b|0,(h[v>>2]|0)+(g<<4)|0,16)|0,h[b+16>>2]=0,E?h[E+16>>2]=b:h[N>>2]=b,h[x>>2]=b,g=g+1|0}while((g|0)<(_|0));if(q=h[M+(X<<4)+8>>2]|0,(q|0)>0){O=M+(X<<4)+12|0,M=0;do{if(_=h[O>>2]|0,g=N,N=Ta(1,12)|0,!N){p=13,g=37;break e}if(h[g+8>>2]=N,h[j>>2]=N,E=h[_+(M<<3)>>2]|0,(E|0)<3){p=1,g=37;break e}_=_+(M<<3)+4|0,v=N+4|0,g=0,x=0;do{if(b=x,x=yr(24)|0,!x){p=13,g=37;break e}_L(x|0,(h[_>>2]|0)+(g<<4)|0,16)|0,h[x+16>>2]=0,b?h[b+16>>2]=x:h[N>>2]=x,h[v>>2]=x,g=g+1|0}while((g|0)<(E|0));M=M+1|0}while((M|0)<(q|0))}if(X=X+1|0,(X|0)>=(ae|0)){p=0,g=50;break}}if((g|0)==5){if(!m)return m=13,m|0;for(_=1,v=m;;){if(p=h[v>>2]|0,p|0)do{if(g=h[p>>2]|0,g|0)do ae=g,g=h[g+16>>2]|0,_t(ae);while((g|0)!=0);ae=p,p=h[p+8>>2]|0,_t(ae)}while((p|0)!=0);if(p=v,v=h[v+8>>2]|0,_?(h[m>>2]=0,h[ue>>2]=0,h[xe>>2]=0):_t(p),v)_=0;else{p=13;break}}return p|0}else if((g|0)==37){if(!m)return m=p,m|0;for(v=1,x=m;;){if(g=h[x>>2]|0,g|0)do{if(_=h[g>>2]|0,_|0)do ae=_,_=h[_+16>>2]|0,_t(ae);while((_|0)!=0);ae=g,g=h[g+8>>2]|0,_t(ae)}while((g|0)!=0);if(g=x,x=h[x+8>>2]|0,v?(h[m>>2]=0,h[ue>>2]=0,h[xe>>2]=0):_t(g),x)v=0;else break}return p|0}else if((g|0)==50)return p|0;return 0}function qx(p,m,g,_,v){p=p|0,m=m|0,g=g|0,_=_|0,v=v|0;var x=0,b=0,E=0,M=0,N=0,O=0,q=0,j=0,X=0,K=0,ae=0,ue=0,xe=0,se=0;if(xe=Q,Q=Q+16|0,ue=xe,O=tt(p|0,m|0,52)|0,ee()|0,O=O&15,X=tt(g|0,_|0,52)|0,ee()|0,(O|0)!=(X&15|0))return ue=12,Q=xe,ue|0;if(M=tt(p|0,m|0,45)|0,ee()|0,M=M&127,N=tt(g|0,_|0,45)|0,ee()|0,N=N&127,M>>>0>121|N>>>0>121)return ue=5,Q=xe,ue|0;if(X=(M|0)!=(N|0),X){if(b=KP(M,N)|0,(b|0)==7)return ue=1,Q=xe,ue|0;E=KP(N,M)|0,(E|0)==7?di(27291,27315,164,27325):(ae=b,x=E)}else ae=0,x=0;q=xr(M)|0,j=xr(N)|0,h[ue>>2]=0,h[ue+4>>2]=0,h[ue+8>>2]=0,h[ue+12>>2]=0;do if(ae){N=h[4272+(M*28|0)+(ae<<2)>>2]|0,b=(N|0)>0;e:do if(j)if(b)for(M=0,E=g,b=_;;){switch(E=Yce(E,b)|0,b=ee()|0,x|0){case 5:case 1:{x=3;break}case 3:{x=2;break}case 2:{x=6;break}case 6:{x=4;break}case 4:{x=5;break}default:}if(M=M+1|0,(M|0)==(N|0)){N=x,M=E,E=b;break e}}else N=x,M=g,E=_;else if(b)for(M=0,E=g,b=_;;){switch(E=oL(E,b)|0,b=ee()|0,x|0){case 1:{x=3;break}case 3:{x=2;break}case 2:{x=6;break}case 6:{x=4;break}case 4:{x=5;break}case 5:{x=1;break}default:}if(M=M+1|0,(M|0)==(N|0)){N=x,M=E,E=b;break e}}else N=x,M=g,E=_;while(!1);if(lL(M,E,ue)|0,X||di(27340,27315,194,27325),b=(q|0)!=0,x=(j|0)!=0,b&x&&di(27367,27315,195,27325),b){if(x=al(p,m)|0,(x|0)==7){x=5;break}if(He[21968+(x*7|0)+ae>>0]|0){x=1;break}j=h[21136+(x*28|0)+(ae<<2)>>2]|0,X=j}else if(x){if(x=al(M,E)|0,(x|0)==7){x=5;break}if(He[21968+(x*7|0)+N>>0]|0){x=1;break}X=0,j=h[21136+(N*28|0)+(x<<2)>>2]|0}else X=0,j=0;if((X|j|0)>=0){if((j|0)>0){g=ue+4|0,_=ue+8|0,q=ue+12|0,N=0,E=h[g>>2]|0,b=h[_>>2]|0,x=h[q>>2]|0;do K=b+E|0,m=(K|0)<0,se=m?K:0,b=x+b-se|0,p=(b|0)<0,M=p?b:0,E=x+E-se-M|0,se=(E|0)<0,x=se?0:E,E=se?E:0,b=(p?0:b)-E|0,E=(m?0:K)-M-E|0,M=(b|0)<(E|0)?b:E,M=(x|0)<(M|0)?x:M,(M|0)>0&&(E=E-M|0,b=b-M|0,x=x-M|0),N=N+1|0;while((N|0)!=(j|0));h[g>>2]=E,h[_>>2]=b,h[q>>2]=x}if((ae+-1|0)>>>0<6?(x=h[22032+(ae*12|0)>>2]|0,E=h[22032+(ae*12|0)+4>>2]|0,se=h[22032+(ae*12|0)+8>>2]|0,b=(E|0)<(x|0)?E:x,b=(se|0)<(b|0)?se:b,b=(b|0)>0?b:0,x=x-b|0,E=E-b|0,b=se-b|0):(x=0,E=0,b=0),O)for(;;)if(M=x*3|0,N=E*3|0,g=b*3|0,gc(O)|0?(m=M+E|0,p=(m|0)<0,se=N+b-(p?m:0)|0,K=(se|0)<0,E=x+g-(p?m:0)-(K?se:0)|0,b=(E|0)<0,ae=b?0:E,M=(K?0:se)-(b?E:0)|0,E=(p?0:m)-(K?se:0)-(b?E:0)|0,b=(M|0)<(E|0)?M:E,b=(ae|0)<(b|0)?ae:b,se=(b|0)>0,x=se?b:0,M=M-(se?b:0)|0,b=ae-(se?b:0)|0):(K=M+b|0,m=(K|0)<0,se=N+x-(m?K:0)|0,x=(se|0)<0,E=g+E-(m?K:0)-(x?se:0)|0,b=(E|0)<0,ae=b?0:E,M=(x?0:se)-(b?E:0)|0,E=(m?0:K)-(x?se:0)-(b?E:0)|0,b=(M|0)<(E|0)?M:E,b=(ae|0)<(b|0)?ae:b,se=(b|0)>0,x=se?b:0,M=M-(se?b:0)|0,b=ae-(se?b:0)|0),x=E-x|0,(O|0)>1)O=O+-1|0,E=M;else{E=M;break}if((X|0)>0){M=0;do m=x+E|0,p=(m|0)<0,se=E+b-(p?m:0)|0,K=(se|0)<0,ae=x+b-(p?m:0)-(K?se:0)|0,x=(ae|0)<0,b=x?0:ae,E=(K?0:se)-(x?ae:0)|0,ae=(p?0:m)-(K?se:0)-(x?ae:0)|0,x=(E|0)<(ae|0)?E:ae,x=(b|0)<(x|0)?b:x,se=(x|0)>0,b=b-(se?x:0)|0,E=E-(se?x:0)|0,x=ae-(se?x:0)|0,M=M+1|0;while((M|0)!=(X|0))}g=ue+4|0,O=ue+8|0,ae=h[O>>2]|0,_=ue+12|0,se=h[_>>2]|0,M=(h[g>>2]|0)+x|0,h[g>>2]=M,E=ae+E|0,h[O>>2]=E,x=se+b|0,h[_>>2]=x,b=E-M|0,(M|0)<0?(x=x-M|0,h[O>>2]=b,h[_>>2]=x,h[g>>2]=0,E=0):(b=E,E=M),(b|0)<0&&(E=E-b|0,h[g>>2]=E,x=x-b|0,h[_>>2]=x,h[O>>2]=0,b=0),N=E-x|0,M=b-x|0,(x|0)<0?(h[g>>2]=N,h[O>>2]=M,h[_>>2]=0,E=N,x=0):M=b,b=(M|0)<(E|0)?M:E,b=(x|0)<(b|0)?x:b,(b|0)>0&&(h[g>>2]=E-b,h[O>>2]=M-b,h[_>>2]=x-b),K=77}else x=5}else if(lL(g,_,ue)|0,(q|0)!=0&(j|0)!=0)if((N|0)!=(M|0)&&di(27398,27315,264,27325),b=al(p,m)|0,x=al(g,_)|0,(b|0)==7|(x|0)==7)x=5;else if(He[21968+(b*7|0)+x>>0]|0)x=1;else if(g=h[21136+(b*28|0)+(x<<2)>>2]|0,(g|0)>0){O=ue+4|0,_=ue+8|0,q=ue+12|0,N=0,E=h[O>>2]|0,b=h[_>>2]|0,x=h[q>>2]|0;do ae=b+E|0,K=(ae|0)<0,p=K?ae:0,b=x+b-p|0,m=(b|0)<0,M=m?b:0,E=x+E-p-M|0,p=(E|0)<0,x=p?0:E,E=p?E:0,b=(m?0:b)-E|0,E=(K?0:ae)-M-E|0,M=(b|0)<(E|0)?b:E,M=(x|0)<(M|0)?x:M,(M|0)>0&&(E=E-M|0,b=b-M|0,x=x-M|0),N=N+1|0;while((N|0)!=(g|0));h[O>>2]=E,h[_>>2]=b,h[q>>2]=x,K=77}else K=77;else K=77;while(!1);return(K|0)==77&&(x=ue+4|0,h[v>>2]=h[x>>2],h[v+4>>2]=h[x+4>>2],h[v+8>>2]=h[x+8>>2],x=0),se=x,Q=xe,se|0}function JG(p,m,g,_){p=p|0,m=m|0,g=g|0,_=_|0;var v=0,x=0,b=0,E=0,M=0,N=0,O=0,q=0,j=0,X=0,K=0,ae=0,ue=0,xe=0,se=0,we=0,Ae=0,Be=0,Ke=0,Me=0,be=0;if(x=tt(p|0,m|0,52)|0,ee()|0,x=x&15,Ae=tt(p|0,m|0,45)|0,ee()|0,Ae=Ae&127,Ae>>>0>121)return _=5,_|0;if(ue=xr(Ae)|0,ft(x|0,0,52)|0,E=ee()|0|134225919,b=_,h[b>>2]=-1,h[b+4>>2]=E,b=h[g>>2]|0,E=h[g+4>>2]|0,g=h[g+8>>2]|0,!x){m=(b|0)<0,xe=m?b:0,we=E-xe|0,ue=(we|0)<0,xe=(ue?0-we|0:0)+(g-xe)|0,g=(xe|0)<0,v=g?0:xe,xe=g?xe:0,g=(ue?0:we)-xe|0,xe=(m?0:b)-(ue?we:0)-xe|0,we=(g|0)<(xe|0)?g:xe,we=(v|0)<(we|0)?v:we,we=(we|0)>0?we:0,v=v-we|0,g=g-we|0;e:do switch(xe-we|0){case 0:switch(g|0){case 0:if(v){v=(v|0)==1?1:7,se=11;break e}else{v=0;break e}case 1:if(v){v=(v|0)==1?3:7,se=11;break e}else{v=2;break e}default:return _=1,_|0}case 1:switch(g|0){case 0:if(v){v=(v|0)==1?5:7,se=11;break e}else{v=4;break e}case 1:{if(v)v=1;else{v=6;break e}return v|0}default:return _=1,_|0}default:return _=1,_|0}while(!1);return(se|0)==11&&(v|0)==7||(v=ZP(Ae,v)|0,(v|0)==127)?(_=1,_|0):(we=ft(v|0,0,45)|0,Ae=ee()|0,se=_,Ae=h[se+4>>2]&-1040385|Ae,h[_>>2]=h[se>>2]|we,h[_+4>>2]=Ae,_=0,_|0)}for(;;){if(ae=x,x=x+-1|0,K=b-g|0,X=E-g|0,M=K>>>0>715827881|X>>>0>715827881,gc(ae)|0){if(M){if(O=(K|0)>0,q=2147483647-K|0,j=-2147483648-K|0,O?(q|0)<(K|0):(j|0)>(K|0)){v=1,se=107;break}if(be=K<<1,O?(2147483647-be|0)<(K|0):(-2147483648-be|0)>(K|0)){v=1,se=107;break}if((X|0)>0?(2147483647-X|0)<(X|0):(-2147483648-X|0)>(X|0)){v=1,se=107;break}if(M=K*3|0,N=X<<1,(O?(q|0)<(N|0):(j|0)>(N|0))||((K|0)>-1?(M|-2147483648|0)>=(X|0):(M^-2147483648|0)<(X|0))){v=1,se=107;break}}else M=K*3|0,N=X<<1;if(q=rh(+(M-X|0)*.14285714285714285)|0,O=rh(+(N+K|0)*.14285714285714285)|0,N=(O|0)<(q|0),M=N?q:O,N=N?O:q,(N|0)<0){if((N|0)==-2147483648||((M|0)>0?(2147483647-M|0)<(N|0):(-2147483648-M|0)>(N|0))){se=24;break}if((M|0)>-1?(M|-2147483648|0)>=(N|0):(M^-2147483648|0)<(N|0)){se=24;break}}j=(q|0)<0,X=O-(j?q:0)|0,Ke=(X|0)<0,Be=(j?0-q|0:0)-(Ke?X:0)|0,K=(Be|0)<0,j=(j?0:q)-(Ke?X:0)-(K?Be:0)|0,X=(Ke?0:X)-(K?Be:0)|0,Be=K?0:Be,K=(X|0)<(j|0)?X:j,K=(Be|0)<(K|0)?Be:K,Ke=(K|0)>0,j=j-(Ke?K:0)|0,X=X-(Ke?K:0)|0,K=Be-(Ke?K:0)|0,Ke=(j*3|0)+X|0,Be=(Ke|0)<0,be=(X*3|0)+K-(Be?Ke:0)|0,M=(be|0)<0,q=(K*3|0)+j-(Be?Ke:0)-(M?be:0)|0,O=(q|0)<0,Me=O?0:q,N=(M?0:be)-(O?q:0)|0,q=(Be?0:Ke)-(M?be:0)-(O?q:0)|0,O=(N|0)<(q|0)?N:q,O=(Me|0)<(O|0)?Me:O,be=(O|0)>0,M=be?O:0,N=N-(be?O:0)|0,O=Me-(be?O:0)|0}else{if(M){if(N=(K|0)>0,N?(2147483647-K|0)<(K|0):(-2147483648-K|0)>(K|0)){v=1,se=107;break}if(M=K<<1,O=(X|0)>0,O?(2147483647-X|0)<(X|0):(-2147483648-X|0)>(X|0)){v=1,se=107;break}if(j=X<<1,O?(2147483647-j|0)<(X|0):(-2147483648-j|0)>(X|0)){v=1,se=107;break}if(N?(2147483647-M|0)<(X|0):(-2147483648-M|0)>(X|0)){v=1,se=107;break}if(N=X*3|0,(X|0)>-1?(N|-2147483648|0)>=(K|0):(N^-2147483648|0)<(K|0)){v=1,se=107;break}}else M=K<<1,N=X*3|0;if(q=rh(+(M+X|0)*.14285714285714285)|0,O=rh(+(N-K|0)*.14285714285714285)|0,N=(O|0)<(q|0),M=N?q:O,N=N?O:q,(N|0)<0){if((N|0)==-2147483648||((M|0)>0?(2147483647-M|0)<(N|0):(-2147483648-M|0)>(N|0))){se=36;break}if((M|0)>-1?(M|-2147483648|0)>=(N|0):(M^-2147483648|0)<(N|0)){se=36;break}}j=(q|0)<0,X=O-(j?q:0)|0,Me=(X|0)<0,be=(j?0-q|0:0)-(Me?X:0)|0,K=(be|0)<0,j=(j?0:q)-(Me?X:0)-(K?be:0)|0,X=(Me?0:X)-(K?be:0)|0,be=K?0:be,K=(X|0)<(j|0)?X:j,K=(be|0)<(K|0)?be:K,Me=(K|0)>0,j=j-(Me?K:0)|0,X=X-(Me?K:0)|0,K=be-(Me?K:0)|0,Me=(j*3|0)+K|0,be=(Me|0)<0,Be=(X*3|0)+j-(be?Me:0)|0,M=(Be|0)<0,q=(K*3|0)+X-(be?Me:0)-(M?Be:0)|0,O=(q|0)<0,Ke=O?0:q,N=(M?0:Be)-(O?q:0)|0,q=(be?0:Me)-(M?Be:0)-(O?q:0)|0,O=(N|0)<(q|0)?N:q,O=(Ke|0)<(O|0)?Ke:O,Be=(O|0)>0,M=Be?O:0,N=N-(Be?O:0)|0,O=Ke-(Be?O:0)|0}M=b+(M-q)|0,Me=(M|0)<0,N=E-N-(Me?M:0)|0,q=(N|0)<0,Be=g-O+(Me?0-M|0:0)+(q?0-N|0:0)|0,b=(Be|0)<0,O=b?0:Be,be=(q?0:N)-(b?Be:0)|0,Be=(Me?0:M)-(q?N:0)-(b?Be:0)|0,b=(be|0)<(Be|0)?be:Be,b=(O|0)<(b|0)?O:b,g=(b|0)>0,Be=Be-(g?b:0)|0,N=_,q=h[N>>2]|0,N=h[N+4>>2]|0,E=(15-ae|0)*3|0,M=ft(7,0,E|0)|0,M=q&~M,N=N&~(ee()|0),q=(Be|0)<0,Me=q?Be:0,be=be-(g?b:0)-Me|0,Ke=(be|0)<0,Me=(Ke?0-be|0:0)+(O-(g?b:0)-Me)|0,b=(Me|0)<0,g=b?0:Me,Me=b?Me:0,b=(Ke?0:be)-Me|0,Me=(q?0:Be)-(Ke?be:0)-Me|0,be=(b|0)<(Me|0)?b:Me,be=(g|0)<(be|0)?g:be,be=(be|0)>0?be:0,g=g-be|0,b=b-be|0;e:do switch(Me-be|0){case 0:switch(b|0){case 0:{g=(g|0)==0?0:(g|0)==1?1:7;break e}case 1:{g=(g|0)==0?2:(g|0)==1?3:7;break e}default:{se=45;break e}}case 1:switch(b|0){case 0:{g=(g|0)==0?4:(g|0)==1?5:7;break e}case 1:if(g){se=45;break e}else{g=6;break e}default:{se=45;break e}}default:se=45}while(!1);if((se|0)==45&&(se=0,g=7),Ke=ft(g|0,0,E|0)|0,Me=ee()|0|N,be=_,h[be>>2]=Ke|M,h[be+4>>2]=Me,(ae|0)<=1){se=47;break}else b=j,E=X,g=K}if((se|0)==24)di(27634,27425,416,27447);else if((se|0)==36)di(27634,27425,464,27461);else if((se|0)==47){if((j|0)>1|(X|0)>1|(K|0)>1)return be=1,be|0;Be=(j|0)<0,Me=Be?j:0,be=X-Me|0,Ke=(be|0)<0,Me=(Ke?0-be|0:0)+(K-Me)|0,x=(Me|0)<0,g=x?0:Me,Me=x?Me:0,x=(Ke?0:be)-Me|0,Me=(Be?0:j)-(Ke?be:0)-Me|0,be=(x|0)<(Me|0)?x:Me,be=(g|0)<(be|0)?g:be,be=(be|0)>0?be:0,g=g-be|0,x=x-be|0;e:do switch(Me-be|0){case 0:switch(x|0){case 0:{x=(g|0)==0?0:(g|0)==1?1:7;break e}case 1:{x=(g|0)==0?2:(g|0)==1?3:7;break e}default:{se=55;break e}}case 1:switch(x|0){case 0:{x=(g|0)==0?4:(g|0)==1?5:7;break e}case 1:if(g){se=55;break e}else{x=6;break e}default:{se=55;break e}}default:se=55}while(!1);(se|0)==55&&(x=7),E=ZP(Ae,x)|0,(E|0)==127?N=0:N=xr(E)|0;e:do if(x){if(ue){if(g=al(p,m)|0,(g|0)==7)return be=5,be|0;b=h[21344+(g*28|0)+(x<<2)>>2]|0;t:do if((b|0)>0)for(g=x,x=0;;){switch(g|0){case 1:{g=5;break}case 5:{g=4;break}case 4:{g=6;break}case 6:{g=2;break}case 2:{g=3;break}case 3:{g=1;break}default:}if(x=x+1|0,(x|0)==(b|0))break t}else g=x;while(!1);if((g|0)==1)return be=9,be|0;x=ZP(Ae,g)|0,(x|0)==127&&di(27476,27315,415,27506),xr(x)|0?di(27521,27315,416,27506):(v=x,we=b,xe=g)}else v=E,we=0,xe=x;if(M=h[4272+(Ae*28|0)+(xe<<2)>>2]|0,(M|0)<=-1&&di(27552,27315,423,27506),!N){if((we|0)<0)return be=5,be|0;if(we|0){b=_,g=0,x=h[b>>2]|0,b=h[b+4>>2]|0;do x=Fm(x,b)|0,b=ee()|0,be=_,h[be>>2]=x,h[be+4>>2]=b,g=g+1|0;while((g|0)<(we|0))}if((M|0)<=0){se=104;break}for(b=_,g=0,x=h[b>>2]|0,b=h[b+4>>2]|0;;)if(x=Fm(x,b)|0,b=ee()|0,be=_,h[be>>2]=x,h[be+4>>2]=b,g=g+1|0,(g|0)==(M|0)){se=104;break e}}if(E=KP(v,Ae)|0,(E|0)==7&&di(27291,27315,432,27506),g=_,x=h[g>>2]|0,g=h[g+4>>2]|0,(M|0)>0){b=0;do x=Fm(x,g)|0,g=ee()|0,be=_,h[be>>2]=x,h[be+4>>2]=g,b=b+1|0;while((b|0)!=(M|0))}if(g=al(x,g)|0,(g|0)==7&&di(27634,27315,444,27506),x=YP(v)|0,x=h[(x?21760:21552)+(E*28|0)+(g<<2)>>2]|0,(x|0)<0&&di(27634,27315,458,27506),!x)se=104;else{E=_,g=0,b=h[E>>2]|0,E=h[E+4>>2]|0;do b=sL(b,E)|0,E=ee()|0,be=_,h[be>>2]=b,h[be+4>>2]=E,g=g+1|0;while((g|0)<(x|0));se=104}}else if((ue|0)!=0&(N|0)!=0){if(v=al(p,m)|0,g=_,g=al(h[g>>2]|0,h[g+4>>2]|0)|0,(v|0)==7|(g|0)==7||(g=h[21344+(v*28|0)+(g<<2)>>2]|0,(g|0)<0))return be=5,be|0;if(!g)v=E,se=105;else{b=_,v=0,x=h[b>>2]|0,b=h[b+4>>2]|0;do x=Fm(x,b)|0,b=ee()|0,be=_,h[be>>2]=x,h[be+4>>2]=b,v=v+1|0;while((v|0)<(g|0));v=E,se=104}}else v=E,se=104;while(!1);return(se|0)==104&&N&&(se=105),(se|0)==105&&(be=_,(al(h[be>>2]|0,h[be+4>>2]|0)|0)==1)?(be=9,be|0):(Me=_,Be=h[Me>>2]|0,Me=h[Me+4>>2]&-1040385,Ke=ft(v|0,0,45)|0,Me=Me|(ee()|0),be=_,h[be>>2]=Be|Ke,h[be+4>>2]=Me,be=0,be|0)}else if((se|0)==107)return v|0;return 0}function hue(p,m,g,_,v,x){p=p|0,m=m|0,g=g|0,_=_|0,v=v|0,x=x|0;var b=0,E=0;return E=Q,Q=Q+16|0,b=E,v|0?(b=15,Q=E,b|0):(p=qx(p,m,g,_,b)|0,p||(v=h[b+4>>2]|0,p=h[b+8>>2]|0,h[x>>2]=(h[b>>2]|0)-p,h[x+4>>2]=v-p,p=0),b=p,Q=E,b|0)}function fue(p,m,g,_,v){p=p|0,m=m|0,g=g|0,_=_|0,v=v|0;var x=0,b=0,E=0,M=0,N=0,O=0,q=0;return q=Q,Q=Q+16|0,O=q,_|0?(O=15,Q=q,O|0):(E=h[g>>2]|0,b=h[g+4>>2]|0,h[O>>2]=E,M=O+4|0,h[M>>2]=b,N=O+8|0,h[N>>2]=0,g=(b|0)<(E|0),_=g?E:b,g=g?b:E,(g|0)<0?!((g|0)==-2147483648||((_|0)>0?(2147483647-_|0)<(g|0):(-2147483648-_|0)>(g|0)))&&!((_|0)>-1?(_|-2147483648|0)>=(g|0):(_^-2147483648|0)<(g|0))?x=5:_=1:x=5,(x|0)==5&&(_=b-E|0,x=0-E|0,(E|0)<0?(h[M>>2]=_,h[N>>2]=x,h[O>>2]=0,E=0):(_=b,x=0),b=E-_|0,g=x-_|0,(_|0)<0?(h[O>>2]=b,h[N>>2]=g,h[M>>2]=0,E=b,_=0):g=x,b=E-g|0,x=_-g|0,(g|0)<0?(h[O>>2]=b,h[M>>2]=x,h[N>>2]=0,g=0):(x=_,b=E),_=(x|0)<(b|0)?x:b,_=(g|0)<(_|0)?g:_,(_|0)>0&&(h[O>>2]=b-_,h[M>>2]=x-_,h[N>>2]=g-_),_=JG(p,m,O,v)|0),O=_,Q=q,O|0)}function fL(p,m,g,_,v){p=p|0,m=m|0,g=g|0,_=_|0,v=v|0;var x=0,b=0,E=0,M=0,N=0;return M=Q,Q=Q+32|0,b=M+12|0,E=M,x=qx(p,m,p,m,b)|0,x|0?(E=x,Q=M,E|0):(p=qx(p,m,g,_,E)|0,p|0?(E=p,Q=M,E|0):(p=(h[b>>2]|0)-(h[E>>2]|0)|0,N=(p|0)<0,_=N?0-p|0:0,g=_+((h[b+4>>2]|0)-(h[E+4>>2]|0))|0,m=(g|0)<0,_=(h[b+8>>2]|0)-(h[E+8>>2]|0)+_+(m?0-g|0:0)|0,x=(_|0)<0,b=x?0:_,_=x?_:0,x=(m?0:g)-_|0,_=(N?0:p)-(m?g:0)-_|0,E=(x|0)<(_|0)?x:_,E=(b|0)<(E|0)?b:E,E=(E|0)>0?E:0,b=b-E|0,x=x-E|0,E=_-E|0,E=(E|0)>-1?E:0-E|0,x=(x|0)>-1?x:0-x|0,b=(b|0)>-1?b:0-b|0,b=(x|0)>(b|0)?x:b,b=(E|0)>(b|0)?E:b,E=v,h[E>>2]=b,h[E+4>>2]=((b|0)<0)<<31>>31,E=0,Q=M,E|0))}function due(p,m,g,_,v){p=p|0,m=m|0,g=g|0,_=_|0,v=v|0;var x=0,b=0;return b=Q,Q=Q+16|0,x=b,p=fL(p,m,g,_,x)|0,p|0?(x=p,Q=b,x|0):(g=x,g=At(h[g>>2]|0,h[g+4>>2]|0,1,0)|0,_=ee()|0,x=v,h[x>>2]=g,h[x+4>>2]=_,x=0,Q=b,x|0)}function pue(p,m,g,_,v){p=p|0,m=m|0,g=g|0,_=_|0,v=v|0;var x=0,b=0,E=0,M=0;return M=Q,Q=Q+16|0,x=M,b=fL(p,m,g,_,x)|0,b|0?(v=b,Q=M,v|0):(b=x,x=h[b>>2]|0,b=h[b+4>>2]|0,(x|0)==0&(b|0)==0?(h[v>>2]=p,h[v+4>>2]=m,v=0,Q=M,v|0):(E=eq(p,m,g,_,x,b,v,0,0,1,0)|0,E?(v=(eq(g,_,p,m,x,b,v,x,b,-1,-1)|0)==0,v=v?0:E,Q=M,v|0):(v=0,Q=M,v|0)))}function eq(p,m,g,_,v,x,b,E,M,N,O){p=p|0,m=m|0,g=g|0,_=_|0,v=v|0,x=x|0,b=b|0,E=E|0,M=M|0,N=N|0,O=O|0;var q=0,j=0,X=0,K=0,ae=0,ue=0,xe=0,se=0,we=0,Ae=0,Be=0,Ke=0,Me=0,be=0,gt=0,je=0,Ut=0,lt=0;if(Ut=Q,Q=Q+48|0,q=Ut+24|0,j=Ut+12|0,je=Ut,h[q>>2]=0,h[q+4>>2]=0,h[q+8>>2]=0,h[j>>2]=0,h[j+4>>2]=0,h[j+8>>2]=0,qx(p,m,p,m,q)|0&&di(27634,27315,696,27575),qx(p,m,g,_,j)|0&&di(27634,27315,701,27575),ae=q+8|0,_=h[ae>>2]|0,g=_-(h[q>>2]|0)|0,h[q>>2]=g,gt=q+4|0,_=(h[gt>>2]|0)-_|0,h[gt>>2]=_,gt=_+g|0,q=0-gt|0,h[ae>>2]=q,ae=j+8|0,se=h[ae>>2]|0,xe=se-(h[j>>2]|0)|0,h[j>>2]=xe,be=j+4|0,se=(h[be>>2]|0)-se|0,h[be>>2]=se,be=se+xe|0,h[ae>>2]=0-be,Me=1/(+(v>>>0)+4294967296*+(x|0)),Be=Me*+(xe-g|0),Ke=Me*+(se-_|0),Me=Me*+(gt-be|0),h[je>>2]=g,be=je+4|0,h[be>>2]=_,gt=je+8|0,h[gt>>2]=q,(x|0)<0)return N=0,Q=Ut,N|0;for(Ae=+(g|0),we=+(_|0),ue=+(q|0),xe=0,se=0;;){if(K=+(xe>>>0)+4294967296*+(se|0),lt=Be*K+Ae,X=Ke*K+we,K=Me*K+ue,_=~~+cT(+lt),q=~~+cT(+X),g=~~+cT(+K),lt=+Qs(+(+(_|0)-lt)),X=+Qs(+(+(q|0)-X)),K=+Qs(+(+(g|0)-K)),lt>X<>K?(j=g+q|0,_=0-j|0):(j=0-_|0,X>K&&(q=j-g|0)),h[be>>2]=q,h[je>>2]=j,h[gt>>2]=0,g=_+q|0,(_|0)>0?(h[be>>2]=g,h[gt>>2]=_,h[je>>2]=0,j=0):(g=q,_=0),(g|0)<0?(q=j-g|0,h[je>>2]=q,_=_-g|0,h[gt>>2]=_,h[be>>2]=0,j=q-_|0,g=0-_|0,(_|0)<0?(h[je>>2]=j,h[be>>2]=g,h[gt>>2]=0,ae=g,_=0):(ae=0,j=q)):ae=g,g=(ae|0)<(j|0)?ae:j,g=(_|0)<(g|0)?_:g,(g|0)>0&&(h[je>>2]=j-g,h[be>>2]=ae-g,h[gt>>2]=_-g),g=br(xe|0,se|0,N|0,O|0)|0,g=At(g|0,ee()|0,E|0,M|0)|0,ee()|0,g=JG(p,m,je,b+(g<<3)|0)|0,g|0){_=20;break}if(ae=xe,xe=At(xe|0,se|0,1,0)|0,j=se,se=ee()|0,!((j|0)<(x|0)|(j|0)==(x|0)&ae>>>0<v>>>0)){g=0,_=20;break}}return(_|0)==20?(Q=Ut,g|0):0}function np(p,m,g,_){p=p|0,m=m|0,g=g|0,_=_|0;var v=0,x=0,b=0;if((g|0)==0&(_|0)==0)return v=0,x=1,On(v|0),x|0;x=p,v=m,p=1,m=0;do b=(g&1|0)==0&!0,p=br((b?1:x)|0,(b?0:v)|0,p|0,m|0)|0,m=ee()|0,g=pq(g|0,_|0,1)|0,_=ee()|0,x=br(x|0,v|0,x|0,v|0)|0,v=ee()|0;while(!((g|0)==0&(_|0)==0));return On(m|0),p|0}function dL(p,m,g,_){p=p|0,m=m|0,g=g|0,_=_|0;var v=0,x=0,b=0,E=0,M=0,N=0,O=0;E=Q,Q=Q+16|0,x=E,b=tt(p|0,m|0,52)|0,ee()|0,b=b&15;do if(b){if(v=v1(p,m,x)|0,!v){N=+ie[x>>3],M=1/+ii(+N),O=+ie[26032+(b<<3)>>3],ie[g>>3]=N+O,ie[g+8>>3]=N-O,N=+ie[x+8>>3],M=O*M,ie[g+16>>3]=M+N,ie[g+24>>3]=N-M;break}return b=v,Q=E,b|0}else{if(v=tt(p|0,m|0,45)|0,ee()|0,v=v&127,v>>>0>121)return b=5,Q=E,b|0;x=22128+(v<<5)|0,h[g>>2]=h[x>>2],h[g+4>>2]=h[x+4>>2],h[g+8>>2]=h[x+8>>2],h[g+12>>2]=h[x+12>>2],h[g+16>>2]=h[x+16>>2],h[g+20>>2]=h[x+20>>2],h[g+24>>2]=h[x+24>>2],h[g+28>>2]=h[x+28>>2];break}while(!1);return Cce(g,_?1.4:1.1),_=26160+(b<<3)|0,(h[_>>2]|0)==(p|0)&&(h[_+4>>2]|0)==(m|0)&&(ie[g>>3]=1.5707963267948966),b=26288+(b<<3)|0,(h[b>>2]|0)==(p|0)&&(h[b+4>>2]|0)==(m|0)&&(ie[g+8>>3]=-1.5707963267948966),+ie[g>>3]!=1.5707963267948966&&+ie[g+8>>3]!=-1.5707963267948966?(b=0,Q=E,b|0):(ie[g+16>>3]=3.141592653589793,ie[g+24>>3]=-3.141592653589793,b=0,Q=E,b|0)}function mue(p,m,g,_){p=p|0,m=m|0,g=g|0,_=_|0;var v=0,x=0,b=0,E=0,M=0,N=0,O=0;N=Q,Q=Q+48|0,b=N+32|0,x=N+40|0,E=N,iL(b,0,0,0),M=h[b>>2]|0,b=h[b+4>>2]|0;do if(g>>>0<=15){if(v=Wx(_)|0,v|0){_=E,h[_>>2]=0,h[_+4>>2]=0,h[E+8>>2]=v,h[E+12>>2]=-1,_=E+16|0,M=E+29|0,h[_>>2]=0,h[_+4>>2]=0,h[_+8>>2]=0,He[_+12>>0]=0,He[M>>0]=He[x>>0]|0,He[M+1>>0]=He[x+1>>0]|0,He[M+2>>0]=He[x+2>>0]|0;break}if(v=Ta((h[m+8>>2]|0)+1|0,32)|0,v){pL(m,v),O=E,h[O>>2]=M,h[O+4>>2]=b,h[E+8>>2]=0,h[E+12>>2]=g,h[E+16>>2]=_,h[E+20>>2]=m,h[E+24>>2]=v,He[E+28>>0]=0,M=E+29|0,He[M>>0]=He[x>>0]|0,He[M+1>>0]=He[x+1>>0]|0,He[M+2>>0]=He[x+2>>0]|0;break}else{_=E,h[_>>2]=0,h[_+4>>2]=0,h[E+8>>2]=13,h[E+12>>2]=-1,_=E+16|0,M=E+29|0,h[_>>2]=0,h[_+4>>2]=0,h[_+8>>2]=0,He[_+12>>0]=0,He[M>>0]=He[x>>0]|0,He[M+1>>0]=He[x+1>>0]|0,He[M+2>>0]=He[x+2>>0]|0;break}}else M=E,h[M>>2]=0,h[M+4>>2]=0,h[E+8>>2]=4,h[E+12>>2]=-1,M=E+16|0,O=E+29|0,h[M>>2]=0,h[M+4>>2]=0,h[M+8>>2]=0,He[M+12>>0]=0,He[O>>0]=He[x>>0]|0,He[O+1>>0]=He[x+1>>0]|0,He[O+2>>0]=He[x+2>>0]|0;while(!1);nT(E),h[p>>2]=h[E>>2],h[p+4>>2]=h[E+4>>2],h[p+8>>2]=h[E+8>>2],h[p+12>>2]=h[E+12>>2],h[p+16>>2]=h[E+16>>2],h[p+20>>2]=h[E+20>>2],h[p+24>>2]=h[E+24>>2],h[p+28>>2]=h[E+28>>2],Q=N}function nT(p){p=p|0;var m=0,g=0,_=0,v=0,x=0,b=0,E=0,M=0,N=0,O=0,q=0,j=0,X=0,K=0,ae=0,ue=0,xe=0,se=0,we=0,Ae=0;if(Ae=Q,Q=Q+336|0,X=Ae+168|0,K=Ae,_=p,g=h[_>>2]|0,_=h[_+4>>2]|0,(g|0)==0&(_|0)==0){Q=Ae;return}if(m=p+28|0,He[m>>0]|0?(g=tq(g,_)|0,_=ee()|0):He[m>>0]=1,we=p+20|0,!(h[h[we>>2]>>2]|0)){m=p+24|0,g=h[m>>2]|0,g|0&&_t(g),se=p,h[se>>2]=0,h[se+4>>2]=0,h[p+8>>2]=0,h[we>>2]=0,h[p+12>>2]=-1,h[p+16>>2]=0,h[m>>2]=0,Q=Ae;return}se=p+16|0,m=h[se>>2]|0,v=m&15;e:do if((g|0)==0&(_|0)==0)xe=p+24|0;else{ae=p+12|0,q=(v|0)==3,O=m&255,M=(v|1|0)==3,j=p+24|0,N=(v+-1|0)>>>0<3,b=(v|2|0)==3,E=K+8|0;t:for(;;){if(x=tt(g|0,_|0,52)|0,ee()|0,x=x&15,(x|0)==(h[ae>>2]|0)){switch(O&15){case 0:case 2:case 3:{if(v=v1(g,_,X)|0,v|0){ue=15;break t}if(mL(h[we>>2]|0,h[j>>2]|0,X)|0){ue=19;break t}break}default:}if(M&&(v=h[(h[we>>2]|0)+4>>2]|0,h[X>>2]=h[v>>2],h[X+4>>2]=h[v+4>>2],h[X+8>>2]=h[v+8>>2],h[X+12>>2]=h[v+12>>2],kG(26896,X)|0)){if(aL(h[(h[we>>2]|0)+4>>2]|0,x,K)|0){ue=25;break}if(v=K,(h[v>>2]|0)==(g|0)&&(h[v+4>>2]|0)==(_|0)){ue=29;break}}if(N){if(v=Bm(g,_,X)|0,v|0){ue=32;break}if(dL(g,_,K,0)|0){ue=36;break}if(b&&iq(h[we>>2]|0,h[j>>2]|0,X,K)|0){ue=42;break}if(M&&rq(h[we>>2]|0,h[j>>2]|0,X,K)|0){ue=42;break}}if(q){if(m=dL(g,_,X,1)|0,v=h[j>>2]|0,m|0){ue=45;break}if(QP(v,X)|0){if(VG(K,X),zG(X,h[j>>2]|0)|0){ue=53;break}if(mL(h[we>>2]|0,h[j>>2]|0,E)|0){ue=53;break}if(rq(h[we>>2]|0,h[j>>2]|0,K,X)|0){ue=53;break}}}}do if((x|0)<(h[ae>>2]|0)){if(m=dL(g,_,X,1)|0,v=h[j>>2]|0,m|0){ue=58;break t}if(!(QP(v,X)|0)){ue=73;break}if(zG(h[j>>2]|0,X)|0&&(VG(K,X),iq(h[we>>2]|0,h[j>>2]|0,K,X)|0)){ue=65;break t}if(g=YG(g,_,x+1|0,K)|0,g|0){ue=67;break t}_=K,g=h[_>>2]|0,_=h[_+4>>2]|0}else ue=73;while(!1);if((ue|0)==73&&(ue=0,g=tq(g,_)|0,_=ee()|0),(g|0)==0&(_|0)==0){xe=j;break e}}switch(ue|0){case 15:{m=h[j>>2]|0,m|0&&_t(m),ue=p,h[ue>>2]=0,h[ue+4>>2]=0,h[we>>2]=0,h[ae>>2]=-1,h[se>>2]=0,h[j>>2]=0,h[p+8>>2]=v,ue=20;break}case 19:{h[p>>2]=g,h[p+4>>2]=_,ue=20;break}case 25:{di(27634,27600,470,27611);break}case 29:{h[p>>2]=g,h[p+4>>2]=_,Q=Ae;return}case 32:{m=h[j>>2]|0,m|0&&_t(m),xe=p,h[xe>>2]=0,h[xe+4>>2]=0,h[we>>2]=0,h[ae>>2]=-1,h[se>>2]=0,h[j>>2]=0,h[p+8>>2]=v,Q=Ae;return}case 36:{di(27634,27600,493,27611);break}case 42:{h[p>>2]=g,h[p+4>>2]=_,Q=Ae;return}case 45:{v|0&&_t(v),ue=p,h[ue>>2]=0,h[ue+4>>2]=0,h[we>>2]=0,h[ae>>2]=-1,h[se>>2]=0,h[j>>2]=0,h[p+8>>2]=m,ue=55;break}case 53:{h[p>>2]=g,h[p+4>>2]=_,ue=55;break}case 58:{v|0&&_t(v),ue=p,h[ue>>2]=0,h[ue+4>>2]=0,h[we>>2]=0,h[ae>>2]=-1,h[se>>2]=0,h[j>>2]=0,h[p+8>>2]=m,ue=71;break}case 65:{h[p>>2]=g,h[p+4>>2]=_,ue=71;break}case 67:{m=h[j>>2]|0,m|0&&_t(m),xe=p,h[xe>>2]=0,h[xe+4>>2]=0,h[we>>2]=0,h[ae>>2]=-1,h[se>>2]=0,h[j>>2]=0,h[p+8>>2]=g,Q=Ae;return}}if((ue|0)==20){Q=Ae;return}else if((ue|0)==55){Q=Ae;return}else if((ue|0)==71){Q=Ae;return}}while(!1);m=h[xe>>2]|0,m|0&&_t(m),ue=p,h[ue>>2]=0,h[ue+4>>2]=0,h[p+8>>2]=0,h[we>>2]=0,h[p+12>>2]=-1,h[se>>2]=0,h[xe>>2]=0,Q=Ae}function tq(p,m){p=p|0,m=m|0;var g=0,_=0,v=0,x=0,b=0,E=0,M=0,N=0,O=0,q=0;q=Q,Q=Q+16|0,O=q,_=tt(p|0,m|0,52)|0,ee()|0,_=_&15,g=tt(p|0,m|0,45)|0,ee()|0;do if(_){for(;g=ft(_+4095|0,0,52)|0,v=ee()|0|m&-15728641,x=(15-_|0)*3|0,b=ft(7,0,x|0)|0,E=ee()|0,g=g|p|b,v=v|E,M=tt(p|0,m|0,x|0)|0,ee()|0,M=M&7,_=_+-1|0,!(M>>>0<6);)if(_)m=v,p=g;else{N=4;break}if((N|0)==4){g=tt(g|0,v|0,45)|0,ee()|0;break}return O=(M|0)==0&(Zi(g,v)|0)!=0,O=ft((O?2:1)+M|0,0,x|0)|0,N=ee()|0|m&~E,O=O|p&~b,On(N|0),Q=q,O|0}while(!1);return g=g&127,g>>>0>120?(N=0,O=0,On(N|0),Q=q,O|0):(iL(O,0,g+1|0,0),N=h[O+4>>2]|0,O=h[O>>2]|0,On(N|0),Q=q,O|0)}function Aue(p,m,g,_,v,x){p=p|0,m=m|0,g=g|0,_=_|0,v=v|0,x=x|0;var b=0,E=0,M=0,N=0,O=0,q=0,j=0,X=0,K=0,ae=0,ue=0;ue=Q,Q=Q+160|0,q=ue+80|0,E=ue+64|0,j=ue+112|0,ae=ue,mue(q,p,m,g),N=q,uL(E,h[N>>2]|0,h[N+4>>2]|0,m),N=E,M=h[N>>2]|0,N=h[N+4>>2]|0,b=h[q+8>>2]|0,X=j+4|0,h[X>>2]=h[q>>2],h[X+4>>2]=h[q+4>>2],h[X+8>>2]=h[q+8>>2],h[X+12>>2]=h[q+12>>2],h[X+16>>2]=h[q+16>>2],h[X+20>>2]=h[q+20>>2],h[X+24>>2]=h[q+24>>2],h[X+28>>2]=h[q+28>>2],X=ae,h[X>>2]=M,h[X+4>>2]=N,X=ae+8|0,h[X>>2]=b,p=ae+12|0,m=j,g=p+36|0;do h[p>>2]=h[m>>2],p=p+4|0,m=m+4|0;while((p|0)<(g|0));if(j=ae+48|0,h[j>>2]=h[E>>2],h[j+4>>2]=h[E+4>>2],h[j+8>>2]=h[E+8>>2],h[j+12>>2]=h[E+12>>2],(M|0)==0&(N|0)==0)return ae=b,Q=ue,ae|0;g=ae+16|0,O=ae+24|0,q=ae+28|0,b=0,E=0,m=M,p=N;do{if(!((b|0)<(v|0)|(b|0)==(v|0)&E>>>0<_>>>0)){K=4;break}if(N=E,E=At(E|0,b|0,1,0)|0,b=ee()|0,N=x+(N<<3)|0,h[N>>2]=m,h[N+4>>2]=p,hL(j),p=j,m=h[p>>2]|0,p=h[p+4>>2]|0,(m|0)==0&(p|0)==0){if(nT(g),m=g,p=h[m>>2]|0,m=h[m+4>>2]|0,(p|0)==0&(m|0)==0){K=10;break}KG(p,m,h[q>>2]|0,j),p=j,m=h[p>>2]|0,p=h[p+4>>2]|0}N=ae,h[N>>2]=m,h[N+4>>2]=p}while(!((m|0)==0&(p|0)==0));return(K|0)==4?(p=ae+40|0,m=h[p>>2]|0,m|0&&_t(m),K=ae+16|0,h[K>>2]=0,h[K+4>>2]=0,h[O>>2]=0,h[ae+36>>2]=0,h[q>>2]=-1,h[ae+32>>2]=0,h[p>>2]=0,KG(0,0,0,j),h[ae>>2]=0,h[ae+4>>2]=0,h[X>>2]=0,ae=14,Q=ue,ae|0):((K|0)==10&&(h[ae>>2]=0,h[ae+4>>2]=0,h[X>>2]=h[O>>2]),ae=h[X>>2]|0,Q=ue,ae|0)}function gue(p,m,g,_){p=p|0,m=m|0,g=g|0,_=_|0;var v=0,x=0,b=0,E=0,M=0,N=0,O=0,q=0,j=0,X=0;if(q=Q,Q=Q+48|0,M=q+32|0,E=q+40|0,N=q,!(h[p>>2]|0))return O=_,h[O>>2]=0,h[O+4>>2]=0,O=0,Q=q,O|0;iL(M,0,0,0),b=M,v=h[b>>2]|0,b=h[b+4>>2]|0;do if(m>>>0>15)O=N,h[O>>2]=0,h[O+4>>2]=0,h[N+8>>2]=4,h[N+12>>2]=-1,O=N+16|0,g=N+29|0,h[O>>2]=0,h[O+4>>2]=0,h[O+8>>2]=0,He[O+12>>0]=0,He[g>>0]=He[E>>0]|0,He[g+1>>0]=He[E+1>>0]|0,He[g+2>>0]=He[E+2>>0]|0,g=4,O=9;else{if(g=Wx(g)|0,g|0){M=N,h[M>>2]=0,h[M+4>>2]=0,h[N+8>>2]=g,h[N+12>>2]=-1,M=N+16|0,O=N+29|0,h[M>>2]=0,h[M+4>>2]=0,h[M+8>>2]=0,He[M+12>>0]=0,He[O>>0]=He[E>>0]|0,He[O+1>>0]=He[E+1>>0]|0,He[O+2>>0]=He[E+2>>0]|0,O=9;break}if(g=Ta((h[p+8>>2]|0)+1|0,32)|0,!g){O=N,h[O>>2]=0,h[O+4>>2]=0,h[N+8>>2]=13,h[N+12>>2]=-1,O=N+16|0,g=N+29|0,h[O>>2]=0,h[O+4>>2]=0,h[O+8>>2]=0,He[O+12>>0]=0,He[g>>0]=He[E>>0]|0,He[g+1>>0]=He[E+1>>0]|0,He[g+2>>0]=He[E+2>>0]|0,g=13,O=9;break}pL(p,g),X=N,h[X>>2]=v,h[X+4>>2]=b,b=N+8|0,h[b>>2]=0,h[N+12>>2]=m,h[N+20>>2]=p,h[N+24>>2]=g,He[N+28>>0]=0,v=N+29|0,He[v>>0]=He[E>>0]|0,He[v+1>>0]=He[E+1>>0]|0,He[v+2>>0]=He[E+2>>0]|0,h[N+16>>2]=3,j=+Tce(g),j=j*+wce(g),x=+Qs(+ +ie[g>>3]),x=j/+ii(+ +lT(+x,+ +Qs(+ +ie[g+8>>3])))*6371.007180918475*6371.007180918475,v=N+12|0,g=h[v>>2]|0;e:do if((g|0)>0)do{if(QG(g+-1|0,M)|0,!(x/+ie[M>>3]>10))break e;X=h[v>>2]|0,g=X+-1|0,h[v>>2]=g}while((X|0)>1);while(!1);if(nT(N),v=_,h[v>>2]=0,h[v+4>>2]=0,v=N,g=h[v>>2]|0,v=h[v+4>>2]|0,!((g|0)==0&(v|0)==0))do zx(g,v,m,M)|0,E=M,p=_,E=At(h[p>>2]|0,h[p+4>>2]|0,h[E>>2]|0,h[E+4>>2]|0)|0,p=ee()|0,X=_,h[X>>2]=E,h[X+4>>2]=p,nT(N),X=N,g=h[X>>2]|0,v=h[X+4>>2]|0;while(!((g|0)==0&(v|0)==0));g=h[b>>2]|0}while(!1);return X=g,Q=q,X|0}function Hx(p,m,g){p=p|0,m=m|0,g=g|0;var _=0,v=0,x=0,b=0,E=0,M=0,N=0,O=0,q=0,j=0;if(!(kG(m,g)|0)||(m=Sce(m)|0,_=+ie[g>>3],v=+ie[g+8>>3],v=m&v<0?v+6.283185307179586:v,j=h[p>>2]|0,(j|0)<=0))return j=0,j|0;if(q=h[p+4>>2]|0,m){m=0,O=v,g=-1,p=0;e:for(;;){for(N=p;b=+ie[q+(N<<4)>>3],v=+ie[q+(N<<4)+8>>3],p=(g+2|0)%(j|0)|0,x=+ie[q+(p<<4)>>3],E=+ie[q+(p<<4)+8>>3],b>x?(M=b,b=E):(M=x,x=b,b=v,v=E),_=_==x|_==M?_+2220446049250313e-31:_,!!(_<x|_>M);)if(g=N+1|0,(g|0)>=(j|0)){g=22;break e}else p=N,N=g,g=p;if(E=b<0?b+6.283185307179586:b,b=v<0?v+6.283185307179586:v,O=E==O|b==O?O+-2220446049250313e-31:O,M=E+(b-E)*((_-x)/(M-x)),(M<0?M+6.283185307179586:M)>O&&(m=m^1),p=N+1|0,(p|0)>=(j|0)){g=22;break}else g=N}if((g|0)==22)return m|0}else{m=0,O=v,g=-1,p=0;e:for(;;){for(N=p;b=+ie[q+(N<<4)>>3],v=+ie[q+(N<<4)+8>>3],p=(g+2|0)%(j|0)|0,x=+ie[q+(p<<4)>>3],E=+ie[q+(p<<4)+8>>3],b>x?(M=b,b=E):(M=x,x=b,b=v,v=E),_=_==x|_==M?_+2220446049250313e-31:_,!!(_<x|_>M);)if(g=N+1|0,(g|0)>=(j|0)){g=22;break e}else p=N,N=g,g=p;if(O=b==O|v==O?O+-2220446049250313e-31:O,b+(v-b)*((_-x)/(M-x))>O&&(m=m^1),p=N+1|0,(p|0)>=(j|0)){g=22;break}else g=N}if((g|0)==22)return m|0}return 0}function nq(p,m){p=p|0,m=m|0;var g=0,_=0,v=0,x=0,b=0,E=0,M=0,N=0,O=0,q=0,j=0,X=0,K=0,ae=0,ue=0,xe=0,se=0;if(K=h[p>>2]|0,!K){h[m>>2]=0,h[m+4>>2]=0,h[m+8>>2]=0,h[m+12>>2]=0,h[m+16>>2]=0,h[m+20>>2]=0,h[m+24>>2]=0,h[m+28>>2]=0;return}if(ae=m+8|0,ie[ae>>3]=17976931348623157e292,ue=m+24|0,ie[ue>>3]=17976931348623157e292,ie[m>>3]=-17976931348623157e292,xe=m+16|0,ie[xe>>3]=-17976931348623157e292,!((K|0)<=0)){for(j=h[p+4>>2]|0,N=17976931348623157e292,O=-17976931348623157e292,q=0,p=-1,x=17976931348623157e292,b=17976931348623157e292,M=-17976931348623157e292,_=-17976931348623157e292,X=0;g=+ie[j+(X<<4)>>3],E=+ie[j+(X<<4)+8>>3],p=p+2|0,v=+ie[j+(((p|0)==(K|0)?0:p)<<4)+8>>3],g<x&&(ie[ae>>3]=g,x=g),E<b&&(ie[ue>>3]=E,b=E),g>M?ie[m>>3]=g:g=M,E>_&&(ie[xe>>3]=E,_=E),N=E>0&E<N?E:N,O=E<0&E>O?E:O,q=q|+Qs(+(E-v))>3.141592653589793,p=X+1|0,(p|0)!=(K|0);)se=X,M=g,X=p,p=se;q&&(ie[xe>>3]=O,ie[ue>>3]=N)}}function Wx(p){return p=p|0,(p>>>0<4?0:15)|0}function pL(p,m){p=p|0,m=m|0;var g=0,_=0,v=0,x=0,b=0,E=0,M=0,N=0,O=0,q=0,j=0,X=0,K=0,ae=0,ue=0,xe=0,se=0,we=0,Ae=0,Be=0,Ke=0,Me=0;if(K=h[p>>2]|0,K){if(ae=m+8|0,ie[ae>>3]=17976931348623157e292,ue=m+24|0,ie[ue>>3]=17976931348623157e292,ie[m>>3]=-17976931348623157e292,xe=m+16|0,ie[xe>>3]=-17976931348623157e292,(K|0)>0){for(v=h[p+4>>2]|0,j=17976931348623157e292,X=-17976931348623157e292,_=0,g=-1,M=17976931348623157e292,N=17976931348623157e292,q=-17976931348623157e292,b=-17976931348623157e292,se=0;x=+ie[v+(se<<4)>>3],O=+ie[v+(se<<4)+8>>3],Ke=g+2|0,E=+ie[v+(((Ke|0)==(K|0)?0:Ke)<<4)+8>>3],x<M&&(ie[ae>>3]=x,M=x),O<N&&(ie[ue>>3]=O,N=O),x>q?ie[m>>3]=x:x=q,O>b&&(ie[xe>>3]=O,b=O),j=O>0&O<j?O:j,X=O<0&O>X?O:X,_=_|+Qs(+(O-E))>3.141592653589793,g=se+1|0,(g|0)!=(K|0);)Ke=se,q=x,se=g,g=Ke;_&&(ie[xe>>3]=X,ie[ue>>3]=j)}}else h[m>>2]=0,h[m+4>>2]=0,h[m+8>>2]=0,h[m+12>>2]=0,h[m+16>>2]=0,h[m+20>>2]=0,h[m+24>>2]=0,h[m+28>>2]=0;if(Ke=p+8|0,g=h[Ke>>2]|0,!((g|0)<=0)){Be=p+12|0,Ae=0;do if(v=h[Be>>2]|0,_=Ae,Ae=Ae+1|0,ue=m+(Ae<<5)|0,xe=h[v+(_<<3)>>2]|0,xe){if(se=m+(Ae<<5)+8|0,ie[se>>3]=17976931348623157e292,p=m+(Ae<<5)+24|0,ie[p>>3]=17976931348623157e292,ie[ue>>3]=-17976931348623157e292,we=m+(Ae<<5)+16|0,ie[we>>3]=-17976931348623157e292,(xe|0)>0){for(K=h[v+(_<<3)+4>>2]|0,j=17976931348623157e292,X=-17976931348623157e292,v=0,_=-1,ae=0,M=17976931348623157e292,N=17976931348623157e292,O=-17976931348623157e292,b=-17976931348623157e292;x=+ie[K+(ae<<4)>>3],q=+ie[K+(ae<<4)+8>>3],_=_+2|0,E=+ie[K+(((_|0)==(xe|0)?0:_)<<4)+8>>3],x<M&&(ie[se>>3]=x,M=x),q<N&&(ie[p>>3]=q,N=q),x>O?ie[ue>>3]=x:x=O,q>b&&(ie[we>>3]=q,b=q),j=q>0&q<j?q:j,X=q<0&q>X?q:X,v=v|+Qs(+(q-E))>3.141592653589793,_=ae+1|0,(_|0)!=(xe|0);)Me=ae,ae=_,O=x,_=Me;v&&(ie[we>>3]=X,ie[p>>3]=j)}}else h[ue>>2]=0,h[ue+4>>2]=0,h[ue+8>>2]=0,h[ue+12>>2]=0,h[ue+16>>2]=0,h[ue+20>>2]=0,h[ue+24>>2]=0,h[ue+28>>2]=0,g=h[Ke>>2]|0;while((Ae|0)<(g|0))}}function mL(p,m,g){p=p|0,m=m|0,g=g|0;var _=0,v=0,x=0;if(!(Hx(p,m,g)|0))return v=0,v|0;if(v=p+8|0,(h[v>>2]|0)<=0)return v=1,v|0;for(_=p+12|0,p=0;;){if(x=p,p=p+1|0,Hx((h[_>>2]|0)+(x<<3)|0,m+(p<<5)|0,g)|0){p=0,_=6;break}if((p|0)>=(h[v>>2]|0)){p=1,_=6;break}}return(_|0)==6?p|0:0}function iq(p,m,g,_){p=p|0,m=m|0,g=g|0,_=_|0;var v=0,x=0,b=0,E=0,M=0,N=0,O=0;if(N=Q,Q=Q+16|0,E=N,b=g+8|0,!(Hx(p,m,b)|0))return M=0,Q=N,M|0;M=p+8|0;e:do if((h[M>>2]|0)>0){for(x=p+12|0,v=0;;){if(O=v,v=v+1|0,Hx((h[x>>2]|0)+(O<<3)|0,m+(v<<5)|0,b)|0){v=0;break}if((v|0)>=(h[M>>2]|0))break e}return Q=N,v|0}while(!1);if(iT(p,m,g,_)|0)return O=0,Q=N,O|0;h[E>>2]=h[g>>2],h[E+4>>2]=b,v=h[M>>2]|0;e:do if((v|0)>0)for(p=p+12|0,b=0,x=v;;){if(v=h[p>>2]|0,(h[v+(b<<3)>>2]|0)>0){if(Hx(E,_,h[v+(b<<3)+4>>2]|0)|0){v=0;break e}if(v=b+1|0,iT((h[p>>2]|0)+(b<<3)|0,m+(v<<5)|0,g,_)|0){v=0;break e}x=h[M>>2]|0}else v=b+1|0;if((v|0)<(x|0))b=v;else{v=1;break}}else v=1;while(!1);return O=v,Q=N,O|0}function iT(p,m,g,_){p=p|0,m=m|0,g=g|0,_=_|0;var v=0,x=0,b=0,E=0,M=0,N=0,O=0,q=0,j=0,X=0,K=0,ae=0,ue=0,xe=0,se=0,we=0,Ae=0,Be=0,Ke=0,Me=0,be=0;if(Ke=Q,Q=Q+176|0,se=Ke+172|0,v=Ke+168|0,we=Ke,!(QP(m,_)|0))return p=0,Q=Ke,p|0;if(Ece(m,_,se,v),cu(we|0,g|0,168)|0,(h[g>>2]|0)>0){m=0;do Me=we+8+(m<<4)+8|0,xe=+Ul(+ie[Me>>3],h[v>>2]|0),ie[Me>>3]=xe,m=m+1|0;while((m|0)<(h[g>>2]|0))}ae=+ie[_>>3],ue=+ie[_+8>>3],xe=+Ul(+ie[_+16>>3],h[v>>2]|0),X=+Ul(+ie[_+24>>3],h[v>>2]|0);e:do if((h[p>>2]|0)>0){if(_=p+4|0,v=h[we>>2]|0,(v|0)<=0){for(m=0;;)if(m=m+1|0,(m|0)>=(h[p>>2]|0)){m=0;break e}}for(g=0;;){if(m=h[_>>2]|0,j=+ie[m+(g<<4)>>3],K=+Ul(+ie[m+(g<<4)+8>>3],h[se>>2]|0),m=h[_>>2]|0,g=g+1|0,Me=(g|0)%(h[p>>2]|0)|0,x=+ie[m+(Me<<4)>>3],b=+Ul(+ie[m+(Me<<4)+8>>3],h[se>>2]|0),!(j>=ae)|!(x>=ae)&&!(j<=ue)|!(x<=ue)&&!(K<=X)|!(b<=X)&&!(K>=xe)|!(b>=xe)){q=x-j,N=b-K,m=0;do if(be=m,m=m+1|0,Me=(m|0)==(v|0)?0:m,x=+ie[we+8+(be<<4)+8>>3],b=+ie[we+8+(Me<<4)+8>>3]-x,E=+ie[we+8+(be<<4)>>3],M=+ie[we+8+(Me<<4)>>3]-E,O=q*b-N*M,O!=0&&(Ae=K-x,Be=j-E,M=(Ae*M-b*Be)/O,!(M<0|M>1))&&(O=(q*Ae-N*Be)/O,O>=0&O<=1)){m=1;break e}while((m|0)<(v|0))}if((g|0)>=(h[p>>2]|0)){m=0;break}}}else m=0;while(!1);return be=m,Q=Ke,be|0}function rq(p,m,g,_){p=p|0,m=m|0,g=g|0,_=_|0;var v=0,x=0,b=0;if(iT(p,m,g,_)|0)return x=1,x|0;if(x=p+8|0,(h[x>>2]|0)<=0)return x=0,x|0;for(v=p+12|0,p=0;;){if(b=p,p=p+1|0,iT((h[v>>2]|0)+(b<<3)|0,m+(p<<5)|0,g,_)|0){p=1,v=6;break}if((p|0)>=(h[x>>2]|0)){p=0,v=6;break}}return(v|0)==6?p|0:0}function vue(){return 8}function _ue(){return 16}function xue(){return 168}function yue(){return 8}function bue(){return 16}function wue(){return 12}function Sue(){return 8}function Tue(p){return p=p|0,+(+((h[p>>2]|0)>>>0)+4294967296*+(h[p+4>>2]|0))}function Eue(p){p=p|0;var m=0,g=0;return g=+ie[p>>3],m=+ie[p+8>>3],+ +bs(+(g*g+m*m))}function sq(p,m,g,_,v){p=p|0,m=m|0,g=g|0,_=_|0,v=v|0;var x=0,b=0,E=0,M=0,N=0,O=0,q=0,j=0;N=+ie[p>>3],M=+ie[m>>3]-N,E=+ie[p+8>>3],b=+ie[m+8>>3]-E,q=+ie[g>>3],x=+ie[_>>3]-q,j=+ie[g+8>>3],O=+ie[_+8>>3]-j,x=(x*(E-j)-(N-q)*O)/(M*O-b*x),ie[v>>3]=N+M*x,ie[v+8>>3]=E+b*x}function oq(p,m){return p=p|0,m=m|0,+Qs(+(+ie[p>>3]-+ie[m>>3]))<11920928955078125e-23?(m=+Qs(+(+ie[p+8>>3]-+ie[m+8>>3]))<11920928955078125e-23,m|0):(m=0,m|0)}function Mue(p,m,g){p=p|0,m=m|0,g=g|0;var _=0,v=0,x=0;if(x=Q,Q=Q+16|0,v=x,_=Zi(p,m)|0,(g+-1|0)>>>0>5||(_=(_|0)!=0,(g|0)==1&_))return v=-1,Q=x,v|0;do if(jx(p,m,v)|0)_=-1;else if(_){_=((h[26416+(g<<2)>>2]|0)+5-(h[v>>2]|0)|0)%5|0;break}else{_=((h[26448+(g<<2)>>2]|0)+6-(h[v>>2]|0)|0)%6|0;break}while(!1);return v=_,Q=x,v|0}function jx(p,m,g){p=p|0,m=m|0,g=g|0;var _=0,v=0,x=0,b=0,E=0,M=0,N=0,O=0;if(O=Q,Q=Q+32|0,E=O+16|0,M=O,_=g1(p,m,E)|0,_|0)return g=_,Q=O,g|0;x=XG(p,m)|0,N=al(p,m)|0,_ce(x,M),_=xce(x,h[E>>2]|0)|0;do if(xr(x)|0){do switch(x|0){case 4:{v=0;break}case 14:{v=1;break}case 24:{v=2;break}case 38:{v=3;break}case 49:{v=4;break}case 58:{v=5;break}case 63:{v=6;break}case 72:{v=7;break}case 83:{v=8;break}case 97:{v=9;break}case 107:{v=10;break}case 117:{v=11;break}default:di(27634,27636,75,27645)}while(!1);if(b=h[26480+(v*24|0)+8>>2]|0,m=h[26480+(v*24|0)+16>>2]|0,p=h[E>>2]|0,(p|0)!=(h[M>>2]|0)&&(M=YP(x)|0,p=h[E>>2]|0,M|(p|0)==(m|0)&&(_=(_+1|0)%6|0)),(N|0)==3&(p|0)==(m|0)){_=(_+5|0)%6|0;break}(N|0)==5&(p|0)==(b|0)&&(_=(_+1|0)%6|0)}while(!1);return h[g>>2]=_,g=0,Q=O,g|0}function vc(p,m,g,_){p=p|0,m=m|0,g=g|0,_=_|0;var v=0,x=0,b=0,E=0,M=0,N=0,O=0,q=0,j=0,X=0,K=0,ae=0,ue=0,xe=0,se=0,we=0;if(we=Q,Q=Q+32|0,se=we+24|0,ue=we+20|0,K=we+8|0,X=we+16|0,j=we,M=(Zi(p,m)|0)==0,M=M?6:5,O=tt(p|0,m|0,52)|0,ee()|0,O=O&15,M>>>0<=g>>>0)return _=2,Q=we,_|0;q=(O|0)==0,!q&&(ae=ft(7,0,(O^15)*3|0)|0,(ae&p|0)==0&((ee()|0)&m|0)==0)?v=g:x=4;e:do if((x|0)==4){if(v=(Zi(p,m)|0)!=0,((v?4:5)|0)<(g|0)||jx(p,m,se)|0||(x=(h[se>>2]|0)+g|0,v?v=26768+(((x|0)%5|0)<<2)|0:v=26800+(((x|0)%6|0)<<2)|0,ae=h[v>>2]|0,(ae|0)==7))return _=1,Q=we,_|0;h[ue>>2]=0,v=Js(p,m,ae,ue,K)|0;do if(!v){if(E=K,N=h[E>>2]|0,E=h[E+4>>2]|0,b=E>>>0<m>>>0|(E|0)==(m|0)&N>>>0<p>>>0,x=b?N:p,b=b?E:m,!q&&(q=ft(7,0,(O^15)*3|0)|0,(N&q|0)==0&(E&(ee()|0)|0)==0))v=g;else{if(E=(g+-1+M|0)%(M|0)|0,v=Zi(p,m)|0,(E|0)<0&&di(27634,27636,248,27661),M=(v|0)!=0,((M?4:5)|0)<(E|0)&&di(27634,27636,248,27661),jx(p,m,se)|0&&di(27634,27636,248,27661),v=(h[se>>2]|0)+E|0,M?v=26768+(((v|0)%5|0)<<2)|0:v=26800+(((v|0)%6|0)<<2)|0,E=h[v>>2]|0,(E|0)==7&&di(27634,27636,248,27661),h[X>>2]=0,v=Js(p,m,E,X,j)|0,v|0)break;N=j,M=h[N>>2]|0,N=h[N+4>>2]|0;do if(N>>>0<b>>>0|(N|0)==(b|0)&M>>>0<x>>>0){if(Zi(M,N)|0?x=QS(M,N,p,m)|0:x=h[26864+((((h[X>>2]|0)+(h[26832+(E<<2)>>2]|0)|0)%6|0)<<2)>>2]|0,v=Zi(M,N)|0,(x+-1|0)>>>0>5){v=-1,x=M,b=N;break}if(v=(v|0)!=0,(x|0)==1&v){v=-1,x=M,b=N;break}do if(jx(M,N,se)|0)v=-1;else if(v){v=((h[26416+(x<<2)>>2]|0)+5-(h[se>>2]|0)|0)%5|0;break}else{v=((h[26448+(x<<2)>>2]|0)+6-(h[se>>2]|0)|0)%6|0;break}while(!1);x=M,b=N}else v=g;while(!1);E=K,N=h[E>>2]|0,E=h[E+4>>2]|0}if((x|0)==(N|0)&(b|0)==(E|0)){if(M=(Zi(N,E)|0)!=0,M?p=QS(N,E,p,m)|0:p=h[26864+((((h[ue>>2]|0)+(h[26832+(ae<<2)>>2]|0)|0)%6|0)<<2)>>2]|0,v=Zi(N,E)|0,(p+-1|0)>>>0<=5&&(xe=(v|0)!=0,!((p|0)==1&xe)))do if(jx(N,E,se)|0)v=-1;else if(xe){v=((h[26416+(p<<2)>>2]|0)+5-(h[se>>2]|0)|0)%5|0;break}else{v=((h[26448+(p<<2)>>2]|0)+6-(h[se>>2]|0)|0)%6|0;break}while(!1);else v=-1;v=v+1|0,v=(v|0)==6|M&(v|0)==5?0:v}m=b,p=x;break e}while(!1);return _=v,Q=we,_|0}while(!1);return xe=ft(v|0,0,56)|0,se=ee()|0|m&-2130706433|536870912,h[_>>2]=xe|p,h[_+4>>2]=se,_=0,Q=we,_|0}function Cue(p,m,g){p=p|0,m=m|0,g=g|0;var _=0,v=0,x=0;return x=(Zi(p,m)|0)==0,_=vc(p,m,0,g)|0,v=(_|0)==0,x?!v||(_=vc(p,m,1,g+8|0)|0,_|0)||(_=vc(p,m,2,g+16|0)|0,_|0)||(_=vc(p,m,3,g+24|0)|0,_|0)||(_=vc(p,m,4,g+32|0)|0,_)?(x=_,x|0):vc(p,m,5,g+40|0)|0:!v||(_=vc(p,m,1,g+8|0)|0,_|0)||(_=vc(p,m,2,g+16|0)|0,_|0)||(_=vc(p,m,3,g+24|0)|0,_|0)||(_=vc(p,m,4,g+32|0)|0,_|0)?(x=_,x|0):(x=g+40|0,h[x>>2]=0,h[x+4>>2]=0,x=0,x|0)}function Rue(p,m,g){p=p|0,m=m|0,g=g|0;var _=0,v=0,x=0,b=0,E=0,M=0;return M=Q,Q=Q+192|0,v=M,x=M+168|0,b=tt(p|0,m|0,56)|0,ee()|0,b=b&7,E=m&-2130706433|134217728,_=g1(p,E,x)|0,_|0?(E=_,Q=M,E|0):(m=tt(p|0,m|0,52)|0,ee()|0,m=m&15,Zi(p,E)|0?eL(x,m,b,1,v):tL(x,m,b,1,v),E=v+8|0,h[g>>2]=h[E>>2],h[g+4>>2]=h[E+4>>2],h[g+8>>2]=h[E+8>>2],h[g+12>>2]=h[E+12>>2],E=0,Q=M,E|0)}function aq(p,m){p=p|0,m=m|0;var g=0,_=0,v=0,x=0;return v=Q,Q=Q+16|0,g=v,!(!0&(m&2013265920|0)==536870912)||(_=m&-2130706433|134217728,!(eT(p,_)|0))?(_=0,Q=v,_|0):(x=tt(p|0,m|0,56)|0,ee()|0,x=(vc(p,_,x&7,g)|0)==0,_=g,_=x&((h[_>>2]|0)==(p|0)?(h[_+4>>2]|0)==(m|0):0)&1,Q=v,_|0)}function lq(){return 27680}function rT(p,m,g,_){p=p|0,m=m|0,g=g|0,_=_|0;var v=0,x=0,b=0,E=0,M=0,N=0,O=0,q=0,j=0;q=Q,Q=Q+208|0,M=q,N=q+192|0,b=ol(g,m)|0,E=N,h[E>>2]=1,h[E+4>>2]=0;e:do if(b|0){for(E=0-g|0,h[M+4>>2]=g,h[M>>2]=g,v=2,m=g,x=g;m=m+g+x|0,h[M+(v<<2)>>2]=m,m>>>0<b>>>0;)j=x,v=v+1|0,x=m,m=j;if(x=p+b+E|0,x>>>0>p>>>0){b=x,v=1,m=1;do{do if((m&3|0)!=3)if(m=v+-1|0,(h[M+(m<<2)>>2]|0)>>>0<(b-p|0)>>>0?AL(p,g,_,v,M):oT(p,g,_,N,v,0,M),(v|0)==1){aT(N,1),v=0;break}else{aT(N,m),v=1;break}else AL(p,g,_,v,M),sT(N,2),v=v+2|0;while(!1);m=h[N>>2]|1,h[N>>2]=m,p=p+g|0}while(p>>>0<x>>>0)}else v=1,m=1;for(oT(p,g,_,N,v,0,M),x=N+4|0;;){if((v|0)==1&(m|0)==1)if(h[x>>2]|0)O=19;else break e;else(v|0)<2?O=19:(aT(N,2),j=v+-2|0,h[N>>2]=h[N>>2]^7,sT(N,1),oT(p+(0-(h[M+(j<<2)>>2]|0))+E|0,g,_,N,v+-1|0,1,M),aT(N,1),m=h[N>>2]|1,h[N>>2]=m,p=p+E|0,oT(p,g,_,N,j,1,M),v=j);(O|0)==19&&(O=0,m=cq(N)|0,sT(N,m),p=p+E|0,v=m+v|0,m=h[N>>2]|0)}}while(!1);Q=q}function AL(p,m,g,_,v){p=p|0,m=m|0,g=g|0,_=_|0,v=v|0;var x=0,b=0,E=0,M=0,N=0,O=0,q=0;q=Q,Q=Q+240|0,O=q,h[O>>2]=p;e:do if((_|0)>1)for(N=0-m|0,E=p,x=_,_=1,b=p;;){if(E=E+N|0,M=x+-2|0,p=E+(0-(h[v+(M<<2)>>2]|0))|0,(ap[g&3](b,p)|0)>-1&&(ap[g&3](b,E)|0)>-1||(b=O+(_<<2)|0,(ap[g&3](p,E)|0)>-1?(h[b>>2]=p,x=x+-1|0):(h[b>>2]=E,p=E,x=M),_=_+1|0,(x|0)<=1))break e;E=p,b=h[O>>2]|0}else _=1;while(!1);hq(m,O,_),Q=q}function sT(p,m){p=p|0,m=m|0;var g=0,_=0,v=0;v=p+4|0,m>>>0>31?(_=h[v>>2]|0,h[p>>2]=_,h[v>>2]=0,m=m+-32|0,g=0):(g=h[v>>2]|0,_=h[p>>2]|0),h[p>>2]=g<<32-m|_>>>m,h[v>>2]=g>>>m}function oT(p,m,g,_,v,x,b){p=p|0,m=m|0,g=g|0,_=_|0,v=v|0,x=x|0,b=b|0;var E=0,M=0,N=0,O=0,q=0,j=0,X=0,K=0;X=Q,Q=Q+240|0,q=X+232|0,j=X,K=h[_>>2]|0,h[q>>2]=K,M=h[_+4>>2]|0,N=q+4|0,h[N>>2]=M,h[j>>2]=p;e:do if((K|0)!=1|(M|0)!=0&&(O=0-m|0,E=p+(0-(h[b+(v<<2)>>2]|0))|0,(ap[g&3](E,p)|0)>=1))for(_=1,x=(x|0)==0,M=E;;){if(x&(v|0)>1){if(x=p+O|0,E=h[b+(v+-2<<2)>>2]|0,(ap[g&3](x,M)|0)>-1){E=10;break e}if((ap[g&3](x+(0-E)|0,M)|0)>-1){E=10;break e}}if(x=_+1|0,h[j+(_<<2)>>2]=M,K=cq(q)|0,sT(q,K),v=K+v|0,!((h[q>>2]|0)!=1|(h[N>>2]|0)!=0)){_=x,p=M,E=10;break e}if(p=M+(0-(h[b+(v<<2)>>2]|0))|0,(ap[g&3](p,h[j>>2]|0)|0)<1){p=M,_=x,x=0,E=9;break}else K=M,_=x,x=1,M=p,p=K}else _=1,E=9;while(!1);(E|0)==9&&(x|0)==0&&(E=10),(E|0)==10&&(hq(m,j,_),AL(p,m,g,v,b)),Q=X}function aT(p,m){p=p|0,m=m|0;var g=0,_=0,v=0;v=p+4|0,m>>>0>31?(_=h[p>>2]|0,h[v>>2]=_,h[p>>2]=0,m=m+-32|0,g=0):(g=h[p>>2]|0,_=h[v>>2]|0),h[v>>2]=g>>>(32-m|0)|_<<m,h[p>>2]=g<<m}function cq(p){p=p|0;var m=0;return m=uq((h[p>>2]|0)+-1|0)|0,m?m|0:(m=uq(h[p+4>>2]|0)|0,((m|0)==0?0:m+32|0)|0)}function uq(p){p=p|0;var m=0;if(p)if(p&1)p=0;else for(m=p,p=0;p=p+1|0,!(m&2);)m=m>>>1;else p=32;return p|0}function hq(p,m,g){p=p|0,m=m|0,g=g|0;var _=0,v=0,x=0,b=0,E=0;b=Q,Q=Q+256|0,_=b;e:do if((g|0)>=2&&(x=m+(g<<2)|0,h[x>>2]=_,p|0))for(;;){v=p>>>0<256?p:256,cu(_|0,h[m>>2]|0,v|0)|0,_=0;do E=m+(_<<2)|0,_=_+1|0,cu(h[E>>2]|0,h[m+(_<<2)>>2]|0,v|0)|0,h[E>>2]=(h[E>>2]|0)+v;while((_|0)!=(g|0));if(p=p-v|0,!p)break e;_=h[x>>2]|0}while(!1);Q=b}function rh(p){return p=+p,~~+Aq(+p)|0}function yr(p){p=p|0;var m=0,g=0,_=0,v=0,x=0,b=0,E=0,M=0,N=0,O=0,q=0,j=0,X=0,K=0,ae=0,ue=0,xe=0,se=0,we=0,Ae=0,Be=0;Be=Q,Q=Q+16|0,j=Be;do if(p>>>0<245){if(N=p>>>0<11?16:p+11&-8,p=N>>>3,q=h[6921]|0,g=q>>>p,g&3|0)return m=(g&1^1)+p|0,p=27724+(m<<1<<2)|0,g=p+8|0,_=h[g>>2]|0,v=_+8|0,x=h[v>>2]|0,(x|0)==(p|0)?h[6921]=q&~(1<<m):(h[x+12>>2]=p,h[g>>2]=x),Ae=m<<3,h[_+4>>2]=Ae|3,Ae=_+Ae+4|0,h[Ae>>2]=h[Ae>>2]|1,Ae=v,Q=Be,Ae|0;if(O=h[6923]|0,N>>>0>O>>>0){if(g|0)return m=2<<p,m=g<<p&(m|0-m),m=(m&0-m)+-1|0,E=m>>>12&16,m=m>>>E,g=m>>>5&8,m=m>>>g,x=m>>>2&4,m=m>>>x,p=m>>>1&2,m=m>>>p,_=m>>>1&1,_=(g|E|x|p|_)+(m>>>_)|0,m=27724+(_<<1<<2)|0,p=m+8|0,x=h[p>>2]|0,E=x+8|0,g=h[E>>2]|0,(g|0)==(m|0)?(p=q&~(1<<_),h[6921]=p):(h[g+12>>2]=m,h[p>>2]=g,p=q),Ae=_<<3,b=Ae-N|0,h[x+4>>2]=N|3,v=x+N|0,h[v+4>>2]=b|1,h[x+Ae>>2]=b,O|0&&(_=h[6926]|0,m=O>>>3,g=27724+(m<<1<<2)|0,m=1<<m,p&m?(p=g+8|0,m=h[p>>2]|0):(h[6921]=p|m,m=g,p=g+8|0),h[p>>2]=_,h[m+12>>2]=_,h[_+8>>2]=m,h[_+12>>2]=g),h[6923]=b,h[6926]=v,Ae=E,Q=Be,Ae|0;if(x=h[6922]|0,x){for(g=(x&0-x)+-1|0,v=g>>>12&16,g=g>>>v,_=g>>>5&8,g=g>>>_,b=g>>>2&4,g=g>>>b,E=g>>>1&2,g=g>>>E,M=g>>>1&1,M=h[27988+((_|v|b|E|M)+(g>>>M)<<2)>>2]|0,g=M,E=M,M=(h[M+4>>2]&-8)-N|0;p=h[g+16>>2]|0,!(!p&&(p=h[g+20>>2]|0,!p));)b=(h[p+4>>2]&-8)-N|0,v=b>>>0<M>>>0,g=p,E=v?p:E,M=v?b:M;if(b=E+N|0,b>>>0>E>>>0){v=h[E+24>>2]|0,m=h[E+12>>2]|0;do if((m|0)==(E|0)){if(p=E+20|0,m=h[p>>2]|0,!m&&(p=E+16|0,m=h[p>>2]|0,!m)){g=0;break}for(;;)if(_=m+20|0,g=h[_>>2]|0,g)m=g,p=_;else if(_=m+16|0,g=h[_>>2]|0,g)m=g,p=_;else break;h[p>>2]=0,g=m}else g=h[E+8>>2]|0,h[g+12>>2]=m,h[m+8>>2]=g,g=m;while(!1);do if(v|0){if(m=h[E+28>>2]|0,p=27988+(m<<2)|0,(E|0)==(h[p>>2]|0)){if(h[p>>2]=g,!g){h[6922]=x&~(1<<m);break}}else if(Ae=v+16|0,h[((h[Ae>>2]|0)==(E|0)?Ae:v+20|0)>>2]=g,!g)break;h[g+24>>2]=v,m=h[E+16>>2]|0,m|0&&(h[g+16>>2]=m,h[m+24>>2]=g),m=h[E+20>>2]|0,m|0&&(h[g+20>>2]=m,h[m+24>>2]=g)}while(!1);return M>>>0<16?(Ae=M+N|0,h[E+4>>2]=Ae|3,Ae=E+Ae+4|0,h[Ae>>2]=h[Ae>>2]|1):(h[E+4>>2]=N|3,h[b+4>>2]=M|1,h[b+M>>2]=M,O|0&&(_=h[6926]|0,m=O>>>3,g=27724+(m<<1<<2)|0,m=1<<m,m&q?(p=g+8|0,m=h[p>>2]|0):(h[6921]=m|q,m=g,p=g+8|0),h[p>>2]=_,h[m+12>>2]=_,h[_+8>>2]=m,h[_+12>>2]=g),h[6923]=M,h[6926]=b),Ae=E+8|0,Q=Be,Ae|0}else q=N}else q=N}else q=N}else if(p>>>0<=4294967231)if(p=p+11|0,N=p&-8,_=h[6922]|0,_){v=0-N|0,p=p>>>8,p?N>>>0>16777215?M=31:(q=(p+1048320|0)>>>16&8,ae=p<<q,E=(ae+520192|0)>>>16&4,ae=ae<<E,M=(ae+245760|0)>>>16&2,M=14-(E|q|M)+(ae<<M>>>15)|0,M=N>>>(M+7|0)&1|M<<1):M=0,g=h[27988+(M<<2)>>2]|0;e:do if(!g)g=0,p=0,ae=61;else for(p=0,E=N<<((M|0)==31?0:25-(M>>>1)|0),x=0;;){if(b=(h[g+4>>2]&-8)-N|0,b>>>0<v>>>0)if(b)p=g,v=b;else{p=g,v=0,ae=65;break e}if(ae=h[g+20>>2]|0,g=h[g+16+(E>>>31<<2)>>2]|0,x=(ae|0)==0|(ae|0)==(g|0)?x:ae,g)E=E<<1;else{g=x,ae=61;break}}while(!1);if((ae|0)==61){if((g|0)==0&(p|0)==0){if(p=2<<M,p=(p|0-p)&_,!p){q=N;break}q=(p&0-p)+-1|0,b=q>>>12&16,q=q>>>b,x=q>>>5&8,q=q>>>x,E=q>>>2&4,q=q>>>E,M=q>>>1&2,q=q>>>M,g=q>>>1&1,p=0,g=h[27988+((x|b|E|M|g)+(q>>>g)<<2)>>2]|0}g?ae=65:(E=p,b=v)}if((ae|0)==65)for(x=g;;)if(q=(h[x+4>>2]&-8)-N|0,g=q>>>0<v>>>0,v=g?q:v,p=g?x:p,g=h[x+16>>2]|0,g||(g=h[x+20>>2]|0),g)x=g;else{E=p,b=v;break}if((E|0)!=0&&b>>>0<((h[6923]|0)-N|0)>>>0&&(O=E+N|0,O>>>0>E>>>0)){x=h[E+24>>2]|0,m=h[E+12>>2]|0;do if((m|0)==(E|0)){if(p=E+20|0,m=h[p>>2]|0,!m&&(p=E+16|0,m=h[p>>2]|0,!m)){m=0;break}for(;;)if(v=m+20|0,g=h[v>>2]|0,g)m=g,p=v;else if(v=m+16|0,g=h[v>>2]|0,g)m=g,p=v;else break;h[p>>2]=0}else Ae=h[E+8>>2]|0,h[Ae+12>>2]=m,h[m+8>>2]=Ae;while(!1);do if(x){if(p=h[E+28>>2]|0,g=27988+(p<<2)|0,(E|0)==(h[g>>2]|0)){if(h[g>>2]=m,!m){_=_&~(1<<p),h[6922]=_;break}}else if(Ae=x+16|0,h[((h[Ae>>2]|0)==(E|0)?Ae:x+20|0)>>2]=m,!m)break;h[m+24>>2]=x,p=h[E+16>>2]|0,p|0&&(h[m+16>>2]=p,h[p+24>>2]=m),p=h[E+20>>2]|0,p&&(h[m+20>>2]=p,h[p+24>>2]=m)}while(!1);e:do if(b>>>0<16)Ae=b+N|0,h[E+4>>2]=Ae|3,Ae=E+Ae+4|0,h[Ae>>2]=h[Ae>>2]|1;else{if(h[E+4>>2]=N|3,h[O+4>>2]=b|1,h[O+b>>2]=b,m=b>>>3,b>>>0<256){g=27724+(m<<1<<2)|0,p=h[6921]|0,m=1<<m,p&m?(p=g+8|0,m=h[p>>2]|0):(h[6921]=p|m,m=g,p=g+8|0),h[p>>2]=O,h[m+12>>2]=O,h[O+8>>2]=m,h[O+12>>2]=g;break}if(m=b>>>8,m?b>>>0>16777215?g=31:(we=(m+1048320|0)>>>16&8,Ae=m<<we,se=(Ae+520192|0)>>>16&4,Ae=Ae<<se,g=(Ae+245760|0)>>>16&2,g=14-(se|we|g)+(Ae<<g>>>15)|0,g=b>>>(g+7|0)&1|g<<1):g=0,m=27988+(g<<2)|0,h[O+28>>2]=g,p=O+16|0,h[p+4>>2]=0,h[p>>2]=0,p=1<<g,!(_&p)){h[6922]=_|p,h[m>>2]=O,h[O+24>>2]=m,h[O+12>>2]=O,h[O+8>>2]=O;break}m=h[m>>2]|0;t:do if((h[m+4>>2]&-8|0)!=(b|0)){for(_=b<<((g|0)==31?0:25-(g>>>1)|0);g=m+16+(_>>>31<<2)|0,p=h[g>>2]|0,!!p;)if((h[p+4>>2]&-8|0)==(b|0)){m=p;break t}else _=_<<1,m=p;h[g>>2]=O,h[O+24>>2]=m,h[O+12>>2]=O,h[O+8>>2]=O;break e}while(!1);we=m+8|0,Ae=h[we>>2]|0,h[Ae+12>>2]=O,h[we>>2]=O,h[O+8>>2]=Ae,h[O+12>>2]=m,h[O+24>>2]=0}while(!1);return Ae=E+8|0,Q=Be,Ae|0}else q=N}else q=N;else q=-1;while(!1);if(g=h[6923]|0,g>>>0>=q>>>0)return m=g-q|0,p=h[6926]|0,m>>>0>15?(Ae=p+q|0,h[6926]=Ae,h[6923]=m,h[Ae+4>>2]=m|1,h[p+g>>2]=m,h[p+4>>2]=q|3):(h[6923]=0,h[6926]=0,h[p+4>>2]=g|3,Ae=p+g+4|0,h[Ae>>2]=h[Ae>>2]|1),Ae=p+8|0,Q=Be,Ae|0;if(b=h[6924]|0,b>>>0>q>>>0)return se=b-q|0,h[6924]=se,Ae=h[6927]|0,we=Ae+q|0,h[6927]=we,h[we+4>>2]=se|1,h[Ae+4>>2]=q|3,Ae=Ae+8|0,Q=Be,Ae|0;if(h[7039]|0?p=h[7041]|0:(h[7041]=4096,h[7040]=4096,h[7042]=-1,h[7043]=-1,h[7044]=0,h[7032]=0,h[7039]=j&-16^1431655768,p=4096),E=q+48|0,M=q+47|0,x=p+M|0,v=0-p|0,N=x&v,N>>>0<=q>>>0||(p=h[7031]|0,p|0&&(O=h[7029]|0,j=O+N|0,j>>>0<=O>>>0|j>>>0>p>>>0)))return Ae=0,Q=Be,Ae|0;e:do if(h[7032]&4)m=0,ae=143;else{g=h[6927]|0;t:do if(g){for(_=28132;j=h[_>>2]|0,!(j>>>0<=g>>>0&&(j+(h[_+4>>2]|0)|0)>>>0>g>>>0);)if(p=h[_+8>>2]|0,p)_=p;else{ae=128;break t}if(m=x-b&v,m>>>0<2147483647)if(p=op(m|0)|0,(p|0)==((h[_>>2]|0)+(h[_+4>>2]|0)|0)){if((p|0)!=-1){b=m,x=p,ae=145;break e}}else _=p,ae=136;else m=0}else ae=128;while(!1);do if((ae|0)==128)if(g=op(0)|0,(g|0)!=-1&&(m=g,X=h[7040]|0,K=X+-1|0,m=((K&m|0)==0?0:(K+m&0-X)-m|0)+N|0,X=h[7029]|0,K=m+X|0,m>>>0>q>>>0&m>>>0<2147483647)){if(j=h[7031]|0,j|0&&K>>>0<=X>>>0|K>>>0>j>>>0){m=0;break}if(p=op(m|0)|0,(p|0)==(g|0)){b=m,x=g,ae=145;break e}else _=p,ae=136}else m=0;while(!1);do if((ae|0)==136){if(g=0-m|0,!(E>>>0>m>>>0&(m>>>0<2147483647&(_|0)!=-1)))if((_|0)==-1){m=0;break}else{b=m,x=_,ae=145;break e}if(p=h[7041]|0,p=M-m+p&0-p,p>>>0>=2147483647){b=m,x=_,ae=145;break e}if((op(p|0)|0)==-1){op(g|0)|0,m=0;break}else{b=p+m|0,x=_,ae=145;break e}}while(!1);h[7032]=h[7032]|4,ae=143}while(!1);if((ae|0)==143&&N>>>0<2147483647&&(se=op(N|0)|0,K=op(0)|0,ue=K-se|0,xe=ue>>>0>(q+40|0)>>>0,!((se|0)==-1|xe^1|se>>>0<K>>>0&((se|0)!=-1&(K|0)!=-1)^1))&&(b=xe?ue:m,x=se,ae=145),(ae|0)==145){m=(h[7029]|0)+b|0,h[7029]=m,m>>>0>(h[7030]|0)>>>0&&(h[7030]=m),M=h[6927]|0;e:do if(M){for(m=28132;;){if(p=h[m>>2]|0,g=h[m+4>>2]|0,(x|0)==(p+g|0)){ae=154;break}if(_=h[m+8>>2]|0,_)m=_;else break}if((ae|0)==154&&(we=m+4|0,(h[m+12>>2]&8|0)==0)&&x>>>0>M>>>0&p>>>0<=M>>>0){h[we>>2]=g+b,Ae=(h[6924]|0)+b|0,se=M+8|0,se=(se&7|0)==0?0:0-se&7,we=M+se|0,se=Ae-se|0,h[6927]=we,h[6924]=se,h[we+4>>2]=se|1,h[M+Ae+4>>2]=40,h[6928]=h[7043];break}for(x>>>0<(h[6925]|0)>>>0&&(h[6925]=x),g=x+b|0,m=28132;;){if((h[m>>2]|0)==(g|0)){ae=162;break}if(p=h[m+8>>2]|0,p)m=p;else break}if((ae|0)==162&&(h[m+12>>2]&8|0)==0){h[m>>2]=x,O=m+4|0,h[O>>2]=(h[O>>2]|0)+b,O=x+8|0,O=x+((O&7|0)==0?0:0-O&7)|0,m=g+8|0,m=g+((m&7|0)==0?0:0-m&7)|0,N=O+q|0,E=m-O-q|0,h[O+4>>2]=q|3;t:do if((M|0)==(m|0))Ae=(h[6924]|0)+E|0,h[6924]=Ae,h[6927]=N,h[N+4>>2]=Ae|1;else{if((h[6926]|0)==(m|0)){Ae=(h[6923]|0)+E|0,h[6923]=Ae,h[6926]=N,h[N+4>>2]=Ae|1,h[N+Ae>>2]=Ae;break}if(p=h[m+4>>2]|0,(p&3|0)==1){b=p&-8,_=p>>>3;n:do if(p>>>0<256)if(p=h[m+8>>2]|0,g=h[m+12>>2]|0,(g|0)==(p|0)){h[6921]=h[6921]&~(1<<_);break}else{h[p+12>>2]=g,h[g+8>>2]=p;break}else{x=h[m+24>>2]|0,p=h[m+12>>2]|0;do if((p|0)==(m|0)){if(g=m+16|0,_=g+4|0,p=h[_>>2]|0,p)g=_;else if(p=h[g>>2]|0,!p){p=0;break}for(;;)if(v=p+20|0,_=h[v>>2]|0,_)p=_,g=v;else if(v=p+16|0,_=h[v>>2]|0,_)p=_,g=v;else break;h[g>>2]=0}else Ae=h[m+8>>2]|0,h[Ae+12>>2]=p,h[p+8>>2]=Ae;while(!1);if(!x)break;g=h[m+28>>2]|0,_=27988+(g<<2)|0;do if((h[_>>2]|0)!=(m|0)){if(Ae=x+16|0,h[((h[Ae>>2]|0)==(m|0)?Ae:x+20|0)>>2]=p,!p)break n}else{if(h[_>>2]=p,p|0)break;h[6922]=h[6922]&~(1<<g);break n}while(!1);if(h[p+24>>2]=x,g=m+16|0,_=h[g>>2]|0,_|0&&(h[p+16>>2]=_,h[_+24>>2]=p),g=h[g+4>>2]|0,!g)break;h[p+20>>2]=g,h[g+24>>2]=p}while(!1);m=m+b|0,v=b+E|0}else v=E;if(m=m+4|0,h[m>>2]=h[m>>2]&-2,h[N+4>>2]=v|1,h[N+v>>2]=v,m=v>>>3,v>>>0<256){g=27724+(m<<1<<2)|0,p=h[6921]|0,m=1<<m,p&m?(p=g+8|0,m=h[p>>2]|0):(h[6921]=p|m,m=g,p=g+8|0),h[p>>2]=N,h[m+12>>2]=N,h[N+8>>2]=m,h[N+12>>2]=g;break}m=v>>>8;do if(!m)_=0;else{if(v>>>0>16777215){_=31;break}we=(m+1048320|0)>>>16&8,Ae=m<<we,se=(Ae+520192|0)>>>16&4,Ae=Ae<<se,_=(Ae+245760|0)>>>16&2,_=14-(se|we|_)+(Ae<<_>>>15)|0,_=v>>>(_+7|0)&1|_<<1}while(!1);if(m=27988+(_<<2)|0,h[N+28>>2]=_,p=N+16|0,h[p+4>>2]=0,h[p>>2]=0,p=h[6922]|0,g=1<<_,!(p&g)){h[6922]=p|g,h[m>>2]=N,h[N+24>>2]=m,h[N+12>>2]=N,h[N+8>>2]=N;break}m=h[m>>2]|0;n:do if((h[m+4>>2]&-8|0)!=(v|0)){for(_=v<<((_|0)==31?0:25-(_>>>1)|0);g=m+16+(_>>>31<<2)|0,p=h[g>>2]|0,!!p;)if((h[p+4>>2]&-8|0)==(v|0)){m=p;break n}else _=_<<1,m=p;h[g>>2]=N,h[N+24>>2]=m,h[N+12>>2]=N,h[N+8>>2]=N;break t}while(!1);we=m+8|0,Ae=h[we>>2]|0,h[Ae+12>>2]=N,h[we>>2]=N,h[N+8>>2]=Ae,h[N+12>>2]=m,h[N+24>>2]=0}while(!1);return Ae=O+8|0,Q=Be,Ae|0}for(m=28132;p=h[m>>2]|0,!(p>>>0<=M>>>0&&(Ae=p+(h[m+4>>2]|0)|0,Ae>>>0>M>>>0));)m=h[m+8>>2]|0;v=Ae+-47|0,p=v+8|0,p=v+((p&7|0)==0?0:0-p&7)|0,v=M+16|0,p=p>>>0<v>>>0?M:p,m=p+8|0,g=b+-40|0,se=x+8|0,se=(se&7|0)==0?0:0-se&7,we=x+se|0,se=g-se|0,h[6927]=we,h[6924]=se,h[we+4>>2]=se|1,h[x+g+4>>2]=40,h[6928]=h[7043],g=p+4|0,h[g>>2]=27,h[m>>2]=h[7033],h[m+4>>2]=h[7034],h[m+8>>2]=h[7035],h[m+12>>2]=h[7036],h[7033]=x,h[7034]=b,h[7036]=0,h[7035]=m,m=p+24|0;do we=m,m=m+4|0,h[m>>2]=7;while((we+8|0)>>>0<Ae>>>0);if((p|0)!=(M|0)){if(x=p-M|0,h[g>>2]=h[g>>2]&-2,h[M+4>>2]=x|1,h[p>>2]=x,m=x>>>3,x>>>0<256){g=27724+(m<<1<<2)|0,p=h[6921]|0,m=1<<m,p&m?(p=g+8|0,m=h[p>>2]|0):(h[6921]=p|m,m=g,p=g+8|0),h[p>>2]=M,h[m+12>>2]=M,h[M+8>>2]=m,h[M+12>>2]=g;break}if(m=x>>>8,m?x>>>0>16777215?_=31:(we=(m+1048320|0)>>>16&8,Ae=m<<we,se=(Ae+520192|0)>>>16&4,Ae=Ae<<se,_=(Ae+245760|0)>>>16&2,_=14-(se|we|_)+(Ae<<_>>>15)|0,_=x>>>(_+7|0)&1|_<<1):_=0,g=27988+(_<<2)|0,h[M+28>>2]=_,h[M+20>>2]=0,h[v>>2]=0,m=h[6922]|0,p=1<<_,!(m&p)){h[6922]=m|p,h[g>>2]=M,h[M+24>>2]=g,h[M+12>>2]=M,h[M+8>>2]=M;break}m=h[g>>2]|0;t:do if((h[m+4>>2]&-8|0)!=(x|0)){for(_=x<<((_|0)==31?0:25-(_>>>1)|0);g=m+16+(_>>>31<<2)|0,p=h[g>>2]|0,!!p;)if((h[p+4>>2]&-8|0)==(x|0)){m=p;break t}else _=_<<1,m=p;h[g>>2]=M,h[M+24>>2]=m,h[M+12>>2]=M,h[M+8>>2]=M;break e}while(!1);we=m+8|0,Ae=h[we>>2]|0,h[Ae+12>>2]=M,h[we>>2]=M,h[M+8>>2]=Ae,h[M+12>>2]=m,h[M+24>>2]=0}}else Ae=h[6925]|0,(Ae|0)==0|x>>>0<Ae>>>0&&(h[6925]=x),h[7033]=x,h[7034]=b,h[7036]=0,h[6930]=h[7039],h[6929]=-1,h[6934]=27724,h[6933]=27724,h[6936]=27732,h[6935]=27732,h[6938]=27740,h[6937]=27740,h[6940]=27748,h[6939]=27748,h[6942]=27756,h[6941]=27756,h[6944]=27764,h[6943]=27764,h[6946]=27772,h[6945]=27772,h[6948]=27780,h[6947]=27780,h[6950]=27788,h[6949]=27788,h[6952]=27796,h[6951]=27796,h[6954]=27804,h[6953]=27804,h[6956]=27812,h[6955]=27812,h[6958]=27820,h[6957]=27820,h[6960]=27828,h[6959]=27828,h[6962]=27836,h[6961]=27836,h[6964]=27844,h[6963]=27844,h[6966]=27852,h[6965]=27852,h[6968]=27860,h[6967]=27860,h[6970]=27868,h[6969]=27868,h[6972]=27876,h[6971]=27876,h[6974]=27884,h[6973]=27884,h[6976]=27892,h[6975]=27892,h[6978]=27900,h[6977]=27900,h[6980]=27908,h[6979]=27908,h[6982]=27916,h[6981]=27916,h[6984]=27924,h[6983]=27924,h[6986]=27932,h[6985]=27932,h[6988]=27940,h[6987]=27940,h[6990]=27948,h[6989]=27948,h[6992]=27956,h[6991]=27956,h[6994]=27964,h[6993]=27964,h[6996]=27972,h[6995]=27972,Ae=b+-40|0,se=x+8|0,se=(se&7|0)==0?0:0-se&7,we=x+se|0,se=Ae-se|0,h[6927]=we,h[6924]=se,h[we+4>>2]=se|1,h[x+Ae+4>>2]=40,h[6928]=h[7043];while(!1);if(m=h[6924]|0,m>>>0>q>>>0)return se=m-q|0,h[6924]=se,Ae=h[6927]|0,we=Ae+q|0,h[6927]=we,h[we+4>>2]=se|1,h[Ae+4>>2]=q|3,Ae=Ae+8|0,Q=Be,Ae|0}return Ae=lq()|0,h[Ae>>2]=12,Ae=0,Q=Be,Ae|0}function _t(p){p=p|0;var m=0,g=0,_=0,v=0,x=0,b=0,E=0,M=0;if(p){g=p+-8|0,v=h[6925]|0,p=h[p+-4>>2]|0,m=p&-8,M=g+m|0;do if(p&1)E=g,b=g;else{if(_=h[g>>2]|0,!(p&3)||(b=g+(0-_)|0,x=_+m|0,b>>>0<v>>>0))return;if((h[6926]|0)==(b|0)){if(p=M+4|0,m=h[p>>2]|0,(m&3|0)!=3){E=b,m=x;break}h[6923]=x,h[p>>2]=m&-2,h[b+4>>2]=x|1,h[b+x>>2]=x;return}if(g=_>>>3,_>>>0<256)if(p=h[b+8>>2]|0,m=h[b+12>>2]|0,(m|0)==(p|0)){h[6921]=h[6921]&~(1<<g),E=b,m=x;break}else{h[p+12>>2]=m,h[m+8>>2]=p,E=b,m=x;break}v=h[b+24>>2]|0,p=h[b+12>>2]|0;do if((p|0)==(b|0)){if(m=b+16|0,g=m+4|0,p=h[g>>2]|0,p)m=g;else if(p=h[m>>2]|0,!p){p=0;break}for(;;)if(_=p+20|0,g=h[_>>2]|0,g)p=g,m=_;else if(_=p+16|0,g=h[_>>2]|0,g)p=g,m=_;else break;h[m>>2]=0}else E=h[b+8>>2]|0,h[E+12>>2]=p,h[p+8>>2]=E;while(!1);if(v){if(m=h[b+28>>2]|0,g=27988+(m<<2)|0,(h[g>>2]|0)==(b|0)){if(h[g>>2]=p,!p){h[6922]=h[6922]&~(1<<m),E=b,m=x;break}}else if(E=v+16|0,h[((h[E>>2]|0)==(b|0)?E:v+20|0)>>2]=p,!p){E=b,m=x;break}h[p+24>>2]=v,m=b+16|0,g=h[m>>2]|0,g|0&&(h[p+16>>2]=g,h[g+24>>2]=p),m=h[m+4>>2]|0,m?(h[p+20>>2]=m,h[m+24>>2]=p,E=b,m=x):(E=b,m=x)}else E=b,m=x}while(!1);if(!(b>>>0>=M>>>0)&&(p=M+4|0,_=h[p>>2]|0,!!(_&1))){if(_&2)h[p>>2]=_&-2,h[E+4>>2]=m|1,h[b+m>>2]=m,v=m;else{if((h[6927]|0)==(M|0)){if(M=(h[6924]|0)+m|0,h[6924]=M,h[6927]=E,h[E+4>>2]=M|1,(E|0)!=(h[6926]|0))return;h[6926]=0,h[6923]=0;return}if((h[6926]|0)==(M|0)){M=(h[6923]|0)+m|0,h[6923]=M,h[6926]=b,h[E+4>>2]=M|1,h[b+M>>2]=M;return}v=(_&-8)+m|0,g=_>>>3;do if(_>>>0<256)if(m=h[M+8>>2]|0,p=h[M+12>>2]|0,(p|0)==(m|0)){h[6921]=h[6921]&~(1<<g);break}else{h[m+12>>2]=p,h[p+8>>2]=m;break}else{x=h[M+24>>2]|0,p=h[M+12>>2]|0;do if((p|0)==(M|0)){if(m=M+16|0,g=m+4|0,p=h[g>>2]|0,p)m=g;else if(p=h[m>>2]|0,!p){g=0;break}for(;;)if(_=p+20|0,g=h[_>>2]|0,g)p=g,m=_;else if(_=p+16|0,g=h[_>>2]|0,g)p=g,m=_;else break;h[m>>2]=0,g=p}else g=h[M+8>>2]|0,h[g+12>>2]=p,h[p+8>>2]=g,g=p;while(!1);if(x|0){if(p=h[M+28>>2]|0,m=27988+(p<<2)|0,(h[m>>2]|0)==(M|0)){if(h[m>>2]=g,!g){h[6922]=h[6922]&~(1<<p);break}}else if(_=x+16|0,h[((h[_>>2]|0)==(M|0)?_:x+20|0)>>2]=g,!g)break;h[g+24>>2]=x,p=M+16|0,m=h[p>>2]|0,m|0&&(h[g+16>>2]=m,h[m+24>>2]=g),p=h[p+4>>2]|0,p|0&&(h[g+20>>2]=p,h[p+24>>2]=g)}}while(!1);if(h[E+4>>2]=v|1,h[b+v>>2]=v,(E|0)==(h[6926]|0)){h[6923]=v;return}}if(p=v>>>3,v>>>0<256){g=27724+(p<<1<<2)|0,m=h[6921]|0,p=1<<p,m&p?(m=g+8|0,p=h[m>>2]|0):(h[6921]=m|p,p=g,m=g+8|0),h[m>>2]=E,h[p+12>>2]=E,h[E+8>>2]=p,h[E+12>>2]=g;return}p=v>>>8,p?v>>>0>16777215?_=31:(b=(p+1048320|0)>>>16&8,M=p<<b,x=(M+520192|0)>>>16&4,M=M<<x,_=(M+245760|0)>>>16&2,_=14-(x|b|_)+(M<<_>>>15)|0,_=v>>>(_+7|0)&1|_<<1):_=0,p=27988+(_<<2)|0,h[E+28>>2]=_,h[E+20>>2]=0,h[E+16>>2]=0,m=h[6922]|0,g=1<<_;e:do if(!(m&g))h[6922]=m|g,h[p>>2]=E,h[E+24>>2]=p,h[E+12>>2]=E,h[E+8>>2]=E;else{p=h[p>>2]|0;t:do if((h[p+4>>2]&-8|0)!=(v|0)){for(_=v<<((_|0)==31?0:25-(_>>>1)|0);g=p+16+(_>>>31<<2)|0,m=h[g>>2]|0,!!m;)if((h[m+4>>2]&-8|0)==(v|0)){p=m;break t}else _=_<<1,p=m;h[g>>2]=E,h[E+24>>2]=p,h[E+12>>2]=E,h[E+8>>2]=E;break e}while(!1);b=p+8|0,M=h[b>>2]|0,h[M+12>>2]=E,h[b>>2]=E,h[E+8>>2]=M,h[E+12>>2]=p,h[E+24>>2]=0}while(!1);if(M=(h[6929]|0)+-1|0,h[6929]=M,!(M|0)){for(p=28140;p=h[p>>2]|0,p;)p=p+8|0;h[6929]=-1}}}}function Ta(p,m){p=p|0,m=m|0;var g=0;return p?(g=ol(m,p)|0,(m|p)>>>0>65535&&(g=((g>>>0)/(p>>>0)|0|0)==(m|0)?g:-1)):g=0,p=yr(g)|0,!p||!(h[p+-4>>2]&3)||sp(p|0,0,g|0)|0,p|0}function Iue(p,m){p=p|0,m=m|0;var g=0,_=0;return p?m>>>0>4294967231?(m=lq()|0,h[m>>2]=12,m=0,m|0):(g=Pue(p+-8|0,m>>>0<11?16:m+11&-8)|0,g|0?(m=g+8|0,m|0):(g=yr(m)|0,g?(_=h[p+-4>>2]|0,_=(_&-8)-((_&3|0)==0?8:4)|0,cu(g|0,p|0,(_>>>0<m>>>0?_:m)|0)|0,_t(p),m=g,m|0):(m=0,m|0))):(m=yr(m)|0,m|0)}function Pue(p,m){p=p|0,m=m|0;var g=0,_=0,v=0,x=0,b=0,E=0,M=0,N=0,O=0,q=0;if(O=p+4|0,q=h[O>>2]|0,g=q&-8,E=p+g|0,!(q&3))return m>>>0<256?(p=0,p|0):(g>>>0>=(m+4|0)>>>0&&(g-m|0)>>>0<=h[7041]<<1>>>0||(p=0),p|0);if(g>>>0>=m>>>0)return g=g-m|0,g>>>0<=15||(N=p+m|0,h[O>>2]=q&1|m|2,h[N+4>>2]=g|3,q=E+4|0,h[q>>2]=h[q>>2]|1,fq(N,g)),p|0;if((h[6927]|0)==(E|0))return N=(h[6924]|0)+g|0,g=N-m|0,_=p+m|0,N>>>0<=m>>>0?(p=0,p|0):(h[O>>2]=q&1|m|2,h[_+4>>2]=g|1,h[6927]=_,h[6924]=g,p|0);if((h[6926]|0)==(E|0))return _=(h[6923]|0)+g|0,_>>>0<m>>>0?(p=0,p|0):(g=_-m|0,g>>>0>15?(N=p+m|0,_=p+_|0,h[O>>2]=q&1|m|2,h[N+4>>2]=g|1,h[_>>2]=g,_=_+4|0,h[_>>2]=h[_>>2]&-2,_=N):(h[O>>2]=q&1|_|2,_=p+_+4|0,h[_>>2]=h[_>>2]|1,_=0,g=0),h[6923]=g,h[6926]=_,p|0);if(_=h[E+4>>2]|0,_&2|0||(M=(_&-8)+g|0,M>>>0<m>>>0))return p=0,p|0;N=M-m|0,v=_>>>3;do if(_>>>0<256)if(_=h[E+8>>2]|0,g=h[E+12>>2]|0,(g|0)==(_|0)){h[6921]=h[6921]&~(1<<v);break}else{h[_+12>>2]=g,h[g+8>>2]=_;break}else{b=h[E+24>>2]|0,g=h[E+12>>2]|0;do if((g|0)==(E|0)){if(_=E+16|0,v=_+4|0,g=h[v>>2]|0,g)_=v;else if(g=h[_>>2]|0,!g){v=0;break}for(;;)if(x=g+20|0,v=h[x>>2]|0,v)g=v,_=x;else if(x=g+16|0,v=h[x>>2]|0,v)g=v,_=x;else break;h[_>>2]=0,v=g}else v=h[E+8>>2]|0,h[v+12>>2]=g,h[g+8>>2]=v,v=g;while(!1);if(b|0){if(g=h[E+28>>2]|0,_=27988+(g<<2)|0,(h[_>>2]|0)==(E|0)){if(h[_>>2]=v,!v){h[6922]=h[6922]&~(1<<g);break}}else if(x=b+16|0,h[((h[x>>2]|0)==(E|0)?x:b+20|0)>>2]=v,!v)break;h[v+24>>2]=b,g=E+16|0,_=h[g>>2]|0,_|0&&(h[v+16>>2]=_,h[_+24>>2]=v),g=h[g+4>>2]|0,g|0&&(h[v+20>>2]=g,h[g+24>>2]=v)}}while(!1);return N>>>0<16?(h[O>>2]=q&1|M|2,q=p+M+4|0,h[q>>2]=h[q>>2]|1,p|0):(E=p+m|0,h[O>>2]=q&1|m|2,h[E+4>>2]=N|3,q=p+M+4|0,h[q>>2]=h[q>>2]|1,fq(E,N),p|0)}function fq(p,m){p=p|0,m=m|0;var g=0,_=0,v=0,x=0,b=0,E=0;E=p+m|0,g=h[p+4>>2]|0;do if(g&1)b=p;else{if(v=h[p>>2]|0,!(g&3))return;if(b=p+(0-v)|0,m=v+m|0,(h[6926]|0)==(b|0)){if(p=E+4|0,g=h[p>>2]|0,(g&3|0)!=3)break;h[6923]=m,h[p>>2]=g&-2,h[b+4>>2]=m|1,h[E>>2]=m;return}if(_=v>>>3,v>>>0<256)if(p=h[b+8>>2]|0,g=h[b+12>>2]|0,(g|0)==(p|0)){h[6921]=h[6921]&~(1<<_);break}else{h[p+12>>2]=g,h[g+8>>2]=p;break}x=h[b+24>>2]|0,p=h[b+12>>2]|0;do if((p|0)==(b|0)){if(g=b+16|0,_=g+4|0,p=h[_>>2]|0,p)g=_;else if(p=h[g>>2]|0,!p){p=0;break}for(;;)if(v=p+20|0,_=h[v>>2]|0,_)p=_,g=v;else if(v=p+16|0,_=h[v>>2]|0,_)p=_,g=v;else break;h[g>>2]=0}else v=h[b+8>>2]|0,h[v+12>>2]=p,h[p+8>>2]=v;while(!1);if(x){if(g=h[b+28>>2]|0,_=27988+(g<<2)|0,(h[_>>2]|0)==(b|0)){if(h[_>>2]=p,!p){h[6922]=h[6922]&~(1<<g);break}}else if(v=x+16|0,h[((h[v>>2]|0)==(b|0)?v:x+20|0)>>2]=p,!p)break;h[p+24>>2]=x,g=b+16|0,_=h[g>>2]|0,_|0&&(h[p+16>>2]=_,h[_+24>>2]=p),g=h[g+4>>2]|0,g&&(h[p+20>>2]=g,h[g+24>>2]=p)}}while(!1);if(p=E+4|0,_=h[p>>2]|0,_&2)h[p>>2]=_&-2,h[b+4>>2]=m|1,h[b+m>>2]=m,v=m;else{if((h[6927]|0)==(E|0)){if(E=(h[6924]|0)+m|0,h[6924]=E,h[6927]=b,h[b+4>>2]=E|1,(b|0)!=(h[6926]|0))return;h[6926]=0,h[6923]=0;return}if((h[6926]|0)==(E|0)){E=(h[6923]|0)+m|0,h[6923]=E,h[6926]=b,h[b+4>>2]=E|1,h[b+E>>2]=E;return}v=(_&-8)+m|0,g=_>>>3;do if(_>>>0<256)if(p=h[E+8>>2]|0,m=h[E+12>>2]|0,(m|0)==(p|0)){h[6921]=h[6921]&~(1<<g);break}else{h[p+12>>2]=m,h[m+8>>2]=p;break}else{x=h[E+24>>2]|0,m=h[E+12>>2]|0;do if((m|0)==(E|0)){if(p=E+16|0,g=p+4|0,m=h[g>>2]|0,m)p=g;else if(m=h[p>>2]|0,!m){g=0;break}for(;;)if(_=m+20|0,g=h[_>>2]|0,g)m=g,p=_;else if(_=m+16|0,g=h[_>>2]|0,g)m=g,p=_;else break;h[p>>2]=0,g=m}else g=h[E+8>>2]|0,h[g+12>>2]=m,h[m+8>>2]=g,g=m;while(!1);if(x|0){if(m=h[E+28>>2]|0,p=27988+(m<<2)|0,(h[p>>2]|0)==(E|0)){if(h[p>>2]=g,!g){h[6922]=h[6922]&~(1<<m);break}}else if(_=x+16|0,h[((h[_>>2]|0)==(E|0)?_:x+20|0)>>2]=g,!g)break;h[g+24>>2]=x,m=E+16|0,p=h[m>>2]|0,p|0&&(h[g+16>>2]=p,h[p+24>>2]=g),m=h[m+4>>2]|0,m|0&&(h[g+20>>2]=m,h[m+24>>2]=g)}}while(!1);if(h[b+4>>2]=v|1,h[b+v>>2]=v,(b|0)==(h[6926]|0)){h[6923]=v;return}}if(m=v>>>3,v>>>0<256){g=27724+(m<<1<<2)|0,p=h[6921]|0,m=1<<m,p&m?(p=g+8|0,m=h[p>>2]|0):(h[6921]=p|m,m=g,p=g+8|0),h[p>>2]=b,h[m+12>>2]=b,h[b+8>>2]=m,h[b+12>>2]=g;return}if(m=v>>>8,m?v>>>0>16777215?_=31:(x=(m+1048320|0)>>>16&8,E=m<<x,g=(E+520192|0)>>>16&4,E=E<<g,_=(E+245760|0)>>>16&2,_=14-(g|x|_)+(E<<_>>>15)|0,_=v>>>(_+7|0)&1|_<<1):_=0,m=27988+(_<<2)|0,h[b+28>>2]=_,h[b+20>>2]=0,h[b+16>>2]=0,p=h[6922]|0,g=1<<_,!(p&g)){h[6922]=p|g,h[m>>2]=b,h[b+24>>2]=m,h[b+12>>2]=b,h[b+8>>2]=b;return}m=h[m>>2]|0;e:do if((h[m+4>>2]&-8|0)!=(v|0)){for(_=v<<((_|0)==31?0:25-(_>>>1)|0);g=m+16+(_>>>31<<2)|0,p=h[g>>2]|0,!!p;)if((h[p+4>>2]&-8|0)==(v|0)){m=p;break e}else _=_<<1,m=p;h[g>>2]=b,h[b+24>>2]=m,h[b+12>>2]=b,h[b+8>>2]=b;return}while(!1);x=m+8|0,E=h[x>>2]|0,h[E+12>>2]=b,h[x>>2]=b,h[b+8>>2]=E,h[b+12>>2]=m,h[b+24>>2]=0}function At(p,m,g,_){return p=p|0,m=m|0,g=g|0,_=_|0,g=p+g>>>0,On(m+_+(g>>>0<p>>>0|0)>>>0|0),g|0|0}function eo(p,m,g,_){return p=p|0,m=m|0,g=g|0,_=_|0,_=m-_-(g>>>0>p>>>0|0)>>>0,On(_|0),p-g>>>0|0|0}function dq(p){return p=p|0,(p?31-(Vf(p^p-1)|0)|0:32)|0}function gL(p,m,g,_,v){p=p|0,m=m|0,g=g|0,_=_|0,v=v|0;var x=0,b=0,E=0,M=0,N=0,O=0,q=0,j=0,X=0,K=0;if(O=p,M=m,N=M,b=g,j=_,E=j,!N)return x=(v|0)!=0,E?x?(h[v>>2]=p|0,h[v+4>>2]=m&0,j=0,v=0,On(j|0),v|0):(j=0,v=0,On(j|0),v|0):(x&&(h[v>>2]=(O>>>0)%(b>>>0),h[v+4>>2]=0),j=0,v=(O>>>0)/(b>>>0)>>>0,On(j|0),v|0);x=(E|0)==0;do if(b){if(!x){if(x=(Vf(E|0)|0)-(Vf(N|0)|0)|0,x>>>0<=31){q=x+1|0,E=31-x|0,m=x-31>>31,b=q,p=O>>>(q>>>0)&m|N<<E,m=N>>>(q>>>0)&m,x=0,E=O<<E;break}return v?(h[v>>2]=p|0,h[v+4>>2]=M|m&0,j=0,v=0,On(j|0),v|0):(j=0,v=0,On(j|0),v|0)}if(x=b-1|0,x&b|0){E=(Vf(b|0)|0)+33-(Vf(N|0)|0)|0,K=64-E|0,q=32-E|0,M=q>>31,X=E-32|0,m=X>>31,b=E,p=q-1>>31&N>>>(X>>>0)|(N<<q|O>>>(E>>>0))&m,m=m&N>>>(E>>>0),x=O<<K&M,E=(N<<K|O>>>(X>>>0))&M|O<<q&E-33>>31;break}return v|0&&(h[v>>2]=x&O,h[v+4>>2]=0),(b|0)==1?(X=M|m&0,K=p|0|0,On(X|0),K|0):(K=dq(b|0)|0,X=N>>>(K>>>0)|0,K=N<<32-K|O>>>(K>>>0)|0,On(X|0),K|0)}else{if(x)return v|0&&(h[v>>2]=(N>>>0)%(b>>>0),h[v+4>>2]=0),X=0,K=(N>>>0)/(b>>>0)>>>0,On(X|0),K|0;if(!O)return v|0&&(h[v>>2]=0,h[v+4>>2]=(N>>>0)%(E>>>0)),X=0,K=(N>>>0)/(E>>>0)>>>0,On(X|0),K|0;if(x=E-1|0,!(x&E))return v|0&&(h[v>>2]=p|0,h[v+4>>2]=x&N|m&0),X=0,K=N>>>((dq(E|0)|0)>>>0),On(X|0),K|0;if(x=(Vf(E|0)|0)-(Vf(N|0)|0)|0,x>>>0<=30){m=x+1|0,E=31-x|0,b=m,p=N<<E|O>>>(m>>>0),m=N>>>(m>>>0),x=0,E=O<<E;break}return v?(h[v>>2]=p|0,h[v+4>>2]=M|m&0,X=0,K=0,On(X|0),K|0):(X=0,K=0,On(X|0),K|0)}while(!1);if(!b)N=E,M=0,E=0;else{q=g|0|0,O=j|_&0,N=At(q|0,O|0,-1,-1)|0,g=ee()|0,M=E,E=0;do _=M,M=x>>>31|M<<1,x=E|x<<1,_=p<<1|_>>>31|0,j=p>>>31|m<<1|0,eo(N|0,g|0,_|0,j|0)|0,K=ee()|0,X=K>>31|((K|0)<0?-1:0)<<1,E=X&1,p=eo(_|0,j|0,X&q|0,(((K|0)<0?-1:0)>>31|((K|0)<0?-1:0)<<1)&O|0)|0,m=ee()|0,b=b-1|0;while((b|0)!=0);N=M,M=0}return b=0,v|0&&(h[v>>2]=p,h[v+4>>2]=m),X=(x|0)>>>31|(N|b)<<1|(b<<1|x>>>31)&0|M,K=(x<<1|0)&-2|E,On(X|0),K|0}function ip(p,m,g,_){p=p|0,m=m|0,g=g|0,_=_|0;var v=0,x=0,b=0,E=0,M=0,N=0;return N=m>>31|((m|0)<0?-1:0)<<1,M=((m|0)<0?-1:0)>>31|((m|0)<0?-1:0)<<1,x=_>>31|((_|0)<0?-1:0)<<1,v=((_|0)<0?-1:0)>>31|((_|0)<0?-1:0)<<1,E=eo(N^p|0,M^m|0,N|0,M|0)|0,b=ee()|0,p=x^N,m=v^M,eo((gL(E,b,eo(x^g|0,v^_|0,x|0,v|0)|0,ee()|0,0)|0)^p|0,(ee()|0)^m|0,p|0,m|0)|0}function Lue(p,m){p=p|0,m=m|0;var g=0,_=0,v=0,x=0;return x=p&65535,v=m&65535,g=ol(v,x)|0,_=p>>>16,p=(g>>>16)+(ol(v,_)|0)|0,v=m>>>16,m=ol(v,x)|0,On((p>>>16)+(ol(v,_)|0)+(((p&65535)+m|0)>>>16)|0),p+m<<16|g&65535|0|0}function br(p,m,g,_){p=p|0,m=m|0,g=g|0,_=_|0;var v=0,x=0;return v=p,x=g,g=Lue(v,x)|0,p=ee()|0,On((ol(m,x)|0)+(ol(_,v)|0)+p|p&0|0),g|0|0|0}function rp(p,m,g,_){p=p|0,m=m|0,g=g|0,_=_|0;var v=0,x=0,b=0,E=0,M=0,N=0;return v=Q,Q=Q+16|0,E=v|0,b=m>>31|((m|0)<0?-1:0)<<1,x=((m|0)<0?-1:0)>>31|((m|0)<0?-1:0)<<1,N=_>>31|((_|0)<0?-1:0)<<1,M=((_|0)<0?-1:0)>>31|((_|0)<0?-1:0)<<1,p=eo(b^p|0,x^m|0,b|0,x|0)|0,m=ee()|0,gL(p,m,eo(N^g|0,M^_|0,N|0,M|0)|0,ee()|0,E)|0,_=eo(h[E>>2]^b|0,h[E+4>>2]^x|0,b|0,x|0)|0,g=ee()|0,Q=v,On(g|0),_|0}function Gf(p,m,g,_){p=p|0,m=m|0,g=g|0,_=_|0;var v=0,x=0;return x=Q,Q=Q+16|0,v=x|0,gL(p,m,g,_,v)|0,Q=x,On(h[v+4>>2]|0),h[v>>2]|0|0}function pq(p,m,g){return p=p|0,m=m|0,g=g|0,(g|0)<32?(On(m>>g|0),p>>>g|(m&(1<<g)-1)<<32-g):(On(((m|0)<0?-1:0)|0),m>>g-32|0)}function tt(p,m,g){return p=p|0,m=m|0,g=g|0,(g|0)<32?(On(m>>>g|0),p>>>g|(m&(1<<g)-1)<<32-g):(On(0),m>>>g-32|0)}function ft(p,m,g){return p=p|0,m=m|0,g=g|0,(g|0)<32?(On(m<<g|(p&(1<<g)-1<<32-g)>>>32-g|0),p<<g):(On(p<<g-32|0),0)}function vL(p,m,g){return p=p|0,m=m|0,g=g|0,m=Vf(m)|0,(m|0)==32&&(m=m+(Vf(p)|0)|0),On(0),m|0}function mq(p,m){return p=+p,m=+m,p!=p?+m:m!=m?+p:+Qle(+p,+m)}function lT(p,m){return p=+p,m=+m,p!=p?+m:m!=m?+p:+$P(+p,+m)}function cT(p){return p=+p,p>=0?+fo(p+.5):+m1(p-.5)}function cu(p,m,g){p=p|0,m=m|0,g=g|0;var _=0,v=0,x=0;if((g|0)>=8192)return tce(p|0,m|0,g|0)|0,p|0;if(x=p|0,v=p+g|0,(p&3)==(m&3)){for(;p&3;){if(!g)return x|0;He[p>>0]=He[m>>0]|0,p=p+1|0,m=m+1|0,g=g-1|0}for(g=v&-4|0,_=g-64|0;(p|0)<=(_|0);)h[p>>2]=h[m>>2],h[p+4>>2]=h[m+4>>2],h[p+8>>2]=h[m+8>>2],h[p+12>>2]=h[m+12>>2],h[p+16>>2]=h[m+16>>2],h[p+20>>2]=h[m+20>>2],h[p+24>>2]=h[m+24>>2],h[p+28>>2]=h[m+28>>2],h[p+32>>2]=h[m+32>>2],h[p+36>>2]=h[m+36>>2],h[p+40>>2]=h[m+40>>2],h[p+44>>2]=h[m+44>>2],h[p+48>>2]=h[m+48>>2],h[p+52>>2]=h[m+52>>2],h[p+56>>2]=h[m+56>>2],h[p+60>>2]=h[m+60>>2],p=p+64|0,m=m+64|0;for(;(p|0)<(g|0);)h[p>>2]=h[m>>2],p=p+4|0,m=m+4|0}else for(g=v-4|0;(p|0)<(g|0);)He[p>>0]=He[m>>0]|0,He[p+1>>0]=He[m+1>>0]|0,He[p+2>>0]=He[m+2>>0]|0,He[p+3>>0]=He[m+3>>0]|0,p=p+4|0,m=m+4|0;for(;(p|0)<(v|0);)He[p>>0]=He[m>>0]|0,p=p+1|0,m=m+1|0;return x|0}function _L(p,m,g){p=p|0,m=m|0,g=g|0;var _=0;if((m|0)<(p|0)&(p|0)<(m+g|0)){for(_=p,m=m+g|0,p=p+g|0;(g|0)>0;)p=p-1|0,m=m-1|0,g=g-1|0,He[p>>0]=He[m>>0]|0;p=_}else cu(p,m,g)|0;return p|0}function sp(p,m,g){p=p|0,m=m|0,g=g|0;var _=0,v=0,x=0,b=0;if(x=p+g|0,m=m&255,(g|0)>=67){for(;p&3;)He[p>>0]=m,p=p+1|0;for(_=x&-4|0,b=m|m<<8|m<<16|m<<24,v=_-64|0;(p|0)<=(v|0);)h[p>>2]=b,h[p+4>>2]=b,h[p+8>>2]=b,h[p+12>>2]=b,h[p+16>>2]=b,h[p+20>>2]=b,h[p+24>>2]=b,h[p+28>>2]=b,h[p+32>>2]=b,h[p+36>>2]=b,h[p+40>>2]=b,h[p+44>>2]=b,h[p+48>>2]=b,h[p+52>>2]=b,h[p+56>>2]=b,h[p+60>>2]=b,p=p+64|0;for(;(p|0)<(_|0);)h[p>>2]=b,p=p+4|0}for(;(p|0)<(x|0);)He[p>>0]=m,p=p+1|0;return x-g|0}function Aq(p){return p=+p,p>=0?+fo(p+.5):+m1(p-.5)}function op(p){p=p|0;var m=0,g=0,_=0;return _=ece()|0,g=h[sl>>2]|0,m=g+p|0,(p|0)>0&(m|0)<(g|0)|(m|0)<0?(ice(m|0)|0,PG(12),-1):(m|0)>(_|0)&&!(nce(m|0)|0)?(PG(12),-1):(h[sl>>2]=m,g|0)}function Due(p,m,g){return p=p|0,m=m|0,g=g|0,ap[p&3](m|0,g|0)|0}function Nue(p,m){return p=p|0,m=m|0,Jle(0),0}var ap=[Nue,Ice,Pce,Lce];return{___divdi3:ip,___muldi3:br,___remdi3:rp,___uremdi3:Gf,_areNeighborCells:Dce,_bitshift64Ashr:pq,_bitshift64Lshr:tt,_bitshift64Shl:ft,_calloc:Ta,_cellAreaKm2:Ace,_cellAreaM2:gce,_cellAreaRads2:mce,_cellToBoundary:Bm,_cellToCenterChild:YG,_cellToChildPos:Jce,_cellToChildren:Hce,_cellToChildrenSize:zx,_cellToLatLng:v1,_cellToLocalIj:hue,_cellToParent:rL,_cellToVertex:vc,_cellToVertexes:Cue,_cellsToDirectedEdge:Nce,_cellsToLinkedMultiPolygon:pce,_childPosToCell:eue,_compactCells:Wce,_constructCell:Gce,_destroyLinkedMultiPolygon:cue,_directedEdgeToBoundary:Ux,_directedEdgeToCells:Oce,_edgeLengthKm:aue,_edgeLengthM:lue,_edgeLengthRads:oue,_emscripten_replace_memory:rce,_free:_t,_getBaseCellNumber:XG,_getDirectedEdgeDestination:Bce,_getDirectedEdgeOrigin:Fce,_getHexagonAreaAvgKm2:QG,_getHexagonAreaAvgM2:iue,_getHexagonEdgeLengthAvgKm:rue,_getHexagonEdgeLengthAvgM:sue,_getIcosahedronFaces:ZG,_getIndexDigit:Vce,_getNumCells:tT,_getPentagons:cL,_getRes0Cells:bce,_getResolution:nL,_greatCircleDistanceKm:Gx,_greatCircleDistanceM:nue,_greatCircleDistanceRads:tue,_gridDisk:LG,_gridDiskDistances:DG,_gridDistance:fL,_gridPathCells:pue,_gridPathCellsSize:due,_gridRing:uce,_gridRingUnsafe:FG,_i64Add:At,_i64Subtract:eo,_isPentagon:Zi,_isResClassIII:$ce,_isValidCell:eT,_isValidDirectedEdge:qG,_isValidIndex:qce,_isValidVertex:aq,_latLngToCell:aL,_llvm_ctlz_i64:vL,_llvm_maxnum_f64:mq,_llvm_minnum_f64:lT,_llvm_round_f64:cT,_localIjToCell:fue,_malloc:yr,_maxFaceCount:Kce,_maxGridDiskSize:cce,_maxPolygonToCellsSize:fce,_maxPolygonToCellsSizeExperimental:gue,_memcpy:cu,_memmove:_L,_memset:sp,_originToDirectedEdges:JP,_pentagonCount:Qce,_polygonToCells:dce,_polygonToCellsExperimental:Aue,_readInt64AsDoubleFromPointer:Tue,_res0CellCount:yce,_reverseDirectedEdge:HG,_round:Aq,_sbrk:op,_sizeOfCellBoundary:xue,_sizeOfCoordIJ:Sue,_sizeOfGeoLoop:yue,_sizeOfGeoPolygon:bue,_sizeOfH3Index:vue,_sizeOfLatLng:_ue,_sizeOfLinkedGeoPolygon:wue,_uncompactCells:jce,_uncompactCellsSize:Xce,_vertexToLatLng:Rue,dynCall_iii:Due,establishStackSpace:lce,stackAlloc:sce,stackRestore:ace,stackSave:oce}})(Bt,ut,W),Yt=e.___divdi3=Ce.___divdi3,nr=e.___muldi3=Ce.___muldi3,Fn=e.___remdi3=Ce.___remdi3,is=e.___uremdi3=Ce.___uremdi3,Pr=e._areNeighborCells=Ce._areNeighborCells,Nl=e._bitshift64Ashr=Ce._bitshift64Ashr,wa=e._bitshift64Lshr=Ce._bitshift64Lshr,Fl=e._bitshift64Shl=Ce._bitshift64Shl,il=e._calloc=Ce._calloc,_r=e._cellAreaKm2=Ce._cellAreaKm2,Ks=e._cellAreaM2=Ce._cellAreaM2,Bl=e._cellAreaRads2=Ce._cellAreaRads2,nh=e._cellToBoundary=Ce._cellToBoundary,YS=e._cellToCenterChild=Ce._cellToCenterChild,zP=e._cellToChildPos=Ce._cellToChildPos,VP=e._cellToChildren=Ce._cellToChildren,Fx=e._cellToChildrenSize=Ce._cellToChildrenSize,GP=e._cellToLatLng=Ce._cellToLatLng,Bx=e._cellToLocalIj=Ce._cellToLocalIj,qP=e._cellToParent=Ce._cellToParent,HP=e._cellToVertex=Ce._cellToVertex,bG=e._cellToVertexes=Ce._cellToVertexes,wG=e._cellsToDirectedEdge=Ce._cellsToDirectedEdge,SG=e._cellsToLinkedMultiPolygon=Ce._cellsToLinkedMultiPolygon,TG=e._childPosToCell=Ce._childPosToCell,ne=e._compactCells=Ce._compactCells,Se=e._constructCell=Ce._constructCell,ke=e._destroyLinkedMultiPolygon=Ce._destroyLinkedMultiPolygon,De=e._directedEdgeToBoundary=Ce._directedEdgeToBoundary,Ne=e._directedEdgeToCells=Ce._directedEdgeToCells,qt=e._edgeLengthKm=Ce._edgeLengthKm,Qt=e._edgeLengthM=Ce._edgeLengthM,Vt=e._edgeLengthRads=Ce._edgeLengthRads,on=e._emscripten_replace_memory=Ce._emscripten_replace_memory,pn=e._free=Ce._free,Wn=e._getBaseCellNumber=Ce._getBaseCellNumber,Jn=e._getDirectedEdgeDestination=Ce._getDirectedEdgeDestination,gn=e._getDirectedEdgeOrigin=Ce._getDirectedEdgeOrigin,Yi=e._getHexagonAreaAvgKm2=Ce._getHexagonAreaAvgKm2,rs=e._getHexagonAreaAvgM2=Ce._getHexagonAreaAvgM2,qr=e._getHexagonEdgeLengthAvgKm=Ce._getHexagonEdgeLengthAvgKm,ir=e._getHexagonEdgeLengthAvgM=Ce._getHexagonEdgeLengthAvgM,Co=e._getIcosahedronFaces=Ce._getIcosahedronFaces,Zt=e._getIndexDigit=Ce._getIndexDigit,rl=e._getNumCells=Ce._getNumCells,yi=e._getPentagons=Ce._getPentagons,Ol=e._getRes0Cells=Ce._getRes0Cells,lu=e._getResolution=Ce._getResolution,Uf=e._greatCircleDistanceKm=Ce._greatCircleDistanceKm,Lm=e._greatCircleDistanceM=Ce._greatCircleDistanceM,rr=e._greatCircleDistanceRads=Ce._greatCircleDistanceRads,ss=e._gridDisk=Ce._gridDisk,kf=e._gridDiskDistances=Ce._gridDiskDistances,pr=e._gridDistance=Ce._gridDistance,zf=e._gridPathCells=Ce._gridPathCells,Dm=e._gridPathCellsSize=Ce._gridPathCellsSize,WP=e._gridRing=Ce._gridRing,L6e=e._gridRingUnsafe=Ce._gridRingUnsafe,D6e=e._i64Add=Ce._i64Add,N6e=e._i64Subtract=Ce._i64Subtract,F6e=e._isPentagon=Ce._isPentagon,B6e=e._isResClassIII=Ce._isResClassIII,O6e=e._isValidCell=Ce._isValidCell,U6e=e._isValidDirectedEdge=Ce._isValidDirectedEdge,k6e=e._isValidIndex=Ce._isValidIndex,z6e=e._isValidVertex=Ce._isValidVertex,V6e=e._latLngToCell=Ce._latLngToCell,G6e=e._llvm_ctlz_i64=Ce._llvm_ctlz_i64,q6e=e._llvm_maxnum_f64=Ce._llvm_maxnum_f64,H6e=e._llvm_minnum_f64=Ce._llvm_minnum_f64,W6e=e._llvm_round_f64=Ce._llvm_round_f64,j6e=e._localIjToCell=Ce._localIjToCell,X6e=e._malloc=Ce._malloc,$6e=e._maxFaceCount=Ce._maxFaceCount,Y6e=e._maxGridDiskSize=Ce._maxGridDiskSize,Z6e=e._maxPolygonToCellsSize=Ce._maxPolygonToCellsSize,K6e=e._maxPolygonToCellsSizeExperimental=Ce._maxPolygonToCellsSizeExperimental,Q6e=e._memcpy=Ce._memcpy,J6e=e._memmove=Ce._memmove,e8e=e._memset=Ce._memset,t8e=e._originToDirectedEdges=Ce._originToDirectedEdges,n8e=e._pentagonCount=Ce._pentagonCount,i8e=e._polygonToCells=Ce._polygonToCells,r8e=e._polygonToCellsExperimental=Ce._polygonToCellsExperimental,s8e=e._readInt64AsDoubleFromPointer=Ce._readInt64AsDoubleFromPointer,o8e=e._res0CellCount=Ce._res0CellCount,a8e=e._reverseDirectedEdge=Ce._reverseDirectedEdge,l8e=e._round=Ce._round,c8e=e._sbrk=Ce._sbrk,u8e=e._sizeOfCellBoundary=Ce._sizeOfCellBoundary,h8e=e._sizeOfCoordIJ=Ce._sizeOfCoordIJ,f8e=e._sizeOfGeoLoop=Ce._sizeOfGeoLoop,d8e=e._sizeOfGeoPolygon=Ce._sizeOfGeoPolygon,p8e=e._sizeOfH3Index=Ce._sizeOfH3Index,m8e=e._sizeOfLatLng=Ce._sizeOfLatLng,A8e=e._sizeOfLinkedGeoPolygon=Ce._sizeOfLinkedGeoPolygon,g8e=e._uncompactCells=Ce._uncompactCells,v8e=e._uncompactCellsSize=Ce._uncompactCellsSize,_8e=e._vertexToLatLng=Ce._vertexToLatLng,x8e=e.establishStackSpace=Ce.establishStackSpace,EG=e.stackAlloc=Ce.stackAlloc,Yle=e.stackRestore=Ce.stackRestore,Zle=e.stackSave=Ce.stackSave,y8e=e.dynCall_iii=Ce.dynCall_iii;if(e.asm=Ce,e.cwrap=I,e.setValue=y,e.getValue=w,le){Te(le)||(le=o(le));{vi("memory initializer");var jP=function(Le){Le.byteLength&&(Le=new Uint8Array(Le)),H.set(Le,A),e.memoryInitializerRequest&&delete e.memoryInitializerRequest.response,zn("memory initializer")},MG=function(){a(le,jP,function(){throw"could not load memory initializer "+le})},CG=St(le);if(CG)jP(CG.buffer);else if(e.memoryInitializerRequest){var RG=function(){var Le=e.memoryInitializerRequest,it=Le.response;if(Le.status!==200&&Le.status!==0){var Dt=St(e.memoryInitializerRequestURL);if(Dt)it=Dt.buffer;else{console.warn("a problem seems to have happened with Module.memoryInitializerRequest, status: "+Le.status+", retrying "+le),MG();return}}jP(it)};e.memoryInitializerRequest.response?setTimeout(RG,0):e.memoryInitializerRequest.addEventListener("load",RG)}else MG()}}var ZS;_e=function Le(){ZS||XP(),ZS||(_e=Le)};function XP(Le){if(Le=Le||r,nn>0||(It(),nn>0))return;function it(){ZS||(ZS=!0,!S&&(dn(),Gt(),e.onRuntimeInitialized&&e.onRuntimeInitialized(),$e()))}e.setStatus?(e.setStatus("Running..."),setTimeout(function(){setTimeout(function(){e.setStatus("")},1),it()},1)):it()}e.run=XP;function Nm(Le){throw e.onAbort&&e.onAbort(Le),Le+="",l(Le),c(Le),S=!0,"abort("+Le+"). Build with -s ASSERTIONS=1 for more info."}if(e.abort=Nm,e.preInit)for(typeof e.preInit=="function"&&(e.preInit=[e.preInit]);e.preInit.length>0;)e.preInit.pop()();return XP(),i})(typeof Ai=="object"?Ai:{}),En="number",Sn=En,L_=En,Cn=En,Rn=En,wo=En,jt=En,aSe=[["sizeOfH3Index",En],["sizeOfLatLng",En],["sizeOfCellBoundary",En],["sizeOfGeoLoop",En],["sizeOfGeoPolygon",En],["sizeOfLinkedGeoPolygon",En],["sizeOfCoordIJ",En],["readInt64AsDoubleFromPointer",En],["isValidCell",L_,[Cn,Rn]],["isValidIndex",L_,[Cn,Rn]],["latLngToCell",Sn,[En,En,wo,jt]],["cellToLatLng",Sn,[Cn,Rn,jt]],["cellToBoundary",Sn,[Cn,Rn,jt]],["maxGridDiskSize",Sn,[En,jt]],["gridDisk",Sn,[Cn,Rn,En,jt]],["gridDiskDistances",Sn,[Cn,Rn,En,jt,jt]],["gridRing",Sn,[Cn,Rn,En,jt]],["gridRingUnsafe",Sn,[Cn,Rn,En,jt]],["maxPolygonToCellsSize",Sn,[jt,wo,En,jt]],["polygonToCells",Sn,[jt,wo,En,jt]],["maxPolygonToCellsSizeExperimental",Sn,[jt,wo,En,jt]],["polygonToCellsExperimental",Sn,[jt,wo,En,En,En,jt]],["cellsToLinkedMultiPolygon",Sn,[jt,En,jt]],["destroyLinkedMultiPolygon",null,[jt]],["compactCells",Sn,[jt,jt,En,En]],["uncompactCells",Sn,[jt,En,En,jt,En,wo]],["uncompactCellsSize",Sn,[jt,En,En,wo,jt]],["isPentagon",L_,[Cn,Rn]],["isResClassIII",L_,[Cn,Rn]],["getBaseCellNumber",En,[Cn,Rn]],["getResolution",En,[Cn,Rn]],["getIndexDigit",En,[Cn,Rn,En]],["constructCell",Sn,[En,En,jt,jt]],["maxFaceCount",Sn,[Cn,Rn,jt]],["getIcosahedronFaces",Sn,[Cn,Rn,jt]],["cellToParent",Sn,[Cn,Rn,wo,jt]],["cellToChildren",Sn,[Cn,Rn,wo,jt]],["cellToCenterChild",Sn,[Cn,Rn,wo,jt]],["cellToChildrenSize",Sn,[Cn,Rn,wo,jt]],["cellToChildPos",Sn,[Cn,Rn,wo,jt]],["childPosToCell",Sn,[En,En,Cn,Rn,wo,jt]],["areNeighborCells",Sn,[Cn,Rn,Cn,Rn,jt]],["cellsToDirectedEdge",Sn,[Cn,Rn,Cn,Rn,jt]],["getDirectedEdgeOrigin",Sn,[Cn,Rn,jt]],["getDirectedEdgeDestination",Sn,[Cn,Rn,jt]],["isValidDirectedEdge",L_,[Cn,Rn]],["directedEdgeToCells",Sn,[Cn,Rn,jt]],["originToDirectedEdges",Sn,[Cn,Rn,jt]],["directedEdgeToBoundary",Sn,[Cn,Rn,jt]],["reverseDirectedEdge",Sn,[Cn,Rn,jt]],["gridDistance",Sn,[Cn,Rn,Cn,Rn,jt]],["gridPathCells",Sn,[Cn,Rn,Cn,Rn,jt]],["gridPathCellsSize",Sn,[Cn,Rn,Cn,Rn,jt]],["cellToLocalIj",Sn,[Cn,Rn,Cn,Rn,En,jt]],["localIjToCell",Sn,[Cn,Rn,jt,En,jt]],["getHexagonAreaAvgM2",Sn,[wo,jt]],["getHexagonAreaAvgKm2",Sn,[wo,jt]],["getHexagonEdgeLengthAvgM",Sn,[wo,jt]],["getHexagonEdgeLengthAvgKm",Sn,[wo,jt]],["greatCircleDistanceM",En,[jt,jt]],["greatCircleDistanceKm",En,[jt,jt]],["greatCircleDistanceRads",En,[jt,jt]],["cellAreaM2",Sn,[Cn,Rn,jt]],["cellAreaKm2",Sn,[Cn,Rn,jt]],["cellAreaRads2",Sn,[Cn,Rn,jt]],["edgeLengthM",Sn,[Cn,Rn,jt]],["edgeLengthKm",Sn,[Cn,Rn,jt]],["edgeLengthRads",Sn,[Cn,Rn,jt]],["getNumCells",Sn,[wo,jt]],["getRes0Cells",Sn,[jt]],["res0CellCount",En],["getPentagons",Sn,[En,jt]],["pentagonCount",En],["cellToVertex",Sn,[Cn,Rn,En,jt]],["cellToVertexes",Sn,[Cn,Rn,jt]],["vertexToLatLng",Sn,[Cn,Rn,jt]],["isValidVertex",L_,[Cn,Rn]]],lSe=0,cSe=1,uSe=2,hSe=3,KJ=4,fSe=5,dSe=6,pSe=7,mSe=8,ASe=9,gSe=10,vSe=11,_Se=12,xSe=13,ySe=14,bSe=15,wSe=16,SSe=17,TSe=18,ESe=19,Is={};Is[lSe]="Success";Is[cSe]="The operation failed but a more specific error is not available";Is[uSe]="Argument was outside of acceptable range";Is[hSe]="Latitude or longitude arguments were outside of acceptable range";Is[KJ]="Resolution argument was outside of acceptable range";Is[fSe]="Cell argument was not valid";Is[dSe]="Directed edge argument was not valid";Is[pSe]="Undirected edge argument was not valid";Is[mSe]="Vertex argument was not valid";Is[ASe]="Pentagon distortion was encountered";Is[gSe]="Duplicate input";Is[vSe]="Cell arguments were not neighbors";Is[_Se]="Cell arguments had incompatible resolutions";Is[xSe]="Memory allocation failed";Is[ySe]="Bounds of provided memory were insufficient";Is[bSe]="Mode or flags argument was not valid";Is[wSe]="Index argument was not valid";Is[SSe]="Base cell number was outside of acceptable range";Is[TSe]="Child indexing digits invalid";Is[ESe]="Child indexing digits refer to a deleted subsequence";var MSe=1e3,QJ=1001,JJ=1002,iR={};iR[MSe]="Unknown unit";iR[QJ]="Array length out of bounds";iR[JJ]="Got unexpected null value for H3 index";var CSe="Unknown error";function eee(i,e,t){var n=t&&"value"in t,r=new Error((i[e]||CSe)+" (code: "+e+(n?", value: "+t.value:"")+")");return r.code=e,r}function tee(i,e){var t=arguments.length===2?{value:e}:{};return eee(Is,i,t)}function nee(i,e){var t=arguments.length===2?{value:e}:{};return eee(iR,i,t)}function Cw(i){if(i!==0)throw tee(i)}var Cl={};aSe.forEach(function(e){Cl[e[0]]=Ai.cwrap.apply(Ai,e)});var D_=16;var Rw=4;var N_=8,RSe=8,tR=Cl.sizeOfH3Index(),fO=Cl.sizeOfLatLng(),ISe=Cl.sizeOfCellBoundary(),PSe=Cl.sizeOfGeoPolygon(),Mw=Cl.sizeOfGeoLoop(),xat=Cl.sizeOfLinkedGeoPolygon(),yat=Cl.sizeOfCoordIJ();function LSe(i){if(typeof i!="number"||i<0||i>15||Math.floor(i)!==i)throw tee(KJ,i);return i}function DSe(i){if(!i)throw nee(JJ);return i}var NSe=Math.pow(2,32)-1,bat=Math.pow(2,31)-1;function FSe(i){if(i>NSe)throw nee(QJ,i);return i}var BSe=/[^0-9a-fA-F]/;function iee(i){if(Array.isArray(i)&&i.length===2&&Number.isInteger(i[0])&&Number.isInteger(i[1]))return i;if(typeof i!="string"||BSe.test(i))return[0,0];var e=parseInt(i.substring(0,i.length-8),D_),t=parseInt(i.substring(i.length-8),D_);return[t,e]}function YJ(i){if(i>=0)return i.toString(D_);i=i&2147483647;var e=ree(8,i.toString(D_)),t=(parseInt(e[0],D_)+8).toString(D_);return e=t+e.substring(1),e}function OSe(i,e){return YJ(e)+ree(8,YJ(i))}function ree(i,e){for(var t=i-e.length,n="",r=0;r<t;r++)n+="0";return n=n+e,n}var wat=Math.pow(2,32);function ZJ(i,e,t){for(var n=i.length,r=Ai._calloc(n,fO),s=t?1:0,o=t?0:1,a=0;a<n*2;a+=2)Ai.HEAPF64.set([i[a/2][s],i[a/2][o]].map(lee),r/N_+a);return Ai.HEAPU32.set([n,r],e/Rw),e}function USe(i,e){var t=i.length-1,n=Ai._calloc(PSe),r=0,s=r+Mw,o=s+Rw;ZJ(i[0],n+r,e);var a;if(t>0){a=Ai._calloc(t,Mw);for(var l=0;l<t;l++)ZJ(i[l+1],a+Mw*l,e)}return Ai.setValue(n+s,t,"i32"),Ai.setValue(n+o,a,"i32"),n}function kSe(i){var e=0,t=e+Mw,n=t+Rw,r=Rw;Ai._free(Ai.getValue(i+e+r,"i8*"));var s=Ai.getValue(i+t,"i32");if(s>0){for(var o=Ai.getValue(i+n,"i32"),a=0;a<s;a++)Ai._free(Ai.getValue(o+Mw*a+r,"i8*"));Ai._free(o)}Ai._free(i)}function see(i,e){e===void 0&&(e=0);var t=Ai.getValue(i+tR*e,"i32"),n=Ai.getValue(i+tR*e+Rw,"i32");return n?OSe(t,n):null}function zSe(i){return Cl.readInt64AsDoubleFromPointer(i)}function VSe(i,e){for(var t=[],n=0;n<e;n++){var r=see(i,n);r!==null&&t.push(r)}return t}function nR(i){return HSe(Ai.getValue(i,"double"))}function oee(i){return[nR(i),nR(i+N_)]}function GSe(i){return[nR(i+N_),nR(i)]}function qSe(i,e,t){for(var n=Ai.getValue(i,"i32"),r=i+N_,s=[],o=e?GSe:oee,a=0;a<n*2;a+=2)s.push(o(r+N_*a));return t&&s.push(s[0]),s}function aee(i,e,t){var n=Ai._malloc(fO);Ai.HEAPF64.set([i,e].map(lee),n/N_);var r=Ai._malloc(tR);try{return Cw(Cl.latLngToCell(n,t,r)),DSe(see(r))}finally{Ai._free(r),Ai._free(n)}}function dO(i){var e=Ai._malloc(fO),t=iee(i),n=t[0],r=t[1];try{return Cw(Cl.cellToLatLng(n,r,e)),oee(e)}finally{Ai._free(e)}}function pO(i,e){var t=Ai._malloc(ISe),n=iee(i),r=n[0],s=n[1];try{return Cw(Cl.cellToBoundary(r,s,t)),qSe(t,e,e)}finally{Ai._free(t)}}function mO(i,e,t){if(LSe(e),t=!!t,i.length===0||i[0].length===0)return[];var n=typeof i[0][0]=="number"?[i]:i,r=USe(n,t),s=Ai._malloc(RSe);try{Cw(Cl.maxPolygonToCellsSize(r,e,0,s));var o=FSe(zSe(s)),a=Ai._calloc(o,tR);try{return Cw(Cl.polygonToCells(r,e,0,a)),VSe(a,o)}finally{Ai._free(a)}}finally{Ai._free(s),kSe(r)}}function lee(i){return i*Math.PI/180}function HSe(i){return i*180/Math.PI}function AO(i){return i=Math.max(0,Math.min(1,i)),"rgb("+Math.max(0,Math.min(255,Math.round(34.61+i*(1172.33-i*(10793.56-i*(33300.12-i*(38394.49-i*14825.05)))))))+", "+Math.max(0,Math.min(255,Math.round(23.31+i*(557.33+i*(1225.33-i*(3574.96-i*(1073.77+i*707.56)))))))+", "+Math.max(0,Math.min(255,Math.round(27.2+i*(3211.1-i*(15327.97-i*(27814-i*(22569.18-i*6838.66)))))))+")"}var WSe=["alphaMap","alphaTest","anisotropy","anisotropyMap","anisotropyRotation","aoMap","aoMapIntensity","attenuationColor","attenuationDistance","bumpMap","clearcoat","clearcoatMap","clearcoatNormalMap","clearcoatNormalScale","clearcoatRoughness","color","dispersion","displacementMap","emissive","emissiveIntensity","emissiveMap","envMap","envMapIntensity","envMapRotation","gradientMap","ior","iridescence","iridescenceIOR","iridescenceMap","iridescenceThicknessMap","lightMap","lightMapIntensity","map","matcap","metalness","metalnessMap","normalMap","normalScale","opacity","roughness","roughnessMap","sheen","sheenColor","sheenColorMap","sheenRoughnessMap","shininess","specular","specularColor","specularColorMap","specularIntensity","specularIntensityMap","specularMap","thickness","transmission","transmissionMap"],cee=new WeakMap,uee=new WeakMap,hee=new WeakMap,tU=class{constructor(e){this.renderObjects=new WeakMap,this.hasNode=this.containsNode(e),this.hasAnimation=e.object.isSkinnedMesh===!0,this.refreshUniforms=WSe,this.renderId=0}firstInitialization(e){return this.renderObjects.has(e)===!1?(this.getRenderObjectData(e),!0):!1}needsVelocity(e){let t=e.getMRT();return t!==null&&t.has("velocity")}getRenderObjectData(e){let t=this.renderObjects.get(e);if(t===void 0){let{geometry:n,object:r}=e;if(t={geometryId:n.id,worldMatrix:r.matrixWorld.clone()},r.center&&(t.center=r.center.clone()),r.morphTargetInfluences&&(t.morphTargetInfluences=r.morphTargetInfluences.slice()),e.bundle!==null&&(t.version=e.bundle.version),e.material.transmission>0){let{width:a,height:l}=e.context;t.bufferWidth=a,t.bufferHeight=l}let{environmentIntensity:s,environmentRotation:o}=e.scene;t.environmentIntensity=s,t.environmentRotation=o.clone(),t.lights=this.getLightsData(e.lightsNode.getLights(),[]),this.renderObjects.set(e,t)}return t}getAttributesData(e){let t={};for(let n in e){let r=e[n];t[n]={id:r.isInterleavedBufferAttribute?r.data.uuid:r.id,version:r.isInterleavedBufferAttribute?r.data.version:r.version}}return t}containsNode(e){let t=e.material;for(let n in t)if(t[n]&&t[n].isNode)return!0;return!!(e.context.modelViewMatrix||e.context.modelNormalViewMatrix||e.context.getAO||e.context.getShadow)}getGeometryData(e){let t=hee.get(e);return t===void 0&&(t={_renderId:-1,_equal:!1,attributes:this.getAttributesData(e.attributes),indexId:e.index?e.index.id:null,indexVersion:e.index?e.index.version:null,drawRange:{start:e.drawRange.start,count:e.drawRange.count}},hee.set(e,t)),t}getMaterialData(e){let t=uee.get(e);if(t===void 0){t={_renderId:-1,_equal:!1};for(let n of this.refreshUniforms){let r=e[n];r!=null&&(typeof r=="object"&&r.clone!==void 0?r.isTexture===!0?t[n]={id:r.id,version:0}:t[n]=r.clone():t[n]=r)}uee.set(e,t)}return t}equals(e,t,n){let{object:r,material:s,geometry:o}=e,a=this.getRenderObjectData(e);if(a.worldMatrix.equals(r.matrixWorld)!==!0)return a.worldMatrix.copy(r.matrixWorld),!1;let l=this.getMaterialData(e.material);if(l._renderId!==n){l._renderId=n;for(let f in l){let d=l[f],A=s[f];if(f!=="_renderId"&&f!=="_equal"){if(d.equals!==void 0){if(d.equals(A)===!1)return d.copy(A),l._equal=!1,!1}else if(A.isTexture===!0){if(d.id!==A.id||d.version!==A.version)return d.id=A.id,d.version=A.version,l._equal=!1,!1}else if(d!==A)return l[f]=A,l._equal=!1,!1}}if(l.transmission>0){let{width:f,height:d}=e.context;if(a.bufferWidth!==f||a.bufferHeight!==d)return a.bufferWidth=f,a.bufferHeight=d,l._equal=!1,!1}l._equal=!0}else if(l._equal===!1)return!1;if(a.geometryId!==o.id)return a.geometryId=o.id,!1;let c=this.getGeometryData(e.geometry);if(c._renderId!==n){c._renderId=n;let f=o.attributes,d=c.attributes,A=0,y=0;for(let I in f)A++;for(let I in d){y++;let F=d[I],D=f[I];if(D===void 0)return delete d[I],c._equal=!1,!1;let L=D.isInterleavedBufferAttribute?D.data.uuid:D.id,C=D.isInterleavedBufferAttribute?D.data.version:D.version;if(F.id!==L||F.version!==C)return F.id=L,F.version=C,c._equal=!1,!1}if(y!==A)return c.attributes=this.getAttributesData(f),c._equal=!1,!1;let w=o.index,S=c.indexId,T=c.indexVersion,R=w?w.id:null,P=w?w.version:null;if(S!==R||T!==P)return c.indexId=R,c.indexVersion=P,c._equal=!1,!1;if(c.drawRange.start!==o.drawRange.start||c.drawRange.count!==o.drawRange.count)return c.drawRange.start=o.drawRange.start,c.drawRange.count=o.drawRange.count,c._equal=!1,!1;c._equal=!0}else if(c._equal===!1)return!1;if(a.morphTargetInfluences){let f=!1;for(let d=0;d<a.morphTargetInfluences.length;d++)a.morphTargetInfluences[d]!==r.morphTargetInfluences[d]&&(a.morphTargetInfluences[d]=r.morphTargetInfluences[d],f=!0);if(f)return!1}if(a.lights){for(let f=0;f<t.length;f++)if(a.lights[f].map!==t[f].map)return!1}let u=e.scene;return u.environment!==null&&s.envMap===null&&(a.environmentIntensity!==u.environmentIntensity||a.environmentRotation.equals(u.environmentRotation)===!1)?(a.environmentIntensity=u.environmentIntensity,a.environmentRotation.copy(u.environmentRotation),!1):a.center&&a.center.equals(r.center)===!1?(a.center.copy(r.center),!1):(e.bundle!==null&&(a.version=e.bundle.version),!0)}getLightsData(e,t){t.length=0;for(let n of e)n.isSpotLight===!0&&n.map!==null&&t.push({map:n.map.version});return t}getLights(e,t){let n=cee.get(e);return n===void 0&&(n={renderId:-1,lightsData:[]},cee.set(e,n)),n.renderId===t||(n.renderId=t,this.getLightsData(e.getLights(),n.lightsData)),n.lightsData}needsRefresh(e,t){if(this.hasNode||this.hasAnimation||this.firstInitialization(e)||this.needsVelocity(t.renderer))return!0;let{renderId:n}=t;if(this.renderId!==n)return this.renderId=n,!0;let r=e.object.static===!0,s=e.bundle!==null&&e.bundle.static===!0&&this.getRenderObjectData(e).version===e.bundle.version;if(r||s)return!1;let o=this.getLights(e.lightsNode,n);return this.equals(e,o,n)!==!0}},jSe=[/^StackTrace\.js$/,/^TSLCore\.js$/,/^.*Node\.js$/,/^three\.webgpu.*\.js$/];function XSe(i){let e=/(?:at\s+(.+?)\s+\()?(?:(.+?)@)?([^@\s()]+):(\d+):(\d+)/;return i.split(`4131-`).map(t=>{let n=t.match(e);if(!n)return null;let r=n[1]||n[2]||"",s=n[3].split("?")[0],o=parseInt(n[4],10),a=parseInt(n[5],10),l=s.split("/").pop();return{fn:r,file:l,line:o,column:a}}).filter(t=>t&&!jSe.some(n=>n.test(t.file)))}var es=class{constructor(e=null){this.isStackTrace=!0,this.stack=XSe(e||new Error().stack)}getLocation(){if(this.stack.length===0)return"[Unknown location]";let e=this.stack[0],t=e.fn;return`${t?`"${t}()" at `:""}"${e.file}:${e.line}"`}getError(e){if(this.stack.length===0)return e;let t=this.stack.map(n=>{let r=`${n.file}:${n.line}:${n.column}`;return n.fn?` at ${n.fn} (${r})`:` at ${r}`}).join(`4117+}`,zF=class{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(e,t){if(this.texture===null){let n=new B2(e.texture);(e.depthNear!==t.depthNear||e.depthFar!==t.depthFar)&&(this.depthNear=e.depthNear,this.depthFar=e.depthFar),this.texture=n}}getMesh(e){if(this.texture!==null&&this.mesh===null){let t=e.cameras[0].viewport,n=new ds({vertexShader:Hxe,fragmentShader:Wxe,uniforms:{depthColor:{value:this.texture},depthWidth:{value:t.z},depthHeight:{value:t.w}}});this.mesh=new Hn(new YA(20,20),n)}return this.mesh}reset(){this.texture=null,this.mesh=null}getDepthTexture(){return this.texture}},VF=class extends ca{constructor(e,t){super();let n=this,r=null,s=1,o=null,a="local-floor",l=1,c=null,u=null,f=null,d=null,A=null,y=null,w=typeof XRWebGLBinding<"u",S=new zF,T={},R=t.getContextAttributes(),I=null,P=null,F=[],D=[],L=new Oe,C=null,B=new Yr;B.viewport=new xn;let k=new Yr;k.viewport=new xn;let z=[B,k],G=new a_,W=null,Y=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(Ee){let Ve=F[Ee];return Ve===void 0&&(Ve=new r0,F[Ee]=Ve),Ve.getTargetRaySpace()},this.getControllerGrip=function(Ee){let Ve=F[Ee];return Ve===void 0&&(Ve=new r0,F[Ee]=Ve),Ve.getGripSpace()},this.getHand=function(Ee){let Ve=F[Ee];return Ve===void 0&&(Ve=new r0,F[Ee]=Ve),Ve.getHandSpace()};function H(Ee){let Ve=D.indexOf(Ee.inputSource);if(Ve===-1)return;let Ye=F[Ve];Ye!==void 0&&(Ye.update(Ee.inputSource,Ee.frame,c||o),Ye.dispatchEvent({type:Ee.type,data:Ee.inputSource}))}function $(){r.removeEventListener("select",H),r.removeEventListener("selectstart",H),r.removeEventListener("selectend",H),r.removeEventListener("squeeze",H),r.removeEventListener("squeezestart",H),r.removeEventListener("squeezeend",H),r.removeEventListener("end",$),r.removeEventListener("inputsourceschange",J);for(let Ee=0;Ee<F.length;Ee++){let Ve=D[Ee];Ve!==null&&(D[Ee]=null,F[Ee].disconnect(Ve))}W=null,Y=null,S.reset();for(let Ee in T)delete T[Ee];e.setRenderTarget(I),A=null,d=null,f=null,r=null,P=null,mt.stop(),n.isPresenting=!1,e.setPixelRatio(C),e.setSize(L.width,L.height,!1),n.dispatchEvent({type:"sessionend"})}this.setFramebufferScaleFactor=function(Ee){s=Ee,n.isPresenting===!0&&Xe("WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(Ee){a=Ee,n.isPresenting===!0&&Xe("WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return c||o},this.setReferenceSpace=function(Ee){c=Ee},this.getBaseLayer=function(){return d!==null?d:A},this.getBinding=function(){return f===null&&w&&(f=new XRWebGLBinding(r,t)),f},this.getFrame=function(){return y},this.getSession=function(){return r},this.setSession=async function(Ee){if(r=Ee,r!==null){if(I=e.getRenderTarget(),r.addEventListener("select",H),r.addEventListener("selectstart",H),r.addEventListener("selectend",H),r.addEventListener("squeeze",H),r.addEventListener("squeezestart",H),r.addEventListener("squeezeend",H),r.addEventListener("end",$),r.addEventListener("inputsourceschange",J),R.xrCompatible!==!0&&await t.makeXRCompatible(),C=e.getPixelRatio(),e.getSize(L),w&&"createProjectionLayer"in XRWebGLBinding.prototype){let Ye=null,Mt=null,Et=null;R.depth&&(Et=R.stencil?t.DEPTH24_STENCIL8:t.DEPTH_COMPONENT24,Ye=R.stencil?xo:Vs,Mt=R.stencil?ua:xi);let Pt={colorFormat:t.RGBA8,depthFormat:Et,scaleFactor:s};f=this.getBinding(),d=f.createProjectionLayer(Pt),r.updateRenderState({layers:[d]}),e.setPixelRatio(1),e.setSize(d.textureWidth,d.textureHeight,!1),P=new Oa(d.textureWidth,d.textureHeight,{format:Or,type:Ji,depthTexture:new Es(d.textureWidth,d.textureHeight,Mt,void 0,void 0,void 0,void 0,void 0,void 0,Ye),stencilBuffer:R.stencil,colorSpace:e.outputColorSpace,samples:R.antialias?4:0,resolveDepthBuffer:d.ignoreDepthValues===!1,resolveStencilBuffer:d.ignoreDepthValues===!1})}else{let Ye={antialias:R.antialias,alpha:!0,depth:R.depth,stencil:R.stencil,framebufferScaleFactor:s};A=new XRWebGLLayer(r,t,Ye),r.updateRenderState({baseLayer:A}),e.setPixelRatio(1),e.setSize(A.framebufferWidth,A.framebufferHeight,!1),P=new Oa(A.framebufferWidth,A.framebufferHeight,{format:Or,type:Ji,colorSpace:e.outputColorSpace,stencilBuffer:R.stencil,resolveDepthBuffer:A.ignoreDepthValues===!1,resolveStencilBuffer:A.ignoreDepthValues===!1})}P.isXRRenderTarget=!0,this.setFoveation(l),c=null,o=await r.requestReferenceSpace(a),mt.setContext(r),mt.start(),n.isPresenting=!0,n.dispatchEvent({type:"sessionstart"})}},this.getEnvironmentBlendMode=function(){if(r!==null)return r.environmentBlendMode},this.getDepthTexture=function(){return S.getDepthTexture()};function J(Ee){for(let Ve=0;Ve<Ee.removed.length;Ve++){let Ye=Ee.removed[Ve],Mt=D.indexOf(Ye);Mt>=0&&(D[Mt]=null,F[Mt].disconnect(Ye))}for(let Ve=0;Ve<Ee.added.length;Ve++){let Ye=Ee.added[Ve],Mt=D.indexOf(Ye);if(Mt===-1){for(let Pt=0;Pt<F.length;Pt++)if(Pt>=D.length){D.push(Ye),Mt=Pt;break}else if(D[Pt]===null){D[Pt]=Ye,Mt=Pt;break}if(Mt===-1)break}let Et=F[Mt];Et&&Et.connect(Ye)}}let te=new re,ce=new re;function he(Ee,Ve,Ye){te.setFromMatrixPosition(Ve.matrixWorld),ce.setFromMatrixPosition(Ye.matrixWorld);let Mt=te.distanceTo(ce),Et=Ve.projectionMatrix.elements,Pt=Ye.projectionMatrix.elements,dn=Et[14]/(Et[10]-1),Gt=Et[14]/(Et[10]+1),$e=(Et[9]+1)/Et[5],ot=(Et[9]-1)/Et[5],nt=(Et[8]-1)/Et[0],bt=(Pt[8]+1)/Pt[0],yt=dn*nt,hn=dn*bt,en=Mt/(-nt+bt),tn=en*-nt;if(Ve.matrixWorld.decompose(Ee.position,Ee.quaternion,Ee.scale),Ee.translateX(tn),Ee.translateZ(en),Ee.matrixWorld.compose(Ee.position,Ee.quaternion,Ee.scale),Ee.matrixWorldInverse.copy(Ee.matrixWorld).invert(),Et[10]===-1)Ee.projectionMatrix.copy(Ve.projectionMatrix),Ee.projectionMatrixInverse.copy(Ve.projectionMatrixInverse);else{let bn=dn+en,_e=Gt+en,vi=yt-tn,zn=hn+(Mt-tn),le=$e*Gt/_e*bn,Z=ot*Gt/_e*bn;Ee.projectionMatrix.makePerspective(vi,zn,le,Z,bn,_e),Ee.projectionMatrixInverse.copy(Ee.projectionMatrix).invert()}}function ve(Ee,Ve){Ve===null?Ee.matrixWorld.copy(Ee.matrix):Ee.matrixWorld.multiplyMatrices(Ve.matrixWorld,Ee.matrix),Ee.matrixWorldInverse.copy(Ee.matrixWorld).invert()}this.updateCamera=function(Ee){if(r===null)return;let Ve=Ee.near,Ye=Ee.far;S.texture!==null&&(S.depthNear>0&&(Ve=S.depthNear),S.depthFar>0&&(Ye=S.depthFar)),G.near=k.near=B.near=Ve,G.far=k.far=B.far=Ye,(W!==G.near||Y!==G.far)&&(r.updateRenderState({depthNear:G.near,depthFar:G.far}),W=G.near,Y=G.far),G.layers.mask=Ee.layers.mask|6,B.layers.mask=G.layers.mask&-5,k.layers.mask=G.layers.mask&-3;let Mt=Ee.parent,Et=G.cameras;ve(G,Mt);for(let Pt=0;Pt<Et.length;Pt++)ve(Et[Pt],Mt);Et.length===2?he(G,B,k):G.projectionMatrix.copy(B.projectionMatrix),Re(Ee,G,Mt)};function Re(Ee,Ve,Ye){Ye===null?Ee.matrix.copy(Ve.matrixWorld):(Ee.matrix.copy(Ye.matrixWorld),Ee.matrix.invert(),Ee.matrix.multiply(Ve.matrixWorld)),Ee.matrix.decompose(Ee.position,Ee.quaternion,Ee.scale),Ee.updateMatrixWorld(!0),Ee.projectionMatrix.copy(Ve.projectionMatrix),Ee.projectionMatrixInverse.copy(Ve.projectionMatrixInverse),Ee.isPerspectiveCamera&&(Ee.fov=Cd*2*Math.atan(1/Ee.projectionMatrix.elements[5]),Ee.zoom=1)}this.getCamera=function(){return G},this.getFoveation=function(){if(!(d===null&&A===null))return l},this.setFoveation=function(Ee){l=Ee,d!==null&&(d.fixedFoveation=Ee),A!==null&&A.fixedFoveation!==void 0&&(A.fixedFoveation=Ee)},this.hasDepthSensing=function(){return S.texture!==null},this.getDepthSensingMesh=function(){return S.getMesh(G)},this.getCameraTexture=function(Ee){return T[Ee]};let Qe=null;function Fe(Ee,Ve){if(u=Ve.getViewerPose(c||o),y=Ve,u!==null){let Ye=u.views;A!==null&&(e.setRenderTargetFramebuffer(P,A.framebuffer),e.setRenderTarget(P));let Mt=!1;Ye.length!==G.cameras.length&&(G.cameras.length=0,Mt=!0);for(let Gt=0;Gt<Ye.length;Gt++){let $e=Ye[Gt],ot=null;if(A!==null)ot=A.getViewport($e);else{let bt=f.getViewSubImage(d,$e);ot=bt.viewport,Gt===0&&(e.setRenderTargetTextures(P,bt.colorTexture,bt.depthStencilTexture),e.setRenderTarget(P))}let nt=z[Gt];nt===void 0&&(nt=new Yr,nt.layers.enable(Gt),nt.viewport=new xn,z[Gt]=nt),nt.matrix.fromArray($e.transform.matrix),nt.matrix.decompose(nt.position,nt.quaternion,nt.scale),nt.projectionMatrix.fromArray($e.projectionMatrix),nt.projectionMatrixInverse.copy(nt.projectionMatrix).invert(),nt.viewport.set(ot.x,ot.y,ot.width,ot.height),Gt===0&&(G.matrix.copy(nt.matrix),G.matrix.decompose(G.position,G.quaternion,G.scale)),Mt===!0&&G.cameras.push(nt)}let Et=r.enabledFeatures;if(Et&&Et.includes("depth-sensing")&&r.depthUsage=="gpu-optimized"&&w){f=n.getBinding();let Gt=f.getDepthInformation(Ye[0]);Gt&&Gt.isValid&&Gt.texture&&S.init(Gt,r.renderState)}if(Et&&Et.includes("camera-access")&&w){e.state.unbindTexture(),f=n.getBinding();for(let Gt=0;Gt<Ye.length;Gt++){let $e=Ye[Gt].camera;if($e){let ot=T[$e];ot||(ot=new B2,T[$e]=ot);let nt=f.getCameraImage($e);ot.sourceTexture=nt}}}}for(let Ye=0;Ye<F.length;Ye++){let Mt=D[Ye],Et=F[Ye];Mt!==null&&Et!==void 0&&Et.update(Mt,Ve,c||o)}Qe&&Qe(Ee,Ve),Ve.detectedPlanes&&n.dispatchEvent({type:"planesdetected",data:Ve}),y=null}let mt=new sK;mt.setAnimationLoop(Fe),this.setAnimationLoop=function(Ee){Qe=Ee},this.dispose=function(){}}},jxe=new cn,hK=new Mn;hK.set(-1,0,0,0,1,0,0,0,1);function Xxe(i,e){function t(S,T){S.matrixAutoUpdate===!0&&S.updateMatrix(),T.value.copy(S.matrix)}function n(S,T){T.color.getRGB(S.fogColor.value,_F(i)),T.isFog?(S.fogNear.value=T.near,S.fogFar.value=T.far):T.isFogExp2&&(S.fogDensity.value=T.density)}function r(S,T,R,I,P){T.isNodeMaterial?T.uniformsNeedUpdate=!1:T.isMeshBasicMaterial?s(S,T):T.isMeshLambertMaterial?(s(S,T),T.envMap&&(S.envMapIntensity.value=T.envMapIntensity)):T.isMeshToonMaterial?(s(S,T),f(S,T)):T.isMeshPhongMaterial?(s(S,T),u(S,T),T.envMap&&(S.envMapIntensity.value=T.envMapIntensity)):T.isMeshStandardMaterial?(s(S,T),d(S,T),T.isMeshPhysicalMaterial&&A(S,T,P)):T.isMeshMatcapMaterial?(s(S,T),y(S,T)):T.isMeshDepthMaterial?s(S,T):T.isMeshDistanceMaterial?(s(S,T),w(S,T)):T.isMeshNormalMaterial?s(S,T):T.isLineBasicMaterial?(o(S,T),T.isLineDashedMaterial&&a(S,T)):T.isPointsMaterial?l(S,T,R,I):T.isSpriteMaterial?c(S,T):T.isShadowMaterial?(S.color.value.copy(T.color),S.opacity.value=T.opacity):T.isShaderMaterial&&(T.uniformsNeedUpdate=!1)}function s(S,T){S.opacity.value=T.opacity,T.color&&S.diffuse.value.copy(T.color),T.emissive&&S.emissive.value.copy(T.emissive).multiplyScalar(T.emissiveIntensity),T.map&&(S.map.value=T.map,t(T.map,S.mapTransform)),T.alphaMap&&(S.alphaMap.value=T.alphaMap,t(T.alphaMap,S.alphaMapTransform)),T.bumpMap&&(S.bumpMap.value=T.bumpMap,t(T.bumpMap,S.bumpMapTransform),S.bumpScale.value=T.bumpScale,T.side===mi&&(S.bumpScale.value*=-1)),T.normalMap&&(S.normalMap.value=T.normalMap,t(T.normalMap,S.normalMapTransform),S.normalScale.value.copy(T.normalScale),T.side===mi&&S.normalScale.value.negate()),T.displacementMap&&(S.displacementMap.value=T.displacementMap,t(T.displacementMap,S.displacementMapTransform),S.displacementScale.value=T.displacementScale,S.displacementBias.value=T.displacementBias),T.emissiveMap&&(S.emissiveMap.value=T.emissiveMap,t(T.emissiveMap,S.emissiveMapTransform)),T.specularMap&&(S.specularMap.value=T.specularMap,t(T.specularMap,S.specularMapTransform)),T.alphaTest>0&&(S.alphaTest.value=T.alphaTest);let R=e.get(T),I=R.envMap,P=R.envMapRotation;I&&(S.envMap.value=I,S.envMapRotation.value.setFromMatrix4(jxe.makeRotationFromEuler(P)).transpose(),I.isCubeTexture&&I.isRenderTargetTexture===!1&&S.envMapRotation.value.premultiply(hK),S.reflectivity.value=T.reflectivity,S.ior.value=T.ior,S.refractionRatio.value=T.refractionRatio),T.lightMap&&(S.lightMap.value=T.lightMap,S.lightMapIntensity.value=T.lightMapIntensity,t(T.lightMap,S.lightMapTransform)),T.aoMap&&(S.aoMap.value=T.aoMap,S.aoMapIntensity.value=T.aoMapIntensity,t(T.aoMap,S.aoMapTransform))}function o(S,T){S.diffuse.value.copy(T.color),S.opacity.value=T.opacity,T.map&&(S.map.value=T.map,t(T.map,S.mapTransform))}function a(S,T){S.dashSize.value=T.dashSize,S.totalSize.value=T.dashSize+T.gapSize,S.scale.value=T.scale}function l(S,T,R,I){S.diffuse.value.copy(T.color),S.opacity.value=T.opacity,S.size.value=T.size*R,S.scale.value=I*.5,T.map&&(S.map.value=T.map,t(T.map,S.uvTransform)),T.alphaMap&&(S.alphaMap.value=T.alphaMap,t(T.alphaMap,S.alphaMapTransform)),T.alphaTest>0&&(S.alphaTest.value=T.alphaTest)}function c(S,T){S.diffuse.value.copy(T.color),S.opacity.value=T.opacity,S.rotation.value=T.rotation,T.map&&(S.map.value=T.map,t(T.map,S.mapTransform)),T.alphaMap&&(S.alphaMap.value=T.alphaMap,t(T.alphaMap,S.alphaMapTransform)),T.alphaTest>0&&(S.alphaTest.value=T.alphaTest)}function u(S,T){S.specular.value.copy(T.specular),S.shininess.value=Math.max(T.shininess,1e-4)}function f(S,T){T.gradientMap&&(S.gradientMap.value=T.gradientMap)}function d(S,T){S.metalness.value=T.metalness,T.metalnessMap&&(S.metalnessMap.value=T.metalnessMap,t(T.metalnessMap,S.metalnessMapTransform)),S.roughness.value=T.roughness,T.roughnessMap&&(S.roughnessMap.value=T.roughnessMap,t(T.roughnessMap,S.roughnessMapTransform)),T.envMap&&(S.envMapIntensity.value=T.envMapIntensity)}function A(S,T,R){S.ior.value=T.ior,T.sheen>0&&(S.sheenColor.value.copy(T.sheenColor).multiplyScalar(T.sheen),S.sheenRoughness.value=T.sheenRoughness,T.sheenColorMap&&(S.sheenColorMap.value=T.sheenColorMap,t(T.sheenColorMap,S.sheenColorMapTransform)),T.sheenRoughnessMap&&(S.sheenRoughnessMap.value=T.sheenRoughnessMap,t(T.sheenRoughnessMap,S.sheenRoughnessMapTransform))),T.clearcoat>0&&(S.clearcoat.value=T.clearcoat,S.clearcoatRoughness.value=T.clearcoatRoughness,T.clearcoatMap&&(S.clearcoatMap.value=T.clearcoatMap,t(T.clearcoatMap,S.clearcoatMapTransform)),T.clearcoatRoughnessMap&&(S.clearcoatRoughnessMap.value=T.clearcoatRoughnessMap,t(T.clearcoatRoughnessMap,S.clearcoatRoughnessMapTransform)),T.clearcoatNormalMap&&(S.clearcoatNormalMap.value=T.clearcoatNormalMap,t(T.clearcoatNormalMap,S.clearcoatNormalMapTransform),S.clearcoatNormalScale.value.copy(T.clearcoatNormalScale),T.side===mi&&S.clearcoatNormalScale.value.negate())),T.dispersion>0&&(S.dispersion.value=T.dispersion),T.iridescence>0&&(S.iridescence.value=T.iridescence,S.iridescenceIOR.value=T.iridescenceIOR,S.iridescenceThicknessMinimum.value=T.iridescenceThicknessRange[0],S.iridescenceThicknessMaximum.value=T.iridescenceThicknessRange[1],T.iridescenceMap&&(S.iridescenceMap.value=T.iridescenceMap,t(T.iridescenceMap,S.iridescenceMapTransform)),T.iridescenceThicknessMap&&(S.iridescenceThicknessMap.value=T.iridescenceThicknessMap,t(T.iridescenceThicknessMap,S.iridescenceThicknessMapTransform))),T.transmission>0&&(S.transmission.value=T.transmission,S.transmissionSamplerMap.value=R.texture,S.transmissionSamplerSize.value.set(R.width,R.height),T.transmissionMap&&(S.transmissionMap.value=T.transmissionMap,t(T.transmissionMap,S.transmissionMapTransform)),S.thickness.value=T.thickness,T.thicknessMap&&(S.thicknessMap.value=T.thicknessMap,t(T.thicknessMap,S.thicknessMapTransform)),S.attenuationDistance.value=T.attenuationDistance,S.attenuationColor.value.copy(T.attenuationColor)),T.anisotropy>0&&(S.anisotropyVector.value.set(T.anisotropy*Math.cos(T.anisotropyRotation),T.anisotropy*Math.sin(T.anisotropyRotation)),T.anisotropyMap&&(S.anisotropyMap.value=T.anisotropyMap,t(T.anisotropyMap,S.anisotropyMapTransform))),S.specularIntensity.value=T.specularIntensity,S.specularColor.value.copy(T.specularColor),T.specularColorMap&&(S.specularColorMap.value=T.specularColorMap,t(T.specularColorMap,S.specularColorMapTransform)),T.specularIntensityMap&&(S.specularIntensityMap.value=T.specularIntensityMap,t(T.specularIntensityMap,S.specularIntensityMapTransform))}function y(S,T){T.matcap&&(S.matcap.value=T.matcap)}function w(S,T){let R=e.get(T).light;S.referencePosition.value.setFromMatrixPosition(R.matrixWorld),S.nearDistance.value=R.shadow.camera.near,S.farDistance.value=R.shadow.camera.far}return{refreshFogUniforms:n,refreshMaterialUniforms:r}}function $xe(i,e,t,n){let r={},s={},o=[],a=i.getParameter(i.MAX_UNIFORM_BUFFER_BINDINGS);function l(P,F){let D=F.program;n.uniformBlockBinding(P,D)}function c(P,F){let D=r[P.id];D===void 0&&(S(P),D=u(P),r[P.id]=D,P.addEventListener("dispose",R));let L=F.program;n.updateUBOMapping(P,L);let C=e.render.frame;s[P.id]!==C&&(d(P),s[P.id]=C)}function u(P){let F=f();P.__bindingPointIndex=F;let D=i.createBuffer(),L=P.__size,C=P.usage;return i.bindBuffer(i.UNIFORM_BUFFER,D),i.bufferData(i.UNIFORM_BUFFER,L,C),i.bindBuffer(i.UNIFORM_BUFFER,null),i.bindBufferBase(i.UNIFORM_BUFFER,F,D),D}function f(){for(let P=0;P<a;P++)if(o.indexOf(P)===-1)return o.push(P),P;return ze("WebGLRenderer: Maximum number of simultaneously usable uniforms groups reached."),0}function d(P){let F=r[P.id],D=P.uniforms,L=P.__cache;i.bindBuffer(i.UNIFORM_BUFFER,F);for(let C=0,B=D.length;C<B;C++){let k=D[C];if(Array.isArray(k))for(let z=0,G=k.length;z<G;z++)A(k[z],C,z,L);else A(k,C,0,L)}i.bindBuffer(i.UNIFORM_BUFFER,null)}function A(P,F,D,L){if(w(P,F,D,L)===!0){let C=P.__offset,B=P.value;if(Array.isArray(B)){let k=0;for(let z=0;z<B.length;z++){let G=B[z],W=T(G);y(G,P.__data,k),typeof G!="number"&&typeof G!="boolean"&&!G.isMatrix3&&!ArrayBuffer.isView(G)&&(k+=W.storage/Float32Array.BYTES_PER_ELEMENT)}}else y(B,P.__data,0);i.bufferSubData(i.UNIFORM_BUFFER,C,P.__data)}}function y(P,F,D){typeof P=="number"||typeof P=="boolean"?F[0]=P:P.isMatrix3?(F[0]=P.elements[0],F[1]=P.elements[1],F[2]=P.elements[2],F[3]=0,F[4]=P.elements[3],F[5]=P.elements[4],F[6]=P.elements[5],F[7]=0,F[8]=P.elements[6],F[9]=P.elements[7],F[10]=P.elements[8],F[11]=0):ArrayBuffer.isView(P)?F.set(new P.constructor(P.buffer,P.byteOffset,F.length)):P.toArray(F,D)}function w(P,F,D,L){let C=P.value,B=F+"_"+D;if(L[B]===void 0)return typeof C=="number"||typeof C=="boolean"?L[B]=C:ArrayBuffer.isView(C)?L[B]=C.slice():L[B]=C.clone(),!0;{let k=L[B];if(typeof C=="number"||typeof C=="boolean"){if(k!==C)return L[B]=C,!0}else{if(ArrayBuffer.isView(C))return!0;if(k.equals(C)===!1)return k.copy(C),!0}}return!1}function S(P){let F=P.uniforms,D=0,L=16;for(let B=0,k=F.length;B<k;B++){let z=Array.isArray(F[B])?F[B]:[F[B]];for(let G=0,W=z.length;G<W;G++){let Y=z[G],H=Array.isArray(Y.value)?Y.value:[Y.value];for(let $=0,J=H.length;$<J;$++){let te=H[$],ce=T(te),he=D%L,ve=he%ce.boundary,Re=he+ve;D+=ve,Re!==0&&L-Re<ce.storage&&(D+=L-Re),Y.__data=new Float32Array(ce.storage/Float32Array.BYTES_PER_ELEMENT),Y.__offset=D,D+=ce.storage}}}let C=D%L;return C>0&&(D+=L-C),P.__size=D,P.__cache={},this}function T(P){let F={boundary:0,storage:0};return typeof P=="number"||typeof P=="boolean"?(F.boundary=4,F.storage=4):P.isVector2?(F.boundary=8,F.storage=8):P.isVector3||P.isColor?(F.boundary=16,F.storage=12):P.isVector4?(F.boundary=16,F.storage=16):P.isMatrix3?(F.boundary=48,F.storage=48):P.isMatrix4?(F.boundary=64,F.storage=64):P.isTexture?Xe("WebGLRenderer: Texture samplers can not be part of an uniforms group."):ArrayBuffer.isView(P)?(F.boundary=16,F.storage=P.byteLength):Xe("WebGLRenderer: Unsupported uniform value type.",P),F}function R(P){let F=P.target;F.removeEventListener("dispose",R);let D=o.indexOf(F.__bindingPointIndex);o.splice(D,1),i.deleteBuffer(r[F.id]),delete r[F.id],delete s[F.id]}function I(){for(let P in r)i.deleteBuffer(r[P]);o=[],r={},s={}}return{bind:l,update:c,dispose:I}}var Yxe=new Uint16Array([12469,15057,12620,14925,13266,14620,13807,14376,14323,13990,14545,13625,14713,13328,14840,12882,14931,12528,14996,12233,15039,11829,15066,11525,15080,11295,15085,10976,15082,10705,15073,10495,13880,14564,13898,14542,13977,14430,14158,14124,14393,13732,14556,13410,14702,12996,14814,12596,14891,12291,14937,11834,14957,11489,14958,11194,14943,10803,14921,10506,14893,10278,14858,9960,14484,14039,14487,14025,14499,13941,14524,13740,14574,13468,14654,13106,14743,12678,14818,12344,14867,11893,14889,11509,14893,11180,14881,10751,14852,10428,14812,10128,14765,9754,14712,9466,14764,13480,14764,13475,14766,13440,14766,13347,14769,13070,14786,12713,14816,12387,14844,11957,14860,11549,14868,11215,14855,10751,14825,10403,14782,10044,14729,9651,14666,9352,14599,9029,14967,12835,14966,12831,14963,12804,14954,12723,14936,12564,14917,12347,14900,11958,14886,11569,14878,11247,14859,10765,14828,10401,14784,10011,14727,9600,14660,9289,14586,8893,14508,8533,15111,12234,15110,12234,15104,12216,15092,12156,15067,12010,15028,11776,14981,11500,14942,11205,14902,10752,14861,10393,14812,9991,14752,9570,14682,9252,14603,8808,14519,8445,14431,8145,15209,11449,15208,11451,15202,11451,15190,11438,15163,11384,15117,11274,15055,10979,14994,10648,14932,10343,14871,9936,14803,9532,14729,9218,14645,8742,14556,8381,14461,8020,14365,7603,15273,10603,15272,10607,15267,10619,15256,10631,15231,10614,15182,10535,15118,10389,15042,10167,14963,9787,14883,9447,14800,9115,14710,8665,14615,8318,14514,7911,14411,7507,14279,7198,15314,9675,15313,9683,15309,9712,15298,9759,15277,9797,15229,9773,15166,9668,15084,9487,14995,9274,14898,8910,14800,8539,14697,8234,14590,7790,14479,7409,14367,7067,14178,6621,15337,8619,15337,8631,15333,8677,15325,8769,15305,8871,15264,8940,15202,8909,15119,8775,15022,8565,14916,8328,14804,8009,14688,7614,14569,7287,14448,6888,14321,6483,14088,6171,15350,7402,15350,7419,15347,7480,15340,7613,15322,7804,15287,7973,15229,8057,15148,8012,15046,7846,14933,7611,14810,7357,14682,7069,14552,6656,14421,6316,14251,5948,14007,5528,15356,5942,15356,5977,15353,6119,15348,6294,15332,6551,15302,6824,15249,7044,15171,7122,15070,7050,14949,6861,14818,6611,14679,6349,14538,6067,14398,5651,14189,5311,13935,4958,15359,4123,15359,4153,15356,4296,15353,4646,15338,5160,15311,5508,15263,5829,15188,6042,15088,6094,14966,6001,14826,5796,14678,5543,14527,5287,14377,4985,14133,4586,13869,4257,15360,1563,15360,1642,15358,2076,15354,2636,15341,3350,15317,4019,15273,4429,15203,4732,15105,4911,14981,4932,14836,4818,14679,4621,14517,4386,14359,4156,14083,3795,13808,3437,15360,122,15360,137,15358,285,15355,636,15344,1274,15322,2177,15281,2765,15215,3223,15120,3451,14995,3569,14846,3567,14681,3466,14511,3305,14344,3121,14037,2800,13753,2467,15360,0,15360,1,15359,21,15355,89,15346,253,15325,479,15287,796,15225,1148,15133,1492,15008,1749,14856,1882,14685,1886,14506,1783,14324,1608,13996,1398,13702,1183]),$h=null;function Zxe(){return $h===null&&($h=new HA(Yxe,16,16,Ws,Wi),$h.name="DFG_LUT",$h.minFilter=Mi,$h.magFilter=Mi,$h.wrapS=la,$h.wrapT=la,$h.generateMipmaps=!1,$h.needsUpdate=!0),$h}var jM=class{constructor(e={}){let{canvas:t=VM(),context:n=null,depth:r=!0,stencil:s=!1,alpha:o=!1,antialias:a=!1,premultipliedAlpha:l=!0,preserveDrawingBuffer:c=!1,powerPreference:u="default",failIfMajorPerformanceCaveat:f=!1,reversedDepthBuffer:d=!1,outputBufferType:A=Ji}=e;this.isWebGLRenderer=!0;let y;if(n!==null){if(typeof WebGLRenderingContext<"u"&&n instanceof WebGLRenderingContext)throw new Error("THREE.WebGLRenderer: WebGL 1 is not supported since r163.");y=n.getContextAttributes().alpha}else y=o;let w=A,S=new Set([g0,zh,kh]),T=new Set([Ji,xi,wl,ua,ng,ig]),R=new Uint32Array(4),I=new Int32Array(4),P=new re,F=null,D=null,L=[],C=[],B=null;this.domElement=t,this.debug={checkShaderErrors:!0,onShaderError:null},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this.toneMapping=ao,this.toneMappingExposure=1,this.transmissionResolutionScale=1;let k=this,z=!1,G=null,W=null,Y=null,H=null;this._outputColorSpace=Fr;let $=0,J=0,te=null,ce=-1,he=null,ve=new xn,Re=new xn,Qe=null,Fe=new zt(0),mt=0,Ee=t.width,Ve=t.height,Ye=1,Mt=null,Et=null,Pt=new xn(0,0,Ee,Ve),dn=new xn(0,0,Ee,Ve),Gt=!1,$e=new zc,ot=!1,nt=!1,bt=new cn,yt=new re,hn=new xn,en={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0},tn=!1;function bn(){return te===null?Ye:1}let _e=n;function vi(ne,Se){return t.getContext(ne,Se)}try{let ne={alpha:!0,depth:r,stencil:s,antialias:a,premultipliedAlpha:l,preserveDrawingBuffer:c,powerPreference:u,failIfMajorPerformanceCaveat:f};if("setAttribute"in t&&t.setAttribute("data-engine",`three.js r${"185"}`),t.addEventListener("webglcontextlost",nr,!1),t.addEventListener("webglcontextrestored",Fn,!1),t.addEventListener("webglcontextcreationerror",rs,!1),_e===null){let Se="webgl2";if(_e=vi(Se,ne),_e===null)throw vi(Se)?new Error("THREE.WebGLRenderer: Error creating WebGL context with your selected attributes."):new Error("THREE.WebGLRenderer: Error creating WebGL context.")}}catch(ne){throw ze("WebGLRenderer: "+ne.message),ne}let zn,le,Z,Te,Ie,Ge,vt,Tt,qe,Je,It,rn,Lt,Rt,fn,wn,Dn,ye,wt,Ze,St,Bt,ut;function Ce(){zn=new i_e(_e),zn.init(),St=new qxe(_e,zn),le=new Yve(_e,zn,e,St),Z=new Vxe(_e,zn),le.reversedDepthBuffer&&d&&Z.buffers.depth.setReversed(!0),W=_e.createFramebuffer(),Y=_e.createFramebuffer(),H=_e.createFramebuffer(),Te=new o_e(_e),Ie=new Mxe,Ge=new Gxe(_e,zn,Z,Ie,le,St,Te),vt=new n_e(k),Tt=new uge(_e),Bt=new Xve(_e,Tt),qe=new r_e(_e,Tt,Te,Bt),Je=new l_e(_e,qe,Tt,Bt,Te),ye=new a_e(_e,le,Ge),fn=new Zve(Ie),It=new Exe(k,vt,zn,le,Bt,fn),rn=new Xxe(k,Ie),Lt=new Rxe,Rt=new Fxe(zn),Dn=new jve(k,vt,Z,Je,y,l),wn=new zxe(k,Je,le),ut=new $xe(_e,Te,le,Z),wt=new $ve(_e,zn,Te),Ze=new s_e(_e,zn,Te),Te.programs=It.programs,k.capabilities=le,k.extensions=zn,k.properties=Ie,k.renderLists=Lt,k.shadowMap=wn,k.state=Z,k.info=Te}Ce(),w!==Ji&&(B=new u_e(w,t.width,t.height,a,r,s));let Yt=new VF(k,_e);this.xr=Yt,this.getContext=function(){return _e},this.getContextAttributes=function(){return _e.getContextAttributes()},this.forceContextLoss=function(){let ne=zn.get("WEBGL_lose_context");ne&&ne.loseContext()},this.forceContextRestore=function(){let ne=zn.get("WEBGL_lose_context");ne&&ne.restoreContext()},this.getPixelRatio=function(){return Ye},this.setPixelRatio=function(ne){ne!==void 0&&(Ye=ne,this.setSize(Ee,Ve,!1))},this.getSize=function(ne){return ne.set(Ee,Ve)},this.setSize=function(ne,Se,ke=!0){if(Yt.isPresenting){Xe("WebGLRenderer: Can't change size while VR device is presenting.");return}Ee=ne,Ve=Se,t.width=Math.floor(ne*Ye),t.height=Math.floor(Se*Ye),ke===!0&&(t.style.width=ne+"px",t.style.height=Se+"px"),B!==null&&B.setSize(t.width,t.height),this.setViewport(0,0,ne,Se)},this.getDrawingBufferSize=function(ne){return ne.set(Ee*Ye,Ve*Ye).floor()},this.setDrawingBufferSize=function(ne,Se,ke){Ee=ne,Ve=Se,Ye=ke,t.width=Math.floor(ne*ke),t.height=Math.floor(Se*ke),this.setViewport(0,0,ne,Se)},this.setEffects=function(ne){if(w===Ji){ze("WebGLRenderer: setEffects() requires outputBufferType set to HalfFloatType or FloatType.");return}if(ne){for(let Se=0;Se<ne.length;Se++)if(ne[Se].isOutputPass===!0){Xe("WebGLRenderer: OutputPass is not needed in setEffects(). Tone mapping and color space conversion are applied automatically.");break}}B.setEffects(ne||[])},this.getCurrentViewport=function(ne){return ne.copy(ve)},this.getViewport=function(ne){return ne.copy(Pt)},this.setViewport=function(ne,Se,ke,De){ne.isVector4?Pt.set(ne.x,ne.y,ne.z,ne.w):Pt.set(ne,Se,ke,De),Z.viewport(ve.copy(Pt).multiplyScalar(Ye).round())},this.getScissor=function(ne){return ne.copy(dn)},this.setScissor=function(ne,Se,ke,De){ne.isVector4?dn.set(ne.x,ne.y,ne.z,ne.w):dn.set(ne,Se,ke,De),Z.scissor(Re.copy(dn).multiplyScalar(Ye).round())},this.getScissorTest=function(){return Gt},this.setScissorTest=function(ne){Z.setScissorTest(Gt=ne)},this.setOpaqueSort=function(ne){Mt=ne},this.setTransparentSort=function(ne){Et=ne},this.getClearColor=function(ne){return ne.copy(Dn.getClearColor())},this.setClearColor=function(){Dn.setClearColor(...arguments)},this.getClearAlpha=function(){return Dn.getClearAlpha()},this.setClearAlpha=function(){Dn.setClearAlpha(...arguments)},this.clear=function(ne=!0,Se=!0,ke=!0){let De=0;if(ne){let Ne=!1;if(te!==null){let qt=te.texture.format;Ne=S.has(qt)}if(Ne){let qt=te.texture.type,Qt=T.has(qt),Vt=Dn.getClearColor(),sn=Dn.getClearAlpha(),pn=Vt.r,Wn=Vt.g,Jn=Vt.b;Qt?(R[0]=pn,R[1]=Wn,R[2]=Jn,R[3]=sn,_e.clearBufferuiv(_e.COLOR,0,R)):(I[0]=pn,I[1]=Wn,I[2]=Jn,I[3]=sn,_e.clearBufferiv(_e.COLOR,0,I))}else De|=_e.COLOR_BUFFER_BIT}Se&&(De|=_e.DEPTH_BUFFER_BIT,this.state.buffers.depth.setMask(!0)),ke&&(De|=_e.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(4294967295)),De!==0&&_e.clear(De)},this.clearColor=function(){this.clear(!0,!1,!1)},this.clearDepth=function(){this.clear(!1,!0,!1)},this.clearStencil=function(){this.clear(!1,!1,!0)},this.setNodesHandler=function(ne){ne.setRenderer(this),G=ne},this.dispose=function(){t.removeEventListener("webglcontextlost",nr,!1),t.removeEventListener("webglcontextrestored",Fn,!1),t.removeEventListener("webglcontextcreationerror",rs,!1),Dn.dispose(),Lt.dispose(),Rt.dispose(),Ie.dispose(),vt.dispose(),Je.dispose(),Bt.dispose(),ut.dispose(),It.dispose(),Yt.dispose(),Yt.removeEventListener("sessionstart",Zs),Yt.removeEventListener("sessionend",Ol),nh.stop()};function nr(ne){ne.preventDefault(),kA("WebGLRenderer: Context Lost."),z=!0}function Fn(){kA("WebGLRenderer: Context Restored."),z=!1;let ne=Te.autoReset,Se=wn.enabled,ke=wn.autoUpdate,De=wn.needsUpdate,Ne=wn.type;Ce(),Te.autoReset=ne,wn.enabled=Se,wn.autoUpdate=ke,wn.needsUpdate=De,wn.type=Ne}function rs(ne){ze("WebGLRenderer: A WebGL context could not be created. Reason: ",ne.statusMessage)}function Lr(ne){let Se=ne.target;Se.removeEventListener("dispose",Lr),Fl(Se)}function Fl(ne){Sa(ne),Ie.remove(ne)}function Sa(ne){let Se=Ie.get(ne).programs;Se!==void 0&&(Se.forEach(function(ke){It.releaseProgram(ke)}),ne.isShaderMaterial&&It.releaseShaderCache(ne))}this.renderBufferDirect=function(ne,Se,ke,De,Ne,qt){Se===null&&(Se=en);let Qt=Ne.isMesh&&Ne.matrixWorld.determinantAffine()<0,Vt=HG(ne,Se,ke,De,Ne);Z.setMaterial(De,Qt);let sn=ke.index,pn=1;if(De.wireframe===!0){if(sn=qe.getWireframeAttribute(ke),sn===void 0)return;pn=2}let Wn=ke.drawRange,Jn=ke.attributes.position,gn=Wn.start*pn,Yi=(Wn.start+Wn.count)*pn;qt!==null&&(gn=Math.max(gn,qt.start*pn),Yi=Math.min(Yi,(qt.start+qt.count)*pn)),sn!==null?(gn=Math.max(gn,0),Yi=Math.min(Yi,sn.count)):Jn!=null&&(gn=Math.max(gn,0),Yi=Math.min(Yi,Jn.count));let ss=Yi-gn;if(ss<0||ss===1/0)return;Bt.setup(Ne,De,Vt,ke,sn);let qr,ir=wt;if(sn!==null&&(qr=Tt.get(sn),ir=Ze,ir.setIndex(qr)),Ne.isMesh)De.wireframe===!0?(Z.setLineWidth(De.wireframeLinewidth*bn()),ir.setMode(_e.LINES)):ir.setMode(_e.TRIANGLES);else if(Ne.isLine){let Co=De.linewidth;Co===void 0&&(Co=1),Z.setLineWidth(Co*bn()),Ne.isLineSegments?ir.setMode(_e.LINES):Ne.isLineLoop?ir.setMode(_e.LINE_LOOP):ir.setMode(_e.LINE_STRIP)}else Ne.isPoints?ir.setMode(_e.POINTS):Ne.isSprite&&ir.setMode(_e.TRIANGLES);if(Ne.isBatchedMesh)if(zn.get("WEBGL_multi_draw"))ir.renderMultiDraw(Ne._multiDrawStarts,Ne._multiDrawCounts,Ne._multiDrawCount);else{let Co=Ne._multiDrawStarts,Zt=Ne._multiDrawCounts,sl=Ne._multiDrawCount,yi=sn?Tt.get(sn).bytesPerElement:1,Ul=Ie.get(De).currentProgram.getUniforms();for(let lu=0;lu<sl;lu++)Ul.setValue(_e,"_gl_DrawID",lu),ir.render(Co[lu]/yi,Zt[lu])}else if(Ne.isInstancedMesh)ir.renderInstances(gn,ss,Ne.count);else if(ke.isInstancedBufferGeometry){let Co=ke._maxInstanceCount!==void 0?ke._maxInstanceCount:1/0,Zt=Math.min(ke.instanceCount,Co);ir.renderInstances(gn,ss,Zt)}else ir.render(gn,ss)};function Bl(ne,Se,ke){ne.transparent===!0&&ne.side===vr&&ne.forceSinglePass===!1?(ne.side=mi,ne.needsUpdate=!0,Gx(ne,Se,ke),ne.side=zo,ne.needsUpdate=!0,Gx(ne,Se,ke),ne.side=vr):Gx(ne,Se,ke)}this.compile=function(ne,Se,ke=null){ke===null&&(ke=ne),D=Rt.get(ke),D.init(Se),C.push(D),ke.traverseVisible(function(Ne){Ne.isLight&&Ne.layers.test(Se.layers)&&(D.pushLight(Ne),Ne.castShadow&&D.pushShadow(Ne))}),ne!==ke&&ne.traverseVisible(function(Ne){Ne.isLight&&Ne.layers.test(Se.layers)&&(D.pushLight(Ne),Ne.castShadow&&D.pushShadow(Ne))}),D.setupLights();let De=new Set;return ne.traverse(function(Ne){if(!(Ne.isMesh||Ne.isPoints||Ne.isLine||Ne.isSprite))return;let qt=Ne.material;if(qt)if(Array.isArray(qt))for(let Qt=0;Qt<qt.length;Qt++){let Vt=qt[Qt];Bl(Vt,ke,Ne),De.add(Vt)}else Bl(qt,ke,Ne),De.add(qt)}),D=C.pop(),De},this.compileAsync=function(ne,Se,ke=null){let De=this.compile(ne,Se,ke);return new Promise(Ne=>{function qt(){if(De.forEach(function(Qt){Ie.get(Qt).currentProgram.isReady()&&De.delete(Qt)}),De.size===0){Ne(ne);return}setTimeout(qt,10)}zn.get("KHR_parallel_shader_compile")!==null?qt():setTimeout(qt,10)})};let rl=null;function xr(ne){rl&&rl(ne)}function Zs(){nh.stop()}function Ol(){nh.start()}let nh=new sK;nh.setAnimationLoop(xr),typeof self<"u"&&nh.setContext(self),this.setAnimationLoop=function(ne){rl=ne,Yt.setAnimationLoop(ne),ne===null?nh.stop():nh.start()},Yt.addEventListener("sessionstart",Zs),Yt.addEventListener("sessionend",Ol),this.render=function(ne,Se){if(Se!==void 0&&Se.isCamera!==!0){ze("WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(z===!0)return;G!==null&&G.renderStart(ne,Se);let ke=Yt.enabled===!0&&Yt.isPresenting===!0,De=B!==null&&(te===null||ke)&&B.begin(k,te);if(ne.matrixWorldAutoUpdate===!0&&ne.updateMatrixWorld(),Se.parent===null&&Se.matrixWorldAutoUpdate===!0&&Se.updateMatrixWorld(),Yt.enabled===!0&&Yt.isPresenting===!0&&(B===null||B.isCompositing()===!1)&&(Yt.cameraAutoUpdate===!0&&Yt.updateCamera(Se),Se=Yt.getCamera()),ne.isScene===!0&&ne.onBeforeRender(k,ne,Se,te),D=Rt.get(ne,C.length),D.init(Se),D.state.textureUnits=Ge.getTextureUnits(),C.push(D),bt.multiplyMatrices(Se.projectionMatrix,Se.matrixWorldInverse),$e.setFromProjectionMatrix(bt,ko,Se.reversedDepth),nt=this.localClippingEnabled,ot=fn.init(this.clippingPlanes,nt),F=Lt.get(ne,L.length),F.init(),L.push(F),Yt.enabled===!0&&Yt.isPresenting===!0){let Qt=k.xr.getDepthSensingMesh();Qt!==null&&tT(Qt,Se,-1/0,k.sortObjects)}tT(ne,Se,0,k.sortObjects),F.finish(),k.sortObjects===!0&&F.sort(Mt,Et,Se.reversedDepth),tn=Yt.enabled===!1||Yt.isPresenting===!1||Yt.hasDepthSensing()===!1,tn&&Dn.addToRenderList(F,ne),this.info.render.frame++,this.info.autoReset===!0&&this.info.reset(),ot===!0&&fn.beginShadows();let Ne=D.state.shadowsArray;if(wn.render(Ne,ne,Se),ot===!0&&fn.endShadows(),(De&&B.hasRenderPass())===!1){let Qt=F.opaque,Vt=F.transmissive;if(D.setupLights(),Se.isArrayCamera){let sn=Se.cameras;if(Vt.length>0)for(let pn=0,Wn=sn.length;pn<Wn;pn++){let Jn=sn[pn];YI(Qt,Vt,ne,Jn)}tn&&Dn.render(ne);for(let pn=0,Wn=sn.length;pn<Wn;pn++){let Jn=sn[pn];$I(F,ne,Jn,Jn.viewport)}}else Vt.length>0&&YI(Qt,Vt,ne,Se),tn&&Dn.render(ne),$I(F,ne,Se)}te!==null&&J===0&&(Ge.updateMultisampleRenderTarget(te),Ge.updateRenderTargetMipmap(te)),De&&B.end(k),ne.isScene===!0&&ne.onAfterRender(k,ne,Se),Bt.resetDefaultState(),ce=-1,he=null,C.pop(),C.length>0?(D=C[C.length-1],Ge.setTextureUnits(D.state.textureUnits),ot===!0&&fn.setGlobalState(k.clippingPlanes,D.state.camera)):D=null,L.pop(),L.length>0?F=L[L.length-1]:F=null,G!==null&&G.renderEnd()};function tT(ne,Se,ke,De){if(ne.visible===!1)return;if(ne.layers.test(Se.layers)){if(ne.isGroup)ke=ne.renderOrder;else if(ne.isLOD)ne.autoUpdate===!0&&ne.update(Se);else if(ne.isLightProbeGrid)D.pushLightProbeGrid(ne);else if(ne.isLight)D.pushLight(ne),ne.castShadow&&D.pushShadow(ne);else if(ne.isSprite){if(!ne.frustumCulled||$e.intersectsSprite(ne)){De&&hn.setFromMatrixPosition(ne.matrixWorld).applyMatrix4(bt);let Qt=Je.update(ne),Vt=ne.material;Vt.visible&&F.push(ne,Qt,Vt,ke,hn.z,null)}}else if((ne.isMesh||ne.isLine||ne.isPoints)&&(!ne.frustumCulled||$e.intersectsObject(ne))){let Qt=Je.update(ne),Vt=ne.material;if(De&&(ne.boundingSphere!==void 0?(ne.boundingSphere===null&&ne.computeBoundingSphere(),hn.copy(ne.boundingSphere.center)):(Qt.boundingSphere===null&&Qt.computeBoundingSphere(),hn.copy(Qt.boundingSphere.center)),hn.applyMatrix4(ne.matrixWorld).applyMatrix4(bt)),Array.isArray(Vt)){let sn=Qt.groups;for(let pn=0,Wn=sn.length;pn<Wn;pn++){let Jn=sn[pn],gn=Vt[Jn.materialIndex];gn&&gn.visible&&F.push(ne,Qt,gn,ke,hn.z,Jn)}}else Vt.visible&&F.push(ne,Qt,Vt,ke,hn.z,null)}}let qt=ne.children;for(let Qt=0,Vt=qt.length;Qt<Vt;Qt++)tT(qt[Qt],Se,ke,De)}function $I(ne,Se,ke,De){let{opaque:Ne,transmissive:qt,transparent:Qt}=ne;D.setupLightsView(ke),ot===!0&&fn.setGlobalState(k.clippingPlanes,ke),De&&Z.viewport(ve.copy(De)),Ne.length>0&&Vx(Ne,Se,ke),qt.length>0&&Vx(qt,Se,ke),Qt.length>0&&Vx(Qt,Se,ke),Z.buffers.depth.setTest(!0),Z.buffers.depth.setMask(!0),Z.buffers.color.setMask(!0),Z.setPolygonOffset(!1)}function YI(ne,Se,ke,De){if((ke.isScene===!0?ke.overrideMaterial:null)!==null)return;if(D.state.transmissionRenderTarget[De.id]===void 0){let gn=zn.has("EXT_color_buffer_half_float")||zn.has("EXT_color_buffer_float");D.state.transmissionRenderTarget[De.id]=new Oa(1,1,{generateMipmaps:!0,type:gn?Wi:Ji,minFilter:Go,samples:Math.max(4,le.samples),stencilBuffer:s,resolveDepthBuffer:!1,resolveStencilBuffer:!1,colorSpace:ln.workingColorSpace})}let qt=D.state.transmissionRenderTarget[De.id],Qt=De.viewport||ve;qt.setSize(Qt.z*k.transmissionResolutionScale,Qt.w*k.transmissionResolutionScale);let Vt=k.getRenderTarget(),sn=k.getActiveCubeFace(),pn=k.getActiveMipmapLevel();k.setRenderTarget(qt),k.getClearColor(Fe),mt=k.getClearAlpha(),mt<1&&k.setClearColor(16777215,.5),k.clear(),tn&&Dn.render(ke);let Wn=k.toneMapping;k.toneMapping=ao;let Jn=De.viewport;if(De.viewport!==void 0&&(De.viewport=void 0),D.setupLightsView(De),ot===!0&&fn.setGlobalState(k.clippingPlanes,De),Vx(ne,ke,De),Ge.updateMultisampleRenderTarget(qt),Ge.updateRenderTargetMipmap(qt),zn.has("WEBGL_multisampled_render_to_texture")===!1){let gn=!1;for(let Yi=0,ss=Se.length;Yi<ss;Yi++){let qr=Se[Yi],{object:ir,geometry:Co,material:Zt,group:sl}=qr;if(Zt.side===vr&&ir.layers.test(De.layers)){let yi=Zt.side;Zt.side=mi,Zt.needsUpdate=!0,ZI(ir,ke,De,Co,Zt,sl),Zt.side=yi,Zt.needsUpdate=!0,gn=!0}}gn===!0&&(Ge.updateMultisampleRenderTarget(qt),Ge.updateRenderTargetMipmap(qt))}k.setRenderTarget(Vt,sn,pn),k.setClearColor(Fe,mt),Jn!==void 0&&(De.viewport=Jn),k.toneMapping=Wn}function Vx(ne,Se,ke){let De=Se.isScene===!0?Se.overrideMaterial:null;for(let Ne=0,qt=ne.length;Ne<qt;Ne++){let Qt=ne[Ne],{object:Vt,geometry:sn,group:pn}=Qt,Wn=Qt.material;Wn.allowOverride===!0&&De!==null&&(Wn=De),Vt.layers.test(ke.layers)&&ZI(Vt,Se,ke,sn,Wn,pn)}}function ZI(ne,Se,ke,De,Ne,qt){ne.onBeforeRender(k,Se,ke,De,Ne,qt),ne.modelViewMatrix.multiplyMatrices(ke.matrixWorldInverse,ne.matrixWorld),ne.normalMatrix.getNormalMatrix(ne.modelViewMatrix),Ne.onBeforeRender(k,Se,ke,De,ne,qt),Ne.transparent===!0&&Ne.side===vr&&Ne.forceSinglePass===!1?(Ne.side=mi,Ne.needsUpdate=!0,k.renderBufferDirect(ke,Se,De,Ne,ne,qt),Ne.side=zo,Ne.needsUpdate=!0,k.renderBufferDirect(ke,Se,De,Ne,ne,qt),Ne.side=vr):k.renderBufferDirect(ke,Se,De,Ne,ne,qt),ne.onAfterRender(k,Se,ke,De,Ne,qt)}function Gx(ne,Se,ke){Se.isScene!==!0&&(Se=en);let De=Ie.get(ne),Ne=D.state.lights,qt=D.state.shadowsArray,Qt=Ne.state.version,Vt=It.getParameters(ne,Ne.state,qt,Se,ke,D.state.lightProbeGridArray),sn=It.getProgramCacheKey(Vt),pn=De.programs;De.environment=ne.isMeshStandardMaterial||ne.isMeshLambertMaterial||ne.isMeshPhongMaterial?Se.environment:null,De.fog=Se.fog;let Wn=ne.isMeshStandardMaterial||ne.isMeshLambertMaterial&&!ne.envMap||ne.isMeshPhongMaterial&&!ne.envMap;De.envMap=vt.get(ne.envMap||De.environment,Wn),De.envMapRotation=De.environment!==null&&ne.envMap===null?Se.environmentRotation:ne.envMapRotation,pn===void 0&&(ne.addEventListener("dispose",Lr),pn=new Map,De.programs=pn);let Jn=pn.get(sn);if(Jn!==void 0){if(De.currentProgram===Jn&&De.lightsStateVersion===Qt)return QI(ne,Vt),Jn}else Vt.uniforms=It.getUniforms(ne),G!==null&&ne.isNodeMaterial&&G.build(ne,ke,Vt),ne.onBeforeCompile(Vt,k),Jn=It.acquireProgram(Vt,sn),pn.set(sn,Jn),De.uniforms=Vt.uniforms;let gn=De.uniforms;return(!ne.isShaderMaterial&&!ne.isRawShaderMaterial||ne.clipping===!0)&&(gn.clippingPlanes=fn.uniform),QI(ne,Vt),De.needsLights=jG(ne),De.lightsStateVersion=Qt,De.needsLights&&(gn.ambientLightColor.value=Ne.state.ambient,gn.lightProbe.value=Ne.state.probe,gn.directionalLights.value=Ne.state.directional,gn.directionalLightShadows.value=Ne.state.directionalShadow,gn.spotLights.value=Ne.state.spot,gn.spotLightShadows.value=Ne.state.spotShadow,gn.rectAreaLights.value=Ne.state.rectArea,gn.ltc_1.value=Ne.state.rectAreaLTC1,gn.ltc_2.value=Ne.state.rectAreaLTC2,gn.pointLights.value=Ne.state.point,gn.pointLightShadows.value=Ne.state.pointShadow,gn.hemisphereLights.value=Ne.state.hemi,gn.directionalShadowMatrix.value=Ne.state.directionalShadowMatrix,gn.spotLightMatrix.value=Ne.state.spotLightMatrix,gn.spotLightMap.value=Ne.state.spotLightMap,gn.pointShadowMatrix.value=Ne.state.pointShadowMatrix),De.lightProbeGrid=D.state.lightProbeGridArray.length>0,De.currentProgram=Jn,De.uniformsList=null,Jn}function KI(ne){if(ne.uniformsList===null){let Se=ne.currentProgram.getUniforms();ne.uniformsList=p_.seqWithValue(Se.seq,ne.uniforms)}return ne.uniformsList}function QI(ne,Se){let ke=Ie.get(ne);ke.outputColorSpace=Se.outputColorSpace,ke.batching=Se.batching,ke.batchingColor=Se.batchingColor,ke.instancing=Se.instancing,ke.instancingColor=Se.instancingColor,ke.instancingMorph=Se.instancingMorph,ke.skinning=Se.skinning,ke.morphTargets=Se.morphTargets,ke.morphNormals=Se.morphNormals,ke.morphColors=Se.morphColors,ke.morphTargetsCount=Se.morphTargetsCount,ke.numClippingPlanes=Se.numClippingPlanes,ke.numIntersection=Se.numClipIntersection,ke.vertexAlphas=Se.vertexAlphas,ke.vertexTangents=Se.vertexTangents,ke.toneMapping=Se.toneMapping}function qG(ne,Se){if(ne.length===0)return null;if(ne.length===1)return ne[0].texture!==null?ne[0]:null;P.setFromMatrixPosition(Se.matrixWorld);for(let ke=0,De=ne.length;ke<De;ke++){let Ne=ne[ke];if(Ne.texture!==null&&Ne.boundingBox.containsPoint(P))return Ne}return null}function HG(ne,Se,ke,De,Ne){Se.isScene!==!0&&(Se=en),Ge.resetTextureUnits();let qt=Se.fog,Qt=De.isMeshStandardMaterial||De.isMeshLambertMaterial||De.isMeshPhongMaterial?Se.environment:null,Vt=te===null?k.outputColorSpace:te.isXRRenderTarget===!0?te.texture.colorSpace:ln.workingColorSpace,sn=De.isMeshStandardMaterial||De.isMeshLambertMaterial&&!De.envMap||De.isMeshPhongMaterial&&!De.envMap,pn=vt.get(De.envMap||Qt,sn),Wn=De.vertexColors===!0&&!!ke.attributes.color&&ke.attributes.color.itemSize===4,Jn=!!ke.attributes.tangent&&(!!De.normalMap||De.anisotropy>0),gn=!!ke.morphAttributes.position,Yi=!!ke.morphAttributes.normal,ss=!!ke.morphAttributes.color,qr=ao;De.toneMapped&&(te===null||te.isXRRenderTarget===!0)&&(qr=k.toneMapping);let ir=ke.morphAttributes.position||ke.morphAttributes.normal||ke.morphAttributes.color,Co=ir!==void 0?ir.length:0,Zt=Ie.get(De),sl=D.state.lights;if(ot===!0&&(nt===!0||ne!==he)){let pr=ne===he&&De.id===ce;fn.setState(De,ne,pr)}let yi=!1;De.version===Zt.__version?(Zt.needsLights&&Zt.lightsStateVersion!==sl.state.version||Zt.outputColorSpace!==Vt||Ne.isBatchedMesh&&Zt.batching===!1||!Ne.isBatchedMesh&&Zt.batching===!0||Ne.isBatchedMesh&&Zt.batchingColor===!0&&Ne.colorTexture===null||Ne.isBatchedMesh&&Zt.batchingColor===!1&&Ne.colorTexture!==null||Ne.isInstancedMesh&&Zt.instancing===!1||!Ne.isInstancedMesh&&Zt.instancing===!0||Ne.isSkinnedMesh&&Zt.skinning===!1||!Ne.isSkinnedMesh&&Zt.skinning===!0||Ne.isInstancedMesh&&Zt.instancingColor===!0&&Ne.instanceColor===null||Ne.isInstancedMesh&&Zt.instancingColor===!1&&Ne.instanceColor!==null||Ne.isInstancedMesh&&Zt.instancingMorph===!0&&Ne.morphTexture===null||Ne.isInstancedMesh&&Zt.instancingMorph===!1&&Ne.morphTexture!==null||Zt.envMap!==pn||De.fog===!0&&Zt.fog!==qt||Zt.numClippingPlanes!==void 0&&(Zt.numClippingPlanes!==fn.numPlanes||Zt.numIntersection!==fn.numIntersection)||Zt.vertexAlphas!==Wn||Zt.vertexTangents!==Jn||Zt.morphTargets!==gn||Zt.morphNormals!==Yi||Zt.morphColors!==ss||Zt.toneMapping!==qr||Zt.morphTargetsCount!==Co||!!Zt.lightProbeGrid!=D.state.lightProbeGridArray.length>0)&&(yi=!0):(yi=!0,Zt.__version=De.version);let Ul=Zt.currentProgram;yi===!0&&(Ul=Gx(De,Se,Ne),G&&De.isNodeMaterial&&G.onUpdateProgram(De,Ul,Zt));let lu=!1,kf=!1,Bm=!1,rr=Ul.getUniforms(),os=Zt.uniforms;if(Z.useProgram(Ul.program)&&(lu=!0,kf=!0,Bm=!0),De.id!==ce&&(ce=De.id,kf=!0),Zt.needsLights){let pr=qG(D.state.lightProbeGridArray,Ne);Zt.lightProbeGrid!==pr&&(Zt.lightProbeGrid=pr,kf=!0)}if(lu||he!==ne){Z.buffers.depth.getReversed()&&ne.reversedDepth!==!0&&(ne._reversedDepth=!0,ne.updateProjectionMatrix()),rr.setValue(_e,"projectionMatrix",ne.projectionMatrix),rr.setValue(_e,"viewMatrix",ne.matrixWorldInverse);let Vf=rr.map.cameraPosition;Vf!==void 0&&Vf.setValue(_e,yt.setFromMatrixPosition(ne.matrixWorld)),le.logarithmicDepthBuffer&&rr.setValue(_e,"logDepthBufFC",2/(Math.log(ne.far+1)/Math.LN2)),(De.isMeshPhongMaterial||De.isMeshToonMaterial||De.isMeshLambertMaterial||De.isMeshBasicMaterial||De.isMeshStandardMaterial||De.isShaderMaterial)&&rr.setValue(_e,"isOrthographic",ne.isOrthographicCamera===!0),he!==ne&&(he=ne,kf=!0,Bm=!0)}if(Zt.needsLights&&(sl.state.directionalShadowMap.length>0&&rr.setValue(_e,"directionalShadowMap",sl.state.directionalShadowMap,Ge),sl.state.spotShadowMap.length>0&&rr.setValue(_e,"spotShadowMap",sl.state.spotShadowMap,Ge),sl.state.pointShadowMap.length>0&&rr.setValue(_e,"pointShadowMap",sl.state.pointShadowMap,Ge)),Ne.isSkinnedMesh){rr.setOptional(_e,Ne,"bindMatrix"),rr.setOptional(_e,Ne,"bindMatrixInverse");let pr=Ne.skeleton;pr&&(pr.boneTexture===null&&pr.computeBoneTexture(),rr.setValue(_e,"boneTexture",pr.boneTexture,Ge))}Ne.isBatchedMesh&&(rr.setOptional(_e,Ne,"batchingTexture"),rr.setValue(_e,"batchingTexture",Ne._matricesTexture,Ge),rr.setOptional(_e,Ne,"batchingIdTexture"),rr.setValue(_e,"batchingIdTexture",Ne._indirectTexture,Ge),rr.setOptional(_e,Ne,"batchingColorTexture"),Ne._colorsTexture!==null&&rr.setValue(_e,"batchingColorTexture",Ne._colorsTexture,Ge));let zf=ke.morphAttributes;if((zf.position!==void 0||zf.normal!==void 0||zf.color!==void 0)&&ye.update(Ne,ke,Ul),(kf||Zt.receiveShadow!==Ne.receiveShadow)&&(Zt.receiveShadow=Ne.receiveShadow,rr.setValue(_e,"receiveShadow",Ne.receiveShadow)),(De.isMeshStandardMaterial||De.isMeshLambertMaterial||De.isMeshPhongMaterial)&&De.envMap===null&&Se.environment!==null&&(os.envMapIntensity.value=Se.environmentIntensity),os.dfgLUT!==void 0&&(os.dfgLUT.value=Zxe()),kf){if(rr.setValue(_e,"toneMappingExposure",k.toneMappingExposure),Zt.needsLights&&WG(os,Bm),qt&&De.fog===!0&&rn.refreshFogUniforms(os,qt),rn.refreshMaterialUniforms(os,De,Ye,Ve,D.state.transmissionRenderTarget[ne.id]),Zt.needsLights&&Zt.lightProbeGrid){let pr=Zt.lightProbeGrid;os.probesSH.value=pr.texture,os.probesMin.value.copy(pr.boundingBox.min),os.probesMax.value.copy(pr.boundingBox.max),os.probesResolution.value.copy(pr.resolution)}p_.upload(_e,KI(Zt),os,Ge)}if(De.isShaderMaterial&&De.uniformsNeedUpdate===!0&&(p_.upload(_e,KI(Zt),os,Ge),De.uniformsNeedUpdate=!1),De.isSpriteMaterial&&rr.setValue(_e,"center",Ne.center),rr.setValue(_e,"modelViewMatrix",Ne.modelViewMatrix),rr.setValue(_e,"normalMatrix",Ne.normalMatrix),rr.setValue(_e,"modelMatrix",Ne.matrixWorld),De.uniformsGroups!==void 0){let pr=De.uniformsGroups;for(let Vf=0,Om=pr.length;Vf<Om;Vf++){let JI=pr[Vf];ut.update(JI,Ul),ut.bind(JI,Ul)}}return Ul}function WG(ne,Se){ne.ambientLightColor.needsUpdate=Se,ne.lightProbe.needsUpdate=Se,ne.directionalLights.needsUpdate=Se,ne.directionalLightShadows.needsUpdate=Se,ne.pointLights.needsUpdate=Se,ne.pointLightShadows.needsUpdate=Se,ne.spotLights.needsUpdate=Se,ne.spotLightShadows.needsUpdate=Se,ne.rectAreaLights.needsUpdate=Se,ne.hemisphereLights.needsUpdate=Se}function jG(ne){return ne.isMeshLambertMaterial||ne.isMeshToonMaterial||ne.isMeshPhongMaterial||ne.isMeshStandardMaterial||ne.isShadowMaterial||ne.isShaderMaterial&&ne.lights===!0}this.getActiveCubeFace=function(){return $},this.getActiveMipmapLevel=function(){return J},this.getRenderTarget=function(){return te},this.setRenderTargetTextures=function(ne,Se,ke){let De=Ie.get(ne);De.__autoAllocateDepthBuffer=ne.resolveDepthBuffer===!1,De.__autoAllocateDepthBuffer===!1&&(De.__useRenderToTexture=!1),Ie.get(ne.texture).__webglTexture=Se,Ie.get(ne.depthTexture).__webglTexture=De.__autoAllocateDepthBuffer?void 0:ke,De.__hasExternalTextures=!0},this.setRenderTargetFramebuffer=function(ne,Se){let ke=Ie.get(ne);ke.__webglFramebuffer=Se,ke.__useDefaultFramebuffer=Se===void 0},this.setRenderTarget=function(ne,Se=0,ke=0){te=ne,$=Se,J=ke;let De=null,Ne=!1,qt=!1;if(ne){let Vt=Ie.get(ne);if(Vt.__useDefaultFramebuffer!==void 0){Z.bindFramebuffer(_e.FRAMEBUFFER,Vt.__webglFramebuffer),ve.copy(ne.viewport),Re.copy(ne.scissor),Qe=ne.scissorTest,Z.viewport(ve),Z.scissor(Re),Z.setScissorTest(Qe),ce=-1;return}else if(Vt.__webglFramebuffer===void 0)Ge.setupRenderTarget(ne);else if(Vt.__hasExternalTextures)Ge.rebindTextures(ne,Ie.get(ne.texture).__webglTexture,Ie.get(ne.depthTexture).__webglTexture);else if(ne.depthBuffer){let Wn=ne.depthTexture;if(Vt.__boundDepthTexture!==Wn){if(Wn!==null&&Ie.has(Wn)&&(ne.width!==Wn.image.width||ne.height!==Wn.image.height))throw new Error("THREE.WebGLRenderer: Attached DepthTexture is initialized to the incorrect size.");Ge.setupDepthRenderbuffer(ne)}}let sn=ne.texture;(sn.isData3DTexture||sn.isDataArrayTexture||sn.isCompressedArrayTexture)&&(qt=!0);let pn=Ie.get(ne).__webglFramebuffer;ne.isWebGLCubeRenderTarget?(Array.isArray(pn[Se])?De=pn[Se][ke]:De=pn[Se],Ne=!0):ne.samples>0&&Ge.useMultisampledRTT(ne)===!1?De=Ie.get(ne).__webglMultisampledFramebuffer:Array.isArray(pn)?De=pn[ke]:De=pn,ve.copy(ne.viewport),Re.copy(ne.scissor),Qe=ne.scissorTest}else ve.copy(Pt).multiplyScalar(Ye).floor(),Re.copy(dn).multiplyScalar(Ye).floor(),Qe=Gt;if(ke!==0&&(De=W),Z.bindFramebuffer(_e.FRAMEBUFFER,De)&&Z.drawBuffers(ne,De),Z.viewport(ve),Z.scissor(Re),Z.setScissorTest(Qe),Ne){let Vt=Ie.get(ne.texture);_e.framebufferTexture2D(_e.FRAMEBUFFER,_e.COLOR_ATTACHMENT0,_e.TEXTURE_CUBE_MAP_POSITIVE_X+Se,Vt.__webglTexture,ke)}else if(qt){let Vt=Se;for(let sn=0;sn<ne.textures.length;sn++){let pn=Ie.get(ne.textures[sn]);_e.framebufferTextureLayer(_e.FRAMEBUFFER,_e.COLOR_ATTACHMENT0+sn,pn.__webglTexture,ke,Vt)}}else if(ne!==null&&ke!==0){let Vt=Ie.get(ne.texture);_e.framebufferTexture2D(_e.FRAMEBUFFER,_e.COLOR_ATTACHMENT0,_e.TEXTURE_2D,Vt.__webglTexture,ke)}ce=-1},this.readRenderTargetPixels=function(ne,Se,ke,De,Ne,qt,Qt,Vt=0){if(!(ne&&ne.isWebGLRenderTarget)){ze("WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let sn=Ie.get(ne).__webglFramebuffer;if(ne.isWebGLCubeRenderTarget&&Qt!==void 0&&(sn=sn[Qt]),sn){Z.bindFramebuffer(_e.FRAMEBUFFER,sn);try{let pn=ne.textures[Vt],Wn=pn.format,Jn=pn.type;if(ne.textures.length>1&&_e.readBuffer(_e.COLOR_ATTACHMENT0+Vt),!le.textureFormatReadable(Wn)){ze("WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}if(!le.textureTypeReadable(Jn)){ze("WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}Se>=0&&Se<=ne.width-De&&ke>=0&&ke<=ne.height-Ne&&_e.readPixels(Se,ke,De,Ne,St.convert(Wn),St.convert(Jn),qt)}finally{let pn=te!==null?Ie.get(te).__webglFramebuffer:null;Z.bindFramebuffer(_e.FRAMEBUFFER,pn)}}},this.readRenderTargetPixelsAsync=async function(ne,Se,ke,De,Ne,qt,Qt,Vt=0){if(!(ne&&ne.isWebGLRenderTarget))throw new Error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let sn=Ie.get(ne).__webglFramebuffer;if(ne.isWebGLCubeRenderTarget&&Qt!==void 0&&(sn=sn[Qt]),sn)if(Se>=0&&Se<=ne.width-De&&ke>=0&&ke<=ne.height-Ne){Z.bindFramebuffer(_e.FRAMEBUFFER,sn);let pn=ne.textures[Vt],Wn=pn.format,Jn=pn.type;if(ne.textures.length>1&&_e.readBuffer(_e.COLOR_ATTACHMENT0+Vt),!le.textureFormatReadable(Wn))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.");if(!le.textureTypeReadable(Jn))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type.");let gn=_e.createBuffer();_e.bindBuffer(_e.PIXEL_PACK_BUFFER,gn),_e.bufferData(_e.PIXEL_PACK_BUFFER,qt.byteLength,_e.STREAM_READ),_e.readPixels(Se,ke,De,Ne,St.convert(Wn),St.convert(Jn),0);let Yi=te!==null?Ie.get(te).__webglFramebuffer:null;Z.bindFramebuffer(_e.FRAMEBUFFER,Yi);let ss=_e.fenceSync(_e.SYNC_GPU_COMMANDS_COMPLETE,0);return _e.flush(),await CZ(_e,ss,4),_e.bindBuffer(_e.PIXEL_PACK_BUFFER,gn),_e.getBufferSubData(_e.PIXEL_PACK_BUFFER,0,qt),_e.deleteBuffer(gn),_e.deleteSync(ss),qt}else throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: requested read bounds are out of range.")},this.copyFramebufferToTexture=function(ne,Se=null,ke=0){let De=Math.pow(2,-ke),Ne=Math.floor(ne.image.width*De),qt=Math.floor(ne.image.height*De),Qt=Se!==null?Se.x:0,Vt=Se!==null?Se.y:0;Ge.setTexture2D(ne,0),_e.copyTexSubImage2D(_e.TEXTURE_2D,ke,0,0,Qt,Vt,Ne,qt),Z.unbindTexture()},this.copyTextureToTexture=function(ne,Se,ke=null,De=null,Ne=0,qt=0){let Qt,Vt,sn,pn,Wn,Jn,gn,Yi,ss,qr=ne.isCompressedTexture?ne.mipmaps[qt]:ne.image;if(ke!==null)Qt=ke.max.x-ke.min.x,Vt=ke.max.y-ke.min.y,sn=ke.isBox3?ke.max.z-ke.min.z:1,pn=ke.min.x,Wn=ke.min.y,Jn=ke.isBox3?ke.min.z:0;else{let os=Math.pow(2,-Ne);Qt=Math.floor(qr.width*os),Vt=Math.floor(qr.height*os),ne.isDataArrayTexture?sn=qr.depth:ne.isData3DTexture?sn=Math.floor(qr.depth*os):sn=1,pn=0,Wn=0,Jn=0}De!==null?(gn=De.x,Yi=De.y,ss=De.z):(gn=0,Yi=0,ss=0);let ir=St.convert(Se.format),Co=St.convert(Se.type),Zt;Se.isData3DTexture?(Ge.setTexture3D(Se,0),Zt=_e.TEXTURE_3D):Se.isDataArrayTexture||Se.isCompressedArrayTexture?(Ge.setTexture2DArray(Se,0),Zt=_e.TEXTURE_2D_ARRAY):(Ge.setTexture2D(Se,0),Zt=_e.TEXTURE_2D),Z.activeTexture(_e.TEXTURE0),Z.pixelStorei(_e.UNPACK_FLIP_Y_WEBGL,Se.flipY),Z.pixelStorei(_e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,Se.premultiplyAlpha),Z.pixelStorei(_e.UNPACK_ALIGNMENT,Se.unpackAlignment);let sl=Z.getParameter(_e.UNPACK_ROW_LENGTH),yi=Z.getParameter(_e.UNPACK_IMAGE_HEIGHT),Ul=Z.getParameter(_e.UNPACK_SKIP_PIXELS),lu=Z.getParameter(_e.UNPACK_SKIP_ROWS),kf=Z.getParameter(_e.UNPACK_SKIP_IMAGES);Z.pixelStorei(_e.UNPACK_ROW_LENGTH,qr.width),Z.pixelStorei(_e.UNPACK_IMAGE_HEIGHT,qr.height),Z.pixelStorei(_e.UNPACK_SKIP_PIXELS,pn),Z.pixelStorei(_e.UNPACK_SKIP_ROWS,Wn),Z.pixelStorei(_e.UNPACK_SKIP_IMAGES,Jn);let Bm=ne.isDataArrayTexture||ne.isData3DTexture,rr=Se.isDataArrayTexture||Se.isData3DTexture;if(ne.isDepthTexture){let os=Ie.get(ne),zf=Ie.get(Se),pr=Ie.get(os.__renderTarget),Vf=Ie.get(zf.__renderTarget);Z.bindFramebuffer(_e.READ_FRAMEBUFFER,pr.__webglFramebuffer),Z.bindFramebuffer(_e.DRAW_FRAMEBUFFER,Vf.__webglFramebuffer);for(let Om=0;Om<sn;Om++)Bm&&(_e.framebufferTextureLayer(_e.READ_FRAMEBUFFER,_e.COLOR_ATTACHMENT0,Ie.get(ne).__webglTexture,Ne,Jn+Om),_e.framebufferTextureLayer(_e.DRAW_FRAMEBUFFER,_e.COLOR_ATTACHMENT0,Ie.get(Se).__webglTexture,qt,ss+Om)),_e.blitFramebuffer(pn,Wn,Qt,Vt,gn,Yi,Qt,Vt,_e.DEPTH_BUFFER_BIT,_e.NEAREST);Z.bindFramebuffer(_e.READ_FRAMEBUFFER,null),Z.bindFramebuffer(_e.DRAW_FRAMEBUFFER,null)}else if(Ne!==0||ne.isRenderTargetTexture||Ie.has(ne)){let os=Ie.get(ne),zf=Ie.get(Se);Z.bindFramebuffer(_e.READ_FRAMEBUFFER,Y),Z.bindFramebuffer(_e.DRAW_FRAMEBUFFER,H);for(let pr=0;pr<sn;pr++)Bm?_e.framebufferTextureLayer(_e.READ_FRAMEBUFFER,_e.COLOR_ATTACHMENT0,os.__webglTexture,Ne,Jn+pr):_e.framebufferTexture2D(_e.READ_FRAMEBUFFER,_e.COLOR_ATTACHMENT0,_e.TEXTURE_2D,os.__webglTexture,Ne),rr?_e.framebufferTextureLayer(_e.DRAW_FRAMEBUFFER,_e.COLOR_ATTACHMENT0,zf.__webglTexture,qt,ss+pr):_e.framebufferTexture2D(_e.DRAW_FRAMEBUFFER,_e.COLOR_ATTACHMENT0,_e.TEXTURE_2D,zf.__webglTexture,qt),Ne!==0?_e.blitFramebuffer(pn,Wn,Qt,Vt,gn,Yi,Qt,Vt,_e.COLOR_BUFFER_BIT,_e.NEAREST):rr?_e.copyTexSubImage3D(Zt,qt,gn,Yi,ss+pr,pn,Wn,Qt,Vt):_e.copyTexSubImage2D(Zt,qt,gn,Yi,pn,Wn,Qt,Vt);Z.bindFramebuffer(_e.READ_FRAMEBUFFER,null),Z.bindFramebuffer(_e.DRAW_FRAMEBUFFER,null)}else rr?ne.isDataTexture||ne.isData3DTexture?_e.texSubImage3D(Zt,qt,gn,Yi,ss,Qt,Vt,sn,ir,Co,qr.data):Se.isCompressedArrayTexture?_e.compressedTexSubImage3D(Zt,qt,gn,Yi,ss,Qt,Vt,sn,ir,qr.data):_e.texSubImage3D(Zt,qt,gn,Yi,ss,Qt,Vt,sn,ir,Co,qr):ne.isDataTexture?_e.texSubImage2D(_e.TEXTURE_2D,qt,gn,Yi,Qt,Vt,ir,Co,qr.data):ne.isCompressedTexture?_e.compressedTexSubImage2D(_e.TEXTURE_2D,qt,gn,Yi,qr.width,qr.height,ir,qr.data):_e.texSubImage2D(_e.TEXTURE_2D,qt,gn,Yi,Qt,Vt,ir,Co,qr);Z.pixelStorei(_e.UNPACK_ROW_LENGTH,sl),Z.pixelStorei(_e.UNPACK_IMAGE_HEIGHT,yi),Z.pixelStorei(_e.UNPACK_SKIP_PIXELS,Ul),Z.pixelStorei(_e.UNPACK_SKIP_ROWS,lu),Z.pixelStorei(_e.UNPACK_SKIP_IMAGES,kf),qt===0&&Se.generateMipmaps&&_e.generateMipmap(Zt),Z.unbindTexture()},this.initRenderTarget=function(ne){Ie.get(ne).__webglFramebuffer===void 0&&Ge.setupRenderTarget(ne)},this.initTexture=function(ne){ne.isCubeTexture?Ge.setTextureCube(ne,0):ne.isData3DTexture?Ge.setTexture3D(ne,0):ne.isDataArrayTexture||ne.isCompressedArrayTexture?Ge.setTexture2DArray(ne,0):Ge.setTexture2D(ne,0),Z.unbindTexture()},this.resetState=function(){$=0,J=0,te=null,Z.reset(),Bt.reset()},typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return ko}get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(e){this._outputColorSpace=e;let t=this.getContext();t.drawingBufferColorSpace=ln._getDrawingBufferColorSpace(e),t.unpackColorSpace=ln._getUnpackColorSpace()}};var YM=class extends lr{constructor(e=document.createElement("div")){super(),this.isCSS2DObject=!0,this.element=e,this.element.style.position="absolute",this.element.style.userSelect="none",this.element.setAttribute("draggable",!1),this.center=new Oe(.5,.5),this.addEventListener("removed",function(){this.traverse(function(t){t.element&&t.element instanceof t.element.ownerDocument.defaultView.Element&&t.element.parentNode!==null&&t.element.remove()})})}copy(e,t){return super.copy(e,t),this.element=e.element.cloneNode(!0),this.center=e.center,this}},A_=new re,fK=new cn,dK=new cn,pK=new re,mK=new re,ZM=class{constructor(e={}){let t=this,n,r,s,o,a={objects:new WeakMap},l=e.element!==void 0?e.element:document.createElement("div");l.style.overflow="hidden",this.domElement=l,this.sortObjects=!0,this.getSize=function(){return{width:n,height:r}},this.render=function(y,w){y.matrixWorldAutoUpdate===!0&&y.updateMatrixWorld(),w.parent===null&&w.matrixWorldAutoUpdate===!0&&w.updateMatrixWorld(),fK.copy(w.matrixWorldInverse),dK.multiplyMatrices(w.projectionMatrix,fK),u(y,y,w),this.sortObjects&&A(y)},this.setSize=function(y,w){n=y,r=w,s=n/2,o=r/2,l.style.width=y+"px",l.style.height=w+"px"};function c(y){y.isCSS2DObject&&(y.element.style.display="none");for(let w=0,S=y.children.length;w<S;w++)c(y.children[w])}function u(y,w,S){if(y.visible===!1){c(y);return}if(y.isCSS2DObject){A_.setFromMatrixPosition(y.matrixWorld),A_.applyMatrix4(dK);let T=A_.z>=-1&&A_.z<=1&&y.layers.test(S.layers)===!0,R=y.element;R.style.display=T===!0?"":"none",T===!0&&(y.onBeforeRender(t,w,S),R.style.transform="translate("+-100*y.center.x+"%,"+-100*y.center.y+"%)translate("+(A_.x*s+s)+"px,"+(-A_.y*o+o)+"px)",R.parentNode!==l&&l.appendChild(R),y.onAfterRender(t,w,S));let I={distanceToCameraSquared:f(S,y)};a.objects.set(y,I)}for(let T=0,R=y.children.length;T<R;T++)u(y.children[T],w,S)}function f(y,w){return pK.setFromMatrixPosition(y.matrixWorld),mK.setFromMatrixPosition(w.matrixWorld),pK.distanceToSquared(mK)}function d(y){let w=[];return y.traverseVisible(function(S){S.isCSS2DObject&&w.push(S)}),w}function A(y){let w=d(y).sort(function(T,R){if(T.renderOrder!==R.renderOrder)return R.renderOrder-T.renderOrder;let I=a.objects.get(T).distanceToCameraSquared,P=a.objects.get(R).distanceToCameraSquared;return I-P}),S=w.length;for(let T=0,R=w.length;T<R;T++)w[T].element.style.zIndex=S-T}}};function Kxe(i){var e=typeof i;return i!=null&&(e=="object"||e=="function")}var Gb=Kxe;var Qxe=typeof global=="object"&&global&&global.Object===Object&&global,AK=Qxe;var Jxe=typeof self=="object"&&self&&self.Object===Object&&self,eye=AK||Jxe||Function("return this")(),KM=eye;var tye=function(){return KM.Date.now()},QM=tye;var nye=/\s/;function iye(i){for(var e=i.length;e--&&nye.test(i.charAt(e)););return e}var gK=iye;var rye=/^\s+/;function sye(i){return i&&i.slice(0,gK(i)+1).replace(rye,"")}var vK=sye;var oye=KM.Symbol,g_=oye;var _K=Object.prototype,aye=_K.hasOwnProperty,lye=_K.toString,qb=g_?g_.toStringTag:void 0;function cye(i){var e=aye.call(i,qb),t=i[qb];try{i[qb]=void 0;var n=!0}catch{}var r=lye.call(i);return n&&(e?i[qb]=t:delete i[qb]),r}var xK=cye;var uye=Object.prototype,hye=uye.toString;function fye(i){return hye.call(i)}var yK=fye;var dye="[object Null]",pye="[object Undefined]",bK=g_?g_.toStringTag:void 0;function mye(i){return i==null?i===void 0?pye:dye:bK&&bK in Object(i)?xK(i):yK(i)}var wK=mye;function Aye(i){return i!=null&&typeof i=="object"}var SK=Aye;var gye="[object Symbol]";function vye(i){return typeof i=="symbol"||SK(i)&&wK(i)==gye}var TK=vye;var EK=NaN,_ye=/^[-+]0x[0-9a-f]+$/i,xye=/^0b[01]+$/i,yye=/^0o[0-7]+$/i,bye=parseInt;function wye(i){if(typeof i=="number")return i;if(TK(i))return EK;if(Gb(i)){var e=typeof i.valueOf=="function"?i.valueOf():i;i=Gb(e)?e+"":e}if(typeof i!="string")return i===0?i:+i;i=vK(i);var t=xye.test(i);return t||yye.test(i)?bye(i.slice(2),t?2:8):_ye.test(i)?EK:+i}var GF=wye;var Sye="Expected a function",Tye=Math.max,Eye=Math.min;function Mye(i,e,t){var n,r,s,o,a,l,c=0,u=!1,f=!1,d=!0;if(typeof i!="function")throw new TypeError(Sye);e=GF(e)||0,Gb(t)&&(u=!!t.leading,f="maxWait"in t,s=f?Tye(GF(t.maxWait)||0,e):s,d="trailing"in t?!!t.trailing:d);function A(D){var L=n,C=r;return n=r=void 0,c=D,o=i.apply(C,L),o}function y(D){return c=D,a=setTimeout(T,e),u?A(D):o}function w(D){var L=D-l,C=D-c,B=e-L;return f?Eye(B,s-C):B}function S(D){var L=D-l,C=D-c;return l===void 0||L>=e||L<0||f&&C>=s}function T(){var D=QM();if(S(D))return R(D);a=setTimeout(T,w(D))}function R(D){return a=void 0,d&&n?A(D):(n=r=void 0,o)}function I(){a!==void 0&&clearTimeout(a),c=0,n=l=r=a=void 0}function P(){return a===void 0?o:R(QM())}function F(){var D=QM(),L=S(D);if(n=arguments,r=this,l=D,L){if(a===void 0)return y(l);if(f)return clearTimeout(a),a=setTimeout(T,e),A(l)}return a===void 0&&(a=setTimeout(T,e)),o}return F.cancel=I,F.flush=P,F}var MK=Mye;function CK(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 Cye(i){if(Array.isArray(i))return i}function Rye(i,e){if(!(i instanceof e))throw new TypeError("Cannot call a class as a function")}function Pye(i,e,t){return Object.defineProperty(i,"prototype",{writable:!1}),i}function Iye(i,e){var t=i==null?null:typeof Symbol<"u"&&i[Symbol.iterator]||i["@@iterator"];if(t!=null){var n,r,s,o,a=[],l=!0,c=!1;try{if(s=(t=t.call(i)).next,e!==0)for(;!(l=(n=s.call(t)).done)&&(a.push(n.value),a.length!==e);l=!0);}catch(u){c=!0,r=u}finally{try{if(!l&&t.return!=null&&(o=t.return(),Object(o)!==o))return}finally{if(c)throw r}}return a}}function Lye(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.4118+In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Dye(i,e){return Cye(i)||Iye(i,e)||Nye(i,e)||Lye()}function Nye(i,e){if(i){if(typeof i=="string")return CK(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)?CK(i,e):void 0}}var Fye=Pye(function i(e,t){var n=t.default,r=n===void 0?null:n,s=t.triggerUpdate,o=s===void 0?!0:s,a=t.onChange,l=a===void 0?function(c,u){}:a;Rye(this,i),this.name=e,this.defaultVal=r,this.triggerUpdate=o,this.onChange=l});function Qr(i){var e=i.stateInit,t=e===void 0?function(){return{}}:e,n=i.props,r=n===void 0?{}:n,s=i.methods,o=s===void 0?{}:s,a=i.aliases,l=a===void 0?{}:a,c=i.init,u=c===void 0?function(){}:c,f=i.update,d=f===void 0?function(){}:f,A=Object.keys(r).map(function(y){return new Fye(y,r[y])});return function y(){for(var w=arguments.length,S=new Array(w),T=0;T<w;T++)S[T]=arguments[T];var R=!!(this instanceof y&&this.constructor),I=R?S.shift():void 0,P=S[0],F=P===void 0?{}:P,D=Object.assign({},t instanceof Function?t(F):t,{initialised:!1}),L={};function C(z){return B(z,F),k(),C}var B=function(G,W){u.call(C,G,D,W),D.initialised=!0},k=MK(function(){D.initialised&&(d.call(C,D,L),L={})},1);return A.forEach(function(z){C[z.name]=G(z);function G(W){var Y=W.name,H=W.triggerUpdate,$=H===void 0?!1:H,J=W.onChange,te=J===void 0?function(ve,Re){}:J,ce=W.defaultVal,he=ce===void 0?null:ce;return function(ve){var Re=D[Y];if(!arguments.length)return Re;var Qe=ve===void 0?he:ve;return D[Y]=Qe,te.call(C,Qe,D,Re),!L.hasOwnProperty(Y)&&(L[Y]=Re),$&&k(),C}}}),Object.keys(o).forEach(function(z){C[z]=function(){for(var G,W=arguments.length,Y=new Array(W),H=0;H<W;H++)Y[H]=arguments[H];return(G=o[z]).call.apply(G,[C,D].concat(Y))}}),Object.entries(l).forEach(function(z){var G=Dye(z,2),W=G[0],Y=G[1];return C[W]=C[Y]}),C.resetProps=function(){return A.forEach(function(z){C[z.name](z.defaultVal)}),C},C.resetProps(),D._rerender=k,R&&I&&C(I),C}}var Jr=Object.freeze({Linear:Object.freeze({None:function(i){return i},In:function(i){return i},Out:function(i){return i},InOut:function(i){return i}}),Quadratic:Object.freeze({In:function(i){return i*i},Out:function(i){return i*(2-i)},InOut:function(i){return(i*=2)<1?.5*i*i:-.5*(--i*(i-2)-1)}}),Cubic:Object.freeze({In:function(i){return i*i*i},Out:function(i){return--i*i*i+1},InOut:function(i){return(i*=2)<1?.5*i*i*i:.5*((i-=2)*i*i+2)}}),Quartic:Object.freeze({In:function(i){return i*i*i*i},Out:function(i){return 1- --i*i*i*i},InOut:function(i){return(i*=2)<1?.5*i*i*i*i:-.5*((i-=2)*i*i*i-2)}}),Quintic:Object.freeze({In:function(i){return i*i*i*i*i},Out:function(i){return--i*i*i*i*i+1},InOut:function(i){return(i*=2)<1?.5*i*i*i*i*i:.5*((i-=2)*i*i*i*i+2)}}),Sinusoidal:Object.freeze({In:function(i){return 1-Math.sin((1-i)*Math.PI/2)},Out:function(i){return Math.sin(i*Math.PI/2)},InOut:function(i){return .5*(1-Math.sin(Math.PI*(.5-i)))}}),Exponential:Object.freeze({In:function(i){return i===0?0:Math.pow(1024,i-1)},Out:function(i){return i===1?1:1-Math.pow(2,-10*i)},InOut:function(i){return i===0?0:i===1?1:(i*=2)<1?.5*Math.pow(1024,i-1):.5*(-Math.pow(2,-10*(i-1))+2)}}),Circular:Object.freeze({In:function(i){return 1-Math.sqrt(1-i*i)},Out:function(i){return Math.sqrt(1- --i*i)},InOut:function(i){return(i*=2)<1?-.5*(Math.sqrt(1-i*i)-1):.5*(Math.sqrt(1-(i-=2)*i)+1)}}),Elastic:Object.freeze({In:function(i){return i===0?0:i===1?1:-Math.pow(2,10*(i-1))*Math.sin((i-1.1)*5*Math.PI)},Out:function(i){return i===0?0:i===1?1:Math.pow(2,-10*i)*Math.sin((i-.1)*5*Math.PI)+1},InOut:function(i){return i===0?0:i===1?1:(i*=2,i<1?-.5*Math.pow(2,10*(i-1))*Math.sin((i-1.1)*5*Math.PI):.5*Math.pow(2,-10*(i-1))*Math.sin((i-1.1)*5*Math.PI)+1)}}),Back:Object.freeze({In:function(i){var e=1.70158;return i===1?1:i*i*((e+1)*i-e)},Out:function(i){var e=1.70158;return i===0?0:--i*i*((e+1)*i+e)+1},InOut:function(i){var e=2.5949095;return(i*=2)<1?.5*(i*i*((e+1)*i-e)):.5*((i-=2)*i*((e+1)*i+e)+2)}}),Bounce:Object.freeze({In:function(i){return 1-Jr.Bounce.Out(1-i)},Out:function(i){return i<.36363636363636365?7.5625*i*i:i<.7272727272727273?7.5625*(i-=.5454545454545454)*i+.75:i<.9090909090909091?7.5625*(i-=.8181818181818182)*i+.9375:7.5625*(i-=.9545454545454546)*i+.984375},InOut:function(i){return i<.5?Jr.Bounce.In(i*2)*.5:Jr.Bounce.Out(i*2-1)*.5+.5}}),generatePow:function(i){return i===void 0&&(i=4),i=i<Number.EPSILON?Number.EPSILON:i,i=i>1e4?1e4:i,{In:function(e){return Math.pow(e,i)},Out:function(e){return 1-Math.pow(1-e,i)},InOut:function(e){return e<.5?Math.pow(e*2,i)/2:(1-Math.pow(2-e*2,i))/2+.5}}}}),Hb=function(){return performance.now()},Ag=(function(){function i(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this._tweens={},this._tweensAddedDuringUpdate={},this.add.apply(this,e)}return i.prototype.getAll=function(){var e=this;return Object.keys(this._tweens).map(function(t){return e._tweens[t]})},i.prototype.removeAll=function(){this._tweens={}},i.prototype.add=function(){for(var e,t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];for(var r=0,s=t;r<s.length;r++){var o=s[r];(e=o._group)===null||e===void 0||e.remove(o),o._group=this,this._tweens[o.getId()]=o,this._tweensAddedDuringUpdate[o.getId()]=o}},i.prototype.remove=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];for(var n=0,r=e;n<r.length;n++){var s=r[n];s._group=void 0,delete this._tweens[s.getId()],delete this._tweensAddedDuringUpdate[s.getId()]}},i.prototype.allStopped=function(){return this.getAll().every(function(e){return!e.isPlaying()})},i.prototype.update=function(e,t){e===void 0&&(e=Hb()),t===void 0&&(t=!0);var n=Object.keys(this._tweens);if(n.length!==0)for(;n.length>0;){this._tweensAddedDuringUpdate={};for(var r=0;r<n.length;r++){var s=this._tweens[n[r]],o=!t;s&&s.update(e,o)===!1&&!t&&this.remove(s)}n=Object.keys(this._tweensAddedDuringUpdate)}},i})(),v_={Linear:function(i,e){var t=i.length-1,n=t*e,r=Math.floor(n),s=v_.Utils.Linear;return e<0?s(i[0],i[1],n):e>1?s(i[t],i[t-1],t-n):s(i[r],i[r+1>t?t:r+1],n-r)},Bezier:function(i,e){for(var t=0,n=i.length-1,r=Math.pow,s=v_.Utils.Bernstein,o=0;o<=n;o++)t+=r(1-e,n-o)*r(e,o)*i[o]*s(n,o);return t},CatmullRom:function(i,e){var t=i.length-1,n=t*e,r=Math.floor(n),s=v_.Utils.CatmullRom;return i[0]===i[t]?(e<0&&(r=Math.floor(n=t*(1+e))),s(i[(r-1+t)%t],i[r],i[(r+1)%t],i[(r+2)%t],n-r)):e<0?i[0]-(s(i[0],i[0],i[1],i[1],-n)-i[0]):e>1?i[t]-(s(i[t],i[t],i[t-1],i[t-1],n-t)-i[t]):s(i[r?r-1:0],i[r],i[t<r+1?t:r+1],i[t<r+2?t:r+2],n-r)},Utils:{Linear:function(i,e,t){return(e-i)*t+i},Bernstein:function(i,e){var t=v_.Utils.Factorial;return t(i)/t(e)/t(i-e)},Factorial:(function(){var i=[1];return function(e){var t=1;if(i[e])return i[e];for(var n=e;n>1;n--)t*=n;return i[e]=t,t}})(),CatmullRom:function(i,e,t,n,r){var s=(t-i)*.5,o=(n-e)*.5,a=r*r,l=r*a;return(2*e-2*t+s+o)*l+(-3*e+3*t-2*s-o)*a+s*r+e}}},RK=(function(){function i(){}return i.nextId=function(){return i._nextId++},i._nextId=0,i})(),qF=new Ag,uo=(function(){function i(e,t){this._isPaused=!1,this._pauseStart=0,this._valuesStart={},this._valuesEnd={},this._valuesStartRepeat={},this._duration=1e3,this._isDynamic=!1,this._initialRepeat=0,this._repeat=0,this._yoyo=!1,this._isPlaying=!1,this._reversed=!1,this._delayTime=0,this._startTime=0,this._easingFunction=Jr.Linear.None,this._interpolationFunction=v_.Linear,this._chainedTweens=[],this._onStartCallbackFired=!1,this._onEveryStartCallbackFired=!1,this._id=RK.nextId(),this._isChainStopped=!1,this._propertiesAreSetUp=!1,this._goToEnd=!1,this._object=e,typeof t=="object"?(this._group=t,t.add(this)):t===!0&&(this._group=qF,qF.add(this))}return i.prototype.getId=function(){return this._id},i.prototype.isPlaying=function(){return this._isPlaying},i.prototype.isPaused=function(){return this._isPaused},i.prototype.getDuration=function(){return this._duration},i.prototype.to=function(e,t){if(t===void 0&&(t=1e3),this._isPlaying)throw new Error("Can not call Tween.to() while Tween is already started or paused. Stop the Tween first.");return this._valuesEnd=e,this._propertiesAreSetUp=!1,this._duration=t<0?0:t,this},i.prototype.duration=function(e){return e===void 0&&(e=1e3),this._duration=e<0?0:e,this},i.prototype.dynamic=function(e){return e===void 0&&(e=!1),this._isDynamic=e,this},i.prototype.start=function(e,t){if(e===void 0&&(e=Hb()),t===void 0&&(t=!1),this._isPlaying)return this;if(this._repeat=this._initialRepeat,this._reversed){this._reversed=!1;for(var n in this._valuesStartRepeat)this._swapEndStartRepeatValues(n),this._valuesStart[n]=this._valuesStartRepeat[n]}if(this._isPlaying=!0,this._isPaused=!1,this._onStartCallbackFired=!1,this._onEveryStartCallbackFired=!1,this._isChainStopped=!1,this._startTime=e,this._startTime+=this._delayTime,!this._propertiesAreSetUp||t){if(this._propertiesAreSetUp=!0,!this._isDynamic){var r={};for(var s in this._valuesEnd)r[s]=this._valuesEnd[s];this._valuesEnd=r}this._setupProperties(this._object,this._valuesStart,this._valuesEnd,this._valuesStartRepeat,t)}return this},i.prototype.startFromCurrentValues=function(e){return this.start(e,!0)},i.prototype._setupProperties=function(e,t,n,r,s){for(var o in n){var a=e[o],l=Array.isArray(a),c=l?"array":typeof a,u=!l&&Array.isArray(n[o]);if(!(c==="undefined"||c==="function")){if(u){var f=n[o];if(f.length===0)continue;for(var d=[a],A=0,y=f.length;A<y;A+=1){var w=this._handleRelativeValue(a,f[A]);if(isNaN(w)){u=!1,console.warn("Found invalid interpolation list. Skipping.");break}d.push(w)}u&&(n[o]=d)}if((c==="object"||l)&&a&&!u){t[o]=l?[]:{};var S=a;for(var T in S)t[o][T]=S[T];r[o]=l?[]:{};var f=n[o];if(!this._isDynamic){var R={};for(var T in f)R[T]=f[T];n[o]=f=R}this._setupProperties(S,t[o],f,r[o],s)}else(typeof t[o]>"u"||s)&&(t[o]=a),l||(t[o]*=1),u?r[o]=n[o].slice().reverse():r[o]=t[o]||0}}},i.prototype.stop=function(){return this._isChainStopped||(this._isChainStopped=!0,this.stopChainedTweens()),this._isPlaying?(this._isPlaying=!1,this._isPaused=!1,this._onStopCallback&&this._onStopCallback(this._object),this):this},i.prototype.end=function(){return this._goToEnd=!0,this.update(this._startTime+this._duration),this},i.prototype.pause=function(e){return e===void 0&&(e=Hb()),this._isPaused||!this._isPlaying?this:(this._isPaused=!0,this._pauseStart=e,this)},i.prototype.resume=function(e){return e===void 0&&(e=Hb()),!this._isPaused||!this._isPlaying?this:(this._isPaused=!1,this._startTime+=e-this._pauseStart,this._pauseStart=0,this)},i.prototype.stopChainedTweens=function(){for(var e=0,t=this._chainedTweens.length;e<t;e++)this._chainedTweens[e].stop();return this},i.prototype.group=function(e){return e?(e.add(this),this):(console.warn("tween.group() without args has been removed, use group.add(tween) instead."),this)},i.prototype.remove=function(){var e;return(e=this._group)===null||e===void 0||e.remove(this),this},i.prototype.delay=function(e){return e===void 0&&(e=0),this._delayTime=e,this},i.prototype.repeat=function(e){return e===void 0&&(e=0),this._initialRepeat=e,this._repeat=e,this},i.prototype.repeatDelay=function(e){return this._repeatDelayTime=e,this},i.prototype.yoyo=function(e){return e===void 0&&(e=!1),this._yoyo=e,this},i.prototype.easing=function(e){return e===void 0&&(e=Jr.Linear.None),this._easingFunction=e,this},i.prototype.interpolation=function(e){return e===void 0&&(e=v_.Linear),this._interpolationFunction=e,this},i.prototype.chain=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return this._chainedTweens=e,this},i.prototype.onStart=function(e){return this._onStartCallback=e,this},i.prototype.onEveryStart=function(e){return this._onEveryStartCallback=e,this},i.prototype.onUpdate=function(e){return this._onUpdateCallback=e,this},i.prototype.onRepeat=function(e){return this._onRepeatCallback=e,this},i.prototype.onComplete=function(e){return this._onCompleteCallback=e,this},i.prototype.onStop=function(e){return this._onStopCallback=e,this},i.prototype.update=function(e,t){var n=this,r;if(e===void 0&&(e=Hb()),t===void 0&&(t=i.autoStartOnUpdate),this._isPaused)return!0;var s;if(!this._goToEnd&&!this._isPlaying)if(t)this.start(e,!0);else return!1;if(this._goToEnd=!1,e<this._startTime)return!0;this._onStartCallbackFired===!1&&(this._onStartCallback&&this._onStartCallback(this._object),this._onStartCallbackFired=!0),this._onEveryStartCallbackFired===!1&&(this._onEveryStartCallback&&this._onEveryStartCallback(this._object),this._onEveryStartCallbackFired=!0);var o=e-this._startTime,a=this._duration+((r=this._repeatDelayTime)!==null&&r!==void 0?r:this._delayTime),l=this._duration+this._repeat*a,c=function(){if(n._duration===0||o>l)return 1;var w=Math.trunc(o/a),S=o-w*a,T=Math.min(S/n._duration,1);return T===0&&o===n._duration?1:T},u=c(),f=this._easingFunction(u);if(this._updateProperties(this._object,this._valuesStart,this._valuesEnd,f),this._onUpdateCallback&&this._onUpdateCallback(this._object,u),this._duration===0||o>=this._duration)if(this._repeat>0){var d=Math.min(Math.trunc((o-this._duration)/a)+1,this._repeat);isFinite(this._repeat)&&(this._repeat-=d);for(s in this._valuesStartRepeat)!this._yoyo&&typeof this._valuesEnd[s]=="string"&&(this._valuesStartRepeat[s]=this._valuesStartRepeat[s]+parseFloat(this._valuesEnd[s])),this._yoyo&&this._swapEndStartRepeatValues(s),this._valuesStart[s]=this._valuesStartRepeat[s];return this._yoyo&&(this._reversed=!this._reversed),this._startTime+=a*d,this._onRepeatCallback&&this._onRepeatCallback(this._object),this._onEveryStartCallbackFired=!1,!0}else{this._onCompleteCallback&&this._onCompleteCallback(this._object);for(var A=0,y=this._chainedTweens.length;A<y;A++)this._chainedTweens[A].start(this._startTime+this._duration,!1);return this._isPlaying=!1,!1}return!0},i.prototype._updateProperties=function(e,t,n,r){for(var s in n)if(t[s]!==void 0){var o=t[s]||0,a=n[s],l=Array.isArray(e[s]),c=Array.isArray(a),u=!l&&c;u?e[s]=this._interpolationFunction(a,r):typeof a=="object"&&a?this._updateProperties(e[s],o,a,r):(a=this._handleRelativeValue(o,a),typeof a=="number"&&(e[s]=o+(a-o)*r))}},i.prototype._handleRelativeValue=function(e,t){return typeof t!="string"?t:t.charAt(0)==="+"||t.charAt(0)==="-"?e+parseFloat(t):parseFloat(t)},i.prototype._swapEndStartRepeatValues=function(e){var t=this._valuesStartRepeat[e],n=this._valuesEnd[e];typeof n=="string"?this._valuesStartRepeat[e]=this._valuesStartRepeat[e]+parseFloat(n):this._valuesStartRepeat[e]=this._valuesEnd[e],this._valuesEnd[e]=t},i.autoStartOnUpdate=!1,i})();var dJe=RK.nextId,Yh=qF,pJe=Yh.getAll.bind(Yh),mJe=Yh.removeAll.bind(Yh),AJe=Yh.add.bind(Yh),gJe=Yh.remove.bind(Yh),vJe=Yh.update.bind(Yh);function PK(i){let e=+this._x.call(null,i),t=+this._y.call(null,i),n=+this._z.call(null,i);return IK(this.cover(e,t,n),e,t,n,i)}function IK(i,e,t,n,r){if(isNaN(e)||isNaN(t)||isNaN(n))return i;var s,o=i._root,a={data:r},l=i._x0,c=i._y0,u=i._z0,f=i._x1,d=i._y1,A=i._z1,y,w,S,T,R,I,P,F,D,L,C;if(!o)return i._root=a,i;for(;o.length;)if((P=e>=(y=(l+f)/2))?l=y:f=y,(F=t>=(w=(c+d)/2))?c=w:d=w,(D=n>=(S=(u+A)/2))?u=S:A=S,s=o,!(o=o[L=D<<2|F<<1|P]))return s[L]=a,i;if(T=+i._x.call(null,o.data),R=+i._y.call(null,o.data),I=+i._z.call(null,o.data),e===T&&t===R&&n===I)return a.next=o,s?s[L]=a:i._root=a,i;do s=s?s[L]=new Array(8):i._root=new Array(8),(P=e>=(y=(l+f)/2))?l=y:f=y,(F=t>=(w=(c+d)/2))?c=w:d=w,(D=n>=(S=(u+A)/2))?u=S:A=S;while((L=D<<2|F<<1|P)===(C=(I>=S)<<2|(R>=w)<<1|T>=y));return s[C]=o,s[L]=a,i}function LK(i){Array.isArray(i)||(i=Array.from(i));let e=i.length,t=new Float64Array(e),n=new Float64Array(e),r=new Float64Array(e),s=1/0,o=1/0,a=1/0,l=-1/0,c=-1/0,u=-1/0;for(let f=0,d,A,y,w;f<e;++f)isNaN(A=+this._x.call(null,d=i[f]))||isNaN(y=+this._y.call(null,d))||isNaN(w=+this._z.call(null,d))||(t[f]=A,n[f]=y,r[f]=w,A<s&&(s=A),A>l&&(l=A),y<o&&(o=y),y>c&&(c=y),w<a&&(a=w),w>u&&(u=w));if(s>l||o>c||a>u)return this;this.cover(s,o,a).cover(l,c,u);for(let f=0;f<e;++f)IK(this,t[f],n[f],r[f],i[f]);return this}function DK(i,e,t){if(isNaN(i=+i)||isNaN(e=+e)||isNaN(t=+t))return this;var n=this._x0,r=this._y0,s=this._z0,o=this._x1,a=this._y1,l=this._z1;if(isNaN(n))o=(n=Math.floor(i))+1,a=(r=Math.floor(e))+1,l=(s=Math.floor(t))+1;else{for(var c=o-n||1,u=this._root,f,d;n>i||i>=o||r>e||e>=a||s>t||t>=l;)switch(d=(t<s)<<2|(e<r)<<1|i<n,f=new Array(8),f[d]=u,u=f,c*=2,d){case 0:o=n+c,a=r+c,l=s+c;break;case 1:n=o-c,a=r+c,l=s+c;break;case 2:o=n+c,r=a-c,l=s+c;break;case 3:n=o-c,r=a-c,l=s+c;break;case 4:o=n+c,a=r+c,s=l-c;break;case 5:n=o-c,a=r+c,s=l-c;break;case 6:o=n+c,r=a-c,s=l-c;break;case 7:n=o-c,r=a-c,s=l-c;break}this._root&&this._root.length&&(this._root=u)}return this._x0=n,this._y0=r,this._z0=s,this._x1=o,this._y1=a,this._z1=l,this}function NK(){var i=[];return this.visit(function(e){if(!e.length)do i.push(e.data);while(e=e.next)}),i}function FK(i){return arguments.length?this.cover(+i[0][0],+i[0][1],+i[0][2]).cover(+i[1][0],+i[1][1],+i[1][2]):isNaN(this._x0)?void 0:[[this._x0,this._y0,this._z0],[this._x1,this._y1,this._z1]]}function ji(i,e,t,n,r,s,o){this.node=i,this.x0=e,this.y0=t,this.z0=n,this.x1=r,this.y1=s,this.z1=o}function BK(i,e,t,n){var r,s=this._x0,o=this._y0,a=this._z0,l,c,u,f,d,A,y=this._x1,w=this._y1,S=this._z1,T=[],R=this._root,I,P;for(R&&T.push(new ji(R,s,o,a,y,w,S)),n==null?n=1/0:(s=i-n,o=e-n,a=t-n,y=i+n,w=e+n,S=t+n,n*=n);I=T.pop();)if(!(!(R=I.node)||(l=I.x0)>y||(c=I.y0)>w||(u=I.z0)>S||(f=I.x1)<s||(d=I.y1)<o||(A=I.z1)<a))if(R.length){var F=(l+f)/2,D=(c+d)/2,L=(u+A)/2;T.push(new ji(R[7],F,D,L,f,d,A),new ji(R[6],l,D,L,F,d,A),new ji(R[5],F,c,L,f,D,A),new ji(R[4],l,c,L,F,D,A),new ji(R[3],F,D,u,f,d,L),new ji(R[2],l,D,u,F,d,L),new ji(R[1],F,c,u,f,D,L),new ji(R[0],l,c,u,F,D,L)),(P=(t>=L)<<2|(e>=D)<<1|i>=F)&&(I=T[T.length-1],T[T.length-1]=T[T.length-1-P],T[T.length-1-P]=I)}else{var C=i-+this._x.call(null,R.data),B=e-+this._y.call(null,R.data),k=t-+this._z.call(null,R.data),z=C*C+B*B+k*k;if(z<n){var G=Math.sqrt(n=z);s=i-G,o=e-G,a=t-G,y=i+G,w=e+G,S=t+G,r=R.data}}return r}var Bye=(i,e,t,n,r,s)=>Math.sqrt((i-n)**2+(e-r)**2+(t-s)**2);function OK(i,e,t,n){let r=[],s=i-n,o=e-n,a=t-n,l=i+n,c=e+n,u=t+n;return this.visit((f,d,A,y,w,S,T)=>{if(!f.length)do{let R=f.data;Bye(i,e,t,this._x(R),this._y(R),this._z(R))<=n&&r.push(R)}while(f=f.next);return d>l||A>c||y>u||w<s||S<o||T<a}),r}function UK(i){if(isNaN(d=+this._x.call(null,i))||isNaN(A=+this._y.call(null,i))||isNaN(y=+this._z.call(null,i)))return this;var e,t=this._root,n,r,s,o=this._x0,a=this._y0,l=this._z0,c=this._x1,u=this._y1,f=this._z1,d,A,y,w,S,T,R,I,P,F,D;if(!t)return this;if(t.length)for(;;){if((R=d>=(w=(o+c)/2))?o=w:c=w,(I=A>=(S=(a+u)/2))?a=S:u=S,(P=y>=(T=(l+f)/2))?l=T:f=T,e=t,!(t=t[F=P<<2|I<<1|R]))return this;if(!t.length)break;(e[F+1&7]||e[F+2&7]||e[F+3&7]||e[F+4&7]||e[F+5&7]||e[F+6&7]||e[F+7&7])&&(n=e,D=F)}for(;t.data!==i;)if(r=t,!(t=t.next))return this;return(s=t.next)&&delete t.next,r?(s?r.next=s:delete r.next,this):e?(s?e[F]=s:delete e[F],(t=e[0]||e[1]||e[2]||e[3]||e[4]||e[5]||e[6]||e[7])&&t===(e[7]||e[6]||e[5]||e[4]||e[3]||e[2]||e[1]||e[0])&&!t.length&&(n?n[D]=t:this._root=t),this):(this._root=s,this)}function kK(i){for(var e=0,t=i.length;e<t;++e)this.remove(i[e]);return this}function zK(){return this._root}function VK(){var i=0;return this.visit(function(e){if(!e.length)do++i;while(e=e.next)}),i}function GK(i){var e=[],t,n=this._root,r,s,o,a,l,c,u;for(n&&e.push(new ji(n,this._x0,this._y0,this._z0,this._x1,this._y1,this._z1));t=e.pop();)if(!i(n=t.node,s=t.x0,o=t.y0,a=t.z0,l=t.x1,c=t.y1,u=t.z1)&&n.length){var f=(s+l)/2,d=(o+c)/2,A=(a+u)/2;(r=n[7])&&e.push(new ji(r,f,d,A,l,c,u)),(r=n[6])&&e.push(new ji(r,s,d,A,f,c,u)),(r=n[5])&&e.push(new ji(r,f,o,A,l,d,u)),(r=n[4])&&e.push(new ji(r,s,o,A,f,d,u)),(r=n[3])&&e.push(new ji(r,f,d,a,l,c,A)),(r=n[2])&&e.push(new ji(r,s,d,a,f,c,A)),(r=n[1])&&e.push(new ji(r,f,o,a,l,d,A)),(r=n[0])&&e.push(new ji(r,s,o,a,f,d,A))}return this}function qK(i){var e=[],t=[],n;for(this._root&&e.push(new ji(this._root,this._x0,this._y0,this._z0,this._x1,this._y1,this._z1));n=e.pop();){var r=n.node;if(r.length){var s,o=n.x0,a=n.y0,l=n.z0,c=n.x1,u=n.y1,f=n.z1,d=(o+c)/2,A=(a+u)/2,y=(l+f)/2;(s=r[0])&&e.push(new ji(s,o,a,l,d,A,y)),(s=r[1])&&e.push(new ji(s,d,a,l,c,A,y)),(s=r[2])&&e.push(new ji(s,o,A,l,d,u,y)),(s=r[3])&&e.push(new ji(s,d,A,l,c,u,y)),(s=r[4])&&e.push(new ji(s,o,a,y,d,A,f)),(s=r[5])&&e.push(new ji(s,d,a,y,c,A,f)),(s=r[6])&&e.push(new ji(s,o,A,y,d,u,f)),(s=r[7])&&e.push(new ji(s,d,A,y,c,u,f))}t.push(n)}for(;n=t.pop();)i(n.node,n.x0,n.y0,n.z0,n.x1,n.y1,n.z1);return this}function HK(i){return i[0]}function WK(i){return arguments.length?(this._x=i,this):this._x}function jK(i){return i[1]}function XK(i){return arguments.length?(this._y=i,this):this._y}function $K(i){return i[2]}function YK(i){return arguments.length?(this._z=i,this):this._z}function Wb(i,e,t,n){var r=new HF(e??HK,t??jK,n??$K,NaN,NaN,NaN,NaN,NaN,NaN);return i==null?r:r.addAll(i)}function HF(i,e,t,n,r,s,o,a,l){this._x=i,this._y=e,this._z=t,this._x0=n,this._y0=r,this._z0=s,this._x1=o,this._y1=a,this._z1=l,this._root=void 0}function ZK(i){for(var e={data:i.data},t=e;i=i.next;)t=t.next={data:i.data};return e}var qo=Wb.prototype=HF.prototype;qo.copy=function(){var i=new HF(this._x,this._y,this._z,this._x0,this._y0,this._z0,this._x1,this._y1,this._z1),e=this._root,t,n;if(!e)return i;if(!e.length)return i._root=ZK(e),i;for(t=[{source:e,target:i._root=new Array(8)}];e=t.pop();)for(var r=0;r<8;++r)(n=e.source[r])&&(n.length?t.push({source:n,target:e.target[r]=new Array(8)}):e.target[r]=ZK(n));return i};qo.add=PK;qo.addAll=LK;qo.cover=DK;qo.data=NK;qo.extent=FK;qo.find=BK;qo.findAllWithinRadius=OK;qo.remove=UK;qo.removeAll=kK;qo.root=zK;qo.size=VK;qo.visit=GK;qo.visitAfter=qK;qo.x=WK;qo.y=XK;qo.z=YK;function gg(i,e){return i==null||e==null?NaN:i<e?-1:i>e?1:i>=e?0:NaN}function WF(i,e){return i==null||e==null?NaN:e<i?-1:e>i?1:e>=i?0:NaN}function JM(i){let e,t,n;i.length!==2?(e=gg,t=(a,l)=>gg(i(a),l),n=(a,l)=>i(a)-l):(e=i===gg||i===WF?i:Oye,t=i,n=i);function r(a,l,c=0,u=a.length){if(c<u){if(e(l,l)!==0)return u;do{let f=c+u>>>1;t(a[f],l)<0?c=f+1:u=f}while(c<u)}return c}function s(a,l,c=0,u=a.length){if(c<u){if(e(l,l)!==0)return u;do{let f=c+u>>>1;t(a[f],l)<=0?c=f+1:u=f}while(c<u)}return c}function o(a,l,c=0,u=a.length){let f=r(a,l,c,u-1);return f>c&&n(a[f-1],l)>-n(a[f],l)?f-1:f}return{left:r,center:o,right:s}}function Oye(){return 0}function jF(i){return i===null?NaN:+i}var KK=JM(gg),QK=KK.right,Uye=KK.left,kye=JM(jF).center,jb=QK;function W0(i,e){let t,n;if(e===void 0)for(let r of i)r!=null&&(t===void 0?r>=r&&(t=n=r):(t>r&&(t=r),n<r&&(n=r)));else{let r=-1;for(let s of i)(s=e(s,++r,i))!=null&&(t===void 0?s>=s&&(t=n=s):(t>s&&(t=s),n<s&&(n=s)))}return[t,n]}var Ho=class{constructor(){this._partials=new Float64Array(32),this._n=0}add(e){let t=this._partials,n=0;for(let r=0;r<this._n&&r<32;r++){let s=t[r],o=e+s,a=Math.abs(e)<Math.abs(s)?e-(o-s):s-(o-e);a&&(t[n++]=a),e=o}return t[n]=e,this._n=n+1,this}valueOf(){let e=this._partials,t=this._n,n,r,s,o=0;if(t>0){for(o=e[--t];t>0&&(n=o,r=e[--t],o=n+r,s=r-(o-n),!s););t>0&&(s<0&&e[t-1]<0||s>0&&e[t-1]>0)&&(r=s*2,n=o+r,r==n-o&&(o=n))}return o}};var zye=Math.sqrt(50),Vye=Math.sqrt(10),Gye=Math.sqrt(2);function eC(i,e,t){let n=(e-i)/Math.max(0,t),r=Math.floor(Math.log10(n)),s=n/Math.pow(10,r),o=s>=zye?10:s>=Vye?5:s>=Gye?2:1,a,l,c;return r<0?(c=Math.pow(10,-r)/o,a=Math.round(i*c),l=Math.round(e*c),a/c<i&&++a,l/c>e&&--l,c=-c):(c=Math.pow(10,r)*o,a=Math.round(i/c),l=Math.round(e/c),a*c<i&&++a,l*c>e&&--l),l<a&&.5<=t&&t<2?eC(i,e,t*2):[a,l,c]}function tC(i,e,t){if(e=+e,i=+i,t=+t,!(t>0))return[];if(i===e)return[i];let n=e<i,[r,s,o]=n?eC(e,i,t):eC(i,e,t);if(!(s>=r))return[];let a=s-r+1,l=new Array(a);if(n)if(o<0)for(let c=0;c<a;++c)l[c]=(s-c)/-o;else for(let c=0;c<a;++c)l[c]=(s-c)*o;else if(o<0)for(let c=0;c<a;++c)l[c]=(r+c)/-o;else for(let c=0;c<a;++c)l[c]=(r+c)*o;return l}function Xb(i,e,t){return e=+e,i=+i,t=+t,eC(i,e,t)[2]}function XF(i,e,t){e=+e,i=+i,t=+t;let n=e<i,r=n?Xb(e,i,t):Xb(i,e,t);return(n?-1:1)*(r<0?1/-r:r)}function nC(i,e){let t;if(e===void 0)for(let n of i)n!=null&&(t<n||t===void 0&&n>=n)&&(t=n);else{let n=-1;for(let r of i)(r=e(r,++n,i))!=null&&(t<r||t===void 0&&r>=r)&&(t=r)}return t}function iC(i,e){let t=0,n=0;if(e===void 0)for(let r of i)r!=null&&(r=+r)>=r&&(++t,n+=r);else{let r=-1;for(let s of i)(s=e(s,++r,i))!=null&&(s=+s)>=s&&(++t,n+=s)}if(t)return n/t}function*qye(i){for(let e of i)yield*e}function Zh(i){return Array.from(qye(i))}function Od(i,e,t){i=+i,e=+e,t=(r=arguments.length)<2?(e=i,i=0,1):r<3?1:+t;for(var n=-1,r=Math.max(0,Math.ceil((e-i)/t))|0,s=new Array(r);++n<r;)s[n]=i+n*t;return s}function rC(i,e){let t=0;if(e===void 0)for(let n of i)(n=+n)&&(t+=n);else{let n=-1;for(let r of i)(r=+e(r,++n,i))&&(t+=r)}return t}function sC(i,e){switch(arguments.length){case 0:break;case 1:this.range(i);break;default:this.range(e).domain(i);break}return this}function oC(i,e,t){i.prototype=e.prototype=t,t.constructor=i}function $F(i,e){var t=Object.create(i.prototype);for(var n in e)t[n]=e[n];return t}function Zb(){}var $b=.7,cC=1/$b,__="\\s*([+-]?\\d+)\\s*",Yb="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",Kh="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",Hye=/^#([0-9a-f]{3,8})$/,Wye=new RegExp(`^rgb\\(${__},${__},${__}\\)$`),jye=new RegExp(`^rgb\\(${Kh},${Kh},${Kh}\\)$`),Xye=new RegExp(`^rgba\\(${__},${__},${__},${Yb}\\)$`),$ye=new RegExp(`^rgba\\(${Kh},${Kh},${Kh},${Yb}\\)$`),Yye=new RegExp(`^hsl\\(${Yb},${Kh},${Kh}\\)$`),Zye=new RegExp(`^hsla\\(${Yb},${Kh},${Kh},${Yb}\\)$`),JK={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};oC(Zb,Uu,{copy(i){return Object.assign(new this.constructor,this,i)},displayable(){return this.rgb().displayable()},hex:eQ,formatHex:eQ,formatHex8:Kye,formatHsl:Qye,formatRgb:tQ,toString:tQ});function eQ(){return this.rgb().formatHex()}function Kye(){return this.rgb().formatHex8()}function Qye(){return aQ(this).formatHsl()}function tQ(){return this.rgb().formatRgb()}function Uu(i){var e,t;return i=(i+"").trim().toLowerCase(),(e=Hye.exec(i))?(t=e[1].length,e=parseInt(e[1],16),t===6?nQ(e):t===3?new Sl(e>>8&15|e>>4&240,e>>4&15|e&240,(e&15)<<4|e&15,1):t===8?aC(e>>24&255,e>>16&255,e>>8&255,(e&255)/255):t===4?aC(e>>12&15|e>>8&240,e>>8&15|e>>4&240,e>>4&15|e&240,((e&15)<<4|e&15)/255):null):(e=Wye.exec(i))?new Sl(e[1],e[2],e[3],1):(e=jye.exec(i))?new Sl(e[1]*255/100,e[2]*255/100,e[3]*255/100,1):(e=Xye.exec(i))?aC(e[1],e[2],e[3],e[4]):(e=$ye.exec(i))?aC(e[1]*255/100,e[2]*255/100,e[3]*255/100,e[4]):(e=Yye.exec(i))?sQ(e[1],e[2]/100,e[3]/100,1):(e=Zye.exec(i))?sQ(e[1],e[2]/100,e[3]/100,e[4]):JK.hasOwnProperty(i)?nQ(JK[i]):i==="transparent"?new Sl(NaN,NaN,NaN,0):null}function nQ(i){return new Sl(i>>16&255,i>>8&255,i&255,1)}function aC(i,e,t,n){return n<=0&&(i=e=t=NaN),new Sl(i,e,t,n)}function Jye(i){return i instanceof Zb||(i=Uu(i)),i?(i=i.rgb(),new Sl(i.r,i.g,i.b,i.opacity)):new Sl}function x_(i,e,t,n){return arguments.length===1?Jye(i):new Sl(i,e,t,n??1)}function Sl(i,e,t,n){this.r=+i,this.g=+e,this.b=+t,this.opacity=+n}oC(Sl,x_,$F(Zb,{brighter(i){return i=i==null?cC:Math.pow(cC,i),new Sl(this.r*i,this.g*i,this.b*i,this.opacity)},darker(i){return i=i==null?$b:Math.pow($b,i),new Sl(this.r*i,this.g*i,this.b*i,this.opacity)},rgb(){return this},clamp(){return new Sl(_g(this.r),_g(this.g),_g(this.b),uC(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:iQ,formatHex:iQ,formatHex8:e2e,formatRgb:rQ,toString:rQ}));function iQ(){return`#${vg(this.r)}${vg(this.g)}${vg(this.b)}`}function e2e(){return`#${vg(this.r)}${vg(this.g)}${vg(this.b)}${vg((isNaN(this.opacity)?1:this.opacity)*255)}`}function rQ(){let i=uC(this.opacity);return`${i===1?"rgb(":"rgba("}${_g(this.r)}, ${_g(this.g)}, ${_g(this.b)}${i===1?")":`, ${i})`}`}function uC(i){return isNaN(i)?1:Math.max(0,Math.min(1,i))}function _g(i){return Math.max(0,Math.min(255,Math.round(i)||0))}function vg(i){return i=_g(i),(i<16?"0":"")+i.toString(16)}function sQ(i,e,t,n){return n<=0?i=e=t=NaN:t<=0||t>=1?i=e=NaN:e<=0&&(i=NaN),new Ou(i,e,t,n)}function aQ(i){if(i instanceof Ou)return new Ou(i.h,i.s,i.l,i.opacity);if(i instanceof Zb||(i=Uu(i)),!i)return new Ou;if(i instanceof Ou)return i;i=i.rgb();var e=i.r/255,t=i.g/255,n=i.b/255,r=Math.min(e,t,n),s=Math.max(e,t,n),o=NaN,a=s-r,l=(s+r)/2;return a?(e===s?o=(t-n)/a+(t<n)*6:t===s?o=(n-e)/a+2:o=(e-t)/a+4,a/=l<.5?s+r:2-s-r,o*=60):a=l>0&&l<1?0:o,new Ou(o,a,l,i.opacity)}function lQ(i,e,t,n){return arguments.length===1?aQ(i):new Ou(i,e,t,n??1)}function Ou(i,e,t,n){this.h=+i,this.s=+e,this.l=+t,this.opacity=+n}oC(Ou,lQ,$F(Zb,{brighter(i){return i=i==null?cC:Math.pow(cC,i),new Ou(this.h,this.s,this.l*i,this.opacity)},darker(i){return i=i==null?$b:Math.pow($b,i),new Ou(this.h,this.s,this.l*i,this.opacity)},rgb(){var i=this.h%360+(this.h<0)*360,e=isNaN(i)||isNaN(this.s)?0:this.s,t=this.l,n=t+(t<.5?t:1-t)*e,r=2*t-n;return new Sl(YF(i>=240?i-240:i+120,r,n),YF(i,r,n),YF(i<120?i+240:i-120,r,n),this.opacity)},clamp(){return new Ou(oQ(this.h),lC(this.s),lC(this.l),uC(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){let i=uC(this.opacity);return`${i===1?"hsl(":"hsla("}${oQ(this.h)}, ${lC(this.s)*100}%, ${lC(this.l)*100}%${i===1?")":`, ${i})`}`}}));function oQ(i){return i=(i||0)%360,i<0?i+360:i}function lC(i){return Math.max(0,Math.min(1,i||0))}function YF(i,e,t){return(i<60?e+(t-e)*i/60:i<180?t:i<240?e+(t-e)*(240-i)/60:e)*255}function ZF(i,e,t,n,r){var s=i*i,o=s*i;return((1-3*i+3*s-o)*e+(4-6*s+3*o)*t+(1+3*i+3*s-3*o)*n+o*r)/6}function cQ(i){var e=i.length-1;return function(t){var n=t<=0?t=0:t>=1?(t=1,e-1):Math.floor(t*e),r=i[n],s=i[n+1],o=n>0?i[n-1]:2*r-s,a=n<e-1?i[n+2]:2*s-r;return ZF((t-n/e)*e,o,r,s,a)}}function uQ(i){var e=i.length;return function(t){var n=Math.floor(((t%=1)<0?++t:t)*e),r=i[(n+e-1)%e],s=i[n%e],o=i[(n+1)%e],a=i[(n+2)%e];return ZF((t-n/e)*e,r,s,o,a)}}var Kb=i=>()=>i;function t2e(i,e){return function(t){return i+t*e}}function n2e(i,e,t){return i=Math.pow(i,t),e=Math.pow(e,t)-i,t=1/t,function(n){return Math.pow(i+n*e,t)}}function hQ(i){return(i=+i)==1?hC:function(e,t){return t-e?n2e(e,t,i):Kb(isNaN(e)?t:e)}}function hC(i,e){var t=e-i;return t?t2e(i,t):Kb(isNaN(i)?e:i)}var KF=(function i(e){var t=hQ(e);function n(r,s){var o=t((r=x_(r)).r,(s=x_(s)).r),a=t(r.g,s.g),l=t(r.b,s.b),c=hC(r.opacity,s.opacity);return function(u){return r.r=o(u),r.g=a(u),r.b=l(u),r.opacity=c(u),r+""}}return n.gamma=i,n})(1);function fQ(i){return function(e){var t=e.length,n=new Array(t),r=new Array(t),s=new Array(t),o,a;for(o=0;o<t;++o)a=x_(e[o]),n[o]=a.r||0,r[o]=a.g||0,s[o]=a.b||0;return n=i(n),r=i(r),s=i(s),a.opacity=1,function(l){return a.r=n(l),a.g=r(l),a.b=s(l),a+""}}}var Yet=fQ(cQ),Zet=fQ(uQ);function fC(i,e){e||(e=[]);var t=i?Math.min(e.length,i.length):0,n=e.slice(),r;return function(s){for(r=0;r<t;++r)n[r]=i[r]*(1-s)+e[r]*s;return n}}function dC(i){return ArrayBuffer.isView(i)&&!(i instanceof DataView)}function QF(i,e){return(dC(e)?fC:JF)(i,e)}function JF(i,e){var t=e?e.length:0,n=i?Math.min(t,i.length):0,r=new Array(n),s=new Array(t),o;for(o=0;o<n;++o)r[o]=xg(i[o],e[o]);for(;o<t;++o)s[o]=e[o];return function(a){for(o=0;o<n;++o)s[o]=r[o](a);return s}}function dQ(i,e){var t=new Date;return i=+i,e=+e,function(n){return t.setTime(i*(1-n)+e*n),t}}function Qh(i,e){return i=+i,e=+e,function(t){return i*(1-t)+e*t}}function pQ(i,e){var t={},n={},r;(i===null||typeof i!="object")&&(i={}),(e===null||typeof e!="object")&&(e={});for(r in e)r in i?t[r]=xg(i[r],e[r]):n[r]=e[r];return function(s){for(r in t)n[r]=t[r](s);return n}}var tB=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,eB=new RegExp(tB.source,"g");function i2e(i){return function(){return i}}function r2e(i){return function(e){return i(e)+""}}function mQ(i,e){var t=tB.lastIndex=eB.lastIndex=0,n,r,s,o=-1,a=[],l=[];for(i=i+"",e=e+"";(n=tB.exec(i))&&(r=eB.exec(e));)(s=r.index)>t&&(s=e.slice(t,s),a[o]?a[o]+=s:a[++o]=s),(n=n[0])===(r=r[0])?a[o]?a[o]+=r:a[++o]=r:(a[++o]=null,l.push({i:o,x:Qh(n,r)})),t=eB.lastIndex;return t<e.length&&(s=e.slice(t),a[o]?a[o]+=s:a[++o]=s),a.length<2?l[0]?r2e(l[0].x):i2e(e):(e=l.length,function(c){for(var u=0,f;u<e;++u)a[(f=l[u]).i]=f.x(c);return a.join("")})}function xg(i,e){var t=typeof e,n;return e==null||t==="boolean"?Kb(e):(t==="number"?Qh:t==="string"?(n=Uu(e))?(e=n,KF):mQ:e instanceof Uu?KF:e instanceof Date?dQ:dC(e)?fC:Array.isArray(e)?JF:typeof e.valueOf!="function"&&typeof e.toString!="function"||isNaN(e)?pQ:Qh)(i,e)}function nB(i,e){return i=+i,e=+e,function(t){return Math.round(i*(1-t)+e*t)}}function iB(i){return function(){return i}}function rB(i){return+i}var AQ=[0,1];function y_(i){return i}function sB(i,e){return(e-=i=+i)?function(t){return(t-i)/e}:iB(isNaN(e)?NaN:.5)}function s2e(i,e){var t;return i>e&&(t=i,i=e,e=t),function(n){return Math.max(i,Math.min(e,n))}}function o2e(i,e,t){var n=i[0],r=i[1],s=e[0],o=e[1];return r<n?(n=sB(r,n),s=t(o,s)):(n=sB(n,r),s=t(s,o)),function(a){return s(n(a))}}function a2e(i,e,t){var n=Math.min(i.length,e.length)-1,r=new Array(n),s=new Array(n),o=-1;for(i[n]<i[0]&&(i=i.slice().reverse(),e=e.slice().reverse());++o<n;)r[o]=sB(i[o],i[o+1]),s[o]=t(e[o],e[o+1]);return function(a){var l=jb(i,a,1,n)-1;return s[l](r[l](a))}}function gQ(i,e){return e.domain(i.domain()).range(i.range()).interpolate(i.interpolate()).clamp(i.clamp()).unknown(i.unknown())}function l2e(){var i=AQ,e=AQ,t=xg,n,r,s,o=y_,a,l,c;function u(){var d=Math.min(i.length,e.length);return o!==y_&&(o=s2e(i[0],i[d-1])),a=d>2?a2e:o2e,l=c=null,f}function f(d){return d==null||isNaN(d=+d)?s:(l||(l=a(i.map(n),e,t)))(n(o(d)))}return f.invert=function(d){return o(r((c||(c=a(e,i.map(n),Qh)))(d)))},f.domain=function(d){return arguments.length?(i=Array.from(d,rB),u()):i.slice()},f.range=function(d){return arguments.length?(e=Array.from(d),u()):e.slice()},f.rangeRound=function(d){return e=Array.from(d),t=nB,u()},f.clamp=function(d){return arguments.length?(o=d?!0:y_,u()):o!==y_},f.interpolate=function(d){return arguments.length?(t=d,u()):t},f.unknown=function(d){return arguments.length?(s=d,f):s},function(d,A){return n=d,r=A,u()}}function oB(){return l2e()(y_,y_)}function vQ(i){return Math.abs(i=Math.round(i))>=1e21?i.toLocaleString("en").replace(/,/g,""):i.toString(10)}function yg(i,e){if(!isFinite(i)||i===0)return null;var t=(i=e?i.toExponential(e-1):i.toExponential()).indexOf("e"),n=i.slice(0,t);return[n.length>1?n[0]+n.slice(2):n,+i.slice(t+1)]}function Jh(i){return i=yg(Math.abs(i)),i?i[1]:NaN}function _Q(i,e){return function(t,n){for(var r=t.length,s=[],o=0,a=i[0],l=0;r>0&&a>0&&(l+a+1>n&&(a=Math.max(1,n-l)),s.push(t.substring(r-=a,r+a)),!((l+=a+1)>n));)a=i[o=(o+1)%i.length];return s.reverse().join(e)}}function xQ(i){return function(e){return e.replace(/[0-9]/g,function(t){return i[+t]})}}var c2e=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function j0(i){if(!(e=c2e.exec(i)))throw new Error("invalid format: "+i);var e;return new pC({fill:e[1],align:e[2],sign:e[3],symbol:e[4],zero:e[5],width:e[6],comma:e[7],precision:e[8]&&e[8].slice(1),trim:e[9],type:e[10]})}j0.prototype=pC.prototype;function pC(i){this.fill=i.fill===void 0?" ":i.fill+"",this.align=i.align===void 0?">":i.align+"",this.sign=i.sign===void 0?"-":i.sign+"",this.symbol=i.symbol===void 0?"":i.symbol+"",this.zero=!!i.zero,this.width=i.width===void 0?void 0:+i.width,this.comma=!!i.comma,this.precision=i.precision===void 0?void 0:+i.precision,this.trim=!!i.trim,this.type=i.type===void 0?"":i.type+""}pC.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(this.width===void 0?"":Math.max(1,this.width|0))+(this.comma?",":"")+(this.precision===void 0?"":"."+Math.max(0,this.precision|0))+(this.trim?"~":"")+this.type};function yQ(i){e:for(var e=i.length,t=1,n=-1,r;t<e;++t)switch(i[t]){case".":n=r=t;break;case"0":n===0&&(n=t),r=t;break;default:if(!+i[t])break e;n>0&&(n=0);break}return n>0?i.slice(0,n)+i.slice(r+1):i}var Qb;function bQ(i,e){var t=yg(i,e);if(!t)return Qb=void 0,i.toPrecision(e);var n=t[0],r=t[1],s=r-(Qb=Math.max(-8,Math.min(8,Math.floor(r/3)))*3)+1,o=n.length;return s===o?n:s>o?n+new Array(s-o+1).join("0"):s>0?n.slice(0,s)+"."+n.slice(s):"0."+new Array(1-s).join("0")+yg(i,Math.max(0,e+s-1))[0]}function aB(i,e){var t=yg(i,e);if(!t)return i+"";var n=t[0],r=t[1];return r<0?"0."+new Array(-r).join("0")+n:n.length>r+1?n.slice(0,r+1)+"."+n.slice(r+1):n+new Array(r-n.length+2).join("0")}var lB={"%":(i,e)=>(i*100).toFixed(e),b:i=>Math.round(i).toString(2),c:i=>i+"",d:vQ,e:(i,e)=>i.toExponential(e),f:(i,e)=>i.toFixed(e),g:(i,e)=>i.toPrecision(e),o:i=>Math.round(i).toString(8),p:(i,e)=>aB(i*100,e),r:aB,s:bQ,X:i=>Math.round(i).toString(16).toUpperCase(),x:i=>Math.round(i).toString(16)};function cB(i){return i}var wQ=Array.prototype.map,SQ=["y","z","a","f","p","n","\xB5","m","","k","M","G","T","P","E","Z","Y"];function TQ(i){var e=i.grouping===void 0||i.thousands===void 0?cB:_Q(wQ.call(i.grouping,Number),i.thousands+""),t=i.currency===void 0?"":i.currency[0]+"",n=i.currency===void 0?"":i.currency[1]+"",r=i.decimal===void 0?".":i.decimal+"",s=i.numerals===void 0?cB:xQ(wQ.call(i.numerals,String)),o=i.percent===void 0?"%":i.percent+"",a=i.minus===void 0?"\u2212":i.minus+"",l=i.nan===void 0?"NaN":i.nan+"";function c(f,d){f=j0(f);var A=f.fill,y=f.align,w=f.sign,S=f.symbol,T=f.zero,R=f.width,I=f.comma,P=f.precision,F=f.trim,D=f.type;D==="n"?(I=!0,D="g"):lB[D]||(P===void 0&&(P=12),F=!0,D="g"),(T||A==="0"&&y==="=")&&(T=!0,A="0",y="=");var L=(d&&d.prefix!==void 0?d.prefix:"")+(S==="$"?t:S==="#"&&/[boxX]/.test(D)?"0"+D.toLowerCase():""),C=(S==="$"?n:/[%p]/.test(D)?o:"")+(d&&d.suffix!==void 0?d.suffix:""),B=lB[D],k=/[defgprs%]/.test(D);P=P===void 0?6:/[gprs]/.test(D)?Math.max(1,Math.min(21,P)):Math.max(0,Math.min(20,P));function z(G){var W=L,Y=C,H,$,J;if(D==="c")Y=B(G)+Y,G="";else{G=+G;var te=G<0||1/G<0;if(G=isNaN(G)?l:B(Math.abs(G),P),F&&(G=yQ(G)),te&&+G==0&&w!=="+"&&(te=!1),W=(te?w==="("?w:a:w==="-"||w==="("?"":w)+W,Y=(D==="s"&&!isNaN(G)&&Qb!==void 0?SQ[8+Qb/3]:"")+Y+(te&&w==="("?")":""),k){for(H=-1,$=G.length;++H<$;)if(J=G.charCodeAt(H),48>J||J>57){Y=(J===46?r+G.slice(H+1):G.slice(H))+Y,G=G.slice(0,H);break}}}I&&!T&&(G=e(G,1/0));var ce=W.length+G.length+Y.length,he=ce<R?new Array(R-ce+1).join(A):"";switch(I&&T&&(G=e(he+G,he.length?R-Y.length:1/0),he=""),y){case"<":G=W+G+Y+he;break;case"=":G=W+he+G+Y;break;case"^":G=he.slice(0,ce=he.length>>1)+W+G+Y+he.slice(ce);break;default:G=he+W+G+Y;break}return s(G)}return z.toString=function(){return f+""},z}function u(f,d){var A=Math.max(-8,Math.min(8,Math.floor(Jh(d)/3)))*3,y=Math.pow(10,-A),w=c((f=j0(f),f.type="f",f),{suffix:SQ[8+A/3]});return function(S){return w(y*S)}}return{format:c,formatPrefix:u}}var mC,AC,gC;uB({thousands:",",grouping:[3],currency:["$",""]});function uB(i){return mC=TQ(i),AC=mC.format,gC=mC.formatPrefix,mC}function hB(i){return Math.max(0,-Jh(Math.abs(i)))}function fB(i,e){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(Jh(e)/3)))*3-Jh(Math.abs(i)))}function dB(i,e){return i=Math.abs(i),e=Math.abs(e)-i,Math.max(0,Jh(e)-Jh(i))+1}function pB(i,e,t,n){var r=XF(i,e,t),s;switch(n=j0(n??",f"),n.type){case"s":{var o=Math.max(Math.abs(i),Math.abs(e));return n.precision==null&&!isNaN(s=fB(r,o))&&(n.precision=s),gC(n,o)}case"":case"e":case"g":case"p":case"r":{n.precision==null&&!isNaN(s=dB(r,Math.max(Math.abs(i),Math.abs(e))))&&(n.precision=s-(n.type==="e"));break}case"f":case"%":{n.precision==null&&!isNaN(s=hB(r))&&(n.precision=s-(n.type==="%")*2);break}}return AC(n)}function mB(i){var e=i.domain;return i.ticks=function(t){var n=e();return tC(n[0],n[n.length-1],t??10)},i.tickFormat=function(t,n){var r=e();return pB(r[0],r[r.length-1],t??10,n)},i.nice=function(t){t==null&&(t=10);var n=e(),r=0,s=n.length-1,o=n[r],a=n[s],l,c,u=10;for(a<o&&(c=o,o=a,a=c,c=r,r=s,s=c);u-- >0;){if(c=Xb(o,a,t),c===l)return n[r]=o,n[s]=a,e(n);if(c>0)o=Math.floor(o/c)*c,a=Math.ceil(a/c)*c;else if(c<0)o=Math.ceil(o*c)/c,a=Math.floor(a*c)/c;else break;l=c}return i},i}function Tl(){var i=oB();return i.copy=function(){return gQ(i,Tl())},sC.apply(i,arguments),mB(i)}function Jb(){var i=0,e=1,t=1,n=[.5],r=[0,1],s;function o(l){return l!=null&&l<=l?r[jb(n,l,0,t)]:s}function a(){var l=-1;for(n=new Array(t);++l<t;)n[l]=((l+1)*e-(l-t)*i)/(t+1);return o}return o.domain=function(l){return arguments.length?([i,e]=l,i=+i,e=+e,a()):[i,e]},o.range=function(l){return arguments.length?(t=(r=Array.from(l)).length-1,a()):r.slice()},o.invertExtent=function(l){var c=r.indexOf(l);return c<0?[NaN,NaN]:c<1?[i,n[0]]:c>=t?[n[t-1],e]:[n[c-1],n[c]]},o.unknown=function(l){return arguments.length&&(s=l),o},o.thresholds=function(){return n.slice()},o.copy=function(){return Jb().domain([i,e]).range(r).unknown(s)},sC.apply(mB(o),arguments)}var In=1e-6,bg=1e-12,ri=Math.PI,yo=ri/2,b_=ri/4,bo=ri*2,ur=180/ri,_n=ri/180,si=Math.abs,w_=Math.atan,Ms=Math.atan2,mn=Math.cos,ew=Math.ceil,EQ=Math.exp;var vC=Math.hypot,MQ=Math.log;var un=Math.sin,CQ=Math.sign||function(i){return i>0?1:i<0?-1:0},Wo=Math.sqrt,RQ=Math.tan;function PQ(i){return i>1?0:i<-1?ri:Math.acos(i)}function da(i){return i>1?yo:i<-1?-yo:Math.asin(i)}function AB(i){return(i=un(i/2))*i}function ms(){}function _C(i,e){i&&LQ.hasOwnProperty(i.type)&&LQ[i.type](i,e)}var IQ={Feature:function(i,e){_C(i.geometry,e)},FeatureCollection:function(i,e){for(var t=i.features,n=-1,r=t.length;++n<r;)_C(t[n].geometry,e)}},LQ={Sphere:function(i,e){e.sphere()},Point:function(i,e){i=i.coordinates,e.point(i[0],i[1],i[2])},MultiPoint:function(i,e){for(var t=i.coordinates,n=-1,r=t.length;++n<r;)i=t[n],e.point(i[0],i[1],i[2])},LineString:function(i,e){gB(i.coordinates,e,0)},MultiLineString:function(i,e){for(var t=i.coordinates,n=-1,r=t.length;++n<r;)gB(t[n],e,0)},Polygon:function(i,e){DQ(i.coordinates,e)},MultiPolygon:function(i,e){for(var t=i.coordinates,n=-1,r=t.length;++n<r;)DQ(t[n],e)},GeometryCollection:function(i,e){for(var t=i.geometries,n=-1,r=t.length;++n<r;)_C(t[n],e)}};function gB(i,e,t){var n=-1,r=i.length-t,s;for(e.lineStart();++n<r;)s=i[n],e.point(s[0],s[1],s[2]);e.lineEnd()}function DQ(i,e){var t=-1,n=i.length;for(e.polygonStart();++t<n;)gB(i[t],e,1);e.polygonEnd()}function X0(i,e){i&&IQ.hasOwnProperty(i.type)?IQ[i.type](i,e):_C(i,e)}var tw=new Ho,NQ=new Ho,FQ,BQ,vB,_B,xB,ef={point:ms,lineStart:ms,lineEnd:ms,polygonStart:function(){tw=new Ho,ef.lineStart=u2e,ef.lineEnd=h2e},polygonEnd:function(){var i=+tw;NQ.add(i<0?bo+i:i),this.lineStart=this.lineEnd=this.point=ms},sphere:function(){NQ.add(bo)}};function u2e(){ef.point=f2e}function h2e(){OQ(FQ,BQ)}function f2e(i,e){ef.point=OQ,FQ=i,BQ=e,i*=_n,e*=_n,vB=i,_B=mn(e=e/2+b_),xB=un(e)}function OQ(i,e){i*=_n,e*=_n,e=e/2+b_;var t=i-vB,n=t>=0?1:-1,r=n*t,s=mn(e),o=un(e),a=xB*o,l=_B*s+a*mn(r),c=a*n*un(r);tw.add(Ms(c,l)),vB=i,_B=s,xB=o}function wg(i){return[Ms(i[1],i[0]),da(i[2])]}function Wc(i){var e=i[0],t=i[1],n=mn(t);return[n*mn(e),n*un(e),un(t)]}function nw(i,e){return i[0]*e[0]+i[1]*e[1]+i[2]*e[2]}function Ud(i,e){return[i[1]*e[2]-i[2]*e[1],i[2]*e[0]-i[0]*e[2],i[0]*e[1]-i[1]*e[0]]}function xC(i,e){i[0]+=e[0],i[1]+=e[1],i[2]+=e[2]}function iw(i,e){return[i[0]*e,i[1]*e,i[2]*e]}function Sg(i){var e=Wo(i[0]*i[0]+i[1]*i[1]+i[2]*i[2]);i[0]/=e,i[1]/=e,i[2]/=e}var es,El,As,ic,Tg,VQ,GQ,S_,rw,$0,zd,kd={point:yB,lineStart:UQ,lineEnd:kQ,polygonStart:function(){kd.point=HQ,kd.lineStart=d2e,kd.lineEnd=p2e,rw=new Ho,ef.polygonStart()},polygonEnd:function(){ef.polygonEnd(),kd.point=yB,kd.lineStart=UQ,kd.lineEnd=kQ,tw<0?(es=-(As=180),El=-(ic=90)):rw>In?ic=90:rw<-In&&(El=-90),zd[0]=es,zd[1]=As},sphere:function(){es=-(As=180),El=-(ic=90)}};function yB(i,e){$0.push(zd=[es=i,As=i]),e<El&&(El=e),e>ic&&(ic=e)}function qQ(i,e){var t=Wc([i*_n,e*_n]);if(S_){var n=Ud(S_,t),r=[n[1],-n[0],0],s=Ud(r,n);Sg(s),s=wg(s);var o=i-Tg,a=o>0?1:-1,l=s[0]*ur*a,c,u=si(o)>180;u^(a*Tg<l&&l<a*i)?(c=s[1]*ur,c>ic&&(ic=c)):(l=(l+360)%360-180,u^(a*Tg<l&&l<a*i)?(c=-s[1]*ur,c<El&&(El=c)):(e<El&&(El=e),e>ic&&(ic=e))),u?i<Tg?nc(es,i)>nc(es,As)&&(As=i):nc(i,As)>nc(es,As)&&(es=i):As>=es?(i<es&&(es=i),i>As&&(As=i)):i>Tg?nc(es,i)>nc(es,As)&&(As=i):nc(i,As)>nc(es,As)&&(es=i)}else $0.push(zd=[es=i,As=i]);e<El&&(El=e),e>ic&&(ic=e),S_=t,Tg=i}function UQ(){kd.point=qQ}function kQ(){zd[0]=es,zd[1]=As,kd.point=yB,S_=null}function HQ(i,e){if(S_){var t=i-Tg;rw.add(si(t)>180?t+(t>0?360:-360):t)}else VQ=i,GQ=e;ef.point(i,e),qQ(i,e)}function d2e(){ef.lineStart()}function p2e(){HQ(VQ,GQ),ef.lineEnd(),si(rw)>In&&(es=-(As=180)),zd[0]=es,zd[1]=As,S_=null}function nc(i,e){return(e-=i)<0?e+360:e}function m2e(i,e){return i[0]-e[0]}function zQ(i,e){return i[0]<=i[1]?i[0]<=e&&e<=i[1]:e<i[0]||i[1]<e}function yC(i){var e,t,n,r,s,o,a;if(ic=As=-(es=El=1/0),$0=[],X0(i,kd),t=$0.length){for($0.sort(m2e),e=1,n=$0[0],s=[n];e<t;++e)r=$0[e],zQ(n,r[0])||zQ(n,r[1])?(nc(n[0],r[1])>nc(n[0],n[1])&&(n[1]=r[1]),nc(r[0],n[1])>nc(n[0],n[1])&&(n[0]=r[0])):s.push(n=r);for(o=-1/0,t=s.length-1,e=0,n=s[t];e<=t;n=r,++e)r=s[e],(a=nc(n[1],r[0]))>o&&(o=a,es=r[0],As=n[1])}return $0=zd=null,es===1/0||El===1/0?[[NaN,NaN],[NaN,NaN]]:[[es,El],[As,ic]]}var sw,bC,wC,SC,TC,EC,MC,CC,bB,wB,SB,XQ,$Q,Wa,ja,Xa,ku={sphere:ms,point:TB,lineStart:WQ,lineEnd:jQ,polygonStart:function(){ku.lineStart=v2e,ku.lineEnd=_2e},polygonEnd:function(){ku.lineStart=WQ,ku.lineEnd=jQ}};function TB(i,e){i*=_n,e*=_n;var t=mn(e);ow(t*mn(i),t*un(i),un(e))}function ow(i,e,t){++sw,wC+=(i-wC)/sw,SC+=(e-SC)/sw,TC+=(t-TC)/sw}function WQ(){ku.point=A2e}function A2e(i,e){i*=_n,e*=_n;var t=mn(e);Wa=t*mn(i),ja=t*un(i),Xa=un(e),ku.point=g2e,ow(Wa,ja,Xa)}function g2e(i,e){i*=_n,e*=_n;var t=mn(e),n=t*mn(i),r=t*un(i),s=un(e),o=Ms(Wo((o=ja*s-Xa*r)*o+(o=Xa*n-Wa*s)*o+(o=Wa*r-ja*n)*o),Wa*n+ja*r+Xa*s);bC+=o,EC+=o*(Wa+(Wa=n)),MC+=o*(ja+(ja=r)),CC+=o*(Xa+(Xa=s)),ow(Wa,ja,Xa)}function jQ(){ku.point=TB}function v2e(){ku.point=x2e}function _2e(){YQ(XQ,$Q),ku.point=TB}function x2e(i,e){XQ=i,$Q=e,i*=_n,e*=_n,ku.point=YQ;var t=mn(e);Wa=t*mn(i),ja=t*un(i),Xa=un(e),ow(Wa,ja,Xa)}function YQ(i,e){i*=_n,e*=_n;var t=mn(e),n=t*mn(i),r=t*un(i),s=un(e),o=ja*s-Xa*r,a=Xa*n-Wa*s,l=Wa*r-ja*n,c=vC(o,a,l),u=da(c),f=c&&-u/c;bB.add(f*o),wB.add(f*a),SB.add(f*l),bC+=u,EC+=u*(Wa+(Wa=n)),MC+=u*(ja+(ja=r)),CC+=u*(Xa+(Xa=s)),ow(Wa,ja,Xa)}function RC(i){sw=bC=wC=SC=TC=EC=MC=CC=0,bB=new Ho,wB=new Ho,SB=new Ho,X0(i,ku);var e=+bB,t=+wB,n=+SB,r=vC(e,t,n);return r<bg&&(e=EC,t=MC,n=CC,bC<In&&(e=wC,t=SC,n=TC),r=vC(e,t,n),r<bg)?[NaN,NaN]:[Ms(t,e)*ur,da(n/r)*ur]}function aw(i,e){function t(n,r){return n=i(n,r),e(n[0],n[1])}return i.invert&&e.invert&&(t.invert=function(n,r){return n=e.invert(n,r),n&&i.invert(n[0],n[1])}),t}function EB(i,e){return si(i)>ri&&(i-=Math.round(i/bo)*bo),[i,e]}EB.invert=EB;function MB(i,e,t){return(i%=bo)?e||t?aw(KQ(i),QQ(e,t)):KQ(i):e||t?QQ(e,t):EB}function ZQ(i){return function(e,t){return e+=i,si(e)>ri&&(e-=Math.round(e/bo)*bo),[e,t]}}function KQ(i){var e=ZQ(i);return e.invert=ZQ(-i),e}function QQ(i,e){var t=mn(i),n=un(i),r=mn(e),s=un(e);function o(a,l){var c=mn(l),u=mn(a)*c,f=un(a)*c,d=un(l),A=d*t+u*n;return[Ms(f*r-A*s,u*t-d*n),da(A*r+f*s)]}return o.invert=function(a,l){var c=mn(l),u=mn(a)*c,f=un(a)*c,d=un(l),A=d*r-f*s;return[Ms(f*r+d*s,u*t+A*n),da(A*t-u*n)]},o}function CB(i){i=MB(i[0]*_n,i[1]*_n,i.length>2?i[2]*_n:0);function e(t){return t=i(t[0]*_n,t[1]*_n),t[0]*=ur,t[1]*=ur,t}return e.invert=function(t){return t=i.invert(t[0]*_n,t[1]*_n),t[0]*=ur,t[1]*=ur,t},e}function eJ(i,e,t,n,r,s){if(t){var o=mn(e),a=un(e),l=n*t;r==null?(r=e+n*bo,s=e-l/2):(r=JQ(o,r),s=JQ(o,s),(n>0?r<s:r>s)&&(r+=n*bo));for(var c,u=r;n>0?u>s:u<s;u-=l)c=wg([o,-a*mn(u),-a*un(u)]),i.point(c[0],c[1])}}function JQ(i,e){e=Wc(e),e[0]-=i,Sg(e);var t=PQ(-e[1]);return((-e[2]<0?-t:t)+bo-In)%bo}function PC(){var i=[],e;return{point:function(t,n,r){e.push([t,n,r])},lineStart:function(){i.push(e=[])},lineEnd:ms,rejoin:function(){i.length>1&&i.push(i.pop().concat(i.shift()))},result:function(){var t=i;return i=[],e=null,t}}}function T_(i,e){return si(i[0]-e[0])<In&&si(i[1]-e[1])<In}function IC(i,e,t,n){this.x=i,this.z=e,this.o=t,this.e=n,this.v=!1,this.n=this.p=null}function LC(i,e,t,n,r){var s=[],o=[],a,l;if(i.forEach(function(y){if(!((w=y.length-1)<=0)){var w,S=y[0],T=y[w],R;if(T_(S,T)){if(!S[2]&&!T[2]){for(r.lineStart(),a=0;a<w;++a)r.point((S=y[a])[0],S[1]);r.lineEnd();return}T[0]+=2*In}s.push(R=new IC(S,y,null,!0)),o.push(R.o=new IC(S,null,R,!1)),s.push(R=new IC(T,y,null,!1)),o.push(R.o=new IC(T,null,R,!0))}}),!!s.length){for(o.sort(e),tJ(s),tJ(o),a=0,l=o.length;a<l;++a)o[a].e=t=!t;for(var c=s[0],u,f;;){for(var d=c,A=!0;d.v;)if((d=d.n)===c)return;u=d.z,r.lineStart();do{if(d.v=d.o.v=!0,d.e){if(A)for(a=0,l=u.length;a<l;++a)r.point((f=u[a])[0],f[1]);else n(d.x,d.n.x,1,r);d=d.n}else{if(A)for(u=d.p.z,a=u.length-1;a>=0;--a)r.point((f=u[a])[0],f[1]);else n(d.x,d.p.x,-1,r);d=d.p}d=d.o,u=d.z,A=!A}while(!d.v);r.lineEnd()}}}function tJ(i){if(e=i.length){for(var e,t=0,n=i[0],r;++t<e;)n.n=r=i[t],r.p=n,n=r;n.n=r=i[0],r.p=n}}function RB(i){return si(i[0])<=ri?i[0]:CQ(i[0])*((si(i[0])+ri)%bo-ri)}function DC(i,e){var t=RB(e),n=e[1],r=un(n),s=[un(t),-mn(t),0],o=0,a=0,l=new Ho;r===1?n=yo+In:r===-1&&(n=-yo-In);for(var c=0,u=i.length;c<u;++c)if(d=(f=i[c]).length)for(var f,d,A=f[d-1],y=RB(A),w=A[1]/2+b_,S=un(w),T=mn(w),R=0;R<d;++R,y=P,S=D,T=L,A=I){var I=f[R],P=RB(I),F=I[1]/2+b_,D=un(F),L=mn(F),C=P-y,B=C>=0?1:-1,k=B*C,z=k>ri,G=S*D;if(l.add(Ms(G*B*un(k),T*L+G*mn(k))),o+=z?C+B*bo:C,z^y>=t^P>=t){var W=Ud(Wc(A),Wc(I));Sg(W);var Y=Ud(s,W);Sg(Y);var H=(z^C>=0?-1:1)*da(Y[2]);(n>H||n===H&&(W[0]||W[1]))&&(a+=z^C>=0?1:-1)}}return(o<-In||o<In&&l<-bg)^a&1}function NC(i,e,t,n){return function(r){var s=e(r),o=PC(),a=e(o),l=!1,c,u,f,d={point:A,lineStart:w,lineEnd:S,polygonStart:function(){d.point=T,d.lineStart=R,d.lineEnd=I,u=[],c=[]},polygonEnd:function(){d.point=A,d.lineStart=w,d.lineEnd=S,u=Zh(u);var P=DC(c,n);u.length?(l||(r.polygonStart(),l=!0),LC(u,b2e,P,t,r)):P&&(l||(r.polygonStart(),l=!0),r.lineStart(),t(null,null,1,r),r.lineEnd()),l&&(r.polygonEnd(),l=!1),u=c=null},sphere:function(){r.polygonStart(),r.lineStart(),t(null,null,1,r),r.lineEnd(),r.polygonEnd()}};function A(P,F){i(P,F)&&r.point(P,F)}function y(P,F){s.point(P,F)}function w(){d.point=y,s.lineStart()}function S(){d.point=A,s.lineEnd()}function T(P,F){f.push([P,F]),a.point(P,F)}function R(){a.lineStart(),f=[]}function I(){T(f[0][0],f[0][1]),a.lineEnd();var P=a.clean(),F=o.result(),D,L=F.length,C,B,k;if(f.pop(),c.push(f),f=null,!!L){if(P&1){if(B=F[0],(C=B.length-1)>0){for(l||(r.polygonStart(),l=!0),r.lineStart(),D=0;D<C;++D)r.point((k=B[D])[0],k[1]);r.lineEnd()}return}L>1&&P&2&&F.push(F.pop().concat(F.shift())),u.push(F.filter(y2e))}}return d}}function y2e(i){return i.length>1}function b2e(i,e){return((i=i.x)[0]<0?i[1]-yo-In:yo-i[1])-((e=e.x)[0]<0?e[1]-yo-In:yo-e[1])}var PB=NC(function(){return!0},w2e,T2e,[-ri,-yo]);function w2e(i){var e=NaN,t=NaN,n=NaN,r;return{lineStart:function(){i.lineStart(),r=1},point:function(s,o){var a=s>0?ri:-ri,l=si(s-e);si(l-ri)<In?(i.point(e,t=(t+o)/2>0?yo:-yo),i.point(n,t),i.lineEnd(),i.lineStart(),i.point(a,t),i.point(s,t),r=0):n!==a&&l>=ri&&(si(e-n)<In&&(e-=n*In),si(s-a)<In&&(s-=a*In),t=S2e(e,t,s,o),i.point(n,t),i.lineEnd(),i.lineStart(),i.point(a,t),r=0),i.point(e=s,t=o),n=a},lineEnd:function(){i.lineEnd(),e=t=NaN},clean:function(){return 2-r}}}function S2e(i,e,t,n){var r,s,o=un(i-t);return si(o)>In?w_((un(e)*(s=mn(n))*un(t)-un(n)*(r=mn(e))*un(i))/(r*s*o)):(e+n)/2}function T2e(i,e,t,n){var r;if(i==null)r=t*yo,n.point(-ri,r),n.point(0,r),n.point(ri,r),n.point(ri,0),n.point(ri,-r),n.point(0,-r),n.point(-ri,-r),n.point(-ri,0),n.point(-ri,r);else if(si(i[0]-e[0])>In){var s=i[0]<e[0]?ri:-ri;r=t*s/2,n.point(-s,r),n.point(0,r),n.point(s,r)}else n.point(e[0],e[1])}function nJ(i){var e=mn(i),t=2*_n,n=e>0,r=si(e)>In;function s(u,f,d,A){eJ(A,i,t,d,u,f)}function o(u,f){return mn(u)*mn(f)>e}function a(u){var f,d,A,y,w;return{lineStart:function(){y=A=!1,w=1},point:function(S,T){var R=[S,T],I,P=o(S,T),F=n?P?0:c(S,T):P?c(S+(S<0?ri:-ri),T):0;if(!f&&(y=A=P)&&u.lineStart(),P!==A&&(I=l(f,R),(!I||T_(f,I)||T_(R,I))&&(R[2]=1)),P!==A)w=0,P?(u.lineStart(),I=l(R,f),u.point(I[0],I[1])):(I=l(f,R),u.point(I[0],I[1],2),u.lineEnd()),f=I;else if(r&&f&&n^P){var D;!(F&d)&&(D=l(R,f,!0))&&(w=0,n?(u.lineStart(),u.point(D[0][0],D[0][1]),u.point(D[1][0],D[1][1]),u.lineEnd()):(u.point(D[1][0],D[1][1]),u.lineEnd(),u.lineStart(),u.point(D[0][0],D[0][1],3)))}P&&(!f||!T_(f,R))&&u.point(R[0],R[1]),f=R,A=P,d=F},lineEnd:function(){A&&u.lineEnd(),f=null},clean:function(){return w|(y&&A)<<1}}}function l(u,f,d){var A=Wc(u),y=Wc(f),w=[1,0,0],S=Ud(A,y),T=nw(S,S),R=S[0],I=T-R*R;if(!I)return!d&&u;var P=e*T/I,F=-e*R/I,D=Ud(w,S),L=iw(w,P),C=iw(S,F);xC(L,C);var B=D,k=nw(L,B),z=nw(B,B),G=k*k-z*(nw(L,L)-1);if(!(G<0)){var W=Wo(G),Y=iw(B,(-k-W)/z);if(xC(Y,L),Y=wg(Y),!d)return Y;var H=u[0],$=f[0],J=u[1],te=f[1],ce;$<H&&(ce=H,H=$,$=ce);var he=$-H,ve=si(he-ri)<In,Re=ve||he<In;if(!ve&&te<J&&(ce=J,J=te,te=ce),Re?ve?J+te>0^Y[1]<(si(Y[0]-H)<In?J:te):J<=Y[1]&&Y[1]<=te:he>ri^(H<=Y[0]&&Y[0]<=$)){var Qe=iw(B,(-k+W)/z);return xC(Qe,L),[Y,wg(Qe)]}}}function c(u,f){var d=n?i:ri-i,A=0;return u<-d?A|=1:u>d&&(A|=2),f<-d?A|=4:f>d&&(A|=8),A}return NC(o,a,s,n?[0,-i]:[-ri,i-ri])}function iJ(i,e,t,n,r,s){var o=i[0],a=i[1],l=e[0],c=e[1],u=0,f=1,d=l-o,A=c-a,y;if(y=t-o,!(!d&&y>0)){if(y/=d,d<0){if(y<u)return;y<f&&(f=y)}else if(d>0){if(y>f)return;y>u&&(u=y)}if(y=r-o,!(!d&&y<0)){if(y/=d,d<0){if(y>f)return;y>u&&(u=y)}else if(d>0){if(y<u)return;y<f&&(f=y)}if(y=n-a,!(!A&&y>0)){if(y/=A,A<0){if(y<u)return;y<f&&(f=y)}else if(A>0){if(y>f)return;y>u&&(u=y)}if(y=s-a,!(!A&&y<0)){if(y/=A,A<0){if(y>f)return;y>u&&(u=y)}else if(A>0){if(y<u)return;y<f&&(f=y)}return u>0&&(i[0]=o+u*d,i[1]=a+u*A),f<1&&(e[0]=o+f*d,e[1]=a+f*A),!0}}}}}var lw=1e9,FC=-lw;function IB(i,e,t,n){function r(c,u){return i<=c&&c<=t&&e<=u&&u<=n}function s(c,u,f,d){var A=0,y=0;if(c==null||(A=o(c,f))!==(y=o(u,f))||l(c,u)<0^f>0)do d.point(A===0||A===3?i:t,A>1?n:e);while((A=(A+f+4)%4)!==y);else d.point(u[0],u[1])}function o(c,u){return si(c[0]-i)<In?u>0?0:3:si(c[0]-t)<In?u>0?2:1:si(c[1]-e)<In?u>0?1:0:u>0?3:2}function a(c,u){return l(c.x,u.x)}function l(c,u){var f=o(c,1),d=o(u,1);return f!==d?f-d:f===0?u[1]-c[1]:f===1?c[0]-u[0]:f===2?c[1]-u[1]:u[0]-c[0]}return function(c){var u=c,f=PC(),d,A,y,w,S,T,R,I,P,F,D,L={point:C,lineStart:G,lineEnd:W,polygonStart:k,polygonEnd:z};function C(H,$){r(H,$)&&u.point(H,$)}function B(){for(var H=0,$=0,J=A.length;$<J;++$)for(var te=A[$],ce=1,he=te.length,ve=te[0],Re,Qe,Fe=ve[0],mt=ve[1];ce<he;++ce)Re=Fe,Qe=mt,ve=te[ce],Fe=ve[0],mt=ve[1],Qe<=n?mt>n&&(Fe-Re)*(n-Qe)>(mt-Qe)*(i-Re)&&++H:mt<=n&&(Fe-Re)*(n-Qe)<(mt-Qe)*(i-Re)&&--H;return H}function k(){u=f,d=[],A=[],D=!0}function z(){var H=B(),$=D&&H,J=(d=Zh(d)).length;($||J)&&(c.polygonStart(),$&&(c.lineStart(),s(null,null,1,c),c.lineEnd()),J&&LC(d,a,H,s,c),c.polygonEnd()),u=c,d=A=y=null}function G(){L.point=Y,A&&A.push(y=[]),F=!0,P=!1,R=I=NaN}function W(){d&&(Y(w,S),T&&P&&f.rejoin(),d.push(f.result())),L.point=C,P&&u.lineEnd()}function Y(H,$){var J=r(H,$);if(A&&y.push([H,$]),F)w=H,S=$,T=J,F=!1,J&&(u.lineStart(),u.point(H,$));else if(J&&P)u.point(H,$);else{var te=[R=Math.max(FC,Math.min(lw,R)),I=Math.max(FC,Math.min(lw,I))],ce=[H=Math.max(FC,Math.min(lw,H)),$=Math.max(FC,Math.min(lw,$))];iJ(te,ce,i,e,t,n)?(P||(u.lineStart(),u.point(te[0],te[1])),u.point(ce[0],ce[1]),J||u.lineEnd(),D=!1):J&&(u.lineStart(),u.point(H,$),D=!1)}R=H,I=$,P=J}return L}}var LB,DB,BC,OC,E_={sphere:ms,point:ms,lineStart:E2e,lineEnd:ms,polygonStart:ms,polygonEnd:ms};function E2e(){E_.point=C2e,E_.lineEnd=M2e}function M2e(){E_.point=E_.lineEnd=ms}function C2e(i,e){i*=_n,e*=_n,DB=i,BC=un(e),OC=mn(e),E_.point=R2e}function R2e(i,e){i*=_n,e*=_n;var t=un(e),n=mn(e),r=si(i-DB),s=mn(r),o=un(r),a=n*o,l=OC*t-BC*n*s,c=BC*t+OC*n*s;LB.add(Ms(Wo(a*a+l*l),c)),DB=i,BC=t,OC=n}function rJ(i){return LB=new Ho,X0(i,E_),+LB}var NB=[null,null],P2e={type:"LineString",coordinates:NB};function Ml(i,e){return NB[0]=i,NB[1]=e,rJ(P2e)}var sJ={Feature:function(i,e){return UC(i.geometry,e)},FeatureCollection:function(i,e){for(var t=i.features,n=-1,r=t.length;++n<r;)if(UC(t[n].geometry,e))return!0;return!1}},oJ={Sphere:function(){return!0},Point:function(i,e){return aJ(i.coordinates,e)},MultiPoint:function(i,e){for(var t=i.coordinates,n=-1,r=t.length;++n<r;)if(aJ(t[n],e))return!0;return!1},LineString:function(i,e){return lJ(i.coordinates,e)},MultiLineString:function(i,e){for(var t=i.coordinates,n=-1,r=t.length;++n<r;)if(lJ(t[n],e))return!0;return!1},Polygon:function(i,e){return cJ(i.coordinates,e)},MultiPolygon:function(i,e){for(var t=i.coordinates,n=-1,r=t.length;++n<r;)if(cJ(t[n],e))return!0;return!1},GeometryCollection:function(i,e){for(var t=i.geometries,n=-1,r=t.length;++n<r;)if(UC(t[n],e))return!0;return!1}};function UC(i,e){return i&&oJ.hasOwnProperty(i.type)?oJ[i.type](i,e):!1}function aJ(i,e){return Ml(i,e)===0}function lJ(i,e){for(var t,n,r,s=0,o=i.length;s<o;s++){if(n=Ml(i[s],e),n===0||s>0&&(r=Ml(i[s],i[s-1]),r>0&&t<=r&&n<=r&&(t+n-r)*(1-Math.pow((t-n)/r,2))<bg*r))return!0;t=n}return!1}function cJ(i,e){return!!DC(i.map(I2e),uJ(e))}function I2e(i){return i=i.map(uJ),i.pop(),i}function uJ(i){return[i[0]*_n,i[1]*_n]}function FB(i,e){return(i&&sJ.hasOwnProperty(i.type)?sJ[i.type]:UC)(i,e)}function hJ(i,e,t){var n=Od(i,e-In,t).concat(e);return function(r){return n.map(function(s){return[r,s]})}}function fJ(i,e,t){var n=Od(i,e-In,t).concat(e);return function(r){return n.map(function(s){return[s,r]})}}function BB(){var i,e,t,n,r,s,o,a,l=10,c=l,u=90,f=360,d,A,y,w,S=2.5;function T(){return{type:"MultiLineString",coordinates:R()}}function R(){return Od(ew(n/u)*u,t,u).map(y).concat(Od(ew(a/f)*f,o,f).map(w)).concat(Od(ew(e/l)*l,i,l).filter(function(I){return si(I%u)>In}).map(d)).concat(Od(ew(s/c)*c,r,c).filter(function(I){return si(I%f)>In}).map(A))}return T.lines=function(){return R().map(function(I){return{type:"LineString",coordinates:I}})},T.outline=function(){return{type:"Polygon",coordinates:[y(n).concat(w(o).slice(1),y(t).reverse().slice(1),w(a).reverse().slice(1))]}},T.extent=function(I){return arguments.length?T.extentMajor(I).extentMinor(I):T.extentMinor()},T.extentMajor=function(I){return arguments.length?(n=+I[0][0],t=+I[1][0],a=+I[0][1],o=+I[1][1],n>t&&(I=n,n=t,t=I),a>o&&(I=a,a=o,o=I),T.precision(S)):[[n,a],[t,o]]},T.extentMinor=function(I){return arguments.length?(e=+I[0][0],i=+I[1][0],s=+I[0][1],r=+I[1][1],e>i&&(I=e,e=i,i=I),s>r&&(I=s,s=r,r=I),T.precision(S)):[[e,s],[i,r]]},T.step=function(I){return arguments.length?T.stepMajor(I).stepMinor(I):T.stepMinor()},T.stepMajor=function(I){return arguments.length?(u=+I[0],f=+I[1],T):[u,f]},T.stepMinor=function(I){return arguments.length?(l=+I[0],c=+I[1],T):[l,c]},T.precision=function(I){return arguments.length?(S=+I,d=hJ(s,r,90),A=fJ(e,i,S),y=hJ(a,o,90),w=fJ(n,t,S),T):S},T.extentMajor([[-180,-90+In],[180,90-In]]).extentMinor([[-180,-80-In],[180,80+In]])}function OB(){return BB()()}function Eg(i,e){var t=i[0]*_n,n=i[1]*_n,r=e[0]*_n,s=e[1]*_n,o=mn(n),a=un(n),l=mn(s),c=un(s),u=o*mn(t),f=o*un(t),d=l*mn(r),A=l*un(r),y=2*da(Wo(AB(s-n)+o*l*AB(r-t))),w=un(y),S=y?function(T){var R=un(T*=y)/w,I=un(y-T)/w,P=I*u+R*d,F=I*f+R*A,D=I*a+R*c;return[Ms(F,P)*ur,Ms(D,Wo(P*P+F*F))*ur]}:function(){return[t*ur,n*ur]};return S.distance=y,S}var UB=i=>i;var M_=1/0,kC=M_,cw=-M_,zC=cw,L2e={point:D2e,lineStart:ms,lineEnd:ms,polygonStart:ms,polygonEnd:ms,result:function(){var i=[[M_,kC],[cw,zC]];return cw=zC=-(kC=M_=1/0),i}};function D2e(i,e){i<M_&&(M_=i),i>cw&&(cw=i),e<kC&&(kC=e),e>zC&&(zC=e)}var kB=L2e;function uw(i){return function(e){var t=new zB;for(var n in i)t[n]=i[n];return t.stream=e,t}}function zB(){}zB.prototype={constructor:zB,point:function(i,e){this.stream.point(i,e)},sphere:function(){this.stream.sphere()},lineStart:function(){this.stream.lineStart()},lineEnd:function(){this.stream.lineEnd()},polygonStart:function(){this.stream.polygonStart()},polygonEnd:function(){this.stream.polygonEnd()}};function VB(i,e,t){var n=i.clipExtent&&i.clipExtent();return i.scale(150).translate([0,0]),n!=null&&i.clipExtent(null),X0(t,i.stream(kB)),e(kB.result()),n!=null&&i.clipExtent(n),i}function GB(i,e,t){return VB(i,function(n){var r=e[1][0]-e[0][0],s=e[1][1]-e[0][1],o=Math.min(r/(n[1][0]-n[0][0]),s/(n[1][1]-n[0][1])),a=+e[0][0]+(r-o*(n[1][0]+n[0][0]))/2,l=+e[0][1]+(s-o*(n[1][1]+n[0][1]))/2;i.scale(150*o).translate([a,l])},t)}function dJ(i,e,t){return GB(i,[[0,0],e],t)}function pJ(i,e,t){return VB(i,function(n){var r=+e,s=r/(n[1][0]-n[0][0]),o=(r-s*(n[1][0]+n[0][0]))/2,a=-s*n[0][1];i.scale(150*s).translate([o,a])},t)}function mJ(i,e,t){return VB(i,function(n){var r=+e,s=r/(n[1][1]-n[0][1]),o=-s*n[0][0],a=(r-s*(n[1][1]+n[0][1]))/2;i.scale(150*s).translate([o,a])},t)}var AJ=16,N2e=mn(30*_n);function qB(i,e){return+e?B2e(i,e):F2e(i)}function F2e(i){return uw({point:function(e,t){e=i(e,t),this.stream.point(e[0],e[1])}})}function B2e(i,e){function t(n,r,s,o,a,l,c,u,f,d,A,y,w,S){var T=c-n,R=u-r,I=T*T+R*R;if(I>4*e&&w--){var P=o+d,F=a+A,D=l+y,L=Wo(P*P+F*F+D*D),C=da(D/=L),B=si(si(D)-1)<In||si(s-f)<In?(s+f)/2:Ms(F,P),k=i(B,C),z=k[0],G=k[1],W=z-n,Y=G-r,H=R*W-T*Y;(H*H/I>e||si((T*W+R*Y)/I-.5)>.3||o*d+a*A+l*y<N2e)&&(t(n,r,s,o,a,l,z,G,B,P/=L,F/=L,D,w,S),S.point(z,G),t(z,G,B,P,F,D,c,u,f,d,A,y,w,S))}}return function(n){var r,s,o,a,l,c,u,f,d,A,y,w,S={point:T,lineStart:R,lineEnd:P,polygonStart:function(){n.polygonStart(),S.lineStart=F},polygonEnd:function(){n.polygonEnd(),S.lineStart=R}};function T(C,B){C=i(C,B),n.point(C[0],C[1])}function R(){f=NaN,S.point=I,n.lineStart()}function I(C,B){var k=Wc([C,B]),z=i(C,B);t(f,d,u,A,y,w,f=z[0],d=z[1],u=C,A=k[0],y=k[1],w=k[2],AJ,n),n.point(f,d)}function P(){S.point=T,n.lineEnd()}function F(){R(),S.point=D,S.lineEnd=L}function D(C,B){I(r=C,B),s=f,o=d,a=A,l=y,c=w,S.point=I}function L(){t(f,d,u,A,y,w,s,o,r,a,l,c,AJ,n),S.lineEnd=P,P()}return S}}var O2e=uw({point:function(i,e){this.stream.point(i*_n,e*_n)}});function U2e(i){return uw({point:function(e,t){var n=i(e,t);return this.stream.point(n[0],n[1])}})}function k2e(i,e,t,n,r){function s(o,a){return o*=n,a*=r,[e+i*o,t-i*a]}return s.invert=function(o,a){return[(o-e)/i*n,(t-a)/i*r]},s}function gJ(i,e,t,n,r,s){if(!s)return k2e(i,e,t,n,r);var o=mn(s),a=un(s),l=o*i,c=a*i,u=o/i,f=a/i,d=(a*t-o*e)/i,A=(a*e+o*t)/i;function y(w,S){return w*=n,S*=r,[l*w-c*S+e,t-c*w-l*S]}return y.invert=function(w,S){return[n*(u*w-f*S+d),r*(A-f*w-u*S)]},y}function HB(i){return z2e(function(){return i})()}function z2e(i){var e,t=150,n=480,r=250,s=0,o=0,a=0,l=0,c=0,u,f=0,d=1,A=1,y=null,w=PB,S=null,T,R,I,P=UB,F=.5,D,L,C,B,k;function z(H){return C(H[0]*_n,H[1]*_n)}function G(H){return H=C.invert(H[0],H[1]),H&&[H[0]*ur,H[1]*ur]}z.stream=function(H){return B&&k===H?B:B=O2e(U2e(u)(w(D(P(k=H)))))},z.preclip=function(H){return arguments.length?(w=H,y=void 0,Y()):w},z.postclip=function(H){return arguments.length?(P=H,S=T=R=I=null,Y()):P},z.clipAngle=function(H){return arguments.length?(w=+H?nJ(y=H*_n):(y=null,PB),Y()):y*ur},z.clipExtent=function(H){return arguments.length?(P=H==null?(S=T=R=I=null,UB):IB(S=+H[0][0],T=+H[0][1],R=+H[1][0],I=+H[1][1]),Y()):S==null?null:[[S,T],[R,I]]},z.scale=function(H){return arguments.length?(t=+H,W()):t},z.translate=function(H){return arguments.length?(n=+H[0],r=+H[1],W()):[n,r]},z.center=function(H){return arguments.length?(s=H[0]%360*_n,o=H[1]%360*_n,W()):[s*ur,o*ur]},z.rotate=function(H){return arguments.length?(a=H[0]%360*_n,l=H[1]%360*_n,c=H.length>2?H[2]%360*_n:0,W()):[a*ur,l*ur,c*ur]},z.angle=function(H){return arguments.length?(f=H%360*_n,W()):f*ur},z.reflectX=function(H){return arguments.length?(d=H?-1:1,W()):d<0},z.reflectY=function(H){return arguments.length?(A=H?-1:1,W()):A<0},z.precision=function(H){return arguments.length?(D=qB(L,F=H*H),Y()):Wo(F)},z.fitExtent=function(H,$){return GB(z,H,$)},z.fitSize=function(H,$){return dJ(z,H,$)},z.fitWidth=function(H,$){return pJ(z,H,$)},z.fitHeight=function(H,$){return mJ(z,H,$)};function W(){var H=gJ(t,0,0,d,A,f).apply(null,e(s,o)),$=gJ(t,n-H[0],r-H[1],d,A,f);return u=MB(a,l,c),L=aw(e,$),C=aw(u,L),D=qB(L,F),Y()}function Y(){return B=k=null,z}return function(){return e=i.apply(this,arguments),z.invert=e.invert&&G,W()}}function vJ(i){return function(e,t){var n=Wo(e*e+t*t),r=i(n),s=un(r),o=mn(r);return[Ms(e*s,n*o),da(n&&t*s/n)]}}function hw(i,e){return[i,MQ(RQ((yo+e)/2))]}hw.invert=function(i,e){return[i,2*w_(EQ(e))-yo]};function WB(i,e){var t=mn(e),n=1+mn(i)*t;return[t*un(i)/n,un(e)/n]}WB.invert=vJ(function(i){return 2*w_(i)});function jB(){return HB(WB).scale(250).clipAngle(142)}function YB(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 V2e(i){if(Array.isArray(i))return i}function G2e(i){if(Array.isArray(i))return YB(i)}function fw(i,e,t){if(typeof i=="function"?i===e:i.has(e))return arguments.length<3?e:t;throw new TypeError("Private element is not present on this object")}function q2e(i){if(i===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return i}function H2e(i,e,t){return e=HC(e),ebe(i,wJ()?Reflect.construct(e,[],HC(i).constructor):e.apply(i,t))}function bJ(i,e){if(e.has(i))throw new TypeError("Cannot initialize the same private elements twice on an object")}function W2e(i,e){if(!(i instanceof e))throw new TypeError("Cannot call a class as a function")}function oi(i,e){return i.get(fw(i,e))}function Y0(i,e,t){bJ(i,e),e.set(i,t)}function Z0(i,e,t){return i.set(fw(i,e),t),t}function j2e(i,e){bJ(i,e),e.add(i)}function X2e(i,e){for(var t=0;t<e.length;t++){var n=e[t];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(i,TJ(n.key),n)}}function $2e(i,e,t){return e&&X2e(i.prototype,e),Object.defineProperty(i,"prototype",{writable:!1}),i}function C_(i,e,t){return(e=TJ(e))in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function HC(i){return HC=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},HC(i)}function Y2e(i,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");i.prototype=Object.create(e&&e.prototype,{constructor:{value:i,writable:!0,configurable:!0}}),Object.defineProperty(i,"prototype",{writable:!1}),e&&ZB(i,e)}function wJ(){try{var i=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(wJ=function(){return!!i})()}function Z2e(i){if(typeof Symbol<"u"&&i[Symbol.iterator]!=null||i["@@iterator"]!=null)return Array.from(i)}function K2e(i,e){var t=i==null?null:typeof Symbol<"u"&&i[Symbol.iterator]||i["@@iterator"];if(t!=null){var n,r,s,o,a=[],l=!0,c=!1;try{if(s=(t=t.call(i)).next,e!==0)for(;!(l=(n=s.call(t)).done)&&(a.push(n.value),a.length!==e);l=!0);}catch(u){c=!0,r=u}finally{try{if(!l&&t.return!=null&&(o=t.return(),Object(o)!==o))return}finally{if(c)throw r}}return a}}function Q2e(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.4119+In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function J2e(){throw new TypeError(`Invalid attempt to spread non-iterable instance.4120+In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function ebe(i,e){if(e&&(typeof e=="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return q2e(i)}function ZB(i,e){return ZB=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,n){return t.__proto__=n,t},ZB(i,e)}function qC(i,e){return V2e(i)||K2e(i,e)||EJ(i,e)||Q2e()}function SJ(i){return G2e(i)||Z2e(i)||EJ(i)||J2e()}function tbe(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 String(i)}function TJ(i){var e=tbe(i,"string");return typeof e=="symbol"?e:e+""}function EJ(i,e){if(i){if(typeof i=="string")return YB(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)?YB(i,e):void 0}}var MJ=function(e){e instanceof Array?e.forEach(MJ):(e.map&&e.map.dispose(),e.dispose())},KB=function(e){e.geometry&&e.geometry.dispose(),e.material&&MJ(e.material),e.texture&&e.texture.dispose(),e.children&&e.children.forEach(KB)};function CJ(i,e,t){var n=(90-i)*Math.PI/180,r=(90-e)*Math.PI/180;return{x:t*Math.sin(n)*Math.cos(r),y:t*Math.cos(n),z:t*Math.sin(n)*Math.sin(r)}}function nbe(i){var e=i.x,t=i.y,n=i.z,r=Math.sqrt(e*e+t*t+n*n),s=Math.acos(t/r),o=Math.atan2(n,e);return{lat:90-s*180/Math.PI,lng:90-o*180/Math.PI-(o<-Math.PI/2?360:0),r}}function Mg(i){return i*Math.PI/180}var RJ=function(e){return 1-(hw(0,(.5-e)*Math.PI)[1]/Math.PI+1)/2},XB=function(e){return Math.max(0,Math.min(1,RJ(e)))},_J=function(e){return .5-hw.invert(0,(2*(1-e)-1)*Math.PI)[1]/Math.PI},ibe=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]:1,r=Tl().domain([1,0]).range([t,n]).clamp(!0),s=Tl().domain([XB(t),XB(n)]).range([1,0]).clamp(!0),o=function(f){return s(XB(r(f)))},a=e.array,l=0,c=a.length;l<c;l+=2)a[l+1]=o(a[l+1]);e.needsUpdate=!0},xJ=function(e,t,n,r){var s=Math.pow(2,e),o=Math.max(0,Math.min(s-1,Math.floor((n+180)*s/360))),a=(90-r)/180;t&&(a=Math.max(0,Math.min(1,RJ(a))));var l=Math.floor(a*s);return[o,l]},QB=function(e,t){for(var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:0,s=arguments.length>4?arguments[4]:void 0,o=arguments.length>5?arguments[5]:void 0,a=[],l=Math.pow(2,e),c=360/l,u=180/l,f=s===void 0?l-1:s,d=o===void 0?l-1:o,A=n,y=Math.min(l-1,f);A<=y;A++)for(var w=r,S=Math.min(l-1,d);w<=S;w++){var T=w,R=u;if(t){T=w===0?w:_J(w/l)*l;var I=w+1===l?w+1:_J((w+1)/l)*l;R=(I-T)*180/l}var P=-180+(A+.5)*c,F=90-(T*180/l+R/2),D=R;a.push({x:A,y:w,lng:P,lat:F,latLen:D})}return a},rbe=6,sbe=7,obe=3,abe=90,tf=new WeakMap,K0=new WeakMap,$B=new WeakMap,VC=new WeakMap,jc=new WeakMap,WC=new WeakMap,R_=new WeakMap,Cg=new WeakMap,GC=new WeakSet,PJ=(function(i){function e(t){var n,r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},s=r.tileUrl,o=r.minLevel,a=o===void 0?0:o,l=r.maxLevel,c=l===void 0?17:l,u=r.mercatorProjection,f=u===void 0?!0:u;return W2e(this,e),n=H2e(this,e),j2e(n,GC),Y0(n,tf,void 0),Y0(n,K0,void 0),Y0(n,$B,void 0),Y0(n,VC,void 0),Y0(n,jc,{}),Y0(n,WC,void 0),Y0(n,R_,void 0),Y0(n,Cg,void 0),C_(n,"minLevel",void 0),C_(n,"maxLevel",void 0),C_(n,"thresholds",SJ(new Array(30)).map(function(d,A){return 8/Math.pow(2,A)})),C_(n,"curvatureResolution",5),C_(n,"tileMargin",0),C_(n,"clearTiles",function(){Object.values(oi(jc,n)).forEach(function(d){d.forEach(function(A){A.obj&&(n.remove(A.obj),KB(A.obj),delete A.obj)})}),Z0(jc,n,{})}),Z0(tf,n,t),n.tileUrl=s,Z0(K0,n,f),n.minLevel=a,n.maxLevel=c,n.level=0,n.add(Z0(Cg,n,new Hn(new Va(oi(tf,n)*.99,180,90),new fs({color:0})))),oi(Cg,n).visible=!1,oi(Cg,n).material.polygonOffset=!0,oi(Cg,n).material.polygonOffsetUnits=3,oi(Cg,n).material.polygonOffsetFactor=1,n}return Y2e(e,i),$2e(e,[{key:"tileUrl",get:function(){return oi($B,this)},set:function(n){Z0($B,this,n),this.updatePov(oi(R_,this))}},{key:"level",get:function(){return oi(VC,this)},set:function(n){var r,s=this;oi(jc,this)[n]||fw(GC,this,lbe).call(this,n);var o=oi(VC,this);if(Z0(VC,this,n),!(n===o||o===void 0)){if(oi(Cg,this).visible=n>0,oi(jc,this)[n].forEach(function(l){return l.obj&&(l.obj.material.depthWrite=!0)}),o<n&&((r=oi(jc,this)[o])===null||r===void 0||r.forEach(function(l){return l.obj&&(l.obj.material.depthWrite=!1)})),o>n)for(var a=n+1;a<=o;a++)oi(jc,this)[a]&&oi(jc,this)[a].forEach(function(l){l.obj&&(s.remove(l.obj),KB(l.obj),delete l.obj)});fw(GC,this,yJ).call(this)}}},{key:"updatePov",value:function(n){var r=this;if(!(!n||!(n instanceof Id))){Z0(R_,this,n);var s;if(Z0(WC,this,function(u){if(!u.hullPnts){var f=360/Math.pow(2,r.level),d=u.lng,A=u.lat,y=u.latLen,w=d-f/2,S=d+f/2,T=A-y/2,R=A+y/2;u.hullPnts=[[A,d],[T,w],[R,w],[T,S],[R,S]].map(function(I){var P=qC(I,2),F=P[0],D=P[1];return CJ(F,D,oi(tf,r))}).map(function(I){var P=I.x,F=I.y,D=I.z;return new re(P,F,D)})}return s||(s=new zc,n.updateMatrix(),n.updateMatrixWorld(),s.setFromProjectionMatrix(new cn().multiplyMatrices(n.projectionMatrix,n.matrixWorldInverse))),u.hullPnts.some(function(I){return s.containsPoint(I.clone().applyMatrix4(r.matrixWorld))})}),this.tileUrl){var o=n.position.clone(),a=o.distanceTo(this.getWorldPosition(new re)),l=(a-oi(tf,this))/oi(tf,this),c=this.thresholds.findIndex(function(u){return u&&u<=l});this.level=Math.min(this.maxLevel,Math.max(this.minLevel,c<0?this.thresholds.length:c)),fw(GC,this,yJ).call(this)}}}}])})(Br);function lbe(i){var e=this;if(i>sbe){oi(jc,this)[i]=[];return}var t=oi(jc,this)[i]=QB(i,oi(K0,this));t.forEach(function(n){return n.centroid=CJ(n.lat,n.lng,oi(tf,e))}),t.octree=Wb().x(function(n){return n.centroid.x}).y(function(n){return n.centroid.y}).z(function(n){return n.centroid.z}).addAll(t)}function yJ(){var i=this;if(!(!this.tileUrl||this.level===void 0||!oi(jc,this).hasOwnProperty(this.level))&&!(!oi(WC,this)&&this.level>rbe)){var e=oi(jc,this)[this.level];if(oi(R_,this)){var t=this.worldToLocal(oi(R_,this).position.clone());if(e.octree){var n,r=this.worldToLocal(oi(R_,this).position.clone()),s=(r.length()-oi(tf,this))*obe;e=(n=e.octree).findAllWithinRadius.apply(n,SJ(r).concat([s]))}else{var o=nbe(t),a=(o.r/oi(tf,this)-1)*abe,l=a/Math.cos(Mg(o.lat)),c=[o.lng-l,o.lng+l],u=[o.lat+a,o.lat-a],f=xJ(this.level,oi(K0,this),c[0],u[0]),d=qC(f,2),A=d[0],y=d[1],w=xJ(this.level,oi(K0,this),c[1],u[1]),S=qC(w,2),T=S[0],R=S[1];!e.record&&(e.record={});var I=e.record;if(!I.hasOwnProperty("".concat(Math.round((A+T)/2),"_").concat(Math.round((y+R)/2))))e=QB(this.level,oi(K0,this),A,y,T,R).map(function(C){var B="".concat(C.x,"_").concat(C.y);return I.hasOwnProperty(B)?I[B]:(I[B]=C,e.push(C),C)});else{for(var P=[],F=A;F<=T;F++)for(var D=y;D<=R;D++){var L="".concat(F,"_").concat(D);I.hasOwnProperty(L)||(I[L]=QB(this.level,oi(K0,this),F,D,F,D)[0],e.push(I[L])),P.push(I[L])}e=P}}}e.filter(function(C){return!C.obj}).filter(oi(WC,this)||function(){return!0}).forEach(function(C){var B=C.x,k=C.y,z=C.lng,G=C.lat,W=C.latLen,Y=360/Math.pow(2,i.level);if(!C.obj){var H=Y*(1-i.tileMargin),$=W*(1-i.tileMargin),J=Mg(z),te=Mg(-G),ce=new Hn(new Va(oi(tf,i),Math.ceil(H/i.curvatureResolution),Math.ceil($/i.curvatureResolution),Mg(90-H/2)+J,Mg(H),Mg(90-$/2)+te,Mg($)),new Ga);if(oi(K0,i)){var he=[G+W/2,G-W/2].map(function(Fe){return .5-Fe/180}),ve=qC(he,2),Re=ve[0],Qe=ve[1];ibe(ce.geometry.attributes.uv,Re,Qe)}C.obj=ce}C.loading||(C.loading=!0,new bl().load(i.tileUrl(B,k,i.level),function(Fe){var mt=C.obj;mt&&(Fe.colorSpace=Fr,mt.material.map=Fe,mt.material.color=null,mt.material.needsUpdate=!0,i.add(mt)),C.loading=!1}))})}}var Aw=new Set,JB=!1;function oO(i,e,t=2){let n=e&&e.length,r=n?e[0]*t:i.length;Aw.size&&Aw.clear();let s=NJ(i,0,r,t,!0),o=[];if(!s||s.next===s.prev)return o;let a=0,l=0,c=0;if(n&&(s=dbe(i,e,s,t)),i.length>80*t){a=i[0],l=i[1];let u=a,f=l;for(let d=t;d<r;d+=t){let A=i[d],y=i[d+1];A<a&&(a=A),y<l&&(l=y),A>u&&(u=A),y>f&&(f=y)}c=Math.max(u-a,f-l),c=c!==0?32767/c:0}return eO(s,o,a,l,c),o}function NJ(i,e,t,n,r){let s=null;if(r===Ebe(i,e,t,n)>0)for(let o=e;o<t;o+=n)s=DJ(o/n|0,i[o],i[o+1],s);else for(let o=t-n;o>=e;o-=n)s=DJ(o/n|0,i[o],i[o+1],s);return s&&gw(s,s.next)&&(_w(s),s=s.next),s}function Pg(i,e=i){let t=e===i,n=i,r;do r=!1,n!==n.next&&(Aw.size===0||!Aw.has(n))&&(gw(n,n.next)||js(n.prev,n,n.next)===0)?((t||n===e)&&(e=n.prev),JB=!0,_w(n),n=n.prev,r=!0):(t||n!==e)&&(n=n.next,r=!t);while(r||n!==e);return e}function eO(i,e,t,n,r){r&&xbe(i,t,n,r);let s=i,o=!1;for(;i.prev!==i.next;){let a=i.prev,l=i.next;if(js(a,i,l)<0&&(r?ube(i,t,n,r):cbe(i))){e.push(a.i,i.i,l.i),_w(i),i=l,s=l;continue}if(i=l,i===s){if(JB=!1,i=Pg(i),JB){s=i;continue}if(!o){i=hbe(i,e),s=i,o=!0;continue}fbe(i,e,t,n,r);break}}}function cbe(i){let e=i.prev,t=i,n=i.next,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),d=Math.max(r,s,o),A=Math.max(a,l,c),y=n.next;for(;y!==e;){if(y.x>=u&&y.x<=d&&y.y>=f&&y.y<=A&&!(r===y.x&&a===y.y)&&YC(r,a,s,l,o,c,y.x,y.y)&&js(y.prev,y,y.next)>=0)return!1;y=y.next}return!0}function ube(i,e,t,n){let r=i.prev,s=i,o=i.next,a=r.x,l=s.x,c=o.x,u=r.y,f=s.y,d=o.y,A=Math.min(a,l,c),y=Math.min(u,f,d),w=Math.max(a,l,c),S=Math.max(u,f,d),T=rO(A,y,e,t,n),R=rO(w,S,e,t,n),I=i.prevZ;for(;I&&I.z>=T;){if(I.x>=A&&I.x<=w&&I.y>=y&&I.y<=S&&I!==o&&!(a===I.x&&u===I.y)&&YC(a,u,l,f,c,d,I.x,I.y)&&js(I.prev,I,I.next)>=0)return!1;I=I.prevZ}let P=i.nextZ;for(;P&&P.z<=R;){if(P.x>=A&&P.x<=w&&P.y>=y&&P.y<=S&&P!==o&&!(a===P.x&&u===P.y)&&YC(a,u,l,f,c,d,P.x,P.y)&&js(P.prev,P,P.next)>=0)return!1;P=P.nextZ}return!0}function hbe(i,e){let t=i,n=!1;do{let r=t.prev,s=t.next.next;OJ(r,t,t.next,s,!1)&&vw(r,s)&&vw(s,r)&&(e.push(r.i,t.i,s.i),_w(t),_w(t.next),t=i=s,n=!0),t=t.next}while(t!==i);return n?Pg(t):t}function fbe(i,e,t,n,r){let s=i;do{let o=s.next.next;for(;o!==s.prev;){if(s.i!==o.i&&wbe(s,o)){let a=UJ(s,o);s=Pg(s,s.next),a=Pg(a,a.next),eO(s,e,t,n,r),eO(a,e,t,n,r);return}o=o.next}s=s.next}while(s!==i)}var tO=!1;function dbe(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=NJ(i,a,l,n,!1);c===c.next&&Aw.add(c),r.push(bbe(c))}r.sort(pbe),Abe(i.length/n,e.length),BJ(t,t),tO=!0;for(let s=0;s<r.length;s++)t=mbe(r[s],t);return tO=!1,Pg(t)}function pbe(i,e){return i.x-e.x||i.y-e.y||(i.next.y-i.y)/(i.next.x-i.x)-(e.next.y-e.y)/(e.next.x-e.x)}function mbe(i,e){let t=vbe(i,e);if(!t)return e;let n=UJ(t,i),r=n.next;return BJ(t,r.next),Pg(n,n.next),Pg(t,t.next)}var FJ=16,gs=new Float64Array(0),$C=0,nO=[],iO=[];function Abe(i,e){let t=Math.ceil((i+2*e)/FJ)+e+2;gs.length<t*4&&(gs=new Float64Array(t*4)),$C=0}function BJ(i,e){let t=i;do{let n=$C++;nO[n]=t;let r=1/0,s=1/0,o=-1/0,a=-1/0,l=0;do{let u=t.next;t.z=n,t.x<r&&(r=t.x),t.x>o&&(o=t.x),t.y<s&&(s=t.y),t.y>a&&(a=t.y),u.x<r&&(r=u.x),u.x>o&&(o=u.x),u.y<s&&(s=u.y),u.y>a&&(a=u.y),t=u}while(++l<FJ&&t!==e);iO[n]=t;let c=n*4;gs[c]=r,gs[c+1]=s,gs[c+2]=o,gs[c+3]=a}while(t!==e)}function gbe(i,e){let t=i.z*4;e.x<gs[t]&&(gs[t]=e.x),e.y<gs[t+1]&&(gs[t+1]=e.y),e.x>gs[t+2]&&(gs[t+2]=e.x),e.y>gs[t+3]&&(gs[t+3]=e.y)}function IJ(i){let e=iO[i];for(;e.prev.next!==e;)e=e.next;return iO[i]=e,e}function LJ(i){let e=nO[i];for(;e.prev.next!==e;)e=e.next;return nO[i]=e,e}function vbe(i,e){let t=e,n=i.x,r=i.y,s=-1/0,o;if(gw(i,t))return t;for(let d=0,A=0;d<$C;d++,A+=4){if(r<gs[A+1]||r>gs[A+3]||gs[A]>n||gs[A+2]<=s)continue;let y=IJ(d);t=LJ(d);do{if(t.prev.next===t){if(gw(i,t.next))return t.next;if(r<=t.y&&r>=t.next.y&&t.next.y!==t.y){let w=t.x+(r-t.y)*(t.next.x-t.x)/(t.next.y-t.y);if(w<=n&&w>s&&(s=w,o=t.x<t.next.x?t:t.next,w===n))return o}}t=t.next}while(t!==y)}if(!o)return null;let a=o.x,l=o.y,c=Math.min(r,l),u=Math.max(r,l),f=1/0;for(let d=0,A=0;d<$C;d++,A+=4){if(gs[A+2]<a||gs[A]>n||gs[A+3]<c||gs[A+1]>u)continue;let y=IJ(d);t=LJ(d);do{if(t.prev.next===t&&n>=t.x&&t.x>=a&&n!==t.x&&YC(r<l?n:s,r,a,l,r<l?s:n,r,t.x,t.y)){let w=Math.abs(r-t.y)/(n-t.x);(vw(t,i)||t.y===r&&t.next.y===r&&t.next.x>n)&&(w<f||w===f&&(t.x>o.x||t.x===o.x&&_be(o,t)))&&(o=t,f=w)}t=t.next}while(t!==y)}return o}function _be(i,e){return js(i.prev,i,e.prev)<0&&js(e.next,i,i.next)<0}var Xc=[],dw=[],Rg=new Uint32Array(0),pw=new Uint32Array(0),mw=new Uint32Array(256);function xbe(i,e,t,n){let r=i,s=0;do r.z=rO(r.x,r.y,e,t,n),Xc[s++]=r,r=r.next;while(r!==i);ybe(s);let o=null;for(let a=0;a<s;a++){let l=Xc[a];l.prevZ=o,o&&(o.nextZ=l),o=l}o.nextZ=null}function ybe(i){if(i<=32){for(let e=1;e<i;e++){let t=Xc[e],n=t.z,r=e-1;for(;r>=0&&Xc[r].z>n;)Xc[r+1]=Xc[r],r--;Xc[r+1]=t}return}Rg.length<i&&(Rg=new Uint32Array(i),pw=new Uint32Array(i),dw=new Array(i));for(let e=0;e<i;e++)Rg[e]=Xc[e].z;jC(i,Xc,Rg,dw,pw,0),jC(i,dw,pw,Xc,Rg,8),jC(i,Xc,Rg,dw,pw,16),jC(i,dw,pw,Xc,Rg,24)}function jC(i,e,t,n,r,s){mw.fill(0);for(let a=0;a<i;a++)mw[t[a]>>>s&255]++;let o=0;for(let a=0;a<256;a++){let l=mw[a];mw[a]=o,o+=l}for(let a=0;a<i;a++){let l=t[a],c=mw[l>>>s&255]++;n[c]=e[a],r[c]=l}}function rO(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 bbe(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 YC(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 wbe(i,e){let t=gw(i,e)&&js(i.prev,i,i.next)>0&&js(e.prev,e,e.next)>0;return i.next.i!==e.i&&(t||vw(i,e)&&vw(e,i)&&(js(i.prev,i,e.prev)!==0||js(i,e.prev,e)!==0))&&!Sbe(i,e)&&(t||Tbe(i,e))}function js(i,e,t){return(e.y-i.y)*(t.x-e.x)-(e.x-i.x)*(t.y-e.y)}function gw(i,e){return i.x===e.x&&i.y===e.y}function OJ(i,e,t,n,r=!0){let s=js(i,e,t),o=js(i,e,n),a=js(t,n,i),l=js(t,n,e);return(s>0&&o<0||s<0&&o>0)&&(a>0&&l<0||a<0&&l>0)?!0:r?!!(s===0&&XC(i,t,e)||o===0&&XC(i,n,e)||a===0&&XC(t,i,n)||l===0&&XC(t,e,n)):!1}function XC(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 Sbe(i,e){let t=Math.min(i.x,e.x),n=Math.max(i.x,e.x),r=Math.min(i.y,e.y),s=Math.max(i.y,e.y),o=i;do{let a=o.next;if(o.x>n&&a.x>n||o.x<t&&a.x<t||o.y>s&&a.y>s||o.y<r&&a.y<r){o=a;continue}if(o.i!==i.i&&a.i!==i.i&&o.i!==e.i&&a.i!==e.i&&OJ(o,a,i,e))return!0;o=a}while(o!==i);return!1}function vw(i,e){return js(i.prev,i,i.next)<0?js(i,e,i.next)>=0&&js(i,i.prev,e)>=0:js(i,e,i.prev)<0||js(i,i.next,e)<0}function Tbe(i,e){let t=i,n=!1,r=(i.x+e.x)/2,s=(i.y+e.y)/2;do{let o=t.next;t.y>s!=o.y>s&&r<(o.x-t.x)*(s-t.y)/(o.y-t.y)+t.x&&(n=!n),t=o}while(t!==i);return n}function UJ(i,e){let t=sO(i.i,i.x,i.y),n=sO(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 DJ(i,e,t,n){let r=sO(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 _w(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),tO&&gbe(i.prev,i.next)}function sO(i,e,t){return{i,x:e,y:t,prev:null,next:null,z:0,prevZ:null,nextZ:null}}function Ebe(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}function P_(i){let e=[],t=[],n=i[0][0].length,r=0,s=0;for(let o of i){for(let a of o)for(let l=0;l<n;l++)e.push(a[l]);s&&(r+=s,t.push(r)),s=o.length}return{vertices:e,holes:t,dimensions:n}}function lO(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 Mbe(i){if(Array.isArray(i))return i}function Cbe(i){if(Array.isArray(i))return lO(i)}function Rbe(i){if(i===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return i}function Pbe(i,e,t){return e=ZC(e),kbe(i,VJ()?Reflect.construct(e,[],ZC(i).constructor):e.apply(i,t))}function Ibe(i,e){if(!(i instanceof e))throw new TypeError("Cannot call a class as a function")}function Lbe(i,e,t){return Object.defineProperty(i,"prototype",{writable:!1}),i}function Dbe(i,e){var t=typeof Symbol<"u"&&i[Symbol.iterator]||i["@@iterator"];if(!t){if(Array.isArray(i)||(t=hO(i))||e){t&&(i=t);var n=0,r=function(){};return{s:r,n:function(){return n>=i.length?{done:!0}:{done:!1,value:i[n++]}},e:function(l){throw l},f:r}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.4121+In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var s,o=!0,a=!1;return{s:function(){t=t.call(i)},n:function(){var l=t.next();return o=l.done,l},e:function(l){a=!0,s=l},f:function(){try{o||t.return==null||t.return()}finally{if(a)throw s}}}}function ZC(i){return ZC=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},ZC(i)}function Nbe(i,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");i.prototype=Object.create(e&&e.prototype,{constructor:{value:i,writable:!0,configurable:!0}}),Object.defineProperty(i,"prototype",{writable:!1}),e&&cO(i,e)}function VJ(){try{var i=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(VJ=function(){return!!i})()}function Fbe(i){if(typeof Symbol<"u"&&i[Symbol.iterator]!=null||i["@@iterator"]!=null)return Array.from(i)}function Bbe(i,e){var t=i==null?null:typeof Symbol<"u"&&i[Symbol.iterator]||i["@@iterator"];if(t!=null){var n,r,s,o,a=[],l=!0,c=!1;try{if(s=(t=t.call(i)).next,e===0){if(Object(t)!==t)return;l=!1}else for(;!(l=(n=s.call(t)).done)&&(a.push(n.value),a.length!==e);l=!0);}catch(u){c=!0,r=u}finally{try{if(!l&&t.return!=null&&(o=t.return(),Object(o)!==o))return}finally{if(c)throw r}}return a}}function Obe(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.4122+In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Ube(){throw new TypeError(`Invalid attempt to spread non-iterable instance.4123+In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function kbe(i,e){if(e&&(typeof e=="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Rbe(i)}function cO(i,e){return cO=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,n){return t.__proto__=n,t},cO(i,e)}function xw(i,e){return Mbe(i)||Bbe(i,e)||hO(i,e)||Obe()}function zbe(i){return Cbe(i)||Fbe(i)||hO(i)||Ube()}function hO(i,e){if(i){if(typeof i=="string")return lO(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)?lO(i,e):void 0}}var kJ=function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,n=[],r=null;return e.forEach(function(s){if(r){var o=Ml(s,r)*180/Math.PI;if(o>t)for(var a=Eg(r,s),l=r.length>2||s.length>2?Qh(r[2]||0,s[2]||0):null,c=l?function(d){return[].concat(zbe(a(d)),[l(d)])}:a,u=1/Math.ceil(o/t),f=u;f<1;)n.push(c(f)),f+=u}n.push(r=s)}),n},uO=typeof window<"u"&&window.THREE?window.THREE:{BufferGeometry:Xn,Float32BufferAttribute:Ln},Vbe=new uO.BufferGeometry().setAttribute?"setAttribute":"addAttribute",fO=(function(i){function e(t){var n,r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,s=arguments.length>2&&arguments[2]!==void 0?arguments[2]:5;Ibe(this,e),n=Pbe(this,e),n.type="GeoJsonGeometry",n.parameters={geoJson:t,radius:r,resolution:s};var o=({Point:u,MultiPoint:f,LineString:d,MultiLineString:A,Polygon:y,MultiPolygon:w}[t.type]||function(){return[]})(t.coordinates,r),a=[],l=[],c=0;o.forEach(function(S){var T=a.length;yw({indices:a,vertices:l},S),n.addGroup(T,a.length-T,c++)}),a.length&&n.setIndex(a),l.length&&n[Vbe]("position",new uO.Float32BufferAttribute(l,3));function u(S,T){var R=aO(S[1],S[0],T+(S[2]||0)),I=[];return[{vertices:R,indices:I}]}function f(S,T){var R={vertices:[],indices:[]};return S.map(function(I){return u(I,T)}).forEach(function(I){var P=xw(I,1),F=P[0];yw(R,F)}),[R]}function d(S,T){for(var R=kJ(S,s).map(function(C){var B=xw(C,3),k=B[0],z=B[1],G=B[2],W=G===void 0?0:G;return aO(z,k,T+W)}),I=P_([R]),P=I.vertices,F=Math.round(P.length/3),D=[],L=1;L<F;L++)D.push(L-1,L);return[{vertices:P,indices:D}]}function A(S,T){var R={vertices:[],indices:[]};return S.map(function(I){return d(I,T)}).forEach(function(I){var P=xw(I,1),F=P[0];yw(R,F)}),[R]}function y(S,T){for(var R=S.map(function(H){return kJ(H,s).map(function($){var J=xw($,3),te=J[0],ce=J[1],he=J[2],ve=he===void 0?0:he;return aO(ce,te,T+ve)})}),I=P_(R),P=I.vertices,F=I.holes,D=F[0]||1/0,L=P.slice(0,D*3),C=P.slice(D*3),B=new Set(F),k=Math.round(P.length/3),z=[],G=[],W=1;W<k;W++)B.has(W)||(W<D?z.push(W-1,W):G.push(W-1-D,W-D));var Y=[{indices:z,vertices:L}];return F.length&&Y.push({indices:G,vertices:C}),Y}function w(S,T){var R={vertices:[],indices:[]},I={vertices:[],indices:[]};S.map(function(F){return y(F,T)}).forEach(function(F){var D=xw(F,2),L=D[0],C=D[1];yw(R,L),C&&yw(I,C)});var P=[R];return I.vertices.length&&P.push(I),P}return n}return Nbe(e,i),Lbe(e)})(uO.BufferGeometry);function yw(i,e){var t=Math.round(i.vertices.length/3);zJ(i.vertices,e.vertices),zJ(i.indices,e.indices.map(function(n){return n+t}))}function zJ(i,e){var t=Dbe(e),n;try{for(t.s();!(n=t.n()).done;){var r=n.value;i.push(r)}}catch(s){t.e(s)}finally{t.f()}}function aO(i,e){var t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,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 bw={};hhe(bw,{computeMikkTSpaceTangents:()=>Gbe,computeMorphedAttributes:()=>Zbe,deepCloneAttribute:()=>Hbe,deinterleaveAttribute:()=>KC,deinterleaveGeometry:()=>jbe,estimateBytesUsed:()=>Xbe,interleaveAttributes:()=>Wbe,mergeAttributes:()=>dO,mergeGeometries:()=>qbe,mergeGroups:()=>Kbe,mergeVertices:()=>$be,toCreasedNormals:()=>Qbe,toTrianglesDrawMode:()=>Ybe});function Gbe(i,e,t=!0){if(!e||!e.isReady)throw new Error("THREE.BufferGeometryUtils: Initialized MikkTSpace library required.");if(!i.hasAttribute("position")||!i.hasAttribute("normal")||!i.hasAttribute("uv"))throw new Error('THREE.BufferGeometryUtils: Tangents require "position", "normal", and "uv" attributes.');function n(o){if(o.normalized||o.isInterleavedBufferAttribute){let a=new Float32Array(o.count*o.itemSize);for(let l=0,c=0;l<o.count;l++)a[c++]=o.getX(l),a[c++]=o.getY(l),o.itemSize>2&&(a[c++]=o.getZ(l));return a}return o.array instanceof Float32Array?o.array:new Float32Array(o.array)}let r=i.index?i.toNonIndexed():i,s=e.generateTangents(n(r.attributes.position),n(r.attributes.normal),n(r.attributes.uv));if(t)for(let o=3;o<s.length;o+=4)s[o]*=-1;return r.setAttribute("tangent",new Hi(s,4)),i!==r&&i.copy(r),i}function qbe(i,e=!1){let t=i[0].index!==null,n=new Set(Object.keys(i[0].attributes)),r=new Set(Object.keys(i[0].morphAttributes)),s={},o={},a=i[0].morphTargetsRelative,l=new Xn,c=0;for(let u=0;u<i.length;++u){let f=i[u],d=0;if(t!==(f.index!==null))return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+u+". All geometries must have compatible attributes; make sure index attribute exists among all geometries, or in none of them."),null;for(let A in f.attributes){if(!n.has(A))return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+u+'. All geometries must have compatible attributes; make sure "'+A+'" attribute exists among all geometries, or in none of them.'),null;s[A]===void 0&&(s[A]=[]),s[A].push(f.attributes[A]),d++}if(d!==n.size)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+u+". Make sure all geometries have the same number of attributes."),null;if(a!==f.morphTargetsRelative)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+u+". .morphTargetsRelative must be consistent throughout all geometries."),null;for(let A in f.morphAttributes){if(!r.has(A))return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+u+". .morphAttributes must be consistent throughout all geometries."),null;o[A]===void 0&&(o[A]=[]),o[A].push(f.morphAttributes[A])}if(e){let A;if(t)A=f.index.count;else if(f.attributes.position!==void 0)A=f.attributes.position.count;else return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+u+". The geometry must have either an index or a position attribute"),null;l.addGroup(c,A,u),c+=A}}if(t){let u=0,f=[];for(let d=0;d<i.length;++d){let A=i[d].index;for(let y=0;y<A.count;++y)f.push(A.getX(y)+u);u+=i[d].attributes.position.count}l.setIndex(f)}for(let u in s){let f=dO(s[u]);if(!f)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed while trying to merge the "+u+" attribute."),null;l.setAttribute(u,f)}for(let u in o){let f=o[u][0].length;if(f!==0){l.morphAttributes=l.morphAttributes||{},l.morphAttributes[u]=[];for(let d=0;d<f;++d){let A=[];for(let w=0;w<o[u].length;++w)A.push(o[u][w][d]);let y=dO(A);if(!y)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed while trying to merge the "+u+" morphAttribute."),null;l.morphAttributes[u].push(y)}}}return l}function dO(i){let e,t,n,r=-1,s=0;for(let c=0;c<i.length;++c){let u=i[c];if(e===void 0&&(e=u.array.constructor),e!==u.array.constructor)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.array must be of consistent array types across matching attributes."),null;if(t===void 0&&(t=u.itemSize),t!==u.itemSize)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.itemSize must be consistent across matching attributes."),null;if(n===void 0&&(n=u.normalized),n!==u.normalized)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.normalized must be consistent across matching attributes."),null;if(r===-1&&(r=u.gpuType),r!==u.gpuType)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.gpuType must be consistent across matching attributes."),null;s+=u.count*t}let o=new e(s),a=new Hi(o,t,n),l=0;for(let c=0;c<i.length;++c){let u=i[c];if(u.isInterleavedBufferAttribute){let f=l/t;for(let d=0,A=u.count;d<A;d++)for(let y=0;y<t;y++){let w=u.getComponent(d,y);a.setComponent(d+f,y,w)}}else o.set(u.array,l);l+=u.count*t}return r!==void 0&&(a.gpuType=r),a}function Hbe(i){return i.isInstancedInterleavedBufferAttribute||i.isInterleavedBufferAttribute?KC(i):i.isInstancedBufferAttribute?new Ql().copy(i):new Hi().copy(i)}function Wbe(i){let e,t=0,n=0;for(let c=0,u=i.length;c<u;++c){let f=i[c];if(e===void 0&&(e=f.array.constructor),e!==f.array.constructor)return console.error("AttributeBuffers of different types cannot be interleaved"),null;t+=f.array.length,n+=f.itemSize}let r=new Rd(new e(t),n),s=0,o=[],a=["getX","getY","getZ","getW"],l=["setX","setY","setZ","setW"];for(let c=0,u=i.length;c<u;c++){let f=i[c],d=f.itemSize,A=f.count,y=new Vo(r,d,s,f.normalized);o.push(y),s+=d;for(let w=0;w<A;w++)for(let S=0;S<d;S++)y[l[S]](w,f[a[S]](w))}return o}function KC(i){let e=i.data.array.constructor,t=i.count,n=i.itemSize,r=i.normalized,s=new e(t*n),o;i.isInstancedInterleavedBufferAttribute?o=new Ql(s,n,r,i.meshPerAttribute):o=new Hi(s,n,r);for(let a=0;a<t;a++)o.setX(a,i.getX(a)),n>=2&&o.setY(a,i.getY(a)),n>=3&&o.setZ(a,i.getZ(a)),n>=4&&o.setW(a,i.getW(a));return o}function jbe(i){let e=i.attributes,t=i.morphTargets,n=new Map;for(let r in e){let s=e[r];s.isInterleavedBufferAttribute&&(n.has(s)||n.set(s,KC(s)),e[r]=n.get(s))}for(let r in t){let s=t[r];s.isInterleavedBufferAttribute&&(n.has(s)||n.set(s,KC(s)),t[r]=n.get(s))}}function Xbe(i){let e=0;for(let n in i.attributes){let r=i.getAttribute(n);e+=r.count*r.itemSize*r.array.BYTES_PER_ELEMENT}let t=i.getIndex();return e+=t?t.count*t.itemSize*t.array.BYTES_PER_ELEMENT:0,e}function $be(i,e=1e-4){e=Math.max(e,Number.EPSILON);let t={},n=i.getIndex(),r=i.getAttribute("position"),s=n?n.count:r.count,o=0,a=Object.keys(i.attributes),l={},c={},u=[],f=["getX","getY","getZ","getW"],d=["setX","setY","setZ","setW"];for(let R=0,I=a.length;R<I;R++){let P=a[R],F=i.attributes[P];l[P]=new F.constructor(new F.array.constructor(F.count*F.itemSize),F.itemSize,F.normalized);let D=i.morphAttributes[P];D&&(c[P]||(c[P]=[]),D.forEach((L,C)=>{let B=new L.array.constructor(L.count*L.itemSize);c[P][C]=new L.constructor(B,L.itemSize,L.normalized)}))}let A=e*.5,y=Math.log10(1/e),w=Math.pow(10,y),S=A*w;for(let R=0;R<s;R++){let I=n?n.getX(R):R,P="";for(let F=0,D=a.length;F<D;F++){let L=a[F],C=i.getAttribute(L),B=C.itemSize;for(let k=0;k<B;k++)P+=`${~~(C[f[k]](I)*w+S)},`}if(P in t)u.push(t[P]);else{for(let F=0,D=a.length;F<D;F++){let L=a[F],C=i.getAttribute(L),B=i.morphAttributes[L],k=C.itemSize,z=l[L],G=c[L];for(let W=0;W<k;W++){let Y=f[W],H=d[W];if(z[H](o,C[Y](I)),B)for(let $=0,J=B.length;$<J;$++)G[$][H](o,B[$][Y](I))}}t[P]=o,u.push(o),o++}}let T=i.clone();for(let R in i.attributes){let I=l[R];if(T.setAttribute(R,new I.constructor(I.array.slice(0,o*I.itemSize),I.itemSize,I.normalized)),R in c)for(let P=0;P<c[R].length;P++){let F=c[R][P];T.morphAttributes[R][P]=new F.constructor(F.array.slice(0,o*F.itemSize),F.itemSize,F.normalized)}}return T.setIndex(u),T}function Ybe(i,e){if(e===Q8)return console.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles."),i;if(e===UM||e===J8){let t=i.getIndex();if(t===null){let o=[],a=i.getAttribute("position");if(a!==void 0){for(let l=0;l<a.count;l++)o.push(l);i.setIndex(o),t=i.getIndex()}else return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Undefined position attribute. Processing not possible."),i}let n=t.count-2,r=[];if(e===UM)for(let o=1;o<=n;o++)r.push(t.getX(0)),r.push(t.getX(o)),r.push(t.getX(o+1));else for(let o=0;o<n;o++)o%2===0?(r.push(t.getX(o)),r.push(t.getX(o+1)),r.push(t.getX(o+2))):(r.push(t.getX(o+2)),r.push(t.getX(o+1)),r.push(t.getX(o)));r.length/3!==n&&console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unable to generate correct amount of triangles.");let s=i.clone();return s.setIndex(r),s.clearGroups(),s}else return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unknown draw mode:",e),i}function Zbe(i){let e=new re,t=new re,n=new re,r=new re,s=new re,o=new re,a=new re,l=new re,c=new re;function u(ce,he,ve,Re,Qe,Fe,mt,Ee){e.fromBufferAttribute(he,Qe),t.fromBufferAttribute(he,Fe),n.fromBufferAttribute(he,mt);let Ve=ce.morphTargetInfluences;if(ve&&Ve){a.set(0,0,0),l.set(0,0,0),c.set(0,0,0);for(let Ye=0,Mt=ve.length;Ye<Mt;Ye++){let Et=Ve[Ye],Pt=ve[Ye];Et!==0&&(r.fromBufferAttribute(Pt,Qe),s.fromBufferAttribute(Pt,Fe),o.fromBufferAttribute(Pt,mt),Re?(a.addScaledVector(r,Et),l.addScaledVector(s,Et),c.addScaledVector(o,Et)):(a.addScaledVector(r.sub(e),Et),l.addScaledVector(s.sub(t),Et),c.addScaledVector(o.sub(n),Et)))}e.add(a),t.add(l),n.add(c)}ce.isSkinnedMesh&&(ce.applyBoneTransform(Qe,e),ce.applyBoneTransform(Fe,t),ce.applyBoneTransform(mt,n)),Ee[Qe*3+0]=e.x,Ee[Qe*3+1]=e.y,Ee[Qe*3+2]=e.z,Ee[Fe*3+0]=t.x,Ee[Fe*3+1]=t.y,Ee[Fe*3+2]=t.z,Ee[mt*3+0]=n.x,Ee[mt*3+1]=n.y,Ee[mt*3+2]=n.z}let f=i.geometry,d=i.material,A,y,w,S=f.index,T=f.attributes.position,R=f.morphAttributes.position,I=f.morphTargetsRelative,P=f.attributes.normal,F=f.morphAttributes.normal,D=f.groups,L=f.drawRange,C,B,k,z,G,W,Y,H=new Float32Array(T.count*T.itemSize),$=new Float32Array(P.count*P.itemSize);if(S!==null)if(Array.isArray(d))for(C=0,k=D.length;C<k;C++)for(G=D[C],W=Math.max(G.start,L.start),Y=Math.min(G.start+G.count,L.start+L.count),B=W,z=Y;B<z;B+=3)A=S.getX(B),y=S.getX(B+1),w=S.getX(B+2),u(i,T,R,I,A,y,w,H),u(i,P,F,I,A,y,w,$);else for(W=Math.max(0,L.start),Y=Math.min(S.count,L.start+L.count),C=W,k=Y;C<k;C+=3)A=S.getX(C),y=S.getX(C+1),w=S.getX(C+2),u(i,T,R,I,A,y,w,H),u(i,P,F,I,A,y,w,$);else if(Array.isArray(d))for(C=0,k=D.length;C<k;C++)for(G=D[C],W=Math.max(G.start,L.start),Y=Math.min(G.start+G.count,L.start+L.count),B=W,z=Y;B<z;B+=3)A=B,y=B+1,w=B+2,u(i,T,R,I,A,y,w,H),u(i,P,F,I,A,y,w,$);else for(W=Math.max(0,L.start),Y=Math.min(T.count,L.start+L.count),C=W,k=Y;C<k;C+=3)A=C,y=C+1,w=C+2,u(i,T,R,I,A,y,w,H),u(i,P,F,I,A,y,w,$);let J=new Ln(H,3),te=new Ln($,3);return{positionAttribute:T,normalAttribute:P,morphedPositionAttribute:J,morphedNormalAttribute:te}}function Kbe(i){if(i.groups.length===0)return console.warn("THREE.BufferGeometryUtils.mergeGroups(): No groups are defined. Nothing to merge."),i;let e=i.groups;if(e=e.sort((o,a)=>o.materialIndex!==a.materialIndex?o.materialIndex-a.materialIndex:o.start-a.start),i.getIndex()===null){let o=i.getAttribute("position"),a=[];for(let l=0;l<o.count;l+=3)a.push(l,l+1,l+2);i.setIndex(a)}let t=i.getIndex(),n=[];for(let o=0;o<e.length;o++){let a=e[o],l=a.start,c=l+a.count;for(let u=l;u<c;u++)n.push(t.getX(u))}i.dispose(),i.setIndex(n);let r=0;for(let o=0;o<e.length;o++){let a=e[o];a.start=r,r+=a.count}let s=e[0];i.groups=[s];for(let o=1;o<e.length;o++){let a=e[o];s.materialIndex===a.materialIndex?s.count+=a.count:(s=a,i.groups.push(s))}return i}function Qbe(i,e=Math.PI/3){let t=i.index?i.toNonIndexed():i,n=t.attributes.position,r=n.count,s;if(n.isBufferAttribute===!0&&n.itemSize===3&&n.normalized===!1)s=n.array;else{s=new Float64Array(r*3);for(let P=0;P<r;P++)s[3*P+0]=n.getX(P),s[3*P+1]=n.getY(P),s[3*P+2]=n.getZ(P)}let o=Math.cos(e),a=(1+1e-10)*100,l=r/3,c=new Float64Array(l*3);for(let P=0;P<l;P++){let F=9*P,D=s[F+0],L=s[F+1],C=s[F+2],B=s[F+3],k=s[F+4],z=s[F+5],G=s[F+6],W=s[F+7],Y=s[F+8],H=G-B,$=W-k,J=Y-z,te=D-B,ce=L-k,he=C-z,ve=$*he-J*ce,Re=J*te-H*he,Qe=H*ce-$*te,Fe=1/(Math.sqrt(ve*ve+Re*Re+Qe*Qe)||1);c[3*P+0]=ve*Fe,c[3*P+1]=Re*Fe,c[3*P+2]=Qe*Fe}let u=new Int32Array(r),f=new Int32Array(r*3),d=1;for(;d<r*2;)d<<=1;let A=d-1,y=new Int32Array(d),w=0;for(let P=0;P<r;P++){let F=3*P,D=~~(s[F+0]*a),L=~~(s[F+1]*a),C=~~(s[F+2]*a),B=(Math.imul(D,73856093)^Math.imul(L,19349663)^Math.imul(C,83492791))&A;for(;;){let k=y[B];if(k===0){let G=3*w;f[G+0]=D,f[G+1]=L,f[G+2]=C,y[B]=w+1,u[P]=w++;break}let z=3*(k-1);if(f[z+0]===D&&f[z+1]===L&&f[z+2]===C){u[P]=k-1;break}B=B+1&A}}let S=new Int32Array(w+1);for(let P=0;P<r;P++)S[u[P]+1]++;for(let P=0;P<w;P++)S[P+1]+=S[P];let T=new Int32Array(r),R=S.slice(0,w);for(let P=0;P<l;P++){let F=3*P;T[R[u[F+0]]++]=P,T[R[u[F+1]]++]=P,T[R[u[F+2]]++]=P}let I=new Float32Array(r*3);for(let P=0;P<l;P++){let F=3*P,D=c[F+0],L=c[F+1],C=c[F+2];for(let B=0;B<3;B++){let k=F+B,z=u[k],G=0,W=0,Y=0;for(let $=S[z],J=S[z+1];$<J;$++){let te=3*T[$],ce=c[te+0],he=c[te+1],ve=c[te+2];D*ce+L*he+C*ve>o&&(G+=ce,W+=he,Y+=ve)}let H=1/(Math.sqrt(G*G+W*W+Y*Y)||1);I[3*k+0]=G*H,I[3*k+1]=W*H,I[3*k+2]=Y*H}}return t.setAttribute("normal",new Hi(I,3,!1)),t}var st=(function(i){return typeof i=="function"?i:typeof i=="string"?function(e){return e[i]}:function(e){return i}});function QC(i){"@babel/helpers - typeof";return QC=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},QC(i)}var Jbe=/^\s+/,ewe=/\s+$/;function An(i,e){if(i=i||"",e=e||{},i instanceof An)return i;if(!(this instanceof An))return new An(i,e);var t=twe(i);this._originalInput=i,this._r=t.r,this._g=t.g,this._b=t.b,this._a=t.a,this._roundA=Math.round(100*this._a)/100,this._format=e.format||t.format,this._gradientType=e.gradientType,this._r<1&&(this._r=Math.round(this._r)),this._g<1&&(this._g=Math.round(this._g)),this._b<1&&(this._b=Math.round(this._b)),this._ok=t.ok}An.prototype={isDark:function(){return this.getBrightness()<128},isLight:function(){return!this.isDark()},isValid:function(){return this._ok},getOriginalInput:function(){return this._originalInput},getFormat:function(){return this._format},getAlpha:function(){return this._a},getBrightness:function(){var e=this.toRgb();return(e.r*299+e.g*587+e.b*114)/1e3},getLuminance:function(){var e=this.toRgb(),t,n,r,s,o,a;return t=e.r/255,n=e.g/255,r=e.b/255,t<=.03928?s=t/12.92:s=Math.pow((t+.055)/1.055,2.4),n<=.03928?o=n/12.92:o=Math.pow((n+.055)/1.055,2.4),r<=.03928?a=r/12.92:a=Math.pow((r+.055)/1.055,2.4),.2126*s+.7152*o+.0722*a},setAlpha:function(e){return this._a=$J(e),this._roundA=Math.round(100*this._a)/100,this},toHsv:function(){var e=qJ(this._r,this._g,this._b);return{h:e.h*360,s:e.s,v:e.v,a:this._a}},toHsvString:function(){var e=qJ(this._r,this._g,this._b),t=Math.round(e.h*360),n=Math.round(e.s*100),r=Math.round(e.v*100);return this._a==1?"hsv("+t+", "+n+"%, "+r+"%)":"hsva("+t+", "+n+"%, "+r+"%, "+this._roundA+")"},toHsl:function(){var e=GJ(this._r,this._g,this._b);return{h:e.h*360,s:e.s,l:e.l,a:this._a}},toHslString:function(){var e=GJ(this._r,this._g,this._b),t=Math.round(e.h*360),n=Math.round(e.s*100),r=Math.round(e.l*100);return this._a==1?"hsl("+t+", "+n+"%, "+r+"%)":"hsla("+t+", "+n+"%, "+r+"%, "+this._roundA+")"},toHex:function(e){return HJ(this._r,this._g,this._b,e)},toHexString:function(e){return"#"+this.toHex(e)},toHex8:function(e){return swe(this._r,this._g,this._b,this._a,e)},toHex8String:function(e){return"#"+this.toHex8(e)},toRgb:function(){return{r:Math.round(this._r),g:Math.round(this._g),b:Math.round(this._b),a:this._a}},toRgbString:function(){return this._a==1?"rgb("+Math.round(this._r)+", "+Math.round(this._g)+", "+Math.round(this._b)+")":"rgba("+Math.round(this._r)+", "+Math.round(this._g)+", "+Math.round(this._b)+", "+this._roundA+")"},toPercentageRgb:function(){return{r:Math.round(Ur(this._r,255)*100)+"%",g:Math.round(Ur(this._g,255)*100)+"%",b:Math.round(Ur(this._b,255)*100)+"%",a:this._a}},toPercentageRgbString:function(){return this._a==1?"rgb("+Math.round(Ur(this._r,255)*100)+"%, "+Math.round(Ur(this._g,255)*100)+"%, "+Math.round(Ur(this._b,255)*100)+"%)":"rgba("+Math.round(Ur(this._r,255)*100)+"%, "+Math.round(Ur(this._g,255)*100)+"%, "+Math.round(Ur(this._b,255)*100)+"%, "+this._roundA+")"},toName:function(){return this._a===0?"transparent":this._a<1?!1:gwe[HJ(this._r,this._g,this._b,!0)]||!1},toFilter:function(e){var t="#"+WJ(this._r,this._g,this._b,this._a),n=t,r=this._gradientType?"GradientType = 1, ":"";if(e){var s=An(e);n="#"+WJ(s._r,s._g,s._b,s._a)}return"progid:DXImageTransform.Microsoft.gradient("+r+"startColorstr="+t+",endColorstr="+n+")"},toString:function(e){var t=!!e;e=e||this._format;var n=!1,r=this._a<1&&this._a>=0,s=!t&&r&&(e==="hex"||e==="hex6"||e==="hex3"||e==="hex4"||e==="hex8"||e==="name");return s?e==="name"&&this._a===0?this.toName():this.toRgbString():(e==="rgb"&&(n=this.toRgbString()),e==="prgb"&&(n=this.toPercentageRgbString()),(e==="hex"||e==="hex6")&&(n=this.toHexString()),e==="hex3"&&(n=this.toHexString(!0)),e==="hex4"&&(n=this.toHex8String(!0)),e==="hex8"&&(n=this.toHex8String()),e==="name"&&(n=this.toName()),e==="hsl"&&(n=this.toHslString()),e==="hsv"&&(n=this.toHsvString()),n||this.toHexString())},clone:function(){return An(this.toString())},_applyModification:function(e,t){var n=e.apply(null,[this].concat([].slice.call(t)));return this._r=n._r,this._g=n._g,this._b=n._b,this.setAlpha(n._a),this},lighten:function(){return this._applyModification(cwe,arguments)},brighten:function(){return this._applyModification(uwe,arguments)},darken:function(){return this._applyModification(hwe,arguments)},desaturate:function(){return this._applyModification(owe,arguments)},saturate:function(){return this._applyModification(awe,arguments)},greyscale:function(){return this._applyModification(lwe,arguments)},spin:function(){return this._applyModification(fwe,arguments)},_applyCombination:function(e,t){return e.apply(null,[this].concat([].slice.call(t)))},analogous:function(){return this._applyCombination(mwe,arguments)},complement:function(){return this._applyCombination(dwe,arguments)},monochromatic:function(){return this._applyCombination(Awe,arguments)},splitcomplement:function(){return this._applyCombination(pwe,arguments)},triad:function(){return this._applyCombination(jJ,[3])},tetrad:function(){return this._applyCombination(jJ,[4])}};An.fromRatio=function(i,e){if(QC(i)=="object"){var t={};for(var n in i)i.hasOwnProperty(n)&&(n==="a"?t[n]=i[n]:t[n]=ww(i[n]));i=t}return An(i,e)};function twe(i){var e={r:0,g:0,b:0},t=1,n=null,r=null,s=null,o=!1,a=!1;return typeof i=="string"&&(i=ywe(i)),QC(i)=="object"&&(Vd(i.r)&&Vd(i.g)&&Vd(i.b)?(e=nwe(i.r,i.g,i.b),o=!0,a=String(i.r).substr(-1)==="%"?"prgb":"rgb"):Vd(i.h)&&Vd(i.s)&&Vd(i.v)?(n=ww(i.s),r=ww(i.v),e=rwe(i.h,n,r),o=!0,a="hsv"):Vd(i.h)&&Vd(i.s)&&Vd(i.l)&&(n=ww(i.s),s=ww(i.l),e=iwe(i.h,n,s),o=!0,a="hsl"),i.hasOwnProperty("a")&&(t=i.a)),t=$J(t),{ok:o,format:i.format||a,r:Math.min(255,Math.max(e.r,0)),g:Math.min(255,Math.max(e.g,0)),b:Math.min(255,Math.max(e.b,0)),a:t}}function nwe(i,e,t){return{r:Ur(i,255)*255,g:Ur(e,255)*255,b:Ur(t,255)*255}}function GJ(i,e,t){i=Ur(i,255),e=Ur(e,255),t=Ur(t,255);var n=Math.max(i,e,t),r=Math.min(i,e,t),s,o,a=(n+r)/2;if(n==r)s=o=0;else{var l=n-r;switch(o=a>.5?l/(2-n-r):l/(n+r),n){case i:s=(e-t)/l+(e<t?6:0);break;case e:s=(t-i)/l+2;break;case t:s=(i-e)/l+4;break}s/=6}return{h:s,s:o,l:a}}function iwe(i,e,t){var n,r,s;i=Ur(i,360),e=Ur(e,100),t=Ur(t,100);function o(c,u,f){return f<0&&(f+=1),f>1&&(f-=1),f<1/6?c+(u-c)*6*f:f<1/2?u:f<2/3?c+(u-c)*(2/3-f)*6:c}if(e===0)n=r=s=t;else{var a=t<.5?t*(1+e):t+e-t*e,l=2*t-a;n=o(l,a,i+1/3),r=o(l,a,i),s=o(l,a,i-1/3)}return{r:n*255,g:r*255,b:s*255}}function qJ(i,e,t){i=Ur(i,255),e=Ur(e,255),t=Ur(t,255);var n=Math.max(i,e,t),r=Math.min(i,e,t),s,o,a=n,l=n-r;if(o=n===0?0:l/n,n==r)s=0;else{switch(n){case i:s=(e-t)/l+(e<t?6:0);break;case e:s=(t-i)/l+2;break;case t:s=(i-e)/l+4;break}s/=6}return{h:s,s:o,v:a}}function rwe(i,e,t){i=Ur(i,360)*6,e=Ur(e,100),t=Ur(t,100);var n=Math.floor(i),r=i-n,s=t*(1-e),o=t*(1-r*e),a=t*(1-(1-r)*e),l=n%6,c=[t,o,s,s,a,t][l],u=[a,t,t,o,s,s][l],f=[s,s,a,t,t,o][l];return{r:c*255,g:u*255,b:f*255}}function HJ(i,e,t,n){var r=[Vu(Math.round(i).toString(16)),Vu(Math.round(e).toString(16)),Vu(Math.round(t).toString(16))];return n&&r[0].charAt(0)==r[0].charAt(1)&&r[1].charAt(0)==r[1].charAt(1)&&r[2].charAt(0)==r[2].charAt(1)?r[0].charAt(0)+r[1].charAt(0)+r[2].charAt(0):r.join("")}function swe(i,e,t,n,r){var s=[Vu(Math.round(i).toString(16)),Vu(Math.round(e).toString(16)),Vu(Math.round(t).toString(16)),Vu(YJ(n))];return r&&s[0].charAt(0)==s[0].charAt(1)&&s[1].charAt(0)==s[1].charAt(1)&&s[2].charAt(0)==s[2].charAt(1)&&s[3].charAt(0)==s[3].charAt(1)?s[0].charAt(0)+s[1].charAt(0)+s[2].charAt(0)+s[3].charAt(0):s.join("")}function WJ(i,e,t,n){var r=[Vu(YJ(n)),Vu(Math.round(i).toString(16)),Vu(Math.round(e).toString(16)),Vu(Math.round(t).toString(16))];return r.join("")}An.equals=function(i,e){return!i||!e?!1:An(i).toRgbString()==An(e).toRgbString()};An.random=function(){return An.fromRatio({r:Math.random(),g:Math.random(),b:Math.random()})};function owe(i,e){e=e===0?0:e||10;var t=An(i).toHsl();return t.s-=e/100,t.s=JC(t.s),An(t)}function awe(i,e){e=e===0?0:e||10;var t=An(i).toHsl();return t.s+=e/100,t.s=JC(t.s),An(t)}function lwe(i){return An(i).desaturate(100)}function cwe(i,e){e=e===0?0:e||10;var t=An(i).toHsl();return t.l+=e/100,t.l=JC(t.l),An(t)}function uwe(i,e){e=e===0?0:e||10;var t=An(i).toRgb();return t.r=Math.max(0,Math.min(255,t.r-Math.round(255*-(e/100)))),t.g=Math.max(0,Math.min(255,t.g-Math.round(255*-(e/100)))),t.b=Math.max(0,Math.min(255,t.b-Math.round(255*-(e/100)))),An(t)}function hwe(i,e){e=e===0?0:e||10;var t=An(i).toHsl();return t.l-=e/100,t.l=JC(t.l),An(t)}function fwe(i,e){var t=An(i).toHsl(),n=(t.h+e)%360;return t.h=n<0?360+n:n,An(t)}function dwe(i){var e=An(i).toHsl();return e.h=(e.h+180)%360,An(e)}function jJ(i,e){if(isNaN(e)||e<=0)throw new Error("Argument to polyad must be a positive number");for(var t=An(i).toHsl(),n=[An(i)],r=360/e,s=1;s<e;s++)n.push(An({h:(t.h+s*r)%360,s:t.s,l:t.l}));return n}function pwe(i){var e=An(i).toHsl(),t=e.h;return[An(i),An({h:(t+72)%360,s:e.s,l:e.l}),An({h:(t+216)%360,s:e.s,l:e.l})]}function mwe(i,e,t){e=e||6,t=t||30;var n=An(i).toHsl(),r=360/t,s=[An(i)];for(n.h=(n.h-(r*e>>1)+720)%360;--e;)n.h=(n.h+r)%360,s.push(An(n));return s}function Awe(i,e){e=e||6;for(var t=An(i).toHsv(),n=t.h,r=t.s,s=t.v,o=[],a=1/e;e--;)o.push(An({h:n,s:r,v:s})),s=(s+a)%1;return o}An.mix=function(i,e,t){t=t===0?0:t||50;var n=An(i).toRgb(),r=An(e).toRgb(),s=t/100,o={r:(r.r-n.r)*s+n.r,g:(r.g-n.g)*s+n.g,b:(r.b-n.b)*s+n.b,a:(r.a-n.a)*s+n.a};return An(o)};An.readability=function(i,e){var t=An(i),n=An(e);return(Math.max(t.getLuminance(),n.getLuminance())+.05)/(Math.min(t.getLuminance(),n.getLuminance())+.05)};An.isReadable=function(i,e,t){var n=An.readability(i,e),r,s;switch(s=!1,r=bwe(t),r.level+r.size){case"AAsmall":case"AAAlarge":s=n>=4.5;break;case"AAlarge":s=n>=3;break;case"AAAsmall":s=n>=7;break}return s};An.mostReadable=function(i,e,t){var n=null,r=0,s,o,a,l;t=t||{},o=t.includeFallbackColors,a=t.level,l=t.size;for(var c=0;c<e.length;c++)s=An.readability(i,e[c]),s>r&&(r=s,n=An(e[c]));return An.isReadable(i,n,{level:a,size:l})||!o?n:(t.includeFallbackColors=!1,An.mostReadable(i,["#fff","#000"],t))};var pO=An.names={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"0ff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000",blanchedalmond:"ffebcd",blue:"00f",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",burntsienna:"ea7e5d",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"0ff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkgrey:"a9a9a9",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkslategrey:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dimgrey:"696969",dodgerblue:"1e90ff",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"f0f",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",grey:"808080",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgray:"d3d3d3",lightgreen:"90ee90",lightgrey:"d3d3d3",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslategray:"789",lightslategrey:"789",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"0f0",limegreen:"32cd32",linen:"faf0e6",magenta:"f0f",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370db",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"db7093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",rebeccapurple:"663399",red:"f00",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",slategrey:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",wheat:"f5deb3",white:"fff",whitesmoke:"f5f5f5",yellow:"ff0",yellowgreen:"9acd32"},gwe=An.hexNames=vwe(pO);function vwe(i){var e={};for(var t in i)i.hasOwnProperty(t)&&(e[i[t]]=t);return e}function $J(i){return i=parseFloat(i),(isNaN(i)||i<0||i>1)&&(i=1),i}function Ur(i,e){_we(i)&&(i="100%");var t=xwe(i);return i=Math.min(e,Math.max(0,parseFloat(i))),t&&(i=parseInt(i*e,10)/100),Math.abs(i-e)<1e-6?1:i%e/parseFloat(e)}function JC(i){return Math.min(1,Math.max(0,i))}function rc(i){return parseInt(i,16)}function _we(i){return typeof i=="string"&&i.indexOf(".")!=-1&&parseFloat(i)===1}function xwe(i){return typeof i=="string"&&i.indexOf("%")!=-1}function Vu(i){return i.length==1?"0"+i:""+i}function ww(i){return i<=1&&(i=i*100+"%"),i}function YJ(i){return Math.round(parseFloat(i)*255).toString(16)}function XJ(i){return rc(i)/255}var zu=(function(){var i="[-\\+]?\\d+%?",e="[-\\+]?\\d*\\.\\d+%?",t="(?:"+e+")|(?:"+i+")",n="[\\s|\\(]+("+t+")[,|\\s]+("+t+")[,|\\s]+("+t+")\\s*\\)?",r="[\\s|\\(]+("+t+")[,|\\s]+("+t+")[,|\\s]+("+t+")[,|\\s]+("+t+")\\s*\\)?";return{CSS_UNIT:new RegExp(t),rgb:new RegExp("rgb"+n),rgba:new RegExp("rgba"+r),hsl:new RegExp("hsl"+n),hsla:new RegExp("hsla"+r),hsv:new RegExp("hsv"+n),hsva:new RegExp("hsva"+r),hex3:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex6:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,hex4:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex8:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/}})();function Vd(i){return!!zu.CSS_UNIT.exec(i)}function ywe(i){i=i.replace(Jbe,"").replace(ewe,"").toLowerCase();var e=!1;if(pO[i])i=pO[i],e=!0;else if(i=="transparent")return{r:0,g:0,b:0,a:0,format:"name"};var t;return(t=zu.rgb.exec(i))?{r:t[1],g:t[2],b:t[3]}:(t=zu.rgba.exec(i))?{r:t[1],g:t[2],b:t[3],a:t[4]}:(t=zu.hsl.exec(i))?{h:t[1],s:t[2],l:t[3]}:(t=zu.hsla.exec(i))?{h:t[1],s:t[2],l:t[3],a:t[4]}:(t=zu.hsv.exec(i))?{h:t[1],s:t[2],v:t[3]}:(t=zu.hsva.exec(i))?{h:t[1],s:t[2],v:t[3],a:t[4]}:(t=zu.hex8.exec(i))?{r:rc(t[1]),g:rc(t[2]),b:rc(t[3]),a:XJ(t[4]),format:e?"name":"hex8"}:(t=zu.hex6.exec(i))?{r:rc(t[1]),g:rc(t[2]),b:rc(t[3]),format:e?"name":"hex"}:(t=zu.hex4.exec(i))?{r:rc(t[1]+""+t[1]),g:rc(t[2]+""+t[2]),b:rc(t[3]+""+t[3]),a:XJ(t[4]+""+t[4]),format:e?"name":"hex8"}:(t=zu.hex3.exec(i))?{r:rc(t[1]+""+t[1]),g:rc(t[2]+""+t[2]),b:rc(t[3]+""+t[3]),format:e?"name":"hex"}:!1}function bwe(i){var e,t;return i=i||{level:"AA",size:"small"},e=(i.level||"AA").toUpperCase(),t=(i.size||"small").toLowerCase(),e!=="AA"&&e!=="AAA"&&(e="AA"),t!=="small"&&t!=="large"&&(t="small"),{level:e,size:t}}function vO(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 wwe(i){if(Array.isArray(i))return i}function Swe(i){if(Array.isArray(i))return vO(i)}function ZJ(i,e,t){if(typeof i=="function"?i===e:i.has(e))return arguments.length<3?e:t;throw new TypeError("Private element is not present on this object")}function Twe(i,e){if(e.has(i))throw new TypeError("Cannot initialize the same private elements twice on an object")}function Ewe(i,e){if(!(i instanceof e))throw new TypeError("Cannot call a class as a function")}function pa(i,e){return i.get(ZJ(i,e))}function I_(i,e,t){Twe(i,e),e.set(i,t)}function eR(i,e,t){return i.set(ZJ(i,e),t),t}function Mwe(i,e){for(var t=0;t<e.length;t++){var n=e[t];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(i,Bwe(n.key),n)}}function Cwe(i,e,t){return e&&Mwe(i.prototype,e),Object.defineProperty(i,"prototype",{writable:!1}),i}function Rwe(i){if(typeof Symbol<"u"&&i[Symbol.iterator]!=null||i["@@iterator"]!=null)return Array.from(i)}function Pwe(i,e){var t=i==null?null:typeof Symbol<"u"&&i[Symbol.iterator]||i["@@iterator"];if(t!=null){var n,r,s,o,a=[],l=!0,c=!1;try{if(s=(t=t.call(i)).next,e!==0)for(;!(l=(n=s.call(t)).done)&&(a.push(n.value),a.length!==e);l=!0);}catch(u){c=!0,r=u}finally{try{if(!l&&t.return!=null&&(o=t.return(),Object(o)!==o))return}finally{if(c)throw r}}return a}}function Iwe(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.4124+In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Lwe(){throw new TypeError(`Invalid attempt to spread non-iterable instance.4125+In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Dwe(i,e){return wwe(i)||Pwe(i,e)||KJ(i,e)||Iwe()}function Nwe(i){return Swe(i)||Rwe(i)||KJ(i)||Lwe()}function Fwe(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 String(i)}function Bwe(i){var e=Fwe(i,"string");return typeof e=="symbol"?e:e+""}function KJ(i,e){if(i){if(typeof i=="string")return vO(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)?vO(i,e):void 0}}var L_=new WeakMap,Sw=new WeakMap,D_=new WeakMap,mO=new WeakMap,AO=new WeakMap,gO=new WeakMap,QJ=(function(){function i(){Ewe(this,i),I_(this,L_,new Map),I_(this,Sw,new Map),I_(this,D_,function(e){return e}),I_(this,mO,function(){return{}}),I_(this,AO,function(){}),I_(this,gO,function(){})}return Cwe(i,[{key:"getObj",value:function(t){return pa(L_,this).get(pa(D_,this).call(this,t))}},{key:"getData",value:function(t){return pa(Sw,this).get(t)}},{key:"entries",value:function(){return Nwe(pa(Sw,this).entries()).map(function(t){var n=Dwe(t,2),r=n[0],s=n[1];return[s,r]})}},{key:"id",value:function(t){return eR(D_,this,st(t)),this}},{key:"onCreateObj",value:function(t){return eR(mO,this,t),this}},{key:"onUpdateObj",value:function(t){return eR(AO,this,t),this}},{key:"onRemoveObj",value:function(t){return eR(gO,this,t),this}},{key:"digest",value:function(t){var n=this;t.filter(function(s){return!pa(L_,n).has(pa(D_,n).call(n,s))}).forEach(function(s){var o=pa(mO,n).call(n,s);pa(L_,n).set(pa(D_,n).call(n,s),o),pa(Sw,n).set(o,s)});var r=new Map(t.map(function(s){return[pa(D_,n).call(n,s),s]}));return pa(L_,this).forEach(function(s,o){r.has(o)?pa(AO,n).call(n,s,r.get(o)):(pa(gO,n).call(n,s,o),pa(L_,n).delete(o),pa(Sw,n).delete(s))}),this}},{key:"clear",value:function(){return this.digest([]),this}}])})();var m1=kq(JJ(),1);var Ei=11102230246251565e-32,Xs=134217729,Ew=(3+8*Ei)*Ei;function Ig(i,e,t,n,r){let s,o,a,l,c=e[0],u=n[0],f=0,d=0;u>c==u>-c?(s=c,c=e[++f]):(s=u,u=n[++d]);let A=0;if(f<i&&d<t)for(u>c==u>-c?(o=c+s,a=s-(o-c),c=e[++f]):(o=u+s,a=s-(o-u),u=n[++d]),s=o,a!==0&&(r[A++]=a);f<i&&d<t;)u>c==u>-c?(o=s+c,l=o-s,a=s-(o-l)+(c-l),c=e[++f]):(o=s+u,l=o-s,a=s-(o-l)+(u-l),u=n[++d]),s=o,a!==0&&(r[A++]=a);for(;f<i;)o=s+c,l=o-s,a=s-(o-l)+(c-l),c=e[++f],s=o,a!==0&&(r[A++]=a);for(;d<t;)o=s+u,l=o-s,a=s-(o-l)+(u-l),u=n[++d],s=o,a!==0&&(r[A++]=a);return(s!==0||A===0)&&(r[A++]=s),A}function Mw(i,e){let t=e[0];for(let n=1;n<i;n++)t+=e[n];return t}function ht(i){return new Float64Array(i)}var Owe=(3+16*Ei)*Ei,Uwe=(2+12*Ei)*Ei,kwe=(9+64*Ei)*Ei*Ei,N_=ht(4),eee=ht(8),tee=ht(12),nee=ht(16),$a=ht(4);function zwe(i,e,t,n,r,s,o){let a,l,c,u,f,d,A,y,w,S,T,R,I,P,F,D,L,C,B=i-r,k=t-r,z=e-s,G=n-s;P=B*G,d=Xs*B,A=d-(d-B),y=B-A,d=Xs*G,w=d-(d-G),S=G-w,F=y*S-(P-A*w-y*w-A*S),D=z*k,d=Xs*z,A=d-(d-z),y=z-A,d=Xs*k,w=d-(d-k),S=k-w,L=y*S-(D-A*w-y*w-A*S),T=F-L,f=F-T,N_[0]=F-(T+f)+(f-L),R=P+T,f=R-P,I=P-(R-f)+(T-f),T=I-D,f=I-T,N_[1]=I-(T+f)+(f-D),C=R+T,f=C-R,N_[2]=R-(C-f)+(T-f),N_[3]=C;let W=Mw(4,N_),Y=Uwe*o;if(W>=Y||-W>=Y||(f=i-B,a=i-(B+f)+(f-r),f=t-k,c=t-(k+f)+(f-r),f=e-z,l=e-(z+f)+(f-s),f=n-G,u=n-(G+f)+(f-s),a===0&&l===0&&c===0&&u===0)||(Y=kwe*o+Ew*Math.abs(W),W+=B*u+G*a-(z*c+k*l),W>=Y||-W>=Y))return W;P=a*G,d=Xs*a,A=d-(d-a),y=a-A,d=Xs*G,w=d-(d-G),S=G-w,F=y*S-(P-A*w-y*w-A*S),D=l*k,d=Xs*l,A=d-(d-l),y=l-A,d=Xs*k,w=d-(d-k),S=k-w,L=y*S-(D-A*w-y*w-A*S),T=F-L,f=F-T,$a[0]=F-(T+f)+(f-L),R=P+T,f=R-P,I=P-(R-f)+(T-f),T=I-D,f=I-T,$a[1]=I-(T+f)+(f-D),C=R+T,f=C-R,$a[2]=R-(C-f)+(T-f),$a[3]=C;let H=Ig(4,N_,4,$a,eee);P=B*u,d=Xs*B,A=d-(d-B),y=B-A,d=Xs*u,w=d-(d-u),S=u-w,F=y*S-(P-A*w-y*w-A*S),D=z*c,d=Xs*z,A=d-(d-z),y=z-A,d=Xs*c,w=d-(d-c),S=c-w,L=y*S-(D-A*w-y*w-A*S),T=F-L,f=F-T,$a[0]=F-(T+f)+(f-L),R=P+T,f=R-P,I=P-(R-f)+(T-f),T=I-D,f=I-T,$a[1]=I-(T+f)+(f-D),C=R+T,f=C-R,$a[2]=R-(C-f)+(T-f),$a[3]=C;let $=Ig(H,eee,4,$a,tee);P=a*u,d=Xs*a,A=d-(d-a),y=a-A,d=Xs*u,w=d-(d-u),S=u-w,F=y*S-(P-A*w-y*w-A*S),D=l*c,d=Xs*l,A=d-(d-l),y=l-A,d=Xs*c,w=d-(d-c),S=c-w,L=y*S-(D-A*w-y*w-A*S),T=F-L,f=F-T,$a[0]=F-(T+f)+(f-L),R=P+T,f=R-P,I=P-(R-f)+(T-f),T=I-D,f=I-T,$a[1]=I-(T+f)+(f-D),C=R+T,f=C-R,$a[2]=R-(C-f)+(T-f),$a[3]=C;let J=Ig($,tee,4,$a,nee);return nee[J-1]}function Q0(i,e,t,n,r,s){let o=(e-s)*(t-r),a=(i-r)*(n-s),l=o-a,c=Math.abs(o+a);return Math.abs(l)>=Owe*c?l:-zwe(i,e,t,n,r,s,c)}var ost=(7+56*Ei)*Ei,ast=(3+28*Ei)*Ei,lst=(26+288*Ei)*Ei*Ei,cst=ht(4),ust=ht(4),hst=ht(4),fst=ht(4),dst=ht(4),pst=ht(4),mst=ht(4),Ast=ht(4),gst=ht(4),vst=ht(8),_st=ht(8),xst=ht(8),yst=ht(4),bst=ht(8),wst=ht(8),Sst=ht(16),Tst=ht(12),Est=ht(192),Mst=ht(192);var Pst=(10+96*Ei)*Ei,Ist=(4+48*Ei)*Ei,Lst=(44+576*Ei)*Ei*Ei,Dst=ht(4),Nst=ht(4),Fst=ht(4),Bst=ht(4),Ost=ht(4),Ust=ht(4),kst=ht(4),zst=ht(4),Vst=ht(8),Gst=ht(8),qst=ht(8),Hst=ht(8),Wst=ht(8),jst=ht(8),Xst=ht(8),$st=ht(8),Yst=ht(8),Zst=ht(4),Kst=ht(4),Qst=ht(4),Jst=ht(8),eot=ht(16),tot=ht(16),not=ht(16),iot=ht(32),rot=ht(32),sot=ht(48),oot=ht(64),aot=ht(1152),lot=ht(1152);var fot=(16+224*Ei)*Ei,dot=(5+72*Ei)*Ei,pot=(71+1408*Ei)*Ei*Ei,mot=ht(4),Aot=ht(4),got=ht(4),vot=ht(4),_ot=ht(4),xot=ht(4),yot=ht(4),bot=ht(4),wot=ht(4),Sot=ht(4),Tot=ht(24),Eot=ht(24),Mot=ht(24),Cot=ht(24),Rot=ht(24),Pot=ht(24),Iot=ht(24),Lot=ht(24),Dot=ht(24),Not=ht(24),Fot=ht(1152),Bot=ht(1152),Oot=ht(1152),Uot=ht(1152),kot=ht(1152),zot=ht(2304),Vot=ht(2304),Got=ht(3456),qot=ht(5760),Hot=ht(8),Wot=ht(8),jot=ht(8),Xot=ht(16),$ot=ht(24),Yot=ht(48),Zot=ht(48),Kot=ht(96),Qot=ht(192),Jot=ht(384),eat=ht(384),tat=ht(384),nat=ht(768);var iat=ht(96),rat=ht(96),sat=ht(96),oat=ht(1152);var ree=Math.pow(2,-52),tR=new Uint32Array(512),J0=class i{static from(e,t=jwe,n=Xwe){let r=e.length,s=new Float64Array(r*2);for(let o=0;o<r;o++){let a=e[o];s[2*o]=t(a),s[2*o+1]=n(a)}return new i(s)}constructor(e){let t=e.length>>1;if(t>0&&typeof e[0]!="number")throw new Error("Expected coords to contain numbers.");this.coords=e;let n=Math.max(2*t-5,0);this._triangles=new Uint32Array(n*3),this._halfedges=new Int32Array(n*3),this._hashSize=Math.ceil(Math.sqrt(t)),this._hullPrev=new Uint32Array(t),this._hullNext=new Uint32Array(t),this._hullTri=new Uint32Array(t),this._hullHash=new Int32Array(this._hashSize),this._ids=new Uint32Array(t),this._dists=new Float64Array(t),this.trianglesLen=0,this._cx=0,this._cy=0,this._hullStart=0,this.hull=this._triangles,this.triangles=this._triangles,this.halfedges=this._halfedges,this.update()}update(){let{coords:e,_hullPrev:t,_hullNext:n,_hullTri:r,_hullHash:s}=this,o=e.length>>1,a=1/0,l=1/0,c=-1/0,u=-1/0;for(let B=0;B<o;B++){let k=e[2*B],z=e[2*B+1];k<a&&(a=k),z<l&&(l=z),k>c&&(c=k),z>u&&(u=z),this._ids[B]=B}let f=(a+c)/2,d=(l+u)/2,A=0,y=0,w=0;for(let B=0,k=1/0;B<o;B++){let z=xO(f,d,e[2*B],e[2*B+1]);z<k&&(A=B,k=z)}let S=e[2*A],T=e[2*A+1];for(let B=0,k=1/0;B<o;B++){if(B===A)continue;let z=xO(S,T,e[2*B],e[2*B+1]);z<k&&z>0&&(y=B,k=z)}let R=e[2*y],I=e[2*y+1],P=1/0;for(let B=0;B<o;B++){if(B===A||B===y)continue;let k=Hwe(S,T,R,I,e[2*B],e[2*B+1]);k<P&&(w=B,P=k)}let F=e[2*w],D=e[2*w+1];if(P===1/0){for(let z=0;z<o;z++)this._dists[z]=e[2*z]-e[0]||e[2*z+1]-e[1];F_(this._ids,this._dists,0,o-1);let B=new Uint32Array(o),k=0;for(let z=0,G=-1/0;z<o;z++){let W=this._ids[z],Y=this._dists[W];Y>G&&(B[k++]=W,G=Y)}this.hull=B.subarray(0,k),this.triangles=new Uint32Array(0),this.halfedges=new Int32Array(0);return}if(Q0(S,T,R,I,F,D)<0){let B=y,k=R,z=I;y=w,R=F,I=D,w=B,F=k,D=z}let L=Wwe(S,T,R,I,F,D);this._cx=L.x,this._cy=L.y;for(let B=0;B<o;B++)this._dists[B]=xO(e[2*B],e[2*B+1],L.x,L.y);F_(this._ids,this._dists,0,o-1),this._hullStart=A;let C=3;n[A]=t[w]=y,n[y]=t[A]=w,n[w]=t[y]=A,r[A]=0,r[y]=1,r[w]=2,s.fill(-1),s[this._hashKey(S,T)]=A,s[this._hashKey(R,I)]=y,s[this._hashKey(F,D)]=w,this.trianglesLen=0,this._addTriangle(A,y,w,-1,-1,-1);for(let B=0,k=0,z=0;B<this._ids.length;B++){let G=this._ids[B],W=e[2*G],Y=e[2*G+1];if(B>0&&Math.abs(W-k)<=ree&&Math.abs(Y-z)<=ree||(k=W,z=Y,G===A||G===y||G===w))continue;let H=0;for(let he=0,ve=this._hashKey(W,Y);he<this._hashSize&&(H=s[(ve+he)%this._hashSize],!(H!==-1&&H!==n[H]));he++);H=t[H];let $=H,J;for(;J=n[$],Q0(W,Y,e[2*$],e[2*$+1],e[2*J],e[2*J+1])>=0;)if($=J,$===H){$=-1;break}if($===-1)continue;let te=this._addTriangle($,G,n[$],-1,-1,r[$]);r[G]=this._legalize(te+2),r[$]=te,C++;let ce=n[$];for(;J=n[ce],Q0(W,Y,e[2*ce],e[2*ce+1],e[2*J],e[2*J+1])<0;)te=this._addTriangle(ce,G,J,r[G],-1,r[ce]),r[G]=this._legalize(te+2),n[ce]=ce,C--,ce=J;if($===H)for(;J=t[$],Q0(W,Y,e[2*J],e[2*J+1],e[2*$],e[2*$+1])<0;)te=this._addTriangle(J,G,$,-1,r[$],r[J]),this._legalize(te+2),r[J]=te,n[$]=$,C--,$=J;this._hullStart=t[G]=$,n[$]=t[ce]=G,n[G]=ce,s[this._hashKey(W,Y)]=G,s[this._hashKey(e[2*$],e[2*$+1])]=$}this.hull=new Uint32Array(C);for(let B=0,k=this._hullStart;B<C;B++)this.hull[B]=k,k=n[k];this.triangles=this._triangles.subarray(0,this.trianglesLen),this.halfedges=this._halfedges.subarray(0,this.trianglesLen)}_hashKey(e,t){return Math.floor(Gwe(e-this._cx,t-this._cy)*this._hashSize)%this._hashSize}_legalize(e){let{_triangles:t,_halfedges:n,coords:r}=this,s=0,o=0;for(;;){let a=n[e],l=e-e%3;if(o=l+(e+2)%3,a===-1){if(s===0)break;e=tR[--s];continue}let c=a-a%3,u=l+(e+1)%3,f=c+(a+2)%3,d=t[o],A=t[e],y=t[u],w=t[f];if(qwe(r[2*d],r[2*d+1],r[2*A],r[2*A+1],r[2*y],r[2*y+1],r[2*w],r[2*w+1])){t[e]=w,t[a]=d;let T=n[f];if(T===-1){let I=this._hullStart;do{if(this._hullTri[I]===f){this._hullTri[I]=e;break}I=this._hullPrev[I]}while(I!==this._hullStart)}this._link(e,T),this._link(a,n[o]),this._link(o,f);let R=c+(a+1)%3;s<tR.length&&(tR[s++]=R)}else{if(s===0)break;e=tR[--s]}}return o}_link(e,t){this._halfedges[e]=t,t!==-1&&(this._halfedges[t]=e)}_addTriangle(e,t,n,r,s,o){let a=this.trianglesLen;return this._triangles[a]=e,this._triangles[a+1]=t,this._triangles[a+2]=n,this._link(a,r),this._link(a+1,s),this._link(a+2,o),this.trianglesLen+=3,a}};function Gwe(i,e){let t=i/(Math.abs(i)+Math.abs(e));return(e>0?3-t:1+t)/4}function xO(i,e,t,n){let r=i-t,s=e-n;return r*r+s*s}function qwe(i,e,t,n,r,s,o,a){let l=i-o,c=e-a,u=t-o,f=n-a,d=r-o,A=s-a,y=l*l+c*c,w=u*u+f*f,S=d*d+A*A;return l*(f*S-w*A)-c*(u*S-w*d)+y*(u*A-f*d)<0}function Hwe(i,e,t,n,r,s){let o=t-i,a=n-e,l=r-i,c=s-e,u=o*o+a*a,f=l*l+c*c,d=.5/(o*c-a*l),A=(c*u-a*f)*d,y=(o*f-l*u)*d;return A*A+y*y}function Wwe(i,e,t,n,r,s){let o=t-i,a=n-e,l=r-i,c=s-e,u=o*o+a*a,f=l*l+c*c,d=.5/(o*c-a*l),A=i+(c*u-a*f)*d,y=e+(o*f-l*u)*d;return{x:A,y}}function F_(i,e,t,n){if(n-t<=20)for(let r=t+1;r<=n;r++){let s=i[r],o=e[s],a=r-1;for(;a>=t&&e[i[a]]>o;)i[a+1]=i[a--];i[a+1]=s}else{let r=t+n>>1,s=t+1,o=n;Cw(i,r,s),e[i[t]]>e[i[n]]&&Cw(i,t,n),e[i[s]]>e[i[n]]&&Cw(i,s,n),e[i[t]]>e[i[s]]&&Cw(i,t,s);let a=i[s],l=e[a];for(;;){do s++;while(e[i[s]]<l);do o--;while(e[i[o]]>l);if(o<s)break;Cw(i,s,o)}i[t+1]=i[o],i[o]=a,n-s+1>=o-t?(F_(i,e,s,n),F_(i,e,t,o-1)):(F_(i,e,t,o-1),F_(i,e,s,n))}}function Cw(i,e,t){let n=i[e];i[e]=i[t],i[t]=n}function jwe(i){return i[0]}function Xwe(i){return i[1]}function see(i,e){var t,n,r=0,s,o,a,l,c,u,f,d=i[0],A=i[1],y=e.length;for(t=0;t<y;t++){n=0;var w=e[t],S=w.length-1;if(u=w[0],u[0]!==w[S][0]&&u[1]!==w[S][1])throw new Error("First and last coordinates in a ring must be the same");for(o=u[0]-d,a=u[1]-A,n;n<S;n++){if(f=w[n+1],l=f[0]-d,c=f[1]-A,a===0&&c===0){if(l<=0&&o>=0||o<=0&&l>=0)return 0}else if(c>=0&&a<=0||c<=0&&a>=0){if(s=Q0(o,l,a,c,0,0),s===0)return 0;(s>0&&c>0&&a<=0||s<0&&c<=0&&a>0)&&r++}u=f,a=c,o=l}}return r%2!==0}function oee(i){if(!i)throw new Error("coord is required");if(!Array.isArray(i)){if(i.type==="Feature"&&i.geometry!==null&&i.geometry.type==="Point")return[...i.geometry.coordinates];if(i.type==="Point")return[...i.coordinates]}if(Array.isArray(i)&&i.length>=2&&!Array.isArray(i[0])&&!Array.isArray(i[1]))return[...i];throw new Error("coord must be GeoJSON Point or an Array of numbers")}function aee(i){return i.type==="Feature"?i.geometry:i}function $we(i,e,t={}){if(!i)throw new Error("point is required");if(!e)throw new Error("polygon is required");let n=oee(i),r=aee(e),s=r.type,o=e.bbox,a=r.coordinates;if(o&&Ywe(n,o)===!1)return!1;s==="Polygon"&&(a=[a]);let l=!1;for(var c=0;c<a.length;++c){let u=see(n,a[c]);if(u===0)return!t.ignoreBoundary;u&&(l=!0)}return l}function Ywe(i,e){return e[0]<=i[0]&&e[1]<=i[1]&&e[2]>=i[0]&&e[3]>=i[1]}var lee=$we;var $c=class{constructor(){this._x0=this._y0=this._x1=this._y1=null,this._=""}moveTo(e,t){this._+=`M${this._x0=this._x1=+e},${this._y0=this._y1=+t}`}closePath(){this._x1!==null&&(this._x1=this._x0,this._y1=this._y0,this._+="Z")}lineTo(e,t){this._+=`L${this._x1=+e},${this._y1=+t}`}arc(e,t,n){e=+e,t=+t,n=+n;let r=e+n,s=t;if(n<0)throw new Error("negative radius");this._x1===null?this._+=`M${r},${s}`:(Math.abs(this._x1-r)>1e-6||Math.abs(this._y1-s)>1e-6)&&(this._+="L"+r+","+s),n&&(this._+=`A${n},${n},0,1,1,${e-n},${t}A${n},${n},0,1,1,${this._x1=r},${this._y1=s}`)}rect(e,t,n,r){this._+=`M${this._x0=this._x1=+e},${this._y0=this._y1=+t}h${+n}v${+r}h${-n}Z`}value(){return this._||null}};var em=class{constructor(){this._=[]}moveTo(e,t){this._.push([e,t])}closePath(){this._.push(this._[0].slice())}lineTo(e,t){this._.push([e,t])}value(){return this._.length?this._:null}};var Rw=class{constructor(e,[t,n,r,s]=[0,0,960,500]){if(!((r=+r)>=(t=+t))||!((s=+s)>=(n=+n)))throw new Error("invalid bounds");this.delaunay=e,this._circumcenters=new Float64Array(e.points.length*2),this.vectors=new Float64Array(e.points.length*2),this.xmax=r,this.xmin=t,this.ymax=s,this.ymin=n,this._init()}update(){return this.delaunay.update(),this._init(),this}_init(){let{delaunay:{points:e,hull:t,triangles:n},vectors:r}=this,s,o,a=this.circumcenters=this._circumcenters.subarray(0,n.length/3*2);for(let w=0,S=0,T=n.length,R,I;w<T;w+=3,S+=2){let P=n[w]*2,F=n[w+1]*2,D=n[w+2]*2,L=e[P],C=e[P+1],B=e[F],k=e[F+1],z=e[D],G=e[D+1],W=B-L,Y=k-C,H=z-L,$=G-C,J=(W*$-Y*H)*2;if(Math.abs(J)<1e-9){if(s===void 0){s=o=0;for(let ce of t)s+=e[ce*2],o+=e[ce*2+1];s/=t.length,o/=t.length}let te=1e9*Math.sign((s-L)*$-(o-C)*H);R=(L+z)/2-te*$,I=(C+G)/2+te*H}else{let te=1/J,ce=W*W+Y*Y,he=H*H+$*$;R=L+($*ce-Y*he)*te,I=C+(W*he-H*ce)*te}a[S]=R,a[S+1]=I}let l=t[t.length-1],c,u=l*4,f,d=e[2*l],A,y=e[2*l+1];r.fill(0);for(let w=0;w<t.length;++w)l=t[w],c=u,f=d,A=y,u=l*4,d=e[2*l],y=e[2*l+1],r[c+2]=r[u]=A-y,r[c+3]=r[u+1]=d-f}render(e){let t=e==null?e=new $c:void 0,{delaunay:{halfedges:n,inedges:r,hull:s},circumcenters:o,vectors:a}=this;if(s.length<=1)return null;for(let u=0,f=n.length;u<f;++u){let d=n[u];if(d<u)continue;let A=Math.floor(u/3)*2,y=Math.floor(d/3)*2,w=o[A],S=o[A+1],T=o[y],R=o[y+1];this._renderSegment(w,S,T,R,e)}let l,c=s[s.length-1];for(let u=0;u<s.length;++u){l=c,c=s[u];let f=Math.floor(r[c]/3)*2,d=o[f],A=o[f+1],y=l*4,w=this._project(d,A,a[y+2],a[y+3]);w&&this._renderSegment(d,A,w[0],w[1],e)}return t&&t.value()}renderBounds(e){let t=e==null?e=new $c:void 0;return e.rect(this.xmin,this.ymin,this.xmax-this.xmin,this.ymax-this.ymin),t&&t.value()}renderCell(e,t){let n=t==null?t=new $c:void 0,r=this._clip(e);if(r===null||!r.length)return;t.moveTo(r[0],r[1]);let s=r.length;for(;r[0]===r[s-2]&&r[1]===r[s-1]&&s>1;)s-=2;for(let o=2;o<s;o+=2)(r[o]!==r[o-2]||r[o+1]!==r[o-1])&&t.lineTo(r[o],r[o+1]);return t.closePath(),n&&n.value()}*cellPolygons(){let{delaunay:{points:e}}=this;for(let t=0,n=e.length/2;t<n;++t){let r=this.cellPolygon(t);r&&(r.index=t,yield r)}}cellPolygon(e){let t=new em;return this.renderCell(e,t),t.value()}_renderSegment(e,t,n,r,s){let o,a=this._regioncode(e,t),l=this._regioncode(n,r);a===0&&l===0?(s.moveTo(e,t),s.lineTo(n,r)):(o=this._clipSegment(e,t,n,r,a,l))&&(s.moveTo(o[0],o[1]),s.lineTo(o[2],o[3]))}contains(e,t,n){return t=+t,t!==t||(n=+n,n!==n)?!1:this.delaunay._step(e,t,n)===e}*neighbors(e){let t=this._clip(e);if(t)for(let n of this.delaunay.neighbors(e)){let r=this._clip(n);if(r){e:for(let s=0,o=t.length;s<o;s+=2)for(let a=0,l=r.length;a<l;a+=2)if(t[s]===r[a]&&t[s+1]===r[a+1]&&t[(s+2)%o]===r[(a+l-2)%l]&&t[(s+3)%o]===r[(a+l-1)%l]){yield n;break e}}}}_cell(e){let{circumcenters:t,delaunay:{inedges:n,halfedges:r,triangles:s}}=this,o=n[e];if(o===-1)return null;let a=[],l=o;do{let c=Math.floor(l/3);if(a.push(t[c*2],t[c*2+1]),l=l%3===2?l-2:l+1,s[l]!==e)break;l=r[l]}while(l!==o&&l!==-1);return a}_clip(e){if(e===0&&this.delaunay.hull.length===1)return[this.xmax,this.ymin,this.xmax,this.ymax,this.xmin,this.ymax,this.xmin,this.ymin];let t=this._cell(e);if(t===null)return null;let{vectors:n}=this,r=e*4;return this._simplify(n[r]||n[r+1]?this._clipInfinite(e,t,n[r],n[r+1],n[r+2],n[r+3]):this._clipFinite(e,t))}_clipFinite(e,t){let n=t.length,r=null,s,o,a=t[n-2],l=t[n-1],c,u=this._regioncode(a,l),f,d=0;for(let A=0;A<n;A+=2)if(s=a,o=l,a=t[A],l=t[A+1],c=u,u=this._regioncode(a,l),c===0&&u===0)f=d,d=0,r?r.push(a,l):r=[a,l];else{let y,w,S,T,R;if(c===0){if((y=this._clipSegment(s,o,a,l,c,u))===null)continue;[w,S,T,R]=y}else{if((y=this._clipSegment(a,l,s,o,u,c))===null)continue;[T,R,w,S]=y,f=d,d=this._edgecode(w,S),f&&d&&this._edge(e,f,d,r,r.length),r?r.push(w,S):r=[w,S]}f=d,d=this._edgecode(T,R),f&&d&&this._edge(e,f,d,r,r.length),r?r.push(T,R):r=[T,R]}if(r)f=d,d=this._edgecode(r[0],r[1]),f&&d&&this._edge(e,f,d,r,r.length);else if(this.contains(e,(this.xmin+this.xmax)/2,(this.ymin+this.ymax)/2))return[this.xmax,this.ymin,this.xmax,this.ymax,this.xmin,this.ymax,this.xmin,this.ymin];return r}_clipSegment(e,t,n,r,s,o){let a=s<o;for(a&&([e,t,n,r,s,o]=[n,r,e,t,o,s]);;){if(s===0&&o===0)return a?[n,r,e,t]:[e,t,n,r];if(s&o)return null;let l,c,u=s||o;u&8?(l=e+(n-e)*(this.ymax-t)/(r-t),c=this.ymax):u&4?(l=e+(n-e)*(this.ymin-t)/(r-t),c=this.ymin):u&2?(c=t+(r-t)*(this.xmax-e)/(n-e),l=this.xmax):(c=t+(r-t)*(this.xmin-e)/(n-e),l=this.xmin),s?(e=l,t=c,s=this._regioncode(e,t)):(n=l,r=c,o=this._regioncode(n,r))}}_clipInfinite(e,t,n,r,s,o){let a=Array.from(t),l;if((l=this._project(a[0],a[1],n,r))&&a.unshift(l[0],l[1]),(l=this._project(a[a.length-2],a[a.length-1],s,o))&&a.push(l[0],l[1]),a=this._clipFinite(e,a))for(let c=0,u=a.length,f,d=this._edgecode(a[u-2],a[u-1]);c<u;c+=2)f=d,d=this._edgecode(a[c],a[c+1]),f&&d&&(c=this._edge(e,f,d,a,c),u=a.length);else this.contains(e,(this.xmin+this.xmax)/2,(this.ymin+this.ymax)/2)&&(a=[this.xmin,this.ymin,this.xmax,this.ymin,this.xmax,this.ymax,this.xmin,this.ymax]);return a}_edge(e,t,n,r,s){for(;t!==n;){let o,a;switch(t){case 5:t=4;continue;case 4:t=6,o=this.xmax,a=this.ymin;break;case 6:t=2;continue;case 2:t=10,o=this.xmax,a=this.ymax;break;case 10:t=8;continue;case 8:t=9,o=this.xmin,a=this.ymax;break;case 9:t=1;continue;case 1:t=5,o=this.xmin,a=this.ymin;break}(r[s]!==o||r[s+1]!==a)&&this.contains(e,o,a)&&(r.splice(s,0,o,a),s+=2)}return s}_project(e,t,n,r){let s=1/0,o,a,l;if(r<0){if(t<=this.ymin)return null;(o=(this.ymin-t)/r)<s&&(l=this.ymin,a=e+(s=o)*n)}else if(r>0){if(t>=this.ymax)return null;(o=(this.ymax-t)/r)<s&&(l=this.ymax,a=e+(s=o)*n)}if(n>0){if(e>=this.xmax)return null;(o=(this.xmax-e)/n)<s&&(a=this.xmax,l=t+(s=o)*r)}else if(n<0){if(e<=this.xmin)return null;(o=(this.xmin-e)/n)<s&&(a=this.xmin,l=t+(s=o)*r)}return[a,l]}_edgecode(e,t){return(e===this.xmin?1:e===this.xmax?2:0)|(t===this.ymin?4:t===this.ymax?8:0)}_regioncode(e,t){return(e<this.xmin?1:e>this.xmax?2:0)|(t<this.ymin?4:t>this.ymax?8:0)}_simplify(e){if(e&&e.length>4){for(let t=0;t<e.length;t+=2){let n=(t+2)%e.length,r=(t+4)%e.length;(e[t]===e[n]&&e[n]===e[r]||e[t+1]===e[n+1]&&e[n+1]===e[r+1])&&(e.splice(n,2),t-=2)}e.length||(e=null)}return e}};var Zwe=2*Math.PI,B_=Math.pow;function Kwe(i){return i[0]}function Qwe(i){return i[1]}function Jwe(i){let{triangles:e,coords:t}=i;for(let n=0;n<e.length;n+=3){let r=2*e[n],s=2*e[n+1],o=2*e[n+2];if((t[o]-t[r])*(t[s+1]-t[r+1])-(t[s]-t[r])*(t[o+1]-t[r+1])>1e-10)return!1}return!0}function eSe(i,e,t){return[i+Math.sin(i+e)*t,e+Math.cos(i-e)*t]}var O_=class i{static from(e,t=Kwe,n=Qwe,r){return new i("length"in e?tSe(e,t,n,r):Float64Array.from(nSe(e,t,n,r)))}constructor(e){this._delaunator=new J0(e),this.inedges=new Int32Array(e.length/2),this._hullIndex=new Int32Array(e.length/2),this.points=this._delaunator.coords,this._init()}update(){return this._delaunator.update(),this._init(),this}_init(){let e=this._delaunator,t=this.points;if(e.hull&&e.hull.length>2&&Jwe(e)){this.collinear=Int32Array.from({length:t.length/2},(d,A)=>A).sort((d,A)=>t[2*d]-t[2*A]||t[2*d+1]-t[2*A+1]);let l=this.collinear[0],c=this.collinear[this.collinear.length-1],u=[t[2*l],t[2*l+1],t[2*c],t[2*c+1]],f=1e-8*Math.hypot(u[3]-u[1],u[2]-u[0]);for(let d=0,A=t.length/2;d<A;++d){let y=eSe(t[2*d],t[2*d+1],f);t[2*d]=y[0],t[2*d+1]=y[1]}this._delaunator=new J0(t)}else delete this.collinear;let n=this.halfedges=this._delaunator.halfedges,r=this.hull=this._delaunator.hull,s=this.triangles=this._delaunator.triangles,o=this.inedges.fill(-1),a=this._hullIndex.fill(-1);for(let l=0,c=n.length;l<c;++l){let u=s[l%3===2?l-2:l+1];(n[l]===-1||o[u]===-1)&&(o[u]=l)}for(let l=0,c=r.length;l<c;++l)a[r[l]]=l;r.length<=2&&r.length>0&&(this.triangles=new Int32Array(3).fill(-1),this.halfedges=new Int32Array(3).fill(-1),this.triangles[0]=r[0],o[r[0]]=1,r.length===2&&(o[r[1]]=0,this.triangles[1]=r[1],this.triangles[2]=r[1]))}voronoi(e){return new Rw(this,e)}*neighbors(e){let{inedges:t,hull:n,_hullIndex:r,halfedges:s,triangles:o,collinear:a}=this;if(a){let f=a.indexOf(e);f>0&&(yield a[f-1]),f<a.length-1&&(yield a[f+1]);return}let l=t[e];if(l===-1)return;let c=l,u=-1;do{if(yield u=o[c],c=c%3===2?c-2:c+1,o[c]!==e)return;if(c=s[c],c===-1){let f=n[(r[e]+1)%n.length];f!==u&&(yield f);return}}while(c!==l)}find(e,t,n=0){if(e=+e,e!==e||(t=+t,t!==t))return-1;let r=n,s;for(;(s=this._step(n,e,t))>=0&&s!==n&&s!==r;)n=s;return s}_step(e,t,n){let{inedges:r,hull:s,_hullIndex:o,halfedges:a,triangles:l,points:c}=this;if(r[e]===-1||!c.length)return(e+1)%(c.length>>1);let u=e,f=B_(t-c[e*2],2)+B_(n-c[e*2+1],2),d=r[e],A=d;do{let y=l[A],w=B_(t-c[y*2],2)+B_(n-c[y*2+1],2);if(w<f&&(f=w,u=y),A=A%3===2?A-2:A+1,l[A]!==e)break;if(A=a[A],A===-1){if(A=s[(o[e]+1)%s.length],A!==y&&B_(t-c[A*2],2)+B_(n-c[A*2+1],2)<f)return A;break}}while(A!==d);return u}render(e){let t=e==null?e=new $c:void 0,{points:n,halfedges:r,triangles:s}=this;for(let o=0,a=r.length;o<a;++o){let l=r[o];if(l<o)continue;let c=s[o]*2,u=s[l]*2;e.moveTo(n[c],n[c+1]),e.lineTo(n[u],n[u+1])}return this.renderHull(e),t&&t.value()}renderPoints(e,t){t===void 0&&(!e||typeof e.moveTo!="function")&&(t=e,e=null),t=t==null?2:+t;let n=e==null?e=new $c:void 0,{points:r}=this;for(let s=0,o=r.length;s<o;s+=2){let a=r[s],l=r[s+1];e.moveTo(a+t,l),e.arc(a,l,t,0,Zwe)}return n&&n.value()}renderHull(e){let t=e==null?e=new $c:void 0,{hull:n,points:r}=this,s=n[0]*2,o=n.length;e.moveTo(r[s],r[s+1]);for(let a=1;a<o;++a){let l=2*n[a];e.lineTo(r[l],r[l+1])}return e.closePath(),t&&t.value()}hullPolygon(){let e=new em;return this.renderHull(e),e.value()}renderTriangle(e,t){let n=t==null?t=new $c:void 0,{points:r,triangles:s}=this,o=s[e*=3]*2,a=s[e+1]*2,l=s[e+2]*2;return t.moveTo(r[o],r[o+1]),t.lineTo(r[a],r[a+1]),t.lineTo(r[l],r[l+1]),t.closePath(),n&&n.value()}*trianglePolygons(){let{triangles:e}=this;for(let t=0,n=e.length/3;t<n;++t)yield this.trianglePolygon(t)}trianglePolygon(e){let t=new em;return this.renderTriangle(e,t),t.value()}};function tSe(i,e,t,n){let r=i.length,s=new Float64Array(r*2);for(let o=0;o<r;++o){let a=i[o];s[o*2]=e.call(n,a,o,i),s[o*2+1]=t.call(n,a,o,i)}return s}function*nSe(i,e,t,n){let r=0;for(let s of i)yield e.call(n,s,r,i),yield t.call(n,s,r,i),++r}var Pw=Math.PI,cee=Pw/2,zat=Pw/4,Vat=Pw*2,yO=180/Pw,bO=Pw/180;var wO=Math.atan2,nR=Math.cos;var uee=Math.max,hee=Math.min;var iR=Math.sin,fee=Math.sign||function(i){return i>0?1:i<0?-1:0},rR=Math.sqrt;function SO(i){return i>1?cee:i<-1?-cee:Math.asin(i)}function TO(i,e){return i[0]*e[0]+i[1]*e[1]+i[2]*e[2]}function Cl(i,e){return[i[1]*e[2]-i[2]*e[1],i[2]*e[0]-i[0]*e[2],i[0]*e[1]-i[1]*e[0]]}function Iw(i,e){return[i[0]+e[0],i[1]+e[1],i[2]+e[2]]}function Lw(i){var e=rR(i[0]*i[0]+i[1]*i[1]+i[2]*i[2]);return[i[0]/e,i[1]/e,i[2]/e]}function EO(i){return[wO(i[1],i[0])*yO,SO(uee(-1,hee(1,i[2])))*yO]}function nf(i){let e=i[0]*bO,t=i[1]*bO,n=nR(t);return[n*nR(e),n*iR(e),iR(t)]}function sR(i){return i=i.map(e=>nf(e)),TO(i[0],Cl(i[2],i[1]))}function pee(i){let e=rSe(i),t=oSe(e),n=sSe(t,i),r=lSe(t,i.length),s=iSe(r,i),o=aSe(t,i),{polygons:a,centers:l}=cSe(o,t,i),c=uSe(a),u=fSe(t,i),f=hSe(n,t);return{delaunay:e,edges:n,triangles:t,centers:l,neighbors:r,polygons:a,mesh:c,hull:u,urquhart:f,find:s}}function iSe(i,e){function t(n,r){let s=n[0]-r[0],o=n[1]-r[1],a=n[2]-r[2];return s*s+o*o+a*a}return function(r,s,o){o===void 0&&(o=0);let a,l,c=o,u=nf([r,s]);do a=o,o=null,l=t(u,nf(e[a])),i[a].forEach(f=>{let d=t(u,nf(e[f]));if(d<l){l=d,o=f,c=f;return}});while(o!==null);return c}}function rSe(i){if(i.length<2)return{};let e=0;for(;isNaN(i[e][0]+i[e][1])&&e++<i.length;);let t=CB(i[e]),n=jB().translate([0,0]).scale(1).rotate(t.invert([180,0]));i=i.map(n);let r=[],s=1;for(let d=0,A=i.length;d<A;d++){let y=i[d][0]**2+i[d][1]**2;!isFinite(y)||y>1e32?r.push(d):y>s&&(s=y)}let o=1e6*rR(s);r.forEach(d=>i[d]=[o,0]),i.push([0,o]),i.push([-o,0]),i.push([0,-o]);let a=O_.from(i);a.projection=n;let{triangles:l,halfedges:c,inedges:u}=a,f=[];for(let d=0,A=c.length;d<A;d++)if(c[d]<0){let y=d%3==2?d-2:d+1,w=d%3==0?d+2:d-1,S=c[y],T=c[w];c[S]=T,c[T]=S,c[y]=c[w]=-1,l[d]=l[y]=l[w]=e,u[l[S]]=S%3==0?S+2:S-1,u[l[T]]=T%3==0?T+2:T-1,f.push(Math.min(d,y,w)),d+=2-d%3}else l[d]>i.length-3-1&&(l[d]=e);return a}function sSe(i,e){let t=new Set;return e.length===2?[[0,1]]:(i.forEach(n=>{if(n[0]!==n[1]&&!(sR(n.map(r=>e[r]))<0))for(let r=0,s;r<3;r++)s=(r+1)%3,t.add(W0([n[r],n[s]]).join("-"))}),Array.from(t,n=>n.split("-").map(Number)))}function oSe(i){let{triangles:e}=i;if(!e)return[];let t=[];for(let n=0,r=e.length/3;n<r;n++){let s=e[3*n],o=e[3*n+1],a=e[3*n+2];s!==o&&o!==a&&t.push([s,a,o])}return t}function aSe(i,e){return i.map(t=>{let n=t.map(s=>e[s]).map(nf),r=Iw(Iw(Cl(n[1],n[0]),Cl(n[2],n[1])),Cl(n[0],n[2]));return EO(Lw(r))})}function lSe(i,e){let t=[];return i.forEach(n=>{for(let r=0;r<3;r++){let s=n[r],o=n[(r+1)%3];t[s]=t[s]||[],t[s].push(o)}}),i.length===0&&(e===2?(t[0]=[1],t[1]=[0]):e===1&&(t[0]=[])),t}function cSe(i,e,t){let n=[],r=i.slice();if(e.length===0){if(t.length<2)return{polygons:n,centers:r};if(t.length===2){let a=nf(t[0]),l=nf(t[1]),c=Lw(Iw(a,l)),u=Lw(Cl(a,l)),f=Cl(c,u),d=[c,Cl(c,f),Cl(Cl(c,f),f),Cl(Cl(Cl(c,f),f),f)].map(EO).map(o);return n.push(d),n.push(d.slice().reverse()),{polygons:n,centers:r}}}e.forEach((a,l)=>{for(let c=0;c<3;c++){let u=a[c],f=a[(c+1)%3],d=a[(c+2)%3];n[u]=n[u]||[],n[u].push([f,d,l,[u,f,d]])}});let s=n.map(a=>{let l=[a[0][2]],c=a[0][1];for(let u=1;u<a.length;u++)for(let f=0;f<a.length;f++)if(a[f][0]==c){c=a[f][1],l.push(a[f][2]);break}if(l.length>2)return l;if(l.length==2){let u=dee(t[a[0][3][0]],t[a[0][3][1]],r[l[0]]),f=dee(t[a[0][3][2]],t[a[0][3][0]],r[l[0]]),d=o(u),A=o(f);return[l[0],A,l[1],d]}});function o(a){let l=-1;return r.slice(e.length,1/0).forEach((c,u)=>{c[0]===a[0]&&c[1]===a[1]&&(l=u+e.length)}),l<0&&(l=r.length,r.push(a)),l}return{polygons:s,centers:r}}function dee(i,e,t){i=nf(i),e=nf(e),t=nf(t);let n=fee(TO(Cl(e,i),t));return EO(Lw(Iw(i,e)).map(r=>n*r))}function uSe(i){let e=[];return i.forEach(t=>{if(!t)return;let n=t[t.length-1];for(let r of t)r>n&&e.push([n,r]),n=r}),e}function hSe(i,e){return function(t){let n=new Map,r=new Map;return i.forEach((s,o)=>{let a=s.join("-");n.set(a,t[o]),r.set(a,!0)}),e.forEach(s=>{let o=0,a=-1;for(let l=0;l<3;l++){let c=W0([s[l],s[(l+1)%3]]).join("-");n.get(c)>o&&(o=n.get(c),a=c)}r.set(a,!1)}),i.map(s=>r.get(s.join("-")))}}function fSe(i,e){let t=new Set,n=[];i.map(a=>{if(!(sR(a.map(l=>e[l>e.length?0:l]))>1e-12))for(let l=0;l<3;l++){let c=[a[l],a[(l+1)%3]],u=`${c[0]}-${c[1]}`;t.has(u)?t.delete(u):t.add(`${c[1]}-${c[0]}`)}});let r=new Map,s;if(t.forEach(a=>{a=a.split("-").map(Number),r.set(a[0],a[1]),s=a[0]}),s===void 0)return n;let o=s;do{n.push(o);let a=r.get(o);r.set(o,-1),o=a}while(o>-1&&o!==s);return n}function MO(i){let e=function(t){if(e.delaunay=null,e._data=t,typeof e._data=="object"&&e._data.type==="FeatureCollection"&&(e._data=e._data.features),typeof e._data=="object"){let n=e._data.map(r=>[e._vx(r),e._vy(r),r]).filter(r=>isFinite(r[0]+r[1]));e.points=n.map(r=>[r[0],r[1]]),e.valid=n.map(r=>r[2]),e.delaunay=pee(e.points)}return e};return e._vx=function(t){if(typeof t=="object"&&"type"in t)return RC(t)[0];if(0 in t)return t[0]},e._vy=function(t){if(typeof t=="object"&&"type"in t)return RC(t)[1];if(1 in t)return t[1]},e.x=function(t){return t?(e._vx=t,e):e._vx},e.y=function(t){return t?(e._vy=t,e):e._vy},e.polygons=function(t){if(t!==void 0&&e(t),!e.delaunay)return!1;let n={type:"FeatureCollection",features:[]};return e.valid.length===0||(e.delaunay.polygons.forEach((r,s)=>n.features.push({type:"Feature",geometry:r?{type:"Polygon",coordinates:[[...r,r[0]].map(o=>e.delaunay.centers[o])]}:null,properties:{site:e.valid[s],sitecoordinates:e.points[s],neighbours:e.delaunay.neighbors[s]}})),e.valid.length===1&&n.features.push({type:"Feature",geometry:{type:"Sphere"},properties:{site:e.valid[0],sitecoordinates:e.points[0],neighbours:[]}})),n},e.triangles=function(t){return t!==void 0&&e(t),e.delaunay?{type:"FeatureCollection",features:e.delaunay.triangles.map((n,r)=>(n=n.map(s=>e.points[s]),n.center=e.delaunay.centers[r],n)).filter(n=>sR(n)>0).map(n=>({type:"Feature",properties:{circumcenter:n.center},geometry:{type:"Polygon",coordinates:[[...n,n[0]]]}}))}:!1},e.links=function(t){if(t!==void 0&&e(t),!e.delaunay)return!1;let n=e.delaunay.edges.map(s=>Ml(e.points[s[0]],e.points[s[1]])),r=e.delaunay.urquhart(n);return{type:"FeatureCollection",features:e.delaunay.edges.map((s,o)=>({type:"Feature",properties:{source:e.valid[s[0]],target:e.valid[s[1]],length:n[o],urquhart:!!r[o]},geometry:{type:"LineString",coordinates:[e.points[s[0]],e.points[s[1]]]}}))}},e.mesh=function(t){return t!==void 0&&e(t),e.delaunay?{type:"MultiLineString",coordinates:e.delaunay.edges.map(n=>[e.points[n[0]],e.points[n[1]]])}:!1},e.cellMesh=function(t){if(t!==void 0&&e(t),!e.delaunay)return!1;let{centers:n,polygons:r}=e.delaunay,s=[];for(let o of r)if(o)for(let a=o.length,l=o[a-1],c=o[0],u=0;u<a;l=c,c=o[++u])c>l&&s.push([n[l],n[c]]);return{type:"MultiLineString",coordinates:s}},e._found=void 0,e.find=function(t,n,r){if(e._found=e.delaunay.find(t,n,e._found),!r||Ml([t,n],e.points[e._found])<r)return e._found},e.hull=function(t){t!==void 0&&e(t);let n=e.delaunay.hull,r=e.points;return n.length===0?null:{type:"Polygon",coordinates:[[...n.map(s=>r[s]),r[n[0]]]]}},i?e(i):e}function RO(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 dSe(i){if(Array.isArray(i))return i}function pSe(i){if(Array.isArray(i))return RO(i)}function mSe(i){if(i===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return i}function ASe(i,e,t){return e=aR(e),SSe(i,Aee()?Reflect.construct(e,[],aR(i).constructor):e.apply(i,t))}function gSe(i,e){if(!(i instanceof e))throw new TypeError("Cannot call a class as a function")}function vSe(i,e,t){return Object.defineProperty(i,"prototype",{writable:!1}),i}function aR(i){return aR=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},aR(i)}function _Se(i,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");i.prototype=Object.create(e&&e.prototype,{constructor:{value:i,writable:!0,configurable:!0}}),Object.defineProperty(i,"prototype",{writable:!1}),e&&PO(i,e)}function Aee(){try{var i=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(Aee=function(){return!!i})()}function xSe(i){if(typeof Symbol<"u"&&i[Symbol.iterator]!=null||i["@@iterator"]!=null)return Array.from(i)}function ySe(i,e){var t=i==null?null:typeof Symbol<"u"&&i[Symbol.iterator]||i["@@iterator"];if(t!=null){var n,r,s,o,a=[],l=!0,c=!1;try{if(s=(t=t.call(i)).next,e!==0)for(;!(l=(n=s.call(t)).done)&&(a.push(n.value),a.length!==e);l=!0);}catch(u){c=!0,r=u}finally{try{if(!l&&t.return!=null&&(o=t.return(),Object(o)!==o))return}finally{if(c)throw r}}return a}}function bSe(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.4126+In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function wSe(){throw new TypeError(`Invalid attempt to spread non-iterable instance.4127+In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function SSe(i,e){if(e&&(typeof e=="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return mSe(i)}function PO(i,e){return PO=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,n){return t.__proto__=n,t},PO(i,e)}function rf(i,e){return dSe(i)||ySe(i,e)||gee(i,e)||bSe()}function CO(i){return pSe(i)||xSe(i)||gee(i)||wSe()}function gee(i,e){if(i){if(typeof i=="string")return RO(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)?RO(i,e):void 0}}function TSe(i){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},t=e.resolution,n=t===void 0?1/0:t,r=ESe(i,n),s=Zh(r),o=MSe(i,n),a=[].concat(CO(s),CO(o)),l={type:"Polygon",coordinates:i},c=yC(l),u=rf(c,2),f=rf(u[0],2),d=f[0],A=f[1],y=rf(u[1],2),w=y[0],S=y[1],T=d>w||S>=89||A<=-89,R=[];if(T){var I=MO(a).triangles(),P=new Map(a.map(function(J,te){var ce=rf(J,2),he=ce[0],ve=ce[1];return["".concat(he,"-").concat(ve),te]}));I.features.forEach(function(J){var te,ce=J.geometry.coordinates[0].slice(0,3).reverse(),he=[];if(ce.forEach(function(Re){var Qe=rf(Re,2),Fe=Qe[0],mt=Qe[1],Ee="".concat(Fe,"-").concat(mt);P.has(Ee)&&he.push(P.get(Ee))}),he.length===3){if(he.some(function(Re){return Re<s.length})){var ve=J.properties.circumcenter;if(!IO(ve,l,T))return}(te=R).push.apply(te,he)}})}else if(o.length)for(var B=J0.from(a),k=function(te){var ce,he=[2,1,0].map(function(Qe){return B.triangles[te+Qe]}),ve=he.map(function(Qe){return a[Qe]});if(he.some(function(Qe){return Qe<s.length})){var Re=[0,1].map(function(Qe){return iC(ve,function(Fe){return Fe[Qe]})});if(!IO(Re,l,T))return 1}(ce=R).push.apply(ce,CO(he))},z=0,G=B.triangles.length;z<G;z+=3)k(z);else{var F=P_(r),D=F.vertices,L=F.holes,C=L===void 0?[]:L;R=oO(D,C,2)}var W=Tl(W0(a,function(J){return J[0]}),[0,1]),Y=Tl(W0(a,function(J){return J[1]}),[0,1]),H=a.map(function(J){var te=rf(J,2),ce=te[0],he=te[1];return[W(ce),Y(he)]}),$={points:a,indices:R,uvs:H};return{contour:r,triangles:$}}function ESe(i,e){return i.map(function(t){var n=[],r;return t.forEach(function(s){if(r){var o=Ml(s,r)*180/Math.PI;if(o>e)for(var a=Eg(r,s),l=1/Math.ceil(o/e),c=l;c<1;)n.push(a(c)),c+=l}n.push(r=s)}),n})}function MSe(i,e){var t={type:"Polygon",coordinates:i},n=yC(t),r=rf(n,2),s=rf(r[0],2),o=s[0],a=s[1],l=rf(r[1],2),c=l[0],u=l[1];if(Math.min(Math.abs(c-o),Math.abs(u-a))<e)return[];var f=o>c||u>=89||a<=-89;return CSe(e,{minLng:o,maxLng:c,minLat:a,maxLat:u}).filter(function(d){return IO(d,t,f)})}function CSe(i){for(var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},t=e.minLng,n=e.maxLng,r=e.minLat,s=e.maxLat,o=Math.round(Math.pow(360/i,2)/Math.PI),a=(1+Math.sqrt(5))/2,l=function(T){return T/a*360%360-180},c=function(T){return Math.acos(2*T/o-1)/Math.PI*180-90},u=function(T){return o*(Math.cos((T+90)*Math.PI/180)+1)/2},f=[s!==void 0?Math.ceil(u(s)):0,r!==void 0?Math.floor(u(r)):o-1],d=t===void 0&&n===void 0?function(){return!0}:t===void 0?function(S){return S<=n}:n===void 0?function(S){return S>=t}:n>=t?function(S){return S>=t&&S<=n}:function(S){return S>=t||S<=n},A=[],y=f[0];y<=f[1];y++){var w=l(y);d(w)&&A.push([w,c(y)])}return A}function IO(i,e){var t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;return t?FB(e,i):lee(i,e)}var oR=window.THREE?window.THREE:{BufferGeometry:Xn,Float32BufferAttribute:Ln},mee=new oR.BufferGeometry().setAttribute?"setAttribute":"addAttribute",lR=(function(i){function e(t,n,r,s,o,a,l){var c;gSe(this,e),c=ASe(this,e),c.type="ConicPolygonGeometry",c.parameters={polygonGeoJson:t,bottomHeight:n,topHeight:r,closedBottom:s,closedTop:o,includeSides:a,curvatureResolution:l},n=n||0,r=r||1,s=s!==void 0?s:!0,o=o!==void 0?o:!0,a=a!==void 0?a:!0,l=l||5;var u=TSe(t,{resolution:l}),f=u.contour,d=u.triangles,A=Zh(d.uvs),y=[],w=[],S=[],T=0,R=function(L){var C=Math.round(y.length/3),B=S.length;y=y.concat(L.vertices),w=w.concat(L.uvs),S=S.concat(C?L.indices.map(function(k){return k+C}):L.indices),c.addGroup(B,S.length-B,T++)};a&&R(P()),s&&R(F(n,!1)),o&&R(F(r,!0)),c.setIndex(S),c[mee]("position",new oR.Float32BufferAttribute(y,3)),c[mee]("uv",new oR.Float32BufferAttribute(w,2)),c.computeVertexNormals();function I(D,L){var C=typeof L=="function"?L:function(){return L},B=D.map(function(k){return k.map(function(z){var G=rf(z,2),W=G[0],Y=G[1];return RSe(Y,W,C(W,Y))})});return P_(B)}function P(){for(var D=I(f,n),L=D.vertices,C=D.holes,B=I(f,r),k=B.vertices,z=Zh([k,L]),G=Math.round(k.length/3),W=new Set(C),Y=0,H=[],$=0;$<G;$++){var J=$+1;if(J===G)J=Y;else if(W.has(J)){var te=J;J=Y,Y=te}H.push($,$+G,J+G),H.push(J+G,J,$)}for(var ce=[],he=1;he>=0;he--)for(var ve=0;ve<G;ve+=1)ce.push(ve/(G-1),he);return{indices:H,vertices:z,uvs:ce}}function F(D){var L=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return{indices:L?d.indices:d.indices.slice().reverse(),vertices:I([d.points],D).vertices,uvs:A}}return c}return _Se(e,i),vSe(e)})(oR.BufferGeometry);function RSe(i,e){var t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,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)]}function LO(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 PSe(i){if(Array.isArray(i))return i}function ISe(i){if(Array.isArray(i))return LO(i)}function LSe(i){if(typeof Symbol<"u"&&i[Symbol.iterator]!=null||i["@@iterator"]!=null)return Array.from(i)}function DSe(i,e){var t=i==null?null:typeof Symbol<"u"&&i[Symbol.iterator]||i["@@iterator"];if(t!=null){var n,r,s,o,a=[],l=!0,c=!1;try{if(s=(t=t.call(i)).next,e!==0)for(;!(l=(n=s.call(t)).done)&&(a.push(n.value),a.length!==e);l=!0);}catch(u){c=!0,r=u}finally{try{if(!l&&t.return!=null&&(o=t.return(),Object(o)!==o))return}finally{if(c)throw r}}return a}}function NSe(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.4128+In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function FSe(){throw new TypeError(`Invalid attempt to spread non-iterable instance.4129+In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function BSe(i,e){if(i==null)return{};var t,n,r=OSe(i,e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(i);for(n=0;n<s.length;n++)t=s[n],e.includes(t)||{}.propertyIsEnumerable.call(i,t)&&(r[t]=i[t])}return r}function OSe(i,e){if(i==null)return{};var t={};for(var n in i)if({}.hasOwnProperty.call(i,n)){if(e.includes(n))continue;t[n]=i[n]}return t}function USe(i,e){return PSe(i)||DSe(i,e)||vee(i,e)||NSe()}function kSe(i){return ISe(i)||LSe(i)||vee(i)||FSe()}function zSe(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 String(i)}function VSe(i){var e=zSe(i,"string");return typeof e=="symbol"?e:e+""}function vee(i,e){if(i){if(typeof i=="string")return LO(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)?LO(i,e):void 0}}var _ee=(function(){var i=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,n=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1,r=(e instanceof Array?e.length?e:[void 0]:[e]).map(function(a){return{keyAccessor:a,isProp:!(a instanceof Function)}}),s=i.reduce(function(a,l){var c=a,u=l;return r.forEach(function(f,d){var A=f.keyAccessor,y=f.isProp,w;if(y){var S=u,T=S[A],R=BSe(S,[A].map(VSe));w=T,u=R}else w=A(u,d);d+1<r.length?(c.hasOwnProperty(w)||(c[w]={}),c=c[w]):t?(c.hasOwnProperty(w)||(c[w]=[]),c[w].push(u)):c[w]=u}),a},{});t instanceof Function&&(function a(l){var c=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1;c===r.length?Object.keys(l).forEach(function(u){return l[u]=t(l[u])}):Object.values(l).forEach(function(u){return a(u,c+1)})})(s);var o=s;return n&&(o=[],(function a(l){var c=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[];c.length===r.length?o.push({keys:c,vals:l}):Object.entries(l).forEach(function(u){var f=USe(u,2),d=f[0],A=f[1];return a(A,[].concat(kSe(c),[d]))})})(s),e instanceof Array&&e.length===0&&o.length===1&&(o[0].keys=[])),o});var Ai=(function(i){i=i||{};var e=typeof i<"u"?i:{},t={},n;for(n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);var r=[],s="";function o(Le){return e.locateFile?e.locateFile(Le,s):s+Le}var a;typeof document<"u"&&document.currentScript&&(s=document.currentScript.src),s.indexOf("blob:")!==0?s=s.substr(0,s.lastIndexOf("/")+1):s="",a=function(it,Dt,He){var h=new XMLHttpRequest;h.open("GET",it,!0),h.responseType="arraybuffer",h.onload=function(){if(h.status==200||h.status==0&&h.response){Dt(h.response);return}var Pi=St(it);if(Pi){Dt(Pi.buffer);return}He()},h.onerror=He,h.send(null)};var l=e.print||console.log.bind(console),c=e.printErr||console.warn.bind(console);for(n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);t=null,e.arguments&&(r=e.arguments);var u=0,f=function(Le){u=Le},d=function(){return u},A=8;function y(Le,it,Dt,He){switch(Dt=Dt||"i8",Dt.charAt(Dt.length-1)==="*"&&(Dt="i32"),Dt){case"i1":Y[Le>>0]=it;break;case"i8":Y[Le>>0]=it;break;case"i16":$[Le>>1]=it;break;case"i32":te[Le>>2]=it;break;case"i64":Ge=[it>>>0,(Ie=it,+bt(Ie)>=1?Ie>0?(en(+hn(Ie/4294967296),4294967295)|0)>>>0:~~+yt((Ie-+(~~Ie>>>0))/4294967296)>>>0:0)],te[Le>>2]=Ge[0],te[Le+4>>2]=Ge[1];break;case"float":he[Le>>2]=it;break;case"double":ve[Le>>3]=it;break;default:Um("invalid type for setValue: "+Dt)}}function w(Le,it,Dt){switch(it=it||"i8",it.charAt(it.length-1)==="*"&&(it="i32"),it){case"i1":return Y[Le>>0];case"i8":return Y[Le>>0];case"i16":return $[Le>>1];case"i32":return te[Le>>2];case"i64":return te[Le>>2];case"float":return he[Le>>2];case"double":return ve[Le>>3];default:Um("invalid type for getValue: "+it)}return null}var S=!1;function T(Le,it){Le||Um("Assertion failed: "+it)}function R(Le){var it=e["_"+Le];return T(it,"Cannot call unknown function "+Le+", make sure it is exported"),it}function I(Le,it,Dt,He,h){var sr={string:function(ii){var zi=0;if(ii!=null&&ii!==0){var iT=(ii.length<<2)+1;zi=XG(iT),B(ii,zi,iT)}return zi},array:function(ii){var zi=XG(ii.length);return z(ii,zi),zi}};function Pi(ii){return it==="string"?L(ii):it==="boolean"?!!ii:ii}var ie=R(Le),or=[],ol=0;if(He)for(var fo=0;fo<He.length;fo++){var Ks=sr[Dt[fo]];Ks?(ol===0&&(ol=yce()),or[fo]=Ks(He[fo])):or[fo]=He[fo]}var bs=ie.apply(null,or);return bs=Pi(bs),ol!==0&&xce(ol),bs}function P(Le,it,Dt,He){Dt=Dt||[];var h=Dt.every(function(Pi){return Pi==="number"}),sr=it!=="string";return sr&&h&&!He?R(Le):function(){return I(Le,it,Dt,arguments,He)}}var F=typeof TextDecoder<"u"?new TextDecoder("utf8"):void 0;function D(Le,it,Dt){for(var He=it+Dt,h=it;Le[h]&&!(h>=He);)++h;if(h-it>16&&Le.subarray&&F)return F.decode(Le.subarray(it,h));for(var sr="";it<h;){var Pi=Le[it++];if(!(Pi&128)){sr+=String.fromCharCode(Pi);continue}var ie=Le[it++]&63;if((Pi&224)==192){sr+=String.fromCharCode((Pi&31)<<6|ie);continue}var or=Le[it++]&63;if((Pi&240)==224?Pi=(Pi&15)<<12|ie<<6|or:Pi=(Pi&7)<<18|ie<<12|or<<6|Le[it++]&63,Pi<65536)sr+=String.fromCharCode(Pi);else{var ol=Pi-65536;sr+=String.fromCharCode(55296|ol>>10,56320|ol&1023)}}return sr}function L(Le,it){return Le?D(H,Le,it):""}function C(Le,it,Dt,He){if(!(He>0))return 0;for(var h=Dt,sr=Dt+He-1,Pi=0;Pi<Le.length;++Pi){var ie=Le.charCodeAt(Pi);if(ie>=55296&&ie<=57343){var or=Le.charCodeAt(++Pi);ie=65536+((ie&1023)<<10)|or&1023}if(ie<=127){if(Dt>=sr)break;it[Dt++]=ie}else if(ie<=2047){if(Dt+1>=sr)break;it[Dt++]=192|ie>>6,it[Dt++]=128|ie&63}else if(ie<=65535){if(Dt+2>=sr)break;it[Dt++]=224|ie>>12,it[Dt++]=128|ie>>6&63,it[Dt++]=128|ie&63}else{if(Dt+3>=sr)break;it[Dt++]=240|ie>>18,it[Dt++]=128|ie>>12&63,it[Dt++]=128|ie>>6&63,it[Dt++]=128|ie&63}}return it[Dt]=0,Dt-h}function B(Le,it,Dt){return C(Le,H,it,Dt)}var k=typeof TextDecoder<"u"?new TextDecoder("utf-16le"):void 0;function z(Le,it){Y.set(Le,it)}function G(Le,it){return Le%it>0&&(Le+=it-Le%it),Le}var W,Y,H,$,J,te,ce,he,ve;function Re(Le){W=Le,e.HEAP8=Y=new Int8Array(Le),e.HEAP16=$=new Int16Array(Le),e.HEAP32=te=new Int32Array(Le),e.HEAPU8=H=new Uint8Array(Le),e.HEAPU16=J=new Uint16Array(Le),e.HEAPU32=ce=new Uint32Array(Le),e.HEAPF32=he=new Float32Array(Le),e.HEAPF64=ve=new Float64Array(Le)}var Qe=5271296,Fe=28384,mt=e.TOTAL_MEMORY||33554432;e.buffer?W=e.buffer:W=new ArrayBuffer(mt),mt=W.byteLength,Re(W),te[Fe>>2]=Qe;function Ee(Le){for(;Le.length>0;){var it=Le.shift();if(typeof it=="function"){it();continue}var Dt=it.func;typeof Dt=="number"?it.arg===void 0?e.dynCall_v(Dt):e.dynCall_vi(Dt,it.arg):Dt(it.arg===void 0?null:it.arg)}}var Ve=[],Ye=[],Mt=[],Et=[];function Pt(){if(e.preRun)for(typeof e.preRun=="function"&&(e.preRun=[e.preRun]);e.preRun.length;)ot(e.preRun.shift());Ee(Ve)}function dn(){Ee(Ye)}function Gt(){Ee(Mt)}function $e(){if(e.postRun)for(typeof e.postRun=="function"&&(e.postRun=[e.postRun]);e.postRun.length;)nt(e.postRun.shift());Ee(Et)}function ot(Le){Ve.unshift(Le)}function nt(Le){Et.unshift(Le)}var bt=Math.abs,yt=Math.ceil,hn=Math.floor,en=Math.min,tn=0,bn=null,_e=null;function vi(Le){tn++,e.monitorRunDependencies&&e.monitorRunDependencies(tn)}function zn(Le){if(tn--,e.monitorRunDependencies&&e.monitorRunDependencies(tn),tn==0&&(bn!==null&&(clearInterval(bn),bn=null),_e)){var it=_e;_e=null,it()}}e.preloadedImages={},e.preloadedAudios={};var le=null,Z="data:application/octet-stream;base64,";function Te(Le){return String.prototype.startsWith?Le.startsWith(Z):Le.indexOf(Z)===0}var Ie,Ge;le="data:application/octet-stream;base64,AAAAAAAAAAAAAAAAAQAAAAIAAAADAAAABAAAAAUAAAAGAAAAAQAAAAQAAAADAAAABgAAAAUAAAACAAAAAAAAAAIAAAADAAAAAQAAAAQAAAAGAAAAAAAAAAUAAAADAAAABgAAAAQAAAAFAAAAAAAAAAEAAAACAAAABAAAAAUAAAAGAAAAAAAAAAIAAAADAAAAAQAAAAUAAAACAAAAAAAAAAEAAAADAAAABgAAAAQAAAAGAAAAAAAAAAUAAAACAAAAAQAAAAQAAAADAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAEAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAIAAAADAAAAAAAAAAAAAAACAAAAAAAAAAEAAAADAAAAAwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAABAAAAAYAAAAAAAAABQAAAAAAAAAAAAAABAAAAAUAAAAAAAAAAAAAAAAAAAACAAAAAAAAAAYAAAAAAAAABgAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAgAAAAMAAAAEAAAABQAAAAYAAAABAAAAAgAAAAMAAAAEAAAABQAAAAYAAAAAAAAAAgAAAAMAAAAEAAAABQAAAAYAAAAAAAAAAQAAAAMAAAAEAAAABQAAAAYAAAAAAAAAAQAAAAIAAAAEAAAABQAAAAYAAAAAAAAAAQAAAAIAAAADAAAABQAAAAYAAAAAAAAAAQAAAAIAAAADAAAABAAAAAYAAAAAAAAAAQAAAAIAAAADAAAABAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAwAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAgAAAAIAAAAAAAAAAAAAAAYAAAAAAAAAAwAAAAIAAAADAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAFAAAABAAAAAAAAAABAAAAAAAAAAAAAAAFAAAABQAAAAAAAAAAAAAAAAAAAAYAAAAAAAAABAAAAAAAAAAGAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAFAAAAAgAAAAQAAAADAAAACAAAAAEAAAAHAAAABgAAAAkAAAAAAAAAAwAAAAIAAAACAAAABgAAAAoAAAALAAAAAAAAAAEAAAAFAAAAAwAAAA0AAAABAAAABwAAAAQAAAAMAAAAAAAAAAQAAAB/AAAADwAAAAgAAAADAAAAAAAAAAwAAAAFAAAAAgAAABIAAAAKAAAACAAAAAAAAAAQAAAABgAAAA4AAAALAAAAEQAAAAEAAAAJAAAAAgAAAAcAAAAVAAAACQAAABMAAAADAAAADQAAAAEAAAAIAAAABQAAABYAAAAQAAAABAAAAAAAAAAPAAAACQAAABMAAAAOAAAAFAAAAAEAAAAHAAAABgAAAAoAAAALAAAAGAAAABcAAAAFAAAAAgAAABIAAAALAAAAEQAAABcAAAAZAAAAAgAAAAYAAAAKAAAADAAAABwAAAANAAAAGgAAAAQAAAAPAAAAAwAAAA0AAAAaAAAAFQAAAB0AAAADAAAADAAAAAcAAAAOAAAAfwAAABEAAAAbAAAACQAAABQAAAAGAAAADwAAABYAAAAcAAAAHwAAAAQAAAAIAAAADAAAABAAAAASAAAAIQAAAB4AAAAIAAAABQAAABYAAAARAAAACwAAAA4AAAAGAAAAIwAAABkAAAAbAAAAEgAAABgAAAAeAAAAIAAAAAUAAAAKAAAAEAAAABMAAAAiAAAAFAAAACQAAAAHAAAAFQAAAAkAAAAUAAAADgAAABMAAAAJAAAAKAAAABsAAAAkAAAAFQAAACYAAAATAAAAIgAAAA0AAAAdAAAABwAAABYAAAAQAAAAKQAAACEAAAAPAAAACAAAAB8AAAAXAAAAGAAAAAsAAAAKAAAAJwAAACUAAAAZAAAAGAAAAH8AAAAgAAAAJQAAAAoAAAAXAAAAEgAAABkAAAAXAAAAEQAAAAsAAAAtAAAAJwAAACMAAAAaAAAAKgAAAB0AAAArAAAADAAAABwAAAANAAAAGwAAACgAAAAjAAAALgAAAA4AAAAUAAAAEQAAABwAAAAfAAAAKgAAACwAAAAMAAAADwAAABoAAAAdAAAAKwAAACYAAAAvAAAADQAAABoAAAAVAAAAHgAAACAAAAAwAAAAMgAAABAAAAASAAAAIQAAAB8AAAApAAAALAAAADUAAAAPAAAAFgAAABwAAAAgAAAAHgAAABgAAAASAAAANAAAADIAAAAlAAAAIQAAAB4AAAAxAAAAMAAAABYAAAAQAAAAKQAAACIAAAATAAAAJgAAABUAAAA2AAAAJAAAADMAAAAjAAAALgAAAC0AAAA4AAAAEQAAABsAAAAZAAAAJAAAABQAAAAiAAAAEwAAADcAAAAoAAAANgAAACUAAAAnAAAANAAAADkAAAAYAAAAFwAAACAAAAAmAAAAfwAAACIAAAAzAAAAHQAAAC8AAAAVAAAAJwAAACUAAAAZAAAAFwAAADsAAAA5AAAALQAAACgAAAAbAAAAJAAAABQAAAA8AAAALgAAADcAAAApAAAAMQAAADUAAAA9AAAAFgAAACEAAAAfAAAAKgAAADoAAAArAAAAPgAAABwAAAAsAAAAGgAAACsAAAA+AAAALwAAAEAAAAAaAAAAKgAAAB0AAAAsAAAANQAAADoAAABBAAAAHAAAAB8AAAAqAAAALQAAACcAAAAjAAAAGQAAAD8AAAA7AAAAOAAAAC4AAAA8AAAAOAAAAEQAAAAbAAAAKAAAACMAAAAvAAAAJgAAACsAAAAdAAAARQAAADMAAABAAAAAMAAAADEAAAAeAAAAIQAAAEMAAABCAAAAMgAAADEAAAB/AAAAPQAAAEIAAAAhAAAAMAAAACkAAAAyAAAAMAAAACAAAAAeAAAARgAAAEMAAAA0AAAAMwAAAEUAAAA2AAAARwAAACYAAAAvAAAAIgAAADQAAAA5AAAARgAAAEoAAAAgAAAAJQAAADIAAAA1AAAAPQAAAEEAAABLAAAAHwAAACkAAAAsAAAANgAAAEcAAAA3AAAASQAAACIAAAAzAAAAJAAAADcAAAAoAAAANgAAACQAAABIAAAAPAAAAEkAAAA4AAAARAAAAD8AAABNAAAAIwAAAC4AAAAtAAAAOQAAADsAAABKAAAATgAAACUAAAAnAAAANAAAADoAAAB/AAAAPgAAAEwAAAAsAAAAQQAAACoAAAA7AAAAPwAAAE4AAABPAAAAJwAAAC0AAAA5AAAAPAAAAEgAAABEAAAAUAAAACgAAAA3AAAALgAAAD0AAAA1AAAAMQAAACkAAABRAAAASwAAAEIAAAA+AAAAKwAAADoAAAAqAAAAUgAAAEAAAABMAAAAPwAAAH8AAAA4AAAALQAAAE8AAAA7AAAATQAAAEAAAAAvAAAAPgAAACsAAABUAAAARQAAAFIAAABBAAAAOgAAADUAAAAsAAAAVgAAAEwAAABLAAAAQgAAAEMAAABRAAAAVQAAADEAAAAwAAAAPQAAAEMAAABCAAAAMgAAADAAAABXAAAAVQAAAEYAAABEAAAAOAAAADwAAAAuAAAAWgAAAE0AAABQAAAARQAAADMAAABAAAAALwAAAFkAAABHAAAAVAAAAEYAAABDAAAANAAAADIAAABTAAAAVwAAAEoAAABHAAAAWQAAAEkAAABbAAAAMwAAAEUAAAA2AAAASAAAAH8AAABJAAAANwAAAFAAAAA8AAAAWAAAAEkAAABbAAAASAAAAFgAAAA2AAAARwAAADcAAABKAAAATgAAAFMAAABcAAAANAAAADkAAABGAAAASwAAAEEAAAA9AAAANQAAAF4AAABWAAAAUQAAAEwAAABWAAAAUgAAAGAAAAA6AAAAQQAAAD4AAABNAAAAPwAAAEQAAAA4AAAAXQAAAE8AAABaAAAATgAAAEoAAAA7AAAAOQAAAF8AAABcAAAATwAAAE8AAABOAAAAPwAAADsAAABdAAAAXwAAAE0AAABQAAAARAAAAEgAAAA8AAAAYwAAAFoAAABYAAAAUQAAAFUAAABeAAAAZQAAAD0AAABCAAAASwAAAFIAAABgAAAAVAAAAGIAAAA+AAAATAAAAEAAAABTAAAAfwAAAEoAAABGAAAAZAAAAFcAAABcAAAAVAAAAEUAAABSAAAAQAAAAGEAAABZAAAAYgAAAFUAAABXAAAAZQAAAGYAAABCAAAAQwAAAFEAAABWAAAATAAAAEsAAABBAAAAaAAAAGAAAABeAAAAVwAAAFMAAABmAAAAZAAAAEMAAABGAAAAVQAAAFgAAABIAAAAWwAAAEkAAABjAAAAUAAAAGkAAABZAAAAYQAAAFsAAABnAAAARQAAAFQAAABHAAAAWgAAAE0AAABQAAAARAAAAGoAAABdAAAAYwAAAFsAAABJAAAAWQAAAEcAAABpAAAAWAAAAGcAAABcAAAAUwAAAE4AAABKAAAAbAAAAGQAAABfAAAAXQAAAE8AAABaAAAATQAAAG0AAABfAAAAagAAAF4AAABWAAAAUQAAAEsAAABrAAAAaAAAAGUAAABfAAAAXAAAAE8AAABOAAAAbQAAAGwAAABdAAAAYAAAAGgAAABiAAAAbgAAAEwAAABWAAAAUgAAAGEAAAB/AAAAYgAAAFQAAABnAAAAWQAAAG8AAABiAAAAbgAAAGEAAABvAAAAUgAAAGAAAABUAAAAYwAAAFAAAABpAAAAWAAAAGoAAABaAAAAcQAAAGQAAABmAAAAUwAAAFcAAABsAAAAcgAAAFwAAABlAAAAZgAAAGsAAABwAAAAUQAAAFUAAABeAAAAZgAAAGUAAABXAAAAVQAAAHIAAABwAAAAZAAAAGcAAABbAAAAYQAAAFkAAAB0AAAAaQAAAG8AAABoAAAAawAAAG4AAABzAAAAVgAAAF4AAABgAAAAaQAAAFgAAABnAAAAWwAAAHEAAABjAAAAdAAAAGoAAABdAAAAYwAAAFoAAAB1AAAAbQAAAHEAAABrAAAAfwAAAGUAAABeAAAAcwAAAGgAAABwAAAAbAAAAGQAAABfAAAAXAAAAHYAAAByAAAAbQAAAG0AAABsAAAAXQAAAF8AAAB1AAAAdgAAAGoAAABuAAAAYgAAAGgAAABgAAAAdwAAAG8AAABzAAAAbwAAAGEAAABuAAAAYgAAAHQAAABnAAAAdwAAAHAAAABrAAAAZgAAAGUAAAB4AAAAcwAAAHIAAABxAAAAYwAAAHQAAABpAAAAdQAAAGoAAAB5AAAAcgAAAHAAAABkAAAAZgAAAHYAAAB4AAAAbAAAAHMAAABuAAAAawAAAGgAAAB4AAAAdwAAAHAAAAB0AAAAZwAAAHcAAABvAAAAcQAAAGkAAAB5AAAAdQAAAH8AAABtAAAAdgAAAHEAAAB5AAAAagAAAHYAAAB4AAAAbAAAAHIAAAB1AAAAeQAAAG0AAAB3AAAAbwAAAHMAAABuAAAAeQAAAHQAAAB4AAAAeAAAAHMAAAByAAAAcAAAAHkAAAB3AAAAdgAAAHkAAAB0AAAAeAAAAHcAAAB1AAAAcQAAAHYAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAABAAAABQAAAAEAAAAAAAAAAAAAAAEAAAAAAAAAAQAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAACAAAABQAAAAEAAAAAAAAA/////wEAAAAAAAAAAwAAAAQAAAACAAAAAAAAAAAAAAABAAAAAAAAAAEAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAMAAAAFAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAFAAAAAQAAAAAAAAAAAAAAAQAAAAMAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAEAAAADAAAAAAAAAAAAAAABAAAAAAAAAAMAAAADAAAAAwAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAADAAAABQAAAAEAAAAAAAAAAAAAAAEAAAAAAAAAAQAAAAAAAAABAAAAAAAAAP////8DAAAAAAAAAAUAAAACAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAEAAAABQAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAMAAAADAAAAAwAAAAMAAAAAAAAAAwAAAAAAAAAAAAAAAAAAAAMAAAAFAAAABQAAAAAAAAAAAAAAAwAAAAMAAAADAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAADAAAAAwAAAAAAAAADAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAFAAAABQAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAQAAAAAAAAABAAAAAAAAAAMAAAADAAAAAwAAAAAAAAADAAAAAAAAAAAAAAD/////AwAAAAAAAAAFAAAAAgAAAAAAAAAAAAAAAAAAAAAAAAADAAAAAAAAAAAAAAADAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAADAAAAAAAAAAAAAAAAAAAAAwAAAAMAAAAAAAAAAAAAAAEAAAAAAAAAAQAAAAAAAAABAAAAAAAAAAAAAAABAAAAAwAAAAAAAAAAAAAAAQAAAAAAAAADAAAAAwAAAAMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAMAAAADAAAAAwAAAAMAAAAAAAAAAwAAAAAAAAAAAAAAAQAAAAMAAAAAAAAAAAAAAAEAAAAAAAAAAwAAAAMAAAADAAAAAwAAAAAAAAADAAAAAAAAAAAAAAADAAAAAAAAAAMAAAAAAAAAAwAAAAAAAAAAAAAAAAAAAAMAAAAAAAAAAAAAAAMAAAAAAAAAAwAAAAAAAAAAAAAAAAAAAAMAAAADAAAAAAAAAP////8DAAAAAAAAAAUAAAACAAAAAAAAAAAAAAADAAAAAAAAAAAAAAADAAAAAwAAAAAAAAAAAAAAAwAAAAAAAAAAAAAAAwAAAAMAAAAAAAAAAAAAAAAAAAAAAAAAAwAAAAUAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAFAAAABQAAAAAAAAAAAAAAAwAAAAMAAAADAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAwAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAwAAAAAAAAAAAAAAAwAAAAMAAAAAAAAAAAAAAAAAAAADAAAAAAAAAAMAAAAAAAAAAAAAAAMAAAADAAAAAwAAAAAAAAADAAAAAAAAAAAAAAADAAAAAwAAAAMAAAAAAAAAAwAAAAAAAAAAAAAA/////wMAAAAAAAAABQAAAAIAAAAAAAAAAAAAAAAAAAAAAAAAAwAAAAAAAAAAAAAAAwAAAAAAAAADAAAAAAAAAAAAAAAAAAAAAwAAAAMAAAAAAAAAAAAAAAMAAAAAAAAAAwAAAAAAAAADAAAAAAAAAAMAAAADAAAAAwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAwAAAAAAAAADAAAAAAAAAAMAAAAAAAAAAAAAAAMAAAAAAAAAAAAAAAMAAAADAAAAAAAAAAMAAAADAAAAAwAAAAAAAAAAAAAAAwAAAAAAAAAAAAAAAAAAAAMAAAAAAAAAAwAAAAAAAAAAAAAA/////wMAAAAAAAAABQAAAAIAAAAAAAAAAAAAAAMAAAADAAAAAwAAAAMAAAADAAAAAAAAAAAAAAADAAAAAwAAAAMAAAADAAAAAwAAAAAAAAAAAAAAAwAAAAMAAAADAAAAAwAAAAAAAAADAAAAAAAAAAMAAAADAAAAAwAAAAMAAAAAAAAAAwAAAAAAAAD/////AwAAAAAAAAAFAAAAAgAAAAAAAAAAAAAAAAAAAAAAAAADAAAAAAAAAAAAAAADAAAAAAAAAAMAAAADAAAAAwAAAAAAAAADAAAAAAAAAAAAAAADAAAAAAAAAAAAAAAAAAAAAwAAAAMAAAAAAAAAAwAAAAAAAAAAAAAAAwAAAAMAAAAAAAAAAAAAAAMAAAADAAAAAwAAAAAAAAAAAAAAAAAAAAAAAAADAAAAAAAAAAAAAAADAAAAAwAAAAAAAAAAAAAAAAAAAAMAAAAAAAAAAAAAAAMAAAADAAAAAAAAAAAAAAAAAAAAAwAAAAAAAAADAAAAAAAAAAAAAAD/////AwAAAAAAAAAFAAAAAgAAAAAAAAAAAAAAAwAAAAMAAAADAAAAAAAAAAAAAAADAAAAAAAAAAMAAAADAAAAAwAAAAAAAAAAAAAAAwAAAAAAAAAAAAAAAAAAAAMAAAAAAAAAAAAAAAMAAAAAAAAAAwAAAAAAAAAAAAAAAAAAAAMAAAADAAAAAAAAAAAAAAAAAAAAAwAAAAAAAAAFAAAAAAAAAAAAAAADAAAAAwAAAAMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAADAAAAAQAAAAAAAAABAAAAAAAAAAAAAAABAAAAAwAAAAEAAAAAAAAAAQAAAAAAAAAAAAAAAwAAAAAAAAADAAAAAAAAAAMAAAAAAAAAAAAAAAMAAAAAAAAAAwAAAAAAAAADAAAAAAAAAP////8DAAAAAAAAAAUAAAACAAAAAAAAAAAAAAAAAAAAAwAAAAAAAAAAAAAAAwAAAAMAAAAAAAAAAAAAAAAAAAADAAAAAAAAAAMAAAAAAAAAAAAAAAMAAAAAAAAAAAAAAAMAAAADAAAAAAAAAAAAAAADAAAAAwAAAAMAAAADAAAAAwAAAAAAAAAAAAAAAAAAAAAAAAADAAAAAAAAAAUAAAAAAAAAAAAAAAMAAAADAAAAAwAAAAMAAAADAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAwAAAAMAAAADAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAwAAAAAAAAAFAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAFAAAABQAAAAAAAAAAAAAAAAAAAAMAAAAAAAAAAAAAAAMAAAADAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAMAAAAAAAAAAwAAAAAAAAAAAAAA/////wMAAAAAAAAABQAAAAIAAAAAAAAAAAAAAAMAAAADAAAAAwAAAAAAAAAAAAAAAwAAAAAAAAAFAAAAAAAAAAAAAAAFAAAABQAAAAAAAAAAAAAAAAAAAAEAAAADAAAAAQAAAAAAAAABAAAAAAAAAAMAAAADAAAAAwAAAAAAAAAAAAAAAwAAAAAAAAADAAAAAwAAAAMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAADAAAAAQAAAAAAAAABAAAAAAAAAAMAAAADAAAAAwAAAAMAAAADAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAEAAAAAAAAAAwAAAAUAAAABAAAAAAAAAP////8DAAAAAAAAAAUAAAACAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAFAAAABQAAAAAAAAAAAAAAAAAAAAEAAAAAAAAABAAAAAUAAAABAAAAAAAAAAMAAAADAAAAAwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAADAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAIAAAAFAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAEAAAADAAAAAQAAAAAAAAABAAAAAAAAAAUAAAAAAAAAAAAAAAUAAAAFAAAAAAAAAAAAAAD/////AQAAAAAAAAADAAAABAAAAAIAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAUAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAFAAAAAAAAAAAAAAAFAAAABQAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAQAAAAUAAAABAAAAAAAAAAAAAAABAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAgAAAAEAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAIAAAAAAAAAAAAAAAEAAAD//////////wEAAAABAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAQAAAAEAAAAAAAAAAAAAAAAAAAADAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAwAAAAEAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAsAAAACAAAAAAAAAAAAAAABAAAAAgAAAAYAAAAEAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAYAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAgAAAAAAAAABAAAAAQAAAAAAAAAAAAAAAAAAAAcAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAACAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAYAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAKAAAAAgAAAAAAAAAAAAAAAQAAAAEAAAAFAAAABgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAALAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAEAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAABAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAABwAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAsAAAABAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACgAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAwAAAACAAAAAAAAAAAAAAABAAAAAwAAAAcAAAAGAAAAAQAAAAAAAAABAAAAAAAAAAAAAAAAAAAABwAAAAEAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAADAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAwAAAAAAAAABAAAAAQAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAGAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAgAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAADgAAAAIAAAAAAAAAAAAAAAEAAAAAAAAACQAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACgAAAAEAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAQAAAAEAAAAAAAAAAAAAAAAAAAAMAAAAAQAAAAEAAAAAAAAAAAAAAAAAAAAAAAAABwAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAsAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAKAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADQAAAAIAAAAAAAAAAAAAAAEAAAAEAAAACAAAAAoAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAALAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAACQAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAgAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAGAAAAAgAAAAAAAAAAAAAAAQAAAAsAAAAPAAAACAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAkAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAOAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAEAAAAAAAAAAQAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAQAAAAEAAAAAAAAAAAAAAAAAAAAIAAAAAQAAAAAAAAABAAAAAAAAAAAAAAAAAAAABQAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAAAAgAAAAAAAAAAAAAAAQAAAAwAAAAQAAAADAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAoAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAJAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADQAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAPAAAAAAAAAAEAAAABAAAAAAAAAAAAAAAAAAAADwAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAQAAAAEAAAAAAAAAAAAAAAAAAAAAAAAADQAAAAEAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAACAAAAAAAAAAAAAAABAAAACgAAABMAAAAIAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAkAAAABAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAEQAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAwAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEQAAAAAAAAABAAAAAQAAAAAAAAAAAAAAAAAAAA8AAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAQAAAAAQAAAAAAAAABAAAAAAAAAAAAAAAAAAAACQAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAANAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACAAAAAIAAAAAAAAAAAAAAAEAAAANAAAAEQAAAA0AAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAARAAAAAQAAAAAAAAABAAAAAAAAAAAAAAAAAAAAEwAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAA4AAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAATAAAAAAAAAAEAAAABAAAAAAAAAAAAAAAAAAAAEQAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAA0AAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAARAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAkAAAACAAAAAAAAAAAAAAABAAAADgAAABIAAAAPAAAAAQAAAAAAAAABAAAAAAAAAAAAAAAAAAAADwAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABIAAAAAAAAAAQAAAAEAAAAAAAAAAAAAAAAAAAASAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAEwAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAABEAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAATAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEgAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAABIAAAABAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAATAAAAAgAAAAAAAAAAAAAAAQAAAP//////////EwAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAATAAAAAQAAAAAAAAABAAAAAAAAAAAAAAAAAAAAEgAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAASAAAAAAAAABgAAAAAAAAAIQAAAAAAAAAeAAAAAAAAACAAAAADAAAAMQAAAAEAAAAwAAAAAwAAADIAAAADAAAACAAAAAAAAAAFAAAABQAAAAoAAAAFAAAAFgAAAAAAAAAQAAAAAAAAABIAAAAAAAAAKQAAAAEAAAAhAAAAAAAAAB4AAAAAAAAABAAAAAAAAAAAAAAABQAAAAIAAAAFAAAADwAAAAEAAAAIAAAAAAAAAAUAAAAFAAAAHwAAAAEAAAAWAAAAAAAAABAAAAAAAAAAAgAAAAAAAAAGAAAAAAAAAA4AAAAAAAAACgAAAAAAAAALAAAAAAAAABEAAAADAAAAGAAAAAEAAAAXAAAAAwAAABkAAAADAAAAAAAAAAAAAAABAAAABQAAAAkAAAAFAAAABQAAAAAAAAACAAAAAAAAAAYAAAAAAAAAEgAAAAEAAAAKAAAAAAAAAAsAAAAAAAAABAAAAAEAAAADAAAABQAAAAcAAAAFAAAACAAAAAEAAAAAAAAAAAAAAAEAAAAFAAAAEAAAAAEAAAAFAAAAAAAAAAIAAAAAAAAABwAAAAAAAAAVAAAAAAAAACYAAAAAAAAACQAAAAAAAAATAAAAAAAAACIAAAADAAAADgAAAAEAAAAUAAAAAwAAACQAAAADAAAAAwAAAAAAAAANAAAABQAAAB0AAAAFAAAAAQAAAAAAAAAHAAAAAAAAABUAAAAAAAAABgAAAAEAAAAJAAAAAAAAABMAAAAAAAAABAAAAAIAAAAMAAAABQAAABoAAAAFAAAAAAAAAAEAAAADAAAAAAAAAA0AAAAFAAAAAgAAAAEAAAABAAAAAAAAAAcAAAAAAAAAGgAAAAAAAAAqAAAAAAAAADoAAAAAAAAAHQAAAAAAAAArAAAAAAAAAD4AAAADAAAAJgAAAAEAAAAvAAAAAwAAAEAAAAADAAAADAAAAAAAAAAcAAAABQAAACwAAAAFAAAADQAAAAAAAAAaAAAAAAAAACoAAAAAAAAAFQAAAAEAAAAdAAAAAAAAACsAAAAAAAAABAAAAAMAAAAPAAAABQAAAB8AAAAFAAAAAwAAAAEAAAAMAAAAAAAAABwAAAAFAAAABwAAAAEAAAANAAAAAAAAABoAAAAAAAAAHwAAAAAAAAApAAAAAAAAADEAAAAAAAAALAAAAAAAAAA1AAAAAAAAAD0AAAADAAAAOgAAAAEAAABBAAAAAwAAAEsAAAADAAAADwAAAAAAAAAWAAAABQAAACEAAAAFAAAAHAAAAAAAAAAfAAAAAAAAACkAAAAAAAAAKgAAAAEAAAAsAAAAAAAAADUAAAAAAAAABAAAAAQAAAAIAAAABQAAABAAAAAFAAAADAAAAAEAAAAPAAAAAAAAABYAAAAFAAAAGgAAAAEAAAAcAAAAAAAAAB8AAAAAAAAAMgAAAAAAAAAwAAAAAAAAADEAAAADAAAAIAAAAAAAAAAeAAAAAwAAACEAAAADAAAAGAAAAAMAAAASAAAAAwAAABAAAAADAAAARgAAAAAAAABDAAAAAAAAAEIAAAADAAAANAAAAAMAAAAyAAAAAAAAADAAAAAAAAAAJQAAAAMAAAAgAAAAAAAAAB4AAAADAAAAUwAAAAAAAABXAAAAAwAAAFUAAAADAAAASgAAAAMAAABGAAAAAAAAAEMAAAAAAAAAOQAAAAEAAAA0AAAAAwAAADIAAAAAAAAAGQAAAAAAAAAXAAAAAAAAABgAAAADAAAAEQAAAAAAAAALAAAAAwAAAAoAAAADAAAADgAAAAMAAAAGAAAAAwAAAAIAAAADAAAALQAAAAAAAAAnAAAAAAAAACUAAAADAAAAIwAAAAMAAAAZAAAAAAAAABcAAAAAAAAAGwAAAAMAAAARAAAAAAAAAAsAAAADAAAAPwAAAAAAAAA7AAAAAwAAADkAAAADAAAAOAAAAAMAAAAtAAAAAAAAACcAAAAAAAAALgAAAAMAAAAjAAAAAwAAABkAAAAAAAAAJAAAAAAAAAAUAAAAAAAAAA4AAAADAAAAIgAAAAAAAAATAAAAAwAAAAkAAAADAAAAJgAAAAMAAAAVAAAAAwAAAAcAAAADAAAANwAAAAAAAAAoAAAAAAAAABsAAAADAAAANgAAAAMAAAAkAAAAAAAAABQAAAAAAAAAMwAAAAMAAAAiAAAAAAAAABMAAAADAAAASAAAAAAAAAA8AAAAAwAAAC4AAAADAAAASQAAAAMAAAA3AAAAAAAAACgAAAAAAAAARwAAAAMAAAA2AAAAAwAAACQAAAAAAAAAQAAAAAAAAAAvAAAAAAAAACYAAAADAAAAPgAAAAAAAAArAAAAAwAAAB0AAAADAAAAOgAAAAMAAAAqAAAAAwAAABoAAAADAAAAVAAAAAAAAABFAAAAAAAAADMAAAADAAAAUgAAAAMAAABAAAAAAAAAAC8AAAAAAAAATAAAAAMAAAA+AAAAAAAAACsAAAADAAAAYQAAAAAAAABZAAAAAwAAAEcAAAADAAAAYgAAAAMAAABUAAAAAAAAAEUAAAAAAAAAYAAAAAMAAABSAAAAAwAAAEAAAAAAAAAASwAAAAAAAABBAAAAAAAAADoAAAADAAAAPQAAAAAAAAA1AAAAAwAAACwAAAADAAAAMQAAAAMAAAApAAAAAwAAAB8AAAADAAAAXgAAAAAAAABWAAAAAAAAAEwAAAADAAAAUQAAAAMAAABLAAAAAAAAAEEAAAAAAAAAQgAAAAMAAAA9AAAAAAAAADUAAAADAAAAawAAAAAAAABoAAAAAwAAAGAAAAADAAAAZQAAAAMAAABeAAAAAAAAAFYAAAAAAAAAVQAAAAMAAABRAAAAAwAAAEsAAAAAAAAAOQAAAAAAAAA7AAAAAAAAAD8AAAADAAAASgAAAAAAAABOAAAAAwAAAE8AAAADAAAAUwAAAAMAAABcAAAAAwAAAF8AAAADAAAAJQAAAAAAAAAnAAAAAwAAAC0AAAADAAAANAAAAAAAAAA5AAAAAAAAADsAAAAAAAAARgAAAAMAAABKAAAAAAAAAE4AAAADAAAAGAAAAAAAAAAXAAAAAwAAABkAAAADAAAAIAAAAAMAAAAlAAAAAAAAACcAAAADAAAAMgAAAAMAAAA0AAAAAAAAADkAAAAAAAAALgAAAAAAAAA8AAAAAAAAAEgAAAADAAAAOAAAAAAAAABEAAAAAwAAAFAAAAADAAAAPwAAAAMAAABNAAAAAwAAAFoAAAADAAAAGwAAAAAAAAAoAAAAAwAAADcAAAADAAAAIwAAAAAAAAAuAAAAAAAAADwAAAAAAAAALQAAAAMAAAA4AAAAAAAAAEQAAAADAAAADgAAAAAAAAAUAAAAAwAAACQAAAADAAAAEQAAAAMAAAAbAAAAAAAAACgAAAADAAAAGQAAAAMAAAAjAAAAAAAAAC4AAAAAAAAARwAAAAAAAABZAAAAAAAAAGEAAAADAAAASQAAAAAAAABbAAAAAwAAAGcAAAADAAAASAAAAAMAAABYAAAAAwAAAGkAAAADAAAAMwAAAAAAAABFAAAAAwAAAFQAAAADAAAANgAAAAAAAABHAAAAAAAAAFkAAAAAAAAANwAAAAMAAABJAAAAAAAAAFsAAAADAAAAJgAAAAAAAAAvAAAAAwAAAEAAAAADAAAAIgAAAAMAAAAzAAAAAAAAAEUAAAADAAAAJAAAAAMAAAA2AAAAAAAAAEcAAAAAAAAAYAAAAAAAAABoAAAAAAAAAGsAAAADAAAAYgAAAAAAAABuAAAAAwAAAHMAAAADAAAAYQAAAAMAAABvAAAAAwAAAHcAAAADAAAATAAAAAAAAABWAAAAAwAAAF4AAAADAAAAUgAAAAAAAABgAAAAAAAAAGgAAAAAAAAAVAAAAAMAAABiAAAAAAAAAG4AAAADAAAAOgAAAAAAAABBAAAAAwAAAEsAAAADAAAAPgAAAAMAAABMAAAAAAAAAFYAAAADAAAAQAAAAAMAAABSAAAAAAAAAGAAAAAAAAAAVQAAAAAAAABXAAAAAAAAAFMAAAADAAAAZQAAAAAAAABmAAAAAwAAAGQAAAADAAAAawAAAAMAAABwAAAAAwAAAHIAAAADAAAAQgAAAAAAAABDAAAAAwAAAEYAAAADAAAAUQAAAAAAAABVAAAAAAAAAFcAAAAAAAAAXgAAAAMAAABlAAAAAAAAAGYAAAADAAAAMQAAAAAAAAAwAAAAAwAAADIAAAADAAAAPQAAAAMAAABCAAAAAAAAAEMAAAADAAAASwAAAAMAAABRAAAAAAAAAFUAAAAAAAAAXwAAAAAAAABcAAAAAAAAAFMAAAAAAAAATwAAAAAAAABOAAAAAAAAAEoAAAADAAAAPwAAAAEAAAA7AAAAAwAAADkAAAADAAAAbQAAAAAAAABsAAAAAAAAAGQAAAAFAAAAXQAAAAEAAABfAAAAAAAAAFwAAAAAAAAATQAAAAEAAABPAAAAAAAAAE4AAAAAAAAAdQAAAAQAAAB2AAAABQAAAHIAAAAFAAAAagAAAAEAAABtAAAAAAAAAGwAAAAAAAAAWgAAAAEAAABdAAAAAQAAAF8AAAAAAAAAWgAAAAAAAABNAAAAAAAAAD8AAAAAAAAAUAAAAAAAAABEAAAAAAAAADgAAAADAAAASAAAAAEAAAA8AAAAAwAAAC4AAAADAAAAagAAAAAAAABdAAAAAAAAAE8AAAAFAAAAYwAAAAEAAABaAAAAAAAAAE0AAAAAAAAAWAAAAAEAAABQAAAAAAAAAEQAAAAAAAAAdQAAAAMAAABtAAAABQAAAF8AAAAFAAAAcQAAAAEAAABqAAAAAAAAAF0AAAAAAAAAaQAAAAEAAABjAAAAAQAAAFoAAAAAAAAAaQAAAAAAAABYAAAAAAAAAEgAAAAAAAAAZwAAAAAAAABbAAAAAAAAAEkAAAADAAAAYQAAAAEAAABZAAAAAwAAAEcAAAADAAAAcQAAAAAAAABjAAAAAAAAAFAAAAAFAAAAdAAAAAEAAABpAAAAAAAAAFgAAAAAAAAAbwAAAAEAAABnAAAAAAAAAFsAAAAAAAAAdQAAAAIAAABqAAAABQAAAFoAAAAFAAAAeQAAAAEAAABxAAAAAAAAAGMAAAAAAAAAdwAAAAEAAAB0AAAAAQAAAGkAAAAAAAAAdwAAAAAAAABvAAAAAAAAAGEAAAAAAAAAcwAAAAAAAABuAAAAAAAAAGIAAAADAAAAawAAAAEAAABoAAAAAwAAAGAAAAADAAAAeQAAAAAAAAB0AAAAAAAAAGcAAAAFAAAAeAAAAAEAAAB3AAAAAAAAAG8AAAAAAAAAcAAAAAEAAABzAAAAAAAAAG4AAAAAAAAAdQAAAAEAAABxAAAABQAAAGkAAAAFAAAAdgAAAAEAAAB5AAAAAAAAAHQAAAAAAAAAcgAAAAEAAAB4AAAAAQAAAHcAAAAAAAAAcgAAAAAAAABwAAAAAAAAAGsAAAAAAAAAZAAAAAAAAABmAAAAAAAAAGUAAAADAAAAUwAAAAEAAABXAAAAAwAAAFUAAAADAAAAdgAAAAAAAAB4AAAAAAAAAHMAAAAFAAAAbAAAAAEAAAByAAAAAAAAAHAAAAAAAAAAXAAAAAEAAABkAAAAAAAAAGYAAAAAAAAAdQAAAAAAAAB5AAAABQAAAHcAAAAFAAAAbQAAAAEAAAB2AAAAAAAAAHgAAAAAAAAAXwAAAAEAAABsAAAAAQAAAHIAAAAAAAAAGC1EVPsh+T8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABgtRFT7Ifk/GC1EVPsh+T8AAAAAAAAAAAAAAAAAAAAAGC1EVPsh+T8AAAAAAAAAABgtRFT7IQlAGC1EVPsh+T8AAAAAAAAAAAAAAAAAAAAAGC1EVPshCUAAAAAAAAAAABgtRFT7Ifm/GC1EVPsh+T8AAAAAAAAAAAAAAAAAAAAAGC1EVPsh+b8AAAAAAAAAAAAAAAAAAAAAGC1EVPsh+b8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABgtRFT7Ifm/GC1EVPsh+b8AAAAAAAAAAAAAAAAAAAAAGC1EVPsh+b8AAAAAAAAAABgtRFT7IQnAGC1EVPsh+b8AAAAAAAAAAAAAAAAAAAAAGC1EVPshCcAAAAAAAAAAABgtRFT7Ifk/GC1EVPsh+b8AAAAAAAAAAAAAAAAAAAAAGC1EVPsh+T8AAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAGAAAAAgAAAAUAAAABAAAABAAAAAAAAAAAAAAABQAAAAMAAAABAAAABgAAAAQAAAACAAAAAAAAAMpi5RexJsw/BlIKPVwR5T95Wyu0/QjnP5PjoT7YYcu/mBhKZ6zrwj8wRYS7NebuP3qW6geh+Ls/SLrixebL3r+pcyymN9XrPwmkNHp7xec/GWNMZVAA17+82s+x2BLiPwn2ytbJ9ek/LgEH1sMS1j8yp/2LhTfeP+SnWwtQBbu/d38gkp5X7z8ytsuHaADGPzUYObdf1+m/7IauECWhwz+cjSACjzniP76Z+wUhN9K/1+GEKzup67+/GYr/04baPw6idWOvsuc/ZedTWsRa5b/EJQOuRzi0v/OncYhHPes/h49PixY53j+i8wWfC03Nvw2idWOvsue/ZedTWsRa5T/EJQOuRzi0P/KncYhHPeu/iY9PixY53r+i8wWfC03NP9anWwtQBbs/d38gkp5X778ytsuHaADGvzUYObdf1+k/74auECWhw7+cjSACjzniv8CZ+wUhN9I/1uGEKzup6z+/GYr/04bavwmkNHp7xee/F2NMZVAA1z+82s+x2BLivwr2ytbJ9em/KwEH1sMS1r8yp/2LhTfev81i5RexJsy/BlIKPVwR5b95Wyu0/Qjnv5DjoT7YYcs/nBhKZ6zrwr8wRYS7Nebuv3OW6geh+Lu/SLrixebL3j+pcyymN9Xrv8rHIFfWehZAMBwUdlo0DECTUc17EOb2PxpVB1SWChdAzjbhb9pTDUDQhmdvECX5P9FlMKCC9+g/IIAzjELgE0DajDngMv8GQFhWDmDPjNs/y1guLh96EkAxPi8k7DIEQJCc4URlhRhA3eLKKLwkEECqpNAyTBD/P6xpjXcDiwVAFtl//cQm4z+Ibt3XKiYTQM7mCLUb3QdAoM1t8yVv7D8aLZv2Nk8UQEAJPV5nQwxAtSsfTCoE9z9TPjXLXIIWQBVanC5W9AtAYM3d7Adm9j++5mQz1FoWQBUThyaVBghAwH5muQsV7T89Q1qv82MUQJoWGOfNuBdAzrkClkmwDkDQjKq77t37Py+g0dtitsE/ZwAMTwVPEUBojepluNwBQGYbtuW+t9w/HNWIJs6MEkDTNuQUSlgEQKxktPP5TcQ/ixbLB8JjEUCwuWjXMQYCQAS/R09FkRdAowpiZjhhDkB7LmlczD/7P01iQmhhsAVAnrtTwDy84z/Z6jfQ2TgTQChOCXMnWwpAhrW3daoz8z/HYJvVPI4VQLT3ik5FcA5Angi7LOZd+z+NNVzDy5gXQBXdvVTFUA1AYNMgOeYe+T8+qHXGCwkXQKQTOKwa5AJA8gFVoEMW0T+FwzJyttIRQAEAAAD/////BwAAAP////8xAAAA/////1cBAAD/////YQkAAP////+nQQAA/////5HLAQD/////95AMAP/////B9lcAAAAAAAAAAAAAAAAAAgAAAP////8OAAAA/////2IAAAD/////rgIAAP/////CEgAA/////06DAAD/////IpcDAP/////uIRkA/////4LtrwAAAAAAAAAAAAAAAAAAAAAAAgAAAP//////////AQAAAAMAAAD//////////////////////////////////////////////////////////////////////////wEAAAAAAAAAAgAAAP///////////////wMAAAD//////////////////////////////////////////////////////////////////////////wEAAAAAAAAAAgAAAP///////////////wMAAAD//////////////////////////////////////////////////////////////////////////wEAAAAAAAAAAgAAAP///////////////wMAAAD//////////////////////////////////////////////////////////wIAAAD//////////wEAAAAAAAAA/////////////////////wMAAAD/////////////////////////////////////////////////////AwAAAP////////////////////8AAAAA/////////////////////wEAAAD///////////////8CAAAA////////////////////////////////AwAAAP////////////////////8AAAAA////////////////AgAAAAEAAAD/////////////////////////////////////////////////////AwAAAP////////////////////8AAAAA////////////////AgAAAAEAAAD/////////////////////////////////////////////////////AwAAAP////////////////////8AAAAA////////////////AgAAAAEAAAD/////////////////////////////////////////////////////AwAAAP////////////////////8AAAAA////////////////AgAAAAEAAAD/////////////////////////////////////////////////////AQAAAAIAAAD///////////////8AAAAA/////////////////////wMAAAD/////////////////////////////////////////////////////AQAAAAIAAAD///////////////8AAAAA/////////////////////wMAAAD/////////////////////////////////////////////////////AQAAAAIAAAD///////////////8AAAAA/////////////////////wMAAAD/////////////////////////////////////////////////////AQAAAAIAAAD///////////////8AAAAA/////////////////////wMAAAD///////////////////////////////8CAAAA////////////////AQAAAP////////////////////8AAAAA/////////////////////wMAAAD/////////////////////////////////////////////////////AwAAAP////////////////////8AAAAAAQAAAP//////////AgAAAP//////////////////////////////////////////////////////////AwAAAP///////////////wIAAAAAAAAAAQAAAP//////////////////////////////////////////////////////////////////////////AwAAAP///////////////wIAAAAAAAAAAQAAAP//////////////////////////////////////////////////////////////////////////AwAAAP///////////////wIAAAAAAAAAAQAAAP//////////////////////////////////////////////////////////////////////////AwAAAAEAAAD//////////wIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAgAAAAAAAAACAAAAAQAAAAEAAAACAAAAAgAAAAAAAAAFAAAABQAAAAAAAAACAAAAAgAAAAMAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACAAAAAAAAAAIAAAABAAAAAgAAAAIAAAACAAAAAAAAAAUAAAAGAAAAAAAAAAIAAAACAAAAAwAAAAIAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAIAAAAAAAAAAgAAAAEAAAADAAAAAgAAAAIAAAAAAAAABQAAAAcAAAAAAAAAAgAAAAIAAAADAAAAAwAAAAAAAAAAAAAAAAAAAAAAAAACAAAAAgAAAAAAAAACAAAAAQAAAAQAAAACAAAAAgAAAAAAAAAFAAAACAAAAAAAAAACAAAAAgAAAAMAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAACAAAAAAAAAAIAAAABAAAAAAAAAAIAAAACAAAAAAAAAAUAAAAJAAAAAAAAAAIAAAACAAAAAwAAAAUAAAAAAAAAAAAAAAAAAAAAAAAACgAAAAIAAAACAAAAAAAAAAMAAAAOAAAAAgAAAAAAAAACAAAAAwAAAAAAAAAAAAAAAgAAAAIAAAADAAAABgAAAAAAAAAAAAAAAAAAAAAAAAALAAAAAgAAAAIAAAAAAAAAAwAAAAoAAAACAAAAAAAAAAIAAAADAAAAAQAAAAAAAAACAAAAAgAAAAMAAAAHAAAAAAAAAAAAAAAAAAAAAAAAAAwAAAACAAAAAgAAAAAAAAADAAAACwAAAAIAAAAAAAAAAgAAAAMAAAACAAAAAAAAAAIAAAACAAAAAwAAAAgAAAAAAAAAAAAAAAAAAAAAAAAADQAAAAIAAAACAAAAAAAAAAMAAAAMAAAAAgAAAAAAAAACAAAAAwAAAAMAAAAAAAAAAgAAAAIAAAADAAAACQAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAgAAAAIAAAAAAAAAAwAAAA0AAAACAAAAAAAAAAIAAAADAAAABAAAAAAAAAACAAAAAgAAAAMAAAAKAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAACAAAAAgAAAAAAAAADAAAABgAAAAIAAAAAAAAAAgAAAAMAAAAPAAAAAAAAAAIAAAACAAAAAwAAAAsAAAAAAAAAAAAAAAAAAAAAAAAABgAAAAIAAAACAAAAAAAAAAMAAAAHAAAAAgAAAAAAAAACAAAAAwAAABAAAAAAAAAAAgAAAAIAAAADAAAADAAAAAAAAAAAAAAAAAAAAAAAAAAHAAAAAgAAAAIAAAAAAAAAAwAAAAgAAAACAAAAAAAAAAIAAAADAAAAEQAAAAAAAAACAAAAAgAAAAMAAAANAAAAAAAAAAAAAAAAAAAAAAAAAAgAAAACAAAAAgAAAAAAAAADAAAACQAAAAIAAAAAAAAAAgAAAAMAAAASAAAAAAAAAAIAAAACAAAAAwAAAA4AAAAAAAAAAAAAAAAAAAAAAAAACQAAAAIAAAACAAAAAAAAAAMAAAAFAAAAAgAAAAAAAAACAAAAAwAAABMAAAAAAAAAAgAAAAIAAAADAAAADwAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAgAAAAAAAAACAAAAAQAAABMAAAACAAAAAgAAAAAAAAAFAAAACgAAAAAAAAACAAAAAgAAAAMAAAAQAAAAAAAAAAAAAAAAAAAAAAAAABEAAAACAAAAAAAAAAIAAAABAAAADwAAAAIAAAACAAAAAAAAAAUAAAALAAAAAAAAAAIAAAACAAAAAwAAABEAAAAAAAAAAAAAAAAAAAAAAAAAEgAAAAIAAAAAAAAAAgAAAAEAAAAQAAAAAgAAAAIAAAAAAAAABQAAAAwAAAAAAAAAAgAAAAIAAAADAAAAEgAAAAAAAAAAAAAAAAAAAAAAAAATAAAAAgAAAAAAAAACAAAAAQAAABEAAAACAAAAAgAAAAAAAAAFAAAADQAAAAAAAAACAAAAAgAAAAMAAAATAAAAAAAAAAAAAAAAAAAAAAAAAA8AAAACAAAAAAAAAAIAAAABAAAAEgAAAAIAAAACAAAAAAAAAAUAAAAOAAAAAAAAAAIAAAACAAAAAwAAAAIAAAABAAAAAAAAAAEAAAACAAAAAAAAAAAAAAACAAAAAQAAAAAAAAABAAAAAgAAAAEAAAAAAAAAAgAAAAAAAAAFAAAABAAAAAAAAAABAAAABQAAAAAAAAAAAAAABQAAAAQAAAAAAAAAAQAAAAUAAAAEAAAAAAAAAAUAAAAAAAAAAgAAAAEAAAAAAAAAAQAAAAIAAAAAAAAAAAAAAAIAAAABAAAAAAAAAAEAAAACAAAAAQAAAAAAAAACAAAAAgAAAAAAAAABAAAAAAAAAAAAAAAFAAAABAAAAAAAAAABAAAABQAAAAAAAAAAAAAABQAAAAQAAAAAAAAAAQAAAAUAAAAEAAAAAAAAAAUAAAAFAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAQAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAABAAAAAAAAAAABAAAAAAEAAAAAAAAAAAEAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAQAAAAAAAAAAAAEAAAAAAAAAAAAAOgehWlKfUEEz1zLi+JsiQa2og3wcMfVAWCbHorc0yEDi+Yn/Y6mbQJ11/mfsnG9At6bnG4UQQkBvMCQWKqUUQJVmwwswmOc/3hVgVBL3uj//qqOEOdGOPw/WDN4gnGE/H3ANkCUgND+AA8btKgAHPwTXBqJVSdo+XfRQAqsKrj4fc+zLYbSPQklEmCZHv2FCUP+uDso1NEKYtPhwphUHQptxnyFXYdpB7CddZAMmrkGAt1AxSTqBQUibBVdTsFNBSuX3MV+AJkFocv82SLf5QAqmgj7AY81A23VDSEnLoEDGEJVSeDFzQDYrqvBk70VA8U157pcRGUBWfEF+ZKbsP6phvycGBZRAJbod0OgwfkCp+L8jatBmQCjl3pGrPlFAfMWm114SOkButwtqS7UjQHQwbcjXyw1A8jnLuuyA9j9KwjL0VwHhPyotk0lcs8k/Q5PvEs9rsz+SfsOQEVqdPzUAKDojLoY/WJz/kcjCcD8YFu070FRZPyoLC2BdJEM/YOXQAuiMM0HIBz1bw3sdQdV46aaHRwZByatzjDPX8EDb3Jie8HXZQCJxj6ULP8NAUaG6uRAZrUCWdmou5/mVQLb9huRPm4BAhvoCHygZaUCuX/I3SPdSQC9/bC/1qTxAfKxsYQ6pJUCuslH+N14QQMS/cv7SvPg/Ol8maYKx4j8AAAAA/////wAAAAAAAAAAAAAAAAAAAAAAAAAA/////////////////////////////////////wAAAAD/////AAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAA/////wAAAAAAAAAAAQAAAAEAAAAAAAAAAAAAAP////8AAAAABQAAAAAAAAAAAAAAAAAAAAAAAAD/////BQAAAAUAAAAAAAAAAAAAAAAAAAAAAAAA/////wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAP////////////////////////////////////8AAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD/////////////////////////////////////AAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAABQAAAAEAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA/////////////////////////////////////wAAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAEAAAABAAAAAQAAAAAAAAABAAAAAAAAAAUAAAABAAAAAQAAAAAAAAAAAAAAAQAAAAEAAAAAAAAAAQAAAAEAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQEAAAAAAAEAAQAAAQEAAAAAAAEAAAABAAAAAQABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAABAAAAAAAAAAAAAAABAAAAAQAAAAEAAAAAAAAAAAAAAAEAAAAAAAAAAQAAAAEAAAABAAAAAAAAAAAAAAAAAAAAAAAAAKriWFiWZfg/Y2nmTbY/8z8MHSPSqmnjv6hnn18HR3c/quJYWJZl+D/jq5TzDdzyPwwdI9KqaeO/u0kC1eFSBECq4lhYlmX4P69pJmt7c/E/NnkJi6jSBsDESFlzKkr6P33ArMz7sfY/o2q2uqM08D+oZ59fB0d3PzEqCi3qrvK/kmm4ANp49D+4wS2wzhzvP9WJvyAnx+E/upcY75RVx7+95t+9y0T1P9L18g1caO0/k6CkRyVzAEBf99+e/GjxP6QMsuuLQ/U/PlP4Qr8q7j8Mb/GO2GMCwLl2K/DQIghAePiwytEp9D9UHrsuI/nqPzjMedJ+yuy/k6xgf58n/L+XoQtn22DzP2lzCnsYk+s/JhUSDI4P8z+8lFcBhgTcPxOqKRxEX/M/89MEdoPQ6j8OKQaXDob7vzWwNvblgAPAzGkxMcl88j9Nm4okPkbpP0vI89vxSgRAdac2Z6W2/T+6UFOMC3zyP/+2XEF3hug/QqhELwGKCMAwdlQerEoEQFcr/B+VnvE/hB1hfFzT5j8wdsE/Da64P0hIvnF/sOC/KH/hrXUg8T9bI5OQHaLlP+mYzla7td6/CtKG6iOm8b8FW3TV8oXwP8ORhtNuJ+c/q8JrTMz/AcC8PaUl+PUFwAXv9rkMT/A/m+sAswr15D+7hk/O3yvkP6c/yVsOHKI/qqAX9idJ8D/8hNz1KNPiP7xSXh3Ggvg/epbkiKr57T/23/LB1GLvP4GTTeNZi+M/W4TqlTheBcDupZgIdYUIQGwlcW3YZO8/tQvDXQ3H4j8Bt+sf9DkAQMdFie+nNvg/Z5Uh1wDX7j9h5X2d4KjhPxMJ1ZVT4Pa/evqB8xB//7+W183U9QLsPwzNxsC7AOA/af/LqCnK/r/lPceQ0FQDwHoY0nYIW+w/bHNSHrTg4D/DFcMAdabuv2sz5Ojhnve/FvLf01HN6z/tEDL2Hz/gP0bBv0KUhPA/pd7sEnMc4D8EGon4Lo7sP5NVbYtSON8/DAMC50odBkB+Z2J8MGYCQIhlM1gubOo/FssiPwWy4D8OIlGqRnkCQAd1vopp6f4/QS1keLLK6T9rfoBuT7LZP3KQbH5ugwjAjqVPXTmbBUBL/JxcqR3qP3oSeovuktg/Y6pRhJmqy7+0kwuU0Yjmv2wvsfFmQ+g/R98lJFqQ2T/IGb5gjLkCwK3mNff3kQbAqDznPFM86T+iiP0FfsvYP7fzKG6Mls0/h7+at2btzL8tsUTgk+LmP/YEIrTDINU/WmwKoVjA5L9aC02r6FHxvzzFCT/Qg+Y/nx0V97en0j8+1toJOm77P1kZ7h8KjfQ/GBbbqxgk5j9RGXM79G/SP+beHsWmweQ/9REi4eX0xD/V9s+kmMHkP+pb9yNs09A/c5ERjVDTAECqEr3OBCH7P14ILfMECOU/piRx4P8P0j+JYU//bfL0Pw62fw28B+w/l5YW2Ga45D9+CyKRbenOP5cH6fHy1/S/o/egk03++r91nTYRL/bjP3fHN6OJVdA/7xXQh1XLBcAB3g6tBdUIQKW2KnGYjeQ/SqIpagclyz8F9P3YgNL6v9H6NBsZ8QDAW2k5L5Qs4z/0axa1l6zLP1GE65Mu4wNAwfX+BYmWAEBBgJP90M3hP6/03qhPLdA/zqo5bJz2778/ESlPCTn1v7JkhGyvzuE/DM7sj5twwz/6xbXLavYGQH29RFRGkgNA7bOXVSJ54T9fEhTHO/TDP+8t+HMOiwDAxa0SbGTtA8Atii7y0mLgP4cecHFB3sM/uPUpyv+K7j8nktD1/WvhP2cWmi772d8/Fj7uU9kEvD8oKOESLzKmvwSdCqrHdNu/XCluGsvI3T929OW5md+uP9dP6rXcZNq/gXM+ggzL6b+eKjsPgJncP6i1e9aVu7E/2CnPNJyD1D/DnyGgSe+xvy8k7g9bp9s/nYmLvHn1sz9cFOwApH8IwGa6Mjy9cgZAJr95SiSW2z8rCkhOFvqdP3SIKmO/UwPAEy0zkN7bBsCds8Hg/13YP1zv413hVGi/FVtqixSn6L9XAPQGul3yv7SGu2BoCNk/n94bv7Maj79p13T6X9z3P45MPCW3WvI/rU/8/LRj1T9cgR6SXd+ZPymL2DstbPI/8s/pAkIz6z/fmoB+8efYPz2XyfWgYaa/6wys72AW/j8LZImhgrf3P729Zla/n9U/ySB8B3PBqL8O2nhevvbxv17+5A+n6fe/YrGIqEGB1T+wCEGbkhaxv989QHVE5wFAzd12PTu3/T9AHUPZY2DUP3SQDST0zq2/JCxAlIoj5T+Mhe1IJkrQP/cRpl8QhtU/amc4seFts79khiUSVaz3vxYfWtjPwf2/CHscxQqD0j/ctUBQ9my3v0POnFiyXv2/pjjn2Ju/AcDk45DwBhPRP/GjwlCrv7m/aT2ciwolBsAQOzHr/wUJQCzpq5UYvtI/gDCf3SlCwb+4i7S+mukEQBDA1f8mowFA2utnRN3KyT9T+9EYAVG6v9/IVZ0enrE/7NbRtdGfzr/8y8GpRz7LP3U0vTSk18e/JzHEcwiBB0AGm8Q7AJkEQNLciyt4Esk/gLou5zoQxr+RrOfM91oBwEzd36KybgTAgLou5zoQxj/S3IsreBLJv1gCch0OHO8/FD+RxSLN4j91NL00pNfHP/zLwalHPsu/nL7/By4Pyr8tSP5h7CPiv1P70RgBUbo/2utnRN3Kyb/KfllfCpUIwLkP5zj+NwdAgDCf3SlCwT8s6auVGL7Sv2aFPlaC4eC/XrS5UVH77b/xo8JQq7+5P+TjkPAGE9G/Q30/RYbn1z8FF/ISafuLv9y1QFD2bLc/CHscxQqD0r/fi+tPROX0P6vRc+19ie0/amc4seFtsz/3EaZfEIbVv77TYpahl/o/DDsu0CaC9D90kA0k9M6tP0AdQ9ljYNS/CCI0rxjZA8BgfCaLthgHwLAIQZuSFrE/YrGIqEGB1b8kvQ982+rsv4J8EWu7jPS/ySB8B3PBqD+9vWZWv5/VvwrAByWcJgBAxFujmE9a+j89l8n1oGGmP9+agH7x59i/N03cuJUt9L8X9v4GdIz6v1yBHpJd35m/rU/8/LRj1b8mz69sydf/vyu5idMqVQLAn94bv7Majz8AhrtgaAjZv+aCE66WZ/q/lA1Mgz/p/79c7+Nd4VRoP52zweD/Xdi/TJZpMTb4AkDLWZShPOb/PysKSE4W+p2/Jr95SiSW27/PkmbE7zjnP6UAiCDmMNI/nYmLvHn1s78vJO4PW6fbv5MWA2vqSrQ/V5WLwPB51b+otXvWlbuxv54qOw+Amdy/1keqzYeRBsApIEMHgZIIQHb05bmZ366/XCluGsvI3b8W44a9X9UFQEeQtDM4rwJAFj7uU9kEvL9nFpou+9nfv3Co+JcyyQhAcdkCX2KzBUCHHnBxQd7Dvy2KLvLSYuC/o6+5YTt/AcCHCNDW+8YEwF8SFMc79MO/7bOXVSJ54b9E/pfA2S3xPzD9xaBb0uQ/DM7sj5tww7+yZIRsr87hv7c4c0SEXNG/Tr79/9M+5r+v9N6oTy3Qv5uAk/3QzeG/XcI1OVQkAUAQSV9Z7Qr9P/RrFrWXrMu/W2k5L5Qs479Zo2IBM/vkv6FuipzkFvG/SqIpagcly7+ltipxmI3kv0pmis91cfc/gWQecsRh8D93xzejiVXQv3WdNhEv9uO/D7mgYy612j+PyVPNaT2jv34LIpFt6c6/l5YW2Ga45L+LUp+2A2z9P39i5xSpRfc/piRx4P8P0r9eCC3zBAjlv5n4OKmIUf2/jj/kUAwgAsDqW/cjbNPQv9X2z6SYweS/aTdljlWd8L94R8vZ8SL3v1EZczv0b9K/GBbbqxgk5r9XdfyikfEDwPILMvas0gfAnx0V97en0r88xQk/0IPmvxGErZ681fa/9kCaiOy2/b/2BCK0wyDVvy2xROCT4ua/+5EBLOXxA0B7p53+BnkAQKKI/QV+y9i/qDznPFM86b/snWGNkkgHwC+ByugkUwdAR98lJFqQ2b9sL7HxZkPovyJNGM67oek/HzNy6BqA1D96EnqL7pLYv0v8nFypHeq/axL/u1FnB0AkSEHvxn8DQGt+gG5Pstm/QS1keLLK6b/Sk/O6mtGzPxU8pLcPNty/FssiPwWy4L+IZTNYLmzqvw4szKfSouq/G+XJHY1a87+TVW2LUjjfvwQaifgujuy/3VARaoMl2L9NFodfK+/qv+0QMvYfP+C/FvLf01HN67+ETOQysd8AwH71iI/eGgXAbHNSHrTg4L96GNJ2CFvsv6BnExReeAFA5CakvxSl+j8MzcbAuwDgv5bXzdT1Auy/uVq8/8x58z+uvPMNqzTnP2HlfZ3gqOG/Z5Uh1wDX7r8PUbMSo2P7P9VfBrXlxPI/tQvDXQ3H4r9sJXFt2GTvvyDssGgO0PG/WxT/uE4N+r+Bk03jWYvjv/bf8sHUYu+/rUXN8hUe3j9m5HB1yZCzv/yE3PUo0+K/qqAX9idJ8L9mByqLMMH5v4kHC7KQowHAm+sAswr15L8F7/a5DE/wv2JLsGADFwTAKQjVGovZCMDDkYbTbifnvwVbdNXyhfC/malhH7yI7D+oevd0GWDZP1sjk5AdouW/KH/hrXUg8b8KWmrpQ0sFQAzEAF/pTgBAhB1hfFzT5r9XK/wflZ7xv18hRuqKXAjA/5rUd9v1BED/tlxBd4bov7pQU4wLfPK/4pnwn0T/sj/c277XPF3jv02biiQ+Rum/zGkxMcl88r8Yk0HhJVzjv62yUUFRjfS/89MEdoPQ6r8TqikcRF/zvxQxghHovfY/cfM1eFWE5j9pcwp7GJPrv5ehC2fbYPO/KUV2nGg0/795OhmUaqEFwFQeuy4j+eq/ePiwytEp9L8DuqWfW+8BQLytJylXHPY/PlP4Qr8q7r+kDLLri0P1vxT4ShWL+Oo/DMsWg0zlv7/S9fINXGjtv73m373LRPW/+xg/Gaxd8b94MdQEfW0AwLjBLbDOHO+/kmm4ANp49L+cShSMMbAEwKyjUgWirAdAo2q2uqM08L99wKzM+7H2v3RdlNBXFgnA8S9+ewyV/z+vaSZre3Pxv6riWFiWZfi/2J7VSZZ60j+LES81zPn3v+OrlPMN3PK/quJYWJZl+L/OZbufkEcEQLCNB/1lPOO/Y2nmTbY/87+q4lhYlmX4v7CNB/1lPOO/zmW7n5BHBEBwKD1Aa57LP/XsSsw7RbU/PMDPJGsfoD/TqningGKIPzFtCLYmb3I/qYfrJr7eWz9pQmleXRFFP0rWlJkA2i8/pCvcttgTGD9Dt8IWbjMCPyCG4GRlhOs+1JI2GhDN1D7ns8cGvXK/Pi8m8UTJxac+hNTfA2z4kT7GI8kjLyt7Pv//////HwAI//////8zEAj/////fzIgCP////9vMjAI/////2MyQAj///8/YjJQCP///zdiMmAI////M2IycAj//78zYjKACP//qzNiMpAI/3+rM2IyoAj/D6szYjKwCP8DqzNiMsAIvwOrM2Iy0AifA6szYjLgCJkDqzNiMvAI//////8/Dwj//////ysfCP////9/KS8I/////z8pPwj/////OSlPCP///z84KV8I////Dzgpbwj///8OOCl/CP//Hw44KY8I//8PDjgpnwj/fw0OOCmvCP8PDQ44Kb8I/w0NDjgpzwj/DA0OOCnfCMcMDQ44Ke8IxAwNDjgp/wgHAAAABwAAAAEAAAACAAAABAAAAAMAAAAAAAAAAAAAAAcAAAADAAAAAQAAAAIAAAAFAAAABAAAAAAAAAAAAAAABAAAAAQAAAAAAAAAAgAAAAEAAAADAAAADgAAAAYAAAALAAAAAgAAAAcAAAABAAAAGAAAAAUAAAAKAAAAAQAAAAYAAAAAAAAAJgAAAAcAAAAMAAAAAwAAAAgAAAACAAAAMQAAAAkAAAAOAAAAAAAAAAUAAAAEAAAAOgAAAAgAAAANAAAABAAAAAkAAAADAAAAPwAAAAsAAAAGAAAADwAAAAoAAAAQAAAASAAAAAwAAAAHAAAAEAAAAAsAAAARAAAAUwAAAAoAAAAFAAAAEwAAAA4AAAAPAAAAYQAAAA0AAAAIAAAAEQAAAAwAAAASAAAAawAAAA4AAAAJAAAAEgAAAA0AAAATAAAAdQAAAA8AAAATAAAAEQAAABIAAAAQAAAABgAAAAIAAAADAAAABQAAAAQAAAAAAAAAAAAAAAAAAAAGAAAAAgAAAAMAAAABAAAABQAAAAQAAAAAAAAAAAAAAAcAAAAFAAAAAwAAAAQAAAABAAAAAAAAAAIAAAAAAAAAAgAAAAMAAAABAAAABQAAAAQAAAAGAAAAAAAAAAAAAAAYLURU+yH5PxgtRFT7Ifm/GC1EVPshCUAYLURU+yEJwGFsZ29zLmMAaDNOZWlnaGJvclJvdGF0aW9ucwBjZWxsc1RvTXVsdGlQb2x5LmMAY2VsbFRvRWRnZUFyY3MAAAEDAgQABAMFAQJjYW5jZWxBcmNQYWlycwBjcmVhdGVTb3J0YWJsZUxvb3AAZGlyZWN0ZWRFZGdlLmMAZGlyZWN0ZWRFZGdlVG9Cb3VuZGFyeQBhZGphY2VudEZhY2VEaXJbdG1wRmlqay5mYWNlXVtmaWprLmZhY2VdID09IEtJAGZhY2VpamsuYwBfZmFjZUlqa1BlbnRUb0NlbGxCb3VuZGFyeQBhZGphY2VudEZhY2VEaXJbY2VudGVySUpLLmZhY2VdW2ZhY2UyXSA9PSBLSQBfZmFjZUlqa1RvQ2VsbEJvdW5kYXJ5AGgzSW5kZXguYwBjb21wYWN0Q2VsbHMAdmVjM1RvQ2VsbABjZWxsVG9DaGlsZFBvcwB2YWxpZGF0ZUNoaWxkUG9zAHJldkRpciAhPSBJTlZBTElEX0RJR0lUAGxvY2FsaWouYwBjZWxsVG9Mb2NhbElqawBiYXNlQ2VsbCAhPSBvcmlnaW5CYXNlQ2VsbAAhKG9yaWdpbk9uUGVudCAmJiBpbmRleE9uUGVudCkAYmFzZUNlbGwgPT0gb3JpZ2luQmFzZUNlbGwALi4vaW5jbHVkZS9jb29yZGlqay5oAF91cEFwN0NoZWNrZWQAX3VwQXA3ckNoZWNrZWQAYmFzZUNlbGwgIT0gSU5WQUxJRF9CQVNFX0NFTEwAbG9jYWxJamtUb0NlbGwAIV9pc0Jhc2VDZWxsUGVudGFnb24oYmFzZUNlbGwpAGJhc2VDZWxsUm90YXRpb25zID49IDAAZ3JpZFBhdGhDZWxsc0ludGVycG9sYXRlAHBvbHlmaWxsLmMAaXRlclN0ZXBQb2x5Z29uQ29tcGFjdAAwAHZlcnRleC5jAHZlcnRleFJvdGF0aW9ucwBjZWxsVG9WZXJ0ZXg=";var vt=28400;function Tt(Le){return Le}function qe(Le){var it=/\b__Z[\w\d_]+/g;return Le.replace(it,function(Dt){var He=Dt;return Dt===He?Dt:He+" ["+Dt+"]"})}function Je(){var Le=new Error;if(!Le.stack){try{throw new Error(0)}catch(it){Le=it}if(!Le.stack)return"(no stack trace available)"}return Le.stack.toString()}function It(){var Le=Je();return e.extraStackTrace&&(Le+=`4130+`+e.extraStackTrace()),qe(Le)}function rn(Le,it,Dt,He){Um("Assertion failed: "+L(Le)+", at: "+[it?L(it):"unknown filename",Dt,He?L(He):"unknown function"])}function Lt(){return Y.length}function Rt(Le,it,Dt){H.set(H.subarray(it,it+Dt),Le)}function fn(Le){return e.___errno_location&&(te[e.___errno_location()>>2]=Le),Le}function wn(Le){Um("OOM")}function Dn(Le){try{var it=new ArrayBuffer(Le);return it.byteLength!=Le?void 0:(new Int8Array(it).set(Y),sn(it),Re(it),1)}catch{}}function ye(Le){var it=Lt(),Dt=16777216,He=2147483648-Dt;if(Le>He)return!1;for(var h=16777216,sr=Math.max(it,h);sr<Le;)sr<=536870912?sr=G(2*sr,Dt):sr=Math.min(G((3*sr+2147483648)/4,Dt),He);var Pi=Dn(sr);return!!Pi}var wt=typeof atob=="function"?atob:function(Le){var it="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",Dt="",He,h,sr,Pi,ie,or,ol,fo=0;Le=Le.replace(/[^A-Za-z0-9\+\/\=]/g,"");do Pi=it.indexOf(Le.charAt(fo++)),ie=it.indexOf(Le.charAt(fo++)),or=it.indexOf(Le.charAt(fo++)),ol=it.indexOf(Le.charAt(fo++)),He=Pi<<2|ie>>4,h=(ie&15)<<4|or>>2,sr=(or&3)<<6|ol,Dt=Dt+String.fromCharCode(He),or!==64&&(Dt=Dt+String.fromCharCode(h)),ol!==64&&(Dt=Dt+String.fromCharCode(sr));while(fo<Le.length);return Dt};function Ze(Le){try{for(var it=wt(Le),Dt=new Uint8Array(it.length),He=0;He<it.length;++He)Dt[He]=it.charCodeAt(He);return Dt}catch{throw new Error("Converting base64 string to bytes failed.")}}function St(Le){if(Te(Le))return Ze(Le.slice(Z.length))}var Bt={Math,Int8Array,Int32Array,Uint8Array,Float32Array,Float64Array},ut={a:Um,b:f,c:d,d:rn,e:fn,f:Lt,g:Rt,h:ye,i:wn,j:Tt,k:qe,l:Dn,m:Je,n:It,o:vt,p:Fe},Ce=(function(Le,it,Dt){"almost asm";var He=new Le.Int8Array(Dt),h=new Le.Int32Array(Dt),sr=new Le.Uint8Array(Dt),Pi=new Le.Float32Array(Dt),ie=new Le.Float64Array(Dt),or=it.o|0,ol=it.p|0,fo=Le.Math.floor,Ks=Le.Math.abs,bs=Le.Math.sqrt,ii=Le.Math.cos,zi=Le.Math.sin,iT=Le.Math.tan,bce=Le.Math.acos,qx=Le.Math.asin,KG=Le.Math.atan,Ta=Le.Math.atan2,x1=Le.Math.ceil,al=Le.Math.imul,nL=Le.Math.min,wce=Le.Math.max,Gf=Le.Math.clz32,Sce=it.a,On=it.b,ee=it.c,di=it.d,QG=it.e,Tce=it.f,Ece=it.g,Mce=it.h,Cce=it.i,Q=28416;function Rce(p){return He=new Int8Array(p),sr=new Uint8Array(p),h=new Int32Array(p),Pi=new Float32Array(p),ie=new Float64Array(p),Dt=p,!0}function Pce(p){p=p|0;var m=0;return m=Q,Q=Q+p|0,Q=Q+15&-16,m|0}function Ice(){return Q|0}function Lce(p){p=p|0,Q=p}function Dce(p,m){p=p|0,m=m|0,Q=p}function Nce(p,m){p=p|0,m=m|0;var g=0,_=0,v=0;return(p|0)<0?(m=2,m|0):(p|0)>13780509?(m=aT(15,m)|0,m|0):(g=((p|0)<0)<<31>>31,v=wr(p|0,g|0,3,0)|0,_=ee()|0,g=At(p|0,g|0,1,0)|0,g=wr(v|0,_|0,g|0,ee()|0)|0,g=At(g|0,ee()|0,1,0)|0,p=ee()|0,h[m>>2]=g,h[m+4>>2]=p,m=0,m|0)}function JG(p,m,g,_){return p=p|0,m=m|0,g=g|0,_=_|0,eq(p,m,g,_,0)|0}function eq(p,m,g,_,v){p=p|0,m=m|0,g=g|0,_=_|0,v=v|0;var x=0,b=0,E=0,M=0,N=0;if(M=Q,Q=Q+16|0,b=M,!(tq(p,m,g,_,v)|0))return _=0,Q=M,_|0;do if((g|0)>=0){if((g|0)>13780509){if(x=aT(15,b)|0,x|0)break;E=b,b=h[E>>2]|0,E=h[E+4>>2]|0}else x=((g|0)<0)<<31>>31,N=wr(g|0,x|0,3,0)|0,E=ee()|0,x=At(g|0,x|0,1,0)|0,x=wr(N|0,E|0,x|0,ee()|0)|0,x=At(x|0,ee()|0,1,0)|0,E=ee()|0,h[b>>2]=x,h[b+4>>2]=E,b=x;if(lp(_|0,0,b<<3|0)|0,v|0){lp(v|0,0,b<<2|0)|0,x=ih(p,m,g,_,v,b,E,0)|0;break}x=Ea(b,4)|0,x?(N=ih(p,m,g,_,x,b,E,0)|0,_t(x),x=N):x=13}else x=2;while(!1);return N=x,Q=M,N|0}function tq(p,m,g,_,v){p=p|0,m=m|0,g=g|0,_=_|0,v=v|0;var x=0,b=0,E=0,M=0,N=0,U=0,q=0,j=0,X=0,K=0,ae=0;if(ae=Q,Q=Q+16|0,X=ae,K=ae+8|0,j=X,h[j>>2]=p,h[j+4>>2]=m,(g|0)<0)return K=2,Q=ae,K|0;if(x=_,h[x>>2]=p,h[x+4>>2]=m,x=(v|0)!=0,x&&(h[v>>2]=0),Zi(p,m)|0)return K=9,Q=ae,K|0;h[K>>2]=0;e:do if((g|0)>=1)if(x)for(U=1,N=0,q=0,j=1,x=p;;){if(!(N|q)){if(x=Qs(x,m,4,K,X)|0,x|0)break e;if(m=X,x=h[m>>2]|0,m=h[m+4>>2]|0,Zi(x,m)|0){x=9;break e}}if(x=Qs(x,m,h[26864+(q<<2)>>2]|0,K,X)|0,x|0)break e;if(m=X,x=h[m>>2]|0,m=h[m+4>>2]|0,p=_+(U<<3)|0,h[p>>2]=x,h[p+4>>2]=m,h[v+(U<<2)>>2]=j,p=N+1|0,b=(p|0)==(j|0),E=q+1|0,M=(E|0)==6,Zi(x,m)|0){x=9;break e}if(j=j+(M&b&1)|0,(j|0)>(g|0)){x=0;break}else U=U+1|0,N=b?0:p,q=b?M?0:E:q}else for(U=1,N=0,q=0,j=1,x=p;;){if(!(N|q)){if(x=Qs(x,m,4,K,X)|0,x|0)break e;if(m=X,x=h[m>>2]|0,m=h[m+4>>2]|0,Zi(x,m)|0){x=9;break e}}if(x=Qs(x,m,h[26864+(q<<2)>>2]|0,K,X)|0,x|0)break e;if(m=X,x=h[m>>2]|0,m=h[m+4>>2]|0,p=_+(U<<3)|0,h[p>>2]=x,h[p+4>>2]=m,p=N+1|0,b=(p|0)==(j|0),E=q+1|0,M=(E|0)==6,Zi(x,m)|0){x=9;break e}if(j=j+(M&b&1)|0,(j|0)>(g|0)){x=0;break}else U=U+1|0,N=b?0:p,q=b?M?0:E:q}else x=0;while(!1);return K=x,Q=ae,K|0}function ih(p,m,g,_,v,x,b,E){p=p|0,m=m|0,g=g|0,_=_|0,v=v|0,x=x|0,b=b|0,E=E|0;var M=0,N=0,U=0,q=0,j=0,X=0,K=0,ae=0,ue=0,xe=0;if(ae=Q,Q=Q+16|0,X=ae+8|0,K=ae,M=qf(p|0,m|0,x|0,b|0)|0,U=ee()|0,q=_+(M<<3)|0,ue=q,xe=h[ue>>2]|0,ue=h[ue+4>>2]|0,N=(xe|0)==(p|0)&(ue|0)==(m|0),!((xe|0)==0&(ue|0)==0|N))do M=At(M|0,U|0,1,0)|0,M=ap(M|0,ee()|0,x|0,b|0)|0,U=ee()|0,q=_+(M<<3)|0,xe=q,ue=h[xe>>2]|0,xe=h[xe+4>>2]|0,N=(ue|0)==(p|0)&(xe|0)==(m|0);while(!((ue|0)==0&(xe|0)==0|N));if(M=v+(M<<2)|0,N&&(h[M>>2]|0)<=(E|0)||(xe=q,h[xe>>2]=p,h[xe+4>>2]=m,h[M>>2]=E,(E|0)>=(g|0)))return xe=0,Q=ae,xe|0;switch(N=E+1|0,h[X>>2]=0,M=Qs(p,m,2,X,K)|0,M|0){case 9:{j=9;break}case 0:{M=K,M=ih(h[M>>2]|0,h[M+4>>2]|0,g,_,v,x,b,N)|0,M||(j=9);break}default:}e:do if((j|0)==9){switch(h[X>>2]=0,M=Qs(p,m,3,X,K)|0,M|0){case 9:break;case 0:{if(M=K,M=ih(h[M>>2]|0,h[M+4>>2]|0,g,_,v,x,b,N)|0,M|0)break e;break}default:break e}switch(h[X>>2]=0,M=Qs(p,m,1,X,K)|0,M|0){case 9:break;case 0:{if(M=K,M=ih(h[M>>2]|0,h[M+4>>2]|0,g,_,v,x,b,N)|0,M|0)break e;break}default:break e}switch(h[X>>2]=0,M=Qs(p,m,5,X,K)|0,M|0){case 9:break;case 0:{if(M=K,M=ih(h[M>>2]|0,h[M+4>>2]|0,g,_,v,x,b,N)|0,M|0)break e;break}default:break e}switch(h[X>>2]=0,M=Qs(p,m,4,X,K)|0,M|0){case 9:break;case 0:{if(M=K,M=ih(h[M>>2]|0,h[M+4>>2]|0,g,_,v,x,b,N)|0,M|0)break e;break}default:break e}switch(h[X>>2]=0,M=Qs(p,m,6,X,K)|0,M|0){case 9:break;case 0:{if(M=K,M=ih(h[M>>2]|0,h[M+4>>2]|0,g,_,v,x,b,N)|0,M|0)break e;break}default:break e}return xe=0,Q=ae,xe|0}while(!1);return xe=M,Q=ae,xe|0}function Qs(p,m,g,_,v){p=p|0,m=m|0,g=g|0,_=_|0,v=v|0;var x=0,b=0,E=0,M=0,N=0,U=0,q=0,j=0,X=0,K=0;if(g>>>0>6)return v=1,v|0;b=(h[_>>2]|0)%6|0,h[_>>2]=b;e:do if((b|0)>0)for(x=0;;){switch(g|0){case 1:{g=5;break}case 5:{g=4;break}case 4:{g=6;break}case 6:{g=2;break}case 2:{g=3;break}case 3:{g=1;break}default:}if(x=x+1|0,(x|0)==(b|0))break e}while(!1);if(q=tt(p|0,m|0,45)|0,ee()|0,U=q&127,U>>>0>121)return v=5,v|0;M=ll(p,m)|0,x=tt(p|0,m|0,52)|0,ee()|0,x=x&15;e:do if(!x)N=15;else{for(;;){if(b=(15-x|0)*3|0,E=tt(p|0,m|0,b|0)|0,ee()|0,E=E&7,(E|0)==7){m=5;break}if(K=(_c(x)|0)==0,x=x+-1|0,j=ft(7,0,b|0)|0,m=m&~(ee()|0),X=ft(h[(K?432:16)+(E*28|0)+(g<<2)>>2]|0,0,b|0)|0,b=ee()|0,g=h[(K?640:224)+(E*28|0)+(g<<2)>>2]|0,p=X|p&~j,m=b|m,!g){g=0;break e}if(!x){N=15;break e}}return m|0}while(!1);(N|0)==15&&(K=h[848+(U*28|0)+(g<<2)>>2]|0,X=ft(K|0,0,45)|0,p=X|p,m=ee()|0|m&-1040385,g=h[4272+(U*28|0)+(g<<2)>>2]|0,(K&127|0)==127&&(K=ft(h[848+(U*28|0)+20>>2]|0,0,45)|0,m=ee()|0|m&-1040385,g=h[4272+(U*28|0)+20>>2]|0,p=km(K|p,m)|0,m=ee()|0,h[_>>2]=(h[_>>2]|0)+1)),E=tt(p|0,m|0,45)|0,ee()|0,E=E&127;e:do if(yr(E)|0){t:do if((ll(p,m)|0)==1){if((U|0)!=(E|0))if(sq(E,h[7696+(U*28|0)>>2]|0)|0){p=pL(p,m)|0,b=1,m=ee()|0;break}else di(27634,26928,533,26936);switch(M|0){case 3:{p=km(p,m)|0,m=ee()|0,h[_>>2]=(h[_>>2]|0)+1,b=0;break t}case 5:{p=pL(p,m)|0,m=ee()|0,h[_>>2]=(h[_>>2]|0)+5,b=0;break t}case 0:return K=9,K|0;default:return K=1,K|0}}else b=0;while(!1);if((g|0)>0){x=0;do p=dL(p,m)|0,m=ee()|0,x=x+1|0;while((x|0)!=(g|0))}if((U|0)!=(E|0)){if(!(iL(E)|0)){if((b|0)!=0|(ll(p,m)|0)!=5)break;h[_>>2]=(h[_>>2]|0)+1;break}switch(q&127){case 8:case 118:break e;default:}(ll(p,m)|0)!=3&&(h[_>>2]=(h[_>>2]|0)+1)}}else if((g|0)>0){x=0;do p=km(p,m)|0,m=ee()|0,x=x+1|0;while((x|0)!=(g|0))}while(!1);return h[_>>2]=((h[_>>2]|0)+g|0)%6|0,K=v,h[K>>2]=p,h[K+4>>2]=m,K=0,K|0}function Fce(p,m,g,_){return p=p|0,m=m|0,g=g|0,_=_|0,nq(p,m,g,_)|0?(lp(_|0,0,g*48|0)|0,_=Bce(p,m,g,_)|0,_|0):(_=0,_|0)}function nq(p,m,g,_){p=p|0,m=m|0,g=g|0,_=_|0;var v=0,x=0,b=0,E=0,M=0,N=0,U=0,q=0,j=0,X=0,K=0;if(K=Q,Q=Q+16|0,j=K,X=K+8|0,q=j,h[q>>2]=p,h[q+4>>2]=m,(g|0)<0)return X=2,Q=K,X|0;if(!g)return X=_,h[X>>2]=p,h[X+4>>2]=m,X=0,Q=K,X|0;h[X>>2]=0;e:do if(Zi(p,m)|0)p=9;else{v=0,q=p;do{if(p=Qs(q,m,4,X,j)|0,p|0)break e;if(m=j,q=h[m>>2]|0,m=h[m+4>>2]|0,v=v+1|0,Zi(q,m)|0){p=9;break e}}while((v|0)<(g|0));U=_,h[U>>2]=q,h[U+4>>2]=m,U=g+-1|0,N=0,p=1;do{if(v=26864+(N<<2)|0,(N|0)==5)for(b=h[v>>2]|0,x=0,v=p;;){if(p=j,p=Qs(h[p>>2]|0,h[p+4>>2]|0,b,X,j)|0,p|0)break e;if((x|0)!=(U|0))if(M=j,E=h[M>>2]|0,M=h[M+4>>2]|0,p=_+(v<<3)|0,h[p>>2]=E,h[p+4>>2]=M,!(Zi(E,M)|0))p=v+1|0;else{p=9;break e}else p=v;if(x=x+1|0,(x|0)>=(g|0))break;v=p}else for(b=j,M=h[v>>2]|0,E=0,v=p,x=h[b>>2]|0,b=h[b+4>>2]|0;;){if(p=Qs(x,b,M,X,j)|0,p|0)break e;if(b=j,x=h[b>>2]|0,b=h[b+4>>2]|0,p=_+(v<<3)|0,h[p>>2]=x,h[p+4>>2]=b,p=v+1|0,Zi(x,b)|0){p=9;break e}if(E=E+1|0,(E|0)>=(g|0))break;v=p}N=N+1|0}while(N>>>0<6);p=j,p=(q|0)==(h[p>>2]|0)&&(m|0)==(h[p+4>>2]|0)?0:9}while(!1);return X=p,Q=K,X|0}function Bce(p,m,g,_){p=p|0,m=m|0,g=g|0,_=_|0;var v=0,x=0,b=0,E=0,M=0,N=0,U=0,q=0,j=0;if(q=Q,Q=Q+16|0,b=q,!g)return h[_>>2]=p,h[_+4>>2]=m,_=0,Q=q,_|0;do if((g|0)>=0){if((g|0)>13780509){if(v=aT(15,b)|0,v|0)break;x=b,v=h[x>>2]|0,x=h[x+4>>2]|0}else v=((g|0)<0)<<31>>31,U=wr(g|0,v|0,3,0)|0,x=ee()|0,v=At(g|0,v|0,1,0)|0,v=wr(U|0,x|0,v|0,ee()|0)|0,v=At(v|0,ee()|0,1,0)|0,x=ee()|0,U=b,h[U>>2]=v,h[U+4>>2]=x;if(N=Ea(v,8)|0,!N)v=13;else{if(U=Ea(v,4)|0,!U){_t(N),v=13;break}if(v=ih(p,m,g,N,U,v,x,0)|0,v|0){_t(N),_t(U);break}if(m=h[b>>2]|0,b=h[b+4>>2]|0,(b|0)>0|(b|0)==0&m>>>0>0){v=0,E=0,M=0;do p=N+(E<<3)|0,x=h[p>>2]|0,p=h[p+4>>2]|0,!((x|0)==0&(p|0)==0)&&(h[U+(E<<2)>>2]|0)==(g|0)&&(j=_+(v<<3)|0,h[j>>2]=x,h[j+4>>2]=p,v=v+1|0),E=At(E|0,M|0,1,0)|0,M=ee()|0;while((M|0)<(b|0)|(M|0)==(b|0)&E>>>0<m>>>0)}_t(N),_t(U),v=0}}else v=2;while(!1);return j=v,Q=q,j|0}function rT(p,m,g,_){p=p|0,m=m|0,g=g|0,_=_|0;var v=0,x=0,b=0,E=0,M=0,N=0;for(E=Q,Q=Q+16|0,x=E,b=E+8|0,v=(Zi(p,m)|0)==0,v=v?1:2;;){if(h[b>>2]=0,N=(Qs(p,m,v,b,x)|0)==0,M=x,N&((h[M>>2]|0)==(g|0)?(h[M+4>>2]|0)==(_|0):0)){p=4;break}if(v=v+1|0,v>>>0>=7){v=7,p=4;break}}return(p|0)==4?(Q=E,v|0):0}function Oce(p,m,g,_){p=p|0,m=m|0,g=g|0,_=_|0;var v=0,x=0,b=0,E=0,M=0,N=0;if(E=Q,Q=Q+48|0,v=E+16|0,x=E+8|0,b=E,g=Kx(g)|0,g|0)return b=g,Q=E,b|0;if(N=p,M=h[N+4>>2]|0,g=x,h[g>>2]=h[N>>2],h[g+4>>2]=M,wq(x,v),g=cq(v,m,b)|0,!g){if(m=h[x>>2]|0,x=h[p+8>>2]|0,(x|0)>0){v=h[p+12>>2]|0,g=0;do m=(h[v+(g<<3)>>2]|0)+m|0,g=g+1|0;while((g|0)<(x|0))}g=b,v=h[g>>2]|0,g=h[g+4>>2]|0,x=((m|0)<0)<<31>>31,(g|0)<(x|0)|(g|0)==(x|0)&v>>>0<m>>>0?(g=b,h[g>>2]=m,h[g+4>>2]=x,g=x):m=v,M=At(m|0,g|0,12,0)|0,N=ee()|0,g=b,h[g>>2]=M,h[g+4>>2]=N,g=_,h[g>>2]=M,h[g+4>>2]=N,g=0}return N=g,Q=E,N|0}function iq(p,m,g,_,v,x,b){p=p|0,m=m|0,g=g|0,_=_|0,v=v|0,x=x|0,b=b|0;var E=0,M=0,N=0,U=0,q=0,j=0,X=0,K=0,ae=0,ue=0,xe=0,se=0,we=0,Ae=0,Be=0,Ke=0,Me=0,be=0,gt=0,je=0,Ut=0,lt=0,pt=0,pi=0,bi=0,Ro=0,Vn=0,wi=0,Ma=0;if(bi=Q,Q=Q+64|0,Ut=bi+48|0,lt=bi+32|0,pt=bi+24|0,Be=bi+8|0,Ke=bi,M=h[p>>2]|0,(M|0)<=0)return pi=0,Q=bi,pi|0;for(Me=p+4|0,be=Ut+8|0,gt=lt+8|0,je=Be+8|0,E=0,we=0;;){N=h[Me>>2]|0,se=N+(we<<4)|0,h[Ut>>2]=h[se>>2],h[Ut+4>>2]=h[se+4>>2],h[Ut+8>>2]=h[se+8>>2],h[Ut+12>>2]=h[se+12>>2],(we|0)==(M+-1|0)?(h[lt>>2]=h[N>>2],h[lt+4>>2]=h[N+4>>2],h[lt+8>>2]=h[N+8>>2],h[lt+12>>2]=h[N+12>>2]):(se=N+(we+1<<4)|0,h[lt>>2]=h[se>>2],h[lt+4>>2]=h[se+4>>2],h[lt+8>>2]=h[se+8>>2],h[lt+12>>2]=h[se+12>>2]),M=Qce(Ut,lt,_,pt)|0;e:do if(M)N=0,E=M;else if(M=pt,N=h[M>>2]|0,M=h[M+4>>2]|0,(M|0)>0|(M|0)==0&N>>>0>0){xe=0,se=0;t:for(;;){if(Vn=1/(+(N>>>0)+4294967296*+(M|0)),Ma=+ie[Ut>>3],M=Js(N|0,M|0,xe|0,se|0)|0,wi=+(M>>>0)+4294967296*+(ee()|0),Ro=+(xe>>>0)+4294967296*+(se|0),ie[Be>>3]=Vn*(Ma*wi)+Vn*(+ie[lt>>3]*Ro),ie[je>>3]=Vn*(+ie[be>>3]*wi)+Vn*(+ie[gt>>3]*Ro),M=mL(Be,_,Ke)|0,M|0){E=M;break}ue=Ke,ae=h[ue>>2]|0,ue=h[ue+4>>2]|0,j=qf(ae|0,ue|0,m|0,g|0)|0,U=ee()|0,M=b+(j<<3)|0,q=M,N=h[q>>2]|0,q=h[q+4>>2]|0;n:do if((N|0)==0&(q|0)==0)Ae=M,pi=16;else for(X=0,K=0;;){if((X|0)>(g|0)|(X|0)==(g|0)&K>>>0>m>>>0){E=1;break t}if((N|0)==(ae|0)&(q|0)==(ue|0))break n;if(M=At(j|0,U|0,1,0)|0,j=ap(M|0,ee()|0,m|0,g|0)|0,U=ee()|0,K=At(K|0,X|0,1,0)|0,X=ee()|0,M=b+(j<<3)|0,q=M,N=h[q>>2]|0,q=h[q+4>>2]|0,(N|0)==0&(q|0)==0){Ae=M,pi=16;break}}while(!1);if((pi|0)==16&&(pi=0,!((ae|0)==0&(ue|0)==0))&&(K=Ae,h[K>>2]=ae,h[K+4>>2]=ue,K=x+(h[v>>2]<<3)|0,h[K>>2]=ae,h[K+4>>2]=ue,K=v,K=At(h[K>>2]|0,h[K+4>>2]|0,1,0)|0,ae=ee()|0,ue=v,h[ue>>2]=K,h[ue+4>>2]=ae),xe=At(xe|0,se|0,1,0)|0,se=ee()|0,M=pt,N=h[M>>2]|0,M=h[M+4>>2]|0,!((M|0)>(se|0)|(M|0)==(se|0)&N>>>0>xe>>>0)){N=1;break e}}N=0}else N=1;while(!1);if(we=we+1|0,!N){pi=21;break}if(M=h[p>>2]|0,(we|0)>=(M|0)){E=0,pi=21;break}}return(pi|0)==21?(Q=bi,E|0):0}function Uce(p,m,g,_){p=p|0,m=m|0,g=g|0,_=_|0;var v=0,x=0,b=0,E=0,M=0,N=0,U=0,q=0,j=0,X=0,K=0,ae=0,ue=0,xe=0,se=0,we=0,Ae=0,Be=0,Ke=0,Me=0,be=0,gt=0,je=0,Ut=0,lt=0,pt=0,pi=0,bi=0,Ro=0,Vn=0,wi=0;if(wi=Q,Q=Q+112|0,pi=wi+80|0,M=wi+72|0,bi=wi,Ro=wi+56|0,v=Kx(g)|0,v|0)return Vn=v,Q=wi,Vn|0;if(N=p+8|0,Vn=br((h[N>>2]<<5)+32|0)|0,!Vn)return Vn=13,Q=wi,Vn|0;if(bL(p,Vn),v=Kx(g)|0,!v){if(lt=p,pt=h[lt+4>>2]|0,v=M,h[v>>2]=h[lt>>2],h[v+4>>2]=pt,wq(M,pi),v=cq(pi,m,bi)|0,v)lt=0,pt=0;else{if(v=h[M>>2]|0,x=h[N>>2]|0,(x|0)>0){b=h[p+12>>2]|0,g=0;do v=(h[b+(g<<3)>>2]|0)+v|0,g=g+1|0;while((g|0)!=(x|0));g=v}else g=v;v=bi,x=h[v>>2]|0,v=h[v+4>>2]|0,b=((g|0)<0)<<31>>31,(v|0)<(b|0)|(v|0)==(b|0)&x>>>0<g>>>0?(v=bi,h[v>>2]=g,h[v+4>>2]=b,v=b):g=x,lt=At(g|0,v|0,12,0)|0,pt=ee()|0,v=bi,h[v>>2]=lt,h[v+4>>2]=pt,v=0}if(!v){if(g=Ea(lt,8)|0,!g)return _t(Vn),Vn=13,Q=wi,Vn|0;if(E=Ea(lt,8)|0,!E)return _t(Vn),_t(g),Vn=13,Q=wi,Vn|0;je=pi,h[je>>2]=0,h[je+4>>2]=0,je=p,Ut=h[je+4>>2]|0,v=M,h[v>>2]=h[je>>2],h[v+4>>2]=Ut,v=iq(M,lt,pt,m,pi,g,E)|0;e:do if(v)_t(g),_t(E),_t(Vn);else{t:do if((h[N>>2]|0)>0){for(b=p+12|0,x=0;v=iq((h[b>>2]|0)+(x<<3)|0,lt,pt,m,pi,g,E)|0,x=x+1|0,!(v|0);)if((x|0)>=(h[N>>2]|0))break t;_t(g),_t(E),_t(Vn);break e}while(!1);(pt|0)>0|(pt|0)==0<>>>0>0&&lp(E|0,0,lt<<3|0)|0,Ut=pi,je=h[Ut+4>>2]|0;t:do if((je|0)>0|(je|0)==0&(h[Ut>>2]|0)>>>0>0){Me=g,be=E,gt=g,je=E,Ut=g,v=g,Ae=g,Be=E,Ke=E,g=E;n:for(;;){for(ue=0,xe=0,se=0,we=0,x=0,b=0;;){E=bi,M=E+56|0;do h[E>>2]=0,E=E+4|0;while((E|0)<(M|0));if(m=Me+(ue<<3)|0,N=h[m>>2]|0,m=h[m+4>>2]|0,tq(N,m,1,bi,0)|0){E=bi,M=E+56|0;do h[E>>2]=0,E=E+4|0;while((E|0)<(M|0));E=Ea(7,4)|0,E|0&&(ih(N,m,1,bi,E,7,0,0)|0,_t(E))}for(ae=0;;){K=bi+(ae<<3)|0,X=h[K>>2]|0,K=h[K+4>>2]|0;i:do if((X|0)==0&(K|0)==0)E=x,M=b;else{if(U=qf(X|0,K|0,lt|0,pt|0)|0,N=ee()|0,E=_+(U<<3)|0,m=E,M=h[m>>2]|0,m=h[m+4>>2]|0,!((M|0)==0&(m|0)==0)){q=0,j=0;do{if((q|0)>(pt|0)|(q|0)==(pt|0)&j>>>0>lt>>>0)break n;if((M|0)==(X|0)&(m|0)==(K|0)){E=x,M=b;break i}E=At(U|0,N|0,1,0)|0,U=ap(E|0,ee()|0,lt|0,pt|0)|0,N=ee()|0,j=At(j|0,q|0,1,0)|0,q=ee()|0,E=_+(U<<3)|0,m=E,M=h[m>>2]|0,m=h[m+4>>2]|0}while(!((M|0)==0&(m|0)==0))}if((X|0)==0&(K|0)==0){E=x,M=b;break}w1(X,K,Ro)|0,wL(p,Vn,Ro)|0&&(j=At(x|0,b|0,1,0)|0,b=ee()|0,q=E,h[q>>2]=X,h[q+4>>2]=K,x=be+(x<<3)|0,h[x>>2]=X,h[x+4>>2]=K,x=j),E=x,M=b}while(!1);if(ae=ae+1|0,ae>>>0>=7)break;x=E,b=M}if(ue=At(ue|0,xe|0,1,0)|0,xe=ee()|0,se=At(se|0,we|0,1,0)|0,we=ee()|0,b=pi,x=h[b>>2]|0,b=h[b+4>>2]|0,(we|0)<(b|0)|(we|0)==(b|0)&se>>>0<x>>>0)x=E,b=M;else break}if((b|0)>0|(b|0)==0&x>>>0>0){x=0,b=0;do we=Me+(x<<3)|0,h[we>>2]=0,h[we+4>>2]=0,x=At(x|0,b|0,1,0)|0,b=ee()|0,we=pi,se=h[we+4>>2]|0;while((b|0)<(se|0)|((b|0)==(se|0)?x>>>0<(h[we>>2]|0)>>>0:0))}if(we=pi,h[we>>2]=E,h[we+4>>2]=M,(M|0)>0|(M|0)==0&E>>>0>0)ae=g,ue=Ke,xe=Ut,se=Be,we=be,g=Ae,Ke=v,Be=gt,Ae=ae,v=ue,Ut=je,je=xe,gt=se,be=Me,Me=we;else break t}_t(gt),_t(je),_t(Vn),v=1;break e}else v=E;while(!1);_t(Vn),_t(g),_t(v),v=0}while(!1);return Vn=v,Q=wi,Vn|0}}return _t(Vn),Vn=v,Q=wi,Vn|0}function kce(p,m,g){p=p|0,m=m|0,g=g|0;var _=0,v=0,x=0,b=0,E=0,M=0,N=0;if(E=Q,Q=Q+16|0,b=E,p=eue(p,m,((m|0)<0)<<31>>31,b)|0,p|0)return b=p,Q=E,b|0;if(x=Fue(b,g)|0,g=b+4|0,(h[b>>2]|0)>0){m=0;do{if(v=h[g>>2]|0,_=v+(m<<4)+4|0,_t(h[_>>2]|0),h[_>>2]=0,h[v+(m<<4)>>2]=0,_=v+(m<<4)+8|0,v=v+(m<<4)+12|0,(h[_>>2]|0)>0){p=0;do M=h[v>>2]|0,N=M+(p<<3)+4|0,_t(h[N>>2]|0),h[N>>2]=0,h[M+(p<<3)>>2]=0,p=p+1|0;while((p|0)<(h[_>>2]|0))}_t(h[v>>2]|0),h[v>>2]=0,h[_>>2]=0,m=m+1|0}while((m|0)<(h[b>>2]|0))}return _t(h[g>>2]|0),h[g>>2]=0,h[b>>2]=0,N=x,Q=E,N|0}function vc(p,m){p=p|0,m=m|0;var g=0,_=0,v=0,x=0,b=0,E=0,M=0,N=0,U=0,q=0;if(b=h[p>>2]|0,(b|0)<=0)return v=0,_=0,b=v<0,_=12.566370614359172-_,_=v+_,v=b?_:v,ie[m>>3]=v,0;if(x=h[p+4>>2]|0,p=(b|0)!=1&1,E=+ie[x>>3]*.5+.7853981633974483,v=+ie[x+(p<<4)>>3]*.5+.7853981633974483,g=+zi(+E)*+zi(+v),_=+ie[x+(p<<4)+8>>3]-+ie[x+8>>3],g=+Ta(+(+zi(+_)*g),+(+ii(+E)*+ii(+v)+ +ii(+_)*g))*-2,_=g+0,g=_-g,(b|0)==1)return E=_,v=g,b=E<0,v=12.566370614359172-v,v=E+v,E=b?v:E,ie[m>>3]=E,0;for(p=1,v=_;U=p,p=p+1|0,q=(p|0)%(b|0)|0,N=+ie[x+(U<<4)>>3]*.5+.7853981633974483,M=+ie[x+(q<<4)>>3]*.5+.7853981633974483,_=+zi(+N)*+zi(+M),E=+ie[x+(q<<4)+8>>3]-+ie[x+(U<<4)+8>>3],g=+Ta(+(+zi(+E)*_),+(+ii(+N)*+ii(+M)+ +ii(+E)*_))*-2-g,_=v+g,g=_-v-g,!((p|0)>=(b|0));)v=_;return q=_<0,N=12.566370614359172-g,N=_+N,N=q?N:_,ie[m>>3]=N,0}function zce(p,m,g){p=p|0,m=m|0,g=g|0;var _=0,v=0,x=0,b=0;return b=Q,Q=Q+192|0,_=b+176|0,v=b,x=b+168|0,p=zm(p,m,v)|0,p|0?(x=p,Q=b,x|0):(h[x>>2]=h[v>>2],h[x+4>>2]=v+8,h[_>>2]=h[x>>2],h[_+4>>2]=h[x+4>>2],vc(_,g)|0,x=0,Q=b,x|0)}function Vce(p,m,g){p=p|0,m=m|0,g=g|0;var _=0,v=0,x=0,b=0;return b=Q,Q=Q+192|0,_=b+176|0,v=b,x=b+168|0,p=zm(p,m,v)|0,p?(x=p,Q=b,x|0):(h[x>>2]=h[v>>2],h[x+4>>2]=v+8,h[_>>2]=h[x>>2],h[_+4>>2]=h[x+4>>2],vc(_,g)|0,ie[g>>3]=+ie[g>>3]*4058973249931477e-8,x=0,Q=b,x|0)}function Gce(p,m,g){p=p|0,m=m|0,g=g|0;var _=0,v=0,x=0,b=0;return b=Q,Q=Q+192|0,_=b+176|0,v=b,x=b+168|0,p=zm(p,m,v)|0,p?(x=p,Q=b,x|0):(h[x>>2]=h[v>>2],h[x+4>>2]=v+8,h[_>>2]=h[x>>2],h[_+4>>2]=h[x+4>>2],vc(_,g)|0,ie[g>>3]=+ie[g>>3]*4058973249931477e-8*1e6,x=0,Q=b,x|0)}function yr(p){return p=p|0,p>>>0>121?(p=0,p|0):(p=h[7696+(p*28|0)+16>>2]|0,p|0)}function iL(p){return p=p|0,(p|0)==4|(p|0)==117|0}function rq(p){return p=p|0,h[11120+((h[p>>2]|0)*216|0)+((h[p+4>>2]|0)*72|0)+((h[p+8>>2]|0)*24|0)+(h[p+12>>2]<<3)>>2]|0}function qce(p){return p=p|0,h[11120+((h[p>>2]|0)*216|0)+((h[p+4>>2]|0)*72|0)+((h[p+8>>2]|0)*24|0)+(h[p+12>>2]<<3)+4>>2]|0}function Hce(p,m){p=p|0,m=m|0,p=7696+(p*28|0)|0,h[m>>2]=h[p>>2],h[m+4>>2]=h[p+4>>2],h[m+8>>2]=h[p+8>>2],h[m+12>>2]=h[p+12>>2]}function Wce(p,m){p=p|0,m=m|0;var g=0,_=0;if(m>>>0>20)return m=-1,m|0;do if((h[11120+(m*216|0)>>2]|0)!=(p|0))if((h[11120+(m*216|0)+8>>2]|0)!=(p|0))if((h[11120+(m*216|0)+16>>2]|0)!=(p|0))if((h[11120+(m*216|0)+24>>2]|0)!=(p|0))if((h[11120+(m*216|0)+32>>2]|0)!=(p|0))if((h[11120+(m*216|0)+40>>2]|0)!=(p|0))if((h[11120+(m*216|0)+48>>2]|0)!=(p|0))if((h[11120+(m*216|0)+56>>2]|0)!=(p|0))if((h[11120+(m*216|0)+64>>2]|0)!=(p|0))if((h[11120+(m*216|0)+72>>2]|0)!=(p|0))if((h[11120+(m*216|0)+80>>2]|0)!=(p|0))if((h[11120+(m*216|0)+88>>2]|0)!=(p|0))if((h[11120+(m*216|0)+96>>2]|0)!=(p|0))if((h[11120+(m*216|0)+104>>2]|0)!=(p|0))if((h[11120+(m*216|0)+112>>2]|0)!=(p|0))if((h[11120+(m*216|0)+120>>2]|0)!=(p|0))if((h[11120+(m*216|0)+128>>2]|0)!=(p|0))if((h[11120+(m*216|0)+136>>2]|0)==(p|0))p=2,g=1,_=2;else{if((h[11120+(m*216|0)+144>>2]|0)==(p|0)){p=0,g=2,_=0;break}if((h[11120+(m*216|0)+152>>2]|0)==(p|0)){p=0,g=2,_=1;break}if((h[11120+(m*216|0)+160>>2]|0)==(p|0)){p=0,g=2,_=2;break}if((h[11120+(m*216|0)+168>>2]|0)==(p|0)){p=1,g=2,_=0;break}if((h[11120+(m*216|0)+176>>2]|0)==(p|0)){p=1,g=2,_=1;break}if((h[11120+(m*216|0)+184>>2]|0)==(p|0)){p=1,g=2,_=2;break}if((h[11120+(m*216|0)+192>>2]|0)==(p|0)){p=2,g=2,_=0;break}if((h[11120+(m*216|0)+200>>2]|0)==(p|0)){p=2,g=2,_=1;break}if((h[11120+(m*216|0)+208>>2]|0)==(p|0)){p=2,g=2,_=2;break}else p=-1;return p|0}else p=2,g=1,_=1;else p=2,g=1,_=0;else p=1,g=1,_=2;else p=1,g=1,_=1;else p=1,g=1,_=0;else p=0,g=1,_=2;else p=0,g=1,_=1;else p=0,g=1,_=0;else p=2,g=0,_=2;else p=2,g=0,_=1;else p=2,g=0,_=0;else p=1,g=0,_=2;else p=1,g=0,_=1;else p=1,g=0,_=0;else p=0,g=0,_=2;else p=0,g=0,_=1;else p=0,g=0,_=0;while(!1);return m=h[11120+(m*216|0)+(g*72|0)+(p*24|0)+(_<<3)+4>>2]|0,m|0}function sq(p,m){return p=p|0,m=m|0,(h[7696+(p*28|0)+20>>2]|0)==(m|0)?(m=1,m|0):(m=(h[7696+(p*28|0)+24>>2]|0)==(m|0),m|0)}function rL(p,m){return p=p|0,m=m|0,h[848+(p*28|0)+(m<<2)>>2]|0}function sL(p,m){return p=p|0,m=m|0,(h[848+(p*28|0)>>2]|0)==(m|0)?(m=0,m|0):(h[848+(p*28|0)+4>>2]|0)==(m|0)?(m=1,m|0):(h[848+(p*28|0)+8>>2]|0)==(m|0)?(m=2,m|0):(h[848+(p*28|0)+12>>2]|0)==(m|0)?(m=3,m|0):(h[848+(p*28|0)+16>>2]|0)==(m|0)?(m=4,m|0):(h[848+(p*28|0)+20>>2]|0)==(m|0)?(m=5,m|0):((h[848+(p*28|0)+24>>2]|0)==(m|0)?6:7)|0}function jce(){return 122}function Xce(p){p=p|0;var m=0,g=0,_=0;m=0;do ft(m|0,0,45)|0,_=ee()|0|134225919,g=p+(m<<3)|0,h[g>>2]=-1,h[g+4>>2]=_,m=m+1|0;while((m|0)!=122);return 0}function $ce(p){p=p|0;var m=0,g=0,_=0;return _=+ie[p+16>>3],g=+ie[p+24>>3],m=_-g,+(_<g?m+6.283185307179586:m)}function Yce(p){return p=p|0,+ie[p+16>>3]<+ie[p+24>>3]|0}function Zce(p){return p=p|0,+(+ie[p>>3]-+ie[p+8>>3])}function oq(p,m){p=p|0,m=m|0;var g=0,_=0,v=0;return g=+ie[m>>3],!(g>=+ie[p+8>>3])||!(g<=+ie[p>>3])?(m=0,m|0):(_=+ie[p+16>>3],g=+ie[p+24>>3],v=+ie[m+8>>3],m=v>=g,p=v<=_&1,_<g?m&&(p=1):m||(p=0),m=(p|0)!=0,m|0)}function oL(p,m){p=p|0,m=m|0;var g=0,_=0,v=0,x=0,b=0,E=0,M=0,N=0,U=0;return+ie[p>>3]<+ie[m+8>>3]||+ie[p+8>>3]>+ie[m>>3]?(_=0,_|0):(x=+ie[p+16>>3],g=p+24|0,U=+ie[g>>3],b=x<U,_=m+16|0,N=+ie[_>>3],v=m+24|0,M=+ie[v>>3],E=N<M,m=U-N<M-x,p=b?E|m?1:2:0,m=E?b?1:m?2:1:0,x=+kl(x,p),x<+kl(+ie[v>>3],m)||(U=+kl(+ie[g>>3],p),U>+kl(+ie[_>>3],m))?(E=0,E|0):(E=1,E|0))}function Kce(p,m,g,_){p=p|0,m=m|0,g=g|0,_=_|0;var v=0,x=0,b=0,E=0,M=0;x=+ie[p+16>>3],M=+ie[p+24>>3],p=x<M,E=+ie[m+16>>3],b=+ie[m+24>>3],v=E<b,m=M-E<b-x,h[g>>2]=p?v|m?1:2:0,h[_>>2]=v?p?1:m?2:1:0}function aq(p,m){p=p|0,m=m|0;var g=0,_=0,v=0,x=0,b=0,E=0,M=0,N=0,U=0;return+ie[p>>3]<+ie[m>>3]||+ie[p+8>>3]>+ie[m+8>>3]?(_=0,_|0):(_=p+16|0,M=+ie[_>>3],x=+ie[p+24>>3],b=M<x,g=m+16|0,U=+ie[g>>3],v=m+24|0,N=+ie[v>>3],E=U<N,m=x-U<N-M,p=b?E|m?1:2:0,m=E?b?1:m?2:1:0,x=+kl(x,p),x<=+kl(+ie[v>>3],m)?(U=+kl(+ie[_>>3],p),E=U>=+kl(+ie[g>>3],m),E|0):(E=0,E|0))}function lq(p,m){p=p|0,m=m|0;var g=0,_=0,v=0,x=0,b=0,E=0;v=Q,Q=Q+176|0,_=v,h[_>>2]=4,E=+ie[m>>3],ie[_+8>>3]=E,x=+ie[m+16>>3],ie[_+16>>3]=x,ie[_+24>>3]=E,E=+ie[m+24>>3],ie[_+32>>3]=E,b=+ie[m+8>>3],ie[_+40>>3]=b,ie[_+48>>3]=E,ie[_+56>>3]=b,ie[_+64>>3]=x,m=_+72|0,g=m+96|0;do h[m>>2]=0,m=m+4|0;while((m|0)<(g|0));cu(p|0,_|0,168)|0,Q=v}function cq(p,m,g){p=p|0,m=m|0,g=g|0;var _=0,v=0,x=0,b=0,E=0,M=0,N=0,U=0,q=0,j=0,X=0,K=0,ae=0,ue=0;K=Q,Q=Q+288|0,U=K+264|0,q=K+96|0,N=K,E=N,M=E+96|0;do h[E>>2]=0,E=E+4|0;while((E|0)<(M|0));return m=gL(m,N)|0,m|0?(X=m,Q=K,X|0):(M=N,N=h[M>>2]|0,M=h[M+4>>2]|0,w1(N,M,U)|0,zm(N,M,q)|0,b=+$x(U,q+8|0),ie[U>>3]=+ie[p>>3],M=U+8|0,ie[M>>3]=+ie[p+16>>3],ie[q>>3]=+ie[p+8>>3],N=q+8|0,ie[N>>3]=+ie[p+24>>3],v=+$x(U,q),ue=+ie[M>>3]-+ie[N>>3],x=+Ks(+ue),ae=+ie[U>>3]-+ie[q>>3],_=+Ks(+ae),!(ue==0|ae==0)&&(ue=+Bq(+x,+_),ue=+x1(+(v*v/+pT(+(ue/+pT(+x,+_)),3)/(b*(b*2.59807621135)*.8))),ie[or>>3]=ue,j=~~ue>>>0,X=+Ks(ue)>=1?ue>0?~~+nL(+fo(ue/4294967296),4294967295)>>>0:~~+x1((ue-+(~~ue>>>0))/4294967296)>>>0:0,(h[or+4>>2]&2146435072|0)!=2146435072)?(q=(j|0)==0&(X|0)==0,m=g,h[m>>2]=q?1:j,h[m+4>>2]=q?0:X,m=0):m=1,X=m,Q=K,X|0)}function Qce(p,m,g,_){p=p|0,m=m|0,g=g|0,_=_|0;var v=0,x=0,b=0,E=0,M=0,N=0,U=0;N=Q,Q=Q+288|0,b=N+264|0,E=N+96|0,M=N,v=M,x=v+96|0;do h[v>>2]=0,v=v+4|0;while((v|0)<(x|0));return g=gL(g,M)|0,g|0?(_=g,Q=N,_|0):(g=M,v=h[g>>2]|0,g=h[g+4>>2]|0,w1(v,g,b)|0,zm(v,g,E)|0,U=+$x(b,E+8|0),U=+x1(+(+$x(p,m)/(U*2))),ie[or>>3]=U,g=~~U>>>0,v=+Ks(U)>=1?U>0?~~+nL(+fo(U/4294967296),4294967295)>>>0:~~+x1((U-+(~~U>>>0))/4294967296)>>>0:0,(h[or+4>>2]&2146435072|0)==2146435072?(_=1,Q=N,_|0):(M=(g|0)==0&(v|0)==0,h[_>>2]=M?1:g,h[_+4>>2]=M?0:v,_=0,Q=N,_|0))}function Jce(p,m){p=p|0,m=+m;var g=0,_=0,v=0,x=0,b=0,E=0,M=0,N=0,U=0;x=p+16|0,b=+ie[x>>3],g=p+24|0,v=+ie[g>>3],_=b-v,_=b<v?_+6.283185307179586:_,N=+ie[p>>3],E=p+8|0,M=+ie[E>>3],U=N-M,_=(_*m-_)*.5,m=(U*m-U)*.5,N=N+m,ie[p>>3]=N>1.5707963267948966?1.5707963267948966:N,m=M-m,ie[E>>3]=m<-1.5707963267948966?-1.5707963267948966:m,m=b+_,m=m>3.141592653589793?m+-6.283185307179586:m,ie[x>>3]=m<-3.141592653589793?m+6.283185307179586:m,m=v-_,m=m>3.141592653589793?m+-6.283185307179586:m,ie[g>>3]=m<-3.141592653589793?m+6.283185307179586:m}function eue(p,m,g,_){p=p|0,m=m|0,g=g|0,_=_|0;var v=0,x=0,b=0,E=0,M=0,N=0,U=0,q=0,j=0,X=0,K=0,ae=0,ue=0,xe=0,se=0,we=0,Ae=0,Be=0,Ke=0,Me=0,be=0,gt=0,je=0,Ut=0,lt=0,pt=0;if(pt=Q,Q=Q+224|0,gt=pt,Be=pt+48|0,M=(g|0)>0|(g|0)==0&m>>>0>0,M&(g>>>0>0|(g|0)==0&m>>>0>17895697))return lt=14,Q=pt,lt|0;if((g|0)<0)return lt=2,Q=pt,lt|0;if((m|0)==0&(g|0)==0)return h[_>>2]=0,h[_+4>>2]=0,lt=0,Q=pt,lt|0;for(v=p,v=uL(h[v>>2]|0,h[v+4>>2]|0)|0,b=0,E=0;;){if(x=p+(b<<3)|0,lt=x,!(oT(h[lt>>2]|0,h[lt+4>>2]|0)|0)){v=5,je=159;break}if(lt=x,lt=(uL(h[lt>>2]|0,h[lt+4>>2]|0)|0)==(v|0),b=At(b|0,E|0,1,0)|0,E=ee()|0,!lt){v=12,je=159;break}if(!((E|0)<(g|0)|(E|0)==(g|0)&b>>>0<m>>>0)){je=8;break}}if((je|0)==8){do if((g|0)>0|(g|0)==0&m>>>0>1){if(v=m<<3,b=br(v)|0,!b)return lt=13,Q=pt,lt|0;for(cu(b|0,p|0,v|0)|0,uT(b,m,8,1),v=1,x=0;Ut=b+(v<<3)|0,lt=b+(v+-1<<3)|0,lt=(h[Ut>>2]|0)==(h[lt>>2]|0)?(h[Ut+4>>2]|0)==(h[lt+4>>2]|0):0,v=At(v|0,x|0,1,0)|0,x=ee()|0,!lt;)if(!((x|0)<(g|0)|(x|0)==(g|0)&v>>>0<m>>>0)){je=14;break}if((je|0)==14){_t(b);break}return _t(b),lt=10,Q=pt,lt|0}while(!1);if(v=wr(m|0,g|0,6,0)|0,x=ee()|0,M){b=0,E=0;do lt=p+(E<<3)|0,lt=((Zi(h[lt>>2]|0,h[lt+4>>2]|0)|0)!=0)<<31>>31,v=At(v|0,x|0,lt|0,((lt|0)<0)<<31>>31|0)|0,x=ee()|0,E=At(E|0,b|0,1,0)|0,b=ee()|0;while((b|0)<(g|0)|(b|0)==(g|0)&E>>>0<m>>>0);Ae=v,we=x}else Ae=v,we=x;if(xe=wr(Ae|0,we|0,10,0)|0,se=ee()|0,Ut=br(Ae<<5)|0,!Ut)return lt=13,Q=pt,lt|0;if(lt=Ea(xe,4)|0,!lt)return _t(Ut),lt=13,Q=pt,lt|0;e:do if(M){for(be=p,aL(h[be>>2]|0,h[be+4>>2]|0,gt)|0,X=Ut,K=0,ae=0,v=0,ue=0;;){M=gt,M=(h[M>>2]|0)==0&(h[M+4>>2]|0)==0,x=M?26990:26995,b=M?5:6,E=0,M=gt+((M&1)<<3)|0,N=At(b|0,E|0,-1,-1)|0,U=ee()|0,q=0,j=0;do Me=M+(q<<3)|0,Ke=h[Me+4>>2]|0,be=X+(q<<5)|0,h[be>>2]=h[Me>>2],h[be+4>>2]=Ke,He[X+(q<<5)+9>>0]=0,He[X+(q<<5)+8>>0]=0,h[X+(q<<5)+20>>2]=X,be=X+(q<<5)+24|0,h[be>>2]=1,h[be+4>>2]=0,be=He[x+q>>0]|0,Ke=At(N|0,U|0,q|0,j|0)|0,Ke=qf(Ke|0,ee()|0,b|0,E|0)|0,ee()|0,Ke=He[x+Ke>>0]|0,q=At(q|0,j|0,1,0)|0,j=ee()|0,Me=He[x+((q|0)==(b|0)&(j|0)==(E|0)?0:q)>>0]|0,be=be&255,h[X+(be<<5)+16>>2]=X+((Ke&255)<<5),h[X+(be<<5)+12>>2]=X+((Me&255)<<5);while(j>>>0<E>>>0|(j|0)==(E|0)&q>>>0<b>>>0);if(K=At(K|0,ae|0,1,0)|0,ae=ee()|0,v=At(b|0,E|0,v|0,ue|0)|0,ue=ee()|0,!((ae|0)<(g|0)|(ae|0)==(g|0)&K>>>0<m>>>0))break e;be=p+(K<<3)|0,aL(h[be>>2]|0,h[be+4>>2]|0,gt)|0||(X=Ut+(v<<5)|0)}di(27634,26956,108,26975)}while(!1);if((we|0)>0|(we|0)==0&Ae>>>0>0){E=0,M=0;do{if(x=Ut+(E<<5)|0,b=h[x>>2]|0,x=h[x+4>>2]|0,v=tt(b|0,x|0,30)|0,x=wr(v^b|0,(ee()|0)^x|0,484763065,-1084733587)|0,b=ee()|0,v=tt(x|0,b|0,27)|0,b=wr(v^x|0,(ee()|0)^b|0,321982955,-1798288965)|0,x=ee()|0,v=tt(b|0,x|0,31)|0,x=qf(v^b|0,(ee()|0)^x|0,xe|0,se|0)|0,b=ee()|0,v=lt+(x<<2)|0,h[v>>2]|0)do v=At(x|0,b|0,1,0)|0,x=ap(v|0,ee()|0,xe|0,se|0)|0,b=ee()|0,v=lt+(x<<2)|0;while((h[v>>2]|0)!=0);h[v>>2]=Ut+(E<<5),E=At(E|0,M|0,1,0)|0,M=ee()|0}while((M|0)<(we|0)|(M|0)==(we|0)&E>>>0<Ae>>>0);q=0,j=0;do{if(E=Ut+(q<<5)|0,M=Ut+(q<<5)+9|0,!(He[M>>0]|0)){if(be=E,hq(h[be>>2]|0,h[be+4>>2]|0,gt)|0){je=39;break}U=gt,N=h[U>>2]|0,U=h[U+4>>2]|0,x=tt(N|0,U|0,30)|0,x=wr(x^N|0,(ee()|0)^U|0,484763065,-1084733587)|0,b=ee()|0,v=tt(x|0,b|0,27)|0,b=wr(v^x|0,(ee()|0)^b|0,321982955,-1798288965)|0,x=ee()|0,v=tt(b|0,x|0,31)|0,x=qf(v^b|0,(ee()|0)^x|0,xe|0,se|0)|0,b=ee()|0,v=h[lt+(x<<2)>>2]|0;e:do if(v|0){for(;be=v,!((h[be>>2]|0)==(N|0)&&(h[be+4>>2]|0)==(U|0));)if(v=At(x|0,b|0,1,0)|0,x=ap(v|0,ee()|0,xe|0,se|0)|0,b=ee()|0,v=h[lt+(x<<2)>>2]|0,!v)break e;He[M>>0]=1,He[v+9>>0]=1,x=v+16|0,be=Ut+(q<<5)+12|0,h[(h[be>>2]|0)+16>>2]=h[x>>2],g=v+12|0,Me=h[Ut+(q<<5)+16>>2]|0,h[Me+12>>2]=h[g>>2],h[(h[g>>2]|0)+16>>2]=Me,h[(h[x>>2]|0)+12>>2]=h[be>>2],x=sT(E)|0,be=sT(v)|0,v=x+24|0,g=h[v+4>>2]|0,Me=be+24|0,Ke=h[Me+4>>2]|0,Me=(g|0)<(Ke|0)|((g|0)==(Ke|0)?(h[v>>2]|0)>>>0<(h[Me>>2]|0)>>>0:0),v=Me?x:be,x=Me?be:x,(x|0)!=(v|0)&&(Ke=v+24|0,be=x+24|0,Me=be,Ke=At(h[Me>>2]|0,h[Me+4>>2]|0,h[Ke>>2]|0,h[Ke+4>>2]|0)|0,Me=ee()|0,h[be>>2]=Ke,h[be+4>>2]=Me,h[v+20>>2]=x)}while(!1)}q=At(q|0,j|0,1,0)|0,j=ee()|0}while((j|0)<(we|0)|(j|0)==(we|0)&q>>>0<Ae>>>0);(je|0)==39&&di(27634,26956,258,27001),v=0,x=0;do He[Ut+(v<<5)+8>>0]=0,v=At(v|0,x|0,1,0)|0,x=ee()|0;while((x|0)<(we|0)|(x|0)==(we|0)&v>>>0<Ae>>>0);for(N=0,b=0,M=0,U=0;;){if(v=Ut+(N<<5)|0,(He[Ut+(N<<5)+8>>0]|0)==0&&(He[Ut+(N<<5)+9>>0]|0)==0){E=v,x=h[E>>2]|0,E=h[E+4>>2]|0;do He[v+8>>0]=1,v=h[v+12>>2]|0,be=v;while(!((h[be>>2]|0)==(x|0)&&(h[be+4>>2]|0)==(E|0)));b=At(b|0,M|0,1,0)|0,E=ee()|0}else E=M;if(N=At(N|0,U|0,1,0)|0,U=ee()|0,(U|0)<(we|0)|(U|0)==(we|0)&N>>>0<Ae>>>0)M=E;else break}v=0,x=0;do He[Ut+(v<<5)+8>>0]=0,v=At(v|0,x|0,1,0)|0,x=ee()|0;while((x|0)<(we|0)|(x|0)==(we|0)&v>>>0<Ae>>>0);Me=b,Ke=E,v=1}else Me=0,Ke=0,v=0;be=br(Me*24|0)|0;e:do if(be|0){t:do if(v){p=0,xe=0,g=0,m=0;n:for(;;){if(v=Ut+(p<<5)|0,(He[Ut+(p<<5)+8>>0]|0)==0&&(He[Ut+(p<<5)+9>>0]|0)==0){ue=v,ae=h[ue>>2]|0,ue=h[ue+4>>2]|0,x=0,b=0;do x=At(x|0,b|0,2,0)|0,b=ee()|0,v=h[v+12>>2]|0,se=v;while(!((h[se>>2]|0)==(ae|0)&&(h[se+4>>2]|0)==(ue|0)));if(K=br(x<<4)|0,!K)break;x=ae,b=ue,X=0,j=0,E=0,M=0;do{if(Hx(x,b,Be)|0){je=69;break n}if(se=h[Be>>2]|0,U=se+-1|0,q=((U|0)<0)<<31>>31,(se|0)>1){b=E,N=0,x=M,E=0;do se=K+(b<<4)|0,M=Be+8+(N<<4)|0,h[se>>2]=h[M>>2],h[se+4>>2]=h[M+4>>2],h[se+8>>2]=h[M+8>>2],h[se+12>>2]=h[M+12>>2],b=At(b|0,x|0,1,0)|0,x=ee()|0,N=At(N|0,E|0,1,0)|0,E=ee()|0;while((E|0)<(q|0)|(E|0)==(q|0)&N>>>0<U>>>0);E=b,M=x}X=At(X|0,j|0,U|0,q|0)|0,j=ee()|0,He[v+8>>0]=1,v=h[v+12>>2]|0,b=v,x=h[b>>2]|0,b=h[b+4>>2]|0}while(!((x|0)==(ae|0)&(b|0)==(ue|0)));if(x=the(K,X<<4)|0,!x){je=75;break}ue=sT(v)|0,se=h[ue+4>>2]|0,v=be+(g*24|0)|0,h[v>>2]=h[ue>>2],h[v+4>>2]=se,v=be+(g*24|0)+16|0,h[v>>2]=X,h[be+(g*24|0)+20>>2]=x,h[gt>>2]=h[v>>2],h[gt+4>>2]=h[v+4>>2],vc(gt,be+(g*24|0)+8|0)|0,x=At(g|0,xe|0,1,0)|0,v=ee()|0}else x=g,v=xe;if(p=At(p|0,m|0,1,0)|0,m=ee()|0,(m|0)<(we|0)|(m|0)==(we|0)&p>>>0<Ae>>>0)xe=v,g=x;else break t}if((je|0)==69?di(27634,26956,351,27016):(je|0)==75&&_t(K),(xe|0)>0|(xe|0)==0&g>>>0>0)for(E=0,M=0,v=g,b=xe;x=h[be+(E*24|0)+20>>2]|0,x?(_t(x),x=xe,v=g):x=b,E=At(E|0,M|0,1,0)|0,M=ee()|0,(M|0)<(x|0)|(M|0)==(x|0)&E>>>0<v>>>0;)b=x;_t(be);break e}while(!1);uT(be,Me,24,2);t:do if((Me|0)==0&(Ke|0)==0){if(se=br(192)|0,se|0){if(h[se+16>>2]=0,h[se+20>>2]=0,j=se+8|0,h[j>>2]=3,v=br(48)|0,X=se+12|0,h[X>>2]=v,v|0){h[v>>2]=h[3860],h[v+4>>2]=h[3861],h[v+8>>2]=h[3862],h[v+12>>2]=h[3863],q=v+16|0,h[q>>2]=h[3864],h[q+4>>2]=h[3865],h[q+8>>2]=h[3866],h[q+12>>2]=h[3867],q=v+32|0,h[q>>2]=h[3868],h[q+4>>2]=h[3869],h[q+8>>2]=h[3870],h[q+12>>2]=h[3871],h[gt>>2]=h[j>>2],h[gt+4>>2]=h[j+4>>2],vc(gt,se)|0,h[se+40>>2]=0,h[se+44>>2]=0,q=se+32|0,h[q>>2]=3,v=br(48)|0,K=se+36|0,h[K>>2]=v;do if(!v)E=0,M=1;else{if(h[v>>2]=h[3872],h[v+4>>2]=h[3873],h[v+8>>2]=h[3874],h[v+12>>2]=h[3875],U=v+16|0,h[U>>2]=h[3876],h[U+4>>2]=h[3877],h[U+8>>2]=h[3878],h[U+12>>2]=h[3879],U=v+32|0,h[U>>2]=h[3880],h[U+4>>2]=h[3881],h[U+8>>2]=h[3882],h[U+12>>2]=h[3883],h[gt>>2]=h[q>>2],h[gt+4>>2]=h[q+4>>2],vc(gt,se+24|0)|0,h[se+64>>2]=0,h[se+68>>2]=0,U=se+56|0,h[U>>2]=3,v=br(48)|0,ae=se+60|0,h[ae>>2]=v,!v){E=0,M=2;break}if(h[v>>2]=h[3884],h[v+4>>2]=h[3885],h[v+8>>2]=h[3886],h[v+12>>2]=h[3887],N=v+16|0,h[N>>2]=h[3888],h[N+4>>2]=h[3889],h[N+8>>2]=h[3890],h[N+12>>2]=h[3891],N=v+32|0,h[N>>2]=h[3892],h[N+4>>2]=h[3893],h[N+8>>2]=h[3894],h[N+12>>2]=h[3895],h[gt>>2]=h[U>>2],h[gt+4>>2]=h[U+4>>2],vc(gt,se+48|0)|0,h[se+88>>2]=0,h[se+92>>2]=0,N=se+80|0,h[N>>2]=3,v=br(48)|0,ue=se+84|0,h[ue>>2]=v,!v){E=0,M=3;break}if(h[v>>2]=h[3896],h[v+4>>2]=h[3897],h[v+8>>2]=h[3898],h[v+12>>2]=h[3899],M=v+16|0,h[M>>2]=h[3900],h[M+4>>2]=h[3901],h[M+8>>2]=h[3902],h[M+12>>2]=h[3903],M=v+32|0,h[M>>2]=h[3904],h[M+4>>2]=h[3905],h[M+8>>2]=h[3906],h[M+12>>2]=h[3907],h[gt>>2]=h[N>>2],h[gt+4>>2]=h[N+4>>2],vc(gt,se+72|0)|0,h[se+112>>2]=0,h[se+116>>2]=0,M=se+104|0,h[M>>2]=3,v=br(48)|0,p=se+108|0,h[p>>2]=v,!v){E=0,M=4;break}if(h[v>>2]=h[3908],h[v+4>>2]=h[3909],h[v+8>>2]=h[3910],h[v+12>>2]=h[3911],E=v+16|0,h[E>>2]=h[3912],h[E+4>>2]=h[3913],h[E+8>>2]=h[3914],h[E+12>>2]=h[3915],E=v+32|0,h[E>>2]=h[3916],h[E+4>>2]=h[3917],h[E+8>>2]=h[3918],h[E+12>>2]=h[3919],h[gt>>2]=h[M>>2],h[gt+4>>2]=h[M+4>>2],vc(gt,se+96|0)|0,h[se+136>>2]=0,h[se+140>>2]=0,E=se+128|0,h[E>>2]=3,v=br(48)|0,m=se+132|0,h[m>>2]=v,!v){E=0,M=5;break}if(h[v>>2]=h[3920],h[v+4>>2]=h[3921],h[v+8>>2]=h[3922],h[v+12>>2]=h[3923],b=v+16|0,h[b>>2]=h[3924],h[b+4>>2]=h[3925],h[b+8>>2]=h[3926],h[b+12>>2]=h[3927],b=v+32|0,h[b>>2]=h[3928],h[b+4>>2]=h[3929],h[b+8>>2]=h[3930],h[b+12>>2]=h[3931],h[gt>>2]=h[E>>2],h[gt+4>>2]=h[E+4>>2],vc(gt,se+120|0)|0,h[se+160>>2]=0,h[se+164>>2]=0,b=se+152|0,h[b>>2]=3,v=br(48)|0,g=se+156|0,h[g>>2]=v,!v){E=0,M=6;break}if(h[v>>2]=h[3932],h[v+4>>2]=h[3933],h[v+8>>2]=h[3934],h[v+12>>2]=h[3935],x=v+16|0,h[x>>2]=h[3936],h[x+4>>2]=h[3937],h[x+8>>2]=h[3938],h[x+12>>2]=h[3939],x=v+32|0,h[x>>2]=h[3940],h[x+4>>2]=h[3941],h[x+8>>2]=h[3942],h[x+12>>2]=h[3943],h[gt>>2]=h[b>>2],h[gt+4>>2]=h[b+4>>2],vc(gt,se+144|0)|0,h[se+184>>2]=0,h[se+188>>2]=0,x=se+176|0,h[x>>2]=3,v=br(48)|0,xe=se+180|0,h[xe>>2]=v,!v){E=0,M=7;break}if(h[v>>2]=h[3944],h[v+4>>2]=h[3945],h[v+8>>2]=h[3946],h[v+12>>2]=h[3947],Be=v+16|0,h[Be>>2]=h[3948],h[Be+4>>2]=h[3949],h[Be+8>>2]=h[3950],h[Be+12>>2]=h[3951],v=v+32|0,h[v>>2]=h[3952],h[v+4>>2]=h[3953],h[v+8>>2]=h[3954],h[v+12>>2]=h[3955],h[gt>>2]=h[x>>2],h[gt+4>>2]=h[x+4>>2],vc(gt,se+168|0)|0,uT(se,8,24,3),v=br(128)|0,h[_+4>>2]=v,v|0){h[_>>2]=8,h[v>>2]=h[j>>2],h[v+4>>2]=h[j+4>>2],h[v+8>>2]=h[j+8>>2],h[v+12>>2]=h[j+12>>2],je=v+16|0,h[je>>2]=h[q>>2],h[je+4>>2]=h[q+4>>2],h[je+8>>2]=h[q+8>>2],h[je+12>>2]=h[q+12>>2],je=v+32|0,h[je>>2]=h[U>>2],h[je+4>>2]=h[U+4>>2],h[je+8>>2]=h[U+8>>2],h[je+12>>2]=h[U+12>>2],je=v+48|0,h[je>>2]=h[N>>2],h[je+4>>2]=h[N+4>>2],h[je+8>>2]=h[N+8>>2],h[je+12>>2]=h[N+12>>2],je=v+64|0,h[je>>2]=h[M>>2],h[je+4>>2]=h[M+4>>2],h[je+8>>2]=h[M+8>>2],h[je+12>>2]=h[M+12>>2],je=v+80|0,h[je>>2]=h[E>>2],h[je+4>>2]=h[E+4>>2],h[je+8>>2]=h[E+8>>2],h[je+12>>2]=h[E+12>>2],je=v+96|0,h[je>>2]=h[b>>2],h[je+4>>2]=h[b+4>>2],h[je+8>>2]=h[b+8>>2],h[je+12>>2]=h[b+12>>2],je=v+112|0,h[je>>2]=h[x>>2],h[je+4>>2]=h[x+4>>2],h[je+8>>2]=h[x+8>>2],h[je+12>>2]=h[x+12>>2],_t(se),je=158;break t}v=h[X>>2]|0,v|0&&_t(v),v=h[K>>2]|0,v|0&&_t(v),v=h[ae>>2]|0,v|0&&_t(v),v=h[ue>>2]|0,v|0&&_t(v),v=h[p>>2]|0,v|0&&_t(v),v=h[m>>2]|0,v|0&&_t(v),v=h[g>>2]|0,v|0&&_t(v),v=h[xe>>2]|0,v|0&&_t(v),_t(se);break t}while(!1);v=0,b=0;do x=h[se+(v*24|0)+12>>2]|0,x|0&&_t(x),v=At(v|0,b|0,1,0)|0,b=ee()|0;while(b>>>0<E>>>0|(b|0)==(E|0)&v>>>0<M>>>0)}_t(se),je=152}}else{if((Ke|0)>0|(Ke|0)==0&Me>>>0>0){b=0,E=0,M=0,x=0,v=0,N=0;do Be=be+(b*24|0)|0,gt=E,E=h[Be>>2]|0,je=M,M=h[Be+4>>2]|0,x=At(x|0,v|0,((E|0)!=(gt|0)|(M|0)!=(je|0))&1|0,0)|0,v=ee()|0,b=At(b|0,N|0,1,0)|0,N=ee()|0;while((N|0)<(Ke|0)|(N|0)==(Ke|0)&b>>>0<Me>>>0);ue=x,ae=v}else ue=0,ae=0;if(p=br(ue*24|0)|0,p){n:do if((Ke|0)>=0){for(j=0,X=0,x=0,b=0,K=0,E=0;;){if(!((j|0)==(Me|0)&(X|0)==(Ke|0))&&(gt=be+(x*24|0)|0,je=be+(j*24|0)|0,(h[gt>>2]|0)==(h[je>>2]|0)?(h[gt+4>>2]|0)==(h[je+4>>2]|0):0))v=K;else{if(U=be+(x*24|0)|0,je=Js(j|0,X|0,x|0,b|0)|0,gt=ee()|0,q=At(je|0,gt|0,-1,-1)|0,b=ee()|0,(gt|0)>0|(gt|0)==0&je>>>0>1){if(v=br(q<<3)|0,!v)break;M=0,N=0;do je=M,M=At(M|0,N|0,1,0)|0,N=ee()|0,Be=U+(M*24|0)+16|0,gt=h[Be+4>>2]|0,je=v+(je<<3)|0,h[je>>2]=h[Be>>2],h[je+4>>2]=gt;while((N|0)<(b|0)|(N|0)==(b|0)&M>>>0<q>>>0)}else v=0;gt=be+(x*24|0)+16|0,je=h[gt+4>>2]|0,b=p+(E*24|0)+8|0,h[b>>2]=h[gt>>2],h[b+4>>2]=je,h[p+(E*24|0)+16>>2]=q,h[p+(E*24|0)+20>>2]=v,ie[p+(E*24|0)>>3]=+ie[be+(x*24|0)+8>>3],E=At(E|0,K|0,1,0)|0,x=j,b=X,v=ee()|0}if(je=j,j=At(j|0,X|0,1,0)|0,gt=X,X=ee()|0,(gt|0)<(Ke|0)|(gt|0)==(Ke|0)&je>>>0<Me>>>0)K=v;else break n}if((K|0)>0|(K|0)==0&E>>>0>0){v=0,b=0;do x=h[p+(v*24|0)+20>>2]|0,x|0&&_t(x),v=At(v|0,b|0,1,0)|0,b=ee()|0;while((b|0)<(K|0)|(b|0)==(K|0)&v>>>0<E>>>0)}_t(p),je=152;break t}while(!1);if(uT(p,ue,24,3),v=br(ue<<4)|0,b=_+4|0,h[b>>2]=v,v){h[_>>2]=ue;do if((ae|0)>0|(ae|0)==0&ue>>>0>0){if(_=p+8|0,h[v>>2]=h[_>>2],h[v+4>>2]=h[_+4>>2],h[v+8>>2]=h[_+8>>2],h[v+12>>2]=h[_+12>>2],(ue|0)==1&(ae|0)==0||(_=v+16|0,je=p+32|0,h[_>>2]=h[je>>2],h[_+4>>2]=h[je+4>>2],h[_+8>>2]=h[je+8>>2],h[_+12>>2]=h[je+12>>2],!((ae|0)>0|(ae|0)==0&ue>>>0>2)))break;v=2,x=0;do _=(h[b>>2]|0)+(v<<4)|0,je=p+(v*24|0)+8|0,h[_>>2]=h[je>>2],h[_+4>>2]=h[je+4>>2],h[_+8>>2]=h[je+8>>2],h[_+12>>2]=h[je+12>>2],v=At(v|0,x|0,1,0)|0,x=ee()|0;while((x|0)<(ae|0)|(x|0)==(ae|0)&v>>>0<ue>>>0)}while(!1);_t(p),je=158;break}else{if((ae|0)>0|(ae|0)==0&ue>>>0>0){v=0,b=0;do x=h[p+(v*24|0)+20>>2]|0,x|0&&_t(x),v=At(v|0,b|0,1,0)|0,b=ee()|0;while((b|0)<(ae|0)|(b|0)==(ae|0)&v>>>0<ue>>>0)}_t(p),je=152;break}}else je=152}while(!1);if((je|0)==158)return _t(Ut),_t(lt),_t(be),lt=0,Q=pt,lt|0;if((je|0)==152&&(Ke|0)>0|(Ke|0)==0&Me>>>0>0)for(E=0,M=0,v=Me,b=Ke;x=h[be+(E*24|0)+20>>2]|0,x?(_t(x),x=Ke,v=Me):x=b,E=At(E|0,M|0,1,0)|0,M=ee()|0,(M|0)<(x|0)|(M|0)==(x|0)&E>>>0<v>>>0;)b=x;return _t(be),_t(Ut),_t(lt),lt=13,Q=pt,lt|0}while(!1);return _t(Ut),_t(lt),lt=13,Q=pt,lt|0}else if((je|0)==159)return Q=pt,v|0;return 0}function tue(p,m){p=p|0,m=m|0;var g=0,_=0;return _=p,p=h[_>>2]|0,_=h[_+4>>2]|0,g=m,m=h[g>>2]|0,g=h[g+4>>2]|0,(_>>>0<g>>>0|(_|0)==(g|0)&p>>>0<m>>>0?-1:(_>>>0>g>>>0|(_|0)==(g|0)&p>>>0>m>>>0)&1)|0}function sT(p){p=p|0;var m=0,g=0;return m=p+20|0,g=h[m>>2]|0,(g|0)==(p|0)?p|0:(g=sT(g)|0,h[m>>2]=g,g|0)}function nue(p,m){p=p|0,m=m|0;var g=0,_=0,v=0,x=0,b=0,E=0;return E=p,b=h[E>>2]|0,E=h[E+4>>2]|0,x=m,v=h[x>>2]|0,x=h[x+4>>2]|0,E>>>0<x>>>0|(E|0)==(x|0)&b>>>0<v>>>0?(m=-1,m|0):E>>>0>x>>>0|(E|0)==(x|0)&b>>>0>v>>>0?(m=1,m|0):(_=+ie[p+8>>3],g=+ie[m+8>>3],_<g?(m=-1,m|0):(m=_>g&1,m|0))}function iue(p,m){p=p|0,m=m|0;var g=0,_=0;return _=+ie[p>>3],g=+ie[m>>3],(_>g?-1:_<g&1)|0}function rue(p,m,g,_,v){p=p|0,m=m|0,g=g|0,_=_|0,v=v|0;var x=0,b=0,E=0,M=0,N=0,U=0,q=0;if(q=Q,Q=Q+64|0,U=q,E=q+56|0,!(!0&(m&2013265920|0)==134217728&(!0&(_&2013265920|0)==134217728)))return v=5,Q=q,v|0;if((p|0)==(g|0)&(m|0)==(_|0))return h[v>>2]=0,v=0,Q=q,v|0;if(b=tt(p|0,m|0,52)|0,ee()|0,b=b&15,N=tt(g|0,_|0,52)|0,ee()|0,(b|0)!=(N&15|0))return v=12,Q=q,v|0;if(x=b+-1|0,b>>>0>1){fL(p,m,x,U)|0,fL(g,_,x,E)|0,N=U,M=h[N>>2]|0,N=h[N+4>>2]|0;e:do if((M|0)==(h[E>>2]|0)&&(N|0)==(h[E+4>>2]|0)){b=(b^15)*3|0,x=tt(p|0,m|0,b|0)|0,ee()|0,x=x&7,b=tt(g|0,_|0,b|0)|0,ee()|0,b=b&7;do if((x|0)==0|(b|0)==0)h[v>>2]=1,x=0;else if((x|0)==7)x=5;else{if((x|0)==1|(b|0)==1&&Zi(M,N)|0){x=5;break}if((h[15824+(x<<2)>>2]|0)!=(b|0)&&(h[15856+(x<<2)>>2]|0)!=(b|0))break e;h[v>>2]=1,x=0}while(!1);return v=x,Q=q,v|0}while(!1)}x=U,b=x+56|0;do h[x>>2]=0,x=x+4|0;while((x|0)<(b|0));return JG(p,m,1,U)|0,m=U,!((h[m>>2]|0)==(g|0)&&(h[m+4>>2]|0)==(_|0))&&(m=U+8|0,!((h[m>>2]|0)==(g|0)&&(h[m+4>>2]|0)==(_|0)))&&(m=U+16|0,!((h[m>>2]|0)==(g|0)&&(h[m+4>>2]|0)==(_|0)))&&(m=U+24|0,!((h[m>>2]|0)==(g|0)&&(h[m+4>>2]|0)==(_|0)))&&(m=U+32|0,!((h[m>>2]|0)==(g|0)&&(h[m+4>>2]|0)==(_|0)))&&(m=U+40|0,!((h[m>>2]|0)==(g|0)&&(h[m+4>>2]|0)==(_|0)))?(x=U+48|0,x=((h[x>>2]|0)==(g|0)?(h[x+4>>2]|0)==(_|0):0)&1):x=1,h[v>>2]=x,v=0,Q=q,v|0}function sue(p,m,g,_,v){return p=p|0,m=m|0,g=g|0,_=_|0,v=v|0,g=rT(p,m,g,_)|0,(g|0)==7?(v=11,v|0):(_=ft(g|0,0,56)|0,m=m&-2130706433|(ee()|0)|268435456,h[v>>2]=p|_,h[v+4>>2]=m,v=0,v|0)}function oue(p,m,g){return p=p|0,m=m|0,g=g|0,!0&(m&2013265920|0)==268435456?(h[g>>2]=p,h[g+4>>2]=m&-2130706433|134217728,g=0,g|0):(g=6,g|0)}function aue(p,m,g){p=p|0,m=m|0,g=g|0;var _=0,v=0,x=0;return v=Q,Q=Q+16|0,_=v,h[_>>2]=0,!0&(m&2013265920|0)==268435456?(x=tt(p|0,m|0,56)|0,ee()|0,_=Qs(p,m&-2130706433|134217728,x&7,_,g)|0,Q=v,_|0):(_=6,Q=v,_|0)}function uq(p,m){p=p|0,m=m|0;var g=0;switch(g=tt(p|0,m|0,56)|0,ee()|0,g&7){case 0:case 7:return g=0,g|0;default:}return g=m&-2130706433|134217728,!(!0&(m&2013265920|0)==268435456)||!0&(m&117440512|0)==16777216&(Zi(p,g)|0)!=0?(g=0,g|0):(g=oT(p,g)|0,g|0)}function lue(p,m,g){p=p|0,m=m|0,g=g|0;var _=0,v=0,x=0,b=0;return v=Q,Q=Q+16|0,_=v,!0&(m&2013265920|0)==268435456?(x=m&-2130706433|134217728,b=g,h[b>>2]=p,h[b+4>>2]=x,h[_>>2]=0,m=tt(p|0,m|0,56)|0,ee()|0,_=Qs(p,x,m&7,_,g+8|0)|0,Q=v,_|0):(_=6,Q=v,_|0)}function aL(p,m,g){p=p|0,m=m|0,g=g|0;var _=0,v=0;return v=(Zi(p,m)|0)==0,m=m&-2130706433,_=g,h[_>>2]=v?p:0,h[_+4>>2]=v?m|285212672:0,_=g+8|0,h[_>>2]=p,h[_+4>>2]=m|301989888,_=g+16|0,h[_>>2]=p,h[_+4>>2]=m|318767104,_=g+24|0,h[_>>2]=p,h[_+4>>2]=m|335544320,_=g+32|0,h[_>>2]=p,h[_+4>>2]=m|352321536,g=g+40|0,h[g>>2]=p,h[g+4>>2]=m|369098752,0}function Hx(p,m,g){p=p|0,m=m|0,g=g|0;var _=0,v=0,x=0,b=0;return b=Q,Q=Q+16|0,v=b,x=m&-2130706433|134217728,!0&(m&2013265920|0)==268435456?(_=tt(p|0,m|0,56)|0,ee()|0,_=Que(p,x,_&7)|0,(_|0)==-1?(h[g>>2]=0,x=6,Q=b,x|0):(b1(p,x,v)|0&&di(27634,27035,282,27050),m=tt(p|0,m|0,52)|0,ee()|0,m=m&15,Zi(p,x)|0?lL(v,m,_,2,g):cL(v,m,_,2,g),x=0,Q=b,x|0)):(x=6,Q=b,x|0)}function hq(p,m,g){p=p|0,m=m|0,g=g|0;var _=0,v=0,x=0,b=0;return b=Q,Q=Q+16|0,_=b+8|0,v=b,x=m&-2130706433|134217728,!0&(m&2013265920|0)==268435456?(h[_>>2]=0,m=tt(p|0,m|0,56)|0,ee()|0,m=Qs(p,x,m&7,_,v)|0,m|0?(g=m,Q=b,g|0):(_=h[v>>2]|0,v=h[v+4>>2]|0,m=rT(_,v,p,x)|0,(m|0)==7?(g=11,Q=b,g|0):(p=ft(m|0,0,56)|0,x=v&-2130706433|(ee()|0)|268435456,h[g>>2]=_|p,h[g+4>>2]=x,g=0,Q=b,g|0))):(g=6,Q=b,g|0)}function cue(p,m,g){p=p|0,m=m|0,g=g|0;var _=0,v=0,x=0,b=0,E=0,M=0,N=0,U=0,q=0,j=0,X=0,K=0,ae=0,ue=0,xe=0,se=0,we=0,Ae=0,Be=0;h[g>>2]=0,N=+ie[p>>3],U=+ie[p+8>>3],M=+ie[p+16>>3],v=0,x=5,_=5,p=0;do ae=+ie[15888+(v*24|0)>>3]-N,K=+ie[15888+(v*24|0)+8>>3]-U,b=+ie[15888+(v*24|0)+16>>3]-M,b=ae*ae+K*K+b*b,b<_&&(h[g>>2]=v,x=b,p=v,_=b),v=v+1|0;while((v|0)!=20);if(x=+bce(+(1-x*.5)),x<1e-16)M=0,b=0;else{if(Ae=+ie[16368+(p*24|0)>>3],se=+ie[15888+(p*24|0)>>3],we=+ie[15888+(p*24|0)+8>>3],xe=+ie[15888+(p*24|0)+16>>3],Be=-(xe+(se*0+we*0)),b=se*Be+0,ae=we*Be+0,Be=xe*Be+1,ue=+bs(+(Be*Be+(b*b+ae*ae))),ue=ue>0?1/ue:0,b=b*ue,ae=ae*ue,ue=Be*ue,Be=-(N*se+U*we+M*xe),K=N+se*Be,_=U+we*Be,N=M+xe*Be,U=+bs(+(N*N+(K*K+_*_))),U=U>0?1/U:0,K=K*U,_=_*U,U=N*U,_=+Xx(Ae-+Xx(+Ta(+(U*(we*b-se*ae)+(K*(xe*ae-we*ue)+_*(se*ue-xe*b))),+(ue*U+(b*K+ae*_))))),_c(m)|0?b=+Xx(_+-.3334731722518321):b=_,_=+iT(+x)*2.618033988749896,(m|0)>0){p=0;do _=_*2.6457513110645907,p=p+1|0;while((p|0)!=(m|0))}M=+ii(+b)*_,b=+zi(+b)*_}m=g+4|0,X=g+12|0,h[X>>2]=0,x=+Ks(+b)*1.1547005383792515,_=+Ks(+M)+x*.5,p=~~_,v=~~x,_=_-+(p|0),x=x-+(v|0);do if(_<.5)if(_<.3333333333333333)if(h[m>>2]=p,x<(_+1)*.5){h[g+8>>2]=v;break}else{v=v+1|0,h[g+8>>2]=v;break}else if(Be=1-_,v=(!(x<Be)&1)+v|0,h[g+8>>2]=v,Be<=x&x<_*2){p=p+1|0,h[m>>2]=p;break}else{h[m>>2]=p;break}else{if(!(_<.6666666666666666))if(p=p+1|0,h[m>>2]=p,x<_*.5){h[g+8>>2]=v;break}else{v=v+1|0,h[g+8>>2]=v;break}if(x<1-_){if(h[g+8>>2]=v,_*2+-1<x){h[m>>2]=p;break}}else v=v+1|0,h[g+8>>2]=v;p=p+1|0,h[m>>2]=p}while(!1);do if(M<0)if(v&1){j=(v+1|0)/2|0,j=Js(p|0,((p|0)<0)<<31>>31|0,j|0,((j|0)<0)<<31>>31|0)|0,p=~~(+(p|0)-((+(j>>>0)+4294967296*+(ee()|0))*2+1)),h[m>>2]=p,j=m;break}else{j=(v|0)/2|0,j=Js(p|0,((p|0)<0)<<31>>31|0,j|0,((j|0)<0)<<31>>31|0)|0,p=~~(+(p|0)-(+(j>>>0)+4294967296*+(ee()|0))*2),h[m>>2]=p,j=m;break}else j=m;while(!1);q=g+8|0,m=0-v|0,b<0?(g=p-((v<<1|1|0)/2|0)|0,h[j>>2]=g,h[q>>2]=m,v=m):g=p,p=v-g|0,m=0-g|0,(g|0)<0?(h[q>>2]=p,h[X>>2]=m,h[j>>2]=0,E=0):(p=v,E=g,m=0),g=E-p|0,v=m-p|0,(p|0)<0?(h[j>>2]=g,h[X>>2]=v,h[q>>2]=0,E=g,p=0):v=m,g=E-v|0,m=p-v|0,(v|0)<0?(h[j>>2]=g,h[q>>2]=m,h[X>>2]=0,v=0):(m=p,g=E),p=(m|0)<(g|0)?m:g,p=(v|0)<(p|0)?v:p,!((p|0)<=0)&&(h[j>>2]=g-p,h[q>>2]=m-p,h[X>>2]=v-p)}function uue(p,m,g){p=p|0,m=m|0,g=g|0;var _=0,v=0,x=0,b=0;_=Q,Q=Q+16|0,v=_,b=h[p+12>>2]|0,x=+((h[p+8>>2]|0)-b|0),ie[v>>3]=+((h[p+4>>2]|0)-b|0)-x*.5,ie[v+8>>3]=x*.8660254037844386,Wx(v,h[p>>2]|0,m,0,g),Q=_}function Wx(p,m,g,_,v){p=p|0,m=m|0,g=g|0,_=_|0,v=v|0;var x=0,b=0,E=0,M=0,N=0,U=0,q=0,j=0,X=0,K=0,ae=0,ue=0;if(x=+Kue(p),x<1e-16){m=15888+(m*24|0)|0,h[v>>2]=h[m>>2],h[v+4>>2]=h[m+4>>2],h[v+8>>2]=h[m+8>>2],h[v+12>>2]=h[m+12>>2],h[v+16>>2]=h[m+16>>2],h[v+20>>2]=h[m+20>>2];return}if(b=+Ta(+ +ie[p+8>>3],+ +ie[p>>3]),(g|0)>0){p=0;do x=x*.37796447300922725,p=p+1|0;while((p|0)!=(g|0))}E=x*.3333333333333333,_?(g=(_c(g)|0)==0,x=+KG(+((g?E:E*.37796447300922725)*.381966011250105))):(x=+KG(+(x*.381966011250105)),_c(g)|0&&(b=+Xx(b+.3334731722518321))),q=+Xx(+ie[16368+(m*24|0)>>3]-b),E=+ie[15888+(m*24|0)>>3],U=+ie[15888+(m*24|0)+8>>3],ae=+ie[15888+(m*24|0)+16>>3],X=-(ae+(E*0+U*0)),N=E*X+0,b=U*X+0,X=ae*X+1,j=+bs(+(X*X+(N*N+b*b))),j=j>0?1/j:0,N=N*j,b=b*j,j=X*j,X=+ii(+q),q=+zi(+q),ue=+ii(+x),K=+zi(+x),M=ue*E+K*(X*N+q*(ae*b-U*j)),x=ue*U+K*(X*b+q*(E*j-ae*N)),b=ue*ae+K*(X*j+q*(U*N-E*b)),E=+bs(+(b*b+(M*M+x*x))),E=E>0?1/E:0,ie[v>>3]=M*E,ie[v+8>>3]=x*E,ie[v+16>>3]=b*E}function lL(p,m,g,_,v){p=p|0,m=m|0,g=g|0,_=_|0,v=v|0;var x=0,b=0,E=0,M=0,N=0,U=0,q=0,j=0,X=0,K=0,ae=0,ue=0,xe=0,se=0,we=0,Ae=0,Be=0,Ke=0,Me=0,be=0,gt=0,je=0,Ut=0,lt=0,pt=0,pi=0,bi=0,Ro=0,Vn=0,wi=0,Ma=0,Ns=0,as=0,Fs=0,ws=0,cl=0,po=0,mo=0,yc=0,Po=0,Ii=0,Vm=0;if(cl=Q,Q=Q+256|0,x=cl+240|0,pi=cl+224|0,as=cl,Fs=cl+208|0,ws=cl+192|0,bi=cl+168|0,Ro=cl+152|0,Vn=cl+136|0,wi=cl+120|0,Ma=cl+104|0,Ns=cl+80|0,h[x>>2]=m,h[pi>>2]=h[p>>2],h[pi+4>>2]=h[p+4>>2],h[pi+8>>2]=h[p+8>>2],h[pi+12>>2]=h[p+12>>2],fq(pi,x,as),h[v>>2]=0,pi=_+g+((_|0)==5&1)|0,(pi|0)<=(g|0)){Q=cl;return}Ae=h[x>>2]|0,we=Fs+4|0,xe=Fs+8|0,se=Fs+12|0,Be=ws+8|0,Ke=g+5|0,Me=16848+(Ae<<2)|0,be=bi+8|0,gt=16928+(Ae<<2)|0,je=Ro+8|0,Ut=Vn+8|0,lt=wi+8|0,pt=ws+8|0,X=bi+8|0,ae=bi+16|0,K=Ns+8|0,ue=Ns+16|0,j=g,_=0,b=0,E=0,M=0;e:for(;;){q=as+(((j|0)%5|0)<<4)|0,h[Fs>>2]=h[q>>2],h[Fs+4>>2]=h[q+4>>2],h[Fs+8>>2]=h[q+8>>2],h[Fs+12>>2]=h[q+12>>2];do;while((y1(Fs,Ae,0,1)|0)==2);if((j|0)>(g|0)&(_c(m)|0)!=0){if(q=h[Fs>>2]|0,p=h[we>>2]|0,N=h[xe>>2]|0,x=h[se>>2]|0,po=+(E-M|0),ie[ws>>3]=+(b-M|0)-po*.5,ie[Be>>3]=po*.8660254037844386,M=h[17008+(q*80|0)+(_<<2)>>2]|0,U=h[18608+(q*80|0)+(M*20|0)>>2]|0,E=h[18608+(q*80|0)+(M*20|0)+16>>2]|0,(E|0)>0){b=0,_=N;do Po=x+p|0,Ii=(Po|0)<0,N=_+p-(Ii?Po:0)|0,yc=(N|0)<0,mo=x+_-(Ii?Po:0)-(yc?N:0)|0,x=(mo|0)<0,p=(Ii?0:Po)-(yc?N:0)-(x?mo:0)|0,_=(yc?0:N)-(x?mo:0)|0,mo=x?0:mo,x=(_|0)<(p|0)?_:p,x=(mo|0)<(x|0)?mo:x,N=(x|0)>0,p=p-(N?x:0)|0,_=_-(N?x:0)|0,x=mo-(N?x:0)|0,b=b+1|0;while((b|0)<(E|0))}else _=N;switch(Ii=(h[Me>>2]|0)*3|0,mo=(al(Ii,h[18608+(q*80|0)+(M*20|0)+4>>2]|0)|0)+p|0,N=(al(Ii,h[18608+(q*80|0)+(M*20|0)+8>>2]|0)|0)+_|0,Ii=(al(Ii,h[18608+(q*80|0)+(M*20|0)+12>>2]|0)|0)+x|0,M=(mo|0)<0,N=N-(M?mo:0)|0,yc=(N|0)<0,Ii=Ii+(M?0-mo|0:0)+(yc?0-N|0:0)|0,Po=(Ii|0)<0,mo=(M?0:mo)-(yc?N:0)-(Po?Ii:0)|0,N=(yc?0:N)-(Po?Ii:0)|0,Ii=Po?0:Ii,Po=(N|0)<(mo|0)?N:mo,Po=(Ii|0)<(Po|0)?Ii:Po,yc=(Po|0)>0,Ii=Ii-(yc?Po:0)|0,po=+(N-(yc?Po:0)-Ii|0),ie[bi>>3]=+(mo-(yc?Po:0)-Ii|0)-po*.5,ie[be>>3]=po*.8660254037844386,po=+(h[gt>>2]|0),ie[Ro>>3]=po*3,ie[je>>3]=0,Vm=po*-1.5,ie[Vn>>3]=Vm,ie[Ut>>3]=po*2.598076211353316,ie[wi>>3]=Vm,ie[lt>>3]=po*-2.598076211353316,h[17008+(U*80|0)+(q<<2)>>2]|0){case 1:{p=Vn,_=Ro;break}case 3:{p=wi,_=Vn;break}case 2:{p=Ro,_=wi;break}default:{p=12;break e}}Eq(ws,bi,_,p,Ma),Wx(Ma,U,Ae,1,Ns),Ii=h[v>>2]|0,po=+qx(+ +ie[ue>>3]),Vm=+Ta(+ +ie[K>>3],+ +ie[Ns>>3]),ie[v+8+(Ii<<4)>>3]=po,ie[v+8+(Ii<<4)+8>>3]=Vm,h[v>>2]=(h[v>>2]|0)+1}if((j|0)<(Ke|0)&&(Ii=h[se>>2]|0,po=+((h[xe>>2]|0)-Ii|0),ie[ws>>3]=+((h[we>>2]|0)-Ii|0)-po*.5,ie[pt>>3]=po*.8660254037844386,Wx(ws,h[Fs>>2]|0,Ae,1,bi),Ii=h[v>>2]|0,po=+qx(+ +ie[ae>>3]),Vm=+Ta(+ +ie[X>>3],+ +ie[bi>>3]),ie[v+8+(Ii<<4)>>3]=po,ie[v+8+(Ii<<4)+8>>3]=Vm,h[v>>2]=(h[v>>2]|0)+1),j=j+1|0,(j|0)>=(pi|0)){p=3;break}else _=h[Fs>>2]|0,b=h[we>>2]|0,E=h[xe>>2]|0,M=h[se>>2]|0}if((p|0)==3){Q=cl;return}else(p|0)==12&&di(27073,27120,599,27130)}function fq(p,m,g){p=p|0,m=m|0,g=g|0;var _=0,v=0,x=0,b=0,E=0,M=0,N=0,U=0,q=0,j=0,X=0,K=0;K=Q,Q=Q+128|0,_=K+64|0,v=K,x=_,b=20208,E=x+60|0;do h[x>>2]=h[b>>2],x=x+4|0,b=b+4|0;while((x|0)<(E|0));x=v,b=20272,E=x+60|0;do h[x>>2]=h[b>>2],x=x+4|0,b=b+4|0;while((x|0)<(E|0));if(U=(_c(h[m>>2]|0)|0)==0,U=U?_:v,X=p+4|0,x=h[X>>2]|0,q=p+8|0,_=h[q>>2]|0,j=p+12|0,v=h[j>>2]|0,b=_+(x<<1)|0,h[X>>2]=b,_=v+(_<<1)|0,h[q>>2]=_,x=(v<<1)+x|0,h[j>>2]=x,v=_-b|0,E=x-b|0,(b|0)<0&&(h[q>>2]=v,h[j>>2]=E,h[X>>2]=0,_=v,b=0,x=E),E=b-_|0,v=x-_|0,(_|0)<0?(h[X>>2]=E,h[j>>2]=v,h[q>>2]=0,_=0):(v=x,E=b),b=E-v|0,x=_-v|0,(v|0)<0?(h[X>>2]=b,h[q>>2]=x,h[j>>2]=0,v=0):(x=_,b=E),_=(x|0)<(b|0)?x:b,_=(v|0)<(_|0)?v:_,(_|0)>0&&(v=v-_|0,x=x-_|0,b=b-_|0,h[X>>2]=b,h[q>>2]=x,h[j>>2]=v),M=(x<<1)+b|0,E=v+(b<<1)|0,h[X>>2]=E,h[q>>2]=M,x=(v<<1)+x|0,h[j>>2]=x,_=M-E|0,v=x-E|0,(E|0)<0?(h[q>>2]=_,h[j>>2]=v,h[X>>2]=0,E=0,x=v):_=M,b=E-_|0,v=x-_|0,(_|0)<0?(h[X>>2]=b,h[j>>2]=v,h[q>>2]=0,E=b,_=0):v=x,b=E-v|0,x=_-v|0,(v|0)<0?(h[X>>2]=b,h[q>>2]=x,h[j>>2]=0,v=0):(x=_,b=E),_=(x|0)<(b|0)?x:b,_=(v|0)<(_|0)?v:_,(_|0)>0&&(h[X>>2]=b-_,h[q>>2]=x-_,h[j>>2]=v-_),_c(h[m>>2]|0)|0&&(x=h[X>>2]|0,b=h[q>>2]|0,v=h[j>>2]|0,_=(b*3|0)+x|0,x=v+(x*3|0)|0,h[X>>2]=x,h[q>>2]=_,b=(v*3|0)+b|0,h[j>>2]=b,v=_-x|0,E=b-x|0,(x|0)<0?(h[q>>2]=v,h[j>>2]=E,h[X>>2]=0,_=v,M=0):(M=x,E=b),x=M-_|0,v=E-_|0,(_|0)<0?(h[X>>2]=x,h[j>>2]=v,h[q>>2]=0,M=x,b=0):(b=_,v=E),x=M-v|0,_=b-v|0,(v|0)<0?(h[X>>2]=x,h[q>>2]=_,h[j>>2]=0,b=_,v=0):x=M,_=(b|0)<(x|0)?b:x,_=(v|0)<(_|0)?v:_,(_|0)>0&&(h[X>>2]=x-_,h[q>>2]=b-_,h[j>>2]=v-_),h[m>>2]=(h[m>>2]|0)+1),h[g>>2]=h[p>>2],v=h[q>>2]|0,_=h[j>>2]|0,m=h[U+4>>2]|0,N=h[U+8>>2]|0,b=(h[U>>2]|0)+(h[X>>2]|0)|0,M=g+4|0,h[M>>2]=b,v=m+v|0,m=g+8|0,h[m>>2]=v,_=N+_|0,N=g+12|0,h[N>>2]=_,x=v-b|0,(b|0)<0&&(_=_-b|0,h[m>>2]=x,h[N>>2]=_,h[M>>2]=0,v=x,b=0),(v|0)<0&&(b=b-v|0,h[M>>2]=b,_=_-v|0,h[N>>2]=_,h[m>>2]=0,v=0),E=b-_|0,x=v-_|0,(_|0)<0?(h[M>>2]=E,h[m>>2]=x,h[N>>2]=0,b=E,_=0):x=v,v=(x|0)<(b|0)?x:b,v=(_|0)<(v|0)?_:v,(v|0)>0&&(h[M>>2]=b-v,h[m>>2]=x-v,h[N>>2]=_-v),h[g+16>>2]=h[p>>2],v=h[q>>2]|0,_=h[j>>2]|0,m=h[U+16>>2]|0,N=h[U+20>>2]|0,b=(h[U+12>>2]|0)+(h[X>>2]|0)|0,M=g+20|0,h[M>>2]=b,v=m+v|0,m=g+24|0,h[m>>2]=v,_=N+_|0,N=g+28|0,h[N>>2]=_,x=v-b|0,(b|0)<0&&(_=_-b|0,h[m>>2]=x,h[N>>2]=_,h[M>>2]=0,v=x,b=0),(v|0)<0&&(b=b-v|0,h[M>>2]=b,_=_-v|0,h[N>>2]=_,h[m>>2]=0,v=0),E=b-_|0,x=v-_|0,(_|0)<0?(h[M>>2]=E,h[m>>2]=x,h[N>>2]=0,b=E,_=0):x=v,v=(x|0)<(b|0)?x:b,v=(_|0)<(v|0)?_:v,(v|0)>0&&(h[M>>2]=b-v,h[m>>2]=x-v,h[N>>2]=_-v),h[g+32>>2]=h[p>>2],v=h[q>>2]|0,_=h[j>>2]|0,m=h[U+28>>2]|0,N=h[U+32>>2]|0,b=(h[U+24>>2]|0)+(h[X>>2]|0)|0,M=g+36|0,h[M>>2]=b,v=m+v|0,m=g+40|0,h[m>>2]=v,_=N+_|0,N=g+44|0,h[N>>2]=_,x=v-b|0,(b|0)<0&&(_=_-b|0,h[m>>2]=x,h[N>>2]=_,h[M>>2]=0,v=x,b=0),(v|0)<0&&(b=b-v|0,h[M>>2]=b,_=_-v|0,h[N>>2]=_,h[m>>2]=0,v=0),E=b-_|0,x=v-_|0,(_|0)<0?(h[M>>2]=E,h[m>>2]=x,h[N>>2]=0,b=E,_=0):x=v,v=(x|0)<(b|0)?x:b,v=(_|0)<(v|0)?_:v,(v|0)>0&&(h[M>>2]=b-v,h[m>>2]=x-v,h[N>>2]=_-v),h[g+48>>2]=h[p>>2],v=h[q>>2]|0,_=h[j>>2]|0,m=h[U+40>>2]|0,N=h[U+44>>2]|0,b=(h[U+36>>2]|0)+(h[X>>2]|0)|0,M=g+52|0,h[M>>2]=b,v=m+v|0,m=g+56|0,h[m>>2]=v,_=N+_|0,N=g+60|0,h[N>>2]=_,x=v-b|0,(b|0)<0&&(_=_-b|0,h[m>>2]=x,h[N>>2]=_,h[M>>2]=0,v=x,b=0),(v|0)<0&&(b=b-v|0,h[M>>2]=b,_=_-v|0,h[N>>2]=_,h[m>>2]=0,v=0),E=b-_|0,x=v-_|0,(_|0)<0?(h[M>>2]=E,h[m>>2]=x,h[N>>2]=0,b=E,_=0):x=v,v=(x|0)<(b|0)?x:b,v=(_|0)<(v|0)?_:v,(v|0)>0&&(h[M>>2]=b-v,h[m>>2]=x-v,h[N>>2]=_-v),h[g+64>>2]=h[p>>2],x=h[q>>2]|0,_=h[j>>2]|0,N=h[U+52>>2]|0,M=h[U+56>>2]|0,b=(h[U+48>>2]|0)+(h[X>>2]|0)|0,m=g+68|0,h[m>>2]=b,x=N+x|0,N=g+72|0,h[N>>2]=x,_=M+_|0,M=g+76|0,h[M>>2]=_,v=x-b|0,(b|0)<0?(_=_-b|0,h[N>>2]=v,h[M>>2]=_,h[m>>2]=0,x=0):(v=x,x=b),(v|0)<0&&(x=x-v|0,h[m>>2]=x,_=_-v|0,h[M>>2]=_,h[N>>2]=0,v=0),E=x-_|0,b=v-_|0,(_|0)<0?(h[m>>2]=E,h[N>>2]=b,h[M>>2]=0,x=E,_=0):b=v,v=(b|0)<(x|0)?b:x,v=(_|0)<(v|0)?_:v,(v|0)<=0){Q=K;return}h[m>>2]=x-v,h[N>>2]=b-v,h[M>>2]=_-v,Q=K}function y1(p,m,g,_){p=p|0,m=m|0,g=g|0,_=_|0;var v=0,x=0,b=0,E=0,M=0,N=0,U=0,q=0,j=0,X=0,K=0,ae=0,ue=0,xe=0;if(j=h[16928+(m<<2)>>2]|0,q=(_|0)!=0,j=q?j*3|0:j,U=p+4|0,E=h[U>>2]|0,N=p+8|0,x=h[N>>2]|0,q){if(b=p+12|0,_=h[b>>2]|0,v=x+E+_|0,(v|0)==(j|0))return j=1,j|0;M=b}else M=p+12|0,v=h[M>>2]|0,_=v,v=x+E+v|0;if((v|0)<=(j|0))return j=0,j|0;do if((_|0)>0){if(v=h[p>>2]|0,(x|0)>0){v=18608+(v*80|0)+60|0,b=E;break}v=18608+(v*80|0)+40|0,g?(b=E-j|0,g=x+b|0,X=(g|0)<0,x=_+x-(X?g:0)|0,E=(x|0)<0,_=_+b-(X?g:0)-(E?x:0)|0,b=(_|0)<0,g=(X?0:g)-(E?x:0)-(b?_:0)|0,x=(E?0:x)-(b?_:0)|0,_=b?0:_,b=(x|0)<(g|0)?x:g,b=(_|0)<(b|0)?_:b,E=(b|0)>0,x=x-(E?b:0)|0,_=_-(E?b:0)|0,b=g-(E?b:0)+j|0,h[U>>2]=b,h[N>>2]=x,h[M>>2]=_):b=E}else v=18608+((h[p>>2]|0)*80|0)+20|0,b=E;while(!1);if(h[p>>2]=h[v>>2],E=h[v+16>>2]|0,(E|0)>0){g=0;do X=_+b|0,K=(X|0)<0,xe=K?X:0,ae=x+b-xe|0,ue=(ae|0)<0,p=ue?ae:0,b=_+x-xe-p|0,x=(b|0)<0,_=x?0:b,b=x?b:0,x=(ue?0:ae)-b|0,b=(K?0:X)-p-b|0,p=(x|0)<(b|0)?x:b,p=(_|0)<(p|0)?_:p,(p|0)>0&&(b=b-p|0,x=x-p|0,_=_-p|0),g=g+1|0;while((g|0)<(E|0));h[U>>2]=b,h[N>>2]=x,h[M>>2]=_}return ae=h[16848+(m<<2)>>2]|0,ae=q?ae*3|0:ae,ue=al(ae,h[v+8>>2]|0)|0,xe=al(ae,h[v+12>>2]|0)|0,b=(al(ae,h[v+4>>2]|0)|0)+b|0,h[U>>2]=b,x=ue+x|0,h[N>>2]=x,_=xe+_|0,h[M>>2]=_,v=x-b|0,(b|0)<0?(_=_-b|0,h[N>>2]=v,h[M>>2]=_,h[U>>2]=0,x=0):(v=x,x=b),(v|0)<0?(p=x-v|0,h[U>>2]=p,_=_-v|0,h[M>>2]=_,h[N>>2]=0,b=0):(p=x,b=v),x=p-_|0,v=b-_|0,(_|0)<0?(h[U>>2]=x,h[N>>2]=v,h[M>>2]=0,_=0):(v=b,x=p),b=(v|0)<(x|0)?v:x,b=(_|0)<(b|0)?_:b,(b|0)>0&&(x=x-b|0,v=v-b|0,_=_-b|0,h[U>>2]=x,h[N>>2]=v,h[M>>2]=_),q?(xe=(v+x+_|0)==(j|0)?1:2,xe|0):(xe=2,xe|0)}function hue(p,m){p=p|0,m=m|0;var g=0;do g=y1(p,m,0,1)|0;while((g|0)==2);return g|0}function cL(p,m,g,_,v){p=p|0,m=m|0,g=g|0,_=_|0,v=v|0;var x=0,b=0,E=0,M=0,N=0,U=0,q=0,j=0,X=0,K=0,ae=0,ue=0,xe=0,se=0,we=0,Ae=0,Be=0,Ke=0,Me=0,be=0,gt=0,je=0,Ut=0,lt=0,pt=0,pi=0,bi=0,Ro=0,Vn=0,wi=0,Ma=0,Ns=0,as=0,Fs=0,ws=0;if(Ns=Q,Q=Q+272|0,x=Ns+256|0,b=Ns+240|0,Vn=Ns,wi=Ns+224|0,Ma=Ns+208|0,je=Ns+184|0,Ut=Ns+168|0,lt=Ns+152|0,pt=Ns+136|0,pi=Ns+120|0,bi=Ns+96|0,h[x>>2]=m,h[b>>2]=h[p>>2],h[b+4>>2]=h[p+4>>2],h[b+8>>2]=h[p+8>>2],h[b+12>>2]=h[p+12>>2],dq(b,x,Vn),h[v>>2]=0,gt=_+g+((_|0)==6&1)|0,(gt|0)<=(g|0)){Q=Ns;return}xe=h[x>>2]|0,se=g+6|0,we=Ma+8|0,Ae=je+8|0,Be=16928+(xe<<2)|0,Ke=Ut+8|0,Me=lt+8|0,be=pt+8|0,ae=h[b>>2]|0,j=wi+4|0,X=wi+8|0,K=wi+12|0,ue=Ma+8|0,M=je+8|0,U=je+16|0,N=bi+8|0,q=bi+16|0,b=0,E=g,_=-1;e:for(;;){if(x=(E|0)%6|0,p=Vn+(x<<4)|0,h[wi>>2]=h[p>>2],h[wi+4>>2]=h[p+4>>2],h[wi+8>>2]=h[p+8>>2],h[wi+12>>2]=h[p+12>>2],p=b,b=y1(wi,xe,0,1)|0,(E|0)>(g|0)&(_c(m)|0)!=0&&(Ro=h[wi>>2]|0,(p|0)!=1&(Ro|0)!=(_|0))){switch(ws=(x+5|0)%6|0,p=h[Vn+(ws<<4)+12>>2]|0,as=+((h[Vn+(ws<<4)+8>>2]|0)-p|0),ie[Ma>>3]=+((h[Vn+(ws<<4)+4>>2]|0)-p|0)-as*.5,ie[we>>3]=as*.8660254037844386,p=h[Vn+(x<<4)+12>>2]|0,as=+((h[Vn+(x<<4)+8>>2]|0)-p|0),ie[je>>3]=+((h[Vn+(x<<4)+4>>2]|0)-p|0)-as*.5,ie[Ae>>3]=as*.8660254037844386,as=+(h[Be>>2]|0),ie[Ut>>3]=as*3,ie[Ke>>3]=0,Fs=as*-1.5,ie[lt>>3]=Fs,ie[Me>>3]=as*2.598076211353316,ie[pt>>3]=Fs,ie[be>>3]=as*-2.598076211353316,h[17008+(ae*80|0)+(((_|0)==(ae|0)?Ro:_)<<2)>>2]|0){case 1:{p=lt,_=Ut;break}case 3:{p=pt,_=lt;break}case 2:{p=Ut,_=pt;break}default:{p=8;break e}}Eq(Ma,je,_,p,pi),!(Mq(Ma,pi)|0)&&!(Mq(je,pi)|0)&&(Wx(pi,ae,xe,1,bi),ws=h[v>>2]|0,as=+qx(+ +ie[q>>3]),Fs=+Ta(+ +ie[N>>3],+ +ie[bi>>3]),ie[v+8+(ws<<4)>>3]=as,ie[v+8+(ws<<4)+8>>3]=Fs,h[v>>2]=(h[v>>2]|0)+1)}if((E|0)<(se|0)&&(ws=h[K>>2]|0,as=+((h[X>>2]|0)-ws|0),ie[Ma>>3]=+((h[j>>2]|0)-ws|0)-as*.5,ie[ue>>3]=as*.8660254037844386,Wx(Ma,h[wi>>2]|0,xe,1,je),ws=h[v>>2]|0,as=+qx(+ +ie[U>>3]),Fs=+Ta(+ +ie[M>>3],+ +ie[je>>3]),ie[v+8+(ws<<4)>>3]=as,ie[v+8+(ws<<4)+8>>3]=Fs,h[v>>2]=(h[v>>2]|0)+1),E=E+1|0,(E|0)>=(gt|0)){p=3;break}else _=h[wi>>2]|0}if((p|0)==3){Q=Ns;return}else(p|0)==8&&di(27157,27120,766,27202)}function dq(p,m,g){p=p|0,m=m|0,g=g|0;var _=0,v=0,x=0,b=0,E=0,M=0,N=0,U=0,q=0,j=0,X=0,K=0,ae=0;ae=Q,Q=Q+160|0,_=ae+80|0,v=ae,x=_,b=20336,E=x+72|0;do h[x>>2]=h[b>>2],x=x+4|0,b=b+4|0;while((x|0)<(E|0));x=v,b=20416,E=x+72|0;do h[x>>2]=h[b>>2],x=x+4|0,b=b+4|0;while((x|0)<(E|0));q=(_c(h[m>>2]|0)|0)==0,q=q?_:v,K=p+4|0,x=h[K>>2]|0,j=p+8|0,_=h[j>>2]|0,X=p+12|0,v=h[X>>2]|0,b=_+(x<<1)|0,h[K>>2]=b,_=v+(_<<1)|0,h[j>>2]=_,x=(v<<1)+x|0,h[X>>2]=x,v=_-b|0,E=x-b|0,(b|0)<0&&(h[j>>2]=v,h[X>>2]=E,h[K>>2]=0,_=v,b=0,x=E),E=b-_|0,v=x-_|0,(_|0)<0?(h[K>>2]=E,h[X>>2]=v,h[j>>2]=0,_=0):(v=x,E=b),b=E-v|0,x=_-v|0,(v|0)<0?(h[K>>2]=b,h[j>>2]=x,h[X>>2]=0,v=0):(x=_,b=E),_=(x|0)<(b|0)?x:b,_=(v|0)<(_|0)?v:_,(_|0)>0&&(v=v-_|0,x=x-_|0,b=b-_|0,h[K>>2]=b,h[j>>2]=x,h[X>>2]=v),M=(x<<1)+b|0,E=v+(b<<1)|0,h[K>>2]=E,h[j>>2]=M,x=(v<<1)+x|0,h[X>>2]=x,_=M-E|0,v=x-E|0,(E|0)<0?(h[j>>2]=_,h[X>>2]=v,h[K>>2]=0,E=0,x=v):_=M,b=E-_|0,v=x-_|0,(_|0)<0?(h[K>>2]=b,h[X>>2]=v,h[j>>2]=0,E=b,_=0):v=x,b=E-v|0,x=_-v|0,(v|0)<0?(h[K>>2]=b,h[j>>2]=x,h[X>>2]=0,v=0):(x=_,b=E),_=(x|0)<(b|0)?x:b,_=(v|0)<(_|0)?v:_,(_|0)>0&&(h[K>>2]=b-_,h[j>>2]=x-_,h[X>>2]=v-_),_c(h[m>>2]|0)|0&&(x=h[K>>2]|0,b=h[j>>2]|0,v=h[X>>2]|0,_=(b*3|0)+x|0,x=v+(x*3|0)|0,h[K>>2]=x,h[j>>2]=_,b=(v*3|0)+b|0,h[X>>2]=b,v=_-x|0,E=b-x|0,(x|0)<0?(h[j>>2]=v,h[X>>2]=E,h[K>>2]=0,_=v,M=0):(M=x,E=b),x=M-_|0,v=E-_|0,(_|0)<0?(h[K>>2]=x,h[X>>2]=v,h[j>>2]=0,M=x,b=0):(b=_,v=E),x=M-v|0,_=b-v|0,(v|0)<0?(h[K>>2]=x,h[j>>2]=_,h[X>>2]=0,b=_,v=0):x=M,_=(b|0)<(x|0)?b:x,_=(v|0)<(_|0)?v:_,(_|0)>0&&(h[K>>2]=x-_,h[j>>2]=b-_,h[X>>2]=v-_),h[m>>2]=(h[m>>2]|0)+1),M=0;do h[g+(M<<4)>>2]=h[p>>2],v=h[j>>2]|0,_=h[X>>2]|0,N=h[q+(M*12|0)+4>>2]|0,U=h[q+(M*12|0)+8>>2]|0,b=(h[q+(M*12|0)>>2]|0)+(h[K>>2]|0)|0,m=g+(M<<4)+4|0,h[m>>2]=b,v=N+v|0,N=g+(M<<4)+8|0,h[N>>2]=v,_=U+_|0,U=g+(M<<4)+12|0,h[U>>2]=_,x=v-b|0,(b|0)<0&&(_=_-b|0,h[N>>2]=x,h[U>>2]=_,h[m>>2]=0,v=x,b=0),(v|0)<0&&(b=b-v|0,h[m>>2]=b,_=_-v|0,h[U>>2]=_,h[N>>2]=0,v=0),E=b-_|0,x=v-_|0,(_|0)<0?(h[m>>2]=E,h[N>>2]=x,h[U>>2]=0,b=E,_=0):x=v,v=(x|0)<(b|0)?x:b,v=(_|0)<(v|0)?_:v,(v|0)>0&&(h[m>>2]=b-v,h[N>>2]=x-v,h[U>>2]=_-v),M=M+1|0;while((M|0)!=6);Q=ae}function uL(p,m){return p=p|0,m=m|0,m=tt(p|0,m|0,52)|0,ee()|0,m&15|0}function pq(p,m){return p=p|0,m=m|0,m=tt(p|0,m|0,45)|0,ee()|0,m&127|0}function fue(p,m,g,_){return p=p|0,m=m|0,g=g|0,_=_|0,(g+-1|0)>>>0>14?(_=4,_|0):(g=tt(p|0,m|0,(15-g|0)*3|0)|0,ee()|0,h[_>>2]=g&7,_=0,_|0)}function due(p,m,g,_){p=p|0,m=m|0,g=g|0,_=_|0;var v=0,x=0,b=0,E=0,M=0,N=0;if(p>>>0>15)return _=4,_|0;if(m>>>0>121)return _=17,_|0;b=ft(p|0,0,52)|0,v=ee()|0,E=ft(m|0,0,45)|0,v=v|(ee()|0)|134225919;e:do if((p|0)>=1){for(E=1,b=(He[20496+m>>0]|0)!=0,x=-1;;){if(m=h[g+(E+-1<<2)>>2]|0,m>>>0>6){v=18,m=10;break}if(!((m|0)==0|b^1))if((m|0)==1){v=19,m=10;break}else b=0;if(N=(15-E|0)*3|0,M=ft(7,0,N|0)|0,v=v&~(ee()|0),m=ft(m|0,((m|0)<0)<<31>>31|0,N|0)|0,x=m|x&~M,v=ee()|0|v,(E|0)<(p|0))E=E+1|0;else break e}if((m|0)==10)return v|0}else x=-1;while(!1);return N=_,h[N>>2]=x,h[N+4>>2]=v,N=0,N|0}function oT(p,m){p=p|0,m=m|0;var g=0,_=0,v=0,x=0,b=0;return!(!0&(m&-16777216|0)==134217728)||(_=tt(p|0,m|0,52)|0,ee()|0,_=_&15,g=tt(p|0,m|0,45)|0,ee()|0,g=g&127,g>>>0>121)?(p=0,p|0):(b=(_^15)*3|0,v=tt(p|0,m|0,b|0)|0,b=ft(v|0,ee()|0,b|0)|0,v=ee()|0,x=Js(-1227133514,-1171,b|0,v|0)|0,!((b&613566756&x|0)==0&(v&4681&(ee()|0)|0)==0)||(b=(_*3|0)+19|0,x=ft(~p|0,~m|0,b|0)|0,b=tt(x|0,ee()|0,b|0)|0,!((_|0)==15|(b|0)==0&(ee()|0)==0))?(b=0,b|0):!(He[20496+g>>0]|0)||(m=m&8191,(p|0)==0&(m|0)==0)?(b=1,b|0):(b=EL(p|0,m|0,0)|0,ee()|0,((63-b|0)%3|0|0)!=0|0))}function pue(p,m){p=p|0,m=m|0;var g=0,_=0,v=0,x=0,b=0;return!0&(m&-16777216|0)==134217728&&(_=tt(p|0,m|0,52)|0,ee()|0,_=_&15,g=tt(p|0,m|0,45)|0,ee()|0,g=g&127,g>>>0<=121)&&(b=(_^15)*3|0,v=tt(p|0,m|0,b|0)|0,b=ft(v|0,ee()|0,b|0)|0,v=ee()|0,x=Js(-1227133514,-1171,b|0,v|0)|0,(b&613566756&x|0)==0&(v&4681&(ee()|0)|0)==0)&&(b=(_*3|0)+19|0,x=ft(~p|0,~m|0,b|0)|0,b=tt(x|0,ee()|0,b|0)|0,(_|0)==15|(b|0)==0&(ee()|0)==0)&&(!(He[20496+g>>0]|0)||(g=m&8191,(p|0)==0&(g|0)==0)||(b=EL(p|0,g|0,0)|0,ee()|0,(63-b|0)%3|0|0))||uq(p,m)|0?(b=1,b|0):(b=(Cq(p,m)|0)!=0&1,b|0)}function hL(p,m,g,_){p=p|0,m=m|0,g=g|0,_=_|0;var v=0,x=0,b=0,E=0;if(v=ft(m|0,0,52)|0,x=ee()|0,g=ft(g|0,0,45)|0,g=x|(ee()|0)|134225919,(m|0)<1){x=-1,_=g,m=p,h[m>>2]=x,p=p+4|0,h[p>>2]=_;return}for(x=1,v=-1;b=(15-x|0)*3|0,E=ft(7,0,b|0)|0,g=g&~(ee()|0),b=ft(_|0,0,b|0)|0,v=v&~E|b,g=g|(ee()|0),(x|0)!=(m|0);)x=x+1|0;E=p,b=E,h[b>>2]=v,E=E+4|0,h[E>>2]=g}function fL(p,m,g,_){p=p|0,m=m|0,g=g|0,_=_|0;var v=0,x=0;if(x=tt(p|0,m|0,52)|0,ee()|0,x=x&15,g>>>0>15)return _=4,_|0;if((x|0)<(g|0))return _=12,_|0;if((x|0)==(g|0))return h[_>>2]=p,h[_+4>>2]=m,_=0,_|0;if(v=ft(g|0,0,52)|0,v=v|p,p=ee()|0|m&-15728641,(x|0)>(g|0))do m=ft(7,0,(14-g|0)*3|0)|0,g=g+1|0,v=m|v,p=ee()|0|p;while((g|0)<(x|0));return h[_>>2]=v,h[_+4>>2]=p,_=0,_|0}function jx(p,m,g,_){p=p|0,m=m|0,g=g|0,_=_|0;var v=0,x=0,b=0;if(x=tt(p|0,m|0,52)|0,ee()|0,x=x&15,!((g|0)<16&(x|0)<=(g|0)))return _=4,_|0;v=g-x|0,g=tt(p|0,m|0,45)|0,ee()|0;e:do if(!(yr(g&127)|0))g=sp(7,0,v,((v|0)<0)<<31>>31)|0,v=ee()|0;else{t:do if(x|0){for(g=1;b=ft(7,0,(15-g|0)*3|0)|0,!!((b&p|0)==0&((ee()|0)&m|0)==0);)if(g>>>0<x>>>0)g=g+1|0;else break t;g=sp(7,0,v,((v|0)<0)<<31>>31)|0,v=ee()|0;break e}while(!1);g=sp(7,0,v,((v|0)<0)<<31>>31)|0,g=wr(g|0,ee()|0,5,0)|0,g=At(g|0,ee()|0,-5,-1)|0,g=op(g|0,ee()|0,6,0)|0,g=At(g|0,ee()|0,1,0)|0,v=ee()|0}while(!1);return b=_,h[b>>2]=g,h[b+4>>2]=v,b=0,b|0}function Zi(p,m){p=p|0,m=m|0;var g=0,_=0,v=0;if(v=tt(p|0,m|0,45)|0,ee()|0,!(yr(v&127)|0))return v=0,v|0;v=tt(p|0,m|0,52)|0,ee()|0,v=v&15;e:do if(!v)g=0;else for(_=1;;){if(g=tt(p|0,m|0,(15-_|0)*3|0)|0,ee()|0,g=g&7,g|0)break e;if(_>>>0<v>>>0)_=_+1|0;else{g=0;break}}while(!1);return v=(g|0)==0&1,v|0}function mue(p,m,g,_){p=p|0,m=m|0,g=g|0,_=_|0;var v=0,x=0,b=0,E=0;if(b=Q,Q=Q+16|0,x=b,vL(x,p,m,g),m=x,p=h[m>>2]|0,m=h[m+4>>2]|0,(p|0)==0&(m|0)==0)return Q=b,0;v=0,g=0;do E=_+(v<<3)|0,h[E>>2]=p,h[E+4>>2]=m,v=At(v|0,g|0,1,0)|0,g=ee()|0,_L(x),E=x,p=h[E>>2]|0,m=h[E+4>>2]|0;while(!((p|0)==0&(m|0)==0));return Q=b,0}function mq(p,m,g,_){return p=p|0,m=m|0,g=g|0,_=_|0,(_|0)<(g|0)?(g=m,_=p,On(g|0),_|0):(g=ft(-1,-1,((_-g|0)*3|0)+3|0)|0,_=ft(~g|0,~(ee()|0)|0,(15-_|0)*3|0)|0,g=~(ee()|0)&m,_=~_&p,On(g|0),_|0)}function Aq(p,m,g,_){p=p|0,m=m|0,g=g|0,_=_|0;var v=0;return v=tt(p|0,m|0,52)|0,ee()|0,v=v&15,(g|0)<16&(v|0)<=(g|0)?((v|0)<(g|0)&&(v=ft(-1,-1,((g+-1-v|0)*3|0)+3|0)|0,v=ft(~v|0,~(ee()|0)|0,(15-g|0)*3|0)|0,m=~(ee()|0)&m,p=~v&p),v=ft(g|0,0,52)|0,g=m&-15728641|(ee()|0),h[_>>2]=p|v,h[_+4>>2]=g,_=0,_|0):(_=4,_|0)}function Aue(p,m,g,_){p=p|0,m=m|0,g=g|0,_=_|0;var v=0,x=0,b=0,E=0,M=0,N=0,U=0,q=0,j=0,X=0,K=0,ae=0,ue=0,xe=0,se=0,we=0,Ae=0,Be=0,Ke=0,Me=0,be=0,gt=0,je=0,Ut=0,lt=0,pt=0;if((g|0)==0&(_|0)==0)return pt=0,pt|0;if(v=p,x=h[v>>2]|0,v=h[v+4>>2]|0,!0&(v&15728640|0)==0){if(!((_|0)>0|(_|0)==0&g>>>0>0)||(pt=m,h[pt>>2]=x,h[pt+4>>2]=v,(g|0)==1&(_|0)==0))return pt=0,pt|0;v=1,x=0;do Ut=p+(v<<3)|0,lt=h[Ut+4>>2]|0,pt=m+(v<<3)|0,h[pt>>2]=h[Ut>>2],h[pt+4>>2]=lt,v=At(v|0,x|0,1,0)|0,x=ee()|0;while((x|0)<(_|0)|(x|0)==(_|0)&v>>>0<g>>>0);return v=0,v|0}if(je=g<<3,lt=br(je)|0,!lt)return pt=13,pt|0;if(cu(lt|0,p|0,je|0)|0,Ut=Ea(g,8)|0,!Ut)return _t(lt),pt=13,pt|0;e:for(;;){v=lt,N=h[v>>2]|0,v=h[v+4>>2]|0,be=tt(N|0,v|0,52)|0,ee()|0,be=be&15,gt=be+-1|0,Me=(be|0)!=0,Ke=(_|0)>0|(_|0)==0&g>>>0>0;t:do if(Me&Ke){if(se=ft(gt|0,0,52)|0,we=ee()|0,gt>>>0>15){if(!((N|0)==0&(v|0)==0)){pt=16;break e}for(x=0,p=0;;){if(x=At(x|0,p|0,1,0)|0,p=ee()|0,!((p|0)<(_|0)|(p|0)==(_|0)&x>>>0<g>>>0))break t;if(b=lt+(x<<3)|0,Be=h[b>>2]|0,b=h[b+4>>2]|0,!((Be|0)==0&(b|0)==0)){v=b,pt=16;break e}}}for(E=N,p=v,x=0,b=0;;){if(!((E|0)==0&(p|0)==0)){if(!(!0&(p&117440512|0)==0)){pt=21;break e}if(U=tt(E|0,p|0,52)|0,ee()|0,U=U&15,(U|0)<(gt|0)){v=12,pt=27;break e}if((U|0)!=(gt|0)&&(E=E|se,p=p&-15728641|we,U>>>0>=be>>>0)){M=gt;do Be=ft(7,0,(14-M|0)*3|0)|0,M=M+1|0,E=Be|E,p=ee()|0|p;while(M>>>0<U>>>0)}if(j=qf(E|0,p|0,g|0,_|0)|0,X=ee()|0,M=Ut+(j<<3)|0,U=M,q=h[U>>2]|0,U=h[U+4>>2]|0,!((q|0)==0&(U|0)==0)){ue=0,xe=0;do{if((ue|0)>(_|0)|(ue|0)==(_|0)&xe>>>0>g>>>0){pt=31;break e}if((q|0)==(E|0)&(U&-117440513|0)==(p|0)){K=tt(q|0,U|0,56)|0,ee()|0,K=K&7,ae=K+1|0,Be=tt(q|0,U|0,45)|0,ee()|0;n:do if(!(yr(Be&127)|0))U=7;else{if(q=tt(q|0,U|0,52)|0,ee()|0,q=q&15,!q){U=6;break}for(U=1;;){if(Be=ft(7,0,(15-U|0)*3|0)|0,!((Be&E|0)==0&((ee()|0)&p|0)==0)){U=7;break n}if(U>>>0<q>>>0)U=U+1|0;else{U=6;break}}}while(!1);if((K+2|0)>>>0>U>>>0){pt=41;break e}Be=ft(ae|0,0,56)|0,p=ee()|0|p&-117440513,Ae=M,h[Ae>>2]=0,h[Ae+4>>2]=0,E=Be|E}else j=At(j|0,X|0,1,0)|0,j=ap(j|0,ee()|0,g|0,_|0)|0,X=ee()|0;xe=At(xe|0,ue|0,1,0)|0,ue=ee()|0,M=Ut+(j<<3)|0,U=M,q=h[U>>2]|0,U=h[U+4>>2]|0}while(!((q|0)==0&(U|0)==0))}Be=M,h[Be>>2]=E,h[Be+4>>2]=p}if(x=At(x|0,b|0,1,0)|0,b=ee()|0,!((b|0)<(_|0)|(b|0)==(_|0)&x>>>0<g>>>0))break t;p=lt+(x<<3)|0,E=h[p>>2]|0,p=h[p+4>>2]|0}}while(!1);if(Be=At(g|0,_|0,5,0)|0,Ae=ee()|0,Ae>>>0<0|(Ae|0)==0&Be>>>0<11){pt=85;break}if(Be=op(g|0,_|0,6,0)|0,ee()|0,Be=Ea(Be,8)|0,!Be){pt=48;break}do if(Ke){for(ae=0,p=0,K=0,ue=0;;){if(U=Ut+(ae<<3)|0,b=U,x=h[b>>2]|0,b=h[b+4>>2]|0,(x|0)==0&(b|0)==0)Ae=K;else{q=tt(x|0,b|0,56)|0,ee()|0,q=q&7,E=q+1|0,j=b&-117440513,Ae=tt(x|0,b|0,45)|0,ee()|0;t:do if(yr(Ae&127)|0){if(X=tt(x|0,b|0,52)|0,ee()|0,X=X&15,X|0)for(M=1;;){if(Ae=ft(7,0,(15-M|0)*3|0)|0,!((x&Ae|0)==0&(j&(ee()|0)|0)==0))break t;if(M>>>0<X>>>0)M=M+1|0;else break}b=ft(E|0,0,56)|0,x=b|x,b=ee()|0|j,E=U,h[E>>2]=x,h[E+4>>2]=b,E=q+2|0}while(!1);(E|0)==7?(Ae=Be+(p<<3)|0,h[Ae>>2]=x,h[Ae+4>>2]=b&-117440513,p=At(p|0,K|0,1,0)|0,Ae=ee()|0):Ae=K}if(ae=At(ae|0,ue|0,1,0)|0,ue=ee()|0,(ue|0)<(_|0)|(ue|0)==(_|0)&ae>>>0<g>>>0)K=Ae;else break}if(Ke){if(xe=gt>>>0>15,se=ft(gt|0,0,52)|0,we=ee()|0,!Me){for(x=0,M=0,E=0,b=0;(N|0)==0&(v|0)==0||(gt=m+(x<<3)|0,h[gt>>2]=N,h[gt+4>>2]=v,x=At(x|0,M|0,1,0)|0,M=ee()|0),E=At(E|0,b|0,1,0)|0,b=ee()|0,!!((b|0)<(_|0)|(b|0)==(_|0)&E>>>0<g>>>0);)v=lt+(E<<3)|0,N=h[v>>2]|0,v=h[v+4>>2]|0;v=Ae;break}for(x=0,M=0,b=0,E=0;;){do if(!((N|0)==0&(v|0)==0)){if(X=tt(N|0,v|0,52)|0,ee()|0,X=X&15,xe|(X|0)<(gt|0)){pt=80;break e}if((X|0)!=(gt|0)){if(U=N|se,q=v&-15728641|we,X>>>0>=be>>>0){j=gt;do Me=ft(7,0,(14-j|0)*3|0)|0,j=j+1|0,U=Me|U,q=ee()|0|q;while(j>>>0<X>>>0)}}else U=N,q=v;K=qf(U|0,q|0,g|0,_|0)|0,j=0,X=0,ue=ee()|0;do{if((j|0)>(_|0)|(j|0)==(_|0)&X>>>0>g>>>0){pt=81;break e}if(Me=Ut+(K<<3)|0,ae=h[Me+4>>2]|0,(ae&-117440513|0)==(q|0)&&(h[Me>>2]|0)==(U|0)){pt=65;break}Me=At(K|0,ue|0,1,0)|0,K=ap(Me|0,ee()|0,g|0,_|0)|0,ue=ee()|0,X=At(X|0,j|0,1,0)|0,j=ee()|0,Me=Ut+(K<<3)|0}while(!((h[Me>>2]|0)==(U|0)&&(h[Me+4>>2]|0)==(q|0)));if((pt|0)==65&&(pt=0,!0&(ae&117440512|0)==100663296))break;Me=m+(x<<3)|0,h[Me>>2]=N,h[Me+4>>2]=v,x=At(x|0,M|0,1,0)|0,M=ee()|0}while(!1);if(b=At(b|0,E|0,1,0)|0,E=ee()|0,!((E|0)<(_|0)|(E|0)==(_|0)&b>>>0<g>>>0))break;v=lt+(b<<3)|0,N=h[v>>2]|0,v=h[v+4>>2]|0}v=Ae}else x=0,v=Ae}else x=0,p=0,v=0;while(!1);if(lp(Ut|0,0,je|0)|0,cu(lt|0,Be|0,p<<3|0)|0,_t(Be),(p|0)==0&(v|0)==0){pt=89;break}else m=m+(x<<3)|0,_=v,g=p}if((pt|0)==16)!0&(v&117440512|0)==0?(v=4,pt=27):pt=21;else if((pt|0)==31)di(27634,27225,620,27235);else{if((pt|0)==41)return _t(lt),_t(Ut),pt=10,pt|0;if((pt|0)==48)return _t(lt),_t(Ut),pt=13,pt|0;(pt|0)==80?di(27634,27225,711,27235):(pt|0)==81?di(27634,27225,723,27235):(pt|0)==85&&(cu(m|0,lt|0,g<<3|0)|0,pt=89)}return(pt|0)==21?(_t(lt),_t(Ut),pt=5,pt|0):(pt|0)==27?(_t(lt),_t(Ut),pt=v,pt|0):(pt|0)==89?(_t(lt),_t(Ut),pt=0,pt|0):0}function gue(p,m,g,_,v,x,b){p=p|0,m=m|0,g=g|0,_=_|0,v=v|0,x=x|0,b=b|0;var E=0,M=0,N=0,U=0,q=0,j=0,X=0,K=0,ae=0;if(ae=Q,Q=Q+16|0,K=ae,!((g|0)>0|(g|0)==0&m>>>0>0))return K=0,Q=ae,K|0;if((b|0)>=16)return K=12,Q=ae,K|0;j=0,X=0,q=0,E=0;e:for(;;){if(N=p+(j<<3)|0,M=h[N>>2]|0,N=h[N+4>>2]|0,U=tt(M|0,N|0,52)|0,ee()|0,(U&15|0)>(b|0)){E=12,M=11;break}if(vL(K,M,N,b),U=K,N=h[U>>2]|0,U=h[U+4>>2]|0,(N|0)==0&(U|0)==0)M=q;else{M=q;do{if(!((E|0)<(x|0)|(E|0)==(x|0)&M>>>0<v>>>0)){M=10;break e}q=_+(M<<3)|0,h[q>>2]=N,h[q+4>>2]=U,M=At(M|0,E|0,1,0)|0,E=ee()|0,_L(K),q=K,N=h[q>>2]|0,U=h[q+4>>2]|0}while(!((N|0)==0&(U|0)==0))}if(j=At(j|0,X|0,1,0)|0,X=ee()|0,(X|0)<(g|0)|(X|0)==(g|0)&j>>>0<m>>>0)q=M;else{E=0,M=11;break}}return(M|0)==10?(K=14,Q=ae,K|0):(M|0)==11?(Q=ae,E|0):0}function vue(p,m,g,_,v){p=p|0,m=m|0,g=g|0,_=_|0,v=v|0;var x=0,b=0,E=0,M=0,N=0,U=0,q=0,j=0;j=Q,Q=Q+16|0,q=j;e:do if((g|0)>0|(g|0)==0&m>>>0>0){for(N=0,b=0,x=0,U=0;;){if(M=p+(N<<3)|0,E=h[M>>2]|0,M=h[M+4>>2]|0,!((E|0)==0&(M|0)==0)&&(M=(jx(E,M,_,q)|0)==0,E=q,b=At(h[E>>2]|0,h[E+4>>2]|0,b|0,x|0)|0,x=ee()|0,!M)){x=12;break}if(N=At(N|0,U|0,1,0)|0,U=ee()|0,!((U|0)<(g|0)|(U|0)==(g|0)&N>>>0<m>>>0))break e}return Q=j,x|0}else b=0,x=0;while(!1);return h[v>>2]=b,h[v+4>>2]=x,v=0,Q=j,v|0}function _ue(p,m){return p=p|0,m=m|0,m=tt(p|0,m|0,52)|0,ee()|0,m&1|0}function ll(p,m){p=p|0,m=m|0;var g=0,_=0,v=0;if(v=tt(p|0,m|0,52)|0,ee()|0,v=v&15,!v)return v=0,v|0;for(_=1;;){if(g=tt(p|0,m|0,(15-_|0)*3|0)|0,ee()|0,g=g&7,g|0){_=5;break}if(_>>>0<v>>>0)_=_+1|0;else{g=0,_=5;break}}return(_|0)==5?g|0:0}function dL(p,m){p=p|0,m=m|0;var g=0,_=0,v=0,x=0,b=0,E=0,M=0,N=0,U=0;if(U=tt(p|0,m|0,52)|0,ee()|0,U=U&15,!U)return N=m,U=p,On(N|0),U|0;for(N=1,g=0;;){switch(_=(15-N|0)*3|0,E=ft(7,0,_|0)|0,M=ee()|0,x=p&~E,b=m&~M,p=tt(p|0,m|0,_|0)|0,ee()|0,p&7){case 1:{p=5;break}case 5:{p=4;break}case 4:{p=6;break}case 6:{p=2;break}case 2:{p=3;break}case 3:{p=1;break}default:p=p&7}_=ft(p|0,0,_|0)|0,v=ee()|0,p=_|x,m=v|b;e:do if(!g)if((_&E|0)==0&(v&M|0)==0)g=0;else if(b=tt(p|0,m|0,52)|0,ee()|0,b=b&15,!b)g=1;else{g=1;t:for(;;){switch(M=tt(p|0,m|0,(15-g|0)*3|0)|0,ee()|0,M&7){case 1:break t;case 0:break;default:{g=1;break e}}if(g>>>0<b>>>0)g=g+1|0;else{g=1;break e}}for(x=1;;){switch(v=(15-x|0)*3|0,g=tt(p|0,m|0,v|0)|0,ee()|0,_=ft(7,0,v|0)|0,_=p&~_,m=m&~(ee()|0),g&7){case 1:{p=5;break}case 5:{p=4;break}case 4:{p=6;break}case 6:{p=2;break}case 2:{p=3;break}case 3:{p=1;break}default:p=g&7}if(p=ft(p|0,0,v|0)|0,p=p|_,m=ee()|0|m,x>>>0<b>>>0)x=x+1|0;else{g=1;break e}}}while(!1);if(N>>>0<U>>>0)N=N+1|0;else break}return On(m|0),p|0}function km(p,m){p=p|0,m=m|0;var g=0,_=0,v=0,x=0,b=0;if(b=tt(p|0,m|0,52)|0,ee()|0,b=b&15,!b)return x=m,b=p,On(x|0),b|0;for(x=1;;){switch(v=(15-x|0)*3|0,g=tt(p|0,m|0,v|0)|0,ee()|0,_=ft(7,0,v|0)|0,_=p&~_,m=m&~(ee()|0),g&7){case 1:{p=5;break}case 5:{p=4;break}case 4:{p=6;break}case 6:{p=2;break}case 2:{p=3;break}case 3:{p=1;break}default:p=g&7}if(p=ft(p|0,0,v|0)|0,p=p|_,m=ee()|0|m,x>>>0<b>>>0)x=x+1|0;else break}return On(m|0),p|0}function xue(p,m){p=p|0,m=m|0;var g=0,_=0,v=0,x=0,b=0,E=0,M=0,N=0,U=0;if(U=tt(p|0,m|0,52)|0,ee()|0,U=U&15,!U)return N=m,U=p,On(N|0),U|0;for(N=1,g=0;;){switch(_=(15-N|0)*3|0,E=ft(7,0,_|0)|0,M=ee()|0,x=p&~E,b=m&~M,p=tt(p|0,m|0,_|0)|0,ee()|0,p&7){case 1:{p=3;break}case 3:{p=2;break}case 2:{p=6;break}case 6:{p=4;break}case 4:{p=5;break}case 5:{p=1;break}default:p=p&7}_=ft(p|0,0,_|0)|0,v=ee()|0,p=_|x,m=v|b;e:do if(!g)if((_&E|0)==0&(v&M|0)==0)g=0;else if(b=tt(p|0,m|0,52)|0,ee()|0,b=b&15,!b)g=1;else{g=1;t:for(;;){switch(M=tt(p|0,m|0,(15-g|0)*3|0)|0,ee()|0,M&7){case 1:break t;case 0:break;default:{g=1;break e}}if(g>>>0<b>>>0)g=g+1|0;else{g=1;break e}}for(x=1;;){switch(g=(15-x|0)*3|0,_=ft(7,0,g|0)|0,_=p&~_,v=m&~(ee()|0),p=tt(p|0,m|0,g|0)|0,ee()|0,p&7){case 1:{p=3;break}case 3:{p=2;break}case 2:{p=6;break}case 6:{p=4;break}case 4:{p=5;break}case 5:{p=1;break}default:p=p&7}if(p=ft(p|0,0,g|0)|0,p=p|_,m=ee()|0|v,x>>>0<b>>>0)x=x+1|0;else{g=1;break e}}}while(!1);if(N>>>0<U>>>0)N=N+1|0;else break}return On(m|0),p|0}function pL(p,m){p=p|0,m=m|0;var g=0,_=0,v=0,x=0,b=0;if(b=tt(p|0,m|0,52)|0,ee()|0,b=b&15,!b)return x=m,b=p,On(x|0),b|0;for(x=1;;){switch(_=(15-x|0)*3|0,g=ft(7,0,_|0)|0,g=p&~g,v=m&~(ee()|0),p=tt(p|0,m|0,_|0)|0,ee()|0,p&7){case 1:{p=3;break}case 3:{p=2;break}case 2:{p=6;break}case 6:{p=4;break}case 4:{p=5;break}case 5:{p=1;break}default:p=p&7}if(p=ft(p|0,0,_|0)|0,p=p|g,m=ee()|0|v,x>>>0<b>>>0)x=x+1|0;else break}return On(m|0),p|0}function yue(p,m){p=p|0,m=m|0;var g=0,_=0,v=0,x=0,b=0,E=0,M=0,N=0,U=0,q=0,j=0,X=0,K=0,ae=0,ue=0,xe=0,se=0,we=0,Ae=0,Be=0,Ke=0,Me=0;if(Ae=Q,Q=Q+16|0,we=Ae,ft(m|0,0,52)|0,g=ee()|0|134225919,!m)return(h[p+4>>2]|0)>2||(h[p+8>>2]|0)>2||(h[p+12>>2]|0)>2?(se=0,we=0,On(se|0),Q=Ae,we|0):(ft(rq(p)|0,0,45)|0,se=ee()|0|g,we=-1,On(se|0),Q=Ae,we|0);h[we>>2]=h[p>>2],h[we+4>>2]=h[p+4>>2],h[we+8>>2]=h[p+8>>2],h[we+12>>2]=h[p+12>>2],se=we+4|0;e:do if((m|0)>0)for(ae=we+8|0,ue=we+12|0,K=m,q=h[ae>>2]|0,j=h[ue>>2]|0,m=-1,U=h[we+4>>2]|0;;){X=K,K=K+-1|0,p=U-j|0,_=q-j|0,X&1?(x=rh(+((p*3|0)-_|0)*.14285714285714285)|0,h[se>>2]=x,p=rh(+((_<<1)+p|0)*.14285714285714285)|0,h[ae>>2]=p,h[ue>>2]=0,_=p-x|0,v=0-x|0,(x|0)<0?(h[ae>>2]=_,h[ue>>2]=v,h[se>>2]=0,p=_,b=0):(b=x,v=0),x=b-p|0,_=v-p|0,(p|0)<0?(h[se>>2]=x,h[ue>>2]=_,h[ae>>2]=0,b=x,x=0):(_=v,x=p),p=b-_|0,v=x-_|0,(_|0)<0?(h[se>>2]=p,h[ae>>2]=v,h[ue>>2]=0,x=0):(v=x,p=b,x=_),_=(v|0)<(p|0)?v:p,_=(x|0)<(_|0)?x:_,(_|0)>0&&(x=x-_|0,v=v-_|0,p=p-_|0,h[se>>2]=p,h[ae>>2]=v,h[ue>>2]=x),Ke=v+(p*3|0)|0,Be=(Ke|0)<0,N=x+(v*3|0)-(Be?Ke:0)|0,M=(N|0)<0,_=(x*3|0)+p-(Be?Ke:0)-(M?N:0)|0,E=(_|0)<0,Me=E?0:_,b=(M?0:N)-(E?_:0)|0,_=(Be?0:Ke)-(M?N:0)-(E?_:0)|0,E=(b|0)<(_|0)?b:_,E=(Me|0)<(E|0)?Me:E,N=(E|0)>0,M=N?E:0,b=b-(N?E:0)|0,E=Me-(N?E:0)|0,N=x):(E=rh(+((p<<1)+_|0)*.14285714285714285)|0,h[se>>2]=E,v=rh(+((_*3|0)-p|0)*.14285714285714285)|0,h[ae>>2]=v,h[ue>>2]=0,_=v-E|0,p=0-E|0,(E|0)<0?(h[ae>>2]=_,h[ue>>2]=p,h[se>>2]=0,v=_,E=0):p=0,b=E-v|0,_=p-v|0,(v|0)<0?(h[se>>2]=b,h[ue>>2]=_,h[ae>>2]=0,x=_,v=0):(x=p,b=E),p=b-x|0,_=v-x|0,(x|0)<0?(h[se>>2]=p,h[ae>>2]=_,h[ue>>2]=0,v=_,x=0):p=b,_=(v|0)<(p|0)?v:p,_=(x|0)<(_|0)?x:_,(_|0)>0&&(x=x-_|0,v=v-_|0,p=p-_|0,h[se>>2]=p,h[ae>>2]=v,h[ue>>2]=x),Ke=x+(p*3|0)|0,Me=(Ke|0)<0,N=(v*3|0)+p-(Me?Ke:0)|0,M=(N|0)<0,_=(x*3|0)+v-(Me?Ke:0)-(M?N:0)|0,E=(_|0)<0,Be=E?0:_,b=(M?0:N)-(E?_:0)|0,_=(Me?0:Ke)-(M?N:0)-(E?_:0)|0,E=(b|0)<(_|0)?b:_,E=(Be|0)<(E|0)?Be:E,N=(E|0)>0,M=N?E:0,b=b-(N?E:0)|0,E=Be-(N?E:0)|0,N=x),_=U+(M-_)|0,x=(_|0)<0,M=q-b-(x?_:0)|0,b=(M|0)<0,j=j-E+(x?0-_|0:0)+(b?0-M|0:0)|0,U=(j|0)<0,E=U?0:j,Me=(b?0:M)-(U?j:0)|0,j=(x?0:_)-(b?M:0)-(U?j:0)|0,U=(Me|0)<(j|0)?Me:j,U=(E|0)<(U|0)?E:U,M=(U|0)>0,j=j-(M?U:0)|0,b=(15-X|0)*3|0,_=ft(7,0,b|0)|0,_=m&~_,x=g&~(ee()|0),q=(j|0)<0,Ke=q?j:0,Me=Me-(M?U:0)-Ke|0,Be=(Me|0)<0,Ke=(Be?0-Me|0:0)+(E-(M?U:0)-Ke)|0,g=(Ke|0)<0,m=g?0:Ke,Ke=g?Ke:0,g=(Be?0:Me)-Ke|0,Ke=(q?0:j)-(Be?Me:0)-Ke|0,Me=(g|0)<(Ke|0)?g:Ke,Me=(m|0)<(Me|0)?m:Me,Me=(Me|0)>0?Me:0,m=m-Me|0,g=g-Me|0;t:do switch(Ke-Me|0){case 0:switch(g|0){case 0:{m=(m|0)==0?0:(m|0)==1?1:7;break t}case 1:{m=(m|0)==0?2:(m|0)==1?3:7;break t}default:{xe=36;break t}}case 1:switch(g|0){case 0:{m=(m|0)==0?4:(m|0)==1?5:7;break t}case 1:if(m){xe=36;break t}else{m=6;break t}default:{xe=36;break t}}default:xe=36}while(!1);if((xe|0)==36&&(xe=0,m=7),m=ft(m|0,0,b|0)|0,m=m|_,g=ee()|0|x,(X|0)<=1)break e;q=v,j=N,U=p}else m=-1,p=h[se>>2]|0;while(!1);e:do if((p|0)<=2&&(h[we+8>>2]|0)<=2&&(h[we+12>>2]|0)<=2){if(_=rq(we)|0,p=ft(_|0,0,45)|0,m=p|m,p=ee()|0|g&-1040385,M=qce(we)|0,!(yr(_)|0)){if((M|0)<=0)break;for(E=0;;){b=tt(m|0,p|0,52)|0,ee()|0,b=b&15;t:do if(b)for(x=1;;){switch(v=(15-x|0)*3|0,g=tt(m|0,p|0,v|0)|0,ee()|0,_=ft(7,0,v|0)|0,m=m&~_,_=p&~(ee()|0),g&7){case 1:{p=5;break}case 5:{p=4;break}case 4:{p=6;break}case 6:{p=2;break}case 2:{p=3;break}case 3:{p=1;break}default:p=g&7}if(p=ft(p|0,0,v|0)|0,m=p|m,p=ee()|0|_,x>>>0<b>>>0)x=x+1|0;else break t}while(!1);if(E=E+1|0,(E|0)==(M|0))break e}}b=tt(m|0,p|0,52)|0,ee()|0,b=b&15;t:do if(b){g=1;n:for(;;){switch(Me=tt(m|0,p|0,(15-g|0)*3|0)|0,ee()|0,Me&7){case 1:break n;case 0:break;default:break t}if(g>>>0<b>>>0)g=g+1|0;else break t}if(sq(_,h[we>>2]|0)|0)for(x=1;;){switch(g=(15-x|0)*3|0,_=ft(7,0,g|0)|0,_=m&~_,v=p&~(ee()|0),p=tt(m|0,p|0,g|0)|0,ee()|0,p&7){case 1:{p=3;break}case 3:{p=2;break}case 2:{p=6;break}case 6:{p=4;break}case 4:{p=5;break}case 5:{p=1;break}default:p=p&7}if(m=ft(p|0,0,g|0)|0,m=m|_,p=ee()|0|v,x>>>0<b>>>0)x=x+1|0;else break t}else for(x=1;;){switch(v=(15-x|0)*3|0,g=tt(m|0,p|0,v|0)|0,ee()|0,_=ft(7,0,v|0)|0,m=m&~_,_=p&~(ee()|0),g&7){case 1:{p=5;break}case 5:{p=4;break}case 4:{p=6;break}case 6:{p=2;break}case 2:{p=3;break}case 3:{p=1;break}default:p=g&7}if(p=ft(p|0,0,v|0)|0,m=p|m,p=ee()|0|_,x>>>0<b>>>0)x=x+1|0;else break t}}while(!1);if((M|0)>0){g=0;do m=dL(m,p)|0,p=ee()|0,g=g+1|0;while((g|0)!=(M|0))}}else m=0,p=0;while(!1);return Ke=p,Me=m,On(Ke|0),Q=Ae,Me|0}function _c(p){return p=p|0,(p|0)%2|0|0}function mL(p,m,g){p=p|0,m=m|0,g=g|0;var _=0,v=0,x=0,b=0,E=0,M=0,N=0,U=0,q=0;if(U=Q,Q=Q+64|0,E=U+24|0,M=U+48|0,N=U,m>>>0>15)return N=4,Q=U,N|0;if(x=+ie[p>>3],ie[or>>3]=x,(h[or+4>>2]&2146435072|0)==2146435072||(_=+ie[p+8>>3],ie[or>>3]=_,(h[or+4>>2]&2146435072|0)==2146435072))return N=3,Q=U,N|0;v=+ii(+x),q=v*+ii(+_),v=v*+zi(+_),_=+zi(+x),ie[N>>3]=q,ie[N+8>>3]=v,ie[N+16>>3]=_,ie[or>>3]=q;do if((h[or+4>>2]&2146435072|0)!=2146435072&&(ie[or>>3]=_,p=h[or+4>>2]|0,ie[or>>3]=v,!((h[or+4>>2]&2146435072|0)==2146435072|!0&(p&2146435072|0)==2146435072)))if(h[E>>2]=h[N>>2],h[E+4>>2]=h[N+4>>2],h[E+8>>2]=h[N+8>>2],h[E+12>>2]=h[N+12>>2],h[E+16>>2]=h[N+16>>2],h[E+20>>2]=h[N+20>>2],cue(E,m,M),M=yue(M,m)|0,N=ee()|0,h[g>>2]=M,h[g+4>>2]=N,(M|0)==0&(N|0)==0)di(27634,27225,1073,27248);else{b=0;break}else b=2;while(!1);return N=b,Q=U,N|0}function AL(p,m,g){p=p|0,m=m|0,g=g|0;var _=0,v=0,x=0,b=0,E=0,M=0,N=0,U=0,q=0,j=0,X=0,K=0;if(X=g+4|0,K=tt(p|0,m|0,52)|0,ee()|0,K=K&15,j=tt(p|0,m|0,45)|0,ee()|0,_=(K|0)==0,yr(j&127)|0){if(_)return K=1,K|0;_=1}else{if(_)return K=0,K|0;(h[X>>2]|0)==0&&(h[g+8>>2]|0)==0?_=(h[g+12>>2]|0)!=0&1:_=1}for(j=g+8|0,q=g+12|0,U=1,g=h[X>>2]|0,b=h[j>>2]|0,x=h[q>>2]|0;v=g*3|0,E=b*3|0,N=x*3|0,U&1?(M=b+v|0,h[X>>2]=M,x=x+E|0,h[j>>2]=x,v=N+g|0,h[q>>2]=v,g=x-M|0,b=v-M|0,(M|0)<0?(h[j>>2]=g,h[q>>2]=b,h[X>>2]=0,E=0,v=b):(g=x,E=M),b=E-g|0,x=v-g|0,(g|0)<0?(h[X>>2]=b,h[q>>2]=x,h[j>>2]=0,E=b,v=0):(x=v,v=g),g=E-x|0,b=v-x|0,(x|0)<0?(h[X>>2]=g,h[j>>2]=b,h[q>>2]=0,x=0):(b=v,g=E),v=(b|0)<(g|0)?b:g,v=(x|0)<(v|0)?x:v,(v|0)>0&&(x=x-v|0,b=b-v|0,g=g-v|0,h[X>>2]=g,h[j>>2]=b,h[q>>2]=x)):(M=E+g|0,E=x+v|0,h[X>>2]=E,h[j>>2]=M,v=N+b|0,h[q>>2]=v,g=M-E|0,x=v-E|0,(E|0)<0?(h[j>>2]=g,h[q>>2]=x,h[X>>2]=0,E=0,v=x):g=M,b=E-g|0,x=v-g|0,(g|0)<0?(h[X>>2]=b,h[q>>2]=x,h[j>>2]=0,E=b,v=0):(x=v,v=g),g=E-x|0,b=v-x|0,(x|0)<0?(h[X>>2]=g,h[j>>2]=b,h[q>>2]=0,x=0):(b=v,g=E),v=(b|0)<(g|0)?b:g,v=(x|0)<(v|0)?x:v,(v|0)>0&&(x=x-v|0,b=b-v|0,g=g-v|0,h[X>>2]=g,h[j>>2]=b,h[q>>2]=x)),v=tt(p|0,m|0,(15-U|0)*3|0)|0,ee()|0,v=v&7,(v+-1|0)>>>0<6&&(M=h[22032+(v*12|0)+4>>2]|0,N=h[22032+(v*12|0)+8>>2]|0,E=(h[22032+(v*12|0)>>2]|0)+g|0,h[X>>2]=E,b=M+b|0,h[j>>2]=b,g=N+x|0,h[q>>2]=g,x=b-E|0,v=g-E|0,(E|0)<0&&(h[j>>2]=x,h[q>>2]=v,h[X>>2]=0,E=0,g=v,b=x),v=E-b|0,x=g-b|0,(b|0)<0?(h[X>>2]=v,h[q>>2]=x,h[j>>2]=0,E=v,b=0):x=g,g=E-x|0,v=b-x|0,(x|0)<0?(h[X>>2]=g,h[j>>2]=v,h[q>>2]=0,b=v,x=0):g=E,v=(b|0)<(g|0)?b:g,v=(x|0)<(v|0)?x:v,(v|0)>0&&(x=x-v|0,b=b-v|0,g=g-v|0,h[X>>2]=g,h[j>>2]=b,h[q>>2]=x)),U>>>0<K>>>0;)U=U+1|0;return _|0}function b1(p,m,g){p=p|0,m=m|0,g=g|0;var _=0,v=0,x=0,b=0,E=0,M=0,N=0,U=0,q=0,j=0,X=0,K=0;if(K=Q,Q=Q+16|0,q=K,j=tt(p|0,m|0,45)|0,ee()|0,j=j&127,j>>>0>121)return h[g>>2]=0,h[g+4>>2]=0,h[g+8>>2]=0,h[g+12>>2]=0,X=5,Q=K,X|0;e:do if((yr(j)|0)!=0&&(E=tt(p|0,m|0,52)|0,ee()|0,E=E&15,(E|0)!=0)){_=1;t:for(;;){switch(X=tt(p|0,m|0,(15-_|0)*3|0)|0,ee()|0,X&7){case 5:break t;case 0:break;default:{N=m;break e}}if(_>>>0<E>>>0)_=_+1|0;else{N=m;break e}}for(b=1,_=m;;){switch(m=(15-b|0)*3|0,v=ft(7,0,m|0)|0,v=p&~v,x=_&~(ee()|0),_=tt(p|0,_|0,m|0)|0,ee()|0,_&7){case 1:{_=3;break}case 3:{_=2;break}case 2:{_=6;break}case 6:{_=4;break}case 4:{_=5;break}case 5:{_=1;break}default:_=_&7}if(p=ft(_|0,0,m|0)|0,p=p|v,_=ee()|0|x,b>>>0<E>>>0)b=b+1|0;else{N=_;break e}}}else N=m;while(!1);if(X=7696+(j*28|0)|0,h[g>>2]=h[X>>2],h[g+4>>2]=h[X+4>>2],h[g+8>>2]=h[X+8>>2],h[g+12>>2]=h[X+12>>2],!(AL(p,N,g)|0))return X=0,Q=K,X|0;if(X=g+4|0,h[q>>2]=h[X>>2],h[q+4>>2]=h[X+4>>2],h[q+8>>2]=h[X+8>>2],M=tt(p|0,N|0,52)|0,ee()|0,U=M&15,M&1?(x=h[X>>2]|0,E=g+8|0,v=h[E>>2]|0,M=g+12|0,m=h[M>>2]|0,_=(v*3|0)+x|0,x=m+(x*3|0)|0,h[X>>2]=x,h[E>>2]=_,v=(m*3|0)+v|0,h[M>>2]=v,m=_-x|0,b=v-x|0,(x|0)<0&&(h[E>>2]=m,h[M>>2]=b,h[X>>2]=0,_=m,x=0,v=b),b=x-_|0,m=v-_|0,(_|0)<0?(h[X>>2]=b,h[M>>2]=m,h[E>>2]=0,_=0):(m=v,b=x),x=b-m|0,v=_-m|0,(m|0)<0?(h[X>>2]=x,h[E>>2]=v,h[M>>2]=0,m=0):(v=_,x=b),_=(v|0)<(x|0)?v:x,_=(m|0)<(_|0)?m:_,(_|0)>0&&(h[X>>2]=x-_,h[E>>2]=v-_,h[M>>2]=m-_),v=U+1|0):v=U,!(yr(j)|0))_=0;else{e:do if(!U)_=0;else for(m=1;;){if(_=tt(p|0,N|0,(15-m|0)*3|0)|0,ee()|0,_=_&7,_|0)break e;if(m>>>0<U>>>0)m=m+1|0;else{_=0;break}}while(!1);_=(_|0)==4&1}if(!(y1(g,v,_,0)|0))(v|0)!=(U|0)&&(h[X>>2]=h[q>>2],h[X+4>>2]=h[q+4>>2],h[X+8>>2]=h[q+8>>2]);else{if(yr(j)|0)do;while((y1(g,v,0,0)|0)!=0);(v|0)!=(U|0)&&(E=g+12|0,p=h[E>>2]|0,_=(h[X>>2]|0)-p|0,b=g+8|0,p=(h[b>>2]|0)-p|0,m=rh(+((_<<1)+p|0)*.14285714285714285)|0,h[X>>2]=m,_=rh(+((p*3|0)-_|0)*.14285714285714285)|0,h[b>>2]=_,h[E>>2]=0,p=_-m|0,v=0-m|0,(m|0)<0?(h[b>>2]=p,h[E>>2]=v,h[X>>2]=0,_=p,m=0):v=0,x=m-_|0,p=v-_|0,(_|0)<0?(h[X>>2]=x,h[E>>2]=p,h[b>>2]=0,m=x,_=0):p=v,x=m-p|0,v=_-p|0,(p|0)<0?(h[X>>2]=x,h[b>>2]=v,h[E>>2]=0,m=x,p=0):v=_,_=(v|0)<(m|0)?v:m,_=(p|0)<(_|0)?p:_,(_|0)>0&&(h[X>>2]=m-_,h[b>>2]=v-_,h[E>>2]=p-_))}return X=0,Q=K,X|0}function w1(p,m,g){p=p|0,m=m|0,g=g|0;var _=0,v=0,x=0,b=0,E=0,M=0;return b=Q,Q=Q+48|0,_=b+24|0,v=b,x=b1(p,m,_)|0,x?(Q=b,x|0):(x=tt(p|0,m|0,52)|0,ee()|0,uue(_,x&15,v),M=+qx(+ +ie[v+16>>3]),E=+Ta(+ +ie[v+8>>3],+ +ie[v>>3]),ie[g>>3]=M,ie[g+8>>3]=E,x=0,Q=b,x|0)}function zm(p,m,g){p=p|0,m=m|0,g=g|0;var _=0,v=0,x=0,b=0,E=0;if(b=Q,Q=Q+16|0,x=b,_=b1(p,m,x)|0,_|0)return x=_,Q=b,x|0;_=tt(p|0,m|0,45)|0,ee()|0,_=(yr(_&127)|0)==0,v=tt(p|0,m|0,52)|0,ee()|0,v=v&15;e:do if(!_){if(v|0)for(_=1;;){if(E=ft(7,0,(15-_|0)*3|0)|0,!((E&p|0)==0&((ee()|0)&m|0)==0))break e;if(_>>>0<v>>>0)_=_+1|0;else break}return lL(x,v,0,5,g),E=0,Q=b,E|0}while(!1);return cL(x,v,0,6,g),E=0,Q=b,E|0}function bue(p,m,g){p=p|0,m=m|0,g=g|0;var _=0,v=0,x=0;if(v=tt(p|0,m|0,45)|0,ee()|0,!(yr(v&127)|0))return v=2,h[g>>2]=v,0;if(v=tt(p|0,m|0,52)|0,ee()|0,v=v&15,!v)return v=5,h[g>>2]=v,0;for(_=1;;){if(x=ft(7,0,(15-_|0)*3|0)|0,!((x&p|0)==0&((ee()|0)&m|0)==0)){_=2,p=6;break}if(_>>>0<v>>>0)_=_+1|0;else{_=5,p=6;break}}return(p|0)==6&&(h[g>>2]=_),0}function gq(p,m,g){p=p|0,m=m|0,g=g|0;var _=0,v=0,x=0,b=0,E=0,M=0,N=0,U=0,q=0;q=Q,Q=Q+128|0,N=q+112|0,x=q+96|0,U=q,v=tt(p|0,m|0,52)|0,ee()|0,E=v&15,h[N>>2]=E,b=tt(p|0,m|0,45)|0,ee()|0,b=b&127;e:do if(yr(b)|0){if(E|0)for(_=1;;){if(M=ft(7,0,(15-_|0)*3|0)|0,!((M&p|0)==0&((ee()|0)&m|0)==0)){v=0;break e}if(_>>>0<E>>>0)_=_+1|0;else break}if(v&1)v=1;else return M=ft(E+1|0,0,52)|0,U=ee()|0|m&-15728641,N=ft(7,0,(14-E|0)*3|0)|0,U=gq((M|p)&~N,U&~(ee()|0),g)|0,Q=q,U|0}else v=0;while(!1);if(_=b1(p,m,x)|0,!_){v?(fq(x,N,U),M=5):(dq(x,N,U),M=6);e:do if(yr(b)|0)if(!E)p=5;else for(_=1;;){if(b=ft(7,0,(15-_|0)*3|0)|0,!((b&p|0)==0&((ee()|0)&m|0)==0)){p=2;break e}if(_>>>0<E>>>0)_=_+1|0;else{p=5;break}}else p=2;while(!1);lp(g|0,-1,p<<2|0)|0;e:do if(v)for(x=0;;){if(b=U+(x<<4)|0,hue(b,h[N>>2]|0)|0,b=h[b>>2]|0,E=h[g>>2]|0,(E|0)==-1|(E|0)==(b|0))_=g;else{v=0;do{if(v=v+1|0,v>>>0>=p>>>0){_=1;break e}_=g+(v<<2)|0,E=h[_>>2]|0}while(!((E|0)==-1|(E|0)==(b|0)))}if(h[_>>2]=b,x=x+1|0,x>>>0>=M>>>0){_=0;break}}else for(x=0;;){if(b=U+(x<<4)|0,y1(b,h[N>>2]|0,0,1)|0,b=h[b>>2]|0,E=h[g>>2]|0,(E|0)==-1|(E|0)==(b|0))_=g;else{v=0;do{if(v=v+1|0,v>>>0>=p>>>0){_=1;break e}_=g+(v<<2)|0,E=h[_>>2]|0}while(!((E|0)==-1|(E|0)==(b|0)))}if(h[_>>2]=b,x=x+1|0,x>>>0>=M>>>0){_=0;break}}while(!1)}return U=_,Q=q,U|0}function wue(){return 12}function gL(p,m){p=p|0,m=m|0;var g=0,_=0,v=0,x=0,b=0,E=0,M=0;if(p>>>0>15)return E=4,E|0;if(ft(p|0,0,52)|0,E=ee()|0|134225919,!p){g=0,_=0;do yr(_)|0&&(ft(_|0,0,45)|0,b=E|(ee()|0),p=m+(g<<3)|0,h[p>>2]=-1,h[p+4>>2]=b,g=g+1|0),_=_+1|0;while((_|0)!=122);return g=0,g|0}g=0,b=0;do{if(yr(b)|0){for(ft(b|0,0,45)|0,_=1,v=-1,x=E|(ee()|0);M=ft(7,0,(15-_|0)*3|0)|0,v=v&~M,x=x&~(ee()|0),(_|0)!=(p|0);)_=_+1|0;M=m+(g<<3)|0,h[M>>2]=v,h[M+4>>2]=x,g=g+1|0}b=b+1|0}while((b|0)!=122);return g=0,g|0}function Sue(p,m,g,_){p=p|0,m=m|0,g=g|0,_=_|0;var v=0,x=0,b=0,E=0,M=0,N=0,U=0,q=0,j=0,X=0,K=0,ae=0,ue=0,xe=0,se=0;if(se=Q,Q=Q+16|0,ue=se,xe=tt(p|0,m|0,52)|0,ee()|0,xe=xe&15,g>>>0>15)return xe=4,Q=se,xe|0;if((xe|0)<(g|0))return xe=12,Q=se,xe|0;if((xe|0)!=(g|0))if(x=ft(g|0,0,52)|0,x=x|p,E=ee()|0|m&-15728641,(xe|0)>(g|0)){M=g;do ae=ft(7,0,(14-M|0)*3|0)|0,M=M+1|0,x=ae|x,E=ee()|0|E;while((M|0)<(xe|0));ae=x}else ae=x;else ae=p,E=m;K=tt(ae|0,E|0,45)|0,ee()|0;e:do if(yr(K&127)|0){if(M=tt(ae|0,E|0,52)|0,ee()|0,M=M&15,M|0)for(x=1;;){if(K=ft(7,0,(15-x|0)*3|0)|0,!((K&ae|0)==0&((ee()|0)&E|0)==0)){N=33;break e}if(x>>>0<M>>>0)x=x+1|0;else break}if(K=_,h[K>>2]=0,h[K+4>>2]=0,(xe|0)>(g|0)){for(K=m&-15728641,X=xe;;){if(j=X,X=X+-1|0,X>>>0>15|(xe|0)<(X|0)){N=19;break}if((xe|0)!=(X|0))if(x=ft(X|0,0,52)|0,x=x|p,M=ee()|0|K,(xe|0)<(j|0))q=x;else{N=X;do q=ft(7,0,(14-N|0)*3|0)|0,N=N+1|0,x=q|x,M=ee()|0|M;while((N|0)<(xe|0));q=x}else q=p,M=m;if(U=tt(q|0,M|0,45)|0,ee()|0,!(yr(U&127)|0))x=0;else{U=tt(q|0,M|0,52)|0,ee()|0,U=U&15;t:do if(!U)x=0;else for(N=1;;){if(x=tt(q|0,M|0,(15-N|0)*3|0)|0,ee()|0,x=x&7,x|0)break t;if(N>>>0<U>>>0)N=N+1|0;else{x=0;break}}while(!1);x=(x|0)==0&1}if(M=tt(p|0,m|0,(15-j|0)*3|0)|0,ee()|0,M=M&7,(M|0)==7){v=5,N=42;break}if(x=(x|0)!=0,(M|0)==1&x){v=5,N=42;break}if(q=M+(((M|0)!=0&x)<<31>>31)|0,q|0&&(N=xe-j|0,N=sp(7,0,N,((N|0)<0)<<31>>31)|0,U=ee()|0,x?(x=wr(N|0,U|0,5,0)|0,x=At(x|0,ee()|0,-5,-1)|0,x=op(x|0,ee()|0,6,0)|0,x=At(x|0,ee()|0,1,0)|0,M=ee()|0):(x=N,M=U),j=q+-1|0,j=wr(N|0,U|0,j|0,((j|0)<0)<<31>>31|0)|0,j=At(x|0,M|0,j|0,ee()|0)|0,q=ee()|0,U=_,U=At(j|0,q|0,h[U>>2]|0,h[U+4>>2]|0)|0,q=ee()|0,j=_,h[j>>2]=U,h[j+4>>2]=q),(X|0)<=(g|0)){N=37;break}}if((N|0)==19)di(27634,27225,1407,27259);else if((N|0)==37){b=_,v=h[b+4>>2]|0,b=h[b>>2]|0;break}else if((N|0)==42)return Q=se,v|0}else v=0,b=0}else N=33;while(!1);e:do if((N|0)==33)if(K=_,h[K>>2]=0,h[K+4>>2]=0,(xe|0)>(g|0)){for(x=xe;;){if(v=tt(p|0,m|0,(15-x|0)*3|0)|0,ee()|0,v=v&7,(v|0)==7){v=5;break}if(b=xe-x|0,b=sp(7,0,b,((b|0)<0)<<31>>31)|0,v=wr(b|0,ee()|0,v|0,0)|0,b=ee()|0,K=_,b=At(h[K>>2]|0,h[K+4>>2]|0,v|0,b|0)|0,v=ee()|0,K=_,h[K>>2]=b,h[K+4>>2]=v,x=x+-1|0,(x|0)<=(g|0))break e}return Q=se,v|0}else v=0,b=0;while(!1);return jx(ae,E,xe,ue)|0&&di(27634,27225,1367,27274),xe=ue,ue=h[xe+4>>2]|0,((v|0)>-1|(v|0)==-1&b>>>0>4294967295)&((ue|0)>(v|0)|((ue|0)==(v|0)?(h[xe>>2]|0)>>>0>b>>>0:0))?(xe=0,Q=se,xe|0):(di(27634,27225,1447,27259),0)}function Tue(p,m,g,_,v,x){p=p|0,m=m|0,g=g|0,_=_|0,v=v|0,x=x|0;var b=0,E=0,M=0,N=0,U=0,q=0,j=0,X=0,K=0,ae=0;if(q=Q,Q=Q+16|0,b=q,v>>>0>15)return x=4,Q=q,x|0;if(E=tt(g|0,_|0,52)|0,ee()|0,E=E&15,(E|0)>(v|0))return x=12,Q=q,x|0;if(jx(g,_,v,b)|0&&di(27634,27225,1367,27274),U=b,N=h[U+4>>2]|0,!(((m|0)>-1|(m|0)==-1&p>>>0>4294967295)&((N|0)>(m|0)|((N|0)==(m|0)?(h[U>>2]|0)>>>0>p>>>0:0))))return x=2,Q=q,x|0;U=v-E|0,v=ft(v|0,0,52)|0,M=ee()|0|_&-15728641,N=x,h[N>>2]=v|g,h[N+4>>2]=M,N=tt(g|0,_|0,45)|0,ee()|0;e:do if(yr(N&127)|0){if(E|0)for(b=1;;){if(N=ft(7,0,(15-b|0)*3|0)|0,!((N&g|0)==0&((ee()|0)&_|0)==0))break e;if(b>>>0<E>>>0)b=b+1|0;else break}if((U|0)<1)return x=0,Q=q,x|0;for(N=E^15,_=-1,M=1,b=1;;){E=U-M|0,E=sp(7,0,E,((E|0)<0)<<31>>31)|0,g=ee()|0;do if(b)if(b=wr(E|0,g|0,5,0)|0,b=At(b|0,ee()|0,-5,-1)|0,b=op(b|0,ee()|0,6,0)|0,v=ee()|0,(m|0)>(v|0)|(m|0)==(v|0)&p>>>0>b>>>0){m=At(p|0,m|0,-1,-1)|0,m=Js(m|0,ee()|0,b|0,v|0)|0,b=ee()|0,j=x,K=h[j>>2]|0,j=h[j+4>>2]|0,ae=(N+_|0)*3|0,X=ft(7,0,ae|0)|0,j=j&~(ee()|0),_=op(m|0,b|0,E|0,g|0)|0,p=ee()|0,v=At(_|0,p|0,2,0)|0,ae=ft(v|0,ee()|0,ae|0)|0,j=ee()|0|j,v=x,h[v>>2]=ae|K&~X,h[v+4>>2]=j,p=wr(_|0,p|0,E|0,g|0)|0,p=Js(m|0,b|0,p|0,ee()|0)|0,b=0,m=ee()|0;break}else{ae=x,X=h[ae>>2]|0,ae=h[ae+4>>2]|0,K=ft(7,0,(N+_|0)*3|0)|0,ae=ae&~(ee()|0),b=x,h[b>>2]=X&~K,h[b+4>>2]=ae,b=1;break}else X=x,v=h[X>>2]|0,X=h[X+4>>2]|0,_=(N+_|0)*3|0,j=ft(7,0,_|0)|0,X=X&~(ee()|0),ae=op(p|0,m|0,E|0,g|0)|0,b=ee()|0,_=ft(ae|0,b|0,_|0)|0,X=ee()|0|X,K=x,h[K>>2]=_|v&~j,h[K+4>>2]=X,b=wr(ae|0,b|0,E|0,g|0)|0,p=Js(p|0,m|0,b|0,ee()|0)|0,b=0,m=ee()|0;while(!1);if((U|0)>(M|0))_=~M,M=M+1|0;else{m=0;break}}return Q=q,m|0}while(!1);if((U|0)<1)return ae=0,Q=q,ae|0;for(v=E^15,b=1;;)if(K=U-b|0,K=sp(7,0,K,((K|0)<0)<<31>>31)|0,ae=ee()|0,M=x,g=h[M>>2]|0,M=h[M+4>>2]|0,E=(v-b|0)*3|0,_=ft(7,0,E|0)|0,M=M&~(ee()|0),j=op(p|0,m|0,K|0,ae|0)|0,X=ee()|0,E=ft(j|0,X|0,E|0)|0,M=ee()|0|M,N=x,h[N>>2]=E|g&~_,h[N+4>>2]=M,ae=wr(j|0,X|0,K|0,ae|0)|0,p=Js(p|0,m|0,ae|0,ee()|0)|0,m=ee()|0,(U|0)<=(b|0)){m=0;break}else b=b+1|0;return Q=q,m|0}function vL(p,m,g,_){p=p|0,m=m|0,g=g|0,_=_|0;var v=0,x=0,b=0;v=tt(m|0,g|0,52)|0,ee()|0,v=v&15,(m|0)==0&(g|0)==0|((_|0)>15|(v|0)>(_|0))?(x=-1,m=-1,g=0,v=0):(m=mq(m,g,v+1|0,_)|0,b=(ee()|0)&-15728641,g=ft(_|0,0,52)|0,g=m|g,b=b|(ee()|0),m=(Zi(g,b)|0)==0,x=v,m=m?-1:_,v=b),b=p,h[b>>2]=g,h[b+4>>2]=v,h[p+8>>2]=x,h[p+12>>2]=m}function vq(p,m,g,_){p=p|0,m=m|0,g=g|0,_=_|0;var v=0,x=0;if(v=tt(p|0,m|0,52)|0,ee()|0,v=v&15,x=_+8|0,h[x>>2]=v,(p|0)==0&(m|0)==0|((g|0)>15|(v|0)>(g|0))){g=_,h[g>>2]=0,h[g+4>>2]=0,h[x>>2]=-1,h[_+12>>2]=-1;return}if(p=mq(p,m,v+1|0,g)|0,x=(ee()|0)&-15728641,v=ft(g|0,0,52)|0,v=p|v,x=x|(ee()|0),p=_,h[p>>2]=v,h[p+4>>2]=x,p=_+12|0,Zi(v,x)|0){h[p>>2]=g;return}else{h[p>>2]=-1;return}}function _L(p){p=p|0;var m=0,g=0,_=0,v=0,x=0,b=0,E=0,M=0,N=0;if(g=p,m=h[g>>2]|0,g=h[g+4>>2]|0,!((m|0)==0&(g|0)==0)&&(_=tt(m|0,g|0,52)|0,ee()|0,_=_&15,E=ft(1,0,(_^15)*3|0)|0,m=At(E|0,ee()|0,m|0,g|0)|0,g=ee()|0,E=p,h[E>>2]=m,h[E+4>>2]=g,E=p+8|0,b=h[E>>2]|0,!((_|0)<(b|0)))){for(M=p+12|0,x=_;;){if((x|0)==(b|0)){_=5;break}if(N=(x|0)==(h[M>>2]|0),v=(15-x|0)*3|0,_=tt(m|0,g|0,v|0)|0,ee()|0,_=_&7,N&((_|0)==1&!0)){_=7;break}if(!((_|0)==7&!0)){_=10;break}if(N=ft(1,0,v|0)|0,m=At(m|0,g|0,N|0,ee()|0)|0,g=ee()|0,N=p,h[N>>2]=m,h[N+4>>2]=g,(x|0)>(b|0))x=x+-1|0;else{_=10;break}}if((_|0)==5){N=p,h[N>>2]=0,h[N+4>>2]=0,h[E>>2]=-1,h[M>>2]=-1;return}else if((_|0)==7){b=ft(1,0,v|0)|0,b=At(m|0,g|0,b|0,ee()|0)|0,E=ee()|0,N=p,h[N>>2]=b,h[N+4>>2]=E,h[M>>2]=x+-1;return}else if((_|0)==10)return}}function Xx(p){p=+p;var m=0;return m=p<0?p+6.283185307179586:p,+(p>=6.283185307179586?m+-6.283185307179586:m)}function kl(p,m){switch(p=+p,m=m|0,m|0){case 1:{p=p<0?p+6.283185307179586:p;break}case 2:{p=p>0?p+-6.283185307179586:p;break}default:}return+p}function Eue(p,m){p=p|0,m=m|0;var g=0,_=0,v=0,x=0;return v=+ie[m>>3],_=+ie[p>>3],x=+zi(+((v-_)*.5)),g=+zi(+((+ie[m+8>>3]-+ie[p+8>>3])*.5)),g=x*x+g*(+ii(+v)*+ii(+_)*g),+(+Ta(+ +bs(+g),+ +bs(+(1-g)))*2)}function $x(p,m){p=p|0,m=m|0;var g=0,_=0,v=0,x=0;return v=+ie[m>>3],_=+ie[p>>3],x=+zi(+((v-_)*.5)),g=+zi(+((+ie[m+8>>3]-+ie[p+8>>3])*.5)),g=x*x+g*(+ii(+v)*+ii(+_)*g),+(+Ta(+ +bs(+g),+ +bs(+(1-g)))*2*6371.007180918475)}function Mue(p,m){p=p|0,m=m|0;var g=0,_=0,v=0,x=0;return v=+ie[m>>3],_=+ie[p>>3],x=+zi(+((v-_)*.5)),g=+zi(+((+ie[m+8>>3]-+ie[p+8>>3])*.5)),g=x*x+g*(+ii(+v)*+ii(+_)*g),+(+Ta(+ +bs(+g),+ +bs(+(1-g)))*2*6371.007180918475*1e3)}function _q(p,m){return p=p|0,m=m|0,p>>>0>15?(m=4,m|0):(ie[m>>3]=+ie[20624+(p<<3)>>3],m=0,m|0)}function Cue(p,m){return p=p|0,m=m|0,p>>>0>15?(m=4,m|0):(ie[m>>3]=+ie[20752+(p<<3)>>3],m=0,m|0)}function Rue(p,m){return p=p|0,m=m|0,p>>>0>15?(m=4,m|0):(ie[m>>3]=+ie[20880+(p<<3)>>3],m=0,m|0)}function Pue(p,m){return p=p|0,m=m|0,p>>>0>15?(m=4,m|0):(ie[m>>3]=+ie[21008+(p<<3)>>3],m=0,m|0)}function aT(p,m){p=p|0,m=m|0;var g=0;return p>>>0>15?(m=4,m|0):(g=sp(7,0,p,((p|0)<0)<<31>>31)|0,g=wr(g|0,ee()|0,120,0)|0,p=ee()|0,h[m>>2]=g|2,h[m+4>>2]=p,m=0,m|0)}function Iue(p,m,g){p=p|0,m=m|0,g=g|0;var _=0,v=0,x=0,b=0,E=0,M=0,N=0,U=0;if(E=Q,Q=Q+176|0,b=E,p=Hx(p,m,b)|0,p|0)return b=p,Q=E,b|0;if(ie[g>>3]=0,p=h[b>>2]|0,(p|0)<=1)return b=0,Q=E,b|0;m=p+-1|0,p=0,_=+ie[b+8>>3],v=+ie[b+16>>3],x=0;do p=p+1|0,N=_,_=+ie[b+8+(p<<4)>>3],U=+zi(+((_-N)*.5)),M=v,v=+ie[b+8+(p<<4)+8>>3],M=+zi(+((v-M)*.5)),M=U*U+M*(+ii(+_)*+ii(+N)*M),x=x+ +Ta(+ +bs(+M),+ +bs(+(1-M)))*2;while((p|0)<(m|0));return ie[g>>3]=x,b=0,Q=E,b|0}function Lue(p,m,g){p=p|0,m=m|0,g=g|0;var _=0,v=0,x=0,b=0,E=0,M=0,N=0,U=0;if(E=Q,Q=Q+176|0,b=E,p=Hx(p,m,b)|0,p|0)return b=p,x=+ie[g>>3],x=x*6371.007180918475,ie[g>>3]=x,Q=E,b|0;if(ie[g>>3]=0,p=h[b>>2]|0,(p|0)<=1)return b=0,x=0,x=x*6371.007180918475,ie[g>>3]=x,Q=E,b|0;m=p+-1|0,p=0,_=+ie[b+8>>3],v=+ie[b+16>>3],x=0;do p=p+1|0,N=_,_=+ie[b+8+(p<<4)>>3],U=+zi(+((_-N)*.5)),M=v,v=+ie[b+8+(p<<4)+8>>3],M=+zi(+((v-M)*.5)),M=U*U+M*(+ii(+N)*+ii(+_)*M),x=x+ +Ta(+ +bs(+M),+ +bs(+(1-M)))*2;while((p|0)!=(m|0));return ie[g>>3]=x,b=0,U=x,U=U*6371.007180918475,ie[g>>3]=U,Q=E,b|0}function Due(p,m,g){p=p|0,m=m|0,g=g|0;var _=0,v=0,x=0,b=0,E=0,M=0,N=0,U=0;if(E=Q,Q=Q+176|0,b=E,p=Hx(p,m,b)|0,p|0)return b=p,x=+ie[g>>3],x=x*6371.007180918475,x=x*1e3,ie[g>>3]=x,Q=E,b|0;if(ie[g>>3]=0,p=h[b>>2]|0,(p|0)<=1)return b=0,x=0,x=x*6371.007180918475,x=x*1e3,ie[g>>3]=x,Q=E,b|0;m=p+-1|0,p=0,_=+ie[b+8>>3],v=+ie[b+16>>3],x=0;do p=p+1|0,N=_,_=+ie[b+8+(p<<4)>>3],U=+zi(+((_-N)*.5)),M=v,v=+ie[b+8+(p<<4)+8>>3],M=+zi(+((v-M)*.5)),M=U*U+M*(+ii(+N)*+ii(+_)*M),x=x+ +Ta(+ +bs(+M),+ +bs(+(1-M)))*2;while((p|0)!=(m|0));return ie[g>>3]=x,b=0,U=x,U=U*6371.007180918475,U=U*1e3,ie[g>>3]=U,Q=E,b|0}function Nue(p){p=p|0;var m=0,g=0,_=0,v=0,x=0,b=0,E=0;if(p)for(x=p+4|0,b=p+8|0,_=1,v=p;;){if(m=h[v>>2]|0,m|0)do{if(g=h[m>>2]|0,g|0)do E=g,g=h[g+16>>2]|0,_t(E);while((g|0)!=0);E=m,m=h[m+8>>2]|0,_t(E)}while((m|0)!=0);if(m=v,v=h[v+8>>2]|0,_?(h[p>>2]=0,h[x>>2]=0,h[b>>2]=0):_t(m),v)_=0;else break}}function Fue(p,m){p=p|0,m=m|0;var g=0,_=0,v=0,x=0,b=0,E=0,M=0,N=0,U=0,q=0,j=0,X=0,K=0,ae=0,ue=0,xe=0;if(h[m>>2]=0,ue=m+4|0,h[ue>>2]=0,xe=m+8|0,h[xe>>2]=0,ae=h[p>>2]|0,(ae|0)<=0)return m=0,m|0;K=p+4|0,p=m,X=0;e:for(;;){if(X){if(g=Ea(1,12)|0,!g){g=5;break}h[p+8>>2]=g,p=g}if(M=h[K>>2]|0,N=Ea(1,12)|0,!N){p=13,g=37;break}if(j=p+4|0,_=h[j>>2]|0,h[((_|0)==0?p:_+8|0)>>2]=N,h[j>>2]=N,_=h[M+(X<<4)>>2]|0,(_|0)<3){p=1,g=37;break}v=M+(X<<4)+4|0,x=N+4|0,g=0,b=0;do{if(E=b,b=br(24)|0,!b){p=13,g=37;break e}ML(b|0,(h[v>>2]|0)+(g<<4)|0,16)|0,h[b+16>>2]=0,E?h[E+16>>2]=b:h[N>>2]=b,h[x>>2]=b,g=g+1|0}while((g|0)<(_|0));if(q=h[M+(X<<4)+8>>2]|0,(q|0)>0){U=M+(X<<4)+12|0,M=0;do{if(_=h[U>>2]|0,g=N,N=Ea(1,12)|0,!N){p=13,g=37;break e}if(h[g+8>>2]=N,h[j>>2]=N,E=h[_+(M<<3)>>2]|0,(E|0)<3){p=1,g=37;break e}_=_+(M<<3)+4|0,v=N+4|0,g=0,x=0;do{if(b=x,x=br(24)|0,!x){p=13,g=37;break e}ML(x|0,(h[_>>2]|0)+(g<<4)|0,16)|0,h[x+16>>2]=0,b?h[b+16>>2]=x:h[N>>2]=x,h[v>>2]=x,g=g+1|0}while((g|0)<(E|0));M=M+1|0}while((M|0)<(q|0))}if(X=X+1|0,(X|0)>=(ae|0)){p=0,g=50;break}}if((g|0)==5){if(!m)return m=13,m|0;for(_=1,v=m;;){if(p=h[v>>2]|0,p|0)do{if(g=h[p>>2]|0,g|0)do ae=g,g=h[g+16>>2]|0,_t(ae);while((g|0)!=0);ae=p,p=h[p+8>>2]|0,_t(ae)}while((p|0)!=0);if(p=v,v=h[v+8>>2]|0,_?(h[m>>2]=0,h[ue>>2]=0,h[xe>>2]=0):_t(p),v)_=0;else{p=13;break}}return p|0}else if((g|0)==37){if(!m)return m=p,m|0;for(v=1,x=m;;){if(g=h[x>>2]|0,g|0)do{if(_=h[g>>2]|0,_|0)do ae=_,_=h[_+16>>2]|0,_t(ae);while((_|0)!=0);ae=g,g=h[g+8>>2]|0,_t(ae)}while((g|0)!=0);if(g=x,x=h[x+8>>2]|0,v?(h[m>>2]=0,h[ue>>2]=0,h[xe>>2]=0):_t(g),x)v=0;else break}return p|0}else if((g|0)==50)return p|0;return 0}function Yx(p,m,g,_,v){p=p|0,m=m|0,g=g|0,_=_|0,v=v|0;var x=0,b=0,E=0,M=0,N=0,U=0,q=0,j=0,X=0,K=0,ae=0,ue=0,xe=0,se=0;if(xe=Q,Q=Q+16|0,ue=xe,U=tt(p|0,m|0,52)|0,ee()|0,U=U&15,X=tt(g|0,_|0,52)|0,ee()|0,(U|0)!=(X&15|0))return ue=12,Q=xe,ue|0;if(M=tt(p|0,m|0,45)|0,ee()|0,M=M&127,N=tt(g|0,_|0,45)|0,ee()|0,N=N&127,M>>>0>121|N>>>0>121)return ue=5,Q=xe,ue|0;if(X=(M|0)!=(N|0),X){if(b=sL(M,N)|0,(b|0)==7)return ue=1,Q=xe,ue|0;E=sL(N,M)|0,(E|0)==7?di(27291,27315,164,27325):(ae=b,x=E)}else ae=0,x=0;q=yr(M)|0,j=yr(N)|0,h[ue>>2]=0,h[ue+4>>2]=0,h[ue+8>>2]=0,h[ue+12>>2]=0;do if(ae){N=h[4272+(M*28|0)+(ae<<2)>>2]|0,b=(N|0)>0;e:do if(j)if(b)for(M=0,E=g,b=_;;){switch(E=xue(E,b)|0,b=ee()|0,x|0){case 5:case 1:{x=3;break}case 3:{x=2;break}case 2:{x=6;break}case 6:{x=4;break}case 4:{x=5;break}default:}if(M=M+1|0,(M|0)==(N|0)){N=x,M=E,E=b;break e}}else N=x,M=g,E=_;else if(b)for(M=0,E=g,b=_;;){switch(E=pL(E,b)|0,b=ee()|0,x|0){case 1:{x=3;break}case 3:{x=2;break}case 2:{x=6;break}case 6:{x=4;break}case 4:{x=5;break}case 5:{x=1;break}default:}if(M=M+1|0,(M|0)==(N|0)){N=x,M=E,E=b;break e}}else N=x,M=g,E=_;while(!1);if(AL(M,E,ue)|0,X||di(27340,27315,194,27325),b=(q|0)!=0,x=(j|0)!=0,b&x&&di(27367,27315,195,27325),b){if(x=ll(p,m)|0,(x|0)==7){x=5;break}if(He[21968+(x*7|0)+ae>>0]|0){x=1;break}j=h[21136+(x*28|0)+(ae<<2)>>2]|0,X=j}else if(x){if(x=ll(M,E)|0,(x|0)==7){x=5;break}if(He[21968+(x*7|0)+N>>0]|0){x=1;break}X=0,j=h[21136+(N*28|0)+(x<<2)>>2]|0}else X=0,j=0;if((X|j|0)>=0){if((j|0)>0){g=ue+4|0,_=ue+8|0,q=ue+12|0,N=0,E=h[g>>2]|0,b=h[_>>2]|0,x=h[q>>2]|0;do K=b+E|0,m=(K|0)<0,se=m?K:0,b=x+b-se|0,p=(b|0)<0,M=p?b:0,E=x+E-se-M|0,se=(E|0)<0,x=se?0:E,E=se?E:0,b=(p?0:b)-E|0,E=(m?0:K)-M-E|0,M=(b|0)<(E|0)?b:E,M=(x|0)<(M|0)?x:M,(M|0)>0&&(E=E-M|0,b=b-M|0,x=x-M|0),N=N+1|0;while((N|0)!=(j|0));h[g>>2]=E,h[_>>2]=b,h[q>>2]=x}if((ae+-1|0)>>>0<6?(x=h[22032+(ae*12|0)>>2]|0,E=h[22032+(ae*12|0)+4>>2]|0,se=h[22032+(ae*12|0)+8>>2]|0,b=(E|0)<(x|0)?E:x,b=(se|0)<(b|0)?se:b,b=(b|0)>0?b:0,x=x-b|0,E=E-b|0,b=se-b|0):(x=0,E=0,b=0),U)for(;;)if(M=x*3|0,N=E*3|0,g=b*3|0,_c(U)|0?(m=M+E|0,p=(m|0)<0,se=N+b-(p?m:0)|0,K=(se|0)<0,E=x+g-(p?m:0)-(K?se:0)|0,b=(E|0)<0,ae=b?0:E,M=(K?0:se)-(b?E:0)|0,E=(p?0:m)-(K?se:0)-(b?E:0)|0,b=(M|0)<(E|0)?M:E,b=(ae|0)<(b|0)?ae:b,se=(b|0)>0,x=se?b:0,M=M-(se?b:0)|0,b=ae-(se?b:0)|0):(K=M+b|0,m=(K|0)<0,se=N+x-(m?K:0)|0,x=(se|0)<0,E=g+E-(m?K:0)-(x?se:0)|0,b=(E|0)<0,ae=b?0:E,M=(x?0:se)-(b?E:0)|0,E=(m?0:K)-(x?se:0)-(b?E:0)|0,b=(M|0)<(E|0)?M:E,b=(ae|0)<(b|0)?ae:b,se=(b|0)>0,x=se?b:0,M=M-(se?b:0)|0,b=ae-(se?b:0)|0),x=E-x|0,(U|0)>1)U=U+-1|0,E=M;else{E=M;break}if((X|0)>0){M=0;do m=x+E|0,p=(m|0)<0,se=E+b-(p?m:0)|0,K=(se|0)<0,ae=x+b-(p?m:0)-(K?se:0)|0,x=(ae|0)<0,b=x?0:ae,E=(K?0:se)-(x?ae:0)|0,ae=(p?0:m)-(K?se:0)-(x?ae:0)|0,x=(E|0)<(ae|0)?E:ae,x=(b|0)<(x|0)?b:x,se=(x|0)>0,b=b-(se?x:0)|0,E=E-(se?x:0)|0,x=ae-(se?x:0)|0,M=M+1|0;while((M|0)!=(X|0))}g=ue+4|0,U=ue+8|0,ae=h[U>>2]|0,_=ue+12|0,se=h[_>>2]|0,M=(h[g>>2]|0)+x|0,h[g>>2]=M,E=ae+E|0,h[U>>2]=E,x=se+b|0,h[_>>2]=x,b=E-M|0,(M|0)<0?(x=x-M|0,h[U>>2]=b,h[_>>2]=x,h[g>>2]=0,E=0):(b=E,E=M),(b|0)<0&&(E=E-b|0,h[g>>2]=E,x=x-b|0,h[_>>2]=x,h[U>>2]=0,b=0),N=E-x|0,M=b-x|0,(x|0)<0?(h[g>>2]=N,h[U>>2]=M,h[_>>2]=0,E=N,x=0):M=b,b=(M|0)<(E|0)?M:E,b=(x|0)<(b|0)?x:b,(b|0)>0&&(h[g>>2]=E-b,h[U>>2]=M-b,h[_>>2]=x-b),K=77}else x=5}else if(AL(g,_,ue)|0,(q|0)!=0&(j|0)!=0)if((N|0)!=(M|0)&&di(27398,27315,264,27325),b=ll(p,m)|0,x=ll(g,_)|0,(b|0)==7|(x|0)==7)x=5;else if(He[21968+(b*7|0)+x>>0]|0)x=1;else if(g=h[21136+(b*28|0)+(x<<2)>>2]|0,(g|0)>0){U=ue+4|0,_=ue+8|0,q=ue+12|0,N=0,E=h[U>>2]|0,b=h[_>>2]|0,x=h[q>>2]|0;do ae=b+E|0,K=(ae|0)<0,p=K?ae:0,b=x+b-p|0,m=(b|0)<0,M=m?b:0,E=x+E-p-M|0,p=(E|0)<0,x=p?0:E,E=p?E:0,b=(m?0:b)-E|0,E=(K?0:ae)-M-E|0,M=(b|0)<(E|0)?b:E,M=(x|0)<(M|0)?x:M,(M|0)>0&&(E=E-M|0,b=b-M|0,x=x-M|0),N=N+1|0;while((N|0)!=(g|0));h[U>>2]=E,h[_>>2]=b,h[q>>2]=x,K=77}else K=77;else K=77;while(!1);return(K|0)==77&&(x=ue+4|0,h[v>>2]=h[x>>2],h[v+4>>2]=h[x+4>>2],h[v+8>>2]=h[x+8>>2],x=0),se=x,Q=xe,se|0}function xq(p,m,g,_){p=p|0,m=m|0,g=g|0,_=_|0;var v=0,x=0,b=0,E=0,M=0,N=0,U=0,q=0,j=0,X=0,K=0,ae=0,ue=0,xe=0,se=0,we=0,Ae=0,Be=0,Ke=0,Me=0,be=0;if(x=tt(p|0,m|0,52)|0,ee()|0,x=x&15,Ae=tt(p|0,m|0,45)|0,ee()|0,Ae=Ae&127,Ae>>>0>121)return _=5,_|0;if(ue=yr(Ae)|0,ft(x|0,0,52)|0,E=ee()|0|134225919,b=_,h[b>>2]=-1,h[b+4>>2]=E,b=h[g>>2]|0,E=h[g+4>>2]|0,g=h[g+8>>2]|0,!x){m=(b|0)<0,xe=m?b:0,we=E-xe|0,ue=(we|0)<0,xe=(ue?0-we|0:0)+(g-xe)|0,g=(xe|0)<0,v=g?0:xe,xe=g?xe:0,g=(ue?0:we)-xe|0,xe=(m?0:b)-(ue?we:0)-xe|0,we=(g|0)<(xe|0)?g:xe,we=(v|0)<(we|0)?v:we,we=(we|0)>0?we:0,v=v-we|0,g=g-we|0;e:do switch(xe-we|0){case 0:switch(g|0){case 0:if(v){v=(v|0)==1?1:7,se=11;break e}else{v=0;break e}case 1:if(v){v=(v|0)==1?3:7,se=11;break e}else{v=2;break e}default:return _=1,_|0}case 1:switch(g|0){case 0:if(v){v=(v|0)==1?5:7,se=11;break e}else{v=4;break e}case 1:{if(v)v=1;else{v=6;break e}return v|0}default:return _=1,_|0}default:return _=1,_|0}while(!1);return(se|0)==11&&(v|0)==7||(v=rL(Ae,v)|0,(v|0)==127)?(_=1,_|0):(we=ft(v|0,0,45)|0,Ae=ee()|0,se=_,Ae=h[se+4>>2]&-1040385|Ae,h[_>>2]=h[se>>2]|we,h[_+4>>2]=Ae,_=0,_|0)}for(;;){if(ae=x,x=x+-1|0,K=b-g|0,X=E-g|0,M=K>>>0>715827881|X>>>0>715827881,_c(ae)|0){if(M){if(U=(K|0)>0,q=2147483647-K|0,j=-2147483648-K|0,U?(q|0)<(K|0):(j|0)>(K|0)){v=1,se=107;break}if(be=K<<1,U?(2147483647-be|0)<(K|0):(-2147483648-be|0)>(K|0)){v=1,se=107;break}if((X|0)>0?(2147483647-X|0)<(X|0):(-2147483648-X|0)>(X|0)){v=1,se=107;break}if(M=K*3|0,N=X<<1,(U?(q|0)<(N|0):(j|0)>(N|0))||((K|0)>-1?(M|-2147483648|0)>=(X|0):(M^-2147483648|0)<(X|0))){v=1,se=107;break}}else M=K*3|0,N=X<<1;if(q=rh(+(M-X|0)*.14285714285714285)|0,U=rh(+(N+K|0)*.14285714285714285)|0,N=(U|0)<(q|0),M=N?q:U,N=N?U:q,(N|0)<0){if((N|0)==-2147483648||((M|0)>0?(2147483647-M|0)<(N|0):(-2147483648-M|0)>(N|0))){se=24;break}if((M|0)>-1?(M|-2147483648|0)>=(N|0):(M^-2147483648|0)<(N|0)){se=24;break}}j=(q|0)<0,X=U-(j?q:0)|0,Ke=(X|0)<0,Be=(j?0-q|0:0)-(Ke?X:0)|0,K=(Be|0)<0,j=(j?0:q)-(Ke?X:0)-(K?Be:0)|0,X=(Ke?0:X)-(K?Be:0)|0,Be=K?0:Be,K=(X|0)<(j|0)?X:j,K=(Be|0)<(K|0)?Be:K,Ke=(K|0)>0,j=j-(Ke?K:0)|0,X=X-(Ke?K:0)|0,K=Be-(Ke?K:0)|0,Ke=(j*3|0)+X|0,Be=(Ke|0)<0,be=(X*3|0)+K-(Be?Ke:0)|0,M=(be|0)<0,q=(K*3|0)+j-(Be?Ke:0)-(M?be:0)|0,U=(q|0)<0,Me=U?0:q,N=(M?0:be)-(U?q:0)|0,q=(Be?0:Ke)-(M?be:0)-(U?q:0)|0,U=(N|0)<(q|0)?N:q,U=(Me|0)<(U|0)?Me:U,be=(U|0)>0,M=be?U:0,N=N-(be?U:0)|0,U=Me-(be?U:0)|0}else{if(M){if(N=(K|0)>0,N?(2147483647-K|0)<(K|0):(-2147483648-K|0)>(K|0)){v=1,se=107;break}if(M=K<<1,U=(X|0)>0,U?(2147483647-X|0)<(X|0):(-2147483648-X|0)>(X|0)){v=1,se=107;break}if(j=X<<1,U?(2147483647-j|0)<(X|0):(-2147483648-j|0)>(X|0)){v=1,se=107;break}if(N?(2147483647-M|0)<(X|0):(-2147483648-M|0)>(X|0)){v=1,se=107;break}if(N=X*3|0,(X|0)>-1?(N|-2147483648|0)>=(K|0):(N^-2147483648|0)<(K|0)){v=1,se=107;break}}else M=K<<1,N=X*3|0;if(q=rh(+(M+X|0)*.14285714285714285)|0,U=rh(+(N-K|0)*.14285714285714285)|0,N=(U|0)<(q|0),M=N?q:U,N=N?U:q,(N|0)<0){if((N|0)==-2147483648||((M|0)>0?(2147483647-M|0)<(N|0):(-2147483648-M|0)>(N|0))){se=36;break}if((M|0)>-1?(M|-2147483648|0)>=(N|0):(M^-2147483648|0)<(N|0)){se=36;break}}j=(q|0)<0,X=U-(j?q:0)|0,Me=(X|0)<0,be=(j?0-q|0:0)-(Me?X:0)|0,K=(be|0)<0,j=(j?0:q)-(Me?X:0)-(K?be:0)|0,X=(Me?0:X)-(K?be:0)|0,be=K?0:be,K=(X|0)<(j|0)?X:j,K=(be|0)<(K|0)?be:K,Me=(K|0)>0,j=j-(Me?K:0)|0,X=X-(Me?K:0)|0,K=be-(Me?K:0)|0,Me=(j*3|0)+K|0,be=(Me|0)<0,Be=(X*3|0)+j-(be?Me:0)|0,M=(Be|0)<0,q=(K*3|0)+X-(be?Me:0)-(M?Be:0)|0,U=(q|0)<0,Ke=U?0:q,N=(M?0:Be)-(U?q:0)|0,q=(be?0:Me)-(M?Be:0)-(U?q:0)|0,U=(N|0)<(q|0)?N:q,U=(Ke|0)<(U|0)?Ke:U,Be=(U|0)>0,M=Be?U:0,N=N-(Be?U:0)|0,U=Ke-(Be?U:0)|0}M=b+(M-q)|0,Me=(M|0)<0,N=E-N-(Me?M:0)|0,q=(N|0)<0,Be=g-U+(Me?0-M|0:0)+(q?0-N|0:0)|0,b=(Be|0)<0,U=b?0:Be,be=(q?0:N)-(b?Be:0)|0,Be=(Me?0:M)-(q?N:0)-(b?Be:0)|0,b=(be|0)<(Be|0)?be:Be,b=(U|0)<(b|0)?U:b,g=(b|0)>0,Be=Be-(g?b:0)|0,N=_,q=h[N>>2]|0,N=h[N+4>>2]|0,E=(15-ae|0)*3|0,M=ft(7,0,E|0)|0,M=q&~M,N=N&~(ee()|0),q=(Be|0)<0,Me=q?Be:0,be=be-(g?b:0)-Me|0,Ke=(be|0)<0,Me=(Ke?0-be|0:0)+(U-(g?b:0)-Me)|0,b=(Me|0)<0,g=b?0:Me,Me=b?Me:0,b=(Ke?0:be)-Me|0,Me=(q?0:Be)-(Ke?be:0)-Me|0,be=(b|0)<(Me|0)?b:Me,be=(g|0)<(be|0)?g:be,be=(be|0)>0?be:0,g=g-be|0,b=b-be|0;e:do switch(Me-be|0){case 0:switch(b|0){case 0:{g=(g|0)==0?0:(g|0)==1?1:7;break e}case 1:{g=(g|0)==0?2:(g|0)==1?3:7;break e}default:{se=45;break e}}case 1:switch(b|0){case 0:{g=(g|0)==0?4:(g|0)==1?5:7;break e}case 1:if(g){se=45;break e}else{g=6;break e}default:{se=45;break e}}default:se=45}while(!1);if((se|0)==45&&(se=0,g=7),Ke=ft(g|0,0,E|0)|0,Me=ee()|0|N,be=_,h[be>>2]=Ke|M,h[be+4>>2]=Me,(ae|0)<=1){se=47;break}else b=j,E=X,g=K}if((se|0)==24)di(27634,27425,416,27447);else if((se|0)==36)di(27634,27425,464,27461);else if((se|0)==47){if((j|0)>1|(X|0)>1|(K|0)>1)return be=1,be|0;Be=(j|0)<0,Me=Be?j:0,be=X-Me|0,Ke=(be|0)<0,Me=(Ke?0-be|0:0)+(K-Me)|0,x=(Me|0)<0,g=x?0:Me,Me=x?Me:0,x=(Ke?0:be)-Me|0,Me=(Be?0:j)-(Ke?be:0)-Me|0,be=(x|0)<(Me|0)?x:Me,be=(g|0)<(be|0)?g:be,be=(be|0)>0?be:0,g=g-be|0,x=x-be|0;e:do switch(Me-be|0){case 0:switch(x|0){case 0:{x=(g|0)==0?0:(g|0)==1?1:7;break e}case 1:{x=(g|0)==0?2:(g|0)==1?3:7;break e}default:{se=55;break e}}case 1:switch(x|0){case 0:{x=(g|0)==0?4:(g|0)==1?5:7;break e}case 1:if(g){se=55;break e}else{x=6;break e}default:{se=55;break e}}default:se=55}while(!1);(se|0)==55&&(x=7),E=rL(Ae,x)|0,(E|0)==127?N=0:N=yr(E)|0;e:do if(x){if(ue){if(g=ll(p,m)|0,(g|0)==7)return be=5,be|0;b=h[21344+(g*28|0)+(x<<2)>>2]|0;t:do if((b|0)>0)for(g=x,x=0;;){switch(g|0){case 1:{g=5;break}case 5:{g=4;break}case 4:{g=6;break}case 6:{g=2;break}case 2:{g=3;break}case 3:{g=1;break}default:}if(x=x+1|0,(x|0)==(b|0))break t}else g=x;while(!1);if((g|0)==1)return be=9,be|0;x=rL(Ae,g)|0,(x|0)==127&&di(27476,27315,415,27506),yr(x)|0?di(27521,27315,416,27506):(v=x,we=b,xe=g)}else v=E,we=0,xe=x;if(M=h[4272+(Ae*28|0)+(xe<<2)>>2]|0,(M|0)<=-1&&di(27552,27315,423,27506),!N){if((we|0)<0)return be=5,be|0;if(we|0){b=_,g=0,x=h[b>>2]|0,b=h[b+4>>2]|0;do x=km(x,b)|0,b=ee()|0,be=_,h[be>>2]=x,h[be+4>>2]=b,g=g+1|0;while((g|0)<(we|0))}if((M|0)<=0){se=104;break}for(b=_,g=0,x=h[b>>2]|0,b=h[b+4>>2]|0;;)if(x=km(x,b)|0,b=ee()|0,be=_,h[be>>2]=x,h[be+4>>2]=b,g=g+1|0,(g|0)==(M|0)){se=104;break e}}if(E=sL(v,Ae)|0,(E|0)==7&&di(27291,27315,432,27506),g=_,x=h[g>>2]|0,g=h[g+4>>2]|0,(M|0)>0){b=0;do x=km(x,g)|0,g=ee()|0,be=_,h[be>>2]=x,h[be+4>>2]=g,b=b+1|0;while((b|0)!=(M|0))}if(g=ll(x,g)|0,(g|0)==7&&di(27634,27315,444,27506),x=iL(v)|0,x=h[(x?21760:21552)+(E*28|0)+(g<<2)>>2]|0,(x|0)<0&&di(27634,27315,458,27506),!x)se=104;else{E=_,g=0,b=h[E>>2]|0,E=h[E+4>>2]|0;do b=dL(b,E)|0,E=ee()|0,be=_,h[be>>2]=b,h[be+4>>2]=E,g=g+1|0;while((g|0)<(x|0));se=104}}else if((ue|0)!=0&(N|0)!=0){if(v=ll(p,m)|0,g=_,g=ll(h[g>>2]|0,h[g+4>>2]|0)|0,(v|0)==7|(g|0)==7||(g=h[21344+(v*28|0)+(g<<2)>>2]|0,(g|0)<0))return be=5,be|0;if(!g)v=E,se=105;else{b=_,v=0,x=h[b>>2]|0,b=h[b+4>>2]|0;do x=km(x,b)|0,b=ee()|0,be=_,h[be>>2]=x,h[be+4>>2]=b,v=v+1|0;while((v|0)<(g|0));v=E,se=104}}else v=E,se=104;while(!1);return(se|0)==104&&N&&(se=105),(se|0)==105&&(be=_,(ll(h[be>>2]|0,h[be+4>>2]|0)|0)==1)?(be=9,be|0):(Me=_,Be=h[Me>>2]|0,Me=h[Me+4>>2]&-1040385,Ke=ft(v|0,0,45)|0,Me=Me|(ee()|0),be=_,h[be>>2]=Be|Ke,h[be+4>>2]=Me,be=0,be|0)}else if((se|0)==107)return v|0;return 0}function Bue(p,m,g,_,v,x){p=p|0,m=m|0,g=g|0,_=_|0,v=v|0,x=x|0;var b=0,E=0;return E=Q,Q=Q+16|0,b=E,v|0?(b=15,Q=E,b|0):(p=Yx(p,m,g,_,b)|0,p||(v=h[b+4>>2]|0,p=h[b+8>>2]|0,h[x>>2]=(h[b>>2]|0)-p,h[x+4>>2]=v-p,p=0),b=p,Q=E,b|0)}function Oue(p,m,g,_,v){p=p|0,m=m|0,g=g|0,_=_|0,v=v|0;var x=0,b=0,E=0,M=0,N=0,U=0,q=0;return q=Q,Q=Q+16|0,U=q,_|0?(U=15,Q=q,U|0):(E=h[g>>2]|0,b=h[g+4>>2]|0,h[U>>2]=E,M=U+4|0,h[M>>2]=b,N=U+8|0,h[N>>2]=0,g=(b|0)<(E|0),_=g?E:b,g=g?b:E,(g|0)<0?!((g|0)==-2147483648||((_|0)>0?(2147483647-_|0)<(g|0):(-2147483648-_|0)>(g|0)))&&!((_|0)>-1?(_|-2147483648|0)>=(g|0):(_^-2147483648|0)<(g|0))?x=5:_=1:x=5,(x|0)==5&&(_=b-E|0,x=0-E|0,(E|0)<0?(h[M>>2]=_,h[N>>2]=x,h[U>>2]=0,E=0):(_=b,x=0),b=E-_|0,g=x-_|0,(_|0)<0?(h[U>>2]=b,h[N>>2]=g,h[M>>2]=0,E=b,_=0):g=x,b=E-g|0,x=_-g|0,(g|0)<0?(h[U>>2]=b,h[M>>2]=x,h[N>>2]=0,g=0):(x=_,b=E),_=(x|0)<(b|0)?x:b,_=(g|0)<(_|0)?g:_,(_|0)>0&&(h[U>>2]=b-_,h[M>>2]=x-_,h[N>>2]=g-_),_=xq(p,m,U,v)|0),U=_,Q=q,U|0)}function xL(p,m,g,_,v){p=p|0,m=m|0,g=g|0,_=_|0,v=v|0;var x=0,b=0,E=0,M=0,N=0;return M=Q,Q=Q+32|0,b=M+12|0,E=M,x=Yx(p,m,p,m,b)|0,x|0?(E=x,Q=M,E|0):(p=Yx(p,m,g,_,E)|0,p|0?(E=p,Q=M,E|0):(p=(h[b>>2]|0)-(h[E>>2]|0)|0,N=(p|0)<0,_=N?0-p|0:0,g=_+((h[b+4>>2]|0)-(h[E+4>>2]|0))|0,m=(g|0)<0,_=(h[b+8>>2]|0)-(h[E+8>>2]|0)+_+(m?0-g|0:0)|0,x=(_|0)<0,b=x?0:_,_=x?_:0,x=(m?0:g)-_|0,_=(N?0:p)-(m?g:0)-_|0,E=(x|0)<(_|0)?x:_,E=(b|0)<(E|0)?b:E,E=(E|0)>0?E:0,b=b-E|0,x=x-E|0,E=_-E|0,E=(E|0)>-1?E:0-E|0,x=(x|0)>-1?x:0-x|0,b=(b|0)>-1?b:0-b|0,b=(x|0)>(b|0)?x:b,b=(E|0)>(b|0)?E:b,E=v,h[E>>2]=b,h[E+4>>2]=((b|0)<0)<<31>>31,E=0,Q=M,E|0))}function Uue(p,m,g,_,v){p=p|0,m=m|0,g=g|0,_=_|0,v=v|0;var x=0,b=0;return b=Q,Q=Q+16|0,x=b,p=xL(p,m,g,_,x)|0,p|0?(x=p,Q=b,x|0):(g=x,g=At(h[g>>2]|0,h[g+4>>2]|0,1,0)|0,_=ee()|0,x=v,h[x>>2]=g,h[x+4>>2]=_,x=0,Q=b,x|0)}function kue(p,m,g,_,v){p=p|0,m=m|0,g=g|0,_=_|0,v=v|0;var x=0,b=0,E=0,M=0;return M=Q,Q=Q+16|0,x=M,b=xL(p,m,g,_,x)|0,b|0?(v=b,Q=M,v|0):(b=x,x=h[b>>2]|0,b=h[b+4>>2]|0,(x|0)==0&(b|0)==0?(h[v>>2]=p,h[v+4>>2]=m,v=0,Q=M,v|0):(E=yq(p,m,g,_,x,b,v,0,0,1,0)|0,E?(v=(yq(g,_,p,m,x,b,v,x,b,-1,-1)|0)==0,v=v?0:E,Q=M,v|0):(v=0,Q=M,v|0)))}function yq(p,m,g,_,v,x,b,E,M,N,U){p=p|0,m=m|0,g=g|0,_=_|0,v=v|0,x=x|0,b=b|0,E=E|0,M=M|0,N=N|0,U=U|0;var q=0,j=0,X=0,K=0,ae=0,ue=0,xe=0,se=0,we=0,Ae=0,Be=0,Ke=0,Me=0,be=0,gt=0,je=0,Ut=0,lt=0;if(Ut=Q,Q=Q+48|0,q=Ut+24|0,j=Ut+12|0,je=Ut,h[q>>2]=0,h[q+4>>2]=0,h[q+8>>2]=0,h[j>>2]=0,h[j+4>>2]=0,h[j+8>>2]=0,Yx(p,m,p,m,q)|0&&di(27634,27315,696,27575),Yx(p,m,g,_,j)|0&&di(27634,27315,701,27575),ae=q+8|0,_=h[ae>>2]|0,g=_-(h[q>>2]|0)|0,h[q>>2]=g,gt=q+4|0,_=(h[gt>>2]|0)-_|0,h[gt>>2]=_,gt=_+g|0,q=0-gt|0,h[ae>>2]=q,ae=j+8|0,se=h[ae>>2]|0,xe=se-(h[j>>2]|0)|0,h[j>>2]=xe,be=j+4|0,se=(h[be>>2]|0)-se|0,h[be>>2]=se,be=se+xe|0,h[ae>>2]=0-be,Me=1/(+(v>>>0)+4294967296*+(x|0)),Be=Me*+(xe-g|0),Ke=Me*+(se-_|0),Me=Me*+(gt-be|0),h[je>>2]=g,be=je+4|0,h[be>>2]=_,gt=je+8|0,h[gt>>2]=q,(x|0)<0)return N=0,Q=Ut,N|0;for(Ae=+(g|0),we=+(_|0),ue=+(q|0),xe=0,se=0;;){if(K=+(xe>>>0)+4294967296*+(se|0),lt=Be*K+Ae,X=Ke*K+we,K=Me*K+ue,_=~~+mT(+lt),q=~~+mT(+X),g=~~+mT(+K),lt=+Ks(+(+(_|0)-lt)),X=+Ks(+(+(q|0)-X)),K=+Ks(+(+(g|0)-K)),lt>X<>K?(j=g+q|0,_=0-j|0):(j=0-_|0,X>K&&(q=j-g|0)),h[be>>2]=q,h[je>>2]=j,h[gt>>2]=0,g=_+q|0,(_|0)>0?(h[be>>2]=g,h[gt>>2]=_,h[je>>2]=0,j=0):(g=q,_=0),(g|0)<0?(q=j-g|0,h[je>>2]=q,_=_-g|0,h[gt>>2]=_,h[be>>2]=0,j=q-_|0,g=0-_|0,(_|0)<0?(h[je>>2]=j,h[be>>2]=g,h[gt>>2]=0,ae=g,_=0):(ae=0,j=q)):ae=g,g=(ae|0)<(j|0)?ae:j,g=(_|0)<(g|0)?_:g,(g|0)>0&&(h[je>>2]=j-g,h[be>>2]=ae-g,h[gt>>2]=_-g),g=wr(xe|0,se|0,N|0,U|0)|0,g=At(g|0,ee()|0,E|0,M|0)|0,ee()|0,g=xq(p,m,je,b+(g<<3)|0)|0,g|0){_=20;break}if(ae=xe,xe=At(xe|0,se|0,1,0)|0,j=se,se=ee()|0,!((j|0)<(x|0)|(j|0)==(x|0)&ae>>>0<v>>>0)){g=0,_=20;break}}return(_|0)==20?(Q=Ut,g|0):0}function sp(p,m,g,_){p=p|0,m=m|0,g=g|0,_=_|0;var v=0,x=0,b=0;if((g|0)==0&(_|0)==0)return v=0,x=1,On(v|0),x|0;x=p,v=m,p=1,m=0;do b=(g&1|0)==0&!0,p=wr((b?1:x)|0,(b?0:v)|0,p|0,m|0)|0,m=ee()|0,g=Fq(g|0,_|0,1)|0,_=ee()|0,x=wr(x|0,v|0,x|0,v|0)|0,v=ee()|0;while(!((g|0)==0&(_|0)==0));return On(m|0),p|0}function yL(p,m,g,_){p=p|0,m=m|0,g=g|0,_=_|0;var v=0,x=0,b=0,E=0,M=0,N=0,U=0;E=Q,Q=Q+16|0,x=E,b=tt(p|0,m|0,52)|0,ee()|0,b=b&15;do if(b){if(v=w1(p,m,x)|0,!v){N=+ie[x>>3],M=1/+ii(+N),U=+ie[26032+(b<<3)>>3],ie[g>>3]=N+U,ie[g+8>>3]=N-U,N=+ie[x+8>>3],M=U*M,ie[g+16>>3]=M+N,ie[g+24>>3]=N-M;break}return b=v,Q=E,b|0}else{if(v=tt(p|0,m|0,45)|0,ee()|0,v=v&127,v>>>0>121)return b=5,Q=E,b|0;x=22128+(v<<5)|0,h[g>>2]=h[x>>2],h[g+4>>2]=h[x+4>>2],h[g+8>>2]=h[x+8>>2],h[g+12>>2]=h[x+12>>2],h[g+16>>2]=h[x+16>>2],h[g+20>>2]=h[x+20>>2],h[g+24>>2]=h[x+24>>2],h[g+28>>2]=h[x+28>>2];break}while(!1);return Jce(g,_?1.4:1.1),_=26160+(b<<3)|0,(h[_>>2]|0)==(p|0)&&(h[_+4>>2]|0)==(m|0)&&(ie[g>>3]=1.5707963267948966),b=26288+(b<<3)|0,(h[b>>2]|0)==(p|0)&&(h[b+4>>2]|0)==(m|0)&&(ie[g+8>>3]=-1.5707963267948966),+ie[g>>3]!=1.5707963267948966&&+ie[g+8>>3]!=-1.5707963267948966?(b=0,Q=E,b|0):(ie[g+16>>3]=3.141592653589793,ie[g+24>>3]=-3.141592653589793,b=0,Q=E,b|0)}function zue(p,m,g,_){p=p|0,m=m|0,g=g|0,_=_|0;var v=0,x=0,b=0,E=0,M=0,N=0,U=0;N=Q,Q=Q+48|0,b=N+32|0,x=N+40|0,E=N,hL(b,0,0,0),M=h[b>>2]|0,b=h[b+4>>2]|0;do if(g>>>0<=15){if(v=Kx(_)|0,v|0){_=E,h[_>>2]=0,h[_+4>>2]=0,h[E+8>>2]=v,h[E+12>>2]=-1,_=E+16|0,M=E+29|0,h[_>>2]=0,h[_+4>>2]=0,h[_+8>>2]=0,He[_+12>>0]=0,He[M>>0]=He[x>>0]|0,He[M+1>>0]=He[x+1>>0]|0,He[M+2>>0]=He[x+2>>0]|0;break}if(v=Ea((h[m+8>>2]|0)+1|0,32)|0,v){bL(m,v),U=E,h[U>>2]=M,h[U+4>>2]=b,h[E+8>>2]=0,h[E+12>>2]=g,h[E+16>>2]=_,h[E+20>>2]=m,h[E+24>>2]=v,He[E+28>>0]=0,M=E+29|0,He[M>>0]=He[x>>0]|0,He[M+1>>0]=He[x+1>>0]|0,He[M+2>>0]=He[x+2>>0]|0;break}else{_=E,h[_>>2]=0,h[_+4>>2]=0,h[E+8>>2]=13,h[E+12>>2]=-1,_=E+16|0,M=E+29|0,h[_>>2]=0,h[_+4>>2]=0,h[_+8>>2]=0,He[_+12>>0]=0,He[M>>0]=He[x>>0]|0,He[M+1>>0]=He[x+1>>0]|0,He[M+2>>0]=He[x+2>>0]|0;break}}else M=E,h[M>>2]=0,h[M+4>>2]=0,h[E+8>>2]=4,h[E+12>>2]=-1,M=E+16|0,U=E+29|0,h[M>>2]=0,h[M+4>>2]=0,h[M+8>>2]=0,He[M+12>>0]=0,He[U>>0]=He[x>>0]|0,He[U+1>>0]=He[x+1>>0]|0,He[U+2>>0]=He[x+2>>0]|0;while(!1);lT(E),h[p>>2]=h[E>>2],h[p+4>>2]=h[E+4>>2],h[p+8>>2]=h[E+8>>2],h[p+12>>2]=h[E+12>>2],h[p+16>>2]=h[E+16>>2],h[p+20>>2]=h[E+20>>2],h[p+24>>2]=h[E+24>>2],h[p+28>>2]=h[E+28>>2],Q=N}function lT(p){p=p|0;var m=0,g=0,_=0,v=0,x=0,b=0,E=0,M=0,N=0,U=0,q=0,j=0,X=0,K=0,ae=0,ue=0,xe=0,se=0,we=0,Ae=0;if(Ae=Q,Q=Q+336|0,X=Ae+168|0,K=Ae,_=p,g=h[_>>2]|0,_=h[_+4>>2]|0,(g|0)==0&(_|0)==0){Q=Ae;return}if(m=p+28|0,He[m>>0]|0?(g=bq(g,_)|0,_=ee()|0):He[m>>0]=1,we=p+20|0,!(h[h[we>>2]>>2]|0)){m=p+24|0,g=h[m>>2]|0,g|0&&_t(g),se=p,h[se>>2]=0,h[se+4>>2]=0,h[p+8>>2]=0,h[we>>2]=0,h[p+12>>2]=-1,h[p+16>>2]=0,h[m>>2]=0,Q=Ae;return}se=p+16|0,m=h[se>>2]|0,v=m&15;e:do if((g|0)==0&(_|0)==0)xe=p+24|0;else{ae=p+12|0,q=(v|0)==3,U=m&255,M=(v|1|0)==3,j=p+24|0,N=(v+-1|0)>>>0<3,b=(v|2|0)==3,E=K+8|0;t:for(;;){if(x=tt(g|0,_|0,52)|0,ee()|0,x=x&15,(x|0)==(h[ae>>2]|0)){switch(U&15){case 0:case 2:case 3:{if(v=w1(g,_,X)|0,v|0){ue=15;break t}if(wL(h[we>>2]|0,h[j>>2]|0,X)|0){ue=19;break t}break}default:}if(M&&(v=h[(h[we>>2]|0)+4>>2]|0,h[X>>2]=h[v>>2],h[X+4>>2]=h[v+4>>2],h[X+8>>2]=h[v+8>>2],h[X+12>>2]=h[v+12>>2],oq(26896,X)|0)){if(mL(h[(h[we>>2]|0)+4>>2]|0,x,K)|0){ue=25;break}if(v=K,(h[v>>2]|0)==(g|0)&&(h[v+4>>2]|0)==(_|0)){ue=29;break}}if(N){if(v=zm(g,_,X)|0,v|0){ue=32;break}if(yL(g,_,K,0)|0){ue=36;break}if(b&&Sq(h[we>>2]|0,h[j>>2]|0,X,K)|0){ue=42;break}if(M&&Tq(h[we>>2]|0,h[j>>2]|0,X,K)|0){ue=42;break}}if(q){if(m=yL(g,_,X,1)|0,v=h[j>>2]|0,m|0){ue=45;break}if(oL(v,X)|0){if(lq(K,X),aq(X,h[j>>2]|0)|0){ue=53;break}if(wL(h[we>>2]|0,h[j>>2]|0,E)|0){ue=53;break}if(Tq(h[we>>2]|0,h[j>>2]|0,K,X)|0){ue=53;break}}}}do if((x|0)<(h[ae>>2]|0)){if(m=yL(g,_,X,1)|0,v=h[j>>2]|0,m|0){ue=58;break t}if(!(oL(v,X)|0)){ue=73;break}if(aq(h[j>>2]|0,X)|0&&(lq(K,X),Sq(h[we>>2]|0,h[j>>2]|0,K,X)|0)){ue=65;break t}if(g=Aq(g,_,x+1|0,K)|0,g|0){ue=67;break t}_=K,g=h[_>>2]|0,_=h[_+4>>2]|0}else ue=73;while(!1);if((ue|0)==73&&(ue=0,g=bq(g,_)|0,_=ee()|0),(g|0)==0&(_|0)==0){xe=j;break e}}switch(ue|0){case 15:{m=h[j>>2]|0,m|0&&_t(m),ue=p,h[ue>>2]=0,h[ue+4>>2]=0,h[we>>2]=0,h[ae>>2]=-1,h[se>>2]=0,h[j>>2]=0,h[p+8>>2]=v,ue=20;break}case 19:{h[p>>2]=g,h[p+4>>2]=_,ue=20;break}case 25:{di(27634,27600,470,27611);break}case 29:{h[p>>2]=g,h[p+4>>2]=_,Q=Ae;return}case 32:{m=h[j>>2]|0,m|0&&_t(m),xe=p,h[xe>>2]=0,h[xe+4>>2]=0,h[we>>2]=0,h[ae>>2]=-1,h[se>>2]=0,h[j>>2]=0,h[p+8>>2]=v,Q=Ae;return}case 36:{di(27634,27600,493,27611);break}case 42:{h[p>>2]=g,h[p+4>>2]=_,Q=Ae;return}case 45:{v|0&&_t(v),ue=p,h[ue>>2]=0,h[ue+4>>2]=0,h[we>>2]=0,h[ae>>2]=-1,h[se>>2]=0,h[j>>2]=0,h[p+8>>2]=m,ue=55;break}case 53:{h[p>>2]=g,h[p+4>>2]=_,ue=55;break}case 58:{v|0&&_t(v),ue=p,h[ue>>2]=0,h[ue+4>>2]=0,h[we>>2]=0,h[ae>>2]=-1,h[se>>2]=0,h[j>>2]=0,h[p+8>>2]=m,ue=71;break}case 65:{h[p>>2]=g,h[p+4>>2]=_,ue=71;break}case 67:{m=h[j>>2]|0,m|0&&_t(m),xe=p,h[xe>>2]=0,h[xe+4>>2]=0,h[we>>2]=0,h[ae>>2]=-1,h[se>>2]=0,h[j>>2]=0,h[p+8>>2]=g,Q=Ae;return}}if((ue|0)==20){Q=Ae;return}else if((ue|0)==55){Q=Ae;return}else if((ue|0)==71){Q=Ae;return}}while(!1);m=h[xe>>2]|0,m|0&&_t(m),ue=p,h[ue>>2]=0,h[ue+4>>2]=0,h[p+8>>2]=0,h[we>>2]=0,h[p+12>>2]=-1,h[se>>2]=0,h[xe>>2]=0,Q=Ae}function bq(p,m){p=p|0,m=m|0;var g=0,_=0,v=0,x=0,b=0,E=0,M=0,N=0,U=0,q=0;q=Q,Q=Q+16|0,U=q,_=tt(p|0,m|0,52)|0,ee()|0,_=_&15,g=tt(p|0,m|0,45)|0,ee()|0;do if(_){for(;g=ft(_+4095|0,0,52)|0,v=ee()|0|m&-15728641,x=(15-_|0)*3|0,b=ft(7,0,x|0)|0,E=ee()|0,g=g|p|b,v=v|E,M=tt(p|0,m|0,x|0)|0,ee()|0,M=M&7,_=_+-1|0,!(M>>>0<6);)if(_)m=v,p=g;else{N=4;break}if((N|0)==4){g=tt(g|0,v|0,45)|0,ee()|0;break}return U=(M|0)==0&(Zi(g,v)|0)!=0,U=ft((U?2:1)+M|0,0,x|0)|0,N=ee()|0|m&~E,U=U|p&~b,On(N|0),Q=q,U|0}while(!1);return g=g&127,g>>>0>120?(N=0,U=0,On(N|0),Q=q,U|0):(hL(U,0,g+1|0,0),N=h[U+4>>2]|0,U=h[U>>2]|0,On(N|0),Q=q,U|0)}function Vue(p,m,g,_,v,x){p=p|0,m=m|0,g=g|0,_=_|0,v=v|0,x=x|0;var b=0,E=0,M=0,N=0,U=0,q=0,j=0,X=0,K=0,ae=0,ue=0;ue=Q,Q=Q+160|0,q=ue+80|0,E=ue+64|0,j=ue+112|0,ae=ue,zue(q,p,m,g),N=q,vL(E,h[N>>2]|0,h[N+4>>2]|0,m),N=E,M=h[N>>2]|0,N=h[N+4>>2]|0,b=h[q+8>>2]|0,X=j+4|0,h[X>>2]=h[q>>2],h[X+4>>2]=h[q+4>>2],h[X+8>>2]=h[q+8>>2],h[X+12>>2]=h[q+12>>2],h[X+16>>2]=h[q+16>>2],h[X+20>>2]=h[q+20>>2],h[X+24>>2]=h[q+24>>2],h[X+28>>2]=h[q+28>>2],X=ae,h[X>>2]=M,h[X+4>>2]=N,X=ae+8|0,h[X>>2]=b,p=ae+12|0,m=j,g=p+36|0;do h[p>>2]=h[m>>2],p=p+4|0,m=m+4|0;while((p|0)<(g|0));if(j=ae+48|0,h[j>>2]=h[E>>2],h[j+4>>2]=h[E+4>>2],h[j+8>>2]=h[E+8>>2],h[j+12>>2]=h[E+12>>2],(M|0)==0&(N|0)==0)return ae=b,Q=ue,ae|0;g=ae+16|0,U=ae+24|0,q=ae+28|0,b=0,E=0,m=M,p=N;do{if(!((b|0)<(v|0)|(b|0)==(v|0)&E>>>0<_>>>0)){K=4;break}if(N=E,E=At(E|0,b|0,1,0)|0,b=ee()|0,N=x+(N<<3)|0,h[N>>2]=m,h[N+4>>2]=p,_L(j),p=j,m=h[p>>2]|0,p=h[p+4>>2]|0,(m|0)==0&(p|0)==0){if(lT(g),m=g,p=h[m>>2]|0,m=h[m+4>>2]|0,(p|0)==0&(m|0)==0){K=10;break}vq(p,m,h[q>>2]|0,j),p=j,m=h[p>>2]|0,p=h[p+4>>2]|0}N=ae,h[N>>2]=m,h[N+4>>2]=p}while(!((m|0)==0&(p|0)==0));return(K|0)==4?(p=ae+40|0,m=h[p>>2]|0,m|0&&_t(m),K=ae+16|0,h[K>>2]=0,h[K+4>>2]=0,h[U>>2]=0,h[ae+36>>2]=0,h[q>>2]=-1,h[ae+32>>2]=0,h[p>>2]=0,vq(0,0,0,j),h[ae>>2]=0,h[ae+4>>2]=0,h[X>>2]=0,ae=14,Q=ue,ae|0):((K|0)==10&&(h[ae>>2]=0,h[ae+4>>2]=0,h[X>>2]=h[U>>2]),ae=h[X>>2]|0,Q=ue,ae|0)}function Gue(p,m,g,_){p=p|0,m=m|0,g=g|0,_=_|0;var v=0,x=0,b=0,E=0,M=0,N=0,U=0,q=0,j=0,X=0;if(q=Q,Q=Q+48|0,M=q+32|0,E=q+40|0,N=q,!(h[p>>2]|0))return U=_,h[U>>2]=0,h[U+4>>2]=0,U=0,Q=q,U|0;hL(M,0,0,0),b=M,v=h[b>>2]|0,b=h[b+4>>2]|0;do if(m>>>0>15)U=N,h[U>>2]=0,h[U+4>>2]=0,h[N+8>>2]=4,h[N+12>>2]=-1,U=N+16|0,g=N+29|0,h[U>>2]=0,h[U+4>>2]=0,h[U+8>>2]=0,He[U+12>>0]=0,He[g>>0]=He[E>>0]|0,He[g+1>>0]=He[E+1>>0]|0,He[g+2>>0]=He[E+2>>0]|0,g=4,U=9;else{if(g=Kx(g)|0,g|0){M=N,h[M>>2]=0,h[M+4>>2]=0,h[N+8>>2]=g,h[N+12>>2]=-1,M=N+16|0,U=N+29|0,h[M>>2]=0,h[M+4>>2]=0,h[M+8>>2]=0,He[M+12>>0]=0,He[U>>0]=He[E>>0]|0,He[U+1>>0]=He[E+1>>0]|0,He[U+2>>0]=He[E+2>>0]|0,U=9;break}if(g=Ea((h[p+8>>2]|0)+1|0,32)|0,!g){U=N,h[U>>2]=0,h[U+4>>2]=0,h[N+8>>2]=13,h[N+12>>2]=-1,U=N+16|0,g=N+29|0,h[U>>2]=0,h[U+4>>2]=0,h[U+8>>2]=0,He[U+12>>0]=0,He[g>>0]=He[E>>0]|0,He[g+1>>0]=He[E+1>>0]|0,He[g+2>>0]=He[E+2>>0]|0,g=13,U=9;break}bL(p,g),X=N,h[X>>2]=v,h[X+4>>2]=b,b=N+8|0,h[b>>2]=0,h[N+12>>2]=m,h[N+20>>2]=p,h[N+24>>2]=g,He[N+28>>0]=0,v=N+29|0,He[v>>0]=He[E>>0]|0,He[v+1>>0]=He[E+1>>0]|0,He[v+2>>0]=He[E+2>>0]|0,h[N+16>>2]=3,j=+Zce(g),j=j*+$ce(g),x=+Ks(+ +ie[g>>3]),x=j/+ii(+ +pT(+x,+ +Ks(+ +ie[g+8>>3])))*6371.007180918475*6371.007180918475,v=N+12|0,g=h[v>>2]|0;e:do if((g|0)>0)do{if(_q(g+-1|0,M)|0,!(x/+ie[M>>3]>10))break e;X=h[v>>2]|0,g=X+-1|0,h[v>>2]=g}while((X|0)>1);while(!1);if(lT(N),v=_,h[v>>2]=0,h[v+4>>2]=0,v=N,g=h[v>>2]|0,v=h[v+4>>2]|0,!((g|0)==0&(v|0)==0))do jx(g,v,m,M)|0,E=M,p=_,E=At(h[p>>2]|0,h[p+4>>2]|0,h[E>>2]|0,h[E+4>>2]|0)|0,p=ee()|0,X=_,h[X>>2]=E,h[X+4>>2]=p,lT(N),X=N,g=h[X>>2]|0,v=h[X+4>>2]|0;while(!((g|0)==0&(v|0)==0));g=h[b>>2]|0}while(!1);return X=g,Q=q,X|0}function Zx(p,m,g){p=p|0,m=m|0,g=g|0;var _=0,v=0,x=0,b=0,E=0,M=0,N=0,U=0,q=0,j=0;if(!(oq(m,g)|0)||(m=Yce(m)|0,_=+ie[g>>3],v=+ie[g+8>>3],v=m&v<0?v+6.283185307179586:v,j=h[p>>2]|0,(j|0)<=0))return j=0,j|0;if(q=h[p+4>>2]|0,m){m=0,U=v,g=-1,p=0;e:for(;;){for(N=p;b=+ie[q+(N<<4)>>3],v=+ie[q+(N<<4)+8>>3],p=(g+2|0)%(j|0)|0,x=+ie[q+(p<<4)>>3],E=+ie[q+(p<<4)+8>>3],b>x?(M=b,b=E):(M=x,x=b,b=v,v=E),_=_==x|_==M?_+2220446049250313e-31:_,!!(_<x|_>M);)if(g=N+1|0,(g|0)>=(j|0)){g=22;break e}else p=N,N=g,g=p;if(E=b<0?b+6.283185307179586:b,b=v<0?v+6.283185307179586:v,U=E==U|b==U?U+-2220446049250313e-31:U,M=E+(b-E)*((_-x)/(M-x)),(M<0?M+6.283185307179586:M)>U&&(m=m^1),p=N+1|0,(p|0)>=(j|0)){g=22;break}else g=N}if((g|0)==22)return m|0}else{m=0,U=v,g=-1,p=0;e:for(;;){for(N=p;b=+ie[q+(N<<4)>>3],v=+ie[q+(N<<4)+8>>3],p=(g+2|0)%(j|0)|0,x=+ie[q+(p<<4)>>3],E=+ie[q+(p<<4)+8>>3],b>x?(M=b,b=E):(M=x,x=b,b=v,v=E),_=_==x|_==M?_+2220446049250313e-31:_,!!(_<x|_>M);)if(g=N+1|0,(g|0)>=(j|0)){g=22;break e}else p=N,N=g,g=p;if(U=b==U|v==U?U+-2220446049250313e-31:U,b+(v-b)*((_-x)/(M-x))>U&&(m=m^1),p=N+1|0,(p|0)>=(j|0)){g=22;break}else g=N}if((g|0)==22)return m|0}return 0}function wq(p,m){p=p|0,m=m|0;var g=0,_=0,v=0,x=0,b=0,E=0,M=0,N=0,U=0,q=0,j=0,X=0,K=0,ae=0,ue=0,xe=0,se=0;if(K=h[p>>2]|0,!K){h[m>>2]=0,h[m+4>>2]=0,h[m+8>>2]=0,h[m+12>>2]=0,h[m+16>>2]=0,h[m+20>>2]=0,h[m+24>>2]=0,h[m+28>>2]=0;return}if(ae=m+8|0,ie[ae>>3]=17976931348623157e292,ue=m+24|0,ie[ue>>3]=17976931348623157e292,ie[m>>3]=-17976931348623157e292,xe=m+16|0,ie[xe>>3]=-17976931348623157e292,!((K|0)<=0)){for(j=h[p+4>>2]|0,N=17976931348623157e292,U=-17976931348623157e292,q=0,p=-1,x=17976931348623157e292,b=17976931348623157e292,M=-17976931348623157e292,_=-17976931348623157e292,X=0;g=+ie[j+(X<<4)>>3],E=+ie[j+(X<<4)+8>>3],p=p+2|0,v=+ie[j+(((p|0)==(K|0)?0:p)<<4)+8>>3],g<x&&(ie[ae>>3]=g,x=g),E<b&&(ie[ue>>3]=E,b=E),g>M?ie[m>>3]=g:g=M,E>_&&(ie[xe>>3]=E,_=E),N=E>0&E<N?E:N,U=E<0&E>U?E:U,q=q|+Ks(+(E-v))>3.141592653589793,p=X+1|0,(p|0)!=(K|0);)se=X,M=g,X=p,p=se;q&&(ie[xe>>3]=U,ie[ue>>3]=N)}}function Kx(p){return p=p|0,(p>>>0<4?0:15)|0}function bL(p,m){p=p|0,m=m|0;var g=0,_=0,v=0,x=0,b=0,E=0,M=0,N=0,U=0,q=0,j=0,X=0,K=0,ae=0,ue=0,xe=0,se=0,we=0,Ae=0,Be=0,Ke=0,Me=0;if(K=h[p>>2]|0,K){if(ae=m+8|0,ie[ae>>3]=17976931348623157e292,ue=m+24|0,ie[ue>>3]=17976931348623157e292,ie[m>>3]=-17976931348623157e292,xe=m+16|0,ie[xe>>3]=-17976931348623157e292,(K|0)>0){for(v=h[p+4>>2]|0,j=17976931348623157e292,X=-17976931348623157e292,_=0,g=-1,M=17976931348623157e292,N=17976931348623157e292,q=-17976931348623157e292,b=-17976931348623157e292,se=0;x=+ie[v+(se<<4)>>3],U=+ie[v+(se<<4)+8>>3],Ke=g+2|0,E=+ie[v+(((Ke|0)==(K|0)?0:Ke)<<4)+8>>3],x<M&&(ie[ae>>3]=x,M=x),U<N&&(ie[ue>>3]=U,N=U),x>q?ie[m>>3]=x:x=q,U>b&&(ie[xe>>3]=U,b=U),j=U>0&U<j?U:j,X=U<0&U>X?U:X,_=_|+Ks(+(U-E))>3.141592653589793,g=se+1|0,(g|0)!=(K|0);)Ke=se,q=x,se=g,g=Ke;_&&(ie[xe>>3]=X,ie[ue>>3]=j)}}else h[m>>2]=0,h[m+4>>2]=0,h[m+8>>2]=0,h[m+12>>2]=0,h[m+16>>2]=0,h[m+20>>2]=0,h[m+24>>2]=0,h[m+28>>2]=0;if(Ke=p+8|0,g=h[Ke>>2]|0,!((g|0)<=0)){Be=p+12|0,Ae=0;do if(v=h[Be>>2]|0,_=Ae,Ae=Ae+1|0,ue=m+(Ae<<5)|0,xe=h[v+(_<<3)>>2]|0,xe){if(se=m+(Ae<<5)+8|0,ie[se>>3]=17976931348623157e292,p=m+(Ae<<5)+24|0,ie[p>>3]=17976931348623157e292,ie[ue>>3]=-17976931348623157e292,we=m+(Ae<<5)+16|0,ie[we>>3]=-17976931348623157e292,(xe|0)>0){for(K=h[v+(_<<3)+4>>2]|0,j=17976931348623157e292,X=-17976931348623157e292,v=0,_=-1,ae=0,M=17976931348623157e292,N=17976931348623157e292,U=-17976931348623157e292,b=-17976931348623157e292;x=+ie[K+(ae<<4)>>3],q=+ie[K+(ae<<4)+8>>3],_=_+2|0,E=+ie[K+(((_|0)==(xe|0)?0:_)<<4)+8>>3],x<M&&(ie[se>>3]=x,M=x),q<N&&(ie[p>>3]=q,N=q),x>U?ie[ue>>3]=x:x=U,q>b&&(ie[we>>3]=q,b=q),j=q>0&q<j?q:j,X=q<0&q>X?q:X,v=v|+Ks(+(q-E))>3.141592653589793,_=ae+1|0,(_|0)!=(xe|0);)Me=ae,ae=_,U=x,_=Me;v&&(ie[we>>3]=X,ie[p>>3]=j)}}else h[ue>>2]=0,h[ue+4>>2]=0,h[ue+8>>2]=0,h[ue+12>>2]=0,h[ue+16>>2]=0,h[ue+20>>2]=0,h[ue+24>>2]=0,h[ue+28>>2]=0,g=h[Ke>>2]|0;while((Ae|0)<(g|0))}}function wL(p,m,g){p=p|0,m=m|0,g=g|0;var _=0,v=0,x=0;if(!(Zx(p,m,g)|0))return v=0,v|0;if(v=p+8|0,(h[v>>2]|0)<=0)return v=1,v|0;for(_=p+12|0,p=0;;){if(x=p,p=p+1|0,Zx((h[_>>2]|0)+(x<<3)|0,m+(p<<5)|0,g)|0){p=0,_=6;break}if((p|0)>=(h[v>>2]|0)){p=1,_=6;break}}return(_|0)==6?p|0:0}function Sq(p,m,g,_){p=p|0,m=m|0,g=g|0,_=_|0;var v=0,x=0,b=0,E=0,M=0,N=0,U=0;if(N=Q,Q=Q+16|0,E=N,b=g+8|0,!(Zx(p,m,b)|0))return M=0,Q=N,M|0;M=p+8|0;e:do if((h[M>>2]|0)>0){for(x=p+12|0,v=0;;){if(U=v,v=v+1|0,Zx((h[x>>2]|0)+(U<<3)|0,m+(v<<5)|0,b)|0){v=0;break}if((v|0)>=(h[M>>2]|0))break e}return Q=N,v|0}while(!1);if(cT(p,m,g,_)|0)return U=0,Q=N,U|0;h[E>>2]=h[g>>2],h[E+4>>2]=b,v=h[M>>2]|0;e:do if((v|0)>0)for(p=p+12|0,b=0,x=v;;){if(v=h[p>>2]|0,(h[v+(b<<3)>>2]|0)>0){if(Zx(E,_,h[v+(b<<3)+4>>2]|0)|0){v=0;break e}if(v=b+1|0,cT((h[p>>2]|0)+(b<<3)|0,m+(v<<5)|0,g,_)|0){v=0;break e}x=h[M>>2]|0}else v=b+1|0;if((v|0)<(x|0))b=v;else{v=1;break}}else v=1;while(!1);return U=v,Q=N,U|0}function cT(p,m,g,_){p=p|0,m=m|0,g=g|0,_=_|0;var v=0,x=0,b=0,E=0,M=0,N=0,U=0,q=0,j=0,X=0,K=0,ae=0,ue=0,xe=0,se=0,we=0,Ae=0,Be=0,Ke=0,Me=0,be=0;if(Ke=Q,Q=Q+176|0,se=Ke+172|0,v=Ke+168|0,we=Ke,!(oL(m,_)|0))return p=0,Q=Ke,p|0;if(Kce(m,_,se,v),cu(we|0,g|0,168)|0,(h[g>>2]|0)>0){m=0;do Me=we+8+(m<<4)+8|0,xe=+kl(+ie[Me>>3],h[v>>2]|0),ie[Me>>3]=xe,m=m+1|0;while((m|0)<(h[g>>2]|0))}ae=+ie[_>>3],ue=+ie[_+8>>3],xe=+kl(+ie[_+16>>3],h[v>>2]|0),X=+kl(+ie[_+24>>3],h[v>>2]|0);e:do if((h[p>>2]|0)>0){if(_=p+4|0,v=h[we>>2]|0,(v|0)<=0){for(m=0;;)if(m=m+1|0,(m|0)>=(h[p>>2]|0)){m=0;break e}}for(g=0;;){if(m=h[_>>2]|0,j=+ie[m+(g<<4)>>3],K=+kl(+ie[m+(g<<4)+8>>3],h[se>>2]|0),m=h[_>>2]|0,g=g+1|0,Me=(g|0)%(h[p>>2]|0)|0,x=+ie[m+(Me<<4)>>3],b=+kl(+ie[m+(Me<<4)+8>>3],h[se>>2]|0),!(j>=ae)|!(x>=ae)&&!(j<=ue)|!(x<=ue)&&!(K<=X)|!(b<=X)&&!(K>=xe)|!(b>=xe)){q=x-j,N=b-K,m=0;do if(be=m,m=m+1|0,Me=(m|0)==(v|0)?0:m,x=+ie[we+8+(be<<4)+8>>3],b=+ie[we+8+(Me<<4)+8>>3]-x,E=+ie[we+8+(be<<4)>>3],M=+ie[we+8+(Me<<4)>>3]-E,U=q*b-N*M,U!=0&&(Ae=K-x,Be=j-E,M=(Ae*M-b*Be)/U,!(M<0|M>1))&&(U=(q*Ae-N*Be)/U,U>=0&U<=1)){m=1;break e}while((m|0)<(v|0))}if((g|0)>=(h[p>>2]|0)){m=0;break}}}else m=0;while(!1);return be=m,Q=Ke,be|0}function Tq(p,m,g,_){p=p|0,m=m|0,g=g|0,_=_|0;var v=0,x=0,b=0;if(cT(p,m,g,_)|0)return x=1,x|0;if(x=p+8|0,(h[x>>2]|0)<=0)return x=0,x|0;for(v=p+12|0,p=0;;){if(b=p,p=p+1|0,cT((h[v>>2]|0)+(b<<3)|0,m+(p<<5)|0,g,_)|0){p=1,v=6;break}if((p|0)>=(h[x>>2]|0)){p=0,v=6;break}}return(v|0)==6?p|0:0}function que(){return 8}function Hue(){return 16}function Wue(){return 168}function jue(){return 8}function Xue(){return 16}function $ue(){return 12}function Yue(){return 8}function Zue(p){return p=p|0,+(+((h[p>>2]|0)>>>0)+4294967296*+(h[p+4>>2]|0))}function Kue(p){p=p|0;var m=0,g=0;return g=+ie[p>>3],m=+ie[p+8>>3],+ +bs(+(g*g+m*m))}function Eq(p,m,g,_,v){p=p|0,m=m|0,g=g|0,_=_|0,v=v|0;var x=0,b=0,E=0,M=0,N=0,U=0,q=0,j=0;N=+ie[p>>3],M=+ie[m>>3]-N,E=+ie[p+8>>3],b=+ie[m+8>>3]-E,q=+ie[g>>3],x=+ie[_>>3]-q,j=+ie[g+8>>3],U=+ie[_+8>>3]-j,x=(x*(E-j)-(N-q)*U)/(M*U-b*x),ie[v>>3]=N+M*x,ie[v+8>>3]=E+b*x}function Mq(p,m){return p=p|0,m=m|0,+Ks(+(+ie[p>>3]-+ie[m>>3]))<11920928955078125e-23?(m=+Ks(+(+ie[p+8>>3]-+ie[m+8>>3]))<11920928955078125e-23,m|0):(m=0,m|0)}function Que(p,m,g){p=p|0,m=m|0,g=g|0;var _=0,v=0,x=0;if(x=Q,Q=Q+16|0,v=x,_=Zi(p,m)|0,(g+-1|0)>>>0>5||(_=(_|0)!=0,(g|0)==1&_))return v=-1,Q=x,v|0;do if(Qx(p,m,v)|0)_=-1;else if(_){_=((h[26416+(g<<2)>>2]|0)+5-(h[v>>2]|0)|0)%5|0;break}else{_=((h[26448+(g<<2)>>2]|0)+6-(h[v>>2]|0)|0)%6|0;break}while(!1);return v=_,Q=x,v|0}function Qx(p,m,g){p=p|0,m=m|0,g=g|0;var _=0,v=0,x=0,b=0,E=0,M=0,N=0,U=0;if(U=Q,Q=Q+32|0,E=U+16|0,M=U,_=b1(p,m,E)|0,_|0)return g=_,Q=U,g|0;x=pq(p,m)|0,N=ll(p,m)|0,Hce(x,M),_=Wce(x,h[E>>2]|0)|0;do if(yr(x)|0){do switch(x|0){case 4:{v=0;break}case 14:{v=1;break}case 24:{v=2;break}case 38:{v=3;break}case 49:{v=4;break}case 58:{v=5;break}case 63:{v=6;break}case 72:{v=7;break}case 83:{v=8;break}case 97:{v=9;break}case 107:{v=10;break}case 117:{v=11;break}default:di(27634,27636,75,27645)}while(!1);if(b=h[26480+(v*24|0)+8>>2]|0,m=h[26480+(v*24|0)+16>>2]|0,p=h[E>>2]|0,(p|0)!=(h[M>>2]|0)&&(M=iL(x)|0,p=h[E>>2]|0,M|(p|0)==(m|0)&&(_=(_+1|0)%6|0)),(N|0)==3&(p|0)==(m|0)){_=(_+5|0)%6|0;break}(N|0)==5&(p|0)==(b|0)&&(_=(_+1|0)%6|0)}while(!1);return h[g>>2]=_,g=0,Q=U,g|0}function xc(p,m,g,_){p=p|0,m=m|0,g=g|0,_=_|0;var v=0,x=0,b=0,E=0,M=0,N=0,U=0,q=0,j=0,X=0,K=0,ae=0,ue=0,xe=0,se=0,we=0;if(we=Q,Q=Q+32|0,se=we+24|0,ue=we+20|0,K=we+8|0,X=we+16|0,j=we,M=(Zi(p,m)|0)==0,M=M?6:5,U=tt(p|0,m|0,52)|0,ee()|0,U=U&15,M>>>0<=g>>>0)return _=2,Q=we,_|0;q=(U|0)==0,!q&&(ae=ft(7,0,(U^15)*3|0)|0,(ae&p|0)==0&((ee()|0)&m|0)==0)?v=g:x=4;e:do if((x|0)==4){if(v=(Zi(p,m)|0)!=0,((v?4:5)|0)<(g|0)||Qx(p,m,se)|0||(x=(h[se>>2]|0)+g|0,v?v=26768+(((x|0)%5|0)<<2)|0:v=26800+(((x|0)%6|0)<<2)|0,ae=h[v>>2]|0,(ae|0)==7))return _=1,Q=we,_|0;h[ue>>2]=0,v=Qs(p,m,ae,ue,K)|0;do if(!v){if(E=K,N=h[E>>2]|0,E=h[E+4>>2]|0,b=E>>>0<m>>>0|(E|0)==(m|0)&N>>>0<p>>>0,x=b?N:p,b=b?E:m,!q&&(q=ft(7,0,(U^15)*3|0)|0,(N&q|0)==0&(E&(ee()|0)|0)==0))v=g;else{if(E=(g+-1+M|0)%(M|0)|0,v=Zi(p,m)|0,(E|0)<0&&di(27634,27636,248,27661),M=(v|0)!=0,((M?4:5)|0)<(E|0)&&di(27634,27636,248,27661),Qx(p,m,se)|0&&di(27634,27636,248,27661),v=(h[se>>2]|0)+E|0,M?v=26768+(((v|0)%5|0)<<2)|0:v=26800+(((v|0)%6|0)<<2)|0,E=h[v>>2]|0,(E|0)==7&&di(27634,27636,248,27661),h[X>>2]=0,v=Qs(p,m,E,X,j)|0,v|0)break;N=j,M=h[N>>2]|0,N=h[N+4>>2]|0;do if(N>>>0<b>>>0|(N|0)==(b|0)&M>>>0<x>>>0){if(Zi(M,N)|0?x=rT(M,N,p,m)|0:x=h[26864+((((h[X>>2]|0)+(h[26832+(E<<2)>>2]|0)|0)%6|0)<<2)>>2]|0,v=Zi(M,N)|0,(x+-1|0)>>>0>5){v=-1,x=M,b=N;break}if(v=(v|0)!=0,(x|0)==1&v){v=-1,x=M,b=N;break}do if(Qx(M,N,se)|0)v=-1;else if(v){v=((h[26416+(x<<2)>>2]|0)+5-(h[se>>2]|0)|0)%5|0;break}else{v=((h[26448+(x<<2)>>2]|0)+6-(h[se>>2]|0)|0)%6|0;break}while(!1);x=M,b=N}else v=g;while(!1);E=K,N=h[E>>2]|0,E=h[E+4>>2]|0}if((x|0)==(N|0)&(b|0)==(E|0)){if(M=(Zi(N,E)|0)!=0,M?p=rT(N,E,p,m)|0:p=h[26864+((((h[ue>>2]|0)+(h[26832+(ae<<2)>>2]|0)|0)%6|0)<<2)>>2]|0,v=Zi(N,E)|0,(p+-1|0)>>>0<=5&&(xe=(v|0)!=0,!((p|0)==1&xe)))do if(Qx(N,E,se)|0)v=-1;else if(xe){v=((h[26416+(p<<2)>>2]|0)+5-(h[se>>2]|0)|0)%5|0;break}else{v=((h[26448+(p<<2)>>2]|0)+6-(h[se>>2]|0)|0)%6|0;break}while(!1);else v=-1;v=v+1|0,v=(v|0)==6|M&(v|0)==5?0:v}m=b,p=x;break e}while(!1);return _=v,Q=we,_|0}while(!1);return xe=ft(v|0,0,56)|0,se=ee()|0|m&-2130706433|536870912,h[_>>2]=xe|p,h[_+4>>2]=se,_=0,Q=we,_|0}function Jue(p,m,g){p=p|0,m=m|0,g=g|0;var _=0,v=0,x=0;return x=(Zi(p,m)|0)==0,_=xc(p,m,0,g)|0,v=(_|0)==0,x?!v||(_=xc(p,m,1,g+8|0)|0,_|0)||(_=xc(p,m,2,g+16|0)|0,_|0)||(_=xc(p,m,3,g+24|0)|0,_|0)||(_=xc(p,m,4,g+32|0)|0,_)?(x=_,x|0):xc(p,m,5,g+40|0)|0:!v||(_=xc(p,m,1,g+8|0)|0,_|0)||(_=xc(p,m,2,g+16|0)|0,_|0)||(_=xc(p,m,3,g+24|0)|0,_|0)||(_=xc(p,m,4,g+32|0)|0,_|0)?(x=_,x|0):(x=g+40|0,h[x>>2]=0,h[x+4>>2]=0,x=0,x|0)}function ehe(p,m,g){p=p|0,m=m|0,g=g|0;var _=0,v=0,x=0,b=0,E=0,M=0;return M=Q,Q=Q+192|0,v=M,x=M+168|0,b=tt(p|0,m|0,56)|0,ee()|0,b=b&7,E=m&-2130706433|134217728,_=b1(p,E,x)|0,_|0?(E=_,Q=M,E|0):(m=tt(p|0,m|0,52)|0,ee()|0,m=m&15,Zi(p,E)|0?lL(x,m,b,1,v):cL(x,m,b,1,v),E=v+8|0,h[g>>2]=h[E>>2],h[g+4>>2]=h[E+4>>2],h[g+8>>2]=h[E+8>>2],h[g+12>>2]=h[E+12>>2],E=0,Q=M,E|0)}function Cq(p,m){p=p|0,m=m|0;var g=0,_=0,v=0,x=0;return v=Q,Q=Q+16|0,g=v,!(!0&(m&2013265920|0)==536870912)||(_=m&-2130706433|134217728,!(oT(p,_)|0))?(_=0,Q=v,_|0):(x=tt(p|0,m|0,56)|0,ee()|0,x=(xc(p,_,x&7,g)|0)==0,_=g,_=x&((h[_>>2]|0)==(p|0)?(h[_+4>>2]|0)==(m|0):0)&1,Q=v,_|0)}function Rq(){return 27680}function uT(p,m,g,_){p=p|0,m=m|0,g=g|0,_=_|0;var v=0,x=0,b=0,E=0,M=0,N=0,U=0,q=0,j=0;q=Q,Q=Q+208|0,M=q,N=q+192|0,b=al(g,m)|0,E=N,h[E>>2]=1,h[E+4>>2]=0;e:do if(b|0){for(E=0-g|0,h[M+4>>2]=g,h[M>>2]=g,v=2,m=g,x=g;m=m+g+x|0,h[M+(v<<2)>>2]=m,m>>>0<b>>>0;)j=x,v=v+1|0,x=m,m=j;if(x=p+b+E|0,x>>>0>p>>>0){b=x,v=1,m=1;do{do if((m&3|0)!=3)if(m=v+-1|0,(h[M+(m<<2)>>2]|0)>>>0<(b-p|0)>>>0?SL(p,g,_,v,M):fT(p,g,_,N,v,0,M),(v|0)==1){dT(N,1),v=0;break}else{dT(N,m),v=1;break}else SL(p,g,_,v,M),hT(N,2),v=v+2|0;while(!1);m=h[N>>2]|1,h[N>>2]=m,p=p+g|0}while(p>>>0<x>>>0)}else v=1,m=1;for(fT(p,g,_,N,v,0,M),x=N+4|0;;){if((v|0)==1&(m|0)==1)if(h[x>>2]|0)U=19;else break e;else(v|0)<2?U=19:(dT(N,2),j=v+-2|0,h[N>>2]=h[N>>2]^7,hT(N,1),fT(p+(0-(h[M+(j<<2)>>2]|0))+E|0,g,_,N,v+-1|0,1,M),dT(N,1),m=h[N>>2]|1,h[N>>2]=m,p=p+E|0,fT(p,g,_,N,j,1,M),v=j);(U|0)==19&&(U=0,m=Pq(N)|0,hT(N,m),p=p+E|0,v=m+v|0,m=h[N>>2]|0)}}while(!1);Q=q}function SL(p,m,g,_,v){p=p|0,m=m|0,g=g|0,_=_|0,v=v|0;var x=0,b=0,E=0,M=0,N=0,U=0,q=0;q=Q,Q=Q+240|0,U=q,h[U>>2]=p;e:do if((_|0)>1)for(N=0-m|0,E=p,x=_,_=1,b=p;;){if(E=E+N|0,M=x+-2|0,p=E+(0-(h[v+(M<<2)>>2]|0))|0,(up[g&3](b,p)|0)>-1&&(up[g&3](b,E)|0)>-1||(b=U+(_<<2)|0,(up[g&3](p,E)|0)>-1?(h[b>>2]=p,x=x+-1|0):(h[b>>2]=E,p=E,x=M),_=_+1|0,(x|0)<=1))break e;E=p,b=h[U>>2]|0}else _=1;while(!1);Lq(m,U,_),Q=q}function hT(p,m){p=p|0,m=m|0;var g=0,_=0,v=0;v=p+4|0,m>>>0>31?(_=h[v>>2]|0,h[p>>2]=_,h[v>>2]=0,m=m+-32|0,g=0):(g=h[v>>2]|0,_=h[p>>2]|0),h[p>>2]=g<<32-m|_>>>m,h[v>>2]=g>>>m}function fT(p,m,g,_,v,x,b){p=p|0,m=m|0,g=g|0,_=_|0,v=v|0,x=x|0,b=b|0;var E=0,M=0,N=0,U=0,q=0,j=0,X=0,K=0;X=Q,Q=Q+240|0,q=X+232|0,j=X,K=h[_>>2]|0,h[q>>2]=K,M=h[_+4>>2]|0,N=q+4|0,h[N>>2]=M,h[j>>2]=p;e:do if((K|0)!=1|(M|0)!=0&&(U=0-m|0,E=p+(0-(h[b+(v<<2)>>2]|0))|0,(up[g&3](E,p)|0)>=1))for(_=1,x=(x|0)==0,M=E;;){if(x&(v|0)>1){if(x=p+U|0,E=h[b+(v+-2<<2)>>2]|0,(up[g&3](x,M)|0)>-1){E=10;break e}if((up[g&3](x+(0-E)|0,M)|0)>-1){E=10;break e}}if(x=_+1|0,h[j+(_<<2)>>2]=M,K=Pq(q)|0,hT(q,K),v=K+v|0,!((h[q>>2]|0)!=1|(h[N>>2]|0)!=0)){_=x,p=M,E=10;break e}if(p=M+(0-(h[b+(v<<2)>>2]|0))|0,(up[g&3](p,h[j>>2]|0)|0)<1){p=M,_=x,x=0,E=9;break}else K=M,_=x,x=1,M=p,p=K}else _=1,E=9;while(!1);(E|0)==9&&(x|0)==0&&(E=10),(E|0)==10&&(Lq(m,j,_),SL(p,m,g,v,b)),Q=X}function dT(p,m){p=p|0,m=m|0;var g=0,_=0,v=0;v=p+4|0,m>>>0>31?(_=h[p>>2]|0,h[v>>2]=_,h[p>>2]=0,m=m+-32|0,g=0):(g=h[p>>2]|0,_=h[v>>2]|0),h[v>>2]=g>>>(32-m|0)|_<<m,h[p>>2]=g<<m}function Pq(p){p=p|0;var m=0;return m=Iq((h[p>>2]|0)+-1|0)|0,m?m|0:(m=Iq(h[p+4>>2]|0)|0,((m|0)==0?0:m+32|0)|0)}function Iq(p){p=p|0;var m=0;if(p)if(p&1)p=0;else for(m=p,p=0;p=p+1|0,!(m&2);)m=m>>>1;else p=32;return p|0}function Lq(p,m,g){p=p|0,m=m|0,g=g|0;var _=0,v=0,x=0,b=0,E=0;b=Q,Q=Q+256|0,_=b;e:do if((g|0)>=2&&(x=m+(g<<2)|0,h[x>>2]=_,p|0))for(;;){v=p>>>0<256?p:256,cu(_|0,h[m>>2]|0,v|0)|0,_=0;do E=m+(_<<2)|0,_=_+1|0,cu(h[E>>2]|0,h[m+(_<<2)>>2]|0,v|0)|0,h[E>>2]=(h[E>>2]|0)+v;while((_|0)!=(g|0));if(p=p-v|0,!p)break e;_=h[x>>2]|0}while(!1);Q=b}function rh(p){return p=+p,~~+Oq(+p)|0}function br(p){p=p|0;var m=0,g=0,_=0,v=0,x=0,b=0,E=0,M=0,N=0,U=0,q=0,j=0,X=0,K=0,ae=0,ue=0,xe=0,se=0,we=0,Ae=0,Be=0;Be=Q,Q=Q+16|0,j=Be;do if(p>>>0<245){if(N=p>>>0<11?16:p+11&-8,p=N>>>3,q=h[6921]|0,g=q>>>p,g&3|0)return m=(g&1^1)+p|0,p=27724+(m<<1<<2)|0,g=p+8|0,_=h[g>>2]|0,v=_+8|0,x=h[v>>2]|0,(x|0)==(p|0)?h[6921]=q&~(1<<m):(h[x+12>>2]=p,h[g>>2]=x),Ae=m<<3,h[_+4>>2]=Ae|3,Ae=_+Ae+4|0,h[Ae>>2]=h[Ae>>2]|1,Ae=v,Q=Be,Ae|0;if(U=h[6923]|0,N>>>0>U>>>0){if(g|0)return m=2<<p,m=g<<p&(m|0-m),m=(m&0-m)+-1|0,E=m>>>12&16,m=m>>>E,g=m>>>5&8,m=m>>>g,x=m>>>2&4,m=m>>>x,p=m>>>1&2,m=m>>>p,_=m>>>1&1,_=(g|E|x|p|_)+(m>>>_)|0,m=27724+(_<<1<<2)|0,p=m+8|0,x=h[p>>2]|0,E=x+8|0,g=h[E>>2]|0,(g|0)==(m|0)?(p=q&~(1<<_),h[6921]=p):(h[g+12>>2]=m,h[p>>2]=g,p=q),Ae=_<<3,b=Ae-N|0,h[x+4>>2]=N|3,v=x+N|0,h[v+4>>2]=b|1,h[x+Ae>>2]=b,U|0&&(_=h[6926]|0,m=U>>>3,g=27724+(m<<1<<2)|0,m=1<<m,p&m?(p=g+8|0,m=h[p>>2]|0):(h[6921]=p|m,m=g,p=g+8|0),h[p>>2]=_,h[m+12>>2]=_,h[_+8>>2]=m,h[_+12>>2]=g),h[6923]=b,h[6926]=v,Ae=E,Q=Be,Ae|0;if(x=h[6922]|0,x){for(g=(x&0-x)+-1|0,v=g>>>12&16,g=g>>>v,_=g>>>5&8,g=g>>>_,b=g>>>2&4,g=g>>>b,E=g>>>1&2,g=g>>>E,M=g>>>1&1,M=h[27988+((_|v|b|E|M)+(g>>>M)<<2)>>2]|0,g=M,E=M,M=(h[M+4>>2]&-8)-N|0;p=h[g+16>>2]|0,!(!p&&(p=h[g+20>>2]|0,!p));)b=(h[p+4>>2]&-8)-N|0,v=b>>>0<M>>>0,g=p,E=v?p:E,M=v?b:M;if(b=E+N|0,b>>>0>E>>>0){v=h[E+24>>2]|0,m=h[E+12>>2]|0;do if((m|0)==(E|0)){if(p=E+20|0,m=h[p>>2]|0,!m&&(p=E+16|0,m=h[p>>2]|0,!m)){g=0;break}for(;;)if(_=m+20|0,g=h[_>>2]|0,g)m=g,p=_;else if(_=m+16|0,g=h[_>>2]|0,g)m=g,p=_;else break;h[p>>2]=0,g=m}else g=h[E+8>>2]|0,h[g+12>>2]=m,h[m+8>>2]=g,g=m;while(!1);do if(v|0){if(m=h[E+28>>2]|0,p=27988+(m<<2)|0,(E|0)==(h[p>>2]|0)){if(h[p>>2]=g,!g){h[6922]=x&~(1<<m);break}}else if(Ae=v+16|0,h[((h[Ae>>2]|0)==(E|0)?Ae:v+20|0)>>2]=g,!g)break;h[g+24>>2]=v,m=h[E+16>>2]|0,m|0&&(h[g+16>>2]=m,h[m+24>>2]=g),m=h[E+20>>2]|0,m|0&&(h[g+20>>2]=m,h[m+24>>2]=g)}while(!1);return M>>>0<16?(Ae=M+N|0,h[E+4>>2]=Ae|3,Ae=E+Ae+4|0,h[Ae>>2]=h[Ae>>2]|1):(h[E+4>>2]=N|3,h[b+4>>2]=M|1,h[b+M>>2]=M,U|0&&(_=h[6926]|0,m=U>>>3,g=27724+(m<<1<<2)|0,m=1<<m,m&q?(p=g+8|0,m=h[p>>2]|0):(h[6921]=m|q,m=g,p=g+8|0),h[p>>2]=_,h[m+12>>2]=_,h[_+8>>2]=m,h[_+12>>2]=g),h[6923]=M,h[6926]=b),Ae=E+8|0,Q=Be,Ae|0}else q=N}else q=N}else q=N}else if(p>>>0<=4294967231)if(p=p+11|0,N=p&-8,_=h[6922]|0,_){v=0-N|0,p=p>>>8,p?N>>>0>16777215?M=31:(q=(p+1048320|0)>>>16&8,ae=p<<q,E=(ae+520192|0)>>>16&4,ae=ae<<E,M=(ae+245760|0)>>>16&2,M=14-(E|q|M)+(ae<<M>>>15)|0,M=N>>>(M+7|0)&1|M<<1):M=0,g=h[27988+(M<<2)>>2]|0;e:do if(!g)g=0,p=0,ae=61;else for(p=0,E=N<<((M|0)==31?0:25-(M>>>1)|0),x=0;;){if(b=(h[g+4>>2]&-8)-N|0,b>>>0<v>>>0)if(b)p=g,v=b;else{p=g,v=0,ae=65;break e}if(ae=h[g+20>>2]|0,g=h[g+16+(E>>>31<<2)>>2]|0,x=(ae|0)==0|(ae|0)==(g|0)?x:ae,g)E=E<<1;else{g=x,ae=61;break}}while(!1);if((ae|0)==61){if((g|0)==0&(p|0)==0){if(p=2<<M,p=(p|0-p)&_,!p){q=N;break}q=(p&0-p)+-1|0,b=q>>>12&16,q=q>>>b,x=q>>>5&8,q=q>>>x,E=q>>>2&4,q=q>>>E,M=q>>>1&2,q=q>>>M,g=q>>>1&1,p=0,g=h[27988+((x|b|E|M|g)+(q>>>g)<<2)>>2]|0}g?ae=65:(E=p,b=v)}if((ae|0)==65)for(x=g;;)if(q=(h[x+4>>2]&-8)-N|0,g=q>>>0<v>>>0,v=g?q:v,p=g?x:p,g=h[x+16>>2]|0,g||(g=h[x+20>>2]|0),g)x=g;else{E=p,b=v;break}if((E|0)!=0&&b>>>0<((h[6923]|0)-N|0)>>>0&&(U=E+N|0,U>>>0>E>>>0)){x=h[E+24>>2]|0,m=h[E+12>>2]|0;do if((m|0)==(E|0)){if(p=E+20|0,m=h[p>>2]|0,!m&&(p=E+16|0,m=h[p>>2]|0,!m)){m=0;break}for(;;)if(v=m+20|0,g=h[v>>2]|0,g)m=g,p=v;else if(v=m+16|0,g=h[v>>2]|0,g)m=g,p=v;else break;h[p>>2]=0}else Ae=h[E+8>>2]|0,h[Ae+12>>2]=m,h[m+8>>2]=Ae;while(!1);do if(x){if(p=h[E+28>>2]|0,g=27988+(p<<2)|0,(E|0)==(h[g>>2]|0)){if(h[g>>2]=m,!m){_=_&~(1<<p),h[6922]=_;break}}else if(Ae=x+16|0,h[((h[Ae>>2]|0)==(E|0)?Ae:x+20|0)>>2]=m,!m)break;h[m+24>>2]=x,p=h[E+16>>2]|0,p|0&&(h[m+16>>2]=p,h[p+24>>2]=m),p=h[E+20>>2]|0,p&&(h[m+20>>2]=p,h[p+24>>2]=m)}while(!1);e:do if(b>>>0<16)Ae=b+N|0,h[E+4>>2]=Ae|3,Ae=E+Ae+4|0,h[Ae>>2]=h[Ae>>2]|1;else{if(h[E+4>>2]=N|3,h[U+4>>2]=b|1,h[U+b>>2]=b,m=b>>>3,b>>>0<256){g=27724+(m<<1<<2)|0,p=h[6921]|0,m=1<<m,p&m?(p=g+8|0,m=h[p>>2]|0):(h[6921]=p|m,m=g,p=g+8|0),h[p>>2]=U,h[m+12>>2]=U,h[U+8>>2]=m,h[U+12>>2]=g;break}if(m=b>>>8,m?b>>>0>16777215?g=31:(we=(m+1048320|0)>>>16&8,Ae=m<<we,se=(Ae+520192|0)>>>16&4,Ae=Ae<<se,g=(Ae+245760|0)>>>16&2,g=14-(se|we|g)+(Ae<<g>>>15)|0,g=b>>>(g+7|0)&1|g<<1):g=0,m=27988+(g<<2)|0,h[U+28>>2]=g,p=U+16|0,h[p+4>>2]=0,h[p>>2]=0,p=1<<g,!(_&p)){h[6922]=_|p,h[m>>2]=U,h[U+24>>2]=m,h[U+12>>2]=U,h[U+8>>2]=U;break}m=h[m>>2]|0;t:do if((h[m+4>>2]&-8|0)!=(b|0)){for(_=b<<((g|0)==31?0:25-(g>>>1)|0);g=m+16+(_>>>31<<2)|0,p=h[g>>2]|0,!!p;)if((h[p+4>>2]&-8|0)==(b|0)){m=p;break t}else _=_<<1,m=p;h[g>>2]=U,h[U+24>>2]=m,h[U+12>>2]=U,h[U+8>>2]=U;break e}while(!1);we=m+8|0,Ae=h[we>>2]|0,h[Ae+12>>2]=U,h[we>>2]=U,h[U+8>>2]=Ae,h[U+12>>2]=m,h[U+24>>2]=0}while(!1);return Ae=E+8|0,Q=Be,Ae|0}else q=N}else q=N;else q=-1;while(!1);if(g=h[6923]|0,g>>>0>=q>>>0)return m=g-q|0,p=h[6926]|0,m>>>0>15?(Ae=p+q|0,h[6926]=Ae,h[6923]=m,h[Ae+4>>2]=m|1,h[p+g>>2]=m,h[p+4>>2]=q|3):(h[6923]=0,h[6926]=0,h[p+4>>2]=g|3,Ae=p+g+4|0,h[Ae>>2]=h[Ae>>2]|1),Ae=p+8|0,Q=Be,Ae|0;if(b=h[6924]|0,b>>>0>q>>>0)return se=b-q|0,h[6924]=se,Ae=h[6927]|0,we=Ae+q|0,h[6927]=we,h[we+4>>2]=se|1,h[Ae+4>>2]=q|3,Ae=Ae+8|0,Q=Be,Ae|0;if(h[7039]|0?p=h[7041]|0:(h[7041]=4096,h[7040]=4096,h[7042]=-1,h[7043]=-1,h[7044]=0,h[7032]=0,h[7039]=j&-16^1431655768,p=4096),E=q+48|0,M=q+47|0,x=p+M|0,v=0-p|0,N=x&v,N>>>0<=q>>>0||(p=h[7031]|0,p|0&&(U=h[7029]|0,j=U+N|0,j>>>0<=U>>>0|j>>>0>p>>>0)))return Ae=0,Q=Be,Ae|0;e:do if(h[7032]&4)m=0,ae=143;else{g=h[6927]|0;t:do if(g){for(_=28132;j=h[_>>2]|0,!(j>>>0<=g>>>0&&(j+(h[_+4>>2]|0)|0)>>>0>g>>>0);)if(p=h[_+8>>2]|0,p)_=p;else{ae=128;break t}if(m=x-b&v,m>>>0<2147483647)if(p=cp(m|0)|0,(p|0)==((h[_>>2]|0)+(h[_+4>>2]|0)|0)){if((p|0)!=-1){b=m,x=p,ae=145;break e}}else _=p,ae=136;else m=0}else ae=128;while(!1);do if((ae|0)==128)if(g=cp(0)|0,(g|0)!=-1&&(m=g,X=h[7040]|0,K=X+-1|0,m=((K&m|0)==0?0:(K+m&0-X)-m|0)+N|0,X=h[7029]|0,K=m+X|0,m>>>0>q>>>0&m>>>0<2147483647)){if(j=h[7031]|0,j|0&&K>>>0<=X>>>0|K>>>0>j>>>0){m=0;break}if(p=cp(m|0)|0,(p|0)==(g|0)){b=m,x=g,ae=145;break e}else _=p,ae=136}else m=0;while(!1);do if((ae|0)==136){if(g=0-m|0,!(E>>>0>m>>>0&(m>>>0<2147483647&(_|0)!=-1)))if((_|0)==-1){m=0;break}else{b=m,x=_,ae=145;break e}if(p=h[7041]|0,p=M-m+p&0-p,p>>>0>=2147483647){b=m,x=_,ae=145;break e}if((cp(p|0)|0)==-1){cp(g|0)|0,m=0;break}else{b=p+m|0,x=_,ae=145;break e}}while(!1);h[7032]=h[7032]|4,ae=143}while(!1);if((ae|0)==143&&N>>>0<2147483647&&(se=cp(N|0)|0,K=cp(0)|0,ue=K-se|0,xe=ue>>>0>(q+40|0)>>>0,!((se|0)==-1|xe^1|se>>>0<K>>>0&((se|0)!=-1&(K|0)!=-1)^1))&&(b=xe?ue:m,x=se,ae=145),(ae|0)==145){m=(h[7029]|0)+b|0,h[7029]=m,m>>>0>(h[7030]|0)>>>0&&(h[7030]=m),M=h[6927]|0;e:do if(M){for(m=28132;;){if(p=h[m>>2]|0,g=h[m+4>>2]|0,(x|0)==(p+g|0)){ae=154;break}if(_=h[m+8>>2]|0,_)m=_;else break}if((ae|0)==154&&(we=m+4|0,(h[m+12>>2]&8|0)==0)&&x>>>0>M>>>0&p>>>0<=M>>>0){h[we>>2]=g+b,Ae=(h[6924]|0)+b|0,se=M+8|0,se=(se&7|0)==0?0:0-se&7,we=M+se|0,se=Ae-se|0,h[6927]=we,h[6924]=se,h[we+4>>2]=se|1,h[M+Ae+4>>2]=40,h[6928]=h[7043];break}for(x>>>0<(h[6925]|0)>>>0&&(h[6925]=x),g=x+b|0,m=28132;;){if((h[m>>2]|0)==(g|0)){ae=162;break}if(p=h[m+8>>2]|0,p)m=p;else break}if((ae|0)==162&&(h[m+12>>2]&8|0)==0){h[m>>2]=x,U=m+4|0,h[U>>2]=(h[U>>2]|0)+b,U=x+8|0,U=x+((U&7|0)==0?0:0-U&7)|0,m=g+8|0,m=g+((m&7|0)==0?0:0-m&7)|0,N=U+q|0,E=m-U-q|0,h[U+4>>2]=q|3;t:do if((M|0)==(m|0))Ae=(h[6924]|0)+E|0,h[6924]=Ae,h[6927]=N,h[N+4>>2]=Ae|1;else{if((h[6926]|0)==(m|0)){Ae=(h[6923]|0)+E|0,h[6923]=Ae,h[6926]=N,h[N+4>>2]=Ae|1,h[N+Ae>>2]=Ae;break}if(p=h[m+4>>2]|0,(p&3|0)==1){b=p&-8,_=p>>>3;n:do if(p>>>0<256)if(p=h[m+8>>2]|0,g=h[m+12>>2]|0,(g|0)==(p|0)){h[6921]=h[6921]&~(1<<_);break}else{h[p+12>>2]=g,h[g+8>>2]=p;break}else{x=h[m+24>>2]|0,p=h[m+12>>2]|0;do if((p|0)==(m|0)){if(g=m+16|0,_=g+4|0,p=h[_>>2]|0,p)g=_;else if(p=h[g>>2]|0,!p){p=0;break}for(;;)if(v=p+20|0,_=h[v>>2]|0,_)p=_,g=v;else if(v=p+16|0,_=h[v>>2]|0,_)p=_,g=v;else break;h[g>>2]=0}else Ae=h[m+8>>2]|0,h[Ae+12>>2]=p,h[p+8>>2]=Ae;while(!1);if(!x)break;g=h[m+28>>2]|0,_=27988+(g<<2)|0;do if((h[_>>2]|0)!=(m|0)){if(Ae=x+16|0,h[((h[Ae>>2]|0)==(m|0)?Ae:x+20|0)>>2]=p,!p)break n}else{if(h[_>>2]=p,p|0)break;h[6922]=h[6922]&~(1<<g);break n}while(!1);if(h[p+24>>2]=x,g=m+16|0,_=h[g>>2]|0,_|0&&(h[p+16>>2]=_,h[_+24>>2]=p),g=h[g+4>>2]|0,!g)break;h[p+20>>2]=g,h[g+24>>2]=p}while(!1);m=m+b|0,v=b+E|0}else v=E;if(m=m+4|0,h[m>>2]=h[m>>2]&-2,h[N+4>>2]=v|1,h[N+v>>2]=v,m=v>>>3,v>>>0<256){g=27724+(m<<1<<2)|0,p=h[6921]|0,m=1<<m,p&m?(p=g+8|0,m=h[p>>2]|0):(h[6921]=p|m,m=g,p=g+8|0),h[p>>2]=N,h[m+12>>2]=N,h[N+8>>2]=m,h[N+12>>2]=g;break}m=v>>>8;do if(!m)_=0;else{if(v>>>0>16777215){_=31;break}we=(m+1048320|0)>>>16&8,Ae=m<<we,se=(Ae+520192|0)>>>16&4,Ae=Ae<<se,_=(Ae+245760|0)>>>16&2,_=14-(se|we|_)+(Ae<<_>>>15)|0,_=v>>>(_+7|0)&1|_<<1}while(!1);if(m=27988+(_<<2)|0,h[N+28>>2]=_,p=N+16|0,h[p+4>>2]=0,h[p>>2]=0,p=h[6922]|0,g=1<<_,!(p&g)){h[6922]=p|g,h[m>>2]=N,h[N+24>>2]=m,h[N+12>>2]=N,h[N+8>>2]=N;break}m=h[m>>2]|0;n:do if((h[m+4>>2]&-8|0)!=(v|0)){for(_=v<<((_|0)==31?0:25-(_>>>1)|0);g=m+16+(_>>>31<<2)|0,p=h[g>>2]|0,!!p;)if((h[p+4>>2]&-8|0)==(v|0)){m=p;break n}else _=_<<1,m=p;h[g>>2]=N,h[N+24>>2]=m,h[N+12>>2]=N,h[N+8>>2]=N;break t}while(!1);we=m+8|0,Ae=h[we>>2]|0,h[Ae+12>>2]=N,h[we>>2]=N,h[N+8>>2]=Ae,h[N+12>>2]=m,h[N+24>>2]=0}while(!1);return Ae=U+8|0,Q=Be,Ae|0}for(m=28132;p=h[m>>2]|0,!(p>>>0<=M>>>0&&(Ae=p+(h[m+4>>2]|0)|0,Ae>>>0>M>>>0));)m=h[m+8>>2]|0;v=Ae+-47|0,p=v+8|0,p=v+((p&7|0)==0?0:0-p&7)|0,v=M+16|0,p=p>>>0<v>>>0?M:p,m=p+8|0,g=b+-40|0,se=x+8|0,se=(se&7|0)==0?0:0-se&7,we=x+se|0,se=g-se|0,h[6927]=we,h[6924]=se,h[we+4>>2]=se|1,h[x+g+4>>2]=40,h[6928]=h[7043],g=p+4|0,h[g>>2]=27,h[m>>2]=h[7033],h[m+4>>2]=h[7034],h[m+8>>2]=h[7035],h[m+12>>2]=h[7036],h[7033]=x,h[7034]=b,h[7036]=0,h[7035]=m,m=p+24|0;do we=m,m=m+4|0,h[m>>2]=7;while((we+8|0)>>>0<Ae>>>0);if((p|0)!=(M|0)){if(x=p-M|0,h[g>>2]=h[g>>2]&-2,h[M+4>>2]=x|1,h[p>>2]=x,m=x>>>3,x>>>0<256){g=27724+(m<<1<<2)|0,p=h[6921]|0,m=1<<m,p&m?(p=g+8|0,m=h[p>>2]|0):(h[6921]=p|m,m=g,p=g+8|0),h[p>>2]=M,h[m+12>>2]=M,h[M+8>>2]=m,h[M+12>>2]=g;break}if(m=x>>>8,m?x>>>0>16777215?_=31:(we=(m+1048320|0)>>>16&8,Ae=m<<we,se=(Ae+520192|0)>>>16&4,Ae=Ae<<se,_=(Ae+245760|0)>>>16&2,_=14-(se|we|_)+(Ae<<_>>>15)|0,_=x>>>(_+7|0)&1|_<<1):_=0,g=27988+(_<<2)|0,h[M+28>>2]=_,h[M+20>>2]=0,h[v>>2]=0,m=h[6922]|0,p=1<<_,!(m&p)){h[6922]=m|p,h[g>>2]=M,h[M+24>>2]=g,h[M+12>>2]=M,h[M+8>>2]=M;break}m=h[g>>2]|0;t:do if((h[m+4>>2]&-8|0)!=(x|0)){for(_=x<<((_|0)==31?0:25-(_>>>1)|0);g=m+16+(_>>>31<<2)|0,p=h[g>>2]|0,!!p;)if((h[p+4>>2]&-8|0)==(x|0)){m=p;break t}else _=_<<1,m=p;h[g>>2]=M,h[M+24>>2]=m,h[M+12>>2]=M,h[M+8>>2]=M;break e}while(!1);we=m+8|0,Ae=h[we>>2]|0,h[Ae+12>>2]=M,h[we>>2]=M,h[M+8>>2]=Ae,h[M+12>>2]=m,h[M+24>>2]=0}}else Ae=h[6925]|0,(Ae|0)==0|x>>>0<Ae>>>0&&(h[6925]=x),h[7033]=x,h[7034]=b,h[7036]=0,h[6930]=h[7039],h[6929]=-1,h[6934]=27724,h[6933]=27724,h[6936]=27732,h[6935]=27732,h[6938]=27740,h[6937]=27740,h[6940]=27748,h[6939]=27748,h[6942]=27756,h[6941]=27756,h[6944]=27764,h[6943]=27764,h[6946]=27772,h[6945]=27772,h[6948]=27780,h[6947]=27780,h[6950]=27788,h[6949]=27788,h[6952]=27796,h[6951]=27796,h[6954]=27804,h[6953]=27804,h[6956]=27812,h[6955]=27812,h[6958]=27820,h[6957]=27820,h[6960]=27828,h[6959]=27828,h[6962]=27836,h[6961]=27836,h[6964]=27844,h[6963]=27844,h[6966]=27852,h[6965]=27852,h[6968]=27860,h[6967]=27860,h[6970]=27868,h[6969]=27868,h[6972]=27876,h[6971]=27876,h[6974]=27884,h[6973]=27884,h[6976]=27892,h[6975]=27892,h[6978]=27900,h[6977]=27900,h[6980]=27908,h[6979]=27908,h[6982]=27916,h[6981]=27916,h[6984]=27924,h[6983]=27924,h[6986]=27932,h[6985]=27932,h[6988]=27940,h[6987]=27940,h[6990]=27948,h[6989]=27948,h[6992]=27956,h[6991]=27956,h[6994]=27964,h[6993]=27964,h[6996]=27972,h[6995]=27972,Ae=b+-40|0,se=x+8|0,se=(se&7|0)==0?0:0-se&7,we=x+se|0,se=Ae-se|0,h[6927]=we,h[6924]=se,h[we+4>>2]=se|1,h[x+Ae+4>>2]=40,h[6928]=h[7043];while(!1);if(m=h[6924]|0,m>>>0>q>>>0)return se=m-q|0,h[6924]=se,Ae=h[6927]|0,we=Ae+q|0,h[6927]=we,h[we+4>>2]=se|1,h[Ae+4>>2]=q|3,Ae=Ae+8|0,Q=Be,Ae|0}return Ae=Rq()|0,h[Ae>>2]=12,Ae=0,Q=Be,Ae|0}function _t(p){p=p|0;var m=0,g=0,_=0,v=0,x=0,b=0,E=0,M=0;if(p){g=p+-8|0,v=h[6925]|0,p=h[p+-4>>2]|0,m=p&-8,M=g+m|0;do if(p&1)E=g,b=g;else{if(_=h[g>>2]|0,!(p&3)||(b=g+(0-_)|0,x=_+m|0,b>>>0<v>>>0))return;if((h[6926]|0)==(b|0)){if(p=M+4|0,m=h[p>>2]|0,(m&3|0)!=3){E=b,m=x;break}h[6923]=x,h[p>>2]=m&-2,h[b+4>>2]=x|1,h[b+x>>2]=x;return}if(g=_>>>3,_>>>0<256)if(p=h[b+8>>2]|0,m=h[b+12>>2]|0,(m|0)==(p|0)){h[6921]=h[6921]&~(1<<g),E=b,m=x;break}else{h[p+12>>2]=m,h[m+8>>2]=p,E=b,m=x;break}v=h[b+24>>2]|0,p=h[b+12>>2]|0;do if((p|0)==(b|0)){if(m=b+16|0,g=m+4|0,p=h[g>>2]|0,p)m=g;else if(p=h[m>>2]|0,!p){p=0;break}for(;;)if(_=p+20|0,g=h[_>>2]|0,g)p=g,m=_;else if(_=p+16|0,g=h[_>>2]|0,g)p=g,m=_;else break;h[m>>2]=0}else E=h[b+8>>2]|0,h[E+12>>2]=p,h[p+8>>2]=E;while(!1);if(v){if(m=h[b+28>>2]|0,g=27988+(m<<2)|0,(h[g>>2]|0)==(b|0)){if(h[g>>2]=p,!p){h[6922]=h[6922]&~(1<<m),E=b,m=x;break}}else if(E=v+16|0,h[((h[E>>2]|0)==(b|0)?E:v+20|0)>>2]=p,!p){E=b,m=x;break}h[p+24>>2]=v,m=b+16|0,g=h[m>>2]|0,g|0&&(h[p+16>>2]=g,h[g+24>>2]=p),m=h[m+4>>2]|0,m?(h[p+20>>2]=m,h[m+24>>2]=p,E=b,m=x):(E=b,m=x)}else E=b,m=x}while(!1);if(!(b>>>0>=M>>>0)&&(p=M+4|0,_=h[p>>2]|0,!!(_&1))){if(_&2)h[p>>2]=_&-2,h[E+4>>2]=m|1,h[b+m>>2]=m,v=m;else{if((h[6927]|0)==(M|0)){if(M=(h[6924]|0)+m|0,h[6924]=M,h[6927]=E,h[E+4>>2]=M|1,(E|0)!=(h[6926]|0))return;h[6926]=0,h[6923]=0;return}if((h[6926]|0)==(M|0)){M=(h[6923]|0)+m|0,h[6923]=M,h[6926]=b,h[E+4>>2]=M|1,h[b+M>>2]=M;return}v=(_&-8)+m|0,g=_>>>3;do if(_>>>0<256)if(m=h[M+8>>2]|0,p=h[M+12>>2]|0,(p|0)==(m|0)){h[6921]=h[6921]&~(1<<g);break}else{h[m+12>>2]=p,h[p+8>>2]=m;break}else{x=h[M+24>>2]|0,p=h[M+12>>2]|0;do if((p|0)==(M|0)){if(m=M+16|0,g=m+4|0,p=h[g>>2]|0,p)m=g;else if(p=h[m>>2]|0,!p){g=0;break}for(;;)if(_=p+20|0,g=h[_>>2]|0,g)p=g,m=_;else if(_=p+16|0,g=h[_>>2]|0,g)p=g,m=_;else break;h[m>>2]=0,g=p}else g=h[M+8>>2]|0,h[g+12>>2]=p,h[p+8>>2]=g,g=p;while(!1);if(x|0){if(p=h[M+28>>2]|0,m=27988+(p<<2)|0,(h[m>>2]|0)==(M|0)){if(h[m>>2]=g,!g){h[6922]=h[6922]&~(1<<p);break}}else if(_=x+16|0,h[((h[_>>2]|0)==(M|0)?_:x+20|0)>>2]=g,!g)break;h[g+24>>2]=x,p=M+16|0,m=h[p>>2]|0,m|0&&(h[g+16>>2]=m,h[m+24>>2]=g),p=h[p+4>>2]|0,p|0&&(h[g+20>>2]=p,h[p+24>>2]=g)}}while(!1);if(h[E+4>>2]=v|1,h[b+v>>2]=v,(E|0)==(h[6926]|0)){h[6923]=v;return}}if(p=v>>>3,v>>>0<256){g=27724+(p<<1<<2)|0,m=h[6921]|0,p=1<<p,m&p?(m=g+8|0,p=h[m>>2]|0):(h[6921]=m|p,p=g,m=g+8|0),h[m>>2]=E,h[p+12>>2]=E,h[E+8>>2]=p,h[E+12>>2]=g;return}p=v>>>8,p?v>>>0>16777215?_=31:(b=(p+1048320|0)>>>16&8,M=p<<b,x=(M+520192|0)>>>16&4,M=M<<x,_=(M+245760|0)>>>16&2,_=14-(x|b|_)+(M<<_>>>15)|0,_=v>>>(_+7|0)&1|_<<1):_=0,p=27988+(_<<2)|0,h[E+28>>2]=_,h[E+20>>2]=0,h[E+16>>2]=0,m=h[6922]|0,g=1<<_;e:do if(!(m&g))h[6922]=m|g,h[p>>2]=E,h[E+24>>2]=p,h[E+12>>2]=E,h[E+8>>2]=E;else{p=h[p>>2]|0;t:do if((h[p+4>>2]&-8|0)!=(v|0)){for(_=v<<((_|0)==31?0:25-(_>>>1)|0);g=p+16+(_>>>31<<2)|0,m=h[g>>2]|0,!!m;)if((h[m+4>>2]&-8|0)==(v|0)){p=m;break t}else _=_<<1,p=m;h[g>>2]=E,h[E+24>>2]=p,h[E+12>>2]=E,h[E+8>>2]=E;break e}while(!1);b=p+8|0,M=h[b>>2]|0,h[M+12>>2]=E,h[b>>2]=E,h[E+8>>2]=M,h[E+12>>2]=p,h[E+24>>2]=0}while(!1);if(M=(h[6929]|0)+-1|0,h[6929]=M,!(M|0)){for(p=28140;p=h[p>>2]|0,p;)p=p+8|0;h[6929]=-1}}}}function Ea(p,m){p=p|0,m=m|0;var g=0;return p?(g=al(m,p)|0,(m|p)>>>0>65535&&(g=((g>>>0)/(p>>>0)|0|0)==(m|0)?g:-1)):g=0,p=br(g)|0,!p||!(h[p+-4>>2]&3)||lp(p|0,0,g|0)|0,p|0}function the(p,m){p=p|0,m=m|0;var g=0,_=0;return p?m>>>0>4294967231?(m=Rq()|0,h[m>>2]=12,m=0,m|0):(g=nhe(p+-8|0,m>>>0<11?16:m+11&-8)|0,g|0?(m=g+8|0,m|0):(g=br(m)|0,g?(_=h[p+-4>>2]|0,_=(_&-8)-((_&3|0)==0?8:4)|0,cu(g|0,p|0,(_>>>0<m>>>0?_:m)|0)|0,_t(p),m=g,m|0):(m=0,m|0))):(m=br(m)|0,m|0)}function nhe(p,m){p=p|0,m=m|0;var g=0,_=0,v=0,x=0,b=0,E=0,M=0,N=0,U=0,q=0;if(U=p+4|0,q=h[U>>2]|0,g=q&-8,E=p+g|0,!(q&3))return m>>>0<256?(p=0,p|0):(g>>>0>=(m+4|0)>>>0&&(g-m|0)>>>0<=h[7041]<<1>>>0||(p=0),p|0);if(g>>>0>=m>>>0)return g=g-m|0,g>>>0<=15||(N=p+m|0,h[U>>2]=q&1|m|2,h[N+4>>2]=g|3,q=E+4|0,h[q>>2]=h[q>>2]|1,Dq(N,g)),p|0;if((h[6927]|0)==(E|0))return N=(h[6924]|0)+g|0,g=N-m|0,_=p+m|0,N>>>0<=m>>>0?(p=0,p|0):(h[U>>2]=q&1|m|2,h[_+4>>2]=g|1,h[6927]=_,h[6924]=g,p|0);if((h[6926]|0)==(E|0))return _=(h[6923]|0)+g|0,_>>>0<m>>>0?(p=0,p|0):(g=_-m|0,g>>>0>15?(N=p+m|0,_=p+_|0,h[U>>2]=q&1|m|2,h[N+4>>2]=g|1,h[_>>2]=g,_=_+4|0,h[_>>2]=h[_>>2]&-2,_=N):(h[U>>2]=q&1|_|2,_=p+_+4|0,h[_>>2]=h[_>>2]|1,_=0,g=0),h[6923]=g,h[6926]=_,p|0);if(_=h[E+4>>2]|0,_&2|0||(M=(_&-8)+g|0,M>>>0<m>>>0))return p=0,p|0;N=M-m|0,v=_>>>3;do if(_>>>0<256)if(_=h[E+8>>2]|0,g=h[E+12>>2]|0,(g|0)==(_|0)){h[6921]=h[6921]&~(1<<v);break}else{h[_+12>>2]=g,h[g+8>>2]=_;break}else{b=h[E+24>>2]|0,g=h[E+12>>2]|0;do if((g|0)==(E|0)){if(_=E+16|0,v=_+4|0,g=h[v>>2]|0,g)_=v;else if(g=h[_>>2]|0,!g){v=0;break}for(;;)if(x=g+20|0,v=h[x>>2]|0,v)g=v,_=x;else if(x=g+16|0,v=h[x>>2]|0,v)g=v,_=x;else break;h[_>>2]=0,v=g}else v=h[E+8>>2]|0,h[v+12>>2]=g,h[g+8>>2]=v,v=g;while(!1);if(b|0){if(g=h[E+28>>2]|0,_=27988+(g<<2)|0,(h[_>>2]|0)==(E|0)){if(h[_>>2]=v,!v){h[6922]=h[6922]&~(1<<g);break}}else if(x=b+16|0,h[((h[x>>2]|0)==(E|0)?x:b+20|0)>>2]=v,!v)break;h[v+24>>2]=b,g=E+16|0,_=h[g>>2]|0,_|0&&(h[v+16>>2]=_,h[_+24>>2]=v),g=h[g+4>>2]|0,g|0&&(h[v+20>>2]=g,h[g+24>>2]=v)}}while(!1);return N>>>0<16?(h[U>>2]=q&1|M|2,q=p+M+4|0,h[q>>2]=h[q>>2]|1,p|0):(E=p+m|0,h[U>>2]=q&1|m|2,h[E+4>>2]=N|3,q=p+M+4|0,h[q>>2]=h[q>>2]|1,Dq(E,N),p|0)}function Dq(p,m){p=p|0,m=m|0;var g=0,_=0,v=0,x=0,b=0,E=0;E=p+m|0,g=h[p+4>>2]|0;do if(g&1)b=p;else{if(v=h[p>>2]|0,!(g&3))return;if(b=p+(0-v)|0,m=v+m|0,(h[6926]|0)==(b|0)){if(p=E+4|0,g=h[p>>2]|0,(g&3|0)!=3)break;h[6923]=m,h[p>>2]=g&-2,h[b+4>>2]=m|1,h[E>>2]=m;return}if(_=v>>>3,v>>>0<256)if(p=h[b+8>>2]|0,g=h[b+12>>2]|0,(g|0)==(p|0)){h[6921]=h[6921]&~(1<<_);break}else{h[p+12>>2]=g,h[g+8>>2]=p;break}x=h[b+24>>2]|0,p=h[b+12>>2]|0;do if((p|0)==(b|0)){if(g=b+16|0,_=g+4|0,p=h[_>>2]|0,p)g=_;else if(p=h[g>>2]|0,!p){p=0;break}for(;;)if(v=p+20|0,_=h[v>>2]|0,_)p=_,g=v;else if(v=p+16|0,_=h[v>>2]|0,_)p=_,g=v;else break;h[g>>2]=0}else v=h[b+8>>2]|0,h[v+12>>2]=p,h[p+8>>2]=v;while(!1);if(x){if(g=h[b+28>>2]|0,_=27988+(g<<2)|0,(h[_>>2]|0)==(b|0)){if(h[_>>2]=p,!p){h[6922]=h[6922]&~(1<<g);break}}else if(v=x+16|0,h[((h[v>>2]|0)==(b|0)?v:x+20|0)>>2]=p,!p)break;h[p+24>>2]=x,g=b+16|0,_=h[g>>2]|0,_|0&&(h[p+16>>2]=_,h[_+24>>2]=p),g=h[g+4>>2]|0,g&&(h[p+20>>2]=g,h[g+24>>2]=p)}}while(!1);if(p=E+4|0,_=h[p>>2]|0,_&2)h[p>>2]=_&-2,h[b+4>>2]=m|1,h[b+m>>2]=m,v=m;else{if((h[6927]|0)==(E|0)){if(E=(h[6924]|0)+m|0,h[6924]=E,h[6927]=b,h[b+4>>2]=E|1,(b|0)!=(h[6926]|0))return;h[6926]=0,h[6923]=0;return}if((h[6926]|0)==(E|0)){E=(h[6923]|0)+m|0,h[6923]=E,h[6926]=b,h[b+4>>2]=E|1,h[b+E>>2]=E;return}v=(_&-8)+m|0,g=_>>>3;do if(_>>>0<256)if(p=h[E+8>>2]|0,m=h[E+12>>2]|0,(m|0)==(p|0)){h[6921]=h[6921]&~(1<<g);break}else{h[p+12>>2]=m,h[m+8>>2]=p;break}else{x=h[E+24>>2]|0,m=h[E+12>>2]|0;do if((m|0)==(E|0)){if(p=E+16|0,g=p+4|0,m=h[g>>2]|0,m)p=g;else if(m=h[p>>2]|0,!m){g=0;break}for(;;)if(_=m+20|0,g=h[_>>2]|0,g)m=g,p=_;else if(_=m+16|0,g=h[_>>2]|0,g)m=g,p=_;else break;h[p>>2]=0,g=m}else g=h[E+8>>2]|0,h[g+12>>2]=m,h[m+8>>2]=g,g=m;while(!1);if(x|0){if(m=h[E+28>>2]|0,p=27988+(m<<2)|0,(h[p>>2]|0)==(E|0)){if(h[p>>2]=g,!g){h[6922]=h[6922]&~(1<<m);break}}else if(_=x+16|0,h[((h[_>>2]|0)==(E|0)?_:x+20|0)>>2]=g,!g)break;h[g+24>>2]=x,m=E+16|0,p=h[m>>2]|0,p|0&&(h[g+16>>2]=p,h[p+24>>2]=g),m=h[m+4>>2]|0,m|0&&(h[g+20>>2]=m,h[m+24>>2]=g)}}while(!1);if(h[b+4>>2]=v|1,h[b+v>>2]=v,(b|0)==(h[6926]|0)){h[6923]=v;return}}if(m=v>>>3,v>>>0<256){g=27724+(m<<1<<2)|0,p=h[6921]|0,m=1<<m,p&m?(p=g+8|0,m=h[p>>2]|0):(h[6921]=p|m,m=g,p=g+8|0),h[p>>2]=b,h[m+12>>2]=b,h[b+8>>2]=m,h[b+12>>2]=g;return}if(m=v>>>8,m?v>>>0>16777215?_=31:(x=(m+1048320|0)>>>16&8,E=m<<x,g=(E+520192|0)>>>16&4,E=E<<g,_=(E+245760|0)>>>16&2,_=14-(g|x|_)+(E<<_>>>15)|0,_=v>>>(_+7|0)&1|_<<1):_=0,m=27988+(_<<2)|0,h[b+28>>2]=_,h[b+20>>2]=0,h[b+16>>2]=0,p=h[6922]|0,g=1<<_,!(p&g)){h[6922]=p|g,h[m>>2]=b,h[b+24>>2]=m,h[b+12>>2]=b,h[b+8>>2]=b;return}m=h[m>>2]|0;e:do if((h[m+4>>2]&-8|0)!=(v|0)){for(_=v<<((_|0)==31?0:25-(_>>>1)|0);g=m+16+(_>>>31<<2)|0,p=h[g>>2]|0,!!p;)if((h[p+4>>2]&-8|0)==(v|0)){m=p;break e}else _=_<<1,m=p;h[g>>2]=b,h[b+24>>2]=m,h[b+12>>2]=b,h[b+8>>2]=b;return}while(!1);x=m+8|0,E=h[x>>2]|0,h[E+12>>2]=b,h[x>>2]=b,h[b+8>>2]=E,h[b+12>>2]=m,h[b+24>>2]=0}function At(p,m,g,_){return p=p|0,m=m|0,g=g|0,_=_|0,g=p+g>>>0,On(m+_+(g>>>0<p>>>0|0)>>>0|0),g|0|0}function Js(p,m,g,_){return p=p|0,m=m|0,g=g|0,_=_|0,_=m-_-(g>>>0>p>>>0|0)>>>0,On(_|0),p-g>>>0|0|0}function Nq(p){return p=p|0,(p?31-(Gf(p^p-1)|0)|0:32)|0}function TL(p,m,g,_,v){p=p|0,m=m|0,g=g|0,_=_|0,v=v|0;var x=0,b=0,E=0,M=0,N=0,U=0,q=0,j=0,X=0,K=0;if(U=p,M=m,N=M,b=g,j=_,E=j,!N)return x=(v|0)!=0,E?x?(h[v>>2]=p|0,h[v+4>>2]=m&0,j=0,v=0,On(j|0),v|0):(j=0,v=0,On(j|0),v|0):(x&&(h[v>>2]=(U>>>0)%(b>>>0),h[v+4>>2]=0),j=0,v=(U>>>0)/(b>>>0)>>>0,On(j|0),v|0);x=(E|0)==0;do if(b){if(!x){if(x=(Gf(E|0)|0)-(Gf(N|0)|0)|0,x>>>0<=31){q=x+1|0,E=31-x|0,m=x-31>>31,b=q,p=U>>>(q>>>0)&m|N<<E,m=N>>>(q>>>0)&m,x=0,E=U<<E;break}return v?(h[v>>2]=p|0,h[v+4>>2]=M|m&0,j=0,v=0,On(j|0),v|0):(j=0,v=0,On(j|0),v|0)}if(x=b-1|0,x&b|0){E=(Gf(b|0)|0)+33-(Gf(N|0)|0)|0,K=64-E|0,q=32-E|0,M=q>>31,X=E-32|0,m=X>>31,b=E,p=q-1>>31&N>>>(X>>>0)|(N<<q|U>>>(E>>>0))&m,m=m&N>>>(E>>>0),x=U<<K&M,E=(N<<K|U>>>(X>>>0))&M|U<<q&E-33>>31;break}return v|0&&(h[v>>2]=x&U,h[v+4>>2]=0),(b|0)==1?(X=M|m&0,K=p|0|0,On(X|0),K|0):(K=Nq(b|0)|0,X=N>>>(K>>>0)|0,K=N<<32-K|U>>>(K>>>0)|0,On(X|0),K|0)}else{if(x)return v|0&&(h[v>>2]=(N>>>0)%(b>>>0),h[v+4>>2]=0),X=0,K=(N>>>0)/(b>>>0)>>>0,On(X|0),K|0;if(!U)return v|0&&(h[v>>2]=0,h[v+4>>2]=(N>>>0)%(E>>>0)),X=0,K=(N>>>0)/(E>>>0)>>>0,On(X|0),K|0;if(x=E-1|0,!(x&E))return v|0&&(h[v>>2]=p|0,h[v+4>>2]=x&N|m&0),X=0,K=N>>>((Nq(E|0)|0)>>>0),On(X|0),K|0;if(x=(Gf(E|0)|0)-(Gf(N|0)|0)|0,x>>>0<=30){m=x+1|0,E=31-x|0,b=m,p=N<<E|U>>>(m>>>0),m=N>>>(m>>>0),x=0,E=U<<E;break}return v?(h[v>>2]=p|0,h[v+4>>2]=M|m&0,X=0,K=0,On(X|0),K|0):(X=0,K=0,On(X|0),K|0)}while(!1);if(!b)N=E,M=0,E=0;else{q=g|0|0,U=j|_&0,N=At(q|0,U|0,-1,-1)|0,g=ee()|0,M=E,E=0;do _=M,M=x>>>31|M<<1,x=E|x<<1,_=p<<1|_>>>31|0,j=p>>>31|m<<1|0,Js(N|0,g|0,_|0,j|0)|0,K=ee()|0,X=K>>31|((K|0)<0?-1:0)<<1,E=X&1,p=Js(_|0,j|0,X&q|0,(((K|0)<0?-1:0)>>31|((K|0)<0?-1:0)<<1)&U|0)|0,m=ee()|0,b=b-1|0;while((b|0)!=0);N=M,M=0}return b=0,v|0&&(h[v>>2]=p,h[v+4>>2]=m),X=(x|0)>>>31|(N|b)<<1|(b<<1|x>>>31)&0|M,K=(x<<1|0)&-2|E,On(X|0),K|0}function op(p,m,g,_){p=p|0,m=m|0,g=g|0,_=_|0;var v=0,x=0,b=0,E=0,M=0,N=0;return N=m>>31|((m|0)<0?-1:0)<<1,M=((m|0)<0?-1:0)>>31|((m|0)<0?-1:0)<<1,x=_>>31|((_|0)<0?-1:0)<<1,v=((_|0)<0?-1:0)>>31|((_|0)<0?-1:0)<<1,E=Js(N^p|0,M^m|0,N|0,M|0)|0,b=ee()|0,p=x^N,m=v^M,Js((TL(E,b,Js(x^g|0,v^_|0,x|0,v|0)|0,ee()|0,0)|0)^p|0,(ee()|0)^m|0,p|0,m|0)|0}function ihe(p,m){p=p|0,m=m|0;var g=0,_=0,v=0,x=0;return x=p&65535,v=m&65535,g=al(v,x)|0,_=p>>>16,p=(g>>>16)+(al(v,_)|0)|0,v=m>>>16,m=al(v,x)|0,On((p>>>16)+(al(v,_)|0)+(((p&65535)+m|0)>>>16)|0),p+m<<16|g&65535|0|0}function wr(p,m,g,_){p=p|0,m=m|0,g=g|0,_=_|0;var v=0,x=0;return v=p,x=g,g=ihe(v,x)|0,p=ee()|0,On((al(m,x)|0)+(al(_,v)|0)+p|p&0|0),g|0|0|0}function ap(p,m,g,_){p=p|0,m=m|0,g=g|0,_=_|0;var v=0,x=0,b=0,E=0,M=0,N=0;return v=Q,Q=Q+16|0,E=v|0,b=m>>31|((m|0)<0?-1:0)<<1,x=((m|0)<0?-1:0)>>31|((m|0)<0?-1:0)<<1,N=_>>31|((_|0)<0?-1:0)<<1,M=((_|0)<0?-1:0)>>31|((_|0)<0?-1:0)<<1,p=Js(b^p|0,x^m|0,b|0,x|0)|0,m=ee()|0,TL(p,m,Js(N^g|0,M^_|0,N|0,M|0)|0,ee()|0,E)|0,_=Js(h[E>>2]^b|0,h[E+4>>2]^x|0,b|0,x|0)|0,g=ee()|0,Q=v,On(g|0),_|0}function qf(p,m,g,_){p=p|0,m=m|0,g=g|0,_=_|0;var v=0,x=0;return x=Q,Q=Q+16|0,v=x|0,TL(p,m,g,_,v)|0,Q=x,On(h[v+4>>2]|0),h[v>>2]|0|0}function Fq(p,m,g){return p=p|0,m=m|0,g=g|0,(g|0)<32?(On(m>>g|0),p>>>g|(m&(1<<g)-1)<<32-g):(On(((m|0)<0?-1:0)|0),m>>g-32|0)}function tt(p,m,g){return p=p|0,m=m|0,g=g|0,(g|0)<32?(On(m>>>g|0),p>>>g|(m&(1<<g)-1)<<32-g):(On(0),m>>>g-32|0)}function ft(p,m,g){return p=p|0,m=m|0,g=g|0,(g|0)<32?(On(m<<g|(p&(1<<g)-1<<32-g)>>>32-g|0),p<<g):(On(p<<g-32|0),0)}function EL(p,m,g){return p=p|0,m=m|0,g=g|0,m=Gf(m)|0,(m|0)==32&&(m=m+(Gf(p)|0)|0),On(0),m|0}function Bq(p,m){return p=+p,m=+m,p!=p?+m:m!=m?+p:+wce(+p,+m)}function pT(p,m){return p=+p,m=+m,p!=p?+m:m!=m?+p:+nL(+p,+m)}function mT(p){return p=+p,p>=0?+fo(p+.5):+x1(p-.5)}function cu(p,m,g){p=p|0,m=m|0,g=g|0;var _=0,v=0,x=0;if((g|0)>=8192)return Ece(p|0,m|0,g|0)|0,p|0;if(x=p|0,v=p+g|0,(p&3)==(m&3)){for(;p&3;){if(!g)return x|0;He[p>>0]=He[m>>0]|0,p=p+1|0,m=m+1|0,g=g-1|0}for(g=v&-4|0,_=g-64|0;(p|0)<=(_|0);)h[p>>2]=h[m>>2],h[p+4>>2]=h[m+4>>2],h[p+8>>2]=h[m+8>>2],h[p+12>>2]=h[m+12>>2],h[p+16>>2]=h[m+16>>2],h[p+20>>2]=h[m+20>>2],h[p+24>>2]=h[m+24>>2],h[p+28>>2]=h[m+28>>2],h[p+32>>2]=h[m+32>>2],h[p+36>>2]=h[m+36>>2],h[p+40>>2]=h[m+40>>2],h[p+44>>2]=h[m+44>>2],h[p+48>>2]=h[m+48>>2],h[p+52>>2]=h[m+52>>2],h[p+56>>2]=h[m+56>>2],h[p+60>>2]=h[m+60>>2],p=p+64|0,m=m+64|0;for(;(p|0)<(g|0);)h[p>>2]=h[m>>2],p=p+4|0,m=m+4|0}else for(g=v-4|0;(p|0)<(g|0);)He[p>>0]=He[m>>0]|0,He[p+1>>0]=He[m+1>>0]|0,He[p+2>>0]=He[m+2>>0]|0,He[p+3>>0]=He[m+3>>0]|0,p=p+4|0,m=m+4|0;for(;(p|0)<(v|0);)He[p>>0]=He[m>>0]|0,p=p+1|0,m=m+1|0;return x|0}function ML(p,m,g){p=p|0,m=m|0,g=g|0;var _=0;if((m|0)<(p|0)&(p|0)<(m+g|0)){for(_=p,m=m+g|0,p=p+g|0;(g|0)>0;)p=p-1|0,m=m-1|0,g=g-1|0,He[p>>0]=He[m>>0]|0;p=_}else cu(p,m,g)|0;return p|0}function lp(p,m,g){p=p|0,m=m|0,g=g|0;var _=0,v=0,x=0,b=0;if(x=p+g|0,m=m&255,(g|0)>=67){for(;p&3;)He[p>>0]=m,p=p+1|0;for(_=x&-4|0,b=m|m<<8|m<<16|m<<24,v=_-64|0;(p|0)<=(v|0);)h[p>>2]=b,h[p+4>>2]=b,h[p+8>>2]=b,h[p+12>>2]=b,h[p+16>>2]=b,h[p+20>>2]=b,h[p+24>>2]=b,h[p+28>>2]=b,h[p+32>>2]=b,h[p+36>>2]=b,h[p+40>>2]=b,h[p+44>>2]=b,h[p+48>>2]=b,h[p+52>>2]=b,h[p+56>>2]=b,h[p+60>>2]=b,p=p+64|0;for(;(p|0)<(_|0);)h[p>>2]=b,p=p+4|0}for(;(p|0)<(x|0);)He[p>>0]=m,p=p+1|0;return x-g|0}function Oq(p){return p=+p,p>=0?+fo(p+.5):+x1(p-.5)}function cp(p){p=p|0;var m=0,g=0,_=0;return _=Tce()|0,g=h[ol>>2]|0,m=g+p|0,(p|0)>0&(m|0)<(g|0)|(m|0)<0?(Cce(m|0)|0,QG(12),-1):(m|0)>(_|0)&&!(Mce(m|0)|0)?(QG(12),-1):(h[ol>>2]=m,g|0)}function rhe(p,m,g){return p=p|0,m=m|0,g=g|0,up[p&3](m|0,g|0)|0}function she(p,m){return p=p|0,m=m|0,Sce(0),0}var up=[she,tue,nue,iue];return{___divdi3:op,___muldi3:wr,___remdi3:ap,___uremdi3:qf,_areNeighborCells:rue,_bitshift64Ashr:Fq,_bitshift64Lshr:tt,_bitshift64Shl:ft,_calloc:Ea,_cellAreaKm2:Vce,_cellAreaM2:Gce,_cellAreaRads2:zce,_cellToBoundary:zm,_cellToCenterChild:Aq,_cellToChildPos:Sue,_cellToChildren:mue,_cellToChildrenSize:jx,_cellToLatLng:w1,_cellToLocalIj:Bue,_cellToParent:fL,_cellToVertex:xc,_cellToVertexes:Jue,_cellsToDirectedEdge:sue,_cellsToLinkedMultiPolygon:kce,_childPosToCell:Tue,_compactCells:Aue,_constructCell:due,_destroyLinkedMultiPolygon:Nue,_directedEdgeToBoundary:Hx,_directedEdgeToCells:lue,_edgeLengthKm:Lue,_edgeLengthM:Due,_edgeLengthRads:Iue,_emscripten_replace_memory:Rce,_free:_t,_getBaseCellNumber:pq,_getDirectedEdgeDestination:aue,_getDirectedEdgeOrigin:oue,_getHexagonAreaAvgKm2:_q,_getHexagonAreaAvgM2:Cue,_getHexagonEdgeLengthAvgKm:Rue,_getHexagonEdgeLengthAvgM:Pue,_getIcosahedronFaces:gq,_getIndexDigit:fue,_getNumCells:aT,_getPentagons:gL,_getRes0Cells:Xce,_getResolution:uL,_greatCircleDistanceKm:$x,_greatCircleDistanceM:Mue,_greatCircleDistanceRads:Eue,_gridDisk:JG,_gridDiskDistances:eq,_gridDistance:xL,_gridPathCells:kue,_gridPathCellsSize:Uue,_gridRing:Fce,_gridRingUnsafe:nq,_i64Add:At,_i64Subtract:Js,_isPentagon:Zi,_isResClassIII:_ue,_isValidCell:oT,_isValidDirectedEdge:uq,_isValidIndex:pue,_isValidVertex:Cq,_latLngToCell:mL,_llvm_ctlz_i64:EL,_llvm_maxnum_f64:Bq,_llvm_minnum_f64:pT,_llvm_round_f64:mT,_localIjToCell:Oue,_malloc:br,_maxFaceCount:bue,_maxGridDiskSize:Nce,_maxPolygonToCellsSize:Oce,_maxPolygonToCellsSizeExperimental:Gue,_memcpy:cu,_memmove:ML,_memset:lp,_originToDirectedEdges:aL,_pentagonCount:wue,_polygonToCells:Uce,_polygonToCellsExperimental:Vue,_readInt64AsDoubleFromPointer:Zue,_res0CellCount:jce,_reverseDirectedEdge:hq,_round:Oq,_sbrk:cp,_sizeOfCellBoundary:Wue,_sizeOfCoordIJ:Yue,_sizeOfGeoLoop:jue,_sizeOfGeoPolygon:Xue,_sizeOfH3Index:que,_sizeOfLatLng:Hue,_sizeOfLinkedGeoPolygon:$ue,_uncompactCells:gue,_uncompactCellsSize:vue,_vertexToLatLng:ehe,dynCall_iii:rhe,establishStackSpace:Dce,stackAlloc:Pce,stackRestore:Lce,stackSave:Ice}})(Bt,ut,W),Yt=e.___divdi3=Ce.___divdi3,nr=e.___muldi3=Ce.___muldi3,Fn=e.___remdi3=Ce.___remdi3,rs=e.___uremdi3=Ce.___uremdi3,Lr=e._areNeighborCells=Ce._areNeighborCells,Fl=e._bitshift64Ashr=Ce._bitshift64Ashr,Sa=e._bitshift64Lshr=Ce._bitshift64Lshr,Bl=e._bitshift64Shl=Ce._bitshift64Shl,rl=e._calloc=Ce._calloc,xr=e._cellAreaKm2=Ce._cellAreaKm2,Zs=e._cellAreaM2=Ce._cellAreaM2,Ol=e._cellAreaRads2=Ce._cellAreaRads2,nh=e._cellToBoundary=Ce._cellToBoundary,tT=e._cellToCenterChild=Ce._cellToCenterChild,$I=e._cellToChildPos=Ce._cellToChildPos,YI=e._cellToChildren=Ce._cellToChildren,Vx=e._cellToChildrenSize=Ce._cellToChildrenSize,ZI=e._cellToLatLng=Ce._cellToLatLng,Gx=e._cellToLocalIj=Ce._cellToLocalIj,KI=e._cellToParent=Ce._cellToParent,QI=e._cellToVertex=Ce._cellToVertex,qG=e._cellToVertexes=Ce._cellToVertexes,HG=e._cellsToDirectedEdge=Ce._cellsToDirectedEdge,WG=e._cellsToLinkedMultiPolygon=Ce._cellsToLinkedMultiPolygon,jG=e._childPosToCell=Ce._childPosToCell,ne=e._compactCells=Ce._compactCells,Se=e._constructCell=Ce._constructCell,ke=e._destroyLinkedMultiPolygon=Ce._destroyLinkedMultiPolygon,De=e._directedEdgeToBoundary=Ce._directedEdgeToBoundary,Ne=e._directedEdgeToCells=Ce._directedEdgeToCells,qt=e._edgeLengthKm=Ce._edgeLengthKm,Qt=e._edgeLengthM=Ce._edgeLengthM,Vt=e._edgeLengthRads=Ce._edgeLengthRads,sn=e._emscripten_replace_memory=Ce._emscripten_replace_memory,pn=e._free=Ce._free,Wn=e._getBaseCellNumber=Ce._getBaseCellNumber,Jn=e._getDirectedEdgeDestination=Ce._getDirectedEdgeDestination,gn=e._getDirectedEdgeOrigin=Ce._getDirectedEdgeOrigin,Yi=e._getHexagonAreaAvgKm2=Ce._getHexagonAreaAvgKm2,ss=e._getHexagonAreaAvgM2=Ce._getHexagonAreaAvgM2,qr=e._getHexagonEdgeLengthAvgKm=Ce._getHexagonEdgeLengthAvgKm,ir=e._getHexagonEdgeLengthAvgM=Ce._getHexagonEdgeLengthAvgM,Co=e._getIcosahedronFaces=Ce._getIcosahedronFaces,Zt=e._getIndexDigit=Ce._getIndexDigit,sl=e._getNumCells=Ce._getNumCells,yi=e._getPentagons=Ce._getPentagons,Ul=e._getRes0Cells=Ce._getRes0Cells,lu=e._getResolution=Ce._getResolution,kf=e._greatCircleDistanceKm=Ce._greatCircleDistanceKm,Bm=e._greatCircleDistanceM=Ce._greatCircleDistanceM,rr=e._greatCircleDistanceRads=Ce._greatCircleDistanceRads,os=e._gridDisk=Ce._gridDisk,zf=e._gridDiskDistances=Ce._gridDiskDistances,pr=e._gridDistance=Ce._gridDistance,Vf=e._gridPathCells=Ce._gridPathCells,Om=e._gridPathCellsSize=Ce._gridPathCellsSize,JI=e._gridRing=Ce._gridRing,d8e=e._gridRingUnsafe=Ce._gridRingUnsafe,p8e=e._i64Add=Ce._i64Add,m8e=e._i64Subtract=Ce._i64Subtract,A8e=e._isPentagon=Ce._isPentagon,g8e=e._isResClassIII=Ce._isResClassIII,v8e=e._isValidCell=Ce._isValidCell,_8e=e._isValidDirectedEdge=Ce._isValidDirectedEdge,x8e=e._isValidIndex=Ce._isValidIndex,y8e=e._isValidVertex=Ce._isValidVertex,b8e=e._latLngToCell=Ce._latLngToCell,w8e=e._llvm_ctlz_i64=Ce._llvm_ctlz_i64,S8e=e._llvm_maxnum_f64=Ce._llvm_maxnum_f64,T8e=e._llvm_minnum_f64=Ce._llvm_minnum_f64,E8e=e._llvm_round_f64=Ce._llvm_round_f64,M8e=e._localIjToCell=Ce._localIjToCell,C8e=e._malloc=Ce._malloc,R8e=e._maxFaceCount=Ce._maxFaceCount,P8e=e._maxGridDiskSize=Ce._maxGridDiskSize,I8e=e._maxPolygonToCellsSize=Ce._maxPolygonToCellsSize,L8e=e._maxPolygonToCellsSizeExperimental=Ce._maxPolygonToCellsSizeExperimental,D8e=e._memcpy=Ce._memcpy,N8e=e._memmove=Ce._memmove,F8e=e._memset=Ce._memset,B8e=e._originToDirectedEdges=Ce._originToDirectedEdges,O8e=e._pentagonCount=Ce._pentagonCount,U8e=e._polygonToCells=Ce._polygonToCells,k8e=e._polygonToCellsExperimental=Ce._polygonToCellsExperimental,z8e=e._readInt64AsDoubleFromPointer=Ce._readInt64AsDoubleFromPointer,V8e=e._res0CellCount=Ce._res0CellCount,G8e=e._reverseDirectedEdge=Ce._reverseDirectedEdge,q8e=e._round=Ce._round,H8e=e._sbrk=Ce._sbrk,W8e=e._sizeOfCellBoundary=Ce._sizeOfCellBoundary,j8e=e._sizeOfCoordIJ=Ce._sizeOfCoordIJ,X8e=e._sizeOfGeoLoop=Ce._sizeOfGeoLoop,$8e=e._sizeOfGeoPolygon=Ce._sizeOfGeoPolygon,Y8e=e._sizeOfH3Index=Ce._sizeOfH3Index,Z8e=e._sizeOfLatLng=Ce._sizeOfLatLng,K8e=e._sizeOfLinkedGeoPolygon=Ce._sizeOfLinkedGeoPolygon,Q8e=e._uncompactCells=Ce._uncompactCells,J8e=e._uncompactCellsSize=Ce._uncompactCellsSize,eFe=e._vertexToLatLng=Ce._vertexToLatLng,tFe=e.establishStackSpace=Ce.establishStackSpace,XG=e.stackAlloc=Ce.stackAlloc,xce=e.stackRestore=Ce.stackRestore,yce=e.stackSave=Ce.stackSave,nFe=e.dynCall_iii=Ce.dynCall_iii;if(e.asm=Ce,e.cwrap=P,e.setValue=y,e.getValue=w,le){Te(le)||(le=o(le));{vi("memory initializer");var eL=function(Le){Le.byteLength&&(Le=new Uint8Array(Le)),H.set(Le,A),e.memoryInitializerRequest&&delete e.memoryInitializerRequest.response,zn("memory initializer")},$G=function(){a(le,eL,function(){throw"could not load memory initializer "+le})},YG=St(le);if(YG)eL(YG.buffer);else if(e.memoryInitializerRequest){var ZG=function(){var Le=e.memoryInitializerRequest,it=Le.response;if(Le.status!==200&&Le.status!==0){var Dt=St(e.memoryInitializerRequestURL);if(Dt)it=Dt.buffer;else{console.warn("a problem seems to have happened with Module.memoryInitializerRequest, status: "+Le.status+", retrying "+le),$G();return}}eL(it)};e.memoryInitializerRequest.response?setTimeout(ZG,0):e.memoryInitializerRequest.addEventListener("load",ZG)}else $G()}}var nT;_e=function Le(){nT||tL(),nT||(_e=Le)};function tL(Le){if(Le=Le||r,tn>0||(Pt(),tn>0))return;function it(){nT||(nT=!0,!S&&(dn(),Gt(),e.onRuntimeInitialized&&e.onRuntimeInitialized(),$e()))}e.setStatus?(e.setStatus("Running..."),setTimeout(function(){setTimeout(function(){e.setStatus("")},1),it()},1)):it()}e.run=tL;function Um(Le){throw e.onAbort&&e.onAbort(Le),Le+="",l(Le),c(Le),S=!0,"abort("+Le+"). Build with -s ASSERTIONS=1 for more info."}if(e.abort=Um,e.preInit)for(typeof e.preInit=="function"&&(e.preInit=[e.preInit]);e.preInit.length>0;)e.preInit.pop()();return tL(),i})(typeof Ai=="object"?Ai:{}),En="number",Sn=En,U_=En,Cn=En,Rn=En,wo=En,jt=En,GSe=[["sizeOfH3Index",En],["sizeOfLatLng",En],["sizeOfCellBoundary",En],["sizeOfGeoLoop",En],["sizeOfGeoPolygon",En],["sizeOfLinkedGeoPolygon",En],["sizeOfCoordIJ",En],["readInt64AsDoubleFromPointer",En],["isValidCell",U_,[Cn,Rn]],["isValidIndex",U_,[Cn,Rn]],["latLngToCell",Sn,[En,En,wo,jt]],["cellToLatLng",Sn,[Cn,Rn,jt]],["cellToBoundary",Sn,[Cn,Rn,jt]],["maxGridDiskSize",Sn,[En,jt]],["gridDisk",Sn,[Cn,Rn,En,jt]],["gridDiskDistances",Sn,[Cn,Rn,En,jt,jt]],["gridRing",Sn,[Cn,Rn,En,jt]],["gridRingUnsafe",Sn,[Cn,Rn,En,jt]],["maxPolygonToCellsSize",Sn,[jt,wo,En,jt]],["polygonToCells",Sn,[jt,wo,En,jt]],["maxPolygonToCellsSizeExperimental",Sn,[jt,wo,En,jt]],["polygonToCellsExperimental",Sn,[jt,wo,En,En,En,jt]],["cellsToLinkedMultiPolygon",Sn,[jt,En,jt]],["destroyLinkedMultiPolygon",null,[jt]],["compactCells",Sn,[jt,jt,En,En]],["uncompactCells",Sn,[jt,En,En,jt,En,wo]],["uncompactCellsSize",Sn,[jt,En,En,wo,jt]],["isPentagon",U_,[Cn,Rn]],["isResClassIII",U_,[Cn,Rn]],["getBaseCellNumber",En,[Cn,Rn]],["getResolution",En,[Cn,Rn]],["getIndexDigit",En,[Cn,Rn,En]],["constructCell",Sn,[En,En,jt,jt]],["maxFaceCount",Sn,[Cn,Rn,jt]],["getIcosahedronFaces",Sn,[Cn,Rn,jt]],["cellToParent",Sn,[Cn,Rn,wo,jt]],["cellToChildren",Sn,[Cn,Rn,wo,jt]],["cellToCenterChild",Sn,[Cn,Rn,wo,jt]],["cellToChildrenSize",Sn,[Cn,Rn,wo,jt]],["cellToChildPos",Sn,[Cn,Rn,wo,jt]],["childPosToCell",Sn,[En,En,Cn,Rn,wo,jt]],["areNeighborCells",Sn,[Cn,Rn,Cn,Rn,jt]],["cellsToDirectedEdge",Sn,[Cn,Rn,Cn,Rn,jt]],["getDirectedEdgeOrigin",Sn,[Cn,Rn,jt]],["getDirectedEdgeDestination",Sn,[Cn,Rn,jt]],["isValidDirectedEdge",U_,[Cn,Rn]],["directedEdgeToCells",Sn,[Cn,Rn,jt]],["originToDirectedEdges",Sn,[Cn,Rn,jt]],["directedEdgeToBoundary",Sn,[Cn,Rn,jt]],["reverseDirectedEdge",Sn,[Cn,Rn,jt]],["gridDistance",Sn,[Cn,Rn,Cn,Rn,jt]],["gridPathCells",Sn,[Cn,Rn,Cn,Rn,jt]],["gridPathCellsSize",Sn,[Cn,Rn,Cn,Rn,jt]],["cellToLocalIj",Sn,[Cn,Rn,Cn,Rn,En,jt]],["localIjToCell",Sn,[Cn,Rn,jt,En,jt]],["getHexagonAreaAvgM2",Sn,[wo,jt]],["getHexagonAreaAvgKm2",Sn,[wo,jt]],["getHexagonEdgeLengthAvgM",Sn,[wo,jt]],["getHexagonEdgeLengthAvgKm",Sn,[wo,jt]],["greatCircleDistanceM",En,[jt,jt]],["greatCircleDistanceKm",En,[jt,jt]],["greatCircleDistanceRads",En,[jt,jt]],["cellAreaM2",Sn,[Cn,Rn,jt]],["cellAreaKm2",Sn,[Cn,Rn,jt]],["cellAreaRads2",Sn,[Cn,Rn,jt]],["edgeLengthM",Sn,[Cn,Rn,jt]],["edgeLengthKm",Sn,[Cn,Rn,jt]],["edgeLengthRads",Sn,[Cn,Rn,jt]],["getNumCells",Sn,[wo,jt]],["getRes0Cells",Sn,[jt]],["res0CellCount",En],["getPentagons",Sn,[En,jt]],["pentagonCount",En],["cellToVertex",Sn,[Cn,Rn,En,jt]],["cellToVertexes",Sn,[Cn,Rn,jt]],["vertexToLatLng",Sn,[Cn,Rn,jt]],["isValidVertex",U_,[Cn,Rn]]],qSe=0,HSe=1,WSe=2,jSe=3,bee=4,XSe=5,$Se=6,YSe=7,ZSe=8,KSe=9,QSe=10,JSe=11,eTe=12,tTe=13,nTe=14,iTe=15,rTe=16,sTe=17,oTe=18,aTe=19,Cs={};Cs[qSe]="Success";Cs[HSe]="The operation failed but a more specific error is not available";Cs[WSe]="Argument was outside of acceptable range";Cs[jSe]="Latitude or longitude arguments were outside of acceptable range";Cs[bee]="Resolution argument was outside of acceptable range";Cs[XSe]="Cell argument was not valid";Cs[$Se]="Directed edge argument was not valid";Cs[YSe]="Undirected edge argument was not valid";Cs[ZSe]="Vertex argument was not valid";Cs[KSe]="Pentagon distortion was encountered";Cs[QSe]="Duplicate input";Cs[JSe]="Cell arguments were not neighbors";Cs[eTe]="Cell arguments had incompatible resolutions";Cs[tTe]="Memory allocation failed";Cs[nTe]="Bounds of provided memory were insufficient";Cs[iTe]="Mode or flags argument was not valid";Cs[rTe]="Index argument was not valid";Cs[sTe]="Base cell number was outside of acceptable range";Cs[oTe]="Child indexing digits invalid";Cs[aTe]="Child indexing digits refer to a deleted subsequence";var lTe=1e3,wee=1001,See=1002,hR={};hR[lTe]="Unknown unit";hR[wee]="Array length out of bounds";hR[See]="Got unexpected null value for H3 index";var cTe="Unknown error";function Tee(i,e,t){var n=t&&"value"in t,r=new Error((i[e]||cTe)+" (code: "+e+(n?", value: "+t.value:"")+")");return r.code=e,r}function Eee(i,e){var t=arguments.length===2?{value:e}:{};return Tee(Cs,i,t)}function Mee(i,e){var t=arguments.length===2?{value:e}:{};return Tee(hR,i,t)}function Nw(i){if(i!==0)throw Eee(i)}var Rl={};GSe.forEach(function(e){Rl[e[0]]=Ai.cwrap.apply(Ai,e)});var k_=16;var Fw=4;var z_=8,uTe=8,cR=Rl.sizeOfH3Index(),DO=Rl.sizeOfLatLng(),hTe=Rl.sizeOfCellBoundary(),fTe=Rl.sizeOfGeoPolygon(),Dw=Rl.sizeOfGeoLoop(),flt=Rl.sizeOfLinkedGeoPolygon(),dlt=Rl.sizeOfCoordIJ();function dTe(i){if(typeof i!="number"||i<0||i>15||Math.floor(i)!==i)throw Eee(bee,i);return i}function pTe(i){if(!i)throw Mee(See);return i}var mTe=Math.pow(2,32)-1,plt=Math.pow(2,31)-1;function ATe(i){if(i>mTe)throw Mee(wee,i);return i}var gTe=/[^0-9a-fA-F]/;function Cee(i){if(Array.isArray(i)&&i.length===2&&Number.isInteger(i[0])&&Number.isInteger(i[1]))return i;if(typeof i!="string"||gTe.test(i))return[0,0];var e=parseInt(i.substring(0,i.length-8),k_),t=parseInt(i.substring(i.length-8),k_);return[t,e]}function xee(i){if(i>=0)return i.toString(k_);i=i&2147483647;var e=Ree(8,i.toString(k_)),t=(parseInt(e[0],k_)+8).toString(k_);return e=t+e.substring(1),e}function vTe(i,e){return xee(e)+Ree(8,xee(i))}function Ree(i,e){for(var t=i-e.length,n="",r=0;r<t;r++)n+="0";return n=n+e,n}var mlt=Math.pow(2,32);function yee(i,e,t){for(var n=i.length,r=Ai._calloc(n,DO),s=t?1:0,o=t?0:1,a=0;a<n*2;a+=2)Ai.HEAPF64.set([i[a/2][s],i[a/2][o]].map(Dee),r/z_+a);return Ai.HEAPU32.set([n,r],e/Fw),e}function _Te(i,e){var t=i.length-1,n=Ai._calloc(fTe),r=0,s=r+Dw,o=s+Fw;yee(i[0],n+r,e);var a;if(t>0){a=Ai._calloc(t,Dw);for(var l=0;l<t;l++)yee(i[l+1],a+Dw*l,e)}return Ai.setValue(n+s,t,"i32"),Ai.setValue(n+o,a,"i32"),n}function xTe(i){var e=0,t=e+Dw,n=t+Fw,r=Fw;Ai._free(Ai.getValue(i+e+r,"i8*"));var s=Ai.getValue(i+t,"i32");if(s>0){for(var o=Ai.getValue(i+n,"i32"),a=0;a<s;a++)Ai._free(Ai.getValue(o+Dw*a+r,"i8*"));Ai._free(o)}Ai._free(i)}function Pee(i,e){e===void 0&&(e=0);var t=Ai.getValue(i+cR*e,"i32"),n=Ai.getValue(i+cR*e+Fw,"i32");return n?vTe(t,n):null}function yTe(i){return Rl.readInt64AsDoubleFromPointer(i)}function bTe(i,e){for(var t=[],n=0;n<e;n++){var r=Pee(i,n);r!==null&&t.push(r)}return t}function uR(i){return TTe(Ai.getValue(i,"double"))}function Iee(i){return[uR(i),uR(i+z_)]}function wTe(i){return[uR(i+z_),uR(i)]}function STe(i,e,t){for(var n=Ai.getValue(i,"i32"),r=i+z_,s=[],o=e?wTe:Iee,a=0;a<n*2;a+=2)s.push(o(r+z_*a));return t&&s.push(s[0]),s}function Lee(i,e,t){var n=Ai._malloc(DO);Ai.HEAPF64.set([i,e].map(Dee),n/z_);var r=Ai._malloc(cR);try{return Nw(Rl.latLngToCell(n,t,r)),pTe(Pee(r))}finally{Ai._free(r),Ai._free(n)}}function NO(i){var e=Ai._malloc(DO),t=Cee(i),n=t[0],r=t[1];try{return Nw(Rl.cellToLatLng(n,r,e)),Iee(e)}finally{Ai._free(e)}}function FO(i,e){var t=Ai._malloc(hTe),n=Cee(i),r=n[0],s=n[1];try{return Nw(Rl.cellToBoundary(r,s,t)),STe(t,e,e)}finally{Ai._free(t)}}function BO(i,e,t){if(dTe(e),t=!!t,i.length===0||i[0].length===0)return[];var n=typeof i[0][0]=="number"?[i]:i,r=_Te(n,t),s=Ai._malloc(uTe);try{Nw(Rl.maxPolygonToCellsSize(r,e,0,s));var o=ATe(yTe(s)),a=Ai._calloc(o,cR);try{return Nw(Rl.polygonToCells(r,e,0,a)),bTe(a,o)}finally{Ai._free(a)}}finally{Ai._free(s),xTe(r)}}function Dee(i){return i*Math.PI/180}function TTe(i){return i*180/Math.PI}function OO(i){return i=Math.max(0,Math.min(1,i)),"rgb("+Math.max(0,Math.min(255,Math.round(34.61+i*(1172.33-i*(10793.56-i*(33300.12-i*(38394.49-i*14825.05)))))))+", "+Math.max(0,Math.min(255,Math.round(23.31+i*(557.33+i*(1225.33-i*(3574.96-i*(1073.77+i*707.56)))))))+", "+Math.max(0,Math.min(255,Math.round(27.2+i*(3211.1-i*(15327.97-i*(27814-i*(22569.18-i*6838.66)))))))+")"}var ETe=["alphaMap","alphaTest","anisotropy","anisotropyMap","anisotropyRotation","aoMap","aoMapIntensity","attenuationColor","attenuationDistance","bumpMap","clearcoat","clearcoatMap","clearcoatNormalMap","clearcoatNormalScale","clearcoatRoughness","color","dispersion","displacementMap","emissive","emissiveIntensity","emissiveMap","envMap","envMapIntensity","envMapRotation","gradientMap","ior","iridescence","iridescenceIOR","iridescenceMap","iridescenceThicknessMap","lightMap","lightMapIntensity","map","matcap","metalness","metalnessMap","normalMap","normalScale","opacity","roughness","roughnessMap","sheen","sheenColor","sheenColorMap","sheenRoughnessMap","shininess","specular","specularColor","specularColorMap","specularIntensity","specularIntensityMap","specularMap","thickness","transmission","transmissionMap"],Nee=new WeakMap,Fee=new WeakMap,Bee=new WeakMap,bU=class{constructor(e){this.renderObjects=new WeakMap,this.hasNode=this.containsNode(e),this.hasAnimation=e.object.isSkinnedMesh===!0,this.refreshUniforms=ETe,this.renderId=0}firstInitialization(e){return this.renderObjects.has(e)===!1?(this.getRenderObjectData(e),!0):!1}needsVelocity(e){let t=e.getMRT();return t!==null&&t.has("velocity")}getRenderObjectData(e){let t=this.renderObjects.get(e);if(t===void 0){let{geometry:n,object:r}=e;if(t={geometryId:n.id,worldMatrix:r.matrixWorld.clone()},r.center&&(t.center=r.center.clone()),r.morphTargetInfluences&&(t.morphTargetInfluences=r.morphTargetInfluences.slice()),e.bundle!==null&&(t.version=e.bundle.version),e.material.transmission>0){let{width:a,height:l}=e.context;t.bufferWidth=a,t.bufferHeight=l}let{environmentIntensity:s,environmentRotation:o}=e.scene;t.environmentIntensity=s,t.environmentRotation=o.clone(),t.lights=this.getLightsData(e.lightsNode.getLights(),[]),this.renderObjects.set(e,t)}return t}getAttributesData(e){let t={};for(let n in e){let r=e[n];t[n]={id:r.isInterleavedBufferAttribute?r.data.uuid:r.id,version:r.isInterleavedBufferAttribute?r.data.version:r.version}}return t}containsNode(e){let t=e.material;for(let n in t)if(t[n]&&t[n].isNode)return!0;return!!(e.context.modelViewMatrix||e.context.modelNormalViewMatrix||e.context.getAO||e.context.getShadow)}getGeometryData(e){let t=Bee.get(e);return t===void 0&&(t={_renderId:-1,_equal:!1,attributes:this.getAttributesData(e.attributes),indexId:e.index?e.index.id:null,indexVersion:e.index?e.index.version:null,drawRange:{start:e.drawRange.start,count:e.drawRange.count}},Bee.set(e,t)),t}getMaterialData(e){let t=Fee.get(e);if(t===void 0){t={_renderId:-1,_equal:!1};for(let n of this.refreshUniforms){let r=e[n];r!=null&&(typeof r=="object"&&r.clone!==void 0?r.isTexture===!0?t[n]={id:r.id,version:0}:t[n]=r.clone():t[n]=r)}Fee.set(e,t)}return t}equals(e,t,n){let{object:r,material:s,geometry:o}=e,a=this.getRenderObjectData(e);if(a.worldMatrix.equals(r.matrixWorld)!==!0)return a.worldMatrix.copy(r.matrixWorld),!1;let l=this.getMaterialData(e.material);if(l._renderId!==n){l._renderId=n;for(let f in l){let d=l[f],A=s[f];if(f!=="_renderId"&&f!=="_equal"){if(d.equals!==void 0){if(d.equals(A)===!1)return d.copy(A),l._equal=!1,!1}else if(A.isTexture===!0){if(d.id!==A.id||d.version!==A.version)return d.id=A.id,d.version=A.version,l._equal=!1,!1}else if(d!==A)return l[f]=A,l._equal=!1,!1}}if(l.transmission>0){let{width:f,height:d}=e.context;if(a.bufferWidth!==f||a.bufferHeight!==d)return a.bufferWidth=f,a.bufferHeight=d,l._equal=!1,!1}l._equal=!0}else if(l._equal===!1)return!1;if(a.geometryId!==o.id)return a.geometryId=o.id,!1;let c=this.getGeometryData(e.geometry);if(c._renderId!==n){c._renderId=n;let f=o.attributes,d=c.attributes,A=0,y=0;for(let P in f)A++;for(let P in d){y++;let F=d[P],D=f[P];if(D===void 0)return delete d[P],c._equal=!1,!1;let L=D.isInterleavedBufferAttribute?D.data.uuid:D.id,C=D.isInterleavedBufferAttribute?D.data.version:D.version;if(F.id!==L||F.version!==C)return F.id=L,F.version=C,c._equal=!1,!1}if(y!==A)return c.attributes=this.getAttributesData(f),c._equal=!1,!1;let w=o.index,S=c.indexId,T=c.indexVersion,R=w?w.id:null,I=w?w.version:null;if(S!==R||T!==I)return c.indexId=R,c.indexVersion=I,c._equal=!1,!1;if(c.drawRange.start!==o.drawRange.start||c.drawRange.count!==o.drawRange.count)return c.drawRange.start=o.drawRange.start,c.drawRange.count=o.drawRange.count,c._equal=!1,!1;c._equal=!0}else if(c._equal===!1)return!1;if(a.morphTargetInfluences){let f=!1;for(let d=0;d<a.morphTargetInfluences.length;d++)a.morphTargetInfluences[d]!==r.morphTargetInfluences[d]&&(a.morphTargetInfluences[d]=r.morphTargetInfluences[d],f=!0);if(f)return!1}if(a.lights){for(let f=0;f<t.length;f++)if(a.lights[f].map!==t[f].map)return!1}let u=e.scene;return u.environment!==null&&s.envMap===null&&(a.environmentIntensity!==u.environmentIntensity||a.environmentRotation.equals(u.environmentRotation)===!1)?(a.environmentIntensity=u.environmentIntensity,a.environmentRotation.copy(u.environmentRotation),!1):a.center&&a.center.equals(r.center)===!1?(a.center.copy(r.center),!1):(e.bundle!==null&&(a.version=e.bundle.version),!0)}getLightsData(e,t){t.length=0;for(let n of e)n.isSpotLight===!0&&n.map!==null&&t.push({map:n.map.version});return t}getLights(e,t){let n=Nee.get(e);return n===void 0&&(n={renderId:-1,lightsData:[]},Nee.set(e,n)),n.renderId===t||(n.renderId=t,this.getLightsData(e.getLights(),n.lightsData)),n.lightsData}needsRefresh(e,t){if(this.hasNode||this.hasAnimation||this.firstInitialization(e)||this.needsVelocity(t.renderer))return!0;let{renderId:n}=t;if(this.renderId!==n)return this.renderId=n,!0;let r=e.object.static===!0,s=e.bundle!==null&&e.bundle.static===!0&&this.getRenderObjectData(e).version===e.bundle.version;if(r||s)return!1;let o=this.getLights(e.lightsNode,n);return this.equals(e,o,n)!==!0}},MTe=[/^StackTrace\.js$/,/^TSLCore\.js$/,/^.*Node\.js$/,/^three\.webgpu.*\.js$/];function CTe(i){let e=/(?:at\s+(.+?)\s+\()?(?:(.+?)@)?([^@\s()]+):(\d+):(\d+)/;return i.split(`4131+`).map(t=>{let n=t.match(e);if(!n)return null;let r=n[1]||n[2]||"",s=n[3].split("?")[0],o=parseInt(n[4],10),a=parseInt(n[5],10),l=s.split("/").pop();return{fn:r,file:l,line:o,column:a}}).filter(t=>t&&!MTe.some(n=>n.test(t.file)))}var ts=class{constructor(e=null){this.isStackTrace=!0,this.stack=CTe(e||new Error().stack)}getLocation(){if(this.stack.length===0)return"[Unknown location]";let e=this.stack[0],t=e.fn;return`${t?`"${t}()" at `:""}"${e.file}:${e.line}"`}getError(e){if(this.stack.length===0)return e;let t=this.stack.map(n=>{let r=`${n.file}:${n.line}:${n.column}`;return n.fn?` at ${n.fn} (${r})`:` at ${r}`}).join(`41324132 `);return`${e}4133-${t}`}};function V9(i,e=0){let t=3735928559^e,n=1103547991^e;if(Array.isArray(i))for(let r=0,s;r<i.length;r++)s=i[r],t=Math.imul(t^s,2654435761),n=Math.imul(n^s,1597334677);else for(let r=0,s;r<i.length;r++)s=i.charCodeAt(r),t=Math.imul(t^s,2654435761),n=Math.imul(n^s,1597334677);return t=Math.imul(t^t>>>16,2246822507),t^=Math.imul(n^n>>>13,3266489909),n=Math.imul(n^n>>>16,2246822507),n^=Math.imul(t^t>>>13,3266489909),4294967296*(2097151&n)+(t>>>0)}var mx=i=>V9(i),ES=i=>V9(i),Zw=(...i)=>V9(i),$Se=new Map([[1,"float"],[2,"vec2"],[3,"vec3"],[4,"vec4"],[9,"mat3"],[16,"mat4"]]),fee=new WeakMap;function Nte(i){return $Se.get(i)}function XR(i){if(/[iu]?vec\d/.test(i))return i.startsWith("ivec")?Int32Array:i.startsWith("uvec")?Uint32Array:Float32Array;if(/mat\d/.test(i)||/float/.test(i))return Float32Array;if(/uint/.test(i))return Uint32Array;if(/int/.test(i))return Int32Array;throw new Error(`THREE.NodeUtils: Unsupported type: ${i}`)}function Fte(i){if(/float|int|uint|bool/.test(i))return 1;if(/vec2/.test(i))return 2;if(/vec3/.test(i))return 3;if(/vec4/.test(i)||/mat2/.test(i))return 4;if(/mat3/.test(i))return 9;if(/mat4/.test(i))return 16;ze(`TSL: Unsupported type: ${i}`,new es)}function YSe(i){if(/float|int|uint|bool/.test(i))return 1;if(/vec2/.test(i))return 2;if(/vec3/.test(i))return 3;if(/vec4/.test(i)||/mat2/.test(i))return 4;if(/mat3/.test(i))return 12;if(/mat4/.test(i))return 16;ze(`TSL: Unsupported type: ${i}`,new es)}function ZSe(i){if(/float|int|uint|bool/.test(i))return 1;if(/vec2/.test(i))return 2;if(/vec3/.test(i)||/vec4/.test(i))return 4;if(/mat2/.test(i))return 2;if(/mat3/.test(i)||/mat4/.test(i))return 4;ze(`TSL: Unsupported type: ${i}`,new es)}function lm(i){if(i==null)return null;let e=typeof i;return i.isNode===!0?"node":e==="number"?"float":e==="boolean"?"bool":e==="string"?"string":e==="function"?"shader":i.isVector2===!0?"vec2":i.isVector3===!0?"vec3":i.isVector4===!0?"vec4":i.isMatrix2===!0?"mat2":i.isMatrix3===!0?"mat3":i.isMatrix4===!0?"mat4":i.isColor===!0?"color":i instanceof ArrayBuffer?"ArrayBuffer":null}function G9(i,...e){let t=i?i.slice(-4):void 0;return e.length===1&&(t==="vec2"?e=[e[0],e[0]]:t==="vec3"?e=[e[0],e[0],e[0]]:t==="vec4"&&(e=[e[0],e[0],e[0],e[0]])),i==="color"?new zt(...e):t==="vec2"?new Oe(...e):t==="vec3"?new re(...e):t==="vec4"?new xn(...e):t==="mat2"?new i_(...e):t==="mat3"?new Mn(...e):t==="mat4"?new cn(...e):i==="bool"?e[0]||!1:i==="float"||i==="int"||i==="uint"?e[0]||0:i==="string"?e[0]||"":i==="ArrayBuffer"?QSe(e[0]):null}function Bte(i){let e=fee.get(i);return e===void 0&&(e={},fee.set(i,e)),e}function KSe(i){let e="",t=new Uint8Array(i);for(let n=0;n<t.length;n++)e+=String.fromCharCode(t[n]);return btoa(e)}function QSe(i){return Uint8Array.from(atob(i),e=>e.charCodeAt(0)).buffer}var $_={VERTEX:"vertex",FRAGMENT:"fragment"},yn={NONE:"none",FRAME:"frame",RENDER:"render",OBJECT:"object"},JSe={BOOLEAN:"bool",INTEGER:"int",FLOAT:"float",VECTOR2:"vec2",VECTOR3:"vec3",VECTOR4:"vec4",MATRIX2:"mat2",MATRIX3:"mat3",MATRIX4:"mat4"},$o={READ_ONLY:"readOnly",WRITE_ONLY:"writeOnly",READ_WRITE:"readWrite"},Ote=["fragment","vertex"],VR=["setup","analyze","generate"],GR=[...Ote,"compute"],n1=["x","y","z","w"],eTe={analyze:"setup",generate:"analyze"},tTe=0,Kt=class i extends la{static get type(){return"Node"}constructor(e=null){super(),this.nodeType=e,this.updateType=yn.NONE,this.updateBeforeType=yn.NONE,this.updateAfterType=yn.NONE,this.version=0,this.name="",this.global=!1,this.parents=!1,this.isNode=!0,this._beforeNodes=null,this._cacheKey=null,this._uuid=null,this._cacheKeyVersion=0,this.id=tTe++,this.stackTrace=null,i.captureStackTrace===!0&&(this.stackTrace=new es)}set needsUpdate(e){e===!0&&this.version++}get uuid(){return this._uuid===null&&(this._uuid=Bu.generateUUID()),this._uuid}get type(){return this.constructor.type}onUpdate(e,t){return this.updateType=t,this.update=e.bind(this),this}onFrameUpdate(e){return this.onUpdate(e,yn.FRAME)}onRenderUpdate(e){return this.onUpdate(e,yn.RENDER)}onObjectUpdate(e){return this.onUpdate(e,yn.OBJECT)}onReference(e){return this.updateReference=e.bind(this),this}updateReference(){return this}isGlobal(){return this.global}*getChildren(){for(let{childNode:e}of this._getChildren())yield e}dispose(){this.dispatchEvent({type:"dispose"})}traverse(e){e(this);for(let t of this.getChildren())t.traverse(e)}_getChildren(e=new Set){let t=[];e.add(this);for(let n of Object.getOwnPropertyNames(this)){let r=this[n];if(!(n.startsWith("_")===!0||e.has(r))){if(Array.isArray(r)===!0)for(let s=0;s<r.length;s++){let o=r[s];o&&o.isNode===!0&&t.push({property:n,index:s,childNode:o})}else if(r&&r.isNode===!0)t.push({property:n,childNode:r});else if(r&&Object.getPrototypeOf(r)===Object.prototype)for(let s in r){if(s.startsWith("_")===!0)continue;let o=r[s];o&&o.isNode===!0&&t.push({property:n,index:s,childNode:o})}}}return t}getCacheKey(e=!1,t=null){if(e=e||this.version!==this._cacheKeyVersion,e===!0||this._cacheKey===null){t===null&&(t=new Set);let n=[];for(let{property:r,childNode:s}of this._getChildren(t))n.push(mx(r.slice(0,-4)),s.getCacheKey(e,t));this._cacheKey=Zw(ES(n),this.customCacheKey()),this._cacheKeyVersion=this.version}return this._cacheKey}customCacheKey(){return this.id}getScope(){return this}getHash(){return String(this.id)}getUpdateType(){return this.updateType}getUpdateBeforeType(){return this.updateBeforeType}getUpdateAfterType(){return this.updateAfterType}getElementType(e){let t=this.getNodeType(e);return e.getElementType(t)}getMemberType(){return"void"}getNodeType(e,t=null){let n=e.getDataFromNode(this),r;return t!==null?(n.typeFromOutput=n.typeFromOutput||{},r=n.typeFromOutput[t],r===void 0&&(r=this.generateNodeType(e,t),n.typeFromOutput[t]=r)):(r=n.type,r===void 0&&(r=this.generateNodeType(e),n.type=r)),r}generateNodeType(e,t=null){let n=e.getNodeProperties(this);return n.outputNode?n.outputNode.getNodeType(e,t):this.nodeType}getShared(e){let t=this.getHash(e),n=e.getNodeFromHash(t),r=null;if(n&&n!==this)r=n;else if(e.context.overrideNodes){let s=e.context.overrideNodes.get(this);if(s){let o=e.getDataFromNode(this);o.isOverwritten!==!0?(o.isOverwritten=!0,r=s(e).overrideNode(this,null),o.sharedNode=r):r=o.sharedNode}}return r||this}getArrayCount(){return null}setup(e){let t=e.getNodeProperties(this),n=0;for(let r of this.getChildren())t["node"+n++]=r;return t.outputNode||null}analyze(e,t=null){let n=e.increaseUsage(this);if(this.parents===!0){let r=e.getDataFromNode(this,"any");r.stages=r.stages||{},r.stages[e.shaderStage]=r.stages[e.shaderStage]||[],r.stages[e.shaderStage].push(t)}if(n===1){let r=e.getNodeProperties(this);for(let s of Object.values(r))s&&s.isNode===!0&&s.build(e,this)}}generate(e,t){let{outputNode:n}=e.getNodeProperties(this);if(n&&n.isNode===!0)return n.build(e,t)}updateBefore(){Xe("Abstract function.")}updateAfter(){Xe("Abstract function.")}update(){Xe("Abstract function.")}before(e){return this._beforeNodes===null&&(this._beforeNodes=[]),this._beforeNodes.push(e),this}build(e,t=null){let n=this.getShared(e);if(this!==n)return n.build(e,t);if(this._beforeNodes!==null){let l=this._beforeNodes;this._beforeNodes=null;for(let c of l)c.build(e,t);this._beforeNodes=l}let r=e.getDataFromNode(this);r.buildStages=r.buildStages||{},r.buildStages[e.buildStage]=!0;let s=eTe[e.buildStage];if(s&&r.buildStages[s]!==!0){let l=e.getBuildStage();e.setBuildStage(s),this.build(e),e.setBuildStage(l)}e.addChain(this);let o=null,a=e.getBuildStage();if(a==="setup"){e.addNode(this),this.updateReference(e);let l=e.getNodeProperties(this);if(l.initialized!==!0){l.initialized=!0,l.outputNode=this.setup(e)||l.outputNode||null;for(let c of Object.values(l))if(c&&c.isNode===!0){if(c.parents===!0){let u=e.getNodeProperties(c);u.parents=u.parents||[],u.parents.push(this)}c.build(e)}e.addSequentialNode(this)}o=l.outputNode}else if(a==="analyze")this.analyze(e,t);else if(a==="generate"){if(this.generate.length<2){let c=this.getNodeType(e),u=e.getDataFromNode(this);o=u.snippet,o===void 0?u.generated===void 0?(u.generated=!0,o=this.generate(e)||"",u.snippet=o):(Xe("Node: Recursion detected.",this),o="/* Recursion detected. */"):u.flowCodes!==void 0&&e.context.nodeBlock!==void 0&&e.addFlowCodeHierarchy(this,e.context.nodeBlock),o=e.format(o,c,t)}else o=this.generate(e,t)||"";o===""&&t!==null&&t!=="void"&&t!=="OutputType"&&(ze(`TSL: Invalid generated code, expected a "${t}".`),o=e.generateConst(t))}return e.removeChain(this),o}getSerializeChildren(){return this._getChildren()}serialize(e){let t=this.getSerializeChildren(),n={};for(let{property:r,index:s,childNode:o}of t)s!==void 0?(n[r]===void 0&&(n[r]=Number.isInteger(s)?[]:{}),n[r][s]=o.toJSON(e.meta).uuid):n[r]=o.toJSON(e.meta).uuid;Object.keys(n).length>0&&(e.inputNodes=n)}deserialize(e){if(e.inputNodes!==void 0){let t=e.meta.nodes;for(let n in e.inputNodes)if(Array.isArray(e.inputNodes[n])){let r=[];for(let s of e.inputNodes[n])r.push(t[s]);this[n]=r}else if(typeof e.inputNodes[n]=="object"){let r={};for(let s in e.inputNodes[n]){let o=e.inputNodes[n][s];r[s]=t[o]}this[n]=r}else{let r=e.inputNodes[n];this[n]=t[r]}}}toJSON(e){let{uuid:t,type:n}=this,r=e===void 0||typeof e=="string";r&&(e={textures:{},images:{},nodes:{}});let s=e.nodes[t];s===void 0&&(s={uuid:t,type:n,meta:e,metadata:{version:4.7,type:"Node",generator:"Node.toJSON"}},r!==!0&&(e.nodes[s.uuid]=s),this.serialize(s),delete s.meta);function o(a){let l=[];for(let c in a){let u=a[c];delete u.metadata,l.push(u)}return l}if(r){let a=o(e.textures),l=o(e.images),c=o(e.nodes);a.length>0&&(s.textures=a),l.length>0&&(s.images=l),c.length>0&&(s.nodes=c)}return s}};Kt.captureStackTrace=!1;var Xd=class extends Kt{static get type(){return"ArrayElementNode"}constructor(e,t){super(),this.node=e,this.indexNode=t,this.isArrayElementNode=!0}generateNodeType(e){return this.node.getElementType(e)}getMemberType(e,t){return this.node.getMemberType(e,t)}generate(e){let t=this.indexNode.getNodeType(e),n=this.node.build(e),r=this.indexNode.build(e,!e.isVector(t)&&e.isInteger(t)?t:"uint");return`${n}[ ${r} ]`}},$R=class extends Kt{static get type(){return"ConvertNode"}constructor(e,t){super(),this.node=e,this.convertTo=t}generateNodeType(e){let t=this.node.getNodeType(e),n=null;for(let r of this.convertTo.split("|"))(n===null||e.getTypeLength(t)===e.getTypeLength(r))&&(n=r);return n}serialize(e){super.serialize(e),e.convertTo=this.convertTo}deserialize(e){super.deserialize(e),this.convertTo=e.convertTo}generate(e,t){let n=this.node,r=this.getNodeType(e),s=n.build(e,r);return e.format(s,r,t)}},Cr=class extends Kt{static get type(){return"TempNode"}constructor(e=null){super(e),this.isTempNode=!0}hasDependencies(e){return e.getDataFromNode(this).usageCount>1}build(e,t){if(e.getBuildStage()==="generate"){let r=e.getVectorType(this.getNodeType(e,t)),s=e.getDataFromNode(this);if(s.propertyName!==void 0)return e.format(s.propertyName,r,t);if(r!=="void"&&t!=="void"&&this.hasDependencies(e)){let o=super.build(e,r),a=e.getVarFromNode(this,null,r),l=e.getPropertyName(a);return e.addLineFlowCode(`${l} = ${o}`,this),s.snippet=o,s.propertyName=l,e.format(s.propertyName,r,t)}}return super.build(e,t)}},nU=class extends Cr{static get type(){return"JoinNode"}constructor(e=[],t=null){super(t),this.nodes=e}generateNodeType(e){return this.nodeType!==null?e.getVectorType(this.nodeType):e.getTypeFromLength(this.nodes.reduce((t,n)=>t+e.getTypeLength(n.getNodeType(e)),0))}generate(e,t){let n=this.getNodeType(e),r=e.getTypeLength(n),s=this.nodes,o=e.getComponentType(n),a=[],l=0;for(let u of s){if(l>=r){ze(`TSL: Length of parameters exceeds maximum length of function '${n}()' type.`,this.stackTrace);break}let f=u.getNodeType(e),d=e.getTypeLength(f),A;if(l+d>r&&(ze(`TSL: Length of '${n}()' data exceeds maximum length of output type.`,this.stackTrace),d=r-l,f=e.getTypeFromLength(d)),l+=d,A=u.build(e,f),e.getComponentType(f)!==o){let w=e.getTypeFromLength(d,o);A=e.format(A,f,w)}a.push(A)}let c=`${e.getType(n)}( ${a.join(", ")} )`;return e.format(c,n,t)}},nTe=n1.join(""),YR=class extends Kt{static get type(){return"SplitNode"}constructor(e,t="x"){super(),this.node=e,this.components=t,this.isSplitNode=!0}getVectorLength(){let e=this.components.length;for(let t of this.components)e=Math.max(n1.indexOf(t)+1,e);return e}getComponentType(e){return e.getComponentType(this.node.getNodeType(e))}generateNodeType(e){return e.getTypeFromLength(this.components.length,this.getComponentType(e))}getScope(){return this.node.getScope()}generate(e,t){let n=this.node,r=e.getTypeLength(n.getNodeType(e)),s=null;if(r>1){let o=null;this.getVectorLength()>=r&&(o=e.getTypeFromLength(this.getVectorLength(),this.getComponentType(e)));let l=n.build(e,o);this.components.length===r&&this.components===nTe.slice(0,this.components.length)?s=e.format(l,o,t):s=e.format(`${l}.${this.components}`,this.getNodeType(e),t)}else s=n.build(e,t);return s}serialize(e){super.serialize(e),e.components=this.components}deserialize(e){super.deserialize(e),this.components=e.components}},iU=class extends Cr{static get type(){return"SetNode"}constructor(e,t,n){super(),this.sourceNode=e,this.components=t,this.targetNode=n}generateNodeType(e){return this.sourceNode.getNodeType(e)}generate(e){let{sourceNode:t,components:n,targetNode:r}=this,s=this.getNodeType(e),o=e.getComponentType(r.getNodeType(e)),a=e.getTypeFromLength(n.length,o),l=r.build(e,a),c=t.build(e,s),u=e.getTypeLength(s),f=[];for(let d=0;d<u;d++){let A=n1[d];A===n[0]?(f.push(l),d+=n.length-1):f.push(c+"."+A)}return`${e.getType(s)}( ${f.join(", ")} )`}},rU=class extends Cr{static get type(){return"FlipNode"}constructor(e,t){super(),this.sourceNode=e,this.components=t}generateNodeType(e){return this.sourceNode.getNodeType(e)}generate(e){let{components:t,sourceNode:n}=this,r=this.getNodeType(e),s=n.build(e),o=e.getVarFromNode(this),a=e.getPropertyName(o);e.addLineFlowCode(a+" = "+s,this);let l=e.getTypeLength(r),c=[],u=0;for(let f=0;f<l;f++){let d=n1[f];d===t[u]?(c.push("1.0 - "+(a+"."+d)),u++):c.push(a+"."+d)}return`${e.getType(r)}( ${c.join(", ")} )`}},sS=class extends Kt{static get type(){return"InputNode"}constructor(e,t=null){super(t),this.isInputNode=!0,this.value=e,this.precision=null}generateNodeType(){return this.nodeType===null?lm(this.value):this.nodeType}getInputType(e){return this.getNodeType(e)}setPrecision(e){return this.precision=e,this}serialize(e){super.serialize(e),e.value=this.value,this.value&&this.value.toArray&&(e.value=this.value.toArray()),e.valueType=lm(this.value),e.nodeType=this.nodeType,e.valueType==="ArrayBuffer"&&(e.value=KSe(e.value)),e.precision=this.precision}deserialize(e){super.deserialize(e),this.nodeType=e.nodeType,this.value=Array.isArray(e.value)?G9(e.valueType,...e.value):e.value,this.precision=e.precision||null,this.value&&this.value.fromArray&&(this.value=this.value.fromArray(e.value))}generate(){Xe("Abstract function.")}},dee=/float|u?int/,iu=class extends sS{static get type(){return"ConstNode"}constructor(e,t=null){super(e,t),this.isConstNode=!0}generateConst(e){return e.generateConst(this.getNodeType(e),this.value)}generate(e,t){let n=this.getNodeType(e);return dee.test(n)&&dee.test(t)?e.generateConst(t,this.value):e.format(this.generateConst(e),n,t)}},sU=class extends Kt{static get type(){return"MemberNode"}constructor(e,t){super(),this.structNode=e,this.property=t,this.isMemberNode=!0}hasMember(e){return this.structNode.isMemberNode&&this.structNode.hasMember(e)===!1?!1:this.structNode.getMemberType(e,this.property)!=="void"}generateNodeType(e){return this.hasMember(e)===!1?"float":this.structNode.getMemberType(e,this.property)}getMemberType(e,t){if(this.hasMember(e)===!1)return"float";let n=this.getNodeType(e);return e.getStructTypeNode(n).getMemberType(e,t)}generate(e){if(this.hasMember(e)===!1){Xe(`TSL: Member "${this.property}" does not exist in struct.`,this.stackTrace);let n=this.getNodeType(e);return e.generateConst(n)}return this.structNode.build(e)+"."+this.property}},fm=null,oU=new Map;function Ue(i,e){if(oU.has(i)){Xe(`TSL: Redefinition of method chaining '${i}'.`);return}if(typeof e!="function")throw new Error(`THREE.TSL: Node element ${i} is not a function`);oU.set(i,e),i!=="assign"&&(Kt.prototype[i]=function(...t){return this.isStackNode?this.addToStack(e(...t)):e(this,...t)},Kt.prototype[i+"Assign"]=function(...t){return this.isStackNode?this.assign(t[0],e(...t)):this.assign(e(this,...t))})}var iTe=i=>i.replace(/r|s/g,"x").replace(/g|t/g,"y").replace(/b|p/g,"z").replace(/a|q/g,"w"),pee=i=>iTe(i).split("").sort().join("");Kt.prototype.assign=function(...i){if(this.isStackNode!==!0)return fm!==null?fm.assign(this,...i):ze("TSL: No stack defined for assign operation. Make sure the assign is inside a Fn().",new es),this;{let e=oU.get("assign");return this.addToStack(e(...i))}};Kt.prototype.toVarIntent=function(){return this};Kt.prototype.get=function(i){return new sU(this,i)};var Kw={};function rR(i,e,t){Kw[i]=Kw[e]=Kw[t]={get(){this._cache=this._cache||{};let o=this._cache[i];return o===void 0&&(o=new YR(this,i),this._cache[i]=o),o},set(o){this[i].assign(Ht(o))}};let n=i.toUpperCase(),r=e.toUpperCase(),s=t.toUpperCase();Kt.prototype["set"+n]=Kt.prototype["set"+r]=Kt.prototype["set"+s]=function(o){let a=pee(i);return new iU(this,a,Ht(o))},Kt.prototype["flip"+n]=Kt.prototype["flip"+r]=Kt.prototype["flip"+s]=function(){let o=pee(i);return new rU(this,o)}}var sf=["x","y","z","w"],of=["r","g","b","a"],af=["s","t","p","q"];for(let i=0;i<4;i++){let e=sf[i],t=of[i],n=af[i];rR(e,t,n);for(let r=0;r<4;r++){e=sf[i]+sf[r],t=of[i]+of[r],n=af[i]+af[r],rR(e,t,n);for(let s=0;s<4;s++){e=sf[i]+sf[r]+sf[s],t=of[i]+of[r]+of[s],n=af[i]+af[r]+af[s],rR(e,t,n);for(let o=0;o<4;o++)e=sf[i]+sf[r]+sf[s]+sf[o],t=of[i]+of[r]+of[s]+of[o],n=af[i]+af[r]+af[s]+af[o],rR(e,t,n)}}}for(let i=0;i<32;i++)Kw[i]={get(){this._cache=this._cache||{};let e=this._cache[i];return e===void 0&&(e=new Xd(this,new iu(i,"uint")),this._cache[i]=e),e},set(e){this[i].assign(Ht(e))}};Object.defineProperties(Kt.prototype,Kw);var rTe=function(i,e=null){let t=lm(i);return t==="node"?i:e===null&&(t==="float"||t==="boolean")||t&&t!=="shader"&&t!=="string"?Ht(cU(i,e)):t==="shader"?i.isFn?i:me(i):i},sTe=function(i,e=null){for(let t in i)i[t]=Ht(i[t],e);return i},oTe=function(i,e=null){let t=i.length;for(let n=0;n<t;n++)i[n]=Ht(i[n],e);return i},Ute=function(i,e=null,t=null,n=null){function r(u){return n!==null?(u=Ht(Object.assign(u,n)),n.intent===!0&&(u=u.toVarIntent())):u=Ht(u),u}let s,o=e,a,l;function c(u){let f;return o?f=/[a-z]/i.test(o)?o+"()":o:f=i.type,a!==void 0&&u.length<a?(ze(`TSL: "${f}" parameter length is less than minimum required.`,new es),u.concat(new Array(a-u.length).fill(0))):l!==void 0&&u.length>l?(ze(`TSL: "${f}" parameter length exceeds limit.`,new es),u.slice(0,l)):u}return e===null?s=(...u)=>r(new i(...zg(c(u)))):t!==null?(t=Ht(t),s=(...u)=>r(new i(e,...zg(c(u)),t))):s=(...u)=>r(new i(e,...zg(c(u)))),s.setParameterLength=(...u)=>(u.length===1?a=l=u[0]:u.length===2&&([a,l]=u),s),s.setName=u=>(o=u,s),s},aTe=function(i,...e){return new i(...zg(e))},aU=class extends Kt{constructor(e,t){super(),this.shaderNode=e,this.rawInputs=t,this.isShaderCallNodeInternal=!0}generateNodeType(e){return this.shaderNode.nodeType||this.getOutputNode(e).getNodeType(e)}getElementType(e){return this.getOutputNode(e).getElementType(e)}getMemberType(e,t){return this.getOutputNode(e).getMemberType(e,t)}call(e){let{shaderNode:t,rawInputs:n}=this,r=e.getNodeProperties(t),s=e.getClosestSubBuild(t.subBuilds)||"",o=s||"default";if(r[o])return r[o];let a=e.subBuildFn,l=e.fnCall;e.subBuildFn=s,e.fnCall=this;let c=null;if(t.layout){if(n){let d=t.layout.inputs;if(kte(n)){let A=n;for(let y=0;y<d.length;y++){let w=A[y];w&&w.isNode&&w.build(e)}}else{let A=n[0];for(let y of d){let w=A[y.name];w&&w.isNode&&w.build(e)}}}let u=e.buildFunctionNode(t);e.addInclude(u);let f=n?lTe(n):null;c=u.call(f)}else{let u=new Proxy(e,{get:(w,S,T)=>{let R;return Symbol.iterator===S?R=function*(){yield void 0}:R=Reflect.get(w,S,T),R}}),f=n?cTe(n):null,d=Array.isArray(n)?n.length>0:n!==null,A=t.jsFunc,y=d||A.length>1?A(f,u):A(u);c=Ht(y)}return e.subBuildFn=a,e.fnCall=l,t.once&&(r[o]=c),c}setupOutput(e){return e.addStack(),e.stack.outputNode=this.call(e),e.removeStack()}getOutputNode(e){let t=e.getNodeProperties(this),n=e.getSubBuildOutput(this);return t[n]=t[n]||this.setupOutput(e),t[n].subBuild=e.getClosestSubBuild(this),t[n]}build(e,t=null){let n=null,r=e.getBuildStage(),s=e.getNodeProperties(this),o=e.getSubBuildOutput(this),a=this.getOutputNode(e),l=e.fnCall;if(e.fnCall=this,r==="setup"){let c=e.getSubBuildProperty("initialized",this);if(s[c]!==!0&&(s[c]=!0,s[o]=this.getOutputNode(e),s[o].build(e),this.shaderNode.subBuilds))for(let u of e.chaining){let f=e.getDataFromNode(u,"any");f.subBuilds=f.subBuilds||new Set;for(let d of this.shaderNode.subBuilds)f.subBuilds.add(d)}n=s[o]}else r==="analyze"?a.build(e,t):r==="generate"&&(n=a.build(e,t)||"");return e.fnCall=l,n}};function kte(i){return i[0]&&(i[0].isNode||Object.getPrototypeOf(i[0])!==Object.prototype)}function lTe(i){let e;return lI(i),kte(i)?e=[...i]:e=i[0],e}function cTe(i){let e=0;return lI(i),new Proxy(i,{get:(t,n,r)=>{let s;if(n==="length")return s=i.length,s;if(Symbol.iterator===n)s=function*(){for(let o of i)yield Ht(o)};else{if(i.length>0)if(Object.getPrototypeOf(i[0])===Object.prototype){let o=i[0];o[n]===void 0?s=o[e++]:s=Reflect.get(o,n,r)}else i[0]instanceof Kt&&(i[n]===void 0?s=i[e++]:s=Reflect.get(i,n,r));else s=Reflect.get(t,n,r);s=Ht(s)}return s}})}var lU=class extends Kt{constructor(e,t){super(t),this.jsFunc=e,this.layout=null,this.global=!0,this.once=!1}setLayout(e){return this.layout=e,this}getLayout(){return this.layout}call(e=null){return new aU(this,e)}setup(){return this.call()}},uTe=[!1,!0],hTe=[0,1,2,3],fTe=[-1,-2],zte=[.5,1.5,1/3,1e-6,1e6,Math.PI,Math.PI*2,1/Math.PI,2/Math.PI,1/(Math.PI*2),Math.PI/2],q9=new Map;for(let i of uTe)q9.set(i,new iu(i));var H9=new Map;for(let i of hTe)H9.set(i,new iu(i,"uint"));var W9=new Map([...H9].map(i=>new iu(i.value,"int")));for(let i of fTe)W9.set(i,new iu(i,"int"));var oI=new Map([...W9].map(i=>new iu(i.value)));for(let i of zte)oI.set(i,new iu(i));for(let i of zte)oI.set(-i,new iu(-i));var aI={bool:q9,uint:H9,ints:W9,float:oI},mee=new Map([...q9,...oI]),cU=(i,e)=>mee.has(i)?mee.get(i):i.isNode===!0?i:new iu(i,e),Zs=function(i,e=null){return(...t)=>{for(let r of t)if(r===void 0)return ze(`TSL: Invalid parameter for the type "${i}".`,new es),new iu(0,i);if((t.length===0||!["bool","float","int","uint"].includes(i)&&t.every(r=>{let s=typeof r;return s!=="object"&&s!=="function"}))&&(t=[G9(i,...t)]),t.length===1&&e!==null&&e.has(t[0]))return $w(e.get(t[0]));if(t.length===1){let r=cU(t[0],i);return r.nodeType===i?$w(r):$w(new $R(r,i))}let n=t.map(r=>cU(r));return $w(new nU(n,i))}};function sx(i){return i&&i.isNode&&i.traverse(e=>{e.isConstNode&&(i=e.value)}),!!i}var Vte=i=>i!=null?i.nodeType||i.convertTo||(typeof i=="string"?i:null):null;function K_(i,e){return new lU(i,e)}var Ht=(i,e=null)=>rTe(i,e),$w=(i,e=null)=>Ht(i,e).toVarIntent(),lI=(i,e=null)=>new sTe(i,e),zg=(i,e=null)=>new oTe(i,e),$n=(i,e=null,t=null,n=null)=>new Ute(i,e,t,n),xt=(i,...e)=>new aTe(i,...e),ct=(i,e=null,t=null,n={})=>new Ute(i,e,t,{...n,intent:!0}),j9=(i,e)=>new Proxy(i,{get(t,n,r){return Reflect.get(e,n,r)},set(t,n,r){return Reflect.set(e,n,r)}}),dTe=0,uU=class extends Kt{constructor(e,t=null){super();let n=null;t!==null&&(typeof t=="object"?n=t.return:(typeof t=="string"?n=t:ze("TSL: Invalid layout type.",new es),t=null)),this.shaderNode=new K_(e,n),t!==null&&this.setLayout(t),this.isFn=!0}setLayout(e){let t=this.shaderNode.nodeType;if(typeof e.inputs!="object"){let n={name:"fn"+dTe++,type:t,inputs:[]};for(let r in e)r!=="return"&&n.inputs.push({name:r,type:e[r]});e=n}return this.shaderNode.setLayout(e),this}generateNodeType(e){return this.shaderNode.getNodeType(e)||"float"}call(...e){let t=this.shaderNode.call(e);return this.shaderNode.nodeType==="void"&&t.toStack(),t.toVarIntent()}once(e=null){return this.shaderNode.once=!0,this.shaderNode.subBuilds=e,this}generate(e){let t=this.getNodeType(e);return ze('TSL: "Fn()" was declared but not invoked. Try calling it like "Fn()( ...params )".',this.stackTrace),e.generateConst(t)}};function me(i,e=null){let t=new uU(i,e);return new Proxy(()=>{},{apply(n,r,s){return t.call(...s)},get(n,r,s){return Reflect.get(t,r,s)},set(n,r,s,o){return Reflect.set(t,r,s,o)}})}var oS=i=>{fm=i},X9=()=>fm,$t=(...i)=>fm.If(...i),pTe=(...i)=>fm.Switch(...i);function cI(i){return fm&&fm.addToStack(i),i}Ue("toStack",cI);var Gte=new Zs("color"),oe=new Zs("float",aI.float),de=new Zs("int",aI.ints),rt=new Zs("uint",aI.uint),uc=new Zs("bool",aI.bool),dt=new Zs("vec2"),kr=new Zs("ivec2"),$9=new Zs("uvec2"),qte=new Zs("bvec2"),pe=new Zs("vec3"),Y9=new Zs("ivec3"),i1=new Zs("uvec3"),Z9=new Zs("bvec3"),Ft=new Zs("vec4"),K9=new Zs("ivec4"),Q9=new Zs("uvec4"),Hte=new Zs("bvec4"),uI=new Zs("mat2"),To=new Zs("mat3"),um=new Zs("mat4");Ue("toColor",Gte);Ue("toFloat",oe);Ue("toInt",de);Ue("toUint",rt);Ue("toBool",uc);Ue("toVec2",dt);Ue("toIVec2",kr);Ue("toUVec2",$9);Ue("toBVec2",qte);Ue("toVec3",pe);Ue("toIVec3",Y9);Ue("toUVec3",i1);Ue("toBVec3",Z9);Ue("toVec4",Ft);Ue("toIVec4",K9);Ue("toUVec4",Q9);Ue("toBVec4",Hte);Ue("toMat2",uI);Ue("toMat3",To);Ue("toMat4",um);var Wte=$n(Xd).setParameterLength(2),jte=(i,e)=>new $R(Ht(i),e),mTe=(i,e)=>new YR(Ht(i),e);Ue("element",Wte);Ue("convert",jte);var ATe=i=>(Xe("TSL: append() has been renamed to Stack().",new es),cI(i));Ue("append",i=>(Xe("TSL: .append() has been renamed to .toStack().",new es),cI(i)));var gi=class extends Kt{static get type(){return"PropertyNode"}constructor(e,t=null,n=!1,r=null){super(e),this.name=t,this.varying=n,this.placeholderNode=Ht(r),this.isPropertyNode=!0,this.global=!0}getNodeType(e){let t=super.getNodeType(e);return t==="output"?e.getOutputType():t}customCacheKey(){return mx(this.type+":"+(this.name||"")+":"+(this.varying?"1":"0"))}getHash(e){return this.name||super.getHash(e)}generate(e){let t;if(this.varying===!0)t=e.getVaryingFromNode(this,this.name),t.needsInterpolation=!0;else if(t=e.getVarFromNode(this,this.name),this.placeholderNode!==null&&e.hasWriteUsage(this)===!1){let n=this.placeholderNode.build(e,this.getNodeType(e));e.addLineFlowCode(`${e.getPropertyName(t)} = ${n}`,this)}return e.getPropertyName(t)}},Zd=(i,e,t=null)=>new gi(i,e,!1,t),r1=(i,e,t=null)=>new gi(i,e,!0,t),Bi=xt(gi,"vec4","DiffuseColor"),Ng=xt(gi,"vec3","DiffuseContribution"),hU=xt(gi,"vec3","EmissiveColor"),pf=xt(gi,"float","Roughness"),jd=xt(gi,"float","Metalness"),ZR=xt(gi,"float","Clearcoat"),J_=xt(gi,"float","ClearcoatRoughness"),oc=xt(gi,"vec3","Sheen"),im=xt(gi,"float","SheenRoughness"),hI=xt(gi,"float","Iridescence"),KR=xt(gi,"float","IridescenceIOR"),QR=xt(gi,"float","IridescenceThickness"),JR=xt(gi,"float","AlphaT"),nm=xt(gi,"float","Anisotropy"),Qw=xt(gi,"vec3","AnisotropyT"),Vg=xt(gi,"vec3","AnisotropyB"),dm=xt(gi,"color","SpecularColor"),Bg=xt(gi,"color","SpecularColorBlended"),Og=xt(gi,"float","SpecularF90"),e4=xt(gi,"float","Shininess"),ex=xt(gi,"output","Output"),Gg=xt(gi,"float","dashSize"),aS=xt(gi,"float","gapSize"),gTe=xt(gi,"float","pointWidth"),Jw=xt(gi,"float","IOR"),t4=xt(gi,"float","Transmission"),J9=xt(gi,"float","Thickness"),ez=xt(gi,"float","AttenuationDistance"),tz=xt(gi,"color","AttenuationColor"),nz=xt(gi,"float","Dispersion"),fU=xt(gi,"float","AmbientOcclusion",!1,1),n4=class extends Kt{static get type(){return"UniformGroupNode"}constructor(e,t=!1,n=1,r=null){super("string"),this.name=e,this.shared=t,this.order=n,this.updateType=r,this.isUniformGroup=!0}update(){this.needsUpdate=!0}serialize(e){super.serialize(e),e.name=this.name,e.version=this.version,e.shared=this.shared}deserialize(e){super.deserialize(e),this.name=e.name,this.version=e.version,this.shared=e.shared}},Xte=(i,e=1,t=null)=>new n4(i,!1,e,t),fI=(i,e=0,t=null)=>new n4(i,!0,e,t),vTe=fI("frame",0,yn.FRAME),Jt=fI("render",0,yn.RENDER),$te=Xte("object",1,yn.OBJECT),Xg=class extends sS{static get type(){return"UniformNode"}constructor(e,t=null){super(e,t),this.isUniformNode=!0,this.name="",this.groupNode=$te}setName(e){return this.name=e,this}label(e){return Xe('TSL: "label()" has been deprecated. Use "setName()" instead.',new es),this.setName(e)}setGroup(e){return this.groupNode=e,this}getGroup(){return this.groupNode}getUniformHash(e){return this.getHash(e)}onUpdate(e,t){return e=e.bind(this),super.onUpdate(n=>{let r=e(n,this);r!==void 0&&(this.value=r)},t)}getInputType(e){let t=super.getInputType(e);return t==="bool"&&(t="uint"),t}generate(e,t){let n=this.getNodeType(e),r=this.getUniformHash(e),s=e.getNodeFromHash(r);s===void 0&&(e.setHashNode(this,r),s=this);let o=s.getInputType(e),a=e.getUniformFromNode(s,o,e.shaderStage,this.name||e.context.nodeName),l=e.getPropertyName(a);e.context.nodeName!==void 0&&delete e.context.nodeName;let c=l;if(n==="bool"){let u=e.getDataFromNode(this),f=u.propertyName;if(f===void 0){let d=e.getVarFromNode(this,null,"bool");f=e.getPropertyName(d),u.propertyName=f,c=e.format(l,o,n),e.addLineFlowCode(`${f} = ${c}`,this)}c=f}return e.format(c,n,t)}},Xt=(i,e)=>{let t=Vte(e||i);if(t===i&&(i=G9(t)),i&&i.isNode===!0){let n=i.value;i.traverse(r=>{r.isConstNode===!0&&(n=r.value)}),i=n}return new Xg(i,t)},i4=class extends Cr{static get type(){return"ArrayNode"}constructor(e,t,n=null){super(e),this.count=t,this.values=n,this.isArrayNode=!0}getArrayCount(){return this.count}generateNodeType(e){return this.nodeType===null?this.values[0].getNodeType(e):this.nodeType}getElementType(e){return this.getNodeType(e)}getMemberType(e,t){return this.nodeType===null?this.values[0].getMemberType(e,t):super.getMemberType(e,t)}generate(e){let t=this.getNodeType(e);return e.generateArray(t,this.count,this.values)}},Yte=(...i)=>{let e;if(i.length===1){let t=i[0];e=new i4(null,t.length,t)}else{let t=i[0],n=i[1];e=new i4(t,n)}return Ht(e)};Ue("toArray",(i,e)=>Yte(Array(e).fill(i)));var dU=class extends Cr{static get type(){return"AssignNode"}constructor(e,t){super(),this.targetNode=e,this.sourceNode=t,this.isAssignNode=!0}hasDependencies(){return!1}generateNodeType(e,t){return t!=="void"?this.targetNode.getNodeType(e):"void"}needsSplitAssign(e){let{targetNode:t}=this;if(e.isAvailable("swizzleAssign")===!1&&t.isSplitNode&&t.components.length>1){let n=e.getTypeLength(t.node.getNodeType(e));return n1.join("").slice(0,n)!==t.components}return!1}setup(e){let{targetNode:t,sourceNode:n}=this,r=t.getScope(),s=e.getDataFromNode(r);s.assign=!0;let o=e.getNodeProperties(this);o.sourceNode=n,o.targetNode=t.context({assign:!0})}generate(e,t){let{targetNode:n,sourceNode:r}=e.getNodeProperties(this),s=this.needsSplitAssign(e),o=n.build(e),a=n.getNodeType(e),l=r.build(e,a),c=r.getNodeType(e),u=e.getDataFromNode(this),f;if(u.initialized===!0)t!=="void"&&(f=o);else if(s){let d=e.getVarFromNode(this,null,a),A=e.getPropertyName(d);e.addLineFlowCode(`${A} = ${l}`,this);let y=n.node,S=y.node.context({assign:!0}).build(e);for(let T=0;T<y.components.length;T++){let R=y.components[T];e.addLineFlowCode(`${S}.${R} = ${A}[ ${T} ]`,this)}t!=="void"&&(f=o)}else f=`${o} = ${l}`,(t==="void"||c==="void")&&(e.addLineFlowCode(f,this),t!=="void"&&(f=o));return u.initialized=!0,e.format(f,a,t)}},Zte=$n(dU).setParameterLength(2);Ue("assign",Zte);var pU=class extends Cr{static get type(){return"FunctionCallNode"}constructor(e=null,t={}){super(),this.functionNode=e,this.parameters=t}setParameters(e){return this.parameters=e,this}getParameters(){return this.parameters}generateNodeType(e){return this.functionNode.getNodeType(e)}getMemberType(e,t){return this.functionNode.getMemberType(e,t)}generate(e){let t=[],n=this.functionNode,r=n.getInputs(e),s=this.parameters,o=(l,c)=>{let u=c.type,f=u==="pointer",d;return f?d="&"+l.build(e):d=l.build(e,u),d};if(Array.isArray(s)){if(s.length>r.length)ze("TSL: The number of provided parameters exceeds the expected number of inputs in 'Fn()'."),s.length=r.length;else if(s.length<r.length)for(ze("TSL: The number of provided parameters is less than the expected number of inputs in 'Fn()'.");s.length<r.length;)s.push(oe(0));for(let l=0;l<s.length;l++)t.push(o(s[l],r[l]))}else for(let l of r){let c=s[l.name];c!==void 0?t.push(o(c,l)):(ze(`TSL: Input '${l.name}' not found in 'Fn()'.`),t.push(o(oe(0),l)))}return`${n.build(e,"property")}( ${t.join(", ")} )`}},Kte=(i,...e)=>(e=e.length>1||e[0]&&e[0].isNode===!0?zg(e):lI(e[0]),new pU(Ht(i),e));Ue("call",Kte);var _Te={"==":"equal","!=":"notEqual","<":"lessThan",">":"greaterThan","<=":"lessThanEqual",">=":"greaterThanEqual","%":"mod"},ts=class i extends Cr{static get type(){return"OperatorNode"}constructor(e,t,n,...r){if(super(),r.length>0){let s=new i(e,t,n);for(let o=0;o<r.length-1;o++)s=new i(e,s,r[o]);t=s,n=r[r.length-1]}this.op=e,this.aNode=t,this.bNode=n,this.isOperatorNode=!0}getOperatorMethod(e,t){return e.getMethod(_Te[this.op],t)}generateNodeType(e,t=null){let n=this.op,r=this.aNode,s=this.bNode,o=r.getNodeType(e),a=s?s.getNodeType(e):null;if(o==="void"||a==="void")return t||"void";if(n==="%")return o;if(n==="~"||n==="&"||n==="|"||n==="^"||n===">>"||n==="<<")return e.getIntegerType(o);if(n==="&&"||n==="||"||n==="^^")return"bool";if(n==="!"){let l=e.getTypeLength(o);return l>1?`bvec${l}`:"bool"}else if(n==="=="||n==="!="||n==="<"||n===">"||n==="<="||n===">="){let l=Math.max(e.getTypeLength(o),e.getTypeLength(a));return l>1?`bvec${l}`:"bool"}else{if(e.isMatrix(o)){if(a==="float")return o;if(e.isVector(a))return e.getVectorFromMatrix(o);if(e.isMatrix(a))return o}else if(e.isMatrix(a)){if(o==="float")return a;if(e.isVector(o))return e.getVectorFromMatrix(a)}return e.getTypeLength(a)>e.getTypeLength(o)?a:o}}generate(e,t){let n=this.op,{aNode:r,bNode:s}=this,o=this.getNodeType(e,t),a=null,l=null;o!=="void"?(a=r.getNodeType(e),l=s?s.getNodeType(e):null,n==="<"||n===">"||n==="<="||n===">="||n==="=="||n==="!="?e.isVector(a)?l=a:e.isVector(l)?a=l:a!==l&&(a=l="float"):n===">>"||n==="<<"?(a=o,l=e.changeComponentType(l,"uint")):n==="%"?(a=o,l=e.isInteger(a)&&e.isInteger(l)?l:a):e.isMatrix(a)?l==="float"?l="float":e.isVector(l)?l=e.getVectorFromMatrix(a):e.isMatrix(l)||(a=l=o):e.isMatrix(l)?a==="float"?a="float":e.isVector(a)?a=e.getVectorFromMatrix(l):a=l=o:a=l=o):a=l=o;let c=r.build(e,a),u=s?s.build(e,l):null,f=e.getFunctionOperator(n);if(t!=="void"){let d=e.renderer.coordinateSystem===Uo;if(n==="=="||n==="!="||n==="<"||n===">"||n==="<="||n===">=")return d?e.isVector(a)?e.format(`${this.getOperatorMethod(e,t)}( ${c}, ${u} )`,o,t):e.format(`( ${c} ${n} ${u} )`,o,t):e.format(`( ${c} ${n} ${u} )`,o,t);if(n==="%")return e.isInteger(l)?e.format(`( ${c} % ${u} )`,o,t):e.format(`${this.getOperatorMethod(e,o)}( ${c}, ${u} )`,o,t);if(n==="!")return d&&e.isVector(a)?e.format(`not( ${c} )`,t):e.format(`( ${n} ${c} )`,a,t);if(n==="~")return e.format(`( ${n} ${c} )`,a,t);if(f)return e.format(`${f}( ${c}, ${u} )`,o,t);if(e.isMatrix(a)&&l==="float")return e.format(`( ${u} ${n} ${c} )`,o,t);if(a==="float"&&e.isMatrix(l))return e.format(`${c} ${n} ${u}`,o,t);{let A=`( ${c} ${n} ${u} )`;return!d&&o==="bool"&&e.isVector(a)&&e.isVector(l)&&(A=`all${A}`),e.format(A,o,t)}}else if(a!=="void")return f?e.format(`${f}( ${c}, ${u} )`,o,t):e.isMatrix(a)&&l==="float"?e.format(`${u} ${n} ${c}`,o,t):e.format(`${c} ${n} ${u}`,o,t)}serialize(e){super.serialize(e),e.op=this.op}deserialize(e){super.deserialize(e),this.op=e.op}},Ls=ct(ts,"+").setParameterLength(2,1/0).setName("add"),ai=ct(ts,"-").setParameterLength(2,1/0).setName("sub"),Tn=ct(ts,"*").setParameterLength(2,1/0).setName("mul"),hc=ct(ts,"/").setParameterLength(2,1/0).setName("div"),dI=ct(ts,"%").setParameterLength(2).setName("mod"),Qte=ct(ts,"==").setParameterLength(2).setName("equal"),Jte=ct(ts,"!=").setParameterLength(2).setName("notEqual"),ene=ct(ts,"<").setParameterLength(2).setName("lessThan"),iz=ct(ts,">").setParameterLength(2).setName("greaterThan"),tne=ct(ts,"<=").setParameterLength(2).setName("lessThanEqual"),nne=ct(ts,">=").setParameterLength(2).setName("greaterThanEqual"),ine=ct(ts,"&&").setParameterLength(2,1/0).setName("and"),rne=ct(ts,"||").setParameterLength(2,1/0).setName("or"),sne=ct(ts,"!").setParameterLength(1).setName("not"),one=ct(ts,"^^").setParameterLength(2).setName("xor"),ane=ct(ts,"&").setParameterLength(2).setName("bitAnd"),lne=ct(ts,"~").setParameterLength(1).setName("bitNot"),cne=ct(ts,"|").setParameterLength(2).setName("bitOr"),une=ct(ts,"^").setParameterLength(2).setName("bitXor"),hne=ct(ts,"<<").setParameterLength(2).setName("shiftLeft"),fne=ct(ts,">>").setParameterLength(2).setName("shiftRight"),dne=me(([i])=>(i.addAssign(1),i)),pne=me(([i])=>(i.subAssign(1),i)),mne=me(([i])=>{let e=de(i).toConst();return i.addAssign(1),e}),Ane=me(([i])=>{let e=de(i).toConst();return i.subAssign(1),e});Ue("add",Ls);Ue("sub",ai);Ue("mul",Tn);Ue("div",hc);Ue("mod",dI);Ue("equal",Qte);Ue("notEqual",Jte);Ue("lessThan",ene);Ue("greaterThan",iz);Ue("lessThanEqual",tne);Ue("greaterThanEqual",nne);Ue("and",ine);Ue("or",rne);Ue("not",sne);Ue("xor",one);Ue("bitAnd",ane);Ue("bitNot",lne);Ue("bitOr",cne);Ue("bitXor",une);Ue("shiftLeft",hne);Ue("shiftRight",fne);Ue("incrementBefore",dne);Ue("decrementBefore",pne);Ue("increment",mne);Ue("decrement",Ane);var Ie=class i extends Cr{static get type(){return"MathNode"}constructor(e,t,n=null,r=null){if(super(),(e===i.MAX||e===i.MIN)&&arguments.length>3){let s=new i(e,t,n);for(let o=3;o<arguments.length-1;o++)s=new i(e,s,arguments[o]);t=s,n=arguments[arguments.length-1],r=null}this.method=e,this.aNode=t,this.bNode=n,this.cNode=r,this.isMathNode=!0}getInputType(e){let t=this.aNode.getNodeType(e),n=this.bNode?this.bNode.getNodeType(e):null,r=this.cNode?this.cNode.getNodeType(e):null,s=e.isMatrix(t)?0:e.getTypeLength(t),o=e.isMatrix(n)?0:e.getTypeLength(n),a=e.isMatrix(r)?0:e.getTypeLength(r);return s>o&&s>a?t:o>a?n:a>s?r:t}generateNodeType(e){let t=this.method;return t===i.LENGTH||t===i.DISTANCE||t===i.DOT?"float":t===i.CROSS?"vec3":t===i.ALL||t===i.ANY?"bool":t===i.EQUALS?e.changeComponentType(this.aNode.getNodeType(e),"bool"):this.getInputType(e)}setup(e){let{aNode:t,bNode:n,method:r}=this,s=null;if(r===i.ONE_MINUS)s=ai(1,t);else if(r===i.RECIPROCAL)s=hc(1,t);else if(r===i.DIFFERENCE)s=fr(ai(t,n));else if(r===i.TRANSFORM_DIRECTION){let o,a;e.isMatrix(t.getNodeType(e))?(o=t,a=n):(o=n,a=t),s=xa(Tn(o,Ft(pe(a),0)).xyz)}return s!==null?s:super.setup(e)}generate(e,t){if(e.getNodeProperties(this).outputNode)return super.generate(e,t);let r=this.method,s=this.getNodeType(e),o=this.getInputType(e),a=this.aNode,l=this.bNode,c=this.cNode,u=e.renderer.coordinateSystem;if(r===i.NEGATE)return e.format("( - "+a.build(e,o)+" )",s,t);{let f=[];return r===i.CROSS?f.push(a.build(e,s),l.build(e,s)):u===Uo&&r===i.STEP?f.push(a.build(e,e.getTypeLength(a.getNodeType(e))===1?"float":o),l.build(e,o)):u===Uo&&(r===i.MIN||r===i.MAX)?f.push(a.build(e,o),l.build(e,e.getTypeLength(l.getNodeType(e))===1?"float":o)):r===i.REFRACT?f.push(a.build(e,o),l.build(e,o),c.build(e,"float")):r===i.MIX?f.push(a.build(e,o),l.build(e,o),c.build(e,e.getTypeLength(c.getNodeType(e))===1?"float":o)):(u===_l&&r===i.ATAN&&l!==null&&(r="atan2"),e.shaderStage!=="fragment"&&(r===i.DFDX||r===i.DFDY)&&(Xe(`TSL: '${r}' is not supported in the ${e.shaderStage} stage.`,this.stackTrace),r="/*"+r+"*/"),f.push(a.build(e,o)),l!==null&&f.push(l.build(e,o)),c!==null&&f.push(c.build(e,o))),e.format(`${e.getMethod(r,s)}( ${f.join(", ")} )`,s,t)}}serialize(e){super.serialize(e),e.method=this.method}deserialize(e){super.deserialize(e),this.method=e.method}};Ie.ALL="all";Ie.ANY="any";Ie.RADIANS="radians";Ie.DEGREES="degrees";Ie.EXP="exp";Ie.EXP2="exp2";Ie.LOG="log";Ie.LOG2="log2";Ie.SQRT="sqrt";Ie.INVERSE_SQRT="inversesqrt";Ie.FLOOR="floor";Ie.CEIL="ceil";Ie.NORMALIZE="normalize";Ie.FRACT="fract";Ie.SIN="sin";Ie.SINH="sinh";Ie.COS="cos";Ie.COSH="cosh";Ie.TAN="tan";Ie.TANH="tanh";Ie.ASIN="asin";Ie.ASINH="asinh";Ie.ACOS="acos";Ie.ACOSH="acosh";Ie.ATAN="atan";Ie.ATANH="atanh";Ie.ABS="abs";Ie.SIGN="sign";Ie.LENGTH="length";Ie.NEGATE="negate";Ie.ONE_MINUS="oneMinus";Ie.DFDX="dFdx";Ie.DFDY="dFdy";Ie.ROUND="round";Ie.RECIPROCAL="reciprocal";Ie.TRUNC="trunc";Ie.FWIDTH="fwidth";Ie.TRANSPOSE="transpose";Ie.DETERMINANT="determinant";Ie.INVERSE="inverse";Ie.EQUALS="equals";Ie.MIN="min";Ie.MAX="max";Ie.STEP="step";Ie.REFLECT="reflect";Ie.DISTANCE="distance";Ie.DIFFERENCE="difference";Ie.DOT="dot";Ie.CROSS="cross";Ie.POW="pow";Ie.TRANSFORM_DIRECTION="transformDirection";Ie.MIX="mix";Ie.CLAMP="clamp";Ie.REFRACT="refract";Ie.SMOOTHSTEP="smoothstep";Ie.FACEFORWARD="faceforward";var pI=oe(1e-6),xTe=oe(1e6),r4=oe(Math.PI),yTe=oe(Math.PI*2),bTe=oe(Math.PI*2),wTe=oe(Math.PI*.5),gne=ct(Ie,Ie.ALL).setParameterLength(1),vne=ct(Ie,Ie.ANY).setParameterLength(1),_ne=ct(Ie,Ie.RADIANS).setParameterLength(1),xne=ct(Ie,Ie.DEGREES).setParameterLength(1),rz=ct(Ie,Ie.EXP).setParameterLength(1),ox=ct(Ie,Ie.EXP2).setParameterLength(1),mI=ct(Ie,Ie.LOG).setParameterLength(1),Af=ct(Ie,Ie.LOG2).setParameterLength(1),Ja=ct(Ie,Ie.SQRT).setParameterLength(1),sz=ct(Ie,Ie.INVERSE_SQRT).setParameterLength(1),gf=ct(Ie,Ie.FLOOR).setParameterLength(1),AI=ct(Ie,Ie.CEIL).setParameterLength(1),xa=ct(Ie,Ie.NORMALIZE).setParameterLength(1),$u=ct(Ie,Ie.FRACT).setParameterLength(1),Za=ct(Ie,Ie.SIN).setParameterLength(1),yne=ct(Ie,Ie.SINH).setParameterLength(1),Hu=ct(Ie,Ie.COS).setParameterLength(1),bne=ct(Ie,Ie.COSH).setParameterLength(1),wne=ct(Ie,Ie.TAN).setParameterLength(1),Sne=ct(Ie,Ie.TANH).setParameterLength(1),Tne=ct(Ie,Ie.ASIN).setParameterLength(1),Ene=ct(Ie,Ie.ASINH).setParameterLength(1),oz=ct(Ie,Ie.ACOS).setParameterLength(1),Mne=ct(Ie,Ie.ACOSH).setParameterLength(1),az=ct(Ie,Ie.ATAN).setParameterLength(1,2),Cne=ct(Ie,Ie.ATANH).setParameterLength(1),fr=ct(Ie,Ie.ABS).setParameterLength(1),lz=ct(Ie,Ie.SIGN).setParameterLength(1),vf=ct(Ie,Ie.LENGTH).setParameterLength(1),cz=ct(Ie,Ie.NEGATE).setParameterLength(1),Rne=ct(Ie,Ie.ONE_MINUS).setParameterLength(1),uz=ct(Ie,Ie.DFDX).setParameterLength(1),hz=ct(Ie,Ie.DFDY).setParameterLength(1),Ine=ct(Ie,Ie.ROUND).setParameterLength(1),Pne=ct(Ie,Ie.RECIPROCAL).setParameterLength(1),fz=ct(Ie,Ie.TRUNC).setParameterLength(1),dz=ct(Ie,Ie.FWIDTH).setParameterLength(1),Lne=ct(Ie,Ie.TRANSPOSE).setParameterLength(1),Dne=ct(Ie,Ie.DETERMINANT).setParameterLength(1),Nne=ct(Ie,Ie.INVERSE).setParameterLength(1),Rl=ct(Ie,Ie.MIN).setParameterLength(2,1/0),zr=ct(Ie,Ie.MAX).setParameterLength(2,1/0),$g=ct(Ie,Ie.STEP).setParameterLength(2),Fne=ct(Ie,Ie.REFLECT).setParameterLength(2),Bne=ct(Ie,Ie.DISTANCE).setParameterLength(2),One=ct(Ie,Ie.DIFFERENCE).setParameterLength(2),ru=ct(Ie,Ie.DOT).setParameterLength(2),$d=ct(Ie,Ie.CROSS).setParameterLength(2),eu=ct(Ie,Ie.POW).setParameterLength(2),pz=i=>Tn(i,i),Une=i=>Tn(i,i,i),mz=i=>Tn(i,i,i,i),kne=ct(Ie,Ie.TRANSFORM_DIRECTION).setParameterLength(2),zne=(i,e)=>xa(Tn(e,Ft(pe(i),0)).xyz),Vne=(i,e)=>xa(Ft(pe(i),0).mul(e).xyz),Gne=i=>Tn(lz(i),eu(fr(i),1/3)),Az=i=>ru(i,i),Qn=ct(Ie,Ie.MIX).setParameterLength(3),Yu=(i,e=0,t=1)=>new Ie(Ie.CLAMP,Ht(i),Ht(e),Ht(t)),gI=i=>Yu(i),gz=ct(Ie,Ie.REFRACT).setParameterLength(3),fc=ct(Ie,Ie.SMOOTHSTEP).setParameterLength(3),vz=ct(Ie,Ie.FACEFORWARD).setParameterLength(3),qne=me(([i])=>{let n=43758.5453,r=ru(i.xy,dt(12.9898,78.233)),s=dI(r,r4);return $u(Za(s).mul(n))}),Hne=(i,e,t)=>Qn(e,t,i),Wne=(i,e,t)=>fc(e,t,i),jne=(i,e)=>$g(e,i),STe=vz,TTe=sz;Ue("all",gne);Ue("any",vne);Ue("radians",_ne);Ue("degrees",xne);Ue("exp",rz);Ue("exp2",ox);Ue("log",mI);Ue("log2",Af);Ue("sqrt",Ja);Ue("inverseSqrt",sz);Ue("floor",gf);Ue("ceil",AI);Ue("normalize",xa);Ue("fract",$u);Ue("sin",Za);Ue("sinh",yne);Ue("cos",Hu);Ue("cosh",bne);Ue("tan",wne);Ue("tanh",Sne);Ue("asin",Tne);Ue("asinh",Ene);Ue("acos",oz);Ue("acosh",Mne);Ue("atan",az);Ue("atanh",Cne);Ue("abs",fr);Ue("sign",lz);Ue("length",vf);Ue("lengthSq",Az);Ue("negate",cz);Ue("oneMinus",Rne);Ue("dFdx",uz);Ue("dFdy",hz);Ue("round",Ine);Ue("reciprocal",Pne);Ue("trunc",fz);Ue("fwidth",dz);Ue("min",Rl);Ue("max",zr);Ue("step",jne);Ue("reflect",Fne);Ue("distance",Bne);Ue("dot",ru);Ue("cross",$d);Ue("pow",eu);Ue("pow2",pz);Ue("pow3",Une);Ue("pow4",mz);Ue("transformDirection",kne);Ue("transformNormalByViewMatrix",zne);Ue("transformNormalByInverseViewMatrix",Vne);Ue("mix",Hne);Ue("clamp",Yu);Ue("refract",gz);Ue("smoothstep",Wne);Ue("faceForward",vz);Ue("difference",One);Ue("saturate",gI);Ue("cbrt",Gne);Ue("transpose",Lne);Ue("determinant",Dne);Ue("inverse",Nne);Ue("rand",qne);var mU=class extends Kt{static get type(){return"ConditionalNode"}constructor(e,t,n=null){super(),this.condNode=e,this.ifNode=t,this.elseNode=n}generateNodeType(e){let{ifNode:t,elseNode:n}=e.getNodeProperties(this);if(t===void 0)return e.flowBuildStage(this,"setup"),this.getNodeType(e);let r=t.getNodeType(e);if(n!==null){let s=n.getNodeType(e);if(e.getTypeLength(s)>e.getTypeLength(r))return s}return r}setup(e){let t=this.condNode,n=this.ifNode.isolate(),r=this.elseNode?this.elseNode.isolate():null,s=e.context.nodeBlock;e.getDataFromNode(n).parentNodeBlock=s,r!==null&&(e.getDataFromNode(r).parentNodeBlock=s);let o=e.context.uniformFlow,a=e.getNodeProperties(this);a.condNode=t,a.ifNode=o?n:n.context({nodeBlock:n}),a.elseNode=r?o?r:r.context({nodeBlock:r}):null}generate(e,t){let n=this.getNodeType(e),r=e.getDataFromNode(this);if(r.nodeProperty!==void 0)return r.nodeProperty;let{condNode:s,ifNode:o,elseNode:a}=e.getNodeProperties(this),l=e.currentFunctionNode,c=t!=="void",u=c?Zd(n).build(e):"";r.nodeProperty=u;let f=s.build(e,"bool");if(e.context.uniformFlow&&a!==null){let y=o.build(e,n),w=a.build(e,n),S=e.getTernary(f,y,w);return e.format(S,n,t)}e.addFlowCode(`4133+${t}`}};function lz(i,e=0){let t=3735928559^e,n=1103547991^e;if(Array.isArray(i))for(let r=0,s;r<i.length;r++)s=i[r],t=Math.imul(t^s,2654435761),n=Math.imul(n^s,1597334677);else for(let r=0,s;r<i.length;r++)s=i.charCodeAt(r),t=Math.imul(t^s,2654435761),n=Math.imul(n^s,1597334677);return t=Math.imul(t^t>>>16,2246822507),t^=Math.imul(n^n>>>13,3266489909),n=Math.imul(n^n>>>16,2246822507),n^=Math.imul(t^t>>>13,3266489909),4294967296*(2097151&n)+(t>>>0)}var yx=i=>lz(i),LS=i=>lz(i),nS=(...i)=>lz(i),RTe=new Map([[1,"float"],[2,"vec2"],[3,"vec3"],[4,"vec4"],[9,"mat3"],[16,"mat4"]]),Oee=new WeakMap;function sne(i){return RTe.get(i)}function t4(i){if(/[iu]?vec\d/.test(i))return i.startsWith("ivec")?Int32Array:i.startsWith("uvec")?Uint32Array:Float32Array;if(/mat\d/.test(i)||/float/.test(i))return Float32Array;if(/uint/.test(i))return Uint32Array;if(/int/.test(i))return Int32Array;throw new Error(`THREE.NodeUtils: Unsupported type: ${i}`)}function one(i){if(/float|int|uint|bool/.test(i))return 1;if(/vec2/.test(i))return 2;if(/vec3/.test(i))return 3;if(/vec4/.test(i)||/mat2/.test(i))return 4;if(/mat3/.test(i))return 9;if(/mat4/.test(i))return 16;ze(`TSL: Unsupported type: ${i}`,new ts)}function PTe(i){if(/float|int|uint|bool/.test(i))return 1;if(/vec2/.test(i))return 2;if(/vec3/.test(i))return 3;if(/vec4/.test(i)||/mat2/.test(i))return 4;if(/mat3/.test(i))return 12;if(/mat4/.test(i))return 16;ze(`TSL: Unsupported type: ${i}`,new ts)}function ITe(i){if(/float|int|uint|bool/.test(i))return 1;if(/vec2/.test(i))return 2;if(/vec3/.test(i)||/vec4/.test(i))return 4;if(/mat2/.test(i))return 2;if(/mat3/.test(i)||/mat4/.test(i))return 4;ze(`TSL: Unsupported type: ${i}`,new ts)}function fm(i){if(i==null)return null;let e=typeof i;return i.isNode===!0?"node":e==="number"?"float":e==="boolean"?"bool":e==="string"?"string":e==="function"?"shader":i.isVector2===!0?"vec2":i.isVector3===!0?"vec3":i.isVector4===!0?"vec4":i.isMatrix2===!0?"mat2":i.isMatrix3===!0?"mat3":i.isMatrix4===!0?"mat4":i.isColor===!0?"color":i instanceof ArrayBuffer?"ArrayBuffer":null}function cz(i,...e){let t=i?i.slice(-4):void 0;return e.length===1&&(t==="vec2"?e=[e[0],e[0]]:t==="vec3"?e=[e[0],e[0],e[0]]:t==="vec4"&&(e=[e[0],e[0],e[0],e[0]])),i==="color"?new zt(...e):t==="vec2"?new Oe(...e):t==="vec3"?new re(...e):t==="vec4"?new xn(...e):t==="mat2"?new c_(...e):t==="mat3"?new Mn(...e):t==="mat4"?new cn(...e):i==="bool"?e[0]||!1:i==="float"||i==="int"||i==="uint"?e[0]||0:i==="string"?e[0]||"":i==="ArrayBuffer"?DTe(e[0]):null}function ane(i){let e=Oee.get(i);return e===void 0&&(e={},Oee.set(i,e)),e}function LTe(i){let e="",t=new Uint8Array(i);for(let n=0;n<t.length;n++)e+=String.fromCharCode(t[n]);return btoa(e)}function DTe(i){return Uint8Array.from(atob(i),e=>e.charCodeAt(0)).buffer}var ex={VERTEX:"vertex",FRAGMENT:"fragment"},yn={NONE:"none",FRAME:"frame",RENDER:"render",OBJECT:"object"},NTe={BOOLEAN:"bool",INTEGER:"int",FLOAT:"float",VECTOR2:"vec2",VECTOR3:"vec3",VECTOR4:"vec4",MATRIX2:"mat2",MATRIX3:"mat3",MATRIX4:"mat4"},Yo={READ_ONLY:"readOnly",WRITE_ONLY:"writeOnly",READ_WRITE:"readWrite"},lne=["fragment","vertex"],YR=["setup","analyze","generate"],ZR=[...lne,"compute"],a1=["x","y","z","w"],FTe={analyze:"setup",generate:"analyze"},BTe=0,Kt=class i extends ca{static get type(){return"Node"}constructor(e=null){super(),this.nodeType=e,this.updateType=yn.NONE,this.updateBeforeType=yn.NONE,this.updateAfterType=yn.NONE,this.version=0,this.name="",this.global=!1,this.parents=!1,this.isNode=!0,this._beforeNodes=null,this._cacheKey=null,this._uuid=null,this._cacheKeyVersion=0,this.id=BTe++,this.stackTrace=null,i.captureStackTrace===!0&&(this.stackTrace=new ts)}set needsUpdate(e){e===!0&&this.version++}get uuid(){return this._uuid===null&&(this._uuid=Bu.generateUUID()),this._uuid}get type(){return this.constructor.type}onUpdate(e,t){return this.updateType=t,this.update=e.bind(this),this}onFrameUpdate(e){return this.onUpdate(e,yn.FRAME)}onRenderUpdate(e){return this.onUpdate(e,yn.RENDER)}onObjectUpdate(e){return this.onUpdate(e,yn.OBJECT)}onReference(e){return this.updateReference=e.bind(this),this}updateReference(){return this}isGlobal(){return this.global}*getChildren(){for(let{childNode:e}of this._getChildren())yield e}dispose(){this.dispatchEvent({type:"dispose"})}traverse(e){e(this);for(let t of this.getChildren())t.traverse(e)}_getChildren(e=new Set){let t=[];e.add(this);for(let n of Object.getOwnPropertyNames(this)){let r=this[n];if(!(n.startsWith("_")===!0||e.has(r))){if(Array.isArray(r)===!0)for(let s=0;s<r.length;s++){let o=r[s];o&&o.isNode===!0&&t.push({property:n,index:s,childNode:o})}else if(r&&r.isNode===!0)t.push({property:n,childNode:r});else if(r&&Object.getPrototypeOf(r)===Object.prototype)for(let s in r){if(s.startsWith("_")===!0)continue;let o=r[s];o&&o.isNode===!0&&t.push({property:n,index:s,childNode:o})}}}return t}getCacheKey(e=!1,t=null){if(e=e||this.version!==this._cacheKeyVersion,e===!0||this._cacheKey===null){t===null&&(t=new Set);let n=[];for(let{property:r,childNode:s}of this._getChildren(t))n.push(yx(r.slice(0,-4)),s.getCacheKey(e,t));this._cacheKey=nS(LS(n),this.customCacheKey()),this._cacheKeyVersion=this.version}return this._cacheKey}customCacheKey(){return this.id}getScope(){return this}getHash(){return String(this.id)}getUpdateType(){return this.updateType}getUpdateBeforeType(){return this.updateBeforeType}getUpdateAfterType(){return this.updateAfterType}getElementType(e){let t=this.getNodeType(e);return e.getElementType(t)}getMemberType(){return"void"}getNodeType(e,t=null){let n=e.getDataFromNode(this),r;return t!==null?(n.typeFromOutput=n.typeFromOutput||{},r=n.typeFromOutput[t],r===void 0&&(r=this.generateNodeType(e,t),n.typeFromOutput[t]=r)):(r=n.type,r===void 0&&(r=this.generateNodeType(e),n.type=r)),r}generateNodeType(e,t=null){let n=e.getNodeProperties(this);return n.outputNode?n.outputNode.getNodeType(e,t):this.nodeType}getShared(e){let t=this.getHash(e),n=e.getNodeFromHash(t),r=null;if(n&&n!==this)r=n;else if(e.context.overrideNodes){let s=e.context.overrideNodes.get(this);if(s){let o=e.getDataFromNode(this);o.isOverwritten!==!0?(o.isOverwritten=!0,r=s(e).overrideNode(this,null),o.sharedNode=r):r=o.sharedNode}}return r||this}getArrayCount(){return null}setup(e){let t=e.getNodeProperties(this),n=0;for(let r of this.getChildren())t["node"+n++]=r;return t.outputNode||null}analyze(e,t=null){let n=e.increaseUsage(this);if(this.parents===!0){let r=e.getDataFromNode(this,"any");r.stages=r.stages||{},r.stages[e.shaderStage]=r.stages[e.shaderStage]||[],r.stages[e.shaderStage].push(t)}if(n===1){let r=e.getNodeProperties(this);for(let s of Object.values(r))s&&s.isNode===!0&&s.build(e,this)}}generate(e,t){let{outputNode:n}=e.getNodeProperties(this);if(n&&n.isNode===!0)return n.build(e,t)}updateBefore(){Xe("Abstract function.")}updateAfter(){Xe("Abstract function.")}update(){Xe("Abstract function.")}before(e){return this._beforeNodes===null&&(this._beforeNodes=[]),this._beforeNodes.push(e),this}build(e,t=null){let n=this.getShared(e);if(this!==n)return n.build(e,t);if(this._beforeNodes!==null){let l=this._beforeNodes;this._beforeNodes=null;for(let c of l)c.build(e,t);this._beforeNodes=l}let r=e.getDataFromNode(this);r.buildStages=r.buildStages||{},r.buildStages[e.buildStage]=!0;let s=FTe[e.buildStage];if(s&&r.buildStages[s]!==!0){let l=e.getBuildStage();e.setBuildStage(s),this.build(e),e.setBuildStage(l)}e.addChain(this);let o=null,a=e.getBuildStage();if(a==="setup"){e.addNode(this),this.updateReference(e);let l=e.getNodeProperties(this);if(l.initialized!==!0){l.initialized=!0,l.outputNode=this.setup(e)||l.outputNode||null;for(let c of Object.values(l))if(c&&c.isNode===!0){if(c.parents===!0){let u=e.getNodeProperties(c);u.parents=u.parents||[],u.parents.push(this)}c.build(e)}e.addSequentialNode(this)}o=l.outputNode}else if(a==="analyze")this.analyze(e,t);else if(a==="generate"){if(this.generate.length<2){let c=this.getNodeType(e),u=e.getDataFromNode(this);o=u.snippet,o===void 0?u.generated===void 0?(u.generated=!0,o=this.generate(e)||"",u.snippet=o):(Xe("Node: Recursion detected.",this),o="/* Recursion detected. */"):u.flowCodes!==void 0&&e.context.nodeBlock!==void 0&&e.addFlowCodeHierarchy(this,e.context.nodeBlock),o=e.format(o,c,t)}else o=this.generate(e,t)||"";o===""&&t!==null&&t!=="void"&&t!=="OutputType"&&(ze(`TSL: Invalid generated code, expected a "${t}".`),o=e.generateConst(t))}return e.removeChain(this),o}getSerializeChildren(){return this._getChildren()}serialize(e){let t=this.getSerializeChildren(),n={};for(let{property:r,index:s,childNode:o}of t)s!==void 0?(n[r]===void 0&&(n[r]=Number.isInteger(s)?[]:{}),n[r][s]=o.toJSON(e.meta).uuid):n[r]=o.toJSON(e.meta).uuid;Object.keys(n).length>0&&(e.inputNodes=n)}deserialize(e){if(e.inputNodes!==void 0){let t=e.meta.nodes;for(let n in e.inputNodes)if(Array.isArray(e.inputNodes[n])){let r=[];for(let s of e.inputNodes[n])r.push(t[s]);this[n]=r}else if(typeof e.inputNodes[n]=="object"){let r={};for(let s in e.inputNodes[n]){let o=e.inputNodes[n][s];r[s]=t[o]}this[n]=r}else{let r=e.inputNodes[n];this[n]=t[r]}}}toJSON(e){let{uuid:t,type:n}=this,r=e===void 0||typeof e=="string";r&&(e={textures:{},images:{},nodes:{}});let s=e.nodes[t];s===void 0&&(s={uuid:t,type:n,meta:e,metadata:{version:4.7,type:"Node",generator:"Node.toJSON"}},r!==!0&&(e.nodes[s.uuid]=s),this.serialize(s),delete s.meta);function o(a){let l=[];for(let c in a){let u=a[c];delete u.metadata,l.push(u)}return l}if(r){let a=o(e.textures),l=o(e.images),c=o(e.nodes);a.length>0&&(s.textures=a),l.length>0&&(s.images=l),c.length>0&&(s.nodes=c)}return s}};Kt.captureStackTrace=!1;var Zd=class extends Kt{static get type(){return"ArrayElementNode"}constructor(e,t){super(),this.node=e,this.indexNode=t,this.isArrayElementNode=!0}generateNodeType(e){return this.node.getElementType(e)}getMemberType(e,t){return this.node.getMemberType(e,t)}generate(e){let t=this.indexNode.getNodeType(e),n=this.node.build(e),r=this.indexNode.build(e,!e.isVector(t)&&e.isInteger(t)?t:"uint");return`${n}[ ${r} ]`}},n4=class extends Kt{static get type(){return"ConvertNode"}constructor(e,t){super(),this.node=e,this.convertTo=t}generateNodeType(e){let t=this.node.getNodeType(e),n=null;for(let r of this.convertTo.split("|"))(n===null||e.getTypeLength(t)===e.getTypeLength(r))&&(n=r);return n}serialize(e){super.serialize(e),e.convertTo=this.convertTo}deserialize(e){super.deserialize(e),this.convertTo=e.convertTo}generate(e,t){let n=this.node,r=this.getNodeType(e),s=n.build(e,r);return e.format(s,r,t)}},Rr=class extends Kt{static get type(){return"TempNode"}constructor(e=null){super(e),this.isTempNode=!0}hasDependencies(e){return e.getDataFromNode(this).usageCount>1}build(e,t){if(e.getBuildStage()==="generate"){let r=e.getVectorType(this.getNodeType(e,t)),s=e.getDataFromNode(this);if(s.propertyName!==void 0)return e.format(s.propertyName,r,t);if(r!=="void"&&t!=="void"&&this.hasDependencies(e)){let o=super.build(e,r),a=e.getVarFromNode(this,null,r),l=e.getPropertyName(a);return e.addLineFlowCode(`${l} = ${o}`,this),s.snippet=o,s.propertyName=l,e.format(s.propertyName,r,t)}}return super.build(e,t)}},wU=class extends Rr{static get type(){return"JoinNode"}constructor(e=[],t=null){super(t),this.nodes=e}generateNodeType(e){return this.nodeType!==null?e.getVectorType(this.nodeType):e.getTypeFromLength(this.nodes.reduce((t,n)=>t+e.getTypeLength(n.getNodeType(e)),0))}generate(e,t){let n=this.getNodeType(e),r=e.getTypeLength(n),s=this.nodes,o=e.getComponentType(n),a=[],l=0;for(let u of s){if(l>=r){ze(`TSL: Length of parameters exceeds maximum length of function '${n}()' type.`,this.stackTrace);break}let f=u.getNodeType(e),d=e.getTypeLength(f),A;if(l+d>r&&(ze(`TSL: Length of '${n}()' data exceeds maximum length of output type.`,this.stackTrace),d=r-l,f=e.getTypeFromLength(d)),l+=d,A=u.build(e,f),e.getComponentType(f)!==o){let w=e.getTypeFromLength(d,o);A=e.format(A,f,w)}a.push(A)}let c=`${e.getType(n)}( ${a.join(", ")} )`;return e.format(c,n,t)}},OTe=a1.join(""),i4=class extends Kt{static get type(){return"SplitNode"}constructor(e,t="x"){super(),this.node=e,this.components=t,this.isSplitNode=!0}getVectorLength(){let e=this.components.length;for(let t of this.components)e=Math.max(a1.indexOf(t)+1,e);return e}getComponentType(e){return e.getComponentType(this.node.getNodeType(e))}generateNodeType(e){return e.getTypeFromLength(this.components.length,this.getComponentType(e))}getScope(){return this.node.getScope()}generate(e,t){let n=this.node,r=e.getTypeLength(n.getNodeType(e)),s=null;if(r>1){let o=null;this.getVectorLength()>=r&&(o=e.getTypeFromLength(this.getVectorLength(),this.getComponentType(e)));let l=n.build(e,o);this.components.length===r&&this.components===OTe.slice(0,this.components.length)?s=e.format(l,o,t):s=e.format(`${l}.${this.components}`,this.getNodeType(e),t)}else s=n.build(e,t);return s}serialize(e){super.serialize(e),e.components=this.components}deserialize(e){super.deserialize(e),this.components=e.components}},SU=class extends Rr{static get type(){return"SetNode"}constructor(e,t,n){super(),this.sourceNode=e,this.components=t,this.targetNode=n}generateNodeType(e){return this.sourceNode.getNodeType(e)}generate(e){let{sourceNode:t,components:n,targetNode:r}=this,s=this.getNodeType(e),o=e.getComponentType(r.getNodeType(e)),a=e.getTypeFromLength(n.length,o),l=r.build(e,a),c=t.build(e,s),u=e.getTypeLength(s),f=[];for(let d=0;d<u;d++){let A=a1[d];A===n[0]?(f.push(l),d+=n.length-1):f.push(c+"."+A)}return`${e.getType(s)}( ${f.join(", ")} )`}},TU=class extends Rr{static get type(){return"FlipNode"}constructor(e,t){super(),this.sourceNode=e,this.components=t}generateNodeType(e){return this.sourceNode.getNodeType(e)}generate(e){let{components:t,sourceNode:n}=this,r=this.getNodeType(e),s=n.build(e),o=e.getVarFromNode(this),a=e.getPropertyName(o);e.addLineFlowCode(a+" = "+s,this);let l=e.getTypeLength(r),c=[],u=0;for(let f=0;f<l;f++){let d=a1[f];d===t[u]?(c.push("1.0 - "+(a+"."+d)),u++):c.push(a+"."+d)}return`${e.getType(r)}( ${c.join(", ")} )`}},hS=class extends Kt{static get type(){return"InputNode"}constructor(e,t=null){super(t),this.isInputNode=!0,this.value=e,this.precision=null}generateNodeType(){return this.nodeType===null?fm(this.value):this.nodeType}getInputType(e){return this.getNodeType(e)}setPrecision(e){return this.precision=e,this}serialize(e){super.serialize(e),e.value=this.value,this.value&&this.value.toArray&&(e.value=this.value.toArray()),e.valueType=fm(this.value),e.nodeType=this.nodeType,e.valueType==="ArrayBuffer"&&(e.value=LTe(e.value)),e.precision=this.precision}deserialize(e){super.deserialize(e),this.nodeType=e.nodeType,this.value=Array.isArray(e.value)?cz(e.valueType,...e.value):e.value,this.precision=e.precision||null,this.value&&this.value.fromArray&&(this.value=this.value.fromArray(e.value))}generate(){Xe("Abstract function.")}},Uee=/float|u?int/,iu=class extends hS{static get type(){return"ConstNode"}constructor(e,t=null){super(e,t),this.isConstNode=!0}generateConst(e){return e.generateConst(this.getNodeType(e),this.value)}generate(e,t){let n=this.getNodeType(e);return Uee.test(n)&&Uee.test(t)?e.generateConst(t,this.value):e.format(this.generateConst(e),n,t)}},EU=class extends Kt{static get type(){return"MemberNode"}constructor(e,t){super(),this.structNode=e,this.property=t,this.isMemberNode=!0}hasMember(e){return this.structNode.isMemberNode&&this.structNode.hasMember(e)===!1?!1:this.structNode.getMemberType(e,this.property)!=="void"}generateNodeType(e){return this.hasMember(e)===!1?"float":this.structNode.getMemberType(e,this.property)}getMemberType(e,t){if(this.hasMember(e)===!1)return"float";let n=this.getNodeType(e);return e.getStructTypeNode(n).getMemberType(e,t)}generate(e){if(this.hasMember(e)===!1){Xe(`TSL: Member "${this.property}" does not exist in struct.`,this.stackTrace);let n=this.getNodeType(e);return e.generateConst(n)}return this.structNode.build(e)+"."+this.property}},Am=null,MU=new Map;function Ue(i,e){if(MU.has(i)){Xe(`TSL: Redefinition of method chaining '${i}'.`);return}if(typeof e!="function")throw new Error(`THREE.TSL: Node element ${i} is not a function`);MU.set(i,e),i!=="assign"&&(Kt.prototype[i]=function(...t){return this.isStackNode?this.addToStack(e(...t)):e(this,...t)},Kt.prototype[i+"Assign"]=function(...t){return this.isStackNode?this.assign(t[0],e(...t)):this.assign(e(this,...t))})}var UTe=i=>i.replace(/r|s/g,"x").replace(/g|t/g,"y").replace(/b|p/g,"z").replace(/a|q/g,"w"),kee=i=>UTe(i).split("").sort().join("");Kt.prototype.assign=function(...i){if(this.isStackNode!==!0)return Am!==null?Am.assign(this,...i):ze("TSL: No stack defined for assign operation. Make sure the assign is inside a Fn().",new ts),this;{let e=MU.get("assign");return this.addToStack(e(...i))}};Kt.prototype.toVarIntent=function(){return this};Kt.prototype.get=function(i){return new EU(this,i)};var iS={};function fR(i,e,t){iS[i]=iS[e]=iS[t]={get(){this._cache=this._cache||{};let o=this._cache[i];return o===void 0&&(o=new i4(this,i),this._cache[i]=o),o},set(o){this[i].assign(Ht(o))}};let n=i.toUpperCase(),r=e.toUpperCase(),s=t.toUpperCase();Kt.prototype["set"+n]=Kt.prototype["set"+r]=Kt.prototype["set"+s]=function(o){let a=kee(i);return new SU(this,a,Ht(o))},Kt.prototype["flip"+n]=Kt.prototype["flip"+r]=Kt.prototype["flip"+s]=function(){let o=kee(i);return new TU(this,o)}}var sf=["x","y","z","w"],of=["r","g","b","a"],af=["s","t","p","q"];for(let i=0;i<4;i++){let e=sf[i],t=of[i],n=af[i];fR(e,t,n);for(let r=0;r<4;r++){e=sf[i]+sf[r],t=of[i]+of[r],n=af[i]+af[r],fR(e,t,n);for(let s=0;s<4;s++){e=sf[i]+sf[r]+sf[s],t=of[i]+of[r]+of[s],n=af[i]+af[r]+af[s],fR(e,t,n);for(let o=0;o<4;o++)e=sf[i]+sf[r]+sf[s]+sf[o],t=of[i]+of[r]+of[s]+of[o],n=af[i]+af[r]+af[s]+af[o],fR(e,t,n)}}}for(let i=0;i<32;i++)iS[i]={get(){this._cache=this._cache||{};let e=this._cache[i];return e===void 0&&(e=new Zd(this,new iu(i,"uint")),this._cache[i]=e),e},set(e){this[i].assign(Ht(e))}};Object.defineProperties(Kt.prototype,iS);var kTe=function(i,e=null){let t=fm(i);return t==="node"?i:e===null&&(t==="float"||t==="boolean")||t&&t!=="shader"&&t!=="string"?Ht(PU(i,e)):t==="shader"?i.isFn?i:me(i):i},zTe=function(i,e=null){for(let t in i)i[t]=Ht(i[t],e);return i},VTe=function(i,e=null){let t=i.length;for(let n=0;n<t;n++)i[n]=Ht(i[n],e);return i},cne=function(i,e=null,t=null,n=null){function r(u){return n!==null?(u=Ht(Object.assign(u,n)),n.intent===!0&&(u=u.toVarIntent())):u=Ht(u),u}let s,o=e,a,l;function c(u){let f;return o?f=/[a-z]/i.test(o)?o+"()":o:f=i.type,a!==void 0&&u.length<a?(ze(`TSL: "${f}" parameter length is less than minimum required.`,new ts),u.concat(new Array(a-u.length).fill(0))):l!==void 0&&u.length>l?(ze(`TSL: "${f}" parameter length exceeds limit.`,new ts),u.slice(0,l)):u}return e===null?s=(...u)=>r(new i(...Wg(c(u)))):t!==null?(t=Ht(t),s=(...u)=>r(new i(e,...Wg(c(u)),t))):s=(...u)=>r(new i(e,...Wg(c(u)))),s.setParameterLength=(...u)=>(u.length===1?a=l=u[0]:u.length===2&&([a,l]=u),s),s.setName=u=>(o=u,s),s},GTe=function(i,...e){return new i(...Wg(e))},CU=class extends Kt{constructor(e,t){super(),this.shaderNode=e,this.rawInputs=t,this.isShaderCallNodeInternal=!0}generateNodeType(e){return this.shaderNode.nodeType||this.getOutputNode(e).getNodeType(e)}getElementType(e){return this.getOutputNode(e).getElementType(e)}getMemberType(e,t){return this.getOutputNode(e).getMemberType(e,t)}call(e){let{shaderNode:t,rawInputs:n}=this,r=e.getNodeProperties(t),s=e.getClosestSubBuild(t.subBuilds)||"",o=s||"default";if(r[o])return r[o];let a=e.subBuildFn,l=e.fnCall;e.subBuildFn=s,e.fnCall=this;let c=null;if(t.layout){if(n){let d=t.layout.inputs;if(une(n)){let A=n;for(let y=0;y<d.length;y++){let w=A[y];w&&w.isNode&&w.build(e)}}else{let A=n[0];for(let y of d){let w=A[y.name];w&&w.isNode&&w.build(e)}}}let u=e.buildFunctionNode(t);e.addInclude(u);let f=n?qTe(n):null;c=u.call(f)}else{let u=new Proxy(e,{get:(w,S,T)=>{let R;return Symbol.iterator===S?R=function*(){yield void 0}:R=Reflect.get(w,S,T),R}}),f=n?HTe(n):null,d=Array.isArray(n)?n.length>0:n!==null,A=t.jsFunc,y=d||A.length>1?A(f,u):A(u);c=Ht(y)}return e.subBuildFn=a,e.fnCall=l,t.once&&(r[o]=c),c}setupOutput(e){return e.addStack(),e.stack.outputNode=this.call(e),e.removeStack()}getOutputNode(e){let t=e.getNodeProperties(this),n=e.getSubBuildOutput(this);return t[n]=t[n]||this.setupOutput(e),t[n].subBuild=e.getClosestSubBuild(this),t[n]}build(e,t=null){let n=null,r=e.getBuildStage(),s=e.getNodeProperties(this),o=e.getSubBuildOutput(this),a=this.getOutputNode(e),l=e.fnCall;if(e.fnCall=this,r==="setup"){let c=e.getSubBuildProperty("initialized",this);if(s[c]!==!0&&(s[c]=!0,s[o]=this.getOutputNode(e),s[o].build(e),this.shaderNode.subBuilds))for(let u of e.chaining){let f=e.getDataFromNode(u,"any");f.subBuilds=f.subBuilds||new Set;for(let d of this.shaderNode.subBuilds)f.subBuilds.add(d)}n=s[o]}else r==="analyze"?a.build(e,t):r==="generate"&&(n=a.build(e,t)||"");return e.fnCall=l,n}};function une(i){return i[0]&&(i[0].isNode||Object.getPrototypeOf(i[0])!==Object.prototype)}function qTe(i){let e;return AP(i),une(i)?e=[...i]:e=i[0],e}function HTe(i){let e=0;return AP(i),new Proxy(i,{get:(t,n,r)=>{let s;if(n==="length")return s=i.length,s;if(Symbol.iterator===n)s=function*(){for(let o of i)yield Ht(o)};else{if(i.length>0)if(Object.getPrototypeOf(i[0])===Object.prototype){let o=i[0];o[n]===void 0?s=o[e++]:s=Reflect.get(o,n,r)}else i[0]instanceof Kt&&(i[n]===void 0?s=i[e++]:s=Reflect.get(i,n,r));else s=Reflect.get(t,n,r);s=Ht(s)}return s}})}var RU=class extends Kt{constructor(e,t){super(t),this.jsFunc=e,this.layout=null,this.global=!0,this.once=!1}setLayout(e){return this.layout=e,this}getLayout(){return this.layout}call(e=null){return new CU(this,e)}setup(){return this.call()}},WTe=[!1,!0],jTe=[0,1,2,3],XTe=[-1,-2],hne=[.5,1.5,1/3,1e-6,1e6,Math.PI,Math.PI*2,1/Math.PI,2/Math.PI,1/(Math.PI*2),Math.PI/2],uz=new Map;for(let i of WTe)uz.set(i,new iu(i));var hz=new Map;for(let i of jTe)hz.set(i,new iu(i,"uint"));var fz=new Map([...hz].map(i=>new iu(i.value,"int")));for(let i of XTe)fz.set(i,new iu(i,"int"));var pP=new Map([...fz].map(i=>new iu(i.value)));for(let i of hne)pP.set(i,new iu(i));for(let i of hne)pP.set(-i,new iu(-i));var mP={bool:uz,uint:hz,ints:fz,float:pP},zee=new Map([...uz,...pP]),PU=(i,e)=>zee.has(i)?zee.get(i):i.isNode===!0?i:new iu(i,e),Ys=function(i,e=null){return(...t)=>{for(let r of t)if(r===void 0)return ze(`TSL: Invalid parameter for the type "${i}".`,new ts),new iu(0,i);if((t.length===0||!["bool","float","int","uint"].includes(i)&&t.every(r=>{let s=typeof r;return s!=="object"&&s!=="function"}))&&(t=[cz(i,...t)]),t.length===1&&e!==null&&e.has(t[0]))return eS(e.get(t[0]));if(t.length===1){let r=PU(t[0],i);return r.nodeType===i?eS(r):eS(new n4(r,i))}let n=t.map(r=>PU(r));return eS(new wU(n,i))}};function hx(i){return i&&i.isNode&&i.traverse(e=>{e.isConstNode&&(i=e.value)}),!!i}var fne=i=>i!=null?i.nodeType||i.convertTo||(typeof i=="string"?i:null):null;function ix(i,e){return new RU(i,e)}var Ht=(i,e=null)=>kTe(i,e),eS=(i,e=null)=>Ht(i,e).toVarIntent(),AP=(i,e=null)=>new zTe(i,e),Wg=(i,e=null)=>new VTe(i,e),$n=(i,e=null,t=null,n=null)=>new cne(i,e,t,n),xt=(i,...e)=>new GTe(i,...e),ct=(i,e=null,t=null,n={})=>new cne(i,e,t,{...n,intent:!0}),dz=(i,e)=>new Proxy(i,{get(t,n,r){return Reflect.get(e,n,r)},set(t,n,r){return Reflect.set(e,n,r)}}),$Te=0,IU=class extends Kt{constructor(e,t=null){super();let n=null;t!==null&&(typeof t=="object"?n=t.return:(typeof t=="string"?n=t:ze("TSL: Invalid layout type.",new ts),t=null)),this.shaderNode=new ix(e,n),t!==null&&this.setLayout(t),this.isFn=!0}setLayout(e){let t=this.shaderNode.nodeType;if(typeof e.inputs!="object"){let n={name:"fn"+$Te++,type:t,inputs:[]};for(let r in e)r!=="return"&&n.inputs.push({name:r,type:e[r]});e=n}return this.shaderNode.setLayout(e),this}generateNodeType(e){return this.shaderNode.getNodeType(e)||"float"}call(...e){let t=this.shaderNode.call(e);return this.shaderNode.nodeType==="void"&&t.toStack(),t.toVarIntent()}once(e=null){return this.shaderNode.once=!0,this.shaderNode.subBuilds=e,this}generate(e){let t=this.getNodeType(e);return ze('TSL: "Fn()" was declared but not invoked. Try calling it like "Fn()( ...params )".',this.stackTrace),e.generateConst(t)}};function me(i,e=null){let t=new IU(i,e);return new Proxy(()=>{},{apply(n,r,s){return t.call(...s)},get(n,r,s){return Reflect.get(t,r,s)},set(n,r,s,o){return Reflect.set(t,r,s,o)}})}var fS=i=>{Am=i},pz=()=>Am,$t=(...i)=>Am.If(...i),YTe=(...i)=>Am.Switch(...i);function gP(i){return Am&&Am.addToStack(i),i}Ue("toStack",gP);var dne=new Ys("color"),oe=new Ys("float",mP.float),de=new Ys("int",mP.ints),rt=new Ys("uint",mP.uint),dc=new Ys("bool",mP.bool),dt=new Ys("vec2"),kr=new Ys("ivec2"),mz=new Ys("uvec2"),pne=new Ys("bvec2"),pe=new Ys("vec3"),Az=new Ys("ivec3"),l1=new Ys("uvec3"),gz=new Ys("bvec3"),Ft=new Ys("vec4"),vz=new Ys("ivec4"),_z=new Ys("uvec4"),mne=new Ys("bvec4"),vP=new Ys("mat2"),To=new Ys("mat3"),pm=new Ys("mat4");Ue("toColor",dne);Ue("toFloat",oe);Ue("toInt",de);Ue("toUint",rt);Ue("toBool",dc);Ue("toVec2",dt);Ue("toIVec2",kr);Ue("toUVec2",mz);Ue("toBVec2",pne);Ue("toVec3",pe);Ue("toIVec3",Az);Ue("toUVec3",l1);Ue("toBVec3",gz);Ue("toVec4",Ft);Ue("toIVec4",vz);Ue("toUVec4",_z);Ue("toBVec4",mne);Ue("toMat2",vP);Ue("toMat3",To);Ue("toMat4",pm);var Ane=$n(Zd).setParameterLength(2),gne=(i,e)=>new n4(Ht(i),e),ZTe=(i,e)=>new i4(Ht(i),e);Ue("element",Ane);Ue("convert",gne);var KTe=i=>(Xe("TSL: append() has been renamed to Stack().",new ts),gP(i));Ue("append",i=>(Xe("TSL: .append() has been renamed to .toStack().",new ts),gP(i)));var gi=class extends Kt{static get type(){return"PropertyNode"}constructor(e,t=null,n=!1,r=null){super(e),this.name=t,this.varying=n,this.placeholderNode=Ht(r),this.isPropertyNode=!0,this.global=!0}getNodeType(e){let t=super.getNodeType(e);return t==="output"?e.getOutputType():t}customCacheKey(){return yx(this.type+":"+(this.name||"")+":"+(this.varying?"1":"0"))}getHash(e){return this.name||super.getHash(e)}generate(e){let t;if(this.varying===!0)t=e.getVaryingFromNode(this,this.name),t.needsInterpolation=!0;else if(t=e.getVarFromNode(this,this.name),this.placeholderNode!==null&&e.hasWriteUsage(this)===!1){let n=this.placeholderNode.build(e,this.getNodeType(e));e.addLineFlowCode(`${e.getPropertyName(t)} = ${n}`,this)}return e.getPropertyName(t)}},Jd=(i,e,t=null)=>new gi(i,e,!1,t),c1=(i,e,t=null)=>new gi(i,e,!0,t),Bi=xt(gi,"vec4","DiffuseColor"),kg=xt(gi,"vec3","DiffuseContribution"),LU=xt(gi,"vec3","EmissiveColor"),pf=xt(gi,"float","Roughness"),Yd=xt(gi,"float","Metalness"),r4=xt(gi,"float","Clearcoat"),sx=xt(gi,"float","ClearcoatRoughness"),cc=xt(gi,"vec3","Sheen"),am=xt(gi,"float","SheenRoughness"),_P=xt(gi,"float","Iridescence"),s4=xt(gi,"float","IridescenceIOR"),o4=xt(gi,"float","IridescenceThickness"),a4=xt(gi,"float","AlphaT"),om=xt(gi,"float","Anisotropy"),rS=xt(gi,"vec3","AnisotropyT"),jg=xt(gi,"vec3","AnisotropyB"),gm=xt(gi,"color","SpecularColor"),Vg=xt(gi,"color","SpecularColorBlended"),Gg=xt(gi,"float","SpecularF90"),l4=xt(gi,"float","Shininess"),ox=xt(gi,"output","Output"),Xg=xt(gi,"float","dashSize"),dS=xt(gi,"float","gapSize"),QTe=xt(gi,"float","pointWidth"),sS=xt(gi,"float","IOR"),c4=xt(gi,"float","Transmission"),xz=xt(gi,"float","Thickness"),yz=xt(gi,"float","AttenuationDistance"),bz=xt(gi,"color","AttenuationColor"),wz=xt(gi,"float","Dispersion"),DU=xt(gi,"float","AmbientOcclusion",!1,1),u4=class extends Kt{static get type(){return"UniformGroupNode"}constructor(e,t=!1,n=1,r=null){super("string"),this.name=e,this.shared=t,this.order=n,this.updateType=r,this.isUniformGroup=!0}update(){this.needsUpdate=!0}serialize(e){super.serialize(e),e.name=this.name,e.version=this.version,e.shared=this.shared}deserialize(e){super.deserialize(e),this.name=e.name,this.version=e.version,this.shared=e.shared}},vne=(i,e=1,t=null)=>new u4(i,!1,e,t),xP=(i,e=0,t=null)=>new u4(i,!0,e,t),JTe=xP("frame",0,yn.FRAME),Jt=xP("render",0,yn.RENDER),_ne=vne("object",1,yn.OBJECT),Qg=class extends hS{static get type(){return"UniformNode"}constructor(e,t=null){super(e,t),this.isUniformNode=!0,this.name="",this.groupNode=_ne}setName(e){return this.name=e,this}label(e){return Xe('TSL: "label()" has been deprecated. Use "setName()" instead.',new ts),this.setName(e)}setGroup(e){return this.groupNode=e,this}getGroup(){return this.groupNode}getUniformHash(e){return this.getHash(e)}onUpdate(e,t){return e=e.bind(this),super.onUpdate(n=>{let r=e(n,this);r!==void 0&&(this.value=r)},t)}getInputType(e){let t=super.getInputType(e);return t==="bool"&&(t="uint"),t}generate(e,t){let n=this.getNodeType(e),r=this.getUniformHash(e),s=e.getNodeFromHash(r);s===void 0&&(e.setHashNode(this,r),s=this);let o=s.getInputType(e),a=e.getUniformFromNode(s,o,e.shaderStage,this.name||e.context.nodeName),l=e.getPropertyName(a);e.context.nodeName!==void 0&&delete e.context.nodeName;let c=l;if(n==="bool"){let u=e.getDataFromNode(this),f=u.propertyName;if(f===void 0){let d=e.getVarFromNode(this,null,"bool");f=e.getPropertyName(d),u.propertyName=f,c=e.format(l,o,n),e.addLineFlowCode(`${f} = ${c}`,this)}c=f}return e.format(c,n,t)}},Xt=(i,e)=>{let t=fne(e||i);if(t===i&&(i=cz(t)),i&&i.isNode===!0){let n=i.value;i.traverse(r=>{r.isConstNode===!0&&(n=r.value)}),i=n}return new Qg(i,t)},h4=class extends Rr{static get type(){return"ArrayNode"}constructor(e,t,n=null){super(e),this.count=t,this.values=n,this.isArrayNode=!0}getArrayCount(){return this.count}generateNodeType(e){return this.nodeType===null?this.values[0].getNodeType(e):this.nodeType}getElementType(e){return this.getNodeType(e)}getMemberType(e,t){return this.nodeType===null?this.values[0].getMemberType(e,t):super.getMemberType(e,t)}generate(e){let t=this.getNodeType(e);return e.generateArray(t,this.count,this.values)}},xne=(...i)=>{let e;if(i.length===1){let t=i[0];e=new h4(null,t.length,t)}else{let t=i[0],n=i[1];e=new h4(t,n)}return Ht(e)};Ue("toArray",(i,e)=>xne(Array(e).fill(i)));var NU=class extends Rr{static get type(){return"AssignNode"}constructor(e,t){super(),this.targetNode=e,this.sourceNode=t,this.isAssignNode=!0}hasDependencies(){return!1}generateNodeType(e,t){return t!=="void"?this.targetNode.getNodeType(e):"void"}needsSplitAssign(e){let{targetNode:t}=this;if(e.isAvailable("swizzleAssign")===!1&&t.isSplitNode&&t.components.length>1){let n=e.getTypeLength(t.node.getNodeType(e));return a1.join("").slice(0,n)!==t.components}return!1}setup(e){let{targetNode:t,sourceNode:n}=this,r=t.getScope(),s=e.getDataFromNode(r);s.assign=!0;let o=e.getNodeProperties(this);o.sourceNode=n,o.targetNode=t.context({assign:!0})}generate(e,t){let{targetNode:n,sourceNode:r}=e.getNodeProperties(this),s=this.needsSplitAssign(e),o=n.build(e),a=n.getNodeType(e),l=r.build(e,a),c=r.getNodeType(e),u=e.getDataFromNode(this),f;if(u.initialized===!0)t!=="void"&&(f=o);else if(s){let d=e.getVarFromNode(this,null,a),A=e.getPropertyName(d);e.addLineFlowCode(`${A} = ${l}`,this);let y=n.node,S=y.node.context({assign:!0}).build(e);for(let T=0;T<y.components.length;T++){let R=y.components[T];e.addLineFlowCode(`${S}.${R} = ${A}[ ${T} ]`,this)}t!=="void"&&(f=o)}else f=`${o} = ${l}`,(t==="void"||c==="void")&&(e.addLineFlowCode(f,this),t!=="void"&&(f=o));return u.initialized=!0,e.format(f,a,t)}},yne=$n(NU).setParameterLength(2);Ue("assign",yne);var FU=class extends Rr{static get type(){return"FunctionCallNode"}constructor(e=null,t={}){super(),this.functionNode=e,this.parameters=t}setParameters(e){return this.parameters=e,this}getParameters(){return this.parameters}generateNodeType(e){return this.functionNode.getNodeType(e)}getMemberType(e,t){return this.functionNode.getMemberType(e,t)}generate(e){let t=[],n=this.functionNode,r=n.getInputs(e),s=this.parameters,o=(l,c)=>{let u=c.type,f=u==="pointer",d;return f?d="&"+l.build(e):d=l.build(e,u),d};if(Array.isArray(s)){if(s.length>r.length)ze("TSL: The number of provided parameters exceeds the expected number of inputs in 'Fn()'."),s.length=r.length;else if(s.length<r.length)for(ze("TSL: The number of provided parameters is less than the expected number of inputs in 'Fn()'.");s.length<r.length;)s.push(oe(0));for(let l=0;l<s.length;l++)t.push(o(s[l],r[l]))}else for(let l of r){let c=s[l.name];c!==void 0?t.push(o(c,l)):(ze(`TSL: Input '${l.name}' not found in 'Fn()'.`),t.push(o(oe(0),l)))}return`${n.build(e,"property")}( ${t.join(", ")} )`}},bne=(i,...e)=>(e=e.length>1||e[0]&&e[0].isNode===!0?Wg(e):AP(e[0]),new FU(Ht(i),e));Ue("call",bne);var eEe={"==":"equal","!=":"notEqual","<":"lessThan",">":"greaterThan","<=":"lessThanEqual",">=":"greaterThanEqual","%":"mod"},ns=class i extends Rr{static get type(){return"OperatorNode"}constructor(e,t,n,...r){if(super(),r.length>0){let s=new i(e,t,n);for(let o=0;o<r.length-1;o++)s=new i(e,s,r[o]);t=s,n=r[r.length-1]}this.op=e,this.aNode=t,this.bNode=n,this.isOperatorNode=!0}getOperatorMethod(e,t){return e.getMethod(eEe[this.op],t)}generateNodeType(e,t=null){let n=this.op,r=this.aNode,s=this.bNode,o=r.getNodeType(e),a=s?s.getNodeType(e):null;if(o==="void"||a==="void")return t||"void";if(n==="%")return o;if(n==="~"||n==="&"||n==="|"||n==="^"||n===">>"||n==="<<")return e.getIntegerType(o);if(n==="&&"||n==="||"||n==="^^")return"bool";if(n==="!"){let l=e.getTypeLength(o);return l>1?`bvec${l}`:"bool"}else if(n==="=="||n==="!="||n==="<"||n===">"||n==="<="||n===">="){let l=Math.max(e.getTypeLength(o),e.getTypeLength(a));return l>1?`bvec${l}`:"bool"}else{if(e.isMatrix(o)){if(a==="float")return o;if(e.isVector(a))return e.getVectorFromMatrix(o);if(e.isMatrix(a))return o}else if(e.isMatrix(a)){if(o==="float")return a;if(e.isVector(o))return e.getVectorFromMatrix(a)}return e.getTypeLength(a)>e.getTypeLength(o)?a:o}}generate(e,t){let n=this.op,{aNode:r,bNode:s}=this,o=this.getNodeType(e,t),a=null,l=null;o!=="void"?(a=r.getNodeType(e),l=s?s.getNodeType(e):null,n==="<"||n===">"||n==="<="||n===">="||n==="=="||n==="!="?e.isVector(a)?l=a:e.isVector(l)?a=l:a!==l&&(a=l="float"):n===">>"||n==="<<"?(a=o,l=e.changeComponentType(l,"uint")):n==="%"?(a=o,l=e.isInteger(a)&&e.isInteger(l)?l:a):e.isMatrix(a)?l==="float"?l="float":e.isVector(l)?l=e.getVectorFromMatrix(a):e.isMatrix(l)||(a=l=o):e.isMatrix(l)?a==="float"?a="float":e.isVector(a)?a=e.getVectorFromMatrix(l):a=l=o:a=l=o):a=l=o;let c=r.build(e,a),u=s?s.build(e,l):null,f=e.getFunctionOperator(n);if(t!=="void"){let d=e.renderer.coordinateSystem===ko;if(n==="=="||n==="!="||n==="<"||n===">"||n==="<="||n===">=")return d?e.isVector(a)?e.format(`${this.getOperatorMethod(e,t)}( ${c}, ${u} )`,o,t):e.format(`( ${c} ${n} ${u} )`,o,t):e.format(`( ${c} ${n} ${u} )`,o,t);if(n==="%")return e.isInteger(l)?e.format(`( ${c} % ${u} )`,o,t):e.format(`${this.getOperatorMethod(e,o)}( ${c}, ${u} )`,o,t);if(n==="!")return d&&e.isVector(a)?e.format(`not( ${c} )`,t):e.format(`( ${n} ${c} )`,a,t);if(n==="~")return e.format(`( ${n} ${c} )`,a,t);if(f)return e.format(`${f}( ${c}, ${u} )`,o,t);if(e.isMatrix(a)&&l==="float")return e.format(`( ${u} ${n} ${c} )`,o,t);if(a==="float"&&e.isMatrix(l))return e.format(`${c} ${n} ${u}`,o,t);{let A=`( ${c} ${n} ${u} )`;return!d&&o==="bool"&&e.isVector(a)&&e.isVector(l)&&(A=`all${A}`),e.format(A,o,t)}}else if(a!=="void")return f?e.format(`${f}( ${c}, ${u} )`,o,t):e.isMatrix(a)&&l==="float"?e.format(`${u} ${n} ${c}`,o,t):e.format(`${c} ${n} ${u}`,o,t)}serialize(e){super.serialize(e),e.op=this.op}deserialize(e){super.deserialize(e),this.op=e.op}},Ps=ct(ns,"+").setParameterLength(2,1/0).setName("add"),ai=ct(ns,"-").setParameterLength(2,1/0).setName("sub"),Tn=ct(ns,"*").setParameterLength(2,1/0).setName("mul"),pc=ct(ns,"/").setParameterLength(2,1/0).setName("div"),yP=ct(ns,"%").setParameterLength(2).setName("mod"),wne=ct(ns,"==").setParameterLength(2).setName("equal"),Sne=ct(ns,"!=").setParameterLength(2).setName("notEqual"),Tne=ct(ns,"<").setParameterLength(2).setName("lessThan"),Sz=ct(ns,">").setParameterLength(2).setName("greaterThan"),Ene=ct(ns,"<=").setParameterLength(2).setName("lessThanEqual"),Mne=ct(ns,">=").setParameterLength(2).setName("greaterThanEqual"),Cne=ct(ns,"&&").setParameterLength(2,1/0).setName("and"),Rne=ct(ns,"||").setParameterLength(2,1/0).setName("or"),Pne=ct(ns,"!").setParameterLength(1).setName("not"),Ine=ct(ns,"^^").setParameterLength(2).setName("xor"),Lne=ct(ns,"&").setParameterLength(2).setName("bitAnd"),Dne=ct(ns,"~").setParameterLength(1).setName("bitNot"),Nne=ct(ns,"|").setParameterLength(2).setName("bitOr"),Fne=ct(ns,"^").setParameterLength(2).setName("bitXor"),Bne=ct(ns,"<<").setParameterLength(2).setName("shiftLeft"),One=ct(ns,">>").setParameterLength(2).setName("shiftRight"),Une=me(([i])=>(i.addAssign(1),i)),kne=me(([i])=>(i.subAssign(1),i)),zne=me(([i])=>{let e=de(i).toConst();return i.addAssign(1),e}),Vne=me(([i])=>{let e=de(i).toConst();return i.subAssign(1),e});Ue("add",Ps);Ue("sub",ai);Ue("mul",Tn);Ue("div",pc);Ue("mod",yP);Ue("equal",wne);Ue("notEqual",Sne);Ue("lessThan",Tne);Ue("greaterThan",Sz);Ue("lessThanEqual",Ene);Ue("greaterThanEqual",Mne);Ue("and",Cne);Ue("or",Rne);Ue("not",Pne);Ue("xor",Ine);Ue("bitAnd",Lne);Ue("bitNot",Dne);Ue("bitOr",Nne);Ue("bitXor",Fne);Ue("shiftLeft",Bne);Ue("shiftRight",One);Ue("incrementBefore",Une);Ue("decrementBefore",kne);Ue("increment",zne);Ue("decrement",Vne);var Pe=class i extends Rr{static get type(){return"MathNode"}constructor(e,t,n=null,r=null){if(super(),(e===i.MAX||e===i.MIN)&&arguments.length>3){let s=new i(e,t,n);for(let o=3;o<arguments.length-1;o++)s=new i(e,s,arguments[o]);t=s,n=arguments[arguments.length-1],r=null}this.method=e,this.aNode=t,this.bNode=n,this.cNode=r,this.isMathNode=!0}getInputType(e){let t=this.aNode.getNodeType(e),n=this.bNode?this.bNode.getNodeType(e):null,r=this.cNode?this.cNode.getNodeType(e):null,s=e.isMatrix(t)?0:e.getTypeLength(t),o=e.isMatrix(n)?0:e.getTypeLength(n),a=e.isMatrix(r)?0:e.getTypeLength(r);return s>o&&s>a?t:o>a?n:a>s?r:t}generateNodeType(e){let t=this.method;return t===i.LENGTH||t===i.DISTANCE||t===i.DOT?"float":t===i.CROSS?"vec3":t===i.ALL||t===i.ANY?"bool":t===i.EQUALS?e.changeComponentType(this.aNode.getNodeType(e),"bool"):this.getInputType(e)}setup(e){let{aNode:t,bNode:n,method:r}=this,s=null;if(r===i.ONE_MINUS)s=ai(1,t);else if(r===i.RECIPROCAL)s=pc(1,t);else if(r===i.DIFFERENCE)s=fr(ai(t,n));else if(r===i.TRANSFORM_DIRECTION){let o,a;e.isMatrix(t.getNodeType(e))?(o=t,a=n):(o=n,a=t),s=ya(Tn(o,Ft(pe(a),0)).xyz)}return s!==null?s:super.setup(e)}generate(e,t){if(e.getNodeProperties(this).outputNode)return super.generate(e,t);let r=this.method,s=this.getNodeType(e),o=this.getInputType(e),a=this.aNode,l=this.bNode,c=this.cNode,u=e.renderer.coordinateSystem;if(r===i.NEGATE)return e.format("( - "+a.build(e,o)+" )",s,t);{let f=[];return r===i.CROSS?f.push(a.build(e,s),l.build(e,s)):u===ko&&r===i.STEP?f.push(a.build(e,e.getTypeLength(a.getNodeType(e))===1?"float":o),l.build(e,o)):u===ko&&(r===i.MIN||r===i.MAX)?f.push(a.build(e,o),l.build(e,e.getTypeLength(l.getNodeType(e))===1?"float":o)):r===i.REFRACT?f.push(a.build(e,o),l.build(e,o),c.build(e,"float")):r===i.MIX?f.push(a.build(e,o),l.build(e,o),c.build(e,e.getTypeLength(c.getNodeType(e))===1?"float":o)):(u===xl&&r===i.ATAN&&l!==null&&(r="atan2"),e.shaderStage!=="fragment"&&(r===i.DFDX||r===i.DFDY)&&(Xe(`TSL: '${r}' is not supported in the ${e.shaderStage} stage.`,this.stackTrace),r="/*"+r+"*/"),f.push(a.build(e,o)),l!==null&&f.push(l.build(e,o)),c!==null&&f.push(c.build(e,o))),e.format(`${e.getMethod(r,s)}( ${f.join(", ")} )`,s,t)}}serialize(e){super.serialize(e),e.method=this.method}deserialize(e){super.deserialize(e),this.method=e.method}};Pe.ALL="all";Pe.ANY="any";Pe.RADIANS="radians";Pe.DEGREES="degrees";Pe.EXP="exp";Pe.EXP2="exp2";Pe.LOG="log";Pe.LOG2="log2";Pe.SQRT="sqrt";Pe.INVERSE_SQRT="inversesqrt";Pe.FLOOR="floor";Pe.CEIL="ceil";Pe.NORMALIZE="normalize";Pe.FRACT="fract";Pe.SIN="sin";Pe.SINH="sinh";Pe.COS="cos";Pe.COSH="cosh";Pe.TAN="tan";Pe.TANH="tanh";Pe.ASIN="asin";Pe.ASINH="asinh";Pe.ACOS="acos";Pe.ACOSH="acosh";Pe.ATAN="atan";Pe.ATANH="atanh";Pe.ABS="abs";Pe.SIGN="sign";Pe.LENGTH="length";Pe.NEGATE="negate";Pe.ONE_MINUS="oneMinus";Pe.DFDX="dFdx";Pe.DFDY="dFdy";Pe.ROUND="round";Pe.RECIPROCAL="reciprocal";Pe.TRUNC="trunc";Pe.FWIDTH="fwidth";Pe.TRANSPOSE="transpose";Pe.DETERMINANT="determinant";Pe.INVERSE="inverse";Pe.EQUALS="equals";Pe.MIN="min";Pe.MAX="max";Pe.STEP="step";Pe.REFLECT="reflect";Pe.DISTANCE="distance";Pe.DIFFERENCE="difference";Pe.DOT="dot";Pe.CROSS="cross";Pe.POW="pow";Pe.TRANSFORM_DIRECTION="transformDirection";Pe.MIX="mix";Pe.CLAMP="clamp";Pe.REFRACT="refract";Pe.SMOOTHSTEP="smoothstep";Pe.FACEFORWARD="faceforward";var bP=oe(1e-6),tEe=oe(1e6),f4=oe(Math.PI),nEe=oe(Math.PI*2),iEe=oe(Math.PI*2),rEe=oe(Math.PI*.5),Gne=ct(Pe,Pe.ALL).setParameterLength(1),qne=ct(Pe,Pe.ANY).setParameterLength(1),Hne=ct(Pe,Pe.RADIANS).setParameterLength(1),Wne=ct(Pe,Pe.DEGREES).setParameterLength(1),Tz=ct(Pe,Pe.EXP).setParameterLength(1),fx=ct(Pe,Pe.EXP2).setParameterLength(1),wP=ct(Pe,Pe.LOG).setParameterLength(1),Af=ct(Pe,Pe.LOG2).setParameterLength(1),el=ct(Pe,Pe.SQRT).setParameterLength(1),Ez=ct(Pe,Pe.INVERSE_SQRT).setParameterLength(1),gf=ct(Pe,Pe.FLOOR).setParameterLength(1),SP=ct(Pe,Pe.CEIL).setParameterLength(1),ya=ct(Pe,Pe.NORMALIZE).setParameterLength(1),$u=ct(Pe,Pe.FRACT).setParameterLength(1),Ka=ct(Pe,Pe.SIN).setParameterLength(1),jne=ct(Pe,Pe.SINH).setParameterLength(1),Hu=ct(Pe,Pe.COS).setParameterLength(1),Xne=ct(Pe,Pe.COSH).setParameterLength(1),$ne=ct(Pe,Pe.TAN).setParameterLength(1),Yne=ct(Pe,Pe.TANH).setParameterLength(1),Zne=ct(Pe,Pe.ASIN).setParameterLength(1),Kne=ct(Pe,Pe.ASINH).setParameterLength(1),Mz=ct(Pe,Pe.ACOS).setParameterLength(1),Qne=ct(Pe,Pe.ACOSH).setParameterLength(1),Cz=ct(Pe,Pe.ATAN).setParameterLength(1,2),Jne=ct(Pe,Pe.ATANH).setParameterLength(1),fr=ct(Pe,Pe.ABS).setParameterLength(1),Rz=ct(Pe,Pe.SIGN).setParameterLength(1),vf=ct(Pe,Pe.LENGTH).setParameterLength(1),Pz=ct(Pe,Pe.NEGATE).setParameterLength(1),eie=ct(Pe,Pe.ONE_MINUS).setParameterLength(1),Iz=ct(Pe,Pe.DFDX).setParameterLength(1),Lz=ct(Pe,Pe.DFDY).setParameterLength(1),tie=ct(Pe,Pe.ROUND).setParameterLength(1),nie=ct(Pe,Pe.RECIPROCAL).setParameterLength(1),Dz=ct(Pe,Pe.TRUNC).setParameterLength(1),Nz=ct(Pe,Pe.FWIDTH).setParameterLength(1),iie=ct(Pe,Pe.TRANSPOSE).setParameterLength(1),rie=ct(Pe,Pe.DETERMINANT).setParameterLength(1),sie=ct(Pe,Pe.INVERSE).setParameterLength(1),Pl=ct(Pe,Pe.MIN).setParameterLength(2,1/0),zr=ct(Pe,Pe.MAX).setParameterLength(2,1/0),Jg=ct(Pe,Pe.STEP).setParameterLength(2),oie=ct(Pe,Pe.REFLECT).setParameterLength(2),aie=ct(Pe,Pe.DISTANCE).setParameterLength(2),lie=ct(Pe,Pe.DIFFERENCE).setParameterLength(2),ru=ct(Pe,Pe.DOT).setParameterLength(2),Kd=ct(Pe,Pe.CROSS).setParameterLength(2),eu=ct(Pe,Pe.POW).setParameterLength(2),Fz=i=>Tn(i,i),cie=i=>Tn(i,i,i),Bz=i=>Tn(i,i,i,i),uie=ct(Pe,Pe.TRANSFORM_DIRECTION).setParameterLength(2),hie=(i,e)=>ya(Tn(e,Ft(pe(i),0)).xyz),fie=(i,e)=>ya(Ft(pe(i),0).mul(e).xyz),die=i=>Tn(Rz(i),eu(fr(i),1/3)),Oz=i=>ru(i,i),Qn=ct(Pe,Pe.MIX).setParameterLength(3),Yu=(i,e=0,t=1)=>new Pe(Pe.CLAMP,Ht(i),Ht(e),Ht(t)),TP=i=>Yu(i),Uz=ct(Pe,Pe.REFRACT).setParameterLength(3),mc=ct(Pe,Pe.SMOOTHSTEP).setParameterLength(3),kz=ct(Pe,Pe.FACEFORWARD).setParameterLength(3),pie=me(([i])=>{let n=43758.5453,r=ru(i.xy,dt(12.9898,78.233)),s=yP(r,f4);return $u(Ka(s).mul(n))}),mie=(i,e,t)=>Qn(e,t,i),Aie=(i,e,t)=>mc(e,t,i),gie=(i,e)=>Jg(e,i),sEe=kz,oEe=Ez;Ue("all",Gne);Ue("any",qne);Ue("radians",Hne);Ue("degrees",Wne);Ue("exp",Tz);Ue("exp2",fx);Ue("log",wP);Ue("log2",Af);Ue("sqrt",el);Ue("inverseSqrt",Ez);Ue("floor",gf);Ue("ceil",SP);Ue("normalize",ya);Ue("fract",$u);Ue("sin",Ka);Ue("sinh",jne);Ue("cos",Hu);Ue("cosh",Xne);Ue("tan",$ne);Ue("tanh",Yne);Ue("asin",Zne);Ue("asinh",Kne);Ue("acos",Mz);Ue("acosh",Qne);Ue("atan",Cz);Ue("atanh",Jne);Ue("abs",fr);Ue("sign",Rz);Ue("length",vf);Ue("lengthSq",Oz);Ue("negate",Pz);Ue("oneMinus",eie);Ue("dFdx",Iz);Ue("dFdy",Lz);Ue("round",tie);Ue("reciprocal",nie);Ue("trunc",Dz);Ue("fwidth",Nz);Ue("min",Pl);Ue("max",zr);Ue("step",gie);Ue("reflect",oie);Ue("distance",aie);Ue("dot",ru);Ue("cross",Kd);Ue("pow",eu);Ue("pow2",Fz);Ue("pow3",cie);Ue("pow4",Bz);Ue("transformDirection",uie);Ue("transformNormalByViewMatrix",hie);Ue("transformNormalByInverseViewMatrix",fie);Ue("mix",mie);Ue("clamp",Yu);Ue("refract",Uz);Ue("smoothstep",Aie);Ue("faceForward",kz);Ue("difference",lie);Ue("saturate",TP);Ue("cbrt",die);Ue("transpose",iie);Ue("determinant",rie);Ue("inverse",sie);Ue("rand",pie);var BU=class extends Kt{static get type(){return"ConditionalNode"}constructor(e,t,n=null){super(),this.condNode=e,this.ifNode=t,this.elseNode=n}generateNodeType(e){let{ifNode:t,elseNode:n}=e.getNodeProperties(this);if(t===void 0)return e.flowBuildStage(this,"setup"),this.getNodeType(e);let r=t.getNodeType(e);if(n!==null){let s=n.getNodeType(e);if(e.getTypeLength(s)>e.getTypeLength(r))return s}return r}setup(e){let t=this.condNode,n=this.ifNode.isolate(),r=this.elseNode?this.elseNode.isolate():null,s=e.context.nodeBlock;e.getDataFromNode(n).parentNodeBlock=s,r!==null&&(e.getDataFromNode(r).parentNodeBlock=s);let o=e.context.uniformFlow,a=e.getNodeProperties(this);a.condNode=t,a.ifNode=o?n:n.context({nodeBlock:n}),a.elseNode=r?o?r:r.context({nodeBlock:r}):null}generate(e,t){let n=this.getNodeType(e),r=e.getDataFromNode(this);if(r.nodeProperty!==void 0)return r.nodeProperty;let{condNode:s,ifNode:o,elseNode:a}=e.getNodeProperties(this),l=e.currentFunctionNode,c=t!=="void",u=c?Jd(n).build(e):"";r.nodeProperty=u;let f=s.build(e,"bool");if(e.context.uniformFlow&&a!==null){let y=o.build(e,n),w=a.build(e,n),S=e.getTernary(f,y,w);return e.format(S,n,t)}e.addFlowCode(`41344134 ${e.tab}if ( ${f} ) {41354135 41364136 `).addFlowTab();let A=o.build(e,n);if(A&&(c?A=u+" = "+A+";":(A="return "+A+";",l===null&&(Xe("TSL: Return statement used in an inline 'Fn()'. Define a layout struct to allow return values.",this.stackTrace),A="// "+A))),e.removeFlowTab().addFlowCode(e.tab+" "+A+`@@ -4143,30 +4143,30 @@ ${e.tab}if ( ${f} ) {
41434143 41444144 `)}else e.addFlowCode(`41454145 4146-`);return e.format(u,n,t)}},_a=$n(mU).setParameterLength(2,3);Ue("select",_a);var lS=class extends Kt{static get type(){return"ContextNode"}constructor(e=null,t={}){super(),this.isContextNode=!0,this.node=e,this.value=t}getScope(){return this.node.getScope()}generateNodeType(e){return this.node.getNodeType(e)}getFlowContextData(){let e=[];return this.traverse(t=>{t.isContextNode===!0&&e.push(t.value)}),Object.assign({},...e)}getMemberType(e,t){return this.node.getMemberType(e,t)}analyze(e){let t=e.addContext(this.value);this.node.build(e),e.setContext(t)}setup(e){let t=e.addContext(this.value);this.node.build(e),e.setContext(t)}generate(e,t){let n=e.addContext(this.value),r=this.node.build(e,t);return e.setContext(n),r}},Kd=(i=null,e={})=>{let t=i;return(t===null||t.isNode!==!0)&&(e=t||e,t=null),new lS(t,e)},Xne=i=>Kd(i,{uniformFlow:!0}),_z=(i,e)=>Kd(i,{nodeName:e});function $ne(i,e,t=null){return Kd(t,{getShadow:({light:n,shadowColorNode:r})=>e===n?r.mul(i):r})}function Yne(i,e=null){return Kd(e,{getAO:(t,{material:n})=>n.transparent===!0?t:t!==null?t.mul(i):i})}function Zne(i,e){return Xe('TSL: "label()" has been deprecated. Use "setName()" instead.'),_z(i,e)}Ue("context",Kd);Ue("label",Zne);Ue("uniformFlow",Xne);Ue("setName",_z);Ue("builtinShadowContext",(i,e,t)=>$ne(e,t,i));Ue("builtinAOContext",(i,e)=>Yne(e,i));var tx=class extends Kt{static get type(){return"VarNode"}constructor(e,t=null,n=!1){super(),this.node=e,this.name=t,this.global=!0,this.isVarNode=!0,this.readOnly=n,this.parents=!0,this.intent=!1}setIntent(e){return this.intent=e,this}isIntent(e){return e.getDataFromNode(this).forceDeclaration===!0?!1:this.intent}getIntent(){return this.intent}getMemberType(e,t){return this.node.getMemberType(e,t)}getElementType(e){return this.node.getElementType(e)}generateNodeType(e){return this.node.getNodeType(e)}getArrayCount(e){return this.node.getArrayCount(e)}isAssign(e){return e.getDataFromNode(this).assign}build(...e){let t=e[0],n=this.getShared(t);if(this!==n)return n.build(...e);if(this._hasStack(t)===!1&&t.buildStage==="setup"&&(t.context.nodeLoop||t.context.nodeBlock)){let r=!1;if(this.node.isShaderCallNodeInternal&&this.node.shaderNode.getLayout()===null&&t.fnCall&&t.fnCall.shaderNode&&t.getDataFromNode(this.node.shaderNode).hasLoop){let a=t.getDataFromNode(this);a.forceDeclaration=!0,r=!0}let s=t.getBaseStack();r?s.addToStackBefore(this):s.addToStack(this)}return this.isIntent(t)&&this.isAssign(t)!==!0?this.node.build(...e):super.build(...e)}generate(e){let{node:t,name:n,readOnly:r}=this,{renderer:s}=e,o=s.backend.isWebGPUBackend===!0,a=!1,l=!1;r&&(a=e.isDeterministic(t),l=o?r:a);let c=this.getNodeType(e);if(c=="void")return this.isIntent(e)!==!0&&ze('TSL: ".toVar()" can not be used with void type.',this.stackTrace),t.build(e);let u=e.getVectorType(c),f=t.build(e,u),d=e.getVarFromNode(this,n,u,void 0,l),A=e.getPropertyName(d),y=A;if(l)if(o)y=a?`const ${A}`:`let ${A}`;else{let w=t.getArrayCount(e);y=`const ${e.getVar(d.type,A,w)}`}return e.addLineFlowCode(`${y} = ${f}`,this),A}_hasStack(e){return e.getDataFromNode(this).stack!==void 0}},xz=$n(tx),Kne=(i,e=null)=>xz(i,e).toStack(),Qne=(i,e=null)=>xz(i,e,!0).toStack(),Jne=i=>xz(i).setIntent(!0).toStack();Ue("toVar",Kne);Ue("toConst",Qne);Ue("toVarIntent",Jne);var AU=class extends Kt{static get type(){return"SubBuild"}constructor(e,t,n=null){super(n),this.node=e,this.name=t,this.isSubBuildNode=!0}generateNodeType(e){if(this.nodeType!==null)return this.nodeType;e.addSubBuild(this.name);let t=this.node.getNodeType(e);return e.removeSubBuild(),t}build(e,...t){e.addSubBuild(this.name);let n=this.node.build(e,...t);return e.removeSubBuild(),n}},qg=(i,e,t=null)=>new AU(Ht(i),e,t),gU=class extends Kt{static get type(){return"VaryingNode"}constructor(e,t=null){super(),this.node=qg(e,"VERTEX"),this.name=t,this.isVaryingNode=!0,this.interpolationType=null,this.interpolationSampling=null,this.global=!0}setInterpolation(e,t=null){return this.interpolationType=e,this.interpolationSampling=t,this}getHash(e){return this.name||super.getHash(e)}generateNodeType(e){return this.node.getNodeType(e)}setupVarying(e){let t=e.getNodeProperties(this),n=t.varying;if(n===void 0){let r=this.name,s=this.getNodeType(e),o=this.interpolationType,a=this.interpolationSampling;t.varying=n=e.getVaryingFromNode(this,r,s,o,a),t.node=qg(this.node,"VERTEX")}return n.needsInterpolation||(n.needsInterpolation=e.shaderStage==="fragment"),n}setup(e){this.setupVarying(e),e.flowNodeFromShaderStage($_.VERTEX,this.node)}analyze(e){this.setupVarying(e),e.flowNodeFromShaderStage($_.VERTEX,this.node)}generate(e){let t=e.getSubBuildProperty("property",e.currentStack),n=e.getNodeProperties(this),r=this.setupVarying(e);if(n[t]===void 0){let s=this.getNodeType(e),o=e.getPropertyName(r,$_.VERTEX);if(e.shaderStage===$_.VERTEX){let a=n.node.build(e,s);e.addLineFlowCode(`${o} = ${a}`,this)}else e.flowNodeFromShaderStage($_.VERTEX,n.node,s,o);n[t]=o}return e.getPropertyName(r)}},gm=$n(gU).setParameterLength(1,2),eie=i=>gm(i);Ue("toVarying",gm);Ue("toVertexStage",eie);var tie=me(([i])=>{let e=i.mul(.9478672986).add(.0521327014).pow(2.4),t=i.mul(.0773993808),n=i.lessThanEqual(.04045);return Qn(e,t,n)}).setLayout({name:"sRGBTransferEOTF",type:"vec3",inputs:[{name:"color",type:"vec3"}]}),nie=me(([i])=>{let e=i.pow(.41666).mul(1.055).sub(.055),t=i.mul(12.92),n=i.lessThanEqual(.0031308);return Qn(e,t,n)}).setLayout({name:"sRGBTransferOETF",type:"vec3",inputs:[{name:"color",type:"vec3"}]}),yz="WorkingColorSpace",ETe="OutputColorSpace",cS=class extends Cr{static get type(){return"ColorSpaceNode"}constructor(e,t,n){super("vec4"),this.colorNode=e,this.source=t,this.target=n}resolveColorSpace(e,t){return t===yz?ln.workingColorSpace:t===ETe?e.context.outputColorSpace||e.renderer.outputColorSpace:t}setup(e){let{colorNode:t}=this,n=this.resolveColorSpace(e,this.source),r=this.resolveColorSpace(e,this.target),s=t;return ln.enabled===!1||n===r||!n||!r||(ln.getTransfer(n)===kt&&(s=Ft(tie(s.rgb),s.a)),ln.getPrimaries(n)!==ln.getPrimaries(r)&&(s=Ft(To(ln._getMatrix(new Mn,n,r)).mul(s.rgb),s.a)),ln.getTransfer(r)===kt&&(s=Ft(nie(s.rgb),s.a))),s}},iie=(i,e)=>new cS(Ht(i),yz,e),vI=(i,e)=>new cS(Ht(i),e,yz),MTe=(i,e,t)=>new cS(Ht(i),e,t);Ue("workingToColorSpace",iie);Ue("colorSpaceToWorking",vI);var CTe=class extends Xd{static get type(){return"ReferenceElementNode"}constructor(e,t){super(e,t),this.referenceNode=e,this.isReferenceElementNode=!0}generateNodeType(){return this.referenceNode.uniformType}generate(e){let t=super.generate(e),n=this.referenceNode.getNodeType(),r=this.getNodeType();return e.format(t,n,r)}},s4=class extends Kt{static get type(){return"ReferenceBaseNode"}constructor(e,t,n=null,r=null){super(),this.property=e,this.uniformType=t,this.object=n,this.count=r,this.properties=e.split("."),this.reference=n,this.node=null,this.group=null,this.updateType=yn.OBJECT}setGroup(e){return this.group=e,this}element(e){return new CTe(this,Ht(e))}setNodeType(e){let t=Xt(null,e);this.group!==null&&t.setGroup(this.group),this.node=t}generateNodeType(e){return this.node===null&&(this.updateReference(e),this.updateValue()),this.node.getNodeType(e)}getValueFromReference(e=this.reference){let{properties:t}=this,n=e[t[0]];for(let r=1;r<t.length;r++)n=n[t[r]];return n}updateReference(e){return this.reference=this.object!==null?this.object:e.object,this.reference}setup(){return this.updateValue(),this.node}update(){this.updateValue()}updateValue(){this.node===null&&this.setNodeType(this.uniformType);let e=this.getValueFromReference();Array.isArray(e)?this.node.array=e:this.node.value=e}},RTe=(i,e,t)=>new s4(i,e,t),vU=class extends s4{static get type(){return"RendererReferenceNode"}constructor(e,t,n=null){super(e,t,n),this.renderer=n,this.setGroup(Jt)}updateReference(e){return this.reference=this.renderer!==null?this.renderer:e.renderer,this.reference}},rie=(i,e,t=null)=>new vU(i,e,t),_U=class extends Cr{static get type(){return"ToneMappingNode"}constructor(e,t=oie,n=null){super("vec3"),this._toneMapping=e,this.exposureNode=t,this.colorNode=n}customCacheKey(){return Zw(this._toneMapping)}setToneMapping(e){return this._toneMapping=e,this}getToneMapping(){return this._toneMapping}setup(e){let t=this.colorNode||e.context.color,n=this._toneMapping;if(n===ao)return t;let r=null,s=e.renderer.library.getToneMappingFunction(n);return s!==null?r=Ft(s(t.rgb,this.exposureNode),t.a):(ze("ToneMappingNode: Unsupported Tone Mapping configuration.",n),r=t),r}},sie=(i,e,t)=>new _U(i,Ht(e),Ht(t)),oie=rie("toneMappingExposure","float");Ue("toneMapping",(i,e,t)=>sie(e,t,i));var Aee=new WeakMap;function gee(i,e){let t=Aee.get(i);return t===void 0&&(t=new Ed(i,e),Aee.set(i,t)),t}var df=class extends sS{static get type(){return"BufferAttributeNode"}constructor(e,t=null,n=0,r=0){super(e,t),this.isBufferNode=!0,this.bufferType=t,this.bufferStride=n,this.bufferOffset=r,this.usage=Jp,this.instanced=!1,this.attribute=null,this.global=!0,e&&e.isBufferAttribute===!0&&e.itemSize<=4&&(this.attribute=e,this.usage=e.usage,this.instanced=e.isInstancedBufferAttribute)}getHash(e){let t;if(this.bufferStride===0&&this.bufferOffset===0){let n=e.globalCache.getData(this.value);n===void 0&&(n={node:this},e.globalCache.setData(this.value,n)),t=n.node.id}else t=this.id;return String(t)}generateNodeType(e){return this.bufferType===null&&(this.bufferType=e.getTypeFromAttribute(this.attribute)),this.bufferType}setup(e){if(this.attribute!==null)return;let t=this.getNodeType(e),n=e.getTypeLength(t),r=this.value,s=this.bufferStride||n,o=this.bufferOffset,a;r.isInterleavedBuffer===!0?a=r:r.isBufferAttribute===!0?a=gee(r.array,s):a=gee(r,s);let l=new zo(a,n,o);a.setUsage(this.usage),this.attribute=l,this.attribute.isInstancedBufferAttribute=this.instanced}generate(e){let t=this.getNodeType(e),n=e.context.nodeName;n!==void 0&&delete e.context.nodeName;let r=e.getBufferAttributeFromNode(this,t,n),s=e.getPropertyName(r),o=null;if(e.shaderStage==="vertex"||e.shaderStage==="compute")this.name=s,o=s;else{let a;n&&(a=n+"Varying"),o=gm(this,a).build(e,t)}return o}getInputType(){return"bufferAttribute"}setUsage(e){return this.usage=e,this.attribute&&this.attribute.isBufferAttribute===!0&&(this.attribute.usage=e),this}setInstanced(e){return this.instanced=e,this}};function _I(i,e=null,t=0,n=0,r=Jp,s=!1){return e==="mat3"||e===null&&i.itemSize===9?To(new df(i,"vec3",9,0).setUsage(r).setInstanced(s),new df(i,"vec3",9,3).setUsage(r).setInstanced(s),new df(i,"vec3",9,6).setUsage(r).setInstanced(s)):e==="mat4"||e===null&&i.itemSize===16?um(new df(i,"vec4",16,0).setUsage(r).setInstanced(s),new df(i,"vec4",16,4).setUsage(r).setInstanced(s),new df(i,"vec4",16,8).setUsage(r).setInstanced(s),new df(i,"vec4",16,12).setUsage(r).setInstanced(s)):new df(i,e,t,n).setUsage(r)}var bz=(i,e=null,t=0,n=0)=>_I(i,e,t,n),ITe=(i,e=null,t=0,n=0)=>_I(i,e,t,n,og),xI=(i,e=null,t=0,n=0)=>_I(i,e,t,n,Jp,!0),wz=(i,e=null,t=0,n=0)=>_I(i,e,t,n,og,!0);Ue("toAttribute",i=>bz(i.value));var Ys=class i extends Kt{static get type(){return"IndexNode"}constructor(e){super("uint"),this.scope=e,this.isIndexNode=!0}generate(e){let t=this.getNodeType(e),n=this.scope,r;if(n===i.VERTEX)r=e.getVertexIndex();else if(n===i.INSTANCE)r=e.getInstanceIndex();else if(n===i.DRAW)r=e.getDrawIndex();else if(n===i.INVOCATION_LOCAL)r=e.getInvocationLocalIndex();else if(n===i.INVOCATION_SUBGROUP)r=e.getInvocationSubgroupIndex();else if(n===i.SUBGROUP)r=e.getSubgroupIndex();else throw new Error("THREE.IndexNode: Unknown scope: "+n);let s;return e.shaderStage==="vertex"||e.shaderStage==="compute"?s=r:s=gm(this).build(e,t),s}};Ys.VERTEX="vertex";Ys.INSTANCE="instance";Ys.SUBGROUP="subgroup";Ys.INVOCATION_LOCAL="invocationLocal";Ys.INVOCATION_SUBGROUP="invocationSubgroup";Ys.DRAW="draw";var aie=xt(Ys,Ys.VERTEX),Xu=xt(Ys,Ys.INSTANCE),PTe=xt(Ys,Ys.SUBGROUP),LTe=xt(Ys,Ys.INVOCATION_SUBGROUP),DTe=xt(Ys,Ys.INVOCATION_LOCAL),lie=xt(Ys,Ys.DRAW),xU=class extends Kt{static get type(){return"ComputeNode"}constructor(e,t){super("void"),this.isComputeNode=!0,this.computeNode=e,this.workgroupSize=t,this.count=null,this.dispatchSize=null,this.version=1,this.name="",this.updateBeforeType=yn.OBJECT,this.onInitFunction=null,this.countNode=null}dispose(){this.dispatchEvent({type:"dispose"})}setName(e){return this.name=e,this}label(e){return Xe('TSL: "label()" has been deprecated. Use "setName()" instead.',new es),this.setName(e)}onInit(e){return this.onInitFunction=e,this}updateBefore({renderer:e}){e.compute(this)}setup(e){this.count!==null&&this.countNode===null&&(this.countNode=Xt(this.count,"uint").onObjectUpdate(()=>this.count));let t=this.computeNode.build(e);if(t){let n=e.getNodeProperties(this);n.outputComputeNode=t.outputNode,t.outputNode=null}return t}generate(e,t){let{shaderStage:n}=e;if(n==="compute"){let r=this.computeNode.build(e,"void");if(r!==""&&e.addLineFlowCode(r,this),this.count!==null&&e.allowEarlyReturns===!0){let s=this.countNode.build(e,"uint"),o=Xu.build(e,"uint");e.flow.code=`${e.tab}if ( ${o} >= ${s} ) { return; }4146+`);return e.format(u,n,t)}},xa=$n(BU).setParameterLength(2,3);Ue("select",xa);var pS=class extends Kt{static get type(){return"ContextNode"}constructor(e=null,t={}){super(),this.isContextNode=!0,this.node=e,this.value=t}getScope(){return this.node.getScope()}generateNodeType(e){return this.node.getNodeType(e)}getFlowContextData(){let e=[];return this.traverse(t=>{t.isContextNode===!0&&e.push(t.value)}),Object.assign({},...e)}getMemberType(e,t){return this.node.getMemberType(e,t)}analyze(e){let t=e.addContext(this.value);this.node.build(e),e.setContext(t)}setup(e){let t=e.addContext(this.value);this.node.build(e),e.setContext(t)}generate(e,t){let n=e.addContext(this.value),r=this.node.build(e,t);return e.setContext(n),r}},ep=(i=null,e={})=>{let t=i;return(t===null||t.isNode!==!0)&&(e=t||e,t=null),new pS(t,e)},vie=i=>ep(i,{uniformFlow:!0}),zz=(i,e)=>ep(i,{nodeName:e});function _ie(i,e,t=null){return ep(t,{getShadow:({light:n,shadowColorNode:r})=>e===n?r.mul(i):r})}function xie(i,e=null){return ep(e,{getAO:(t,{material:n})=>n.transparent===!0?t:t!==null?t.mul(i):i})}function yie(i,e){return Xe('TSL: "label()" has been deprecated. Use "setName()" instead.'),zz(i,e)}Ue("context",ep);Ue("label",yie);Ue("uniformFlow",vie);Ue("setName",zz);Ue("builtinShadowContext",(i,e,t)=>_ie(e,t,i));Ue("builtinAOContext",(i,e)=>xie(e,i));var ax=class extends Kt{static get type(){return"VarNode"}constructor(e,t=null,n=!1){super(),this.node=e,this.name=t,this.global=!0,this.isVarNode=!0,this.readOnly=n,this.parents=!0,this.intent=!1}setIntent(e){return this.intent=e,this}isIntent(e){return e.getDataFromNode(this).forceDeclaration===!0?!1:this.intent}getIntent(){return this.intent}getMemberType(e,t){return this.node.getMemberType(e,t)}getElementType(e){return this.node.getElementType(e)}generateNodeType(e){return this.node.getNodeType(e)}getArrayCount(e){return this.node.getArrayCount(e)}isAssign(e){return e.getDataFromNode(this).assign}build(...e){let t=e[0],n=this.getShared(t);if(this!==n)return n.build(...e);if(this._hasStack(t)===!1&&t.buildStage==="setup"&&(t.context.nodeLoop||t.context.nodeBlock)){let r=!1;if(this.node.isShaderCallNodeInternal&&this.node.shaderNode.getLayout()===null&&t.fnCall&&t.fnCall.shaderNode&&t.getDataFromNode(this.node.shaderNode).hasLoop){let a=t.getDataFromNode(this);a.forceDeclaration=!0,r=!0}let s=t.getBaseStack();r?s.addToStackBefore(this):s.addToStack(this)}return this.isIntent(t)&&this.isAssign(t)!==!0?this.node.build(...e):super.build(...e)}generate(e){let{node:t,name:n,readOnly:r}=this,{renderer:s}=e,o=s.backend.isWebGPUBackend===!0,a=!1,l=!1;r&&(a=e.isDeterministic(t),l=o?r:a);let c=this.getNodeType(e);if(c=="void")return this.isIntent(e)!==!0&&ze('TSL: ".toVar()" can not be used with void type.',this.stackTrace),t.build(e);let u=e.getVectorType(c),f=t.build(e,u),d=e.getVarFromNode(this,n,u,void 0,l),A=e.getPropertyName(d),y=A;if(l)if(o)y=a?`const ${A}`:`let ${A}`;else{let w=t.getArrayCount(e);y=`const ${e.getVar(d.type,A,w)}`}return e.addLineFlowCode(`${y} = ${f}`,this),A}_hasStack(e){return e.getDataFromNode(this).stack!==void 0}},Vz=$n(ax),bie=(i,e=null)=>Vz(i,e).toStack(),wie=(i,e=null)=>Vz(i,e,!0).toStack(),Sie=i=>Vz(i).setIntent(!0).toStack();Ue("toVar",bie);Ue("toConst",wie);Ue("toVarIntent",Sie);var OU=class extends Kt{static get type(){return"SubBuild"}constructor(e,t,n=null){super(n),this.node=e,this.name=t,this.isSubBuildNode=!0}generateNodeType(e){if(this.nodeType!==null)return this.nodeType;e.addSubBuild(this.name);let t=this.node.getNodeType(e);return e.removeSubBuild(),t}build(e,...t){e.addSubBuild(this.name);let n=this.node.build(e,...t);return e.removeSubBuild(),n}},$g=(i,e,t=null)=>new OU(Ht(i),e,t),UU=class extends Kt{static get type(){return"VaryingNode"}constructor(e,t=null){super(),this.node=$g(e,"VERTEX"),this.name=t,this.isVaryingNode=!0,this.interpolationType=null,this.interpolationSampling=null,this.global=!0}setInterpolation(e,t=null){return this.interpolationType=e,this.interpolationSampling=t,this}getHash(e){return this.name||super.getHash(e)}generateNodeType(e){return this.node.getNodeType(e)}setupVarying(e){let t=e.getNodeProperties(this),n=t.varying;if(n===void 0){let r=this.name,s=this.getNodeType(e),o=this.interpolationType,a=this.interpolationSampling;t.varying=n=e.getVaryingFromNode(this,r,s,o,a),t.node=$g(this.node,"VERTEX")}return n.needsInterpolation||(n.needsInterpolation=e.shaderStage==="fragment"),n}setup(e){this.setupVarying(e),e.flowNodeFromShaderStage(ex.VERTEX,this.node)}analyze(e){this.setupVarying(e),e.flowNodeFromShaderStage(ex.VERTEX,this.node)}generate(e){let t=e.getSubBuildProperty("property",e.currentStack),n=e.getNodeProperties(this),r=this.setupVarying(e);if(n[t]===void 0){let s=this.getNodeType(e),o=e.getPropertyName(r,ex.VERTEX);if(e.shaderStage===ex.VERTEX){let a=n.node.build(e,s);e.addLineFlowCode(`${o} = ${a}`,this)}else e.flowNodeFromShaderStage(ex.VERTEX,n.node,s,o);n[t]=o}return e.getPropertyName(r)}},ym=$n(UU).setParameterLength(1,2),Tie=i=>ym(i);Ue("toVarying",ym);Ue("toVertexStage",Tie);var Eie=me(([i])=>{let e=i.mul(.9478672986).add(.0521327014).pow(2.4),t=i.mul(.0773993808),n=i.lessThanEqual(.04045);return Qn(e,t,n)}).setLayout({name:"sRGBTransferEOTF",type:"vec3",inputs:[{name:"color",type:"vec3"}]}),Mie=me(([i])=>{let e=i.pow(.41666).mul(1.055).sub(.055),t=i.mul(12.92),n=i.lessThanEqual(.0031308);return Qn(e,t,n)}).setLayout({name:"sRGBTransferOETF",type:"vec3",inputs:[{name:"color",type:"vec3"}]}),Gz="WorkingColorSpace",aEe="OutputColorSpace",mS=class extends Rr{static get type(){return"ColorSpaceNode"}constructor(e,t,n){super("vec4"),this.colorNode=e,this.source=t,this.target=n}resolveColorSpace(e,t){return t===Gz?ln.workingColorSpace:t===aEe?e.context.outputColorSpace||e.renderer.outputColorSpace:t}setup(e){let{colorNode:t}=this,n=this.resolveColorSpace(e,this.source),r=this.resolveColorSpace(e,this.target),s=t;return ln.enabled===!1||n===r||!n||!r||(ln.getTransfer(n)===kt&&(s=Ft(Eie(s.rgb),s.a)),ln.getPrimaries(n)!==ln.getPrimaries(r)&&(s=Ft(To(ln._getMatrix(new Mn,n,r)).mul(s.rgb),s.a)),ln.getTransfer(r)===kt&&(s=Ft(Mie(s.rgb),s.a))),s}},Cie=(i,e)=>new mS(Ht(i),Gz,e),EP=(i,e)=>new mS(Ht(i),e,Gz),lEe=(i,e,t)=>new mS(Ht(i),e,t);Ue("workingToColorSpace",Cie);Ue("colorSpaceToWorking",EP);var cEe=class extends Zd{static get type(){return"ReferenceElementNode"}constructor(e,t){super(e,t),this.referenceNode=e,this.isReferenceElementNode=!0}generateNodeType(){return this.referenceNode.uniformType}generate(e){let t=super.generate(e),n=this.referenceNode.getNodeType(),r=this.getNodeType();return e.format(t,n,r)}},d4=class extends Kt{static get type(){return"ReferenceBaseNode"}constructor(e,t,n=null,r=null){super(),this.property=e,this.uniformType=t,this.object=n,this.count=r,this.properties=e.split("."),this.reference=n,this.node=null,this.group=null,this.updateType=yn.OBJECT}setGroup(e){return this.group=e,this}element(e){return new cEe(this,Ht(e))}setNodeType(e){let t=Xt(null,e);this.group!==null&&t.setGroup(this.group),this.node=t}generateNodeType(e){return this.node===null&&(this.updateReference(e),this.updateValue()),this.node.getNodeType(e)}getValueFromReference(e=this.reference){let{properties:t}=this,n=e[t[0]];for(let r=1;r<t.length;r++)n=n[t[r]];return n}updateReference(e){return this.reference=this.object!==null?this.object:e.object,this.reference}setup(){return this.updateValue(),this.node}update(){this.updateValue()}updateValue(){this.node===null&&this.setNodeType(this.uniformType);let e=this.getValueFromReference();Array.isArray(e)?this.node.array=e:this.node.value=e}},uEe=(i,e,t)=>new d4(i,e,t),kU=class extends d4{static get type(){return"RendererReferenceNode"}constructor(e,t,n=null){super(e,t,n),this.renderer=n,this.setGroup(Jt)}updateReference(e){return this.reference=this.renderer!==null?this.renderer:e.renderer,this.reference}},Rie=(i,e,t=null)=>new kU(i,e,t),zU=class extends Rr{static get type(){return"ToneMappingNode"}constructor(e,t=Iie,n=null){super("vec3"),this._toneMapping=e,this.exposureNode=t,this.colorNode=n}customCacheKey(){return nS(this._toneMapping)}setToneMapping(e){return this._toneMapping=e,this}getToneMapping(){return this._toneMapping}setup(e){let t=this.colorNode||e.context.color,n=this._toneMapping;if(n===ao)return t;let r=null,s=e.renderer.library.getToneMappingFunction(n);return s!==null?r=Ft(s(t.rgb,this.exposureNode),t.a):(ze("ToneMappingNode: Unsupported Tone Mapping configuration.",n),r=t),r}},Pie=(i,e,t)=>new zU(i,Ht(e),Ht(t)),Iie=Rie("toneMappingExposure","float");Ue("toneMapping",(i,e,t)=>Pie(e,t,i));var Vee=new WeakMap;function Gee(i,e){let t=Vee.get(i);return t===void 0&&(t=new Rd(i,e),Vee.set(i,t)),t}var df=class extends hS{static get type(){return"BufferAttributeNode"}constructor(e,t=null,n=0,r=0){super(e,t),this.isBufferNode=!0,this.bufferType=t,this.bufferStride=n,this.bufferOffset=r,this.usage=i0,this.instanced=!1,this.attribute=null,this.global=!0,e&&e.isBufferAttribute===!0&&e.itemSize<=4&&(this.attribute=e,this.usage=e.usage,this.instanced=e.isInstancedBufferAttribute)}getHash(e){let t;if(this.bufferStride===0&&this.bufferOffset===0){let n=e.globalCache.getData(this.value);n===void 0&&(n={node:this},e.globalCache.setData(this.value,n)),t=n.node.id}else t=this.id;return String(t)}generateNodeType(e){return this.bufferType===null&&(this.bufferType=e.getTypeFromAttribute(this.attribute)),this.bufferType}setup(e){if(this.attribute!==null)return;let t=this.getNodeType(e),n=e.getTypeLength(t),r=this.value,s=this.bufferStride||n,o=this.bufferOffset,a;r.isInterleavedBuffer===!0?a=r:r.isBufferAttribute===!0?a=Gee(r.array,s):a=Gee(r,s);let l=new Vo(a,n,o);a.setUsage(this.usage),this.attribute=l,this.attribute.isInstancedBufferAttribute=this.instanced}generate(e){let t=this.getNodeType(e),n=e.context.nodeName;n!==void 0&&delete e.context.nodeName;let r=e.getBufferAttributeFromNode(this,t,n),s=e.getPropertyName(r),o=null;if(e.shaderStage==="vertex"||e.shaderStage==="compute")this.name=s,o=s;else{let a;n&&(a=n+"Varying"),o=ym(this,a).build(e,t)}return o}getInputType(){return"bufferAttribute"}setUsage(e){return this.usage=e,this.attribute&&this.attribute.isBufferAttribute===!0&&(this.attribute.usage=e),this}setInstanced(e){return this.instanced=e,this}};function MP(i,e=null,t=0,n=0,r=i0,s=!1){return e==="mat3"||e===null&&i.itemSize===9?To(new df(i,"vec3",9,0).setUsage(r).setInstanced(s),new df(i,"vec3",9,3).setUsage(r).setInstanced(s),new df(i,"vec3",9,6).setUsage(r).setInstanced(s)):e==="mat4"||e===null&&i.itemSize===16?pm(new df(i,"vec4",16,0).setUsage(r).setInstanced(s),new df(i,"vec4",16,4).setUsage(r).setInstanced(s),new df(i,"vec4",16,8).setUsage(r).setInstanced(s),new df(i,"vec4",16,12).setUsage(r).setInstanced(s)):new df(i,e,t,n).setUsage(r)}var qz=(i,e=null,t=0,n=0)=>MP(i,e,t,n),hEe=(i,e=null,t=0,n=0)=>MP(i,e,t,n,hg),CP=(i,e=null,t=0,n=0)=>MP(i,e,t,n,i0,!0),Hz=(i,e=null,t=0,n=0)=>MP(i,e,t,n,hg,!0);Ue("toAttribute",i=>qz(i.value));var $s=class i extends Kt{static get type(){return"IndexNode"}constructor(e){super("uint"),this.scope=e,this.isIndexNode=!0}generate(e){let t=this.getNodeType(e),n=this.scope,r;if(n===i.VERTEX)r=e.getVertexIndex();else if(n===i.INSTANCE)r=e.getInstanceIndex();else if(n===i.DRAW)r=e.getDrawIndex();else if(n===i.INVOCATION_LOCAL)r=e.getInvocationLocalIndex();else if(n===i.INVOCATION_SUBGROUP)r=e.getInvocationSubgroupIndex();else if(n===i.SUBGROUP)r=e.getSubgroupIndex();else throw new Error("THREE.IndexNode: Unknown scope: "+n);let s;return e.shaderStage==="vertex"||e.shaderStage==="compute"?s=r:s=ym(this).build(e,t),s}};$s.VERTEX="vertex";$s.INSTANCE="instance";$s.SUBGROUP="subgroup";$s.INVOCATION_LOCAL="invocationLocal";$s.INVOCATION_SUBGROUP="invocationSubgroup";$s.DRAW="draw";var Lie=xt($s,$s.VERTEX),Xu=xt($s,$s.INSTANCE),fEe=xt($s,$s.SUBGROUP),dEe=xt($s,$s.INVOCATION_SUBGROUP),pEe=xt($s,$s.INVOCATION_LOCAL),Die=xt($s,$s.DRAW),VU=class extends Kt{static get type(){return"ComputeNode"}constructor(e,t){super("void"),this.isComputeNode=!0,this.computeNode=e,this.workgroupSize=t,this.count=null,this.dispatchSize=null,this.version=1,this.name="",this.updateBeforeType=yn.OBJECT,this.onInitFunction=null,this.countNode=null}dispose(){this.dispatchEvent({type:"dispose"})}setName(e){return this.name=e,this}label(e){return Xe('TSL: "label()" has been deprecated. Use "setName()" instead.',new ts),this.setName(e)}onInit(e){return this.onInitFunction=e,this}updateBefore({renderer:e}){e.compute(this)}setup(e){this.count!==null&&this.countNode===null&&(this.countNode=Xt(this.count,"uint").onObjectUpdate(()=>this.count));let t=this.computeNode.build(e);if(t){let n=e.getNodeProperties(this);n.outputComputeNode=t.outputNode,t.outputNode=null}return t}generate(e,t){let{shaderStage:n}=e;if(n==="compute"){let r=this.computeNode.build(e,"void");if(r!==""&&e.addLineFlowCode(r,this),this.count!==null&&e.allowEarlyReturns===!0){let s=this.countNode.build(e,"uint"),o=Xu.build(e,"uint");e.flow.code=`${e.tab}if ( ${o} >= ${s} ) { return; }41474147 4148-${e.flow.code}`}}else{let s=e.getNodeProperties(this).outputComputeNode;if(s)return s.build(e,t)}}},Sz=(i,e=[64])=>{(e.length===0||e.length>3)&&ze("TSL: compute() workgroupSize must have 1, 2, or 3 elements",new es);for(let t=0;t<e.length;t++){let n=e[t];(typeof n!="number"||n<=0||!Number.isInteger(n))&&ze(`TSL: compute() workgroupSize element at index [ ${t} ] must be a positive integer`,new es)}for(;e.length<3;)e.push(1);return new xU(Ht(i),e)},cie=(i,e,t)=>{let n=Sz(i,t);return typeof e=="number"?n.count=e:n.dispatchSize=e,n};Ue("compute",cie);Ue("computeKernel",Sz);var yU=class extends Kt{static get type(){return"IsolateNode"}constructor(e,t=!0){super(),this.node=e,this.parent=t,this.isIsolateNode=!0}generateNodeType(e){let t=e.getCache(),n=e.getCacheFromNode(this,this.parent);e.setCache(n);let r=this.node.getNodeType(e);return e.setCache(t),r}build(e,...t){let n=e.getCache(),r=e.getCacheFromNode(this,this.parent);e.setCache(r);let s=this.node.build(e,...t);return e.setCache(n),s}setParent(e){return this.parent=e,this}getParent(){return this.parent}},nx=i=>new yU(Ht(i));function uie(i,e=!0){return Xe('TSL: "cache()" has been deprecated. Use "isolate()" instead.'),nx(i).setParent(e)}Ue("cache",uie);Ue("isolate",nx);var bU=class extends Kt{static get type(){return"BypassNode"}constructor(e,t){super(),this.isBypassNode=!0,this.outputNode=e,this.callNode=t}generateNodeType(e){return this.outputNode.getNodeType(e)}generate(e){let t=this.callNode.build(e,"void");return t!==""&&e.addLineFlowCode(t,this),this.outputNode.build(e)}},hie=$n(bU).setParameterLength(2);Ue("bypass",hie);var Tz=me(([i,e,t,n=oe(0),r=oe(1),s=uc(!1)])=>{let o=i.sub(e).div(t.sub(e));return sx(s)&&(o=o.clamp()),o.mul(r.sub(n)).add(n)});function fie(i,e,t,n=oe(0),r=oe(1)){return Tz(i,e,t,n,r,!0)}Ue("remap",Tz);Ue("remapClamp",fie);var ix=class extends Kt{static get type(){return"ExpressionNode"}constructor(e="",t="void"){super(t),this.snippet=e}generate(e,t){let n=this.getNodeType(e),r=this.snippet;if(n==="void")e.addLineFlowCode(r,this);else return e.format(r,n,t)}},lc=$n(ix).setParameterLength(1,2),die=i=>(i?_a(i,lc("discard")):lc("discard")).toStack(),NTe=()=>lc("return").toStack();Ue("discard",die);var Ez=me(([i])=>Ft(i.rgb.mul(i.a),i.a),{color:"vec4",return:"vec4"}),pie=me(([i])=>i.a.equal(0).select(Ft(0),Ft(i.rgb.div(i.a),i.a)),{color:"vec4",return:"vec4"}),wU=class extends Cr{static get type(){return"RenderOutputNode"}constructor(e,t,n){super("vec4"),this.colorNode=e,this._toneMapping=t,this.outputColorSpace=n,this.isRenderOutputNode=!0}setToneMapping(e){return this._toneMapping=e,this}getToneMapping(){return this._toneMapping}setup({context:e}){let t=this.colorNode||e.color;t=Ft(t.rgb,t.a.clamp(0,1)),t=pie(t);let n=(this._toneMapping!==null?this._toneMapping:e.toneMapping)||ao,r=(this.outputColorSpace!==null?this.outputColorSpace:e.outputColorSpace)||ua;return n!==ao&&(t=t.toneMapping(n)),r!==ua&&r!==ln.workingColorSpace&&(t=t.workingToColorSpace(r)),t=Ez(t),t}},Mz=(i,e=null,t=null)=>new wU(Ht(i),e,t);Ue("renderOutput",Mz);var SU=class extends Cr{static get type(){return"DebugNode"}constructor(e,t=null){super(),this.node=e,this.callback=t}generateNodeType(e){return this.node.getNodeType(e)}setup(e){return this.node.build(e)}analyze(e){return this.node.build(e)}generate(e){let t=this.callback,n=this.node.build(e);if(t!==null)t(e,n);else{let r="--- TSL debug - "+e.shaderStage+" shader ---",s="-".repeat(r.length),o="";o+="// #"+r+`#4148+${e.flow.code}`}}else{let s=e.getNodeProperties(this).outputComputeNode;if(s)return s.build(e,t)}}},Wz=(i,e=[64])=>{(e.length===0||e.length>3)&&ze("TSL: compute() workgroupSize must have 1, 2, or 3 elements",new ts);for(let t=0;t<e.length;t++){let n=e[t];(typeof n!="number"||n<=0||!Number.isInteger(n))&&ze(`TSL: compute() workgroupSize element at index [ ${t} ] must be a positive integer`,new ts)}for(;e.length<3;)e.push(1);return new VU(Ht(i),e)},Nie=(i,e,t)=>{let n=Wz(i,t);return typeof e=="number"?n.count=e:n.dispatchSize=e,n};Ue("compute",Nie);Ue("computeKernel",Wz);var GU=class extends Kt{static get type(){return"IsolateNode"}constructor(e,t=!0){super(),this.node=e,this.parent=t,this.isIsolateNode=!0}generateNodeType(e){let t=e.getCache(),n=e.getCacheFromNode(this,this.parent);e.setCache(n);let r=this.node.getNodeType(e);return e.setCache(t),r}build(e,...t){let n=e.getCache(),r=e.getCacheFromNode(this,this.parent);e.setCache(r);let s=this.node.build(e,...t);return e.setCache(n),s}setParent(e){return this.parent=e,this}getParent(){return this.parent}},lx=i=>new GU(Ht(i));function Fie(i,e=!0){return Xe('TSL: "cache()" has been deprecated. Use "isolate()" instead.'),lx(i).setParent(e)}Ue("cache",Fie);Ue("isolate",lx);var qU=class extends Kt{static get type(){return"BypassNode"}constructor(e,t){super(),this.isBypassNode=!0,this.outputNode=e,this.callNode=t}generateNodeType(e){return this.outputNode.getNodeType(e)}generate(e){let t=this.callNode.build(e,"void");return t!==""&&e.addLineFlowCode(t,this),this.outputNode.build(e)}},Bie=$n(qU).setParameterLength(2);Ue("bypass",Bie);var jz=me(([i,e,t,n=oe(0),r=oe(1),s=dc(!1)])=>{let o=i.sub(e).div(t.sub(e));return hx(s)&&(o=o.clamp()),o.mul(r.sub(n)).add(n)});function Oie(i,e,t,n=oe(0),r=oe(1)){return jz(i,e,t,n,r,!0)}Ue("remap",jz);Ue("remapClamp",Oie);var cx=class extends Kt{static get type(){return"ExpressionNode"}constructor(e="",t="void"){super(t),this.snippet=e}generate(e,t){let n=this.getNodeType(e),r=this.snippet;if(n==="void")e.addLineFlowCode(r,this);else return e.format(r,n,t)}},hc=$n(cx).setParameterLength(1,2),Uie=i=>(i?xa(i,hc("discard")):hc("discard")).toStack(),mEe=()=>hc("return").toStack();Ue("discard",Uie);var Xz=me(([i])=>Ft(i.rgb.mul(i.a),i.a),{color:"vec4",return:"vec4"}),kie=me(([i])=>i.a.equal(0).select(Ft(0),Ft(i.rgb.div(i.a),i.a)),{color:"vec4",return:"vec4"}),HU=class extends Rr{static get type(){return"RenderOutputNode"}constructor(e,t,n){super("vec4"),this.colorNode=e,this._toneMapping=t,this.outputColorSpace=n,this.isRenderOutputNode=!0}setToneMapping(e){return this._toneMapping=e,this}getToneMapping(){return this._toneMapping}setup({context:e}){let t=this.colorNode||e.color;t=Ft(t.rgb,t.a.clamp(0,1)),t=kie(t);let n=(this._toneMapping!==null?this._toneMapping:e.toneMapping)||ao,r=(this.outputColorSpace!==null?this.outputColorSpace:e.outputColorSpace)||ha;return n!==ao&&(t=t.toneMapping(n)),r!==ha&&r!==ln.workingColorSpace&&(t=t.workingToColorSpace(r)),t=Xz(t),t}},$z=(i,e=null,t=null)=>new HU(Ht(i),e,t);Ue("renderOutput",$z);var WU=class extends Rr{static get type(){return"DebugNode"}constructor(e,t=null){super(),this.node=e,this.callback=t}generateNodeType(e){return this.node.getNodeType(e)}setup(e){return this.node.build(e)}analyze(e){return this.node.build(e)}generate(e){let t=this.callback,n=this.node.build(e);if(t!==null)t(e,n);else{let r="--- TSL debug - "+e.shaderStage+" shader ---",s="-".repeat(r.length),o="";o+="// #"+r+`#41494149 `,o+=e.flow.code.replace(/^\t/mg,"")+`41504150 `,o+="/* ... */ "+n+` /* ... */41514151 `,o+="// #"+s+`#4152-`,NA(o)}return n}},mie=(i,e=null)=>new SU(Ht(i),e).toStack();Ue("debug",mie);var o4=class extends la{constructor(){super(),this._renderer=null,this.currentFrame=null}get nodeFrame(){return this._renderer._nodes.nodeFrame}setRenderer(e){return this._renderer=e,this}getRenderer(){return this._renderer}init(){}begin(){}finish(){}inspect(){}computeAsync(){}beginCompute(){}finishCompute(){}beginRender(){}finishRender(){}copyTextureToTexture(){}copyFramebufferToTexture(){}},TU=class extends Kt{static get type(){return"InspectorNode"}constructor(e,t="",n=null){super(),this.node=e,this.name=t,this.callback=n,this.updateType=yn.FRAME,this.isInspectorNode=!0}getName(){return this.name||this.node.name}update(e){e.renderer.inspector.inspect(this)}generateNodeType(e){return this.node.getNodeType(e)}setup(e){let t=this.node;return e.context.inspector===!0&&this.callback!==null&&(t=this.callback(t)),e.renderer.backend.isWebGPUBackend!==!0&&e.renderer.inspector.constructor!==o4&&ni('TSL: ".toInspector()" is only available with WebGPU.'),t}};function Aie(i,e="",t=null){return i=Ht(i),i.before(new TU(i,e,t))}Ue("toInspector",Aie);function FTe(i){Xe("TSL: AddNodeElement has been removed in favor of tree-shaking. Trying add",i)}var a4=class extends Kt{static get type(){return"AttributeNode"}constructor(e,t=null){super(t),this.global=!0,this._attributeName=e}getHash(e){return this.getAttributeName(e)}generateNodeType(e){let t=this.nodeType;if(t===null){let n=this.getAttributeName(e);if(e.hasGeometryAttribute(n)){let r=e.geometry.getAttribute(n);t=e.getTypeFromAttribute(r)}else t="float"}return t}setAttributeName(e){return this._attributeName=e,this}getAttributeName(){return this._attributeName}generate(e){let t=this.getAttributeName(e),n=this.getNodeType(e);if(e.hasGeometryAttribute(t)===!0){let s=e.geometry.getAttribute(t),o=e.getTypeFromAttribute(s),a=e.getAttribute(t,o);return e.shaderStage==="vertex"?e.format(a.name,o,n):gm(this).build(e,n)}else return Xe(`AttributeNode: Vertex attribute "${t}" not found on geometry.`),e.generateConst(n)}serialize(e){super.serialize(e),e.global=this.global,e._attributeName=this._attributeName}deserialize(e){super.deserialize(e),this.global=e.global,this._attributeName=e._attributeName}},cc=(i,e=null)=>new a4(i,e),Ui=(i=0)=>cc("uv"+(i>0?i:""),"vec2"),EU=class extends Kt{static get type(){return"TextureSizeNode"}constructor(e,t=null){super("uvec2"),this.isTextureSizeNode=!0,this.textureNode=e,this.levelNode=t}generate(e,t){let n=this.textureNode.build(e,"property"),r=this.levelNode===null?"0":this.levelNode.build(e,"int");return e.format(`${e.getMethod("textureDimensions")}( ${n}, ${r} )`,this.getNodeType(e),t)}},Yg=$n(EU).setParameterLength(1,2),MU=class extends Xg{static get type(){return"MaxMipLevelNode"}constructor(e){super(0),this._textureNode=e,this.updateType=yn.FRAME}get textureNode(){return this._textureNode}get texture(){return this._textureNode.value}update(){let e=this.texture,t=e.images,n=t&&t.length>0?t[0]&&t[0].image||t[0]:e.image;if(n&&n.width!==void 0){let{width:r,height:s}=n;this.value=Math.log2(Math.max(r,s))}}},Cz=$n(MU).setParameterLength(1),l4=class extends Error{constructor(e,t=null){super(e),this.name="NodeError",this.stackTrace=t}},Rz=new Hs,su=class extends Xg{static get type(){return"TextureNode"}constructor(e=Rz,t=null,n=null,r=null){super(e),this.isTextureNode=!0,this.uvNode=t,this.levelNode=n,this.biasNode=r,this.compareNode=null,this.depthNode=null,this.gradNode=null,this.gatherNode=null,this.offsetNode=null,this.sampler=!0,this.updateMatrix=!1,this.updateType=yn.NONE,this.referenceNode=null,this._value=e,this._matrixUniform=null,this._flipYUniform=null,this.setUpdateMatrix(t===null)}set value(e){this.referenceNode?this.referenceNode.value=e:this._value=e}get value(){return this.referenceNode?this.referenceNode.value:this._value}getUniformHash(){return this.value.uuid}generateNodeType(){return this.value.isDepthTexture===!0?this.gatherNode===null?"float":"vec4":this.value.type===xi?"uvec4":this.value.type===Zr?"ivec4":"vec4"}getInputType(){return"texture"}getDefaultUV(){return Ui(this.value.channel)}updateReference(){return this.value}getTransformedUV(e){return this._matrixUniform===null&&(this._matrixUniform=Xt(this.value.matrix)),this._matrixUniform.mul(pe(e,1)).xy}setUpdateMatrix(e){return this.updateMatrix=e,this}setupUV(e,t){return e.isFlipY()&&(this._flipYUniform===null&&(this._flipYUniform=Xt(!1)),t=t.toVar(),this.sampler?t=this._flipYUniform.select(t.flipY(),t):t=this._flipYUniform.select(t.setY(de(Yg(this,this.levelNode).y).sub(t.y).sub(1)),t)),t}setup(e){let t=e.getNodeProperties(this);t.referenceNode=this.referenceNode;let n=this.value;if(!n||n.isTexture!==!0)throw new l4("THREE.TSL: `texture( value )` function expects a valid instance of THREE.Texture().",this.stackTrace);let r=me(()=>{let l=this.uvNode;return(l===null||e.context.forceUVContext===!0)&&e.context.getUV&&(l=e.context.getUV(this,e)),l||(l=this.getDefaultUV()),this.updateMatrix===!0&&(l=this.getTransformedUV(l)),l=this.setupUV(e,l),this.updateType=this._matrixUniform!==null||this._flipYUniform!==null?yn.OBJECT:yn.NONE,l})(),s=this.levelNode;s===null&&e.context.getTextureLevel&&(s=e.context.getTextureLevel(this));let o=null,a=null;if(this.compareNode!==null)if(e.renderer.hasCompatibility(Dd.TEXTURE_COMPARE))o=this.compareNode;else{let l=n.compareFunction;l===null||l===s_||l===Xh||l===sg||l===Fu?a=this.compareNode:(o=this.compareNode,ni('TSL: Only "LessCompare", "LessEqualCompare", "GreaterCompare" and "GreaterEqualCompare" are supported for depth texture comparison fallback.'))}t.uvNode=r,t.levelNode=s,t.biasNode=this.biasNode,t.compareNode=o,t.compareStepNode=a,t.gradNode=this.gradNode,t.gatherNode=this.gatherNode,t.depthNode=this.depthNode,t.offsetNode=this.offsetNode}generateUV(e,t){return t.build(e,this.sampler===!0?"vec2":"ivec2")}generateOffset(e,t){return t.build(e,"ivec2")}generateSnippet(e,t,n,r,s,o,a,l,c,u,f){let d=this.value,A;return s?A=e.generateTextureBias(d,t,n,s,o,u):l?A=e.generateTextureGrad(d,t,n,l,o,u):c?a?A=e.generateTextureGatherCompare(d,t,n,a,o,u,f):A=e.generateTextureGather(d,t,n,c,o,u,f):a?A=e.generateTextureCompare(d,t,n,a,o,u):this.sampler===!1?A=e.generateTextureLoad(d,t,n,r,o,u):r?A=e.generateTextureLevel(d,t,n,r,o,u):A=e.generateTexture(d,t,n,o,u),A}generate(e,t){let n=this.value,r=e.getNodeProperties(this),s=super.generate(e,"property");if(/^sampler/.test(t))return s+"_sampler";if(e.isReference(t))return s;{let o=e.getDataFromNode(this),a=this.getNodeType(e),l=o.propertyName;if(l===void 0){let{uvNode:u,levelNode:f,biasNode:d,compareNode:A,compareStepNode:y,depthNode:w,gradNode:S,gatherNode:T,offsetNode:R}=r,P=this.generateUV(e,u),I=f?f.build(e,"float"):null,F=d?d.build(e,"float"):null,D=w?w.build(e,"int"):null,L=A?A.build(e,"float"):null,C=y?y.build(e,"float"):null,B=S?[S[0].build(e,"vec2"),S[1].build(e,"vec2")]:null,k=T?T.build(e,"int"):null,z=R?this.generateOffset(e,R):null,G=this._flipYUniform?this._flipYUniform.build(e,"bool"):null;k&&(a="vec4");let W=D;W===null&&n.isArrayTexture&&this.isTexture3DNode!==!0&&(W="0");let Y=e.getVarFromNode(this);l=e.getPropertyName(Y);let H=this.generateSnippet(e,s,P,I,F,W,L,B,k,z,G);if(C!==null){let $=n.compareFunction;$===sg||$===Fu?H=$g(lc(H,a),lc(C,"float")).build(e,a):H=$g(lc(C,"float"),lc(H,a)).build(e,a)}e.addLineFlowCode(`${l} = ${H}`,this),o.snippet=H,o.propertyName=l}let c=l;return e.needsToWorkingColorSpace(n)&&(c=vI(lc(c,a),n.colorSpace).setup(e).build(e,a)),e.format(c,a,t)}}setSampler(e){return this.sampler=e,this}getSampler(){return this.sampler}sample(e){let t=this.clone();return t.uvNode=Ht(e),t.referenceNode=this.getBase(),Ht(t)}load(e){return this.sample(e).setSampler(!1)}blur(e){let t=this.clone();t.biasNode=Ht(e).mul(Cz(t)),t.referenceNode=this.getBase();let n=t.value;return t.generateMipmaps===!1&&(n&&n.generateMipmaps===!1||n.minFilter===Ti||n.magFilter===Ti)&&(Xe("TSL: texture().blur() requires mipmaps and sampling. Use .generateMipmaps=true and .minFilter/.magFilter=THREE.LinearFilter in the Texture."),t.biasNode=null),Ht(t)}level(e){let t=this.clone();return t.levelNode=Ht(e),t.referenceNode=this.getBase(),Ht(t)}size(e){return Yg(this,e)}bias(e){let t=this.clone();return t.biasNode=Ht(e),t.referenceNode=this.getBase(),Ht(t)}getBase(){return this.referenceNode?this.referenceNode.getBase():this}compare(e){let t=this.clone();return t.compareNode=Ht(e),t.referenceNode=this.getBase(),Ht(t)}grad(e,t){let n=this.clone();return n.gradNode=[Ht(e),Ht(t)],n.referenceNode=this.getBase(),Ht(n)}gather(e=0){let t=this.clone();return t.gatherNode=Ht(e),t.referenceNode=this.getBase(),Ht(t)}depth(e){let t=this.clone();return t.depthNode=Ht(e),t.referenceNode=this.getBase(),Ht(t)}offset(e){let t=this.clone();return t.offsetNode=Ht(e),t.referenceNode=this.getBase(),Ht(t)}serialize(e){super.serialize(e),e.value=this.value.toJSON(e.meta).uuid,e.sampler=this.sampler,e.updateMatrix=this.updateMatrix,e.updateType=this.updateType}deserialize(e){super.deserialize(e),this.value=e.meta.textures[e.value],this.sampler=e.sampler,this.updateMatrix=e.updateMatrix,this.updateType=e.updateType}update(){let e=this.value,t=this._matrixUniform;t!==null&&(t.value=e.matrix),e.matrixAutoUpdate===!0&&e.updateMatrix();let n=this._flipYUniform;n!==null&&(n.value=e.image instanceof ImageBitmap&&e.flipY===!0||e.isRenderTargetTexture===!0||e.isFramebufferTexture===!0||e.isDepthTexture===!0)}clone(){let e=new this.constructor(this.value,this.uvNode,this.levelNode,this.biasNode);return e.sampler=this.sampler,e.depthNode=this.depthNode,e.compareNode=this.compareNode,e.gradNode=this.gradNode,e.gatherNode=this.gatherNode,e.offsetNode=this.offsetNode,e}},BTe=$n(su).setParameterLength(1,4).setName("texture"),fi=(i=Rz,e=null,t=null,n=null)=>{let r;return i&&i.isTextureNode===!0?(r=Ht(i.clone()),r.referenceNode=i.getBase(),e!==null&&(r.uvNode=Ht(e)),t!==null&&(r.levelNode=Ht(t)),n!==null&&(r.biasNode=Ht(n))):r=BTe(i,e,t,n),r},OTe=(i=Rz)=>fi(i),_s=(...i)=>fi(...i).setSampler(!1),UTe=(i,e,t)=>fi(i,e).level(t),kTe=i=>(i.isNode===!0?i:fi(i)).convert("sampler"),zTe=i=>(i.isNode===!0?i:fi(i)).convert("samplerComparison"),uS=class extends Xg{static get type(){return"BufferNode"}constructor(e,t,n=0){super(e,t),this.isBufferNode=!0,this.bufferType=t,this.bufferCount=n,this.updateRanges=[]}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}getElementType(e){return this.getNodeType(e)}getInputType(){return"buffer"}},Ax=(i,e,t)=>new uS(i,e,t),CU=class extends Xd{static get type(){return"UniformArrayElementNode"}constructor(e,t){super(e,t),this.isArrayBufferElementNode=!0}generate(e){let t=super.generate(e),n=this.getNodeType(e),r=this.node.getPaddedType();return e.format(t,r,n)}},RU=class extends uS{static get type(){return"UniformArrayNode"}constructor(e,t=null){super(null),this.array=e,this.elementType=t===null?lm(e[0]):t,this.paddedType=this.getPaddedType(),this.updateType=yn.RENDER,this.isArrayBufferNode=!0}generateNodeType(){return this.paddedType}getElementType(){return this.elementType}getPaddedType(){let e=this.elementType,t="vec4";return e==="mat2"?t="mat2":/mat/.test(e)===!0?t="mat4":e.charAt(0)==="i"?t="ivec4":e.charAt(0)==="u"&&(t="uvec4"),t}update(){let{array:e,value:t}=this,n=this.elementType;if(n==="float"||n==="int"||n==="uint")for(let r=0;r<e.length;r++){let s=r*4;t[s]=e[r]}else if(n==="color")for(let r=0;r<e.length;r++){let s=r*4,o=e[r];t[s]=o.r,t[s+1]=o.g,t[s+2]=o.b||0}else if(n==="mat2")for(let r=0;r<e.length;r++){let s=r*4,o=e[r];t[s]=o.elements[0],t[s+1]=o.elements[1],t[s+2]=o.elements[2],t[s+3]=o.elements[3]}else if(n==="mat3")for(let r=0;r<e.length;r++){let s=r*16,o=e[r];t[s]=o.elements[0],t[s+1]=o.elements[1],t[s+2]=o.elements[2],t[s+4]=o.elements[3],t[s+5]=o.elements[4],t[s+6]=o.elements[5],t[s+8]=o.elements[6],t[s+9]=o.elements[7],t[s+10]=o.elements[8],t[s+15]=1}else if(n==="mat4")for(let r=0;r<e.length;r++){let s=r*16,o=e[r];for(let a=0;a<o.elements.length;a++)t[s+a]=o.elements[a]}else for(let r=0;r<e.length;r++){let s=r*4,o=e[r];t[s]=o.x,t[s+1]=o.y,t[s+2]=o.z||0,t[s+3]=o.w||0}}setup(e){let t=this.array.length,n=this.elementType,r=Float32Array,s=this.paddedType,o=e.getTypeLength(s);return n.charAt(0)==="i"&&(r=Int32Array),n.charAt(0)==="u"&&(r=Uint32Array),this.value=new r(t*o),this.bufferCount=t,this.bufferType=s,this.update(),super.setup(e)}element(e){return new CU(this,Ht(e))}},Xo=(i,e)=>new RU(i,e),IU=class extends Kt{constructor(e){super("float"),this.name=e,this.isBuiltinNode=!0}generate(){return this.name}},Qd=$n(IU).setParameterLength(1),Iw,Pw,Yo=class i extends Kt{static get type(){return"ScreenNode"}constructor(e){super(),this.scope=e,this._output=null,this.isViewportNode=!0}generateNodeType(){return this.scope===i.DPR?"float":this.scope===i.VIEWPORT?"vec4":"vec2"}getUpdateType(){let e=yn.NONE;return(this.scope===i.SIZE||this.scope===i.VIEWPORT||this.scope===i.DPR)&&(e=yn.RENDER),this.updateType=e,e}update({renderer:e}){let t=e.getRenderTarget();this.scope===i.VIEWPORT?t!==null?Pw.copy(t.viewport):(e.getViewport(Pw),Pw.multiplyScalar(e.getPixelRatio())):this.scope===i.DPR?this._output.value=e.getPixelRatio():t!==null?(Iw.width=t.width,Iw.height=t.height):e.getDrawingBufferSize(Iw)}setup(){let e=this.scope,t=null;return e===i.SIZE?t=Xt(Iw||(Iw=new Oe)):e===i.VIEWPORT?t=Xt(Pw||(Pw=new xn)):e===i.DPR?t=Xt(1):t=dt(s1.div(Zg)),this._output=t,t}generate(e){if(this.scope===i.COORDINATE){let t=e.getFragCoord();if(e.isFlipY()){let n=e.getNodeProperties(Zg).outputNode.build(e);t=`${e.getType("vec2")}( ${t}.x, ${n}.y - ${t}.y )`}return t}return super.generate(e)}};Yo.COORDINATE="coordinate";Yo.VIEWPORT="viewport";Yo.SIZE="size";Yo.UV="uv";Yo.DPR="dpr";var Iz=xt(Yo,Yo.DPR),ju=xt(Yo,Yo.UV),Zg=xt(Yo,Yo.SIZE),s1=xt(Yo,Yo.COORDINATE),rx=xt(Yo,Yo.VIEWPORT),Pz=rx.zw,gie=s1.sub(rx.xy),VTe=gie.div(Pz),GTe=me(()=>(Xe('TSL: "viewportResolution" is deprecated. Use "screenSize" instead.',new es),Zg),"vec2").once()(),gO=null,sR=null,vO=null,oR=null,_O=null,aR=null,xO=null,lR=null,yO=null,cR=null,bO=null,uR=null,wO=null,hR=null,vm=Xt(0,"uint").setName("u_cameraIndex").setGroup(fI("cameraIndex")).toVarying("v_cameraIndex"),rm=Xt("float").setName("cameraNear").setGroup(Jt).onRenderUpdate(({camera:i})=>i.near),sm=Xt("float").setName("cameraFar").setGroup(Jt).onRenderUpdate(({camera:i})=>i.far),Qa=me(({camera:i})=>{let e;if(i.isArrayCamera&&i.cameras.length>0){let t=[];for(let n of i.cameras)t.push(n.projectionMatrix);sR===null?sR=Xo(t).setGroup(Jt).setName("cameraProjectionMatrices"):sR.array=t,e=sR.element(i.isMultiViewCamera?Qd("gl_ViewID_OVR"):vm)}else gO===null&&(gO=Xt(i.projectionMatrix).setName("cameraProjectionMatrix").setGroup(Jt).onRenderUpdate(({camera:t})=>t.projectionMatrix)),e=gO;return e}).once()(),vie=me(({camera:i})=>{let e;if(i.isArrayCamera&&i.cameras.length>0){let t=[];for(let n of i.cameras)t.push(n.projectionMatrixInverse);oR===null?oR=Xo(t).setGroup(Jt).setName("cameraProjectionMatricesInverse"):oR.array=t,e=oR.element(i.isMultiViewCamera?Qd("gl_ViewID_OVR"):vm)}else vO===null&&(vO=Xt(i.projectionMatrixInverse).setName("cameraProjectionMatrixInverse").setGroup(Jt).onRenderUpdate(({camera:t})=>t.projectionMatrixInverse)),e=vO;return e}).once()(),_m=me(({camera:i})=>{let e;if(i.isArrayCamera&&i.cameras.length>0){let t=[];for(let n of i.cameras)t.push(n.matrixWorldInverse);aR===null?aR=Xo(t).setGroup(Jt).setName("cameraViewMatrices"):aR.array=t,e=aR.element(i.isMultiViewCamera?Qd("gl_ViewID_OVR"):vm)}else _O===null&&(_O=Xt(i.matrixWorldInverse).setName("cameraViewMatrix").setGroup(Jt).onRenderUpdate(({camera:t})=>t.matrixWorldInverse)),e=_O;return e}).once()(),MS=me(({camera:i})=>{let e;if(i.isArrayCamera&&i.cameras.length>0){let t=[];for(let n of i.cameras)t.push(n.matrixWorld);lR===null?lR=Xo(t).setGroup(Jt).setName("cameraWorldMatrices"):lR.array=t,e=lR.element(i.isMultiViewCamera?Qd("gl_ViewID_OVR"):vm)}else xO===null&&(xO=Xt(i.matrixWorld).setName("cameraWorldMatrix").setGroup(Jt).onRenderUpdate(({camera:t})=>t.matrixWorld)),e=xO;return e}).once()(),qTe=me(({camera:i})=>{let e;if(i.isArrayCamera&&i.cameras.length>0){let t=[];for(let n of i.cameras)t.push(n.normalMatrix);cR===null?cR=Xo(t).setGroup(Jt).setName("cameraNormalMatrices"):cR.array=t,e=cR.element(i.isMultiViewCamera?Qd("gl_ViewID_OVR"):vm)}else yO===null&&(yO=Xt(i.normalMatrix).setName("cameraNormalMatrix").setGroup(Jt).onRenderUpdate(({camera:t})=>t.normalMatrix)),e=yO;return e}).once()(),_ie=me(({camera:i})=>{let e;if(i.isArrayCamera&&i.cameras.length>0){let t=[];for(let n=0,r=i.cameras.length;n<r;n++)t.push(new re);uR===null?uR=Xo(t).setGroup(Jt).setName("cameraPositions").onRenderUpdate(({camera:n},r)=>{let s=n.cameras,o=r.array;for(let a=0,l=s.length;a<l;a++)o[a].setFromMatrixPosition(s[a].matrixWorld)}):uR.array=t,e=uR.element(i.isMultiViewCamera?Qd("gl_ViewID_OVR"):vm)}else bO===null&&(bO=Xt(new re).setName("cameraPosition").setGroup(Jt).onRenderUpdate(({camera:t},n)=>n.value.setFromMatrixPosition(t.matrixWorld))),e=bO;return e}).once()(),HTe=me(({camera:i})=>{let e;if(i.isArrayCamera&&i.cameras.length>0){let t=[];for(let n of i.cameras)t.push(n.viewport);hR===null?hR=Xo(t,"vec4").setGroup(Jt).setName("cameraViewports"):hR.array=t,e=hR.element(vm)}else wO===null&&(wO=Ft(0,0,Zg.x,Zg.y).toConst("cameraViewport")),e=wO;return e}).once()(),vee=new xl,Ds=class i extends Kt{static get type(){return"Object3DNode"}constructor(e,t=null){super(),this.scope=e,this.object3d=t,this.updateType=yn.OBJECT,this.uniformNode=new Xg(null)}generateNodeType(){let e=this.scope;if(e===i.WORLD_MATRIX)return"mat4";if(e===i.POSITION||e===i.VIEW_POSITION||e===i.DIRECTION||e===i.SCALE)return"vec3";if(e===i.RADIUS)return"float"}update(e){let t=this.object3d,n=this.uniformNode,r=this.scope;if(r===i.WORLD_MATRIX)n.value=t.matrixWorld;else if(r===i.POSITION)n.value=n.value||new re,n.value.setFromMatrixPosition(t.matrixWorld);else if(r===i.SCALE)n.value=n.value||new re,n.value.setFromMatrixScale(t.matrixWorld);else if(r===i.DIRECTION)n.value=n.value||new re,t.getWorldDirection(n.value);else if(r===i.VIEW_POSITION){let s=e.camera;n.value=n.value||new re,n.value.setFromMatrixPosition(t.matrixWorld),n.value.applyMatrix4(s.matrixWorldInverse)}else if(r===i.RADIUS){let s=e.object.geometry;s.boundingSphere===null&&s.computeBoundingSphere(),vee.copy(s.boundingSphere).applyMatrix4(t.matrixWorld),n.value=vee.radius}}generate(e){let t=this.scope;return t===i.WORLD_MATRIX?this.uniformNode.nodeType="mat4":t===i.POSITION||t===i.VIEW_POSITION||t===i.DIRECTION||t===i.SCALE?this.uniformNode.nodeType="vec3":t===i.RADIUS&&(this.uniformNode.nodeType="float"),this.uniformNode.build(e)}serialize(e){super.serialize(e),e.scope=this.scope}deserialize(e){super.deserialize(e),this.scope=e.scope}};Ds.WORLD_MATRIX="worldMatrix";Ds.POSITION="position";Ds.SCALE="scale";Ds.VIEW_POSITION="viewPosition";Ds.DIRECTION="direction";Ds.RADIUS="radius";var WTe=$n(Ds,Ds.DIRECTION).setParameterLength(1),jTe=$n(Ds,Ds.WORLD_MATRIX).setParameterLength(1),XTe=$n(Ds,Ds.POSITION).setParameterLength(1),$Te=$n(Ds,Ds.SCALE).setParameterLength(1),YTe=$n(Ds,Ds.VIEW_POSITION).setParameterLength(1),ZTe=$n(Ds,Ds.RADIUS).setParameterLength(1),Il=class extends Ds{static get type(){return"ModelNode"}constructor(e){super(e)}update(e){this.object3d=e.object,super.update(e)}},KTe=xt(Il,Il.DIRECTION),tu=xt(Il,Il.WORLD_MATRIX),QTe=xt(Il,Il.POSITION),JTe=xt(Il,Il.SCALE),eEe=xt(Il,Il.VIEW_POSITION),tEe=xt(Il,Il.RADIUS),xie=Xt(new Mn).onObjectUpdate(({object:i},e)=>e.value.getNormalMatrix(i.matrixWorld)),nEe=Xt(new cn).onObjectUpdate(({object:i},e)=>e.value.copy(i.matrixWorld).invert()),bf=me(i=>i.context.modelViewMatrix||yie).once()().toVar("modelViewMatrix"),yie=_m.mul(tu),PU=me(i=>(i.context.isHighPrecisionModelViewMatrix=!0,Xt("mat4").onObjectUpdate(({object:e,camera:t})=>e.modelViewMatrix.multiplyMatrices(t.matrixWorldInverse,e.matrixWorld)))).once()().toVar("highpModelViewMatrix"),LU=me(i=>{let e=i.context.isHighPrecisionModelViewMatrix;return Xt("mat3").onObjectUpdate(({object:t,camera:n})=>(e!==!0&&t.modelViewMatrix.multiplyMatrices(n.matrixWorldInverse,t.matrixWorld),t.normalMatrix.getNormalMatrix(t.modelViewMatrix)))}).once()().toVar("highpModelNormalViewMatrix"),bie=me(i=>i.shaderStage!=="fragment"?(ni("TSL: `clipSpace` is only available in fragment stage."),Ft()):i.context.clipSpace.toVarying("v_clipSpace")).once()(),ga=cc("position","vec3"),Er=ga.toVarying("positionLocal"),Kg=ga.toVarying("positionPrevious"),_f=me(i=>tu.mul(Er).xyz.toVarying(i.getSubBuildProperty("v_positionWorld")),"vec3").once(["POSITION"])(),Lz=me(()=>Er.transformDirection(tu).toVarying("v_positionWorldDirection").normalize().toVar("positionWorldDirection"),"vec3").once(["POSITION"])(),xs=me(i=>{if(i.shaderStage==="fragment"&&i.material.vertexNode){let e=vie.mul(bie);return e.xyz.div(e.w).toVar("positionView")}return i.context.setupPositionView().toVarying("v_positionView")},"vec3").once(["POSITION","VERTEX"])(),er=me(i=>{let e;return i.camera.isOrthographicCamera?e=pe(0,0,1):e=xs.negate().toVarying("v_positionViewDirection").normalize(),e.toVar("positionViewDirection")},"vec3").once(["POSITION"])(),DU=class extends Kt{static get type(){return"FrontFacingNode"}constructor(){super("bool"),this.isFrontFacingNode=!0}generate(e){if(e.shaderStage!=="fragment")return"true";let{material:t}=e;return t.side===mi?"false":e.getFrontFacing()}},wie=xt(DU),Dz=oe(wie).mul(2).sub(1),o1=me(([i],{material:e})=>{let t=e.side;return t===mi?i=i.mul(-1):t===gr&&(i=i.mul(Dz)),i}),iEe=i=>(ni('TSL: "directionToFaceDirection()" has been renamed to "negateOnBackSide()".'),o1(i)),yI=cc("normal","vec3"),ba=me(i=>i.geometry.hasAttribute("normal")===!1?(Xe('TSL: Vertex attribute "normal" not found on geometry.'),pe(0,1,0)):yI,"vec3").once()().toVar("normalLocal"),Sie=xs.dFdx().cross(xs.dFdy()).normalize().toVar("normalFlat"),ax=me(i=>{let e;return i.isFlatShading()?e=Sie:e=Fz(ba).toVarying("v_normalViewGeometry").normalize(),e},"vec3").once()().toVar("normalViewGeometry"),Tie=me(i=>{let e=ax.transformNormalByInverseViewMatrix(_m);return i.isFlatShading()!==!0&&(e=e.toVarying("v_normalWorldGeometry")),e.normalize().toVar("normalWorldGeometry")},"vec3").once()(),hi=me(i=>{let e;return i.subBuildFn==="NORMAL"||i.subBuildFn==="VERTEX"?(e=ax,i.isFlatShading()!==!0&&(e=o1(e))):e=i.context.setupNormal().context({getUV:null,getTextureLevel:null}),e},"vec3").once(["NORMAL","VERTEX"])().toVar("normalView"),xm=hi.transformNormalByInverseViewMatrix(_m).toVar("normalWorld"),om=me(({subBuildFn:i,context:e})=>{let t;return i==="NORMAL"||i==="VERTEX"?t=hi:t=e.setupClearcoatNormal().context({getUV:null,getTextureLevel:null}),t},"vec3").once(["NORMAL","VERTEX"])().toVar("clearcoatNormalView"),Nz=me(([i,e=tu])=>To(e).inverse().transpose().mul(i).normalize());Ue("transformNormal",Nz);var Fz=me(([i],e)=>{let t=e.context.modelNormalViewMatrix;return t?i.transformNormalByViewMatrix(t):xie.mul(i).transformNormalByViewMatrix(_m)}),rEe=me(()=>(Xe('TSL: "transformedNormalView" is deprecated. Use "normalView" instead.'),hi)).once(["NORMAL","VERTEX"])(),sEe=me(()=>(Xe('TSL: "transformedNormalWorld" is deprecated. Use "normalWorld" instead.'),xm)).once(["NORMAL","VERTEX"])(),oEe=me(()=>(Xe('TSL: "transformedClearcoatNormalView" is deprecated. Use "clearcoatNormalView" instead.'),om)).once(["NORMAL","VERTEX"])(),SO=new cn,Eie=Xt(0).onReference(({material:i})=>i).onObjectUpdate(({material:i})=>i.refractionRatio),qR=Xt(1).onReference(({material:i})=>i).onObjectUpdate(function({material:i,scene:e}){return i.envMap?i.envMapIntensity:e.environmentIntensity}),c4=Xt(new cn).onReference(function(i){return i.material}).onObjectUpdate(function({material:i,scene:e}){let n=(e.environment!==null||e.environmentNode&&e.environmentNode.isNode)&&i.envMap===null?e.environmentRotation:i.envMapRotation;return n?SO.makeRotationFromEuler(n).transpose():SO.identity(),SO}),Mie=er.negate().reflect(hi),Cie=er.negate().refract(hi,Eie),Rie=Mie.transformDirection(MS).toVar("reflectVector"),Iie=Cie.transformDirection(MS).toVar("refractVector"),Pie=new Ih,NU=class extends su{static get type(){return"CubeTextureNode"}constructor(e,t=null,n=null,r=null){super(e,t,n,r),this.isCubeTextureNode=!0}getInputType(){return this.value.isDepthTexture===!0?"cubeDepthTexture":"cubeTexture"}getDefaultUV(){let e=this.value;return e.mapping===Kl?Rie:e.mapping===Gc?Iie:(ze('CubeTextureNode: Mapping "%s" not supported.',e.mapping),pe(0,0,0))}setUpdateMatrix(){}setupUV(e,t){let n=this.value;return n.isDepthTexture===!0?e.renderer.coordinateSystem===_l?pe(t.x,t.y.negate(),t.z):t:(t=c4.mul(t),(e.renderer.coordinateSystem===_l||!n.isRenderTargetTexture)&&(t=pe(t.x.negate(),t.yz)),t)}generateUV(e,t){return t.build(e,this.sampler===!0?"vec3":"ivec3")}},Bz=$n(NU).setParameterLength(1,4).setName("cubeTexture"),Ka=(i=Pie,e=null,t=null,n=null)=>{let r;return i&&i.isCubeTextureNode===!0?(r=Ht(i.clone()),r.referenceNode=i,e!==null&&(r.uvNode=Ht(e)),t!==null&&(r.levelNode=Ht(t)),n!==null&&(r.biasNode=Ht(n))):r=Bz(i,e,t,n),r},aEe=(i=Pie)=>Bz(i),FU=class extends Xd{static get type(){return"ReferenceElementNode"}constructor(e,t){super(e,t),this.referenceNode=e,this.isReferenceElementNode=!0}generateNodeType(){return this.referenceNode.uniformType}generate(e){let t=super.generate(e),n=this.referenceNode.getNodeType(e),r=this.getNodeType(e);return e.format(t,n,r)}},lx=class extends Kt{static get type(){return"ReferenceNode"}constructor(e,t,n=null,r=null){super(),this.property=e,this.uniformType=t,this.object=n,this.count=r,this.properties=e.split("."),this.reference=n,this.node=null,this.group=null,this.name=null,this.updateType=yn.OBJECT}element(e){return new FU(this,Ht(e))}setGroup(e){return this.group=e,this}setName(e){return this.name=e,this}label(e){return Xe('TSL: "label()" has been deprecated. Use "setName()" instead.'),this.setName(e)}setNodeType(e){let t=null;this.count!==null?t=Ax(null,e,this.count):Array.isArray(this.getValueFromReference())?(t=Xo(null,e),t.updateType=yn.OBJECT):e==="texture"?t=fi(null):e==="cubeTexture"?t=Ka(null):t=Xt(null,e),this.group!==null&&t.setGroup(this.group),this.name!==null&&t.setName(this.name),this.node=t}generateNodeType(e){return this.node===null&&(this.updateReference(e),this.updateValue()),this.node.getNodeType(e)}getValueFromReference(e=this.reference){let{properties:t}=this,n=e[t[0]];for(let r=1;r<t.length;r++)n=n[t[r]];return n}updateReference(e){return this.reference=this.object!==null?this.object:e.object,this.reference}setup(){return this.updateValue(),this.node}update(){this.updateValue()}updateValue(){this.node===null&&this.setNodeType(this.uniformType);let e=this.getValueFromReference();Array.isArray(e)?this.node.array=e:this.node.value=e}},mr=(i,e,t)=>new lx(i,e,t),Lie=(i,e,t,n)=>new lx(i,e,n,t),BU=class extends lx{static get type(){return"MaterialReferenceNode"}constructor(e,t,n=null){super(e,t,n),this.material=n,this.isMaterialReferenceNode=!0}updateReference(e){return this.reference=this.material!==null?this.material:e.material,this.reference}},Hd=(i,e,t=null)=>new BU(i,e,t),Die=Ui(),lEe=xs.dFdx(),cEe=xs.dFdy(),Nie=Die.dFdx(),Fie=Die.dFdy(),Bie=hi,Oie=cEe.cross(Bie),Uie=Bie.cross(lEe),OU=Oie.mul(Nie.x).add(Uie.mul(Fie.x)),UU=Oie.mul(Nie.y).add(Uie.mul(Fie.y)),_ee=OU.dot(OU).max(UU.dot(UU)),kie=_ee.equal(0).select(0,_ee.inverseSqrt()),uEe=OU.mul(kie).toVar("tangentViewFrame"),hEe=UU.mul(kie).toVar("bitangentViewFrame"),bI=cc("tangent","vec4"),pm=bI.xyz.toVar("tangentLocal"),wI=me(i=>{let e;return i.subBuildFn==="VERTEX"||i.geometry.hasAttribute("tangent")?e=bf.mul(Ft(pm,0)).xyz.toVarying("v_tangentView").normalize():e=uEe,i.isFlatShading()!==!0&&(e=o1(e)),e},"vec3").once(["NORMAL","VERTEX"])().toVar("tangentView"),zie=wI.transformDirection(MS).toVarying("v_tangentWorld").normalize().toVar("tangentWorld"),SI=me(([i,e],t)=>{let n=i.mul(bI.w).xyz;return t.subBuildFn==="NORMAL"&&t.isFlatShading()!==!0&&(n=n.toVarying(e)),n}).once(["NORMAL"]),fEe=SI(yI.cross(bI),"v_bitangentGeometry").normalize().toVar("bitangentGeometry"),dEe=SI(ba.cross(pm),"v_bitangentLocal").normalize().toVar("bitangentLocal"),Vie=me(i=>{let e;return i.subBuildFn==="VERTEX"||i.geometry.hasAttribute("tangent")?e=SI(hi.cross(wI),"v_bitangentView").normalize():e=hEe,i.isFlatShading()!==!0&&(e=o1(e)),e},"vec3").once(["NORMAL","VERTEX"])().toVar("bitangentView"),pEe=SI(xm.cross(zie),"v_bitangentWorld").normalize().toVar("bitangentWorld"),Ug=To(wI,Vie,hi).toVar("TBNViewMatrix"),Gie=er.mul(Ug),mEe=(i,e)=>i.sub(Gie.mul(e)),qie=me(()=>{let i=Vg.cross(er);return i=i.cross(Vg).normalize(),i=Qn(i,hi,nm.mul(pf.oneMinus()).oneMinus().pow2().pow2()).normalize(),i}).once()(),Oz=i=>Ht(i).mul(.5).add(.5),Hie=i=>Ht(i).mul(2).sub(1),kU=i=>pe(i,Ja(gI(oe(1).sub(ru(i,i))))),AEe=i=>(ni('TSL: "directionToColor()" has been renamed to "packNormalToRGB()".'),Oz(i)),gEe=i=>(ni('TSL: "colorToDirection()" has been renamed to "unpackRGBToNormal()".'),Hie(i)),zU=class extends Cr{static get type(){return"NormalMapNode"}constructor(e,t=null){super("vec3"),this.node=e,this.scaleNode=t,this.normalMapType=Ql,this.unpackNormalMode=Eb}setup(e){let{normalMapType:t,scaleNode:n,unpackNormalMode:r}=this,s=this.node.mul(2).sub(1);if(t===Ql?r===LM?s=kU(s.xy):r===D8?s=kU(s.yw):r!==Eb&&ze(`THREE.NodeMaterial: Unexpected unpack normal mode: ${r}`):r!==Eb&&ze(`THREE.NodeMaterial: Normal map type '${t}' is not compatible with unpack normal mode '${r}'`),n!==null){let a=n;e.isFlatShading()===!0&&(a=o1(a)),s=pe(s.xy.mul(a),s.z)}let o=null;return t===PM?o=Fz(s):t===Ql?o=Ug.mul(s).normalize():(ze(`NodeMaterial: Unsupported normal map type: ${t}`),o=hi),o}},VU=$n(zU).setParameterLength(1,2),vEe=me(({textureNode:i,bumpScale:e})=>{let t=r=>i.isolate().context({getUV:s=>r(s.uvNode||Ui()),forceUVContext:!0}),n=oe(t(r=>r));return dt(oe(t(r=>r.add(r.dFdx()))).sub(n),oe(t(r=>r.add(r.dFdy()))).sub(n)).mul(e)}),_Ee=me(i=>{let{surf_pos:e,surf_norm:t,dHdxy:n}=i,r=e.dFdx().normalize(),s=e.dFdy().normalize(),o=t,a=s.cross(o),l=o.cross(r),c=r.dot(a).mul(Dz),u=c.sign().mul(n.x.mul(a).add(n.y.mul(l)));return c.abs().mul(t).sub(u).normalize()}),GU=class extends Cr{static get type(){return"BumpMapNode"}constructor(e,t=null){super("vec3"),this.textureNode=e,this.scaleNode=t}setup(e){if(e.material.wireframe===!0)return hi;let t=this.scaleNode!==null?this.scaleNode:1,n=vEe({textureNode:this.textureNode,bumpScale:t});return _Ee({surf_pos:xs,surf_norm:hi,dHdxy:n})}},Uz=$n(GU).setParameterLength(1,2),xee=new Map,at=class i extends Kt{static get type(){return"MaterialNode"}constructor(e){super(),this.scope=e}getCache(e,t){let n=xee.get(e);return n===void 0&&(n=Hd(e,t),xee.set(e,n)),n}getFloat(e){return this.getCache(e,"float")}getColor(e){return this.getCache(e,"color")}getTexture(e){return this.getCache(e==="map"?"map":e+"Map","texture")}setup(e){let t=e.context.material,n=this.scope,r=null;if(n===i.COLOR){let s=t.color!==void 0?this.getColor(n):pe();t.map&&t.map.isTexture===!0?r=s.mul(this.getTexture("map")):r=s}else if(n===i.OPACITY){let s=this.getFloat(n);t.alphaMap&&t.alphaMap.isTexture===!0?r=s.mul(this.getTexture("alpha")):r=s}else if(n===i.SPECULAR_STRENGTH)t.specularMap&&t.specularMap.isTexture===!0?r=this.getTexture("specular").r:r=oe(1);else if(n===i.SPECULAR_INTENSITY){let s=this.getFloat(n);t.specularIntensityMap&&t.specularIntensityMap.isTexture===!0?r=s.mul(this.getTexture(n).a):r=s}else if(n===i.SPECULAR_COLOR){let s=this.getColor(n);t.specularColorMap&&t.specularColorMap.isTexture===!0?r=s.mul(this.getTexture(n).rgb):r=s}else if(n===i.ROUGHNESS){let s=this.getFloat(n);t.roughnessMap&&t.roughnessMap.isTexture===!0?r=s.mul(this.getTexture(n).g):r=s}else if(n===i.METALNESS){let s=this.getFloat(n);t.metalnessMap&&t.metalnessMap.isTexture===!0?r=s.mul(this.getTexture(n).b):r=s}else if(n===i.EMISSIVE){let s=this.getFloat("emissiveIntensity"),o=this.getColor(n).mul(s);t.emissiveMap&&t.emissiveMap.isTexture===!0?r=o.mul(this.getTexture(n)):r=o}else if(n===i.NORMAL)t.normalMap?(r=VU(this.getTexture("normal"),this.getCache("normalScale","vec2")),r.normalMapType=t.normalMapType,(t.normalMap.format==js||t.normalMap.format==jh||t.normalMap.format==Wh)&&(r.unpackNormalMode=LM)):t.bumpMap?r=Uz(this.getTexture("bump").r,this.getFloat("bumpScale")):r=hi;else if(n===i.CLEARCOAT){let s=this.getFloat(n);t.clearcoatMap&&t.clearcoatMap.isTexture===!0?r=s.mul(this.getTexture(n).r):r=s}else if(n===i.CLEARCOAT_ROUGHNESS){let s=this.getFloat(n);t.clearcoatRoughnessMap&&t.clearcoatRoughnessMap.isTexture===!0?r=s.mul(this.getTexture(n).r):r=s}else if(n===i.CLEARCOAT_NORMAL)t.clearcoatNormalMap?r=VU(this.getTexture(n),this.getCache(n+"Scale","vec2")):r=hi;else if(n===i.SHEEN){let s=this.getColor("sheenColor").mul(this.getFloat("sheen"));t.sheenColorMap&&t.sheenColorMap.isTexture===!0?r=s.mul(this.getTexture("sheenColor").rgb):r=s}else if(n===i.SHEEN_ROUGHNESS){let s=this.getFloat(n);t.sheenRoughnessMap&&t.sheenRoughnessMap.isTexture===!0?r=s.mul(this.getTexture(n).a):r=s,r=r.clamp(1e-4,1)}else if(n===i.ANISOTROPY)if(t.anisotropyMap&&t.anisotropyMap.isTexture===!0){let s=this.getTexture(n);r=uI(Y_.x,Y_.y,Y_.y.negate(),Y_.x).mul(s.rg.mul(2).sub(dt(1)).normalize().mul(s.b))}else r=Y_;else if(n===i.IRIDESCENCE_THICKNESS){let s=mr("1","float",t.iridescenceThicknessRange);if(t.iridescenceThicknessMap){let o=mr("0","float",t.iridescenceThicknessRange);r=s.sub(o).mul(this.getTexture(n).g).add(o)}else r=s}else if(n===i.TRANSMISSION){let s=this.getFloat(n);t.transmissionMap?r=s.mul(this.getTexture(n).r):r=s}else if(n===i.THICKNESS){let s=this.getFloat(n);t.thicknessMap?r=s.mul(this.getTexture(n).g):r=s}else if(n===i.IOR)r=this.getFloat(n);else if(n===i.LIGHT_MAP)t.lightMap?r=this.getTexture(n).rgb.mul(this.getFloat("lightMapIntensity")):r=pe(0);else if(n===i.AO)t.aoMap?r=this.getTexture(n).r.sub(1).mul(this.getFloat("aoMapIntensity")).add(1):r=oe(1);else if(n===i.LINE_DASH_OFFSET)r=t.dashOffset?this.getFloat(n):oe(0);else{let s=this.getNodeType(e);r=this.getCache(n,s)}return r}};at.ALPHA_TEST="alphaTest";at.COLOR="color";at.OPACITY="opacity";at.SHININESS="shininess";at.SPECULAR="specular";at.SPECULAR_STRENGTH="specularStrength";at.SPECULAR_INTENSITY="specularIntensity";at.SPECULAR_COLOR="specularColor";at.REFLECTIVITY="reflectivity";at.ROUGHNESS="roughness";at.METALNESS="metalness";at.NORMAL="normal";at.CLEARCOAT="clearcoat";at.CLEARCOAT_ROUGHNESS="clearcoatRoughness";at.CLEARCOAT_NORMAL="clearcoatNormal";at.EMISSIVE="emissive";at.ROTATION="rotation";at.SHEEN="sheen";at.SHEEN_ROUGHNESS="sheenRoughness";at.ANISOTROPY="anisotropy";at.IRIDESCENCE="iridescence";at.IRIDESCENCE_IOR="iridescenceIOR";at.IRIDESCENCE_THICKNESS="iridescenceThickness";at.IOR="ior";at.TRANSMISSION="transmission";at.THICKNESS="thickness";at.ATTENUATION_DISTANCE="attenuationDistance";at.ATTENUATION_COLOR="attenuationColor";at.LINE_SCALE="scale";at.LINE_DASH_SIZE="dashSize";at.LINE_GAP_SIZE="gapSize";at.LINE_WIDTH="linewidth";at.LINE_DASH_OFFSET="dashOffset";at.POINT_SIZE="size";at.DISPERSION="dispersion";at.LIGHT_MAP="light";at.AO="ao";var Wie=xt(at,at.ALPHA_TEST),jie=xt(at,at.COLOR),Xie=xt(at,at.SHININESS),$ie=xt(at,at.EMISSIVE),kz=xt(at,at.OPACITY),Yie=xt(at,at.SPECULAR),qU=xt(at,at.SPECULAR_INTENSITY),Zie=xt(at,at.SPECULAR_COLOR),eS=xt(at,at.SPECULAR_STRENGTH),HR=xt(at,at.REFLECTIVITY),Kie=xt(at,at.ROUGHNESS),Qie=xt(at,at.METALNESS),Jie=xt(at,at.NORMAL),ere=xt(at,at.CLEARCOAT),tre=xt(at,at.CLEARCOAT_ROUGHNESS),nre=xt(at,at.CLEARCOAT_NORMAL),ire=xt(at,at.ROTATION),rre=xt(at,at.SHEEN),sre=xt(at,at.SHEEN_ROUGHNESS),ore=xt(at,at.ANISOTROPY),are=xt(at,at.IRIDESCENCE),lre=xt(at,at.IRIDESCENCE_IOR),cre=xt(at,at.IRIDESCENCE_THICKNESS),ure=xt(at,at.TRANSMISSION),hre=xt(at,at.THICKNESS),fre=xt(at,at.IOR),dre=xt(at,at.ATTENUATION_DISTANCE),pre=xt(at,at.ATTENUATION_COLOR),zz=xt(at,at.LINE_SCALE),Vz=xt(at,at.LINE_DASH_SIZE),Gz=xt(at,at.LINE_GAP_SIZE),u4=xt(at,at.LINE_WIDTH),qz=xt(at,at.LINE_DASH_OFFSET),mre=xt(at,at.POINT_SIZE),Are=xt(at,at.DISPERSION),Hz=xt(at,at.LIGHT_MAP),gre=xt(at,at.AO),Y_=Xt(new Oe).onReference(function(i){return i.material}).onRenderUpdate(function({material:i}){this.value.set(i.anisotropy*Math.cos(i.anisotropyRotation),i.anisotropy*Math.sin(i.anisotropyRotation))}),vre=me(i=>i.context.setupModelViewProjection(),"vec4").once()().toVarying("v_modelViewProjection"),el=class i extends Kt{static get type(){return"EventNode"}constructor(e,t){super("void"),this.eventType=e,this.callback=t,e===i.OBJECT?this.updateType=yn.OBJECT:e===i.MATERIAL?this.updateType=yn.RENDER:e===i.FRAME?this.updateType=yn.FRAME:e===i.BEFORE_OBJECT?this.updateBeforeType=yn.OBJECT:e===i.BEFORE_MATERIAL?this.updateBeforeType=yn.RENDER:e===i.BEFORE_FRAME&&(this.updateBeforeType=yn.FRAME)}update(e){this.callback(e)}updateBefore(e){this.callback(e)}};el.OBJECT="object";el.MATERIAL="material";el.FRAME="frame";el.BEFORE_OBJECT="beforeObject";el.BEFORE_MATERIAL="beforeMaterial";el.BEFORE_FRAME="beforeFrame";var gx=(i,e)=>new el(i,e).toStack(),CS=i=>gx(el.OBJECT,i),xEe=i=>gx(el.MATERIAL,i),_re=i=>gx(el.FRAME,i),yEe=i=>gx(el.BEFORE_OBJECT,i),bEe=i=>gx(el.BEFORE_MATERIAL,i),wEe=i=>gx(el.BEFORE_FRAME,i),HU=class extends Xd{static get type(){return"StorageArrayElementNode"}constructor(e,t){super(e,t),this.isStorageArrayElementNode=!0}set storageBufferNode(e){this.node=e}get storageBufferNode(){return this.node}getMemberType(e,t){let n=this.storageBufferNode.structTypeNode;return n?n.getMemberType(e,t):"void"}setup(e){return e.isAvailable("storageBuffer")===!1&&this.node.isPBO===!0&&e.setupPBO(this.node),super.setup(e)}generate(e,t){let n,r=e.isContextAssign();if(e.isAvailable("storageBuffer")===!1?this.node.isPBO===!0&&r!==!0&&(this.node.value.isInstancedBufferAttribute||e.shaderStage!=="compute")?n=e.generatePBO(this):n=this.node.build(e):n=super.generate(e),r!==!0){let s=this.getNodeType(e);n=e.format(n,s,t)}return n}},SEe=$n(HU).setParameterLength(2),WU=class extends uS{static get type(){return"StorageBufferNode"}constructor(e,t=null,n=0){let r,s=null;t&&t.isStructTypeNode?(r="struct",s=t,(e.isStorageBufferAttribute||e.isStorageInstancedBufferAttribute)&&(n=e.count)):t===null&&(e.isStorageBufferAttribute||e.isStorageInstancedBufferAttribute)?(r=Nte(e.itemSize),n=e.count):r=t,super(e,r,n),this.isStorageBufferNode=!0,this.structTypeNode=s,this.access=$o.READ_WRITE,this.isAtomic=!1,this.isPBO=!1,this._attribute=null,this._varying=null,this.global=!0,e.isStorageBufferAttribute!==!0&&e.isStorageInstancedBufferAttribute!==!0&&(e.isInstancedBufferAttribute?e.isStorageInstancedBufferAttribute=!0:e.isStorageBufferAttribute=!0)}getHash(e){let t;if(this.bufferCount===0){let n=e.globalCache.getData(this.value);n===void 0&&(n={node:this},e.globalCache.setData(this.value,n)),t=n.node.id}else t=this.id;return String(t)}getInputType(){return this.value.isIndirectStorageBufferAttribute?"indirectStorageBuffer":"storageBuffer"}element(e){return SEe(this,e)}setPBO(e){return this.isPBO=e,this}getPBO(){return this.isPBO}setAccess(e){return this.access=e,this}toReadOnly(){return this.setAccess($o.READ_ONLY)}setAtomic(e){return this.isAtomic=e,this}toAtomic(){return this.setAtomic(!0)}getAttributeData(){return this._attribute===null&&(this._attribute=bz(this.value),this._varying=gm(this._attribute)),{attribute:this._attribute,varying:this._varying}}generateNodeType(e){if(this.structTypeNode!==null)return this.structTypeNode.getNodeType(e);if(e.isAvailable("storageBuffer")||e.isAvailable("indirectStorageBuffer"))return super.generateNodeType(e);let{attribute:t}=this.getAttributeData();return t.getNodeType(e)}getMemberType(e,t){return this.structTypeNode!==null?this.structTypeNode.getMemberType(e,t):"void"}generate(e){if(this.structTypeNode!==null&&this.structTypeNode.build(e),e.isAvailable("storageBuffer")||e.isAvailable("indirectStorageBuffer"))return super.generate(e);let{attribute:t,varying:n}=this.getAttributeData(),r=n.build(e);return e.registerTransform(r,t),r}},hm=(i,e=null,t=0)=>new WU(i,e,t),jU=new WeakMap,yee=new WeakMap,XU=new WeakMap;function xre(i,e){let t,n=Math.max(e.count,1);if(e.isStorageInstancedBufferAttribute===!0)t=hm(e,"mat4",n).element(Xu);else if(n*16*4<=i.getUniformBufferLimit())t=Ax(e.array,"mat4",n).element(Xu);else{let o=jU.get(e);o||(o=new Lh(e.array,16,1),jU.set(e,o));let a=e.usage===og?wz:xI,l=[a(o,"vec4",16,0),a(o,"vec4",16,4),a(o,"vec4",16,8),a(o,"vec4",16,12)];t=um(...l)}return t}function TEe(i,e,t){let n=XU.get(i);if(n===void 0){let r=e.clone();n={previousInstanceMatrix:r,node:xre(t,r)},XU.set(i,n)}return n.node}var Wz=r1("vec3","vInstanceColor"),yre=me(([i,e=null],t)=>{let n=i.isStorageInstancedBufferAttribute===!0,r=e&&e.isStorageInstancedBufferAttribute===!0,s=xre(t,i),o=null;n||Math.max(i.count,1)*16*4>t.getUniformBufferLimit()&&(o=jU.get(i));let a=null,l=null;if(e)if(r)a=hm(e,"vec3",Math.max(e.count,1)).element(Xu);else{let u=yee.get(e);u||(u=new Yl(e.array,3),yee.set(e,u)),l=u;let f=e.usage===og?wz:xI;a=pe(f(u,"vec3",3,0))}(o!==null||l!==null)&&_re(()=>{o!==null&&(o.clearUpdateRanges(),o.updateRanges.push(...i.updateRanges),i.version!==o.version&&(o.version=i.version)),e&&l!==null&&(l.clearUpdateRanges(),l.updateRanges.push(...e.updateRanges),e.version!==l.version&&(l.version=e.version))});let c=s.mul(Er).xyz;if(Er.assign(c),t.needsPreviousData()){let u=t.object;CS(({object:d})=>{XU.get(d).previousInstanceMatrix.array.set(i.array)});let f=TEe(u,i,t);Kg.assign(f.mul(Kg).xyz)}if(t.hasGeometryAttribute("normal")){let u=Nz(ba,s);ba.assign(u)}a!==null&&Wz.assign(a)},"void"),bre=me(([i])=>{let{instanceMatrix:e,instanceColor:t}=i;yre(e,t)},"void"),EEe=me(([i,e])=>{let t=de(Yg(_s(i),0).x).toConst(),n=de(e),r=n.mod(t).toConst(),s=n.div(t).toConst();return _s(i,kr(r,s))}),MEe=me(([i,e])=>{let t=de(Yg(_s(i),0).x).toConst(),n=de(e).mod(t).toConst(),r=de(e).div(t).toConst();return _s(i,kr(n,r)).x}),jz=r1("vec4","vBatchColor"),wre=me(([i],e)=>{let t=e.getDrawIndex()===null?Xu:lie,n=MEe(i._indirectTexture,de(t)),r=i._matricesTexture,s=de(Yg(_s(r),0).x).toConst(),o=oe(n).mul(4).toInt().toConst(),a=o.mod(s).toConst(),l=o.div(s).toConst(),c=um(_s(r,kr(a,l)),_s(r,kr(a.add(1),l)),_s(r,kr(a.add(2),l)),_s(r,kr(a.add(3),l))),u=i._colorsTexture;if(u!==null){let y=EEe(u,n);jz.assign(y)}let f=To(c);Er.assign(c.mul(Er));let d=ba.div(pe(f[0].dot(f[0]),f[1].dot(f[1]),f[2].dot(f[2]))),A=f.mul(d).xyz;ba.assign(A),e.hasGeometryAttribute("tangent")&&pm.mulAssign(f)},"void"),h4=new WeakMap,f4=new WeakMap;function Xz(i,e,t,n,r,s){let o=i.element(r.x),a=i.element(r.y),l=i.element(r.z),c=i.element(r.w),u=t.mul(e),f=Ls(o.mul(s.x).mul(u),a.mul(s.y).mul(u),l.mul(s.z).mul(u),c.mul(s.w).mul(u));return n.mul(f).xyz}function Sre(i,e,t,n,r,s,o){let a=i.element(s.x),l=i.element(s.y),c=i.element(s.z),u=i.element(s.w),f=Ls(o.x.mul(a),o.y.mul(l),o.z.mul(c),o.w.mul(u));f=r.mul(f).mul(n);let d=f.transformDirection(e).xyz,A=f.transformDirection(t).xyz;return{skinNormal:d,skinTangent:A}}function Tre(i,e,t,n,r){let s=i.skeleton,o=f4.get(s);if(o===void 0){s.update();let a=new Float32Array(s.boneMatrices);o={previousBoneMatrices:a,node:Ax(a,"mat4",s.bones.length)},f4.set(s,o)}return Xz(o.node,Kg,e,t,n,r)}var Ere=me(([i],e)=>{let t=cc("skinIndex","uvec4"),n=cc("skinWeight","vec4"),r=mr("bindMatrix","mat4"),s=mr("bindMatrixInverse","mat4"),o=Lie("skeleton.boneMatrices","mat4",i.skeleton.bones.length);if(CS(({object:l,frameId:c})=>{let u=l.skeleton;if(h4.get(u)!==c){h4.set(u,c);let f=f4.get(u);f!==void 0&&f.previousBoneMatrices.set(u.boneMatrices),u.update()}}),e.needsPreviousData()){let l=Tre(i,r,s,t,n);Kg.assign(l)}let a=Xz(o,Er,r,s,t,n);if(Er.assign(a),e.hasGeometryAttribute("normal")){let{skinNormal:l,skinTangent:c}=Sre(o,ba,pm,r,s,t,n);ba.assign(l),e.hasGeometryAttribute("tangent")&&pm.assign(c)}},"void"),CEe=me(([i,e=null],t)=>{let n=hm(new Yl(i.geometry.getAttribute("position").array,3),"vec3").setPBO(!0).toReadOnly().element(Xu).toVar(),r=hm(new Yl(new Uint32Array(i.geometry.getAttribute("skinIndex").array),4),"uvec4").setPBO(!0).toReadOnly().element(Xu).toVar(),s=hm(new Yl(i.geometry.getAttribute("skinWeight").array,4),"vec4").setPBO(!0).toReadOnly().element(Xu).toVar(),o=Xt(i.bindMatrix,"mat4"),a=Xt(i.bindMatrixInverse,"mat4"),l=Ax(i.skeleton.boneMatrices,"mat4",i.skeleton.bones.length),c=i.skeleton;if(CS(({frameId:f})=>{if(h4.get(c)!==f){h4.set(c,f);let d=f4.get(c);d!==void 0&&d.previousBoneMatrices.set(c.boneMatrices),c.update()}}),t.needsPreviousData()){let f=Tre(i,o,a,r,s);Kg.assign(f)}let u=Xz(l,n,o,a,r,s);if(e!==null&&e.assign(u),t.hasGeometryAttribute("normal")){let{skinNormal:f,skinTangent:d}=Sre(l,ba,pm,o,a,r,s);ba.assign(f),t.hasGeometryAttribute("tangent")&&pm.assign(d)}return u}),$U=class extends Kt{static get type(){return"LoopNode"}constructor(e=[]){super("void"),this.params=e}getVarName(e){return String.fromCharCode(105+e)}getProperties(e){let t=e.getNodeProperties(this);if(t.stackNode!==void 0)return t;let n={};for(let a=0,l=this.params.length-1;a<l;a++){let c=this.params[a],u=c.isNode!==!0&&c.name||this.getVarName(a),f=c.isNode!==!0&&c.type||"int";n[u]=lc(u,f)}let r=e.addStack(),s=this.params[this.params.length-1](n);t.returnsNode=s.context({nodeLoop:s}),t.stackNode=r;let o=this.params[0];if(o.isNode!==!0&&typeof o.update=="function"){let a=me(this.params[0].update)(n);t.updateNode=a.context({nodeLoop:a})}return e.removeStack(),t}setup(e){if(this.getProperties(e),e.fnCall){let t=e.getDataFromNode(e.fnCall.shaderNode);t.hasLoop=!0}}generate(e){let t=this.getProperties(e),n=this.params,r=t.stackNode;for(let o=0,a=n.length-1;o<a;o++){let l=n[o],c=!1,u=null,f=null,d=null,A=null,y=null,w=null;l.isNode?l.getNodeType(e)==="bool"?(c=!0,A="bool",f=l.build(e,A)):(A="int",d=this.getVarName(o),u="0",f=l.build(e,A),y="<"):(A=l.type||"int",d=l.name||this.getVarName(o),u=l.start,f=l.end,y=l.condition,w=l.update,typeof u=="number"?u=e.generateConst(A,u):u&&u.isNode&&(u=u.build(e,A)),typeof f=="number"?f=e.generateConst(A,f):f&&f.isNode&&(f=f.build(e,A)),u!==void 0&&f===void 0?(u=u+" - 1",f="0",y=">="):f!==void 0&&u===void 0&&(u="0",y="<"),y===void 0&&(Number(u)>Number(f)?y=">=":y="<"));let S;if(c)S=`while ( ${f} )`;else{let T={start:u,end:f},R=T.start,P=T.end,I,F=()=>y.includes("<")?"+=":"-=";if(w!=null)switch(typeof w){case"function":I=e.flowStagesNode(t.updateNode,"void").code.replace(/\t|;/g,"");break;case"number":I=d+" "+F()+" "+e.generateConst(A,w);break;case"string":I=d+" "+w;break;default:w.isNode?I=d+" "+F()+" "+w.build(e):(ze("TSL: 'Loop( { update: ... } )' is not a function, string or number.",this.stackTrace),I="break /* invalid update */")}else A==="int"||A==="uint"?w=y.includes("<")?"++":"--":w=F()+" 1.",I=d+" "+w;let D=e.getVar(A,d)+" = "+R,L=d+" "+y+" "+P;S=`for ( ${D}; ${L}; ${I} )`}e.addFlowCode((o===0?`4152+`,kA(o)}return n}},zie=(i,e=null)=>new WU(Ht(i),e).toStack();Ue("debug",zie);var p4=class extends ca{constructor(){super(),this._renderer=null,this.currentFrame=null}get nodeFrame(){return this._renderer._nodes.nodeFrame}setRenderer(e){return this._renderer=e,this}getRenderer(){return this._renderer}init(){}begin(){}finish(){}inspect(){}computeAsync(){}beginCompute(){}finishCompute(){}beginRender(){}finishRender(){}copyTextureToTexture(){}copyFramebufferToTexture(){}},jU=class extends Kt{static get type(){return"InspectorNode"}constructor(e,t="",n=null){super(),this.node=e,this.name=t,this.callback=n,this.updateType=yn.FRAME,this.isInspectorNode=!0}getName(){return this.name||this.node.name}update(e){e.renderer.inspector.inspect(this)}generateNodeType(e){return this.node.getNodeType(e)}setup(e){let t=this.node;return e.context.inspector===!0&&this.callback!==null&&(t=this.callback(t)),e.renderer.backend.isWebGPUBackend!==!0&&e.renderer.inspector.constructor!==p4&&ni('TSL: ".toInspector()" is only available with WebGPU.'),t}};function Vie(i,e="",t=null){return i=Ht(i),i.before(new jU(i,e,t))}Ue("toInspector",Vie);function AEe(i){Xe("TSL: AddNodeElement has been removed in favor of tree-shaking. Trying add",i)}var m4=class extends Kt{static get type(){return"AttributeNode"}constructor(e,t=null){super(t),this.global=!0,this._attributeName=e}getHash(e){return this.getAttributeName(e)}generateNodeType(e){let t=this.nodeType;if(t===null){let n=this.getAttributeName(e);if(e.hasGeometryAttribute(n)){let r=e.geometry.getAttribute(n);t=e.getTypeFromAttribute(r)}else t="float"}return t}setAttributeName(e){return this._attributeName=e,this}getAttributeName(){return this._attributeName}generate(e){let t=this.getAttributeName(e),n=this.getNodeType(e);if(e.hasGeometryAttribute(t)===!0){let s=e.geometry.getAttribute(t),o=e.getTypeFromAttribute(s),a=e.getAttribute(t,o);return e.shaderStage==="vertex"?e.format(a.name,o,n):ym(this).build(e,n)}else return Xe(`AttributeNode: Vertex attribute "${t}" not found on geometry.`),e.generateConst(n)}serialize(e){super.serialize(e),e.global=this.global,e._attributeName=this._attributeName}deserialize(e){super.deserialize(e),this.global=e.global,this._attributeName=e._attributeName}},fc=(i,e=null)=>new m4(i,e),Ui=(i=0)=>fc("uv"+(i>0?i:""),"vec2"),XU=class extends Kt{static get type(){return"TextureSizeNode"}constructor(e,t=null){super("uvec2"),this.isTextureSizeNode=!0,this.textureNode=e,this.levelNode=t}generate(e,t){let n=this.textureNode.build(e,"property"),r=this.levelNode===null?"0":this.levelNode.build(e,"int");return e.format(`${e.getMethod("textureDimensions")}( ${n}, ${r} )`,this.getNodeType(e),t)}},e1=$n(XU).setParameterLength(1,2),$U=class extends Qg{static get type(){return"MaxMipLevelNode"}constructor(e){super(0),this._textureNode=e,this.updateType=yn.FRAME}get textureNode(){return this._textureNode}get texture(){return this._textureNode.value}update(){let e=this.texture,t=e.images,n=t&&t.length>0?t[0]&&t[0].image||t[0]:e.image;if(n&&n.width!==void 0){let{width:r,height:s}=n;this.value=Math.log2(Math.max(r,s))}}},Yz=$n($U).setParameterLength(1),A4=class extends Error{constructor(e,t=null){super(e),this.name="NodeError",this.stackTrace=t}},Zz=new qs,su=class extends Qg{static get type(){return"TextureNode"}constructor(e=Zz,t=null,n=null,r=null){super(e),this.isTextureNode=!0,this.uvNode=t,this.levelNode=n,this.biasNode=r,this.compareNode=null,this.depthNode=null,this.gradNode=null,this.gatherNode=null,this.offsetNode=null,this.sampler=!0,this.updateMatrix=!1,this.updateType=yn.NONE,this.referenceNode=null,this._value=e,this._matrixUniform=null,this._flipYUniform=null,this.setUpdateMatrix(t===null)}set value(e){this.referenceNode?this.referenceNode.value=e:this._value=e}get value(){return this.referenceNode?this.referenceNode.value:this._value}getUniformHash(){return this.value.uuid}generateNodeType(){return this.value.isDepthTexture===!0?this.gatherNode===null?"float":"vec4":this.value.type===xi?"uvec4":this.value.type===Kr?"ivec4":"vec4"}getInputType(){return"texture"}getDefaultUV(){return Ui(this.value.channel)}updateReference(){return this.value}getTransformedUV(e){return this._matrixUniform===null&&(this._matrixUniform=Xt(this.value.matrix)),this._matrixUniform.mul(pe(e,1)).xy}setUpdateMatrix(e){return this.updateMatrix=e,this}setupUV(e,t){return e.isFlipY()&&(this._flipYUniform===null&&(this._flipYUniform=Xt(!1)),t=t.toVar(),this.sampler?t=this._flipYUniform.select(t.flipY(),t):t=this._flipYUniform.select(t.setY(de(e1(this,this.levelNode).y).sub(t.y).sub(1)),t)),t}setup(e){let t=e.getNodeProperties(this);t.referenceNode=this.referenceNode;let n=this.value;if(!n||n.isTexture!==!0)throw new A4("THREE.TSL: `texture( value )` function expects a valid instance of THREE.Texture().",this.stackTrace);let r=me(()=>{let l=this.uvNode;return(l===null||e.context.forceUVContext===!0)&&e.context.getUV&&(l=e.context.getUV(this,e)),l||(l=this.getDefaultUV()),this.updateMatrix===!0&&(l=this.getTransformedUV(l)),l=this.setupUV(e,l),this.updateType=this._matrixUniform!==null||this._flipYUniform!==null?yn.OBJECT:yn.NONE,l})(),s=this.levelNode;s===null&&e.context.getTextureLevel&&(s=e.context.getTextureLevel(this));let o=null,a=null;if(this.compareNode!==null)if(e.renderer.hasCompatibility(Bd.TEXTURE_COMPARE))o=this.compareNode;else{let l=n.compareFunction;l===null||l===h_||l===Xh||l===ug||l===Fu?a=this.compareNode:(o=this.compareNode,ni('TSL: Only "LessCompare", "LessEqualCompare", "GreaterCompare" and "GreaterEqualCompare" are supported for depth texture comparison fallback.'))}t.uvNode=r,t.levelNode=s,t.biasNode=this.biasNode,t.compareNode=o,t.compareStepNode=a,t.gradNode=this.gradNode,t.gatherNode=this.gatherNode,t.depthNode=this.depthNode,t.offsetNode=this.offsetNode}generateUV(e,t){return t.build(e,this.sampler===!0?"vec2":"ivec2")}generateOffset(e,t){return t.build(e,"ivec2")}generateSnippet(e,t,n,r,s,o,a,l,c,u,f){let d=this.value,A;return s?A=e.generateTextureBias(d,t,n,s,o,u):l?A=e.generateTextureGrad(d,t,n,l,o,u):c?a?A=e.generateTextureGatherCompare(d,t,n,a,o,u,f):A=e.generateTextureGather(d,t,n,c,o,u,f):a?A=e.generateTextureCompare(d,t,n,a,o,u):this.sampler===!1?A=e.generateTextureLoad(d,t,n,r,o,u):r?A=e.generateTextureLevel(d,t,n,r,o,u):A=e.generateTexture(d,t,n,o,u),A}generate(e,t){let n=this.value,r=e.getNodeProperties(this),s=super.generate(e,"property");if(/^sampler/.test(t))return s+"_sampler";if(e.isReference(t))return s;{let o=e.getDataFromNode(this),a=this.getNodeType(e),l=o.propertyName;if(l===void 0){let{uvNode:u,levelNode:f,biasNode:d,compareNode:A,compareStepNode:y,depthNode:w,gradNode:S,gatherNode:T,offsetNode:R}=r,I=this.generateUV(e,u),P=f?f.build(e,"float"):null,F=d?d.build(e,"float"):null,D=w?w.build(e,"int"):null,L=A?A.build(e,"float"):null,C=y?y.build(e,"float"):null,B=S?[S[0].build(e,"vec2"),S[1].build(e,"vec2")]:null,k=T?T.build(e,"int"):null,z=R?this.generateOffset(e,R):null,G=this._flipYUniform?this._flipYUniform.build(e,"bool"):null;k&&(a="vec4");let W=D;W===null&&n.isArrayTexture&&this.isTexture3DNode!==!0&&(W="0");let Y=e.getVarFromNode(this);l=e.getPropertyName(Y);let H=this.generateSnippet(e,s,I,P,F,W,L,B,k,z,G);if(C!==null){let $=n.compareFunction;$===ug||$===Fu?H=Jg(hc(H,a),hc(C,"float")).build(e,a):H=Jg(hc(C,"float"),hc(H,a)).build(e,a)}e.addLineFlowCode(`${l} = ${H}`,this),o.snippet=H,o.propertyName=l}let c=l;return e.needsToWorkingColorSpace(n)&&(c=EP(hc(c,a),n.colorSpace).setup(e).build(e,a)),e.format(c,a,t)}}setSampler(e){return this.sampler=e,this}getSampler(){return this.sampler}sample(e){let t=this.clone();return t.uvNode=Ht(e),t.referenceNode=this.getBase(),Ht(t)}load(e){return this.sample(e).setSampler(!1)}blur(e){let t=this.clone();t.biasNode=Ht(e).mul(Yz(t)),t.referenceNode=this.getBase();let n=t.value;return t.generateMipmaps===!1&&(n&&n.generateMipmaps===!1||n.minFilter===Ti||n.magFilter===Ti)&&(Xe("TSL: texture().blur() requires mipmaps and sampling. Use .generateMipmaps=true and .minFilter/.magFilter=THREE.LinearFilter in the Texture."),t.biasNode=null),Ht(t)}level(e){let t=this.clone();return t.levelNode=Ht(e),t.referenceNode=this.getBase(),Ht(t)}size(e){return e1(this,e)}bias(e){let t=this.clone();return t.biasNode=Ht(e),t.referenceNode=this.getBase(),Ht(t)}getBase(){return this.referenceNode?this.referenceNode.getBase():this}compare(e){let t=this.clone();return t.compareNode=Ht(e),t.referenceNode=this.getBase(),Ht(t)}grad(e,t){let n=this.clone();return n.gradNode=[Ht(e),Ht(t)],n.referenceNode=this.getBase(),Ht(n)}gather(e=0){let t=this.clone();return t.gatherNode=Ht(e),t.referenceNode=this.getBase(),Ht(t)}depth(e){let t=this.clone();return t.depthNode=Ht(e),t.referenceNode=this.getBase(),Ht(t)}offset(e){let t=this.clone();return t.offsetNode=Ht(e),t.referenceNode=this.getBase(),Ht(t)}serialize(e){super.serialize(e),e.value=this.value.toJSON(e.meta).uuid,e.sampler=this.sampler,e.updateMatrix=this.updateMatrix,e.updateType=this.updateType}deserialize(e){super.deserialize(e),this.value=e.meta.textures[e.value],this.sampler=e.sampler,this.updateMatrix=e.updateMatrix,this.updateType=e.updateType}update(){let e=this.value,t=this._matrixUniform;t!==null&&(t.value=e.matrix),e.matrixAutoUpdate===!0&&e.updateMatrix();let n=this._flipYUniform;n!==null&&(n.value=e.image instanceof ImageBitmap&&e.flipY===!0||e.isRenderTargetTexture===!0||e.isFramebufferTexture===!0||e.isDepthTexture===!0)}clone(){let e=new this.constructor(this.value,this.uvNode,this.levelNode,this.biasNode);return e.sampler=this.sampler,e.depthNode=this.depthNode,e.compareNode=this.compareNode,e.gradNode=this.gradNode,e.gatherNode=this.gatherNode,e.offsetNode=this.offsetNode,e}},gEe=$n(su).setParameterLength(1,4).setName("texture"),fi=(i=Zz,e=null,t=null,n=null)=>{let r;return i&&i.isTextureNode===!0?(r=Ht(i.clone()),r.referenceNode=i.getBase(),e!==null&&(r.uvNode=Ht(e)),t!==null&&(r.levelNode=Ht(t)),n!==null&&(r.biasNode=Ht(n))):r=gEe(i,e,t,n),r},vEe=(i=Zz)=>fi(i),_s=(...i)=>fi(...i).setSampler(!1),_Ee=(i,e,t)=>fi(i,e).level(t),xEe=i=>(i.isNode===!0?i:fi(i)).convert("sampler"),yEe=i=>(i.isNode===!0?i:fi(i)).convert("samplerComparison"),AS=class extends Qg{static get type(){return"BufferNode"}constructor(e,t,n=0){super(e,t),this.isBufferNode=!0,this.bufferType=t,this.bufferCount=n,this.updateRanges=[]}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}getElementType(e){return this.getNodeType(e)}getInputType(){return"buffer"}},bx=(i,e,t)=>new AS(i,e,t),YU=class extends Zd{static get type(){return"UniformArrayElementNode"}constructor(e,t){super(e,t),this.isArrayBufferElementNode=!0}generate(e){let t=super.generate(e),n=this.getNodeType(e),r=this.node.getPaddedType();return e.format(t,r,n)}},ZU=class extends AS{static get type(){return"UniformArrayNode"}constructor(e,t=null){super(null),this.array=e,this.elementType=t===null?fm(e[0]):t,this.paddedType=this.getPaddedType(),this.updateType=yn.RENDER,this.isArrayBufferNode=!0}generateNodeType(){return this.paddedType}getElementType(){return this.elementType}getPaddedType(){let e=this.elementType,t="vec4";return e==="mat2"?t="mat2":/mat/.test(e)===!0?t="mat4":e.charAt(0)==="i"?t="ivec4":e.charAt(0)==="u"&&(t="uvec4"),t}update(){let{array:e,value:t}=this,n=this.elementType;if(n==="float"||n==="int"||n==="uint")for(let r=0;r<e.length;r++){let s=r*4;t[s]=e[r]}else if(n==="color")for(let r=0;r<e.length;r++){let s=r*4,o=e[r];t[s]=o.r,t[s+1]=o.g,t[s+2]=o.b||0}else if(n==="mat2")for(let r=0;r<e.length;r++){let s=r*4,o=e[r];t[s]=o.elements[0],t[s+1]=o.elements[1],t[s+2]=o.elements[2],t[s+3]=o.elements[3]}else if(n==="mat3")for(let r=0;r<e.length;r++){let s=r*16,o=e[r];t[s]=o.elements[0],t[s+1]=o.elements[1],t[s+2]=o.elements[2],t[s+4]=o.elements[3],t[s+5]=o.elements[4],t[s+6]=o.elements[5],t[s+8]=o.elements[6],t[s+9]=o.elements[7],t[s+10]=o.elements[8],t[s+15]=1}else if(n==="mat4")for(let r=0;r<e.length;r++){let s=r*16,o=e[r];for(let a=0;a<o.elements.length;a++)t[s+a]=o.elements[a]}else for(let r=0;r<e.length;r++){let s=r*4,o=e[r];t[s]=o.x,t[s+1]=o.y,t[s+2]=o.z||0,t[s+3]=o.w||0}}setup(e){let t=this.array.length,n=this.elementType,r=Float32Array,s=this.paddedType,o=e.getTypeLength(s);return n.charAt(0)==="i"&&(r=Int32Array),n.charAt(0)==="u"&&(r=Uint32Array),this.value=new r(t*o),this.bufferCount=t,this.bufferType=s,this.update(),super.setup(e)}element(e){return new YU(this,Ht(e))}},$o=(i,e)=>new ZU(i,e),KU=class extends Kt{constructor(e){super("float"),this.name=e,this.isBuiltinNode=!0}generate(){return this.name}},tp=$n(KU).setParameterLength(1),Bw,Ow,Zo=class i extends Kt{static get type(){return"ScreenNode"}constructor(e){super(),this.scope=e,this._output=null,this.isViewportNode=!0}generateNodeType(){return this.scope===i.DPR?"float":this.scope===i.VIEWPORT?"vec4":"vec2"}getUpdateType(){let e=yn.NONE;return(this.scope===i.SIZE||this.scope===i.VIEWPORT||this.scope===i.DPR)&&(e=yn.RENDER),this.updateType=e,e}update({renderer:e}){let t=e.getRenderTarget();this.scope===i.VIEWPORT?t!==null?Ow.copy(t.viewport):(e.getViewport(Ow),Ow.multiplyScalar(e.getPixelRatio())):this.scope===i.DPR?this._output.value=e.getPixelRatio():t!==null?(Bw.width=t.width,Bw.height=t.height):e.getDrawingBufferSize(Bw)}setup(){let e=this.scope,t=null;return e===i.SIZE?t=Xt(Bw||(Bw=new Oe)):e===i.VIEWPORT?t=Xt(Ow||(Ow=new xn)):e===i.DPR?t=Xt(1):t=dt(u1.div(t1)),this._output=t,t}generate(e){if(this.scope===i.COORDINATE){let t=e.getFragCoord();if(e.isFlipY()){let n=e.getNodeProperties(t1).outputNode.build(e);t=`${e.getType("vec2")}( ${t}.x, ${n}.y - ${t}.y )`}return t}return super.generate(e)}};Zo.COORDINATE="coordinate";Zo.VIEWPORT="viewport";Zo.SIZE="size";Zo.UV="uv";Zo.DPR="dpr";var Kz=xt(Zo,Zo.DPR),ju=xt(Zo,Zo.UV),t1=xt(Zo,Zo.SIZE),u1=xt(Zo,Zo.COORDINATE),ux=xt(Zo,Zo.VIEWPORT),Qz=ux.zw,Gie=u1.sub(ux.xy),bEe=Gie.div(Qz),wEe=me(()=>(Xe('TSL: "viewportResolution" is deprecated. Use "screenSize" instead.',new ts),t1),"vec2").once()(),UO=null,dR=null,kO=null,pR=null,zO=null,mR=null,VO=null,AR=null,GO=null,gR=null,qO=null,vR=null,HO=null,_R=null,bm=Xt(0,"uint").setName("u_cameraIndex").setGroup(xP("cameraIndex")).toVarying("v_cameraIndex"),lm=Xt("float").setName("cameraNear").setGroup(Jt).onRenderUpdate(({camera:i})=>i.near),cm=Xt("float").setName("cameraFar").setGroup(Jt).onRenderUpdate(({camera:i})=>i.far),Ja=me(({camera:i})=>{let e;if(i.isArrayCamera&&i.cameras.length>0){let t=[];for(let n of i.cameras)t.push(n.projectionMatrix);dR===null?dR=$o(t).setGroup(Jt).setName("cameraProjectionMatrices"):dR.array=t,e=dR.element(i.isMultiViewCamera?tp("gl_ViewID_OVR"):bm)}else UO===null&&(UO=Xt(i.projectionMatrix).setName("cameraProjectionMatrix").setGroup(Jt).onRenderUpdate(({camera:t})=>t.projectionMatrix)),e=UO;return e}).once()(),qie=me(({camera:i})=>{let e;if(i.isArrayCamera&&i.cameras.length>0){let t=[];for(let n of i.cameras)t.push(n.projectionMatrixInverse);pR===null?pR=$o(t).setGroup(Jt).setName("cameraProjectionMatricesInverse"):pR.array=t,e=pR.element(i.isMultiViewCamera?tp("gl_ViewID_OVR"):bm)}else kO===null&&(kO=Xt(i.projectionMatrixInverse).setName("cameraProjectionMatrixInverse").setGroup(Jt).onRenderUpdate(({camera:t})=>t.projectionMatrixInverse)),e=kO;return e}).once()(),wm=me(({camera:i})=>{let e;if(i.isArrayCamera&&i.cameras.length>0){let t=[];for(let n of i.cameras)t.push(n.matrixWorldInverse);mR===null?mR=$o(t).setGroup(Jt).setName("cameraViewMatrices"):mR.array=t,e=mR.element(i.isMultiViewCamera?tp("gl_ViewID_OVR"):bm)}else zO===null&&(zO=Xt(i.matrixWorldInverse).setName("cameraViewMatrix").setGroup(Jt).onRenderUpdate(({camera:t})=>t.matrixWorldInverse)),e=zO;return e}).once()(),DS=me(({camera:i})=>{let e;if(i.isArrayCamera&&i.cameras.length>0){let t=[];for(let n of i.cameras)t.push(n.matrixWorld);AR===null?AR=$o(t).setGroup(Jt).setName("cameraWorldMatrices"):AR.array=t,e=AR.element(i.isMultiViewCamera?tp("gl_ViewID_OVR"):bm)}else VO===null&&(VO=Xt(i.matrixWorld).setName("cameraWorldMatrix").setGroup(Jt).onRenderUpdate(({camera:t})=>t.matrixWorld)),e=VO;return e}).once()(),SEe=me(({camera:i})=>{let e;if(i.isArrayCamera&&i.cameras.length>0){let t=[];for(let n of i.cameras)t.push(n.normalMatrix);gR===null?gR=$o(t).setGroup(Jt).setName("cameraNormalMatrices"):gR.array=t,e=gR.element(i.isMultiViewCamera?tp("gl_ViewID_OVR"):bm)}else GO===null&&(GO=Xt(i.normalMatrix).setName("cameraNormalMatrix").setGroup(Jt).onRenderUpdate(({camera:t})=>t.normalMatrix)),e=GO;return e}).once()(),Hie=me(({camera:i})=>{let e;if(i.isArrayCamera&&i.cameras.length>0){let t=[];for(let n=0,r=i.cameras.length;n<r;n++)t.push(new re);vR===null?vR=$o(t).setGroup(Jt).setName("cameraPositions").onRenderUpdate(({camera:n},r)=>{let s=n.cameras,o=r.array;for(let a=0,l=s.length;a<l;a++)o[a].setFromMatrixPosition(s[a].matrixWorld)}):vR.array=t,e=vR.element(i.isMultiViewCamera?tp("gl_ViewID_OVR"):bm)}else qO===null&&(qO=Xt(new re).setName("cameraPosition").setGroup(Jt).onRenderUpdate(({camera:t},n)=>n.value.setFromMatrixPosition(t.matrixWorld))),e=qO;return e}).once()(),TEe=me(({camera:i})=>{let e;if(i.isArrayCamera&&i.cameras.length>0){let t=[];for(let n of i.cameras)t.push(n.viewport);_R===null?_R=$o(t,"vec4").setGroup(Jt).setName("cameraViewports"):_R.array=t,e=_R.element(bm)}else HO===null&&(HO=Ft(0,0,t1.x,t1.y).toConst("cameraViewport")),e=HO;return e}).once()(),qee=new yl,Is=class i extends Kt{static get type(){return"Object3DNode"}constructor(e,t=null){super(),this.scope=e,this.object3d=t,this.updateType=yn.OBJECT,this.uniformNode=new Qg(null)}generateNodeType(){let e=this.scope;if(e===i.WORLD_MATRIX)return"mat4";if(e===i.POSITION||e===i.VIEW_POSITION||e===i.DIRECTION||e===i.SCALE)return"vec3";if(e===i.RADIUS)return"float"}update(e){let t=this.object3d,n=this.uniformNode,r=this.scope;if(r===i.WORLD_MATRIX)n.value=t.matrixWorld;else if(r===i.POSITION)n.value=n.value||new re,n.value.setFromMatrixPosition(t.matrixWorld);else if(r===i.SCALE)n.value=n.value||new re,n.value.setFromMatrixScale(t.matrixWorld);else if(r===i.DIRECTION)n.value=n.value||new re,t.getWorldDirection(n.value);else if(r===i.VIEW_POSITION){let s=e.camera;n.value=n.value||new re,n.value.setFromMatrixPosition(t.matrixWorld),n.value.applyMatrix4(s.matrixWorldInverse)}else if(r===i.RADIUS){let s=e.object.geometry;s.boundingSphere===null&&s.computeBoundingSphere(),qee.copy(s.boundingSphere).applyMatrix4(t.matrixWorld),n.value=qee.radius}}generate(e){let t=this.scope;return t===i.WORLD_MATRIX?this.uniformNode.nodeType="mat4":t===i.POSITION||t===i.VIEW_POSITION||t===i.DIRECTION||t===i.SCALE?this.uniformNode.nodeType="vec3":t===i.RADIUS&&(this.uniformNode.nodeType="float"),this.uniformNode.build(e)}serialize(e){super.serialize(e),e.scope=this.scope}deserialize(e){super.deserialize(e),this.scope=e.scope}};Is.WORLD_MATRIX="worldMatrix";Is.POSITION="position";Is.SCALE="scale";Is.VIEW_POSITION="viewPosition";Is.DIRECTION="direction";Is.RADIUS="radius";var EEe=$n(Is,Is.DIRECTION).setParameterLength(1),MEe=$n(Is,Is.WORLD_MATRIX).setParameterLength(1),CEe=$n(Is,Is.POSITION).setParameterLength(1),REe=$n(Is,Is.SCALE).setParameterLength(1),PEe=$n(Is,Is.VIEW_POSITION).setParameterLength(1),IEe=$n(Is,Is.RADIUS).setParameterLength(1),Il=class extends Is{static get type(){return"ModelNode"}constructor(e){super(e)}update(e){this.object3d=e.object,super.update(e)}},LEe=xt(Il,Il.DIRECTION),tu=xt(Il,Il.WORLD_MATRIX),DEe=xt(Il,Il.POSITION),NEe=xt(Il,Il.SCALE),FEe=xt(Il,Il.VIEW_POSITION),BEe=xt(Il,Il.RADIUS),Wie=Xt(new Mn).onObjectUpdate(({object:i},e)=>e.value.getNormalMatrix(i.matrixWorld)),OEe=Xt(new cn).onObjectUpdate(({object:i},e)=>e.value.copy(i.matrixWorld).invert()),bf=me(i=>i.context.modelViewMatrix||jie).once()().toVar("modelViewMatrix"),jie=wm.mul(tu),QU=me(i=>(i.context.isHighPrecisionModelViewMatrix=!0,Xt("mat4").onObjectUpdate(({object:e,camera:t})=>e.modelViewMatrix.multiplyMatrices(t.matrixWorldInverse,e.matrixWorld)))).once()().toVar("highpModelViewMatrix"),JU=me(i=>{let e=i.context.isHighPrecisionModelViewMatrix;return Xt("mat3").onObjectUpdate(({object:t,camera:n})=>(e!==!0&&t.modelViewMatrix.multiplyMatrices(n.matrixWorldInverse,t.matrixWorld),t.normalMatrix.getNormalMatrix(t.modelViewMatrix)))}).once()().toVar("highpModelNormalViewMatrix"),Xie=me(i=>i.shaderStage!=="fragment"?(ni("TSL: `clipSpace` is only available in fragment stage."),Ft()):i.context.clipSpace.toVarying("v_clipSpace")).once()(),va=fc("position","vec3"),Mr=va.toVarying("positionLocal"),n1=va.toVarying("positionPrevious"),_f=me(i=>tu.mul(Mr).xyz.toVarying(i.getSubBuildProperty("v_positionWorld")),"vec3").once(["POSITION"])(),Jz=me(()=>Mr.transformDirection(tu).toVarying("v_positionWorldDirection").normalize().toVar("positionWorldDirection"),"vec3").once(["POSITION"])(),xs=me(i=>{if(i.shaderStage==="fragment"&&i.material.vertexNode){let e=qie.mul(Xie);return e.xyz.div(e.w).toVar("positionView")}return i.context.setupPositionView().toVarying("v_positionView")},"vec3").once(["POSITION","VERTEX"])(),er=me(i=>{let e;return i.camera.isOrthographicCamera?e=pe(0,0,1):e=xs.negate().toVarying("v_positionViewDirection").normalize(),e.toVar("positionViewDirection")},"vec3").once(["POSITION"])(),e7=class extends Kt{static get type(){return"FrontFacingNode"}constructor(){super("bool"),this.isFrontFacingNode=!0}generate(e){if(e.shaderStage!=="fragment")return"true";let{material:t}=e;return t.side===mi?"false":e.getFrontFacing()}},$ie=xt(e7),eV=oe($ie).mul(2).sub(1),h1=me(([i],{material:e})=>{let t=e.side;return t===mi?i=i.mul(-1):t===vr&&(i=i.mul(eV)),i}),UEe=i=>(ni('TSL: "directionToFaceDirection()" has been renamed to "negateOnBackSide()".'),h1(i)),RP=fc("normal","vec3"),wa=me(i=>i.geometry.hasAttribute("normal")===!1?(Xe('TSL: Vertex attribute "normal" not found on geometry.'),pe(0,1,0)):RP,"vec3").once()().toVar("normalLocal"),Yie=xs.dFdx().cross(xs.dFdy()).normalize().toVar("normalFlat"),dx=me(i=>{let e;return i.isFlatShading()?e=Yie:e=nV(wa).toVarying("v_normalViewGeometry").normalize(),e},"vec3").once()().toVar("normalViewGeometry"),Zie=me(i=>{let e=dx.transformNormalByInverseViewMatrix(wm);return i.isFlatShading()!==!0&&(e=e.toVarying("v_normalWorldGeometry")),e.normalize().toVar("normalWorldGeometry")},"vec3").once()(),hi=me(i=>{let e;return i.subBuildFn==="NORMAL"||i.subBuildFn==="VERTEX"?(e=dx,i.isFlatShading()!==!0&&(e=h1(e))):e=i.context.setupNormal().context({getUV:null,getTextureLevel:null}),e},"vec3").once(["NORMAL","VERTEX"])().toVar("normalView"),Sm=hi.transformNormalByInverseViewMatrix(wm).toVar("normalWorld"),um=me(({subBuildFn:i,context:e})=>{let t;return i==="NORMAL"||i==="VERTEX"?t=hi:t=e.setupClearcoatNormal().context({getUV:null,getTextureLevel:null}),t},"vec3").once(["NORMAL","VERTEX"])().toVar("clearcoatNormalView"),tV=me(([i,e=tu])=>To(e).inverse().transpose().mul(i).normalize());Ue("transformNormal",tV);var nV=me(([i],e)=>{let t=e.context.modelNormalViewMatrix;return t?i.transformNormalByViewMatrix(t):Wie.mul(i).transformNormalByViewMatrix(wm)}),kEe=me(()=>(Xe('TSL: "transformedNormalView" is deprecated. Use "normalView" instead.'),hi)).once(["NORMAL","VERTEX"])(),zEe=me(()=>(Xe('TSL: "transformedNormalWorld" is deprecated. Use "normalWorld" instead.'),Sm)).once(["NORMAL","VERTEX"])(),VEe=me(()=>(Xe('TSL: "transformedClearcoatNormalView" is deprecated. Use "clearcoatNormalView" instead.'),um)).once(["NORMAL","VERTEX"])(),WO=new cn,Kie=Xt(0).onReference(({material:i})=>i).onObjectUpdate(({material:i})=>i.refractionRatio),KR=Xt(1).onReference(({material:i})=>i).onObjectUpdate(function({material:i,scene:e}){return i.envMap?i.envMapIntensity:e.environmentIntensity}),g4=Xt(new cn).onReference(function(i){return i.material}).onObjectUpdate(function({material:i,scene:e}){let n=(e.environment!==null||e.environmentNode&&e.environmentNode.isNode)&&i.envMap===null?e.environmentRotation:i.envMapRotation;return n?WO.makeRotationFromEuler(n).transpose():WO.identity(),WO}),Qie=er.negate().reflect(hi),Jie=er.negate().refract(hi,Kie),ere=Qie.transformDirection(DS).toVar("reflectVector"),tre=Jie.transformDirection(DS).toVar("refractVector"),nre=new Ph,t7=class extends su{static get type(){return"CubeTextureNode"}constructor(e,t=null,n=null,r=null){super(e,t,n,r),this.isCubeTextureNode=!0}getInputType(){return this.value.isDepthTexture===!0?"cubeDepthTexture":"cubeTexture"}getDefaultUV(){let e=this.value;return e.mapping===ec?ere:e.mapping===Gc?tre:(ze('CubeTextureNode: Mapping "%s" not supported.',e.mapping),pe(0,0,0))}setUpdateMatrix(){}setupUV(e,t){let n=this.value;return n.isDepthTexture===!0?e.renderer.coordinateSystem===xl?pe(t.x,t.y.negate(),t.z):t:(t=g4.mul(t),(e.renderer.coordinateSystem===xl||!n.isRenderTargetTexture)&&(t=pe(t.x.negate(),t.yz)),t)}generateUV(e,t){return t.build(e,this.sampler===!0?"vec3":"ivec3")}},iV=$n(t7).setParameterLength(1,4).setName("cubeTexture"),Qa=(i=nre,e=null,t=null,n=null)=>{let r;return i&&i.isCubeTextureNode===!0?(r=Ht(i.clone()),r.referenceNode=i,e!==null&&(r.uvNode=Ht(e)),t!==null&&(r.levelNode=Ht(t)),n!==null&&(r.biasNode=Ht(n))):r=iV(i,e,t,n),r},GEe=(i=nre)=>iV(i),n7=class extends Zd{static get type(){return"ReferenceElementNode"}constructor(e,t){super(e,t),this.referenceNode=e,this.isReferenceElementNode=!0}generateNodeType(){return this.referenceNode.uniformType}generate(e){let t=super.generate(e),n=this.referenceNode.getNodeType(e),r=this.getNodeType(e);return e.format(t,n,r)}},px=class extends Kt{static get type(){return"ReferenceNode"}constructor(e,t,n=null,r=null){super(),this.property=e,this.uniformType=t,this.object=n,this.count=r,this.properties=e.split("."),this.reference=n,this.node=null,this.group=null,this.name=null,this.updateType=yn.OBJECT}element(e){return new n7(this,Ht(e))}setGroup(e){return this.group=e,this}setName(e){return this.name=e,this}label(e){return Xe('TSL: "label()" has been deprecated. Use "setName()" instead.'),this.setName(e)}setNodeType(e){let t=null;this.count!==null?t=bx(null,e,this.count):Array.isArray(this.getValueFromReference())?(t=$o(null,e),t.updateType=yn.OBJECT):e==="texture"?t=fi(null):e==="cubeTexture"?t=Qa(null):t=Xt(null,e),this.group!==null&&t.setGroup(this.group),this.name!==null&&t.setName(this.name),this.node=t}generateNodeType(e){return this.node===null&&(this.updateReference(e),this.updateValue()),this.node.getNodeType(e)}getValueFromReference(e=this.reference){let{properties:t}=this,n=e[t[0]];for(let r=1;r<t.length;r++)n=n[t[r]];return n}updateReference(e){return this.reference=this.object!==null?this.object:e.object,this.reference}setup(){return this.updateValue(),this.node}update(){this.updateValue()}updateValue(){this.node===null&&this.setNodeType(this.uniformType);let e=this.getValueFromReference();Array.isArray(e)?this.node.array=e:this.node.value=e}},mr=(i,e,t)=>new px(i,e,t),ire=(i,e,t,n)=>new px(i,e,n,t),i7=class extends px{static get type(){return"MaterialReferenceNode"}constructor(e,t,n=null){super(e,t,n),this.material=n,this.isMaterialReferenceNode=!0}updateReference(e){return this.reference=this.material!==null?this.material:e.material,this.reference}},Xd=(i,e,t=null)=>new i7(i,e,t),rre=Ui(),qEe=xs.dFdx(),HEe=xs.dFdy(),sre=rre.dFdx(),ore=rre.dFdy(),are=hi,lre=HEe.cross(are),cre=are.cross(qEe),r7=lre.mul(sre.x).add(cre.mul(ore.x)),s7=lre.mul(sre.y).add(cre.mul(ore.y)),Hee=r7.dot(r7).max(s7.dot(s7)),ure=Hee.equal(0).select(0,Hee.inverseSqrt()),WEe=r7.mul(ure).toVar("tangentViewFrame"),jEe=s7.mul(ure).toVar("bitangentViewFrame"),PP=fc("tangent","vec4"),vm=PP.xyz.toVar("tangentLocal"),IP=me(i=>{let e;return i.subBuildFn==="VERTEX"||i.geometry.hasAttribute("tangent")?e=bf.mul(Ft(vm,0)).xyz.toVarying("v_tangentView").normalize():e=WEe,i.isFlatShading()!==!0&&(e=h1(e)),e},"vec3").once(["NORMAL","VERTEX"])().toVar("tangentView"),hre=IP.transformDirection(DS).toVarying("v_tangentWorld").normalize().toVar("tangentWorld"),LP=me(([i,e],t)=>{let n=i.mul(PP.w).xyz;return t.subBuildFn==="NORMAL"&&t.isFlatShading()!==!0&&(n=n.toVarying(e)),n}).once(["NORMAL"]),XEe=LP(RP.cross(PP),"v_bitangentGeometry").normalize().toVar("bitangentGeometry"),$Ee=LP(wa.cross(vm),"v_bitangentLocal").normalize().toVar("bitangentLocal"),fre=me(i=>{let e;return i.subBuildFn==="VERTEX"||i.geometry.hasAttribute("tangent")?e=LP(hi.cross(IP),"v_bitangentView").normalize():e=jEe,i.isFlatShading()!==!0&&(e=h1(e)),e},"vec3").once(["NORMAL","VERTEX"])().toVar("bitangentView"),YEe=LP(Sm.cross(hre),"v_bitangentWorld").normalize().toVar("bitangentWorld"),qg=To(IP,fre,hi).toVar("TBNViewMatrix"),dre=er.mul(qg),ZEe=(i,e)=>i.sub(dre.mul(e)),pre=me(()=>{let i=jg.cross(er);return i=i.cross(jg).normalize(),i=Qn(i,hi,om.mul(pf.oneMinus()).oneMinus().pow2().pow2()).normalize(),i}).once()(),rV=i=>Ht(i).mul(.5).add(.5),mre=i=>Ht(i).mul(2).sub(1),o7=i=>pe(i,el(TP(oe(1).sub(ru(i,i))))),KEe=i=>(ni('TSL: "directionToColor()" has been renamed to "packNormalToRGB()".'),rV(i)),QEe=i=>(ni('TSL: "colorToDirection()" has been renamed to "unpackRGBToNormal()".'),mre(i)),a7=class extends Rr{static get type(){return"NormalMapNode"}constructor(e,t=null){super("vec3"),this.node=e,this.scaleNode=t,this.normalMapType=tc,this.unpackNormalMode=Lb}setup(e){let{normalMapType:t,scaleNode:n,unpackNormalMode:r}=this,s=this.node.mul(2).sub(1);if(t===tc?r===zM?s=o7(s.xy):r===eF?s=o7(s.yw):r!==Lb&&ze(`THREE.NodeMaterial: Unexpected unpack normal mode: ${r}`):r!==Lb&&ze(`THREE.NodeMaterial: Normal map type '${t}' is not compatible with unpack normal mode '${r}'`),n!==null){let a=n;e.isFlatShading()===!0&&(a=h1(a)),s=pe(s.xy.mul(a),s.z)}let o=null;return t===kM?o=nV(s):t===tc?o=qg.mul(s).normalize():(ze(`NodeMaterial: Unsupported normal map type: ${t}`),o=hi),o}},l7=$n(a7).setParameterLength(1,2),JEe=me(({textureNode:i,bumpScale:e})=>{let t=r=>i.isolate().context({getUV:s=>r(s.uvNode||Ui()),forceUVContext:!0}),n=oe(t(r=>r));return dt(oe(t(r=>r.add(r.dFdx()))).sub(n),oe(t(r=>r.add(r.dFdy()))).sub(n)).mul(e)}),e3e=me(i=>{let{surf_pos:e,surf_norm:t,dHdxy:n}=i,r=e.dFdx().normalize(),s=e.dFdy().normalize(),o=t,a=s.cross(o),l=o.cross(r),c=r.dot(a).mul(eV),u=c.sign().mul(n.x.mul(a).add(n.y.mul(l)));return c.abs().mul(t).sub(u).normalize()}),c7=class extends Rr{static get type(){return"BumpMapNode"}constructor(e,t=null){super("vec3"),this.textureNode=e,this.scaleNode=t}setup(e){if(e.material.wireframe===!0)return hi;let t=this.scaleNode!==null?this.scaleNode:1,n=JEe({textureNode:this.textureNode,bumpScale:t});return e3e({surf_pos:xs,surf_norm:hi,dHdxy:n})}},sV=$n(c7).setParameterLength(1,2),Wee=new Map,at=class i extends Kt{static get type(){return"MaterialNode"}constructor(e){super(),this.scope=e}getCache(e,t){let n=Wee.get(e);return n===void 0&&(n=Xd(e,t),Wee.set(e,n)),n}getFloat(e){return this.getCache(e,"float")}getColor(e){return this.getCache(e,"color")}getTexture(e){return this.getCache(e==="map"?"map":e+"Map","texture")}setup(e){let t=e.context.material,n=this.scope,r=null;if(n===i.COLOR){let s=t.color!==void 0?this.getColor(n):pe();t.map&&t.map.isTexture===!0?r=s.mul(this.getTexture("map")):r=s}else if(n===i.OPACITY){let s=this.getFloat(n);t.alphaMap&&t.alphaMap.isTexture===!0?r=s.mul(this.getTexture("alpha")):r=s}else if(n===i.SPECULAR_STRENGTH)t.specularMap&&t.specularMap.isTexture===!0?r=this.getTexture("specular").r:r=oe(1);else if(n===i.SPECULAR_INTENSITY){let s=this.getFloat(n);t.specularIntensityMap&&t.specularIntensityMap.isTexture===!0?r=s.mul(this.getTexture(n).a):r=s}else if(n===i.SPECULAR_COLOR){let s=this.getColor(n);t.specularColorMap&&t.specularColorMap.isTexture===!0?r=s.mul(this.getTexture(n).rgb):r=s}else if(n===i.ROUGHNESS){let s=this.getFloat(n);t.roughnessMap&&t.roughnessMap.isTexture===!0?r=s.mul(this.getTexture(n).g):r=s}else if(n===i.METALNESS){let s=this.getFloat(n);t.metalnessMap&&t.metalnessMap.isTexture===!0?r=s.mul(this.getTexture(n).b):r=s}else if(n===i.EMISSIVE){let s=this.getFloat("emissiveIntensity"),o=this.getColor(n).mul(s);t.emissiveMap&&t.emissiveMap.isTexture===!0?r=o.mul(this.getTexture(n)):r=o}else if(n===i.NORMAL)t.normalMap?(r=l7(this.getTexture("normal"),this.getCache("normalScale","vec2")),r.normalMapType=t.normalMapType,(t.normalMap.format==Ws||t.normalMap.format==jh||t.normalMap.format==Wh)&&(r.unpackNormalMode=zM)):t.bumpMap?r=sV(this.getTexture("bump").r,this.getFloat("bumpScale")):r=hi;else if(n===i.CLEARCOAT){let s=this.getFloat(n);t.clearcoatMap&&t.clearcoatMap.isTexture===!0?r=s.mul(this.getTexture(n).r):r=s}else if(n===i.CLEARCOAT_ROUGHNESS){let s=this.getFloat(n);t.clearcoatRoughnessMap&&t.clearcoatRoughnessMap.isTexture===!0?r=s.mul(this.getTexture(n).r):r=s}else if(n===i.CLEARCOAT_NORMAL)t.clearcoatNormalMap?r=l7(this.getTexture(n),this.getCache(n+"Scale","vec2")):r=hi;else if(n===i.SHEEN){let s=this.getColor("sheenColor").mul(this.getFloat("sheen"));t.sheenColorMap&&t.sheenColorMap.isTexture===!0?r=s.mul(this.getTexture("sheenColor").rgb):r=s}else if(n===i.SHEEN_ROUGHNESS){let s=this.getFloat(n);t.sheenRoughnessMap&&t.sheenRoughnessMap.isTexture===!0?r=s.mul(this.getTexture(n).a):r=s,r=r.clamp(1e-4,1)}else if(n===i.ANISOTROPY)if(t.anisotropyMap&&t.anisotropyMap.isTexture===!0){let s=this.getTexture(n);r=vP(tx.x,tx.y,tx.y.negate(),tx.x).mul(s.rg.mul(2).sub(dt(1)).normalize().mul(s.b))}else r=tx;else if(n===i.IRIDESCENCE_THICKNESS){let s=mr("1","float",t.iridescenceThicknessRange);if(t.iridescenceThicknessMap){let o=mr("0","float",t.iridescenceThicknessRange);r=s.sub(o).mul(this.getTexture(n).g).add(o)}else r=s}else if(n===i.TRANSMISSION){let s=this.getFloat(n);t.transmissionMap?r=s.mul(this.getTexture(n).r):r=s}else if(n===i.THICKNESS){let s=this.getFloat(n);t.thicknessMap?r=s.mul(this.getTexture(n).g):r=s}else if(n===i.IOR)r=this.getFloat(n);else if(n===i.LIGHT_MAP)t.lightMap?r=this.getTexture(n).rgb.mul(this.getFloat("lightMapIntensity")):r=pe(0);else if(n===i.AO)t.aoMap?r=this.getTexture(n).r.sub(1).mul(this.getFloat("aoMapIntensity")).add(1):r=oe(1);else if(n===i.LINE_DASH_OFFSET)r=t.dashOffset?this.getFloat(n):oe(0);else{let s=this.getNodeType(e);r=this.getCache(n,s)}return r}};at.ALPHA_TEST="alphaTest";at.COLOR="color";at.OPACITY="opacity";at.SHININESS="shininess";at.SPECULAR="specular";at.SPECULAR_STRENGTH="specularStrength";at.SPECULAR_INTENSITY="specularIntensity";at.SPECULAR_COLOR="specularColor";at.REFLECTIVITY="reflectivity";at.ROUGHNESS="roughness";at.METALNESS="metalness";at.NORMAL="normal";at.CLEARCOAT="clearcoat";at.CLEARCOAT_ROUGHNESS="clearcoatRoughness";at.CLEARCOAT_NORMAL="clearcoatNormal";at.EMISSIVE="emissive";at.ROTATION="rotation";at.SHEEN="sheen";at.SHEEN_ROUGHNESS="sheenRoughness";at.ANISOTROPY="anisotropy";at.IRIDESCENCE="iridescence";at.IRIDESCENCE_IOR="iridescenceIOR";at.IRIDESCENCE_THICKNESS="iridescenceThickness";at.IOR="ior";at.TRANSMISSION="transmission";at.THICKNESS="thickness";at.ATTENUATION_DISTANCE="attenuationDistance";at.ATTENUATION_COLOR="attenuationColor";at.LINE_SCALE="scale";at.LINE_DASH_SIZE="dashSize";at.LINE_GAP_SIZE="gapSize";at.LINE_WIDTH="linewidth";at.LINE_DASH_OFFSET="dashOffset";at.POINT_SIZE="size";at.DISPERSION="dispersion";at.LIGHT_MAP="light";at.AO="ao";var Are=xt(at,at.ALPHA_TEST),gre=xt(at,at.COLOR),vre=xt(at,at.SHININESS),_re=xt(at,at.EMISSIVE),oV=xt(at,at.OPACITY),xre=xt(at,at.SPECULAR),u7=xt(at,at.SPECULAR_INTENSITY),yre=xt(at,at.SPECULAR_COLOR),oS=xt(at,at.SPECULAR_STRENGTH),QR=xt(at,at.REFLECTIVITY),bre=xt(at,at.ROUGHNESS),wre=xt(at,at.METALNESS),Sre=xt(at,at.NORMAL),Tre=xt(at,at.CLEARCOAT),Ere=xt(at,at.CLEARCOAT_ROUGHNESS),Mre=xt(at,at.CLEARCOAT_NORMAL),Cre=xt(at,at.ROTATION),Rre=xt(at,at.SHEEN),Pre=xt(at,at.SHEEN_ROUGHNESS),Ire=xt(at,at.ANISOTROPY),Lre=xt(at,at.IRIDESCENCE),Dre=xt(at,at.IRIDESCENCE_IOR),Nre=xt(at,at.IRIDESCENCE_THICKNESS),Fre=xt(at,at.TRANSMISSION),Bre=xt(at,at.THICKNESS),Ore=xt(at,at.IOR),Ure=xt(at,at.ATTENUATION_DISTANCE),kre=xt(at,at.ATTENUATION_COLOR),aV=xt(at,at.LINE_SCALE),lV=xt(at,at.LINE_DASH_SIZE),cV=xt(at,at.LINE_GAP_SIZE),v4=xt(at,at.LINE_WIDTH),uV=xt(at,at.LINE_DASH_OFFSET),zre=xt(at,at.POINT_SIZE),Vre=xt(at,at.DISPERSION),hV=xt(at,at.LIGHT_MAP),Gre=xt(at,at.AO),tx=Xt(new Oe).onReference(function(i){return i.material}).onRenderUpdate(function({material:i}){this.value.set(i.anisotropy*Math.cos(i.anisotropyRotation),i.anisotropy*Math.sin(i.anisotropyRotation))}),qre=me(i=>i.context.setupModelViewProjection(),"vec4").once()().toVarying("v_modelViewProjection"),tl=class i extends Kt{static get type(){return"EventNode"}constructor(e,t){super("void"),this.eventType=e,this.callback=t,e===i.OBJECT?this.updateType=yn.OBJECT:e===i.MATERIAL?this.updateType=yn.RENDER:e===i.FRAME?this.updateType=yn.FRAME:e===i.BEFORE_OBJECT?this.updateBeforeType=yn.OBJECT:e===i.BEFORE_MATERIAL?this.updateBeforeType=yn.RENDER:e===i.BEFORE_FRAME&&(this.updateBeforeType=yn.FRAME)}update(e){this.callback(e)}updateBefore(e){this.callback(e)}};tl.OBJECT="object";tl.MATERIAL="material";tl.FRAME="frame";tl.BEFORE_OBJECT="beforeObject";tl.BEFORE_MATERIAL="beforeMaterial";tl.BEFORE_FRAME="beforeFrame";var wx=(i,e)=>new tl(i,e).toStack(),NS=i=>wx(tl.OBJECT,i),t3e=i=>wx(tl.MATERIAL,i),Hre=i=>wx(tl.FRAME,i),n3e=i=>wx(tl.BEFORE_OBJECT,i),i3e=i=>wx(tl.BEFORE_MATERIAL,i),r3e=i=>wx(tl.BEFORE_FRAME,i),h7=class extends Zd{static get type(){return"StorageArrayElementNode"}constructor(e,t){super(e,t),this.isStorageArrayElementNode=!0}set storageBufferNode(e){this.node=e}get storageBufferNode(){return this.node}getMemberType(e,t){let n=this.storageBufferNode.structTypeNode;return n?n.getMemberType(e,t):"void"}setup(e){return e.isAvailable("storageBuffer")===!1&&this.node.isPBO===!0&&e.setupPBO(this.node),super.setup(e)}generate(e,t){let n,r=e.isContextAssign();if(e.isAvailable("storageBuffer")===!1?this.node.isPBO===!0&&r!==!0&&(this.node.value.isInstancedBufferAttribute||e.shaderStage!=="compute")?n=e.generatePBO(this):n=this.node.build(e):n=super.generate(e),r!==!0){let s=this.getNodeType(e);n=e.format(n,s,t)}return n}},s3e=$n(h7).setParameterLength(2),f7=class extends AS{static get type(){return"StorageBufferNode"}constructor(e,t=null,n=0){let r,s=null;t&&t.isStructTypeNode?(r="struct",s=t,(e.isStorageBufferAttribute||e.isStorageInstancedBufferAttribute)&&(n=e.count)):t===null&&(e.isStorageBufferAttribute||e.isStorageInstancedBufferAttribute)?(r=sne(e.itemSize),n=e.count):r=t,super(e,r,n),this.isStorageBufferNode=!0,this.structTypeNode=s,this.access=Yo.READ_WRITE,this.isAtomic=!1,this.isPBO=!1,this._attribute=null,this._varying=null,this.global=!0,e.isStorageBufferAttribute!==!0&&e.isStorageInstancedBufferAttribute!==!0&&(e.isInstancedBufferAttribute?e.isStorageInstancedBufferAttribute=!0:e.isStorageBufferAttribute=!0)}getHash(e){let t;if(this.bufferCount===0){let n=e.globalCache.getData(this.value);n===void 0&&(n={node:this},e.globalCache.setData(this.value,n)),t=n.node.id}else t=this.id;return String(t)}getInputType(){return this.value.isIndirectStorageBufferAttribute?"indirectStorageBuffer":"storageBuffer"}element(e){return s3e(this,e)}setPBO(e){return this.isPBO=e,this}getPBO(){return this.isPBO}setAccess(e){return this.access=e,this}toReadOnly(){return this.setAccess(Yo.READ_ONLY)}setAtomic(e){return this.isAtomic=e,this}toAtomic(){return this.setAtomic(!0)}getAttributeData(){return this._attribute===null&&(this._attribute=qz(this.value),this._varying=ym(this._attribute)),{attribute:this._attribute,varying:this._varying}}generateNodeType(e){if(this.structTypeNode!==null)return this.structTypeNode.getNodeType(e);if(e.isAvailable("storageBuffer")||e.isAvailable("indirectStorageBuffer"))return super.generateNodeType(e);let{attribute:t}=this.getAttributeData();return t.getNodeType(e)}getMemberType(e,t){return this.structTypeNode!==null?this.structTypeNode.getMemberType(e,t):"void"}generate(e){if(this.structTypeNode!==null&&this.structTypeNode.build(e),e.isAvailable("storageBuffer")||e.isAvailable("indirectStorageBuffer"))return super.generate(e);let{attribute:t,varying:n}=this.getAttributeData(),r=n.build(e);return e.registerTransform(r,t),r}},mm=(i,e=null,t=0)=>new f7(i,e,t),d7=new WeakMap,jee=new WeakMap,p7=new WeakMap;function Wre(i,e){let t,n=Math.max(e.count,1);if(e.isStorageInstancedBufferAttribute===!0)t=mm(e,"mat4",n).element(Xu);else if(n*16*4<=i.getUniformBufferLimit())t=bx(e.array,"mat4",n).element(Xu);else{let o=d7.get(e);o||(o=new Lh(e.array,16,1),d7.set(e,o));let a=e.usage===hg?Hz:CP,l=[a(o,"vec4",16,0),a(o,"vec4",16,4),a(o,"vec4",16,8),a(o,"vec4",16,12)];t=pm(...l)}return t}function o3e(i,e,t){let n=p7.get(i);if(n===void 0){let r=e.clone();n={previousInstanceMatrix:r,node:Wre(t,r)},p7.set(i,n)}return n.node}var fV=c1("vec3","vInstanceColor"),jre=me(([i,e=null],t)=>{let n=i.isStorageInstancedBufferAttribute===!0,r=e&&e.isStorageInstancedBufferAttribute===!0,s=Wre(t,i),o=null;n||Math.max(i.count,1)*16*4>t.getUniformBufferLimit()&&(o=d7.get(i));let a=null,l=null;if(e)if(r)a=mm(e,"vec3",Math.max(e.count,1)).element(Xu);else{let u=jee.get(e);u||(u=new Ql(e.array,3),jee.set(e,u)),l=u;let f=e.usage===hg?Hz:CP;a=pe(f(u,"vec3",3,0))}(o!==null||l!==null)&&Hre(()=>{o!==null&&(o.clearUpdateRanges(),o.updateRanges.push(...i.updateRanges),i.version!==o.version&&(o.version=i.version)),e&&l!==null&&(l.clearUpdateRanges(),l.updateRanges.push(...e.updateRanges),e.version!==l.version&&(l.version=e.version))});let c=s.mul(Mr).xyz;if(Mr.assign(c),t.needsPreviousData()){let u=t.object;NS(({object:d})=>{p7.get(d).previousInstanceMatrix.array.set(i.array)});let f=o3e(u,i,t);n1.assign(f.mul(n1).xyz)}if(t.hasGeometryAttribute("normal")){let u=tV(wa,s);wa.assign(u)}a!==null&&fV.assign(a)},"void"),Xre=me(([i])=>{let{instanceMatrix:e,instanceColor:t}=i;jre(e,t)},"void"),a3e=me(([i,e])=>{let t=de(e1(_s(i),0).x).toConst(),n=de(e),r=n.mod(t).toConst(),s=n.div(t).toConst();return _s(i,kr(r,s))}),l3e=me(([i,e])=>{let t=de(e1(_s(i),0).x).toConst(),n=de(e).mod(t).toConst(),r=de(e).div(t).toConst();return _s(i,kr(n,r)).x}),dV=c1("vec4","vBatchColor"),$re=me(([i],e)=>{let t=e.getDrawIndex()===null?Xu:Die,n=l3e(i._indirectTexture,de(t)),r=i._matricesTexture,s=de(e1(_s(r),0).x).toConst(),o=oe(n).mul(4).toInt().toConst(),a=o.mod(s).toConst(),l=o.div(s).toConst(),c=pm(_s(r,kr(a,l)),_s(r,kr(a.add(1),l)),_s(r,kr(a.add(2),l)),_s(r,kr(a.add(3),l))),u=i._colorsTexture;if(u!==null){let y=a3e(u,n);dV.assign(y)}let f=To(c);Mr.assign(c.mul(Mr));let d=wa.div(pe(f[0].dot(f[0]),f[1].dot(f[1]),f[2].dot(f[2]))),A=f.mul(d).xyz;wa.assign(A),e.hasGeometryAttribute("tangent")&&vm.mulAssign(f)},"void"),_4=new WeakMap,x4=new WeakMap;function pV(i,e,t,n,r,s){let o=i.element(r.x),a=i.element(r.y),l=i.element(r.z),c=i.element(r.w),u=t.mul(e),f=Ps(o.mul(s.x).mul(u),a.mul(s.y).mul(u),l.mul(s.z).mul(u),c.mul(s.w).mul(u));return n.mul(f).xyz}function Yre(i,e,t,n,r,s,o){let a=i.element(s.x),l=i.element(s.y),c=i.element(s.z),u=i.element(s.w),f=Ps(o.x.mul(a),o.y.mul(l),o.z.mul(c),o.w.mul(u));f=r.mul(f).mul(n);let d=f.transformDirection(e).xyz,A=f.transformDirection(t).xyz;return{skinNormal:d,skinTangent:A}}function Zre(i,e,t,n,r){let s=i.skeleton,o=x4.get(s);if(o===void 0){s.update();let a=new Float32Array(s.boneMatrices);o={previousBoneMatrices:a,node:bx(a,"mat4",s.bones.length)},x4.set(s,o)}return pV(o.node,n1,e,t,n,r)}var Kre=me(([i],e)=>{let t=fc("skinIndex","uvec4"),n=fc("skinWeight","vec4"),r=mr("bindMatrix","mat4"),s=mr("bindMatrixInverse","mat4"),o=ire("skeleton.boneMatrices","mat4",i.skeleton.bones.length);if(NS(({object:l,frameId:c})=>{let u=l.skeleton;if(_4.get(u)!==c){_4.set(u,c);let f=x4.get(u);f!==void 0&&f.previousBoneMatrices.set(u.boneMatrices),u.update()}}),e.needsPreviousData()){let l=Zre(i,r,s,t,n);n1.assign(l)}let a=pV(o,Mr,r,s,t,n);if(Mr.assign(a),e.hasGeometryAttribute("normal")){let{skinNormal:l,skinTangent:c}=Yre(o,wa,vm,r,s,t,n);wa.assign(l),e.hasGeometryAttribute("tangent")&&vm.assign(c)}},"void"),c3e=me(([i,e=null],t)=>{let n=mm(new Ql(i.geometry.getAttribute("position").array,3),"vec3").setPBO(!0).toReadOnly().element(Xu).toVar(),r=mm(new Ql(new Uint32Array(i.geometry.getAttribute("skinIndex").array),4),"uvec4").setPBO(!0).toReadOnly().element(Xu).toVar(),s=mm(new Ql(i.geometry.getAttribute("skinWeight").array,4),"vec4").setPBO(!0).toReadOnly().element(Xu).toVar(),o=Xt(i.bindMatrix,"mat4"),a=Xt(i.bindMatrixInverse,"mat4"),l=bx(i.skeleton.boneMatrices,"mat4",i.skeleton.bones.length),c=i.skeleton;if(NS(({frameId:f})=>{if(_4.get(c)!==f){_4.set(c,f);let d=x4.get(c);d!==void 0&&d.previousBoneMatrices.set(c.boneMatrices),c.update()}}),t.needsPreviousData()){let f=Zre(i,o,a,r,s);n1.assign(f)}let u=pV(l,n,o,a,r,s);if(e!==null&&e.assign(u),t.hasGeometryAttribute("normal")){let{skinNormal:f,skinTangent:d}=Yre(l,wa,vm,o,a,r,s);wa.assign(f),t.hasGeometryAttribute("tangent")&&vm.assign(d)}return u}),m7=class extends Kt{static get type(){return"LoopNode"}constructor(e=[]){super("void"),this.params=e}getVarName(e){return String.fromCharCode(105+e)}getProperties(e){let t=e.getNodeProperties(this);if(t.stackNode!==void 0)return t;let n={};for(let a=0,l=this.params.length-1;a<l;a++){let c=this.params[a],u=c.isNode!==!0&&c.name||this.getVarName(a),f=c.isNode!==!0&&c.type||"int";n[u]=hc(u,f)}let r=e.addStack(),s=this.params[this.params.length-1](n);t.returnsNode=s.context({nodeLoop:s}),t.stackNode=r;let o=this.params[0];if(o.isNode!==!0&&typeof o.update=="function"){let a=me(this.params[0].update)(n);t.updateNode=a.context({nodeLoop:a})}return e.removeStack(),t}setup(e){if(this.getProperties(e),e.fnCall){let t=e.getDataFromNode(e.fnCall.shaderNode);t.hasLoop=!0}}generate(e){let t=this.getProperties(e),n=this.params,r=t.stackNode;for(let o=0,a=n.length-1;o<a;o++){let l=n[o],c=!1,u=null,f=null,d=null,A=null,y=null,w=null;l.isNode?l.getNodeType(e)==="bool"?(c=!0,A="bool",f=l.build(e,A)):(A="int",d=this.getVarName(o),u="0",f=l.build(e,A),y="<"):(A=l.type||"int",d=l.name||this.getVarName(o),u=l.start,f=l.end,y=l.condition,w=l.update,typeof u=="number"?u=e.generateConst(A,u):u&&u.isNode&&(u=u.build(e,A)),typeof f=="number"?f=e.generateConst(A,f):f&&f.isNode&&(f=f.build(e,A)),u!==void 0&&f===void 0?(u=u+" - 1",f="0",y=">="):f!==void 0&&u===void 0&&(u="0",y="<"),y===void 0&&(Number(u)>Number(f)?y=">=":y="<"));let S;if(c)S=`while ( ${f} )`;else{let T={start:u,end:f},R=T.start,I=T.end,P,F=()=>y.includes("<")?"+=":"-=";if(w!=null)switch(typeof w){case"function":P=e.flowStagesNode(t.updateNode,"void").code.replace(/\t|;/g,"");break;case"number":P=d+" "+F()+" "+e.generateConst(A,w);break;case"string":P=d+" "+w;break;default:w.isNode?P=d+" "+F()+" "+w.build(e):(ze("TSL: 'Loop( { update: ... } )' is not a function, string or number.",this.stackTrace),P="break /* invalid update */")}else A==="int"||A==="uint"?w=y.includes("<")?"++":"--":w=F()+" 1.",P=d+" "+w;let D=e.getVar(A,d)+" = "+R,L=d+" "+y+" "+I;S=`for ( ${D}; ${L}; ${P} )`}e.addFlowCode((o===0?`41534153 `:"")+e.tab+S+` {41544154 41554155 `).addFlowTab()}let s=r.build(e,"void");t.returnsNode.build(e,"void"),e.removeFlowTab().addFlowCode(`41564156 `+e.tab+s);for(let o=0,a=this.params.length-1;o<a;o++)e.addFlowCode((o===0?"":e.tab)+`}41574157 4158-`).removeFlowTab();e.addFlowTab()}},Oi=(...i)=>new $U(zg(i,"int")).toStack(),REe=()=>lc("continue").toStack(),Mre=()=>lc("break").toStack(),TO=new WeakMap,nc=new xn,bee=new WeakMap,wee=me(({bufferMap:i,influence:e,stride:t,width:n,depth:r,offset:s})=>{let o=de(aie).mul(t).add(s),a=o.div(n),l=o.sub(a.mul(n));return _s(i,kr(l,a)).depth(r).xyz.mul(e)});function IEe(i){let e=i.morphAttributes.position!==void 0,t=i.morphAttributes.normal!==void 0,n=i.morphAttributes.color!==void 0,r=i.morphAttributes.position||i.morphAttributes.normal||i.morphAttributes.color,s=r!==void 0?r.length:0,o=TO.get(i);if(o===void 0||o.count!==s){let T=function(){w.dispose(),TO.delete(i),i.removeEventListener("dispose",T)};o!==void 0&&o.texture.dispose();let a=i.morphAttributes.position||[],l=i.morphAttributes.normal||[],c=i.morphAttributes.color||[],u=0;e===!0&&(u=1),t===!0&&(u=2),n===!0&&(u=3);let f=i.attributes.position.count*u,d=1,A=4096;f>A&&(d=Math.ceil(f/A),f=A);let y=new Float32Array(f*d*4*s),w=new FA(y,f,d,s);w.type=cr,w.needsUpdate=!0;let S=u*4;for(let R=0;R<s;R++){let P=a[R],I=l[R],F=c[R],D=f*d*4*R;for(let L=0;L<P.count;L++){let C=L*S;e===!0&&(nc.fromBufferAttribute(P,L),y[D+C+0]=nc.x,y[D+C+1]=nc.y,y[D+C+2]=nc.z,y[D+C+3]=0),t===!0&&(nc.fromBufferAttribute(I,L),y[D+C+4]=nc.x,y[D+C+5]=nc.y,y[D+C+6]=nc.z,y[D+C+7]=0),n===!0&&(nc.fromBufferAttribute(F,L),y[D+C+8]=nc.x,y[D+C+9]=nc.y,y[D+C+10]=nc.z,y[D+C+11]=F.itemSize===4?nc.w:1)}}o={count:s,texture:w,stride:u,size:new Oe(f,d)},TO.set(i,o),i.addEventListener("dispose",T)}return o}var Cre=me(([i])=>{let{geometry:e}=i,t=e.morphAttributes.position!==void 0,n=e.hasAttribute("normal")&&e.morphAttributes.normal!==void 0,r=e.morphAttributes.position||e.morphAttributes.normal||e.morphAttributes.color,s=r!==void 0?r.length:0;if(s===0)return;let o=bee.get(i);(o===void 0||o.count!==s)&&(o={base:Xt(1),influences:i.morphTargetInfluences?Xo(i.morphTargetInfluences,"float"):null,count:s},bee.set(i,o));let{base:a,influences:l}=o,{texture:c,stride:u,size:f}=IEe(e);t===!0&&Er.mulAssign(a),n===!0&&ba.mulAssign(a);let d=de(f.width);Oi(s,({i:A})=>{let y=oe(0).toVar();i.count>1&&i.morphTexture!==null&&i.morphTexture!==void 0?y.assign(_s(i.morphTexture,kr(de(A).add(1),de(Xu))).r):y.assign(l.element(A).toVar()),$t(y.notEqual(0),()=>{t===!0&&Er.addAssign(wee({bufferMap:c,influence:y,stride:u,width:d,depth:A,offset:de(0)})),n===!0&&ba.addAssign(wee({bufferMap:c,influence:y,stride:u,width:d,depth:A,offset:de(1)}))})}),CS(({object:A})=>{let{base:y,influences:w}=o;A.geometry.morphTargetsRelative?y.value=1:y.value=1-A.morphTargetInfluences.reduce((S,T)=>S+T,0),w&&(w.array=A.morphTargetInfluences,w.update())})},"void"),mm=class extends Kt{static get type(){return"LightingNode"}constructor(){super("vec3"),this.isLightingNode=!0}},YU=class extends mm{static get type(){return"AONode"}constructor(e=null){super(),this.aoNode=e}setup(e){e.context.ambientOcclusion.mulAssign(this.aoNode)}},ZU=class extends lS{static get type(){return"LightingContextNode"}constructor(e,t=null,n=[],r=null,s=null){super(e),this.lightingModel=t,this.materialLightings=n,this.backdropNode=r,this.backdropAlphaNode=s,this._value=null}getContext(){let{materialLightings:e,backdropNode:t,backdropAlphaNode:n}=this,r=pe().toVar("directDiffuse"),s=pe().toVar("directSpecular"),o=pe().toVar("indirectDiffuse"),a=pe().toVar("indirectSpecular"),l={directDiffuse:r,directSpecular:s,indirectDiffuse:o,indirectSpecular:a};return{radiance:pe().toVar("radiance"),irradiance:pe().toVar("irradiance"),iblIrradiance:pe().toVar("iblIrradiance"),ambientOcclusion:oe(1).toVar("ambientOcclusion"),reflectedLight:l,materialLightings:e,backdrop:t,backdropAlpha:n}}setup(e){return this.value=this._value||(this._value=this.getContext()),this.value.lightingModel=this.lightingModel||e.context.lightingModel,super.setup(e)}},Rre=$n(ZU),KU=class extends mm{static get type(){return"IrradianceNode"}constructor(e){super(),this.node=e}setup(e){e.context.irradiance.addAssign(this.node)}},Mg=new Oe,cx=class extends su{static get type(){return"ViewportTextureNode"}constructor(e=ju,t=null,n=null){let r=null;n===null?(r=new zA,r.minFilter=Vo,n=r):r=n,super(n,e,t),this.generateMipmaps=!1,this.defaultFramebuffer=r,this.isOutputTextureNode=!0,this.updateBeforeType=yn.RENDER,this._cacheTextures=new WeakMap}getTextureForReference(e=null){let t,n;if(this.referenceNode?(t=this.referenceNode.defaultFramebuffer,n=this.referenceNode._cacheTextures):(t=this.defaultFramebuffer,n=this._cacheTextures),e===null)return t;if(n.has(e)===!1){let r=t.clone();n.set(e,r)}return n.get(e)}updateReference(e){let t=e.renderer,n=t.getRenderTarget(),r=t.getCanvasTarget(),s=n||r;return this.value=this.getTextureForReference(s),this.value}updateBefore(e){let t=e.renderer,n=t.getRenderTarget(),r=t.getCanvasTarget(),s=n||r;s===null?t.getDrawingBufferSize(Mg):s.getDrawingBufferSize?s.getDrawingBufferSize(Mg):Mg.set(s.width,s.height);let o=this.getTextureForReference(s);(o.image.width!==Mg.width||o.image.height!==Mg.height)&&(o.image.width=Mg.width,o.image.height=Mg.height,o.needsUpdate=!0);let a=o.generateMipmaps;o.generateMipmaps=this.generateMipmaps,t.copyFramebufferToTexture(o),o.generateMipmaps=a}clone(){let e=new this.constructor(this.uvNode,this.levelNode,this.value);return e.generateMipmaps=this.generateMipmaps,e}},PEe=$n(cx).setParameterLength(0,3),$z=$n(cx,null,null,{generateMipmaps:!0}).setParameterLength(0,3),LEe=$z(),Ire=(i=ju,e=null)=>LEe.sample(i,e),EO=null,QU=class extends cx{static get type(){return"ViewportDepthTextureNode"}constructor(e=ju,t=null,n=null){n===null&&(EO===null&&(EO=new Cs),n=EO),super(e,t,n)}},Yz=$n(QU).setParameterLength(0,3),Zu=class i extends Kt{static get type(){return"ViewportDepthNode"}constructor(e,t=null){super("float"),this.scope=e,this.valueNode=t,this.isViewportDepthNode=!0}generate(e){let{scope:t}=this;return t===i.DEPTH_BASE?e.getFragDepth():super.generate(e)}setup({camera:e}){let{scope:t}=this,n=this.valueNode,r=null;if(t===i.DEPTH_BASE)n!==null&&(r=Dre().assign(n));else if(t===i.DEPTH)e.isPerspectiveCamera?r=Zz(xs.z,rm,sm):r=Hg(xs.z,rm,sm);else if(t===i.LINEAR_DEPTH)if(n!==null)if(e.isPerspectiveCamera){let s=TI(n,rm,sm);r=Hg(s,rm,sm)}else r=n;else r=Hg(xs.z,rm,sm);return r}};Zu.DEPTH_BASE="depthBase";Zu.DEPTH="depth";Zu.LINEAR_DEPTH="linearDepth";var Hg=(i,e,t)=>i.add(e).div(e.sub(t)),DEe=(i,e,t)=>i.add(t).div(t.sub(e)),Pre=me(([i,e,t],n)=>n.renderer.reversedDepthBuffer===!0?t.sub(e).mul(i).sub(t):e.sub(t).mul(i).sub(e)),Zz=(i,e,t)=>e.add(i).mul(t).div(t.sub(e).mul(i)),Lre=(i,e,t)=>e.mul(i.add(t)).div(i.mul(e.sub(t))),TI=me(([i,e,t],n)=>n.renderer.reversedDepthBuffer===!0?e.mul(t).div(e.sub(t).mul(i).sub(e)):e.mul(t).div(t.sub(e).mul(i).sub(t))),EI=(i,e,t)=>{e=e.max(1e-6).toVar();let n=Af(i.negate().div(e)),r=Af(t.div(e));return n.div(r)},NEe=(i,e,t)=>{let n=i.mul(mI(t.div(e)));return oe(Math.E).pow(n).mul(e).negate()},Dre=$n(Zu,Zu.DEPTH_BASE),Kz=xt(Zu,Zu.DEPTH),d4=$n(Zu,Zu.LINEAR_DEPTH).setParameterLength(0,1),FEe=d4(Yz());Kz.assign=i=>Dre(i);var wf=class i extends Kt{static get type(){return"ClippingNode"}constructor(e=i.DEFAULT){super(),this.scope=e}setup(e){super.setup(e);let t=e.clippingContext,{intersectionPlanes:n,unionPlanes:r}=t;return this.hardwareClipping=e.hardwareClipping,this.scope===i.ALPHA_TO_COVERAGE?this.setupAlphaToCoverage(n,r):this.scope===i.HARDWARE?this.setupHardwareClipping(r,e):this.setupDefault(n,r)}setupAlphaToCoverage(e,t){return me(()=>{let n=oe().toVar("distanceToPlane"),r=oe().toVar("distanceToGradient"),s=oe(1).toVar("clipOpacity"),o=t.length;if(this.hardwareClipping===!1&&o>0){let l=Xo(t).setGroup(Jt);Oi(o,({i:c})=>{let u=l.element(c);n.assign(xs.dot(u.xyz).negate().add(u.w)),r.assign(n.fwidth().div(2)),s.mulAssign(fc(r.negate(),r,n))})}let a=e.length;if(a>0){let l=Xo(e).setGroup(Jt),c=oe(1).toVar("intersectionClipOpacity");Oi(a,({i:u})=>{let f=l.element(u);n.assign(xs.dot(f.xyz).negate().add(f.w)),r.assign(n.fwidth().div(2)),c.mulAssign(fc(r.negate(),r,n).oneMinus())}),s.mulAssign(c.oneMinus())}Bi.a.mulAssign(s),Bi.a.equal(0).discard()})()}setupDefault(e,t){return me(()=>{let n=t.length;if(this.hardwareClipping===!1&&n>0){let s=Xo(t).setGroup(Jt);Oi(n,({i:o})=>{let a=s.element(o);xs.dot(a.xyz).greaterThan(a.w).discard()})}let r=e.length;if(r>0){let s=Xo(e).setGroup(Jt),o=uc(!0).toVar("clipped");Oi(r,({i:a})=>{let l=s.element(a);o.assign(xs.dot(l.xyz).greaterThan(l.w).and(o))}),o.discard()}})()}setupHardwareClipping(e,t){let n=e.length;return t.enableHardwareClipping(n),me(()=>{let r=Xo(e).setGroup(Jt),s=Qd(t.getClipDistance());Oi(n,({i:o})=>{let a=r.element(o),l=xs.dot(a.xyz).sub(a.w).negate();s.element(o).assign(l)})})()}};wf.ALPHA_TO_COVERAGE="alphaToCoverage";wf.DEFAULT="default";wf.HARDWARE="hardware";var BEe=()=>new wf,OEe=()=>new wf(wf.ALPHA_TO_COVERAGE),UEe=()=>new wf(wf.HARDWARE),kEe=.05,See=me(([i])=>$u(Tn(1e4,Za(Tn(17,i.x).add(Tn(.1,i.y)))).mul(Ls(.1,fr(Za(Tn(13,i.y).add(i.x))))))),Tee=me(([i])=>See(dt(See(i.xy),i.z))),zEe=me(([i])=>{let e=zr(vf(uz(i.xyz)),vf(hz(i.xyz))),t=oe(1).div(oe(kEe).mul(e)).toVar("pixScale"),n=dt(ox(gf(Af(t))),ox(AI(Af(t)))),r=dt(Tee(gf(n.x.mul(i.xyz))),Tee(gf(n.y.mul(i.xyz)))),s=$u(Af(t)),o=Ls(Tn(s.oneMinus(),r.x),Tn(s,r.y)),a=Rl(s,s.oneMinus()),l=pe(o.mul(o).div(Tn(2,a).mul(ai(1,a))),o.sub(Tn(.5,a)).div(ai(1,a)),ai(1,ai(1,o).mul(ai(1,o)).div(Tn(2,a).mul(ai(1,a))))),c=o.lessThan(a.oneMinus()).select(o.lessThan(a).select(l.x,l.y),l.z);return Yu(c,1e-6,1)}).setLayout({name:"getAlphaHashThreshold",type:"float",inputs:[{name:"position",type:"vec3"}]}),JU=class extends a4{static get type(){return"VertexColorNode"}constructor(e){super(null,"vec4"),this.isVertexColorNode=!0,this.index=e}getAttributeName(){let e=this.index;return"color"+(e>0?e:"")}generate(e){let t=this.getAttributeName(e),n=e.hasGeometryAttribute(t),r;return n===!0?r=super.generate(e):r=e.generateConst(this.nodeType,new xn(1,1,1,1)),r}serialize(e){super.serialize(e),e.index=this.index}deserialize(e){super.deserialize(e),this.index=e.index}},Nre=(i=0)=>new JU(i),Rr=class extends Ws{static get type(){return"NodeMaterial"}get type(){return this.constructor.type}set type(e){}constructor(){super(),this.isNodeMaterial=!0,this.fog=!0,this.lights=!1,this.lightsNode=null,this.envNode=null,this.aoNode=null,this.colorNode=null,this.normalNode=null,this.opacityNode=null,this.backdropNode=null,this.backdropAlphaNode=null,this.alphaTestNode=null,this.maskNode=null,this.maskShadowNode=null,this.positionNode=null,this.geometryNode=null,this.depthNode=null,this.receivedShadowPositionNode=null,this.castShadowPositionNode=null,this.receivedShadowNode=null,this.castShadowNode=null,this.outputNode=null,this.mrtNode=null,this.fragmentNode=null,this.vertexNode=null,this.contextNode=null}_getNodeChildren(){let e=[];for(let t of Object.getOwnPropertyNames(this)){if(t.startsWith("_")===!0)continue;let n=this[t];n&&n.isNode===!0&&e.push({property:t,childNode:n})}return e}customProgramCacheKey(){let e=[];for(let{property:t,childNode:n}of this._getNodeChildren())e.push(mx(t.slice(0,-4)),n.getCacheKey());return this.type+ES(e)}build(e){this.setup(e)}setupObserver(e){return new tU(e)}setup(e){e.context.setupNormal=()=>qg(this.setupNormal(e),"NORMAL","vec3"),e.context.setupPositionView=()=>this.setupPositionView(e),e.context.setupModelViewProjection=()=>this.setupModelViewProjection(e);let t=e.renderer,n=t.getRenderTarget();e.addStack();let r=this.setupVertex(e),s=qg(this.vertexNode||r,"VERTEX");e.context.clipSpace=s,e.stack.outputNode=s,this.setupHardwareClipping(e),this.geometryNode!==null&&(e.stack.outputNode=e.stack.outputNode.bypass(this.geometryNode)),e.addFlow("vertex",e.removeStack()),e.addStack();let o,a=this.setupClipping(e);if((this.depthWrite===!0||this.depthTest===!0)&&(n!==null?n.depthBuffer===!0&&this.setupDepth(e):t.depth===!0&&this.setupDepth(e)),this.fragmentNode===null){this.setupDiffuseColor(e),this.setupAmbientOcclusion(e),this.setupVariants(e);let l=this.setupLighting(e);a!==null&&e.stack.addToStack(a);let c=Ft(l,Bi.a).max(0);o=this.setupOutput(e,c),ex.assign(o);let u=this.outputNode!==null;if(u&&(o=this.outputNode),e.context.getOutput&&(o=e.context.getOutput(o,e)),n!==null){let f=t.getMRT(),d=this.mrtNode;f!==null?(u&&ex.assign(o),o=f,d!==null&&(o=f.merge(d))):d!==null&&(o=d)}}else{let l=this.fragmentNode;l.isOutputStructNode!==!0&&(l=l.convert(e.getOutputType())),o=this.setupOutput(e,l)}e.stack.outputNode=o,e.addFlow("fragment",e.removeStack()),e.observer=this.setupObserver(e)}setupClipping(e){if(e.clippingContext===null)return null;let{unionPlanes:t,intersectionPlanes:n}=e.clippingContext,r=null;if(t.length>0||n.length>0){let s=e.renderer.currentSamples;this.alphaToCoverage&&s>1?r=OEe():e.stack.addToStack(BEe())}return r}setupHardwareClipping(e){if(e.hardwareClipping=!1,e.clippingContext===null)return;let t=e.clippingContext.unionPlanes.length;t>0&&t<=8&&e.isAvailable("clipDistance")&&(e.stack.addToStack(UEe()),e.hardwareClipping=!0)}setupDepth(e){let{renderer:t,camera:n}=e,r=this.depthNode;if(r===null){let s=t.getMRT();s&&s.has("depth")?r=s.get("depth"):t.logarithmicDepthBuffer===!0&&(n.isPerspectiveCamera?r=EI(xs.z,rm,sm):r=Hg(xs.z,rm,sm))}r!==null&&Kz.assign(r).toStack()}setupPositionView(){return bf.mul(Er).xyz}setupModelViewProjection(){return Qa.mul(xs)}setupVertex(e){return e.addStack(),this.setupPosition(e),e.context.position=e.removeStack(),vre}setupPosition(e){let{object:t,geometry:n}=e;if((n.morphAttributes.position||n.morphAttributes.normal||n.morphAttributes.color)&&Cre(t),t.isSkinnedMesh===!0&&Ere(t),this.displacementMap){let r=Hd("displacementMap","texture"),s=Hd("displacementScale","float"),o=Hd("displacementBias","float");Er.addAssign(ba.normalize().mul(r.x.mul(s).add(o)))}return t.isBatchedMesh&&wre(t),t.isInstancedMesh&&t.instanceMatrix&&t.instanceMatrix.isInstancedBufferAttribute===!0&&bre(t),this.positionNode!==null&&Er.assign(qg(this.positionNode,"POSITION","vec3")),Er}setupDiffuseColor(e){let{object:t,geometry:n}=e;this.maskNode!==null&&uc(this.maskNode).not().discard();let r=this.colorNode?Ft(this.colorNode):jie;this.vertexColors===!0&&n.hasAttribute("color")&&(r=r.mul(Nre())),t.instanceColor&&(r=Wz.mul(r)),t.isBatchedMesh&&t._colorsTexture&&(r=jz.mul(r)),Bi.assign(r);let s=this.opacityNode?oe(this.opacityNode):kz;Bi.a.assign(Bi.a.mul(s));let o=null;(this.alphaTestNode!==null||this.alphaTest>0)&&(o=this.alphaTestNode!==null?oe(this.alphaTestNode):Wie,this.alphaToCoverage===!0?(Bi.a=fc(o,o.add(dz(Bi.a)),Bi.a),Bi.a.lessThanEqual(0).discard()):Bi.a.lessThanEqual(o).discard()),this.alphaHash===!0&&Bi.a.lessThan(zEe(Er)).discard(),e.isOpaque()&&Bi.a.assign(1)}setupVariants(){}setupOutgoingLight(){return this.lights===!0?pe(0):Bi.rgb}setupNormal(){return this.normalNode?pe(this.normalNode):Jie}setupEnvironment(){let e=null;return this.envNode?e=this.envNode:this.envMap&&(e=this.envMap.isCubeTexture?Hd("envMap","cubeTexture"):Hd("envMap","texture")),e}setupLightMap(e){let t=null;return e.material.lightMap&&(t=new KU(Hz)),t}setupMaterialLightings(e){let t=[];if(e.renderer.lighting.enabled===!1)return t;let n=this.setupEnvironment(e);n&&n.isLightingNode&&t.push(n);let r=this.setupLightMap(e);return r&&r.isLightingNode&&t.push(r),e.context.ambientOcclusion&&t.push(new YU(e.context.ambientOcclusion)),t}setupAmbientOcclusion(e){let t=this.aoNode;t===null&&e.material.aoMap&&(t=gre),e.context.getAO&&(t=e.context.getAO(t,e)),t!==null&&(fU.assign(t),e.context.ambientOcclusion=fU)}setupLightingModel(){}setupLighting(e){let{material:t}=e,{backdropNode:n,backdropAlphaNode:r,emissiveNode:s}=this,o=this.lights===!0||this.lightsNode!==null,a=this.lights===!0?this.setupMaterialLightings(e):[],l=o?this.lightsNode||e.lightsNode:null,c=this.setupOutgoingLight(e);if(l&&(a.length>0||l.getScope().hasLights)){let u=this.setupLightingModel(e)||null;c=Rre(l,u,a,n,r)}else n!==null&&(c=pe(r!==null?Qn(c,n,r):n));return(s&&s.isNode===!0||t.emissive&&t.emissive.isColor===!0)&&(hU.assign(pe(s||$ie)),c=c.add(hU)),c}setupFog(e,t){let n=e.fogNode;return n&&(ex.assign(t),t=Ft(n.toVar())),t}setupPremultipliedAlpha(e,t){return Ez(t)}setupOutput(e,t){return this.fog===!0&&(t=this.setupFog(e,t)),this.premultipliedAlpha===!0&&(t=this.setupPremultipliedAlpha(e,t)),t}setDefaultValues(e){for(let n in e){let r=e[n];this[n]===void 0&&(this[n]=r,r&&r.clone&&(this[n]=r.clone()))}let t=Object.getOwnPropertyDescriptors(e.constructor.prototype);for(let n in t)Object.getOwnPropertyDescriptor(this.constructor.prototype,n)===void 0&&t[n].get!==void 0&&Object.defineProperty(this.constructor.prototype,n,t[n])}toJSON(e){let t=e===void 0||typeof e=="string";t&&(e={textures:{},images:{},nodes:{}});let n=Ws.prototype.toJSON.call(this,e);n.inputNodes={};for(let{property:s,childNode:o}of this._getNodeChildren())n.inputNodes[s]=o.toJSON(e).uuid;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),a=r(e.nodes);s.length>0&&(n.textures=s),o.length>0&&(n.images=o),a.length>0&&(n.nodes=a)}return n}copy(e){let t=Object.getOwnPropertyDescriptors(this.constructor.prototype);for(let n in t)if(t[n].set!==void 0&&e[n]!==void 0){let r=e[n];this[n]&&this[n].copy!==void 0?this[n].copy(r):this[n]=r}for(let n in this)if(!/^(?:is[A-Z]|_)|^(?:id|uuid|version|type|userData|clippingPlanes)$/.test(n)&&this[n]!==void 0&&e[n]!==void 0){let r=e[n];this[n]&&this[n].copy!==void 0?this[n].copy(r):this[n]=r}return this.clippingPlanes=e.clippingPlanes?e.clippingPlanes.map(n=>n.clone()):null,this.userData=JSON.parse(JSON.stringify(e.userData)),this}},VEe=new Pu,e7=class extends Rr{static get type(){return"LineBasicNodeMaterial"}constructor(e){super(),this.isLineBasicNodeMaterial=!0,this.setDefaultValues(VEe),this.setValues(e)}},GEe=new $2,t7=class extends Rr{static get type(){return"LineDashedNodeMaterial"}constructor(e){super(),this.isLineDashedNodeMaterial=!0,this.setDefaultValues(GEe),this.dashOffset=0,this.offsetNode=null,this.dashScaleNode=null,this.dashSizeNode=null,this.gapSizeNode=null,this.setValues(e)}setupVariants(){let e=this.offsetNode?oe(this.offsetNode):qz,t=this.dashScaleNode?oe(this.dashScaleNode):zz,n=this.dashSizeNode?oe(this.dashSizeNode):Vz,r=this.gapSizeNode?oe(this.gapSizeNode):Gz;Gg.assign(n),aS.assign(r);let s=gm(cc("lineDistance").mul(t));(e?s.add(e):s).mod(Gg.add(aS)).greaterThan(Gg).discard()}};var WR=r1("vec3","worldStart"),n7=r1("vec3","worldEnd"),Fre=r1("float","lineDistance"),Dg=r1("vec4","worldPos"),Eee=me(({start:i,end:e})=>{let t=Qa.element(2).element(2),n=Qa.element(3).element(2);return t.greaterThan(0).select(n.negate().div(t.add(1)),n.mul(-.5).div(t)).sub(i.z).div(e.z.sub(i.z))},{start:"vec4",end:"vec4",return:"float"}),qEe=me(({p1:i,p2:e,p3:t,p4:n})=>{let r=i.sub(t),s=n.sub(t),o=e.sub(i),a=r.dot(s),l=s.dot(o),c=r.dot(o),u=s.dot(s),d=o.dot(o).mul(u).sub(l.mul(l)),y=a.mul(l).sub(c.mul(u)).div(d).clamp(),w=a.add(l.mul(y)).div(u).clamp();return dt(y,w)},{p1:"vec3",p2:"vec3",p3:"vec3",p4:"vec3",return:"vec2"}),Iat=me(({material:i})=>{let e=i._useDash,t=i._useWorldUnits,n=cc("instanceStart"),r=cc("instanceEnd"),s=Ft(bf.mul(Ft(n,1))).toVar("start"),o=Ft(bf.mul(Ft(r,1))).toVar("end"),a,l;e&&(a=oe(cc("instanceDistanceStart")).toVar("distanceStart"),l=oe(cc("instanceDistanceEnd")).toVar("distanceEnd")),t&&(WR.assign(s.xyz),n7.assign(o.xyz));let c=rx.z.div(rx.w),u=Qa.element(2).element(3).equal(-1);if($t(u,()=>{$t(s.z.lessThan(0).and(o.z.greaterThan(0)),()=>{let T=Eee({start:s,end:o});o.assign(Ft(Qn(s.xyz,o.xyz,T),o.w)),e&&l.assign(Qn(a,l,T))}).ElseIf(o.z.lessThan(0).and(s.z.greaterThanEqual(0)),()=>{let T=Eee({start:o,end:s});s.assign(Ft(Qn(o.xyz,s.xyz,T),s.w)),e&&a.assign(Qn(l,a,T))})}),e){let T=i.dashScaleNode?oe(i.dashScaleNode):zz,R=i.offsetNode?oe(i.offsetNode):qz,P=ga.y.lessThan(.5).select(T.mul(a),T.mul(l));P=P.add(R),Fre.assign(P)}let f=Qa.mul(s),d=Qa.mul(o),A=f.xyz.div(f.w),y=d.xyz.div(d.w),w=y.xy.sub(A.xy).toVar();w.x.assign(w.x.mul(c)),w.assign(w.normalize());let S=Ft().toVar();if(t){let T=o.xyz.sub(s.xyz).normalize(),R=Qn(s.xyz,o.xyz,.5).normalize(),P=T.cross(R).normalize(),I=T.cross(P);Dg.assign(ga.y.lessThan(.5).select(s,o));let F=u4.mul(.5);Dg.addAssign(Ft(ga.x.lessThan(0).select(P.mul(F),P.mul(F).negate()),0)),e||(Dg.addAssign(Ft(ga.y.lessThan(.5).select(T.mul(F).negate(),T.mul(F)),0)),Dg.addAssign(Ft(I.mul(F),0)),$t(ga.y.greaterThan(1).or(ga.y.lessThan(0)),()=>{Dg.subAssign(Ft(I.mul(2).mul(F),0))})),S.assign(Qa.mul(Dg));let D=pe().toVar();D.assign(ga.y.lessThan(.5).select(A,y)),S.z.assign(D.z.mul(S.w))}else{let T=dt(w.y,w.x.negate()).toVar("offset");w.x.assign(w.x.div(c)),T.x.assign(T.x.div(c)),T.assign(ga.x.lessThan(0).select(T.negate(),T)),$t(ga.y.lessThan(0),()=>{T.assign(T.sub(w))}).ElseIf(ga.y.greaterThan(1),()=>{T.assign(T.add(w))}),T.assign(T.mul(u4)),T.assign(T.div(rx.w.div(Iz))),S.assign(ga.y.lessThan(.5).select(f,d)),T.assign(T.mul(S.w)),S.assign(S.add(Ft(T,0,0)))}return S})(),Pat=me(({material:i,renderer:e})=>{let t=i._useAlphaToCoverage,n=i._useDash,r=i._useWorldUnits,s=Ui();if(n){let a=i.dashSizeNode?oe(i.dashSizeNode):Vz,l=i.gapSizeNode?oe(i.gapSizeNode):Gz;Gg.assign(a),aS.assign(l),s.y.lessThan(-1).or(s.y.greaterThan(1)).discard(),Fre.mod(Gg.add(aS)).greaterThan(Gg).discard()}let o=oe(1).toVar("alpha");if(r){let a=Dg.xyz.normalize().mul(1e5),l=n7.sub(WR),c=qEe({p1:WR,p2:n7,p3:pe(0,0,0),p4:a}),u=WR.add(l.mul(c.x)),f=a.mul(c.y),y=u.sub(f).length().div(u4);if(!n)if(t&&e.currentSamples>0){let w=y.fwidth();o.assign(fc(w.negate().add(.5),w.add(.5),y).oneMinus())}else y.greaterThan(.5).discard()}else if(t&&e.currentSamples>0){let a=s.x,l=s.y.greaterThan(0).select(s.y.sub(1),s.y.add(1)),c=a.mul(a).add(l.mul(l)),u=oe(c.fwidth()).toVar("dlen");$t(s.y.abs().greaterThan(1),()=>{o.assign(fc(u.oneMinus(),u.add(1),c).oneMinus())})}else $t(s.y.abs().greaterThan(1),()=>{let a=s.x,l=s.y.greaterThan(0).select(s.y.sub(1),s.y.add(1));a.mul(a).add(l.mul(l)).greaterThan(1).discard()});return o})();var HEe=new j2,i7=class extends Rr{static get type(){return"MeshNormalNodeMaterial"}constructor(e){super(),this.isMeshNormalNodeMaterial=!0,this.setDefaultValues(HEe),this.setValues(e)}setupDiffuseColor(){let e=this.opacityNode?oe(this.opacityNode):kz;Bi.assign(vI(Ft(Oz(hi),e),Fr))}},Qz=me(([i=Lz])=>{let e=i.z.atan(i.x).mul(1/(Math.PI*2)).add(.5),t=i.y.clamp(-1,1).asin().mul(1/Math.PI).add(.5);return dt(e,t)}),r7=me(([i=Ui()])=>{let e=i.x.sub(.5).mul(Math.PI*2),t=i.y.sub(.5).mul(Math.PI),n=t.cos(),r=n.mul(e.cos()),s=t.sin(),o=n.mul(e.sin());return pe(r,s,o)}),p4=class extends Fa{constructor(e=1,t={}){super(e,e,t),this.isCubeRenderTarget=!0;let n={width:e,height:e,depth:1},r=[n,n,n,n,n,n];this.texture=new Ih(r),this._setTextureOptions(t),this.texture.isRenderTargetTexture=!0}fromEquirectangularTexture(e,t){let n=t.minFilter,r=t.generateMipmaps;t.generateMipmaps=!0,this.texture.type=t.type,this.texture.colorSpace=t.colorSpace,this.texture.generateMipmaps=t.generateMipmaps,this.texture.minFilter=t.minFilter,this.texture.magFilter=t.magFilter;let s=new Lu(5,5,5),o=Qz(Lz),a=new Rr;a.colorNode=fi(t,o,0),a.side=mi,a.blending=ps;let l=new Hn(s,a),c=new t0;c.add(l),t.minFilter===Vo&&(t.minFilter=Mi);let u=new e_(1,10,this),f=e.getMRT();return e.setMRT(null),u.update(e,c),e.setMRT(f),t.minFilter=n,t.generateMipmaps=r,l.geometry.dispose(),l.material.dispose(),this}clear(e,t=!0,n=!0,r=!0){let s=e.getRenderTarget();for(let o=0;o<6;o++)e.setRenderTarget(this,o),e.clear(t,n,r);e.setRenderTarget(s)}},tS=new WeakMap,s7=class extends Cr{static get type(){return"CubeMapNode"}constructor(e){super("vec3"),this.envNode=e,this._cubeTexture=null,this._cubeTextureNode=Ka(null);let t=new Ih;t.isRenderTargetTexture=!0,this._defaultTexture=t,this.updateBeforeType=yn.RENDER}updateBefore(e){let{renderer:t,material:n}=e,r=this.envNode;if(r.isTextureNode||r.isMaterialReferenceNode){let s=r.isTextureNode?r.value:n[r.property];if(s&&s.isTexture){let o=s.mapping;if(o===u0||o===h0){if(tS.has(s)){let a=tS.get(s);Mee(a,s.mapping),this._cubeTexture=a}else{let a=s.image;if(WEe(a)){let l=new p4(a.height);l.fromEquirectangularTexture(t,s),Mee(l.texture,s.mapping),this._cubeTexture=l.texture,tS.set(s,l.texture),s.addEventListener("dispose",Bre)}else this._cubeTexture=this._defaultTexture}this._cubeTextureNode.value=this._cubeTexture}else this._cubeTextureNode=this.envNode}}}setup(e){return this.updateBefore(e),this._cubeTextureNode}};function WEe(i){return i==null?!1:i.height>0}function Bre(i){let e=i.target;e.removeEventListener("dispose",Bre);let t=tS.get(e);t!==void 0&&(tS.delete(e),t.dispose())}function Mee(i,e){e===u0?i.mapping=Kl:e===h0&&(i.mapping=Gc)}var Ore=$n(s7).setParameterLength(1),hS=class extends mm{static get type(){return"BasicEnvironmentNode"}constructor(e=null){super(),this.envNode=e}setup(e){e.context.environment=Ore(this.envNode)}},o7=class extends mm{static get type(){return"BasicLightMapNode"}constructor(e=null){super(),this.lightMapNode=e}setup(e){let t=oe(1/Math.PI);e.context.irradianceLightMap=this.lightMapNode.mul(t)}},ux=class{start(e){e.lightsNode.setupLights(e,e.lightsNode.getLightNodes(e)),this.indirect(e)}finish(){}direct(){}directRectArea(){}indirect(){}ambientOcclusion(){}},m4=class extends ux{constructor(){super()}indirect({context:e}){let t=e.ambientOcclusion,n=e.reflectedLight,r=e.irradianceLightMap;n.indirectDiffuse.assign(Ft(0)),r?n.indirectDiffuse.addAssign(r):n.indirectDiffuse.addAssign(Ft(1,1,1,0)),n.indirectDiffuse.mulAssign(t),n.indirectDiffuse.mulAssign(Bi.rgb)}finish(e){let{material:t,context:n}=e,r=n.outgoingLight,s=e.context.environment;if(s)switch(t.combine){case ZA:r.rgb.assign(Qn(r.rgb,r.rgb.mul(s.rgb),eS.mul(HR)));break;case CM:r.rgb.assign(Qn(r.rgb,s.rgb,eS.mul(HR)));break;case RM:r.rgb.addAssign(s.rgb.mul(eS.mul(HR)));break;default:Xe("BasicLightingModel: Unsupported .combine value:",t.combine);break}}},jEe=new fs,a7=class extends Rr{static get type(){return"MeshBasicNodeMaterial"}constructor(e){super(),this.isMeshBasicNodeMaterial=!0,this.lights=!0,this.setDefaultValues(jEe),this.setValues(e)}setupNormal(){return o1(ax)}setupEnvironment(e){let t=super.setupEnvironment(e);return t?new hS(t):null}setupLightMap(e){let t=null;return e.material.lightMap&&(t=new o7(Hz)),t}setupOutgoingLight(){return Bi.rgb}setupLightingModel(){return new m4}},hx=me(({f0:i,f90:e,dotVH:t})=>{let n=t.mul(-5.55473).sub(6.98316).mul(t).exp2();return i.mul(n.oneMinus()).add(e.mul(n))}),Qg=me(i=>i.diffuseColor.mul(1/Math.PI)),XEe=()=>oe(.25),$Ee=me(({dotNH:i})=>e4.mul(oe(.5)).add(1).mul(oe(1/Math.PI)).mul(i.pow(e4))),YEe=me(({lightDirection:i})=>{let e=i.add(er).normalize(),t=hi.dot(e).clamp(),n=er.dot(e).clamp(),r=hx({f0:dm,f90:1,dotVH:n}),s=XEe(),o=$Ee({dotNH:t});return r.mul(s).mul(o)}),A4=class extends m4{constructor(e=!0){super(),this.specular=e}direct({lightDirection:e,lightColor:t,reflectedLight:n}){let s=hi.dot(e).clamp().mul(t);n.directDiffuse.addAssign(s.mul(Qg({diffuseColor:Bi.rgb}))),this.specular===!0&&n.directSpecular.addAssign(s.mul(YEe({lightDirection:e})).mul(eS))}indirect(e){let{ambientOcclusion:t,irradiance:n,reflectedLight:r}=e.context;r.indirectDiffuse.addAssign(n.mul(Qg({diffuseColor:Bi}))),r.indirectDiffuse.mulAssign(t)}},ZEe=new Va,l7=class extends Rr{static get type(){return"MeshLambertNodeMaterial"}constructor(e){super(),this.isMeshLambertNodeMaterial=!0,this.lights=!0,this.setDefaultValues(ZEe),this.setValues(e)}setupEnvironment(e){let t=super.setupEnvironment(e);return t?new hS(t):null}setupLightingModel(){return new A4(!1)}},KEe=new WA,c7=class extends Rr{static get type(){return"MeshPhongNodeMaterial"}constructor(e){super(),this.isMeshPhongNodeMaterial=!0,this.lights=!0,this.shininessNode=null,this.specularNode=null,this.setDefaultValues(KEe),this.setValues(e)}setupEnvironment(e){let t=super.setupEnvironment(e);return t?new hS(t):null}setupLightingModel(){return new A4}setupVariants(){let e=(this.shininessNode?oe(this.shininessNode):Xie).max(1e-4);e4.assign(e);let t=this.specularNode||Yie;dm.assign(t)}},Ure=me(i=>{if(i.geometry.hasAttribute("normal")===!1)return oe(0);let e=ax.dFdx().abs().max(ax.dFdy().abs());return e.x.max(e.y).max(e.z)}),Jz=me(i=>{let{roughness:e}=i,t=Ure(),n=e.max(.0525);return n=n.add(t),n=n.min(1),n}),kre=me(({alpha:i,dotNL:e,dotNV:t})=>{let n=i.pow2(),r=e.mul(n.add(n.oneMinus().mul(t.pow2())).sqrt()),s=t.mul(n.add(n.oneMinus().mul(e.pow2())).sqrt());return hc(.5,r.add(s).max(pI))}).setLayout({name:"V_GGX_SmithCorrelated",type:"float",inputs:[{name:"alpha",type:"float"},{name:"dotNL",type:"float"},{name:"dotNV",type:"float"}]}),QEe=me(({alphaT:i,alphaB:e,dotTV:t,dotBV:n,dotTL:r,dotBL:s,dotNV:o,dotNL:a})=>{let l=a.mul(pe(i.mul(t),e.mul(n),o).length()),c=o.mul(pe(i.mul(r),e.mul(s),a).length());return hc(.5,l.add(c).max(pI))}).setLayout({name:"V_GGX_SmithCorrelated_Anisotropic",type:"float",inputs:[{name:"alphaT",type:"float",qualifier:"in"},{name:"alphaB",type:"float",qualifier:"in"},{name:"dotTV",type:"float",qualifier:"in"},{name:"dotBV",type:"float",qualifier:"in"},{name:"dotTL",type:"float",qualifier:"in"},{name:"dotBL",type:"float",qualifier:"in"},{name:"dotNV",type:"float",qualifier:"in"},{name:"dotNL",type:"float",qualifier:"in"}]}),zre=me(({alpha:i,dotNH:e})=>{let t=i.pow2(),n=e.pow2().mul(t.oneMinus()).oneMinus();return t.div(n.pow2()).mul(1/Math.PI)}).setLayout({name:"D_GGX",type:"float",inputs:[{name:"alpha",type:"float"},{name:"dotNH",type:"float"}]}),JEe=oe(1/Math.PI),e3e=me(({alphaT:i,alphaB:e,dotNH:t,dotTH:n,dotBH:r})=>{let s=i.mul(e),o=pe(e.mul(n),i.mul(r),s.mul(t)),a=o.dot(o),l=s.div(a);return JEe.mul(s.mul(l.pow2()))}).setLayout({name:"D_GGX_Anisotropic",type:"float",inputs:[{name:"alphaT",type:"float",qualifier:"in"},{name:"alphaB",type:"float",qualifier:"in"},{name:"dotNH",type:"float",qualifier:"in"},{name:"dotTH",type:"float",qualifier:"in"},{name:"dotBH",type:"float",qualifier:"in"}]}),eV=me(({lightDirection:i,f0:e,f90:t,roughness:n,f:r,normalView:s=hi,USE_IRIDESCENCE:o,USE_ANISOTROPY:a})=>{let l=n.pow2(),c=i.add(er).normalize(),u=s.dot(i).clamp(),f=s.dot(er).clamp(),d=s.dot(c).clamp(),A=er.dot(c).clamp(),y=hx({f0:e,f90:t,dotVH:A}),w,S;if(sx(o)&&(y=hI.mix(y,r)),sx(a)){let T=Qw.dot(i),R=Qw.dot(er),P=Qw.dot(c),I=Vg.dot(i),F=Vg.dot(er),D=Vg.dot(c);w=QEe({alphaT:JR,alphaB:l,dotTV:R,dotBV:F,dotTL:T,dotBL:I,dotNV:f,dotNL:u}),S=e3e({alphaT:JR,alphaB:l,dotNH:d,dotTH:P,dotBH:D})}else w=kre({alpha:l,dotNL:u,dotNV:f}),S=zre({alpha:l,dotNH:d});return y.mul(w).mul(S)}),t3e=new Uint16Array([12469,15057,12620,14925,13266,14620,13807,14376,14323,13990,14545,13625,14713,13328,14840,12882,14931,12528,14996,12233,15039,11829,15066,11525,15080,11295,15085,10976,15082,10705,15073,10495,13880,14564,13898,14542,13977,14430,14158,14124,14393,13732,14556,13410,14702,12996,14814,12596,14891,12291,14937,11834,14957,11489,14958,11194,14943,10803,14921,10506,14893,10278,14858,9960,14484,14039,14487,14025,14499,13941,14524,13740,14574,13468,14654,13106,14743,12678,14818,12344,14867,11893,14889,11509,14893,11180,14881,10751,14852,10428,14812,10128,14765,9754,14712,9466,14764,13480,14764,13475,14766,13440,14766,13347,14769,13070,14786,12713,14816,12387,14844,11957,14860,11549,14868,11215,14855,10751,14825,10403,14782,10044,14729,9651,14666,9352,14599,9029,14967,12835,14966,12831,14963,12804,14954,12723,14936,12564,14917,12347,14900,11958,14886,11569,14878,11247,14859,10765,14828,10401,14784,10011,14727,9600,14660,9289,14586,8893,14508,8533,15111,12234,15110,12234,15104,12216,15092,12156,15067,12010,15028,11776,14981,11500,14942,11205,14902,10752,14861,10393,14812,9991,14752,9570,14682,9252,14603,8808,14519,8445,14431,8145,15209,11449,15208,11451,15202,11451,15190,11438,15163,11384,15117,11274,15055,10979,14994,10648,14932,10343,14871,9936,14803,9532,14729,9218,14645,8742,14556,8381,14461,8020,14365,7603,15273,10603,15272,10607,15267,10619,15256,10631,15231,10614,15182,10535,15118,10389,15042,10167,14963,9787,14883,9447,14800,9115,14710,8665,14615,8318,14514,7911,14411,7507,14279,7198,15314,9675,15313,9683,15309,9712,15298,9759,15277,9797,15229,9773,15166,9668,15084,9487,14995,9274,14898,8910,14800,8539,14697,8234,14590,7790,14479,7409,14367,7067,14178,6621,15337,8619,15337,8631,15333,8677,15325,8769,15305,8871,15264,8940,15202,8909,15119,8775,15022,8565,14916,8328,14804,8009,14688,7614,14569,7287,14448,6888,14321,6483,14088,6171,15350,7402,15350,7419,15347,7480,15340,7613,15322,7804,15287,7973,15229,8057,15148,8012,15046,7846,14933,7611,14810,7357,14682,7069,14552,6656,14421,6316,14251,5948,14007,5528,15356,5942,15356,5977,15353,6119,15348,6294,15332,6551,15302,6824,15249,7044,15171,7122,15070,7050,14949,6861,14818,6611,14679,6349,14538,6067,14398,5651,14189,5311,13935,4958,15359,4123,15359,4153,15356,4296,15353,4646,15338,5160,15311,5508,15263,5829,15188,6042,15088,6094,14966,6001,14826,5796,14678,5543,14527,5287,14377,4985,14133,4586,13869,4257,15360,1563,15360,1642,15358,2076,15354,2636,15341,3350,15317,4019,15273,4429,15203,4732,15105,4911,14981,4932,14836,4818,14679,4621,14517,4386,14359,4156,14083,3795,13808,3437,15360,122,15360,137,15358,285,15355,636,15344,1274,15322,2177,15281,2765,15215,3223,15120,3451,14995,3569,14846,3567,14681,3466,14511,3305,14344,3121,14037,2800,13753,2467,15360,0,15360,1,15359,21,15355,89,15346,253,15325,479,15287,796,15225,1148,15133,1492,15008,1749,14856,1882,14685,1886,14506,1783,14324,1608,13996,1398,13702,1183]),lf=null,fS=me(({roughness:i,dotNV:e})=>{lf===null&&(lf=new kA(t3e,16,16,js,Wi),lf.name="DFG_LUT",lf.minFilter=Mi,lf.magFilter=Mi,lf.wrapS=aa,lf.wrapT=aa,lf.generateMipmaps=!1,lf.needsUpdate=!0);let t=dt(i,e);return fi(lf,t).rg}),n3e=me(({lightDirection:i,f0:e,f90:t,roughness:n,f:r,USE_IRIDESCENCE:s,USE_ANISOTROPY:o})=>{let a=eV({lightDirection:i,f0:e,f90:t,roughness:n,f:r,USE_IRIDESCENCE:s,USE_ANISOTROPY:o}),l=hi.dot(i).clamp(),c=hi.dot(er).clamp(),u=fS({roughness:n,dotNV:c}),f=fS({roughness:n,dotNV:l}),d=e.mul(u.x).add(t.mul(u.y)),A=e.mul(f.x).add(t.mul(f.y)),y=u.x.add(u.y),w=f.x.add(f.y),S=oe(1).sub(y),T=oe(1).sub(w),R=e.add(e.oneMinus().mul(.047619)),P=d.mul(A).mul(R).div(oe(1).sub(S.mul(T).mul(R).mul(R)).add(pI)),I=S.mul(T),F=P.mul(I);return a.add(F)}),Vre=me(i=>{let{dotNV:e,specularColor:t,specularF90:n,roughness:r}=i,s=fS({dotNV:e,roughness:r});return t.mul(s.x).add(n.mul(s.y))}),u7=me(({f:i,f90:e,dotVH:t})=>{let n=t.oneMinus().saturate(),r=n.mul(n),s=n.mul(r,r).clamp(0,.9999);return i.sub(pe(e).mul(s)).div(s.oneMinus())}).setLayout({name:"Schlick_to_F0",type:"vec3",inputs:[{name:"f",type:"vec3"},{name:"f90",type:"float"},{name:"dotVH",type:"float"}]}),i3e=me(({roughness:i,dotNH:e})=>{let t=i.pow2(),n=oe(1).div(t),s=e.pow2().oneMinus().max(.0078125);return oe(2).add(n).mul(s.pow(n.mul(.5))).div(2*Math.PI)}).setLayout({name:"D_Charlie",type:"float",inputs:[{name:"roughness",type:"float"},{name:"dotNH",type:"float"}]}),r3e=me(({dotNV:i,dotNL:e})=>oe(1).div(oe(4).mul(e.add(i).sub(e.mul(i))))).setLayout({name:"V_Neubelt",type:"float",inputs:[{name:"dotNV",type:"float"},{name:"dotNL",type:"float"}]}),s3e=me(({lightDirection:i})=>{let e=i.add(er).normalize(),t=hi.dot(i).clamp(),n=hi.dot(er).clamp(),r=hi.dot(e).clamp(),s=i3e({roughness:im,dotNH:r}),o=r3e({dotNV:n,dotNL:t});return oc.mul(s).mul(o)}),Cee=me(({N:i,V:e,roughness:t})=>{let s=.0078125,o=i.dot(e).saturate(),a=dt(t,o.oneMinus().sqrt());return a.assign(a.mul(.984375).add(s)),a}).setLayout({name:"LTC_Uv",type:"vec2",inputs:[{name:"N",type:"vec3"},{name:"V",type:"vec3"},{name:"roughness",type:"float"}]}),o3e=me(({f:i})=>{let e=i.length();return zr(e.mul(e).add(i.z).div(e.add(1)),0)}).setLayout({name:"LTC_ClippedSphereFormFactor",type:"float",inputs:[{name:"f",type:"vec3"}]}),fR=me(({v1:i,v2:e})=>{let t=i.dot(e),n=t.abs().toVar(),r=n.mul(.0145206).add(.4965155).mul(n).add(.8543985).toVar(),s=n.add(4.1616724).mul(n).add(3.417594).toVar(),o=r.div(s),a=t.greaterThan(0).select(o,zr(t.mul(t).oneMinus(),1e-7).inverseSqrt().mul(.5).sub(o));return i.cross(e).mul(a)}).setLayout({name:"LTC_EdgeVectorFormFactor",type:"vec3",inputs:[{name:"v1",type:"vec3"},{name:"v2",type:"vec3"}]}),MO=me(({N:i,V:e,P:t,mInv:n,p0:r,p1:s,p2:o,p3:a})=>{let l=s.sub(r).toVar(),c=a.sub(r).toVar(),u=l.cross(c),f=pe().toVar();return $t(u.dot(t.sub(r)).greaterThanEqual(0),()=>{let d=e.sub(i.mul(e.dot(i))).normalize(),A=i.cross(d).negate(),y=n.mul(To(d,A,i).transpose()).toVar(),w=y.mul(r.sub(t)).normalize().toVar(),S=y.mul(s.sub(t)).normalize().toVar(),T=y.mul(o.sub(t)).normalize().toVar(),R=y.mul(a.sub(t)).normalize().toVar(),P=pe(0).toVar();P.addAssign(fR({v1:w,v2:S})),P.addAssign(fR({v1:S,v2:T})),P.addAssign(fR({v1:T,v2:R})),P.addAssign(fR({v1:R,v2:w})),f.assign(pe(o3e({f:P})))}),f}).setLayout({name:"LTC_Evaluate",type:"vec3",inputs:[{name:"N",type:"vec3"},{name:"V",type:"vec3"},{name:"P",type:"vec3"},{name:"mInv",type:"mat3"},{name:"p0",type:"vec3"},{name:"p1",type:"vec3"},{name:"p2",type:"vec3"},{name:"p3",type:"vec3"}]});var MI=1/6,Gre=i=>Tn(MI,Tn(i,Tn(i,i.negate().add(3)).sub(3)).add(1)),h7=i=>Tn(MI,Tn(i,Tn(i,Tn(3,i).sub(6))).add(4)),qre=i=>Tn(MI,Tn(i,Tn(i,Tn(-3,i).add(3)).add(3)).add(1)),f7=i=>Tn(MI,eu(i,3)),Ree=i=>Gre(i).add(h7(i)),Iee=i=>qre(i).add(f7(i)),Pee=i=>Ls(-1,h7(i).div(Gre(i).add(h7(i)))),Lee=i=>Ls(1,f7(i).div(qre(i).add(f7(i)))),Dee=(i,e,t)=>{let n=i.uvNode,r=Tn(n,e.zw).add(.5),s=gf(r),o=$u(r),a=Ree(o.x),l=Iee(o.x),c=Pee(o.x),u=Lee(o.x),f=Pee(o.y),d=Lee(o.y),A=dt(s.x.add(c),s.y.add(f)).sub(.5).mul(e.xy),y=dt(s.x.add(u),s.y.add(f)).sub(.5).mul(e.xy),w=dt(s.x.add(c),s.y.add(d)).sub(.5).mul(e.xy),S=dt(s.x.add(u),s.y.add(d)).sub(.5).mul(e.xy),T=Ree(o.y).mul(Ls(a.mul(i.sample(A).level(t)),l.mul(i.sample(y).level(t)))),R=Iee(o.y).mul(Ls(a.mul(i.sample(w).level(t)),l.mul(i.sample(S).level(t))));return T.add(R)},tV=me(([i,e])=>{let t=dt(i.size(de(e))),n=dt(i.size(de(e.add(1)))),r=hc(1,t),s=hc(1,n),o=Dee(i,Ft(r,t),gf(e)),a=Dee(i,Ft(s,n),AI(e));return $u(e).mix(o,a)}),a3e=me(([i,e])=>{let t=e.mul(Cz(i));return tV(i,t)}),Nee=me(([i,e,t,n,r])=>{let s=pe(gz(e.negate(),xa(i),hc(1,n))),o=pe(vf(r[0].xyz),vf(r[1].xyz),vf(r[2].xyz));return xa(s).mul(t.mul(o))}).setLayout({name:"getVolumeTransmissionRay",type:"vec3",inputs:[{name:"n",type:"vec3"},{name:"v",type:"vec3"},{name:"thickness",type:"float"},{name:"ior",type:"float"},{name:"modelMatrix",type:"mat4"}]}),l3e=me(([i,e])=>i.mul(Yu(e.mul(2).sub(2),0,1))).setLayout({name:"applyIorToRoughness",type:"float",inputs:[{name:"roughness",type:"float"},{name:"ior",type:"float"}]}),c3e=$z(),u3e=Ire(),Fee=me(([i,e,t],{material:n})=>{let s=(n.side===mi?c3e:u3e).sample(i),o=Af(Zg.x).mul(l3e(e,t));return tV(s,o)}),Bee=me(([i,e,t])=>($t(t.notEqual(0),()=>{let n=mI(e).negate().div(t);return rz(n.negate().mul(i))}),pe(1))).setLayout({name:"volumeAttenuation",type:"vec3",inputs:[{name:"transmissionDistance",type:"float"},{name:"attenuationColor",type:"vec3"},{name:"attenuationDistance",type:"float"}]}),h3e=me(([i,e,t,n,r,s,o,a,l,c,u,f,d,A,y])=>{let w,S;if(y){w=Ft().toVar(),S=pe().toVar();let F=u.sub(1).mul(y.mul(.025)),D=pe(u.sub(F),u,u.add(F));Oi({start:0,end:3},({i:L})=>{let C=D.element(L),B=Nee(i,e,f,C,a),k=o.add(B),z=c.mul(l.mul(Ft(k,1))),G=dt(z.xy.div(z.w)).toVar();G.addAssign(1),G.divAssign(2),G.assign(dt(G.x,G.y.oneMinus()));let W=Fee(G,t,C);w.element(L).assign(W.element(L)),w.a.addAssign(W.a),S.element(L).assign(n.element(L).mul(Bee(vf(B),d,A).element(L)))}),w.a.divAssign(3)}else{let F=Nee(i,e,f,u,a),D=o.add(F),L=c.mul(l.mul(Ft(D,1))),C=dt(L.xy.div(L.w)).toVar();C.addAssign(1),C.divAssign(2),C.assign(dt(C.x,C.y.oneMinus())),w=Fee(C,t,u),S=n.mul(Bee(vf(F),d,A))}let T=S.rgb.mul(w.rgb),R=i.dot(e).clamp(),P=pe(Vre({dotNV:R,specularColor:r,specularF90:s,roughness:t})),I=S.r.add(S.g,S.b).div(3);return Ft(P.oneMinus().mul(T),w.a.oneMinus().mul(I).oneMinus())}),f3e=To(3.2404542,-.969266,.0556434,-1.5371385,1.8760108,-.2040259,-.4985314,.041556,1.0572252),d3e=i=>{let e=i.sqrt();return pe(1).add(e).div(pe(1).sub(e))},Oee=(i,e)=>i.sub(e).div(i.add(e)).pow2(),p3e=(i,e)=>{let t=i.mul(2*Math.PI*1e-9),n=pe(54856e-17,44201e-17,52481e-17),r=pe(1681e3,1795300,2208400),s=pe(43278e5,93046e5,66121e5),o=oe(9747e-17*Math.sqrt(2*Math.PI*45282e5)).mul(t.mul(2239900).add(e.x).cos()).mul(t.pow2().mul(-45282e5).exp()),a=n.mul(s.mul(2*Math.PI).sqrt()).mul(r.mul(t).add(e).cos()).mul(t.pow2().negate().mul(s).exp());return a=pe(a.x.add(o),a.y,a.z).div(10685e-11),f3e.mul(a)},Uee=me(({outsideIOR:i,eta2:e,cosTheta1:t,thinFilmThickness:n,baseF0:r})=>{let s=Qn(i,e,fc(0,.03,n)),a=i.div(s).pow2().mul(t.pow2().oneMinus()).oneMinus();$t(a.lessThan(0),()=>pe(1));let l=a.sqrt(),c=Oee(s,i),u=hx({f0:c,f90:1,dotVH:t}),f=u.oneMinus(),d=s.lessThan(i).select(Math.PI,0),A=oe(Math.PI).sub(d),y=d3e(r.clamp(0,.9999)),w=Oee(y,s.toVec3()),S=hx({f0:w,f90:1,dotVH:l}),T=pe(y.x.lessThan(s).select(Math.PI,0),y.y.lessThan(s).select(Math.PI,0),y.z.lessThan(s).select(Math.PI,0)),R=s.mul(n,l,2),P=pe(A).add(T),I=u.mul(S).clamp(1e-5,.9999),F=I.sqrt(),D=f.pow2().mul(S).div(pe(1).sub(I)),C=u.add(D).toVar(),B=D.sub(f).toVar();return Oi({start:1,end:2,condition:"<=",name:"m"},({m:k})=>{B.mulAssign(F);let z=p3e(oe(k).mul(R),oe(k).mul(P)).mul(2);C.addAssign(B.mul(z))}),C.max(pe(0))}).setLayout({name:"evalIridescence",type:"vec3",inputs:[{name:"outsideIOR",type:"float"},{name:"eta2",type:"float"},{name:"cosTheta1",type:"float"},{name:"thinFilmThickness",type:"float"},{name:"baseF0",type:"vec3"}]}),Lw=me(({normal:i,viewDir:e,roughness:t})=>{let n=i.dot(e).saturate(),r=t.mul(t),s=t.add(.1).reciprocal(),o=oe(-1.9362).add(t.mul(1.0678)).add(r.mul(.4573)).sub(s.mul(.8469)),a=oe(-.6014).add(t.mul(.5538)).sub(r.mul(.467)).sub(s.mul(.1255));return o.mul(n).add(a).exp().saturate()}),Dw=pe(.04),dR=oe(1),g4=class extends ux{constructor(e=!1,t=!1,n=!1,r=!1,s=!1,o=!1){super(),this.clearcoat=e,this.sheen=t,this.iridescence=n,this.anisotropy=r,this.transmission=s,this.dispersion=o,this.clearcoatRadiance=null,this.clearcoatSpecularDirect=null,this.clearcoatSpecularIndirect=null,this.sheenSpecularDirect=null,this.sheenSpecularIndirect=null,this.iridescenceFresnel=null,this.iridescenceF0=null,this.iridescenceF0Dielectric=null,this.iridescenceF0Metallic=null}start(e){if(this.clearcoat===!0&&(this.clearcoatRadiance=pe().toVar("clearcoatRadiance"),this.clearcoatSpecularDirect=pe().toVar("clearcoatSpecularDirect"),this.clearcoatSpecularIndirect=pe().toVar("clearcoatSpecularIndirect")),this.sheen===!0&&(this.sheenSpecularDirect=pe().toVar("sheenSpecularDirect"),this.sheenSpecularIndirect=pe().toVar("sheenSpecularIndirect")),this.iridescence===!0){let t=hi.dot(er).clamp(),n=Uee({outsideIOR:oe(1),eta2:KR,cosTheta1:t,thinFilmThickness:QR,baseF0:dm}),r=Uee({outsideIOR:oe(1),eta2:KR,cosTheta1:t,thinFilmThickness:QR,baseF0:Bi.rgb});this.iridescenceFresnel=Qn(n,r,jd),this.iridescenceF0Dielectric=u7({f:n,f90:1,dotVH:t}),this.iridescenceF0Metallic=u7({f:r,f90:1,dotVH:t}),this.iridescenceF0=Qn(this.iridescenceF0Dielectric,this.iridescenceF0Metallic,jd)}if(this.transmission===!0){let t=_f,n=_ie.sub(_f).normalize(),r=xm,s=e.context;s.backdrop=h3e(r,n,pf,Ng,Bg,Og,t,tu,_m,Qa,Jw,J9,tz,ez,this.dispersion?nz:null),s.backdropAlpha=t4,Bi.a.mulAssign(Qn(1,s.backdrop.a,t4))}super.start(e)}computeMultiscattering(e,t,n,r,s=null){let o=hi.dot(er).clamp(),a=fS({roughness:pf,dotNV:o}),l=s?hI.mix(r,s):r,c=l.mul(a.x).add(n.mul(a.y)),f=a.x.add(a.y).oneMinus(),d=l.add(l.oneMinus().mul(.047619)),A=c.mul(d).div(f.mul(d).oneMinus());e.addAssign(c),t.addAssign(A.mul(f))}direct({lightDirection:e,lightColor:t,reflectedLight:n}){let s=hi.dot(e).clamp().mul(t).toVar();if(this.sheen===!0){this.sheenSpecularDirect.addAssign(s.mul(s3e({lightDirection:e})));let o=Lw({normal:hi,viewDir:er,roughness:im}),a=Lw({normal:hi,viewDir:e,roughness:im}),l=oc.r.max(oc.g).max(oc.b).mul(o.max(a)).oneMinus();s.mulAssign(l)}if(this.clearcoat===!0){let a=om.dot(e).clamp().mul(t);this.clearcoatSpecularDirect.addAssign(a.mul(eV({lightDirection:e,f0:Dw,f90:dR,roughness:J_,normalView:om})))}n.directDiffuse.addAssign(s.mul(Qg({diffuseColor:Ng}))),n.directSpecular.addAssign(s.mul(n3e({lightDirection:e,f0:Bg,f90:1,roughness:pf,f:this.iridescenceFresnel,USE_IRIDESCENCE:this.iridescence,USE_ANISOTROPY:this.anisotropy})))}directRectArea({lightColor:e,lightPosition:t,halfWidth:n,halfHeight:r,reflectedLight:s,ltc_1:o,ltc_2:a}){let l=t.add(n).sub(r),c=t.sub(n).sub(r),u=t.sub(n).add(r),f=t.add(n).add(r),d=hi,A=er,y=xs.toVar(),w=Cee({N:d,V:A,roughness:pf}),S=o.sample(w).toVar(),T=a.sample(w).toVar(),R=To(pe(S.x,0,S.y),pe(0,1,0),pe(S.z,0,S.w)).toVar(),P=Bg.mul(T.x).add(Og.sub(Bg).mul(T.y)).toVar();if(s.directSpecular.addAssign(e.mul(P).mul(MO({N:d,V:A,P:y,mInv:R,p0:l,p1:c,p2:u,p3:f}))),s.directDiffuse.addAssign(e.mul(Ng).mul(MO({N:d,V:A,P:y,mInv:To(1,0,0,0,1,0,0,0,1),p0:l,p1:c,p2:u,p3:f}))),this.clearcoat===!0){let I=om,F=Cee({N:I,V:A,roughness:J_}),D=o.sample(F),L=a.sample(F),C=To(pe(D.x,0,D.y),pe(0,1,0),pe(D.z,0,D.w)),B=Dw.mul(L.x).add(dR.sub(Dw).mul(L.y));this.clearcoatSpecularDirect.addAssign(e.mul(B).mul(MO({N:I,V:A,P:y,mInv:C,p0:l,p1:c,p2:u,p3:f})))}}indirect(e){this.indirectDiffuse(e),this.indirectSpecular(e),this.ambientOcclusion(e)}indirectDiffuse(e){let{irradiance:t,reflectedLight:n}=e.context,r=t.mul(Qg({diffuseColor:Ng})).toVar();if(this.sheen===!0){let s=Lw({normal:hi,viewDir:er,roughness:im}),o=oc.r.max(oc.g).max(oc.b).mul(s).oneMinus();r.mulAssign(o)}n.indirectDiffuse.addAssign(r)}indirectSpecular(e){let{radiance:t,iblIrradiance:n,reflectedLight:r}=e.context;if(this.sheen===!0&&this.sheenSpecularIndirect.addAssign(n.mul(oc,Lw({normal:hi,viewDir:er,roughness:im}))),this.clearcoat===!0){let S=om.dot(er).clamp(),T=Vre({dotNV:S,specularColor:Dw,specularF90:dR,roughness:J_});this.clearcoatSpecularIndirect.addAssign(this.clearcoatRadiance.mul(T))}let s=pe().toVar("singleScatteringDielectric"),o=pe().toVar("multiScatteringDielectric"),a=pe().toVar("singleScatteringMetallic"),l=pe().toVar("multiScatteringMetallic");this.computeMultiscattering(s,o,Og,dm,this.iridescenceF0Dielectric),this.computeMultiscattering(a,l,Og,Bi.rgb,this.iridescenceF0Metallic);let c=Qn(s,a,jd),u=Qn(o,l,jd),f=s.add(o),d=Ng.mul(f.oneMinus()),A=n.mul(1/Math.PI),y=t.mul(c).add(u.mul(A)).toVar(),w=d.mul(A).toVar();if(this.sheen===!0){let S=Lw({normal:hi,viewDir:er,roughness:im}),T=oc.r.max(oc.g).max(oc.b).mul(S).oneMinus();y.mulAssign(T),w.mulAssign(T)}r.indirectSpecular.addAssign(y),r.indirectDiffuse.addAssign(w)}ambientOcclusion(e){let{ambientOcclusion:t,reflectedLight:n}=e.context,s=hi.dot(er).clamp().add(t),o=pf.mul(-16).oneMinus().negate().exp2(),a=t.sub(s.pow(o).oneMinus()).clamp();this.clearcoat===!0&&this.clearcoatSpecularIndirect.mulAssign(t),this.sheen===!0&&this.sheenSpecularIndirect.mulAssign(t),n.indirectDiffuse.mulAssign(t),n.indirectSpecular.mulAssign(a)}finish({context:e}){let{outgoingLight:t}=e;if(this.clearcoat===!0){let n=om.dot(er).clamp(),r=hx({dotVH:n,f0:Dw,f90:dR}),s=t.mul(ZR.mul(r).oneMinus()).add(this.clearcoatSpecularDirect.add(this.clearcoatSpecularIndirect).mul(ZR));t.assign(s)}if(this.sheen===!0){let n=t.add(this.sheenSpecularDirect,this.sheenSpecularIndirect.mul(1/Math.PI));t.assign(n)}}},kee=oe(1),d7=oe(-2),pR=oe(.8),CO=oe(-1),mR=oe(.4),RO=oe(2),AR=oe(.305),IO=oe(3),zee=oe(.21),m3e=oe(4),Vee=oe(4),A3e=oe(16),g3e=me(([i])=>{let e=pe(fr(i)).toVar(),t=oe(-1).toVar();return $t(e.x.greaterThan(e.z),()=>{$t(e.x.greaterThan(e.y),()=>{t.assign(_a(i.x.greaterThan(0),0,3))}).Else(()=>{t.assign(_a(i.y.greaterThan(0),1,4))})}).Else(()=>{$t(e.z.greaterThan(e.y),()=>{t.assign(_a(i.z.greaterThan(0),2,5))}).Else(()=>{t.assign(_a(i.y.greaterThan(0),1,4))})}),t}).setLayout({name:"getFace",type:"float",inputs:[{name:"direction",type:"vec3"}]}),v3e=me(([i,e])=>{let t=dt().toVar();return $t(e.equal(0),()=>{t.assign(dt(i.z,i.y).div(fr(i.x)))}).ElseIf(e.equal(1),()=>{t.assign(dt(i.x.negate(),i.z.negate()).div(fr(i.y)))}).ElseIf(e.equal(2),()=>{t.assign(dt(i.x.negate(),i.y).div(fr(i.z)))}).ElseIf(e.equal(3),()=>{t.assign(dt(i.z.negate(),i.y).div(fr(i.x)))}).ElseIf(e.equal(4),()=>{t.assign(dt(i.x.negate(),i.z).div(fr(i.y)))}).Else(()=>{t.assign(dt(i.x,i.y).div(fr(i.z)))}),Tn(.5,t.add(1))}).setLayout({name:"getUV",type:"vec2",inputs:[{name:"direction",type:"vec3"},{name:"face",type:"float"}]}),_3e=me(([i])=>{let e=oe(0).toVar();return $t(i.greaterThanEqual(pR),()=>{e.assign(kee.sub(i).mul(CO.sub(d7)).div(kee.sub(pR)).add(d7))}).ElseIf(i.greaterThanEqual(mR),()=>{e.assign(pR.sub(i).mul(RO.sub(CO)).div(pR.sub(mR)).add(CO))}).ElseIf(i.greaterThanEqual(AR),()=>{e.assign(mR.sub(i).mul(IO.sub(RO)).div(mR.sub(AR)).add(RO))}).ElseIf(i.greaterThanEqual(zee),()=>{e.assign(AR.sub(i).mul(m3e.sub(IO)).div(AR.sub(zee)).add(IO))}).Else(()=>{e.assign(oe(-2).mul(Af(Tn(1.16,i))))}),e}).setLayout({name:"roughnessToMip",type:"float",inputs:[{name:"roughness",type:"float"}]}),Hre=me(([i,e])=>{let t=i.toVar();t.assign(Tn(2,t).sub(1));let n=pe(t,1).toVar();return $t(e.equal(0),()=>{n.assign(n.zyx)}).ElseIf(e.equal(1),()=>{n.assign(n.xzy),n.xz.mulAssign(-1)}).ElseIf(e.equal(2),()=>{n.x.mulAssign(-1)}).ElseIf(e.equal(3),()=>{n.assign(n.zyx),n.xz.mulAssign(-1)}).ElseIf(e.equal(4),()=>{n.assign(n.xzy),n.xy.mulAssign(-1)}).ElseIf(e.equal(5),()=>{n.z.mulAssign(-1)}),n}).setLayout({name:"getDirection",type:"vec3",inputs:[{name:"uv",type:"vec2"},{name:"face",type:"float"}]}),Wre=me(([i,e,t,n,r,s])=>{let o=oe(t),a=pe(e),l=Yu(_3e(o),d7,s),c=$u(l),u=gf(l),f=pe(dS(i,a,u,n,r,s)).toVar();return $t(c.notEqual(0),()=>{let d=pe(dS(i,a,u.add(1),n,r,s)).toVar();f.assign(Qn(f,d,c))}),f}),dS=me(([i,e,t,n,r,s])=>{let o=oe(t).toVar(),a=pe(e),l=oe(g3e(a)).toVar(),c=oe(zr(Vee.sub(o),0)).toVar();o.assign(zr(o,Vee));let u=oe(ox(o)).toVar(),f=dt(v3e(a,l).mul(u.sub(2)).add(1)).toVar();return $t(l.greaterThan(2),()=>{f.y.addAssign(u),l.subAssign(3)}),f.x.addAssign(l.mul(u)),f.x.addAssign(c.mul(Tn(3,A3e))),f.y.addAssign(Tn(4,ox(s).sub(u))),f.x.mulAssign(n),f.y.mulAssign(r),i.sample(f).grad(dt(),dt())}),PO=me(({envMap:i,mipInt:e,outputDirection:t,theta:n,axis:r,CUBEUV_TEXEL_WIDTH:s,CUBEUV_TEXEL_HEIGHT:o,CUBEUV_MAX_MIP:a})=>{let l=Hu(n),c=t.mul(l).add(r.cross(t).mul(Za(n))).add(r.mul(r.dot(t).mul(l.oneMinus())));return dS(i,c,e,s,o,a)}),jre=me(({n:i,latitudinal:e,poleAxis:t,outputDirection:n,weights:r,samples:s,dTheta:o,mipInt:a,envMap:l,CUBEUV_TEXEL_WIDTH:c,CUBEUV_TEXEL_HEIGHT:u,CUBEUV_MAX_MIP:f})=>{let d=pe(_a(e,t,$d(t,n))).toVar();$t(d.equal(pe(0)),()=>{d.assign(pe(n.z,0,n.x.negate()))}),d.assign(xa(d));let A=pe().toVar();return A.addAssign(r.element(0).mul(PO({theta:0,axis:d,outputDirection:n,mipInt:a,envMap:l,CUBEUV_TEXEL_WIDTH:c,CUBEUV_TEXEL_HEIGHT:u,CUBEUV_MAX_MIP:f}))),Oi({start:de(1),end:i},({i:y})=>{$t(y.greaterThanEqual(s),()=>{Mre()});let w=oe(o.mul(oe(y))).toVar();A.addAssign(r.element(y).mul(PO({theta:w.mul(-1),axis:d,outputDirection:n,mipInt:a,envMap:l,CUBEUV_TEXEL_WIDTH:c,CUBEUV_TEXEL_HEIGHT:u,CUBEUV_MAX_MIP:f}))),A.addAssign(r.element(y).mul(PO({theta:w,axis:d,outputDirection:n,mipInt:a,envMap:l,CUBEUV_TEXEL_WIDTH:c,CUBEUV_TEXEL_HEIGHT:u,CUBEUV_MAX_MIP:f})))}),Ft(A,1)}),x3e=me(([i])=>{let e=rt(i).toVar();return e.assign(e.shiftLeft(rt(16)).bitOr(e.shiftRight(rt(16)))),e.assign(e.bitAnd(rt(1431655765)).shiftLeft(rt(1)).bitOr(e.bitAnd(rt(2863311530)).shiftRight(rt(1)))),e.assign(e.bitAnd(rt(858993459)).shiftLeft(rt(2)).bitOr(e.bitAnd(rt(3435973836)).shiftRight(rt(2)))),e.assign(e.bitAnd(rt(252645135)).shiftLeft(rt(4)).bitOr(e.bitAnd(rt(4042322160)).shiftRight(rt(4)))),e.assign(e.bitAnd(rt(16711935)).shiftLeft(rt(8)).bitOr(e.bitAnd(rt(4278255360)).shiftRight(rt(8)))),oe(e).mul(23283064365386963e-26)}),y3e=me(([i,e])=>dt(oe(i).div(oe(e)),x3e(i))),b3e=me(([i,e,t])=>{let n=t.mul(t).toConst(),r=pe(1,0,0).toConst(),s=$d(e,r).toConst(),o=Ja(i.x).toConst(),a=Tn(2,3.14159265359).mul(i.y).toConst(),l=o.mul(Hu(a)).toConst(),c=o.mul(Za(a)).toVar(),u=Tn(.5,e.z.add(1)).toConst();c.assign(u.oneMinus().mul(Ja(l.mul(l).oneMinus())).add(u.mul(c)));let f=r.mul(l).add(s.mul(c)).add(e.mul(Ja(zr(0,l.mul(l).add(c.mul(c)).oneMinus()))));return xa(pe(n.mul(f.x),n.mul(f.y),zr(0,f.z)))}),Xre=me(({roughness:i,mipInt:e,envMap:t,N_immutable:n,GGX_SAMPLES:r,CUBEUV_TEXEL_WIDTH:s,CUBEUV_TEXEL_HEIGHT:o,CUBEUV_MAX_MIP:a})=>{let l=pe(n).toVar(),c=pe(0).toVar(),u=oe(0).toVar();return $t(i.lessThan(.001),()=>{c.assign(dS(t,l,e,s,o,a))}).Else(()=>{let f=_a(fr(l.z).lessThan(.999),pe(0,0,1),pe(1,0,0)),d=xa($d(f,l)).toVar(),A=$d(l,d).toVar();Oi({start:rt(0),end:r},({i:y})=>{let w=y3e(y,r),S=b3e(w,pe(0,0,1),i),T=xa(d.mul(S.x).add(A.mul(S.y)).add(l.mul(S.z))),R=xa(T.mul(ru(l,T).mul(2)).sub(l)),P=zr(ru(l,R),0);$t(P.greaterThan(0),()=>{let I=dS(t,R,e,s,o,a);c.addAssign(I.mul(P)),u.addAssign(P)})}),$t(u.greaterThan(0),()=>{c.assign(c.div(u))})}),Ft(c,1)}),cm=4,Gee=[.125,.215,.35,.446,.526,.582],Fg=20,w3e=512,Nw=new Du(-1,1,1,-1,0,1),S3e=new $r(90,1),qee=new zt,LO=null,DO=0,NO=0,T3e=new re,v4=new WeakMap,E3e=[3,1,5,0,4,2],FO=Hre(Ui(),cc("faceIndex")).normalize(),CI=pe(FO.x,FO.y,FO.z),p7=class{constructor(e){this._renderer=e,this._pingPongRenderTarget=null,this._lodMax=0,this._cubeSize=0,this._sizeLods=[],this._sigmas=[],this._lodMeshes=[],this._blurMaterial=null,this._ggxMaterial=null,this._cubemapMaterial=null,this._equirectMaterial=null,this._backgroundBox=null}get _hasInitialized(){return this._renderer.hasInitialized()}fromScene(e,t=0,n=.1,r=100,s={}){let{size:o=256,position:a=T3e,renderTarget:l=null}=s;if(this._setSize(o),this._hasInitialized===!1)throw new Error('THREE.PMREMGenerator: .fromScene() called before the backend is initialized. Use "await renderer.init();" before using this method.');LO=this._renderer.getRenderTarget(),DO=this._renderer.getActiveCubeFace(),NO=this._renderer.getActiveMipmapLevel();let c=l||this._allocateTarget(!0);return this._init(c),this._sceneToCubeUV(e,n,r,c,a),t>0&&this._blur(c,0,0,t),this._applyPMREM(c),this._cleanup(c),c}async fromSceneAsync(e,t=0,n=.1,r=100,s={}){return ni('PMREMGenerator: ".fromSceneAsync()" is deprecated. Use "await renderer.init()" instead.'),await this._renderer.init(),this.fromScene(e,t,n,r,s)}fromEquirectangular(e,t=null){if(this._hasInitialized===!1)throw new Error('THREE.PMREMGenerator: .fromEquirectangular() called before the backend is initialized. Use "await renderer.init();" before using this method.');return this._fromTexture(e,t)}async fromEquirectangularAsync(e,t=null){return ni('PMREMGenerator: ".fromEquirectangularAsync()" is deprecated. Use "await renderer.init()" instead.'),await this._renderer.init(),this._fromTexture(e,t)}fromCubemap(e,t=null){if(this._hasInitialized===!1)throw new Error('THREE.PMREMGenerator: .fromCubemap() called before the backend is initialized. Use "await renderer.init();" before using this method.');return this._fromTexture(e,t)}async fromCubemapAsync(e,t=null){return ni('PMREMGenerator: ".fromCubemapAsync()" is deprecated. Use "await renderer.init()" instead.'),await this._renderer.init(),this._fromTexture(e,t)}async compileCubemapShader(){this._cubemapMaterial===null&&(this._cubemapMaterial=Wee(),await this._compileMaterial(this._cubemapMaterial))}async compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=jee(),await this._compileMaterial(this._equirectMaterial))}dispose(){this._dispose(),this._cubemapMaterial!==null&&this._cubemapMaterial.dispose(),this._equirectMaterial!==null&&this._equirectMaterial.dispose(),this._backgroundBox!==null&&(this._backgroundBox.geometry.dispose(),this._backgroundBox.material.dispose())}_setSizeFromTexture(e){e.mapping===Kl||e.mapping===Gc?this._setSize(e.image.length===0?16:e.image[0].width||e.image[0].image.width):this._setSize(e.image.width/4)}_setSize(e){this._lodMax=Math.floor(Math.log2(e)),this._cubeSize=Math.pow(2,this._lodMax)}_dispose(){this._blurMaterial!==null&&this._blurMaterial.dispose(),this._ggxMaterial!==null&&this._ggxMaterial.dispose(),this._pingPongRenderTarget!==null&&this._pingPongRenderTarget.dispose();for(let e=0;e<this._lodMeshes.length;e++)this._lodMeshes[e].geometry.dispose()}_cleanup(e){this._renderer.setRenderTarget(LO,DO,NO),e.scissorTest=!1,this._setViewport(e,0,0,e.width,e.height)}_fromTexture(e,t){this._setSizeFromTexture(e),LO=this._renderer.getRenderTarget(),DO=this._renderer.getActiveCubeFace(),NO=this._renderer.getActiveMipmapLevel();let n=t||this._allocateTarget(!1);return this._init(n),this._textureToCubeUV(e,n),this._applyPMREM(n),this._cleanup(n),n}_allocateTarget(e){let t=3*Math.max(this._cubeSize,112),n=4*this._cubeSize;return Hee(t,n,e)}_init(e){if(this._pingPongRenderTarget===null||this._pingPongRenderTarget.width!==e.width||this._pingPongRenderTarget.height!==e.height){this._pingPongRenderTarget!==null&&this._dispose(),this._pingPongRenderTarget=Hee(e.width,e.height);let{_lodMax:t}=this;({lodMeshes:this._lodMeshes,sizeLods:this._sizeLods,sigmas:this._sigmas}=M3e(t)),this._blurMaterial=C3e(t,e.width,e.height),this._ggxMaterial=R3e(t,e.width,e.height)}}async _compileMaterial(e){let t=new Hn(new Xn,e);await this._renderer.compile(t,Nw)}_sceneToCubeUV(e,t,n,r,s){let o=S3e;o.near=t,o.far=n;let a=[1,1,1,1,-1,1],l=[1,-1,1,-1,1,-1],c=this._renderer,u=c.autoClear;c.getClearColor(qee),c.autoClear=!1,this._backgroundBox===null&&(this._backgroundBox=new Hn(new Lu,new fs({name:"PMREM.Background",side:mi,depthWrite:!1,depthTest:!1})));let f=this._backgroundBox,d=f.material,A=!1,y=e.background;y?y.isColor&&(d.color.copy(y),e.background=null,A=!0):(d.color.copy(qee),A=!0),c.setRenderTarget(r),c.clear(),A&&c.render(f,o);for(let w=0;w<6;w++){let S=w%3;S===0?(o.up.set(0,a[w],0),o.position.set(s.x,s.y,s.z),o.lookAt(s.x+l[w],s.y,s.z)):S===1?(o.up.set(0,0,a[w]),o.position.set(s.x,s.y,s.z),o.lookAt(s.x,s.y+l[w],s.z)):(o.up.set(0,a[w],0),o.position.set(s.x,s.y,s.z),o.lookAt(s.x,s.y,s.z+l[w]));let T=this._cubeSize;this._setViewport(r,S*T,w>2?T:0,T,T),c.render(e,o)}c.autoClear=u,e.background=y}_textureToCubeUV(e,t){let n=this._renderer,r=e.mapping===Kl||e.mapping===Gc;r?this._cubemapMaterial===null&&(this._cubemapMaterial=Wee(e)):this._equirectMaterial===null&&(this._equirectMaterial=jee(e));let s=r?this._cubemapMaterial:this._equirectMaterial;s.fragmentNode.value=e;let o=this._lodMeshes[0];o.material=s;let a=this._cubeSize;this._setViewport(t,0,0,3*a,2*a),n.setRenderTarget(t),n.render(o,Nw)}_applyPMREM(e){let t=this._renderer,n=t.autoClear;t.autoClear=!1;let r=this._lodMeshes.length;for(let s=1;s<r;s++)this._applyGGXFilter(e,s-1,s);t.autoClear=n}_applyGGXFilter(e,t,n){let r=this._renderer,s=this._pingPongRenderTarget,o=this._ggxMaterial,a=this._lodMeshes[n];a.material=o;let l=v4.get(o),c=n/(this._lodMeshes.length-1),u=t/(this._lodMeshes.length-1),f=Math.sqrt(c*c-u*u),d=0+c*1.25,A=f*d,{_lodMax:y}=this,w=this._sizeLods[n],S=3*w*(n>y-cm?n-y+cm:0),T=4*(this._cubeSize-w);e.texture.frame=(e.texture.frame||0)+1,l.envMap.value=e.texture,l.roughness.value=A,l.mipInt.value=y-t,this._setViewport(s,S,T,3*w,2*w),r.setRenderTarget(s),r.render(a,Nw),s.texture.frame=(s.texture.frame||0)+1,l.envMap.value=s.texture,l.roughness.value=0,l.mipInt.value=y-n,this._setViewport(e,S,T,3*w,2*w),r.setRenderTarget(e),r.render(a,Nw)}_blur(e,t,n,r,s){let o=this._pingPongRenderTarget;this._halfBlur(e,o,t,n,r,"latitudinal",s),this._halfBlur(o,e,n,n,r,"longitudinal",s)}_halfBlur(e,t,n,r,s,o,a){let l=this._renderer,c=this._blurMaterial;o!=="latitudinal"&&o!=="longitudinal"&&ze("blur direction must be either latitudinal or longitudinal!");let u=3,f=this._lodMeshes[r];f.material=c;let d=v4.get(c),A=this._sizeLods[n]-1,y=isFinite(s)?Math.PI/(2*A):2*Math.PI/(2*Fg-1),w=s/y,S=isFinite(s)?1+Math.floor(u*w):Fg;S>Fg&&Xe(`sigmaRadians, ${s}, is too large and will clip, as it requested ${S} samples when the maximum is set to ${Fg}`);let T=[],R=0;for(let L=0;L<Fg;++L){let C=L/w,B=Math.exp(-C*C/2);T.push(B),L===0?R+=B:L<S&&(R+=2*B)}for(let L=0;L<T.length;L++)T[L]=T[L]/R;e.texture.frame=(e.texture.frame||0)+1,d.envMap.value=e.texture,d.samples.value=S,d.weights.array=T,d.latitudinal.value=o==="latitudinal"?1:0,a&&(d.poleAxis.value=a);let{_lodMax:P}=this;d.dTheta.value=y,d.mipInt.value=P-n;let I=this._sizeLods[r],F=3*I*(r>P-cm?r-P+cm:0),D=4*(this._cubeSize-I);this._setViewport(t,F,D,3*I,2*I),l.setRenderTarget(t),l.render(f,Nw)}_setViewport(e,t,n,r,s){this._renderer.isWebGLRenderer?(e.viewport.set(t,e.height-s-n,r,s),e.scissor.set(t,e.height-s-n,r,s)):(e.viewport.set(t,n,r,s),e.scissor.set(t,n,r,s))}};function M3e(i){let e=[],t=[],n=[],r=i,s=i-cm+1+Gee.length;for(let o=0;o<s;o++){let a=Math.pow(2,r);e.push(a);let l=1/a;o>i-cm?l=Gee[o-i+cm-1]:o===0&&(l=0),t.push(l);let c=1/(a-2),u=-c,f=1+c,d=[u,u,f,u,f,f,u,u,f,f,u,f],A=6,y=6,w=3,S=2,T=1,R=new Float32Array(w*y*A),P=new Float32Array(S*y*A),I=new Float32Array(T*y*A);for(let D=0;D<A;D++){let L=D%3*2/3-1,C=D>2?0:-1,B=[L,C,0,L+2/3,C,0,L+2/3,C+1,0,L,C,0,L+2/3,C+1,0,L,C+1,0],k=E3e[D];R.set(B,w*y*k),P.set(d,S*y*k);let z=[k,k,k,k,k,k];I.set(z,T*y*k)}let F=new Xn;F.setAttribute("position",new Hi(R,w)),F.setAttribute("uv",new Hi(P,S)),F.setAttribute("faceIndex",new Hi(I,T)),n.push(new Hn(F,null)),r>cm&&r--}return{lodMeshes:n,sizeLods:e,sigmas:t}}function Hee(i,e,t){let n={magFilter:Mi,minFilter:Mi,generateMipmaps:!1,type:Wi,format:Or,colorSpace:Kp,depthBuffer:t},r=new Fa(i,e,n);return r.texture.mapping=Bh,r.texture.name="PMREM.cubeUv",r.texture.isPMREMTexture=!0,r.scissorTest=!0,r}function RI(i){let e=new Rr;return e.depthTest=!1,e.depthWrite=!1,e.blending=ps,e.name=`PMREM_${i}`,e}function C3e(i,e,t){let n=Xo(new Array(Fg).fill(0)),r=Xt(new re(0,1,0)),s=Xt(0),o=oe(Fg),a=Xt(0),l=Xt(1),c=fi(),u=Xt(0),f=oe(1/e),d=oe(1/t),A=oe(i),y={n:o,latitudinal:a,weights:n,poleAxis:r,outputDirection:CI,dTheta:s,samples:l,envMap:c,mipInt:u,CUBEUV_TEXEL_WIDTH:f,CUBEUV_TEXEL_HEIGHT:d,CUBEUV_MAX_MIP:A},w=RI("blur");return w.fragmentNode=jre({...y,latitudinal:a.equal(1)}),v4.set(w,y),w}function R3e(i,e,t){let n=fi(),r=Xt(0),s=Xt(0),o=oe(1/e),a=oe(1/t),l=oe(i),c={envMap:n,roughness:r,mipInt:s,CUBEUV_TEXEL_WIDTH:o,CUBEUV_TEXEL_HEIGHT:a,CUBEUV_MAX_MIP:l},u=RI("ggx");return u.fragmentNode=Xre({...c,N_immutable:CI,GGX_SAMPLES:rt(w3e)}),v4.set(u,c),u}function Wee(i){let e=RI("cubemap");return e.fragmentNode=Ka(i,CI),e}function jee(i){let e=RI("equirect");return e.fragmentNode=fi(i,Qz(CI),0),e}var Xee=new WeakMap;function I3e(i){let e=Math.log2(i)-2,t=1/i;return{texelWidth:1/(3*Math.max(Math.pow(2,e),112)),texelHeight:t,maxMip:e}}function P3e(i,e,t){let n=L3e(e),r=n.get(i);if((r!==void 0?r.pmremVersion:-1)!==i.pmremVersion){let o=i.image;if(i.isCubeTexture)if(D3e(o))r=t.fromCubemap(i,r);else return null;else if(N3e(o))r=t.fromEquirectangular(i,r);else return null;if(r.pmremVersion=i.pmremVersion,n.has(i)===!1){let a=()=>{i.removeEventListener("dispose",a);let l=n.get(i);l!==void 0&&(l.dispose(),n.delete(i))};i.addEventListener("dispose",a)}n.set(i,r)}return r.texture}function L3e(i){let e=Xee.get(i);return e===void 0&&(e=new WeakMap,Xee.set(i,e)),e}var m7=class extends Cr{static get type(){return"PMREMNode"}constructor(e,t=null,n=null){super("vec3"),this._value=e,this._pmrem=null,this.uvNode=t,this.levelNode=n,this._generator=null;let r=new Hs;r.isRenderTargetTexture=!0,this._texture=fi(r),this._width=Xt(0),this._height=Xt(0),this._maxMip=Xt(0),this.updateBeforeType=yn.RENDER}set value(e){this._value=e,this._pmrem=null}get value(){return this._value}updateFromTexture(e){let t=I3e(e.image.height);this._texture.value=e,this._width.value=t.texelWidth,this._height.value=t.texelHeight,this._maxMip.value=t.maxMip}updateBefore(e){let t=this._pmrem,n=t?t.pmremVersion:-1,r=this._value;n!==r.pmremVersion&&(r.isPMREMTexture===!0||r.mapping===Bh?t=r:t=P3e(r,e.renderer,this._generator),t!==null&&(this._pmrem=t,this.updateFromTexture(t)))}setup(e){this._generator===null&&(this._generator=new p7(e.renderer)),this.updateBefore(e);let t=this.uvNode;t===null&&e.context.getUV&&(t=e.context.getUV(this,e)),t=this._pmrem.isRenderTargetTexture?c4.mul(pe(t.x,t.y.negate(),t.z)):c4.mul(t);let n=this.levelNode;return n===null&&e.context.getTextureLevel&&(n=e.context.getTextureLevel(this)),Wre(this._texture,t,n,this._width,this._height,this._maxMip)}dispose(){super.dispose(),this._generator!==null&&this._generator.dispose()}};function D3e(i){if(i==null)return!1;let e=0,t=6;for(let n=0;n<t;n++)i[n]!==void 0&&e++;return e===t}function N3e(i){return i==null?!1:i.height>0}var nV=$n(m7).setParameterLength(1,3),$ee=new WeakMap,A7=class extends mm{static get type(){return"EnvironmentNode"}constructor(e=null){super(),this.envNode=e}setup(e){let{material:t}=e,n=this.envNode;if(n.isTextureNode||n.isMaterialReferenceNode){let f=n.isTextureNode?n.value:t[n.property],d=this._getPMREMNodeCache(e.renderer),A=d.get(f);A===void 0&&(A=nV(f),d.set(f,A)),n=A}let s=t.useAnisotropy===!0||t.anisotropy>0?qie:hi,o=n.context(Yee(pf,s)).mul(qR),a=n.context(F3e(xm)).mul(Math.PI).mul(qR),l=nx(o),c=nx(a);e.context.radiance.addAssign(l),e.context.iblIrradiance.addAssign(c);let u=e.context.lightingModel.clearcoatRadiance;if(u){let f=n.context(Yee(J_,om)).mul(qR),d=nx(f);u.addAssign(d)}}_getPMREMNodeCache(e){let t=$ee.get(e);return t===void 0&&(t=new WeakMap,$ee.set(e,t)),t}},Yee=(i,e)=>{let t=null;return{getUV:()=>(t===null&&(t=er.negate().reflect(e),t=mz(i).mix(t,e).normalize(),t=t.transformDirection(MS)),t),getTextureLevel:()=>i}},F3e=i=>({getUV:()=>i,getTextureLevel:()=>oe(1)}),B3e=new Jv,_4=class extends Rr{static get type(){return"MeshStandardNodeMaterial"}constructor(e){super(),this.isMeshStandardNodeMaterial=!0,this.lights=!0,this.emissiveNode=null,this.metalnessNode=null,this.roughnessNode=null,this.setDefaultValues(B3e),this.setValues(e)}setupEnvironment(e){let t=super.setupEnvironment(e);return t===null&&e.environmentNode&&(t=e.environmentNode),t?new A7(t):null}setupLightingModel(){return new g4}setupSpecular(){let e=Qn(pe(.04),Bi.rgb,jd);dm.assign(pe(.04)),Bg.assign(e),Og.assign(1)}setupVariants(){let e=this.metalnessNode?oe(this.metalnessNode):Qie;jd.assign(e);let t=this.roughnessNode?oe(this.roughnessNode):Kie;t=Jz({roughness:t}),pf.assign(t),this.setupSpecular(),Ng.assign(Bi.rgb.mul(e.oneMinus()))}},O3e=new H2,g7=class extends _4{static get type(){return"MeshPhysicalNodeMaterial"}constructor(e){super(),this.isMeshPhysicalNodeMaterial=!0,this.clearcoatNode=null,this.clearcoatRoughnessNode=null,this.clearcoatNormalNode=null,this.sheenNode=null,this.sheenRoughnessNode=null,this.iridescenceNode=null,this.iridescenceIORNode=null,this.iridescenceThicknessNode=null,this.specularIntensityNode=null,this.specularColorNode=null,this.iorNode=null,this.transmissionNode=null,this.thicknessNode=null,this.attenuationDistanceNode=null,this.attenuationColorNode=null,this.dispersionNode=null,this.anisotropyNode=null,this.setDefaultValues(O3e),this.setValues(e)}get useClearcoat(){return this.clearcoat>0||this.clearcoatNode!==null}get useIridescence(){return this.iridescence>0||this.iridescenceNode!==null}get useSheen(){return this.sheen>0||this.sheenNode!==null}get useAnisotropy(){return this.anisotropy>0||this.anisotropyNode!==null}get useTransmission(){return this.transmission>0||this.transmissionNode!==null}get useDispersion(){return this.dispersion>0||this.dispersionNode!==null}setupSpecular(){let e=this.iorNode?oe(this.iorNode):fre;Jw.assign(e),dm.assign(Rl(pz(Jw.sub(1).div(Jw.add(1))).mul(Zie),pe(1)).mul(qU)),Bg.assign(Qn(dm,Bi.rgb,jd)),Og.assign(Qn(qU,1,jd))}setupLightingModel(){return new g4(this.useClearcoat,this.useSheen,this.useIridescence,this.useAnisotropy,this.useTransmission,this.useDispersion)}setupVariants(e){if(super.setupVariants(e),this.useClearcoat){let t=this.clearcoatNode?oe(this.clearcoatNode):ere,n=this.clearcoatRoughnessNode?oe(this.clearcoatRoughnessNode):tre;ZR.assign(t),J_.assign(Jz({roughness:n}))}if(this.useSheen){let t=this.sheenNode?pe(this.sheenNode):rre,n=this.sheenRoughnessNode?oe(this.sheenRoughnessNode):sre;oc.assign(t),im.assign(n)}if(this.useIridescence){let t=this.iridescenceNode?oe(this.iridescenceNode):are,n=this.iridescenceIORNode?oe(this.iridescenceIORNode):lre,r=this.iridescenceThicknessNode?oe(this.iridescenceThicknessNode):cre;hI.assign(t),KR.assign(n),QR.assign(r)}if(this.useAnisotropy){let t=(this.anisotropyNode?dt(this.anisotropyNode):ore).toVar();nm.assign(t.length()),$t(nm.equal(0),()=>{t.assign(dt(1,0))}).Else(()=>{t.divAssign(dt(nm)),nm.assign(nm.saturate())}),JR.assign(nm.pow2().mix(pf.pow2(),1)),Qw.assign(Ug[0].mul(t.x).add(Ug[1].mul(t.y))),Vg.assign(Ug[1].mul(t.x).sub(Ug[0].mul(t.y)))}if(this.useTransmission){let t=this.transmissionNode?oe(this.transmissionNode):ure,n=this.thicknessNode?oe(this.thicknessNode):hre,r=this.attenuationDistanceNode?oe(this.attenuationDistanceNode):dre,s=this.attenuationColorNode?pe(this.attenuationColorNode):pre;if(t4.assign(t),J9.assign(n),ez.assign(r),tz.assign(s),this.useDispersion){let o=this.dispersionNode?oe(this.dispersionNode):Are;nz.assign(o)}}}setupClearcoatNormal(){return this.clearcoatNormalNode?pe(this.clearcoatNormalNode):nre}setup(e){e.context.setupClearcoatNormal=()=>qg(this.setupClearcoatNormal(e),"NORMAL","vec3"),super.setup(e)}};var U3e=me(({normal:i,lightDirection:e,builder:t})=>{let n=i.dot(e),r=dt(n.mul(.5).add(.5),0);if(t.material.gradientMap){let s=Hd("gradientMap","texture").context({getUV:()=>r});return pe(s.r)}else{let s=r.fwidth().mul(.5);return Qn(pe(.7),pe(1),fc(oe(.7).sub(s.x),oe(.7).add(s.x),r.x))}}),v7=class extends ux{direct({lightDirection:e,lightColor:t,reflectedLight:n},r){let s=U3e({normal:yI,lightDirection:e,builder:r}).mul(t);n.directDiffuse.addAssign(s.mul(Qg({diffuseColor:Bi.rgb})))}indirect(e){let{ambientOcclusion:t,irradiance:n,reflectedLight:r}=e.context;r.indirectDiffuse.addAssign(n.mul(Qg({diffuseColor:Bi}))),r.indirectDiffuse.mulAssign(t)}},k3e=new W2,_7=class extends Rr{static get type(){return"MeshToonNodeMaterial"}constructor(e){super(),this.isMeshToonNodeMaterial=!0,this.lights=!0,this.setDefaultValues(k3e),this.setValues(e)}setupLightingModel(){return new v7}},$re=me(()=>{let i=pe(er.z,0,er.x.negate()).normalize(),e=er.cross(i);return dt(i.dot(hi),e.dot(hi)).mul(.495).add(.5)}).once(["NORMAL","VERTEX"])().toVar("matcapUV"),z3e=new X2,x7=class extends Rr{static get type(){return"MeshMatcapNodeMaterial"}constructor(e){super(),this.isMeshMatcapNodeMaterial=!0,this.setDefaultValues(z3e),this.setValues(e)}setupVariants(e){let t=$re,n;e.material.matcap?n=Hd("matcap","texture").context({getUV:()=>t}):n=pe(Qn(.2,.8,t.y)),Bi.rgb.mulAssign(n.rgb)}},y7=class extends Cr{static get type(){return"RotateNode"}constructor(e,t){super(),this.positionNode=e,this.rotationNode=t}generateNodeType(e){return this.positionNode.getNodeType(e)}setup(e){let{rotationNode:t,positionNode:n}=this;if(this.getNodeType(e)==="vec2"){let s=t.cos(),o=t.sin();return uI(s,o,o.negate(),s).mul(n)}else{let s=t,o=um(Ft(1,0,0,0),Ft(0,Hu(s.x),Za(s.x).negate(),0),Ft(0,Za(s.x),Hu(s.x),0),Ft(0,0,0,1)),a=um(Ft(Hu(s.y),0,Za(s.y),0),Ft(0,1,0,0),Ft(Za(s.y).negate(),0,Hu(s.y),0),Ft(0,0,0,1)),l=um(Ft(Hu(s.z),Za(s.z).negate(),0,0),Ft(Za(s.z),Hu(s.z),0,0),Ft(0,0,1,0),Ft(0,0,0,1));return o.mul(a).mul(l).mul(Ft(n,1)).xyz}}},RS=$n(y7).setParameterLength(2),V3e=new Rh,x4=class extends Rr{static get type(){return"SpriteNodeMaterial"}constructor(e){super(),this.isSpriteNodeMaterial=!0,this._useSizeAttenuation=!0,this.positionNode=null,this.rotationNode=null,this.scaleNode=null,this.transparent=!0,this.setDefaultValues(V3e),this.setValues(e)}setupPositionView(e){let{object:t,camera:n}=e,{positionNode:r,rotationNode:s,scaleNode:o,sizeAttenuation:a}=this,l=bf.mul(pe(r||0)),c=dt(tu[0].xyz.length(),tu[1].xyz.length());o!==null&&(c=c.mul(dt(o))),n.isPerspectiveCamera&&a===!1&&(c=c.mul(l.z.negate()));let u=ga.xy;if(t.center&&t.center.isVector2===!0){let A=RTe("center","vec2",t);u=u.sub(A.sub(.5))}u=u.mul(c);let f=oe(s||ire),d=RS(u,f);return Ft(l.xy.add(d),l.zw)}get sizeAttenuation(){return this._useSizeAttenuation}set sizeAttenuation(e){this._useSizeAttenuation!==e&&(this._useSizeAttenuation=e,this.needsUpdate=!0)}},G3e=new i0,q3e=new Oe,b7=class extends x4{static get type(){return"PointsNodeMaterial"}constructor(e){super(),this.sizeNode=null,this.isPointsNodeMaterial=!0,this.setDefaultValues(G3e),this.setValues(e)}setupPositionView(){let{positionNode:e}=this;return bf.mul(pe(e||Er)).xyz}setupVertexSprite(e){let{material:t,camera:n}=e,{rotationNode:r,scaleNode:s,sizeNode:o,sizeAttenuation:a}=this,l=super.setupVertex(e);if(t.isNodeMaterial!==!0)return l;let c=o!==null?dt(o):mre;c=c.mul(Iz),n.isPerspectiveCamera&&a===!0&&(c=c.mul(H3e.div(xs.z.negate()))),s&&s.isNode&&(c=c.mul(dt(s)));let u=ga.xy;if(r&&r.isNode){let f=oe(r);u=RS(u,f)}return u=u.mul(c),u=u.div(Pz.div(2)),u=u.mul(l.w),l=l.add(Ft(u,0,0)),l}setupVertex(e){return e.object.isPoints?super.setupVertex(e):this.setupVertexSprite(e)}get alphaToCoverage(){return this._useAlphaToCoverage}set alphaToCoverage(e){this._useAlphaToCoverage!==e&&(this._useAlphaToCoverage=e,this.needsUpdate=!0)}},H3e=Xt(1).onFrameUpdate(function({renderer:i}){let e=i.getSize(q3e);this.value=.5*e.y}),w7=class extends ux{constructor(){super(),this.shadowNode=oe(1).toVar("shadowMask")}direct({lightNode:e}){e.shadowNode!==null&&this.shadowNode.mulAssign(e.shadowNode)}finish({context:e}){Bi.a.mulAssign(this.shadowNode.oneMinus()),e.outgoingLight.rgb.assign(Bi.rgb)}},W3e=new q2,S7=class extends Rr{static get type(){return"ShadowNodeMaterial"}constructor(e){super(),this.isShadowNodeMaterial=!0,this.lights=!0,this.transparent=!0,this.setDefaultValues(W3e),this.setValues(e)}setupLightingModel(){return new w7}},Lat=Zd("vec3"),Dat=Zd("vec3"),Nat=Zd("vec3");var T7=class{constructor(e,t,n){this.renderer=e,this.nodes=t,this.info=n,this._context=typeof self<"u"?self:null,this._animationLoop=null,this._requestId=null}start(){let e=(t,n)=>{this._requestId=this._context.requestAnimationFrame(e),this.info.autoReset===!0&&this.info.reset(),this.nodes.nodeFrame.update(),this.info.frame=this.nodes.nodeFrame.frameId,this.renderer._inspector.begin(),this._animationLoop!==null&&this._animationLoop(t,n),this.renderer._inspector.finish()};e()}stop(){this._context!==null&&this._context.cancelAnimationFrame(this._requestId),this._requestId=null}getAnimationLoop(){return this._animationLoop}setAnimationLoop(e){this._animationLoop=e}getContext(){return this._context}setContext(e){this._context=e}dispose(){this.stop()}},Sf=class{constructor(){this.weakMaps={}}_getWeakMap(e){let t=e.length,n=this.weakMaps[t];return n===void 0&&(n=new WeakMap,this.weakMaps[t]=n),n}get(e){let t=this._getWeakMap(e);for(let n=0;n<e.length-1;n++)if(t=t.get(e[n]),t===void 0)return;return t.get(e[e.length-1])}set(e,t){let n=this._getWeakMap(e);for(let r=0;r<e.length-1;r++){let s=e[r];n.has(s)===!1&&n.set(s,new WeakMap),n=n.get(s)}return n.set(e[e.length-1],t),this}delete(e){let t=this._getWeakMap(e);for(let n=0;n<e.length-1;n++)if(t=t.get(e[n]),t===void 0)return!1;return t.delete(e[e.length-1])}},j3e=0,Zee=new WeakMap;function X3e(i){let e=Object.keys(i),t=Zee.get(i.constructor);if(t===void 0){t=[];let n=Object.getPrototypeOf(i);for(;n;){let r=Object.getOwnPropertyDescriptors(n);for(let s in r){let o=r[s];o&&typeof o.get=="function"&&t.push(s)}n=Object.getPrototypeOf(n)}Zee.set(i.constructor,t)}for(let n=0;n<t.length;n++)e.push(t[n]);return e}var E7=class{constructor(e,t,n,r,s,o,a,l,c,u){this.id=j3e++,this._nodes=e,this._geometries=t,this.renderer=n,this.object=r,this.material=s,this.scene=o,this.camera=a,this.lightsNode=l,this.context=c,this.geometry=r.geometry,this.version=s.version,this.drawRange=null,this.attributes=null,this.attributesId=null,this.pipeline=null,this.group=null,this.vertexBuffers=null,this.drawParams=null,this.bundle=null,this.clippingContext=u,this.clippingContextCacheKey=u!==null?u.cacheKey:"",this.initialNodesCacheKey=this.getDynamicCacheKey(),this.initialCacheKey=this.getCacheKey(),this._nodeBuilderState=null,this._bindings=null,this._monitor=null,this._sourceMaterial=n._currentSourceMaterial,this.onDispose=null,this.isRenderObject=!0,this.onMaterialDispose=()=>{this.dispose()},this.onGeometryDispose=()=>{this.attributes=null,this.attributesId=null},this.material.addEventListener("dispose",this.onMaterialDispose),this.geometry.addEventListener("dispose",this.onGeometryDispose),this._sourceMaterial!==null&&this._sourceMaterial.addEventListener("dispose",this.onMaterialDispose)}updateClipping(e){this.clippingContext=e}get clippingNeedsUpdate(){return this.clippingContext===null||this.clippingContext.cacheKey===this.clippingContextCacheKey?!1:(this.clippingContextCacheKey=this.clippingContext.cacheKey,!0)}get hardwareClippingPlanes(){return this.getNodeBuilderState().hardwareClipping===!0?this.clippingContext.unionClippingCount:0}getNodeBuilderState(){return this._nodeBuilderState||(this._nodeBuilderState=this._nodes.getForRender(this))}getMonitor(){return this._monitor||(this._monitor=this.getNodeBuilderState().observer)}getBindings(){return this._bindings||(this._bindings=this.getNodeBuilderState().createBindings())}getBindingGroup(e){for(let t of this.getBindings())if(t.name===e)return t}getIndex(){return this._geometries.getIndex(this)}getIndirect(){return this._geometries.getIndirect(this)}getIndirectOffset(){return this._geometries.getIndirectOffset(this)}getChainArray(){return[this.object,this.material,this.context,this.lightsNode]}setGeometry(e){this.geometry=e,this.attributes=null,this.attributesId=null}getAttributes(){if(this.attributes!==null)return this.attributes;let e=this.getNodeBuilderState().nodeAttributes,t=this.geometry,n=[],r=new Set,s={};for(let o of e){let a;if(o.node&&o.node.attribute?a=o.node.attribute:(a=t.getAttribute(o.name),a!==void 0&&(a.isInterleavedBufferAttribute?s[o.name]=a.data.uuid:s[o.name]=a.id)),a===void 0)continue;n.push(a);let l=a.isInterleavedBufferAttribute?a.data:a;r.add(l)}return this.attributes=n,this.attributesId=s,this.vertexBuffers=Array.from(r.values()),n}getVertexBuffers(){return this.vertexBuffers===null&&this.getAttributes(),this.vertexBuffers}getDrawParameters(){let{object:e,material:t,geometry:n,group:r,drawRange:s}=this,o=this.drawParams||(this.drawParams={vertexCount:0,firstVertex:0,instanceCount:0,firstInstance:0}),a=this.getIndex(),l=a!==null,c=1;if(n.isInstancedBufferGeometry===!0?c=n.instanceCount:e.count!==void 0&&(c=Math.max(0,e.count)),c===0)return null;if(o.instanceCount=c,e.isBatchedMesh===!0)return o;let u=1;t.wireframe===!0&&!e.isPoints&&!e.isLineSegments&&!e.isLine&&!e.isLineLoop&&(u=2);let f=s.start*u,d=(s.start+s.count)*u;r!==null&&(f=Math.max(f,r.start*u),d=Math.min(d,(r.start+r.count)*u));let A=n.attributes.position,y=1/0;l?y=a.count:A!=null&&(y=A.count),f=Math.max(f,0),d=Math.min(d,y);let w=d-f;return w<0||w===1/0?null:(o.vertexCount=w,o.firstVertex=f,o)}getGeometryCacheKey(){let{geometry:e}=this,t="";for(let n of Object.keys(e.attributes).sort()){let r=e.attributes[n];t+=n+",",r.data&&(t+=r.data.stride+","),r.offset&&(t+=r.offset+","),r.itemSize&&(t+=r.itemSize+","),r.normalized&&(t+="n,")}for(let n of Object.keys(e.morphAttributes).sort()){let r=e.morphAttributes[n];t+="morph-"+n+",";for(let s=0,o=r.length;s<o;s++){let a=r[s];t+=a.id+","}}return e.index&&(t+="index,"),t}getMaterialCacheKey(){let{object:e,material:t,renderer:n}=this,r=t.customProgramCacheKey();for(let s of X3e(t)){if(/^(is[A-Z]|_)|^(visible|version|uuid|name|opacity|userData)$/.test(s))continue;let o=t[s],a;if(o!==null){let l=typeof o;l==="number"?s==="side"?a=String(o):a=o!==0?"1":"0":l==="object"?(a="{",o.isTexture&&(a+=o.mapping,n.backend.isWebGPUBackend===!0&&(a+=o.magFilter,a+=o.minFilter,a+=o.wrapS,a+=o.wrapT,a+=o.wrapR)),a+="}"):a=String(o)}else a=String(o);r+=a+","}return r+=this.clippingContextCacheKey+",",e.geometry&&(r+=this.getGeometryCacheKey()),e.skeleton&&(r+=e.skeleton.bones.length+","),e.isBatchedMesh&&(r+=e._matricesTexture.uuid+",",e._colorsTexture!==null&&(r+=e._colorsTexture.uuid+",")),(e.isInstancedMesh||e.count>1)&&(r+=e.uuid+","),r+=this.context.id+",",r+=e.receiveShadow+",",mx(r)}get needsGeometryUpdate(){if(this.geometry.id!==this.object.geometry.id)return!0;if(this.attributes!==null){let e=this.attributesId;for(let t in e){let n=this.geometry.getAttribute(t);if(n===void 0)return!0;let r=n.isInterleavedBufferAttribute?n.data.uuid:n.id;if(e[t]!==r)return!0}}return!1}get needsUpdate(){return this.initialNodesCacheKey!==this.getDynamicCacheKey()||this.clippingNeedsUpdate}getDynamicCacheKey(){let e=0;return this.material.isShadowPassMaterial!==!0&&(e=this._nodes.getCacheKey(this.scene,this.lightsNode)),this.camera.isArrayCamera&&(e=Zw(e,this.camera.cameras.length)),this.object.receiveShadow&&(e=Zw(e,1)),e=Zw(e,this.renderer.contextNode.id,this.renderer.contextNode.version),e}getCacheKey(){return this.getMaterialCacheKey()+this.getDynamicCacheKey()}dispose(){this.material.removeEventListener("dispose",this.onMaterialDispose),this.geometry.removeEventListener("dispose",this.onGeometryDispose),this._sourceMaterial!==null&&this._sourceMaterial.removeEventListener("dispose",this.onMaterialDispose),this.onDispose()}},cf=[],M7=class{constructor(e,t,n,r,s,o){this.renderer=e,this.nodes=t,this.geometries=n,this.pipelines=r,this.bindings=s,this.info=o,this.chainMaps={}}get(e,t,n,r,s,o,a,l){let c=this.getChainMap(l);cf[0]=e,cf[1]=t,cf[2]=o,cf[3]=s;let u=c.get(cf);return u===void 0?(u=this.createRenderObject(this.nodes,this.geometries,this.renderer,e,t,n,r,s,o,a,l),c.set(cf,u)):(u.camera=r,u.updateClipping(a),u.needsGeometryUpdate&&u.setGeometry(e.geometry),(u.version!==t.version||u.needsUpdate)&&(u.initialCacheKey!==u.getCacheKey()?(u.dispose(),u=this.get(e,t,n,r,s,o,a,l)):u.version=t.version)),cf[0]=null,cf[1]=null,cf[2]=null,cf[3]=null,u}getChainMap(e="default"){return this.chainMaps[e]||(this.chainMaps[e]=new Sf)}dispose(){this.chainMaps={}}createRenderObject(e,t,n,r,s,o,a,l,c,u,f){let d=this.getChainMap(f),A=new E7(e,t,n,r,s,o,a,l,c,u);return A.onDispose=()=>{this.pipelines.delete(A),this.bindings.deleteForRender(A),this.nodes.delete(A),d.delete(A.getChainArray())},A}},Tf=class{constructor(){this.data=new WeakMap}get(e){let t=this.data.get(e);return t===void 0&&(t={},this.data.set(e,t)),t}delete(e){let t=null;return this.data.has(e)&&(t=this.data.get(e),this.data.delete(e)),t}has(e){return this.data.has(e)}dispose(){this.data=new WeakMap}},nu={VERTEX:1,INDEX:2,STORAGE:3,INDIRECT:4},am=16,$3e=211,Y3e=212,C7=class extends Tf{constructor(e,t){super(),this.backend=e,this.info=t}delete(e){let t=super.delete(e);return t!==null&&(this.backend.destroyAttribute(e),this.info.destroyAttribute(e)),t}update(e,t){let n=this.get(e);if(n.version===void 0)t===nu.VERTEX?(this.backend.createAttribute(e),this.info.createAttribute(e)):t===nu.INDEX?(this.backend.createIndexAttribute(e),this.info.createIndexAttribute(e)):t===nu.STORAGE?(this.backend.createStorageAttribute(e),this.info.createStorageAttribute(e)):t===nu.INDIRECT&&(this.backend.createIndirectStorageAttribute(e),this.info.createIndirectStorageAttribute(e)),n.version=this._getBufferAttribute(e).version;else{let r=this._getBufferAttribute(e);(n.version<r.version||r.usage===og)&&(this.backend.updateAttribute(e),n.version=r.version)}}_getBufferAttribute(e){return e.isInterleavedBufferAttribute&&(e=e.data),e}};function Yre(i){return i.index!==null?i.index.version:i.attributes.position.version}function Zre(i){return i.index!==null?i.index.id:i.attributes.position.id}function Kee(i){let e=[],t=i.index,n=i.attributes.position;if(t!==null){let s=t.array;for(let o=0,a=s.length;o<a;o+=3){let l=s[o+0],c=s[o+1],u=s[o+2];e.push(l,c,c,u,u,l)}}else{let s=n.array;for(let o=0,a=s.length/3-1;o<a;o+=3){let l=o+0,c=o+1,u=o+2;e.push(l,c,c,u,u,l)}}let r=new(n.count>=65535?OA:BA)(e,1);return r.version=Yre(i),r.__id=Zre(i),r}var R7=class extends Tf{constructor(e,t){super(),this.attributes=e,this.info=t,this.wireframes=new WeakMap,this.attributeCall=new WeakMap,this._geometryDisposeListeners=new Map}has(e){let t=e.geometry;return super.has(t)&&this.get(t).initialized===!0}updateForRender(e){this.has(e)===!1&&this.initGeometry(e),this.updateAttributes(e)}initGeometry(e){let t=e.geometry,n=this.get(t);n.initialized=!0,this.info.memory.geometries++;let r=()=>{this.info.memory.geometries--;let s=t.index,o=e.getAttributes();s!==null&&this.attributes.delete(s);for(let l of o)this.attributes.delete(l);let a=this.wireframes.get(t);a!==void 0&&this.attributes.delete(a),t.removeEventListener("dispose",r),this._geometryDisposeListeners.delete(t)};t.addEventListener("dispose",r),this._geometryDisposeListeners.set(t,r)}updateAttributes(e){let t=e.getAttributes();for(let s of t)s.isStorageBufferAttribute||s.isStorageInstancedBufferAttribute?this.updateAttribute(s,nu.STORAGE):this.updateAttribute(s,nu.VERTEX);let n=this.getIndex(e);n!==null&&this.updateAttribute(n,nu.INDEX);let r=e.geometry.indirect;r!==null&&this.updateAttribute(r,nu.INDIRECT)}updateAttribute(e,t){let n=this.info.render.calls;e.isInterleavedBufferAttribute?this.attributeCall.get(e)===void 0?(this.attributes.update(e,t),this.attributeCall.set(e,n)):this.attributeCall.get(e.data)!==n&&(this.attributes.update(e,t),this.attributeCall.set(e.data,n),this.attributeCall.set(e,n)):this.attributeCall.get(e)!==n&&(this.attributes.update(e,t),this.attributeCall.set(e,n))}getIndirect(e){return e.geometry.indirect}getIndirectOffset(e){return e.geometry.indirectOffset}getIndex(e){let{geometry:t,material:n}=e,r=t.index;if(n.wireframe===!0){let s=this.wireframes,o=s.get(t);o===void 0?(o=Kee(t),s.set(t,o)):(o.version!==Yre(t)||o.__id!==Zre(t))&&(this.attributes.delete(o),o=Kee(t),s.set(t,o)),r=o}return r}dispose(){for(let[e,t]of this._geometryDisposeListeners.entries())e.removeEventListener("dispose",t);this._geometryDisposeListeners.clear()}},I7=class{constructor(){this.autoReset=!0,this.frame=0,this.calls=0,this.render={calls:0,frameCalls:0,drawCalls:0,triangles:0,points:0,lines:0,timestamp:0},this.compute={calls:0,frameCalls:0,timestamp:0},this.memory={attributes:0,attributesSize:0,geometries:0,indexAttributes:0,indexAttributesSize:0,indirectStorageAttributes:0,indirectStorageAttributesSize:0,programs:0,programsSize:0,readbackBuffers:0,readbackBuffersSize:0,renderTargets:0,storageAttributes:0,storageAttributesSize:0,textures:0,texturesSize:0,uniformBuffers:0,uniformBuffersSize:0,total:0},this.memoryMap=new Map}update(e,t,n){this.render.drawCalls++,e.isMesh||e.isSprite?this.render.triangles+=n*(t/3):e.isPoints?this.render.points+=n*t:e.isLineSegments?this.render.lines+=n*(t/2):e.isLine?this.render.lines+=n*(t-1):ze("WebGPUInfo: Unknown object type.")}reset(){this.render.drawCalls=0,this.render.frameCalls=0,this.compute.frameCalls=0,this.render.triangles=0,this.render.points=0,this.render.lines=0}dispose(){this.reset(),this.calls=0,this.render.calls=0,this.compute.calls=0,this.render.timestamp=0,this.compute.timestamp=0;for(let e in this.memory)this.memory[e]=0;this.memoryMap.clear()}createTexture(e){let t=this._getTextureMemorySize(e);this.memoryMap.set(e,t),this.memory.textures++,this.memory.total+=t,this.memory.texturesSize+=t}destroyTexture(e){let t=this.memoryMap.get(e)||0;this.memoryMap.delete(e),this.memory.textures--,this.memory.total-=t,this.memory.texturesSize-=t}_createAttribute(e,t){let n=this._getAttributeMemorySize(e);this.memoryMap.set(e,{size:n,type:t}),this.memory[t]++,this.memory.total+=n,this.memory[t+"Size"]+=n}createAttribute(e){this._createAttribute(e,"attributes")}createIndexAttribute(e){this._createAttribute(e,"indexAttributes")}createStorageAttribute(e){this._createAttribute(e,"storageAttributes")}createIndirectStorageAttribute(e){this._createAttribute(e,"indirectStorageAttributes")}destroyAttribute(e){let t=this.memoryMap.get(e);t&&(this.memoryMap.delete(e),this.memory[t.type]--,this.memory.total-=t.size,this.memory[t.type+"Size"]-=t.size)}createReadbackBuffer(e){let t=e.maxByteLength;this.memoryMap.set(e,{size:t,type:"readbackBuffers"}),this.memory.readbackBuffers++,this.memory.total+=t,this.memory.readbackBuffersSize+=t}destroyReadbackBuffer(e){let{size:t}=this.memoryMap.get(e);this.memoryMap.delete(e),this.memory.readbackBuffers--,this.memory.total-=t,this.memory.readbackBuffersSize-=t}createUniformBuffer(e){let t=e.byteLength;this.memoryMap.set(e,{size:t,type:"uniformBuffers"}),this.memory.uniformBuffers++,this.memory.total+=t,this.memory.uniformBuffersSize+=t}destroyUniformBuffer(e){let t=this.memoryMap.get(e);t&&(this.memoryMap.delete(e),this.memory.uniformBuffers--,this.memory.total-=t.size,this.memory.uniformBuffersSize-=t.size)}createProgram(e){let t=e.code.length;this.memoryMap.set(e,t),this.memory.programs++,this.memory.total+=t,this.memory.programsSize+=t}destroyProgram(e){let t=this.memoryMap.get(e)||0;this.memoryMap.delete(e),this.memory.programs--,this.memory.total-=t,this.memory.programsSize-=t}_getTextureMemorySize(e){if(e.isCompressedTexture)return 1;let t=1;e.type===Oh||e.type===Ji?t=1:e.type===Uh||e.type===bl||e.type===Wi?t=2:(e.type===Zr||e.type===xi||e.type===cr)&&(t=4);let n=4;e.format===r_||e.format===Ld||e.format===kh||e.format===Gs||e.format===xo?n=1:e.format===js||e.format===zh?n=2:(e.format===Pd||e.format===Tb)&&(n=3);let r=t*n;e.type===KA||e.type===QA?r=2:(e.type===ca||e.type===JA||e.type===eg)&&(r=4);let s=e.width||1,o=e.height||1,a=e.isCubeTexture?6:e.depth||1,l=s*o*a*r,c=e.mipmaps;if(c&&c.length>0){let u=0;for(let f=0;f<c.length;f++){let d=c[f];if(d.data)u+=d.data.byteLength;else{let A=d.width||Math.max(1,s>>f),y=d.height||Math.max(1,o>>f);u+=A*y*a*r}}l+=u}else e.generateMipmaps&&(l=l*1.333);return Math.round(l)}_getAttributeMemorySize(e){return e.isInterleavedBufferAttribute&&(e=e.data),e.array?e.array.byteLength:e.count&&e.itemSize?e.count*e.itemSize*4:0}},y4=class{constructor(e){this.cacheKey=e,this.usedTimes=0}},P7=class extends y4{constructor(e,t,n){super(e),this.vertexProgram=t,this.fragmentProgram=n}},L7=class extends y4{constructor(e,t){super(e),this.computeProgram=t,this.isComputePipeline=!0}},Z3e=0,nS=class{constructor(e,t,n,r=null,s=null){this.id=Z3e++,this.code=e,this.stage=t,this.name=n,this.transforms=r,this.attributes=s,this.usedTimes=0}},D7=class extends Tf{constructor(e,t,n){super(),this.backend=e,this.nodes=t,this.info=n,this.bindings=null,this.caches=new Map,this.programs={vertex:new Map,fragment:new Map,compute:new Map}}getForCompute(e,t){let{backend:n}=this,r=this.get(e);if(this._needsComputeUpdate(e)){let s=r.pipeline;s&&(s.usedTimes--,s.computeProgram.usedTimes--);let o=this.nodes.getForCompute(e),a=this.programs.compute.get(o.computeShader);a===void 0&&(s&&s.computeProgram.usedTimes===0&&this._releaseProgram(s.computeProgram),a=new nS(o.computeShader,"compute",e.name,o.transforms,o.nodeAttributes),this.programs.compute.set(o.computeShader,a),n.createProgram(a),this.info.createProgram(a));let l=this._getComputeCacheKey(e,a),c=this.caches.get(l);c===void 0&&(s&&s.usedTimes===0&&this._releasePipeline(s),c=this._getComputePipeline(e,a,l,t)),c.usedTimes++,a.usedTimes++,r.version=e.version,r.pipeline=c}return r.pipeline}getForRender(e,t=null){let{backend:n}=this,r=this.get(e);if(this._needsRenderUpdate(e)){let s=r.pipeline;s&&(s.usedTimes--,s.vertexProgram.usedTimes--,s.fragmentProgram.usedTimes--);let o=e.getNodeBuilderState(),a=e.material?e.material.name:"",l=this.programs.vertex.get(o.vertexShader);l===void 0&&(s&&s.vertexProgram.usedTimes===0&&this._releaseProgram(s.vertexProgram),l=new nS(o.vertexShader,"vertex",a),this.programs.vertex.set(o.vertexShader,l),n.createProgram(l),this.info.createProgram(l));let c=this.programs.fragment.get(o.fragmentShader);c===void 0&&(s&&s.fragmentProgram.usedTimes===0&&this._releaseProgram(s.fragmentProgram),c=new nS(o.fragmentShader,"fragment",a),this.programs.fragment.set(o.fragmentShader,c),n.createProgram(c),this.info.createProgram(c));let u=this._getRenderCacheKey(e,l,c),f=this.caches.get(u);f===void 0?(s&&s.usedTimes===0&&this._releasePipeline(s),f=this._getRenderPipeline(e,l,c,u,t)):e.pipeline=f,f.usedTimes++,l.usedTimes++,c.usedTimes++,r.pipeline=f}return r.pipeline}isReady(e){let n=this.get(e).pipeline;if(n===void 0)return!1;let r=this.backend.get(n);return r.pipeline!==void 0&&r.pipeline!==null}delete(e){let t=this.get(e).pipeline;return t&&(t.usedTimes--,t.usedTimes===0&&this._releasePipeline(t),t.isComputePipeline?(t.computeProgram.usedTimes--,t.computeProgram.usedTimes===0&&this._releaseProgram(t.computeProgram)):(t.fragmentProgram.usedTimes--,t.vertexProgram.usedTimes--,t.vertexProgram.usedTimes===0&&this._releaseProgram(t.vertexProgram),t.fragmentProgram.usedTimes===0&&this._releaseProgram(t.fragmentProgram))),super.delete(e)}dispose(){super.dispose(),this.caches=new Map,this.programs={vertex:new Map,fragment:new Map,compute:new Map}}updateForRender(e){this.getForRender(e)}_getComputePipeline(e,t,n,r){n=n||this._getComputeCacheKey(e,t);let s=this.caches.get(n);return s===void 0&&(s=new L7(n,t),this.caches.set(n,s),this.backend.createComputePipeline(s,r)),s}_getRenderPipeline(e,t,n,r,s){r=r||this._getRenderCacheKey(e,t,n);let o=this.caches.get(r);return o===void 0&&(o=new P7(r,t,n),this.caches.set(r,o),e.pipeline=o,this.backend.createRenderPipeline(e,s)),o}_getComputeCacheKey(e,t){return e.id+","+t.id}_getRenderCacheKey(e,t,n){return t.id+","+n.id+","+this.backend.getRenderCacheKey(e)}_releasePipeline(e){this.caches.delete(e.cacheKey)}_releaseProgram(e){let t=e.code,n=e.stage;this.programs[n].delete(t),this.info.destroyProgram(e)}_needsComputeUpdate(e){let t=this.get(e);return t.pipeline===void 0||t.version!==e.version}_needsRenderUpdate(e){return this.get(e).pipeline===void 0||this.backend.needsRenderUpdate(e)}},N7=class extends Tf{constructor(e,t,n,r,s,o){super(),this.backend=e,this.textures=n,this.pipelines=s,this.attributes=r,this.nodes=t,this.info=o,this.pipelines.bindings=this}getForRender(e){let t=e.getBindings(),n=this.get(e);return n.initialized!==!0&&(this._createBindings(t),n.initialized=!0),t}getForCompute(e){let t=this.nodes.getForCompute(e).bindings,n=this.get(e);return(n.initialized!==!0||n.bindings!==t)&&(n.bindings!==void 0&&this._destroyBindings(n.bindings),this._createBindings(t),n.initialized=!0,n.bindings=t),t}updateForCompute(e){this._updateBindings(this.getForCompute(e))}updateForRender(e){this._updateBindings(this.getForRender(e))}deleteForCompute(e){let n=this.get(e).bindings||this.nodes.getForCompute(e).bindings;this._destroyBindings(n),this.delete(e)}deleteForRender(e){let t=e.getBindings();this._destroyBindings(t),this.delete(e)}_createBindings(e){for(let t of e){let n=this.get(t);if(n.bindGroup===void 0){for(let r of t.bindings)if(r.isUniformBuffer)this.backend.createUniformBuffer(r),this.info.createUniformBuffer(r);else if(r.isSampledTexture)this.textures.updateTexture(r.texture);else if(r.isSampler)this.textures.updateSampler(r);else if(r.isStorageBuffer){let s=r.attribute,o=s.isIndirectStorageBufferAttribute?nu.INDIRECT:nu.STORAGE;this.attributes.update(s,o)}this.backend.createBindings(t,e,0),n.bindGroup=t,n.usedTimes=1}else n.usedTimes++}}_destroyBindings(e){for(let t of e){let n=this.get(t);if(n.usedTimes--,n.usedTimes===0){for(let r of t.bindings)r.isUniformBuffer?(this.backend.destroyUniformBuffer(r),this.info.destroyUniformBuffer(r),r.release()):r.isSampler&&(r.isSampledTexture!==!0&&this.backend.destroySampler(r),r.release());this.backend.deleteBindGroupData(t),this.delete(t)}}}_updateBindings(e){for(let t of e)this._update(t,e)}_update(e,t){let{backend:n}=this,r=!1,s=!0,o=0,a=0;for(let l of e.bindings)if(this.nodes.updateGroup(l)!==!1){if(l.isStorageBuffer){let u=l.attribute,f=u.isIndirectStorageBufferAttribute?nu.INDIRECT:nu.STORAGE,d=n.get(l);this.attributes.update(u,f),d.attribute!==u&&(d.attribute=u,r=!0)}if(l.isUniformBuffer)l.update()&&n.updateBinding(l);else if(l.isSampledTexture){let u=l.update(),f=l.texture,d=this.textures.get(f);if(u&&(this.textures.updateTexture(f),l.generation!==d.generation&&(l.generation=d.generation,r=!0),d.bindGroups.add(e)),n.get(f).externalTexture!==void 0||d.isDefaultTexture?s=!1:(o=o*10+f.id,a+=f.version),f.isStorageTexture===!0&&f.mipmapsAutoUpdate===!0){let y=this.get(f);l.store===!0?y.needsMipmap=!0:this.textures.needsMipmaps(f)&&y.needsMipmap===!0&&(this.backend.generateMipmaps(f),y.needsMipmap=!1)}}else if(l.isSampler&&l.update()){let f=this.textures.updateSampler(l);l.samplerKey!==f&&(l.samplerKey=f,r=!0)}l.isBuffer&&l.updateRanges.length>0&&l.clearUpdateRanges()}r===!0&&this.backend.updateBindings(e,t,s?o:0,a)}},K3e=Object.freeze([]);function Q3e(i,e){return i.groupOrder!==e.groupOrder?i.groupOrder-e.groupOrder:i.renderOrder!==e.renderOrder?i.renderOrder-e.renderOrder:i.z!==e.z?i.z-e.z:i.id-e.id}function Qee(i,e){return i.groupOrder!==e.groupOrder?i.groupOrder-e.groupOrder:i.renderOrder!==e.renderOrder?i.renderOrder-e.renderOrder:i.z!==e.z?e.z-i.z:i.id-e.id}function Jee(i){return(i.transmission>0||i.transmissionNode&&i.transmissionNode.isNode)&&i.side===gr&&i.forceSinglePass===!1}var F7=class{constructor(e,t,n){this.renderItems=[],this.renderItemsIndex=0,this.opaque=[],this.transparentDoublePass=[],this.transparent=[],this.bundles=[],this.lighting=e,this.lightsNode=e.getNode(t),this.lightsArray=[],this.scene=t,this.camera=n,this.occlusionQueryCount=0,this._lastOcclusionObject=null}begin(){return this.renderItemsIndex=0,this.opaque.length=0,this.transparentDoublePass.length=0,this.transparent.length=0,this.bundles.length=0,this.lightsArray.length=0,this.occlusionQueryCount=0,this}getNextRenderItem(e,t,n,r,s,o,a){let l=this.renderItems[this.renderItemsIndex];return l===void 0?(l={id:e.id,object:e,geometry:t,material:n,groupOrder:r,renderOrder:e.renderOrder,z:s,group:o,clippingContext:a},this.renderItems[this.renderItemsIndex]=l):(l.id=e.id,l.object=e,l.geometry=t,l.material=n,l.groupOrder=r,l.renderOrder=e.renderOrder,l.z=s,l.group=o,l.clippingContext=a),this.renderItemsIndex++,l}push(e,t,n,r,s,o,a){let l=this.getNextRenderItem(e,t,n,r,s,o,a);e.occlusionTest===!0&&this._lastOcclusionObject!==e&&(this.occlusionQueryCount++,this._lastOcclusionObject=e),n.transparent===!0||n.transmission>0||n.transmissionNode&&n.transmissionNode.isNode||n.backdropNode&&n.backdropNode.isNode?(Jee(n)&&this.transparentDoublePass.push(l),this.transparent.push(l)):this.opaque.push(l)}unshift(e,t,n,r,s,o,a){let l=this.getNextRenderItem(e,t,n,r,s,o,a);n.transparent===!0||n.transmission>0||n.transmissionNode&&n.transmissionNode.isNode||n.backdropNode&&n.backdropNode.isNode?(Jee(n)&&this.transparentDoublePass.unshift(l),this.transparent.unshift(l)):this.opaque.unshift(l)}pushBundle(e){this.bundles.push(e)}pushLight(e){this.lightsArray.push(e)}sort(e,t,n){this.opaque.length>1&&this.opaque.sort(e||Q3e),this.transparentDoublePass.length>1&&this.transparentDoublePass.sort(t||Qee),this.transparent.length>1&&this.transparent.sort(t||Qee),n&&(this.opaque.reverse(),this.transparentDoublePass.reverse(),this.transparent.reverse())}finish(){this.lightsNode.setLights(this.lighting.enabled?this.lightsArray:K3e);for(let e=this.renderItemsIndex,t=this.renderItems.length;e<t;e++){let n=this.renderItems[e];if(n.id===null)break;n.id=null,n.object=null,n.geometry=null,n.material=null,n.groupOrder=null,n.renderOrder=null,n.z=null,n.group=null,n.clippingContext=null}this._lastOcclusionObject=null}},F_=[],B7=class{constructor(e){this.lighting=e,this.lists=new Sf}get(e,t){let n=this.lists;F_[0]=e,F_[1]=t;let r=n.get(F_);return r===void 0&&(r=new F7(this.lighting,e,t),n.set(F_,r)),F_[0]=null,F_[1]=null,r}dispose(){this.lists=new Sf}},J3e=0,O7=class{constructor(){this.id=J3e++,this.mrt=null,this.color=!0,this.clearColor=!0,this.clearColorValue={r:0,g:0,b:0,a:1},this.depth=!0,this.clearDepth=!0,this.clearDepthValue=1,this.stencil=!1,this.clearStencil=!0,this.clearStencilValue=1,this.viewport=!1,this.viewportValue=new xn,this.scissor=!1,this.scissorValue=new xn,this.renderTarget=null,this.textures=null,this.depthTexture=null,this.activeCubeFace=0,this.activeMipmapLevel=0,this.sampleCount=1,this.width=0,this.height=0,this.occlusionQueryCount=0,this.clippingContext=null,this.camera=null,this.isRenderContext=!0}getCacheKey(){return Kre(this)}};function Kre(i){let{textures:e,activeCubeFace:t,activeMipmapLevel:n}=i,r=[t,n];for(let s of e)r.push(s.id);return ES(r)}var U7=class{constructor(e){this.renderer=e,this._renderContexts={}}get(e=null,t=null,n=0){let r;if(e===null)r="default";else{let l=e.texture.format,c=e.texture.type;r=`${e.textures.length}:${l}:${c}:${e.samples}:${e.depthBuffer}:${e.stencilBuffer}`}let s=t!==null?t.id:"default",o=r+"-"+s+"-"+n,a=this._renderContexts[o];return a===void 0&&(a=new O7,a.mrt=t,this._renderContexts[o]=a),e!==null&&(a.sampleCount=e.samples===0?1:e.samples),a.clearDepthValue=this.renderer.getClearDepth(),a.clearStencilValue=this.renderer.getClearStencil(),a}dispose(){this._renderContexts={}}},eMe=new re,k7=class extends Tf{constructor(e,t,n){super(),this.renderer=e,this.backend=t,this.info=n,this._htmlTextures=new Set}updateRenderTarget(e,t=0){let n=this.get(e),r=e.samples===0?1:e.samples,s=n.depthTextureMips||(n.depthTextureMips={}),o=e.textures,a=this.getSize(o[0]),l=a.width>>t,c=a.height>>t,u=e.depthTexture||s[t],f=e.depthBuffer===!0||e.stencilBuffer===!0,d=!1,A=u!==void 0&&u.image!==void 0&&u.image.depth>1,y=a.depth>1&&(e.useArrayDepthTexture||e.multiview||A);u===void 0&&f&&(u=new Cs,u.format=e.stencilBuffer?xo:Gs,u.type=e.stencilBuffer?ca:xi,u.image.width=l,u.image.height=c,u.image.depth=a.depth,u.renderTarget=e,s[t]=u),u&&(u.isArrayTexture=y),(n.width!==a.width||a.height!==n.height)&&(d=!0,u&&(u.needsUpdate=!0,u.image.width=l,u.image.height=c,u.image.depth=y?a.depth:1)),n.width=a.width,n.height=a.height,n.textures=o,n.depthTexture=u||null,n.depth=e.depthBuffer,n.stencil=e.stencilBuffer,n.renderTarget=e,n.sampleCount!==r&&(d=!0,u&&(u.needsUpdate=!0),n.sampleCount=r);let w={sampleCount:r};if(e.isXRRenderTarget!==!0){for(let S=0;S<o.length;S++){let T=o[S];d&&(T.needsUpdate=!0),this.updateTexture(T,w)}u&&this.updateTexture(u,w)}n.initialized!==!0&&(n.initialized=!0,this.info.memory.renderTargets++,n.onDispose=()=>{this._destroyRenderTarget(e)},e.addEventListener("dispose",n.onDispose))}updateTexture(e,t={}){let n=this.get(e);if(n.initialized===!0&&n.version===e.version)return;let r=e.isRenderTargetTexture||e.isDepthTexture||e.isFramebufferTexture,s=this.backend;if(r&&n.initialized===!0&&s.destroyTexture(e),e.isFramebufferTexture){let c=this.renderer.getRenderTarget();c?e.type=c.texture.type:e.type=Ji}if(e.isHTMLTexture&&e.image){let c=this.renderer.domElement;if("requestPaint"in c){if(c.hasAttribute("layoutsubtree")||c.setAttribute("layoutsubtree","true"),e.image.parentNode!==c&&c.appendChild(e.image),this._htmlTextures.size===0){let u=this._htmlTextures;c.onpaint=f=>{let d=f&&f.changedElements;for(let A of u)(!d||d.includes(A.image))&&(A.needsUpdate=!0)}}this._htmlTextures.add(e)}}let{width:o,height:a,depth:l}=this.getSize(e);if(t.width=o,t.height=a,t.depth=l,t.needsMipmaps=this.needsMipmaps(e),t.levels=t.needsMipmaps?this.getMipLevels(e,o,a):1,e.isCubeTexture&&e.mipmaps.length>0&&t.levels++,r||e.isStorageTexture===!0||e.isExternalTexture===!0)s.createTexture(e,t),n.generation=e.version;else if(e.version>0){let c=e.image;if(c===void 0)Xe("Renderer: Texture marked for update but image is undefined.");else if(c.complete===!1)Xe("Renderer: Texture marked for update but image is incomplete.");else{if(e.images){let f=[];for(let d of e.images)f.push(d);t.images=f}else t.image=c;(n.isDefaultTexture===void 0||n.isDefaultTexture===!0)&&(s.createTexture(e,t),n.isDefaultTexture=!1,n.generation=e.version),e.source.dataReady===!0&&s.updateTexture(e,t);let u=e.isStorageTexture===!0&&e.mipmapsAutoUpdate===!1;t.needsMipmaps&&e.mipmaps.length===0&&!u&&s.generateMipmaps(e),e.onUpdate&&e.onUpdate(e)}}else s.createDefaultTexture(e),n.isDefaultTexture=!0,n.generation=e.version;n.initialized!==!0&&(n.initialized=!0,n.generation=e.version,n.bindGroups=new Set,this.info.createTexture(e),e.isVideoTexture&&ln.enabled===!0&&ln.getTransfer(e.colorSpace)!==kt&&Xe("WebGPURenderer: Video textures must use a color space with a sRGB transfer function, e.g. SRGBColorSpace."),n.onDispose=()=>{this._destroyTexture(e)},e.addEventListener("dispose",n.onDispose)),n.version=e.version}updateSampler(e){return this.backend.updateSampler(e)}getSize(e,t=eMe){let n=e.images?e.images[0]:e.image;return n?(n.image!==void 0&&(n=n.image),e.isHTMLTexture?(t.width=n.offsetWidth||1,t.height=n.offsetHeight||1,t.depth=1):typeof HTMLVideoElement<"u"&&n instanceof HTMLVideoElement?(t.width=n.videoWidth||1,t.height=n.videoHeight||1,t.depth=1):typeof VideoFrame<"u"&&n instanceof VideoFrame?(t.width=n.displayWidth||1,t.height=n.displayHeight||1,t.depth=1):(t.width=n.width||1,t.height=n.height||1,t.depth=e.isCubeTexture?6:n.depth||1)):t.width=t.height=t.depth=1,t}getMipLevels(e,t,n){let r;return e.mipmaps.length>0?r=e.mipmaps.length:e.isCompressedTexture===!0?r=1:r=Math.floor(Math.log2(Math.max(t,n)))+1,r}needsMipmaps(e){return e.generateMipmaps===!0||e.mipmaps.length>0}_destroyRenderTarget(e){if(this.has(e)===!0){let t=this.get(e),n=t.textures,r=t.depthTexture;e.removeEventListener("dispose",t.onDispose);for(let s=0;s<n.length;s++)this._destroyTexture(n[s]);r&&this._destroyTexture(r),this.delete(e),this.backend.delete(e),this.info.memory.renderTargets--}}_destroyTexture(e){if(this.has(e)===!0){let t=this.get(e);e.removeEventListener("dispose",t.onDispose);let n=t.isDefaultTexture;if(this.backend.destroyTexture(e,n),t.bindGroups)for(let r of t.bindGroups){let s=this.backend.get(r);s.groups=void 0,s.versions=void 0;for(let o of r.bindings)o.isSampler&&o.texture===e&&(o.isSampledTexture!==!0&&this.backend.destroySampler(o),o.reset(),o.release())}this._htmlTextures.delete(e),this.delete(e),this.info.destroyTexture(e)}}},pS=class extends zt{constructor(e,t,n,r=1){super(e,t,n),this.a=r}set(e,t,n,r=1){return this.a=r,super.set(e,t,n)}copy(e){return e.a!==void 0&&(this.a=e.a),super.copy(e)}clone(){return new this.constructor(this.r,this.g,this.b,this.a)}},b4=class extends lS{static get type(){return"OverrideContextNode"}constructor(e,t=null){super(t,{overrideNodes:e}),this.isOverrideContextNode=!0}getFlowContextData(){let e=[];this.traverse(r=>{r.isOverrideContextNode===!0&&e.push(r.value.overrideNodes)});let t=new Map(e.flatMap(r=>Array.from(r.entries()))),n=super.getFlowContextData();return n.overrideNodes=t,n}};function Qre(i,e=null,t=null){if(e&&e.isNode){let n=e;e=()=>n}return new b4(new Map([[i,e]]),t)}Ue("overrideNode",(i,e,t)=>Qre(e,t,i));function Jre(i,e=null){let t=new Map;for(let[n,r]of i){let s=r!==null?typeof r=="function"?r:()=>r:null;t.set(n,s)}return new b4(t,e)}Ue("overrideNodes",(i,e)=>Jre(e,i));var w4=class extends gi{static get type(){return"ParameterNode"}constructor(e,t=null){super(e,t),this.isParameterNode=!0}getMemberType(e,t){let n=this.getNodeType(e),r=e.getStructTypeNode(n),s;return r!==null?s=r.getMemberType(e,t):(ze(`TSL: Member "${t}" not found in struct "${n}".`,new es),s="float"),s}getHash(){return String(this.id)}generate(){return this.name}},tMe=(i,e)=>new w4(i,e),z7=class extends Kt{static get type(){return"StackNode"}constructor(e=null){super(),this.nodes=[],this.outputNode=null,this.parent=e,this._currentCond=null,this._expressionNode=null,this._currentNode=null,this._nodeDataLibrary=new Map,this.isStackNode=!0}getElementType(e){return this.outputNode?this.outputNode.getElementType(e):"void"}generateNodeType(e){return this.outputNode?this.outputNode.getNodeType(e):"void"}getMemberType(e,t){return this.outputNode?this.outputNode.getMemberType(e,t):"void"}addToStack(e,t=-1){if(e.isNode!==!0)return ze("TSL: Invalid node added to stack.",new es),this;if(t===-1)if(this._currentNode){let n=this._nodeDataLibrary.get(this._currentNode);n===void 0&&(n={delta:0},this._nodeDataLibrary.set(this._currentNode,n)),n.delta++,t=this.nodes.indexOf(this._currentNode)+n.delta}else t=this.nodes.length;return this.nodes.splice(t,0,e),this}addToStackBefore(e){let t=this._currentNode?this.nodes.indexOf(this._currentNode):0;return this.addToStack(e,t)}If(e,t){let n=new K_(t);return this._currentCond=_a(e,n),this.addToStack(this._currentCond)}ElseIf(e,t){let n=new K_(t),r=_a(e,n);return this._currentCond.elseNode=r,this._currentCond=r,this}Else(e){return this._currentCond.elseNode=new K_(e),this}Switch(e){return this._expressionNode=Ht(e),this}Case(...e){let t=[];if(e.length>=2)for(let a=0;a<e.length-1;a++)t.push(this._expressionNode.equal(Ht(e[a])));else ze("TSL: Invalid parameter length. Case() requires at least two parameters.",new es);let n=e[e.length-1],r=new K_(n),s=t[0];for(let a=1;a<t.length;a++)s=s.or(t[a]);let o=_a(s,r);return this._currentCond===null?(this._currentCond=o,this.addToStack(this._currentCond)):(this._currentCond.elseNode=o,this._currentCond=o,this)}Default(e){return this.Else(e),this}setup(e){let t=e.getNodeProperties(this),n=0;for(let r of this.getChildren())r.isVarNode&&r.isIntent(e)&&r.isAssign(e)!==!0||(t["node"+n++]=r);return t.outputNode||null}build(e,...t){let n=X9(),r=e.buildStage;oS(this),e.setActiveStack(this);for(let o=0;o<this.nodes.length;o++){let a=this.nodes[o],l=this._currentNode;if(this._currentNode=a,!(a.isVarNode&&a.isIntent(e)&&a.isAssign(e)!==!0)){if(r==="setup")a.build(e);else if(r==="analyze")a.build(e,this);else if(r==="generate"){let c=e.getDataFromNode(a,"any").stages,u=c&&c[e.shaderStage];if(a.isVarNode&&u&&u.length===1&&u[0]&&u[0].isStackNode)continue;a.build(e,"void")}this._currentNode=l}}let s;if(this.outputNode){let o=this.outputNode.build(e,...t);(e.buildStage!=="generate"||this.outputNode.getNodeType(e)!=="void")&&(s=o)}else s=super.build(e,...t);return oS(n),e.removeActiveStack(this),s}},jR=$n(z7).setParameterLength(0,1);function nMe(i){return Object.entries(i).map(([e,t])=>typeof t=="string"?{name:e,type:t,atomic:!1}:{name:e,type:t.type,atomic:t.atomic||!1})}var V7=class extends Kt{static get type(){return"StructTypeNode"}constructor(e,t=null){super("struct"),this.membersLayout=nMe(e),this.name=t,this.isStructTypeNode=!0}getLength(){let e=1,t=0;for(let n of this.membersLayout){let r=n.type,s=YSe(r),o=ZSe(r);e=Math.max(e,o);let l=t%e%o;l!==0&&(t+=o-l),t+=s}return Math.ceil(t/e)*e}getMemberType(e,t){let n=this.membersLayout.find(r=>r.name===t);return n?n.type:"void"}generateNodeType(e){return e.getStructTypeFromNode(this,this.membersLayout,this.name).name}setup(e){e.getStructTypeFromNode(this,this.membersLayout,this.name),e.addInclude(this)}generate(e){return this.getNodeType(e)}},G7=class extends Kt{static get type(){return"StructNode"}constructor(e,t){super("vec3"),this.structTypeNode=e,this.values=t,this.isStructNode=!0}generateNodeType(e){return this.structTypeNode.getNodeType(e)}getMemberType(e,t){return this.structTypeNode.getMemberType(e,t)}_getChildren(){let e=super._getChildren(),t=e.find(n=>n.childNode===this.structTypeNode);return e.splice(e.indexOf(t),1),e.push(t),e}generate(e){let t=e.getVarFromNode(this),n=t.type,r=e.getPropertyName(t);return e.addLineFlowCode(`${r} = ${e.generateStruct(n,this.structTypeNode.membersLayout,this.values)}`,this),t.name}},iMe=(i,e=null)=>{let t=new V7(i,e);return j9((...r)=>{let s=null;if(r.length>0)if(r[0].isNode){s={};let o=Object.keys(i);for(let a=0;a<r.length;a++)s[o[a]]=r[a]}else s=r[0];return new G7(t,s)},t)},S4=class extends Kt{static get type(){return"OutputStructNode"}constructor(...e){super(),this.members=e,this.isOutputStructNode=!0}generateNodeType(){return"OutputType"}generate(e){let t=e.getDataFromNode(this);if(t.membersLayout===void 0){let o=this.members,a=[];for(let l=0;l<o.length;l++){let c="m"+l,u=o[l].getNodeType(e);a.push({name:c,type:u,index:l})}t.membersLayout=a,t.structType=e.getOutputStructTypeFromNode(this,t.membersLayout)}let n=e.getOutputStructName(),r=this.members,s=n!==""?n+".":"";for(let o=0;o<r.length;o++){let a=r[o].build(e,t.membersLayout[o].type);e.addLineFlowCode(`${s}m${o} = ${a}`,this)}return n}},rMe=$n(S4),T4=class{constructor(e=Ms){this.blending=e,this.blendSrc=Yp,this.blendDst=Zp,this.blendEquation=oo,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.premultiplyAlpha=!1}copy(e){return this.blending=e.blending,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.premultiplyAlpha=e.premultiplyAlpha,this}clone(){return new this.constructor().copy(this)}},sMe=new T4(ps),oMe=new T4(ob);function ese(i,e){for(let t=0;t<i.length;t++)if(i[t].name===e)return t;return-1}var q7=class extends S4{static get type(){return"MRTNode"}constructor(e){super(),this.outputNodes=e,this.blendModes={output:oMe},this.isMRTNode=!0}setBlendMode(e,t){return this.blendModes[e]=t,this}getBlendMode(e){return this.blendModes[e]||sMe}has(e){return this.outputNodes[e]!==void 0}get(e){return this.outputNodes[e]}merge(e){let t={...this.outputNodes,...e.outputNodes},n={...this.blendModes,...e.blendModes},r=tse(t);return r.blendings=n,r}setup(e){let t=this.outputNodes,n=e.renderer.getRenderTarget(),r=[],s=n.textures;for(let o in t){let a=ese(s,o);if(a===-1)continue;let l=e.getOutputType(a);r[a]=t[o].convert(l)}return this.members=r,super.setup(e)}},tse=$n(q7),Jg=class extends Cr{static get type(){return"BitcastNode"}constructor(e,t,n=null){super(),this.valueNode=e,this.conversionType=t,this.inputType=n,this.isBitcastNode=!0}generateNodeType(e){if(this.inputType!==null){let t=this.valueNode.getNodeType(e),n=e.getTypeLength(t);return e.getTypeFromLength(n,this.conversionType)}return this.conversionType}generate(e){let t=this.getNodeType(e),n="";if(this.inputType!==null){let r=this.valueNode.getNodeType(e);n=e.getTypeLength(r)===1?this.inputType:e.changeComponentType(r,this.inputType)}else n=this.valueNode.getNodeType(e);return`${e.getBitcastMethod(t,n)}( ${this.valueNode.build(e,n)} )`}},nse=ct(Jg).setParameterLength(2),aMe=i=>new Jg(i,"int","float"),ise=i=>new Jg(i,"uint","float"),lMe=i=>new Jg(i,"float","int"),cMe=i=>new Jg(i,"float","uint"),gR={},Ku=class i extends Ie{static get type(){return"BitcountNode"}constructor(e,t){super(e,t),this.isBitcountNode=!0}_resolveElementType(e,t,n){n==="int"?t.assign(nse(e,"uint")):t.assign(e)}_returnDataNode(e){switch(e){case"uint":return rt;case"int":return de;case"uvec2":return $9;case"uvec3":return i1;case"uvec4":return Q9;case"ivec2":return kr;case"ivec3":return Y9;case"ivec4":return K9}}_createTrailingZerosBaseLayout(e,t){let n=this._returnDataNode(t);return me(([s])=>{let o=rt(0);this._resolveElementType(s,o,t);let a=oe(o.bitAnd(cz(o))),c=ise(a).shiftRight(23).sub(127);return n(c)}).setLayout({name:e,type:t,inputs:[{name:"value",type:t}]})}_createLeadingZerosBaseLayout(e,t){let n=this._returnDataNode(t);return me(([s])=>{$t(s.equal(rt(0)),()=>rt(32));let o=rt(0),a=rt(0);return this._resolveElementType(s,o,t),$t(o.shiftRight(16).equal(0),()=>{a.addAssign(16),o.shiftLeftAssign(16)}),$t(o.shiftRight(24).equal(0),()=>{a.addAssign(8),o.shiftLeftAssign(8)}),$t(o.shiftRight(28).equal(0),()=>{a.addAssign(4),o.shiftLeftAssign(4)}),$t(o.shiftRight(30).equal(0),()=>{a.addAssign(2),o.shiftLeftAssign(2)}),$t(o.shiftRight(31).equal(0),()=>{a.addAssign(1)}),n(a)}).setLayout({name:e,type:t,inputs:[{name:"value",type:t}]})}_createOneBitsBaseLayout(e,t){let n=this._returnDataNode(t);return me(([s])=>{let o=rt(0);this._resolveElementType(s,o,t),o.assign(o.sub(o.shiftRight(rt(1)).bitAnd(rt(1431655765)))),o.assign(o.bitAnd(rt(858993459)).add(o.shiftRight(rt(2)).bitAnd(rt(858993459))));let a=o.add(o.shiftRight(rt(4))).bitAnd(rt(252645135)).mul(rt(16843009)).shiftRight(rt(24));return n(a)}).setLayout({name:e,type:t,inputs:[{name:"value",type:t}]})}_createMainLayout(e,t,n,r){let s=this._returnDataNode(t);return me(([a])=>{if(n===1)return s(r(a));{let l=s(0),c=["x","y","z","w"];for(let u=0;u<n;u++){let f=c[u];l[f].assign(r(a[f]))}return l}}).setLayout({name:e,type:t,inputs:[{name:"value",type:t}]})}setup(e){let{method:t,aNode:n}=this,{renderer:r}=e;if(r.backend.isWebGPUBackend)return super.setup(e);let s=this.getInputType(e),o=e.getElementType(s),a=e.getTypeLength(s),l=`${t}_base_${o}`,c=`${t}_${s}`,u=gR[l];if(u===void 0){switch(t){case i.COUNT_LEADING_ZEROS:{u=this._createLeadingZerosBaseLayout(l,o);break}case i.COUNT_TRAILING_ZEROS:{u=this._createTrailingZerosBaseLayout(l,o);break}case i.COUNT_ONE_BITS:{u=this._createOneBitsBaseLayout(l,o);break}}gR[l]=u}let f=gR[c];return f===void 0&&(f=this._createMainLayout(c,s,a,u),gR[c]=f),me(()=>f(n))()}};Ku.COUNT_TRAILING_ZEROS="countTrailingZeros";Ku.COUNT_LEADING_ZEROS="countLeadingZeros";Ku.COUNT_ONE_BITS="countOneBits";var uMe=ct(Ku,Ku.COUNT_TRAILING_ZEROS).setParameterLength(1),hMe=ct(Ku,Ku.COUNT_LEADING_ZEROS).setParameterLength(1),fMe=ct(Ku,Ku.COUNT_ONE_BITS).setParameterLength(1),dMe=me(([i])=>{let e=i.toUint().mul(747796405).add(2891336453),t=e.shiftRight(e.shiftRight(28).add(4)).bitXor(e).mul(277803737);return t.shiftRight(22).bitXor(t).toFloat().mul(1/2**32)}),H7=(i,e)=>eu(Tn(4,i.mul(ai(1,i))),e),pMe=(i,e)=>i.lessThan(.5)?H7(i.mul(2),e).div(2):ai(1,H7(Tn(ai(1,i),2),e).div(2)),mMe=(i,e,t)=>eu(hc(eu(i,e),Ls(eu(i,e),eu(ai(1,i),t))),1/e),AMe=(i,e)=>Za(r4.mul(e.mul(i).sub(1))).div(r4.mul(e.mul(i).sub(1))),mS=class extends Cr{static get type(){return"PackFloatNode"}constructor(e,t){super(),this.vectorNode=t,this.encoding=e,this.isPackFloatNode=!0}generateNodeType(){return"uint"}generate(e){let t=this.vectorNode.getNodeType(e);return`${e.getFloatPackingMethod(this.encoding)}(${this.vectorNode.build(e,t)})`}},gMe=ct(mS,"snorm").setParameterLength(1),vMe=ct(mS,"unorm").setParameterLength(1),_Me=ct(mS,"float16").setParameterLength(1),AS=class extends Cr{static get type(){return"UnpackFloatNode"}constructor(e,t){super(),this.uintNode=t,this.encoding=e,this.isUnpackFloatNode=!0}generateNodeType(){return"vec2"}generate(e){let t=this.uintNode.getNodeType(e);return`${e.getFloatUnpackingMethod(this.encoding)}(${this.uintNode.build(e,t)})`}},xMe=ct(AS,"snorm").setParameterLength(1),yMe=ct(AS,"unorm").setParameterLength(1),bMe=ct(AS,"float16").setParameterLength(1),qd=me(([i])=>i.fract().sub(.5).abs()).setLayout({name:"tri",type:"float",inputs:[{name:"x",type:"float"}]}),wMe=me(([i])=>pe(qd(i.z.add(qd(i.y.mul(1)))),qd(i.z.add(qd(i.x.mul(1)))),qd(i.y.add(qd(i.x.mul(1)))))).setLayout({name:"tri3",type:"vec3",inputs:[{name:"p",type:"vec3"}]}),SMe=me(([i,e,t])=>{let n=pe(i).toVar(),r=oe(1.4).toVar(),s=oe(0).toVar(),o=pe(n).toVar();return Oi({start:oe(0),end:oe(3),type:"float",condition:"<="},()=>{let a=pe(wMe(o.mul(2))).toVar();n.addAssign(a.add(t.mul(oe(.1).mul(e)))),o.mulAssign(1.8),r.mulAssign(1.5),n.mulAssign(1.2);let l=oe(qd(n.z.add(qd(n.x.add(qd(n.y)))))).toVar();s.addAssign(l.div(r)),o.addAssign(.14)}),s}).setLayout({name:"triNoise3D",type:"float",inputs:[{name:"position",type:"vec3"},{name:"speed",type:"float"},{name:"time",type:"float"}]}),W7=class extends Kt{static get type(){return"FunctionOverloadingNode"}constructor(e=[],...t){super(),this.functionNodes=e,this.parametersNodes=t,this._candidateFn=null,this.global=!0}generateNodeType(e){return this.getCandidateFn(e).shaderNode.layout.type}getCandidateFn(e){let t=this.parametersNodes,n=this._candidateFn;if(n===null){let r=null,s=-1;for(let o of this.functionNodes){let l=o.shaderNode.layout;if(l===null)throw new Error("THREE.FunctionOverloadingNode: FunctionNode must be a layout.");let c=l.inputs;if(t.length===c.length){let u=0;for(let f=0;f<t.length;f++){let d=t[f],A=c[f];d.getNodeType(e)===A.type&&u++}u>s&&(r=o,s=u)}}this._candidateFn=n=r}return n}setup(e){return this.getCandidateFn(e)(...this.parametersNodes)}},TMe=$n(W7),Zo=i=>(...e)=>TMe(i,...e),vx=Xt(0).setGroup(Jt).onRenderUpdate(i=>i.time),EMe=Xt(0).setGroup(Jt).onRenderUpdate(i=>i.deltaTime),rse=Xt(0,"uint").setGroup(Jt).onRenderUpdate(i=>i.frameId),MMe=(i=vx)=>i.add(.75).mul(Math.PI*2).sin().mul(.5).add(.5),CMe=(i=vx)=>i.fract().round(),RMe=(i=vx)=>i.add(.5).fract().mul(2).sub(1).abs(),IMe=(i=vx)=>i.fract();function PMe(i,e=null){return Kd(e,{getUV:typeof i=="function"?i:()=>i})}var LMe=me(([i,e,t=dt(.5)])=>RS(i.sub(t),e).add(t)),DMe=me(([i,e,t=dt(.5)])=>{let n=i.sub(t),r=n.dot(n),o=r.mul(r).mul(e);return i.add(n.mul(o))}),NMe=me(({position:i=null,horizontal:e=!0,vertical:t=!1})=>{let n;i!==null?(n=tu.toVar(),n[3][0]=i.x,n[3][1]=i.y,n[3][2]=i.z):n=tu;let r=_m.mul(n);return sx(e)&&(r[0][0]=tu[0].length(),r[0][1]=0,r[0][2]=0),sx(t)&&(r[1][0]=0,r[1][1]=tu[1].length(),r[1][2]=0),r[2][0]=0,r[2][1]=0,r[2][2]=1,Qa.mul(r).mul(Er)}),FMe=me(([i=null])=>{let e=d4();return d4(Yz(i)).sub(e).lessThan(0).select(ju,i)}),BMe=me(([i,e=Ui(),t=oe(0)])=>{let n=i.x,r=i.y,s=t.mod(n.mul(r)).floor(),o=s.mod(n),a=r.sub(s.add(1).div(n).ceil()),l=i.reciprocal(),c=dt(o,a);return e.add(c).mul(l)}),sse=me(([i,e=null,t=null,n=oe(1),r=Er,s=ba])=>{let o=s.abs().normalize();o=o.div(o.dot(pe(1)));let a=r.yz.mul(n),l=r.zx.mul(n),c=r.xy.mul(n),u=i.value,f=e!==null?e.value:u,d=t!==null?t.value:u,A=fi(u,a).mul(o.x),y=fi(f,l).mul(o.y),w=fi(d,c).mul(o.z);return Ls(A,y,w)}),OMe=(...i)=>sse(...i),B_=new Da,Cg=new re,O_=new re,BO=new re,Fw=new cn,vR=new re(0,0,-1),uf=new xn,Bw=new re,_R=new re,Ow=new xn,xR=new Oe,E4=new Fa,UMe=ju.flipX();E4.depthTexture=new Cs(1,1);var yR=!1,j7=class i extends su{static get type(){return"ReflectorNode"}constructor(e={}){super(e.defaultTexture||E4.texture,UMe),this._reflectorBaseNode=e.reflector||new X7(this,e),this._depthNode=null,this.setUpdateMatrix(!1)}get reflector(){return this._reflectorBaseNode}get target(){return this._reflectorBaseNode.target}getDepthNode(){if(this._depthNode===null){if(this._reflectorBaseNode.depth!==!0)throw new Error("THREE.ReflectorNode: Depth node can only be requested when the reflector is created with { depth: true }. ");this._depthNode=new i({defaultTexture:E4.depthTexture,reflector:this._reflectorBaseNode})}return this._depthNode}setup(e){return e.object.isQuadMesh||this._reflectorBaseNode.build(e),super.setup(e)}clone(){let e=new this.constructor(this.reflectorNode);return e.uvNode=this.uvNode,e.levelNode=this.levelNode,e.biasNode=this.biasNode,e.sampler=this.sampler,e.depthNode=this.depthNode,e.compareNode=this.compareNode,e.gradNode=this.gradNode,e.gatherNode=this.gatherNode,e.offsetNode=this.offsetNode,e._reflectorBaseNode=this._reflectorBaseNode,e}dispose(){super.dispose(),this._reflectorBaseNode.dispose()}},X7=class extends Kt{static get type(){return"ReflectorBaseNode"}constructor(e,t={}){super();let{target:n=new lr,resolutionScale:r=1,generateMipmaps:s=!1,bounces:o=!0,depth:a=!1,samples:l=0}=t;this.textureNode=e,this.target=n,this.resolutionScale=r,t.resolution!==void 0&&(ni('ReflectorNode: The "resolution" parameter has been renamed to "resolutionScale".'),this.resolutionScale=t.resolution),this.generateMipmaps=s,this.bounces=o,this.depth=a,this.samples=l,this.updateBeforeType=o?yn.RENDER:yn.FRAME,this.virtualCameras=new WeakMap,this.renderTargets=new Map,this.forceUpdate=!1,this.hasOutput=!1}_updateResolution(e,t){let n=this.resolutionScale;t.getDrawingBufferSize(xR),e.setSize(Math.round(xR.width*n),Math.round(xR.height*n))}setup(e){return this._updateResolution(E4,e.renderer),super.setup(e)}dispose(){super.dispose();for(let e of this.renderTargets.values())e.dispose()}getVirtualCamera(e){let t=this.virtualCameras.get(e);return t===void 0&&(t=e.clone(),this.virtualCameras.set(e,t)),t}getRenderTarget(e){let t=this.renderTargets.get(e);return t===void 0&&(t=new Fa(0,0,{type:Wi,samples:this.samples}),this.generateMipmaps===!0&&(t.texture.minFilter=I8,t.texture.generateMipmaps=!0),this.depth===!0&&(t.depthTexture=new Cs),this.renderTargets.set(e,t)),t}updateBefore(e){if(this.bounces===!1&&yR)return!1;yR=!0;let{scene:t,camera:n,renderer:r,material:s}=e,{target:o}=this,a=this.getVirtualCamera(n),l=this.getRenderTarget(a);r.getDrawingBufferSize(xR),this._updateResolution(l,r),O_.setFromMatrixPosition(o.matrixWorld),BO.setFromMatrixPosition(n.matrixWorld),Fw.extractRotation(o.matrixWorld),Cg.set(0,0,1),Cg.applyMatrix4(Fw),Bw.subVectors(O_,BO);let c=Bw.dot(Cg)>0,u=!1;if(c===!0&&this.forceUpdate===!1){if(this.hasOutput===!1){yR=!1;return}u=!0}Bw.reflect(Cg).negate(),Bw.add(O_),Fw.extractRotation(n.matrixWorld),vR.set(0,0,-1),vR.applyMatrix4(Fw),vR.add(BO),_R.subVectors(O_,vR),_R.reflect(Cg).negate(),_R.add(O_),a.coordinateSystem=n.coordinateSystem,a.position.copy(Bw),a.up.set(0,1,0),a.up.applyMatrix4(Fw),a.up.reflect(Cg),a.lookAt(_R),a.near=n.near,a.far=n.far,a.updateMatrixWorld(),a.projectionMatrix.copy(n.projectionMatrix),B_.setFromNormalAndCoplanarPoint(Cg,O_),B_.applyMatrix4(a.matrixWorldInverse),uf.set(B_.normal.x,B_.normal.y,B_.normal.z,B_.constant);let f=a.projectionMatrix;Ow.x=(Math.sign(uf.x)+f.elements[8])/f.elements[0],Ow.y=(Math.sign(uf.y)+f.elements[9])/f.elements[5],Ow.z=-1,Ow.w=(1+f.elements[10])/f.elements[14],uf.multiplyScalar(1/uf.dot(Ow));let d=0;f.elements[2]=uf.x,f.elements[6]=uf.y,f.elements[10]=r.coordinateSystem===_l?uf.z-d:uf.z+1-d,f.elements[14]=uf.w,this.textureNode.value=l.texture,this.depth===!0&&(this.textureNode.getDepthNode().value=l.depthTexture),s.visible=!1;let A=r.getRenderTarget(),y=r.getMRT(),w=r.autoClear;r.setMRT(null),r.setRenderTarget(l),r.autoClear=!0;let S=t.name;t.name=(t.name||"Scene")+" [ Reflector ]",u?(r.clear(),this.hasOutput=!1):(r.render(t,a),this.hasOutput=!0),t.name=S,r.setMRT(y),r.setRenderTarget(A),r.autoClear=w,s.visible=!0,yR=!1,this.forceUpdate=!1}get resolution(){return ni('ReflectorNode: The "resolution" property has been renamed to "resolutionScale".'),this.resolutionScale}set resolution(e){ni('ReflectorNode: The "resolution" property has been renamed to "resolutionScale".'),this.resolutionScale=e}},kMe=i=>new j7(i),OO=new Du(-1,1,1,-1,0,1),$7=class extends Xn{constructor(e=!1){super();let t=e===!1?[0,-1,0,1,2,1]:[0,2,0,0,2,0];this.setAttribute("position",new Ln([-1,3,0,-1,-1,0,3,-1,0],3)),this.setAttribute("uv",new Ln(t,2))}},zMe=new $7,gS=class extends Hn{constructor(e=null){super(zMe,e),this.camera=OO,this.isQuadMesh=!0}async renderAsync(e){ni('QuadMesh: "renderAsync()" has been deprecated. Use "render()" and "await renderer.init();" when creating the renderer.'),await e.init(),e.render(this,OO)}render(e){e.render(this,OO)}},VMe=new Oe,Y7=class extends su{static get type(){return"RTTNode"}constructor(e,t=null,n=null,r={type:Wi}){let s=new Fa(t,n,r);super(s.texture,Ui()),this.isRTTNode=!0,this.node=e,this.width=t,this.height=n,this.renderTarget=s,this.textureNeedsUpdate=!0,this.autoUpdate=!0,this._resolutionScale=1,this._rttNode=null,this._quadMesh=new gS(new Rr),this.updateBeforeType=yn.RENDER}get autoResize(){return this.width===null}setup(e){return this._rttNode=this.node.context(e.getSharedContext()),this._quadMesh.material.name="RTT",this._quadMesh.material.needsUpdate=!0,super.setup(e)}setSize(e,t){let n=Math.floor(e*this._resolutionScale),r=Math.floor(t*this._resolutionScale);this.renderTarget.setSize(n,r),this.textureNeedsUpdate=!0}setResolutionScale(e){return this._resolutionScale=e,this.autoResize===!1&&this.setSize(this.width,this.height),this}getResolutionScale(){return this._resolutionScale}updateBefore({renderer:e}){if(this.textureNeedsUpdate===!1&&this.autoUpdate===!1)return;this.textureNeedsUpdate=!1;let t=e.getRenderTarget();if(this.autoResize===!0){let r=e.getDrawingBufferSize(VMe),s=Math.floor(r.width*this._resolutionScale),o=Math.floor(r.height*this._resolutionScale);(s!==this.renderTarget.width||o!==this.renderTarget.height)&&(this.renderTarget.setSize(s,o),this.textureNeedsUpdate=!0)}let n="RTT";this.node.name&&(n=this.node.name+" [ "+n+" ]"),this._quadMesh.material.fragmentNode=this._rttNode,this._quadMesh.name=n,e.setRenderTarget(this.renderTarget),this._quadMesh.render(e),e.setRenderTarget(t)}clone(){let e=new su(this.value,this.uvNode,this.levelNode);return e.sampler=this.sampler,e.referenceNode=this,e}},ose=(i,...e)=>new Y7(Ht(i),...e),GMe=(i,...e)=>i.isSampleNode||i.isTextureNode?i:i.isPassNode?i.getTextureNode():ose(i,...e),Z_=me(([i,e,t],n)=>{let r;n.renderer.coordinateSystem===_l?(i=dt(i.x,i.y.oneMinus()).mul(2).sub(1),r=Ft(pe(i,e),1)):r=Ft(pe(i.x,i.y.oneMinus(),e).mul(2).sub(1),1);let s=Ft(t.mul(r));return s.xyz.div(s.w)}),qMe=me(([i,e])=>{let t=e.mul(Ft(i,1)),n=t.xy.div(t.w).mul(.5).add(.5).toVar();return dt(n.x,n.y.oneMinus())}),HMe=me(([i,e,t])=>{let n=Yg(_s(e)),r=kr(i.mul(n)).toVar(),s=_s(e,r).toVar(),o=_s(e,r.sub(kr(2,0))).toVar(),a=_s(e,r.sub(kr(1,0))).toVar(),l=_s(e,r.add(kr(1,0))).toVar(),c=_s(e,r.add(kr(2,0))).toVar(),u=_s(e,r.add(kr(0,2))).toVar(),f=_s(e,r.add(kr(0,1))).toVar(),d=_s(e,r.sub(kr(0,1))).toVar(),A=_s(e,r.sub(kr(0,2))).toVar(),y=fr(ai(oe(2).mul(a).sub(o),s)).toVar(),w=fr(ai(oe(2).mul(l).sub(c),s)).toVar(),S=fr(ai(oe(2).mul(f).sub(u),s)).toVar(),T=fr(ai(oe(2).mul(d).sub(A),s)).toVar(),R=Z_(i,s,t).toVar(),P=y.lessThan(w).select(R.sub(Z_(i.sub(dt(oe(1).div(n.x),0)),a,t)),R.negate().add(Z_(i.add(dt(oe(1).div(n.x),0)),l,t))),I=S.lessThan(T).select(R.sub(Z_(i.add(dt(0,oe(1).div(n.y))),f,t)),R.negate().add(Z_(i.sub(dt(0,oe(1).div(n.y))),d,t)));return xa($d(P,I))}),iV=me(([i])=>$u(oe(52.9829189).mul($u(ru(i,dt(.06711056,.00583715)))))).setLayout({name:"interleavedGradientNoise",type:"float",inputs:[{name:"position",type:"vec2"}]}),Wu=me(([i,e,t])=>{let n=oe(2.399963229728653),r=Ja(oe(i).add(.5).div(oe(e))),s=oe(i).mul(n).add(t);return dt(Hu(s),Za(s)).mul(r)}).setLayout({name:"vogelDiskSample",type:"vec2",inputs:[{name:"sampleIndex",type:"int"},{name:"samplesCount",type:"int"},{name:"phi",type:"float"}]}),Z7=class extends Kt{static get type(){return"SampleNode"}constructor(e,t=null){super(),this.callback=e,this.uvNode=t,this.isSampleNode=!0}setup(){return this.sample(Ui())}sample(e){return this.callback(e)}},WMe=(i,e=null)=>new Z7(i,Ht(e)),e1=class extends Yl{constructor(e,t,n=Float32Array){let r=ArrayBuffer.isView(e)?e:new n(e*t);super(r,t),this.isStorageInstancedBufferAttribute=!0}},K7=class extends Hi{constructor(e,t,n=Float32Array){let r=ArrayBuffer.isView(e)?e:new n(e*t);super(r,t),this.isStorageBufferAttribute=!0}},jMe=(i,e="float")=>{let t,n;e.isStructTypeNode===!0?(t=e.getLength(),n=XR("float")):(t=Fte(e),n=XR(e));let r=new K7(i,t,n);return hm(r,e,i)},XMe=(i,e="float")=>{let t,n;e.isStructTypeNode===!0?(t=e.getLength(),n=XR("float")):(t=Fte(e),n=XR(e));let r=new e1(i,t,n);return hm(r,e,r.count)},Q7=class extends Kt{static get type(){return"PointUVNode"}constructor(){super("vec2"),this.isPointUVNode=!0}generate(){return"vec2( gl_PointCoord.x, 1.0 - gl_PointCoord.y )"}},$Me=xt(Q7),UO=new cn,ase=Xt(0).setGroup(Jt).onRenderUpdate(({scene:i})=>i.backgroundBlurriness),J7=Xt(1).setGroup(Jt).onRenderUpdate(({scene:i})=>i.backgroundIntensity),lse=Xt(new cn).setGroup(Jt).onRenderUpdate(({scene:i})=>{let e=i.background;return e!==null&&e.isTexture&&e.mapping!==wb||i.backgroundNode&&i.backgroundNode.isNode?UO.makeRotationFromEuler(i.backgroundRotation).transpose():UO.identity(),UO}),M4=class extends su{static get type(){return"StorageTextureNode"}constructor(e,t,n=null){super(e,t),this.storeNode=n,this.mipLevel=0,this.isStorageTextureNode=!0,this.access=$o.WRITE_ONLY}getInputType(){return"storageTexture"}getTransformedUV(e){return e}setup(e){super.setup(e);let t=e.getNodeProperties(this);return t.storeNode=this.storeNode,t}setAccess(e){return this.access=e,this}setMipLevel(e){return this.mipLevel=e,this}generate(e,t){return this.storeNode!==null?(this.generateStore(e),""):super.generate(e,t)}generateSnippet(e,t,n,r,s,o,a,l,c){let u=this.value;return e.generateStorageTextureLoad(u,t,n,r,o,c)}toReadWrite(){return this.setAccess($o.READ_WRITE)}toReadOnly(){return this.setAccess($o.READ_ONLY)}toWriteOnly(){return this.setAccess($o.WRITE_ONLY)}store(e,t){let n=this.clone();return n.referenceNode=this.getBase(),n.uvNode=e,n.storeNode=t,t!==null&&n.toStack(),n}generateStore(e){let t=e.getNodeProperties(this),{uvNode:n,storeNode:r,depthNode:s}=t,o=super.generate(e,"property"),a=n.build(e,this.value.is3DTexture===!0?"uvec3":"uvec2"),l=r.build(e,"vec4"),c=s?s.build(e,"int"):null,u=e.generateTextureStore(this.value,o,a,c,l);e.addLineFlowCode(u,this)}clone(){let e=super.clone();return e.storeNode=this.storeNode,e.mipLevel=this.mipLevel,e.access=this.access,e}},cse=$n(M4).setParameterLength(1,3),YMe=(i,e,t)=>{let n;return i.isStorageTextureNode===!0?n=i.store(e,t):(n=cse(i,e,t),t!==null&&n.toStack()),n},ek=class extends M4{static get type(){return"StorageTexture3DNode"}constructor(e,t,n=null){super(e,t,n),this.isStorageTexture3DNode=!0}getDefaultUV(){return pe(.5,.5,.5)}setUpdateMatrix(){}generateUV(e,t){return t.build(e,this.sampler===!0?"vec3":"ivec3")}generateOffset(e,t){return t.build(e,"ivec3")}},ZMe=$n(ek).setParameterLength(1,3),KMe=me(({texture:i,uv:e})=>{let n=pe().toVar();return $t(e.x.lessThan(1e-4),()=>{n.assign(pe(1,0,0))}).ElseIf(e.y.lessThan(1e-4),()=>{n.assign(pe(0,1,0))}).ElseIf(e.z.lessThan(1e-4),()=>{n.assign(pe(0,0,1))}).ElseIf(e.x.greaterThan(1-1e-4),()=>{n.assign(pe(-1,0,0))}).ElseIf(e.y.greaterThan(1-1e-4),()=>{n.assign(pe(0,-1,0))}).ElseIf(e.z.greaterThan(1-1e-4),()=>{n.assign(pe(0,0,-1))}).Else(()=>{let s=i.sample(e.add(pe(-.01,0,0))).r.sub(i.sample(e.add(pe(.01,0,0))).r),o=i.sample(e.add(pe(0,-.01,0))).r.sub(i.sample(e.add(pe(0,.01,0))).r),a=i.sample(e.add(pe(0,0,-.01))).r.sub(i.sample(e.add(pe(0,0,.01))).r);n.assign(pe(s,o,a))}),n.normalize()}),tk=class extends su{static get type(){return"Texture3DNode"}constructor(e,t=null,n=null){super(e,t,n),this.isTexture3DNode=!0}getInputType(){return"texture3D"}getDefaultUV(){return pe(.5,.5,.5)}setUpdateMatrix(){}generateUV(e,t){return t.build(e,this.sampler===!0?"vec3":"ivec3")}generateOffset(e,t){return t.build(e,"ivec3")}normal(e){return KMe({texture:this,uv:e})}},rV=$n(tk).setParameterLength(1,3),QMe=(...i)=>rV(...i).setSampler(!1),JMe=(i,e,t)=>rV(i,e).level(t),nk=class extends lx{static get type(){return"UserDataNode"}constructor(e,t,n=null){super(e,t,n),this.userData=n}updateReference(e){return this.reference=this.userData!==null?this.userData:e.object.userData,this.reference}},eCe=(i,e,t)=>new nk(i,e,t),ete=new WeakMap,ik=class extends Cr{static get type(){return"VelocityNode"}constructor(){super("vec2"),this.projectionMatrix=null,this.updateType=yn.OBJECT,this.updateAfterType=yn.OBJECT,this.previousModelWorldMatrix=Xt(new cn),this.previousProjectionMatrix=Xt(new cn).setGroup(Jt),this.previousCameraViewMatrix=Xt(new cn)}setProjectionMatrix(e){this.projectionMatrix=e}update({frameId:e,camera:t,object:n}){let r=tte(n);this.previousModelWorldMatrix.value.copy(r);let s=use(t);s.frameId!==e&&(s.frameId=e,s.previousProjectionMatrix===void 0?(s.previousProjectionMatrix=new cn,s.previousCameraViewMatrix=new cn,s.currentProjectionMatrix=new cn,s.currentCameraViewMatrix=new cn,s.previousProjectionMatrix.copy(this.projectionMatrix||t.projectionMatrix),s.previousCameraViewMatrix.copy(t.matrixWorldInverse)):(s.previousProjectionMatrix.copy(s.currentProjectionMatrix),s.previousCameraViewMatrix.copy(s.currentCameraViewMatrix)),s.currentProjectionMatrix.copy(this.projectionMatrix||t.projectionMatrix),s.currentCameraViewMatrix.copy(t.matrixWorldInverse),this.previousProjectionMatrix.value.copy(s.previousProjectionMatrix),this.previousCameraViewMatrix.value.copy(s.previousCameraViewMatrix))}updateAfter({object:e}){tte(e).copy(e.matrixWorld)}setup(){let e=this.projectionMatrix===null?Qa:Xt(this.projectionMatrix),t=this.previousCameraViewMatrix.mul(this.previousModelWorldMatrix),n=e.mul(bf).mul(Er),r=this.previousProjectionMatrix.mul(t).mul(Kg),s=n.xy.div(n.w),o=r.xy.div(r.w);return ai(s,o)}};function use(i){let e=ete.get(i);return e===void 0&&(e={},ete.set(i,e)),e}function tte(i,e=0){let t=use(i),n=t[e];return n===void 0&&(t[e]=n=new cn,t[e].copy(i.matrixWorld)),n}var tCe=xt(ik),nCe=me(([i,e])=>Rl(1,i.oneMinus().div(e)).oneMinus()).setLayout({name:"blendBurn",type:"vec3",inputs:[{name:"base",type:"vec3"},{name:"blend",type:"vec3"}]}),iCe=me(([i,e])=>Rl(i.div(e.oneMinus()),1)).setLayout({name:"blendDodge",type:"vec3",inputs:[{name:"base",type:"vec3"},{name:"blend",type:"vec3"}]}),rCe=me(([i,e])=>i.oneMinus().mul(e.oneMinus()).oneMinus()).setLayout({name:"blendScreen",type:"vec3",inputs:[{name:"base",type:"vec3"},{name:"blend",type:"vec3"}]}),sCe=me(([i,e])=>Qn(i.mul(2).mul(e),i.oneMinus().mul(2).mul(e.oneMinus()).oneMinus(),$g(.5,i))).setLayout({name:"blendOverlay",type:"vec3",inputs:[{name:"base",type:"vec3"},{name:"blend",type:"vec3"}]}),oCe=me(([i,e])=>{let t=e.a.add(i.a.mul(e.a.oneMinus()));return Ft(e.rgb.mul(e.a).add(i.rgb.mul(i.a).mul(e.a.oneMinus())).div(t),t)}).setLayout({name:"blendColor",type:"vec4",inputs:[{name:"base",type:"vec4"},{name:"blend",type:"vec4"}]}),aCe=me(([i])=>sV(i.rgb)),lCe=me(([i,e=oe(1)])=>e.mix(sV(i.rgb),i.rgb).max(0)),cCe=me(([i,e=oe(0)])=>{let t=Ls(i.r,i.g,i.b).div(3),n=i.r.max(i.g.max(i.b)),r=n.sub(t).mul(e).mul(-3);return Qn(i.rgb,n,r).max(0)}),uCe=me(([i,e=oe(1)])=>{let t=pe(.57735,.57735,.57735),n=e.cos();return pe(i.rgb.mul(n).add(t.cross(i.rgb).mul(e.sin()).add(t.mul(ru(t,i.rgb).mul(n.oneMinus()))))).max(0)}),sV=(i,e=pe(ln.getLuminanceCoefficients(new re)))=>ru(i,e),hCe=me(([i,e=pe(1),t=pe(0),n=pe(1),r=oe(1),s=pe(ln.getLuminanceCoefficients(new re,Kp))])=>{let o=i.rgb.dot(pe(s)),a=zr(i.rgb.mul(e).add(t),0),l=a.pow(n);return $t(a.r.greaterThan(0),()=>{a.r.assign(l.r)}),$t(a.g.greaterThan(0),()=>{a.g.assign(l.g)}),$t(a.b.greaterThan(0),()=>{a.b.assign(l.b)}),a.assign(o.add(a.sub(o).mul(r)).max(0)),Ft(a.rgb,i.a)}),fCe=me(([i,e])=>i.mul(e).floor().div(e)),bR=null,rk=class extends cx{static get type(){return"ViewportSharedTextureNode"}constructor(e=ju,t=null){bR===null&&(bR=new zA),super(e,t,bR)}getTextureForReference(){return bR}updateReference(){return this}},dCe=$n(rk).setParameterLength(0,2),wR=new Oe,C4=class extends su{static get type(){return"PassTextureNode"}constructor(e,t){super(t),this.passNode=e,this.isPassTextureNode=!0,this.setUpdateMatrix(!1)}setup(e){let t=e.getNodeProperties(this);return t.passNode=this.passNode,super.setup(e)}clone(){return new this.constructor(this.passNode,this.value)}},R4=class extends C4{static get type(){return"PassMultipleTextureNode"}constructor(e,t,n=!1){super(e,null),this.textureName=t,this.previousTexture=n,this.isPassMultipleTextureNode=!0}updateTexture(){this.value=this.previousTexture?this.passNode.getPreviousTexture(this.textureName):this.passNode.getTexture(this.textureName)}setup(e){return this.updateTexture(),super.setup(e)}clone(){let e=new this.constructor(this.passNode,this.textureName,this.previousTexture);return e.uvNode=this.uvNode,e.levelNode=this.levelNode,e.biasNode=this.biasNode,e.sampler=this.sampler,e.depthNode=this.depthNode,e.compareNode=this.compareNode,e.gradNode=this.gradNode,e.gatherNode=this.gatherNode,e.offsetNode=this.offsetNode,e}},Ef=class i extends Cr{static get type(){return"PassNode"}constructor(e,t,n,r={}){super("vec4"),this.scope=e,this.scene=t,this.camera=n,this.options=r,this._width=1,this._height=1;let s=new Fa(this._width,this._height,{type:Wi,...r});s.texture.name="output";let o=null;(this.scope===i.DEPTH||r.depthBuffer!==!1)&&(o=new Cs,o.isRenderTargetTexture=!0,o.name="depth",s.depthTexture=o),this.renderTarget=s,this.overrideMaterial=null,this.transparent=!0,this.opaque=!0,this.contextNode=null,this._contextNodeCache=null,this._textures={output:s.texture},o!==null&&(this._textures.depth=o),this._textureNodes={},this._linearDepthNodes={},this._viewZNodes={},this._previousTextures={},this._previousTextureNodes={},this._cameraNear=Xt(0),this._cameraFar=Xt(0),this._mrt=null,this._layers=null,this._resolutionScale=1,this._viewport=null,this._scissor=null,this.isPassNode=!0,this.updateBeforeType=yn.FRAME,this.global=!0}setResolutionScale(e){return this._resolutionScale=e,this}getResolutionScale(){return this._resolutionScale}setResolution(e){return Xe("PassNode: .setResolution() is deprecated. Use .setResolutionScale() instead."),this.setResolutionScale(e)}getResolution(){return Xe("PassNode: .getResolution() is deprecated. Use .getResolutionScale() instead."),this.getResolutionScale()}setLayers(e){return this._layers=e,this}getLayers(){return this._layers}setMRT(e){return this._mrt=e,this}getMRT(){return this._mrt}getTexture(e){let t=this._textures[e];if(t===void 0){if(e==="depth")throw new Error("THREE.PassNode: Depth texture is not available for this pass.");t=this.renderTarget.texture.clone(),t.name=e,this._textures[e]=t,this.renderTarget.textures.push(t)}return t}getPreviousTexture(e){let t=this._previousTextures[e];return t===void 0&&(t=this.getTexture(e).clone(),this._previousTextures[e]=t),t}toggleTexture(e){let t=this._previousTextures[e];if(t!==void 0){let n=this._textures[e],r=this.renderTarget.textures.indexOf(n);this.renderTarget.textures[r]=t,this._textures[e]=t,this._previousTextures[e]=n,this._textureNodes[e].updateTexture(),this._previousTextureNodes[e].updateTexture()}}getTextureNode(e="output"){let t=this._textureNodes[e];return t===void 0&&(t=new R4(this,e),t.updateTexture(),this._textureNodes[e]=t),t}getPreviousTextureNode(e="output"){let t=this._previousTextureNodes[e];return t===void 0&&(this._textureNodes[e]===void 0&&this.getTextureNode(e),t=new R4(this,e,!0),t.updateTexture(),this._previousTextureNodes[e]=t),t}getViewZNode(e="depth"){let t=this._viewZNodes[e];if(t===void 0){let n=this._cameraNear,r=this._cameraFar;this._viewZNodes[e]=t=TI(this.getTextureNode(e),n,r)}return t}getLinearDepthNode(e="depth"){let t=this._linearDepthNodes[e];if(t===void 0){let n=this._cameraNear,r=this._cameraFar,s=this.getViewZNode(e);this._linearDepthNodes[e]=t=Hg(s,n,r)}return t}async compileAsync(e){let t=e.getRenderTarget(),n=e.getMRT();e.setRenderTarget(this.renderTarget),e.setMRT(this._mrt),await e.compileAsync(this.scene,this.camera),e.setRenderTarget(t),e.setMRT(n)}setup({renderer:e}){return this.renderTarget.samples=this.options.samples===void 0?e.samples:this.options.samples,this.renderTarget.texture.type=e.getOutputBufferType(),e.reversedDepthBuffer===!0&&this.renderTarget.depthTexture!==null&&(this.renderTarget.depthTexture.type=cr),this.scope===i.COLOR?this.getTextureNode():this.getLinearDepthNode()}updateBefore(e){let{renderer:t}=e,{scene:n}=this,r,s=t.getOutputRenderTarget();s&&s.isXRRenderTarget===!0?(r=t.xr.getCamera(),t.xr.updateCamera(r),wR.set(s.width,s.height)):(r=this.camera,t.getDrawingBufferSize(wR)),this.setSize(wR.width,wR.height);let o=t.getRenderTarget(),a=t.getMRT(),l=t.autoClear,c=t.transparent,u=t.opaque,f=r.layers.mask,d=t.contextNode,A=n.overrideMaterial;this._cameraNear.value=r.near,this._cameraFar.value=r.far,this._layers!==null&&(r.layers.mask=this._layers.mask);for(let w in this._previousTextures)this.toggleTexture(w);this.overrideMaterial!==null&&(n.overrideMaterial=this.overrideMaterial),t.setRenderTarget(this.renderTarget),t.setMRT(this._mrt),t.autoClear=!0,t.transparent=this.transparent,t.opaque=this.opaque,this.contextNode!==null&&((this._contextNodeCache===null||this._contextNodeCache.version!==this.version)&&(this._contextNodeCache={version:this.version,context:Kd({...t.contextNode.getFlowContextData(),...this.contextNode.getFlowContextData()})}),t.contextNode=this._contextNodeCache.context);let y=n.name;n.name=this.name?this.name:n.name,t.render(n,r),n.name=y,n.overrideMaterial=A,t.setRenderTarget(o),t.setMRT(a),t.autoClear=l,t.transparent=c,t.opaque=u,t.contextNode=d,r.layers.mask=f}setSize(e,t){this._width=e,this._height=t;let n=Math.floor(this._width*this._resolutionScale),r=Math.floor(this._height*this._resolutionScale);this.renderTarget.setSize(n,r),this._scissor!==null?(this.renderTarget.scissor.copy(this._scissor).multiplyScalar(this._resolutionScale).floor(),this.renderTarget.scissorTest=!0):this.renderTarget.scissorTest=!1,this._viewport!==null&&this.renderTarget.viewport.copy(this._viewport).multiplyScalar(this._resolutionScale).floor()}setScissor(e,t,n,r){e===null?this._scissor=null:(this._scissor===null&&(this._scissor=new xn),e.isVector4?this._scissor.copy(e):this._scissor.set(e,t,n,r))}setViewport(e,t,n,r){e===null?this._viewport=null:(this._viewport===null&&(this._viewport=new xn),e.isVector4?this._viewport.copy(e):this._viewport.set(e,t,n,r))}dispose(){this.renderTarget.dispose()}};Ef.COLOR="color";Ef.DEPTH="depth";var pCe=(i,e,t)=>new Ef(Ef.COLOR,i,e,t),mCe=(i,e)=>new C4(i,e),ACe=(i,e,t)=>new Ef(Ef.DEPTH,i,e,t),sk=class extends Ef{static get type(){return"ToonOutlinePassNode"}constructor(e,t,n,r,s){super(Ef.COLOR,e,t),this.colorNode=n,this.thicknessNode=r,this.alphaNode=s,this._materialCache=new WeakMap,this.name="Outline Pass"}updateBefore(e){let{renderer:t}=e,n=t.getRenderObjectFunction();t.setRenderObjectFunction((r,s,o,a,l,c,u,f)=>{if((l.isMeshToonMaterial||l.isMeshToonNodeMaterial)&&l.wireframe===!1){let d=this._getOutlineMaterial(l);t.renderObject(r,s,o,a,d,c,u,f)}t.renderObject(r,s,o,a,l,c,u,f)}),super.updateBefore(e),t.setRenderObjectFunction(n)}_createMaterial(){let e=new Rr;e.isMeshToonOutlineMaterial=!0,e.name="Toon_Outline",e.side=mi;let t=ba.negate(),n=Qa.mul(bf),r=oe(1),s=n.mul(Ft(Er,1)),o=n.mul(Ft(Er.add(t),1)),a=xa(s.sub(o));return e.vertexNode=s.add(a.mul(this.thicknessNode).mul(s.w).mul(r)),e.colorNode=Ft(this.colorNode,this.alphaNode),e}_getOutlineMaterial(e){let t=this._materialCache.get(e);return t===void 0&&(t=this._createMaterial(),this._materialCache.set(e,t)),t}},gCe=(i,e,t=new zt(0,0,0),n=.003,r=1)=>new sk(i,e,Ht(t),Ht(n),Ht(r)),hse=me(([i,e])=>i.mul(e).clamp()).setLayout({name:"linearToneMapping",type:"vec3",inputs:[{name:"color",type:"vec3"},{name:"exposure",type:"float"}]}),fse=me(([i,e])=>(i=i.mul(e),i.div(i.add(1)).clamp())).setLayout({name:"reinhardToneMapping",type:"vec3",inputs:[{name:"color",type:"vec3"},{name:"exposure",type:"float"}]}),dse=me(([i,e])=>{i=i.mul(e),i=i.sub(.004).max(0);let t=i.mul(i.mul(6.2).add(.5)),n=i.mul(i.mul(6.2).add(1.7)).add(.06);return t.div(n).pow(2.2)}).setLayout({name:"cineonToneMapping",type:"vec3",inputs:[{name:"color",type:"vec3"},{name:"exposure",type:"float"}]}),vCe=me(([i])=>{let e=i.mul(i.add(.0245786)).sub(90537e-9),t=i.mul(i.add(.432951).mul(.983729)).add(.238081);return e.div(t)}),pse=me(([i,e])=>{let t=To(.59719,.35458,.04823,.076,.90834,.01566,.0284,.13383,.83777),n=To(1.60475,-.53108,-.07367,-.10208,1.10813,-.00605,-.00327,-.07276,1.07602);return i=i.mul(e).div(.6),i=t.mul(i),i=vCe(i),i=n.mul(i),i.clamp()}).setLayout({name:"acesFilmicToneMapping",type:"vec3",inputs:[{name:"color",type:"vec3"},{name:"exposure",type:"float"}]}),_Ce=To(pe(1.6605,-.1246,-.0182),pe(-.5876,1.1329,-.1006),pe(-.0728,-.0083,1.1187)),xCe=To(pe(.6274,.0691,.0164),pe(.3293,.9195,.088),pe(.0433,.0113,.8956)),yCe=me(([i])=>{let e=pe(i).toVar(),t=pe(e.mul(e)).toVar(),n=pe(t.mul(t)).toVar();return oe(15.5).mul(n.mul(t)).sub(Tn(40.14,n.mul(e))).add(Tn(31.96,n).sub(Tn(6.868,t.mul(e))).add(Tn(.4298,t).add(Tn(.1191,e).sub(.00232))))}),mse=me(([i,e])=>{let t=pe(i).toVar(),n=To(pe(.856627153315983,.137318972929847,.11189821299995),pe(.0951212405381588,.761241990602591,.0767994186031903),pe(.0482516061458583,.101439036467562,.811302368396859)),r=To(pe(1.1271005818144368,-.1413297634984383,-.14132976349843826),pe(-.11060664309660323,1.157823702216272,-.11060664309660294),pe(-.016493938717834573,-.016493938717834257,1.2519364065950405)),s=oe(-12.47393),o=oe(4.026069);return t.mulAssign(e),t.assign(xCe.mul(t)),t.assign(n.mul(t)),t.assign(zr(t,1e-10)),t.assign(Af(t)),t.assign(t.sub(s).div(o.sub(s))),t.assign(Yu(t,0,1)),t.assign(yCe(t)),t.assign(r.mul(t)),t.assign(eu(zr(pe(0),t),pe(2.2))),t.assign(_Ce.mul(t)),t.assign(Yu(t,0,1)),t}).setLayout({name:"agxToneMapping",type:"vec3",inputs:[{name:"color",type:"vec3"},{name:"exposure",type:"float"}]}),Ase=me(([i,e])=>{let t=oe(.76),n=oe(.15);i=i.mul(e);let r=Rl(i.r,Rl(i.g,i.b)),s=_a(r.lessThan(.08),r.sub(Tn(6.25,r.mul(r))),.04);i.subAssign(s);let o=zr(i.r,zr(i.g,i.b));$t(o.lessThan(t),()=>i);let a=ai(1,t),l=ai(1,a.mul(a).div(o.add(a.sub(t))));i.mulAssign(l.div(o));let c=ai(1,hc(1,n.mul(o.sub(l)).add(1)));return Qn(i,pe(l),c)}).setLayout({name:"neutralToneMapping",type:"vec3",inputs:[{name:"color",type:"vec3"},{name:"exposure",type:"float"}]}),hr=class extends Kt{static get type(){return"CodeNode"}constructor(e="",t=[],n=""){super("code"),this.isCodeNode=!0,this.global=!0,this.code=e,this.includes=t,this.language=n}setIncludes(e){return this.includes=e,this}getIncludes(){return this.includes}generate(e){let t=this.getIncludes(e);for(let r of t)r.build(e);let n=e.getCodeFromNode(this,this.getNodeType(e));return n.code=this.code,n.code}serialize(e){super.serialize(e),e.code=this.code,e.language=this.language}deserialize(e){super.deserialize(e),this.code=e.code,this.language=e.language}},II=$n(hr).setParameterLength(1,3),bCe=(i,e)=>II(i,e,"js"),wCe=(i,e)=>II(i,e,"wgsl"),SCe=(i,e)=>II(i,e,"glsl"),I4=class extends hr{static get type(){return"FunctionNode"}constructor(e="",t=[],n=""){super(e,t,n)}generateNodeType(e){return this.getNodeFunction(e).type}getMemberType(e,t){let n=this.getNodeType(e);return e.getStructTypeNode(n).getMemberType(e,t)}getInputs(e){return this.getNodeFunction(e).inputs}getNodeFunction(e){let t=e.getDataFromNode(this),n=t.nodeFunction;return n===void 0&&(n=e.parser.parseFunction(this.code),t.nodeFunction=n),n}generate(e,t){super.generate(e);let n=this.getNodeFunction(e),r=n.name,s=n.type,o=e.getCodeFromNode(this,s);r!==""&&(o.name=r);let a=e.getPropertyName(o),l=this.getNodeFunction(e).getCode(a);return o.code=l+`4159-`,t==="property"?a:e.format(`${a}()`,s,t)}},gse=(i,e=[],t="")=>{let n=new I4(i,e,t);return j9((...s)=>n.call(...s),n)},TCe=(i,e)=>gse(i,e,"glsl"),ECe=(i,e)=>gse(i,e,"wgsl");function oV(i){let e,t=i.context.getViewZ;return t!==void 0&&(e=t(this)),(e||xs.z).negate()}var vse=me(([i,e],t)=>{let n=oV(t);return fc(i,e,n)}),_se=me(([i],e)=>{let t=oV(e);return i.mul(i,t,t).negate().exp().oneMinus()}),MCe=me(([i,e],t)=>{let n=oV(t),s=e.sub(_f.y).max(0).toConst().mul(n).toConst();return i.mul(i,s,s).negate().exp().oneMinus()}),ok=me(([i,e])=>Ft(e.toFloat().mix(ex.rgb,i.toVec3()),ex.a)),Rg=null,Ig=null,ak=class extends Kt{static get type(){return"RangeNode"}constructor(e=oe(),t=oe()){super(),this.minNode=e,this.maxNode=t}getVectorLength(e){let t=this.getConstNode(this.minNode),n=this.getConstNode(this.maxNode),r=e.getTypeLength(lm(t.value)),s=e.getTypeLength(lm(n.value));return r>s?r:s}generateNodeType(e){return e.object.count>1?e.getTypeFromLength(this.getVectorLength(e)):"float"}getConstNode(e){let t=null;if(e.traverse(n=>{n.isConstNode===!0&&(t=n)}),t===null)throw new l4('THREE.TSL: No "ConstNode" found in node graph.',this.stackTrace);return t}setup(e){let t=e.object,n=null;if(t.count>1){let r=this.getConstNode(this.minNode),s=this.getConstNode(this.maxNode),o=r.value,a=s.value,l=e.getTypeLength(lm(o)),c=e.getTypeLength(lm(a));Rg=Rg||new xn,Ig=Ig||new xn,Rg.setScalar(0),Ig.setScalar(0),l===1?Rg.setScalar(o):o.isColor?Rg.set(o.r,o.g,o.b,1):Rg.set(o.x,o.y,o.z||0,o.w||0),c===1?Ig.setScalar(a):a.isColor?Ig.set(a.r,a.g,a.b,1):Ig.set(a.x,a.y,a.z||0,a.w||0);let u=4,f=u*t.count,d=new Float32Array(f);for(let w=0;w<f;w++){let S=w%u,T=Rg.getComponent(S),R=Ig.getComponent(S);d[w]=Bu.lerp(T,R,Math.random())}let A=this.getNodeType(e);if(t.count*4*4<=e.getUniformBufferLimit())n=Ax(d,"vec4",t.count).element(Xu).convert(A);else{let w=new Yl(d,4);e.geometry.setAttribute("__range"+this.id,w),n=xI(w).convert(A)}}else n=oe(0);return n}},CCe=$n(ak).setParameterLength(2),lk=class extends Kt{static get type(){return"ComputeBuiltinNode"}constructor(e,t){super(t),this._builtinName=e}getHash(e){return this.getBuiltinName(e)}generateNodeType(){return this.nodeType}setBuiltinName(e){return this._builtinName=e,this}getBuiltinName(){return this._builtinName}hasBuiltin(e){return e.hasBuiltin(this._builtinName)}generate(e,t){let n=this.getBuiltinName(e),r=this.getNodeType(e);return e.shaderStage==="compute"?e.format(n,r,t):(Xe(`ComputeBuiltinNode: Compute built-in value ${n} can not be accessed in the ${e.shaderStage} stage`),e.generateConst(r))}serialize(e){super.serialize(e),e.global=this.global,e._builtinName=this._builtinName}deserialize(e){super.deserialize(e),this.global=e.global,this._builtinName=e._builtinName}},IS=(i,e)=>new lk(i,e),RCe=IS("numWorkgroups","uvec3"),ICe=IS("workgroupId","uvec3"),PCe=IS("globalId","uvec3"),LCe=IS("localId","uvec3"),DCe=IS("subgroupSize","uint"),ck=class extends Kt{constructor(e){super(),this.scope=e,this.isBarrierNode=!0}setup(e){e.allowEarlyReturns=!1,e.allowGlobalVariables=!1}generate(e){let{scope:t}=this,{renderer:n}=e;n.backend.isWebGLBackend===!0?e.addFlowCode(` // ${t}Barrier 4160-`):e.addLineFlowCode(`${t}Barrier()`,this)}},aV=$n(ck),NCe=()=>aV("workgroup").toStack(),FCe=()=>aV("storage").toStack(),BCe=()=>aV("texture").toStack(),uk=class extends Xd{constructor(e,t){super(e,t),this.isWorkgroupInfoElementNode=!0}generate(e,t){let n,r=e.isContextAssign();if(n=super.generate(e),r!==!0){let s=this.getNodeType(e);n=e.format(n,s,t)}return n}},hk=class extends Kt{constructor(e,t,n=0){super(t),this.bufferType=t,this.bufferCount=n,this.isWorkgroupInfoNode=!0,this.elementType=t,this.scope=e,this.name=""}setName(e){return this.name=e,this}label(e){return Xe('TSL: "label()" has been deprecated. Use "setName()" instead.',new es),this.setName(e)}setScope(e){return this.scope=e,this}getElementType(){return this.elementType}getInputType(){return`${this.scope}Array`}element(e){return new uk(this,e)}generate(e){let t=this.name!==""?this.name:`${this.scope}Array_${this.id}`;return e.getScopedArray(t,this.scope.toLowerCase(),this.bufferType,this.bufferCount)}},OCe=(i,e)=>new hk("Workgroup",i,e),Ns=class extends Kt{static get type(){return"AtomicFunctionNode"}constructor(e,t,n){super("uint"),this.method=e,this.pointerNode=t,this.valueNode=n,this.parents=!0}getInputType(e){return this.pointerNode.getNodeType(e)}generateNodeType(e){return this.getInputType(e)}generate(e){let t=e.getNodeProperties(this),n=t.parents,r=this.method,s=this.getNodeType(e),o=this.getInputType(e),a=this.pointerNode,l=this.valueNode,c=[];c.push(`&${a.build(e,o)}`),l!==null&&c.push(l.build(e,o));let u=`${e.getMethod(r,s)}( ${c.join(", ")} )`;if(n?n.length===1&&n[0].isStackNode===!0:!1)e.addLineFlowCode(u,this);else return t.constNode===void 0&&(t.constNode=lc(u,s).toConst()),t.constNode.build(e)}};Ns.ATOMIC_LOAD="atomicLoad";Ns.ATOMIC_STORE="atomicStore";Ns.ATOMIC_ADD="atomicAdd";Ns.ATOMIC_SUB="atomicSub";Ns.ATOMIC_MAX="atomicMax";Ns.ATOMIC_MIN="atomicMin";Ns.ATOMIC_AND="atomicAnd";Ns.ATOMIC_OR="atomicOr";Ns.ATOMIC_XOR="atomicXor";var UCe=$n(Ns),Cf=(i,e,t)=>UCe(i,e,t).toStack(),kCe=i=>Cf(Ns.ATOMIC_LOAD,i,null),zCe=(i,e)=>Cf(Ns.ATOMIC_STORE,i,e),VCe=(i,e)=>Cf(Ns.ATOMIC_ADD,i,e),GCe=(i,e)=>Cf(Ns.ATOMIC_SUB,i,e),qCe=(i,e)=>Cf(Ns.ATOMIC_MAX,i,e),HCe=(i,e)=>Cf(Ns.ATOMIC_MIN,i,e),WCe=(i,e)=>Cf(Ns.ATOMIC_AND,i,e),jCe=(i,e)=>Cf(Ns.ATOMIC_OR,i,e),XCe=(i,e)=>Cf(Ns.ATOMIC_XOR,i,e),Ot=class i extends Cr{static get type(){return"SubgroupFunctionNode"}constructor(e,t=null,n=null){super(),this.method=e,this.aNode=t,this.bNode=n}getInputType(e){let t=this.aNode?this.aNode.getNodeType(e):null,n=this.bNode?this.bNode.getNodeType(e):null,r=e.isMatrix(t)?0:e.getTypeLength(t),s=e.isMatrix(n)?0:e.getTypeLength(n);return r>s?t:n}generateNodeType(e){let t=this.method;return t===i.SUBGROUP_ELECT?"bool":t===i.SUBGROUP_BALLOT?"uvec4":this.getInputType(e)}generate(e,t){let n=this.method,r=this.getNodeType(e),s=this.getInputType(e),o=this.aNode,a=this.bNode,l=[];if(n===i.SUBGROUP_BROADCAST||n===i.SUBGROUP_SHUFFLE||n===i.QUAD_BROADCAST){let u=a.getNodeType(e);l.push(o.build(e,r),a.build(e,u==="float"?"int":r))}else n===i.SUBGROUP_SHUFFLE_XOR||n===i.SUBGROUP_SHUFFLE_DOWN||n===i.SUBGROUP_SHUFFLE_UP?l.push(o.build(e,r),a.build(e,"uint")):(o!==null&&l.push(o.build(e,s)),a!==null&&l.push(a.build(e,s)));let c=l.length===0?"()":`( ${l.join(", ")} )`;return e.format(`${e.getMethod(n,r)}${c}`,r,t)}serialize(e){super.serialize(e),e.method=this.method}deserialize(e){super.deserialize(e),this.method=e.method}};Ot.SUBGROUP_ELECT="subgroupElect";Ot.SUBGROUP_BALLOT="subgroupBallot";Ot.SUBGROUP_ADD="subgroupAdd";Ot.SUBGROUP_INCLUSIVE_ADD="subgroupInclusiveAdd";Ot.SUBGROUP_EXCLUSIVE_AND="subgroupExclusiveAdd";Ot.SUBGROUP_MUL="subgroupMul";Ot.SUBGROUP_INCLUSIVE_MUL="subgroupInclusiveMul";Ot.SUBGROUP_EXCLUSIVE_MUL="subgroupExclusiveMul";Ot.SUBGROUP_AND="subgroupAnd";Ot.SUBGROUP_OR="subgroupOr";Ot.SUBGROUP_XOR="subgroupXor";Ot.SUBGROUP_MIN="subgroupMin";Ot.SUBGROUP_MAX="subgroupMax";Ot.SUBGROUP_ALL="subgroupAll";Ot.SUBGROUP_ANY="subgroupAny";Ot.SUBGROUP_BROADCAST_FIRST="subgroupBroadcastFirst";Ot.QUAD_SWAP_X="quadSwapX";Ot.QUAD_SWAP_Y="quadSwapY";Ot.QUAD_SWAP_DIAGONAL="quadSwapDiagonal";Ot.SUBGROUP_BROADCAST="subgroupBroadcast";Ot.SUBGROUP_SHUFFLE="subgroupShuffle";Ot.SUBGROUP_SHUFFLE_XOR="subgroupShuffleXor";Ot.SUBGROUP_SHUFFLE_UP="subgroupShuffleUp";Ot.SUBGROUP_SHUFFLE_DOWN="subgroupShuffleDown";Ot.QUAD_BROADCAST="quadBroadcast";var $Ce=ct(Ot,Ot.SUBGROUP_ELECT).setParameterLength(0),YCe=ct(Ot,Ot.SUBGROUP_BALLOT).setParameterLength(1),ZCe=ct(Ot,Ot.SUBGROUP_ADD).setParameterLength(1),KCe=ct(Ot,Ot.SUBGROUP_INCLUSIVE_ADD).setParameterLength(1),QCe=ct(Ot,Ot.SUBGROUP_EXCLUSIVE_AND).setParameterLength(1),JCe=ct(Ot,Ot.SUBGROUP_MUL).setParameterLength(1),eRe=ct(Ot,Ot.SUBGROUP_INCLUSIVE_MUL).setParameterLength(1),tRe=ct(Ot,Ot.SUBGROUP_EXCLUSIVE_MUL).setParameterLength(1),nRe=ct(Ot,Ot.SUBGROUP_AND).setParameterLength(1),iRe=ct(Ot,Ot.SUBGROUP_OR).setParameterLength(1),rRe=ct(Ot,Ot.SUBGROUP_XOR).setParameterLength(1),sRe=ct(Ot,Ot.SUBGROUP_MIN).setParameterLength(1),oRe=ct(Ot,Ot.SUBGROUP_MAX).setParameterLength(1),aRe=ct(Ot,Ot.SUBGROUP_ALL).setParameterLength(0),lRe=ct(Ot,Ot.SUBGROUP_ANY).setParameterLength(0),cRe=ct(Ot,Ot.SUBGROUP_BROADCAST_FIRST).setParameterLength(2),uRe=ct(Ot,Ot.QUAD_SWAP_X).setParameterLength(1),hRe=ct(Ot,Ot.QUAD_SWAP_Y).setParameterLength(1),fRe=ct(Ot,Ot.QUAD_SWAP_DIAGONAL).setParameterLength(1),dRe=ct(Ot,Ot.SUBGROUP_BROADCAST).setParameterLength(2),pRe=ct(Ot,Ot.SUBGROUP_SHUFFLE).setParameterLength(2),mRe=ct(Ot,Ot.SUBGROUP_SHUFFLE_XOR).setParameterLength(2),ARe=ct(Ot,Ot.SUBGROUP_SHUFFLE_UP).setParameterLength(2),gRe=ct(Ot,Ot.SUBGROUP_SHUFFLE_DOWN).setParameterLength(2),vRe=ct(Ot,Ot.QUAD_BROADCAST).setParameterLength(1),SR;function PI(i){SR=SR||new WeakMap;let e=SR.get(i);return e===void 0&&SR.set(i,e={}),e}function LI(i){let e=PI(i);return e.shadowMatrix||(e.shadowMatrix=Xt("mat4").setGroup(Jt).onRenderUpdate(t=>((i.castShadow!==!0||t.renderer.shadowMap.enabled===!1)&&(i.shadow.camera.coordinateSystem!==t.camera.coordinateSystem&&(i.shadow.camera.coordinateSystem=t.camera.coordinateSystem,i.shadow.camera.updateProjectionMatrix()),i.shadow.updateMatrices(i)),i.shadow.matrix)))}function xse(i,e=_f){let t=LI(i).mul(e);return t.xyz.div(t.w)}function lV(i){let e=PI(i);return e.position||(e.position=Xt(new re).setGroup(Jt).onRenderUpdate((t,n)=>n.value.setFromMatrixPosition(i.matrixWorld)))}function yse(i){let e=PI(i);return e.targetPosition||(e.targetPosition=Xt(new re).setGroup(Jt).onRenderUpdate((t,n)=>n.value.setFromMatrixPosition(i.target.matrixWorld)))}function cV(i){let e=PI(i);return e.viewPosition||(e.viewPosition=Xt(new re).setGroup(Jt).onRenderUpdate(({camera:t},n)=>{n.value=n.value||new re,n.value.setFromMatrixPosition(i.matrixWorld),n.value.applyMatrix4(t.matrixWorldInverse)}))}var uV=i=>_m.transformDirection(lV(i).sub(yse(i))),_Re=Zd("vec3","totalDiffuse"),xRe=Zd("vec3","totalSpecular"),yRe=Zd("vec3","outgoingLight"),bRe=i=>i.sort((e,t)=>e.id-t.id),wRe=(i,e)=>{for(let t of e)if(t.isAnalyticLightNode&&t.light.id===i)return t;return null},kO=new WeakMap,Uw=[],vS=class extends Kt{static get type(){return"LightsNode"}constructor(){super("vec3"),this.totalDiffuseNode=_Re,this.totalSpecularNode=xRe,this.outgoingLightNode=yRe,this._lights=[],this.global=!0}customCacheKey(){let e=this._lights;for(let n=0;n<e.length;n++){let r=e[n];if(Uw.push(r.id),Uw.push(r.castShadow?1:0),r.isSpotLight===!0){let s=r.map!==null?r.map.id:-1,o=r.colorNode?r.colorNode.getCacheKey():-1;Uw.push(s,o)}}let t=ES(Uw);return Uw.length=0,t}getHash(e){let t=e.getDataFromNode(this);if(t.lightNodesHash===void 0){let n=this.setupLightsNode(e);t.lightNodes=n;let r=[];for(let s of n)r.push(s.getHash());t.lightNodesHash="lights-"+r.join(",")}return t.lightNodesHash}analyze(e){let t=e.getNodeProperties(this);for(let n of t.nodes)n.build(e);t.outputNode.build(e)}setupLightsNode(e){let t=e.getDataFromNode(this),n=[],r=t.lightNodes||null,s=e.context.materialLightings,o=bRe([...s,...this._lights]),a=e.renderer.library;for(let l of o)if(l.isNode)n.push(l);else{let c=null;if(r!==null&&(c=wRe(l.id,r)),c===null){let u=a.getLightNodeClass(l.constructor);if(u===null){Xe(`LightsNode.setupNodeLights: Light node not found for ${l.constructor.name}`);continue}kO.has(l)===!1&&kO.set(l,new u(l)),c=kO.get(l)}n.push(c)}return n}setupDirectLight(e,t,n){let{lightingModel:r,reflectedLight:s}=e.context;r.direct({...n,lightNode:t,reflectedLight:s},e)}setupDirectRectAreaLight(e,t,n){let{lightingModel:r,reflectedLight:s}=e.context;r.directRectArea({...n,lightNode:t,reflectedLight:s},e)}setupLights(e,t){for(let n of t)n.build(e)}getLightNodes(e){let t=e.getDataFromNode(this);return t.lightNodes===void 0&&(t.lightNodes=this.setupLightsNode(e)),t.lightNodes}setup(e){let t=e.lightsNode;e.lightsNode=this;let n=this.outgoingLightNode,r=e.context,s=r.lightingModel,o=e.getNodeProperties(this);if(s){let{totalDiffuseNode:a,totalSpecularNode:l}=this;r.outgoingLight=n;let c=e.addStack();o.nodes=c.nodes,s.start(e);let{backdrop:u,backdropAlpha:f}=r,{directDiffuse:d,directSpecular:A,indirectDiffuse:y,indirectSpecular:w}=r.reflectedLight,S=d.add(y);u!==null&&(f!==null?S=pe(f.mix(S,u)):S=pe(u)),a.assign(S),l.assign(A.add(w)),n.assign(a.add(l)),s.finish(e),n=n.bypass(e.removeStack())}else o.nodes=[];return e.lightsNode=t,n}setLights(e){return this._lights=e,this}getLights(){return this._lights}get hasLights(){return this._lights.length>0}},SRe=(i=[])=>new vS().setLights(i),fk=class extends Kt{static get type(){return"ShadowBaseNode"}constructor(e){super(),this.light=e,this.updateBeforeType=yn.RENDER,this.isShadowBaseNode=!0}setupShadowPosition({context:e,material:t}){hV.assign(t.receivedShadowPositionNode||e.shadowPositionWorld||_f)}},hV=Zd("vec3","shadowPositionWorld");function TRe(i,e={}){return e.toneMapping=i.toneMapping,e.toneMappingExposure=i.toneMappingExposure,e.outputColorSpace=i.outputColorSpace,e.renderTarget=i.getRenderTarget(),e.activeCubeFace=i.getActiveCubeFace(),e.activeMipmapLevel=i.getActiveMipmapLevel(),e.renderObjectFunction=i.getRenderObjectFunction(),e.pixelRatio=i.getPixelRatio(),e.mrt=i.getMRT(),e.clearColor=i.getClearColor(e.clearColor||new zt),e.clearAlpha=i.getClearAlpha(),e.autoClear=i.autoClear,e.scissorTest=i.getScissorTest(),e}function ERe(i,e){return e=TRe(i,e),i.setMRT(null),i.setRenderObjectFunction(null),i.setClearColor(0,1),i.autoClear=!0,e}function MRe(i,e){i.toneMapping=e.toneMapping,i.toneMappingExposure=e.toneMappingExposure,i.outputColorSpace=e.outputColorSpace,i.setRenderTarget(e.renderTarget,e.activeCubeFace,e.activeMipmapLevel),i.setRenderObjectFunction(e.renderObjectFunction),i.setPixelRatio(e.pixelRatio),i.setMRT(e.mrt),i.setClearColor(e.clearColor,e.clearAlpha),i.autoClear=e.autoClear,i.setScissorTest(e.scissorTest)}function CRe(i,e={}){return e.background=i.background,e.backgroundNode=i.backgroundNode,e.overrideMaterial=i.overrideMaterial,e}function RRe(i,e){return e=CRe(i,e),i.background=null,i.backgroundNode=null,i.overrideMaterial=null,e}function IRe(i,e){i.background=e.background,i.backgroundNode=e.backgroundNode,i.overrideMaterial=e.overrideMaterial}function PRe(i,e,t){return t=ERe(i,t),t=RRe(e,t),t}function LRe(i,e,t){MRe(i,t),IRe(e,t)}var P4=new WeakMap,bse=me(({depthTexture:i,shadowCoord:e,depthLayer:t})=>{let n=fi(i,e.xy).setName("t_basic");return i.isArrayTexture&&(n=n.depth(t)),n.compare(e.z)}),wse=me(({depthTexture:i,shadowCoord:e,shadow:t,depthLayer:n})=>{let r=(u,f)=>{let d=fi(i,u);return i.isArrayTexture&&(d=d.depth(n)),d.compare(f)},s=mr("mapSize","vec2",t).setGroup(Jt),o=mr("radius","float",t).setGroup(Jt),a=dt(1).div(s),l=o.mul(a.x),c=iV(s1.xy).mul(6.28318530718);return Ls(r(e.xy.add(Wu(0,5,c).mul(l)),e.z),r(e.xy.add(Wu(1,5,c).mul(l)),e.z),r(e.xy.add(Wu(2,5,c).mul(l)),e.z),r(e.xy.add(Wu(3,5,c).mul(l)),e.z),r(e.xy.add(Wu(4,5,c).mul(l)),e.z)).mul(1/5)}),Sse=me(({depthTexture:i,shadowCoord:e,shadow:t,depthLayer:n})=>{let r=mr("mapSize","vec2",t).setGroup(Jt),s=dt(1).div(r),o=e.xy,a=$u(o.mul(r).add(.5)).toConst();o.subAssign(a.sub(.5).mul(s));let l=A=>{let y=fi(i,o).offset(A).gather();return i.isArrayTexture&&(y=y.depth(n)),y.compare(e.z)},c=l(kr(-1,1)).toConst(),u=l(kr(1,1)).toConst(),f=l(kr(-1,-1)).toConst(),d=l(kr(1,-1)).toConst();return Ls(Qn(c.x,u.y,a.x).add(c.y).add(u.x).mul(a.y),Qn(c.w,u.z,a.x).add(c.z).add(u.w),Qn(f.x,d.y,a.x).add(f.y).add(d.x),Qn(f.w,d.z,a.x).add(f.z).add(d.w).mul(a.y.oneMinus())).mul(1/9)}),Tse=me(({depthTexture:i,shadowCoord:e,depthLayer:t},n)=>{let r=fi(i).sample(e.xy);i.isArrayTexture&&(r=r.depth(t)),r=r.rg;let s=r.x,o=zr(1e-7,r.y.mul(r.y)),a=n.renderer.reversedDepthBuffer?$g(s,e.z):$g(e.z,s),l=oe(1).toVar();return $t(a.notEqual(1),()=>{let c=e.z.sub(s),u=o.div(o.add(c.mul(c)));u=Yu(ai(u,.3).div(.65)),l.assign(zr(a,u))}),l}),Ese=i=>{let e=P4.get(i);return e===void 0&&(e=new Rr,e.colorNode=Ft(0,0,0,1),e.isShadowPassMaterial=!0,e.name="ShadowMaterial",e.blending=ps,e.fog=!1,P4.set(i,e)),e},Mse=i=>{let e=P4.get(i);e!==void 0&&(e.dispose(),P4.delete(i))},nte=new Sf,U_=[],Cse=(i,e,t,n)=>{U_[0]=i,U_[1]=e;let r=nte.get(U_);return(r===void 0||r.shadowType!==t||r.useVelocity!==n)&&(r=(s,o,a,l,c,u,f,d,A)=>{(s.castShadow===!0||s.receiveShadow&&t===Vc)&&(n&&(Bte(s).useVelocity=!0),s.onBeforeShadow(i,s,a,e.camera,l,o.overrideMaterial,u),i.renderObject(s,o,a,l,c,u,f,d,A),s.onAfterShadow(i,s,a,e.camera,l,o.overrideMaterial,u))},r.shadowType=t,r.useVelocity=n,nte.set(U_,r)),U_[0]=null,U_[1]=null,r},DRe=me(({samples:i,radius:e,size:t,shadowPass:n,depthLayer:r})=>{let s=oe(0).toVar("meanVertical"),o=oe(0).toVar("squareMeanVertical"),a=i.lessThanEqual(oe(1)).select(oe(0),oe(2).div(i.sub(1))),l=i.lessThanEqual(oe(1)).select(oe(0),oe(-1));Oi({start:de(0),end:de(i),type:"int",condition:"<"},({i:u})=>{let f=l.add(oe(u).mul(a)),d=n.sample(Ls(s1.xy,dt(0,f).mul(e)).div(t));n.value.isArrayTexture&&(d=d.depth(r)),d=d.x,s.addAssign(d),o.addAssign(d.mul(d))}),s.divAssign(i),o.divAssign(i);let c=Ja(o.sub(s.mul(s)).max(0));return dt(s,c)}),NRe=me(({samples:i,radius:e,size:t,shadowPass:n,depthLayer:r})=>{let s=oe(0).toVar("meanHorizontal"),o=oe(0).toVar("squareMeanHorizontal"),a=i.lessThanEqual(oe(1)).select(oe(0),oe(2).div(i.sub(1))),l=i.lessThanEqual(oe(1)).select(oe(0),oe(-1));Oi({start:de(0),end:de(i),type:"int",condition:"<"},({i:u})=>{let f=l.add(oe(u).mul(a)),d=n.sample(Ls(s1.xy,dt(f,0).mul(e)).div(t));n.value.isArrayTexture&&(d=d.depth(r)),s.addAssign(d.x),o.addAssign(Ls(d.y.mul(d.y),d.x.mul(d.x)))}),s.divAssign(i),o.divAssign(i);let c=Ja(o.sub(s.mul(s)).max(0));return dt(s,c)}),FRe=[bse,wse,Sse,Tse],zO,TR=new gS,L4=class extends fk{static get type(){return"ShadowNode"}constructor(e,t=null){super(e),this.shadow=t||e.shadow,this.shadowMap=null,this.vsmShadowMapVertical=null,this.vsmShadowMapHorizontal=null,this.vsmMaterialVertical=null,this.vsmMaterialHorizontal=null,this._node=null,this._currentShadowType=null,this._cameraFrameId=new WeakMap,this.isShadowNode=!0,this.depthLayer=0}setupShadowFilter(e,{filterFn:t,depthTexture:n,shadowCoord:r,shadow:s,depthLayer:o}){let a=r.x.greaterThanEqual(0).and(r.x.lessThanEqual(1)).and(r.y.greaterThanEqual(0)).and(r.y.lessThanEqual(1)).and(r.z.lessThanEqual(1)),l=t({depthTexture:n,shadowCoord:r,shadow:s,depthLayer:o});return a.select(l,oe(1))}setupShadowCoord(e,t){let{shadow:n}=this,{renderer:r}=e,s=n.biasNode||mr("bias","float",n).setGroup(Jt),o=t,a;if(n.camera.isOrthographicCamera||r.logarithmicDepthBuffer!==!0)o=o.xyz.div(o.w),a=o.z;else{let l=o.w;o=o.xy.div(l);let c=mr("near","float",n.camera).setGroup(Jt),u=mr("far","float",n.camera).setGroup(Jt);a=EI(l.negate(),c,u)}return o=pe(o.x,o.y.oneMinus(),r.reversedDepthBuffer?a.sub(s):a.add(s)),o}getShadowFilterFn(e){return FRe[e]}setupRenderTarget(e,t){let n=new Cs(e.mapSize.width,e.mapSize.height);n.name="ShadowDepthTexture",n.compareFunction=t.renderer.reversedDepthBuffer?Fu:Xh;let r=t.createRenderTarget(e.mapSize.width,e.mapSize.height);return r.texture.name="ShadowMap",r.texture.type=e.mapType,r.depthTexture=n,{shadowMap:r,depthTexture:n}}setupShadow(e){let{renderer:t,camera:n}=e,{light:r,shadow:s}=this,{depthTexture:o,shadowMap:a}=this.setupRenderTarget(s,e),l=t.shadowMap.type,c=t.hasCompatibility(Dd.TEXTURE_COMPARE);if((l===c0||l===TM)&&c?(o.minFilter=Mi,o.magFilter=Mi):(o.minFilter=Ti,o.magFilter=Ti),s.camera.coordinateSystem=n.coordinateSystem,s.camera.updateProjectionMatrix(),l===Vc&&s.isPointLightShadow!==!0){o.compareFunction=null,a.depth>1?(a._vsmShadowMapVertical||(a._vsmShadowMapVertical=e.createRenderTarget(s.mapSize.width,s.mapSize.height,{format:js,type:Wi,depth:a.depth,depthBuffer:!1}),a._vsmShadowMapVertical.texture.name="VSMVertical"),this.vsmShadowMapVertical=a._vsmShadowMapVertical,a._vsmShadowMapHorizontal||(a._vsmShadowMapHorizontal=e.createRenderTarget(s.mapSize.width,s.mapSize.height,{format:js,type:Wi,depth:a.depth,depthBuffer:!1}),a._vsmShadowMapHorizontal.texture.name="VSMHorizontal"),this.vsmShadowMapHorizontal=a._vsmShadowMapHorizontal):(this.vsmShadowMapVertical=e.createRenderTarget(s.mapSize.width,s.mapSize.height,{format:js,type:Wi,depthBuffer:!1}),this.vsmShadowMapHorizontal=e.createRenderTarget(s.mapSize.width,s.mapSize.height,{format:js,type:Wi,depthBuffer:!1}));let D=fi(o);o.isArrayTexture&&(D=D.depth(this.depthLayer));let L=fi(this.vsmShadowMapVertical.texture);o.isArrayTexture&&(L=L.depth(this.depthLayer));let C=mr("blurSamples","float",s).setGroup(Jt),B=mr("radius","float",s).setGroup(Jt),k=mr("mapSize","vec2",s).setGroup(Jt),z=this.vsmMaterialVertical||(this.vsmMaterialVertical=new Rr);z.fragmentNode=DRe({samples:C,radius:B,size:k,shadowPass:D,depthLayer:this.depthLayer}).context(e.getSharedContext()),z.name="VSMVertical",z=this.vsmMaterialHorizontal||(this.vsmMaterialHorizontal=new Rr),z.fragmentNode=NRe({samples:C,radius:B,size:k,shadowPass:L,depthLayer:this.depthLayer}).context(e.getSharedContext()),z.name="VSMHorizontal"}let u=mr("intensity","float",s).setGroup(Jt),f=mr("normalBias","float",s).setGroup(Jt),d=LI(r),A=xm.mul(f),y;!t.highPrecision||e.material.receivedShadowPositionNode||e.context.shadowPositionWorld?y=d.mul(hV.add(A)):y=Xt("mat4").onObjectUpdate(({object:L},C)=>C.value.multiplyMatrices(d.value,L.matrixWorld)).mul(Er).add(d.mul(Ft(A,0)));let w=this.setupShadowCoord(e,y),S=s.filterNode||this.getShadowFilterFn(t.shadowMap.type)||null;if(S===null)throw new Error("THREE.WebGPURenderer: Shadow map type not supported yet.");let T=l===Vc&&s.isPointLightShadow!==!0?this.vsmShadowMapHorizontal.texture:o,R=this.setupShadowFilter(e,{filterFn:S,shadowTexture:a.texture,depthTexture:T,shadowCoord:w,shadow:s,depthLayer:this.depthLayer}),P;t.shadowMap.transmitted===!0&&(a.texture.isCubeTexture?P=Ka(a.texture,w.xyz):(P=fi(a.texture,w),o.isArrayTexture&&(P=P.depth(this.depthLayer))));let I;P?I=Qn(1,R.rgb.mix(P,1),u.mul(P.a)).toVar():I=Qn(1,R,u).toVar(),this.shadowMap=a,this.shadow.map=a;let F=`${this.light.type} Shadow [ ${this.light.name||"ID: "+this.light.id} ]`;return P&&I.toInspector(`${F} / Color`,()=>this.shadowMap.texture.isCubeTexture?Ka(this.shadowMap.texture,r7()):fi(this.shadowMap.texture)),I.toInspector(`${F} / Depth`,()=>{let D=mr("near","float",this.shadow.camera),L=mr("far","float",this.shadow.camera),C;this.shadowMap.texture.isCubeTexture?C=Ka(this.shadowMap.depthTexture,r7()).r:C=fi(this.shadowMap.depthTexture).r;let B;return this.shadow.camera.isPerspectiveCamera?B=TI(C,D,L):B=Pre(C,D,L),B=Hg(B,D,L),B.oneMinus()})}setup(e){if(e.renderer.shadowMap.enabled!==!1)return me(()=>{let t=e.renderer.shadowMap.type;this._currentShadowType!==t&&(this._reset(),this._node=null);let n=this._node;return this.setupShadowPosition(e),n===null&&(this._node=n=this.setupShadow(e),this._currentShadowType=t),e.material.receivedShadowNode&&(n=e.material.receivedShadowNode(n)),n})()}renderShadow(e){let{shadow:t,shadowMap:n,light:r}=this,{renderer:s,scene:o}=e;t.updateMatrices(r),n.setSize(t.mapSize.width,t.mapSize.height,n.depth);let a=o.name;o.name=`Shadow Map [ ${r.name||"ID: "+r.id} ]`,s.render(o,t.camera),o.name=a}updateShadow(e){let{shadowMap:t,light:n,shadow:r}=this,{renderer:s,scene:o,camera:a}=e,l=s.shadowMap.type,c=t.depthTexture.version;this._depthVersionCached=c;let u=r.camera.layers.mask;(r.camera.layers.mask&4294967294)===0&&(r.camera.layers.mask=a.layers.mask);let f=s.getRenderObjectFunction(),d=s.getMRT(),A=d?d.has("velocity"):!1;zO=PRe(s,o,zO),o.overrideMaterial=Ese(n),s.setRenderObjectFunction(Cse(s,r,l,A)),s.setClearColor(0,0),s.setRenderTarget(t),this.renderShadow(e),s.setRenderObjectFunction(f),l===Vc&&r.isPointLightShadow!==!0&&this.vsmPass(s),r.camera.layers.mask=u,LRe(s,o,zO)}vsmPass(e){let{shadow:t}=this,n=this.shadowMap.depth;this.vsmShadowMapVertical.setSize(t.mapSize.width,t.mapSize.height,n),this.vsmShadowMapHorizontal.setSize(t.mapSize.width,t.mapSize.height,n),e.setRenderTarget(this.vsmShadowMapVertical),TR.material=this.vsmMaterialVertical,TR.render(e),e.setRenderTarget(this.vsmShadowMapHorizontal),TR.material=this.vsmMaterialHorizontal,TR.render(e)}dispose(){this._reset(),super.dispose()}_reset(){this._currentShadowType=null,Mse(this.light),this.shadowMap&&(this.shadowMap.dispose(),this.shadowMap=null),this.vsmShadowMapVertical!==null&&(this.vsmShadowMapVertical.dispose(),this.vsmShadowMapVertical=null,this.vsmMaterialVertical.dispose(),this.vsmMaterialVertical=null),this.vsmShadowMapHorizontal!==null&&(this.vsmShadowMapHorizontal.dispose(),this.vsmShadowMapHorizontal=null,this.vsmMaterialHorizontal.dispose(),this.vsmMaterialHorizontal=null)}updateBefore(e){let{shadow:t}=this,n=t.needsUpdate||t.autoUpdate;n&&(this._cameraFrameId[e.camera]===e.frameId&&(n=!1),this._cameraFrameId[e.camera]=e.frameId),n&&(this.updateShadow(e),this.shadowMap.depthTexture.version===this._depthVersionCached&&(t.needsUpdate=!1))}},Rse=(i,e)=>new L4(i,e),BRe=new zt,ite=new cn,kw=new re,VO=new re,ORe=[new re(1,0,0),new re(-1,0,0),new re(0,-1,0),new re(0,1,0),new re(0,0,1),new re(0,0,-1)],URe=[new re(0,-1,0),new re(0,-1,0),new re(0,0,-1),new re(0,0,1),new re(0,-1,0),new re(0,-1,0)],kRe=[new re(1,0,0),new re(-1,0,0),new re(0,1,0),new re(0,-1,0),new re(0,0,1),new re(0,0,-1)],zRe=[new re(0,-1,0),new re(0,-1,0),new re(0,0,1),new re(0,0,-1),new re(0,-1,0),new re(0,-1,0)],Ise=me(({depthTexture:i,bd3D:e,dp:t})=>Ka(i,e).compare(t)),Pse=me(({depthTexture:i,bd3D:e,dp:t,shadow:n})=>{let r=mr("radius","float",n).setGroup(Jt),s=mr("mapSize","vec2",n).setGroup(Jt),o=r.div(s.x),a=fr(e),l=xa($d(e,a.x.greaterThan(a.z).select(pe(0,1,0),pe(1,0,0)))),c=$d(e,l),u=iV(s1.xy).mul(6.28318530718),f=Wu(0,5,u),d=Wu(1,5,u),A=Wu(2,5,u),y=Wu(3,5,u),w=Wu(4,5,u);return Ka(i,e.add(l.mul(f.x).add(c.mul(f.y)).mul(o))).compare(t).add(Ka(i,e.add(l.mul(d.x).add(c.mul(d.y)).mul(o))).compare(t)).add(Ka(i,e.add(l.mul(A.x).add(c.mul(A.y)).mul(o))).compare(t)).add(Ka(i,e.add(l.mul(y.x).add(c.mul(y.y)).mul(o))).compare(t)).add(Ka(i,e.add(l.mul(w.x).add(c.mul(w.y)).mul(o))).compare(t)).mul(1/5)}),VRe=me(({filterFn:i,depthTexture:e,shadowCoord:t,shadow:n},r)=>{let s=t.xyz.toConst(),o=s.abs().toConst(),a=o.x.max(o.y).max(o.z),l=Xt("float").setGroup(Jt).onRenderUpdate(()=>n.camera.near),c=Xt("float").setGroup(Jt).onRenderUpdate(()=>n.camera.far),u=mr("bias","float",n).setGroup(Jt),f=oe(1).toVar();return $t(a.sub(c).lessThanEqual(0).and(a.sub(l).greaterThanEqual(0)),()=>{let d;r.renderer.reversedDepthBuffer?(d=Lre(a.negate(),l,c),d.subAssign(u)):r.renderer.logarithmicDepthBuffer?(d=EI(a.negate(),l,c),d.addAssign(u)):(d=Zz(a.negate(),l,c),d.addAssign(u));let A=s.normalize();f.assign(i({depthTexture:e,bd3D:A,dp:d,shadow:n}))}),f}),dk=class extends L4{static get type(){return"PointShadowNode"}constructor(e,t=null){super(e,t)}getShadowFilterFn(e){return e===C8?Ise:Pse}setupShadowCoord(e,t){return t}setupShadowFilter(e,{filterFn:t,depthTexture:n,shadowCoord:r,shadow:s}){return VRe({filterFn:t,depthTexture:n,shadowCoord:r,shadow:s})}setupRenderTarget(e,t){let n=new $v(e.mapSize.width);n.name="PointShadowDepthTexture",n.compareFunction=t.renderer.reversedDepthBuffer?Fu:Xh;let r=t.createCubeRenderTarget(e.mapSize.width);return r.texture.name="PointShadowMap",r.depthTexture=n,{shadowMap:r,depthTexture:n}}renderShadow(e){let{shadow:t,shadowMap:n,light:r}=this,{renderer:s,scene:o}=e,a=t.camera,l=t.matrix,c=s.coordinateSystem===_l,u=c?ORe:kRe,f=c?URe:zRe;n.setSize(t.mapSize.width,t.mapSize.width);let d=s.autoClear,A=s.getClearColor(BRe),y=s.getClearAlpha();s.autoClear=!1,s.setClearColor(t.clearColor,t.clearAlpha);for(let w=0;w<6;w++){s.setRenderTarget(n,w),s.clear();let S=r.distance||a.far;S!==a.far&&(a.far=S,a.updateProjectionMatrix()),kw.setFromMatrixPosition(r.matrixWorld),a.position.copy(kw),VO.copy(a.position),VO.add(u[w]),a.up.copy(f[w]),a.lookAt(VO),a.updateMatrixWorld(),l.makeTranslation(-kw.x,-kw.y,-kw.z),ite.multiplyMatrices(a.projectionMatrix,a.matrixWorldInverse),t._frustum.setFromProjectionMatrix(ite,a.coordinateSystem,a.reversedDepth);let T=o.name;o.name=`Point Light Shadow [ ${r.name||"ID: "+r.id} ] - Face ${w+1}`,s.render(o,a),o.name=T}s.autoClear=d,s.setClearColor(A,y)}},Lse=(i,e)=>new dk(i,e),Yd=class extends mm{static get type(){return"AnalyticLightNode"}constructor(e=null){super(),this.light=e,this.color=new zt,this.colorNode=e&&e.colorNode||Xt(this.color).setGroup(Jt),this.baseColorNode=null,this.shadowNode=null,this.shadowColorNode=null,this.isAnalyticLightNode=!0,this.updateType=yn.FRAME,e&&e.shadow&&(this._shadowDisposeListener=()=>{this.disposeShadow()},e.addEventListener("dispose",this._shadowDisposeListener))}dispose(){this._shadowDisposeListener&&this.light.removeEventListener("dispose",this._shadowDisposeListener),super.dispose()}disposeShadow(){this.shadowNode!==null&&(this.shadowNode.dispose(),this.shadowNode=null),this.shadowColorNode=null,this.baseColorNode!==null&&(this.colorNode=this.baseColorNode,this.baseColorNode=null)}getHash(){return this.light.uuid}getLightVector(e){return cV(this.light).sub(e.context.positionView||xs)}setupDirect(){}setupDirectRectArea(){}setupShadowNode(){return Rse(this.light)}setupShadow(e){let{renderer:t}=e;if(t.shadowMap.enabled===!1)return;let n=this.shadowColorNode;if(n===null){let r=this.light.shadow.shadowNode,s;r!==void 0?s=Ht(r):s=this.setupShadowNode(),this.shadowNode=s,this.shadowColorNode=n=this.colorNode.mul(s),this.baseColorNode=this.colorNode}e.context.getShadow&&(n=e.context.getShadow(this,e)),this.colorNode=n}setup(e){this.colorNode=this.baseColorNode||this.colorNode,this.light.castShadow?e.object.receiveShadow&&this.setupShadow(e):this.shadowNode!==null&&(this.shadowNode.dispose(),this.shadowNode=null,this.shadowColorNode=null);let t=this.setupDirect(e),n=this.setupDirectRectArea(e);t&&e.lightsNode.setupDirectLight(e,this,t),n&&e.lightsNode.setupDirectRectAreaLight(e,this,n)}update(){let{light:e}=this;this.color.copy(e.color).multiplyScalar(e.intensity)}},fV=me(({lightDistance:i,cutoffDistance:e,decayExponent:t})=>{let n=i.pow(t).max(.01).reciprocal();return e.greaterThan(0).select(n.mul(i.div(e).pow4().oneMinus().clamp().pow2()),n)}),Dse=({color:i,lightVector:e,cutoffDistance:t,decayExponent:n})=>{let r=e.normalize(),s=e.length(),o=fV({lightDistance:s,cutoffDistance:t,decayExponent:n}),a=i.mul(o);return{lightDirection:r,lightColor:a}},pk=class extends Yd{static get type(){return"PointLightNode"}constructor(e=null){super(e),this.cutoffDistanceNode=Xt(0).setGroup(Jt),this.decayExponentNode=Xt(2).setGroup(Jt)}update(e){let{light:t}=this;super.update(e),this.cutoffDistanceNode.value=t.distance,this.decayExponentNode.value=t.decay}setupShadowNode(){return Lse(this.light)}setupDirect(e){return Dse({color:this.colorNode,lightVector:this.getLightVector(e),cutoffDistance:this.cutoffDistanceNode,decayExponent:this.decayExponentNode})}},GRe=me(([i=Ui()])=>{let e=i.mul(2),t=e.x.floor(),n=e.y.floor();return t.add(n).mod(2).sign()}),qRe=me(([i=Ui()],{renderer:e,material:t})=>{let n=Az(i.mul(2).sub(1)),r;if(t.alphaToCoverage&&e.currentSamples>0){let s=oe(n.fwidth()).toVar();r=fc(s.oneMinus(),s.add(1),n).oneMinus()}else r=_a(n.greaterThan(1),0,1);return r}),iS=me(([i,e,t])=>{let n=oe(t).toVar(),r=oe(e).toVar(),s=uc(i).toVar();return _a(s,r,n).uniformFlow()}).setLayout({name:"mx_select",type:"float",inputs:[{name:"b",type:"bool"},{name:"t",type:"float"},{name:"f",type:"float"}]}),D4=me(([i,e])=>{let t=uc(e).toVar(),n=oe(i).toVar();return _a(t,n.negate(),n).uniformFlow()}).setLayout({name:"mx_negate_if",type:"float",inputs:[{name:"val",type:"float"},{name:"b",type:"bool"}]}),Ps=me(([i])=>{let e=oe(i).toVar();return de(gf(e))}).setLayout({name:"mx_floor",type:"int",inputs:[{name:"x",type:"float"}]}),Mr=me(([i,e])=>{let t=oe(i).toVar();return e.assign(Ps(t)),t.sub(oe(e))}),HRe=me(([i,e,t,n,r,s])=>{let o=oe(s).toVar(),a=oe(r).toVar(),l=oe(n).toVar(),c=oe(t).toVar(),u=oe(e).toVar(),f=oe(i).toVar(),d=oe(ai(1,a)).toVar();return ai(1,o).mul(f.mul(d).add(u.mul(a))).add(o.mul(c.mul(d).add(l.mul(a))))}).setLayout({name:"mx_bilerp_0",type:"float",inputs:[{name:"v0",type:"float"},{name:"v1",type:"float"},{name:"v2",type:"float"},{name:"v3",type:"float"},{name:"s",type:"float"},{name:"t",type:"float"}]}),WRe=me(([i,e,t,n,r,s])=>{let o=oe(s).toVar(),a=oe(r).toVar(),l=pe(n).toVar(),c=pe(t).toVar(),u=pe(e).toVar(),f=pe(i).toVar(),d=oe(ai(1,a)).toVar();return ai(1,o).mul(f.mul(d).add(u.mul(a))).add(o.mul(c.mul(d).add(l.mul(a))))}).setLayout({name:"mx_bilerp_1",type:"vec3",inputs:[{name:"v0",type:"vec3"},{name:"v1",type:"vec3"},{name:"v2",type:"vec3"},{name:"v3",type:"vec3"},{name:"s",type:"float"},{name:"t",type:"float"}]}),Nse=Zo([HRe,WRe]),jRe=me(([i,e,t,n,r,s,o,a,l,c,u])=>{let f=oe(u).toVar(),d=oe(c).toVar(),A=oe(l).toVar(),y=oe(a).toVar(),w=oe(o).toVar(),S=oe(s).toVar(),T=oe(r).toVar(),R=oe(n).toVar(),P=oe(t).toVar(),I=oe(e).toVar(),F=oe(i).toVar(),D=oe(ai(1,A)).toVar(),L=oe(ai(1,d)).toVar();return oe(ai(1,f)).toVar().mul(L.mul(F.mul(D).add(I.mul(A))).add(d.mul(P.mul(D).add(R.mul(A))))).add(f.mul(L.mul(T.mul(D).add(S.mul(A))).add(d.mul(w.mul(D).add(y.mul(A))))))}).setLayout({name:"mx_trilerp_0",type:"float",inputs:[{name:"v0",type:"float"},{name:"v1",type:"float"},{name:"v2",type:"float"},{name:"v3",type:"float"},{name:"v4",type:"float"},{name:"v5",type:"float"},{name:"v6",type:"float"},{name:"v7",type:"float"},{name:"s",type:"float"},{name:"t",type:"float"},{name:"r",type:"float"}]}),XRe=me(([i,e,t,n,r,s,o,a,l,c,u])=>{let f=oe(u).toVar(),d=oe(c).toVar(),A=oe(l).toVar(),y=pe(a).toVar(),w=pe(o).toVar(),S=pe(s).toVar(),T=pe(r).toVar(),R=pe(n).toVar(),P=pe(t).toVar(),I=pe(e).toVar(),F=pe(i).toVar(),D=oe(ai(1,A)).toVar(),L=oe(ai(1,d)).toVar();return oe(ai(1,f)).toVar().mul(L.mul(F.mul(D).add(I.mul(A))).add(d.mul(P.mul(D).add(R.mul(A))))).add(f.mul(L.mul(T.mul(D).add(S.mul(A))).add(d.mul(w.mul(D).add(y.mul(A))))))}).setLayout({name:"mx_trilerp_1",type:"vec3",inputs:[{name:"v0",type:"vec3"},{name:"v1",type:"vec3"},{name:"v2",type:"vec3"},{name:"v3",type:"vec3"},{name:"v4",type:"vec3"},{name:"v5",type:"vec3"},{name:"v6",type:"vec3"},{name:"v7",type:"vec3"},{name:"s",type:"float"},{name:"t",type:"float"},{name:"r",type:"float"}]}),Fse=Zo([jRe,XRe]),$Re=me(([i,e,t])=>{let n=oe(t).toVar(),r=oe(e).toVar(),s=rt(i).toVar(),o=rt(s.bitAnd(rt(7))).toVar(),a=oe(iS(o.lessThan(rt(4)),r,n)).toVar(),l=oe(Tn(2,iS(o.lessThan(rt(4)),n,r))).toVar();return D4(a,uc(o.bitAnd(rt(1)))).add(D4(l,uc(o.bitAnd(rt(2)))))}).setLayout({name:"mx_gradient_float_0",type:"float",inputs:[{name:"hash",type:"uint"},{name:"x",type:"float"},{name:"y",type:"float"}]}),YRe=me(([i,e,t,n])=>{let r=oe(n).toVar(),s=oe(t).toVar(),o=oe(e).toVar(),a=rt(i).toVar(),l=rt(a.bitAnd(rt(15))).toVar(),c=oe(iS(l.lessThan(rt(8)),o,s)).toVar(),u=oe(iS(l.lessThan(rt(4)),s,iS(l.equal(rt(12)).or(l.equal(rt(14))),o,r))).toVar();return D4(c,uc(l.bitAnd(rt(1)))).add(D4(u,uc(l.bitAnd(rt(2)))))}).setLayout({name:"mx_gradient_float_1",type:"float",inputs:[{name:"hash",type:"uint"},{name:"x",type:"float"},{name:"y",type:"float"},{name:"z",type:"float"}]}),So=Zo([$Re,YRe]),ZRe=me(([i,e,t])=>{let n=oe(t).toVar(),r=oe(e).toVar(),s=i1(i).toVar();return pe(So(s.x,r,n),So(s.y,r,n),So(s.z,r,n))}).setLayout({name:"mx_gradient_vec3_0",type:"vec3",inputs:[{name:"hash",type:"uvec3"},{name:"x",type:"float"},{name:"y",type:"float"}]}),KRe=me(([i,e,t,n])=>{let r=oe(n).toVar(),s=oe(t).toVar(),o=oe(e).toVar(),a=i1(i).toVar();return pe(So(a.x,o,s,r),So(a.y,o,s,r),So(a.z,o,s,r))}).setLayout({name:"mx_gradient_vec3_1",type:"vec3",inputs:[{name:"hash",type:"uvec3"},{name:"x",type:"float"},{name:"y",type:"float"},{name:"z",type:"float"}]}),Qc=Zo([ZRe,KRe]),QRe=me(([i])=>{let e=oe(i).toVar();return Tn(.6616,e)}).setLayout({name:"mx_gradient_scale2d_0",type:"float",inputs:[{name:"v",type:"float"}]}),JRe=me(([i])=>{let e=oe(i).toVar();return Tn(.982,e)}).setLayout({name:"mx_gradient_scale3d_0",type:"float",inputs:[{name:"v",type:"float"}]}),e4e=me(([i])=>{let e=pe(i).toVar();return Tn(.6616,e)}).setLayout({name:"mx_gradient_scale2d_1",type:"vec3",inputs:[{name:"v",type:"vec3"}]}),Bse=Zo([QRe,e4e]),t4e=me(([i])=>{let e=pe(i).toVar();return Tn(.982,e)}).setLayout({name:"mx_gradient_scale3d_1",type:"vec3",inputs:[{name:"v",type:"vec3"}]}),Ose=Zo([JRe,t4e]),ac=me(([i,e])=>{let t=de(e).toVar(),n=rt(i).toVar();return n.shiftLeft(t).bitOr(n.shiftRight(de(32).sub(t)))}).setLayout({name:"mx_rotl32",type:"uint",inputs:[{name:"x",type:"uint"},{name:"k",type:"int"}]}),Use=me(([i,e,t])=>{i.subAssign(t),i.bitXorAssign(ac(t,de(4))),t.addAssign(e),e.subAssign(i),e.bitXorAssign(ac(i,de(6))),i.addAssign(t),t.subAssign(e),t.bitXorAssign(ac(e,de(8))),e.addAssign(i),i.subAssign(t),i.bitXorAssign(ac(t,de(16))),t.addAssign(e),e.subAssign(i),e.bitXorAssign(ac(i,de(19))),i.addAssign(t),t.subAssign(e),t.bitXorAssign(ac(e,de(4))),e.addAssign(i)}),PS=me(([i,e,t])=>{let n=rt(t).toVar(),r=rt(e).toVar(),s=rt(i).toVar();return n.bitXorAssign(r),n.subAssign(ac(r,de(14))),s.bitXorAssign(n),s.subAssign(ac(n,de(11))),r.bitXorAssign(s),r.subAssign(ac(s,de(25))),n.bitXorAssign(r),n.subAssign(ac(r,de(16))),s.bitXorAssign(n),s.subAssign(ac(n,de(4))),r.bitXorAssign(s),r.subAssign(ac(s,de(14))),n.bitXorAssign(r),n.subAssign(ac(r,de(24))),n}).setLayout({name:"mx_bjfinal",type:"uint",inputs:[{name:"a",type:"uint"},{name:"b",type:"uint"},{name:"c",type:"uint"}]}),ya=me(([i])=>{let e=rt(i).toVar();return oe(e).div(oe(rt(de(4294967295))))}).setLayout({name:"mx_bits_to_01",type:"float",inputs:[{name:"bits",type:"uint"}]}),xf=me(([i])=>{let e=oe(i).toVar();return e.mul(e).mul(e).mul(e.mul(e.mul(6).sub(15)).add(10))}).setLayout({name:"mx_fade",type:"float",inputs:[{name:"t",type:"float"}]}),n4e=me(([i])=>{let e=de(i).toVar(),t=rt(rt(1)).toVar(),n=rt(rt(de(3735928559)).add(t.shiftLeft(rt(2))).add(rt(13))).toVar();return PS(n.add(rt(e)),n,n)}).setLayout({name:"mx_hash_int_0",type:"uint",inputs:[{name:"x",type:"int"}]}),i4e=me(([i,e])=>{let t=de(e).toVar(),n=de(i).toVar(),r=rt(rt(2)).toVar(),s=rt().toVar(),o=rt().toVar(),a=rt().toVar();return s.assign(o.assign(a.assign(rt(de(3735928559)).add(r.shiftLeft(rt(2))).add(rt(13))))),s.addAssign(rt(n)),o.addAssign(rt(t)),PS(s,o,a)}).setLayout({name:"mx_hash_int_1",type:"uint",inputs:[{name:"x",type:"int"},{name:"y",type:"int"}]}),r4e=me(([i,e,t])=>{let n=de(t).toVar(),r=de(e).toVar(),s=de(i).toVar(),o=rt(rt(3)).toVar(),a=rt().toVar(),l=rt().toVar(),c=rt().toVar();return a.assign(l.assign(c.assign(rt(de(3735928559)).add(o.shiftLeft(rt(2))).add(rt(13))))),a.addAssign(rt(s)),l.addAssign(rt(r)),c.addAssign(rt(n)),PS(a,l,c)}).setLayout({name:"mx_hash_int_2",type:"uint",inputs:[{name:"x",type:"int"},{name:"y",type:"int"},{name:"z",type:"int"}]}),s4e=me(([i,e,t,n])=>{let r=de(n).toVar(),s=de(t).toVar(),o=de(e).toVar(),a=de(i).toVar(),l=rt(rt(4)).toVar(),c=rt().toVar(),u=rt().toVar(),f=rt().toVar();return c.assign(u.assign(f.assign(rt(de(3735928559)).add(l.shiftLeft(rt(2))).add(rt(13))))),c.addAssign(rt(a)),u.addAssign(rt(o)),f.addAssign(rt(s)),Use(c,u,f),c.addAssign(rt(r)),PS(c,u,f)}).setLayout({name:"mx_hash_int_3",type:"uint",inputs:[{name:"x",type:"int"},{name:"y",type:"int"},{name:"z",type:"int"},{name:"xx",type:"int"}]}),o4e=me(([i,e,t,n,r])=>{let s=de(r).toVar(),o=de(n).toVar(),a=de(t).toVar(),l=de(e).toVar(),c=de(i).toVar(),u=rt(rt(5)).toVar(),f=rt().toVar(),d=rt().toVar(),A=rt().toVar();return f.assign(d.assign(A.assign(rt(de(3735928559)).add(u.shiftLeft(rt(2))).add(rt(13))))),f.addAssign(rt(c)),d.addAssign(rt(l)),A.addAssign(rt(a)),Use(f,d,A),f.addAssign(rt(o)),d.addAssign(rt(s)),PS(f,d,A)}).setLayout({name:"mx_hash_int_4",type:"uint",inputs:[{name:"x",type:"int"},{name:"y",type:"int"},{name:"z",type:"int"},{name:"xx",type:"int"},{name:"yy",type:"int"}]}),Xi=Zo([n4e,i4e,r4e,s4e,o4e]),a4e=me(([i,e])=>{let t=de(e).toVar(),n=de(i).toVar(),r=rt(Xi(n,t)).toVar(),s=i1().toVar();return s.x.assign(r.bitAnd(de(255))),s.y.assign(r.shiftRight(de(8)).bitAnd(de(255))),s.z.assign(r.shiftRight(de(16)).bitAnd(de(255))),s}).setLayout({name:"mx_hash_vec3_0",type:"uvec3",inputs:[{name:"x",type:"int"},{name:"y",type:"int"}]}),l4e=me(([i,e,t])=>{let n=de(t).toVar(),r=de(e).toVar(),s=de(i).toVar(),o=rt(Xi(s,r,n)).toVar(),a=i1().toVar();return a.x.assign(o.bitAnd(de(255))),a.y.assign(o.shiftRight(de(8)).bitAnd(de(255))),a.z.assign(o.shiftRight(de(16)).bitAnd(de(255))),a}).setLayout({name:"mx_hash_vec3_1",type:"uvec3",inputs:[{name:"x",type:"int"},{name:"y",type:"int"},{name:"z",type:"int"}]}),Jc=Zo([a4e,l4e]),c4e=me(([i])=>{let e=dt(i).toVar(),t=de().toVar(),n=de().toVar(),r=oe(Mr(e.x,t)).toVar(),s=oe(Mr(e.y,n)).toVar(),o=oe(xf(r)).toVar(),a=oe(xf(s)).toVar(),l=oe(Nse(So(Xi(t,n),r,s),So(Xi(t.add(de(1)),n),r.sub(1),s),So(Xi(t,n.add(de(1))),r,s.sub(1)),So(Xi(t.add(de(1)),n.add(de(1))),r.sub(1),s.sub(1)),o,a)).toVar();return Bse(l)}).setLayout({name:"mx_perlin_noise_float_0",type:"float",inputs:[{name:"p",type:"vec2"}]}),u4e=me(([i])=>{let e=pe(i).toVar(),t=de().toVar(),n=de().toVar(),r=de().toVar(),s=oe(Mr(e.x,t)).toVar(),o=oe(Mr(e.y,n)).toVar(),a=oe(Mr(e.z,r)).toVar(),l=oe(xf(s)).toVar(),c=oe(xf(o)).toVar(),u=oe(xf(a)).toVar(),f=oe(Fse(So(Xi(t,n,r),s,o,a),So(Xi(t.add(de(1)),n,r),s.sub(1),o,a),So(Xi(t,n.add(de(1)),r),s,o.sub(1),a),So(Xi(t.add(de(1)),n.add(de(1)),r),s.sub(1),o.sub(1),a),So(Xi(t,n,r.add(de(1))),s,o,a.sub(1)),So(Xi(t.add(de(1)),n,r.add(de(1))),s.sub(1),o,a.sub(1)),So(Xi(t,n.add(de(1)),r.add(de(1))),s,o.sub(1),a.sub(1)),So(Xi(t.add(de(1)),n.add(de(1)),r.add(de(1))),s.sub(1),o.sub(1),a.sub(1)),l,c,u)).toVar();return Ose(f)}).setLayout({name:"mx_perlin_noise_float_1",type:"float",inputs:[{name:"p",type:"vec3"}]}),dV=Zo([c4e,u4e]),h4e=me(([i])=>{let e=dt(i).toVar(),t=de().toVar(),n=de().toVar(),r=oe(Mr(e.x,t)).toVar(),s=oe(Mr(e.y,n)).toVar(),o=oe(xf(r)).toVar(),a=oe(xf(s)).toVar(),l=pe(Nse(Qc(Jc(t,n),r,s),Qc(Jc(t.add(de(1)),n),r.sub(1),s),Qc(Jc(t,n.add(de(1))),r,s.sub(1)),Qc(Jc(t.add(de(1)),n.add(de(1))),r.sub(1),s.sub(1)),o,a)).toVar();return Bse(l)}).setLayout({name:"mx_perlin_noise_vec3_0",type:"vec3",inputs:[{name:"p",type:"vec2"}]}),f4e=me(([i])=>{let e=pe(i).toVar(),t=de().toVar(),n=de().toVar(),r=de().toVar(),s=oe(Mr(e.x,t)).toVar(),o=oe(Mr(e.y,n)).toVar(),a=oe(Mr(e.z,r)).toVar(),l=oe(xf(s)).toVar(),c=oe(xf(o)).toVar(),u=oe(xf(a)).toVar(),f=pe(Fse(Qc(Jc(t,n,r),s,o,a),Qc(Jc(t.add(de(1)),n,r),s.sub(1),o,a),Qc(Jc(t,n.add(de(1)),r),s,o.sub(1),a),Qc(Jc(t.add(de(1)),n.add(de(1)),r),s.sub(1),o.sub(1),a),Qc(Jc(t,n,r.add(de(1))),s,o,a.sub(1)),Qc(Jc(t.add(de(1)),n,r.add(de(1))),s.sub(1),o,a.sub(1)),Qc(Jc(t,n.add(de(1)),r.add(de(1))),s,o.sub(1),a.sub(1)),Qc(Jc(t.add(de(1)),n.add(de(1)),r.add(de(1))),s.sub(1),o.sub(1),a.sub(1)),l,c,u)).toVar();return Ose(f)}).setLayout({name:"mx_perlin_noise_vec3_1",type:"vec3",inputs:[{name:"p",type:"vec3"}]}),LS=Zo([h4e,f4e]),d4e=me(([i])=>{let e=oe(i).toVar(),t=de(Ps(e)).toVar();return ya(Xi(t))}).setLayout({name:"mx_cell_noise_float_0",type:"float",inputs:[{name:"p",type:"float"}]}),p4e=me(([i])=>{let e=dt(i).toVar(),t=de(Ps(e.x)).toVar(),n=de(Ps(e.y)).toVar();return ya(Xi(t,n))}).setLayout({name:"mx_cell_noise_float_1",type:"float",inputs:[{name:"p",type:"vec2"}]}),m4e=me(([i])=>{let e=pe(i).toVar(),t=de(Ps(e.x)).toVar(),n=de(Ps(e.y)).toVar(),r=de(Ps(e.z)).toVar();return ya(Xi(t,n,r))}).setLayout({name:"mx_cell_noise_float_2",type:"float",inputs:[{name:"p",type:"vec3"}]}),A4e=me(([i])=>{let e=Ft(i).toVar(),t=de(Ps(e.x)).toVar(),n=de(Ps(e.y)).toVar(),r=de(Ps(e.z)).toVar(),s=de(Ps(e.w)).toVar();return ya(Xi(t,n,r,s))}).setLayout({name:"mx_cell_noise_float_3",type:"float",inputs:[{name:"p",type:"vec4"}]}),g4e=Zo([d4e,p4e,m4e,A4e]),v4e=me(([i])=>{let e=oe(i).toVar(),t=de(Ps(e)).toVar();return pe(ya(Xi(t,de(0))),ya(Xi(t,de(1))),ya(Xi(t,de(2))))}).setLayout({name:"mx_cell_noise_vec3_0",type:"vec3",inputs:[{name:"p",type:"float"}]}),_4e=me(([i])=>{let e=dt(i).toVar(),t=de(Ps(e.x)).toVar(),n=de(Ps(e.y)).toVar();return pe(ya(Xi(t,n,de(0))),ya(Xi(t,n,de(1))),ya(Xi(t,n,de(2))))}).setLayout({name:"mx_cell_noise_vec3_1",type:"vec3",inputs:[{name:"p",type:"vec2"}]}),x4e=me(([i])=>{let e=pe(i).toVar(),t=de(Ps(e.x)).toVar(),n=de(Ps(e.y)).toVar(),r=de(Ps(e.z)).toVar();return pe(ya(Xi(t,n,r,de(0))),ya(Xi(t,n,r,de(1))),ya(Xi(t,n,r,de(2))))}).setLayout({name:"mx_cell_noise_vec3_2",type:"vec3",inputs:[{name:"p",type:"vec3"}]}),y4e=me(([i])=>{let e=Ft(i).toVar(),t=de(Ps(e.x)).toVar(),n=de(Ps(e.y)).toVar(),r=de(Ps(e.z)).toVar(),s=de(Ps(e.w)).toVar();return pe(ya(Xi(t,n,r,s,de(0))),ya(Xi(t,n,r,s,de(1))),ya(Xi(t,n,r,s,de(2))))}).setLayout({name:"mx_cell_noise_vec3_3",type:"vec3",inputs:[{name:"p",type:"vec4"}]}),DI=Zo([v4e,_4e,x4e,y4e]),N4=me(([i,e,t,n])=>{let r=oe(n).toVar(),s=oe(t).toVar(),o=de(e).toVar(),a=pe(i).toVar(),l=oe(0).toVar(),c=oe(1).toVar();return Oi(o,()=>{l.addAssign(c.mul(dV(a))),c.mulAssign(r),a.mulAssign(s)}),l}).setLayout({name:"mx_fractal_noise_float",type:"float",inputs:[{name:"p",type:"vec3"},{name:"octaves",type:"int"},{name:"lacunarity",type:"float"},{name:"diminish",type:"float"}]}),NI=me(([i,e,t,n])=>{let r=oe(n).toVar(),s=oe(t).toVar(),o=de(e).toVar(),a=pe(i).toVar(),l=pe(0).toVar(),c=oe(1).toVar();return Oi(o,()=>{l.addAssign(c.mul(LS(a))),c.mulAssign(r),a.mulAssign(s)}),l}).setLayout({name:"mx_fractal_noise_vec3",type:"vec3",inputs:[{name:"p",type:"vec3"},{name:"octaves",type:"int"},{name:"lacunarity",type:"float"},{name:"diminish",type:"float"}]}),b4e=me(([i,e,t,n])=>{let r=oe(n).toVar(),s=oe(t).toVar(),o=de(e).toVar(),a=pe(i).toVar();return dt(N4(a,o,s,r),N4(a.add(pe(de(19),de(193),de(17))),o,s,r))}).setLayout({name:"mx_fractal_noise_vec2",type:"vec2",inputs:[{name:"p",type:"vec3"},{name:"octaves",type:"int"},{name:"lacunarity",type:"float"},{name:"diminish",type:"float"}]}),w4e=me(([i,e,t,n])=>{let r=oe(n).toVar(),s=oe(t).toVar(),o=de(e).toVar(),a=pe(i).toVar(),l=pe(NI(a,o,s,r)).toVar(),c=oe(N4(a.add(pe(de(19),de(193),de(17))),o,s,r)).toVar();return Ft(l,c)}).setLayout({name:"mx_fractal_noise_vec4",type:"vec4",inputs:[{name:"p",type:"vec3"},{name:"octaves",type:"int"},{name:"lacunarity",type:"float"},{name:"diminish",type:"float"}]}),S4e=me(([i,e,t,n,r,s,o])=>{let a=de(o).toVar(),l=oe(s).toVar(),c=de(r).toVar(),u=de(n).toVar(),f=de(t).toVar(),d=de(e).toVar(),A=dt(i).toVar(),y=pe(DI(dt(d.add(u),f.add(c)))).toVar(),w=dt(y.x,y.y).toVar();w.subAssign(.5),w.mulAssign(l),w.addAssign(.5);let S=dt(dt(oe(d),oe(f)).add(w)).toVar(),T=dt(S.sub(A)).toVar();return $t(a.equal(de(2)),()=>fr(T.x).add(fr(T.y))),$t(a.equal(de(3)),()=>zr(fr(T.x),fr(T.y))),ru(T,T)}).setLayout({name:"mx_worley_distance_0",type:"float",inputs:[{name:"p",type:"vec2"},{name:"x",type:"int"},{name:"y",type:"int"},{name:"xoff",type:"int"},{name:"yoff",type:"int"},{name:"jitter",type:"float"},{name:"metric",type:"int"}]}),T4e=me(([i,e,t,n,r,s,o,a,l])=>{let c=de(l).toVar(),u=oe(a).toVar(),f=de(o).toVar(),d=de(s).toVar(),A=de(r).toVar(),y=de(n).toVar(),w=de(t).toVar(),S=de(e).toVar(),T=pe(i).toVar(),R=pe(DI(pe(S.add(A),w.add(d),y.add(f)))).toVar();R.subAssign(.5),R.mulAssign(u),R.addAssign(.5);let P=pe(pe(oe(S),oe(w),oe(y)).add(R)).toVar(),I=pe(P.sub(T)).toVar();return $t(c.equal(de(2)),()=>fr(I.x).add(fr(I.y)).add(fr(I.z))),$t(c.equal(de(3)),()=>zr(fr(I.x),fr(I.y),fr(I.z))),ru(I,I)}).setLayout({name:"mx_worley_distance_1",type:"float",inputs:[{name:"p",type:"vec3"},{name:"x",type:"int"},{name:"y",type:"int"},{name:"z",type:"int"},{name:"xoff",type:"int"},{name:"yoff",type:"int"},{name:"zoff",type:"int"},{name:"jitter",type:"float"},{name:"metric",type:"int"}]}),_x=Zo([S4e,T4e]),E4e=me(([i,e,t])=>{let n=de(t).toVar(),r=oe(e).toVar(),s=dt(i).toVar(),o=de().toVar(),a=de().toVar(),l=dt(Mr(s.x,o),Mr(s.y,a)).toVar(),c=oe(1e6).toVar();return Oi({start:-1,end:de(1),name:"x",condition:"<="},({x:u})=>{Oi({start:-1,end:de(1),name:"y",condition:"<="},({y:f})=>{let d=oe(_x(l,u,f,o,a,r,n)).toVar();c.assign(Rl(c,d))})}),$t(n.equal(de(0)),()=>{c.assign(Ja(c))}),c}).setLayout({name:"mx_worley_noise_float_0",type:"float",inputs:[{name:"p",type:"vec2"},{name:"jitter",type:"float"},{name:"metric",type:"int"}]}),M4e=me(([i,e,t])=>{let n=de(t).toVar(),r=oe(e).toVar(),s=dt(i).toVar(),o=de().toVar(),a=de().toVar(),l=dt(Mr(s.x,o),Mr(s.y,a)).toVar(),c=dt(1e6,1e6).toVar();return Oi({start:-1,end:de(1),name:"x",condition:"<="},({x:u})=>{Oi({start:-1,end:de(1),name:"y",condition:"<="},({y:f})=>{let d=oe(_x(l,u,f,o,a,r,n)).toVar();$t(d.lessThan(c.x),()=>{c.y.assign(c.x),c.x.assign(d)}).ElseIf(d.lessThan(c.y),()=>{c.y.assign(d)})})}),$t(n.equal(de(0)),()=>{c.assign(Ja(c))}),c}).setLayout({name:"mx_worley_noise_vec2_0",type:"vec2",inputs:[{name:"p",type:"vec2"},{name:"jitter",type:"float"},{name:"metric",type:"int"}]}),C4e=me(([i,e,t])=>{let n=de(t).toVar(),r=oe(e).toVar(),s=dt(i).toVar(),o=de().toVar(),a=de().toVar(),l=dt(Mr(s.x,o),Mr(s.y,a)).toVar(),c=pe(1e6,1e6,1e6).toVar();return Oi({start:-1,end:de(1),name:"x",condition:"<="},({x:u})=>{Oi({start:-1,end:de(1),name:"y",condition:"<="},({y:f})=>{let d=oe(_x(l,u,f,o,a,r,n)).toVar();$t(d.lessThan(c.x),()=>{c.z.assign(c.y),c.y.assign(c.x),c.x.assign(d)}).ElseIf(d.lessThan(c.y),()=>{c.z.assign(c.y),c.y.assign(d)}).ElseIf(d.lessThan(c.z),()=>{c.z.assign(d)})})}),$t(n.equal(de(0)),()=>{c.assign(Ja(c))}),c}).setLayout({name:"mx_worley_noise_vec3_0",type:"vec3",inputs:[{name:"p",type:"vec2"},{name:"jitter",type:"float"},{name:"metric",type:"int"}]}),R4e=me(([i,e,t])=>{let n=de(t).toVar(),r=oe(e).toVar(),s=pe(i).toVar(),o=de().toVar(),a=de().toVar(),l=de().toVar(),c=pe(Mr(s.x,o),Mr(s.y,a),Mr(s.z,l)).toVar(),u=oe(1e6).toVar();return Oi({start:-1,end:de(1),name:"x",condition:"<="},({x:f})=>{Oi({start:-1,end:de(1),name:"y",condition:"<="},({y:d})=>{Oi({start:-1,end:de(1),name:"z",condition:"<="},({z:A})=>{let y=oe(_x(c,f,d,A,o,a,l,r,n)).toVar();u.assign(Rl(u,y))})})}),$t(n.equal(de(0)),()=>{u.assign(Ja(u))}),u}).setLayout({name:"mx_worley_noise_float_1",type:"float",inputs:[{name:"p",type:"vec3"},{name:"jitter",type:"float"},{name:"metric",type:"int"}]}),I4e=Zo([E4e,R4e]),P4e=me(([i,e,t])=>{let n=de(t).toVar(),r=oe(e).toVar(),s=pe(i).toVar(),o=de().toVar(),a=de().toVar(),l=de().toVar(),c=pe(Mr(s.x,o),Mr(s.y,a),Mr(s.z,l)).toVar(),u=dt(1e6,1e6).toVar();return Oi({start:-1,end:de(1),name:"x",condition:"<="},({x:f})=>{Oi({start:-1,end:de(1),name:"y",condition:"<="},({y:d})=>{Oi({start:-1,end:de(1),name:"z",condition:"<="},({z:A})=>{let y=oe(_x(c,f,d,A,o,a,l,r,n)).toVar();$t(y.lessThan(u.x),()=>{u.y.assign(u.x),u.x.assign(y)}).ElseIf(y.lessThan(u.y),()=>{u.y.assign(y)})})})}),$t(n.equal(de(0)),()=>{u.assign(Ja(u))}),u}).setLayout({name:"mx_worley_noise_vec2_1",type:"vec2",inputs:[{name:"p",type:"vec3"},{name:"jitter",type:"float"},{name:"metric",type:"int"}]}),L4e=Zo([M4e,P4e]),D4e=me(([i,e,t])=>{let n=de(t).toVar(),r=oe(e).toVar(),s=pe(i).toVar(),o=de().toVar(),a=de().toVar(),l=de().toVar(),c=pe(Mr(s.x,o),Mr(s.y,a),Mr(s.z,l)).toVar(),u=pe(1e6,1e6,1e6).toVar();return Oi({start:-1,end:de(1),name:"x",condition:"<="},({x:f})=>{Oi({start:-1,end:de(1),name:"y",condition:"<="},({y:d})=>{Oi({start:-1,end:de(1),name:"z",condition:"<="},({z:A})=>{let y=oe(_x(c,f,d,A,o,a,l,r,n)).toVar();$t(y.lessThan(u.x),()=>{u.z.assign(u.y),u.y.assign(u.x),u.x.assign(y)}).ElseIf(y.lessThan(u.y),()=>{u.z.assign(u.y),u.y.assign(y)}).ElseIf(y.lessThan(u.z),()=>{u.z.assign(y)})})})}),$t(n.equal(de(0)),()=>{u.assign(Ja(u))}),u}).setLayout({name:"mx_worley_noise_vec3_1",type:"vec3",inputs:[{name:"p",type:"vec3"},{name:"jitter",type:"float"},{name:"metric",type:"int"}]}),pV=Zo([C4e,D4e]),N4e=me(([i,e,t,n,r,s,o,a,l,c,u])=>{let f=de(i).toVar(),d=dt(e).toVar(),A=dt(t).toVar(),y=dt(n).toVar(),w=oe(r).toVar(),S=oe(s).toVar(),T=oe(o).toVar(),R=uc(a).toVar(),P=de(l).toVar(),I=oe(c).toVar(),F=oe(u).toVar(),D=d.mul(A).add(y),L=oe(0).toVar();return $t(f.equal(de(0)),()=>{L.assign(LS(D))}),$t(f.equal(de(1)),()=>{L.assign(DI(D))}),$t(f.equal(de(2)),()=>{L.assign(pV(D,w,de(0)))}),$t(f.equal(de(3)),()=>{L.assign(NI(pe(D,0),P,I,F))}),L.assign(L.mul(T.sub(S)).add(S)),$t(R,()=>{L.assign(Yu(L,S,T))}),L}).setLayout({name:"mx_unifiednoise2d",type:"float",inputs:[{name:"noiseType",type:"int"},{name:"texcoord",type:"vec2"},{name:"freq",type:"vec2"},{name:"offset",type:"vec2"},{name:"jitter",type:"float"},{name:"outmin",type:"float"},{name:"outmax",type:"float"},{name:"clampoutput",type:"bool"},{name:"octaves",type:"int"},{name:"lacunarity",type:"float"},{name:"diminish",type:"float"}]}),F4e=me(([i,e,t,n,r,s,o,a,l,c,u])=>{let f=de(i).toVar(),d=pe(e).toVar(),A=pe(t).toVar(),y=pe(n).toVar(),w=oe(r).toVar(),S=oe(s).toVar(),T=oe(o).toVar(),R=uc(a).toVar(),P=de(l).toVar(),I=oe(c).toVar(),F=oe(u).toVar(),D=d.mul(A).add(y),L=oe(0).toVar();return $t(f.equal(de(0)),()=>{L.assign(LS(D))}),$t(f.equal(de(1)),()=>{L.assign(DI(D))}),$t(f.equal(de(2)),()=>{L.assign(pV(D,w,de(0)))}),$t(f.equal(de(3)),()=>{L.assign(NI(D,P,I,F))}),L.assign(L.mul(T.sub(S)).add(S)),$t(R,()=>{L.assign(Yu(L,S,T))}),L}).setLayout({name:"mx_unifiednoise3d",type:"float",inputs:[{name:"noiseType",type:"int"},{name:"position",type:"vec3"},{name:"freq",type:"vec3"},{name:"offset",type:"vec3"},{name:"jitter",type:"float"},{name:"outmin",type:"float"},{name:"outmax",type:"float"},{name:"clampoutput",type:"bool"},{name:"octaves",type:"int"},{name:"lacunarity",type:"float"},{name:"diminish",type:"float"}]}),B4e=me(([i])=>{let e=i.y,t=i.z,n=pe().toVar();return $t(e.lessThan(1e-4),()=>{n.assign(pe(t,t,t))}).Else(()=>{let r=i.x;r=r.sub(gf(r)).mul(6).toVar();let s=de(fz(r)),o=r.sub(oe(s)),a=t.mul(e.oneMinus()),l=t.mul(e.mul(o).oneMinus()),c=t.mul(e.mul(o.oneMinus()).oneMinus());$t(s.equal(de(0)),()=>{n.assign(pe(t,c,a))}).ElseIf(s.equal(de(1)),()=>{n.assign(pe(l,t,a))}).ElseIf(s.equal(de(2)),()=>{n.assign(pe(a,t,c))}).ElseIf(s.equal(de(3)),()=>{n.assign(pe(a,l,t))}).ElseIf(s.equal(de(4)),()=>{n.assign(pe(c,a,t))}).Else(()=>{n.assign(pe(t,a,l))})}),n}).setLayout({name:"mx_hsvtorgb",type:"vec3",inputs:[{name:"hsv",type:"vec3"}]}),O4e=me(([i])=>{let e=pe(i).toVar(),t=oe(e.x).toVar(),n=oe(e.y).toVar(),r=oe(e.z).toVar(),s=oe(Rl(t,Rl(n,r))).toVar(),o=oe(zr(t,zr(n,r))).toVar(),a=oe(o.sub(s)).toVar(),l=oe().toVar(),c=oe().toVar(),u=oe().toVar();return u.assign(o),$t(o.greaterThan(0),()=>{c.assign(a.div(o))}).Else(()=>{c.assign(0)}),$t(c.lessThanEqual(0),()=>{l.assign(0)}).Else(()=>{$t(t.greaterThanEqual(o),()=>{l.assign(n.sub(r).div(a))}).ElseIf(n.greaterThanEqual(o),()=>{l.assign(Ls(2,r.sub(t).div(a)))}).Else(()=>{l.assign(Ls(4,t.sub(n).div(a)))}),l.mulAssign(1/6),$t(l.lessThan(0),()=>{l.addAssign(1)})}),pe(l,c,u)}).setLayout({name:"mx_rgbtohsv",type:"vec3",inputs:[{name:"c",type:"vec3"}]}),U4e=me(([i])=>{let e=pe(i).toVar(),t=Z9(iz(e,pe(.04045))).toVar(),n=pe(e.div(12.92)).toVar(),r=pe(eu(zr(e.add(pe(.055)),pe(0)).div(1.055),pe(2.4))).toVar();return Qn(n,r,t)}).setLayout({name:"mx_srgb_texture_to_lin_rec709",type:"vec3",inputs:[{name:"color",type:"vec3"}]}),kse=(i,e)=>{i=oe(i),e=oe(e);let t=dt(e.dFdx(),e.dFdy()).length().mul(.7071067811865476);return fc(i.sub(t),i.add(t),e)},zse=(i,e,t,n)=>Qn(i,e,t[n].clamp()),k4e=(i,e,t=Ui())=>zse(i,e,t,"x"),z4e=(i,e,t=Ui())=>zse(i,e,t,"y"),V4e=(i,e,t,n,r=Ui())=>{let s=r.x.clamp(),o=r.y.clamp(),a=Qn(i,e,s),l=Qn(t,n,s);return Qn(a,l,o)},Vse=(i,e,t,n,r)=>Qn(i,e,kse(t,n[r])),G4e=(i,e,t,n=Ui())=>Vse(i,e,t,n,"x"),q4e=(i,e,t,n=Ui())=>Vse(i,e,t,n,"y"),H4e=(i=1,e=0,t=Ui())=>t.mul(i).add(e),W4e=(i,e=1)=>(i=oe(i),i.abs().pow(e).mul(i.sign())),j4e=(i,e=1,t=.5)=>oe(i).sub(t).mul(e).add(t),X4e=(i=Ui(),e=1,t=0)=>dV(i.convert("vec2|vec3")).mul(e).add(t),$4e=(i=Ui(),e=1,t=0)=>LS(i.convert("vec2|vec3")).mul(e).add(t),Y4e=(i=Ui(),e=1,t=0)=>(i=i.convert("vec2|vec3"),Ft(LS(i),dV(i.add(dt(19,73)))).mul(e).add(t)),Z4e=(i,e=Ui(),t=dt(1,1),n=dt(0,0),r=1,s=0,o=1,a=!1,l=1,c=2,u=.5)=>N4e(i,e.convert("vec2|vec3"),t,n,r,s,o,a,l,c,u),K4e=(i,e=Ui(),t=dt(1,1),n=dt(0,0),r=1,s=0,o=1,a=!1,l=1,c=2,u=.5)=>F4e(i,e.convert("vec2|vec3"),t,n,r,s,o,a,l,c,u),Q4e=(i=Ui(),e=1)=>I4e(i.convert("vec2|vec3"),e,de(1)),J4e=(i=Ui(),e=1)=>L4e(i.convert("vec2|vec3"),e,de(1)),eIe=(i=Ui(),e=1)=>pV(i.convert("vec2|vec3"),e,de(1)),tIe=(i=Ui())=>g4e(i.convert("vec2|vec3")),nIe=(i=Ui(),e=3,t=2,n=.5,r=1)=>N4(i,de(e),t,n).mul(r),iIe=(i=Ui(),e=3,t=2,n=.5,r=1)=>b4e(i,de(e),t,n).mul(r),rIe=(i=Ui(),e=3,t=2,n=.5,r=1)=>NI(i,de(e),t,n).mul(r),sIe=(i=Ui(),e=3,t=2,n=.5,r=1)=>w4e(i,de(e),t,n).mul(r),oIe=(i,e=oe(0))=>Ls(i,e),aIe=(i,e=oe(0))=>ai(i,e),lIe=(i,e=oe(1))=>Tn(i,e),cIe=(i,e=oe(1))=>hc(i,e),uIe=(i,e=oe(1))=>dI(i,e),hIe=(i,e=oe(1))=>eu(i,e),fIe=(i=oe(0),e=oe(1))=>az(i,e),dIe=()=>vx,pIe=()=>rse,mIe=(i,e=oe(1))=>ai(e,i),AIe=(i,e,t,n)=>i.greaterThan(e).mix(t,n),gIe=(i,e,t,n)=>i.greaterThanEqual(e).mix(t,n),vIe=(i,e,t,n)=>i.equal(e).mix(t,n),_Ie=(i,e=null)=>{if(typeof e=="string"){let t={x:0,r:0,y:1,g:1,z:2,b:2,w:3,a:3},n=e.replace(/^out/,"").toLowerCase();if(t[n]!==void 0)return i.element(t[n])}if(typeof e=="number")return i.element(e);if(typeof e=="string"&&e.length===1){let t={x:0,r:0,y:1,g:1,z:2,b:2,w:3,a:3};if(t[e]!==void 0)return i.element(t[e])}return i},xIe=(i,e=dt(.5,.5),t=dt(1,1),n=oe(0),r=dt(0,0))=>{let s=i;if(e&&(s=s.sub(e)),t&&(s=s.mul(t)),n){let o=n.mul(Math.PI/180),a=o.cos(),l=o.sin();s=dt(s.x.mul(a).sub(s.y.mul(l)),s.x.mul(l).add(s.y.mul(a)))}return e&&(s=s.add(e)),r&&(s=s.add(r)),s},yIe=(i,e)=>{i=dt(i),e=oe(e);let t=e.mul(Math.PI/180);return RS(i,t)},bIe=(i,e,t)=>{i=pe(i),e=oe(e),t=pe(t);let n=e.mul(Math.PI/180),r=t.normalize(),s=n.cos(),o=n.sin(),a=oe(1).sub(s);return i.mul(s).add(r.cross(i).mul(o)).add(r.mul(r.dot(i)).mul(a))},wIe=(i,e)=>(i=pe(i),e=oe(e),Uz(i,e)),SIe=me(([i,e,t])=>{let n=xa(i).toVar(),r=ai(oe(.5).mul(e.sub(t)),_f).div(n).toVar(),s=ai(oe(-.5).mul(e.sub(t)),_f).div(n).toVar(),o=pe().toVar();o.x=n.x.greaterThan(oe(0)).select(r.x,s.x),o.y=n.y.greaterThan(oe(0)).select(r.y,s.y),o.z=n.z.greaterThan(oe(0)).select(r.z,s.z);let a=Rl(o.x,o.y,o.z).toVar();return _f.add(n.mul(a)).toVar().sub(t)}),Gse=me(([i,e])=>{let t=i.x,n=i.y,r=i.z,s=e.element(0).mul(.886227);return s=s.add(e.element(1).mul(2*.511664).mul(n)),s=s.add(e.element(2).mul(2*.511664).mul(r)),s=s.add(e.element(3).mul(2*.511664).mul(t)),s=s.add(e.element(4).mul(2*.429043).mul(t).mul(n)),s=s.add(e.element(5).mul(2*.429043).mul(n).mul(r)),s=s.add(e.element(6).mul(r.mul(r).mul(.743125).sub(.247708))),s=s.add(e.element(7).mul(2*.429043).mul(t).mul(r)),s=s.add(e.element(8).mul(.429043).mul(Tn(t,t).sub(Tn(n,n)))),s}),V=Object.freeze({__proto__:null,BRDF_GGX:eV,BRDF_Lambert:Qg,BasicPointShadowFilter:Ise,BasicShadowFilter:bse,Break:Mre,Const:Qne,Continue:REe,DFGLUT:fS,D_GGX:zre,Discard:die,EPSILON:pI,F_Schlick:hx,Fn:me,HALF_PI:wTe,INFINITY:xTe,If:$t,Loop:Oi,NodeAccess:$o,NodeShaderStage:$_,NodeType:JSe,NodeUpdateType:yn,OnBeforeFrameUpdate:wEe,OnBeforeMaterialUpdate:bEe,OnBeforeObjectUpdate:yEe,OnFrameUpdate:_re,OnMaterialUpdate:xEe,OnObjectUpdate:CS,PCFShadowFilter:wse,PCFSoftShadowFilter:Sse,PI:r4,PI2:yTe,PointShadowFilter:Pse,Return:NTe,Schlick_to_F0:u7,ShaderNode:K_,Stack:cI,Switch:pTe,TBNViewMatrix:Ug,TWO_PI:bTe,VSMShadowFilter:Tse,V_GGX_SmithCorrelated:kre,Var:Kne,VarIntent:Jne,abs:fr,acesFilmicToneMapping:pse,acos:oz,acosh:Mne,add:Ls,addMethodChaining:Ue,addNodeElement:FTe,agxToneMapping:mse,all:gne,alphaT:JR,ambientOcclusion:fU,and:ine,anisotropy:nm,anisotropyB:Vg,anisotropyT:Qw,any:vne,append:ATe,array:Yte,asin:Tne,asinh:Ene,assign:Zte,atan:az,atanh:Cne,atomicAdd:VCe,atomicAnd:WCe,atomicFunc:Cf,atomicLoad:kCe,atomicMax:qCe,atomicMin:HCe,atomicOr:jCe,atomicStore:zCe,atomicSub:GCe,atomicXor:XCe,attenuationColor:tz,attenuationDistance:ez,attribute:cc,attributeArray:jMe,backgroundBlurriness:ase,backgroundIntensity:J7,backgroundRotation:lse,batch:wre,batchColor:jz,bentNormalView:qie,billboarding:NMe,bitAnd:ane,bitNot:lne,bitOr:cne,bitXor:une,bitangentGeometry:fEe,bitangentLocal:dEe,bitangentView:Vie,bitangentWorld:pEe,bitcast:nse,blendBurn:nCe,blendColor:oCe,blendDodge:iCe,blendOverlay:sCe,blendScreen:rCe,blur:jre,bool:uc,buffer:Ax,bufferAttribute:bz,builtin:Qd,builtinAOContext:Yne,builtinShadowContext:$ne,bumpMap:Uz,bvec2:qte,bvec3:Z9,bvec4:Hte,bypass:hie,cache:uie,call:Kte,cameraFar:sm,cameraIndex:vm,cameraNear:rm,cameraNormalMatrix:qTe,cameraPosition:_ie,cameraProjectionMatrix:Qa,cameraProjectionMatrixInverse:vie,cameraViewMatrix:_m,cameraViewport:HTe,cameraWorldMatrix:MS,cbrt:Gne,cdl:hCe,ceil:AI,checker:GRe,cineonToneMapping:dse,clamp:Yu,clearcoat:ZR,clearcoatNormalView:om,clearcoatRoughness:J_,clipSpace:bie,code:II,color:Gte,colorSpaceToWorking:vI,colorToDirection:gEe,compute:cie,computeKernel:Sz,computeSkinning:CEe,context:Kd,convert:jte,convertColorSpace:MTe,convertToTexture:GMe,cos:Hu,cosh:bne,countLeadingZeros:hMe,countOneBits:fMe,countTrailingZeros:uMe,cross:$d,cubeTexture:Ka,cubeTextureBase:Bz,dFdx:uz,dFdy:hz,dashSize:Gg,debug:mie,decrement:Ane,decrementBefore:pne,defaultBuildStages:VR,defaultShaderStages:Ote,defined:sx,degrees:xne,deltaTime:EMe,densityFogFactor:_se,depth:Kz,depthPass:ACe,determinant:Dne,difference:One,diffuseColor:Bi,diffuseContribution:Ng,directPointLight:Dse,directionToColor:AEe,directionToFaceDirection:iEe,dispersion:nz,disposeShadowMaterial:Mse,distance:Bne,div:hc,dot:ru,drawIndex:lie,dynamicBufferAttribute:ITe,element:Wte,emissive:hU,equal:Qte,equirectDirection:r7,equirectUV:Qz,exp:rz,exp2:ox,exponentialHeightFogFactor:MCe,expression:lc,faceDirection:Dz,faceForward:vz,faceforward:STe,float:oe,floatBitsToInt:aMe,floatBitsToUint:ise,floor:gf,fog:ok,fract:$u,frameGroup:vTe,frameId:rse,frontFacing:wie,fwidth:dz,gain:pMe,gapSize:aS,getConstNodeType:Vte,getCurrentStack:X9,getDirection:Hre,getDistanceAttenuation:fV,getGeometryRoughness:Ure,getNormalFromDepth:HMe,getParallaxCorrectNormal:SIe,getRoughness:Jz,getScreenPosition:qMe,getShIrradianceAt:Gse,getShadowMaterial:Ese,getShadowRenderObjectFunction:Cse,getTextureIndex:ese,getViewPosition:Z_,ggxConvolution:Xre,globalId:PCe,glsl:SCe,glslFn:TCe,grayscale:aCe,greaterThan:iz,greaterThanEqual:nne,hash:dMe,highpModelNormalViewMatrix:LU,highpModelViewMatrix:PU,hue:uCe,increment:mne,incrementBefore:dne,inspector:Aie,instance:yre,instanceColor:Wz,instanceIndex:Xu,instancedArray:XMe,instancedBufferAttribute:xI,instancedDynamicBufferAttribute:wz,instancedMesh:bre,int:de,intBitsToFloat:lMe,interleavedGradientNoise:iV,inverse:Nne,inverseSqrt:sz,inversesqrt:TTe,invocationLocalIndex:DTe,invocationSubgroupIndex:LTe,ior:Jw,iridescence:hI,iridescenceIOR:KR,iridescenceThickness:QR,isolate:nx,ivec2:kr,ivec3:Y9,ivec4:K9,js:bCe,label:Zne,length:vf,lengthSq:Az,lessThan:ene,lessThanEqual:tne,lightPosition:lV,lightProjectionUV:xse,lightShadowMatrix:LI,lightTargetDirection:uV,lightTargetPosition:yse,lightViewPosition:cV,lightingContext:Rre,lights:SRe,linearDepth:d4,linearToneMapping:hse,localId:LCe,log:mI,log2:Af,logarithmicDepthToViewZ:NEe,luminance:sV,mat2:uI,mat3:To,mat4:um,matcapUV:$re,materialAO:gre,materialAlphaTest:Wie,materialAnisotropy:ore,materialAnisotropyVector:Y_,materialAttenuationColor:pre,materialAttenuationDistance:dre,materialClearcoat:ere,materialClearcoatNormal:nre,materialClearcoatRoughness:tre,materialColor:jie,materialDispersion:Are,materialEmissive:$ie,materialEnvIntensity:qR,materialEnvRotation:c4,materialIOR:fre,materialIridescence:are,materialIridescenceIOR:lre,materialIridescenceThickness:cre,materialLightMap:Hz,materialLineDashOffset:qz,materialLineDashSize:Vz,materialLineGapSize:Gz,materialLineScale:zz,materialLineWidth:u4,materialMetalness:Qie,materialNormal:Jie,materialOpacity:kz,materialPointSize:mre,materialReference:Hd,materialReflectivity:HR,materialRefractionRatio:Eie,materialRotation:ire,materialRoughness:Kie,materialSheen:rre,materialSheenRoughness:sre,materialShininess:Xie,materialSpecular:Yie,materialSpecularColor:Zie,materialSpecularIntensity:qU,materialSpecularStrength:eS,materialThickness:hre,materialTransmission:ure,max:zr,maxMipLevel:Cz,mediumpModelViewMatrix:yie,metalness:jd,min:Rl,mix:Qn,mixElement:Hne,mod:dI,modelDirection:KTe,modelNormalMatrix:xie,modelPosition:QTe,modelRadius:tEe,modelScale:JTe,modelViewMatrix:bf,modelViewPosition:eEe,modelViewProjection:vre,modelWorldMatrix:tu,modelWorldMatrixInverse:nEe,morphReference:Cre,mrt:tse,mul:Tn,mx_aastep:kse,mx_add:oIe,mx_atan2:fIe,mx_cell_noise_float:tIe,mx_contrast:j4e,mx_divide:cIe,mx_fractal_noise_float:nIe,mx_fractal_noise_vec2:iIe,mx_fractal_noise_vec3:rIe,mx_fractal_noise_vec4:sIe,mx_frame:pIe,mx_heighttonormal:wIe,mx_hsvtorgb:B4e,mx_ifequal:vIe,mx_ifgreater:AIe,mx_ifgreatereq:gIe,mx_invert:mIe,mx_modulo:uIe,mx_multiply:lIe,mx_noise_float:X4e,mx_noise_vec3:$4e,mx_noise_vec4:Y4e,mx_place2d:xIe,mx_power:hIe,mx_ramp4:V4e,mx_ramplr:k4e,mx_ramptb:z4e,mx_rgbtohsv:O4e,mx_rotate2d:yIe,mx_rotate3d:bIe,mx_safepower:W4e,mx_separate:_Ie,mx_splitlr:G4e,mx_splittb:q4e,mx_srgb_texture_to_lin_rec709:U4e,mx_subtract:aIe,mx_timer:dIe,mx_transform_uv:H4e,mx_unifiednoise2d:Z4e,mx_unifiednoise3d:K4e,mx_worley_noise_float:Q4e,mx_worley_noise_vec2:J4e,mx_worley_noise_vec3:eIe,negate:cz,negateOnBackSide:o1,neutralToneMapping:Ase,nodeArray:zg,nodeImmutable:xt,nodeObject:Ht,nodeObjectIntent:$w,nodeObjects:lI,nodeProxy:$n,nodeProxyConstructor:j9,nodeProxyIntent:ct,normalFlat:Sie,normalGeometry:yI,normalLocal:ba,normalMap:VU,normalView:hi,normalViewGeometry:ax,normalWorld:xm,normalWorldGeometry:Tie,normalize:xa,not:sne,notEqual:Jte,numWorkgroups:RCe,objectDirection:WTe,objectGroup:$te,objectPosition:XTe,objectRadius:ZTe,objectScale:$Te,objectViewPosition:YTe,objectWorldMatrix:jTe,oneMinus:Rne,or:rne,orthographicDepthToViewZ:Pre,oscSawtooth:IMe,oscSine:MMe,oscSquare:CMe,oscTriangle:RMe,output:ex,outputStruct:rMe,overloadingFn:Zo,overrideNode:Qre,overrideNodes:Jre,packHalf2x16:_Me,packNormalToRGB:Oz,packSnorm2x16:gMe,packUnorm2x16:vMe,parabola:H7,parallaxDirection:Gie,parallaxUV:mEe,parameter:tMe,pass:pCe,passTexture:mCe,pcurve:mMe,perspectiveDepthToViewZ:TI,pmremTexture:nV,pointShadow:Lse,pointUV:$Me,pointWidth:gTe,positionGeometry:ga,positionLocal:Er,positionPrevious:Kg,positionView:xs,positionViewDirection:er,positionWorld:_f,positionWorldDirection:Lz,posterize:fCe,pow:eu,pow2:pz,pow3:Une,pow4:mz,premultiplyAlpha:Ez,property:Zd,quadBroadcast:vRe,quadSwapDiagonal:fRe,quadSwapX:uRe,quadSwapY:hRe,radians:_ne,rand:qne,range:CCe,rangeFogFactor:vse,reciprocal:Pne,reference:mr,referenceBuffer:Lie,reflect:Fne,reflectVector:Rie,reflectView:Mie,reflector:kMe,refract:gz,refractVector:Iie,refractView:Cie,reinhardToneMapping:fse,remap:Tz,remapClamp:fie,renderGroup:Jt,renderOutput:Mz,rendererReference:rie,replaceDefaultUV:PMe,rotate:RS,rotateUV:LMe,roughness:pf,round:Ine,rtt:ose,sRGBTransferEOTF:tie,sRGBTransferOETF:nie,sample:WMe,sampler:kTe,samplerComparison:zTe,saturate:gI,saturation:lCe,screenCoordinate:s1,screenDPR:Iz,screenSize:Zg,screenUV:ju,select:_a,setCurrentStack:oS,setName:_z,shaderStages:GR,shadow:Rse,shadowPositionWorld:hV,shapeCircle:qRe,sharedUniformGroup:fI,sheen:oc,sheenRoughness:im,shiftLeft:hne,shiftRight:fne,shininess:e4,sign:lz,sin:Za,sinc:AMe,sinh:yne,skinning:Ere,smoothstep:fc,smoothstepElement:Wne,specularColor:dm,specularColorBlended:Bg,specularF90:Og,spherizeUV:DMe,split:mTe,spritesheetUV:BMe,sqrt:Ja,stack:jR,step:$g,stepElement:jne,storage:hm,storageBarrier:FCe,storageTexture:cse,storageTexture3D:ZMe,struct:iMe,sub:ai,subBuild:qg,subgroupAdd:ZCe,subgroupAll:aRe,subgroupAnd:nRe,subgroupAny:lRe,subgroupBallot:YCe,subgroupBroadcast:dRe,subgroupBroadcastFirst:cRe,subgroupElect:$Ce,subgroupExclusiveAdd:QCe,subgroupExclusiveMul:tRe,subgroupInclusiveAdd:KCe,subgroupInclusiveMul:eRe,subgroupIndex:PTe,subgroupMax:oRe,subgroupMin:sRe,subgroupMul:JCe,subgroupOr:iRe,subgroupShuffle:pRe,subgroupShuffleDown:gRe,subgroupShuffleUp:ARe,subgroupShuffleXor:mRe,subgroupSize:DCe,subgroupXor:rRe,tan:wne,tangentGeometry:bI,tangentLocal:pm,tangentView:wI,tangentWorld:zie,tanh:Sne,texture:fi,texture3D:rV,texture3DLevel:JMe,texture3DLoad:QMe,textureBarrier:BCe,textureBicubic:a3e,textureBicubicLevel:tV,textureCubeUV:Wre,textureLevel:UTe,textureLoad:_s,textureSize:Yg,textureStore:YMe,thickness:J9,time:vx,toneMapping:sie,toneMappingExposure:oie,toonOutlinePass:gCe,transformDirection:kne,transformNormal:Nz,transformNormalByInverseViewMatrix:Vne,transformNormalByViewMatrix:zne,transformNormalToView:Fz,transformedClearcoatNormalView:oEe,transformedNormalView:rEe,transformedNormalWorld:sEe,transmission:t4,transpose:Lne,triNoise3D:SMe,triplanarTexture:OMe,triplanarTextures:sse,trunc:fz,uint:rt,uintBitsToFloat:cMe,uniform:Xt,uniformArray:Xo,uniformCubeTexture:aEe,uniformFlow:Xne,uniformGroup:Xte,uniformTexture:OTe,unpackHalf2x16:bMe,unpackNormal:kU,unpackRGBToNormal:Hie,unpackSnorm2x16:xMe,unpackUnorm2x16:yMe,unpremultiplyAlpha:pie,userData:eCe,uv:Ui,uvec2:$9,uvec3:i1,uvec4:Q9,varying:gm,varyingProperty:r1,vec2:dt,vec3:pe,vec4:Ft,vectorComponents:n1,velocity:tCe,vertexColor:Nre,vertexIndex:aie,vertexStage:eie,vibrance:cCe,viewZToLogarithmicDepth:EI,viewZToOrthographicDepth:Hg,viewZToPerspectiveDepth:Zz,viewZToReversedOrthographicDepth:DEe,viewZToReversedPerspectiveDepth:Lre,viewport:rx,viewportCoordinate:gie,viewportDepthTexture:Yz,viewportLinearDepth:FEe,viewportMipTexture:$z,viewportOpaqueMipTexture:Ire,viewportResolution:GTe,viewportSafeUV:FMe,viewportSharedTexture:dCe,viewportSize:Pz,viewportTexture:PEe,viewportUV:VTe,vogelDiskSample:Wu,wgsl:wCe,wgslFn:ECe,workgroupArray:OCe,workgroupBarrier:NCe,workgroupId:ICe,workingToColorSpace:iie,xor:one}),Gu=new pS,mk=class extends Tf{constructor(e,t){super(),this.renderer=e,this.nodes=t}update(e,t,n){let r=this.renderer,s=this.nodes.getBackgroundNode(e)||e.background,o=!1;if(s===null)r._clearColor.getRGB(Gu),Gu.a=r._clearColor.a;else if(s.isColor===!0)s.getRGB(Gu),Gu.a=1,o=!0;else if(s.isNode===!0){let l=this.get(e),c=s;Gu.copy(r._clearColor);let u=l.backgroundMesh;if(u===void 0){let P=function(){s.removeEventListener("dispose",P),u.material.dispose(),u.geometry.dispose()},d=Ft(c).mul(J7).context({getUV:()=>lse.mul(Tie),getTextureLevel:()=>ase}),A=Qa.element(3).element(3).equal(1),y=hc(1,Qa.element(1).element(1)).mul(3),w=A.select(Er.mul(y),Er),S=bf.mul(Ft(w,0)),T=Qa.mul(Ft(S.xyz,1));T=T.setZ(T.w);let R=new Rr;R.name="Background.material",R.side=mi,R.depthTest=!1,R.depthWrite=!1,R.allowOverride=!1,R.fog=!1,R.lights=!1,R.vertexNode=T,R.colorNode=d,l.backgroundMeshNode=d,l.backgroundMesh=u=new Hn(new za(1,32,32),R),u.frustumCulled=!1,u.name="Background.mesh",s.addEventListener("dispose",P)}let f=c.getCacheKey();l.backgroundCacheKey!==f&&(l.backgroundMeshNode.node=Ft(c).mul(J7),l.backgroundMeshNode.needsUpdate=!0,u.material.needsUpdate=!0,l.backgroundCacheKey=f),t.unshift(u,u.geometry,u.material,0,0,null,null)}else ze("Renderer: Unsupported background configuration.",s);let a=r.xr.getEnvironmentBlendMode();if(a==="additive"?Gu.set(0,0,0,1):a==="alpha-blend"&&Gu.set(0,0,0,0),r.autoClear===!0||o===!0){let l=n.clearColorValue;l.r=Gu.r,l.g=Gu.g,l.b=Gu.b,l.a=Gu.a,(r.backend.isWebGLBackend===!0||r.alpha===!0)&&(l.r*=l.a,l.g*=l.a,l.b*=l.a),n.depthClearValue=r.getClearDepth(),n.stencilClearValue=r.getClearStencil(),n.clearColor=r.autoClearColor===!0,n.clearDepth=r.autoClearDepth===!0,n.clearStencil=r.autoClearStencil===!0}else n.clearColor=!1,n.clearDepth=!1,n.clearStencil=!1}},TIe=0,_S=class{constructor(e="",t=[]){this.name=e,this.bindings=t,this.id=TIe++}},Ak=class{constructor(e,t,n,r,s,o,a,l,c,u,f=[]){this.vertexShader=e,this.fragmentShader=t,this.computeShader=n,this.transforms=f,this.nodeAttributes=r,this.bindings=s,this.updateNodes=o,this.updateBeforeNodes=a,this.updateAfterNodes=l,this.observer=c,this.hardwareClipping=u,this.usedTimes=0}createBindings(){let e=[];for(let t of this.bindings)if(t.bindings[0].groupNode.shared!==!0){let r=new _S(t.name,[]);e.push(r);for(let s of t.bindings)r.bindings.push(s.clone())}else e.push(t);return e}},F4=class{constructor(e,t,n=null){this.isNodeAttribute=!0,this.name=e,this.type=t,this.node=n}},gk=class{constructor(e,t,n){this.isNodeUniform=!0,this.name=e,this.type=t,this.node=n}get value(){return this.node.value}set value(e){this.node.value=e}get id(){return this.node.id}get groupNode(){return this.node.groupNode}},B4=class{constructor(e,t,n=!1,r=null){this.isNodeVar=!0,this.name=e,this.type=t,this.readOnly=n,this.count=r}},vk=class extends B4{constructor(e,t,n=null,r=null){super(e,t),this.needsInterpolation=!1,this.isNodeVarying=!0,this.interpolationType=n,this.interpolationSampling=r}},_k=class{constructor(e,t,n=""){this.name=e,this.type=t,this.code=n,Object.defineProperty(this,"isNodeCode",{value:!0})}},EIe=0,rS=class{constructor(e=null){this.id=EIe++,this.nodesData=new WeakMap,this.parent=e}getData(e){let t=this.nodesData.get(e);return t===void 0&&this.parent!==null&&(t=this.parent.getData(e)),t}setData(e,t){this.nodesData.set(e,t)}},xk=class{constructor(e,t){this.name=e,this.members=t,this.output=!1}},Mf=class{constructor(e,t){this.name=e,this.value=t,this.boundary=0,this.itemSize=0,this.offset=0,this.index=-1}setValue(e){this.value=e}getValue(){return this.value}},yk=class extends Mf{constructor(e,t=0){super(e,t),this.isNumberUniform=!0,this.boundary=4,this.itemSize=1}},bk=class extends Mf{constructor(e,t=new Oe){super(e,t),this.isVector2Uniform=!0,this.boundary=8,this.itemSize=2}},wk=class extends Mf{constructor(e,t=new re){super(e,t),this.isVector3Uniform=!0,this.boundary=16,this.itemSize=3}},Sk=class extends Mf{constructor(e,t=new xn){super(e,t),this.isVector4Uniform=!0,this.boundary=16,this.itemSize=4}},Tk=class extends Mf{constructor(e,t=new zt){super(e,t),this.isColorUniform=!0,this.boundary=16,this.itemSize=3}},Ek=class extends Mf{constructor(e,t=new i_){super(e,t),this.isMatrix2Uniform=!0,this.boundary=8,this.itemSize=4}},Mk=class extends Mf{constructor(e,t=new Mn){super(e,t),this.isMatrix3Uniform=!0,this.boundary=48,this.itemSize=12}},Ck=class extends Mf{constructor(e,t=new cn){super(e,t),this.isMatrix4Uniform=!0,this.boundary=64,this.itemSize=16}},Rk=class extends yk{constructor(e){super(e.name,e.value),this.nodeUniform=e}getValue(){return this.nodeUniform.value}getType(){return this.nodeUniform.type}},Ik=class extends bk{constructor(e){super(e.name,e.value),this.nodeUniform=e}getValue(){return this.nodeUniform.value}getType(){return this.nodeUniform.type}},Pk=class extends wk{constructor(e){super(e.name,e.value),this.nodeUniform=e}getValue(){return this.nodeUniform.value}getType(){return this.nodeUniform.type}},Lk=class extends Sk{constructor(e){super(e.name,e.value),this.nodeUniform=e}getValue(){return this.nodeUniform.value}getType(){return this.nodeUniform.type}},Dk=class extends Tk{constructor(e){super(e.name,e.value),this.nodeUniform=e}getValue(){return this.nodeUniform.value}getType(){return this.nodeUniform.type}},Nk=class extends Ek{constructor(e){super(e.name,e.value),this.nodeUniform=e}getValue(){return this.nodeUniform.value}getType(){return this.nodeUniform.type}},Fk=class extends Mk{constructor(e){super(e.name,e.value),this.nodeUniform=e}getValue(){return this.nodeUniform.value}getType(){return this.nodeUniform.type}},Bk=class extends Ck{constructor(e){super(e.name,e.value),this.nodeUniform=e}getValue(){return this.nodeUniform.value}getType(){return this.nodeUniform.type}},MIe=0,rte=new WeakMap,ste=new WeakMap,CIe=new WeakMap,RIe=new Map([[Int8Array,"int"],[Int16Array,"int"],[Int32Array,"int"],[Uint8Array,"uint"],[Uint16Array,"uint"],[Uint32Array,"uint"],[Float32Array,"float"]]),ER=i=>/e/g.test(i)?String(i).replace(/\+/g,""):(i=Number(i),i+(i%1?"":".0")),qse=i=>{if(i.writeUsageCount>0)return!0;if(i.subBuildsCache!==void 0){for(let e in i.subBuildsCache)if(qse(i.subBuildsCache[e]))return!0}return!1},O4=class{constructor(e,t,n){this.object=e,this.material=e&&e.material||null,this.geometry=e&&e.geometry||null,this.renderer=t,this.parser=n,this.scene=null,this.camera=null,this.nodes=new Set,this.sequentialNodes=new Set,this.updateNodes=[],this.updateBeforeNodes=[],this.updateAfterNodes=[],this.hashNodes={},this.observer=null,this.lightsNode=null,this.environmentNode=null,this.fogNode=null,this.clippingContext=null,this.hardwareClipping=!1,this.vertexShader=null,this.fragmentShader=null,this.computeShader=null,this.flowNodes={vertex:[],fragment:[],compute:[]},this.flowCode={vertex:"",fragment:"",compute:""},this.uniforms={vertex:[],fragment:[],compute:[],index:0},this.structs={vertex:[],fragment:[],compute:[],index:0},this.types={vertex:[],fragment:[],compute:[],index:0},this.bindings={vertex:{},fragment:{},compute:{}},this.bindingsIndexes={},this.bindGroups=null,this.attributes=[],this.bufferAttributes=[],this.varyings=[],this.codes={},this.vars={},this.declarations={},this.flow={code:""},this.chaining=[],this.stack=jR(),this.stacks=[],this.tab=" ",this.currentFunctionNode=null,this.context={material:this.material},this.cache=new rS,this.globalCache=this.cache,this.flowsData=new WeakMap,this.shaderStage=null,this.buildStage=null,this.subBuildLayers=[],this.activeStacks=[],this.subBuildFn=null,this.fnCall=null,Object.defineProperty(this,"id",{value:MIe++})}isFlatShading(){return this.material.flatShading===!0||this.geometry.hasAttribute("normal")===!1}isOpaque(){let e=this.material;return e.transparent===!1&&e.blending===Ms&&e.alphaToCoverage===!1}createRenderTarget(e,t,n){return new Fa(e,t,n)}createCubeRenderTarget(e,t){return new p4(e,t)}includes(e){return this.nodes.has(e)}getOutputType(e=0){let t="vec4",n=this.renderer.getRenderTarget();if(n!==null){let r=n.textures[e].type,s=n.textures[e].format,o="vec";r===Zr?o="ivec":r===xi&&(o="uvec"),s===Ld||s===kh?r===Zr?t="int":r===xi?t="uint":t="float":s===js||s===zh?t=`${o}2`:s===Pd||s===Tb?t=`${o}3`:t=`${o}4`}return t}getOutputStructName(){}_getBindGroup(e,t){let n=t[0].groupNode,r=n.shared;if(r)for(let o=1;o<t.length;o++)n!==t[o].groupNode&&(r=!1);let s;if(r){let o="";for(let u of t)if(u.isNodeUniformsGroup){u.uniforms.sort((f,d)=>f.nodeUniform.node.id-d.nodeUniform.node.id);for(let f of u.uniforms)o+=f.nodeUniform.node.id}else o+=u.nodeUniform.id;let a=this.renderer._currentRenderContext||this.renderer,l=rte.get(a);l===void 0&&(l=new Map,rte.set(a,l));let c=mx(o);s=l.get(c),s===void 0&&(s=new _S(e,t),l.set(c,s))}else s=new _S(e,t);return s}getBindGroupArray(e,t){let n=this.bindings[t],r=n[e];return r===void 0&&(this.bindingsIndexes[e]===void 0&&(this.bindingsIndexes[e]={binding:0,group:Object.keys(this.bindingsIndexes).length}),n[e]=r=[]),r}getBindings(){let e=this.bindGroups;if(e===null){let t={},n=this.bindings;for(let r of GR)for(let s in n[r]){let o=n[r][s],a=t[s]||(t[s]=[]);for(let l of o)a.includes(l)===!1&&a.push(l)}e=[];for(let r in t){let s=t[r],o=this._getBindGroup(r,s);e.push(o)}this.bindGroups=e}return e}sortBindingGroups(){let e=this.getBindings();e.sort((t,n)=>t.bindings[0].groupNode.order-n.bindings[0].groupNode.order);for(let t=0;t<e.length;t++){let n=e[t];this.bindingsIndexes[n.name].group=t}}setHashNode(e,t){this.hashNodes[t]=e}addNode(e){this.nodes.has(e)===!1&&(this.nodes.add(e),this.setHashNode(e,e.getHash(this)))}addSequentialNode(e){let t=e.getUpdateBeforeType(),n=e.getUpdateAfterType();(t!==yn.NONE||n!==yn.NONE)&&this.sequentialNodes.add(e)}buildUpdateNodes(){for(let e of this.nodes)e.getUpdateType()!==yn.NONE&&this.updateNodes.push(e);for(let e of this.sequentialNodes){let t=e.getUpdateBeforeType(),n=e.getUpdateAfterType();t!==yn.NONE&&this.updateBeforeNodes.push(e),n!==yn.NONE&&this.updateAfterNodes.push(e)}}get currentNode(){return this.chaining[this.chaining.length-1]}isFilteredTexture(e){return e.magFilter===Mi||e.magFilter===f0||e.magFilter===qc||e.magFilter===Vo||e.minFilter===Mi||e.minFilter===f0||e.minFilter===qc||e.minFilter===Vo}getUniformBufferLimit(){return this.renderer.backend.capabilities.getUniformBufferLimit()}addChain(e){this.chaining.push(e)}removeChain(e){if(this.chaining.pop()!==e)throw new Error("THREE.NodeBuilder: Invalid node chaining!")}getMethod(e){return e}getTernary(){return null}getNodeFromHash(e){return this.hashNodes[e]}addFlow(e,t){return this.flowNodes[e].push(t),t}setContext(e){this.context=e}getContext(){return this.context}addContext(e){let t=this.getContext();return this.setContext({...this.context,...e}),t}getSharedContext(){let e={...this.context};return delete e.material,delete e.getUV,delete e.getOutput,delete e.getTextureLevel,delete e.getAO,delete e.getShadow,e}setCache(e){this.cache=e}getCache(){return this.cache}getCacheFromNode(e,t=!0){let n=this.getDataFromNode(e);return n.cache===void 0&&(n.cache=new rS(t?this.getCache():null)),n.cache}isAvailable(){return!1}getVertexIndex(){Xe("Abstract function.")}getInstanceIndex(){Xe("Abstract function.")}getDrawIndex(){Xe("Abstract function.")}getFrontFacing(){Xe("Abstract function.")}getFragCoord(){Xe("Abstract function.")}isFlipY(){return!1}isContextAssign(){return this.context.assign===!0}increaseUsage(e){let t=this.getDataFromNode(e);return t.usageCount=t.usageCount===void 0?1:t.usageCount+1,this.isContextAssign()?t.writeUsageCount=t.writeUsageCount===void 0?1:t.writeUsageCount+1:t.readUsageCount=t.readUsageCount===void 0?1:t.readUsageCount+1,t.usageCount}hasWriteUsage(e){let t=e.getShared(this),r=(t.isGlobal(this)?this.globalCache:this.cache).getData(t);if(r!==void 0){for(let s in r)if(qse(r[s]))return!0}return!1}generateTexture(){Xe("Abstract function.")}generateTextureLod(){Xe("Abstract function.")}generateArrayDeclaration(e,t){return this.getType(e)+"[ "+t+" ]"}generateArray(e,t,n=null){let r=this.generateArrayDeclaration(e,t)+"( ";for(let s=0;s<t;s++){let o=n?n[s]:null;o!==null?r+=o.build(this,e):r+=this.generateConst(e),s<t-1&&(r+=", ")}return r+=" )",r}generateStruct(e,t,n=null){let r=[];for(let s of t){let{name:o,type:a}=s;n&&n[o]&&n[o].isNode?r.push(n[o].build(this,a)):r.push(this.generateConst(a))}return e+"( "+r.join(", ")+" )"}generateConst(e,t=null){if(t===null&&(e==="float"||e==="int"||e==="uint"?t=0:e==="bool"?t=!1:e==="color"?t=new zt:e==="vec2"||e==="uvec2"||e==="ivec2"?t=new Oe:e==="vec3"||e==="uvec3"||e==="ivec3"?t=new re:(e==="vec4"||e==="uvec4"||e==="ivec4")&&(t=new xn)),e==="float")return ER(t);if(e==="int")return`${Math.round(t)}`;if(e==="uint")return t>=0?`${Math.round(t)}u`:"0u";if(e==="bool")return t?"true":"false";if(e==="color")return`${this.getType("vec3")}( ${ER(t.r)}, ${ER(t.g)}, ${ER(t.b)} )`;let n=this.getTypeLength(e),r=this.getComponentType(e),s=o=>this.generateConst(r,o);if(n===2)return`${this.getType(e)}( ${s(t.x)}, ${s(t.y)} )`;if(n===3)return`${this.getType(e)}( ${s(t.x)}, ${s(t.y)}, ${s(t.z)} )`;if(n===4&&e!=="mat2")return`${this.getType(e)}( ${s(t.x)}, ${s(t.y)}, ${s(t.z)}, ${s(t.w)} )`;if(n>=4&&t&&(t.isMatrix2||t.isMatrix3||t.isMatrix4))return`${this.getType(e)}( ${t.elements.map(s).join(", ")} )`;if(n>4)return`${this.getType(e)}()`;throw new Error(`THREE.NodeBuilder: Type '${e}' not found in generate constant attempt.`)}getType(e){return e==="color"?"vec3":e}hasGeometryAttribute(e){return this.geometry&&this.geometry.getAttribute(e)!==void 0}getAttribute(e,t){let n=this.attributes;for(let s of n)if(s.name===e)return s;let r=new F4(e,t);return this.registerDeclaration(r),n.push(r),r}getPropertyName(e){return e.name}isVector(e){return/vec\d/.test(e)}isMatrix(e){return/mat\d/.test(e)}isReference(e){return e==="void"||e==="property"||e==="sampler"||e==="samplerComparison"||e==="texture"||e==="cubeTexture"||e==="storageTexture"||e==="depthTexture"||e==="texture3D"}needsToWorkingColorSpace(){return!1}getComponentTypeFromTexture(e){let t=e.type;return e.isDepthTexture===!0?"float":t===Zr?"int":t===xi?"uint":"float"}getElementType(e){return e==="mat2"?"vec2":e==="mat3"?"vec3":e==="mat4"?"vec4":this.getComponentType(e)}getComponentType(e){if(e=this.getVectorType(e),e==="float"||e==="bool"||e==="int"||e==="uint")return e;let t=/(b|i|u|)(vec|mat)([2-4])/.exec(e);return t===null?null:t[1]==="b"?"bool":t[1]==="i"?"int":t[1]==="u"?"uint":"float"}getVectorType(e){return e==="color"?"vec3":e==="texture"||e==="cubeTexture"||e==="storageTexture"||e==="texture3D"?"vec4":e}getTypeFromLength(e,t="float"){if(e===1)return t;let n=Nte(e),r=t==="float"?"":t[0];return/mat2/.test(t)===!0&&(n=n.replace("vec","mat")),r+n}getTypeFromArray(e){return RIe.get(e.constructor)}isInteger(e){return/int|uint|(i|u)vec/.test(e)}getTypeFromAttribute(e){let t=e;e.isInterleavedBufferAttribute&&(t=e.data);let n=t.array,r=e.itemSize,s=e.normalized,o;return!(e instanceof jv)&&s!==!0&&(o=this.getTypeFromArray(n)),this.getTypeFromLength(r,o)}getTypeLength(e){let t=this.getVectorType(e),n=/vec([2-4])/.exec(t);return n!==null?Number(n[1]):t==="float"||t==="bool"||t==="int"||t==="uint"?1:/mat2/.test(e)===!0?4:/mat3/.test(e)===!0?9:/mat4/.test(e)===!0?16:0}getVectorFromMatrix(e){return e.replace("mat","vec")}changeComponentType(e,t){return this.getTypeFromLength(this.getTypeLength(e),t)}getIntegerType(e){let t=this.getComponentType(e);return t==="int"||t==="uint"?e:this.changeComponentType(e,"int")}setActiveStack(e){this.activeStacks.push(e)}removeActiveStack(e){if(this.activeStacks[this.activeStacks.length-1]===e)this.activeStacks.pop();else throw new Error("THREE.NodeBuilder: Invalid active stack removal.")}getActiveStack(){return this.activeStacks[this.activeStacks.length-1]}getBaseStack(){return this.activeStacks[0]}addStack(){this.stack=jR(this.stack);let e=X9();return this.stacks.push(e),oS(this.stack),this.stack}removeStack(){let e=this.stack;for(let t of e.nodes){let n=this.getDataFromNode(t);n.stack=e}return this.stack=e.parent,oS(this.stacks.pop()),e}getDataFromNode(e,t=this.shaderStage,n=null){n=n===null?e.isGlobal(this)?this.globalCache:this.cache:n;let r=n.getData(e);r===void 0&&(r={},n.setData(e,r)),r[t]===void 0&&(r[t]={});let s=r[t];if(this.subBuildLayers.length===0)return s;let o=r.any?r.any.subBuilds:null,a=this.getClosestSubBuild(o);return a&&(s.subBuildsCache===void 0&&(s.subBuildsCache={}),s=s.subBuildsCache[a]||(s.subBuildsCache[a]={}),s.subBuilds=o),s}getNodeProperties(e,t="any"){let n=this.getDataFromNode(e,t);return n.properties||(n.properties={outputNode:null})}getBufferAttributeFromNode(e,t,n=null){let r=this.getDataFromNode(e,"vertex"),s=r.bufferAttribute;if(s===void 0){let o=this.uniforms.index++;n===null&&(n="nodeAttribute"+o),s=new F4(n,t,e),this.bufferAttributes.push(s),r.bufferAttribute=s}return s}getStructTypeNode(e,t=this.shaderStage){return this.types[t][e]||null}getStructTypeFromNode(e,t,n=null,r=this.shaderStage){let s=this.getDataFromNode(e,r,this.globalCache),o=s.structType;if(o===void 0){let a=this.structs.index++;n===null&&(n="StructType"+a),o=new xk(n,t),this.structs[r].push(o),this.types[r][n]=e,s.structType=o}return o}getOutputStructTypeFromNode(e,t){let n=this.getStructTypeFromNode(e,t,"OutputType","fragment");return n.output=!0,n}getUniformFromNode(e,t,n=this.shaderStage,r=null){let s=this.getDataFromNode(e,n,this.globalCache),o=s.uniform;if(o===void 0){let a=this.uniforms.index++;o=new gk(r||"nodeUniform"+a,t,e),this.uniforms[n].push(o),this.registerDeclaration(o),s.uniform=o}return o}getVarFromNode(e,t=null,n=e.getNodeType(this),r=this.shaderStage,s=!1){let o=this.getDataFromNode(e,r),a=this.getSubBuildProperty("variable",o.subBuilds),l=o[a];if(l===void 0){let c=s?"_const":"_var",u=this.vars[r]||(this.vars[r]=[]),f=this.vars[c]||(this.vars[c]=0);t===null&&(t=(s?"nodeConst":"nodeVar")+f,this.vars[c]++),a!=="variable"&&(t=this.getSubBuildProperty(t,o.subBuilds));let d=e.getArrayCount(this);l=new B4(t,n,s,d),s||u.push(l),this.registerDeclaration(l),o[a]=l}return l}isDeterministic(e){if(e.isMathNode)return this.isDeterministic(e.aNode)&&(e.bNode?this.isDeterministic(e.bNode):!0)&&(e.cNode?this.isDeterministic(e.cNode):!0);if(e.isOperatorNode)return this.isDeterministic(e.aNode)&&(e.bNode?this.isDeterministic(e.bNode):!0);if(e.isArrayNode){if(e.values!==null){for(let t of e.values)if(!this.isDeterministic(t))return!1}return!0}else if(e.isConstNode)return!0;return!1}getVaryingFromNode(e,t=null,n=e.getNodeType(this),r=null,s=null){let o=this.getDataFromNode(e,"any"),a=this.getSubBuildProperty("varying",o.subBuilds),l=o[a];if(l===void 0){let c=this.varyings,u=c.length;t===null&&(t="nodeVarying"+u),a!=="varying"&&(t=this.getSubBuildProperty(t,o.subBuilds)),l=new vk(t,n,r,s),c.push(l),this.registerDeclaration(l),o[a]=l}return l}registerDeclaration(e){let t=this.shaderStage,n=this.declarations[t]||(this.declarations[t]={}),r=e.name,s=r,o=this.getPropertyName(e),a=1;for(;n[o]!==void 0;)s=r+"_"+a++,e.name=s,o=this.getPropertyName(e);s!==r&&Xe(`TSL: Declaration name '${r}' of '${e.type}' already in use. Renamed to '${s}'.`),n[o]=e}getCodeFromNode(e,t,n=this.shaderStage){let r=this.getDataFromNode(e),s=r.code;if(s===void 0){let o=this.codes[n]||(this.codes[n]=[]),a=o.length;s=new _k("nodeCode"+a,t),o.push(s),r.code=s}return s}addFlowCodeHierarchy(e,t){let{flowCodes:n,flowCodeBlock:r}=this.getDataFromNode(e),s=!0,o=t;for(;o;){if(r.get(o)===!0){s=!1;break}o=this.getDataFromNode(o).parentNodeBlock}if(s)for(let a of n)this.addLineFlowCode(a)}addLineFlowCodeBlock(e,t,n){let r=this.getDataFromNode(e),s=r.flowCodes||(r.flowCodes=[]),o=r.flowCodeBlock||(r.flowCodeBlock=new WeakMap);s.push(t),o.set(n,!0)}addLineFlowCode(e,t=null){return e===""?this:(t!==null&&this.context.nodeBlock&&this.addLineFlowCodeBlock(t,e,this.context.nodeBlock),e=this.tab+e,/;\s*$/.test(e)||(e=e+`;4161-`),this.flow.code+=e,this)}addFlowCode(e){return this.flow.code+=e,this}addFlowTab(){return this.tab+=" ",this}removeFlowTab(){return this.tab=this.tab.slice(0,-1),this}getFlowData(e){return this.flowsData.get(e)}flowNode(e){let t=e.getNodeType(this),n=this.flowChildNode(e,t);return this.flowsData.set(e,n),n}addInclude(e){this.currentFunctionNode!==null&&this.currentFunctionNode.includes.push(e)}buildFunctionNode(e){let t=this.renderer.backend,n=ste.get(t);n===void 0&&(n=new WeakMap,ste.set(t,n));let r=n.get(e);if(r===void 0){r=new I4;let s=this.currentFunctionNode;this.currentFunctionNode=r,r.code=this.buildFunctionCode(e),this.currentFunctionNode=s,n.set(e,r)}return r}flowShaderNode(e){let t=e.layout,n={[Symbol.iterator](){let o=0,a=Object.values(this);return{next:()=>({value:a[o],done:o++>=a.length})}}};for(let o of t.inputs)n[o.name]=new w4(o.type,o.name);e.layout=null;let r=e.call(n),s=this.flowStagesNode(r,t.type);return e.layout=t,s}flowBuildStage(e,t,n=null){let r=this.getBuildStage();this.setBuildStage(t);let s=e.build(this,n);return this.setBuildStage(r),s}flowStagesNode(e,t=null){let n=this.flow,r=this.vars,s=this.declarations,o=this.cache,a=this.buildStage,l=this.stack,c={code:""};this.flow=c,this.vars={},this.declarations={},this.cache=new rS,this.stack=jR();for(let u of VR)this.setBuildStage(u),c.result=e.build(this,t);return c.vars=this.getVars(this.shaderStage),this.flow=n,this.vars=r,this.declarations=s,this.cache=o,this.stack=l,this.setBuildStage(a),c}getFunctionOperator(){return null}buildFunctionCode(){Xe("Abstract function.")}flowChildNode(e,t=null){let n=this.flow,r={code:""};return this.flow=r,r.result=e.build(this,t),this.flow=n,r}flowNodeFromShaderStage(e,t,n=null,r=null){let s=this.tab,o=this.cache,a=this.shaderStage,l=this.context;this.setShaderStage(e);let c={...this.context};delete c.nodeBlock,this.cache=this.globalCache,this.tab=" ",this.context=c;let u=null;if(this.buildStage==="generate"){let f=this.flowChildNode(t,n);r!==null&&(f.code+=`${this.tab+r} = ${f.result};4158+`).removeFlowTab();e.addFlowTab()}},Oi=(...i)=>new m7(Wg(i,"int")).toStack(),u3e=()=>hc("continue").toStack(),Qre=()=>hc("break").toStack(),jO=new WeakMap,sc=new xn,Xee=new WeakMap,$ee=me(({bufferMap:i,influence:e,stride:t,width:n,depth:r,offset:s})=>{let o=de(Lie).mul(t).add(s),a=o.div(n),l=o.sub(a.mul(n));return _s(i,kr(l,a)).depth(r).xyz.mul(e)});function h3e(i){let e=i.morphAttributes.position!==void 0,t=i.morphAttributes.normal!==void 0,n=i.morphAttributes.color!==void 0,r=i.morphAttributes.position||i.morphAttributes.normal||i.morphAttributes.color,s=r!==void 0?r.length:0,o=jO.get(i);if(o===void 0||o.count!==s){let T=function(){w.dispose(),jO.delete(i),i.removeEventListener("dispose",T)};o!==void 0&&o.texture.dispose();let a=i.morphAttributes.position||[],l=i.morphAttributes.normal||[],c=i.morphAttributes.color||[],u=0;e===!0&&(u=1),t===!0&&(u=2),n===!0&&(u=3);let f=i.attributes.position.count*u,d=1,A=4096;f>A&&(d=Math.ceil(f/A),f=A);let y=new Float32Array(f*d*4*s),w=new zA(y,f,d,s);w.type=cr,w.needsUpdate=!0;let S=u*4;for(let R=0;R<s;R++){let I=a[R],P=l[R],F=c[R],D=f*d*4*R;for(let L=0;L<I.count;L++){let C=L*S;e===!0&&(sc.fromBufferAttribute(I,L),y[D+C+0]=sc.x,y[D+C+1]=sc.y,y[D+C+2]=sc.z,y[D+C+3]=0),t===!0&&(sc.fromBufferAttribute(P,L),y[D+C+4]=sc.x,y[D+C+5]=sc.y,y[D+C+6]=sc.z,y[D+C+7]=0),n===!0&&(sc.fromBufferAttribute(F,L),y[D+C+8]=sc.x,y[D+C+9]=sc.y,y[D+C+10]=sc.z,y[D+C+11]=F.itemSize===4?sc.w:1)}}o={count:s,texture:w,stride:u,size:new Oe(f,d)},jO.set(i,o),i.addEventListener("dispose",T)}return o}var Jre=me(([i])=>{let{geometry:e}=i,t=e.morphAttributes.position!==void 0,n=e.hasAttribute("normal")&&e.morphAttributes.normal!==void 0,r=e.morphAttributes.position||e.morphAttributes.normal||e.morphAttributes.color,s=r!==void 0?r.length:0;if(s===0)return;let o=Xee.get(i);(o===void 0||o.count!==s)&&(o={base:Xt(1),influences:i.morphTargetInfluences?$o(i.morphTargetInfluences,"float"):null,count:s},Xee.set(i,o));let{base:a,influences:l}=o,{texture:c,stride:u,size:f}=h3e(e);t===!0&&Mr.mulAssign(a),n===!0&&wa.mulAssign(a);let d=de(f.width);Oi(s,({i:A})=>{let y=oe(0).toVar();i.count>1&&i.morphTexture!==null&&i.morphTexture!==void 0?y.assign(_s(i.morphTexture,kr(de(A).add(1),de(Xu))).r):y.assign(l.element(A).toVar()),$t(y.notEqual(0),()=>{t===!0&&Mr.addAssign($ee({bufferMap:c,influence:y,stride:u,width:d,depth:A,offset:de(0)})),n===!0&&wa.addAssign($ee({bufferMap:c,influence:y,stride:u,width:d,depth:A,offset:de(1)}))})}),NS(({object:A})=>{let{base:y,influences:w}=o;A.geometry.morphTargetsRelative?y.value=1:y.value=1-A.morphTargetInfluences.reduce((S,T)=>S+T,0),w&&(w.array=A.morphTargetInfluences,w.update())})},"void"),_m=class extends Kt{static get type(){return"LightingNode"}constructor(){super("vec3"),this.isLightingNode=!0}},A7=class extends _m{static get type(){return"AONode"}constructor(e=null){super(),this.aoNode=e}setup(e){e.context.ambientOcclusion.mulAssign(this.aoNode)}},g7=class extends pS{static get type(){return"LightingContextNode"}constructor(e,t=null,n=[],r=null,s=null){super(e),this.lightingModel=t,this.materialLightings=n,this.backdropNode=r,this.backdropAlphaNode=s,this._value=null}getContext(){let{materialLightings:e,backdropNode:t,backdropAlphaNode:n}=this,r=pe().toVar("directDiffuse"),s=pe().toVar("directSpecular"),o=pe().toVar("indirectDiffuse"),a=pe().toVar("indirectSpecular"),l={directDiffuse:r,directSpecular:s,indirectDiffuse:o,indirectSpecular:a};return{radiance:pe().toVar("radiance"),irradiance:pe().toVar("irradiance"),iblIrradiance:pe().toVar("iblIrradiance"),ambientOcclusion:oe(1).toVar("ambientOcclusion"),reflectedLight:l,materialLightings:e,backdrop:t,backdropAlpha:n}}setup(e){return this.value=this._value||(this._value=this.getContext()),this.value.lightingModel=this.lightingModel||e.context.lightingModel,super.setup(e)}},ese=$n(g7),v7=class extends _m{static get type(){return"IrradianceNode"}constructor(e){super(),this.node=e}setup(e){e.context.irradiance.addAssign(this.node)}},Lg=new Oe,mx=class extends su{static get type(){return"ViewportTextureNode"}constructor(e=ju,t=null,n=null){let r=null;n===null?(r=new WA,r.minFilter=Go,n=r):r=n,super(n,e,t),this.generateMipmaps=!1,this.defaultFramebuffer=r,this.isOutputTextureNode=!0,this.updateBeforeType=yn.RENDER,this._cacheTextures=new WeakMap}getTextureForReference(e=null){let t,n;if(this.referenceNode?(t=this.referenceNode.defaultFramebuffer,n=this.referenceNode._cacheTextures):(t=this.defaultFramebuffer,n=this._cacheTextures),e===null)return t;if(n.has(e)===!1){let r=t.clone();n.set(e,r)}return n.get(e)}updateReference(e){let t=e.renderer,n=t.getRenderTarget(),r=t.getCanvasTarget(),s=n||r;return this.value=this.getTextureForReference(s),this.value}updateBefore(e){let t=e.renderer,n=t.getRenderTarget(),r=t.getCanvasTarget(),s=n||r;s===null?t.getDrawingBufferSize(Lg):s.getDrawingBufferSize?s.getDrawingBufferSize(Lg):Lg.set(s.width,s.height);let o=this.getTextureForReference(s);(o.image.width!==Lg.width||o.image.height!==Lg.height)&&(o.image.width=Lg.width,o.image.height=Lg.height,o.needsUpdate=!0);let a=o.generateMipmaps;o.generateMipmaps=this.generateMipmaps,t.copyFramebufferToTexture(o),o.generateMipmaps=a}clone(){let e=new this.constructor(this.uvNode,this.levelNode,this.value);return e.generateMipmaps=this.generateMipmaps,e}},f3e=$n(mx).setParameterLength(0,3),mV=$n(mx,null,null,{generateMipmaps:!0}).setParameterLength(0,3),d3e=mV(),tse=(i=ju,e=null)=>d3e.sample(i,e),XO=null,_7=class extends mx{static get type(){return"ViewportDepthTextureNode"}constructor(e=ju,t=null,n=null){n===null&&(XO===null&&(XO=new Es),n=XO),super(e,t,n)}},AV=$n(_7).setParameterLength(0,3),Zu=class i extends Kt{static get type(){return"ViewportDepthNode"}constructor(e,t=null){super("float"),this.scope=e,this.valueNode=t,this.isViewportDepthNode=!0}generate(e){let{scope:t}=this;return t===i.DEPTH_BASE?e.getFragDepth():super.generate(e)}setup({camera:e}){let{scope:t}=this,n=this.valueNode,r=null;if(t===i.DEPTH_BASE)n!==null&&(r=rse().assign(n));else if(t===i.DEPTH)e.isPerspectiveCamera?r=gV(xs.z,lm,cm):r=Yg(xs.z,lm,cm);else if(t===i.LINEAR_DEPTH)if(n!==null)if(e.isPerspectiveCamera){let s=DP(n,lm,cm);r=Yg(s,lm,cm)}else r=n;else r=Yg(xs.z,lm,cm);return r}};Zu.DEPTH_BASE="depthBase";Zu.DEPTH="depth";Zu.LINEAR_DEPTH="linearDepth";var Yg=(i,e,t)=>i.add(e).div(e.sub(t)),p3e=(i,e,t)=>i.add(t).div(t.sub(e)),nse=me(([i,e,t],n)=>n.renderer.reversedDepthBuffer===!0?t.sub(e).mul(i).sub(t):e.sub(t).mul(i).sub(e)),gV=(i,e,t)=>e.add(i).mul(t).div(t.sub(e).mul(i)),ise=(i,e,t)=>e.mul(i.add(t)).div(i.mul(e.sub(t))),DP=me(([i,e,t],n)=>n.renderer.reversedDepthBuffer===!0?e.mul(t).div(e.sub(t).mul(i).sub(e)):e.mul(t).div(t.sub(e).mul(i).sub(t))),NP=(i,e,t)=>{e=e.max(1e-6).toVar();let n=Af(i.negate().div(e)),r=Af(t.div(e));return n.div(r)},m3e=(i,e,t)=>{let n=i.mul(wP(t.div(e)));return oe(Math.E).pow(n).mul(e).negate()},rse=$n(Zu,Zu.DEPTH_BASE),vV=xt(Zu,Zu.DEPTH),y4=$n(Zu,Zu.LINEAR_DEPTH).setParameterLength(0,1),A3e=y4(AV());vV.assign=i=>rse(i);var wf=class i extends Kt{static get type(){return"ClippingNode"}constructor(e=i.DEFAULT){super(),this.scope=e}setup(e){super.setup(e);let t=e.clippingContext,{intersectionPlanes:n,unionPlanes:r}=t;return this.hardwareClipping=e.hardwareClipping,this.scope===i.ALPHA_TO_COVERAGE?this.setupAlphaToCoverage(n,r):this.scope===i.HARDWARE?this.setupHardwareClipping(r,e):this.setupDefault(n,r)}setupAlphaToCoverage(e,t){return me(()=>{let n=oe().toVar("distanceToPlane"),r=oe().toVar("distanceToGradient"),s=oe(1).toVar("clipOpacity"),o=t.length;if(this.hardwareClipping===!1&&o>0){let l=$o(t).setGroup(Jt);Oi(o,({i:c})=>{let u=l.element(c);n.assign(xs.dot(u.xyz).negate().add(u.w)),r.assign(n.fwidth().div(2)),s.mulAssign(mc(r.negate(),r,n))})}let a=e.length;if(a>0){let l=$o(e).setGroup(Jt),c=oe(1).toVar("intersectionClipOpacity");Oi(a,({i:u})=>{let f=l.element(u);n.assign(xs.dot(f.xyz).negate().add(f.w)),r.assign(n.fwidth().div(2)),c.mulAssign(mc(r.negate(),r,n).oneMinus())}),s.mulAssign(c.oneMinus())}Bi.a.mulAssign(s),Bi.a.equal(0).discard()})()}setupDefault(e,t){return me(()=>{let n=t.length;if(this.hardwareClipping===!1&&n>0){let s=$o(t).setGroup(Jt);Oi(n,({i:o})=>{let a=s.element(o);xs.dot(a.xyz).greaterThan(a.w).discard()})}let r=e.length;if(r>0){let s=$o(e).setGroup(Jt),o=dc(!0).toVar("clipped");Oi(r,({i:a})=>{let l=s.element(a);o.assign(xs.dot(l.xyz).greaterThan(l.w).and(o))}),o.discard()}})()}setupHardwareClipping(e,t){let n=e.length;return t.enableHardwareClipping(n),me(()=>{let r=$o(e).setGroup(Jt),s=tp(t.getClipDistance());Oi(n,({i:o})=>{let a=r.element(o),l=xs.dot(a.xyz).sub(a.w).negate();s.element(o).assign(l)})})()}};wf.ALPHA_TO_COVERAGE="alphaToCoverage";wf.DEFAULT="default";wf.HARDWARE="hardware";var g3e=()=>new wf,v3e=()=>new wf(wf.ALPHA_TO_COVERAGE),_3e=()=>new wf(wf.HARDWARE),x3e=.05,Yee=me(([i])=>$u(Tn(1e4,Ka(Tn(17,i.x).add(Tn(.1,i.y)))).mul(Ps(.1,fr(Ka(Tn(13,i.y).add(i.x))))))),Zee=me(([i])=>Yee(dt(Yee(i.xy),i.z))),y3e=me(([i])=>{let e=zr(vf(Iz(i.xyz)),vf(Lz(i.xyz))),t=oe(1).div(oe(x3e).mul(e)).toVar("pixScale"),n=dt(fx(gf(Af(t))),fx(SP(Af(t)))),r=dt(Zee(gf(n.x.mul(i.xyz))),Zee(gf(n.y.mul(i.xyz)))),s=$u(Af(t)),o=Ps(Tn(s.oneMinus(),r.x),Tn(s,r.y)),a=Pl(s,s.oneMinus()),l=pe(o.mul(o).div(Tn(2,a).mul(ai(1,a))),o.sub(Tn(.5,a)).div(ai(1,a)),ai(1,ai(1,o).mul(ai(1,o)).div(Tn(2,a).mul(ai(1,a))))),c=o.lessThan(a.oneMinus()).select(o.lessThan(a).select(l.x,l.y),l.z);return Yu(c,1e-6,1)}).setLayout({name:"getAlphaHashThreshold",type:"float",inputs:[{name:"position",type:"vec3"}]}),x7=class extends m4{static get type(){return"VertexColorNode"}constructor(e){super(null,"vec4"),this.isVertexColorNode=!0,this.index=e}getAttributeName(){let e=this.index;return"color"+(e>0?e:"")}generate(e){let t=this.getAttributeName(e),n=e.hasGeometryAttribute(t),r;return n===!0?r=super.generate(e):r=e.generateConst(this.nodeType,new xn(1,1,1,1)),r}serialize(e){super.serialize(e),e.index=this.index}deserialize(e){super.deserialize(e),this.index=e.index}},sse=(i=0)=>new x7(i),Pr=class extends Hs{static get type(){return"NodeMaterial"}get type(){return this.constructor.type}set type(e){}constructor(){super(),this.isNodeMaterial=!0,this.fog=!0,this.lights=!1,this.lightsNode=null,this.envNode=null,this.aoNode=null,this.colorNode=null,this.normalNode=null,this.opacityNode=null,this.backdropNode=null,this.backdropAlphaNode=null,this.alphaTestNode=null,this.maskNode=null,this.maskShadowNode=null,this.positionNode=null,this.geometryNode=null,this.depthNode=null,this.receivedShadowPositionNode=null,this.castShadowPositionNode=null,this.receivedShadowNode=null,this.castShadowNode=null,this.outputNode=null,this.mrtNode=null,this.fragmentNode=null,this.vertexNode=null,this.contextNode=null}_getNodeChildren(){let e=[];for(let t of Object.getOwnPropertyNames(this)){if(t.startsWith("_")===!0)continue;let n=this[t];n&&n.isNode===!0&&e.push({property:t,childNode:n})}return e}customProgramCacheKey(){let e=[];for(let{property:t,childNode:n}of this._getNodeChildren())e.push(yx(t.slice(0,-4)),n.getCacheKey());return this.type+LS(e)}build(e){this.setup(e)}setupObserver(e){return new bU(e)}setup(e){e.context.setupNormal=()=>$g(this.setupNormal(e),"NORMAL","vec3"),e.context.setupPositionView=()=>this.setupPositionView(e),e.context.setupModelViewProjection=()=>this.setupModelViewProjection(e);let t=e.renderer,n=t.getRenderTarget();e.addStack();let r=this.setupVertex(e),s=$g(this.vertexNode||r,"VERTEX");e.context.clipSpace=s,e.stack.outputNode=s,this.setupHardwareClipping(e),this.geometryNode!==null&&(e.stack.outputNode=e.stack.outputNode.bypass(this.geometryNode)),e.addFlow("vertex",e.removeStack()),e.addStack();let o,a=this.setupClipping(e);if((this.depthWrite===!0||this.depthTest===!0)&&(n!==null?n.depthBuffer===!0&&this.setupDepth(e):t.depth===!0&&this.setupDepth(e)),this.fragmentNode===null){this.setupDiffuseColor(e),this.setupAmbientOcclusion(e),this.setupVariants(e);let l=this.setupLighting(e);a!==null&&e.stack.addToStack(a);let c=Ft(l,Bi.a).max(0);o=this.setupOutput(e,c),ox.assign(o);let u=this.outputNode!==null;if(u&&(o=this.outputNode),e.context.getOutput&&(o=e.context.getOutput(o,e)),n!==null){let f=t.getMRT(),d=this.mrtNode;f!==null?(u&&ox.assign(o),o=f,d!==null&&(o=f.merge(d))):d!==null&&(o=d)}}else{let l=this.fragmentNode;l.isOutputStructNode!==!0&&(l=l.convert(e.getOutputType())),o=this.setupOutput(e,l)}e.stack.outputNode=o,e.addFlow("fragment",e.removeStack()),e.observer=this.setupObserver(e)}setupClipping(e){if(e.clippingContext===null)return null;let{unionPlanes:t,intersectionPlanes:n}=e.clippingContext,r=null;if(t.length>0||n.length>0){let s=e.renderer.currentSamples;this.alphaToCoverage&&s>1?r=v3e():e.stack.addToStack(g3e())}return r}setupHardwareClipping(e){if(e.hardwareClipping=!1,e.clippingContext===null)return;let t=e.clippingContext.unionPlanes.length;t>0&&t<=8&&e.isAvailable("clipDistance")&&(e.stack.addToStack(_3e()),e.hardwareClipping=!0)}setupDepth(e){let{renderer:t,camera:n}=e,r=this.depthNode;if(r===null){let s=t.getMRT();s&&s.has("depth")?r=s.get("depth"):t.logarithmicDepthBuffer===!0&&(n.isPerspectiveCamera?r=NP(xs.z,lm,cm):r=Yg(xs.z,lm,cm))}r!==null&&vV.assign(r).toStack()}setupPositionView(){return bf.mul(Mr).xyz}setupModelViewProjection(){return Ja.mul(xs)}setupVertex(e){return e.addStack(),this.setupPosition(e),e.context.position=e.removeStack(),qre}setupPosition(e){let{object:t,geometry:n}=e;if((n.morphAttributes.position||n.morphAttributes.normal||n.morphAttributes.color)&&Jre(t),t.isSkinnedMesh===!0&&Kre(t),this.displacementMap){let r=Xd("displacementMap","texture"),s=Xd("displacementScale","float"),o=Xd("displacementBias","float");Mr.addAssign(wa.normalize().mul(r.x.mul(s).add(o)))}return t.isBatchedMesh&&$re(t),t.isInstancedMesh&&t.instanceMatrix&&t.instanceMatrix.isInstancedBufferAttribute===!0&&Xre(t),this.positionNode!==null&&Mr.assign($g(this.positionNode,"POSITION","vec3")),Mr}setupDiffuseColor(e){let{object:t,geometry:n}=e;this.maskNode!==null&&dc(this.maskNode).not().discard();let r=this.colorNode?Ft(this.colorNode):gre;this.vertexColors===!0&&n.hasAttribute("color")&&(r=r.mul(sse())),t.instanceColor&&(r=fV.mul(r)),t.isBatchedMesh&&t._colorsTexture&&(r=dV.mul(r)),Bi.assign(r);let s=this.opacityNode?oe(this.opacityNode):oV;Bi.a.assign(Bi.a.mul(s));let o=null;(this.alphaTestNode!==null||this.alphaTest>0)&&(o=this.alphaTestNode!==null?oe(this.alphaTestNode):Are,this.alphaToCoverage===!0?(Bi.a=mc(o,o.add(Nz(Bi.a)),Bi.a),Bi.a.lessThanEqual(0).discard()):Bi.a.lessThanEqual(o).discard()),this.alphaHash===!0&&Bi.a.lessThan(y3e(Mr)).discard(),e.isOpaque()&&Bi.a.assign(1)}setupVariants(){}setupOutgoingLight(){return this.lights===!0?pe(0):Bi.rgb}setupNormal(){return this.normalNode?pe(this.normalNode):Sre}setupEnvironment(){let e=null;return this.envNode?e=this.envNode:this.envMap&&(e=this.envMap.isCubeTexture?Xd("envMap","cubeTexture"):Xd("envMap","texture")),e}setupLightMap(e){let t=null;return e.material.lightMap&&(t=new v7(hV)),t}setupMaterialLightings(e){let t=[];if(e.renderer.lighting.enabled===!1)return t;let n=this.setupEnvironment(e);n&&n.isLightingNode&&t.push(n);let r=this.setupLightMap(e);return r&&r.isLightingNode&&t.push(r),e.context.ambientOcclusion&&t.push(new A7(e.context.ambientOcclusion)),t}setupAmbientOcclusion(e){let t=this.aoNode;t===null&&e.material.aoMap&&(t=Gre),e.context.getAO&&(t=e.context.getAO(t,e)),t!==null&&(DU.assign(t),e.context.ambientOcclusion=DU)}setupLightingModel(){}setupLighting(e){let{material:t}=e,{backdropNode:n,backdropAlphaNode:r,emissiveNode:s}=this,o=this.lights===!0||this.lightsNode!==null,a=this.lights===!0?this.setupMaterialLightings(e):[],l=o?this.lightsNode||e.lightsNode:null,c=this.setupOutgoingLight(e);if(l&&(a.length>0||l.getScope().hasLights)){let u=this.setupLightingModel(e)||null;c=ese(l,u,a,n,r)}else n!==null&&(c=pe(r!==null?Qn(c,n,r):n));return(s&&s.isNode===!0||t.emissive&&t.emissive.isColor===!0)&&(LU.assign(pe(s||_re)),c=c.add(LU)),c}setupFog(e,t){let n=e.fogNode;return n&&(ox.assign(t),t=Ft(n.toVar())),t}setupPremultipliedAlpha(e,t){return Xz(t)}setupOutput(e,t){return this.fog===!0&&(t=this.setupFog(e,t)),this.premultipliedAlpha===!0&&(t=this.setupPremultipliedAlpha(e,t)),t}setDefaultValues(e){for(let n in e){let r=e[n];this[n]===void 0&&(this[n]=r,r&&r.clone&&(this[n]=r.clone()))}let t=Object.getOwnPropertyDescriptors(e.constructor.prototype);for(let n in t)Object.getOwnPropertyDescriptor(this.constructor.prototype,n)===void 0&&t[n].get!==void 0&&Object.defineProperty(this.constructor.prototype,n,t[n])}toJSON(e){let t=e===void 0||typeof e=="string";t&&(e={textures:{},images:{},nodes:{}});let n=Hs.prototype.toJSON.call(this,e);n.inputNodes={};for(let{property:s,childNode:o}of this._getNodeChildren())n.inputNodes[s]=o.toJSON(e).uuid;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),a=r(e.nodes);s.length>0&&(n.textures=s),o.length>0&&(n.images=o),a.length>0&&(n.nodes=a)}return n}copy(e){let t=Object.getOwnPropertyDescriptors(this.constructor.prototype);for(let n in t)if(t[n].set!==void 0&&e[n]!==void 0){let r=e[n];this[n]&&this[n].copy!==void 0?this[n].copy(r):this[n]=r}for(let n in this)if(!/^(?:is[A-Z]|_)|^(?:id|uuid|version|type|userData|clippingPlanes)$/.test(n)&&this[n]!==void 0&&e[n]!==void 0){let r=e[n];this[n]&&this[n].copy!==void 0?this[n].copy(r):this[n]=r}return this.clippingPlanes=e.clippingPlanes?e.clippingPlanes.map(n=>n.clone()):null,this.userData=JSON.parse(JSON.stringify(e.userData)),this}},b3e=new Iu,y7=class extends Pr{static get type(){return"LineBasicNodeMaterial"}constructor(e){super(),this.isLineBasicNodeMaterial=!0,this.setDefaultValues(b3e),this.setValues(e)}},w3e=new eb,b7=class extends Pr{static get type(){return"LineDashedNodeMaterial"}constructor(e){super(),this.isLineDashedNodeMaterial=!0,this.setDefaultValues(w3e),this.dashOffset=0,this.offsetNode=null,this.dashScaleNode=null,this.dashSizeNode=null,this.gapSizeNode=null,this.setValues(e)}setupVariants(){let e=this.offsetNode?oe(this.offsetNode):uV,t=this.dashScaleNode?oe(this.dashScaleNode):aV,n=this.dashSizeNode?oe(this.dashSizeNode):lV,r=this.gapSizeNode?oe(this.gapSizeNode):cV;Xg.assign(n),dS.assign(r);let s=ym(fc("lineDistance").mul(t));(e?s.add(e):s).mod(Xg.add(dS)).greaterThan(Xg).discard()}};var JR=c1("vec3","worldStart"),w7=c1("vec3","worldEnd"),ose=c1("float","lineDistance"),Ug=c1("vec4","worldPos"),Kee=me(({start:i,end:e})=>{let t=Ja.element(2).element(2),n=Ja.element(3).element(2);return t.greaterThan(0).select(n.negate().div(t.add(1)),n.mul(-.5).div(t)).sub(i.z).div(e.z.sub(i.z))},{start:"vec4",end:"vec4",return:"float"}),S3e=me(({p1:i,p2:e,p3:t,p4:n})=>{let r=i.sub(t),s=n.sub(t),o=e.sub(i),a=r.dot(s),l=s.dot(o),c=r.dot(o),u=s.dot(s),d=o.dot(o).mul(u).sub(l.mul(l)),y=a.mul(l).sub(c.mul(u)).div(d).clamp(),w=a.add(l.mul(y)).div(u).clamp();return dt(y,w)},{p1:"vec3",p2:"vec3",p3:"vec3",p4:"vec3",return:"vec2"}),blt=me(({material:i})=>{let e=i._useDash,t=i._useWorldUnits,n=fc("instanceStart"),r=fc("instanceEnd"),s=Ft(bf.mul(Ft(n,1))).toVar("start"),o=Ft(bf.mul(Ft(r,1))).toVar("end"),a,l;e&&(a=oe(fc("instanceDistanceStart")).toVar("distanceStart"),l=oe(fc("instanceDistanceEnd")).toVar("distanceEnd")),t&&(JR.assign(s.xyz),w7.assign(o.xyz));let c=ux.z.div(ux.w),u=Ja.element(2).element(3).equal(-1);if($t(u,()=>{$t(s.z.lessThan(0).and(o.z.greaterThan(0)),()=>{let T=Kee({start:s,end:o});o.assign(Ft(Qn(s.xyz,o.xyz,T),o.w)),e&&l.assign(Qn(a,l,T))}).ElseIf(o.z.lessThan(0).and(s.z.greaterThanEqual(0)),()=>{let T=Kee({start:o,end:s});s.assign(Ft(Qn(o.xyz,s.xyz,T),s.w)),e&&a.assign(Qn(l,a,T))})}),e){let T=i.dashScaleNode?oe(i.dashScaleNode):aV,R=i.offsetNode?oe(i.offsetNode):uV,I=va.y.lessThan(.5).select(T.mul(a),T.mul(l));I=I.add(R),ose.assign(I)}let f=Ja.mul(s),d=Ja.mul(o),A=f.xyz.div(f.w),y=d.xyz.div(d.w),w=y.xy.sub(A.xy).toVar();w.x.assign(w.x.mul(c)),w.assign(w.normalize());let S=Ft().toVar();if(t){let T=o.xyz.sub(s.xyz).normalize(),R=Qn(s.xyz,o.xyz,.5).normalize(),I=T.cross(R).normalize(),P=T.cross(I);Ug.assign(va.y.lessThan(.5).select(s,o));let F=v4.mul(.5);Ug.addAssign(Ft(va.x.lessThan(0).select(I.mul(F),I.mul(F).negate()),0)),e||(Ug.addAssign(Ft(va.y.lessThan(.5).select(T.mul(F).negate(),T.mul(F)),0)),Ug.addAssign(Ft(P.mul(F),0)),$t(va.y.greaterThan(1).or(va.y.lessThan(0)),()=>{Ug.subAssign(Ft(P.mul(2).mul(F),0))})),S.assign(Ja.mul(Ug));let D=pe().toVar();D.assign(va.y.lessThan(.5).select(A,y)),S.z.assign(D.z.mul(S.w))}else{let T=dt(w.y,w.x.negate()).toVar("offset");w.x.assign(w.x.div(c)),T.x.assign(T.x.div(c)),T.assign(va.x.lessThan(0).select(T.negate(),T)),$t(va.y.lessThan(0),()=>{T.assign(T.sub(w))}).ElseIf(va.y.greaterThan(1),()=>{T.assign(T.add(w))}),T.assign(T.mul(v4)),T.assign(T.div(ux.w.div(Kz))),S.assign(va.y.lessThan(.5).select(f,d)),T.assign(T.mul(S.w)),S.assign(S.add(Ft(T,0,0)))}return S})(),wlt=me(({material:i,renderer:e})=>{let t=i._useAlphaToCoverage,n=i._useDash,r=i._useWorldUnits,s=Ui();if(n){let a=i.dashSizeNode?oe(i.dashSizeNode):lV,l=i.gapSizeNode?oe(i.gapSizeNode):cV;Xg.assign(a),dS.assign(l),s.y.lessThan(-1).or(s.y.greaterThan(1)).discard(),ose.mod(Xg.add(dS)).greaterThan(Xg).discard()}let o=oe(1).toVar("alpha");if(r){let a=Ug.xyz.normalize().mul(1e5),l=w7.sub(JR),c=S3e({p1:JR,p2:w7,p3:pe(0,0,0),p4:a}),u=JR.add(l.mul(c.x)),f=a.mul(c.y),y=u.sub(f).length().div(v4);if(!n)if(t&&e.currentSamples>0){let w=y.fwidth();o.assign(mc(w.negate().add(.5),w.add(.5),y).oneMinus())}else y.greaterThan(.5).discard()}else if(t&&e.currentSamples>0){let a=s.x,l=s.y.greaterThan(0).select(s.y.sub(1),s.y.add(1)),c=a.mul(a).add(l.mul(l)),u=oe(c.fwidth()).toVar("dlen");$t(s.y.abs().greaterThan(1),()=>{o.assign(mc(u.oneMinus(),u.add(1),c).oneMinus())})}else $t(s.y.abs().greaterThan(1),()=>{let a=s.x,l=s.y.greaterThan(0).select(s.y.sub(1),s.y.add(1));a.mul(a).add(l.mul(l)).greaterThan(1).discard()});return o})();var T3e=new Q2,S7=class extends Pr{static get type(){return"MeshNormalNodeMaterial"}constructor(e){super(),this.isMeshNormalNodeMaterial=!0,this.setDefaultValues(T3e),this.setValues(e)}setupDiffuseColor(){let e=this.opacityNode?oe(this.opacityNode):oV;Bi.assign(EP(Ft(rV(hi),e),Fr))}},_V=me(([i=Jz])=>{let e=i.z.atan(i.x).mul(1/(Math.PI*2)).add(.5),t=i.y.clamp(-1,1).asin().mul(1/Math.PI).add(.5);return dt(e,t)}),T7=me(([i=Ui()])=>{let e=i.x.sub(.5).mul(Math.PI*2),t=i.y.sub(.5).mul(Math.PI),n=t.cos(),r=n.mul(e.cos()),s=t.sin(),o=n.mul(e.sin());return pe(r,s,o)}),b4=class extends Ba{constructor(e=1,t={}){super(e,e,t),this.isCubeRenderTarget=!0;let n={width:e,height:e,depth:1},r=[n,n,n,n,n,n];this.texture=new Ph(r),this._setTextureOptions(t),this.texture.isRenderTargetTexture=!0}fromEquirectangularTexture(e,t){let n=t.minFilter,r=t.generateMipmaps;t.generateMipmaps=!0,this.texture.type=t.type,this.texture.colorSpace=t.colorSpace,this.texture.generateMipmaps=t.generateMipmaps,this.texture.minFilter=t.minFilter,this.texture.magFilter=t.magFilter;let s=new Lu(5,5,5),o=_V(Jz),a=new Pr;a.colorNode=fi(t,o,0),a.side=mi,a.blending=ps;let l=new Hn(s,a),c=new s0;c.add(l),t.minFilter===Go&&(t.minFilter=Mi);let u=new o_(1,10,this),f=e.getMRT();return e.setMRT(null),u.update(e,c),e.setMRT(f),t.minFilter=n,t.generateMipmaps=r,l.geometry.dispose(),l.material.dispose(),this}clear(e,t=!0,n=!0,r=!0){let s=e.getRenderTarget();for(let o=0;o<6;o++)e.setRenderTarget(this,o),e.clear(t,n,r);e.setRenderTarget(s)}},aS=new WeakMap,E7=class extends Rr{static get type(){return"CubeMapNode"}constructor(e){super("vec3"),this.envNode=e,this._cubeTexture=null,this._cubeTextureNode=Qa(null);let t=new Ph;t.isRenderTargetTexture=!0,this._defaultTexture=t,this.updateBeforeType=yn.RENDER}updateBefore(e){let{renderer:t,material:n}=e,r=this.envNode;if(r.isTextureNode||r.isMaterialReferenceNode){let s=r.isTextureNode?r.value:n[r.property];if(s&&s.isTexture){let o=s.mapping;if(o===p0||o===m0){if(aS.has(s)){let a=aS.get(s);Qee(a,s.mapping),this._cubeTexture=a}else{let a=s.image;if(E3e(a)){let l=new b4(a.height);l.fromEquirectangularTexture(t,s),Qee(l.texture,s.mapping),this._cubeTexture=l.texture,aS.set(s,l.texture),s.addEventListener("dispose",ase)}else this._cubeTexture=this._defaultTexture}this._cubeTextureNode.value=this._cubeTexture}else this._cubeTextureNode=this.envNode}}}setup(e){return this.updateBefore(e),this._cubeTextureNode}};function E3e(i){return i==null?!1:i.height>0}function ase(i){let e=i.target;e.removeEventListener("dispose",ase);let t=aS.get(e);t!==void 0&&(aS.delete(e),t.dispose())}function Qee(i,e){e===p0?i.mapping=ec:e===m0&&(i.mapping=Gc)}var lse=$n(E7).setParameterLength(1),gS=class extends _m{static get type(){return"BasicEnvironmentNode"}constructor(e=null){super(),this.envNode=e}setup(e){e.context.environment=lse(this.envNode)}},M7=class extends _m{static get type(){return"BasicLightMapNode"}constructor(e=null){super(),this.lightMapNode=e}setup(e){let t=oe(1/Math.PI);e.context.irradianceLightMap=this.lightMapNode.mul(t)}},Ax=class{start(e){e.lightsNode.setupLights(e,e.lightsNode.getLightNodes(e)),this.indirect(e)}finish(){}direct(){}directRectArea(){}indirect(){}ambientOcclusion(){}},w4=class extends Ax{constructor(){super()}indirect({context:e}){let t=e.ambientOcclusion,n=e.reflectedLight,r=e.irradianceLightMap;n.indirectDiffuse.assign(Ft(0)),r?n.indirectDiffuse.addAssign(r):n.indirectDiffuse.addAssign(Ft(1,1,1,0)),n.indirectDiffuse.mulAssign(t),n.indirectDiffuse.mulAssign(Bi.rgb)}finish(e){let{material:t,context:n}=e,r=n.outgoingLight,s=e.context.environment;if(s)switch(t.combine){case tg:r.rgb.assign(Qn(r.rgb,r.rgb.mul(s.rgb),oS.mul(QR)));break;case BM:r.rgb.assign(Qn(r.rgb,s.rgb,oS.mul(QR)));break;case OM:r.rgb.addAssign(s.rgb.mul(oS.mul(QR)));break;default:Xe("BasicLightingModel: Unsupported .combine value:",t.combine);break}}},M3e=new fs,C7=class extends Pr{static get type(){return"MeshBasicNodeMaterial"}constructor(e){super(),this.isMeshBasicNodeMaterial=!0,this.lights=!0,this.setDefaultValues(M3e),this.setValues(e)}setupNormal(){return h1(dx)}setupEnvironment(e){let t=super.setupEnvironment(e);return t?new gS(t):null}setupLightMap(e){let t=null;return e.material.lightMap&&(t=new M7(hV)),t}setupOutgoingLight(){return Bi.rgb}setupLightingModel(){return new w4}},gx=me(({f0:i,f90:e,dotVH:t})=>{let n=t.mul(-5.55473).sub(6.98316).mul(t).exp2();return i.mul(n.oneMinus()).add(e.mul(n))}),i1=me(i=>i.diffuseColor.mul(1/Math.PI)),C3e=()=>oe(.25),R3e=me(({dotNH:i})=>l4.mul(oe(.5)).add(1).mul(oe(1/Math.PI)).mul(i.pow(l4))),P3e=me(({lightDirection:i})=>{let e=i.add(er).normalize(),t=hi.dot(e).clamp(),n=er.dot(e).clamp(),r=gx({f0:gm,f90:1,dotVH:n}),s=C3e(),o=R3e({dotNH:t});return r.mul(s).mul(o)}),S4=class extends w4{constructor(e=!0){super(),this.specular=e}direct({lightDirection:e,lightColor:t,reflectedLight:n}){let s=hi.dot(e).clamp().mul(t);n.directDiffuse.addAssign(s.mul(i1({diffuseColor:Bi.rgb}))),this.specular===!0&&n.directSpecular.addAssign(s.mul(P3e({lightDirection:e})).mul(oS))}indirect(e){let{ambientOcclusion:t,irradiance:n,reflectedLight:r}=e.context;r.indirectDiffuse.addAssign(n.mul(i1({diffuseColor:Bi}))),r.indirectDiffuse.mulAssign(t)}},I3e=new Ga,R7=class extends Pr{static get type(){return"MeshLambertNodeMaterial"}constructor(e){super(),this.isMeshLambertNodeMaterial=!0,this.lights=!0,this.setDefaultValues(I3e),this.setValues(e)}setupEnvironment(e){let t=super.setupEnvironment(e);return t?new gS(t):null}setupLightingModel(){return new S4(!1)}},L3e=new ZA,P7=class extends Pr{static get type(){return"MeshPhongNodeMaterial"}constructor(e){super(),this.isMeshPhongNodeMaterial=!0,this.lights=!0,this.shininessNode=null,this.specularNode=null,this.setDefaultValues(L3e),this.setValues(e)}setupEnvironment(e){let t=super.setupEnvironment(e);return t?new gS(t):null}setupLightingModel(){return new S4}setupVariants(){let e=(this.shininessNode?oe(this.shininessNode):vre).max(1e-4);l4.assign(e);let t=this.specularNode||xre;gm.assign(t)}},cse=me(i=>{if(i.geometry.hasAttribute("normal")===!1)return oe(0);let e=dx.dFdx().abs().max(dx.dFdy().abs());return e.x.max(e.y).max(e.z)}),xV=me(i=>{let{roughness:e}=i,t=cse(),n=e.max(.0525);return n=n.add(t),n=n.min(1),n}),use=me(({alpha:i,dotNL:e,dotNV:t})=>{let n=i.pow2(),r=e.mul(n.add(n.oneMinus().mul(t.pow2())).sqrt()),s=t.mul(n.add(n.oneMinus().mul(e.pow2())).sqrt());return pc(.5,r.add(s).max(bP))}).setLayout({name:"V_GGX_SmithCorrelated",type:"float",inputs:[{name:"alpha",type:"float"},{name:"dotNL",type:"float"},{name:"dotNV",type:"float"}]}),D3e=me(({alphaT:i,alphaB:e,dotTV:t,dotBV:n,dotTL:r,dotBL:s,dotNV:o,dotNL:a})=>{let l=a.mul(pe(i.mul(t),e.mul(n),o).length()),c=o.mul(pe(i.mul(r),e.mul(s),a).length());return pc(.5,l.add(c).max(bP))}).setLayout({name:"V_GGX_SmithCorrelated_Anisotropic",type:"float",inputs:[{name:"alphaT",type:"float",qualifier:"in"},{name:"alphaB",type:"float",qualifier:"in"},{name:"dotTV",type:"float",qualifier:"in"},{name:"dotBV",type:"float",qualifier:"in"},{name:"dotTL",type:"float",qualifier:"in"},{name:"dotBL",type:"float",qualifier:"in"},{name:"dotNV",type:"float",qualifier:"in"},{name:"dotNL",type:"float",qualifier:"in"}]}),hse=me(({alpha:i,dotNH:e})=>{let t=i.pow2(),n=e.pow2().mul(t.oneMinus()).oneMinus();return t.div(n.pow2()).mul(1/Math.PI)}).setLayout({name:"D_GGX",type:"float",inputs:[{name:"alpha",type:"float"},{name:"dotNH",type:"float"}]}),N3e=oe(1/Math.PI),F3e=me(({alphaT:i,alphaB:e,dotNH:t,dotTH:n,dotBH:r})=>{let s=i.mul(e),o=pe(e.mul(n),i.mul(r),s.mul(t)),a=o.dot(o),l=s.div(a);return N3e.mul(s.mul(l.pow2()))}).setLayout({name:"D_GGX_Anisotropic",type:"float",inputs:[{name:"alphaT",type:"float",qualifier:"in"},{name:"alphaB",type:"float",qualifier:"in"},{name:"dotNH",type:"float",qualifier:"in"},{name:"dotTH",type:"float",qualifier:"in"},{name:"dotBH",type:"float",qualifier:"in"}]}),yV=me(({lightDirection:i,f0:e,f90:t,roughness:n,f:r,normalView:s=hi,USE_IRIDESCENCE:o,USE_ANISOTROPY:a})=>{let l=n.pow2(),c=i.add(er).normalize(),u=s.dot(i).clamp(),f=s.dot(er).clamp(),d=s.dot(c).clamp(),A=er.dot(c).clamp(),y=gx({f0:e,f90:t,dotVH:A}),w,S;if(hx(o)&&(y=_P.mix(y,r)),hx(a)){let T=rS.dot(i),R=rS.dot(er),I=rS.dot(c),P=jg.dot(i),F=jg.dot(er),D=jg.dot(c);w=D3e({alphaT:a4,alphaB:l,dotTV:R,dotBV:F,dotTL:T,dotBL:P,dotNV:f,dotNL:u}),S=F3e({alphaT:a4,alphaB:l,dotNH:d,dotTH:I,dotBH:D})}else w=use({alpha:l,dotNL:u,dotNV:f}),S=hse({alpha:l,dotNH:d});return y.mul(w).mul(S)}),B3e=new Uint16Array([12469,15057,12620,14925,13266,14620,13807,14376,14323,13990,14545,13625,14713,13328,14840,12882,14931,12528,14996,12233,15039,11829,15066,11525,15080,11295,15085,10976,15082,10705,15073,10495,13880,14564,13898,14542,13977,14430,14158,14124,14393,13732,14556,13410,14702,12996,14814,12596,14891,12291,14937,11834,14957,11489,14958,11194,14943,10803,14921,10506,14893,10278,14858,9960,14484,14039,14487,14025,14499,13941,14524,13740,14574,13468,14654,13106,14743,12678,14818,12344,14867,11893,14889,11509,14893,11180,14881,10751,14852,10428,14812,10128,14765,9754,14712,9466,14764,13480,14764,13475,14766,13440,14766,13347,14769,13070,14786,12713,14816,12387,14844,11957,14860,11549,14868,11215,14855,10751,14825,10403,14782,10044,14729,9651,14666,9352,14599,9029,14967,12835,14966,12831,14963,12804,14954,12723,14936,12564,14917,12347,14900,11958,14886,11569,14878,11247,14859,10765,14828,10401,14784,10011,14727,9600,14660,9289,14586,8893,14508,8533,15111,12234,15110,12234,15104,12216,15092,12156,15067,12010,15028,11776,14981,11500,14942,11205,14902,10752,14861,10393,14812,9991,14752,9570,14682,9252,14603,8808,14519,8445,14431,8145,15209,11449,15208,11451,15202,11451,15190,11438,15163,11384,15117,11274,15055,10979,14994,10648,14932,10343,14871,9936,14803,9532,14729,9218,14645,8742,14556,8381,14461,8020,14365,7603,15273,10603,15272,10607,15267,10619,15256,10631,15231,10614,15182,10535,15118,10389,15042,10167,14963,9787,14883,9447,14800,9115,14710,8665,14615,8318,14514,7911,14411,7507,14279,7198,15314,9675,15313,9683,15309,9712,15298,9759,15277,9797,15229,9773,15166,9668,15084,9487,14995,9274,14898,8910,14800,8539,14697,8234,14590,7790,14479,7409,14367,7067,14178,6621,15337,8619,15337,8631,15333,8677,15325,8769,15305,8871,15264,8940,15202,8909,15119,8775,15022,8565,14916,8328,14804,8009,14688,7614,14569,7287,14448,6888,14321,6483,14088,6171,15350,7402,15350,7419,15347,7480,15340,7613,15322,7804,15287,7973,15229,8057,15148,8012,15046,7846,14933,7611,14810,7357,14682,7069,14552,6656,14421,6316,14251,5948,14007,5528,15356,5942,15356,5977,15353,6119,15348,6294,15332,6551,15302,6824,15249,7044,15171,7122,15070,7050,14949,6861,14818,6611,14679,6349,14538,6067,14398,5651,14189,5311,13935,4958,15359,4123,15359,4153,15356,4296,15353,4646,15338,5160,15311,5508,15263,5829,15188,6042,15088,6094,14966,6001,14826,5796,14678,5543,14527,5287,14377,4985,14133,4586,13869,4257,15360,1563,15360,1642,15358,2076,15354,2636,15341,3350,15317,4019,15273,4429,15203,4732,15105,4911,14981,4932,14836,4818,14679,4621,14517,4386,14359,4156,14083,3795,13808,3437,15360,122,15360,137,15358,285,15355,636,15344,1274,15322,2177,15281,2765,15215,3223,15120,3451,14995,3569,14846,3567,14681,3466,14511,3305,14344,3121,14037,2800,13753,2467,15360,0,15360,1,15359,21,15355,89,15346,253,15325,479,15287,796,15225,1148,15133,1492,15008,1749,14856,1882,14685,1886,14506,1783,14324,1608,13996,1398,13702,1183]),lf=null,vS=me(({roughness:i,dotNV:e})=>{lf===null&&(lf=new HA(B3e,16,16,Ws,Wi),lf.name="DFG_LUT",lf.minFilter=Mi,lf.magFilter=Mi,lf.wrapS=la,lf.wrapT=la,lf.generateMipmaps=!1,lf.needsUpdate=!0);let t=dt(i,e);return fi(lf,t).rg}),O3e=me(({lightDirection:i,f0:e,f90:t,roughness:n,f:r,USE_IRIDESCENCE:s,USE_ANISOTROPY:o})=>{let a=yV({lightDirection:i,f0:e,f90:t,roughness:n,f:r,USE_IRIDESCENCE:s,USE_ANISOTROPY:o}),l=hi.dot(i).clamp(),c=hi.dot(er).clamp(),u=vS({roughness:n,dotNV:c}),f=vS({roughness:n,dotNV:l}),d=e.mul(u.x).add(t.mul(u.y)),A=e.mul(f.x).add(t.mul(f.y)),y=u.x.add(u.y),w=f.x.add(f.y),S=oe(1).sub(y),T=oe(1).sub(w),R=e.add(e.oneMinus().mul(.047619)),I=d.mul(A).mul(R).div(oe(1).sub(S.mul(T).mul(R).mul(R)).add(bP)),P=S.mul(T),F=I.mul(P);return a.add(F)}),fse=me(i=>{let{dotNV:e,specularColor:t,specularF90:n,roughness:r}=i,s=vS({dotNV:e,roughness:r});return t.mul(s.x).add(n.mul(s.y))}),I7=me(({f:i,f90:e,dotVH:t})=>{let n=t.oneMinus().saturate(),r=n.mul(n),s=n.mul(r,r).clamp(0,.9999);return i.sub(pe(e).mul(s)).div(s.oneMinus())}).setLayout({name:"Schlick_to_F0",type:"vec3",inputs:[{name:"f",type:"vec3"},{name:"f90",type:"float"},{name:"dotVH",type:"float"}]}),U3e=me(({roughness:i,dotNH:e})=>{let t=i.pow2(),n=oe(1).div(t),s=e.pow2().oneMinus().max(.0078125);return oe(2).add(n).mul(s.pow(n.mul(.5))).div(2*Math.PI)}).setLayout({name:"D_Charlie",type:"float",inputs:[{name:"roughness",type:"float"},{name:"dotNH",type:"float"}]}),k3e=me(({dotNV:i,dotNL:e})=>oe(1).div(oe(4).mul(e.add(i).sub(e.mul(i))))).setLayout({name:"V_Neubelt",type:"float",inputs:[{name:"dotNV",type:"float"},{name:"dotNL",type:"float"}]}),z3e=me(({lightDirection:i})=>{let e=i.add(er).normalize(),t=hi.dot(i).clamp(),n=hi.dot(er).clamp(),r=hi.dot(e).clamp(),s=U3e({roughness:am,dotNH:r}),o=k3e({dotNV:n,dotNL:t});return cc.mul(s).mul(o)}),Jee=me(({N:i,V:e,roughness:t})=>{let s=.0078125,o=i.dot(e).saturate(),a=dt(t,o.oneMinus().sqrt());return a.assign(a.mul(.984375).add(s)),a}).setLayout({name:"LTC_Uv",type:"vec2",inputs:[{name:"N",type:"vec3"},{name:"V",type:"vec3"},{name:"roughness",type:"float"}]}),V3e=me(({f:i})=>{let e=i.length();return zr(e.mul(e).add(i.z).div(e.add(1)),0)}).setLayout({name:"LTC_ClippedSphereFormFactor",type:"float",inputs:[{name:"f",type:"vec3"}]}),xR=me(({v1:i,v2:e})=>{let t=i.dot(e),n=t.abs().toVar(),r=n.mul(.0145206).add(.4965155).mul(n).add(.8543985).toVar(),s=n.add(4.1616724).mul(n).add(3.417594).toVar(),o=r.div(s),a=t.greaterThan(0).select(o,zr(t.mul(t).oneMinus(),1e-7).inverseSqrt().mul(.5).sub(o));return i.cross(e).mul(a)}).setLayout({name:"LTC_EdgeVectorFormFactor",type:"vec3",inputs:[{name:"v1",type:"vec3"},{name:"v2",type:"vec3"}]}),$O=me(({N:i,V:e,P:t,mInv:n,p0:r,p1:s,p2:o,p3:a})=>{let l=s.sub(r).toVar(),c=a.sub(r).toVar(),u=l.cross(c),f=pe().toVar();return $t(u.dot(t.sub(r)).greaterThanEqual(0),()=>{let d=e.sub(i.mul(e.dot(i))).normalize(),A=i.cross(d).negate(),y=n.mul(To(d,A,i).transpose()).toVar(),w=y.mul(r.sub(t)).normalize().toVar(),S=y.mul(s.sub(t)).normalize().toVar(),T=y.mul(o.sub(t)).normalize().toVar(),R=y.mul(a.sub(t)).normalize().toVar(),I=pe(0).toVar();I.addAssign(xR({v1:w,v2:S})),I.addAssign(xR({v1:S,v2:T})),I.addAssign(xR({v1:T,v2:R})),I.addAssign(xR({v1:R,v2:w})),f.assign(pe(V3e({f:I})))}),f}).setLayout({name:"LTC_Evaluate",type:"vec3",inputs:[{name:"N",type:"vec3"},{name:"V",type:"vec3"},{name:"P",type:"vec3"},{name:"mInv",type:"mat3"},{name:"p0",type:"vec3"},{name:"p1",type:"vec3"},{name:"p2",type:"vec3"},{name:"p3",type:"vec3"}]});var FP=1/6,dse=i=>Tn(FP,Tn(i,Tn(i,i.negate().add(3)).sub(3)).add(1)),L7=i=>Tn(FP,Tn(i,Tn(i,Tn(3,i).sub(6))).add(4)),pse=i=>Tn(FP,Tn(i,Tn(i,Tn(-3,i).add(3)).add(3)).add(1)),D7=i=>Tn(FP,eu(i,3)),ete=i=>dse(i).add(L7(i)),tte=i=>pse(i).add(D7(i)),nte=i=>Ps(-1,L7(i).div(dse(i).add(L7(i)))),ite=i=>Ps(1,D7(i).div(pse(i).add(D7(i)))),rte=(i,e,t)=>{let n=i.uvNode,r=Tn(n,e.zw).add(.5),s=gf(r),o=$u(r),a=ete(o.x),l=tte(o.x),c=nte(o.x),u=ite(o.x),f=nte(o.y),d=ite(o.y),A=dt(s.x.add(c),s.y.add(f)).sub(.5).mul(e.xy),y=dt(s.x.add(u),s.y.add(f)).sub(.5).mul(e.xy),w=dt(s.x.add(c),s.y.add(d)).sub(.5).mul(e.xy),S=dt(s.x.add(u),s.y.add(d)).sub(.5).mul(e.xy),T=ete(o.y).mul(Ps(a.mul(i.sample(A).level(t)),l.mul(i.sample(y).level(t)))),R=tte(o.y).mul(Ps(a.mul(i.sample(w).level(t)),l.mul(i.sample(S).level(t))));return T.add(R)},bV=me(([i,e])=>{let t=dt(i.size(de(e))),n=dt(i.size(de(e.add(1)))),r=pc(1,t),s=pc(1,n),o=rte(i,Ft(r,t),gf(e)),a=rte(i,Ft(s,n),SP(e));return $u(e).mix(o,a)}),G3e=me(([i,e])=>{let t=e.mul(Yz(i));return bV(i,t)}),ste=me(([i,e,t,n,r])=>{let s=pe(Uz(e.negate(),ya(i),pc(1,n))),o=pe(vf(r[0].xyz),vf(r[1].xyz),vf(r[2].xyz));return ya(s).mul(t.mul(o))}).setLayout({name:"getVolumeTransmissionRay",type:"vec3",inputs:[{name:"n",type:"vec3"},{name:"v",type:"vec3"},{name:"thickness",type:"float"},{name:"ior",type:"float"},{name:"modelMatrix",type:"mat4"}]}),q3e=me(([i,e])=>i.mul(Yu(e.mul(2).sub(2),0,1))).setLayout({name:"applyIorToRoughness",type:"float",inputs:[{name:"roughness",type:"float"},{name:"ior",type:"float"}]}),H3e=mV(),W3e=tse(),ote=me(([i,e,t],{material:n})=>{let s=(n.side===mi?H3e:W3e).sample(i),o=Af(t1.x).mul(q3e(e,t));return bV(s,o)}),ate=me(([i,e,t])=>($t(t.notEqual(0),()=>{let n=wP(e).negate().div(t);return Tz(n.negate().mul(i))}),pe(1))).setLayout({name:"volumeAttenuation",type:"vec3",inputs:[{name:"transmissionDistance",type:"float"},{name:"attenuationColor",type:"vec3"},{name:"attenuationDistance",type:"float"}]}),j3e=me(([i,e,t,n,r,s,o,a,l,c,u,f,d,A,y])=>{let w,S;if(y){w=Ft().toVar(),S=pe().toVar();let F=u.sub(1).mul(y.mul(.025)),D=pe(u.sub(F),u,u.add(F));Oi({start:0,end:3},({i:L})=>{let C=D.element(L),B=ste(i,e,f,C,a),k=o.add(B),z=c.mul(l.mul(Ft(k,1))),G=dt(z.xy.div(z.w)).toVar();G.addAssign(1),G.divAssign(2),G.assign(dt(G.x,G.y.oneMinus()));let W=ote(G,t,C);w.element(L).assign(W.element(L)),w.a.addAssign(W.a),S.element(L).assign(n.element(L).mul(ate(vf(B),d,A).element(L)))}),w.a.divAssign(3)}else{let F=ste(i,e,f,u,a),D=o.add(F),L=c.mul(l.mul(Ft(D,1))),C=dt(L.xy.div(L.w)).toVar();C.addAssign(1),C.divAssign(2),C.assign(dt(C.x,C.y.oneMinus())),w=ote(C,t,u),S=n.mul(ate(vf(F),d,A))}let T=S.rgb.mul(w.rgb),R=i.dot(e).clamp(),I=pe(fse({dotNV:R,specularColor:r,specularF90:s,roughness:t})),P=S.r.add(S.g,S.b).div(3);return Ft(I.oneMinus().mul(T),w.a.oneMinus().mul(P).oneMinus())}),X3e=To(3.2404542,-.969266,.0556434,-1.5371385,1.8760108,-.2040259,-.4985314,.041556,1.0572252),$3e=i=>{let e=i.sqrt();return pe(1).add(e).div(pe(1).sub(e))},lte=(i,e)=>i.sub(e).div(i.add(e)).pow2(),Y3e=(i,e)=>{let t=i.mul(2*Math.PI*1e-9),n=pe(54856e-17,44201e-17,52481e-17),r=pe(1681e3,1795300,2208400),s=pe(43278e5,93046e5,66121e5),o=oe(9747e-17*Math.sqrt(2*Math.PI*45282e5)).mul(t.mul(2239900).add(e.x).cos()).mul(t.pow2().mul(-45282e5).exp()),a=n.mul(s.mul(2*Math.PI).sqrt()).mul(r.mul(t).add(e).cos()).mul(t.pow2().negate().mul(s).exp());return a=pe(a.x.add(o),a.y,a.z).div(10685e-11),X3e.mul(a)},cte=me(({outsideIOR:i,eta2:e,cosTheta1:t,thinFilmThickness:n,baseF0:r})=>{let s=Qn(i,e,mc(0,.03,n)),a=i.div(s).pow2().mul(t.pow2().oneMinus()).oneMinus();$t(a.lessThan(0),()=>pe(1));let l=a.sqrt(),c=lte(s,i),u=gx({f0:c,f90:1,dotVH:t}),f=u.oneMinus(),d=s.lessThan(i).select(Math.PI,0),A=oe(Math.PI).sub(d),y=$3e(r.clamp(0,.9999)),w=lte(y,s.toVec3()),S=gx({f0:w,f90:1,dotVH:l}),T=pe(y.x.lessThan(s).select(Math.PI,0),y.y.lessThan(s).select(Math.PI,0),y.z.lessThan(s).select(Math.PI,0)),R=s.mul(n,l,2),I=pe(A).add(T),P=u.mul(S).clamp(1e-5,.9999),F=P.sqrt(),D=f.pow2().mul(S).div(pe(1).sub(P)),C=u.add(D).toVar(),B=D.sub(f).toVar();return Oi({start:1,end:2,condition:"<=",name:"m"},({m:k})=>{B.mulAssign(F);let z=Y3e(oe(k).mul(R),oe(k).mul(I)).mul(2);C.addAssign(B.mul(z))}),C.max(pe(0))}).setLayout({name:"evalIridescence",type:"vec3",inputs:[{name:"outsideIOR",type:"float"},{name:"eta2",type:"float"},{name:"cosTheta1",type:"float"},{name:"thinFilmThickness",type:"float"},{name:"baseF0",type:"vec3"}]}),Uw=me(({normal:i,viewDir:e,roughness:t})=>{let n=i.dot(e).saturate(),r=t.mul(t),s=t.add(.1).reciprocal(),o=oe(-1.9362).add(t.mul(1.0678)).add(r.mul(.4573)).sub(s.mul(.8469)),a=oe(-.6014).add(t.mul(.5538)).sub(r.mul(.467)).sub(s.mul(.1255));return o.mul(n).add(a).exp().saturate()}),kw=pe(.04),yR=oe(1),T4=class extends Ax{constructor(e=!1,t=!1,n=!1,r=!1,s=!1,o=!1){super(),this.clearcoat=e,this.sheen=t,this.iridescence=n,this.anisotropy=r,this.transmission=s,this.dispersion=o,this.clearcoatRadiance=null,this.clearcoatSpecularDirect=null,this.clearcoatSpecularIndirect=null,this.sheenSpecularDirect=null,this.sheenSpecularIndirect=null,this.iridescenceFresnel=null,this.iridescenceF0=null,this.iridescenceF0Dielectric=null,this.iridescenceF0Metallic=null}start(e){if(this.clearcoat===!0&&(this.clearcoatRadiance=pe().toVar("clearcoatRadiance"),this.clearcoatSpecularDirect=pe().toVar("clearcoatSpecularDirect"),this.clearcoatSpecularIndirect=pe().toVar("clearcoatSpecularIndirect")),this.sheen===!0&&(this.sheenSpecularDirect=pe().toVar("sheenSpecularDirect"),this.sheenSpecularIndirect=pe().toVar("sheenSpecularIndirect")),this.iridescence===!0){let t=hi.dot(er).clamp(),n=cte({outsideIOR:oe(1),eta2:s4,cosTheta1:t,thinFilmThickness:o4,baseF0:gm}),r=cte({outsideIOR:oe(1),eta2:s4,cosTheta1:t,thinFilmThickness:o4,baseF0:Bi.rgb});this.iridescenceFresnel=Qn(n,r,Yd),this.iridescenceF0Dielectric=I7({f:n,f90:1,dotVH:t}),this.iridescenceF0Metallic=I7({f:r,f90:1,dotVH:t}),this.iridescenceF0=Qn(this.iridescenceF0Dielectric,this.iridescenceF0Metallic,Yd)}if(this.transmission===!0){let t=_f,n=Hie.sub(_f).normalize(),r=Sm,s=e.context;s.backdrop=j3e(r,n,pf,kg,Vg,Gg,t,tu,wm,Ja,sS,xz,bz,yz,this.dispersion?wz:null),s.backdropAlpha=c4,Bi.a.mulAssign(Qn(1,s.backdrop.a,c4))}super.start(e)}computeMultiscattering(e,t,n,r,s=null){let o=hi.dot(er).clamp(),a=vS({roughness:pf,dotNV:o}),l=s?_P.mix(r,s):r,c=l.mul(a.x).add(n.mul(a.y)),f=a.x.add(a.y).oneMinus(),d=l.add(l.oneMinus().mul(.047619)),A=c.mul(d).div(f.mul(d).oneMinus());e.addAssign(c),t.addAssign(A.mul(f))}direct({lightDirection:e,lightColor:t,reflectedLight:n}){let s=hi.dot(e).clamp().mul(t).toVar();if(this.sheen===!0){this.sheenSpecularDirect.addAssign(s.mul(z3e({lightDirection:e})));let o=Uw({normal:hi,viewDir:er,roughness:am}),a=Uw({normal:hi,viewDir:e,roughness:am}),l=cc.r.max(cc.g).max(cc.b).mul(o.max(a)).oneMinus();s.mulAssign(l)}if(this.clearcoat===!0){let a=um.dot(e).clamp().mul(t);this.clearcoatSpecularDirect.addAssign(a.mul(yV({lightDirection:e,f0:kw,f90:yR,roughness:sx,normalView:um})))}n.directDiffuse.addAssign(s.mul(i1({diffuseColor:kg}))),n.directSpecular.addAssign(s.mul(O3e({lightDirection:e,f0:Vg,f90:1,roughness:pf,f:this.iridescenceFresnel,USE_IRIDESCENCE:this.iridescence,USE_ANISOTROPY:this.anisotropy})))}directRectArea({lightColor:e,lightPosition:t,halfWidth:n,halfHeight:r,reflectedLight:s,ltc_1:o,ltc_2:a}){let l=t.add(n).sub(r),c=t.sub(n).sub(r),u=t.sub(n).add(r),f=t.add(n).add(r),d=hi,A=er,y=xs.toVar(),w=Jee({N:d,V:A,roughness:pf}),S=o.sample(w).toVar(),T=a.sample(w).toVar(),R=To(pe(S.x,0,S.y),pe(0,1,0),pe(S.z,0,S.w)).toVar(),I=Vg.mul(T.x).add(Gg.sub(Vg).mul(T.y)).toVar();if(s.directSpecular.addAssign(e.mul(I).mul($O({N:d,V:A,P:y,mInv:R,p0:l,p1:c,p2:u,p3:f}))),s.directDiffuse.addAssign(e.mul(kg).mul($O({N:d,V:A,P:y,mInv:To(1,0,0,0,1,0,0,0,1),p0:l,p1:c,p2:u,p3:f}))),this.clearcoat===!0){let P=um,F=Jee({N:P,V:A,roughness:sx}),D=o.sample(F),L=a.sample(F),C=To(pe(D.x,0,D.y),pe(0,1,0),pe(D.z,0,D.w)),B=kw.mul(L.x).add(yR.sub(kw).mul(L.y));this.clearcoatSpecularDirect.addAssign(e.mul(B).mul($O({N:P,V:A,P:y,mInv:C,p0:l,p1:c,p2:u,p3:f})))}}indirect(e){this.indirectDiffuse(e),this.indirectSpecular(e),this.ambientOcclusion(e)}indirectDiffuse(e){let{irradiance:t,reflectedLight:n}=e.context,r=t.mul(i1({diffuseColor:kg})).toVar();if(this.sheen===!0){let s=Uw({normal:hi,viewDir:er,roughness:am}),o=cc.r.max(cc.g).max(cc.b).mul(s).oneMinus();r.mulAssign(o)}n.indirectDiffuse.addAssign(r)}indirectSpecular(e){let{radiance:t,iblIrradiance:n,reflectedLight:r}=e.context;if(this.sheen===!0&&this.sheenSpecularIndirect.addAssign(n.mul(cc,Uw({normal:hi,viewDir:er,roughness:am}))),this.clearcoat===!0){let S=um.dot(er).clamp(),T=fse({dotNV:S,specularColor:kw,specularF90:yR,roughness:sx});this.clearcoatSpecularIndirect.addAssign(this.clearcoatRadiance.mul(T))}let s=pe().toVar("singleScatteringDielectric"),o=pe().toVar("multiScatteringDielectric"),a=pe().toVar("singleScatteringMetallic"),l=pe().toVar("multiScatteringMetallic");this.computeMultiscattering(s,o,Gg,gm,this.iridescenceF0Dielectric),this.computeMultiscattering(a,l,Gg,Bi.rgb,this.iridescenceF0Metallic);let c=Qn(s,a,Yd),u=Qn(o,l,Yd),f=s.add(o),d=kg.mul(f.oneMinus()),A=n.mul(1/Math.PI),y=t.mul(c).add(u.mul(A)).toVar(),w=d.mul(A).toVar();if(this.sheen===!0){let S=Uw({normal:hi,viewDir:er,roughness:am}),T=cc.r.max(cc.g).max(cc.b).mul(S).oneMinus();y.mulAssign(T),w.mulAssign(T)}r.indirectSpecular.addAssign(y),r.indirectDiffuse.addAssign(w)}ambientOcclusion(e){let{ambientOcclusion:t,reflectedLight:n}=e.context,s=hi.dot(er).clamp().add(t),o=pf.mul(-16).oneMinus().negate().exp2(),a=t.sub(s.pow(o).oneMinus()).clamp();this.clearcoat===!0&&this.clearcoatSpecularIndirect.mulAssign(t),this.sheen===!0&&this.sheenSpecularIndirect.mulAssign(t),n.indirectDiffuse.mulAssign(t),n.indirectSpecular.mulAssign(a)}finish({context:e}){let{outgoingLight:t}=e;if(this.clearcoat===!0){let n=um.dot(er).clamp(),r=gx({dotVH:n,f0:kw,f90:yR}),s=t.mul(r4.mul(r).oneMinus()).add(this.clearcoatSpecularDirect.add(this.clearcoatSpecularIndirect).mul(r4));t.assign(s)}if(this.sheen===!0){let n=t.add(this.sheenSpecularDirect,this.sheenSpecularIndirect.mul(1/Math.PI));t.assign(n)}}},ute=oe(1),N7=oe(-2),bR=oe(.8),YO=oe(-1),wR=oe(.4),ZO=oe(2),SR=oe(.305),KO=oe(3),hte=oe(.21),Z3e=oe(4),fte=oe(4),K3e=oe(16),Q3e=me(([i])=>{let e=pe(fr(i)).toVar(),t=oe(-1).toVar();return $t(e.x.greaterThan(e.z),()=>{$t(e.x.greaterThan(e.y),()=>{t.assign(xa(i.x.greaterThan(0),0,3))}).Else(()=>{t.assign(xa(i.y.greaterThan(0),1,4))})}).Else(()=>{$t(e.z.greaterThan(e.y),()=>{t.assign(xa(i.z.greaterThan(0),2,5))}).Else(()=>{t.assign(xa(i.y.greaterThan(0),1,4))})}),t}).setLayout({name:"getFace",type:"float",inputs:[{name:"direction",type:"vec3"}]}),J3e=me(([i,e])=>{let t=dt().toVar();return $t(e.equal(0),()=>{t.assign(dt(i.z,i.y).div(fr(i.x)))}).ElseIf(e.equal(1),()=>{t.assign(dt(i.x.negate(),i.z.negate()).div(fr(i.y)))}).ElseIf(e.equal(2),()=>{t.assign(dt(i.x.negate(),i.y).div(fr(i.z)))}).ElseIf(e.equal(3),()=>{t.assign(dt(i.z.negate(),i.y).div(fr(i.x)))}).ElseIf(e.equal(4),()=>{t.assign(dt(i.x.negate(),i.z).div(fr(i.y)))}).Else(()=>{t.assign(dt(i.x,i.y).div(fr(i.z)))}),Tn(.5,t.add(1))}).setLayout({name:"getUV",type:"vec2",inputs:[{name:"direction",type:"vec3"},{name:"face",type:"float"}]}),eMe=me(([i])=>{let e=oe(0).toVar();return $t(i.greaterThanEqual(bR),()=>{e.assign(ute.sub(i).mul(YO.sub(N7)).div(ute.sub(bR)).add(N7))}).ElseIf(i.greaterThanEqual(wR),()=>{e.assign(bR.sub(i).mul(ZO.sub(YO)).div(bR.sub(wR)).add(YO))}).ElseIf(i.greaterThanEqual(SR),()=>{e.assign(wR.sub(i).mul(KO.sub(ZO)).div(wR.sub(SR)).add(ZO))}).ElseIf(i.greaterThanEqual(hte),()=>{e.assign(SR.sub(i).mul(Z3e.sub(KO)).div(SR.sub(hte)).add(KO))}).Else(()=>{e.assign(oe(-2).mul(Af(Tn(1.16,i))))}),e}).setLayout({name:"roughnessToMip",type:"float",inputs:[{name:"roughness",type:"float"}]}),mse=me(([i,e])=>{let t=i.toVar();t.assign(Tn(2,t).sub(1));let n=pe(t,1).toVar();return $t(e.equal(0),()=>{n.assign(n.zyx)}).ElseIf(e.equal(1),()=>{n.assign(n.xzy),n.xz.mulAssign(-1)}).ElseIf(e.equal(2),()=>{n.x.mulAssign(-1)}).ElseIf(e.equal(3),()=>{n.assign(n.zyx),n.xz.mulAssign(-1)}).ElseIf(e.equal(4),()=>{n.assign(n.xzy),n.xy.mulAssign(-1)}).ElseIf(e.equal(5),()=>{n.z.mulAssign(-1)}),n}).setLayout({name:"getDirection",type:"vec3",inputs:[{name:"uv",type:"vec2"},{name:"face",type:"float"}]}),Ase=me(([i,e,t,n,r,s])=>{let o=oe(t),a=pe(e),l=Yu(eMe(o),N7,s),c=$u(l),u=gf(l),f=pe(_S(i,a,u,n,r,s)).toVar();return $t(c.notEqual(0),()=>{let d=pe(_S(i,a,u.add(1),n,r,s)).toVar();f.assign(Qn(f,d,c))}),f}),_S=me(([i,e,t,n,r,s])=>{let o=oe(t).toVar(),a=pe(e),l=oe(Q3e(a)).toVar(),c=oe(zr(fte.sub(o),0)).toVar();o.assign(zr(o,fte));let u=oe(fx(o)).toVar(),f=dt(J3e(a,l).mul(u.sub(2)).add(1)).toVar();return $t(l.greaterThan(2),()=>{f.y.addAssign(u),l.subAssign(3)}),f.x.addAssign(l.mul(u)),f.x.addAssign(c.mul(Tn(3,K3e))),f.y.addAssign(Tn(4,fx(s).sub(u))),f.x.mulAssign(n),f.y.mulAssign(r),i.sample(f).grad(dt(),dt())}),QO=me(({envMap:i,mipInt:e,outputDirection:t,theta:n,axis:r,CUBEUV_TEXEL_WIDTH:s,CUBEUV_TEXEL_HEIGHT:o,CUBEUV_MAX_MIP:a})=>{let l=Hu(n),c=t.mul(l).add(r.cross(t).mul(Ka(n))).add(r.mul(r.dot(t).mul(l.oneMinus())));return _S(i,c,e,s,o,a)}),gse=me(({n:i,latitudinal:e,poleAxis:t,outputDirection:n,weights:r,samples:s,dTheta:o,mipInt:a,envMap:l,CUBEUV_TEXEL_WIDTH:c,CUBEUV_TEXEL_HEIGHT:u,CUBEUV_MAX_MIP:f})=>{let d=pe(xa(e,t,Kd(t,n))).toVar();$t(d.equal(pe(0)),()=>{d.assign(pe(n.z,0,n.x.negate()))}),d.assign(ya(d));let A=pe().toVar();return A.addAssign(r.element(0).mul(QO({theta:0,axis:d,outputDirection:n,mipInt:a,envMap:l,CUBEUV_TEXEL_WIDTH:c,CUBEUV_TEXEL_HEIGHT:u,CUBEUV_MAX_MIP:f}))),Oi({start:de(1),end:i},({i:y})=>{$t(y.greaterThanEqual(s),()=>{Qre()});let w=oe(o.mul(oe(y))).toVar();A.addAssign(r.element(y).mul(QO({theta:w.mul(-1),axis:d,outputDirection:n,mipInt:a,envMap:l,CUBEUV_TEXEL_WIDTH:c,CUBEUV_TEXEL_HEIGHT:u,CUBEUV_MAX_MIP:f}))),A.addAssign(r.element(y).mul(QO({theta:w,axis:d,outputDirection:n,mipInt:a,envMap:l,CUBEUV_TEXEL_WIDTH:c,CUBEUV_TEXEL_HEIGHT:u,CUBEUV_MAX_MIP:f})))}),Ft(A,1)}),tMe=me(([i])=>{let e=rt(i).toVar();return e.assign(e.shiftLeft(rt(16)).bitOr(e.shiftRight(rt(16)))),e.assign(e.bitAnd(rt(1431655765)).shiftLeft(rt(1)).bitOr(e.bitAnd(rt(2863311530)).shiftRight(rt(1)))),e.assign(e.bitAnd(rt(858993459)).shiftLeft(rt(2)).bitOr(e.bitAnd(rt(3435973836)).shiftRight(rt(2)))),e.assign(e.bitAnd(rt(252645135)).shiftLeft(rt(4)).bitOr(e.bitAnd(rt(4042322160)).shiftRight(rt(4)))),e.assign(e.bitAnd(rt(16711935)).shiftLeft(rt(8)).bitOr(e.bitAnd(rt(4278255360)).shiftRight(rt(8)))),oe(e).mul(23283064365386963e-26)}),nMe=me(([i,e])=>dt(oe(i).div(oe(e)),tMe(i))),iMe=me(([i,e,t])=>{let n=t.mul(t).toConst(),r=pe(1,0,0).toConst(),s=Kd(e,r).toConst(),o=el(i.x).toConst(),a=Tn(2,3.14159265359).mul(i.y).toConst(),l=o.mul(Hu(a)).toConst(),c=o.mul(Ka(a)).toVar(),u=Tn(.5,e.z.add(1)).toConst();c.assign(u.oneMinus().mul(el(l.mul(l).oneMinus())).add(u.mul(c)));let f=r.mul(l).add(s.mul(c)).add(e.mul(el(zr(0,l.mul(l).add(c.mul(c)).oneMinus()))));return ya(pe(n.mul(f.x),n.mul(f.y),zr(0,f.z)))}),vse=me(({roughness:i,mipInt:e,envMap:t,N_immutable:n,GGX_SAMPLES:r,CUBEUV_TEXEL_WIDTH:s,CUBEUV_TEXEL_HEIGHT:o,CUBEUV_MAX_MIP:a})=>{let l=pe(n).toVar(),c=pe(0).toVar(),u=oe(0).toVar();return $t(i.lessThan(.001),()=>{c.assign(_S(t,l,e,s,o,a))}).Else(()=>{let f=xa(fr(l.z).lessThan(.999),pe(0,0,1),pe(1,0,0)),d=ya(Kd(f,l)).toVar(),A=Kd(l,d).toVar();Oi({start:rt(0),end:r},({i:y})=>{let w=nMe(y,r),S=iMe(w,pe(0,0,1),i),T=ya(d.mul(S.x).add(A.mul(S.y)).add(l.mul(S.z))),R=ya(T.mul(ru(l,T).mul(2)).sub(l)),I=zr(ru(l,R),0);$t(I.greaterThan(0),()=>{let P=_S(t,R,e,s,o,a);c.addAssign(P.mul(I)),u.addAssign(I)})}),$t(u.greaterThan(0),()=>{c.assign(c.div(u))})}),Ft(c,1)}),dm=4,dte=[.125,.215,.35,.446,.526,.582],zg=20,rMe=512,zw=new Du(-1,1,1,-1,0,1),sMe=new Yr(90,1),pte=new zt,JO=null,eU=0,tU=0,oMe=new re,E4=new WeakMap,aMe=[3,1,5,0,4,2],nU=mse(Ui(),fc("faceIndex")).normalize(),BP=pe(nU.x,nU.y,nU.z),F7=class{constructor(e){this._renderer=e,this._pingPongRenderTarget=null,this._lodMax=0,this._cubeSize=0,this._sizeLods=[],this._sigmas=[],this._lodMeshes=[],this._blurMaterial=null,this._ggxMaterial=null,this._cubemapMaterial=null,this._equirectMaterial=null,this._backgroundBox=null}get _hasInitialized(){return this._renderer.hasInitialized()}fromScene(e,t=0,n=.1,r=100,s={}){let{size:o=256,position:a=oMe,renderTarget:l=null}=s;if(this._setSize(o),this._hasInitialized===!1)throw new Error('THREE.PMREMGenerator: .fromScene() called before the backend is initialized. Use "await renderer.init();" before using this method.');JO=this._renderer.getRenderTarget(),eU=this._renderer.getActiveCubeFace(),tU=this._renderer.getActiveMipmapLevel();let c=l||this._allocateTarget(!0);return this._init(c),this._sceneToCubeUV(e,n,r,c,a),t>0&&this._blur(c,0,0,t),this._applyPMREM(c),this._cleanup(c),c}async fromSceneAsync(e,t=0,n=.1,r=100,s={}){return ni('PMREMGenerator: ".fromSceneAsync()" is deprecated. Use "await renderer.init()" instead.'),await this._renderer.init(),this.fromScene(e,t,n,r,s)}fromEquirectangular(e,t=null){if(this._hasInitialized===!1)throw new Error('THREE.PMREMGenerator: .fromEquirectangular() called before the backend is initialized. Use "await renderer.init();" before using this method.');return this._fromTexture(e,t)}async fromEquirectangularAsync(e,t=null){return ni('PMREMGenerator: ".fromEquirectangularAsync()" is deprecated. Use "await renderer.init()" instead.'),await this._renderer.init(),this._fromTexture(e,t)}fromCubemap(e,t=null){if(this._hasInitialized===!1)throw new Error('THREE.PMREMGenerator: .fromCubemap() called before the backend is initialized. Use "await renderer.init();" before using this method.');return this._fromTexture(e,t)}async fromCubemapAsync(e,t=null){return ni('PMREMGenerator: ".fromCubemapAsync()" is deprecated. Use "await renderer.init()" instead.'),await this._renderer.init(),this._fromTexture(e,t)}async compileCubemapShader(){this._cubemapMaterial===null&&(this._cubemapMaterial=Ate(),await this._compileMaterial(this._cubemapMaterial))}async compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=gte(),await this._compileMaterial(this._equirectMaterial))}dispose(){this._dispose(),this._cubemapMaterial!==null&&this._cubemapMaterial.dispose(),this._equirectMaterial!==null&&this._equirectMaterial.dispose(),this._backgroundBox!==null&&(this._backgroundBox.geometry.dispose(),this._backgroundBox.material.dispose())}_setSizeFromTexture(e){e.mapping===ec||e.mapping===Gc?this._setSize(e.image.length===0?16:e.image[0].width||e.image[0].image.width):this._setSize(e.image.width/4)}_setSize(e){this._lodMax=Math.floor(Math.log2(e)),this._cubeSize=Math.pow(2,this._lodMax)}_dispose(){this._blurMaterial!==null&&this._blurMaterial.dispose(),this._ggxMaterial!==null&&this._ggxMaterial.dispose(),this._pingPongRenderTarget!==null&&this._pingPongRenderTarget.dispose();for(let e=0;e<this._lodMeshes.length;e++)this._lodMeshes[e].geometry.dispose()}_cleanup(e){this._renderer.setRenderTarget(JO,eU,tU),e.scissorTest=!1,this._setViewport(e,0,0,e.width,e.height)}_fromTexture(e,t){this._setSizeFromTexture(e),JO=this._renderer.getRenderTarget(),eU=this._renderer.getActiveCubeFace(),tU=this._renderer.getActiveMipmapLevel();let n=t||this._allocateTarget(!1);return this._init(n),this._textureToCubeUV(e,n),this._applyPMREM(n),this._cleanup(n),n}_allocateTarget(e){let t=3*Math.max(this._cubeSize,112),n=4*this._cubeSize;return mte(t,n,e)}_init(e){if(this._pingPongRenderTarget===null||this._pingPongRenderTarget.width!==e.width||this._pingPongRenderTarget.height!==e.height){this._pingPongRenderTarget!==null&&this._dispose(),this._pingPongRenderTarget=mte(e.width,e.height);let{_lodMax:t}=this;({lodMeshes:this._lodMeshes,sizeLods:this._sizeLods,sigmas:this._sigmas}=lMe(t)),this._blurMaterial=cMe(t,e.width,e.height),this._ggxMaterial=uMe(t,e.width,e.height)}}async _compileMaterial(e){let t=new Hn(new Xn,e);await this._renderer.compile(t,zw)}_sceneToCubeUV(e,t,n,r,s){let o=sMe;o.near=t,o.far=n;let a=[1,1,1,1,-1,1],l=[1,-1,1,-1,1,-1],c=this._renderer,u=c.autoClear;c.getClearColor(pte),c.autoClear=!1,this._backgroundBox===null&&(this._backgroundBox=new Hn(new Lu,new fs({name:"PMREM.Background",side:mi,depthWrite:!1,depthTest:!1})));let f=this._backgroundBox,d=f.material,A=!1,y=e.background;y?y.isColor&&(d.color.copy(y),e.background=null,A=!0):(d.color.copy(pte),A=!0),c.setRenderTarget(r),c.clear(),A&&c.render(f,o);for(let w=0;w<6;w++){let S=w%3;S===0?(o.up.set(0,a[w],0),o.position.set(s.x,s.y,s.z),o.lookAt(s.x+l[w],s.y,s.z)):S===1?(o.up.set(0,0,a[w]),o.position.set(s.x,s.y,s.z),o.lookAt(s.x,s.y+l[w],s.z)):(o.up.set(0,a[w],0),o.position.set(s.x,s.y,s.z),o.lookAt(s.x,s.y,s.z+l[w]));let T=this._cubeSize;this._setViewport(r,S*T,w>2?T:0,T,T),c.render(e,o)}c.autoClear=u,e.background=y}_textureToCubeUV(e,t){let n=this._renderer,r=e.mapping===ec||e.mapping===Gc;r?this._cubemapMaterial===null&&(this._cubemapMaterial=Ate(e)):this._equirectMaterial===null&&(this._equirectMaterial=gte(e));let s=r?this._cubemapMaterial:this._equirectMaterial;s.fragmentNode.value=e;let o=this._lodMeshes[0];o.material=s;let a=this._cubeSize;this._setViewport(t,0,0,3*a,2*a),n.setRenderTarget(t),n.render(o,zw)}_applyPMREM(e){let t=this._renderer,n=t.autoClear;t.autoClear=!1;let r=this._lodMeshes.length;for(let s=1;s<r;s++)this._applyGGXFilter(e,s-1,s);t.autoClear=n}_applyGGXFilter(e,t,n){let r=this._renderer,s=this._pingPongRenderTarget,o=this._ggxMaterial,a=this._lodMeshes[n];a.material=o;let l=E4.get(o),c=n/(this._lodMeshes.length-1),u=t/(this._lodMeshes.length-1),f=Math.sqrt(c*c-u*u),d=0+c*1.25,A=f*d,{_lodMax:y}=this,w=this._sizeLods[n],S=3*w*(n>y-dm?n-y+dm:0),T=4*(this._cubeSize-w);e.texture.frame=(e.texture.frame||0)+1,l.envMap.value=e.texture,l.roughness.value=A,l.mipInt.value=y-t,this._setViewport(s,S,T,3*w,2*w),r.setRenderTarget(s),r.render(a,zw),s.texture.frame=(s.texture.frame||0)+1,l.envMap.value=s.texture,l.roughness.value=0,l.mipInt.value=y-n,this._setViewport(e,S,T,3*w,2*w),r.setRenderTarget(e),r.render(a,zw)}_blur(e,t,n,r,s){let o=this._pingPongRenderTarget;this._halfBlur(e,o,t,n,r,"latitudinal",s),this._halfBlur(o,e,n,n,r,"longitudinal",s)}_halfBlur(e,t,n,r,s,o,a){let l=this._renderer,c=this._blurMaterial;o!=="latitudinal"&&o!=="longitudinal"&&ze("blur direction must be either latitudinal or longitudinal!");let u=3,f=this._lodMeshes[r];f.material=c;let d=E4.get(c),A=this._sizeLods[n]-1,y=isFinite(s)?Math.PI/(2*A):2*Math.PI/(2*zg-1),w=s/y,S=isFinite(s)?1+Math.floor(u*w):zg;S>zg&&Xe(`sigmaRadians, ${s}, is too large and will clip, as it requested ${S} samples when the maximum is set to ${zg}`);let T=[],R=0;for(let L=0;L<zg;++L){let C=L/w,B=Math.exp(-C*C/2);T.push(B),L===0?R+=B:L<S&&(R+=2*B)}for(let L=0;L<T.length;L++)T[L]=T[L]/R;e.texture.frame=(e.texture.frame||0)+1,d.envMap.value=e.texture,d.samples.value=S,d.weights.array=T,d.latitudinal.value=o==="latitudinal"?1:0,a&&(d.poleAxis.value=a);let{_lodMax:I}=this;d.dTheta.value=y,d.mipInt.value=I-n;let P=this._sizeLods[r],F=3*P*(r>I-dm?r-I+dm:0),D=4*(this._cubeSize-P);this._setViewport(t,F,D,3*P,2*P),l.setRenderTarget(t),l.render(f,zw)}_setViewport(e,t,n,r,s){this._renderer.isWebGLRenderer?(e.viewport.set(t,e.height-s-n,r,s),e.scissor.set(t,e.height-s-n,r,s)):(e.viewport.set(t,n,r,s),e.scissor.set(t,n,r,s))}};function lMe(i){let e=[],t=[],n=[],r=i,s=i-dm+1+dte.length;for(let o=0;o<s;o++){let a=Math.pow(2,r);e.push(a);let l=1/a;o>i-dm?l=dte[o-i+dm-1]:o===0&&(l=0),t.push(l);let c=1/(a-2),u=-c,f=1+c,d=[u,u,f,u,f,f,u,u,f,f,u,f],A=6,y=6,w=3,S=2,T=1,R=new Float32Array(w*y*A),I=new Float32Array(S*y*A),P=new Float32Array(T*y*A);for(let D=0;D<A;D++){let L=D%3*2/3-1,C=D>2?0:-1,B=[L,C,0,L+2/3,C,0,L+2/3,C+1,0,L,C,0,L+2/3,C+1,0,L,C+1,0],k=aMe[D];R.set(B,w*y*k),I.set(d,S*y*k);let z=[k,k,k,k,k,k];P.set(z,T*y*k)}let F=new Xn;F.setAttribute("position",new Hi(R,w)),F.setAttribute("uv",new Hi(I,S)),F.setAttribute("faceIndex",new Hi(P,T)),n.push(new Hn(F,null)),r>dm&&r--}return{lodMeshes:n,sizeLods:e,sigmas:t}}function mte(i,e,t){let n={magFilter:Mi,minFilter:Mi,generateMipmaps:!1,type:Wi,format:Or,colorSpace:t0,depthBuffer:t},r=new Ba(i,e,n);return r.texture.mapping=Bh,r.texture.name="PMREM.cubeUv",r.texture.isPMREMTexture=!0,r.scissorTest=!0,r}function OP(i){let e=new Pr;return e.depthTest=!1,e.depthWrite=!1,e.blending=ps,e.name=`PMREM_${i}`,e}function cMe(i,e,t){let n=$o(new Array(zg).fill(0)),r=Xt(new re(0,1,0)),s=Xt(0),o=oe(zg),a=Xt(0),l=Xt(1),c=fi(),u=Xt(0),f=oe(1/e),d=oe(1/t),A=oe(i),y={n:o,latitudinal:a,weights:n,poleAxis:r,outputDirection:BP,dTheta:s,samples:l,envMap:c,mipInt:u,CUBEUV_TEXEL_WIDTH:f,CUBEUV_TEXEL_HEIGHT:d,CUBEUV_MAX_MIP:A},w=OP("blur");return w.fragmentNode=gse({...y,latitudinal:a.equal(1)}),E4.set(w,y),w}function uMe(i,e,t){let n=fi(),r=Xt(0),s=Xt(0),o=oe(1/e),a=oe(1/t),l=oe(i),c={envMap:n,roughness:r,mipInt:s,CUBEUV_TEXEL_WIDTH:o,CUBEUV_TEXEL_HEIGHT:a,CUBEUV_MAX_MIP:l},u=OP("ggx");return u.fragmentNode=vse({...c,N_immutable:BP,GGX_SAMPLES:rt(rMe)}),E4.set(u,c),u}function Ate(i){let e=OP("cubemap");return e.fragmentNode=Qa(i,BP),e}function gte(i){let e=OP("equirect");return e.fragmentNode=fi(i,_V(BP),0),e}var vte=new WeakMap;function hMe(i){let e=Math.log2(i)-2,t=1/i;return{texelWidth:1/(3*Math.max(Math.pow(2,e),112)),texelHeight:t,maxMip:e}}function fMe(i,e,t){let n=dMe(e),r=n.get(i);if((r!==void 0?r.pmremVersion:-1)!==i.pmremVersion){let o=i.image;if(i.isCubeTexture)if(pMe(o))r=t.fromCubemap(i,r);else return null;else if(mMe(o))r=t.fromEquirectangular(i,r);else return null;if(r.pmremVersion=i.pmremVersion,n.has(i)===!1){let a=()=>{i.removeEventListener("dispose",a);let l=n.get(i);l!==void 0&&(l.dispose(),n.delete(i))};i.addEventListener("dispose",a)}n.set(i,r)}return r.texture}function dMe(i){let e=vte.get(i);return e===void 0&&(e=new WeakMap,vte.set(i,e)),e}var B7=class extends Rr{static get type(){return"PMREMNode"}constructor(e,t=null,n=null){super("vec3"),this._value=e,this._pmrem=null,this.uvNode=t,this.levelNode=n,this._generator=null;let r=new qs;r.isRenderTargetTexture=!0,this._texture=fi(r),this._width=Xt(0),this._height=Xt(0),this._maxMip=Xt(0),this.updateBeforeType=yn.RENDER}set value(e){this._value=e,this._pmrem=null}get value(){return this._value}updateFromTexture(e){let t=hMe(e.image.height);this._texture.value=e,this._width.value=t.texelWidth,this._height.value=t.texelHeight,this._maxMip.value=t.maxMip}updateBefore(e){let t=this._pmrem,n=t?t.pmremVersion:-1,r=this._value;n!==r.pmremVersion&&(r.isPMREMTexture===!0||r.mapping===Bh?t=r:t=fMe(r,e.renderer,this._generator),t!==null&&(this._pmrem=t,this.updateFromTexture(t)))}setup(e){this._generator===null&&(this._generator=new F7(e.renderer)),this.updateBefore(e);let t=this.uvNode;t===null&&e.context.getUV&&(t=e.context.getUV(this,e)),t=this._pmrem.isRenderTargetTexture?g4.mul(pe(t.x,t.y.negate(),t.z)):g4.mul(t);let n=this.levelNode;return n===null&&e.context.getTextureLevel&&(n=e.context.getTextureLevel(this)),Ase(this._texture,t,n,this._width,this._height,this._maxMip)}dispose(){super.dispose(),this._generator!==null&&this._generator.dispose()}};function pMe(i){if(i==null)return!1;let e=0,t=6;for(let n=0;n<t;n++)i[n]!==void 0&&e++;return e===t}function mMe(i){return i==null?!1:i.height>0}var wV=$n(B7).setParameterLength(1,3),_te=new WeakMap,O7=class extends _m{static get type(){return"EnvironmentNode"}constructor(e=null){super(),this.envNode=e}setup(e){let{material:t}=e,n=this.envNode;if(n.isTextureNode||n.isMaterialReferenceNode){let f=n.isTextureNode?n.value:t[n.property],d=this._getPMREMNodeCache(e.renderer),A=d.get(f);A===void 0&&(A=wV(f),d.set(f,A)),n=A}let s=t.useAnisotropy===!0||t.anisotropy>0?pre:hi,o=n.context(xte(pf,s)).mul(KR),a=n.context(AMe(Sm)).mul(Math.PI).mul(KR),l=lx(o),c=lx(a);e.context.radiance.addAssign(l),e.context.iblIrradiance.addAssign(c);let u=e.context.lightingModel.clearcoatRadiance;if(u){let f=n.context(xte(sx,um)).mul(KR),d=lx(f);u.addAssign(d)}}_getPMREMNodeCache(e){let t=_te.get(e);return t===void 0&&(t=new WeakMap,_te.set(e,t)),t}},xte=(i,e)=>{let t=null;return{getUV:()=>(t===null&&(t=er.negate().reflect(e),t=Bz(i).mix(t,e).normalize(),t=t.transformDirection(DS)),t),getTextureLevel:()=>i}},AMe=i=>({getUV:()=>i,getTextureLevel:()=>oe(1)}),gMe=new s_,M4=class extends Pr{static get type(){return"MeshStandardNodeMaterial"}constructor(e){super(),this.isMeshStandardNodeMaterial=!0,this.lights=!0,this.emissiveNode=null,this.metalnessNode=null,this.roughnessNode=null,this.setDefaultValues(gMe),this.setValues(e)}setupEnvironment(e){let t=super.setupEnvironment(e);return t===null&&e.environmentNode&&(t=e.environmentNode),t?new O7(t):null}setupLightingModel(){return new T4}setupSpecular(){let e=Qn(pe(.04),Bi.rgb,Yd);gm.assign(pe(.04)),Vg.assign(e),Gg.assign(1)}setupVariants(){let e=this.metalnessNode?oe(this.metalnessNode):wre;Yd.assign(e);let t=this.roughnessNode?oe(this.roughnessNode):bre;t=xV({roughness:t}),pf.assign(t),this.setupSpecular(),kg.assign(Bi.rgb.mul(e.oneMinus()))}},vMe=new Z2,U7=class extends M4{static get type(){return"MeshPhysicalNodeMaterial"}constructor(e){super(),this.isMeshPhysicalNodeMaterial=!0,this.clearcoatNode=null,this.clearcoatRoughnessNode=null,this.clearcoatNormalNode=null,this.sheenNode=null,this.sheenRoughnessNode=null,this.iridescenceNode=null,this.iridescenceIORNode=null,this.iridescenceThicknessNode=null,this.specularIntensityNode=null,this.specularColorNode=null,this.iorNode=null,this.transmissionNode=null,this.thicknessNode=null,this.attenuationDistanceNode=null,this.attenuationColorNode=null,this.dispersionNode=null,this.anisotropyNode=null,this.setDefaultValues(vMe),this.setValues(e)}get useClearcoat(){return this.clearcoat>0||this.clearcoatNode!==null}get useIridescence(){return this.iridescence>0||this.iridescenceNode!==null}get useSheen(){return this.sheen>0||this.sheenNode!==null}get useAnisotropy(){return this.anisotropy>0||this.anisotropyNode!==null}get useTransmission(){return this.transmission>0||this.transmissionNode!==null}get useDispersion(){return this.dispersion>0||this.dispersionNode!==null}setupSpecular(){let e=this.iorNode?oe(this.iorNode):Ore;sS.assign(e),gm.assign(Pl(Fz(sS.sub(1).div(sS.add(1))).mul(yre),pe(1)).mul(u7)),Vg.assign(Qn(gm,Bi.rgb,Yd)),Gg.assign(Qn(u7,1,Yd))}setupLightingModel(){return new T4(this.useClearcoat,this.useSheen,this.useIridescence,this.useAnisotropy,this.useTransmission,this.useDispersion)}setupVariants(e){if(super.setupVariants(e),this.useClearcoat){let t=this.clearcoatNode?oe(this.clearcoatNode):Tre,n=this.clearcoatRoughnessNode?oe(this.clearcoatRoughnessNode):Ere;r4.assign(t),sx.assign(xV({roughness:n}))}if(this.useSheen){let t=this.sheenNode?pe(this.sheenNode):Rre,n=this.sheenRoughnessNode?oe(this.sheenRoughnessNode):Pre;cc.assign(t),am.assign(n)}if(this.useIridescence){let t=this.iridescenceNode?oe(this.iridescenceNode):Lre,n=this.iridescenceIORNode?oe(this.iridescenceIORNode):Dre,r=this.iridescenceThicknessNode?oe(this.iridescenceThicknessNode):Nre;_P.assign(t),s4.assign(n),o4.assign(r)}if(this.useAnisotropy){let t=(this.anisotropyNode?dt(this.anisotropyNode):Ire).toVar();om.assign(t.length()),$t(om.equal(0),()=>{t.assign(dt(1,0))}).Else(()=>{t.divAssign(dt(om)),om.assign(om.saturate())}),a4.assign(om.pow2().mix(pf.pow2(),1)),rS.assign(qg[0].mul(t.x).add(qg[1].mul(t.y))),jg.assign(qg[1].mul(t.x).sub(qg[0].mul(t.y)))}if(this.useTransmission){let t=this.transmissionNode?oe(this.transmissionNode):Fre,n=this.thicknessNode?oe(this.thicknessNode):Bre,r=this.attenuationDistanceNode?oe(this.attenuationDistanceNode):Ure,s=this.attenuationColorNode?pe(this.attenuationColorNode):kre;if(c4.assign(t),xz.assign(n),yz.assign(r),bz.assign(s),this.useDispersion){let o=this.dispersionNode?oe(this.dispersionNode):Vre;wz.assign(o)}}}setupClearcoatNormal(){return this.clearcoatNormalNode?pe(this.clearcoatNormalNode):Mre}setup(e){e.context.setupClearcoatNormal=()=>$g(this.setupClearcoatNormal(e),"NORMAL","vec3"),super.setup(e)}};var _Me=me(({normal:i,lightDirection:e,builder:t})=>{let n=i.dot(e),r=dt(n.mul(.5).add(.5),0);if(t.material.gradientMap){let s=Xd("gradientMap","texture").context({getUV:()=>r});return pe(s.r)}else{let s=r.fwidth().mul(.5);return Qn(pe(.7),pe(1),mc(oe(.7).sub(s.x),oe(.7).add(s.x),r.x))}}),k7=class extends Ax{direct({lightDirection:e,lightColor:t,reflectedLight:n},r){let s=_Me({normal:RP,lightDirection:e,builder:r}).mul(t);n.directDiffuse.addAssign(s.mul(i1({diffuseColor:Bi.rgb})))}indirect(e){let{ambientOcclusion:t,irradiance:n,reflectedLight:r}=e.context;r.indirectDiffuse.addAssign(n.mul(i1({diffuseColor:Bi}))),r.indirectDiffuse.mulAssign(t)}},xMe=new K2,z7=class extends Pr{static get type(){return"MeshToonNodeMaterial"}constructor(e){super(),this.isMeshToonNodeMaterial=!0,this.lights=!0,this.setDefaultValues(xMe),this.setValues(e)}setupLightingModel(){return new k7}},_se=me(()=>{let i=pe(er.z,0,er.x.negate()).normalize(),e=er.cross(i);return dt(i.dot(hi),e.dot(hi)).mul(.495).add(.5)}).once(["NORMAL","VERTEX"])().toVar("matcapUV"),yMe=new J2,V7=class extends Pr{static get type(){return"MeshMatcapNodeMaterial"}constructor(e){super(),this.isMeshMatcapNodeMaterial=!0,this.setDefaultValues(yMe),this.setValues(e)}setupVariants(e){let t=_se,n;e.material.matcap?n=Xd("matcap","texture").context({getUV:()=>t}):n=pe(Qn(.2,.8,t.y)),Bi.rgb.mulAssign(n.rgb)}},G7=class extends Rr{static get type(){return"RotateNode"}constructor(e,t){super(),this.positionNode=e,this.rotationNode=t}generateNodeType(e){return this.positionNode.getNodeType(e)}setup(e){let{rotationNode:t,positionNode:n}=this;if(this.getNodeType(e)==="vec2"){let s=t.cos(),o=t.sin();return vP(s,o,o.negate(),s).mul(n)}else{let s=t,o=pm(Ft(1,0,0,0),Ft(0,Hu(s.x),Ka(s.x).negate(),0),Ft(0,Ka(s.x),Hu(s.x),0),Ft(0,0,0,1)),a=pm(Ft(Hu(s.y),0,Ka(s.y),0),Ft(0,1,0,0),Ft(Ka(s.y).negate(),0,Hu(s.y),0),Ft(0,0,0,1)),l=pm(Ft(Hu(s.z),Ka(s.z).negate(),0,0),Ft(Ka(s.z),Hu(s.z),0,0),Ft(0,0,1,0),Ft(0,0,0,1));return o.mul(a).mul(l).mul(Ft(n,1)).xyz}}},FS=$n(G7).setParameterLength(2),bMe=new Rh,C4=class extends Pr{static get type(){return"SpriteNodeMaterial"}constructor(e){super(),this.isSpriteNodeMaterial=!0,this._useSizeAttenuation=!0,this.positionNode=null,this.rotationNode=null,this.scaleNode=null,this.transparent=!0,this.setDefaultValues(bMe),this.setValues(e)}setupPositionView(e){let{object:t,camera:n}=e,{positionNode:r,rotationNode:s,scaleNode:o,sizeAttenuation:a}=this,l=bf.mul(pe(r||0)),c=dt(tu[0].xyz.length(),tu[1].xyz.length());o!==null&&(c=c.mul(dt(o))),n.isPerspectiveCamera&&a===!1&&(c=c.mul(l.z.negate()));let u=va.xy;if(t.center&&t.center.isVector2===!0){let A=uEe("center","vec2",t);u=u.sub(A.sub(.5))}u=u.mul(c);let f=oe(s||Cre),d=FS(u,f);return Ft(l.xy.add(d),l.zw)}get sizeAttenuation(){return this._useSizeAttenuation}set sizeAttenuation(e){this._useSizeAttenuation!==e&&(this._useSizeAttenuation=e,this.needsUpdate=!0)}},wMe=new a0,SMe=new Oe,q7=class extends C4{static get type(){return"PointsNodeMaterial"}constructor(e){super(),this.sizeNode=null,this.isPointsNodeMaterial=!0,this.setDefaultValues(wMe),this.setValues(e)}setupPositionView(){let{positionNode:e}=this;return bf.mul(pe(e||Mr)).xyz}setupVertexSprite(e){let{material:t,camera:n}=e,{rotationNode:r,scaleNode:s,sizeNode:o,sizeAttenuation:a}=this,l=super.setupVertex(e);if(t.isNodeMaterial!==!0)return l;let c=o!==null?dt(o):zre;c=c.mul(Kz),n.isPerspectiveCamera&&a===!0&&(c=c.mul(TMe.div(xs.z.negate()))),s&&s.isNode&&(c=c.mul(dt(s)));let u=va.xy;if(r&&r.isNode){let f=oe(r);u=FS(u,f)}return u=u.mul(c),u=u.div(Qz.div(2)),u=u.mul(l.w),l=l.add(Ft(u,0,0)),l}setupVertex(e){return e.object.isPoints?super.setupVertex(e):this.setupVertexSprite(e)}get alphaToCoverage(){return this._useAlphaToCoverage}set alphaToCoverage(e){this._useAlphaToCoverage!==e&&(this._useAlphaToCoverage=e,this.needsUpdate=!0)}},TMe=Xt(1).onFrameUpdate(function({renderer:i}){let e=i.getSize(SMe);this.value=.5*e.y}),H7=class extends Ax{constructor(){super(),this.shadowNode=oe(1).toVar("shadowMask")}direct({lightNode:e}){e.shadowNode!==null&&this.shadowNode.mulAssign(e.shadowNode)}finish({context:e}){Bi.a.mulAssign(this.shadowNode.oneMinus()),e.outgoingLight.rgb.assign(Bi.rgb)}},EMe=new Y2,W7=class extends Pr{static get type(){return"ShadowNodeMaterial"}constructor(e){super(),this.isShadowNodeMaterial=!0,this.lights=!0,this.transparent=!0,this.setDefaultValues(EMe),this.setValues(e)}setupLightingModel(){return new H7}},Slt=Jd("vec3"),Tlt=Jd("vec3"),Elt=Jd("vec3");var j7=class{constructor(e,t,n){this.renderer=e,this.nodes=t,this.info=n,this._context=typeof self<"u"?self:null,this._animationLoop=null,this._requestId=null}start(){let e=(t,n)=>{this._requestId=this._context.requestAnimationFrame(e),this.info.autoReset===!0&&this.info.reset(),this.nodes.nodeFrame.update(),this.info.frame=this.nodes.nodeFrame.frameId,this.renderer._inspector.begin(),this._animationLoop!==null&&this._animationLoop(t,n),this.renderer._inspector.finish()};e()}stop(){this._context!==null&&this._context.cancelAnimationFrame(this._requestId),this._requestId=null}getAnimationLoop(){return this._animationLoop}setAnimationLoop(e){this._animationLoop=e}getContext(){return this._context}setContext(e){this._context=e}dispose(){this.stop()}},Sf=class{constructor(){this.weakMaps={}}_getWeakMap(e){let t=e.length,n=this.weakMaps[t];return n===void 0&&(n=new WeakMap,this.weakMaps[t]=n),n}get(e){let t=this._getWeakMap(e);for(let n=0;n<e.length-1;n++)if(t=t.get(e[n]),t===void 0)return;return t.get(e[e.length-1])}set(e,t){let n=this._getWeakMap(e);for(let r=0;r<e.length-1;r++){let s=e[r];n.has(s)===!1&&n.set(s,new WeakMap),n=n.get(s)}return n.set(e[e.length-1],t),this}delete(e){let t=this._getWeakMap(e);for(let n=0;n<e.length-1;n++)if(t=t.get(e[n]),t===void 0)return!1;return t.delete(e[e.length-1])}},MMe=0,yte=new WeakMap;function CMe(i){let e=Object.keys(i),t=yte.get(i.constructor);if(t===void 0){t=[];let n=Object.getPrototypeOf(i);for(;n;){let r=Object.getOwnPropertyDescriptors(n);for(let s in r){let o=r[s];o&&typeof o.get=="function"&&t.push(s)}n=Object.getPrototypeOf(n)}yte.set(i.constructor,t)}for(let n=0;n<t.length;n++)e.push(t[n]);return e}var X7=class{constructor(e,t,n,r,s,o,a,l,c,u){this.id=MMe++,this._nodes=e,this._geometries=t,this.renderer=n,this.object=r,this.material=s,this.scene=o,this.camera=a,this.lightsNode=l,this.context=c,this.geometry=r.geometry,this.version=s.version,this.drawRange=null,this.attributes=null,this.attributesId=null,this.pipeline=null,this.group=null,this.vertexBuffers=null,this.drawParams=null,this.bundle=null,this.clippingContext=u,this.clippingContextCacheKey=u!==null?u.cacheKey:"",this.initialNodesCacheKey=this.getDynamicCacheKey(),this.initialCacheKey=this.getCacheKey(),this._nodeBuilderState=null,this._bindings=null,this._monitor=null,this._sourceMaterial=n._currentSourceMaterial,this.onDispose=null,this.isRenderObject=!0,this.onMaterialDispose=()=>{this.dispose()},this.onGeometryDispose=()=>{this.attributes=null,this.attributesId=null},this.material.addEventListener("dispose",this.onMaterialDispose),this.geometry.addEventListener("dispose",this.onGeometryDispose),this._sourceMaterial!==null&&this._sourceMaterial.addEventListener("dispose",this.onMaterialDispose)}updateClipping(e){this.clippingContext=e}get clippingNeedsUpdate(){return this.clippingContext===null||this.clippingContext.cacheKey===this.clippingContextCacheKey?!1:(this.clippingContextCacheKey=this.clippingContext.cacheKey,!0)}get hardwareClippingPlanes(){return this.getNodeBuilderState().hardwareClipping===!0?this.clippingContext.unionClippingCount:0}getNodeBuilderState(){return this._nodeBuilderState||(this._nodeBuilderState=this._nodes.getForRender(this))}getMonitor(){return this._monitor||(this._monitor=this.getNodeBuilderState().observer)}getBindings(){return this._bindings||(this._bindings=this.getNodeBuilderState().createBindings())}getBindingGroup(e){for(let t of this.getBindings())if(t.name===e)return t}getIndex(){return this._geometries.getIndex(this)}getIndirect(){return this._geometries.getIndirect(this)}getIndirectOffset(){return this._geometries.getIndirectOffset(this)}getChainArray(){return[this.object,this.material,this.context,this.lightsNode]}setGeometry(e){this.geometry=e,this.attributes=null,this.attributesId=null}getAttributes(){if(this.attributes!==null)return this.attributes;let e=this.getNodeBuilderState().nodeAttributes,t=this.geometry,n=[],r=new Set,s={};for(let o of e){let a;if(o.node&&o.node.attribute?a=o.node.attribute:(a=t.getAttribute(o.name),a!==void 0&&(a.isInterleavedBufferAttribute?s[o.name]=a.data.uuid:s[o.name]=a.id)),a===void 0)continue;n.push(a);let l=a.isInterleavedBufferAttribute?a.data:a;r.add(l)}return this.attributes=n,this.attributesId=s,this.vertexBuffers=Array.from(r.values()),n}getVertexBuffers(){return this.vertexBuffers===null&&this.getAttributes(),this.vertexBuffers}getDrawParameters(){let{object:e,material:t,geometry:n,group:r,drawRange:s}=this,o=this.drawParams||(this.drawParams={vertexCount:0,firstVertex:0,instanceCount:0,firstInstance:0}),a=this.getIndex(),l=a!==null,c=1;if(n.isInstancedBufferGeometry===!0?c=n.instanceCount:e.count!==void 0&&(c=Math.max(0,e.count)),c===0)return null;if(o.instanceCount=c,e.isBatchedMesh===!0)return o;let u=1;t.wireframe===!0&&!e.isPoints&&!e.isLineSegments&&!e.isLine&&!e.isLineLoop&&(u=2);let f=s.start*u,d=(s.start+s.count)*u;r!==null&&(f=Math.max(f,r.start*u),d=Math.min(d,(r.start+r.count)*u));let A=n.attributes.position,y=1/0;l?y=a.count:A!=null&&(y=A.count),f=Math.max(f,0),d=Math.min(d,y);let w=d-f;return w<0||w===1/0?null:(o.vertexCount=w,o.firstVertex=f,o)}getGeometryCacheKey(){let{geometry:e}=this,t="";for(let n of Object.keys(e.attributes).sort()){let r=e.attributes[n];t+=n+",",r.data&&(t+=r.data.stride+","),r.offset&&(t+=r.offset+","),r.itemSize&&(t+=r.itemSize+","),r.normalized&&(t+="n,")}for(let n of Object.keys(e.morphAttributes).sort()){let r=e.morphAttributes[n];t+="morph-"+n+",";for(let s=0,o=r.length;s<o;s++){let a=r[s];t+=a.id+","}}return e.index&&(t+="index,"),t}getMaterialCacheKey(){let{object:e,material:t,renderer:n}=this,r=t.customProgramCacheKey();for(let s of CMe(t)){if(/^(is[A-Z]|_)|^(visible|version|uuid|name|opacity|userData)$/.test(s))continue;let o=t[s],a;if(o!==null){let l=typeof o;l==="number"?s==="side"?a=String(o):a=o!==0?"1":"0":l==="object"?(a="{",o.isTexture&&(a+=o.mapping,n.backend.isWebGPUBackend===!0&&(a+=o.magFilter,a+=o.minFilter,a+=o.wrapS,a+=o.wrapT,a+=o.wrapR)),a+="}"):a=String(o)}else a=String(o);r+=a+","}return r+=this.clippingContextCacheKey+",",e.geometry&&(r+=this.getGeometryCacheKey()),e.skeleton&&(r+=e.skeleton.bones.length+","),e.isBatchedMesh&&(r+=e._matricesTexture.uuid+",",e._colorsTexture!==null&&(r+=e._colorsTexture.uuid+",")),(e.isInstancedMesh||e.count>1)&&(r+=e.uuid+","),r+=this.context.id+",",r+=e.receiveShadow+",",yx(r)}get needsGeometryUpdate(){if(this.geometry.id!==this.object.geometry.id)return!0;if(this.attributes!==null){let e=this.attributesId;for(let t in e){let n=this.geometry.getAttribute(t);if(n===void 0)return!0;let r=n.isInterleavedBufferAttribute?n.data.uuid:n.id;if(e[t]!==r)return!0}}return!1}get needsUpdate(){return this.initialNodesCacheKey!==this.getDynamicCacheKey()||this.clippingNeedsUpdate}getDynamicCacheKey(){let e=0;return this.material.isShadowPassMaterial!==!0&&(e=this._nodes.getCacheKey(this.scene,this.lightsNode)),this.camera.isArrayCamera&&(e=nS(e,this.camera.cameras.length)),this.object.receiveShadow&&(e=nS(e,1)),e=nS(e,this.renderer.contextNode.id,this.renderer.contextNode.version),e}getCacheKey(){return this.getMaterialCacheKey()+this.getDynamicCacheKey()}dispose(){this.material.removeEventListener("dispose",this.onMaterialDispose),this.geometry.removeEventListener("dispose",this.onGeometryDispose),this._sourceMaterial!==null&&this._sourceMaterial.removeEventListener("dispose",this.onMaterialDispose),this.onDispose()}},cf=[],$7=class{constructor(e,t,n,r,s,o){this.renderer=e,this.nodes=t,this.geometries=n,this.pipelines=r,this.bindings=s,this.info=o,this.chainMaps={}}get(e,t,n,r,s,o,a,l){let c=this.getChainMap(l);cf[0]=e,cf[1]=t,cf[2]=o,cf[3]=s;let u=c.get(cf);return u===void 0?(u=this.createRenderObject(this.nodes,this.geometries,this.renderer,e,t,n,r,s,o,a,l),c.set(cf,u)):(u.camera=r,u.updateClipping(a),u.needsGeometryUpdate&&u.setGeometry(e.geometry),(u.version!==t.version||u.needsUpdate)&&(u.initialCacheKey!==u.getCacheKey()?(u.dispose(),u=this.get(e,t,n,r,s,o,a,l)):u.version=t.version)),cf[0]=null,cf[1]=null,cf[2]=null,cf[3]=null,u}getChainMap(e="default"){return this.chainMaps[e]||(this.chainMaps[e]=new Sf)}dispose(){this.chainMaps={}}createRenderObject(e,t,n,r,s,o,a,l,c,u,f){let d=this.getChainMap(f),A=new X7(e,t,n,r,s,o,a,l,c,u);return A.onDispose=()=>{this.pipelines.delete(A),this.bindings.deleteForRender(A),this.nodes.delete(A),d.delete(A.getChainArray())},A}},Tf=class{constructor(){this.data=new WeakMap}get(e){let t=this.data.get(e);return t===void 0&&(t={},this.data.set(e,t)),t}delete(e){let t=null;return this.data.has(e)&&(t=this.data.get(e),this.data.delete(e)),t}has(e){return this.data.has(e)}dispose(){this.data=new WeakMap}},nu={VERTEX:1,INDEX:2,STORAGE:3,INDIRECT:4},hm=16,RMe=211,PMe=212,Y7=class extends Tf{constructor(e,t){super(),this.backend=e,this.info=t}delete(e){let t=super.delete(e);return t!==null&&(this.backend.destroyAttribute(e),this.info.destroyAttribute(e)),t}update(e,t){let n=this.get(e);if(n.version===void 0)t===nu.VERTEX?(this.backend.createAttribute(e),this.info.createAttribute(e)):t===nu.INDEX?(this.backend.createIndexAttribute(e),this.info.createIndexAttribute(e)):t===nu.STORAGE?(this.backend.createStorageAttribute(e),this.info.createStorageAttribute(e)):t===nu.INDIRECT&&(this.backend.createIndirectStorageAttribute(e),this.info.createIndirectStorageAttribute(e)),n.version=this._getBufferAttribute(e).version;else{let r=this._getBufferAttribute(e);(n.version<r.version||r.usage===hg)&&(this.backend.updateAttribute(e),n.version=r.version)}}_getBufferAttribute(e){return e.isInterleavedBufferAttribute&&(e=e.data),e}};function xse(i){return i.index!==null?i.index.version:i.attributes.position.version}function yse(i){return i.index!==null?i.index.id:i.attributes.position.id}function bte(i){let e=[],t=i.index,n=i.attributes.position;if(t!==null){let s=t.array;for(let o=0,a=s.length;o<a;o+=3){let l=s[o+0],c=s[o+1],u=s[o+2];e.push(l,c,c,u,u,l)}}else{let s=n.array;for(let o=0,a=s.length/3-1;o<a;o+=3){let l=o+0,c=o+1,u=o+2;e.push(l,c,c,u,u,l)}}let r=new(n.count>=65535?GA:VA)(e,1);return r.version=xse(i),r.__id=yse(i),r}var Z7=class extends Tf{constructor(e,t){super(),this.attributes=e,this.info=t,this.wireframes=new WeakMap,this.attributeCall=new WeakMap,this._geometryDisposeListeners=new Map}has(e){let t=e.geometry;return super.has(t)&&this.get(t).initialized===!0}updateForRender(e){this.has(e)===!1&&this.initGeometry(e),this.updateAttributes(e)}initGeometry(e){let t=e.geometry,n=this.get(t);n.initialized=!0,this.info.memory.geometries++;let r=()=>{this.info.memory.geometries--;let s=t.index,o=e.getAttributes();s!==null&&this.attributes.delete(s);for(let l of o)this.attributes.delete(l);let a=this.wireframes.get(t);a!==void 0&&this.attributes.delete(a),t.removeEventListener("dispose",r),this._geometryDisposeListeners.delete(t)};t.addEventListener("dispose",r),this._geometryDisposeListeners.set(t,r)}updateAttributes(e){let t=e.getAttributes();for(let s of t)s.isStorageBufferAttribute||s.isStorageInstancedBufferAttribute?this.updateAttribute(s,nu.STORAGE):this.updateAttribute(s,nu.VERTEX);let n=this.getIndex(e);n!==null&&this.updateAttribute(n,nu.INDEX);let r=e.geometry.indirect;r!==null&&this.updateAttribute(r,nu.INDIRECT)}updateAttribute(e,t){let n=this.info.render.calls;e.isInterleavedBufferAttribute?this.attributeCall.get(e)===void 0?(this.attributes.update(e,t),this.attributeCall.set(e,n)):this.attributeCall.get(e.data)!==n&&(this.attributes.update(e,t),this.attributeCall.set(e.data,n),this.attributeCall.set(e,n)):this.attributeCall.get(e)!==n&&(this.attributes.update(e,t),this.attributeCall.set(e,n))}getIndirect(e){return e.geometry.indirect}getIndirectOffset(e){return e.geometry.indirectOffset}getIndex(e){let{geometry:t,material:n}=e,r=t.index;if(n.wireframe===!0){let s=this.wireframes,o=s.get(t);o===void 0?(o=bte(t),s.set(t,o)):(o.version!==xse(t)||o.__id!==yse(t))&&(this.attributes.delete(o),o=bte(t),s.set(t,o)),r=o}return r}dispose(){for(let[e,t]of this._geometryDisposeListeners.entries())e.removeEventListener("dispose",t);this._geometryDisposeListeners.clear()}},K7=class{constructor(){this.autoReset=!0,this.frame=0,this.calls=0,this.render={calls:0,frameCalls:0,drawCalls:0,triangles:0,points:0,lines:0,timestamp:0},this.compute={calls:0,frameCalls:0,timestamp:0},this.memory={attributes:0,attributesSize:0,geometries:0,indexAttributes:0,indexAttributesSize:0,indirectStorageAttributes:0,indirectStorageAttributesSize:0,programs:0,programsSize:0,readbackBuffers:0,readbackBuffersSize:0,renderTargets:0,storageAttributes:0,storageAttributesSize:0,textures:0,texturesSize:0,uniformBuffers:0,uniformBuffersSize:0,total:0},this.memoryMap=new Map}update(e,t,n){this.render.drawCalls++,e.isMesh||e.isSprite?this.render.triangles+=n*(t/3):e.isPoints?this.render.points+=n*t:e.isLineSegments?this.render.lines+=n*(t/2):e.isLine?this.render.lines+=n*(t-1):ze("WebGPUInfo: Unknown object type.")}reset(){this.render.drawCalls=0,this.render.frameCalls=0,this.compute.frameCalls=0,this.render.triangles=0,this.render.points=0,this.render.lines=0}dispose(){this.reset(),this.calls=0,this.render.calls=0,this.compute.calls=0,this.render.timestamp=0,this.compute.timestamp=0;for(let e in this.memory)this.memory[e]=0;this.memoryMap.clear()}createTexture(e){let t=this._getTextureMemorySize(e);this.memoryMap.set(e,t),this.memory.textures++,this.memory.total+=t,this.memory.texturesSize+=t}destroyTexture(e){let t=this.memoryMap.get(e)||0;this.memoryMap.delete(e),this.memory.textures--,this.memory.total-=t,this.memory.texturesSize-=t}_createAttribute(e,t){let n=this._getAttributeMemorySize(e);this.memoryMap.set(e,{size:n,type:t}),this.memory[t]++,this.memory.total+=n,this.memory[t+"Size"]+=n}createAttribute(e){this._createAttribute(e,"attributes")}createIndexAttribute(e){this._createAttribute(e,"indexAttributes")}createStorageAttribute(e){this._createAttribute(e,"storageAttributes")}createIndirectStorageAttribute(e){this._createAttribute(e,"indirectStorageAttributes")}destroyAttribute(e){let t=this.memoryMap.get(e);t&&(this.memoryMap.delete(e),this.memory[t.type]--,this.memory.total-=t.size,this.memory[t.type+"Size"]-=t.size)}createReadbackBuffer(e){let t=e.maxByteLength;this.memoryMap.set(e,{size:t,type:"readbackBuffers"}),this.memory.readbackBuffers++,this.memory.total+=t,this.memory.readbackBuffersSize+=t}destroyReadbackBuffer(e){let{size:t}=this.memoryMap.get(e);this.memoryMap.delete(e),this.memory.readbackBuffers--,this.memory.total-=t,this.memory.readbackBuffersSize-=t}createUniformBuffer(e){let t=e.byteLength;this.memoryMap.set(e,{size:t,type:"uniformBuffers"}),this.memory.uniformBuffers++,this.memory.total+=t,this.memory.uniformBuffersSize+=t}destroyUniformBuffer(e){let t=this.memoryMap.get(e);t&&(this.memoryMap.delete(e),this.memory.uniformBuffers--,this.memory.total-=t.size,this.memory.uniformBuffersSize-=t.size)}createProgram(e){let t=e.code.length;this.memoryMap.set(e,t),this.memory.programs++,this.memory.total+=t,this.memory.programsSize+=t}destroyProgram(e){let t=this.memoryMap.get(e)||0;this.memoryMap.delete(e),this.memory.programs--,this.memory.total-=t,this.memory.programsSize-=t}_getTextureMemorySize(e){if(e.isCompressedTexture)return 1;let t=1;e.type===Oh||e.type===Ji?t=1:e.type===Uh||e.type===wl||e.type===Wi?t=2:(e.type===Kr||e.type===xi||e.type===cr)&&(t=4);let n=4;e.format===u_||e.format===Fd||e.format===kh||e.format===Vs||e.format===xo?n=1:e.format===Ws||e.format===zh?n=2:(e.format===Nd||e.format===Ib)&&(n=3);let r=t*n;e.type===ng||e.type===ig?r=2:(e.type===ua||e.type===rg||e.type===sg)&&(r=4);let s=e.width||1,o=e.height||1,a=e.isCubeTexture?6:e.depth||1,l=s*o*a*r,c=e.mipmaps;if(c&&c.length>0){let u=0;for(let f=0;f<c.length;f++){let d=c[f];if(d.data)u+=d.data.byteLength;else{let A=d.width||Math.max(1,s>>f),y=d.height||Math.max(1,o>>f);u+=A*y*a*r}}l+=u}else e.generateMipmaps&&(l=l*1.333);return Math.round(l)}_getAttributeMemorySize(e){return e.isInterleavedBufferAttribute&&(e=e.data),e.array?e.array.byteLength:e.count&&e.itemSize?e.count*e.itemSize*4:0}},R4=class{constructor(e){this.cacheKey=e,this.usedTimes=0}},Q7=class extends R4{constructor(e,t,n){super(e),this.vertexProgram=t,this.fragmentProgram=n}},J7=class extends R4{constructor(e,t){super(e),this.computeProgram=t,this.isComputePipeline=!0}},IMe=0,lS=class{constructor(e,t,n,r=null,s=null){this.id=IMe++,this.code=e,this.stage=t,this.name=n,this.transforms=r,this.attributes=s,this.usedTimes=0}},ek=class extends Tf{constructor(e,t,n){super(),this.backend=e,this.nodes=t,this.info=n,this.bindings=null,this.caches=new Map,this.programs={vertex:new Map,fragment:new Map,compute:new Map}}getForCompute(e,t){let{backend:n}=this,r=this.get(e);if(this._needsComputeUpdate(e)){let s=r.pipeline;s&&(s.usedTimes--,s.computeProgram.usedTimes--);let o=this.nodes.getForCompute(e),a=this.programs.compute.get(o.computeShader);a===void 0&&(s&&s.computeProgram.usedTimes===0&&this._releaseProgram(s.computeProgram),a=new lS(o.computeShader,"compute",e.name,o.transforms,o.nodeAttributes),this.programs.compute.set(o.computeShader,a),n.createProgram(a),this.info.createProgram(a));let l=this._getComputeCacheKey(e,a),c=this.caches.get(l);c===void 0&&(s&&s.usedTimes===0&&this._releasePipeline(s),c=this._getComputePipeline(e,a,l,t)),c.usedTimes++,a.usedTimes++,r.version=e.version,r.pipeline=c}return r.pipeline}getForRender(e,t=null){let{backend:n}=this,r=this.get(e);if(this._needsRenderUpdate(e)){let s=r.pipeline;s&&(s.usedTimes--,s.vertexProgram.usedTimes--,s.fragmentProgram.usedTimes--);let o=e.getNodeBuilderState(),a=e.material?e.material.name:"",l=this.programs.vertex.get(o.vertexShader);l===void 0&&(s&&s.vertexProgram.usedTimes===0&&this._releaseProgram(s.vertexProgram),l=new lS(o.vertexShader,"vertex",a),this.programs.vertex.set(o.vertexShader,l),n.createProgram(l),this.info.createProgram(l));let c=this.programs.fragment.get(o.fragmentShader);c===void 0&&(s&&s.fragmentProgram.usedTimes===0&&this._releaseProgram(s.fragmentProgram),c=new lS(o.fragmentShader,"fragment",a),this.programs.fragment.set(o.fragmentShader,c),n.createProgram(c),this.info.createProgram(c));let u=this._getRenderCacheKey(e,l,c),f=this.caches.get(u);f===void 0?(s&&s.usedTimes===0&&this._releasePipeline(s),f=this._getRenderPipeline(e,l,c,u,t)):e.pipeline=f,f.usedTimes++,l.usedTimes++,c.usedTimes++,r.pipeline=f}return r.pipeline}isReady(e){let n=this.get(e).pipeline;if(n===void 0)return!1;let r=this.backend.get(n);return r.pipeline!==void 0&&r.pipeline!==null}delete(e){let t=this.get(e).pipeline;return t&&(t.usedTimes--,t.usedTimes===0&&this._releasePipeline(t),t.isComputePipeline?(t.computeProgram.usedTimes--,t.computeProgram.usedTimes===0&&this._releaseProgram(t.computeProgram)):(t.fragmentProgram.usedTimes--,t.vertexProgram.usedTimes--,t.vertexProgram.usedTimes===0&&this._releaseProgram(t.vertexProgram),t.fragmentProgram.usedTimes===0&&this._releaseProgram(t.fragmentProgram))),super.delete(e)}dispose(){super.dispose(),this.caches=new Map,this.programs={vertex:new Map,fragment:new Map,compute:new Map}}updateForRender(e){this.getForRender(e)}_getComputePipeline(e,t,n,r){n=n||this._getComputeCacheKey(e,t);let s=this.caches.get(n);return s===void 0&&(s=new J7(n,t),this.caches.set(n,s),this.backend.createComputePipeline(s,r)),s}_getRenderPipeline(e,t,n,r,s){r=r||this._getRenderCacheKey(e,t,n);let o=this.caches.get(r);return o===void 0&&(o=new Q7(r,t,n),this.caches.set(r,o),e.pipeline=o,this.backend.createRenderPipeline(e,s)),o}_getComputeCacheKey(e,t){return e.id+","+t.id}_getRenderCacheKey(e,t,n){return t.id+","+n.id+","+this.backend.getRenderCacheKey(e)}_releasePipeline(e){this.caches.delete(e.cacheKey)}_releaseProgram(e){let t=e.code,n=e.stage;this.programs[n].delete(t),this.info.destroyProgram(e)}_needsComputeUpdate(e){let t=this.get(e);return t.pipeline===void 0||t.version!==e.version}_needsRenderUpdate(e){return this.get(e).pipeline===void 0||this.backend.needsRenderUpdate(e)}},tk=class extends Tf{constructor(e,t,n,r,s,o){super(),this.backend=e,this.textures=n,this.pipelines=s,this.attributes=r,this.nodes=t,this.info=o,this.pipelines.bindings=this}getForRender(e){let t=e.getBindings(),n=this.get(e);return n.initialized!==!0&&(this._createBindings(t),n.initialized=!0),t}getForCompute(e){let t=this.nodes.getForCompute(e).bindings,n=this.get(e);return(n.initialized!==!0||n.bindings!==t)&&(n.bindings!==void 0&&this._destroyBindings(n.bindings),this._createBindings(t),n.initialized=!0,n.bindings=t),t}updateForCompute(e){this._updateBindings(this.getForCompute(e))}updateForRender(e){this._updateBindings(this.getForRender(e))}deleteForCompute(e){let n=this.get(e).bindings||this.nodes.getForCompute(e).bindings;this._destroyBindings(n),this.delete(e)}deleteForRender(e){let t=e.getBindings();this._destroyBindings(t),this.delete(e)}_createBindings(e){for(let t of e){let n=this.get(t);if(n.bindGroup===void 0){for(let r of t.bindings)if(r.isUniformBuffer)this.backend.createUniformBuffer(r),this.info.createUniformBuffer(r);else if(r.isSampledTexture)this.textures.updateTexture(r.texture);else if(r.isSampler)this.textures.updateSampler(r);else if(r.isStorageBuffer){let s=r.attribute,o=s.isIndirectStorageBufferAttribute?nu.INDIRECT:nu.STORAGE;this.attributes.update(s,o)}this.backend.createBindings(t,e,0),n.bindGroup=t,n.usedTimes=1}else n.usedTimes++}}_destroyBindings(e){for(let t of e){let n=this.get(t);if(n.usedTimes--,n.usedTimes===0){for(let r of t.bindings)r.isUniformBuffer?(this.backend.destroyUniformBuffer(r),this.info.destroyUniformBuffer(r),r.release()):r.isSampler&&(r.isSampledTexture!==!0&&this.backend.destroySampler(r),r.release());this.backend.deleteBindGroupData(t),this.delete(t)}}}_updateBindings(e){for(let t of e)this._update(t,e)}_update(e,t){let{backend:n}=this,r=!1,s=!0,o=0,a=0;for(let l of e.bindings)if(this.nodes.updateGroup(l)!==!1){if(l.isStorageBuffer){let u=l.attribute,f=u.isIndirectStorageBufferAttribute?nu.INDIRECT:nu.STORAGE,d=n.get(l);this.attributes.update(u,f),d.attribute!==u&&(d.attribute=u,r=!0)}if(l.isUniformBuffer)l.update()&&n.updateBinding(l);else if(l.isSampledTexture){let u=l.update(),f=l.texture,d=this.textures.get(f);if(u&&(this.textures.updateTexture(f),l.generation!==d.generation&&(l.generation=d.generation,r=!0),d.bindGroups.add(e)),n.get(f).externalTexture!==void 0||d.isDefaultTexture?s=!1:(o=o*10+f.id,a+=f.version),f.isStorageTexture===!0&&f.mipmapsAutoUpdate===!0){let y=this.get(f);l.store===!0?y.needsMipmap=!0:this.textures.needsMipmaps(f)&&y.needsMipmap===!0&&(this.backend.generateMipmaps(f),y.needsMipmap=!1)}}else if(l.isSampler&&l.update()){let f=this.textures.updateSampler(l);l.samplerKey!==f&&(l.samplerKey=f,r=!0)}l.isBuffer&&l.updateRanges.length>0&&l.clearUpdateRanges()}r===!0&&this.backend.updateBindings(e,t,s?o:0,a)}},LMe=Object.freeze([]);function DMe(i,e){return i.groupOrder!==e.groupOrder?i.groupOrder-e.groupOrder:i.renderOrder!==e.renderOrder?i.renderOrder-e.renderOrder:i.z!==e.z?i.z-e.z:i.id-e.id}function wte(i,e){return i.groupOrder!==e.groupOrder?i.groupOrder-e.groupOrder:i.renderOrder!==e.renderOrder?i.renderOrder-e.renderOrder:i.z!==e.z?e.z-i.z:i.id-e.id}function Ste(i){return(i.transmission>0||i.transmissionNode&&i.transmissionNode.isNode)&&i.side===vr&&i.forceSinglePass===!1}var nk=class{constructor(e,t,n){this.renderItems=[],this.renderItemsIndex=0,this.opaque=[],this.transparentDoublePass=[],this.transparent=[],this.bundles=[],this.lighting=e,this.lightsNode=e.getNode(t),this.lightsArray=[],this.scene=t,this.camera=n,this.occlusionQueryCount=0,this._lastOcclusionObject=null}begin(){return this.renderItemsIndex=0,this.opaque.length=0,this.transparentDoublePass.length=0,this.transparent.length=0,this.bundles.length=0,this.lightsArray.length=0,this.occlusionQueryCount=0,this}getNextRenderItem(e,t,n,r,s,o,a){let l=this.renderItems[this.renderItemsIndex];return l===void 0?(l={id:e.id,object:e,geometry:t,material:n,groupOrder:r,renderOrder:e.renderOrder,z:s,group:o,clippingContext:a},this.renderItems[this.renderItemsIndex]=l):(l.id=e.id,l.object=e,l.geometry=t,l.material=n,l.groupOrder=r,l.renderOrder=e.renderOrder,l.z=s,l.group=o,l.clippingContext=a),this.renderItemsIndex++,l}push(e,t,n,r,s,o,a){let l=this.getNextRenderItem(e,t,n,r,s,o,a);e.occlusionTest===!0&&this._lastOcclusionObject!==e&&(this.occlusionQueryCount++,this._lastOcclusionObject=e),n.transparent===!0||n.transmission>0||n.transmissionNode&&n.transmissionNode.isNode||n.backdropNode&&n.backdropNode.isNode?(Ste(n)&&this.transparentDoublePass.push(l),this.transparent.push(l)):this.opaque.push(l)}unshift(e,t,n,r,s,o,a){let l=this.getNextRenderItem(e,t,n,r,s,o,a);n.transparent===!0||n.transmission>0||n.transmissionNode&&n.transmissionNode.isNode||n.backdropNode&&n.backdropNode.isNode?(Ste(n)&&this.transparentDoublePass.unshift(l),this.transparent.unshift(l)):this.opaque.unshift(l)}pushBundle(e){this.bundles.push(e)}pushLight(e){this.lightsArray.push(e)}sort(e,t,n){this.opaque.length>1&&this.opaque.sort(e||DMe),this.transparentDoublePass.length>1&&this.transparentDoublePass.sort(t||wte),this.transparent.length>1&&this.transparent.sort(t||wte),n&&(this.opaque.reverse(),this.transparentDoublePass.reverse(),this.transparent.reverse())}finish(){this.lightsNode.setLights(this.lighting.enabled?this.lightsArray:LMe);for(let e=this.renderItemsIndex,t=this.renderItems.length;e<t;e++){let n=this.renderItems[e];if(n.id===null)break;n.id=null,n.object=null,n.geometry=null,n.material=null,n.groupOrder=null,n.renderOrder=null,n.z=null,n.group=null,n.clippingContext=null}this._lastOcclusionObject=null}},V_=[],ik=class{constructor(e){this.lighting=e,this.lists=new Sf}get(e,t){let n=this.lists;V_[0]=e,V_[1]=t;let r=n.get(V_);return r===void 0&&(r=new nk(this.lighting,e,t),n.set(V_,r)),V_[0]=null,V_[1]=null,r}dispose(){this.lists=new Sf}},NMe=0,rk=class{constructor(){this.id=NMe++,this.mrt=null,this.color=!0,this.clearColor=!0,this.clearColorValue={r:0,g:0,b:0,a:1},this.depth=!0,this.clearDepth=!0,this.clearDepthValue=1,this.stencil=!1,this.clearStencil=!0,this.clearStencilValue=1,this.viewport=!1,this.viewportValue=new xn,this.scissor=!1,this.scissorValue=new xn,this.renderTarget=null,this.textures=null,this.depthTexture=null,this.activeCubeFace=0,this.activeMipmapLevel=0,this.sampleCount=1,this.width=0,this.height=0,this.occlusionQueryCount=0,this.clippingContext=null,this.camera=null,this.isRenderContext=!0}getCacheKey(){return bse(this)}};function bse(i){let{textures:e,activeCubeFace:t,activeMipmapLevel:n}=i,r=[t,n];for(let s of e)r.push(s.id);return LS(r)}var sk=class{constructor(e){this.renderer=e,this._renderContexts={}}get(e=null,t=null,n=0){let r;if(e===null)r="default";else{let l=e.texture.format,c=e.texture.type;r=`${e.textures.length}:${l}:${c}:${e.samples}:${e.depthBuffer}:${e.stencilBuffer}`}let s=t!==null?t.id:"default",o=r+"-"+s+"-"+n,a=this._renderContexts[o];return a===void 0&&(a=new rk,a.mrt=t,this._renderContexts[o]=a),e!==null&&(a.sampleCount=e.samples===0?1:e.samples),a.clearDepthValue=this.renderer.getClearDepth(),a.clearStencilValue=this.renderer.getClearStencil(),a}dispose(){this._renderContexts={}}},FMe=new re,ok=class extends Tf{constructor(e,t,n){super(),this.renderer=e,this.backend=t,this.info=n,this._htmlTextures=new Set}updateRenderTarget(e,t=0){let n=this.get(e),r=e.samples===0?1:e.samples,s=n.depthTextureMips||(n.depthTextureMips={}),o=e.textures,a=this.getSize(o[0]),l=a.width>>t,c=a.height>>t,u=e.depthTexture||s[t],f=e.depthBuffer===!0||e.stencilBuffer===!0,d=!1,A=u!==void 0&&u.image!==void 0&&u.image.depth>1,y=a.depth>1&&(e.useArrayDepthTexture||e.multiview||A);u===void 0&&f&&(u=new Es,u.format=e.stencilBuffer?xo:Vs,u.type=e.stencilBuffer?ua:xi,u.image.width=l,u.image.height=c,u.image.depth=a.depth,u.renderTarget=e,s[t]=u),u&&(u.isArrayTexture=y),(n.width!==a.width||a.height!==n.height)&&(d=!0,u&&(u.needsUpdate=!0,u.image.width=l,u.image.height=c,u.image.depth=y?a.depth:1)),n.width=a.width,n.height=a.height,n.textures=o,n.depthTexture=u||null,n.depth=e.depthBuffer,n.stencil=e.stencilBuffer,n.renderTarget=e,n.sampleCount!==r&&(d=!0,u&&(u.needsUpdate=!0),n.sampleCount=r);let w={sampleCount:r};if(e.isXRRenderTarget!==!0){for(let S=0;S<o.length;S++){let T=o[S];d&&(T.needsUpdate=!0),this.updateTexture(T,w)}u&&this.updateTexture(u,w)}n.initialized!==!0&&(n.initialized=!0,this.info.memory.renderTargets++,n.onDispose=()=>{this._destroyRenderTarget(e)},e.addEventListener("dispose",n.onDispose))}updateTexture(e,t={}){let n=this.get(e);if(n.initialized===!0&&n.version===e.version)return;let r=e.isRenderTargetTexture||e.isDepthTexture||e.isFramebufferTexture,s=this.backend;if(r&&n.initialized===!0&&s.destroyTexture(e),e.isFramebufferTexture){let c=this.renderer.getRenderTarget();c?e.type=c.texture.type:e.type=Ji}if(e.isHTMLTexture&&e.image){let c=this.renderer.domElement;if("requestPaint"in c){if(c.hasAttribute("layoutsubtree")||c.setAttribute("layoutsubtree","true"),e.image.parentNode!==c&&c.appendChild(e.image),this._htmlTextures.size===0){let u=this._htmlTextures;c.onpaint=f=>{let d=f&&f.changedElements;for(let A of u)(!d||d.includes(A.image))&&(A.needsUpdate=!0)}}this._htmlTextures.add(e)}}let{width:o,height:a,depth:l}=this.getSize(e);if(t.width=o,t.height=a,t.depth=l,t.needsMipmaps=this.needsMipmaps(e),t.levels=t.needsMipmaps?this.getMipLevels(e,o,a):1,e.isCubeTexture&&e.mipmaps.length>0&&t.levels++,r||e.isStorageTexture===!0||e.isExternalTexture===!0)s.createTexture(e,t),n.generation=e.version;else if(e.version>0){let c=e.image;if(c===void 0)Xe("Renderer: Texture marked for update but image is undefined.");else if(c.complete===!1)Xe("Renderer: Texture marked for update but image is incomplete.");else{if(e.images){let f=[];for(let d of e.images)f.push(d);t.images=f}else t.image=c;(n.isDefaultTexture===void 0||n.isDefaultTexture===!0)&&(s.createTexture(e,t),n.isDefaultTexture=!1,n.generation=e.version),e.source.dataReady===!0&&s.updateTexture(e,t);let u=e.isStorageTexture===!0&&e.mipmapsAutoUpdate===!1;t.needsMipmaps&&e.mipmaps.length===0&&!u&&s.generateMipmaps(e),e.onUpdate&&e.onUpdate(e)}}else s.createDefaultTexture(e),n.isDefaultTexture=!0,n.generation=e.version;n.initialized!==!0&&(n.initialized=!0,n.generation=e.version,n.bindGroups=new Set,this.info.createTexture(e),e.isVideoTexture&&ln.enabled===!0&&ln.getTransfer(e.colorSpace)!==kt&&Xe("WebGPURenderer: Video textures must use a color space with a sRGB transfer function, e.g. SRGBColorSpace."),n.onDispose=()=>{this._destroyTexture(e)},e.addEventListener("dispose",n.onDispose)),n.version=e.version}updateSampler(e){return this.backend.updateSampler(e)}getSize(e,t=FMe){let n=e.images?e.images[0]:e.image;return n?(n.image!==void 0&&(n=n.image),e.isHTMLTexture?(t.width=n.offsetWidth||1,t.height=n.offsetHeight||1,t.depth=1):typeof HTMLVideoElement<"u"&&n instanceof HTMLVideoElement?(t.width=n.videoWidth||1,t.height=n.videoHeight||1,t.depth=1):typeof VideoFrame<"u"&&n instanceof VideoFrame?(t.width=n.displayWidth||1,t.height=n.displayHeight||1,t.depth=1):(t.width=n.width||1,t.height=n.height||1,t.depth=e.isCubeTexture?6:n.depth||1)):t.width=t.height=t.depth=1,t}getMipLevels(e,t,n){let r;return e.mipmaps.length>0?r=e.mipmaps.length:e.isCompressedTexture===!0?r=1:r=Math.floor(Math.log2(Math.max(t,n)))+1,r}needsMipmaps(e){return e.generateMipmaps===!0||e.mipmaps.length>0}_destroyRenderTarget(e){if(this.has(e)===!0){let t=this.get(e),n=t.textures,r=t.depthTexture;e.removeEventListener("dispose",t.onDispose);for(let s=0;s<n.length;s++)this._destroyTexture(n[s]);r&&this._destroyTexture(r),this.delete(e),this.backend.delete(e),this.info.memory.renderTargets--}}_destroyTexture(e){if(this.has(e)===!0){let t=this.get(e);e.removeEventListener("dispose",t.onDispose);let n=t.isDefaultTexture;if(this.backend.destroyTexture(e,n),t.bindGroups)for(let r of t.bindGroups){let s=this.backend.get(r);s.groups=void 0,s.versions=void 0;for(let o of r.bindings)o.isSampler&&o.texture===e&&(o.isSampledTexture!==!0&&this.backend.destroySampler(o),o.reset(),o.release())}this._htmlTextures.delete(e),this.delete(e),this.info.destroyTexture(e)}}},xS=class extends zt{constructor(e,t,n,r=1){super(e,t,n),this.a=r}set(e,t,n,r=1){return this.a=r,super.set(e,t,n)}copy(e){return e.a!==void 0&&(this.a=e.a),super.copy(e)}clone(){return new this.constructor(this.r,this.g,this.b,this.a)}},P4=class extends pS{static get type(){return"OverrideContextNode"}constructor(e,t=null){super(t,{overrideNodes:e}),this.isOverrideContextNode=!0}getFlowContextData(){let e=[];this.traverse(r=>{r.isOverrideContextNode===!0&&e.push(r.value.overrideNodes)});let t=new Map(e.flatMap(r=>Array.from(r.entries()))),n=super.getFlowContextData();return n.overrideNodes=t,n}};function wse(i,e=null,t=null){if(e&&e.isNode){let n=e;e=()=>n}return new P4(new Map([[i,e]]),t)}Ue("overrideNode",(i,e,t)=>wse(e,t,i));function Sse(i,e=null){let t=new Map;for(let[n,r]of i){let s=r!==null?typeof r=="function"?r:()=>r:null;t.set(n,s)}return new P4(t,e)}Ue("overrideNodes",(i,e)=>Sse(e,i));var I4=class extends gi{static get type(){return"ParameterNode"}constructor(e,t=null){super(e,t),this.isParameterNode=!0}getMemberType(e,t){let n=this.getNodeType(e),r=e.getStructTypeNode(n),s;return r!==null?s=r.getMemberType(e,t):(ze(`TSL: Member "${t}" not found in struct "${n}".`,new ts),s="float"),s}getHash(){return String(this.id)}generate(){return this.name}},BMe=(i,e)=>new I4(i,e),ak=class extends Kt{static get type(){return"StackNode"}constructor(e=null){super(),this.nodes=[],this.outputNode=null,this.parent=e,this._currentCond=null,this._expressionNode=null,this._currentNode=null,this._nodeDataLibrary=new Map,this.isStackNode=!0}getElementType(e){return this.outputNode?this.outputNode.getElementType(e):"void"}generateNodeType(e){return this.outputNode?this.outputNode.getNodeType(e):"void"}getMemberType(e,t){return this.outputNode?this.outputNode.getMemberType(e,t):"void"}addToStack(e,t=-1){if(e.isNode!==!0)return ze("TSL: Invalid node added to stack.",new ts),this;if(t===-1)if(this._currentNode){let n=this._nodeDataLibrary.get(this._currentNode);n===void 0&&(n={delta:0},this._nodeDataLibrary.set(this._currentNode,n)),n.delta++,t=this.nodes.indexOf(this._currentNode)+n.delta}else t=this.nodes.length;return this.nodes.splice(t,0,e),this}addToStackBefore(e){let t=this._currentNode?this.nodes.indexOf(this._currentNode):0;return this.addToStack(e,t)}If(e,t){let n=new ix(t);return this._currentCond=xa(e,n),this.addToStack(this._currentCond)}ElseIf(e,t){let n=new ix(t),r=xa(e,n);return this._currentCond.elseNode=r,this._currentCond=r,this}Else(e){return this._currentCond.elseNode=new ix(e),this}Switch(e){return this._expressionNode=Ht(e),this}Case(...e){let t=[];if(e.length>=2)for(let a=0;a<e.length-1;a++)t.push(this._expressionNode.equal(Ht(e[a])));else ze("TSL: Invalid parameter length. Case() requires at least two parameters.",new ts);let n=e[e.length-1],r=new ix(n),s=t[0];for(let a=1;a<t.length;a++)s=s.or(t[a]);let o=xa(s,r);return this._currentCond===null?(this._currentCond=o,this.addToStack(this._currentCond)):(this._currentCond.elseNode=o,this._currentCond=o,this)}Default(e){return this.Else(e),this}setup(e){let t=e.getNodeProperties(this),n=0;for(let r of this.getChildren())r.isVarNode&&r.isIntent(e)&&r.isAssign(e)!==!0||(t["node"+n++]=r);return t.outputNode||null}build(e,...t){let n=pz(),r=e.buildStage;fS(this),e.setActiveStack(this);for(let o=0;o<this.nodes.length;o++){let a=this.nodes[o],l=this._currentNode;if(this._currentNode=a,!(a.isVarNode&&a.isIntent(e)&&a.isAssign(e)!==!0)){if(r==="setup")a.build(e);else if(r==="analyze")a.build(e,this);else if(r==="generate"){let c=e.getDataFromNode(a,"any").stages,u=c&&c[e.shaderStage];if(a.isVarNode&&u&&u.length===1&&u[0]&&u[0].isStackNode)continue;a.build(e,"void")}this._currentNode=l}}let s;if(this.outputNode){let o=this.outputNode.build(e,...t);(e.buildStage!=="generate"||this.outputNode.getNodeType(e)!=="void")&&(s=o)}else s=super.build(e,...t);return fS(n),e.removeActiveStack(this),s}},e4=$n(ak).setParameterLength(0,1);function OMe(i){return Object.entries(i).map(([e,t])=>typeof t=="string"?{name:e,type:t,atomic:!1}:{name:e,type:t.type,atomic:t.atomic||!1})}var lk=class extends Kt{static get type(){return"StructTypeNode"}constructor(e,t=null){super("struct"),this.membersLayout=OMe(e),this.name=t,this.isStructTypeNode=!0}getLength(){let e=1,t=0;for(let n of this.membersLayout){let r=n.type,s=PTe(r),o=ITe(r);e=Math.max(e,o);let l=t%e%o;l!==0&&(t+=o-l),t+=s}return Math.ceil(t/e)*e}getMemberType(e,t){let n=this.membersLayout.find(r=>r.name===t);return n?n.type:"void"}generateNodeType(e){return e.getStructTypeFromNode(this,this.membersLayout,this.name).name}setup(e){e.getStructTypeFromNode(this,this.membersLayout,this.name),e.addInclude(this)}generate(e){return this.getNodeType(e)}},ck=class extends Kt{static get type(){return"StructNode"}constructor(e,t){super("vec3"),this.structTypeNode=e,this.values=t,this.isStructNode=!0}generateNodeType(e){return this.structTypeNode.getNodeType(e)}getMemberType(e,t){return this.structTypeNode.getMemberType(e,t)}_getChildren(){let e=super._getChildren(),t=e.find(n=>n.childNode===this.structTypeNode);return e.splice(e.indexOf(t),1),e.push(t),e}generate(e){let t=e.getVarFromNode(this),n=t.type,r=e.getPropertyName(t);return e.addLineFlowCode(`${r} = ${e.generateStruct(n,this.structTypeNode.membersLayout,this.values)}`,this),t.name}},UMe=(i,e=null)=>{let t=new lk(i,e);return dz((...r)=>{let s=null;if(r.length>0)if(r[0].isNode){s={};let o=Object.keys(i);for(let a=0;a<r.length;a++)s[o[a]]=r[a]}else s=r[0];return new ck(t,s)},t)},L4=class extends Kt{static get type(){return"OutputStructNode"}constructor(...e){super(),this.members=e,this.isOutputStructNode=!0}generateNodeType(){return"OutputType"}generate(e){let t=e.getDataFromNode(this);if(t.membersLayout===void 0){let o=this.members,a=[];for(let l=0;l<o.length;l++){let c="m"+l,u=o[l].getNodeType(e);a.push({name:c,type:u,index:l})}t.membersLayout=a,t.structType=e.getOutputStructTypeFromNode(this,t.membersLayout)}let n=e.getOutputStructName(),r=this.members,s=n!==""?n+".":"";for(let o=0;o<r.length;o++){let a=r[o].build(e,t.membersLayout[o].type);e.addLineFlowCode(`${s}m${o} = ${a}`,this)}return n}},kMe=$n(L4),D4=class{constructor(e=Ts){this.blending=e,this.blendSrc=Jp,this.blendDst=e0,this.blendEquation=oo,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.premultiplyAlpha=!1}copy(e){return this.blending=e.blending,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.premultiplyAlpha=e.premultiplyAlpha,this}clone(){return new this.constructor().copy(this)}},zMe=new D4(ps),VMe=new D4(fb);function Tse(i,e){for(let t=0;t<i.length;t++)if(i[t].name===e)return t;return-1}var uk=class extends L4{static get type(){return"MRTNode"}constructor(e){super(),this.outputNodes=e,this.blendModes={output:VMe},this.isMRTNode=!0}setBlendMode(e,t){return this.blendModes[e]=t,this}getBlendMode(e){return this.blendModes[e]||zMe}has(e){return this.outputNodes[e]!==void 0}get(e){return this.outputNodes[e]}merge(e){let t={...this.outputNodes,...e.outputNodes},n={...this.blendModes,...e.blendModes},r=Ese(t);return r.blendings=n,r}setup(e){let t=this.outputNodes,n=e.renderer.getRenderTarget(),r=[],s=n.textures;for(let o in t){let a=Tse(s,o);if(a===-1)continue;let l=e.getOutputType(a);r[a]=t[o].convert(l)}return this.members=r,super.setup(e)}},Ese=$n(uk),r1=class extends Rr{static get type(){return"BitcastNode"}constructor(e,t,n=null){super(),this.valueNode=e,this.conversionType=t,this.inputType=n,this.isBitcastNode=!0}generateNodeType(e){if(this.inputType!==null){let t=this.valueNode.getNodeType(e),n=e.getTypeLength(t);return e.getTypeFromLength(n,this.conversionType)}return this.conversionType}generate(e){let t=this.getNodeType(e),n="";if(this.inputType!==null){let r=this.valueNode.getNodeType(e);n=e.getTypeLength(r)===1?this.inputType:e.changeComponentType(r,this.inputType)}else n=this.valueNode.getNodeType(e);return`${e.getBitcastMethod(t,n)}( ${this.valueNode.build(e,n)} )`}},Mse=ct(r1).setParameterLength(2),GMe=i=>new r1(i,"int","float"),Cse=i=>new r1(i,"uint","float"),qMe=i=>new r1(i,"float","int"),HMe=i=>new r1(i,"float","uint"),TR={},Ku=class i extends Pe{static get type(){return"BitcountNode"}constructor(e,t){super(e,t),this.isBitcountNode=!0}_resolveElementType(e,t,n){n==="int"?t.assign(Mse(e,"uint")):t.assign(e)}_returnDataNode(e){switch(e){case"uint":return rt;case"int":return de;case"uvec2":return mz;case"uvec3":return l1;case"uvec4":return _z;case"ivec2":return kr;case"ivec3":return Az;case"ivec4":return vz}}_createTrailingZerosBaseLayout(e,t){let n=this._returnDataNode(t);return me(([s])=>{let o=rt(0);this._resolveElementType(s,o,t);let a=oe(o.bitAnd(Pz(o))),c=Cse(a).shiftRight(23).sub(127);return n(c)}).setLayout({name:e,type:t,inputs:[{name:"value",type:t}]})}_createLeadingZerosBaseLayout(e,t){let n=this._returnDataNode(t);return me(([s])=>{$t(s.equal(rt(0)),()=>rt(32));let o=rt(0),a=rt(0);return this._resolveElementType(s,o,t),$t(o.shiftRight(16).equal(0),()=>{a.addAssign(16),o.shiftLeftAssign(16)}),$t(o.shiftRight(24).equal(0),()=>{a.addAssign(8),o.shiftLeftAssign(8)}),$t(o.shiftRight(28).equal(0),()=>{a.addAssign(4),o.shiftLeftAssign(4)}),$t(o.shiftRight(30).equal(0),()=>{a.addAssign(2),o.shiftLeftAssign(2)}),$t(o.shiftRight(31).equal(0),()=>{a.addAssign(1)}),n(a)}).setLayout({name:e,type:t,inputs:[{name:"value",type:t}]})}_createOneBitsBaseLayout(e,t){let n=this._returnDataNode(t);return me(([s])=>{let o=rt(0);this._resolveElementType(s,o,t),o.assign(o.sub(o.shiftRight(rt(1)).bitAnd(rt(1431655765)))),o.assign(o.bitAnd(rt(858993459)).add(o.shiftRight(rt(2)).bitAnd(rt(858993459))));let a=o.add(o.shiftRight(rt(4))).bitAnd(rt(252645135)).mul(rt(16843009)).shiftRight(rt(24));return n(a)}).setLayout({name:e,type:t,inputs:[{name:"value",type:t}]})}_createMainLayout(e,t,n,r){let s=this._returnDataNode(t);return me(([a])=>{if(n===1)return s(r(a));{let l=s(0),c=["x","y","z","w"];for(let u=0;u<n;u++){let f=c[u];l[f].assign(r(a[f]))}return l}}).setLayout({name:e,type:t,inputs:[{name:"value",type:t}]})}setup(e){let{method:t,aNode:n}=this,{renderer:r}=e;if(r.backend.isWebGPUBackend)return super.setup(e);let s=this.getInputType(e),o=e.getElementType(s),a=e.getTypeLength(s),l=`${t}_base_${o}`,c=`${t}_${s}`,u=TR[l];if(u===void 0){switch(t){case i.COUNT_LEADING_ZEROS:{u=this._createLeadingZerosBaseLayout(l,o);break}case i.COUNT_TRAILING_ZEROS:{u=this._createTrailingZerosBaseLayout(l,o);break}case i.COUNT_ONE_BITS:{u=this._createOneBitsBaseLayout(l,o);break}}TR[l]=u}let f=TR[c];return f===void 0&&(f=this._createMainLayout(c,s,a,u),TR[c]=f),me(()=>f(n))()}};Ku.COUNT_TRAILING_ZEROS="countTrailingZeros";Ku.COUNT_LEADING_ZEROS="countLeadingZeros";Ku.COUNT_ONE_BITS="countOneBits";var WMe=ct(Ku,Ku.COUNT_TRAILING_ZEROS).setParameterLength(1),jMe=ct(Ku,Ku.COUNT_LEADING_ZEROS).setParameterLength(1),XMe=ct(Ku,Ku.COUNT_ONE_BITS).setParameterLength(1),$Me=me(([i])=>{let e=i.toUint().mul(747796405).add(2891336453),t=e.shiftRight(e.shiftRight(28).add(4)).bitXor(e).mul(277803737);return t.shiftRight(22).bitXor(t).toFloat().mul(1/2**32)}),hk=(i,e)=>eu(Tn(4,i.mul(ai(1,i))),e),YMe=(i,e)=>i.lessThan(.5)?hk(i.mul(2),e).div(2):ai(1,hk(Tn(ai(1,i),2),e).div(2)),ZMe=(i,e,t)=>eu(pc(eu(i,e),Ps(eu(i,e),eu(ai(1,i),t))),1/e),KMe=(i,e)=>Ka(f4.mul(e.mul(i).sub(1))).div(f4.mul(e.mul(i).sub(1))),yS=class extends Rr{static get type(){return"PackFloatNode"}constructor(e,t){super(),this.vectorNode=t,this.encoding=e,this.isPackFloatNode=!0}generateNodeType(){return"uint"}generate(e){let t=this.vectorNode.getNodeType(e);return`${e.getFloatPackingMethod(this.encoding)}(${this.vectorNode.build(e,t)})`}},QMe=ct(yS,"snorm").setParameterLength(1),JMe=ct(yS,"unorm").setParameterLength(1),eCe=ct(yS,"float16").setParameterLength(1),bS=class extends Rr{static get type(){return"UnpackFloatNode"}constructor(e,t){super(),this.uintNode=t,this.encoding=e,this.isUnpackFloatNode=!0}generateNodeType(){return"vec2"}generate(e){let t=this.uintNode.getNodeType(e);return`${e.getFloatUnpackingMethod(this.encoding)}(${this.uintNode.build(e,t)})`}},tCe=ct(bS,"snorm").setParameterLength(1),nCe=ct(bS,"unorm").setParameterLength(1),iCe=ct(bS,"float16").setParameterLength(1),jd=me(([i])=>i.fract().sub(.5).abs()).setLayout({name:"tri",type:"float",inputs:[{name:"x",type:"float"}]}),rCe=me(([i])=>pe(jd(i.z.add(jd(i.y.mul(1)))),jd(i.z.add(jd(i.x.mul(1)))),jd(i.y.add(jd(i.x.mul(1)))))).setLayout({name:"tri3",type:"vec3",inputs:[{name:"p",type:"vec3"}]}),sCe=me(([i,e,t])=>{let n=pe(i).toVar(),r=oe(1.4).toVar(),s=oe(0).toVar(),o=pe(n).toVar();return Oi({start:oe(0),end:oe(3),type:"float",condition:"<="},()=>{let a=pe(rCe(o.mul(2))).toVar();n.addAssign(a.add(t.mul(oe(.1).mul(e)))),o.mulAssign(1.8),r.mulAssign(1.5),n.mulAssign(1.2);let l=oe(jd(n.z.add(jd(n.x.add(jd(n.y)))))).toVar();s.addAssign(l.div(r)),o.addAssign(.14)}),s}).setLayout({name:"triNoise3D",type:"float",inputs:[{name:"position",type:"vec3"},{name:"speed",type:"float"},{name:"time",type:"float"}]}),fk=class extends Kt{static get type(){return"FunctionOverloadingNode"}constructor(e=[],...t){super(),this.functionNodes=e,this.parametersNodes=t,this._candidateFn=null,this.global=!0}generateNodeType(e){return this.getCandidateFn(e).shaderNode.layout.type}getCandidateFn(e){let t=this.parametersNodes,n=this._candidateFn;if(n===null){let r=null,s=-1;for(let o of this.functionNodes){let l=o.shaderNode.layout;if(l===null)throw new Error("THREE.FunctionOverloadingNode: FunctionNode must be a layout.");let c=l.inputs;if(t.length===c.length){let u=0;for(let f=0;f<t.length;f++){let d=t[f],A=c[f];d.getNodeType(e)===A.type&&u++}u>s&&(r=o,s=u)}}this._candidateFn=n=r}return n}setup(e){return this.getCandidateFn(e)(...this.parametersNodes)}},oCe=$n(fk),Ko=i=>(...e)=>oCe(i,...e),Sx=Xt(0).setGroup(Jt).onRenderUpdate(i=>i.time),aCe=Xt(0).setGroup(Jt).onRenderUpdate(i=>i.deltaTime),Rse=Xt(0,"uint").setGroup(Jt).onRenderUpdate(i=>i.frameId),lCe=(i=Sx)=>i.add(.75).mul(Math.PI*2).sin().mul(.5).add(.5),cCe=(i=Sx)=>i.fract().round(),uCe=(i=Sx)=>i.add(.5).fract().mul(2).sub(1).abs(),hCe=(i=Sx)=>i.fract();function fCe(i,e=null){return ep(e,{getUV:typeof i=="function"?i:()=>i})}var dCe=me(([i,e,t=dt(.5)])=>FS(i.sub(t),e).add(t)),pCe=me(([i,e,t=dt(.5)])=>{let n=i.sub(t),r=n.dot(n),o=r.mul(r).mul(e);return i.add(n.mul(o))}),mCe=me(({position:i=null,horizontal:e=!0,vertical:t=!1})=>{let n;i!==null?(n=tu.toVar(),n[3][0]=i.x,n[3][1]=i.y,n[3][2]=i.z):n=tu;let r=wm.mul(n);return hx(e)&&(r[0][0]=tu[0].length(),r[0][1]=0,r[0][2]=0),hx(t)&&(r[1][0]=0,r[1][1]=tu[1].length(),r[1][2]=0),r[2][0]=0,r[2][1]=0,r[2][2]=1,Ja.mul(r).mul(Mr)}),ACe=me(([i=null])=>{let e=y4();return y4(AV(i)).sub(e).lessThan(0).select(ju,i)}),gCe=me(([i,e=Ui(),t=oe(0)])=>{let n=i.x,r=i.y,s=t.mod(n.mul(r)).floor(),o=s.mod(n),a=r.sub(s.add(1).div(n).ceil()),l=i.reciprocal(),c=dt(o,a);return e.add(c).mul(l)}),Pse=me(([i,e=null,t=null,n=oe(1),r=Mr,s=wa])=>{let o=s.abs().normalize();o=o.div(o.dot(pe(1)));let a=r.yz.mul(n),l=r.zx.mul(n),c=r.xy.mul(n),u=i.value,f=e!==null?e.value:u,d=t!==null?t.value:u,A=fi(u,a).mul(o.x),y=fi(f,l).mul(o.y),w=fi(d,c).mul(o.z);return Ps(A,y,w)}),vCe=(...i)=>Pse(...i),G_=new Na,Dg=new re,q_=new re,iU=new re,Vw=new cn,ER=new re(0,0,-1),uf=new xn,Gw=new re,MR=new re,qw=new xn,CR=new Oe,N4=new Ba,_Ce=ju.flipX();N4.depthTexture=new Es(1,1);var RR=!1,dk=class i extends su{static get type(){return"ReflectorNode"}constructor(e={}){super(e.defaultTexture||N4.texture,_Ce),this._reflectorBaseNode=e.reflector||new pk(this,e),this._depthNode=null,this.setUpdateMatrix(!1)}get reflector(){return this._reflectorBaseNode}get target(){return this._reflectorBaseNode.target}getDepthNode(){if(this._depthNode===null){if(this._reflectorBaseNode.depth!==!0)throw new Error("THREE.ReflectorNode: Depth node can only be requested when the reflector is created with { depth: true }. ");this._depthNode=new i({defaultTexture:N4.depthTexture,reflector:this._reflectorBaseNode})}return this._depthNode}setup(e){return e.object.isQuadMesh||this._reflectorBaseNode.build(e),super.setup(e)}clone(){let e=new this.constructor(this.reflectorNode);return e.uvNode=this.uvNode,e.levelNode=this.levelNode,e.biasNode=this.biasNode,e.sampler=this.sampler,e.depthNode=this.depthNode,e.compareNode=this.compareNode,e.gradNode=this.gradNode,e.gatherNode=this.gatherNode,e.offsetNode=this.offsetNode,e._reflectorBaseNode=this._reflectorBaseNode,e}dispose(){super.dispose(),this._reflectorBaseNode.dispose()}},pk=class extends Kt{static get type(){return"ReflectorBaseNode"}constructor(e,t={}){super();let{target:n=new lr,resolutionScale:r=1,generateMipmaps:s=!1,bounces:o=!0,depth:a=!1,samples:l=0}=t;this.textureNode=e,this.target=n,this.resolutionScale=r,t.resolution!==void 0&&(ni('ReflectorNode: The "resolution" parameter has been renamed to "resolutionScale".'),this.resolutionScale=t.resolution),this.generateMipmaps=s,this.bounces=o,this.depth=a,this.samples=l,this.updateBeforeType=o?yn.RENDER:yn.FRAME,this.virtualCameras=new WeakMap,this.renderTargets=new Map,this.forceUpdate=!1,this.hasOutput=!1}_updateResolution(e,t){let n=this.resolutionScale;t.getDrawingBufferSize(CR),e.setSize(Math.round(CR.width*n),Math.round(CR.height*n))}setup(e){return this._updateResolution(N4,e.renderer),super.setup(e)}dispose(){super.dispose();for(let e of this.renderTargets.values())e.dispose()}getVirtualCamera(e){let t=this.virtualCameras.get(e);return t===void 0&&(t=e.clone(),this.virtualCameras.set(e,t)),t}getRenderTarget(e){let t=this.renderTargets.get(e);return t===void 0&&(t=new Ba(0,0,{type:Wi,samples:this.samples}),this.generateMipmaps===!0&&(t.texture.minFilter=K8,t.texture.generateMipmaps=!0),this.depth===!0&&(t.depthTexture=new Es),this.renderTargets.set(e,t)),t}updateBefore(e){if(this.bounces===!1&&RR)return!1;RR=!0;let{scene:t,camera:n,renderer:r,material:s}=e,{target:o}=this,a=this.getVirtualCamera(n),l=this.getRenderTarget(a);r.getDrawingBufferSize(CR),this._updateResolution(l,r),q_.setFromMatrixPosition(o.matrixWorld),iU.setFromMatrixPosition(n.matrixWorld),Vw.extractRotation(o.matrixWorld),Dg.set(0,0,1),Dg.applyMatrix4(Vw),Gw.subVectors(q_,iU);let c=Gw.dot(Dg)>0,u=!1;if(c===!0&&this.forceUpdate===!1){if(this.hasOutput===!1){RR=!1;return}u=!0}Gw.reflect(Dg).negate(),Gw.add(q_),Vw.extractRotation(n.matrixWorld),ER.set(0,0,-1),ER.applyMatrix4(Vw),ER.add(iU),MR.subVectors(q_,ER),MR.reflect(Dg).negate(),MR.add(q_),a.coordinateSystem=n.coordinateSystem,a.position.copy(Gw),a.up.set(0,1,0),a.up.applyMatrix4(Vw),a.up.reflect(Dg),a.lookAt(MR),a.near=n.near,a.far=n.far,a.updateMatrixWorld(),a.projectionMatrix.copy(n.projectionMatrix),G_.setFromNormalAndCoplanarPoint(Dg,q_),G_.applyMatrix4(a.matrixWorldInverse),uf.set(G_.normal.x,G_.normal.y,G_.normal.z,G_.constant);let f=a.projectionMatrix;qw.x=(Math.sign(uf.x)+f.elements[8])/f.elements[0],qw.y=(Math.sign(uf.y)+f.elements[9])/f.elements[5],qw.z=-1,qw.w=(1+f.elements[10])/f.elements[14],uf.multiplyScalar(1/uf.dot(qw));let d=0;f.elements[2]=uf.x,f.elements[6]=uf.y,f.elements[10]=r.coordinateSystem===xl?uf.z-d:uf.z+1-d,f.elements[14]=uf.w,this.textureNode.value=l.texture,this.depth===!0&&(this.textureNode.getDepthNode().value=l.depthTexture),s.visible=!1;let A=r.getRenderTarget(),y=r.getMRT(),w=r.autoClear;r.setMRT(null),r.setRenderTarget(l),r.autoClear=!0;let S=t.name;t.name=(t.name||"Scene")+" [ Reflector ]",u?(r.clear(),this.hasOutput=!1):(r.render(t,a),this.hasOutput=!0),t.name=S,r.setMRT(y),r.setRenderTarget(A),r.autoClear=w,s.visible=!0,RR=!1,this.forceUpdate=!1}get resolution(){return ni('ReflectorNode: The "resolution" property has been renamed to "resolutionScale".'),this.resolutionScale}set resolution(e){ni('ReflectorNode: The "resolution" property has been renamed to "resolutionScale".'),this.resolutionScale=e}},xCe=i=>new dk(i),rU=new Du(-1,1,1,-1,0,1),mk=class extends Xn{constructor(e=!1){super();let t=e===!1?[0,-1,0,1,2,1]:[0,2,0,0,2,0];this.setAttribute("position",new Ln([-1,3,0,-1,-1,0,3,-1,0],3)),this.setAttribute("uv",new Ln(t,2))}},yCe=new mk,wS=class extends Hn{constructor(e=null){super(yCe,e),this.camera=rU,this.isQuadMesh=!0}async renderAsync(e){ni('QuadMesh: "renderAsync()" has been deprecated. Use "render()" and "await renderer.init();" when creating the renderer.'),await e.init(),e.render(this,rU)}render(e){e.render(this,rU)}},bCe=new Oe,Ak=class extends su{static get type(){return"RTTNode"}constructor(e,t=null,n=null,r={type:Wi}){let s=new Ba(t,n,r);super(s.texture,Ui()),this.isRTTNode=!0,this.node=e,this.width=t,this.height=n,this.renderTarget=s,this.textureNeedsUpdate=!0,this.autoUpdate=!0,this._resolutionScale=1,this._rttNode=null,this._quadMesh=new wS(new Pr),this.updateBeforeType=yn.RENDER}get autoResize(){return this.width===null}setup(e){return this._rttNode=this.node.context(e.getSharedContext()),this._quadMesh.material.name="RTT",this._quadMesh.material.needsUpdate=!0,super.setup(e)}setSize(e,t){let n=Math.floor(e*this._resolutionScale),r=Math.floor(t*this._resolutionScale);this.renderTarget.setSize(n,r),this.textureNeedsUpdate=!0}setResolutionScale(e){return this._resolutionScale=e,this.autoResize===!1&&this.setSize(this.width,this.height),this}getResolutionScale(){return this._resolutionScale}updateBefore({renderer:e}){if(this.textureNeedsUpdate===!1&&this.autoUpdate===!1)return;this.textureNeedsUpdate=!1;let t=e.getRenderTarget();if(this.autoResize===!0){let r=e.getDrawingBufferSize(bCe),s=Math.floor(r.width*this._resolutionScale),o=Math.floor(r.height*this._resolutionScale);(s!==this.renderTarget.width||o!==this.renderTarget.height)&&(this.renderTarget.setSize(s,o),this.textureNeedsUpdate=!0)}let n="RTT";this.node.name&&(n=this.node.name+" [ "+n+" ]"),this._quadMesh.material.fragmentNode=this._rttNode,this._quadMesh.name=n,e.setRenderTarget(this.renderTarget),this._quadMesh.render(e),e.setRenderTarget(t)}clone(){let e=new su(this.value,this.uvNode,this.levelNode);return e.sampler=this.sampler,e.referenceNode=this,e}},Ise=(i,...e)=>new Ak(Ht(i),...e),wCe=(i,...e)=>i.isSampleNode||i.isTextureNode?i:i.isPassNode?i.getTextureNode():Ise(i,...e),nx=me(([i,e,t],n)=>{let r;n.renderer.coordinateSystem===xl?(i=dt(i.x,i.y.oneMinus()).mul(2).sub(1),r=Ft(pe(i,e),1)):r=Ft(pe(i.x,i.y.oneMinus(),e).mul(2).sub(1),1);let s=Ft(t.mul(r));return s.xyz.div(s.w)}),SCe=me(([i,e])=>{let t=e.mul(Ft(i,1)),n=t.xy.div(t.w).mul(.5).add(.5).toVar();return dt(n.x,n.y.oneMinus())}),TCe=me(([i,e,t])=>{let n=e1(_s(e)),r=kr(i.mul(n)).toVar(),s=_s(e,r).toVar(),o=_s(e,r.sub(kr(2,0))).toVar(),a=_s(e,r.sub(kr(1,0))).toVar(),l=_s(e,r.add(kr(1,0))).toVar(),c=_s(e,r.add(kr(2,0))).toVar(),u=_s(e,r.add(kr(0,2))).toVar(),f=_s(e,r.add(kr(0,1))).toVar(),d=_s(e,r.sub(kr(0,1))).toVar(),A=_s(e,r.sub(kr(0,2))).toVar(),y=fr(ai(oe(2).mul(a).sub(o),s)).toVar(),w=fr(ai(oe(2).mul(l).sub(c),s)).toVar(),S=fr(ai(oe(2).mul(f).sub(u),s)).toVar(),T=fr(ai(oe(2).mul(d).sub(A),s)).toVar(),R=nx(i,s,t).toVar(),I=y.lessThan(w).select(R.sub(nx(i.sub(dt(oe(1).div(n.x),0)),a,t)),R.negate().add(nx(i.add(dt(oe(1).div(n.x),0)),l,t))),P=S.lessThan(T).select(R.sub(nx(i.add(dt(0,oe(1).div(n.y))),f,t)),R.negate().add(nx(i.sub(dt(0,oe(1).div(n.y))),d,t)));return ya(Kd(I,P))}),SV=me(([i])=>$u(oe(52.9829189).mul($u(ru(i,dt(.06711056,.00583715)))))).setLayout({name:"interleavedGradientNoise",type:"float",inputs:[{name:"position",type:"vec2"}]}),Wu=me(([i,e,t])=>{let n=oe(2.399963229728653),r=el(oe(i).add(.5).div(oe(e))),s=oe(i).mul(n).add(t);return dt(Hu(s),Ka(s)).mul(r)}).setLayout({name:"vogelDiskSample",type:"vec2",inputs:[{name:"sampleIndex",type:"int"},{name:"samplesCount",type:"int"},{name:"phi",type:"float"}]}),gk=class extends Kt{static get type(){return"SampleNode"}constructor(e,t=null){super(),this.callback=e,this.uvNode=t,this.isSampleNode=!0}setup(){return this.sample(Ui())}sample(e){return this.callback(e)}},ECe=(i,e=null)=>new gk(i,Ht(e)),s1=class extends Ql{constructor(e,t,n=Float32Array){let r=ArrayBuffer.isView(e)?e:new n(e*t);super(r,t),this.isStorageInstancedBufferAttribute=!0}},vk=class extends Hi{constructor(e,t,n=Float32Array){let r=ArrayBuffer.isView(e)?e:new n(e*t);super(r,t),this.isStorageBufferAttribute=!0}},MCe=(i,e="float")=>{let t,n;e.isStructTypeNode===!0?(t=e.getLength(),n=t4("float")):(t=one(e),n=t4(e));let r=new vk(i,t,n);return mm(r,e,i)},CCe=(i,e="float")=>{let t,n;e.isStructTypeNode===!0?(t=e.getLength(),n=t4("float")):(t=one(e),n=t4(e));let r=new s1(i,t,n);return mm(r,e,r.count)},_k=class extends Kt{static get type(){return"PointUVNode"}constructor(){super("vec2"),this.isPointUVNode=!0}generate(){return"vec2( gl_PointCoord.x, 1.0 - gl_PointCoord.y )"}},RCe=xt(_k),sU=new cn,Lse=Xt(0).setGroup(Jt).onRenderUpdate(({scene:i})=>i.backgroundBlurriness),xk=Xt(1).setGroup(Jt).onRenderUpdate(({scene:i})=>i.backgroundIntensity),Dse=Xt(new cn).setGroup(Jt).onRenderUpdate(({scene:i})=>{let e=i.background;return e!==null&&e.isTexture&&e.mapping!==Rb||i.backgroundNode&&i.backgroundNode.isNode?sU.makeRotationFromEuler(i.backgroundRotation).transpose():sU.identity(),sU}),F4=class extends su{static get type(){return"StorageTextureNode"}constructor(e,t,n=null){super(e,t),this.storeNode=n,this.mipLevel=0,this.isStorageTextureNode=!0,this.access=Yo.WRITE_ONLY}getInputType(){return"storageTexture"}getTransformedUV(e){return e}setup(e){super.setup(e);let t=e.getNodeProperties(this);return t.storeNode=this.storeNode,t}setAccess(e){return this.access=e,this}setMipLevel(e){return this.mipLevel=e,this}generate(e,t){return this.storeNode!==null?(this.generateStore(e),""):super.generate(e,t)}generateSnippet(e,t,n,r,s,o,a,l,c){let u=this.value;return e.generateStorageTextureLoad(u,t,n,r,o,c)}toReadWrite(){return this.setAccess(Yo.READ_WRITE)}toReadOnly(){return this.setAccess(Yo.READ_ONLY)}toWriteOnly(){return this.setAccess(Yo.WRITE_ONLY)}store(e,t){let n=this.clone();return n.referenceNode=this.getBase(),n.uvNode=e,n.storeNode=t,t!==null&&n.toStack(),n}generateStore(e){let t=e.getNodeProperties(this),{uvNode:n,storeNode:r,depthNode:s}=t,o=super.generate(e,"property"),a=n.build(e,this.value.is3DTexture===!0?"uvec3":"uvec2"),l=r.build(e,"vec4"),c=s?s.build(e,"int"):null,u=e.generateTextureStore(this.value,o,a,c,l);e.addLineFlowCode(u,this)}clone(){let e=super.clone();return e.storeNode=this.storeNode,e.mipLevel=this.mipLevel,e.access=this.access,e}},Nse=$n(F4).setParameterLength(1,3),PCe=(i,e,t)=>{let n;return i.isStorageTextureNode===!0?n=i.store(e,t):(n=Nse(i,e,t),t!==null&&n.toStack()),n},yk=class extends F4{static get type(){return"StorageTexture3DNode"}constructor(e,t,n=null){super(e,t,n),this.isStorageTexture3DNode=!0}getDefaultUV(){return pe(.5,.5,.5)}setUpdateMatrix(){}generateUV(e,t){return t.build(e,this.sampler===!0?"vec3":"ivec3")}generateOffset(e,t){return t.build(e,"ivec3")}},ICe=$n(yk).setParameterLength(1,3),LCe=me(({texture:i,uv:e})=>{let n=pe().toVar();return $t(e.x.lessThan(1e-4),()=>{n.assign(pe(1,0,0))}).ElseIf(e.y.lessThan(1e-4),()=>{n.assign(pe(0,1,0))}).ElseIf(e.z.lessThan(1e-4),()=>{n.assign(pe(0,0,1))}).ElseIf(e.x.greaterThan(1-1e-4),()=>{n.assign(pe(-1,0,0))}).ElseIf(e.y.greaterThan(1-1e-4),()=>{n.assign(pe(0,-1,0))}).ElseIf(e.z.greaterThan(1-1e-4),()=>{n.assign(pe(0,0,-1))}).Else(()=>{let s=i.sample(e.add(pe(-.01,0,0))).r.sub(i.sample(e.add(pe(.01,0,0))).r),o=i.sample(e.add(pe(0,-.01,0))).r.sub(i.sample(e.add(pe(0,.01,0))).r),a=i.sample(e.add(pe(0,0,-.01))).r.sub(i.sample(e.add(pe(0,0,.01))).r);n.assign(pe(s,o,a))}),n.normalize()}),bk=class extends su{static get type(){return"Texture3DNode"}constructor(e,t=null,n=null){super(e,t,n),this.isTexture3DNode=!0}getInputType(){return"texture3D"}getDefaultUV(){return pe(.5,.5,.5)}setUpdateMatrix(){}generateUV(e,t){return t.build(e,this.sampler===!0?"vec3":"ivec3")}generateOffset(e,t){return t.build(e,"ivec3")}normal(e){return LCe({texture:this,uv:e})}},TV=$n(bk).setParameterLength(1,3),DCe=(...i)=>TV(...i).setSampler(!1),NCe=(i,e,t)=>TV(i,e).level(t),wk=class extends px{static get type(){return"UserDataNode"}constructor(e,t,n=null){super(e,t,n),this.userData=n}updateReference(e){return this.reference=this.userData!==null?this.userData:e.object.userData,this.reference}},FCe=(i,e,t)=>new wk(i,e,t),Tte=new WeakMap,Sk=class extends Rr{static get type(){return"VelocityNode"}constructor(){super("vec2"),this.projectionMatrix=null,this.updateType=yn.OBJECT,this.updateAfterType=yn.OBJECT,this.previousModelWorldMatrix=Xt(new cn),this.previousProjectionMatrix=Xt(new cn).setGroup(Jt),this.previousCameraViewMatrix=Xt(new cn)}setProjectionMatrix(e){this.projectionMatrix=e}update({frameId:e,camera:t,object:n}){let r=Ete(n);this.previousModelWorldMatrix.value.copy(r);let s=Fse(t);s.frameId!==e&&(s.frameId=e,s.previousProjectionMatrix===void 0?(s.previousProjectionMatrix=new cn,s.previousCameraViewMatrix=new cn,s.currentProjectionMatrix=new cn,s.currentCameraViewMatrix=new cn,s.previousProjectionMatrix.copy(this.projectionMatrix||t.projectionMatrix),s.previousCameraViewMatrix.copy(t.matrixWorldInverse)):(s.previousProjectionMatrix.copy(s.currentProjectionMatrix),s.previousCameraViewMatrix.copy(s.currentCameraViewMatrix)),s.currentProjectionMatrix.copy(this.projectionMatrix||t.projectionMatrix),s.currentCameraViewMatrix.copy(t.matrixWorldInverse),this.previousProjectionMatrix.value.copy(s.previousProjectionMatrix),this.previousCameraViewMatrix.value.copy(s.previousCameraViewMatrix))}updateAfter({object:e}){Ete(e).copy(e.matrixWorld)}setup(){let e=this.projectionMatrix===null?Ja:Xt(this.projectionMatrix),t=this.previousCameraViewMatrix.mul(this.previousModelWorldMatrix),n=e.mul(bf).mul(Mr),r=this.previousProjectionMatrix.mul(t).mul(n1),s=n.xy.div(n.w),o=r.xy.div(r.w);return ai(s,o)}};function Fse(i){let e=Tte.get(i);return e===void 0&&(e={},Tte.set(i,e)),e}function Ete(i,e=0){let t=Fse(i),n=t[e];return n===void 0&&(t[e]=n=new cn,t[e].copy(i.matrixWorld)),n}var BCe=xt(Sk),OCe=me(([i,e])=>Pl(1,i.oneMinus().div(e)).oneMinus()).setLayout({name:"blendBurn",type:"vec3",inputs:[{name:"base",type:"vec3"},{name:"blend",type:"vec3"}]}),UCe=me(([i,e])=>Pl(i.div(e.oneMinus()),1)).setLayout({name:"blendDodge",type:"vec3",inputs:[{name:"base",type:"vec3"},{name:"blend",type:"vec3"}]}),kCe=me(([i,e])=>i.oneMinus().mul(e.oneMinus()).oneMinus()).setLayout({name:"blendScreen",type:"vec3",inputs:[{name:"base",type:"vec3"},{name:"blend",type:"vec3"}]}),zCe=me(([i,e])=>Qn(i.mul(2).mul(e),i.oneMinus().mul(2).mul(e.oneMinus()).oneMinus(),Jg(.5,i))).setLayout({name:"blendOverlay",type:"vec3",inputs:[{name:"base",type:"vec3"},{name:"blend",type:"vec3"}]}),VCe=me(([i,e])=>{let t=e.a.add(i.a.mul(e.a.oneMinus()));return Ft(e.rgb.mul(e.a).add(i.rgb.mul(i.a).mul(e.a.oneMinus())).div(t),t)}).setLayout({name:"blendColor",type:"vec4",inputs:[{name:"base",type:"vec4"},{name:"blend",type:"vec4"}]}),GCe=me(([i])=>EV(i.rgb)),qCe=me(([i,e=oe(1)])=>e.mix(EV(i.rgb),i.rgb).max(0)),HCe=me(([i,e=oe(0)])=>{let t=Ps(i.r,i.g,i.b).div(3),n=i.r.max(i.g.max(i.b)),r=n.sub(t).mul(e).mul(-3);return Qn(i.rgb,n,r).max(0)}),WCe=me(([i,e=oe(1)])=>{let t=pe(.57735,.57735,.57735),n=e.cos();return pe(i.rgb.mul(n).add(t.cross(i.rgb).mul(e.sin()).add(t.mul(ru(t,i.rgb).mul(n.oneMinus()))))).max(0)}),EV=(i,e=pe(ln.getLuminanceCoefficients(new re)))=>ru(i,e),jCe=me(([i,e=pe(1),t=pe(0),n=pe(1),r=oe(1),s=pe(ln.getLuminanceCoefficients(new re,t0))])=>{let o=i.rgb.dot(pe(s)),a=zr(i.rgb.mul(e).add(t),0),l=a.pow(n);return $t(a.r.greaterThan(0),()=>{a.r.assign(l.r)}),$t(a.g.greaterThan(0),()=>{a.g.assign(l.g)}),$t(a.b.greaterThan(0),()=>{a.b.assign(l.b)}),a.assign(o.add(a.sub(o).mul(r)).max(0)),Ft(a.rgb,i.a)}),XCe=me(([i,e])=>i.mul(e).floor().div(e)),PR=null,Tk=class extends mx{static get type(){return"ViewportSharedTextureNode"}constructor(e=ju,t=null){PR===null&&(PR=new WA),super(e,t,PR)}getTextureForReference(){return PR}updateReference(){return this}},$Ce=$n(Tk).setParameterLength(0,2),IR=new Oe,B4=class extends su{static get type(){return"PassTextureNode"}constructor(e,t){super(t),this.passNode=e,this.isPassTextureNode=!0,this.setUpdateMatrix(!1)}setup(e){let t=e.getNodeProperties(this);return t.passNode=this.passNode,super.setup(e)}clone(){return new this.constructor(this.passNode,this.value)}},O4=class extends B4{static get type(){return"PassMultipleTextureNode"}constructor(e,t,n=!1){super(e,null),this.textureName=t,this.previousTexture=n,this.isPassMultipleTextureNode=!0}updateTexture(){this.value=this.previousTexture?this.passNode.getPreviousTexture(this.textureName):this.passNode.getTexture(this.textureName)}setup(e){return this.updateTexture(),super.setup(e)}clone(){let e=new this.constructor(this.passNode,this.textureName,this.previousTexture);return e.uvNode=this.uvNode,e.levelNode=this.levelNode,e.biasNode=this.biasNode,e.sampler=this.sampler,e.depthNode=this.depthNode,e.compareNode=this.compareNode,e.gradNode=this.gradNode,e.gatherNode=this.gatherNode,e.offsetNode=this.offsetNode,e}},Ef=class i extends Rr{static get type(){return"PassNode"}constructor(e,t,n,r={}){super("vec4"),this.scope=e,this.scene=t,this.camera=n,this.options=r,this._width=1,this._height=1;let s=new Ba(this._width,this._height,{type:Wi,...r});s.texture.name="output";let o=null;(this.scope===i.DEPTH||r.depthBuffer!==!1)&&(o=new Es,o.isRenderTargetTexture=!0,o.name="depth",s.depthTexture=o),this.renderTarget=s,this.overrideMaterial=null,this.transparent=!0,this.opaque=!0,this.contextNode=null,this._contextNodeCache=null,this._textures={output:s.texture},o!==null&&(this._textures.depth=o),this._textureNodes={},this._linearDepthNodes={},this._viewZNodes={},this._previousTextures={},this._previousTextureNodes={},this._cameraNear=Xt(0),this._cameraFar=Xt(0),this._mrt=null,this._layers=null,this._resolutionScale=1,this._viewport=null,this._scissor=null,this.isPassNode=!0,this.updateBeforeType=yn.FRAME,this.global=!0}setResolutionScale(e){return this._resolutionScale=e,this}getResolutionScale(){return this._resolutionScale}setResolution(e){return Xe("PassNode: .setResolution() is deprecated. Use .setResolutionScale() instead."),this.setResolutionScale(e)}getResolution(){return Xe("PassNode: .getResolution() is deprecated. Use .getResolutionScale() instead."),this.getResolutionScale()}setLayers(e){return this._layers=e,this}getLayers(){return this._layers}setMRT(e){return this._mrt=e,this}getMRT(){return this._mrt}getTexture(e){let t=this._textures[e];if(t===void 0){if(e==="depth")throw new Error("THREE.PassNode: Depth texture is not available for this pass.");t=this.renderTarget.texture.clone(),t.name=e,this._textures[e]=t,this.renderTarget.textures.push(t)}return t}getPreviousTexture(e){let t=this._previousTextures[e];return t===void 0&&(t=this.getTexture(e).clone(),this._previousTextures[e]=t),t}toggleTexture(e){let t=this._previousTextures[e];if(t!==void 0){let n=this._textures[e],r=this.renderTarget.textures.indexOf(n);this.renderTarget.textures[r]=t,this._textures[e]=t,this._previousTextures[e]=n,this._textureNodes[e].updateTexture(),this._previousTextureNodes[e].updateTexture()}}getTextureNode(e="output"){let t=this._textureNodes[e];return t===void 0&&(t=new O4(this,e),t.updateTexture(),this._textureNodes[e]=t),t}getPreviousTextureNode(e="output"){let t=this._previousTextureNodes[e];return t===void 0&&(this._textureNodes[e]===void 0&&this.getTextureNode(e),t=new O4(this,e,!0),t.updateTexture(),this._previousTextureNodes[e]=t),t}getViewZNode(e="depth"){let t=this._viewZNodes[e];if(t===void 0){let n=this._cameraNear,r=this._cameraFar;this._viewZNodes[e]=t=DP(this.getTextureNode(e),n,r)}return t}getLinearDepthNode(e="depth"){let t=this._linearDepthNodes[e];if(t===void 0){let n=this._cameraNear,r=this._cameraFar,s=this.getViewZNode(e);this._linearDepthNodes[e]=t=Yg(s,n,r)}return t}async compileAsync(e){let t=e.getRenderTarget(),n=e.getMRT();e.setRenderTarget(this.renderTarget),e.setMRT(this._mrt),await e.compileAsync(this.scene,this.camera),e.setRenderTarget(t),e.setMRT(n)}setup({renderer:e}){return this.renderTarget.samples=this.options.samples===void 0?e.samples:this.options.samples,this.renderTarget.texture.type=e.getOutputBufferType(),e.reversedDepthBuffer===!0&&this.renderTarget.depthTexture!==null&&(this.renderTarget.depthTexture.type=cr),this.scope===i.COLOR?this.getTextureNode():this.getLinearDepthNode()}updateBefore(e){let{renderer:t}=e,{scene:n}=this,r,s=t.getOutputRenderTarget();s&&s.isXRRenderTarget===!0?(r=t.xr.getCamera(),t.xr.updateCamera(r),IR.set(s.width,s.height)):(r=this.camera,t.getDrawingBufferSize(IR)),this.setSize(IR.width,IR.height);let o=t.getRenderTarget(),a=t.getMRT(),l=t.autoClear,c=t.transparent,u=t.opaque,f=r.layers.mask,d=t.contextNode,A=n.overrideMaterial;this._cameraNear.value=r.near,this._cameraFar.value=r.far,this._layers!==null&&(r.layers.mask=this._layers.mask);for(let w in this._previousTextures)this.toggleTexture(w);this.overrideMaterial!==null&&(n.overrideMaterial=this.overrideMaterial),t.setRenderTarget(this.renderTarget),t.setMRT(this._mrt),t.autoClear=!0,t.transparent=this.transparent,t.opaque=this.opaque,this.contextNode!==null&&((this._contextNodeCache===null||this._contextNodeCache.version!==this.version)&&(this._contextNodeCache={version:this.version,context:ep({...t.contextNode.getFlowContextData(),...this.contextNode.getFlowContextData()})}),t.contextNode=this._contextNodeCache.context);let y=n.name;n.name=this.name?this.name:n.name,t.render(n,r),n.name=y,n.overrideMaterial=A,t.setRenderTarget(o),t.setMRT(a),t.autoClear=l,t.transparent=c,t.opaque=u,t.contextNode=d,r.layers.mask=f}setSize(e,t){this._width=e,this._height=t;let n=Math.floor(this._width*this._resolutionScale),r=Math.floor(this._height*this._resolutionScale);this.renderTarget.setSize(n,r),this._scissor!==null?(this.renderTarget.scissor.copy(this._scissor).multiplyScalar(this._resolutionScale).floor(),this.renderTarget.scissorTest=!0):this.renderTarget.scissorTest=!1,this._viewport!==null&&this.renderTarget.viewport.copy(this._viewport).multiplyScalar(this._resolutionScale).floor()}setScissor(e,t,n,r){e===null?this._scissor=null:(this._scissor===null&&(this._scissor=new xn),e.isVector4?this._scissor.copy(e):this._scissor.set(e,t,n,r))}setViewport(e,t,n,r){e===null?this._viewport=null:(this._viewport===null&&(this._viewport=new xn),e.isVector4?this._viewport.copy(e):this._viewport.set(e,t,n,r))}dispose(){this.renderTarget.dispose()}};Ef.COLOR="color";Ef.DEPTH="depth";var YCe=(i,e,t)=>new Ef(Ef.COLOR,i,e,t),ZCe=(i,e)=>new B4(i,e),KCe=(i,e,t)=>new Ef(Ef.DEPTH,i,e,t),Ek=class extends Ef{static get type(){return"ToonOutlinePassNode"}constructor(e,t,n,r,s){super(Ef.COLOR,e,t),this.colorNode=n,this.thicknessNode=r,this.alphaNode=s,this._materialCache=new WeakMap,this.name="Outline Pass"}updateBefore(e){let{renderer:t}=e,n=t.getRenderObjectFunction();t.setRenderObjectFunction((r,s,o,a,l,c,u,f)=>{if((l.isMeshToonMaterial||l.isMeshToonNodeMaterial)&&l.wireframe===!1){let d=this._getOutlineMaterial(l);t.renderObject(r,s,o,a,d,c,u,f)}t.renderObject(r,s,o,a,l,c,u,f)}),super.updateBefore(e),t.setRenderObjectFunction(n)}_createMaterial(){let e=new Pr;e.isMeshToonOutlineMaterial=!0,e.name="Toon_Outline",e.side=mi;let t=wa.negate(),n=Ja.mul(bf),r=oe(1),s=n.mul(Ft(Mr,1)),o=n.mul(Ft(Mr.add(t),1)),a=ya(s.sub(o));return e.vertexNode=s.add(a.mul(this.thicknessNode).mul(s.w).mul(r)),e.colorNode=Ft(this.colorNode,this.alphaNode),e}_getOutlineMaterial(e){let t=this._materialCache.get(e);return t===void 0&&(t=this._createMaterial(),this._materialCache.set(e,t)),t}},QCe=(i,e,t=new zt(0,0,0),n=.003,r=1)=>new Ek(i,e,Ht(t),Ht(n),Ht(r)),Bse=me(([i,e])=>i.mul(e).clamp()).setLayout({name:"linearToneMapping",type:"vec3",inputs:[{name:"color",type:"vec3"},{name:"exposure",type:"float"}]}),Ose=me(([i,e])=>(i=i.mul(e),i.div(i.add(1)).clamp())).setLayout({name:"reinhardToneMapping",type:"vec3",inputs:[{name:"color",type:"vec3"},{name:"exposure",type:"float"}]}),Use=me(([i,e])=>{i=i.mul(e),i=i.sub(.004).max(0);let t=i.mul(i.mul(6.2).add(.5)),n=i.mul(i.mul(6.2).add(1.7)).add(.06);return t.div(n).pow(2.2)}).setLayout({name:"cineonToneMapping",type:"vec3",inputs:[{name:"color",type:"vec3"},{name:"exposure",type:"float"}]}),JCe=me(([i])=>{let e=i.mul(i.add(.0245786)).sub(90537e-9),t=i.mul(i.add(.432951).mul(.983729)).add(.238081);return e.div(t)}),kse=me(([i,e])=>{let t=To(.59719,.35458,.04823,.076,.90834,.01566,.0284,.13383,.83777),n=To(1.60475,-.53108,-.07367,-.10208,1.10813,-.00605,-.00327,-.07276,1.07602);return i=i.mul(e).div(.6),i=t.mul(i),i=JCe(i),i=n.mul(i),i.clamp()}).setLayout({name:"acesFilmicToneMapping",type:"vec3",inputs:[{name:"color",type:"vec3"},{name:"exposure",type:"float"}]}),eRe=To(pe(1.6605,-.1246,-.0182),pe(-.5876,1.1329,-.1006),pe(-.0728,-.0083,1.1187)),tRe=To(pe(.6274,.0691,.0164),pe(.3293,.9195,.088),pe(.0433,.0113,.8956)),nRe=me(([i])=>{let e=pe(i).toVar(),t=pe(e.mul(e)).toVar(),n=pe(t.mul(t)).toVar();return oe(15.5).mul(n.mul(t)).sub(Tn(40.14,n.mul(e))).add(Tn(31.96,n).sub(Tn(6.868,t.mul(e))).add(Tn(.4298,t).add(Tn(.1191,e).sub(.00232))))}),zse=me(([i,e])=>{let t=pe(i).toVar(),n=To(pe(.856627153315983,.137318972929847,.11189821299995),pe(.0951212405381588,.761241990602591,.0767994186031903),pe(.0482516061458583,.101439036467562,.811302368396859)),r=To(pe(1.1271005818144368,-.1413297634984383,-.14132976349843826),pe(-.11060664309660323,1.157823702216272,-.11060664309660294),pe(-.016493938717834573,-.016493938717834257,1.2519364065950405)),s=oe(-12.47393),o=oe(4.026069);return t.mulAssign(e),t.assign(tRe.mul(t)),t.assign(n.mul(t)),t.assign(zr(t,1e-10)),t.assign(Af(t)),t.assign(t.sub(s).div(o.sub(s))),t.assign(Yu(t,0,1)),t.assign(nRe(t)),t.assign(r.mul(t)),t.assign(eu(zr(pe(0),t),pe(2.2))),t.assign(eRe.mul(t)),t.assign(Yu(t,0,1)),t}).setLayout({name:"agxToneMapping",type:"vec3",inputs:[{name:"color",type:"vec3"},{name:"exposure",type:"float"}]}),Vse=me(([i,e])=>{let t=oe(.76),n=oe(.15);i=i.mul(e);let r=Pl(i.r,Pl(i.g,i.b)),s=xa(r.lessThan(.08),r.sub(Tn(6.25,r.mul(r))),.04);i.subAssign(s);let o=zr(i.r,zr(i.g,i.b));$t(o.lessThan(t),()=>i);let a=ai(1,t),l=ai(1,a.mul(a).div(o.add(a.sub(t))));i.mulAssign(l.div(o));let c=ai(1,pc(1,n.mul(o.sub(l)).add(1)));return Qn(i,pe(l),c)}).setLayout({name:"neutralToneMapping",type:"vec3",inputs:[{name:"color",type:"vec3"},{name:"exposure",type:"float"}]}),hr=class extends Kt{static get type(){return"CodeNode"}constructor(e="",t=[],n=""){super("code"),this.isCodeNode=!0,this.global=!0,this.code=e,this.includes=t,this.language=n}setIncludes(e){return this.includes=e,this}getIncludes(){return this.includes}generate(e){let t=this.getIncludes(e);for(let r of t)r.build(e);let n=e.getCodeFromNode(this,this.getNodeType(e));return n.code=this.code,n.code}serialize(e){super.serialize(e),e.code=this.code,e.language=this.language}deserialize(e){super.deserialize(e),this.code=e.code,this.language=e.language}},UP=$n(hr).setParameterLength(1,3),iRe=(i,e)=>UP(i,e,"js"),rRe=(i,e)=>UP(i,e,"wgsl"),sRe=(i,e)=>UP(i,e,"glsl"),U4=class extends hr{static get type(){return"FunctionNode"}constructor(e="",t=[],n=""){super(e,t,n)}generateNodeType(e){return this.getNodeFunction(e).type}getMemberType(e,t){let n=this.getNodeType(e);return e.getStructTypeNode(n).getMemberType(e,t)}getInputs(e){return this.getNodeFunction(e).inputs}getNodeFunction(e){let t=e.getDataFromNode(this),n=t.nodeFunction;return n===void 0&&(n=e.parser.parseFunction(this.code),t.nodeFunction=n),n}generate(e,t){super.generate(e);let n=this.getNodeFunction(e),r=n.name,s=n.type,o=e.getCodeFromNode(this,s);r!==""&&(o.name=r);let a=e.getPropertyName(o),l=this.getNodeFunction(e).getCode(a);return o.code=l+`4159+`,t==="property"?a:e.format(`${a}()`,s,t)}},Gse=(i,e=[],t="")=>{let n=new U4(i,e,t);return dz((...s)=>n.call(...s),n)},oRe=(i,e)=>Gse(i,e,"glsl"),aRe=(i,e)=>Gse(i,e,"wgsl");function MV(i){let e,t=i.context.getViewZ;return t!==void 0&&(e=t(this)),(e||xs.z).negate()}var qse=me(([i,e],t)=>{let n=MV(t);return mc(i,e,n)}),Hse=me(([i],e)=>{let t=MV(e);return i.mul(i,t,t).negate().exp().oneMinus()}),lRe=me(([i,e],t)=>{let n=MV(t),s=e.sub(_f.y).max(0).toConst().mul(n).toConst();return i.mul(i,s,s).negate().exp().oneMinus()}),Mk=me(([i,e])=>Ft(e.toFloat().mix(ox.rgb,i.toVec3()),ox.a)),Ng=null,Fg=null,Ck=class extends Kt{static get type(){return"RangeNode"}constructor(e=oe(),t=oe()){super(),this.minNode=e,this.maxNode=t}getVectorLength(e){let t=this.getConstNode(this.minNode),n=this.getConstNode(this.maxNode),r=e.getTypeLength(fm(t.value)),s=e.getTypeLength(fm(n.value));return r>s?r:s}generateNodeType(e){return e.object.count>1?e.getTypeFromLength(this.getVectorLength(e)):"float"}getConstNode(e){let t=null;if(e.traverse(n=>{n.isConstNode===!0&&(t=n)}),t===null)throw new A4('THREE.TSL: No "ConstNode" found in node graph.',this.stackTrace);return t}setup(e){let t=e.object,n=null;if(t.count>1){let r=this.getConstNode(this.minNode),s=this.getConstNode(this.maxNode),o=r.value,a=s.value,l=e.getTypeLength(fm(o)),c=e.getTypeLength(fm(a));Ng=Ng||new xn,Fg=Fg||new xn,Ng.setScalar(0),Fg.setScalar(0),l===1?Ng.setScalar(o):o.isColor?Ng.set(o.r,o.g,o.b,1):Ng.set(o.x,o.y,o.z||0,o.w||0),c===1?Fg.setScalar(a):a.isColor?Fg.set(a.r,a.g,a.b,1):Fg.set(a.x,a.y,a.z||0,a.w||0);let u=4,f=u*t.count,d=new Float32Array(f);for(let w=0;w<f;w++){let S=w%u,T=Ng.getComponent(S),R=Fg.getComponent(S);d[w]=Bu.lerp(T,R,Math.random())}let A=this.getNodeType(e);if(t.count*4*4<=e.getUniformBufferLimit())n=bx(d,"vec4",t.count).element(Xu).convert(A);else{let w=new Ql(d,4);e.geometry.setAttribute("__range"+this.id,w),n=CP(w).convert(A)}}else n=oe(0);return n}},cRe=$n(Ck).setParameterLength(2),Rk=class extends Kt{static get type(){return"ComputeBuiltinNode"}constructor(e,t){super(t),this._builtinName=e}getHash(e){return this.getBuiltinName(e)}generateNodeType(){return this.nodeType}setBuiltinName(e){return this._builtinName=e,this}getBuiltinName(){return this._builtinName}hasBuiltin(e){return e.hasBuiltin(this._builtinName)}generate(e,t){let n=this.getBuiltinName(e),r=this.getNodeType(e);return e.shaderStage==="compute"?e.format(n,r,t):(Xe(`ComputeBuiltinNode: Compute built-in value ${n} can not be accessed in the ${e.shaderStage} stage`),e.generateConst(r))}serialize(e){super.serialize(e),e.global=this.global,e._builtinName=this._builtinName}deserialize(e){super.deserialize(e),this.global=e.global,this._builtinName=e._builtinName}},BS=(i,e)=>new Rk(i,e),uRe=BS("numWorkgroups","uvec3"),hRe=BS("workgroupId","uvec3"),fRe=BS("globalId","uvec3"),dRe=BS("localId","uvec3"),pRe=BS("subgroupSize","uint"),Pk=class extends Kt{constructor(e){super(),this.scope=e,this.isBarrierNode=!0}setup(e){e.allowEarlyReturns=!1,e.allowGlobalVariables=!1}generate(e){let{scope:t}=this,{renderer:n}=e;n.backend.isWebGLBackend===!0?e.addFlowCode(` // ${t}Barrier 4160+`):e.addLineFlowCode(`${t}Barrier()`,this)}},CV=$n(Pk),mRe=()=>CV("workgroup").toStack(),ARe=()=>CV("storage").toStack(),gRe=()=>CV("texture").toStack(),Ik=class extends Zd{constructor(e,t){super(e,t),this.isWorkgroupInfoElementNode=!0}generate(e,t){let n,r=e.isContextAssign();if(n=super.generate(e),r!==!0){let s=this.getNodeType(e);n=e.format(n,s,t)}return n}},Lk=class extends Kt{constructor(e,t,n=0){super(t),this.bufferType=t,this.bufferCount=n,this.isWorkgroupInfoNode=!0,this.elementType=t,this.scope=e,this.name=""}setName(e){return this.name=e,this}label(e){return Xe('TSL: "label()" has been deprecated. Use "setName()" instead.',new ts),this.setName(e)}setScope(e){return this.scope=e,this}getElementType(){return this.elementType}getInputType(){return`${this.scope}Array`}element(e){return new Ik(this,e)}generate(e){let t=this.name!==""?this.name:`${this.scope}Array_${this.id}`;return e.getScopedArray(t,this.scope.toLowerCase(),this.bufferType,this.bufferCount)}},vRe=(i,e)=>new Lk("Workgroup",i,e),Ls=class extends Kt{static get type(){return"AtomicFunctionNode"}constructor(e,t,n){super("uint"),this.method=e,this.pointerNode=t,this.valueNode=n,this.parents=!0}getInputType(e){return this.pointerNode.getNodeType(e)}generateNodeType(e){return this.getInputType(e)}generate(e){let t=e.getNodeProperties(this),n=t.parents,r=this.method,s=this.getNodeType(e),o=this.getInputType(e),a=this.pointerNode,l=this.valueNode,c=[];c.push(`&${a.build(e,o)}`),l!==null&&c.push(l.build(e,o));let u=`${e.getMethod(r,s)}( ${c.join(", ")} )`;if(n?n.length===1&&n[0].isStackNode===!0:!1)e.addLineFlowCode(u,this);else return t.constNode===void 0&&(t.constNode=hc(u,s).toConst()),t.constNode.build(e)}};Ls.ATOMIC_LOAD="atomicLoad";Ls.ATOMIC_STORE="atomicStore";Ls.ATOMIC_ADD="atomicAdd";Ls.ATOMIC_SUB="atomicSub";Ls.ATOMIC_MAX="atomicMax";Ls.ATOMIC_MIN="atomicMin";Ls.ATOMIC_AND="atomicAnd";Ls.ATOMIC_OR="atomicOr";Ls.ATOMIC_XOR="atomicXor";var _Re=$n(Ls),Cf=(i,e,t)=>_Re(i,e,t).toStack(),xRe=i=>Cf(Ls.ATOMIC_LOAD,i,null),yRe=(i,e)=>Cf(Ls.ATOMIC_STORE,i,e),bRe=(i,e)=>Cf(Ls.ATOMIC_ADD,i,e),wRe=(i,e)=>Cf(Ls.ATOMIC_SUB,i,e),SRe=(i,e)=>Cf(Ls.ATOMIC_MAX,i,e),TRe=(i,e)=>Cf(Ls.ATOMIC_MIN,i,e),ERe=(i,e)=>Cf(Ls.ATOMIC_AND,i,e),MRe=(i,e)=>Cf(Ls.ATOMIC_OR,i,e),CRe=(i,e)=>Cf(Ls.ATOMIC_XOR,i,e),Ot=class i extends Rr{static get type(){return"SubgroupFunctionNode"}constructor(e,t=null,n=null){super(),this.method=e,this.aNode=t,this.bNode=n}getInputType(e){let t=this.aNode?this.aNode.getNodeType(e):null,n=this.bNode?this.bNode.getNodeType(e):null,r=e.isMatrix(t)?0:e.getTypeLength(t),s=e.isMatrix(n)?0:e.getTypeLength(n);return r>s?t:n}generateNodeType(e){let t=this.method;return t===i.SUBGROUP_ELECT?"bool":t===i.SUBGROUP_BALLOT?"uvec4":this.getInputType(e)}generate(e,t){let n=this.method,r=this.getNodeType(e),s=this.getInputType(e),o=this.aNode,a=this.bNode,l=[];if(n===i.SUBGROUP_BROADCAST||n===i.SUBGROUP_SHUFFLE||n===i.QUAD_BROADCAST){let u=a.getNodeType(e);l.push(o.build(e,r),a.build(e,u==="float"?"int":r))}else n===i.SUBGROUP_SHUFFLE_XOR||n===i.SUBGROUP_SHUFFLE_DOWN||n===i.SUBGROUP_SHUFFLE_UP?l.push(o.build(e,r),a.build(e,"uint")):(o!==null&&l.push(o.build(e,s)),a!==null&&l.push(a.build(e,s)));let c=l.length===0?"()":`( ${l.join(", ")} )`;return e.format(`${e.getMethod(n,r)}${c}`,r,t)}serialize(e){super.serialize(e),e.method=this.method}deserialize(e){super.deserialize(e),this.method=e.method}};Ot.SUBGROUP_ELECT="subgroupElect";Ot.SUBGROUP_BALLOT="subgroupBallot";Ot.SUBGROUP_ADD="subgroupAdd";Ot.SUBGROUP_INCLUSIVE_ADD="subgroupInclusiveAdd";Ot.SUBGROUP_EXCLUSIVE_AND="subgroupExclusiveAdd";Ot.SUBGROUP_MUL="subgroupMul";Ot.SUBGROUP_INCLUSIVE_MUL="subgroupInclusiveMul";Ot.SUBGROUP_EXCLUSIVE_MUL="subgroupExclusiveMul";Ot.SUBGROUP_AND="subgroupAnd";Ot.SUBGROUP_OR="subgroupOr";Ot.SUBGROUP_XOR="subgroupXor";Ot.SUBGROUP_MIN="subgroupMin";Ot.SUBGROUP_MAX="subgroupMax";Ot.SUBGROUP_ALL="subgroupAll";Ot.SUBGROUP_ANY="subgroupAny";Ot.SUBGROUP_BROADCAST_FIRST="subgroupBroadcastFirst";Ot.QUAD_SWAP_X="quadSwapX";Ot.QUAD_SWAP_Y="quadSwapY";Ot.QUAD_SWAP_DIAGONAL="quadSwapDiagonal";Ot.SUBGROUP_BROADCAST="subgroupBroadcast";Ot.SUBGROUP_SHUFFLE="subgroupShuffle";Ot.SUBGROUP_SHUFFLE_XOR="subgroupShuffleXor";Ot.SUBGROUP_SHUFFLE_UP="subgroupShuffleUp";Ot.SUBGROUP_SHUFFLE_DOWN="subgroupShuffleDown";Ot.QUAD_BROADCAST="quadBroadcast";var RRe=ct(Ot,Ot.SUBGROUP_ELECT).setParameterLength(0),PRe=ct(Ot,Ot.SUBGROUP_BALLOT).setParameterLength(1),IRe=ct(Ot,Ot.SUBGROUP_ADD).setParameterLength(1),LRe=ct(Ot,Ot.SUBGROUP_INCLUSIVE_ADD).setParameterLength(1),DRe=ct(Ot,Ot.SUBGROUP_EXCLUSIVE_AND).setParameterLength(1),NRe=ct(Ot,Ot.SUBGROUP_MUL).setParameterLength(1),FRe=ct(Ot,Ot.SUBGROUP_INCLUSIVE_MUL).setParameterLength(1),BRe=ct(Ot,Ot.SUBGROUP_EXCLUSIVE_MUL).setParameterLength(1),ORe=ct(Ot,Ot.SUBGROUP_AND).setParameterLength(1),URe=ct(Ot,Ot.SUBGROUP_OR).setParameterLength(1),kRe=ct(Ot,Ot.SUBGROUP_XOR).setParameterLength(1),zRe=ct(Ot,Ot.SUBGROUP_MIN).setParameterLength(1),VRe=ct(Ot,Ot.SUBGROUP_MAX).setParameterLength(1),GRe=ct(Ot,Ot.SUBGROUP_ALL).setParameterLength(0),qRe=ct(Ot,Ot.SUBGROUP_ANY).setParameterLength(0),HRe=ct(Ot,Ot.SUBGROUP_BROADCAST_FIRST).setParameterLength(2),WRe=ct(Ot,Ot.QUAD_SWAP_X).setParameterLength(1),jRe=ct(Ot,Ot.QUAD_SWAP_Y).setParameterLength(1),XRe=ct(Ot,Ot.QUAD_SWAP_DIAGONAL).setParameterLength(1),$Re=ct(Ot,Ot.SUBGROUP_BROADCAST).setParameterLength(2),YRe=ct(Ot,Ot.SUBGROUP_SHUFFLE).setParameterLength(2),ZRe=ct(Ot,Ot.SUBGROUP_SHUFFLE_XOR).setParameterLength(2),KRe=ct(Ot,Ot.SUBGROUP_SHUFFLE_UP).setParameterLength(2),QRe=ct(Ot,Ot.SUBGROUP_SHUFFLE_DOWN).setParameterLength(2),JRe=ct(Ot,Ot.QUAD_BROADCAST).setParameterLength(1),LR;function kP(i){LR=LR||new WeakMap;let e=LR.get(i);return e===void 0&&LR.set(i,e={}),e}function zP(i){let e=kP(i);return e.shadowMatrix||(e.shadowMatrix=Xt("mat4").setGroup(Jt).onRenderUpdate(t=>((i.castShadow!==!0||t.renderer.shadowMap.enabled===!1)&&(i.shadow.camera.coordinateSystem!==t.camera.coordinateSystem&&(i.shadow.camera.coordinateSystem=t.camera.coordinateSystem,i.shadow.camera.updateProjectionMatrix()),i.shadow.updateMatrices(i)),i.shadow.matrix)))}function Wse(i,e=_f){let t=zP(i).mul(e);return t.xyz.div(t.w)}function RV(i){let e=kP(i);return e.position||(e.position=Xt(new re).setGroup(Jt).onRenderUpdate((t,n)=>n.value.setFromMatrixPosition(i.matrixWorld)))}function jse(i){let e=kP(i);return e.targetPosition||(e.targetPosition=Xt(new re).setGroup(Jt).onRenderUpdate((t,n)=>n.value.setFromMatrixPosition(i.target.matrixWorld)))}function PV(i){let e=kP(i);return e.viewPosition||(e.viewPosition=Xt(new re).setGroup(Jt).onRenderUpdate(({camera:t},n)=>{n.value=n.value||new re,n.value.setFromMatrixPosition(i.matrixWorld),n.value.applyMatrix4(t.matrixWorldInverse)}))}var IV=i=>wm.transformDirection(RV(i).sub(jse(i))),e4e=Jd("vec3","totalDiffuse"),t4e=Jd("vec3","totalSpecular"),n4e=Jd("vec3","outgoingLight"),i4e=i=>i.sort((e,t)=>e.id-t.id),r4e=(i,e)=>{for(let t of e)if(t.isAnalyticLightNode&&t.light.id===i)return t;return null},oU=new WeakMap,Hw=[],SS=class extends Kt{static get type(){return"LightsNode"}constructor(){super("vec3"),this.totalDiffuseNode=e4e,this.totalSpecularNode=t4e,this.outgoingLightNode=n4e,this._lights=[],this.global=!0}customCacheKey(){let e=this._lights;for(let n=0;n<e.length;n++){let r=e[n];if(Hw.push(r.id),Hw.push(r.castShadow?1:0),r.isSpotLight===!0){let s=r.map!==null?r.map.id:-1,o=r.colorNode?r.colorNode.getCacheKey():-1;Hw.push(s,o)}}let t=LS(Hw);return Hw.length=0,t}getHash(e){let t=e.getDataFromNode(this);if(t.lightNodesHash===void 0){let n=this.setupLightsNode(e);t.lightNodes=n;let r=[];for(let s of n)r.push(s.getHash());t.lightNodesHash="lights-"+r.join(",")}return t.lightNodesHash}analyze(e){let t=e.getNodeProperties(this);for(let n of t.nodes)n.build(e);t.outputNode.build(e)}setupLightsNode(e){let t=e.getDataFromNode(this),n=[],r=t.lightNodes||null,s=e.context.materialLightings,o=i4e([...s,...this._lights]),a=e.renderer.library;for(let l of o)if(l.isNode)n.push(l);else{let c=null;if(r!==null&&(c=r4e(l.id,r)),c===null){let u=a.getLightNodeClass(l.constructor);if(u===null){Xe(`LightsNode.setupNodeLights: Light node not found for ${l.constructor.name}`);continue}oU.has(l)===!1&&oU.set(l,new u(l)),c=oU.get(l)}n.push(c)}return n}setupDirectLight(e,t,n){let{lightingModel:r,reflectedLight:s}=e.context;r.direct({...n,lightNode:t,reflectedLight:s},e)}setupDirectRectAreaLight(e,t,n){let{lightingModel:r,reflectedLight:s}=e.context;r.directRectArea({...n,lightNode:t,reflectedLight:s},e)}setupLights(e,t){for(let n of t)n.build(e)}getLightNodes(e){let t=e.getDataFromNode(this);return t.lightNodes===void 0&&(t.lightNodes=this.setupLightsNode(e)),t.lightNodes}setup(e){let t=e.lightsNode;e.lightsNode=this;let n=this.outgoingLightNode,r=e.context,s=r.lightingModel,o=e.getNodeProperties(this);if(s){let{totalDiffuseNode:a,totalSpecularNode:l}=this;r.outgoingLight=n;let c=e.addStack();o.nodes=c.nodes,s.start(e);let{backdrop:u,backdropAlpha:f}=r,{directDiffuse:d,directSpecular:A,indirectDiffuse:y,indirectSpecular:w}=r.reflectedLight,S=d.add(y);u!==null&&(f!==null?S=pe(f.mix(S,u)):S=pe(u)),a.assign(S),l.assign(A.add(w)),n.assign(a.add(l)),s.finish(e),n=n.bypass(e.removeStack())}else o.nodes=[];return e.lightsNode=t,n}setLights(e){return this._lights=e,this}getLights(){return this._lights}get hasLights(){return this._lights.length>0}},s4e=(i=[])=>new SS().setLights(i),Dk=class extends Kt{static get type(){return"ShadowBaseNode"}constructor(e){super(),this.light=e,this.updateBeforeType=yn.RENDER,this.isShadowBaseNode=!0}setupShadowPosition({context:e,material:t}){LV.assign(t.receivedShadowPositionNode||e.shadowPositionWorld||_f)}},LV=Jd("vec3","shadowPositionWorld");function o4e(i,e={}){return e.toneMapping=i.toneMapping,e.toneMappingExposure=i.toneMappingExposure,e.outputColorSpace=i.outputColorSpace,e.renderTarget=i.getRenderTarget(),e.activeCubeFace=i.getActiveCubeFace(),e.activeMipmapLevel=i.getActiveMipmapLevel(),e.renderObjectFunction=i.getRenderObjectFunction(),e.pixelRatio=i.getPixelRatio(),e.mrt=i.getMRT(),e.clearColor=i.getClearColor(e.clearColor||new zt),e.clearAlpha=i.getClearAlpha(),e.autoClear=i.autoClear,e.scissorTest=i.getScissorTest(),e}function a4e(i,e){return e=o4e(i,e),i.setMRT(null),i.setRenderObjectFunction(null),i.setClearColor(0,1),i.autoClear=!0,e}function l4e(i,e){i.toneMapping=e.toneMapping,i.toneMappingExposure=e.toneMappingExposure,i.outputColorSpace=e.outputColorSpace,i.setRenderTarget(e.renderTarget,e.activeCubeFace,e.activeMipmapLevel),i.setRenderObjectFunction(e.renderObjectFunction),i.setPixelRatio(e.pixelRatio),i.setMRT(e.mrt),i.setClearColor(e.clearColor,e.clearAlpha),i.autoClear=e.autoClear,i.setScissorTest(e.scissorTest)}function c4e(i,e={}){return e.background=i.background,e.backgroundNode=i.backgroundNode,e.overrideMaterial=i.overrideMaterial,e}function u4e(i,e){return e=c4e(i,e),i.background=null,i.backgroundNode=null,i.overrideMaterial=null,e}function h4e(i,e){i.background=e.background,i.backgroundNode=e.backgroundNode,i.overrideMaterial=e.overrideMaterial}function f4e(i,e,t){return t=a4e(i,t),t=u4e(e,t),t}function d4e(i,e,t){l4e(i,t),h4e(e,t)}var k4=new WeakMap,Xse=me(({depthTexture:i,shadowCoord:e,depthLayer:t})=>{let n=fi(i,e.xy).setName("t_basic");return i.isArrayTexture&&(n=n.depth(t)),n.compare(e.z)}),$se=me(({depthTexture:i,shadowCoord:e,shadow:t,depthLayer:n})=>{let r=(u,f)=>{let d=fi(i,u);return i.isArrayTexture&&(d=d.depth(n)),d.compare(f)},s=mr("mapSize","vec2",t).setGroup(Jt),o=mr("radius","float",t).setGroup(Jt),a=dt(1).div(s),l=o.mul(a.x),c=SV(u1.xy).mul(6.28318530718);return Ps(r(e.xy.add(Wu(0,5,c).mul(l)),e.z),r(e.xy.add(Wu(1,5,c).mul(l)),e.z),r(e.xy.add(Wu(2,5,c).mul(l)),e.z),r(e.xy.add(Wu(3,5,c).mul(l)),e.z),r(e.xy.add(Wu(4,5,c).mul(l)),e.z)).mul(1/5)}),Yse=me(({depthTexture:i,shadowCoord:e,shadow:t,depthLayer:n})=>{let r=mr("mapSize","vec2",t).setGroup(Jt),s=dt(1).div(r),o=e.xy,a=$u(o.mul(r).add(.5)).toConst();o.subAssign(a.sub(.5).mul(s));let l=A=>{let y=fi(i,o).offset(A).gather();return i.isArrayTexture&&(y=y.depth(n)),y.compare(e.z)},c=l(kr(-1,1)).toConst(),u=l(kr(1,1)).toConst(),f=l(kr(-1,-1)).toConst(),d=l(kr(1,-1)).toConst();return Ps(Qn(c.x,u.y,a.x).add(c.y).add(u.x).mul(a.y),Qn(c.w,u.z,a.x).add(c.z).add(u.w),Qn(f.x,d.y,a.x).add(f.y).add(d.x),Qn(f.w,d.z,a.x).add(f.z).add(d.w).mul(a.y.oneMinus())).mul(1/9)}),Zse=me(({depthTexture:i,shadowCoord:e,depthLayer:t},n)=>{let r=fi(i).sample(e.xy);i.isArrayTexture&&(r=r.depth(t)),r=r.rg;let s=r.x,o=zr(1e-7,r.y.mul(r.y)),a=n.renderer.reversedDepthBuffer?Jg(s,e.z):Jg(e.z,s),l=oe(1).toVar();return $t(a.notEqual(1),()=>{let c=e.z.sub(s),u=o.div(o.add(c.mul(c)));u=Yu(ai(u,.3).div(.65)),l.assign(zr(a,u))}),l}),Kse=i=>{let e=k4.get(i);return e===void 0&&(e=new Pr,e.colorNode=Ft(0,0,0,1),e.isShadowPassMaterial=!0,e.name="ShadowMaterial",e.blending=ps,e.fog=!1,k4.set(i,e)),e},Qse=i=>{let e=k4.get(i);e!==void 0&&(e.dispose(),k4.delete(i))},Mte=new Sf,H_=[],Jse=(i,e,t,n)=>{H_[0]=i,H_[1]=e;let r=Mte.get(H_);return(r===void 0||r.shadowType!==t||r.useVelocity!==n)&&(r=(s,o,a,l,c,u,f,d,A)=>{(s.castShadow===!0||s.receiveShadow&&t===Vc)&&(n&&(ane(s).useVelocity=!0),s.onBeforeShadow(i,s,a,e.camera,l,o.overrideMaterial,u),i.renderObject(s,o,a,l,c,u,f,d,A),s.onAfterShadow(i,s,a,e.camera,l,o.overrideMaterial,u))},r.shadowType=t,r.useVelocity=n,Mte.set(H_,r)),H_[0]=null,H_[1]=null,r},p4e=me(({samples:i,radius:e,size:t,shadowPass:n,depthLayer:r})=>{let s=oe(0).toVar("meanVertical"),o=oe(0).toVar("squareMeanVertical"),a=i.lessThanEqual(oe(1)).select(oe(0),oe(2).div(i.sub(1))),l=i.lessThanEqual(oe(1)).select(oe(0),oe(-1));Oi({start:de(0),end:de(i),type:"int",condition:"<"},({i:u})=>{let f=l.add(oe(u).mul(a)),d=n.sample(Ps(u1.xy,dt(0,f).mul(e)).div(t));n.value.isArrayTexture&&(d=d.depth(r)),d=d.x,s.addAssign(d),o.addAssign(d.mul(d))}),s.divAssign(i),o.divAssign(i);let c=el(o.sub(s.mul(s)).max(0));return dt(s,c)}),m4e=me(({samples:i,radius:e,size:t,shadowPass:n,depthLayer:r})=>{let s=oe(0).toVar("meanHorizontal"),o=oe(0).toVar("squareMeanHorizontal"),a=i.lessThanEqual(oe(1)).select(oe(0),oe(2).div(i.sub(1))),l=i.lessThanEqual(oe(1)).select(oe(0),oe(-1));Oi({start:de(0),end:de(i),type:"int",condition:"<"},({i:u})=>{let f=l.add(oe(u).mul(a)),d=n.sample(Ps(u1.xy,dt(f,0).mul(e)).div(t));n.value.isArrayTexture&&(d=d.depth(r)),s.addAssign(d.x),o.addAssign(Ps(d.y.mul(d.y),d.x.mul(d.x)))}),s.divAssign(i),o.divAssign(i);let c=el(o.sub(s.mul(s)).max(0));return dt(s,c)}),A4e=[Xse,$se,Yse,Zse],aU,DR=new wS,z4=class extends Dk{static get type(){return"ShadowNode"}constructor(e,t=null){super(e),this.shadow=t||e.shadow,this.shadowMap=null,this.vsmShadowMapVertical=null,this.vsmShadowMapHorizontal=null,this.vsmMaterialVertical=null,this.vsmMaterialHorizontal=null,this._node=null,this._currentShadowType=null,this._cameraFrameId=new WeakMap,this.isShadowNode=!0,this.depthLayer=0}setupShadowFilter(e,{filterFn:t,depthTexture:n,shadowCoord:r,shadow:s,depthLayer:o}){let a=r.x.greaterThanEqual(0).and(r.x.lessThanEqual(1)).and(r.y.greaterThanEqual(0)).and(r.y.lessThanEqual(1)).and(r.z.lessThanEqual(1)),l=t({depthTexture:n,shadowCoord:r,shadow:s,depthLayer:o});return a.select(l,oe(1))}setupShadowCoord(e,t){let{shadow:n}=this,{renderer:r}=e,s=n.biasNode||mr("bias","float",n).setGroup(Jt),o=t,a;if(n.camera.isOrthographicCamera||r.logarithmicDepthBuffer!==!0)o=o.xyz.div(o.w),a=o.z;else{let l=o.w;o=o.xy.div(l);let c=mr("near","float",n.camera).setGroup(Jt),u=mr("far","float",n.camera).setGroup(Jt);a=NP(l.negate(),c,u)}return o=pe(o.x,o.y.oneMinus(),r.reversedDepthBuffer?a.sub(s):a.add(s)),o}getShadowFilterFn(e){return A4e[e]}setupRenderTarget(e,t){let n=new Es(e.mapSize.width,e.mapSize.height);n.name="ShadowDepthTexture",n.compareFunction=t.renderer.reversedDepthBuffer?Fu:Xh;let r=t.createRenderTarget(e.mapSize.width,e.mapSize.height);return r.texture.name="ShadowMap",r.texture.type=e.mapType,r.depthTexture=n,{shadowMap:r,depthTexture:n}}setupShadow(e){let{renderer:t,camera:n}=e,{light:r,shadow:s}=this,{depthTexture:o,shadowMap:a}=this.setupRenderTarget(s,e),l=t.shadowMap.type,c=t.hasCompatibility(Bd.TEXTURE_COMPARE);if((l===d0||l===DM)&&c?(o.minFilter=Mi,o.magFilter=Mi):(o.minFilter=Ti,o.magFilter=Ti),s.camera.coordinateSystem=n.coordinateSystem,s.camera.updateProjectionMatrix(),l===Vc&&s.isPointLightShadow!==!0){o.compareFunction=null,a.depth>1?(a._vsmShadowMapVertical||(a._vsmShadowMapVertical=e.createRenderTarget(s.mapSize.width,s.mapSize.height,{format:Ws,type:Wi,depth:a.depth,depthBuffer:!1}),a._vsmShadowMapVertical.texture.name="VSMVertical"),this.vsmShadowMapVertical=a._vsmShadowMapVertical,a._vsmShadowMapHorizontal||(a._vsmShadowMapHorizontal=e.createRenderTarget(s.mapSize.width,s.mapSize.height,{format:Ws,type:Wi,depth:a.depth,depthBuffer:!1}),a._vsmShadowMapHorizontal.texture.name="VSMHorizontal"),this.vsmShadowMapHorizontal=a._vsmShadowMapHorizontal):(this.vsmShadowMapVertical=e.createRenderTarget(s.mapSize.width,s.mapSize.height,{format:Ws,type:Wi,depthBuffer:!1}),this.vsmShadowMapHorizontal=e.createRenderTarget(s.mapSize.width,s.mapSize.height,{format:Ws,type:Wi,depthBuffer:!1}));let D=fi(o);o.isArrayTexture&&(D=D.depth(this.depthLayer));let L=fi(this.vsmShadowMapVertical.texture);o.isArrayTexture&&(L=L.depth(this.depthLayer));let C=mr("blurSamples","float",s).setGroup(Jt),B=mr("radius","float",s).setGroup(Jt),k=mr("mapSize","vec2",s).setGroup(Jt),z=this.vsmMaterialVertical||(this.vsmMaterialVertical=new Pr);z.fragmentNode=p4e({samples:C,radius:B,size:k,shadowPass:D,depthLayer:this.depthLayer}).context(e.getSharedContext()),z.name="VSMVertical",z=this.vsmMaterialHorizontal||(this.vsmMaterialHorizontal=new Pr),z.fragmentNode=m4e({samples:C,radius:B,size:k,shadowPass:L,depthLayer:this.depthLayer}).context(e.getSharedContext()),z.name="VSMHorizontal"}let u=mr("intensity","float",s).setGroup(Jt),f=mr("normalBias","float",s).setGroup(Jt),d=zP(r),A=Sm.mul(f),y;!t.highPrecision||e.material.receivedShadowPositionNode||e.context.shadowPositionWorld?y=d.mul(LV.add(A)):y=Xt("mat4").onObjectUpdate(({object:L},C)=>C.value.multiplyMatrices(d.value,L.matrixWorld)).mul(Mr).add(d.mul(Ft(A,0)));let w=this.setupShadowCoord(e,y),S=s.filterNode||this.getShadowFilterFn(t.shadowMap.type)||null;if(S===null)throw new Error("THREE.WebGPURenderer: Shadow map type not supported yet.");let T=l===Vc&&s.isPointLightShadow!==!0?this.vsmShadowMapHorizontal.texture:o,R=this.setupShadowFilter(e,{filterFn:S,shadowTexture:a.texture,depthTexture:T,shadowCoord:w,shadow:s,depthLayer:this.depthLayer}),I;t.shadowMap.transmitted===!0&&(a.texture.isCubeTexture?I=Qa(a.texture,w.xyz):(I=fi(a.texture,w),o.isArrayTexture&&(I=I.depth(this.depthLayer))));let P;I?P=Qn(1,R.rgb.mix(I,1),u.mul(I.a)).toVar():P=Qn(1,R,u).toVar(),this.shadowMap=a,this.shadow.map=a;let F=`${this.light.type} Shadow [ ${this.light.name||"ID: "+this.light.id} ]`;return I&&P.toInspector(`${F} / Color`,()=>this.shadowMap.texture.isCubeTexture?Qa(this.shadowMap.texture,T7()):fi(this.shadowMap.texture)),P.toInspector(`${F} / Depth`,()=>{let D=mr("near","float",this.shadow.camera),L=mr("far","float",this.shadow.camera),C;this.shadowMap.texture.isCubeTexture?C=Qa(this.shadowMap.depthTexture,T7()).r:C=fi(this.shadowMap.depthTexture).r;let B;return this.shadow.camera.isPerspectiveCamera?B=DP(C,D,L):B=nse(C,D,L),B=Yg(B,D,L),B.oneMinus()})}setup(e){if(e.renderer.shadowMap.enabled!==!1)return me(()=>{let t=e.renderer.shadowMap.type;this._currentShadowType!==t&&(this._reset(),this._node=null);let n=this._node;return this.setupShadowPosition(e),n===null&&(this._node=n=this.setupShadow(e),this._currentShadowType=t),e.material.receivedShadowNode&&(n=e.material.receivedShadowNode(n)),n})()}renderShadow(e){let{shadow:t,shadowMap:n,light:r}=this,{renderer:s,scene:o}=e;t.updateMatrices(r),n.setSize(t.mapSize.width,t.mapSize.height,n.depth);let a=o.name;o.name=`Shadow Map [ ${r.name||"ID: "+r.id} ]`,s.render(o,t.camera),o.name=a}updateShadow(e){let{shadowMap:t,light:n,shadow:r}=this,{renderer:s,scene:o,camera:a}=e,l=s.shadowMap.type,c=t.depthTexture.version;this._depthVersionCached=c;let u=r.camera.layers.mask;(r.camera.layers.mask&4294967294)===0&&(r.camera.layers.mask=a.layers.mask);let f=s.getRenderObjectFunction(),d=s.getMRT(),A=d?d.has("velocity"):!1;aU=f4e(s,o,aU),o.overrideMaterial=Kse(n),s.setRenderObjectFunction(Jse(s,r,l,A)),s.setClearColor(0,0),s.setRenderTarget(t),this.renderShadow(e),s.setRenderObjectFunction(f),l===Vc&&r.isPointLightShadow!==!0&&this.vsmPass(s),r.camera.layers.mask=u,d4e(s,o,aU)}vsmPass(e){let{shadow:t}=this,n=this.shadowMap.depth;this.vsmShadowMapVertical.setSize(t.mapSize.width,t.mapSize.height,n),this.vsmShadowMapHorizontal.setSize(t.mapSize.width,t.mapSize.height,n),e.setRenderTarget(this.vsmShadowMapVertical),DR.material=this.vsmMaterialVertical,DR.render(e),e.setRenderTarget(this.vsmShadowMapHorizontal),DR.material=this.vsmMaterialHorizontal,DR.render(e)}dispose(){this._reset(),super.dispose()}_reset(){this._currentShadowType=null,Qse(this.light),this.shadowMap&&(this.shadowMap.dispose(),this.shadowMap=null),this.vsmShadowMapVertical!==null&&(this.vsmShadowMapVertical.dispose(),this.vsmShadowMapVertical=null,this.vsmMaterialVertical.dispose(),this.vsmMaterialVertical=null),this.vsmShadowMapHorizontal!==null&&(this.vsmShadowMapHorizontal.dispose(),this.vsmShadowMapHorizontal=null,this.vsmMaterialHorizontal.dispose(),this.vsmMaterialHorizontal=null)}updateBefore(e){let{shadow:t}=this,n=t.needsUpdate||t.autoUpdate;n&&(this._cameraFrameId[e.camera]===e.frameId&&(n=!1),this._cameraFrameId[e.camera]=e.frameId),n&&(this.updateShadow(e),this.shadowMap.depthTexture.version===this._depthVersionCached&&(t.needsUpdate=!1))}},eoe=(i,e)=>new z4(i,e),g4e=new zt,Cte=new cn,Ww=new re,lU=new re,v4e=[new re(1,0,0),new re(-1,0,0),new re(0,-1,0),new re(0,1,0),new re(0,0,1),new re(0,0,-1)],_4e=[new re(0,-1,0),new re(0,-1,0),new re(0,0,-1),new re(0,0,1),new re(0,-1,0),new re(0,-1,0)],x4e=[new re(1,0,0),new re(-1,0,0),new re(0,1,0),new re(0,-1,0),new re(0,0,1),new re(0,0,-1)],y4e=[new re(0,-1,0),new re(0,-1,0),new re(0,0,1),new re(0,0,-1),new re(0,-1,0),new re(0,-1,0)],toe=me(({depthTexture:i,bd3D:e,dp:t})=>Qa(i,e).compare(t)),noe=me(({depthTexture:i,bd3D:e,dp:t,shadow:n})=>{let r=mr("radius","float",n).setGroup(Jt),s=mr("mapSize","vec2",n).setGroup(Jt),o=r.div(s.x),a=fr(e),l=ya(Kd(e,a.x.greaterThan(a.z).select(pe(0,1,0),pe(1,0,0)))),c=Kd(e,l),u=SV(u1.xy).mul(6.28318530718),f=Wu(0,5,u),d=Wu(1,5,u),A=Wu(2,5,u),y=Wu(3,5,u),w=Wu(4,5,u);return Qa(i,e.add(l.mul(f.x).add(c.mul(f.y)).mul(o))).compare(t).add(Qa(i,e.add(l.mul(d.x).add(c.mul(d.y)).mul(o))).compare(t)).add(Qa(i,e.add(l.mul(A.x).add(c.mul(A.y)).mul(o))).compare(t)).add(Qa(i,e.add(l.mul(y.x).add(c.mul(y.y)).mul(o))).compare(t)).add(Qa(i,e.add(l.mul(w.x).add(c.mul(w.y)).mul(o))).compare(t)).mul(1/5)}),b4e=me(({filterFn:i,depthTexture:e,shadowCoord:t,shadow:n},r)=>{let s=t.xyz.toConst(),o=s.abs().toConst(),a=o.x.max(o.y).max(o.z),l=Xt("float").setGroup(Jt).onRenderUpdate(()=>n.camera.near),c=Xt("float").setGroup(Jt).onRenderUpdate(()=>n.camera.far),u=mr("bias","float",n).setGroup(Jt),f=oe(1).toVar();return $t(a.sub(c).lessThanEqual(0).and(a.sub(l).greaterThanEqual(0)),()=>{let d;r.renderer.reversedDepthBuffer?(d=ise(a.negate(),l,c),d.subAssign(u)):r.renderer.logarithmicDepthBuffer?(d=NP(a.negate(),l,c),d.addAssign(u)):(d=gV(a.negate(),l,c),d.addAssign(u));let A=s.normalize();f.assign(i({depthTexture:e,bd3D:A,dp:d,shadow:n}))}),f}),Nk=class extends z4{static get type(){return"PointShadowNode"}constructor(e,t=null){super(e,t)}getShadowFilterFn(e){return e===Y8?toe:noe}setupShadowCoord(e,t){return t}setupShadowFilter(e,{filterFn:t,depthTexture:n,shadowCoord:r,shadow:s}){return b4e({filterFn:t,depthTexture:n,shadowCoord:r,shadow:s})}setupRenderTarget(e,t){let n=new e_(e.mapSize.width);n.name="PointShadowDepthTexture",n.compareFunction=t.renderer.reversedDepthBuffer?Fu:Xh;let r=t.createCubeRenderTarget(e.mapSize.width);return r.texture.name="PointShadowMap",r.depthTexture=n,{shadowMap:r,depthTexture:n}}renderShadow(e){let{shadow:t,shadowMap:n,light:r}=this,{renderer:s,scene:o}=e,a=t.camera,l=t.matrix,c=s.coordinateSystem===xl,u=c?v4e:x4e,f=c?_4e:y4e;n.setSize(t.mapSize.width,t.mapSize.width);let d=s.autoClear,A=s.getClearColor(g4e),y=s.getClearAlpha();s.autoClear=!1,s.setClearColor(t.clearColor,t.clearAlpha);for(let w=0;w<6;w++){s.setRenderTarget(n,w),s.clear();let S=r.distance||a.far;S!==a.far&&(a.far=S,a.updateProjectionMatrix()),Ww.setFromMatrixPosition(r.matrixWorld),a.position.copy(Ww),lU.copy(a.position),lU.add(u[w]),a.up.copy(f[w]),a.lookAt(lU),a.updateMatrixWorld(),l.makeTranslation(-Ww.x,-Ww.y,-Ww.z),Cte.multiplyMatrices(a.projectionMatrix,a.matrixWorldInverse),t._frustum.setFromProjectionMatrix(Cte,a.coordinateSystem,a.reversedDepth);let T=o.name;o.name=`Point Light Shadow [ ${r.name||"ID: "+r.id} ] - Face ${w+1}`,s.render(o,a),o.name=T}s.autoClear=d,s.setClearColor(A,y)}},ioe=(i,e)=>new Nk(i,e),Qd=class extends _m{static get type(){return"AnalyticLightNode"}constructor(e=null){super(),this.light=e,this.color=new zt,this.colorNode=e&&e.colorNode||Xt(this.color).setGroup(Jt),this.baseColorNode=null,this.shadowNode=null,this.shadowColorNode=null,this.isAnalyticLightNode=!0,this.updateType=yn.FRAME,e&&e.shadow&&(this._shadowDisposeListener=()=>{this.disposeShadow()},e.addEventListener("dispose",this._shadowDisposeListener))}dispose(){this._shadowDisposeListener&&this.light.removeEventListener("dispose",this._shadowDisposeListener),super.dispose()}disposeShadow(){this.shadowNode!==null&&(this.shadowNode.dispose(),this.shadowNode=null),this.shadowColorNode=null,this.baseColorNode!==null&&(this.colorNode=this.baseColorNode,this.baseColorNode=null)}getHash(){return this.light.uuid}getLightVector(e){return PV(this.light).sub(e.context.positionView||xs)}setupDirect(){}setupDirectRectArea(){}setupShadowNode(){return eoe(this.light)}setupShadow(e){let{renderer:t}=e;if(t.shadowMap.enabled===!1)return;let n=this.shadowColorNode;if(n===null){let r=this.light.shadow.shadowNode,s;r!==void 0?s=Ht(r):s=this.setupShadowNode(),this.shadowNode=s,this.shadowColorNode=n=this.colorNode.mul(s),this.baseColorNode=this.colorNode}e.context.getShadow&&(n=e.context.getShadow(this,e)),this.colorNode=n}setup(e){this.colorNode=this.baseColorNode||this.colorNode,this.light.castShadow?e.object.receiveShadow&&this.setupShadow(e):this.shadowNode!==null&&(this.shadowNode.dispose(),this.shadowNode=null,this.shadowColorNode=null);let t=this.setupDirect(e),n=this.setupDirectRectArea(e);t&&e.lightsNode.setupDirectLight(e,this,t),n&&e.lightsNode.setupDirectRectAreaLight(e,this,n)}update(){let{light:e}=this;this.color.copy(e.color).multiplyScalar(e.intensity)}},DV=me(({lightDistance:i,cutoffDistance:e,decayExponent:t})=>{let n=i.pow(t).max(.01).reciprocal();return e.greaterThan(0).select(n.mul(i.div(e).pow4().oneMinus().clamp().pow2()),n)}),roe=({color:i,lightVector:e,cutoffDistance:t,decayExponent:n})=>{let r=e.normalize(),s=e.length(),o=DV({lightDistance:s,cutoffDistance:t,decayExponent:n}),a=i.mul(o);return{lightDirection:r,lightColor:a}},Fk=class extends Qd{static get type(){return"PointLightNode"}constructor(e=null){super(e),this.cutoffDistanceNode=Xt(0).setGroup(Jt),this.decayExponentNode=Xt(2).setGroup(Jt)}update(e){let{light:t}=this;super.update(e),this.cutoffDistanceNode.value=t.distance,this.decayExponentNode.value=t.decay}setupShadowNode(){return ioe(this.light)}setupDirect(e){return roe({color:this.colorNode,lightVector:this.getLightVector(e),cutoffDistance:this.cutoffDistanceNode,decayExponent:this.decayExponentNode})}},w4e=me(([i=Ui()])=>{let e=i.mul(2),t=e.x.floor(),n=e.y.floor();return t.add(n).mod(2).sign()}),S4e=me(([i=Ui()],{renderer:e,material:t})=>{let n=Oz(i.mul(2).sub(1)),r;if(t.alphaToCoverage&&e.currentSamples>0){let s=oe(n.fwidth()).toVar();r=mc(s.oneMinus(),s.add(1),n).oneMinus()}else r=xa(n.greaterThan(1),0,1);return r}),cS=me(([i,e,t])=>{let n=oe(t).toVar(),r=oe(e).toVar(),s=dc(i).toVar();return xa(s,r,n).uniformFlow()}).setLayout({name:"mx_select",type:"float",inputs:[{name:"b",type:"bool"},{name:"t",type:"float"},{name:"f",type:"float"}]}),V4=me(([i,e])=>{let t=dc(e).toVar(),n=oe(i).toVar();return xa(t,n.negate(),n).uniformFlow()}).setLayout({name:"mx_negate_if",type:"float",inputs:[{name:"val",type:"float"},{name:"b",type:"bool"}]}),Rs=me(([i])=>{let e=oe(i).toVar();return de(gf(e))}).setLayout({name:"mx_floor",type:"int",inputs:[{name:"x",type:"float"}]}),Cr=me(([i,e])=>{let t=oe(i).toVar();return e.assign(Rs(t)),t.sub(oe(e))}),T4e=me(([i,e,t,n,r,s])=>{let o=oe(s).toVar(),a=oe(r).toVar(),l=oe(n).toVar(),c=oe(t).toVar(),u=oe(e).toVar(),f=oe(i).toVar(),d=oe(ai(1,a)).toVar();return ai(1,o).mul(f.mul(d).add(u.mul(a))).add(o.mul(c.mul(d).add(l.mul(a))))}).setLayout({name:"mx_bilerp_0",type:"float",inputs:[{name:"v0",type:"float"},{name:"v1",type:"float"},{name:"v2",type:"float"},{name:"v3",type:"float"},{name:"s",type:"float"},{name:"t",type:"float"}]}),E4e=me(([i,e,t,n,r,s])=>{let o=oe(s).toVar(),a=oe(r).toVar(),l=pe(n).toVar(),c=pe(t).toVar(),u=pe(e).toVar(),f=pe(i).toVar(),d=oe(ai(1,a)).toVar();return ai(1,o).mul(f.mul(d).add(u.mul(a))).add(o.mul(c.mul(d).add(l.mul(a))))}).setLayout({name:"mx_bilerp_1",type:"vec3",inputs:[{name:"v0",type:"vec3"},{name:"v1",type:"vec3"},{name:"v2",type:"vec3"},{name:"v3",type:"vec3"},{name:"s",type:"float"},{name:"t",type:"float"}]}),soe=Ko([T4e,E4e]),M4e=me(([i,e,t,n,r,s,o,a,l,c,u])=>{let f=oe(u).toVar(),d=oe(c).toVar(),A=oe(l).toVar(),y=oe(a).toVar(),w=oe(o).toVar(),S=oe(s).toVar(),T=oe(r).toVar(),R=oe(n).toVar(),I=oe(t).toVar(),P=oe(e).toVar(),F=oe(i).toVar(),D=oe(ai(1,A)).toVar(),L=oe(ai(1,d)).toVar();return oe(ai(1,f)).toVar().mul(L.mul(F.mul(D).add(P.mul(A))).add(d.mul(I.mul(D).add(R.mul(A))))).add(f.mul(L.mul(T.mul(D).add(S.mul(A))).add(d.mul(w.mul(D).add(y.mul(A))))))}).setLayout({name:"mx_trilerp_0",type:"float",inputs:[{name:"v0",type:"float"},{name:"v1",type:"float"},{name:"v2",type:"float"},{name:"v3",type:"float"},{name:"v4",type:"float"},{name:"v5",type:"float"},{name:"v6",type:"float"},{name:"v7",type:"float"},{name:"s",type:"float"},{name:"t",type:"float"},{name:"r",type:"float"}]}),C4e=me(([i,e,t,n,r,s,o,a,l,c,u])=>{let f=oe(u).toVar(),d=oe(c).toVar(),A=oe(l).toVar(),y=pe(a).toVar(),w=pe(o).toVar(),S=pe(s).toVar(),T=pe(r).toVar(),R=pe(n).toVar(),I=pe(t).toVar(),P=pe(e).toVar(),F=pe(i).toVar(),D=oe(ai(1,A)).toVar(),L=oe(ai(1,d)).toVar();return oe(ai(1,f)).toVar().mul(L.mul(F.mul(D).add(P.mul(A))).add(d.mul(I.mul(D).add(R.mul(A))))).add(f.mul(L.mul(T.mul(D).add(S.mul(A))).add(d.mul(w.mul(D).add(y.mul(A))))))}).setLayout({name:"mx_trilerp_1",type:"vec3",inputs:[{name:"v0",type:"vec3"},{name:"v1",type:"vec3"},{name:"v2",type:"vec3"},{name:"v3",type:"vec3"},{name:"v4",type:"vec3"},{name:"v5",type:"vec3"},{name:"v6",type:"vec3"},{name:"v7",type:"vec3"},{name:"s",type:"float"},{name:"t",type:"float"},{name:"r",type:"float"}]}),ooe=Ko([M4e,C4e]),R4e=me(([i,e,t])=>{let n=oe(t).toVar(),r=oe(e).toVar(),s=rt(i).toVar(),o=rt(s.bitAnd(rt(7))).toVar(),a=oe(cS(o.lessThan(rt(4)),r,n)).toVar(),l=oe(Tn(2,cS(o.lessThan(rt(4)),n,r))).toVar();return V4(a,dc(o.bitAnd(rt(1)))).add(V4(l,dc(o.bitAnd(rt(2)))))}).setLayout({name:"mx_gradient_float_0",type:"float",inputs:[{name:"hash",type:"uint"},{name:"x",type:"float"},{name:"y",type:"float"}]}),P4e=me(([i,e,t,n])=>{let r=oe(n).toVar(),s=oe(t).toVar(),o=oe(e).toVar(),a=rt(i).toVar(),l=rt(a.bitAnd(rt(15))).toVar(),c=oe(cS(l.lessThan(rt(8)),o,s)).toVar(),u=oe(cS(l.lessThan(rt(4)),s,cS(l.equal(rt(12)).or(l.equal(rt(14))),o,r))).toVar();return V4(c,dc(l.bitAnd(rt(1)))).add(V4(u,dc(l.bitAnd(rt(2)))))}).setLayout({name:"mx_gradient_float_1",type:"float",inputs:[{name:"hash",type:"uint"},{name:"x",type:"float"},{name:"y",type:"float"},{name:"z",type:"float"}]}),So=Ko([R4e,P4e]),I4e=me(([i,e,t])=>{let n=oe(t).toVar(),r=oe(e).toVar(),s=l1(i).toVar();return pe(So(s.x,r,n),So(s.y,r,n),So(s.z,r,n))}).setLayout({name:"mx_gradient_vec3_0",type:"vec3",inputs:[{name:"hash",type:"uvec3"},{name:"x",type:"float"},{name:"y",type:"float"}]}),L4e=me(([i,e,t,n])=>{let r=oe(n).toVar(),s=oe(t).toVar(),o=oe(e).toVar(),a=l1(i).toVar();return pe(So(a.x,o,s,r),So(a.y,o,s,r),So(a.z,o,s,r))}).setLayout({name:"mx_gradient_vec3_1",type:"vec3",inputs:[{name:"hash",type:"uvec3"},{name:"x",type:"float"},{name:"y",type:"float"},{name:"z",type:"float"}]}),Qc=Ko([I4e,L4e]),D4e=me(([i])=>{let e=oe(i).toVar();return Tn(.6616,e)}).setLayout({name:"mx_gradient_scale2d_0",type:"float",inputs:[{name:"v",type:"float"}]}),N4e=me(([i])=>{let e=oe(i).toVar();return Tn(.982,e)}).setLayout({name:"mx_gradient_scale3d_0",type:"float",inputs:[{name:"v",type:"float"}]}),F4e=me(([i])=>{let e=pe(i).toVar();return Tn(.6616,e)}).setLayout({name:"mx_gradient_scale2d_1",type:"vec3",inputs:[{name:"v",type:"vec3"}]}),aoe=Ko([D4e,F4e]),B4e=me(([i])=>{let e=pe(i).toVar();return Tn(.982,e)}).setLayout({name:"mx_gradient_scale3d_1",type:"vec3",inputs:[{name:"v",type:"vec3"}]}),loe=Ko([N4e,B4e]),uc=me(([i,e])=>{let t=de(e).toVar(),n=rt(i).toVar();return n.shiftLeft(t).bitOr(n.shiftRight(de(32).sub(t)))}).setLayout({name:"mx_rotl32",type:"uint",inputs:[{name:"x",type:"uint"},{name:"k",type:"int"}]}),coe=me(([i,e,t])=>{i.subAssign(t),i.bitXorAssign(uc(t,de(4))),t.addAssign(e),e.subAssign(i),e.bitXorAssign(uc(i,de(6))),i.addAssign(t),t.subAssign(e),t.bitXorAssign(uc(e,de(8))),e.addAssign(i),i.subAssign(t),i.bitXorAssign(uc(t,de(16))),t.addAssign(e),e.subAssign(i),e.bitXorAssign(uc(i,de(19))),i.addAssign(t),t.subAssign(e),t.bitXorAssign(uc(e,de(4))),e.addAssign(i)}),OS=me(([i,e,t])=>{let n=rt(t).toVar(),r=rt(e).toVar(),s=rt(i).toVar();return n.bitXorAssign(r),n.subAssign(uc(r,de(14))),s.bitXorAssign(n),s.subAssign(uc(n,de(11))),r.bitXorAssign(s),r.subAssign(uc(s,de(25))),n.bitXorAssign(r),n.subAssign(uc(r,de(16))),s.bitXorAssign(n),s.subAssign(uc(n,de(4))),r.bitXorAssign(s),r.subAssign(uc(s,de(14))),n.bitXorAssign(r),n.subAssign(uc(r,de(24))),n}).setLayout({name:"mx_bjfinal",type:"uint",inputs:[{name:"a",type:"uint"},{name:"b",type:"uint"},{name:"c",type:"uint"}]}),ba=me(([i])=>{let e=rt(i).toVar();return oe(e).div(oe(rt(de(4294967295))))}).setLayout({name:"mx_bits_to_01",type:"float",inputs:[{name:"bits",type:"uint"}]}),xf=me(([i])=>{let e=oe(i).toVar();return e.mul(e).mul(e).mul(e.mul(e.mul(6).sub(15)).add(10))}).setLayout({name:"mx_fade",type:"float",inputs:[{name:"t",type:"float"}]}),O4e=me(([i])=>{let e=de(i).toVar(),t=rt(rt(1)).toVar(),n=rt(rt(de(3735928559)).add(t.shiftLeft(rt(2))).add(rt(13))).toVar();return OS(n.add(rt(e)),n,n)}).setLayout({name:"mx_hash_int_0",type:"uint",inputs:[{name:"x",type:"int"}]}),U4e=me(([i,e])=>{let t=de(e).toVar(),n=de(i).toVar(),r=rt(rt(2)).toVar(),s=rt().toVar(),o=rt().toVar(),a=rt().toVar();return s.assign(o.assign(a.assign(rt(de(3735928559)).add(r.shiftLeft(rt(2))).add(rt(13))))),s.addAssign(rt(n)),o.addAssign(rt(t)),OS(s,o,a)}).setLayout({name:"mx_hash_int_1",type:"uint",inputs:[{name:"x",type:"int"},{name:"y",type:"int"}]}),k4e=me(([i,e,t])=>{let n=de(t).toVar(),r=de(e).toVar(),s=de(i).toVar(),o=rt(rt(3)).toVar(),a=rt().toVar(),l=rt().toVar(),c=rt().toVar();return a.assign(l.assign(c.assign(rt(de(3735928559)).add(o.shiftLeft(rt(2))).add(rt(13))))),a.addAssign(rt(s)),l.addAssign(rt(r)),c.addAssign(rt(n)),OS(a,l,c)}).setLayout({name:"mx_hash_int_2",type:"uint",inputs:[{name:"x",type:"int"},{name:"y",type:"int"},{name:"z",type:"int"}]}),z4e=me(([i,e,t,n])=>{let r=de(n).toVar(),s=de(t).toVar(),o=de(e).toVar(),a=de(i).toVar(),l=rt(rt(4)).toVar(),c=rt().toVar(),u=rt().toVar(),f=rt().toVar();return c.assign(u.assign(f.assign(rt(de(3735928559)).add(l.shiftLeft(rt(2))).add(rt(13))))),c.addAssign(rt(a)),u.addAssign(rt(o)),f.addAssign(rt(s)),coe(c,u,f),c.addAssign(rt(r)),OS(c,u,f)}).setLayout({name:"mx_hash_int_3",type:"uint",inputs:[{name:"x",type:"int"},{name:"y",type:"int"},{name:"z",type:"int"},{name:"xx",type:"int"}]}),V4e=me(([i,e,t,n,r])=>{let s=de(r).toVar(),o=de(n).toVar(),a=de(t).toVar(),l=de(e).toVar(),c=de(i).toVar(),u=rt(rt(5)).toVar(),f=rt().toVar(),d=rt().toVar(),A=rt().toVar();return f.assign(d.assign(A.assign(rt(de(3735928559)).add(u.shiftLeft(rt(2))).add(rt(13))))),f.addAssign(rt(c)),d.addAssign(rt(l)),A.addAssign(rt(a)),coe(f,d,A),f.addAssign(rt(o)),d.addAssign(rt(s)),OS(f,d,A)}).setLayout({name:"mx_hash_int_4",type:"uint",inputs:[{name:"x",type:"int"},{name:"y",type:"int"},{name:"z",type:"int"},{name:"xx",type:"int"},{name:"yy",type:"int"}]}),Xi=Ko([O4e,U4e,k4e,z4e,V4e]),G4e=me(([i,e])=>{let t=de(e).toVar(),n=de(i).toVar(),r=rt(Xi(n,t)).toVar(),s=l1().toVar();return s.x.assign(r.bitAnd(de(255))),s.y.assign(r.shiftRight(de(8)).bitAnd(de(255))),s.z.assign(r.shiftRight(de(16)).bitAnd(de(255))),s}).setLayout({name:"mx_hash_vec3_0",type:"uvec3",inputs:[{name:"x",type:"int"},{name:"y",type:"int"}]}),q4e=me(([i,e,t])=>{let n=de(t).toVar(),r=de(e).toVar(),s=de(i).toVar(),o=rt(Xi(s,r,n)).toVar(),a=l1().toVar();return a.x.assign(o.bitAnd(de(255))),a.y.assign(o.shiftRight(de(8)).bitAnd(de(255))),a.z.assign(o.shiftRight(de(16)).bitAnd(de(255))),a}).setLayout({name:"mx_hash_vec3_1",type:"uvec3",inputs:[{name:"x",type:"int"},{name:"y",type:"int"},{name:"z",type:"int"}]}),Jc=Ko([G4e,q4e]),H4e=me(([i])=>{let e=dt(i).toVar(),t=de().toVar(),n=de().toVar(),r=oe(Cr(e.x,t)).toVar(),s=oe(Cr(e.y,n)).toVar(),o=oe(xf(r)).toVar(),a=oe(xf(s)).toVar(),l=oe(soe(So(Xi(t,n),r,s),So(Xi(t.add(de(1)),n),r.sub(1),s),So(Xi(t,n.add(de(1))),r,s.sub(1)),So(Xi(t.add(de(1)),n.add(de(1))),r.sub(1),s.sub(1)),o,a)).toVar();return aoe(l)}).setLayout({name:"mx_perlin_noise_float_0",type:"float",inputs:[{name:"p",type:"vec2"}]}),W4e=me(([i])=>{let e=pe(i).toVar(),t=de().toVar(),n=de().toVar(),r=de().toVar(),s=oe(Cr(e.x,t)).toVar(),o=oe(Cr(e.y,n)).toVar(),a=oe(Cr(e.z,r)).toVar(),l=oe(xf(s)).toVar(),c=oe(xf(o)).toVar(),u=oe(xf(a)).toVar(),f=oe(ooe(So(Xi(t,n,r),s,o,a),So(Xi(t.add(de(1)),n,r),s.sub(1),o,a),So(Xi(t,n.add(de(1)),r),s,o.sub(1),a),So(Xi(t.add(de(1)),n.add(de(1)),r),s.sub(1),o.sub(1),a),So(Xi(t,n,r.add(de(1))),s,o,a.sub(1)),So(Xi(t.add(de(1)),n,r.add(de(1))),s.sub(1),o,a.sub(1)),So(Xi(t,n.add(de(1)),r.add(de(1))),s,o.sub(1),a.sub(1)),So(Xi(t.add(de(1)),n.add(de(1)),r.add(de(1))),s.sub(1),o.sub(1),a.sub(1)),l,c,u)).toVar();return loe(f)}).setLayout({name:"mx_perlin_noise_float_1",type:"float",inputs:[{name:"p",type:"vec3"}]}),NV=Ko([H4e,W4e]),j4e=me(([i])=>{let e=dt(i).toVar(),t=de().toVar(),n=de().toVar(),r=oe(Cr(e.x,t)).toVar(),s=oe(Cr(e.y,n)).toVar(),o=oe(xf(r)).toVar(),a=oe(xf(s)).toVar(),l=pe(soe(Qc(Jc(t,n),r,s),Qc(Jc(t.add(de(1)),n),r.sub(1),s),Qc(Jc(t,n.add(de(1))),r,s.sub(1)),Qc(Jc(t.add(de(1)),n.add(de(1))),r.sub(1),s.sub(1)),o,a)).toVar();return aoe(l)}).setLayout({name:"mx_perlin_noise_vec3_0",type:"vec3",inputs:[{name:"p",type:"vec2"}]}),X4e=me(([i])=>{let e=pe(i).toVar(),t=de().toVar(),n=de().toVar(),r=de().toVar(),s=oe(Cr(e.x,t)).toVar(),o=oe(Cr(e.y,n)).toVar(),a=oe(Cr(e.z,r)).toVar(),l=oe(xf(s)).toVar(),c=oe(xf(o)).toVar(),u=oe(xf(a)).toVar(),f=pe(ooe(Qc(Jc(t,n,r),s,o,a),Qc(Jc(t.add(de(1)),n,r),s.sub(1),o,a),Qc(Jc(t,n.add(de(1)),r),s,o.sub(1),a),Qc(Jc(t.add(de(1)),n.add(de(1)),r),s.sub(1),o.sub(1),a),Qc(Jc(t,n,r.add(de(1))),s,o,a.sub(1)),Qc(Jc(t.add(de(1)),n,r.add(de(1))),s.sub(1),o,a.sub(1)),Qc(Jc(t,n.add(de(1)),r.add(de(1))),s,o.sub(1),a.sub(1)),Qc(Jc(t.add(de(1)),n.add(de(1)),r.add(de(1))),s.sub(1),o.sub(1),a.sub(1)),l,c,u)).toVar();return loe(f)}).setLayout({name:"mx_perlin_noise_vec3_1",type:"vec3",inputs:[{name:"p",type:"vec3"}]}),US=Ko([j4e,X4e]),$4e=me(([i])=>{let e=oe(i).toVar(),t=de(Rs(e)).toVar();return ba(Xi(t))}).setLayout({name:"mx_cell_noise_float_0",type:"float",inputs:[{name:"p",type:"float"}]}),Y4e=me(([i])=>{let e=dt(i).toVar(),t=de(Rs(e.x)).toVar(),n=de(Rs(e.y)).toVar();return ba(Xi(t,n))}).setLayout({name:"mx_cell_noise_float_1",type:"float",inputs:[{name:"p",type:"vec2"}]}),Z4e=me(([i])=>{let e=pe(i).toVar(),t=de(Rs(e.x)).toVar(),n=de(Rs(e.y)).toVar(),r=de(Rs(e.z)).toVar();return ba(Xi(t,n,r))}).setLayout({name:"mx_cell_noise_float_2",type:"float",inputs:[{name:"p",type:"vec3"}]}),K4e=me(([i])=>{let e=Ft(i).toVar(),t=de(Rs(e.x)).toVar(),n=de(Rs(e.y)).toVar(),r=de(Rs(e.z)).toVar(),s=de(Rs(e.w)).toVar();return ba(Xi(t,n,r,s))}).setLayout({name:"mx_cell_noise_float_3",type:"float",inputs:[{name:"p",type:"vec4"}]}),Q4e=Ko([$4e,Y4e,Z4e,K4e]),J4e=me(([i])=>{let e=oe(i).toVar(),t=de(Rs(e)).toVar();return pe(ba(Xi(t,de(0))),ba(Xi(t,de(1))),ba(Xi(t,de(2))))}).setLayout({name:"mx_cell_noise_vec3_0",type:"vec3",inputs:[{name:"p",type:"float"}]}),ePe=me(([i])=>{let e=dt(i).toVar(),t=de(Rs(e.x)).toVar(),n=de(Rs(e.y)).toVar();return pe(ba(Xi(t,n,de(0))),ba(Xi(t,n,de(1))),ba(Xi(t,n,de(2))))}).setLayout({name:"mx_cell_noise_vec3_1",type:"vec3",inputs:[{name:"p",type:"vec2"}]}),tPe=me(([i])=>{let e=pe(i).toVar(),t=de(Rs(e.x)).toVar(),n=de(Rs(e.y)).toVar(),r=de(Rs(e.z)).toVar();return pe(ba(Xi(t,n,r,de(0))),ba(Xi(t,n,r,de(1))),ba(Xi(t,n,r,de(2))))}).setLayout({name:"mx_cell_noise_vec3_2",type:"vec3",inputs:[{name:"p",type:"vec3"}]}),nPe=me(([i])=>{let e=Ft(i).toVar(),t=de(Rs(e.x)).toVar(),n=de(Rs(e.y)).toVar(),r=de(Rs(e.z)).toVar(),s=de(Rs(e.w)).toVar();return pe(ba(Xi(t,n,r,s,de(0))),ba(Xi(t,n,r,s,de(1))),ba(Xi(t,n,r,s,de(2))))}).setLayout({name:"mx_cell_noise_vec3_3",type:"vec3",inputs:[{name:"p",type:"vec4"}]}),VP=Ko([J4e,ePe,tPe,nPe]),G4=me(([i,e,t,n])=>{let r=oe(n).toVar(),s=oe(t).toVar(),o=de(e).toVar(),a=pe(i).toVar(),l=oe(0).toVar(),c=oe(1).toVar();return Oi(o,()=>{l.addAssign(c.mul(NV(a))),c.mulAssign(r),a.mulAssign(s)}),l}).setLayout({name:"mx_fractal_noise_float",type:"float",inputs:[{name:"p",type:"vec3"},{name:"octaves",type:"int"},{name:"lacunarity",type:"float"},{name:"diminish",type:"float"}]}),GP=me(([i,e,t,n])=>{let r=oe(n).toVar(),s=oe(t).toVar(),o=de(e).toVar(),a=pe(i).toVar(),l=pe(0).toVar(),c=oe(1).toVar();return Oi(o,()=>{l.addAssign(c.mul(US(a))),c.mulAssign(r),a.mulAssign(s)}),l}).setLayout({name:"mx_fractal_noise_vec3",type:"vec3",inputs:[{name:"p",type:"vec3"},{name:"octaves",type:"int"},{name:"lacunarity",type:"float"},{name:"diminish",type:"float"}]}),iPe=me(([i,e,t,n])=>{let r=oe(n).toVar(),s=oe(t).toVar(),o=de(e).toVar(),a=pe(i).toVar();return dt(G4(a,o,s,r),G4(a.add(pe(de(19),de(193),de(17))),o,s,r))}).setLayout({name:"mx_fractal_noise_vec2",type:"vec2",inputs:[{name:"p",type:"vec3"},{name:"octaves",type:"int"},{name:"lacunarity",type:"float"},{name:"diminish",type:"float"}]}),rPe=me(([i,e,t,n])=>{let r=oe(n).toVar(),s=oe(t).toVar(),o=de(e).toVar(),a=pe(i).toVar(),l=pe(GP(a,o,s,r)).toVar(),c=oe(G4(a.add(pe(de(19),de(193),de(17))),o,s,r)).toVar();return Ft(l,c)}).setLayout({name:"mx_fractal_noise_vec4",type:"vec4",inputs:[{name:"p",type:"vec3"},{name:"octaves",type:"int"},{name:"lacunarity",type:"float"},{name:"diminish",type:"float"}]}),sPe=me(([i,e,t,n,r,s,o])=>{let a=de(o).toVar(),l=oe(s).toVar(),c=de(r).toVar(),u=de(n).toVar(),f=de(t).toVar(),d=de(e).toVar(),A=dt(i).toVar(),y=pe(VP(dt(d.add(u),f.add(c)))).toVar(),w=dt(y.x,y.y).toVar();w.subAssign(.5),w.mulAssign(l),w.addAssign(.5);let S=dt(dt(oe(d),oe(f)).add(w)).toVar(),T=dt(S.sub(A)).toVar();return $t(a.equal(de(2)),()=>fr(T.x).add(fr(T.y))),$t(a.equal(de(3)),()=>zr(fr(T.x),fr(T.y))),ru(T,T)}).setLayout({name:"mx_worley_distance_0",type:"float",inputs:[{name:"p",type:"vec2"},{name:"x",type:"int"},{name:"y",type:"int"},{name:"xoff",type:"int"},{name:"yoff",type:"int"},{name:"jitter",type:"float"},{name:"metric",type:"int"}]}),oPe=me(([i,e,t,n,r,s,o,a,l])=>{let c=de(l).toVar(),u=oe(a).toVar(),f=de(o).toVar(),d=de(s).toVar(),A=de(r).toVar(),y=de(n).toVar(),w=de(t).toVar(),S=de(e).toVar(),T=pe(i).toVar(),R=pe(VP(pe(S.add(A),w.add(d),y.add(f)))).toVar();R.subAssign(.5),R.mulAssign(u),R.addAssign(.5);let I=pe(pe(oe(S),oe(w),oe(y)).add(R)).toVar(),P=pe(I.sub(T)).toVar();return $t(c.equal(de(2)),()=>fr(P.x).add(fr(P.y)).add(fr(P.z))),$t(c.equal(de(3)),()=>zr(fr(P.x),fr(P.y),fr(P.z))),ru(P,P)}).setLayout({name:"mx_worley_distance_1",type:"float",inputs:[{name:"p",type:"vec3"},{name:"x",type:"int"},{name:"y",type:"int"},{name:"z",type:"int"},{name:"xoff",type:"int"},{name:"yoff",type:"int"},{name:"zoff",type:"int"},{name:"jitter",type:"float"},{name:"metric",type:"int"}]}),Tx=Ko([sPe,oPe]),aPe=me(([i,e,t])=>{let n=de(t).toVar(),r=oe(e).toVar(),s=dt(i).toVar(),o=de().toVar(),a=de().toVar(),l=dt(Cr(s.x,o),Cr(s.y,a)).toVar(),c=oe(1e6).toVar();return Oi({start:-1,end:de(1),name:"x",condition:"<="},({x:u})=>{Oi({start:-1,end:de(1),name:"y",condition:"<="},({y:f})=>{let d=oe(Tx(l,u,f,o,a,r,n)).toVar();c.assign(Pl(c,d))})}),$t(n.equal(de(0)),()=>{c.assign(el(c))}),c}).setLayout({name:"mx_worley_noise_float_0",type:"float",inputs:[{name:"p",type:"vec2"},{name:"jitter",type:"float"},{name:"metric",type:"int"}]}),lPe=me(([i,e,t])=>{let n=de(t).toVar(),r=oe(e).toVar(),s=dt(i).toVar(),o=de().toVar(),a=de().toVar(),l=dt(Cr(s.x,o),Cr(s.y,a)).toVar(),c=dt(1e6,1e6).toVar();return Oi({start:-1,end:de(1),name:"x",condition:"<="},({x:u})=>{Oi({start:-1,end:de(1),name:"y",condition:"<="},({y:f})=>{let d=oe(Tx(l,u,f,o,a,r,n)).toVar();$t(d.lessThan(c.x),()=>{c.y.assign(c.x),c.x.assign(d)}).ElseIf(d.lessThan(c.y),()=>{c.y.assign(d)})})}),$t(n.equal(de(0)),()=>{c.assign(el(c))}),c}).setLayout({name:"mx_worley_noise_vec2_0",type:"vec2",inputs:[{name:"p",type:"vec2"},{name:"jitter",type:"float"},{name:"metric",type:"int"}]}),cPe=me(([i,e,t])=>{let n=de(t).toVar(),r=oe(e).toVar(),s=dt(i).toVar(),o=de().toVar(),a=de().toVar(),l=dt(Cr(s.x,o),Cr(s.y,a)).toVar(),c=pe(1e6,1e6,1e6).toVar();return Oi({start:-1,end:de(1),name:"x",condition:"<="},({x:u})=>{Oi({start:-1,end:de(1),name:"y",condition:"<="},({y:f})=>{let d=oe(Tx(l,u,f,o,a,r,n)).toVar();$t(d.lessThan(c.x),()=>{c.z.assign(c.y),c.y.assign(c.x),c.x.assign(d)}).ElseIf(d.lessThan(c.y),()=>{c.z.assign(c.y),c.y.assign(d)}).ElseIf(d.lessThan(c.z),()=>{c.z.assign(d)})})}),$t(n.equal(de(0)),()=>{c.assign(el(c))}),c}).setLayout({name:"mx_worley_noise_vec3_0",type:"vec3",inputs:[{name:"p",type:"vec2"},{name:"jitter",type:"float"},{name:"metric",type:"int"}]}),uPe=me(([i,e,t])=>{let n=de(t).toVar(),r=oe(e).toVar(),s=pe(i).toVar(),o=de().toVar(),a=de().toVar(),l=de().toVar(),c=pe(Cr(s.x,o),Cr(s.y,a),Cr(s.z,l)).toVar(),u=oe(1e6).toVar();return Oi({start:-1,end:de(1),name:"x",condition:"<="},({x:f})=>{Oi({start:-1,end:de(1),name:"y",condition:"<="},({y:d})=>{Oi({start:-1,end:de(1),name:"z",condition:"<="},({z:A})=>{let y=oe(Tx(c,f,d,A,o,a,l,r,n)).toVar();u.assign(Pl(u,y))})})}),$t(n.equal(de(0)),()=>{u.assign(el(u))}),u}).setLayout({name:"mx_worley_noise_float_1",type:"float",inputs:[{name:"p",type:"vec3"},{name:"jitter",type:"float"},{name:"metric",type:"int"}]}),hPe=Ko([aPe,uPe]),fPe=me(([i,e,t])=>{let n=de(t).toVar(),r=oe(e).toVar(),s=pe(i).toVar(),o=de().toVar(),a=de().toVar(),l=de().toVar(),c=pe(Cr(s.x,o),Cr(s.y,a),Cr(s.z,l)).toVar(),u=dt(1e6,1e6).toVar();return Oi({start:-1,end:de(1),name:"x",condition:"<="},({x:f})=>{Oi({start:-1,end:de(1),name:"y",condition:"<="},({y:d})=>{Oi({start:-1,end:de(1),name:"z",condition:"<="},({z:A})=>{let y=oe(Tx(c,f,d,A,o,a,l,r,n)).toVar();$t(y.lessThan(u.x),()=>{u.y.assign(u.x),u.x.assign(y)}).ElseIf(y.lessThan(u.y),()=>{u.y.assign(y)})})})}),$t(n.equal(de(0)),()=>{u.assign(el(u))}),u}).setLayout({name:"mx_worley_noise_vec2_1",type:"vec2",inputs:[{name:"p",type:"vec3"},{name:"jitter",type:"float"},{name:"metric",type:"int"}]}),dPe=Ko([lPe,fPe]),pPe=me(([i,e,t])=>{let n=de(t).toVar(),r=oe(e).toVar(),s=pe(i).toVar(),o=de().toVar(),a=de().toVar(),l=de().toVar(),c=pe(Cr(s.x,o),Cr(s.y,a),Cr(s.z,l)).toVar(),u=pe(1e6,1e6,1e6).toVar();return Oi({start:-1,end:de(1),name:"x",condition:"<="},({x:f})=>{Oi({start:-1,end:de(1),name:"y",condition:"<="},({y:d})=>{Oi({start:-1,end:de(1),name:"z",condition:"<="},({z:A})=>{let y=oe(Tx(c,f,d,A,o,a,l,r,n)).toVar();$t(y.lessThan(u.x),()=>{u.z.assign(u.y),u.y.assign(u.x),u.x.assign(y)}).ElseIf(y.lessThan(u.y),()=>{u.z.assign(u.y),u.y.assign(y)}).ElseIf(y.lessThan(u.z),()=>{u.z.assign(y)})})})}),$t(n.equal(de(0)),()=>{u.assign(el(u))}),u}).setLayout({name:"mx_worley_noise_vec3_1",type:"vec3",inputs:[{name:"p",type:"vec3"},{name:"jitter",type:"float"},{name:"metric",type:"int"}]}),FV=Ko([cPe,pPe]),mPe=me(([i,e,t,n,r,s,o,a,l,c,u])=>{let f=de(i).toVar(),d=dt(e).toVar(),A=dt(t).toVar(),y=dt(n).toVar(),w=oe(r).toVar(),S=oe(s).toVar(),T=oe(o).toVar(),R=dc(a).toVar(),I=de(l).toVar(),P=oe(c).toVar(),F=oe(u).toVar(),D=d.mul(A).add(y),L=oe(0).toVar();return $t(f.equal(de(0)),()=>{L.assign(US(D))}),$t(f.equal(de(1)),()=>{L.assign(VP(D))}),$t(f.equal(de(2)),()=>{L.assign(FV(D,w,de(0)))}),$t(f.equal(de(3)),()=>{L.assign(GP(pe(D,0),I,P,F))}),L.assign(L.mul(T.sub(S)).add(S)),$t(R,()=>{L.assign(Yu(L,S,T))}),L}).setLayout({name:"mx_unifiednoise2d",type:"float",inputs:[{name:"noiseType",type:"int"},{name:"texcoord",type:"vec2"},{name:"freq",type:"vec2"},{name:"offset",type:"vec2"},{name:"jitter",type:"float"},{name:"outmin",type:"float"},{name:"outmax",type:"float"},{name:"clampoutput",type:"bool"},{name:"octaves",type:"int"},{name:"lacunarity",type:"float"},{name:"diminish",type:"float"}]}),APe=me(([i,e,t,n,r,s,o,a,l,c,u])=>{let f=de(i).toVar(),d=pe(e).toVar(),A=pe(t).toVar(),y=pe(n).toVar(),w=oe(r).toVar(),S=oe(s).toVar(),T=oe(o).toVar(),R=dc(a).toVar(),I=de(l).toVar(),P=oe(c).toVar(),F=oe(u).toVar(),D=d.mul(A).add(y),L=oe(0).toVar();return $t(f.equal(de(0)),()=>{L.assign(US(D))}),$t(f.equal(de(1)),()=>{L.assign(VP(D))}),$t(f.equal(de(2)),()=>{L.assign(FV(D,w,de(0)))}),$t(f.equal(de(3)),()=>{L.assign(GP(D,I,P,F))}),L.assign(L.mul(T.sub(S)).add(S)),$t(R,()=>{L.assign(Yu(L,S,T))}),L}).setLayout({name:"mx_unifiednoise3d",type:"float",inputs:[{name:"noiseType",type:"int"},{name:"position",type:"vec3"},{name:"freq",type:"vec3"},{name:"offset",type:"vec3"},{name:"jitter",type:"float"},{name:"outmin",type:"float"},{name:"outmax",type:"float"},{name:"clampoutput",type:"bool"},{name:"octaves",type:"int"},{name:"lacunarity",type:"float"},{name:"diminish",type:"float"}]}),gPe=me(([i])=>{let e=i.y,t=i.z,n=pe().toVar();return $t(e.lessThan(1e-4),()=>{n.assign(pe(t,t,t))}).Else(()=>{let r=i.x;r=r.sub(gf(r)).mul(6).toVar();let s=de(Dz(r)),o=r.sub(oe(s)),a=t.mul(e.oneMinus()),l=t.mul(e.mul(o).oneMinus()),c=t.mul(e.mul(o.oneMinus()).oneMinus());$t(s.equal(de(0)),()=>{n.assign(pe(t,c,a))}).ElseIf(s.equal(de(1)),()=>{n.assign(pe(l,t,a))}).ElseIf(s.equal(de(2)),()=>{n.assign(pe(a,t,c))}).ElseIf(s.equal(de(3)),()=>{n.assign(pe(a,l,t))}).ElseIf(s.equal(de(4)),()=>{n.assign(pe(c,a,t))}).Else(()=>{n.assign(pe(t,a,l))})}),n}).setLayout({name:"mx_hsvtorgb",type:"vec3",inputs:[{name:"hsv",type:"vec3"}]}),vPe=me(([i])=>{let e=pe(i).toVar(),t=oe(e.x).toVar(),n=oe(e.y).toVar(),r=oe(e.z).toVar(),s=oe(Pl(t,Pl(n,r))).toVar(),o=oe(zr(t,zr(n,r))).toVar(),a=oe(o.sub(s)).toVar(),l=oe().toVar(),c=oe().toVar(),u=oe().toVar();return u.assign(o),$t(o.greaterThan(0),()=>{c.assign(a.div(o))}).Else(()=>{c.assign(0)}),$t(c.lessThanEqual(0),()=>{l.assign(0)}).Else(()=>{$t(t.greaterThanEqual(o),()=>{l.assign(n.sub(r).div(a))}).ElseIf(n.greaterThanEqual(o),()=>{l.assign(Ps(2,r.sub(t).div(a)))}).Else(()=>{l.assign(Ps(4,t.sub(n).div(a)))}),l.mulAssign(1/6),$t(l.lessThan(0),()=>{l.addAssign(1)})}),pe(l,c,u)}).setLayout({name:"mx_rgbtohsv",type:"vec3",inputs:[{name:"c",type:"vec3"}]}),_Pe=me(([i])=>{let e=pe(i).toVar(),t=gz(Sz(e,pe(.04045))).toVar(),n=pe(e.div(12.92)).toVar(),r=pe(eu(zr(e.add(pe(.055)),pe(0)).div(1.055),pe(2.4))).toVar();return Qn(n,r,t)}).setLayout({name:"mx_srgb_texture_to_lin_rec709",type:"vec3",inputs:[{name:"color",type:"vec3"}]}),uoe=(i,e)=>{i=oe(i),e=oe(e);let t=dt(e.dFdx(),e.dFdy()).length().mul(.7071067811865476);return mc(i.sub(t),i.add(t),e)},hoe=(i,e,t,n)=>Qn(i,e,t[n].clamp()),xPe=(i,e,t=Ui())=>hoe(i,e,t,"x"),yPe=(i,e,t=Ui())=>hoe(i,e,t,"y"),bPe=(i,e,t,n,r=Ui())=>{let s=r.x.clamp(),o=r.y.clamp(),a=Qn(i,e,s),l=Qn(t,n,s);return Qn(a,l,o)},foe=(i,e,t,n,r)=>Qn(i,e,uoe(t,n[r])),wPe=(i,e,t,n=Ui())=>foe(i,e,t,n,"x"),SPe=(i,e,t,n=Ui())=>foe(i,e,t,n,"y"),TPe=(i=1,e=0,t=Ui())=>t.mul(i).add(e),EPe=(i,e=1)=>(i=oe(i),i.abs().pow(e).mul(i.sign())),MPe=(i,e=1,t=.5)=>oe(i).sub(t).mul(e).add(t),CPe=(i=Ui(),e=1,t=0)=>NV(i.convert("vec2|vec3")).mul(e).add(t),RPe=(i=Ui(),e=1,t=0)=>US(i.convert("vec2|vec3")).mul(e).add(t),PPe=(i=Ui(),e=1,t=0)=>(i=i.convert("vec2|vec3"),Ft(US(i),NV(i.add(dt(19,73)))).mul(e).add(t)),IPe=(i,e=Ui(),t=dt(1,1),n=dt(0,0),r=1,s=0,o=1,a=!1,l=1,c=2,u=.5)=>mPe(i,e.convert("vec2|vec3"),t,n,r,s,o,a,l,c,u),LPe=(i,e=Ui(),t=dt(1,1),n=dt(0,0),r=1,s=0,o=1,a=!1,l=1,c=2,u=.5)=>APe(i,e.convert("vec2|vec3"),t,n,r,s,o,a,l,c,u),DPe=(i=Ui(),e=1)=>hPe(i.convert("vec2|vec3"),e,de(1)),NPe=(i=Ui(),e=1)=>dPe(i.convert("vec2|vec3"),e,de(1)),FPe=(i=Ui(),e=1)=>FV(i.convert("vec2|vec3"),e,de(1)),BPe=(i=Ui())=>Q4e(i.convert("vec2|vec3")),OPe=(i=Ui(),e=3,t=2,n=.5,r=1)=>G4(i,de(e),t,n).mul(r),UPe=(i=Ui(),e=3,t=2,n=.5,r=1)=>iPe(i,de(e),t,n).mul(r),kPe=(i=Ui(),e=3,t=2,n=.5,r=1)=>GP(i,de(e),t,n).mul(r),zPe=(i=Ui(),e=3,t=2,n=.5,r=1)=>rPe(i,de(e),t,n).mul(r),VPe=(i,e=oe(0))=>Ps(i,e),GPe=(i,e=oe(0))=>ai(i,e),qPe=(i,e=oe(1))=>Tn(i,e),HPe=(i,e=oe(1))=>pc(i,e),WPe=(i,e=oe(1))=>yP(i,e),jPe=(i,e=oe(1))=>eu(i,e),XPe=(i=oe(0),e=oe(1))=>Cz(i,e),$Pe=()=>Sx,YPe=()=>Rse,ZPe=(i,e=oe(1))=>ai(e,i),KPe=(i,e,t,n)=>i.greaterThan(e).mix(t,n),QPe=(i,e,t,n)=>i.greaterThanEqual(e).mix(t,n),JPe=(i,e,t,n)=>i.equal(e).mix(t,n),eIe=(i,e=null)=>{if(typeof e=="string"){let t={x:0,r:0,y:1,g:1,z:2,b:2,w:3,a:3},n=e.replace(/^out/,"").toLowerCase();if(t[n]!==void 0)return i.element(t[n])}if(typeof e=="number")return i.element(e);if(typeof e=="string"&&e.length===1){let t={x:0,r:0,y:1,g:1,z:2,b:2,w:3,a:3};if(t[e]!==void 0)return i.element(t[e])}return i},tIe=(i,e=dt(.5,.5),t=dt(1,1),n=oe(0),r=dt(0,0))=>{let s=i;if(e&&(s=s.sub(e)),t&&(s=s.mul(t)),n){let o=n.mul(Math.PI/180),a=o.cos(),l=o.sin();s=dt(s.x.mul(a).sub(s.y.mul(l)),s.x.mul(l).add(s.y.mul(a)))}return e&&(s=s.add(e)),r&&(s=s.add(r)),s},nIe=(i,e)=>{i=dt(i),e=oe(e);let t=e.mul(Math.PI/180);return FS(i,t)},iIe=(i,e,t)=>{i=pe(i),e=oe(e),t=pe(t);let n=e.mul(Math.PI/180),r=t.normalize(),s=n.cos(),o=n.sin(),a=oe(1).sub(s);return i.mul(s).add(r.cross(i).mul(o)).add(r.mul(r.dot(i)).mul(a))},rIe=(i,e)=>(i=pe(i),e=oe(e),sV(i,e)),sIe=me(([i,e,t])=>{let n=ya(i).toVar(),r=ai(oe(.5).mul(e.sub(t)),_f).div(n).toVar(),s=ai(oe(-.5).mul(e.sub(t)),_f).div(n).toVar(),o=pe().toVar();o.x=n.x.greaterThan(oe(0)).select(r.x,s.x),o.y=n.y.greaterThan(oe(0)).select(r.y,s.y),o.z=n.z.greaterThan(oe(0)).select(r.z,s.z);let a=Pl(o.x,o.y,o.z).toVar();return _f.add(n.mul(a)).toVar().sub(t)}),doe=me(([i,e])=>{let t=i.x,n=i.y,r=i.z,s=e.element(0).mul(.886227);return s=s.add(e.element(1).mul(2*.511664).mul(n)),s=s.add(e.element(2).mul(2*.511664).mul(r)),s=s.add(e.element(3).mul(2*.511664).mul(t)),s=s.add(e.element(4).mul(2*.429043).mul(t).mul(n)),s=s.add(e.element(5).mul(2*.429043).mul(n).mul(r)),s=s.add(e.element(6).mul(r.mul(r).mul(.743125).sub(.247708))),s=s.add(e.element(7).mul(2*.429043).mul(t).mul(r)),s=s.add(e.element(8).mul(.429043).mul(Tn(t,t).sub(Tn(n,n)))),s}),V=Object.freeze({__proto__:null,BRDF_GGX:yV,BRDF_Lambert:i1,BasicPointShadowFilter:toe,BasicShadowFilter:Xse,Break:Qre,Const:wie,Continue:u3e,DFGLUT:vS,D_GGX:hse,Discard:Uie,EPSILON:bP,F_Schlick:gx,Fn:me,HALF_PI:rEe,INFINITY:tEe,If:$t,Loop:Oi,NodeAccess:Yo,NodeShaderStage:ex,NodeType:NTe,NodeUpdateType:yn,OnBeforeFrameUpdate:r3e,OnBeforeMaterialUpdate:i3e,OnBeforeObjectUpdate:n3e,OnFrameUpdate:Hre,OnMaterialUpdate:t3e,OnObjectUpdate:NS,PCFShadowFilter:$se,PCFSoftShadowFilter:Yse,PI:f4,PI2:nEe,PointShadowFilter:noe,Return:mEe,Schlick_to_F0:I7,ShaderNode:ix,Stack:gP,Switch:YTe,TBNViewMatrix:qg,TWO_PI:iEe,VSMShadowFilter:Zse,V_GGX_SmithCorrelated:use,Var:bie,VarIntent:Sie,abs:fr,acesFilmicToneMapping:kse,acos:Mz,acosh:Qne,add:Ps,addMethodChaining:Ue,addNodeElement:AEe,agxToneMapping:zse,all:Gne,alphaT:a4,ambientOcclusion:DU,and:Cne,anisotropy:om,anisotropyB:jg,anisotropyT:rS,any:qne,append:KTe,array:xne,asin:Zne,asinh:Kne,assign:yne,atan:Cz,atanh:Jne,atomicAdd:bRe,atomicAnd:ERe,atomicFunc:Cf,atomicLoad:xRe,atomicMax:SRe,atomicMin:TRe,atomicOr:MRe,atomicStore:yRe,atomicSub:wRe,atomicXor:CRe,attenuationColor:bz,attenuationDistance:yz,attribute:fc,attributeArray:MCe,backgroundBlurriness:Lse,backgroundIntensity:xk,backgroundRotation:Dse,batch:$re,batchColor:dV,bentNormalView:pre,billboarding:mCe,bitAnd:Lne,bitNot:Dne,bitOr:Nne,bitXor:Fne,bitangentGeometry:XEe,bitangentLocal:$Ee,bitangentView:fre,bitangentWorld:YEe,bitcast:Mse,blendBurn:OCe,blendColor:VCe,blendDodge:UCe,blendOverlay:zCe,blendScreen:kCe,blur:gse,bool:dc,buffer:bx,bufferAttribute:qz,builtin:tp,builtinAOContext:xie,builtinShadowContext:_ie,bumpMap:sV,bvec2:pne,bvec3:gz,bvec4:mne,bypass:Bie,cache:Fie,call:bne,cameraFar:cm,cameraIndex:bm,cameraNear:lm,cameraNormalMatrix:SEe,cameraPosition:Hie,cameraProjectionMatrix:Ja,cameraProjectionMatrixInverse:qie,cameraViewMatrix:wm,cameraViewport:TEe,cameraWorldMatrix:DS,cbrt:die,cdl:jCe,ceil:SP,checker:w4e,cineonToneMapping:Use,clamp:Yu,clearcoat:r4,clearcoatNormalView:um,clearcoatRoughness:sx,clipSpace:Xie,code:UP,color:dne,colorSpaceToWorking:EP,colorToDirection:QEe,compute:Nie,computeKernel:Wz,computeSkinning:c3e,context:ep,convert:gne,convertColorSpace:lEe,convertToTexture:wCe,cos:Hu,cosh:Xne,countLeadingZeros:jMe,countOneBits:XMe,countTrailingZeros:WMe,cross:Kd,cubeTexture:Qa,cubeTextureBase:iV,dFdx:Iz,dFdy:Lz,dashSize:Xg,debug:zie,decrement:Vne,decrementBefore:kne,defaultBuildStages:YR,defaultShaderStages:lne,defined:hx,degrees:Wne,deltaTime:aCe,densityFogFactor:Hse,depth:vV,depthPass:KCe,determinant:rie,difference:lie,diffuseColor:Bi,diffuseContribution:kg,directPointLight:roe,directionToColor:KEe,directionToFaceDirection:UEe,dispersion:wz,disposeShadowMaterial:Qse,distance:aie,div:pc,dot:ru,drawIndex:Die,dynamicBufferAttribute:hEe,element:Ane,emissive:LU,equal:wne,equirectDirection:T7,equirectUV:_V,exp:Tz,exp2:fx,exponentialHeightFogFactor:lRe,expression:hc,faceDirection:eV,faceForward:kz,faceforward:sEe,float:oe,floatBitsToInt:GMe,floatBitsToUint:Cse,floor:gf,fog:Mk,fract:$u,frameGroup:JTe,frameId:Rse,frontFacing:$ie,fwidth:Nz,gain:YMe,gapSize:dS,getConstNodeType:fne,getCurrentStack:pz,getDirection:mse,getDistanceAttenuation:DV,getGeometryRoughness:cse,getNormalFromDepth:TCe,getParallaxCorrectNormal:sIe,getRoughness:xV,getScreenPosition:SCe,getShIrradianceAt:doe,getShadowMaterial:Kse,getShadowRenderObjectFunction:Jse,getTextureIndex:Tse,getViewPosition:nx,ggxConvolution:vse,globalId:fRe,glsl:sRe,glslFn:oRe,grayscale:GCe,greaterThan:Sz,greaterThanEqual:Mne,hash:$Me,highpModelNormalViewMatrix:JU,highpModelViewMatrix:QU,hue:WCe,increment:zne,incrementBefore:Une,inspector:Vie,instance:jre,instanceColor:fV,instanceIndex:Xu,instancedArray:CCe,instancedBufferAttribute:CP,instancedDynamicBufferAttribute:Hz,instancedMesh:Xre,int:de,intBitsToFloat:qMe,interleavedGradientNoise:SV,inverse:sie,inverseSqrt:Ez,inversesqrt:oEe,invocationLocalIndex:pEe,invocationSubgroupIndex:dEe,ior:sS,iridescence:_P,iridescenceIOR:s4,iridescenceThickness:o4,isolate:lx,ivec2:kr,ivec3:Az,ivec4:vz,js:iRe,label:yie,length:vf,lengthSq:Oz,lessThan:Tne,lessThanEqual:Ene,lightPosition:RV,lightProjectionUV:Wse,lightShadowMatrix:zP,lightTargetDirection:IV,lightTargetPosition:jse,lightViewPosition:PV,lightingContext:ese,lights:s4e,linearDepth:y4,linearToneMapping:Bse,localId:dRe,log:wP,log2:Af,logarithmicDepthToViewZ:m3e,luminance:EV,mat2:vP,mat3:To,mat4:pm,matcapUV:_se,materialAO:Gre,materialAlphaTest:Are,materialAnisotropy:Ire,materialAnisotropyVector:tx,materialAttenuationColor:kre,materialAttenuationDistance:Ure,materialClearcoat:Tre,materialClearcoatNormal:Mre,materialClearcoatRoughness:Ere,materialColor:gre,materialDispersion:Vre,materialEmissive:_re,materialEnvIntensity:KR,materialEnvRotation:g4,materialIOR:Ore,materialIridescence:Lre,materialIridescenceIOR:Dre,materialIridescenceThickness:Nre,materialLightMap:hV,materialLineDashOffset:uV,materialLineDashSize:lV,materialLineGapSize:cV,materialLineScale:aV,materialLineWidth:v4,materialMetalness:wre,materialNormal:Sre,materialOpacity:oV,materialPointSize:zre,materialReference:Xd,materialReflectivity:QR,materialRefractionRatio:Kie,materialRotation:Cre,materialRoughness:bre,materialSheen:Rre,materialSheenRoughness:Pre,materialShininess:vre,materialSpecular:xre,materialSpecularColor:yre,materialSpecularIntensity:u7,materialSpecularStrength:oS,materialThickness:Bre,materialTransmission:Fre,max:zr,maxMipLevel:Yz,mediumpModelViewMatrix:jie,metalness:Yd,min:Pl,mix:Qn,mixElement:mie,mod:yP,modelDirection:LEe,modelNormalMatrix:Wie,modelPosition:DEe,modelRadius:BEe,modelScale:NEe,modelViewMatrix:bf,modelViewPosition:FEe,modelViewProjection:qre,modelWorldMatrix:tu,modelWorldMatrixInverse:OEe,morphReference:Jre,mrt:Ese,mul:Tn,mx_aastep:uoe,mx_add:VPe,mx_atan2:XPe,mx_cell_noise_float:BPe,mx_contrast:MPe,mx_divide:HPe,mx_fractal_noise_float:OPe,mx_fractal_noise_vec2:UPe,mx_fractal_noise_vec3:kPe,mx_fractal_noise_vec4:zPe,mx_frame:YPe,mx_heighttonormal:rIe,mx_hsvtorgb:gPe,mx_ifequal:JPe,mx_ifgreater:KPe,mx_ifgreatereq:QPe,mx_invert:ZPe,mx_modulo:WPe,mx_multiply:qPe,mx_noise_float:CPe,mx_noise_vec3:RPe,mx_noise_vec4:PPe,mx_place2d:tIe,mx_power:jPe,mx_ramp4:bPe,mx_ramplr:xPe,mx_ramptb:yPe,mx_rgbtohsv:vPe,mx_rotate2d:nIe,mx_rotate3d:iIe,mx_safepower:EPe,mx_separate:eIe,mx_splitlr:wPe,mx_splittb:SPe,mx_srgb_texture_to_lin_rec709:_Pe,mx_subtract:GPe,mx_timer:$Pe,mx_transform_uv:TPe,mx_unifiednoise2d:IPe,mx_unifiednoise3d:LPe,mx_worley_noise_float:DPe,mx_worley_noise_vec2:NPe,mx_worley_noise_vec3:FPe,negate:Pz,negateOnBackSide:h1,neutralToneMapping:Vse,nodeArray:Wg,nodeImmutable:xt,nodeObject:Ht,nodeObjectIntent:eS,nodeObjects:AP,nodeProxy:$n,nodeProxyConstructor:dz,nodeProxyIntent:ct,normalFlat:Yie,normalGeometry:RP,normalLocal:wa,normalMap:l7,normalView:hi,normalViewGeometry:dx,normalWorld:Sm,normalWorldGeometry:Zie,normalize:ya,not:Pne,notEqual:Sne,numWorkgroups:uRe,objectDirection:EEe,objectGroup:_ne,objectPosition:CEe,objectRadius:IEe,objectScale:REe,objectViewPosition:PEe,objectWorldMatrix:MEe,oneMinus:eie,or:Rne,orthographicDepthToViewZ:nse,oscSawtooth:hCe,oscSine:lCe,oscSquare:cCe,oscTriangle:uCe,output:ox,outputStruct:kMe,overloadingFn:Ko,overrideNode:wse,overrideNodes:Sse,packHalf2x16:eCe,packNormalToRGB:rV,packSnorm2x16:QMe,packUnorm2x16:JMe,parabola:hk,parallaxDirection:dre,parallaxUV:ZEe,parameter:BMe,pass:YCe,passTexture:ZCe,pcurve:ZMe,perspectiveDepthToViewZ:DP,pmremTexture:wV,pointShadow:ioe,pointUV:RCe,pointWidth:QTe,positionGeometry:va,positionLocal:Mr,positionPrevious:n1,positionView:xs,positionViewDirection:er,positionWorld:_f,positionWorldDirection:Jz,posterize:XCe,pow:eu,pow2:Fz,pow3:cie,pow4:Bz,premultiplyAlpha:Xz,property:Jd,quadBroadcast:JRe,quadSwapDiagonal:XRe,quadSwapX:WRe,quadSwapY:jRe,radians:Hne,rand:pie,range:cRe,rangeFogFactor:qse,reciprocal:nie,reference:mr,referenceBuffer:ire,reflect:oie,reflectVector:ere,reflectView:Qie,reflector:xCe,refract:Uz,refractVector:tre,refractView:Jie,reinhardToneMapping:Ose,remap:jz,remapClamp:Oie,renderGroup:Jt,renderOutput:$z,rendererReference:Rie,replaceDefaultUV:fCe,rotate:FS,rotateUV:dCe,roughness:pf,round:tie,rtt:Ise,sRGBTransferEOTF:Eie,sRGBTransferOETF:Mie,sample:ECe,sampler:xEe,samplerComparison:yEe,saturate:TP,saturation:qCe,screenCoordinate:u1,screenDPR:Kz,screenSize:t1,screenUV:ju,select:xa,setCurrentStack:fS,setName:zz,shaderStages:ZR,shadow:eoe,shadowPositionWorld:LV,shapeCircle:S4e,sharedUniformGroup:xP,sheen:cc,sheenRoughness:am,shiftLeft:Bne,shiftRight:One,shininess:l4,sign:Rz,sin:Ka,sinc:KMe,sinh:jne,skinning:Kre,smoothstep:mc,smoothstepElement:Aie,specularColor:gm,specularColorBlended:Vg,specularF90:Gg,spherizeUV:pCe,split:ZTe,spritesheetUV:gCe,sqrt:el,stack:e4,step:Jg,stepElement:gie,storage:mm,storageBarrier:ARe,storageTexture:Nse,storageTexture3D:ICe,struct:UMe,sub:ai,subBuild:$g,subgroupAdd:IRe,subgroupAll:GRe,subgroupAnd:ORe,subgroupAny:qRe,subgroupBallot:PRe,subgroupBroadcast:$Re,subgroupBroadcastFirst:HRe,subgroupElect:RRe,subgroupExclusiveAdd:DRe,subgroupExclusiveMul:BRe,subgroupInclusiveAdd:LRe,subgroupInclusiveMul:FRe,subgroupIndex:fEe,subgroupMax:VRe,subgroupMin:zRe,subgroupMul:NRe,subgroupOr:URe,subgroupShuffle:YRe,subgroupShuffleDown:QRe,subgroupShuffleUp:KRe,subgroupShuffleXor:ZRe,subgroupSize:pRe,subgroupXor:kRe,tan:$ne,tangentGeometry:PP,tangentLocal:vm,tangentView:IP,tangentWorld:hre,tanh:Yne,texture:fi,texture3D:TV,texture3DLevel:NCe,texture3DLoad:DCe,textureBarrier:gRe,textureBicubic:G3e,textureBicubicLevel:bV,textureCubeUV:Ase,textureLevel:_Ee,textureLoad:_s,textureSize:e1,textureStore:PCe,thickness:xz,time:Sx,toneMapping:Pie,toneMappingExposure:Iie,toonOutlinePass:QCe,transformDirection:uie,transformNormal:tV,transformNormalByInverseViewMatrix:fie,transformNormalByViewMatrix:hie,transformNormalToView:nV,transformedClearcoatNormalView:VEe,transformedNormalView:kEe,transformedNormalWorld:zEe,transmission:c4,transpose:iie,triNoise3D:sCe,triplanarTexture:vCe,triplanarTextures:Pse,trunc:Dz,uint:rt,uintBitsToFloat:HMe,uniform:Xt,uniformArray:$o,uniformCubeTexture:GEe,uniformFlow:vie,uniformGroup:vne,uniformTexture:vEe,unpackHalf2x16:iCe,unpackNormal:o7,unpackRGBToNormal:mre,unpackSnorm2x16:tCe,unpackUnorm2x16:nCe,unpremultiplyAlpha:kie,userData:FCe,uv:Ui,uvec2:mz,uvec3:l1,uvec4:_z,varying:ym,varyingProperty:c1,vec2:dt,vec3:pe,vec4:Ft,vectorComponents:a1,velocity:BCe,vertexColor:sse,vertexIndex:Lie,vertexStage:Tie,vibrance:HCe,viewZToLogarithmicDepth:NP,viewZToOrthographicDepth:Yg,viewZToPerspectiveDepth:gV,viewZToReversedOrthographicDepth:p3e,viewZToReversedPerspectiveDepth:ise,viewport:ux,viewportCoordinate:Gie,viewportDepthTexture:AV,viewportLinearDepth:A3e,viewportMipTexture:mV,viewportOpaqueMipTexture:tse,viewportResolution:wEe,viewportSafeUV:ACe,viewportSharedTexture:$Ce,viewportSize:Qz,viewportTexture:f3e,viewportUV:bEe,vogelDiskSample:Wu,wgsl:rRe,wgslFn:aRe,workgroupArray:vRe,workgroupBarrier:mRe,workgroupId:hRe,workingToColorSpace:Cie,xor:Ine}),Gu=new xS,Bk=class extends Tf{constructor(e,t){super(),this.renderer=e,this.nodes=t}update(e,t,n){let r=this.renderer,s=this.nodes.getBackgroundNode(e)||e.background,o=!1;if(s===null)r._clearColor.getRGB(Gu),Gu.a=r._clearColor.a;else if(s.isColor===!0)s.getRGB(Gu),Gu.a=1,o=!0;else if(s.isNode===!0){let l=this.get(e),c=s;Gu.copy(r._clearColor);let u=l.backgroundMesh;if(u===void 0){let I=function(){s.removeEventListener("dispose",I),u.material.dispose(),u.geometry.dispose()},d=Ft(c).mul(xk).context({getUV:()=>Dse.mul(Zie),getTextureLevel:()=>Lse}),A=Ja.element(3).element(3).equal(1),y=pc(1,Ja.element(1).element(1)).mul(3),w=A.select(Mr.mul(y),Mr),S=bf.mul(Ft(w,0)),T=Ja.mul(Ft(S.xyz,1));T=T.setZ(T.w);let R=new Pr;R.name="Background.material",R.side=mi,R.depthTest=!1,R.depthWrite=!1,R.allowOverride=!1,R.fog=!1,R.lights=!1,R.vertexNode=T,R.colorNode=d,l.backgroundMeshNode=d,l.backgroundMesh=u=new Hn(new Va(1,32,32),R),u.frustumCulled=!1,u.name="Background.mesh",s.addEventListener("dispose",I)}let f=c.getCacheKey();l.backgroundCacheKey!==f&&(l.backgroundMeshNode.node=Ft(c).mul(xk),l.backgroundMeshNode.needsUpdate=!0,u.material.needsUpdate=!0,l.backgroundCacheKey=f),t.unshift(u,u.geometry,u.material,0,0,null,null)}else ze("Renderer: Unsupported background configuration.",s);let a=r.xr.getEnvironmentBlendMode();if(a==="additive"?Gu.set(0,0,0,1):a==="alpha-blend"&&Gu.set(0,0,0,0),r.autoClear===!0||o===!0){let l=n.clearColorValue;l.r=Gu.r,l.g=Gu.g,l.b=Gu.b,l.a=Gu.a,(r.backend.isWebGLBackend===!0||r.alpha===!0)&&(l.r*=l.a,l.g*=l.a,l.b*=l.a),n.depthClearValue=r.getClearDepth(),n.stencilClearValue=r.getClearStencil(),n.clearColor=r.autoClearColor===!0,n.clearDepth=r.autoClearDepth===!0,n.clearStencil=r.autoClearStencil===!0}else n.clearColor=!1,n.clearDepth=!1,n.clearStencil=!1}},oIe=0,TS=class{constructor(e="",t=[]){this.name=e,this.bindings=t,this.id=oIe++}},Ok=class{constructor(e,t,n,r,s,o,a,l,c,u,f=[]){this.vertexShader=e,this.fragmentShader=t,this.computeShader=n,this.transforms=f,this.nodeAttributes=r,this.bindings=s,this.updateNodes=o,this.updateBeforeNodes=a,this.updateAfterNodes=l,this.observer=c,this.hardwareClipping=u,this.usedTimes=0}createBindings(){let e=[];for(let t of this.bindings)if(t.bindings[0].groupNode.shared!==!0){let r=new TS(t.name,[]);e.push(r);for(let s of t.bindings)r.bindings.push(s.clone())}else e.push(t);return e}},q4=class{constructor(e,t,n=null){this.isNodeAttribute=!0,this.name=e,this.type=t,this.node=n}},Uk=class{constructor(e,t,n){this.isNodeUniform=!0,this.name=e,this.type=t,this.node=n}get value(){return this.node.value}set value(e){this.node.value=e}get id(){return this.node.id}get groupNode(){return this.node.groupNode}},H4=class{constructor(e,t,n=!1,r=null){this.isNodeVar=!0,this.name=e,this.type=t,this.readOnly=n,this.count=r}},kk=class extends H4{constructor(e,t,n=null,r=null){super(e,t),this.needsInterpolation=!1,this.isNodeVarying=!0,this.interpolationType=n,this.interpolationSampling=r}},zk=class{constructor(e,t,n=""){this.name=e,this.type=t,this.code=n,Object.defineProperty(this,"isNodeCode",{value:!0})}},aIe=0,uS=class{constructor(e=null){this.id=aIe++,this.nodesData=new WeakMap,this.parent=e}getData(e){let t=this.nodesData.get(e);return t===void 0&&this.parent!==null&&(t=this.parent.getData(e)),t}setData(e,t){this.nodesData.set(e,t)}},Vk=class{constructor(e,t){this.name=e,this.members=t,this.output=!1}},Mf=class{constructor(e,t){this.name=e,this.value=t,this.boundary=0,this.itemSize=0,this.offset=0,this.index=-1}setValue(e){this.value=e}getValue(){return this.value}},Gk=class extends Mf{constructor(e,t=0){super(e,t),this.isNumberUniform=!0,this.boundary=4,this.itemSize=1}},qk=class extends Mf{constructor(e,t=new Oe){super(e,t),this.isVector2Uniform=!0,this.boundary=8,this.itemSize=2}},Hk=class extends Mf{constructor(e,t=new re){super(e,t),this.isVector3Uniform=!0,this.boundary=16,this.itemSize=3}},Wk=class extends Mf{constructor(e,t=new xn){super(e,t),this.isVector4Uniform=!0,this.boundary=16,this.itemSize=4}},jk=class extends Mf{constructor(e,t=new zt){super(e,t),this.isColorUniform=!0,this.boundary=16,this.itemSize=3}},Xk=class extends Mf{constructor(e,t=new c_){super(e,t),this.isMatrix2Uniform=!0,this.boundary=8,this.itemSize=4}},$k=class extends Mf{constructor(e,t=new Mn){super(e,t),this.isMatrix3Uniform=!0,this.boundary=48,this.itemSize=12}},Yk=class extends Mf{constructor(e,t=new cn){super(e,t),this.isMatrix4Uniform=!0,this.boundary=64,this.itemSize=16}},Zk=class extends Gk{constructor(e){super(e.name,e.value),this.nodeUniform=e}getValue(){return this.nodeUniform.value}getType(){return this.nodeUniform.type}},Kk=class extends qk{constructor(e){super(e.name,e.value),this.nodeUniform=e}getValue(){return this.nodeUniform.value}getType(){return this.nodeUniform.type}},Qk=class extends Hk{constructor(e){super(e.name,e.value),this.nodeUniform=e}getValue(){return this.nodeUniform.value}getType(){return this.nodeUniform.type}},Jk=class extends Wk{constructor(e){super(e.name,e.value),this.nodeUniform=e}getValue(){return this.nodeUniform.value}getType(){return this.nodeUniform.type}},e9=class extends jk{constructor(e){super(e.name,e.value),this.nodeUniform=e}getValue(){return this.nodeUniform.value}getType(){return this.nodeUniform.type}},t9=class extends Xk{constructor(e){super(e.name,e.value),this.nodeUniform=e}getValue(){return this.nodeUniform.value}getType(){return this.nodeUniform.type}},n9=class extends $k{constructor(e){super(e.name,e.value),this.nodeUniform=e}getValue(){return this.nodeUniform.value}getType(){return this.nodeUniform.type}},i9=class extends Yk{constructor(e){super(e.name,e.value),this.nodeUniform=e}getValue(){return this.nodeUniform.value}getType(){return this.nodeUniform.type}},lIe=0,Rte=new WeakMap,Pte=new WeakMap,cIe=new WeakMap,uIe=new Map([[Int8Array,"int"],[Int16Array,"int"],[Int32Array,"int"],[Uint8Array,"uint"],[Uint16Array,"uint"],[Uint32Array,"uint"],[Float32Array,"float"]]),NR=i=>/e/g.test(i)?String(i).replace(/\+/g,""):(i=Number(i),i+(i%1?"":".0")),poe=i=>{if(i.writeUsageCount>0)return!0;if(i.subBuildsCache!==void 0){for(let e in i.subBuildsCache)if(poe(i.subBuildsCache[e]))return!0}return!1},W4=class{constructor(e,t,n){this.object=e,this.material=e&&e.material||null,this.geometry=e&&e.geometry||null,this.renderer=t,this.parser=n,this.scene=null,this.camera=null,this.nodes=new Set,this.sequentialNodes=new Set,this.updateNodes=[],this.updateBeforeNodes=[],this.updateAfterNodes=[],this.hashNodes={},this.observer=null,this.lightsNode=null,this.environmentNode=null,this.fogNode=null,this.clippingContext=null,this.hardwareClipping=!1,this.vertexShader=null,this.fragmentShader=null,this.computeShader=null,this.flowNodes={vertex:[],fragment:[],compute:[]},this.flowCode={vertex:"",fragment:"",compute:""},this.uniforms={vertex:[],fragment:[],compute:[],index:0},this.structs={vertex:[],fragment:[],compute:[],index:0},this.types={vertex:[],fragment:[],compute:[],index:0},this.bindings={vertex:{},fragment:{},compute:{}},this.bindingsIndexes={},this.bindGroups=null,this.attributes=[],this.bufferAttributes=[],this.varyings=[],this.codes={},this.vars={},this.declarations={},this.flow={code:""},this.chaining=[],this.stack=e4(),this.stacks=[],this.tab=" ",this.currentFunctionNode=null,this.context={material:this.material},this.cache=new uS,this.globalCache=this.cache,this.flowsData=new WeakMap,this.shaderStage=null,this.buildStage=null,this.subBuildLayers=[],this.activeStacks=[],this.subBuildFn=null,this.fnCall=null,Object.defineProperty(this,"id",{value:lIe++})}isFlatShading(){return this.material.flatShading===!0||this.geometry.hasAttribute("normal")===!1}isOpaque(){let e=this.material;return e.transparent===!1&&e.blending===Ts&&e.alphaToCoverage===!1}createRenderTarget(e,t,n){return new Ba(e,t,n)}createCubeRenderTarget(e,t){return new b4(e,t)}includes(e){return this.nodes.has(e)}getOutputType(e=0){let t="vec4",n=this.renderer.getRenderTarget();if(n!==null){let r=n.textures[e].type,s=n.textures[e].format,o="vec";r===Kr?o="ivec":r===xi&&(o="uvec"),s===Fd||s===kh?r===Kr?t="int":r===xi?t="uint":t="float":s===Ws||s===zh?t=`${o}2`:s===Nd||s===Ib?t=`${o}3`:t=`${o}4`}return t}getOutputStructName(){}_getBindGroup(e,t){let n=t[0].groupNode,r=n.shared;if(r)for(let o=1;o<t.length;o++)n!==t[o].groupNode&&(r=!1);let s;if(r){let o="";for(let u of t)if(u.isNodeUniformsGroup){u.uniforms.sort((f,d)=>f.nodeUniform.node.id-d.nodeUniform.node.id);for(let f of u.uniforms)o+=f.nodeUniform.node.id}else o+=u.nodeUniform.id;let a=this.renderer._currentRenderContext||this.renderer,l=Rte.get(a);l===void 0&&(l=new Map,Rte.set(a,l));let c=yx(o);s=l.get(c),s===void 0&&(s=new TS(e,t),l.set(c,s))}else s=new TS(e,t);return s}getBindGroupArray(e,t){let n=this.bindings[t],r=n[e];return r===void 0&&(this.bindingsIndexes[e]===void 0&&(this.bindingsIndexes[e]={binding:0,group:Object.keys(this.bindingsIndexes).length}),n[e]=r=[]),r}getBindings(){let e=this.bindGroups;if(e===null){let t={},n=this.bindings;for(let r of ZR)for(let s in n[r]){let o=n[r][s],a=t[s]||(t[s]=[]);for(let l of o)a.includes(l)===!1&&a.push(l)}e=[];for(let r in t){let s=t[r],o=this._getBindGroup(r,s);e.push(o)}this.bindGroups=e}return e}sortBindingGroups(){let e=this.getBindings();e.sort((t,n)=>t.bindings[0].groupNode.order-n.bindings[0].groupNode.order);for(let t=0;t<e.length;t++){let n=e[t];this.bindingsIndexes[n.name].group=t}}setHashNode(e,t){this.hashNodes[t]=e}addNode(e){this.nodes.has(e)===!1&&(this.nodes.add(e),this.setHashNode(e,e.getHash(this)))}addSequentialNode(e){let t=e.getUpdateBeforeType(),n=e.getUpdateAfterType();(t!==yn.NONE||n!==yn.NONE)&&this.sequentialNodes.add(e)}buildUpdateNodes(){for(let e of this.nodes)e.getUpdateType()!==yn.NONE&&this.updateNodes.push(e);for(let e of this.sequentialNodes){let t=e.getUpdateBeforeType(),n=e.getUpdateAfterType();t!==yn.NONE&&this.updateBeforeNodes.push(e),n!==yn.NONE&&this.updateAfterNodes.push(e)}}get currentNode(){return this.chaining[this.chaining.length-1]}isFilteredTexture(e){return e.magFilter===Mi||e.magFilter===A0||e.magFilter===qc||e.magFilter===Go||e.minFilter===Mi||e.minFilter===A0||e.minFilter===qc||e.minFilter===Go}getUniformBufferLimit(){return this.renderer.backend.capabilities.getUniformBufferLimit()}addChain(e){this.chaining.push(e)}removeChain(e){if(this.chaining.pop()!==e)throw new Error("THREE.NodeBuilder: Invalid node chaining!")}getMethod(e){return e}getTernary(){return null}getNodeFromHash(e){return this.hashNodes[e]}addFlow(e,t){return this.flowNodes[e].push(t),t}setContext(e){this.context=e}getContext(){return this.context}addContext(e){let t=this.getContext();return this.setContext({...this.context,...e}),t}getSharedContext(){let e={...this.context};return delete e.material,delete e.getUV,delete e.getOutput,delete e.getTextureLevel,delete e.getAO,delete e.getShadow,e}setCache(e){this.cache=e}getCache(){return this.cache}getCacheFromNode(e,t=!0){let n=this.getDataFromNode(e);return n.cache===void 0&&(n.cache=new uS(t?this.getCache():null)),n.cache}isAvailable(){return!1}getVertexIndex(){Xe("Abstract function.")}getInstanceIndex(){Xe("Abstract function.")}getDrawIndex(){Xe("Abstract function.")}getFrontFacing(){Xe("Abstract function.")}getFragCoord(){Xe("Abstract function.")}isFlipY(){return!1}isContextAssign(){return this.context.assign===!0}increaseUsage(e){let t=this.getDataFromNode(e);return t.usageCount=t.usageCount===void 0?1:t.usageCount+1,this.isContextAssign()?t.writeUsageCount=t.writeUsageCount===void 0?1:t.writeUsageCount+1:t.readUsageCount=t.readUsageCount===void 0?1:t.readUsageCount+1,t.usageCount}hasWriteUsage(e){let t=e.getShared(this),r=(t.isGlobal(this)?this.globalCache:this.cache).getData(t);if(r!==void 0){for(let s in r)if(poe(r[s]))return!0}return!1}generateTexture(){Xe("Abstract function.")}generateTextureLod(){Xe("Abstract function.")}generateArrayDeclaration(e,t){return this.getType(e)+"[ "+t+" ]"}generateArray(e,t,n=null){let r=this.generateArrayDeclaration(e,t)+"( ";for(let s=0;s<t;s++){let o=n?n[s]:null;o!==null?r+=o.build(this,e):r+=this.generateConst(e),s<t-1&&(r+=", ")}return r+=" )",r}generateStruct(e,t,n=null){let r=[];for(let s of t){let{name:o,type:a}=s;n&&n[o]&&n[o].isNode?r.push(n[o].build(this,a)):r.push(this.generateConst(a))}return e+"( "+r.join(", ")+" )"}generateConst(e,t=null){if(t===null&&(e==="float"||e==="int"||e==="uint"?t=0:e==="bool"?t=!1:e==="color"?t=new zt:e==="vec2"||e==="uvec2"||e==="ivec2"?t=new Oe:e==="vec3"||e==="uvec3"||e==="ivec3"?t=new re:(e==="vec4"||e==="uvec4"||e==="ivec4")&&(t=new xn)),e==="float")return NR(t);if(e==="int")return`${Math.round(t)}`;if(e==="uint")return t>=0?`${Math.round(t)}u`:"0u";if(e==="bool")return t?"true":"false";if(e==="color")return`${this.getType("vec3")}( ${NR(t.r)}, ${NR(t.g)}, ${NR(t.b)} )`;let n=this.getTypeLength(e),r=this.getComponentType(e),s=o=>this.generateConst(r,o);if(n===2)return`${this.getType(e)}( ${s(t.x)}, ${s(t.y)} )`;if(n===3)return`${this.getType(e)}( ${s(t.x)}, ${s(t.y)}, ${s(t.z)} )`;if(n===4&&e!=="mat2")return`${this.getType(e)}( ${s(t.x)}, ${s(t.y)}, ${s(t.z)}, ${s(t.w)} )`;if(n>=4&&t&&(t.isMatrix2||t.isMatrix3||t.isMatrix4))return`${this.getType(e)}( ${t.elements.map(s).join(", ")} )`;if(n>4)return`${this.getType(e)}()`;throw new Error(`THREE.NodeBuilder: Type '${e}' not found in generate constant attempt.`)}getType(e){return e==="color"?"vec3":e}hasGeometryAttribute(e){return this.geometry&&this.geometry.getAttribute(e)!==void 0}getAttribute(e,t){let n=this.attributes;for(let s of n)if(s.name===e)return s;let r=new q4(e,t);return this.registerDeclaration(r),n.push(r),r}getPropertyName(e){return e.name}isVector(e){return/vec\d/.test(e)}isMatrix(e){return/mat\d/.test(e)}isReference(e){return e==="void"||e==="property"||e==="sampler"||e==="samplerComparison"||e==="texture"||e==="cubeTexture"||e==="storageTexture"||e==="depthTexture"||e==="texture3D"}needsToWorkingColorSpace(){return!1}getComponentTypeFromTexture(e){let t=e.type;return e.isDepthTexture===!0?"float":t===Kr?"int":t===xi?"uint":"float"}getElementType(e){return e==="mat2"?"vec2":e==="mat3"?"vec3":e==="mat4"?"vec4":this.getComponentType(e)}getComponentType(e){if(e=this.getVectorType(e),e==="float"||e==="bool"||e==="int"||e==="uint")return e;let t=/(b|i|u|)(vec|mat)([2-4])/.exec(e);return t===null?null:t[1]==="b"?"bool":t[1]==="i"?"int":t[1]==="u"?"uint":"float"}getVectorType(e){return e==="color"?"vec3":e==="texture"||e==="cubeTexture"||e==="storageTexture"||e==="texture3D"?"vec4":e}getTypeFromLength(e,t="float"){if(e===1)return t;let n=sne(e),r=t==="float"?"":t[0];return/mat2/.test(t)===!0&&(n=n.replace("vec","mat")),r+n}getTypeFromArray(e){return uIe.get(e.constructor)}isInteger(e){return/int|uint|(i|u)vec/.test(e)}getTypeFromAttribute(e){let t=e;e.isInterleavedBufferAttribute&&(t=e.data);let n=t.array,r=e.itemSize,s=e.normalized,o;return!(e instanceof Qv)&&s!==!0&&(o=this.getTypeFromArray(n)),this.getTypeFromLength(r,o)}getTypeLength(e){let t=this.getVectorType(e),n=/vec([2-4])/.exec(t);return n!==null?Number(n[1]):t==="float"||t==="bool"||t==="int"||t==="uint"?1:/mat2/.test(e)===!0?4:/mat3/.test(e)===!0?9:/mat4/.test(e)===!0?16:0}getVectorFromMatrix(e){return e.replace("mat","vec")}changeComponentType(e,t){return this.getTypeFromLength(this.getTypeLength(e),t)}getIntegerType(e){let t=this.getComponentType(e);return t==="int"||t==="uint"?e:this.changeComponentType(e,"int")}setActiveStack(e){this.activeStacks.push(e)}removeActiveStack(e){if(this.activeStacks[this.activeStacks.length-1]===e)this.activeStacks.pop();else throw new Error("THREE.NodeBuilder: Invalid active stack removal.")}getActiveStack(){return this.activeStacks[this.activeStacks.length-1]}getBaseStack(){return this.activeStacks[0]}addStack(){this.stack=e4(this.stack);let e=pz();return this.stacks.push(e),fS(this.stack),this.stack}removeStack(){let e=this.stack;for(let t of e.nodes){let n=this.getDataFromNode(t);n.stack=e}return this.stack=e.parent,fS(this.stacks.pop()),e}getDataFromNode(e,t=this.shaderStage,n=null){n=n===null?e.isGlobal(this)?this.globalCache:this.cache:n;let r=n.getData(e);r===void 0&&(r={},n.setData(e,r)),r[t]===void 0&&(r[t]={});let s=r[t];if(this.subBuildLayers.length===0)return s;let o=r.any?r.any.subBuilds:null,a=this.getClosestSubBuild(o);return a&&(s.subBuildsCache===void 0&&(s.subBuildsCache={}),s=s.subBuildsCache[a]||(s.subBuildsCache[a]={}),s.subBuilds=o),s}getNodeProperties(e,t="any"){let n=this.getDataFromNode(e,t);return n.properties||(n.properties={outputNode:null})}getBufferAttributeFromNode(e,t,n=null){let r=this.getDataFromNode(e,"vertex"),s=r.bufferAttribute;if(s===void 0){let o=this.uniforms.index++;n===null&&(n="nodeAttribute"+o),s=new q4(n,t,e),this.bufferAttributes.push(s),r.bufferAttribute=s}return s}getStructTypeNode(e,t=this.shaderStage){return this.types[t][e]||null}getStructTypeFromNode(e,t,n=null,r=this.shaderStage){let s=this.getDataFromNode(e,r,this.globalCache),o=s.structType;if(o===void 0){let a=this.structs.index++;n===null&&(n="StructType"+a),o=new Vk(n,t),this.structs[r].push(o),this.types[r][n]=e,s.structType=o}return o}getOutputStructTypeFromNode(e,t){let n=this.getStructTypeFromNode(e,t,"OutputType","fragment");return n.output=!0,n}getUniformFromNode(e,t,n=this.shaderStage,r=null){let s=this.getDataFromNode(e,n,this.globalCache),o=s.uniform;if(o===void 0){let a=this.uniforms.index++;o=new Uk(r||"nodeUniform"+a,t,e),this.uniforms[n].push(o),this.registerDeclaration(o),s.uniform=o}return o}getVarFromNode(e,t=null,n=e.getNodeType(this),r=this.shaderStage,s=!1){let o=this.getDataFromNode(e,r),a=this.getSubBuildProperty("variable",o.subBuilds),l=o[a];if(l===void 0){let c=s?"_const":"_var",u=this.vars[r]||(this.vars[r]=[]),f=this.vars[c]||(this.vars[c]=0);t===null&&(t=(s?"nodeConst":"nodeVar")+f,this.vars[c]++),a!=="variable"&&(t=this.getSubBuildProperty(t,o.subBuilds));let d=e.getArrayCount(this);l=new H4(t,n,s,d),s||u.push(l),this.registerDeclaration(l),o[a]=l}return l}isDeterministic(e){if(e.isMathNode)return this.isDeterministic(e.aNode)&&(e.bNode?this.isDeterministic(e.bNode):!0)&&(e.cNode?this.isDeterministic(e.cNode):!0);if(e.isOperatorNode)return this.isDeterministic(e.aNode)&&(e.bNode?this.isDeterministic(e.bNode):!0);if(e.isArrayNode){if(e.values!==null){for(let t of e.values)if(!this.isDeterministic(t))return!1}return!0}else if(e.isConstNode)return!0;return!1}getVaryingFromNode(e,t=null,n=e.getNodeType(this),r=null,s=null){let o=this.getDataFromNode(e,"any"),a=this.getSubBuildProperty("varying",o.subBuilds),l=o[a];if(l===void 0){let c=this.varyings,u=c.length;t===null&&(t="nodeVarying"+u),a!=="varying"&&(t=this.getSubBuildProperty(t,o.subBuilds)),l=new kk(t,n,r,s),c.push(l),this.registerDeclaration(l),o[a]=l}return l}registerDeclaration(e){let t=this.shaderStage,n=this.declarations[t]||(this.declarations[t]={}),r=e.name,s=r,o=this.getPropertyName(e),a=1;for(;n[o]!==void 0;)s=r+"_"+a++,e.name=s,o=this.getPropertyName(e);s!==r&&Xe(`TSL: Declaration name '${r}' of '${e.type}' already in use. Renamed to '${s}'.`),n[o]=e}getCodeFromNode(e,t,n=this.shaderStage){let r=this.getDataFromNode(e),s=r.code;if(s===void 0){let o=this.codes[n]||(this.codes[n]=[]),a=o.length;s=new zk("nodeCode"+a,t),o.push(s),r.code=s}return s}addFlowCodeHierarchy(e,t){let{flowCodes:n,flowCodeBlock:r}=this.getDataFromNode(e),s=!0,o=t;for(;o;){if(r.get(o)===!0){s=!1;break}o=this.getDataFromNode(o).parentNodeBlock}if(s)for(let a of n)this.addLineFlowCode(a)}addLineFlowCodeBlock(e,t,n){let r=this.getDataFromNode(e),s=r.flowCodes||(r.flowCodes=[]),o=r.flowCodeBlock||(r.flowCodeBlock=new WeakMap);s.push(t),o.set(n,!0)}addLineFlowCode(e,t=null){return e===""?this:(t!==null&&this.context.nodeBlock&&this.addLineFlowCodeBlock(t,e,this.context.nodeBlock),e=this.tab+e,/;\s*$/.test(e)||(e=e+`;4161+`),this.flow.code+=e,this)}addFlowCode(e){return this.flow.code+=e,this}addFlowTab(){return this.tab+=" ",this}removeFlowTab(){return this.tab=this.tab.slice(0,-1),this}getFlowData(e){return this.flowsData.get(e)}flowNode(e){let t=e.getNodeType(this),n=this.flowChildNode(e,t);return this.flowsData.set(e,n),n}addInclude(e){this.currentFunctionNode!==null&&this.currentFunctionNode.includes.push(e)}buildFunctionNode(e){let t=this.renderer.backend,n=Pte.get(t);n===void 0&&(n=new WeakMap,Pte.set(t,n));let r=n.get(e);if(r===void 0){r=new U4;let s=this.currentFunctionNode;this.currentFunctionNode=r,r.code=this.buildFunctionCode(e),this.currentFunctionNode=s,n.set(e,r)}return r}flowShaderNode(e){let t=e.layout,n={[Symbol.iterator](){let o=0,a=Object.values(this);return{next:()=>({value:a[o],done:o++>=a.length})}}};for(let o of t.inputs)n[o.name]=new I4(o.type,o.name);e.layout=null;let r=e.call(n),s=this.flowStagesNode(r,t.type);return e.layout=t,s}flowBuildStage(e,t,n=null){let r=this.getBuildStage();this.setBuildStage(t);let s=e.build(this,n);return this.setBuildStage(r),s}flowStagesNode(e,t=null){let n=this.flow,r=this.vars,s=this.declarations,o=this.cache,a=this.buildStage,l=this.stack,c={code:""};this.flow=c,this.vars={},this.declarations={},this.cache=new uS,this.stack=e4();for(let u of YR)this.setBuildStage(u),c.result=e.build(this,t);return c.vars=this.getVars(this.shaderStage),this.flow=n,this.vars=r,this.declarations=s,this.cache=o,this.stack=l,this.setBuildStage(a),c}getFunctionOperator(){return null}buildFunctionCode(){Xe("Abstract function.")}flowChildNode(e,t=null){let n=this.flow,r={code:""};return this.flow=r,r.result=e.build(this,t),this.flow=n,r}flowNodeFromShaderStage(e,t,n=null,r=null){let s=this.tab,o=this.cache,a=this.shaderStage,l=this.context;this.setShaderStage(e);let c={...this.context};delete c.nodeBlock,this.cache=this.globalCache,this.tab=" ",this.context=c;let u=null;if(this.buildStage==="generate"){let f=this.flowChildNode(t,n);r!==null&&(f.code+=`${this.tab+r} = ${f.result};41624162 `),this.flowCode[e]=this.flowCode[e]+f.code,u=f}else u=t.build(this);return this.setShaderStage(a),this.cache=o,this.tab=s,this.context=l,u}getAttributesArray(){return this.attributes.concat(this.bufferAttributes)}getAttributes(){Xe("Abstract function.")}getVaryings(){Xe("Abstract function.")}getVar(e,t,n=null){return`${n!==null?this.generateArrayDeclaration(e,n):this.getType(e)} ${t}`}getVars(e,t=!1){let n=[],r=this.vars[e];if(r!==void 0)for(let s of r)n.push(`${this.getVar(s.type,s.name,s.count)};`);return n.join(t?`41634163 `:`41644164 `)}getUniforms(){Xe("Abstract function.")}getCodes(e){let t=this.codes[e],n="";if(t!==void 0)for(let r of t)n+=r.code+`4165-`;return n}getHash(){return this.vertexShader+this.fragmentShader+this.computeShader}setShaderStage(e){this.shaderStage=e}getShaderStage(){return this.shaderStage}setBuildStage(e){this.buildStage=e}getBuildStage(){return this.buildStage}buildCode(){Xe("Abstract function.")}get subBuild(){return this.subBuildLayers[this.subBuildLayers.length-1]||null}addSubBuild(e){this.subBuildLayers.push(e)}removeSubBuild(){return this.subBuildLayers.pop()}getClosestSubBuild(e){let t;if(e&&e.isNode?e.isShaderCallNodeInternal?t=e.shaderNode.subBuilds:e.isStackNode?t=[e.subBuild]:t=this.getDataFromNode(e,"any").subBuilds:e instanceof Set?t=[...e]:t=e,!t)return null;let n=this.subBuildLayers;for(let r=t.length-1;r>=0;r--){let s=t[r];if(n.includes(s))return s}return null}getSubBuildOutput(e){return this.getSubBuildProperty("outputNode",e)}getSubBuildProperty(e="",t=null){let n;t!==null?n=this.getClosestSubBuild(t):n=this.subBuildFn;let r;return n?r=e?n+"_"+e:n:r=e,r}prebuild(){let{object:e,renderer:t,material:n}=this;if(t.contextNode.isContextNode===!0?this.context={...this.context,...t.contextNode.getFlowContextData()}:ze('NodeBuilder: "renderer.contextNode" must be an instance of `context()`.'),n&&n.contextNode&&(n.contextNode.isContextNode===!0?this.context={...this.context,...n.contextNode.getFlowContextData()}:ze('NodeBuilder: "material.contextNode" must be an instance of `context()`.')),n!==null){let r=t.library.fromMaterial(n);r===null&&(ze(`NodeBuilder: Material "${n.type}" is not compatible.`),r=new Rr),r.build(this)}else this.addFlow("compute",e)}build(){this.prebuild();for(let e of VR){this.setBuildStage(e),this.context.position&&this.context.position.isNode&&this.flowNodeFromShaderStage("vertex",this.context.position);for(let t of GR){this.setShaderStage(t);let n=this.flowNodes[t];for(let r of n)e==="generate"?this.flowNode(r):r.build(this)}}return this.setBuildStage(null),this.setShaderStage(null),this.buildCode(),this.buildUpdateNodes(),this}async buildAsync(){this.prebuild();for(let e of VR){this.setBuildStage(e),this.context.position&&this.context.position.isNode&&this.flowNodeFromShaderStage("vertex",this.context.position);for(let t of GR){this.setShaderStage(t);let n=this.flowNodes[t];for(let r of n)e==="generate"?this.flowNode(r):r.build(this);await Y8()}}return this.setBuildStage(null),this.setShaderStage(null),this.buildCode(),this.buildUpdateNodes(),this}getSharedDataFromNode(e){let t=CIe.get(e);return t===void 0&&(t={}),t}getNodeUniform(e,t){let n=this.getSharedDataFromNode(e),r=n.cache;if(r===void 0){if(t==="float"||t==="int"||t==="uint")r=new Rk(e);else if(t==="vec2"||t==="ivec2"||t==="uvec2")r=new Ik(e);else if(t==="vec3"||t==="ivec3"||t==="uvec3")r=new Pk(e);else if(t==="vec4"||t==="ivec4"||t==="uvec4")r=new Lk(e);else if(t==="color")r=new Dk(e);else if(t==="mat2")r=new Nk(e);else if(t==="mat3")r=new Fk(e);else if(t==="mat4")r=new Bk(e);else throw new Error(`THREE.NodeBuilder: Uniform "${t}" not implemented.`);n.cache=r}return r}format(e,t,n){if(t=this.getVectorType(t),n=this.getVectorType(n),t===n||n===null||this.isReference(n))return e;let r=this.getTypeLength(t),s=this.getTypeLength(n);return r===16&&s===9?`${this.getType(n)}( ${e}[ 0 ].xyz, ${e}[ 1 ].xyz, ${e}[ 2 ].xyz )`:r===9&&s===4?`${this.getType(n)}( ${e}[ 0 ].xy, ${e}[ 1 ].xy )`:r>4||s>4||s===0?e:r===s?`${this.getType(n)}( ${e} )`:r>s?(e=n==="bool"?`all( ${e} )`:`${e}.${"xyz".slice(0,s)}`,this.format(e,this.getTypeFromLength(s,this.getComponentType(t)),n)):s===4&&r>1?`${this.getType(n)}( ${this.format(e,t,"vec3")}, 1.0 )`:r===2?`${this.getType(n)}( ${this.format(e,t,"vec2")}, 0.0 )`:(r===1&&s>1&&t!==this.getComponentType(n)&&(e=`${this.getType(this.getComponentType(n))}( ${e} )`),`${this.getType(n)}( ${e} )`)}getSignature(){return`// Three.js r${"185"} - Node System4166-`}needsPreviousData(){let e=this.renderer.getMRT();return e&&e.has("velocity")||Bte(this.object).useVelocity===!0}},U4=class{constructor(){this.time=0,this.deltaTime=0,this.frameId=0,this.renderId=0,this.updateMap=new WeakMap,this.updateBeforeMap=new WeakMap,this.updateAfterMap=new WeakMap,this.renderer=null,this.material=null,this.camera=null,this.object=null,this.scene=null}_getMaps(e,t){let n=e.get(t);return n===void 0&&(n={renderId:0,frameId:0},e.set(t,n)),n}updateBeforeNode(e){let t=e.getUpdateBeforeType(),n=e.updateReference(this);if(t===yn.FRAME){let r=this._getMaps(this.updateBeforeMap,n);if(r.frameId!==this.frameId){let s=r.frameId;r.frameId=this.frameId,e.updateBefore(this)===!1&&(r.frameId=s)}}else if(t===yn.RENDER){let r=this._getMaps(this.updateBeforeMap,n);if(r.renderId!==this.renderId){let s=r.renderId;r.renderId=this.renderId,e.updateBefore(this)===!1&&(r.renderId=s)}}else t===yn.OBJECT&&e.updateBefore(this)}updateAfterNode(e){let t=e.getUpdateAfterType(),n=e.updateReference(this);if(t===yn.FRAME){let r=this._getMaps(this.updateAfterMap,n);r.frameId!==this.frameId&&e.updateAfter(this)!==!1&&(r.frameId=this.frameId)}else if(t===yn.RENDER){let r=this._getMaps(this.updateAfterMap,n);r.renderId!==this.renderId&&e.updateAfter(this)!==!1&&(r.renderId=this.renderId)}else t===yn.OBJECT&&e.updateAfter(this)}updateNode(e){let t=e.getUpdateType(),n=e.updateReference(this);if(t===yn.FRAME){let r=this._getMaps(this.updateMap,n);r.frameId!==this.frameId&&e.update(this)!==!1&&(r.frameId=this.frameId)}else if(t===yn.RENDER){let r=this._getMaps(this.updateMap,n);r.renderId!==this.renderId&&e.update(this)!==!1&&(r.renderId=this.renderId)}else t===yn.OBJECT&&e.update(this)}update(){this.frameId++,this.lastTime===void 0&&(this.lastTime=performance.now()),this.deltaTime=(performance.now()-this.lastTime)/1e3,this.lastTime=performance.now(),this.time+=this.deltaTime}},xS=class{constructor(e,t,n=null,r="",s=!1){this.type=e,this.name=t,this.count=n,this.qualifier=r,this.isConst=s}};xS.isNodeFunctionInput=!0;var Ok=class extends Yd{static get type(){return"AmbientLightNode"}constructor(e=null){super(e)}setup({context:e}){e.irradiance.addAssign(this.colorNode)}},Uk=class extends Yd{static get type(){return"DirectionalLightNode"}constructor(e=null){super(e)}setupDirect(){let e=this.colorNode;return{lightDirection:uV(this.light),lightColor:e}}},kk=class extends Yd{static get type(){return"HemisphereLightNode"}constructor(e=null){super(e),this.lightPositionNode=lV(e),this.lightDirectionNode=this.lightPositionNode.normalize(),this.groundColorNode=Xt(new zt).setGroup(Jt)}update(e){let{light:t}=this;super.update(e),this.lightPositionNode.object3d=t,this.groundColorNode.value.copy(t.groundColor).multiplyScalar(t.intensity)}setup(e){let{colorNode:t,groundColorNode:n,lightDirectionNode:r}=this,o=xm.dot(r).mul(.5).add(.5),a=Qn(n,t,o);e.context.irradiance.addAssign(a)}},yS=class extends Yd{static get type(){return"SpotLightNode"}constructor(e=null){super(e),this.coneCosNode=Xt(0).setGroup(Jt),this.penumbraCosNode=Xt(0).setGroup(Jt),this.cutoffDistanceNode=Xt(0).setGroup(Jt),this.decayExponentNode=Xt(0).setGroup(Jt),this.colorNode=Xt(this.color).setGroup(Jt)}update(e){super.update(e);let{light:t}=this;this.coneCosNode.value=Math.cos(t.angle),this.penumbraCosNode.value=Math.cos(t.angle*(1-t.penumbra)),this.cutoffDistanceNode.value=t.distance,this.decayExponentNode.value=t.decay}getSpotAttenuation(e,t){let{coneCosNode:n,penumbraCosNode:r}=this;return fc(n,r,t)}getLightCoord(e){let t=e.getNodeProperties(this),n=t.projectionUV;return n===void 0&&(n=xse(this.light,e.context.positionWorld),t.projectionUV=n),n}setupDirect(e){let{colorNode:t,cutoffDistanceNode:n,decayExponentNode:r,light:s}=this,o=this.getLightVector(e),a=o.normalize(),l=a.dot(uV(s)),c=this.getSpotAttenuation(e,l),u=o.length(),f=fV({lightDistance:u,cutoffDistance:n,decayExponent:r}),d=t.mul(c).mul(f),A,y;return s.colorNode?(y=this.getLightCoord(e),A=s.colorNode(y)):s.map&&(y=this.getLightCoord(e),A=fi(s.map,y.xy).onRenderUpdate(()=>s.map)),A&&(d=y.mul(2).sub(1).abs().lessThan(1).all().select(d.mul(A),d)),{lightColor:d,lightDirection:a}}},zk=class extends yS{static get type(){return"IESSpotLightNode"}constructor(e=null){super(e),this._iesTextureNode=null}getSpotAttenuation(e,t){let n=this.light.iesMap,r=null;if(n&&n.isTexture===!0){let s=t.acos().mul(1/Math.PI);this._iesTextureNode=fi(n,dt(s,0),0),r=this._iesTextureNode.r}else r=super.getSpotAttenuation(e,t);return r}update(e){super.update(e),this._iesTextureNode!==null&&this.light.iesMap&&(this._iesTextureNode.value=this.light.iesMap)}},Vk=class extends Yd{static get type(){return"LightProbeNode"}constructor(e=null){super(e);let t=[];for(let n=0;n<9;n++)t.push(new re);this.lightProbe=Xo(t)}update(e){let{light:t}=this;super.update(e);for(let n=0;n<9;n++)this.lightProbe.array[n].copy(t.sh.coefficients[n]).multiplyScalar(t.intensity)}setup(e){let t=Gse(xm,this.lightProbe);e.context.irradiance.addAssign(t)}},IIe=me(([i,e])=>{let t=i.abs().sub(e);return vf(zr(t,0)).add(Rl(zr(t.x,t.y),0))}),Gk=class extends yS{static get type(){return"ProjectorLightNode"}update(e){super.update(e);let t=this.light;if(this.penumbraCosNode.value=Math.min(Math.cos(t.angle*(1-t.penumbra)),.99999),t.aspect===null){let n=1;t.map!==null&&(n=t.map.width/t.map.height),t.shadow.aspect=n}else t.shadow.aspect=t.aspect}getSpotAttenuation(e){let t=oe(0),n=this.penumbraCosNode,r=LI(this.light).mul(e.context.positionWorld||_f);return $t(r.w.greaterThan(0),()=>{let s=r.xyz.div(r.w),o=IIe(s.xy.sub(dt(.5)),dt(.5)),a=hc(-1,ai(1,oz(n)).sub(1));t.assign(gI(o.mul(-2).mul(a)))}),t}},GO=new cn,MR=new cn,zw=null,qk=class extends Yd{static get type(){return"RectAreaLightNode"}constructor(e=null){super(e),this.halfHeight=Xt(new re).setGroup(Jt),this.halfWidth=Xt(new re).setGroup(Jt),this.updateType=yn.RENDER}update(e){super.update(e);let{light:t}=this,n=e.camera.matrixWorldInverse;MR.identity(),GO.copy(t.matrixWorld),GO.premultiply(n),MR.extractRotation(GO),this.halfWidth.value.set(t.width*.5,0,0),this.halfHeight.value.set(0,t.height*.5,0),this.halfWidth.value.applyMatrix4(MR),this.halfHeight.value.applyMatrix4(MR)}setupDirectRectArea(e){let t,n;e.isAvailable("float32Filterable")?(t=fi(zw.LTC_FLOAT_1),n=fi(zw.LTC_FLOAT_2)):(t=fi(zw.LTC_HALF_1),n=fi(zw.LTC_HALF_2));let{colorNode:r,light:s}=this,o=cV(s);return{lightColor:r,lightPosition:o,halfWidth:this.halfWidth,halfHeight:this.halfHeight,ltc_1:t,ltc_2:n}}static setLTC(e){zw=e}},k4=class{parseFunction(){Xe("Abstract function.")}},bS=class{constructor(e,t,n="",r=""){this.type=e,this.inputs=t,this.name=n,this.precision=r}getCode(){Xe("Abstract function.")}};bS.isNodeFunction=!0;var PIe=/^\s*(highp|mediump|lowp)?\s*([a-z_0-9]+)\s*([a-z_0-9]+)?\s*\(([\s\S]*?)\)/i,LIe=/[a-z_0-9]+/ig,ote="#pragma main",DIe=i=>{i=i.trim();let e=i.indexOf(ote),t=e!==-1?i.slice(e+ote.length):i,n=t.match(PIe);if(n!==null&&n.length===5){let r=n[4],s=[],o=null;for(;(o=LIe.exec(r))!==null;)s.push(o);let a=[],l=0;for(;l<s.length;){let y=s[l][0]==="const";y===!0&&l++;let w=s[l][0];w==="in"||w==="out"||w==="inout"?l++:w="";let S=s[l++][0],T=Number.parseInt(s[l][0]);Number.isNaN(T)===!1?l++:T=null;let R=s[l++][0];a.push(new xS(S,R,T,w,y))}let c=t.substring(n[0].length),u=n[3]!==void 0?n[3]:"",f=n[2],d=n[1]!==void 0?n[1]:"",A=e!==-1?i.slice(0,e):"";return{type:f,inputs:a,name:u,precision:d,inputsCode:r,blockCode:c,headerCode:A}}else throw new Error("THREE.FunctionNode: Function is not a GLSL code.")},Hk=class extends bS{constructor(e){let{type:t,inputs:n,name:r,precision:s,inputsCode:o,blockCode:a,headerCode:l}=DIe(e);super(t,n,r,s),this.inputsCode=o,this.blockCode=a,this.headerCode=l}getCode(e=this.name){let t,n=this.blockCode;if(n!==""){let{type:r,inputsCode:s,headerCode:o,precision:a}=this,l=`${r} ${e} ( ${s.trim()} )`;a!==""&&(l=`${a} ${l}`),t=o+l+n}else t="";return t}},Wk=class extends k4{parseFunction(e){return new Hk(e)}},Yc=[],kd=[],ate=Xt(0,"int").setGroup(Jt),jk=class extends Tf{constructor(e,t){super(),this.renderer=e,this.backend=t,this.nodeFrame=new U4,this.nodeBuilderCache=new Map,this.callHashCache=new Sf,this.groupsData=new Sf,this._buildQueue=[],this._buildInProgress=!1,this.cacheLib={}}updateGroup(e){let t=e.groupNode;if(t.updateType===yn.OBJECT)return!0;Yc[0]=t,Yc[1]=e;let n=this.groupsData.get(Yc);return n===void 0&&this.groupsData.set(Yc,n={}),Yc[0]=null,Yc[1]=null,n.version!==t.version?(n.version=t.version,!0):!1}getForRenderCacheKey(e){return e.initialCacheKey}_createNodeBuilder(e,t){let n=this.backend.createNodeBuilder(e.object,this.renderer);return n.scene=e.scene,n.material=t,n.camera=e.camera,n.context.material=t,n.lightsNode=e.lightsNode,n.environmentNode=this.getEnvironmentNode(e.scene),n.fogNode=this.getFogNode(e.scene),n.clippingContext=e.clippingContext,this.renderer.getOutputRenderTarget()&&this.renderer.getOutputRenderTarget().multiview&&n.enableMultiview(),n}getForRender(e,t=!1){let n=this.get(e),r=n.nodeBuilderState;if(r===void 0){let{nodeBuilderCache:s}=this,o=this.getForRenderCacheKey(e);if(r=s.get(o),r===void 0){let a=async()=>{let l=this._createNodeBuilder(e,e.material);try{t?await l.buildAsync():l.build()}catch(c){l=this._createNodeBuilder(e,new Rr),t?await l.buildAsync():l.build(),ze("TSL: "+c)}return l};if(t)return a().then(l=>(r=this._createNodeBuilderState(l),s.set(o,r),r.usedTimes++,n.nodeBuilderState=r,r));{let l=this._createNodeBuilder(e,e.material);try{l.build()}catch(c){l=this._createNodeBuilder(e,new Rr),l.build();let u=c.stackTrace;!u&&c.stack&&(u=new es(c.stack)),ze("TSL: "+c,u)}r=this._createNodeBuilderState(l),s.set(o,r)}}r.usedTimes++,n.nodeBuilderState=r}return r}getForRenderAsync(e){let t=this.getForRender(e,!0);return t.then?t:Promise.resolve(t)}getForRenderDeferred(e){let t=this.get(e);if(t.nodeBuilderState!==void 0)return t.nodeBuilderState;let n=this.getForRenderCacheKey(e),r=this.nodeBuilderCache.get(n);return r!==void 0?(r.usedTimes++,t.nodeBuilderState=r,r):(t.pendingBuild!==!0&&(t.pendingBuild=!0,this._buildQueue.push(()=>this.getForRenderAsync(e).then(()=>{t.pendingBuild=!1})),this._processBuildQueue()),null)}_processBuildQueue(){if(this._buildInProgress||this._buildQueue.length===0)return;this._buildInProgress=!0,this._buildQueue.shift()().then(()=>{this._buildInProgress=!1,this._processBuildQueue()})}delete(e){if(e.isRenderObject){let t=this.get(e).nodeBuilderState;t!==void 0&&(t.usedTimes--,t.usedTimes===0&&this.nodeBuilderCache.delete(this.getForRenderCacheKey(e)))}return super.delete(e)}getForCompute(e){let t=this.get(e),n=t.nodeBuilderState;if(n===void 0||t.version!==e.version){let r=this.backend.createNodeBuilder(e,this.renderer);r.build(),n=this._createNodeBuilderState(r),t.nodeBuilderState=n,t.version=e.version}return n}_createNodeBuilderState(e){return new Ak(e.vertexShader,e.fragmentShader,e.computeShader,e.getAttributesArray(),e.getBindings(),e.updateNodes,e.updateBeforeNodes,e.updateAfterNodes,e.observer,e.hardwareClipping,e.transforms)}getEnvironmentNode(e){if(this.renderer.lighting.enabled===!1)return null;this.updateEnvironment(e);let t=null;if(e.environmentNode&&e.environmentNode.isNode)t=e.environmentNode;else{let n=this.get(e);n.environmentNode&&(t=n.environmentNode)}return t}getBackgroundNode(e){this.updateBackground(e);let t=null;if(e.backgroundNode&&e.backgroundNode.isNode)t=e.backgroundNode;else{let n=this.get(e);n.backgroundNode&&(t=n.backgroundNode)}return t}getFogNode(e){return this.updateFog(e),e.fogNode||this.get(e).fogNode||null}getCacheKey(e,t){Yc[0]=e,Yc[1]=t;let n=this.renderer.info.calls,r=this.callHashCache.get(Yc)||{};if(r.callId!==n){if(kd.push(this.renderer.getOutputRenderTarget()&&this.renderer.getOutputRenderTarget().multiview?1:0),kd.push(this.renderer.lighting.enabled?1:0),this.renderer.lighting.enabled){kd.push(t.getCacheKey(!0)),kd.push(this.renderer.shadowMap.enabled?1:0),kd.push(this.renderer.shadowMap.type);let o=this.getEnvironmentNode(e);o&&kd.push(o.getCacheKey())}let s=this.getFogNode(e);s&&kd.push(s.getCacheKey()),r.callId=n,r.cacheKey=ES(kd),this.callHashCache.set(Yc,r),kd.length=0}return Yc[0]=null,Yc[1]=null,r.cacheKey}get isToneMappingState(){return!this.renderer.getRenderTarget()}updateBackground(e){let t=this.get(e),n=e.background;if(n){let r=e.backgroundBlurriness===0&&t.backgroundBlurriness>0||e.backgroundBlurriness>0&&t.backgroundBlurriness===0;if(t.background!==n||r){let s=this.getCacheNode("background",n,()=>{if(n.isCubeTexture===!0||n.mapping===u0||n.mapping===h0||n.mapping===Bh){if(e.backgroundBlurriness>0||n.mapping===Bh)return nV(n);{let o;return n.isCubeTexture===!0?o=Ka(n):o=fi(n),Ore(o)}}else{if(n.isTexture===!0)return fi(n,ju.flipY()).setUpdateMatrix(!0);n.isColor!==!0&&ze("WebGPUNodes: Unsupported background configuration.",n)}},r);t.backgroundNode=s,t.background=n,t.backgroundBlurriness=e.backgroundBlurriness}}else t.backgroundNode&&(delete t.backgroundNode,delete t.background)}getCacheNode(e,t,n,r=!1){let s=this.cacheLib[e]||(this.cacheLib[e]=new WeakMap),o=s.get(t);return(o===void 0||r)&&(o=n(),s.set(t,o)),o}updateFog(e){let t=this.get(e),n=e.fog;if(n){if(t.fog!==n){let r=this.getCacheNode("fog",n,()=>{if(n.isFogExp2){let s=mr("color","color",n).setGroup(Jt),o=mr("density","float",n).setGroup(Jt);return ok(s,_se(o))}else if(n.isFog){let s=mr("color","color",n).setGroup(Jt),o=mr("near","float",n).setGroup(Jt),a=mr("far","float",n).setGroup(Jt);return ok(s,vse(o,a))}else ze("Renderer: Unsupported fog configuration.",n)});t.fogNode=r,t.fog=n}}else delete t.fogNode,delete t.fog}updateEnvironment(e){let t=this.get(e),n=e.environment;if(n){if(t.environment!==n){let r=this.getCacheNode("environment",n,()=>{if(n.isCubeTexture===!0)return Ka(n);if(n.isTexture===!0)return fi(n);ze("Nodes: Unsupported environment configuration.",n)});t.environmentNode=r,t.environment=n}}else t.environmentNode&&(delete t.environmentNode,delete t.environment)}getNodeFrame(e=this.renderer,t=null,n=null,r=null,s=null){let o=this.nodeFrame;return o.renderer=e,o.scene=t,o.object=n,o.camera=r,o.material=s,o}getNodeFrameForRender(e){return this.getNodeFrame(e.renderer,e.scene,e.object,e.camera,e.material)}getOutputCacheKey(){let e=this.renderer;return e.toneMapping+","+e.currentColorSpace+","+e.xr.isPresenting}getOutputNode(e){let t=this.renderer,n;return e.isArrayTexture?this.backend.isWebGLBackend?n=fi(e,ju).depth(Qd("gl_ViewID_OVR")).renderOutput(t.toneMapping,t.currentColorSpace):n=fi(e,ju).depth(ate).renderOutput(t.toneMapping,t.currentColorSpace):n=fi(e,ju).renderOutput(t.toneMapping,t.currentColorSpace),n}setOutputLayerIndex(e){ate.value=e}updateBefore(e){let t=e.getNodeBuilderState();for(let n of t.updateBeforeNodes)this.getNodeFrameForRender(e).updateBeforeNode(n)}updateAfter(e){let t=e.getNodeBuilderState();for(let n of t.updateAfterNodes)this.getNodeFrameForRender(e).updateAfterNode(n)}updateForCompute(e){let t=this.getNodeFrame(),n=this.getForCompute(e);for(let r of n.updateNodes)t.updateNode(r)}updateForRender(e){let t=this.getNodeFrameForRender(e),n=e.getNodeBuilderState();for(let r of n.updateNodes)t.updateNode(r)}needsRefresh(e){let t=this.getNodeFrameForRender(e);return e.getMonitor().needsRefresh(e,t)}dispose(){super.dispose(),this.nodeFrame=new U4,this.nodeBuilderCache=new Map,this.cacheLib={}}},qO=new Da,z4=class i{constructor(e=null){this.version=0,this.clipIntersection=null,this.cacheKey="",this.shadowPass=!1,this.viewMatrix=new cn,this.viewNormalMatrix=new Mn,this.clippingGroupContexts=new WeakMap,this.intersectionPlanes=[],this.unionPlanes=[],this.parentVersion=null,e!==null&&(this.viewMatrix=e.viewMatrix,this.viewNormalMatrix=e.viewNormalMatrix,this.clippingGroupContexts=e.clippingGroupContexts,this.shadowPass=e.shadowPass)}projectPlanes(e,t,n){let r=e.length;for(let s=0;s<r;s++){qO.copy(e[s]).applyMatrix4(this.viewMatrix,this.viewNormalMatrix);let o=t[n+s],a=qO.normal;o.x=-a.x,o.y=-a.y,o.z=-a.z,o.w=qO.constant}}updateGlobal(e,t){this.shadowPass=e.overrideMaterial!==null&&e.overrideMaterial.isShadowPassMaterial,this.viewMatrix.copy(t.matrixWorldInverse),this.viewNormalMatrix.getNormalMatrix(this.viewMatrix)}update(e,t){let n=!1;e.version!==this.parentVersion&&(this.intersectionPlanes=Array.from(e.intersectionPlanes),this.unionPlanes=Array.from(e.unionPlanes),this.parentVersion=e.version),this.clipIntersection!==t.clipIntersection&&(this.clipIntersection=t.clipIntersection,this.clipIntersection?this.unionPlanes.length=e.unionPlanes.length:this.intersectionPlanes.length=e.intersectionPlanes.length);let r=t.clippingPlanes,s=r.length,o,a;if(this.clipIntersection?(o=this.intersectionPlanes,a=e.intersectionPlanes.length):(o=this.unionPlanes,a=e.unionPlanes.length),o.length!==a+s){o.length=a+s;for(let l=0;l<s;l++)o[a+l]=new xn;n=!0}this.projectPlanes(r,o,a),n&&(this.version++,this.cacheKey=`${this.intersectionPlanes.length}:${this.unionPlanes.length}`)}getGroupContext(e){if(this.shadowPass&&!e.clipShadows)return this;let t=this.clippingGroupContexts.get(e);return t===void 0&&(t=new i(this),this.clippingGroupContexts.set(e,t)),t.update(this,e),t}get unionClippingCount(){return this.unionPlanes.length}},Xk=class{constructor(e,t,n){this.bundleGroup=e,this.camera=t,this.renderContext=n}},K0=[],$k=class{constructor(){this.bundles=new Sf}get(e,t,n){let r=this.bundles;K0[0]=e,K0[1]=t,K0[2]=n;let s=r.get(K0);return s===void 0&&(s=new Xk(e,t,n),r.set(K0,s)),K0[0]=null,K0[1]=null,K0[2]=null,s}dispose(){this.bundles=new Sf}},V4=class{constructor(){this.lightNodes=new WeakMap,this.materialNodes=new Map,this.toneMappingNodes=new Map}fromMaterial(e){if(e.isNodeMaterial)return e;let t=null,n=this.getMaterialNodeClass(e.type);if(n!==null){t=new n;for(let r in e)t[r]=e[r]}return t}addToneMapping(e,t){this.addType(e,t,this.toneMappingNodes)}getToneMappingFunction(e){return this.toneMappingNodes.get(e)||null}getMaterialNodeClass(e){return this.materialNodes.get(e)||null}addMaterial(e,t){this.addType(e,t,this.materialNodes)}getLightNodeClass(e){return this.lightNodes.get(e)||null}addLight(e,t){this.addClass(e,t,this.lightNodes)}addType(e,t,n){if(n.has(t)){Xe(`Redefinition of node ${t}`);return}if(typeof e!="function")throw new Error(`THREE.NodeLibrary: Node class ${e.name} is not a class.`);if(typeof t=="function"||typeof t=="object")throw new Error(`THREE.NodeLibrary: Base class ${t} is not a class.`);n.set(t,e)}addClass(e,t,n){if(n.has(t)){Xe(`Redefinition of node ${t.name}`);return}if(typeof e!="function")throw new Error(`THREE.NodeLibrary: Node class ${e.name} is not a class.`);if(typeof t!="function")throw new Error(`THREE.NodeLibrary: Base class ${t.name} is not a class.`);n.set(t,e)}},NIe=new vS,lte=new WeakMap,Yk=class{constructor(){this.enabled=!0,this._cache=[]}createNode(e=[]){return new vS().setLights(e)}getNode(e){if(e.isScene!==!0&&e.isGroup!==!0)return NIe;let t=lte.get(e);return t===void 0&&(t=this.createNode(),lte.set(e,t)),t}beginRender(e){this._cache.push(this.getNode(e).getLights())}finishRender(e){this.getNode(e).setLights(this._cache.pop())}},kg=class extends Fa{constructor(e=1,t=1,n={}){super(e,t,n),this.isXRRenderTarget=!0,this._hasExternalTextures=!1,this._autoAllocateDepthBuffer=!0,this._isOpaqueFramebuffer=!1}copy(e){return super.copy(e),this._hasExternalTextures=e._hasExternalTextures,this._autoAllocateDepthBuffer=e._autoAllocateDepthBuffer,this._isOpaqueFramebuffer=e._isOpaqueFramebuffer,this}},cte=new re,ute=new re,hte=new WeakMap,Zk=class extends la{constructor(e,t=!1){super(),this.enabled=!1,this.isPresenting=!1,this.cameraAutoUpdate=!0,this._renderer=e,this._cameraL=new $r,this._cameraL.viewport=new xn,this._cameraL.matrixWorldAutoUpdate=!1,this._cameraR=new $r,this._cameraR.viewport=new xn,this._cameraR.matrixWorldAutoUpdate=!1,this._cameras=[this._cameraL,this._cameraR],this._cameraXR=new t_,this._currentDepthNear=null,this._currentDepthFar=null,this._controllers=[],this._controllerInputSources=[],this._xrRenderTarget=null,this._layers=[],this._sessionUsesLayers=!1,this._supportsGlBinding=typeof XRWebGLBinding<"u",this._supportsWebGPUBinding=typeof globalThis.XRGPUBinding<"u",this._createXRLayer=zIe.bind(this),this._gl=null,this._currentAnimationContext=null,this._currentAnimationLoop=null,this._currentPixelRatio=null,this._currentSamples=null,this._currentSize=new Oe,this._onSessionEvent=OIe.bind(this),this._onSessionEnd=UIe.bind(this),this._onInputSourcesChange=kIe.bind(this),this._onAnimationFrame=VIe.bind(this),this._referenceSpace=null,this._referenceSpaceType="local-floor",this._customReferenceSpace=null,this._framebufferScaleFactor=1,this._foveation=1,this._session=null,this._glBaseLayer=null,this._glBinding=null,this._webgpuBinding=null,this._glProjLayer=null,this._xrFrame=null,this._supportsLayers=this._supportsGlBinding&&"createProjectionLayer"in XRWebGLBinding.prototype,this._useMultiviewIfPossible=t,this._useMultiview=!1}getController(e){return this._getController(e).getTargetRaySpace()}getControllerGrip(e){return this._getController(e).getGripSpace()}getHand(e){return this._getController(e).getHandSpace()}getFoveation(){return this._foveation}setFoveation(e){this._foveation=e,this._glProjLayer!==null&&(this._glProjLayer.fixedFoveation=e),this._glBaseLayer!==null&&this._glBaseLayer.fixedFoveation!==void 0&&(this._glBaseLayer.fixedFoveation=e)}getFramebufferScaleFactor(){return this._framebufferScaleFactor}setFramebufferScaleFactor(e){this._framebufferScaleFactor=e,this.isPresenting===!0&&Xe("XRManager: Cannot change framebuffer scale while presenting.")}getReferenceSpaceType(){return this._referenceSpaceType}setReferenceSpaceType(e){this._referenceSpaceType=e,this.isPresenting===!0&&Xe("XRManager: Cannot change reference space type while presenting.")}getReferenceSpace(){return this._customReferenceSpace||this._referenceSpace}setReferenceSpace(e){this._customReferenceSpace=e}getCamera(){return this._cameraXR}getEnvironmentBlendMode(){if(this._session!==null)return this._session.environmentBlendMode}getBaseLayer(){return this._glProjLayer!==null?this._glProjLayer:this._glBaseLayer}getBinding(){return this._glBinding===null&&this._supportsGlBinding&&(this._glBinding=new XRWebGLBinding(this._session,this._gl)),this._glBinding}foveateBoundTexture(e){if(e.isPostProcessingRenderTarget!==!0||this.isPresenting!==!0||this._glProjLayer===null)return;let t=this._renderer.backend;if(t===void 0||t.isWebGLBackend!==!0||t.state===null)return;let n=this._renderer.getOutputRenderTarget();if(n===null||n.isXRRenderTarget!==!0)return;let r=this.getBinding();if(r===null||typeof r.foveateBoundTexture!="function")return;this._renderer._textures.updateRenderTarget(e);let{textureGPU:s,glTextureType:o}=t.get(e.texture);if(!(s===void 0||o===void 0)&&e._xrFoveationTextureGPU!==s){e._xrFoveationTextureGPU=s,t.state.bindTexture(o,s);try{r.foveateBoundTexture(o,this.getFoveation())}catch(a){ni(`XRManager: Unable to foveate bound XR post-processing texture. ${a.name}: ${a.message}`)}finally{t.state.unbindTexture()}}}getWebGPUBinding(){return this._webgpuBinding===null&&this._supportsWebGPUBinding&&(this._webgpuBinding=new globalThis.XRGPUBinding(this._session,this._renderer.backend.device)),this._webgpuBinding}_isWebGPUSession(){return this._renderer.backend.isWebGPUBackend===!0&&this._session!==null&&this._session.enabledFeatures.includes("webgpu")}_validateWebGPUSession(){let e=this._renderer;if(e.backend.isWebGPUBackend===!0){if(this._session.enabledFeatures.includes("webgpu")===!1)throw new Error('THREE.XRManager: WebGPU XR sessions require the "webgpu" session feature. Use VRButtonGPU/XRButton with "webgpu" enabled or use a WebGL backend.');e.samples>0&&(ni("THREE.XRManager: WebGPU XR does not support MSAA yet. Disabling MSAA for this XR session."),this._currentSamples===null&&(this._currentSamples=e.samples),e._samples=0)}}async _initWebGPUSession(e){let t=this.getWebGPUBinding(),n=t.createProjectionLayer({colorFormat:t.getPreferredColorFormat(),depthStencilFormat:"depth24plus"});this._glProjLayer=n,e.updateRenderState({layers:[n]}),this._referenceSpace=await e.requestReferenceSpace(this.getReferenceSpaceType()),this._xrRenderTarget=new Fa(n.textureWidth,n.textureHeight,{depth:2,minFilter:Mi,magFilter:Mi,depthBuffer:!0,multiview:!1,useArrayDepthTexture:!0,samples:0}),this._xrRenderTarget.texture.isArrayTexture=!0,this._useMultiviewIfPossible===!0&&ni("THREE.XRManager: WebGPU XR does not support multiview yet. Disabling multiview for this XR session."),this._useMultiview=!1}_disposeWebGPUSession(){let e=this._renderer,t=this._xrRenderTarget;if(t===null||e.backend.isWebGPUBackend!==!0)return;let n=e.backend,r=e._textures,s=n.get?n.get(t):null;s&&(s.descriptors=void 0);let o=a=>{a!=null&&(n.delete&&n.delete(a),r.delete&&r.delete(a))};for(let a=0;a<t.textures.length;a++)o(t.textures[a]);o(t.depthTexture),o(t),e._renderContexts&&e._renderContexts.dispose&&e._renderContexts.dispose(),t.dispose()}_getWebGPUViewData(e){let t=this.getWebGPUBinding(),n={colorTexture:null,viewDescriptors:[],viewports:[]};for(let r=0;r<e.length;r++){let s=t.getViewSubImage(this._glProjLayer,e[r]);n.colorTexture===null&&(n.colorTexture=s.colorTexture),n.viewports.push(s.viewport),s.getViewDescriptor&&n.viewDescriptors.push(s.getViewDescriptor())}return n}getFrame(){return this._xrFrame}useMultiview(){return this._useMultiview}createQuadLayer(e,t,n,r,s,o,a,l={}){let c=new HA(e,t),u=new kg(s,o,{format:Or,type:Ji,depthTexture:new Cs(s,o,l.stencil?ca:xi,void 0,void 0,void 0,void 0,void 0,void 0,l.stencil?xo:Gs),stencilBuffer:l.stencil,resolveDepthBuffer:!1,resolveStencilBuffer:!1});u._autoAllocateDepthBuffer=!0;let f=new fs({color:16777215,side:ko});f.map=u.texture,f.map.offset.y=1,f.map.repeat.y=-1;let d=new Hn(c,f);d.position.copy(n),d.quaternion.copy(r);let A={type:"quad",width:e,height:t,translation:n,quaternion:r,pixelwidth:s,pixelheight:o,plane:d,material:f,rendercall:a,renderTarget:u};if(this._layers.push(A),this._session!==null){A.plane.material=new fs({color:16777215,side:ko}),A.plane.material.blending=Id,A.plane.material.blendEquation=oo,A.plane.material.blendSrc=Nu,A.plane.material.blendDst=Nu,A.xrlayer=this._createXRLayer(A);let y=this._session.renderState.layers;y.unshift(A.xrlayer),this._session.updateRenderState({layers:y})}else u.isXRRenderTarget=!1;return d}createCylinderLayer(e,t,n,r,s,o,a,l,c={}){let u=new VA(e,e,e*t/n,64,64,!0,Math.PI-t/2,t),f=new kg(o,a,{format:Or,type:Ji,depthTexture:new Cs(o,a,c.stencil?ca:xi,void 0,void 0,void 0,void 0,void 0,void 0,c.stencil?xo:Gs),stencilBuffer:c.stencil,resolveDepthBuffer:!1,resolveStencilBuffer:!1});f._autoAllocateDepthBuffer=!0;let d=new fs({color:16777215,side:mi});d.map=f.texture,d.map.offset.y=1,d.map.repeat.y=-1;let A=new Hn(u,d);A.position.copy(r),A.quaternion.copy(s);let y={type:"cylinder",radius:e,centralAngle:t,aspectratio:n,translation:r,quaternion:s,pixelwidth:o,pixelheight:a,plane:A,material:d,rendercall:l,renderTarget:f};if(this._layers.push(y),this._session!==null){y.plane.material=new fs({color:16777215,side:mi}),y.plane.material.blending=Id,y.plane.material.blendEquation=oo,y.plane.material.blendSrc=Nu,y.plane.material.blendDst=Nu,y.xrlayer=this._createXRLayer(y);let w=this._session.renderState.layers;w.unshift(y.xrlayer),this._session.updateRenderState({layers:w})}else f.isXRRenderTarget=!1;return A}renderLayers(){let e=new re,t=new qs,n=this._renderer,r=this.isPresenting;this.isPresenting=!1;let s=new Oe;n.getSize(s);let o=n.getRenderTarget();for(let a of this._layers){a.renderTarget.isXRRenderTarget=this._session!==null,a.renderTarget._hasExternalTextures=a.renderTarget.isXRRenderTarget;let l=n.contextNode,c;if(a.renderTarget.isXRRenderTarget&&this._sessionUsesLayers){a.xrlayer.transform=new XRRigidTransform(a.plane.getWorldPosition(e),a.plane.getWorldQuaternion(t));let u=this._glBinding.getSubImage(a.xrlayer,this._xrFrame);n.backend.setXRRenderTargetTextures(a.renderTarget,u.colorTexture,void 0),n._setXRLayerSize(a.renderTarget.width,a.renderTarget.height),c=hte.get(l),c===void 0&&(c=l.context({getOutput:f=>Mz(f,n.toneMapping,n.outputColorSpace)}),hte.set(l,c))}else c=l;n.contextNode=c,n.setRenderTarget(a.renderTarget),a.rendercall(),n.contextNode=l}n.setRenderTarget(o),n._setXRLayerSize(s.x,s.y),this.isPresenting=r}getSession(){return this._session}async setSession(e){let t=this._renderer;t.initialized===!1&&await t.init(),this._gl=t.getContext();let n=this._gl;if(this._session=e,e!==null){if(e.addEventListener("select",this._onSessionEvent),e.addEventListener("selectstart",this._onSessionEvent),e.addEventListener("selectend",this._onSessionEvent),e.addEventListener("squeeze",this._onSessionEvent),e.addEventListener("squeezestart",this._onSessionEvent),e.addEventListener("squeezeend",this._onSessionEvent),e.addEventListener("end",this._onSessionEnd),e.addEventListener("inputsourceschange",this._onInputSourcesChange),this._validateWebGPUSession(),this._currentPixelRatio=t.getPixelRatio(),t.getSize(this._currentSize),this._currentAnimationContext=t._animation.getContext(),this._currentAnimationLoop=t._animation.getAnimationLoop(),t._animation.stop(),this._isWebGPUSession())await this._initWebGPUSession(e);else if(this._supportsLayers===!0){let r=null,s=null,o=null,a=n.getContextAttributes();await t.backend.makeXRCompatible(),this.setFoveation(this.getFoveation()),t.depth&&(o=t.stencil?n.DEPTH24_STENCIL8:n.DEPTH_COMPONENT24,r=t.stencil?xo:Gs,s=t.stencil?ca:xi);let l={colorFormat:n.RGBA8,depthFormat:o,scaleFactor:this._framebufferScaleFactor,clearOnAccess:!1};this._useMultiviewIfPossible&&t.hasFeature("OVR_multiview2")&&(l.textureType="texture-array",this._useMultiview=!0),this._glBinding=this.getBinding();let c=this._glBinding.createProjectionLayer(l),u=[c];this._glProjLayer=c,t.setPixelRatio(1),t._setXRLayerSize(c.textureWidth,c.textureHeight);let f=this._useMultiview?2:1,d=new Cs(c.textureWidth,c.textureHeight,s,void 0,void 0,void 0,void 0,void 0,void 0,r,f);if(this._xrRenderTarget=new kg(c.textureWidth,c.textureHeight,{format:Or,type:Ji,colorSpace:t.outputColorSpace,depthTexture:d,stencilBuffer:t.stencil,samples:a.antialias?4:0,resolveDepthBuffer:c.ignoreDepthValues===!1,resolveStencilBuffer:c.ignoreDepthValues===!1,depth:this._useMultiview?2:1,multiview:this._useMultiview}),this._xrRenderTarget._hasExternalTextures=!0,this._xrRenderTarget.depth=this._useMultiview?2:1,this._sessionUsesLayers=e.enabledFeatures.includes("layers"),this._referenceSpace=await e.requestReferenceSpace(this.getReferenceSpaceType()),this._sessionUsesLayers)for(let A of this._layers)A.plane.material=new fs({color:16777215,side:A.type==="cylinder"?mi:ko}),A.plane.material.blending=Id,A.plane.material.blendEquation=oo,A.plane.material.blendSrc=Nu,A.plane.material.blendDst=Nu,A.xrlayer=this._createXRLayer(A),u.unshift(A.xrlayer);e.updateRenderState({layers:u})}else{await t.backend.makeXRCompatible(),this.setFoveation(this.getFoveation());let r={antialias:t.currentSamples>0,alpha:!0,depth:t.depth,stencil:t.stencil,framebufferScaleFactor:this.getFramebufferScaleFactor()},s=new XRWebGLLayer(e,n,r);this._glBaseLayer=s,e.updateRenderState({baseLayer:s}),t.setPixelRatio(1),t._setXRLayerSize(s.framebufferWidth,s.framebufferHeight),this._xrRenderTarget=new kg(s.framebufferWidth,s.framebufferHeight,{format:Or,type:Ji,colorSpace:t.outputColorSpace,stencilBuffer:t.stencil,resolveDepthBuffer:s.ignoreDepthValues===!1,resolveStencilBuffer:s.ignoreDepthValues===!1}),this._xrRenderTarget._isOpaqueFramebuffer=!0,this._referenceSpace=await e.requestReferenceSpace(this.getReferenceSpaceType())}t._animation.setAnimationLoop(this._onAnimationFrame),t._animation.setContext(e),t._animation.start(),this.isPresenting=!0,this.dispatchEvent({type:"sessionstart"})}}updateCamera(e){let t=this._session;if(t===null)return;let n=e.near,r=e.far,s=this._cameraXR,o=this._cameraL,a=this._cameraR;s.near=a.near=o.near=n,s.far=a.far=o.far=r,s.isMultiViewCamera=this._useMultiview,(this._currentDepthNear!==s.near||this._currentDepthFar!==s.far)&&(t.updateRenderState({depthNear:s.near,depthFar:s.far}),this._currentDepthNear=s.near,this._currentDepthFar=s.far),s.layers.mask=e.layers.mask|6,o.layers.mask=s.layers.mask&-5,a.layers.mask=s.layers.mask&-3;let l=e.parent,c=s.cameras;fte(s,l);for(let u=0;u<c.length;u++)fte(c[u],l);c.length===2?FIe(s,o,a):s.projectionMatrix.copy(o.projectionMatrix),BIe(e,s,l)}_getController(e){let t=this._controllers[e];return t===void 0&&(t=new e0,this._controllers[e]=t),t}};function FIe(i,e,t){cte.setFromMatrixPosition(e.matrixWorld),ute.setFromMatrixPosition(t.matrixWorld);let n=cte.distanceTo(ute),r=e.projectionMatrix.elements,s=t.projectionMatrix.elements,o=r[14]/(r[10]-1),a=r[14]/(r[10]+1),l=(r[9]+1)/r[5],c=(r[9]-1)/r[5],u=(r[8]-1)/r[0],f=(s[8]+1)/s[0],d=o*u,A=o*f,y=n/(-u+f),w=y*-u;if(e.matrixWorld.decompose(i.position,i.quaternion,i.scale),i.translateX(w),i.translateZ(y),i.matrixWorld.compose(i.position,i.quaternion,i.scale),i.matrixWorldInverse.copy(i.matrixWorld).invert(),r[10]===-1)i.projectionMatrix.copy(e.projectionMatrix),i.projectionMatrixInverse.copy(e.projectionMatrixInverse);else{let S=o+y,T=a+y,R=d-w,P=A+(n-w),I=l*a/T*S,F=c*a/T*S;i.projectionMatrix.makePerspective(R,P,I,F,S,T),i.projectionMatrixInverse.copy(i.projectionMatrix).invert()}}function fte(i,e){e===null?i.matrixWorld.copy(i.matrix):i.matrixWorld.multiplyMatrices(e.matrixWorld,i.matrix),i.matrixWorldInverse.copy(i.matrixWorld).invert()}function BIe(i,e,t){t===null?i.matrix.copy(e.matrixWorld):(i.matrix.copy(t.matrixWorld),i.matrix.invert(),i.matrix.multiply(e.matrixWorld)),i.matrix.decompose(i.position,i.quaternion,i.scale),i.updateMatrixWorld(!0),i.projectionMatrix.copy(e.projectionMatrix),i.projectionMatrixInverse.copy(e.projectionMatrixInverse),i.isPerspectiveCamera&&(i.fov=Td*2*Math.atan(1/i.projectionMatrix.elements[5]),i.zoom=1)}function OIe(i){let e=this._controllerInputSources.indexOf(i.inputSource);if(e===-1)return;let t=this._controllers[e];if(t!==void 0){let n=this.getReferenceSpace();t.update(i.inputSource,i.frame,n),t.dispatchEvent({type:i.type,data:i.inputSource})}}function UIe(){let i=this._session,e=this._renderer;i.removeEventListener("select",this._onSessionEvent),i.removeEventListener("selectstart",this._onSessionEvent),i.removeEventListener("selectend",this._onSessionEvent),i.removeEventListener("squeeze",this._onSessionEvent),i.removeEventListener("squeezestart",this._onSessionEvent),i.removeEventListener("squeezeend",this._onSessionEvent),i.removeEventListener("end",this._onSessionEnd),i.removeEventListener("inputsourceschange",this._onInputSourcesChange);for(let t=0;t<this._controllers.length;t++){let n=this._controllerInputSources[t];n!==null&&(this._controllerInputSources[t]=null,this._controllers[t].disconnect(n))}if(this._currentDepthNear=null,this._currentDepthFar=null,this._currentSamples!==null&&(e._samples=this._currentSamples,this._currentSamples=null),e._resetXRState(),this._disposeWebGPUSession(),this._session=null,this._xrRenderTarget=null,this._glBinding=null,this._webgpuBinding=null,this._glBaseLayer=null,this._glProjLayer=null,this._sessionUsesLayers===!0)for(let t of this._layers)t.renderTarget=new kg(t.pixelwidth,t.pixelheight,{format:Or,type:Ji,depthTexture:new Cs(t.pixelwidth,t.pixelheight,t.stencilBuffer?ca:xi,void 0,void 0,void 0,void 0,void 0,void 0,t.stencilBuffer?xo:Gs),stencilBuffer:t.stencilBuffer,resolveDepthBuffer:!1,resolveStencilBuffer:!1}),t.renderTarget.isXRRenderTarget=!1,t.plane.material=t.material,t.material.map=t.renderTarget.texture,t.material.map.offset.y=1,t.material.map.repeat.y=-1,delete t.xrlayer;this.isPresenting=!1,this._useMultiview=!1,e._animation.stop(),e._animation.setAnimationLoop(this._currentAnimationLoop),e._animation.setContext(this._currentAnimationContext),e._animation.start(),e.setPixelRatio(this._currentPixelRatio),e.setSize(this._currentSize.width,this._currentSize.height,!1),this.dispatchEvent({type:"sessionend"})}function kIe(i){let e=this._controllers,t=this._controllerInputSources;for(let n=0;n<i.removed.length;n++){let r=i.removed[n],s=t.indexOf(r);s>=0&&(t[s]=null,e[s].disconnect(r))}for(let n=0;n<i.added.length;n++){let r=i.added[n],s=t.indexOf(r);if(s===-1){for(let a=0;a<e.length;a++)if(a>=t.length){t.push(r),s=a;break}else if(t[a]===null){t[a]=r,s=a;break}if(s===-1)break}let o=e[s];o&&o.connect(r)}}function zIe(i){return i.type==="quad"?this._glBinding.createQuadLayer({transform:new XRRigidTransform(i.translation,i.quaternion),width:i.width/2,height:i.height/2,space:this._referenceSpace,viewPixelWidth:i.pixelwidth,viewPixelHeight:i.pixelheight,clearOnAccess:!1}):this._glBinding.createCylinderLayer({transform:new XRRigidTransform(i.translation,i.quaternion),radius:i.radius,centralAngle:i.centralAngle,aspectRatio:i.aspectRatio,space:this._referenceSpace,viewPixelWidth:i.pixelwidth,viewPixelHeight:i.pixelheight,clearOnAccess:!1})}function VIe(i,e){if(e===void 0)return;let t=this._cameraXR,n=this._renderer,r=n.backend,s=this._glBaseLayer,o=this.getReferenceSpace(),a=e.getViewerPose(o);if(this._xrFrame=e,a!==null){let l=a.views,c=this._isWebGPUSession()?this._getWebGPUViewData(l):null;this._glBaseLayer!==null&&c===null&&r.setXRTarget(s.framebuffer);let u=!1;l.length!==t.cameras.length&&(t.cameras.length=0,u=!0);for(let d=0;d<l.length;d++){let A=l[d],y;if(c!==null)y=c.viewports[d];else if(this._supportsLayers===!0){let S=this._glBinding.getViewSubImage(this._glProjLayer,A);y=S.viewport,d===0&&r.setXRRenderTargetTextures(this._xrRenderTarget,S.colorTexture,this._glProjLayer.ignoreDepthValues&&!this._useMultiview?void 0:S.depthStencilTexture)}else y=s.getViewport(A);let w=this._cameras[d];w===void 0&&(w=new $r,w.layers.enable(d),w.viewport=new xn,w.matrixWorldAutoUpdate=!1,this._cameras[d]=w),w.matrix.fromArray(A.transform.matrix),w.matrix.decompose(w.position,w.quaternion,w.scale),w.projectionMatrix.fromArray(A.projectionMatrix),w.projectionMatrixInverse.copy(w.projectionMatrix).invert(),w.viewport.set(y.x,y.y,y.width,y.height),d===0&&(t.matrix.copy(w.matrix),t.matrix.decompose(t.position,t.quaternion,t.scale)),u===!0&&t.cameras.push(w)}c!==null&&c.colorTexture!==null&&r.setXRRenderTargetTextures(this._xrRenderTarget,c.colorTexture,c.viewDescriptors),n.setOutputRenderTarget(this._xrRenderTarget);let f=n._getFrameBufferTarget();n.xr.foveateBoundTexture(f)}for(let l=0;l<this._controllers.length;l++){let c=this._controllerInputSources[l],u=this._controllers[l];c!==null&&u!==void 0&&u.update(c,e,o)}this._currentAnimationLoop&&this._currentAnimationLoop(i,e),e.detectedPlanes&&this.dispatchEvent({type:"planesdetected",data:e}),this._xrFrame=null}var Kk=class extends la{constructor(e){super(),this.domElement=e,this._pixelRatio=1,this._width=this.domElement.width,this._height=this.domElement.height,this._viewport=new xn(0,0,this._width,this._height),this._scissor=new xn(0,0,this._width,this._height),this._scissorTest=!1,this.colorTexture=new zA,this.depthTexture=new Cs}getPixelRatio(){return this._pixelRatio}getDrawingBufferSize(e){return e.set(this._width*this._pixelRatio,this._height*this._pixelRatio).floor()}getSize(e){return e.set(this._width,this._height)}setPixelRatio(e=1){this._pixelRatio!==e&&(this._pixelRatio=e,this.setSize(this._width,this._height,!1))}setDrawingBufferSize(e,t,n){this.xr&&this.xr.isPresenting||(this._width=e,this._height=t,this._pixelRatio=n,this.domElement.width=Math.floor(e*n),this.domElement.height=Math.floor(t*n),this.setViewport(0,0,e,t),this._dispatchResize())}setSize(e,t,n=!0){this.xr&&this.xr.isPresenting||(this._width=e,this._height=t,this.domElement.width=Math.floor(e*this._pixelRatio),this.domElement.height=Math.floor(t*this._pixelRatio),n===!0&&(this.domElement.style.width=e+"px",this.domElement.style.height=t+"px"),this.setViewport(0,0,e,t),this._dispatchResize())}getScissor(e){let t=this._scissor;return e.x=t.x,e.y=t.y,e.width=t.width,e.height=t.height,e}setScissor(e,t,n,r){let s=this._scissor;e.isVector4?s.copy(e):s.set(e,t,n,r)}getScissorTest(){return this._scissorTest}setScissorTest(e){this._scissorTest=e}getViewport(e){return e.copy(this._viewport)}setViewport(e,t,n,r,s=0,o=1){let a=this._viewport;e.isVector4?a.copy(e):a.set(e,t,n,r),a.minDepth=s,a.maxDepth=o}_dispatchResize(){this.dispatchEvent({type:"resize"})}dispose(){this.dispatchEvent({type:"dispose"})}},dte=new t0,k_=new Oe,HO=new xn,CR=new zc,RR=new C2,z_=new cn,zd=new xn,GIe={[ko]:mi,[mi]:ko,[gr]:gr},Qk=class{constructor(e,t={}){this.isRenderer=!0;let{logarithmicDepthBuffer:n=!1,reversedDepthBuffer:r=!1,alpha:s=!0,depth:o=!0,stencil:a=!1,antialias:l=!1,samples:c=0,getFallback:u=null,outputBufferType:f=Wi,multiview:d=!1}=t;this.backend=e,this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.alpha=s,this.logarithmicDepthBuffer=n,this.reversedDepthBuffer=r,this.outputColorSpace=Fr,this.toneMapping=ao,this.toneMappingExposure=1,this.sortObjects=!0,this.depth=o,this.stencil=a,this.info=new I7,this.contextNode=Kd(),this.library=new V4,this.lighting=new Yk,this._samples=c||l===!0?4:0,this._onCanvasTargetResize=this._onCanvasTargetResize.bind(this),this._canvasTarget=new Kk(e.getDomElement()),this._canvasTarget.addEventListener("resize",this._onCanvasTargetResize),this._canvasTarget.isDefaultCanvasTarget=!0,this._inspector=new o4,this._inspector.setRenderer(this),this._getFallback=u,this._attributes=null,this._geometries=null,this._nodes=null,this._animation=null,this._bindings=null,this._objects=null,this._pipelines=null,this._bundles=null,this._renderLists=null,this._renderContexts=null,this._textures=null,this._background=null,this._quadCache=new Map,this._currentRenderContext=null,this._opaqueSort=null,this._transparentSort=null,this._frameBufferTargets=new Map;let A=this.alpha===!0?0:1;this._clearColor=new pS(0,0,0,A),this._clearDepth=1,this._clearStencil=0,this._renderTarget=null,this._activeCubeFace=0,this._activeMipmapLevel=0,this._outputRenderTarget=null,this._mrt=null,this._renderObjectFunction=null,this._currentRenderObjectFunction=null,this._currentRenderBundle=null,this._handleObjectFunction=this._renderObjectDirect,this._isDeviceLost=!1,this.onDeviceLost=this._onDeviceLost,this.onError=this._onError,this._outputBufferType=f,this._cacheShadowNodes=new WeakMap,this._initialized=!1,this._callDepth=-1,this._initPromise=null,this._compilationPromises=null,this._currentSourceMaterial=null,this.transparent=!0,this.opaque=!0,this.shadowMap={enabled:!1,transmitted:!1,type:c0},this.xr=new Zk(this,d),this.debug={checkShaderErrors:!0,onShaderError:null,getShaderAsync:async(y,w,S)=>{await this.compileAsync(S,w,y);let R=this.needsFrameBufferTarget&&this._renderTarget===null?this._getFrameBufferTarget():this._renderTarget||this._outputRenderTarget,P=this._renderLists.get(y,w),I=this._renderContexts.get(R,this._mrt),F=y.overrideMaterial||S.material,D=this._objects.get(S,F,y,w,P.lightsNode,I,I.clippingContext),{fragmentShader:L,vertexShader:C}=D.getNodeBuilderState();return{fragmentShader:L,vertexShader:C}}}}async init(){return this._initPromise!==null?this._initPromise:(this._initPromise=new Promise(async(e,t)=>{let n=this.backend;try{await n.init(this)}catch(r){if(this._getFallback!==null)try{this.backend=n=this._getFallback(r),await n.init(this)}catch(s){t(s);return}else{t(r);return}}this._nodes=new jk(this,n),this._animation=new T7(this,this._nodes,this.info),this._attributes=new C7(n,this.info),this._background=new mk(this,this._nodes),this._geometries=new R7(this._attributes,this.info),this._textures=new k7(this,n,this.info),this._pipelines=new D7(n,this._nodes,this.info),this._bindings=new N7(n,this._nodes,this._textures,this._attributes,this._pipelines,this.info),this._objects=new M7(this,this._nodes,this._geometries,this._pipelines,this._bindings,this.info),this._renderLists=new B7(this.lighting),this._bundles=new $k,this._renderContexts=new U7(this),this._animation.start(),this._initialized=!0,this._inspector.init(),e(this)}),this._initPromise)}get domElement(){return this._canvasTarget.domElement}get coordinateSystem(){return this.backend.coordinateSystem}async compileAsync(e,t,n=null){if(this._isDeviceLost===!0)return;this._initialized===!1&&await this.init();let r=this._nodes.nodeFrame,s=r.renderId,o=this._currentRenderContext,a=this._currentRenderObjectFunction,l=this._handleObjectFunction,c=this._compilationPromises;n===null&&(n=e);let u=e.isScene===!0?e:n.isScene===!0?n:dte,d=this.needsFrameBufferTarget&&this._renderTarget===null?this._getFrameBufferTarget():this._renderTarget||this._outputRenderTarget,A=this._renderContexts.get(d,this._mrt),y=this._activeMipmapLevel,w=[];this._currentRenderContext=A,this._currentRenderObjectFunction=this.renderObject,this._handleObjectFunction=this._createObjectPipeline,this._compilationPromises=w,r.renderId++,r.update(),A.depth=this.depth,A.stencil=this.stencil,A.clippingContext||(A.clippingContext=new z4),A.clippingContext.updateGlobal(u,t),e.matrixWorldAutoUpdate===!0&&e.updateMatrixWorld(),t=this._updateCamera(t),u.onBeforeRender(this,e,t,d);let S=t.isArrayCamera?RR:CR;t.isArrayCamera?S.setFromArrayCamera(t):(z_.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),S.setFromProjectionMatrix(z_,t.coordinateSystem,t.reversedDepth));let T=this._renderLists.get(u,t);if(T.begin(),this._projectObject(e,t,0,T,A.clippingContext),n!==e&&n.traverseVisible(function(D){D.isLight&&D.layers.test(t.layers)&&T.pushLight(D)}),T.finish(),d!==null){this._textures.updateRenderTarget(d,y);let D=this._textures.get(d);A.textures=D.textures,A.depthTexture=D.depthTexture}else A.textures=null,A.depthTexture=null;n!==e?this._background.update(n,T,A):this._background.update(u,T,A);let R=T.opaque,P=T.transparent,I=T.transparentDoublePass,F=T.lightsNode;this.opaque===!0&&R.length>0&&this._renderObjects(R,t,u,F),this.transparent===!0&&P.length>0&&this._renderTransparents(P,I,t,u,F),r.renderId=s,this._currentRenderContext=o,this._currentRenderObjectFunction=a,this._handleObjectFunction=l,this._compilationPromises=c;for(let D of w){let L=this._objects.get(D.object,D.material,D.scene,D.camera,D.lightsNode,D.renderContext,D.clippingContext,D.passId);L.drawRange=D.object.geometry.drawRange,L.group=D.group,await this._nodes.getForRenderAsync(L),this._nodes.updateBefore(L),this._geometries.updateForRender(L),this._nodes.updateForRender(L),this._bindings.updateForRender(L);let C=[];this._pipelines.getForRender(L,C),C.length>0&&await Promise.all(C),this._nodes.updateAfter(L),await Y8()}}async renderAsync(e,t){ni('Renderer: "renderAsync()" has been deprecated. Use "render()" and "await renderer.init();" when creating the renderer.'),await this.init(),this.render(e,t)}async waitForGPU(){ze("Renderer: waitForGPU() has been removed. Read https://github.com/mrdoob/three.js/issues/32012 for more information.")}set inspector(e){this._inspector!==null&&this._inspector.setRenderer(null),this._inspector=e,this._inspector.setRenderer(this)}get inspector(){return this._inspector}set highPrecision(e){let t=this.contextNode.value;e===!0?(t.modelViewMatrix=PU,t.modelNormalViewMatrix=LU):this.highPrecision&&(delete t.modelViewMatrix,delete t.modelNormalViewMatrix)}get highPrecision(){let e=this.contextNode.value;return e.modelViewMatrix===PU&&e.modelNormalViewMatrix===LU}setMRT(e){return this._mrt=e,this}getMRT(){return this._mrt}getOutputBufferType(){return this._outputBufferType}getColorBufferType(){return ni('Renderer: ".getColorBufferType()" has been renamed to ".getOutputBufferType()".'),this.getOutputBufferType()}_onDeviceLost(e){let t=`THREE.WebGPURenderer: ${e.api} Device Lost:4165+`;return n}getHash(){return this.vertexShader+this.fragmentShader+this.computeShader}setShaderStage(e){this.shaderStage=e}getShaderStage(){return this.shaderStage}setBuildStage(e){this.buildStage=e}getBuildStage(){return this.buildStage}buildCode(){Xe("Abstract function.")}get subBuild(){return this.subBuildLayers[this.subBuildLayers.length-1]||null}addSubBuild(e){this.subBuildLayers.push(e)}removeSubBuild(){return this.subBuildLayers.pop()}getClosestSubBuild(e){let t;if(e&&e.isNode?e.isShaderCallNodeInternal?t=e.shaderNode.subBuilds:e.isStackNode?t=[e.subBuild]:t=this.getDataFromNode(e,"any").subBuilds:e instanceof Set?t=[...e]:t=e,!t)return null;let n=this.subBuildLayers;for(let r=t.length-1;r>=0;r--){let s=t[r];if(n.includes(s))return s}return null}getSubBuildOutput(e){return this.getSubBuildProperty("outputNode",e)}getSubBuildProperty(e="",t=null){let n;t!==null?n=this.getClosestSubBuild(t):n=this.subBuildFn;let r;return n?r=e?n+"_"+e:n:r=e,r}prebuild(){let{object:e,renderer:t,material:n}=this;if(t.contextNode.isContextNode===!0?this.context={...this.context,...t.contextNode.getFlowContextData()}:ze('NodeBuilder: "renderer.contextNode" must be an instance of `context()`.'),n&&n.contextNode&&(n.contextNode.isContextNode===!0?this.context={...this.context,...n.contextNode.getFlowContextData()}:ze('NodeBuilder: "material.contextNode" must be an instance of `context()`.')),n!==null){let r=t.library.fromMaterial(n);r===null&&(ze(`NodeBuilder: Material "${n.type}" is not compatible.`),r=new Pr),r.build(this)}else this.addFlow("compute",e)}build(){this.prebuild();for(let e of YR){this.setBuildStage(e),this.context.position&&this.context.position.isNode&&this.flowNodeFromShaderStage("vertex",this.context.position);for(let t of ZR){this.setShaderStage(t);let n=this.flowNodes[t];for(let r of n)e==="generate"?this.flowNode(r):r.build(this)}}return this.setBuildStage(null),this.setShaderStage(null),this.buildCode(),this.buildUpdateNodes(),this}async buildAsync(){this.prebuild();for(let e of YR){this.setBuildStage(e),this.context.position&&this.context.position.isNode&&this.flowNodeFromShaderStage("vertex",this.context.position);for(let t of ZR){this.setShaderStage(t);let n=this.flowNodes[t];for(let r of n)e==="generate"?this.flowNode(r):r.build(this);await AF()}}return this.setBuildStage(null),this.setShaderStage(null),this.buildCode(),this.buildUpdateNodes(),this}getSharedDataFromNode(e){let t=cIe.get(e);return t===void 0&&(t={}),t}getNodeUniform(e,t){let n=this.getSharedDataFromNode(e),r=n.cache;if(r===void 0){if(t==="float"||t==="int"||t==="uint")r=new Zk(e);else if(t==="vec2"||t==="ivec2"||t==="uvec2")r=new Kk(e);else if(t==="vec3"||t==="ivec3"||t==="uvec3")r=new Qk(e);else if(t==="vec4"||t==="ivec4"||t==="uvec4")r=new Jk(e);else if(t==="color")r=new e9(e);else if(t==="mat2")r=new t9(e);else if(t==="mat3")r=new n9(e);else if(t==="mat4")r=new i9(e);else throw new Error(`THREE.NodeBuilder: Uniform "${t}" not implemented.`);n.cache=r}return r}format(e,t,n){if(t=this.getVectorType(t),n=this.getVectorType(n),t===n||n===null||this.isReference(n))return e;let r=this.getTypeLength(t),s=this.getTypeLength(n);return r===16&&s===9?`${this.getType(n)}( ${e}[ 0 ].xyz, ${e}[ 1 ].xyz, ${e}[ 2 ].xyz )`:r===9&&s===4?`${this.getType(n)}( ${e}[ 0 ].xy, ${e}[ 1 ].xy )`:r>4||s>4||s===0?e:r===s?`${this.getType(n)}( ${e} )`:r>s?(e=n==="bool"?`all( ${e} )`:`${e}.${"xyz".slice(0,s)}`,this.format(e,this.getTypeFromLength(s,this.getComponentType(t)),n)):s===4&&r>1?`${this.getType(n)}( ${this.format(e,t,"vec3")}, 1.0 )`:r===2?`${this.getType(n)}( ${this.format(e,t,"vec2")}, 0.0 )`:(r===1&&s>1&&t!==this.getComponentType(n)&&(e=`${this.getType(this.getComponentType(n))}( ${e} )`),`${this.getType(n)}( ${e} )`)}getSignature(){return`// Three.js r${"185"} - Node System4166+`}needsPreviousData(){let e=this.renderer.getMRT();return e&&e.has("velocity")||ane(this.object).useVelocity===!0}},j4=class{constructor(){this.time=0,this.deltaTime=0,this.frameId=0,this.renderId=0,this.updateMap=new WeakMap,this.updateBeforeMap=new WeakMap,this.updateAfterMap=new WeakMap,this.renderer=null,this.material=null,this.camera=null,this.object=null,this.scene=null}_getMaps(e,t){let n=e.get(t);return n===void 0&&(n={renderId:0,frameId:0},e.set(t,n)),n}updateBeforeNode(e){let t=e.getUpdateBeforeType(),n=e.updateReference(this);if(t===yn.FRAME){let r=this._getMaps(this.updateBeforeMap,n);if(r.frameId!==this.frameId){let s=r.frameId;r.frameId=this.frameId,e.updateBefore(this)===!1&&(r.frameId=s)}}else if(t===yn.RENDER){let r=this._getMaps(this.updateBeforeMap,n);if(r.renderId!==this.renderId){let s=r.renderId;r.renderId=this.renderId,e.updateBefore(this)===!1&&(r.renderId=s)}}else t===yn.OBJECT&&e.updateBefore(this)}updateAfterNode(e){let t=e.getUpdateAfterType(),n=e.updateReference(this);if(t===yn.FRAME){let r=this._getMaps(this.updateAfterMap,n);r.frameId!==this.frameId&&e.updateAfter(this)!==!1&&(r.frameId=this.frameId)}else if(t===yn.RENDER){let r=this._getMaps(this.updateAfterMap,n);r.renderId!==this.renderId&&e.updateAfter(this)!==!1&&(r.renderId=this.renderId)}else t===yn.OBJECT&&e.updateAfter(this)}updateNode(e){let t=e.getUpdateType(),n=e.updateReference(this);if(t===yn.FRAME){let r=this._getMaps(this.updateMap,n);r.frameId!==this.frameId&&e.update(this)!==!1&&(r.frameId=this.frameId)}else if(t===yn.RENDER){let r=this._getMaps(this.updateMap,n);r.renderId!==this.renderId&&e.update(this)!==!1&&(r.renderId=this.renderId)}else t===yn.OBJECT&&e.update(this)}update(){this.frameId++,this.lastTime===void 0&&(this.lastTime=performance.now()),this.deltaTime=(performance.now()-this.lastTime)/1e3,this.lastTime=performance.now(),this.time+=this.deltaTime}},ES=class{constructor(e,t,n=null,r="",s=!1){this.type=e,this.name=t,this.count=n,this.qualifier=r,this.isConst=s}};ES.isNodeFunctionInput=!0;var r9=class extends Qd{static get type(){return"AmbientLightNode"}constructor(e=null){super(e)}setup({context:e}){e.irradiance.addAssign(this.colorNode)}},s9=class extends Qd{static get type(){return"DirectionalLightNode"}constructor(e=null){super(e)}setupDirect(){let e=this.colorNode;return{lightDirection:IV(this.light),lightColor:e}}},o9=class extends Qd{static get type(){return"HemisphereLightNode"}constructor(e=null){super(e),this.lightPositionNode=RV(e),this.lightDirectionNode=this.lightPositionNode.normalize(),this.groundColorNode=Xt(new zt).setGroup(Jt)}update(e){let{light:t}=this;super.update(e),this.lightPositionNode.object3d=t,this.groundColorNode.value.copy(t.groundColor).multiplyScalar(t.intensity)}setup(e){let{colorNode:t,groundColorNode:n,lightDirectionNode:r}=this,o=Sm.dot(r).mul(.5).add(.5),a=Qn(n,t,o);e.context.irradiance.addAssign(a)}},MS=class extends Qd{static get type(){return"SpotLightNode"}constructor(e=null){super(e),this.coneCosNode=Xt(0).setGroup(Jt),this.penumbraCosNode=Xt(0).setGroup(Jt),this.cutoffDistanceNode=Xt(0).setGroup(Jt),this.decayExponentNode=Xt(0).setGroup(Jt),this.colorNode=Xt(this.color).setGroup(Jt)}update(e){super.update(e);let{light:t}=this;this.coneCosNode.value=Math.cos(t.angle),this.penumbraCosNode.value=Math.cos(t.angle*(1-t.penumbra)),this.cutoffDistanceNode.value=t.distance,this.decayExponentNode.value=t.decay}getSpotAttenuation(e,t){let{coneCosNode:n,penumbraCosNode:r}=this;return mc(n,r,t)}getLightCoord(e){let t=e.getNodeProperties(this),n=t.projectionUV;return n===void 0&&(n=Wse(this.light,e.context.positionWorld),t.projectionUV=n),n}setupDirect(e){let{colorNode:t,cutoffDistanceNode:n,decayExponentNode:r,light:s}=this,o=this.getLightVector(e),a=o.normalize(),l=a.dot(IV(s)),c=this.getSpotAttenuation(e,l),u=o.length(),f=DV({lightDistance:u,cutoffDistance:n,decayExponent:r}),d=t.mul(c).mul(f),A,y;return s.colorNode?(y=this.getLightCoord(e),A=s.colorNode(y)):s.map&&(y=this.getLightCoord(e),A=fi(s.map,y.xy).onRenderUpdate(()=>s.map)),A&&(d=y.mul(2).sub(1).abs().lessThan(1).all().select(d.mul(A),d)),{lightColor:d,lightDirection:a}}},a9=class extends MS{static get type(){return"IESSpotLightNode"}constructor(e=null){super(e),this._iesTextureNode=null}getSpotAttenuation(e,t){let n=this.light.iesMap,r=null;if(n&&n.isTexture===!0){let s=t.acos().mul(1/Math.PI);this._iesTextureNode=fi(n,dt(s,0),0),r=this._iesTextureNode.r}else r=super.getSpotAttenuation(e,t);return r}update(e){super.update(e),this._iesTextureNode!==null&&this.light.iesMap&&(this._iesTextureNode.value=this.light.iesMap)}},l9=class extends Qd{static get type(){return"LightProbeNode"}constructor(e=null){super(e);let t=[];for(let n=0;n<9;n++)t.push(new re);this.lightProbe=$o(t)}update(e){let{light:t}=this;super.update(e);for(let n=0;n<9;n++)this.lightProbe.array[n].copy(t.sh.coefficients[n]).multiplyScalar(t.intensity)}setup(e){let t=doe(Sm,this.lightProbe);e.context.irradiance.addAssign(t)}},hIe=me(([i,e])=>{let t=i.abs().sub(e);return vf(zr(t,0)).add(Pl(zr(t.x,t.y),0))}),c9=class extends MS{static get type(){return"ProjectorLightNode"}update(e){super.update(e);let t=this.light;if(this.penumbraCosNode.value=Math.min(Math.cos(t.angle*(1-t.penumbra)),.99999),t.aspect===null){let n=1;t.map!==null&&(n=t.map.width/t.map.height),t.shadow.aspect=n}else t.shadow.aspect=t.aspect}getSpotAttenuation(e){let t=oe(0),n=this.penumbraCosNode,r=zP(this.light).mul(e.context.positionWorld||_f);return $t(r.w.greaterThan(0),()=>{let s=r.xyz.div(r.w),o=hIe(s.xy.sub(dt(.5)),dt(.5)),a=pc(-1,ai(1,Mz(n)).sub(1));t.assign(TP(o.mul(-2).mul(a)))}),t}},cU=new cn,FR=new cn,jw=null,u9=class extends Qd{static get type(){return"RectAreaLightNode"}constructor(e=null){super(e),this.halfHeight=Xt(new re).setGroup(Jt),this.halfWidth=Xt(new re).setGroup(Jt),this.updateType=yn.RENDER}update(e){super.update(e);let{light:t}=this,n=e.camera.matrixWorldInverse;FR.identity(),cU.copy(t.matrixWorld),cU.premultiply(n),FR.extractRotation(cU),this.halfWidth.value.set(t.width*.5,0,0),this.halfHeight.value.set(0,t.height*.5,0),this.halfWidth.value.applyMatrix4(FR),this.halfHeight.value.applyMatrix4(FR)}setupDirectRectArea(e){let t,n;e.isAvailable("float32Filterable")?(t=fi(jw.LTC_FLOAT_1),n=fi(jw.LTC_FLOAT_2)):(t=fi(jw.LTC_HALF_1),n=fi(jw.LTC_HALF_2));let{colorNode:r,light:s}=this,o=PV(s);return{lightColor:r,lightPosition:o,halfWidth:this.halfWidth,halfHeight:this.halfHeight,ltc_1:t,ltc_2:n}}static setLTC(e){jw=e}},X4=class{parseFunction(){Xe("Abstract function.")}},CS=class{constructor(e,t,n="",r=""){this.type=e,this.inputs=t,this.name=n,this.precision=r}getCode(){Xe("Abstract function.")}};CS.isNodeFunction=!0;var fIe=/^\s*(highp|mediump|lowp)?\s*([a-z_0-9]+)\s*([a-z_0-9]+)?\s*\(([\s\S]*?)\)/i,dIe=/[a-z_0-9]+/ig,Ite="#pragma main",pIe=i=>{i=i.trim();let e=i.indexOf(Ite),t=e!==-1?i.slice(e+Ite.length):i,n=t.match(fIe);if(n!==null&&n.length===5){let r=n[4],s=[],o=null;for(;(o=dIe.exec(r))!==null;)s.push(o);let a=[],l=0;for(;l<s.length;){let y=s[l][0]==="const";y===!0&&l++;let w=s[l][0];w==="in"||w==="out"||w==="inout"?l++:w="";let S=s[l++][0],T=Number.parseInt(s[l][0]);Number.isNaN(T)===!1?l++:T=null;let R=s[l++][0];a.push(new ES(S,R,T,w,y))}let c=t.substring(n[0].length),u=n[3]!==void 0?n[3]:"",f=n[2],d=n[1]!==void 0?n[1]:"",A=e!==-1?i.slice(0,e):"";return{type:f,inputs:a,name:u,precision:d,inputsCode:r,blockCode:c,headerCode:A}}else throw new Error("THREE.FunctionNode: Function is not a GLSL code.")},h9=class extends CS{constructor(e){let{type:t,inputs:n,name:r,precision:s,inputsCode:o,blockCode:a,headerCode:l}=pIe(e);super(t,n,r,s),this.inputsCode=o,this.blockCode=a,this.headerCode=l}getCode(e=this.name){let t,n=this.blockCode;if(n!==""){let{type:r,inputsCode:s,headerCode:o,precision:a}=this,l=`${r} ${e} ( ${s.trim()} )`;a!==""&&(l=`${a} ${l}`),t=o+l+n}else t="";return t}},f9=class extends X4{parseFunction(e){return new h9(e)}},Yc=[],Gd=[],Lte=Xt(0,"int").setGroup(Jt),d9=class extends Tf{constructor(e,t){super(),this.renderer=e,this.backend=t,this.nodeFrame=new j4,this.nodeBuilderCache=new Map,this.callHashCache=new Sf,this.groupsData=new Sf,this._buildQueue=[],this._buildInProgress=!1,this.cacheLib={}}updateGroup(e){let t=e.groupNode;if(t.updateType===yn.OBJECT)return!0;Yc[0]=t,Yc[1]=e;let n=this.groupsData.get(Yc);return n===void 0&&this.groupsData.set(Yc,n={}),Yc[0]=null,Yc[1]=null,n.version!==t.version?(n.version=t.version,!0):!1}getForRenderCacheKey(e){return e.initialCacheKey}_createNodeBuilder(e,t){let n=this.backend.createNodeBuilder(e.object,this.renderer);return n.scene=e.scene,n.material=t,n.camera=e.camera,n.context.material=t,n.lightsNode=e.lightsNode,n.environmentNode=this.getEnvironmentNode(e.scene),n.fogNode=this.getFogNode(e.scene),n.clippingContext=e.clippingContext,this.renderer.getOutputRenderTarget()&&this.renderer.getOutputRenderTarget().multiview&&n.enableMultiview(),n}getForRender(e,t=!1){let n=this.get(e),r=n.nodeBuilderState;if(r===void 0){let{nodeBuilderCache:s}=this,o=this.getForRenderCacheKey(e);if(r=s.get(o),r===void 0){let a=async()=>{let l=this._createNodeBuilder(e,e.material);try{t?await l.buildAsync():l.build()}catch(c){l=this._createNodeBuilder(e,new Pr),t?await l.buildAsync():l.build(),ze("TSL: "+c)}return l};if(t)return a().then(l=>(r=this._createNodeBuilderState(l),s.set(o,r),r.usedTimes++,n.nodeBuilderState=r,r));{let l=this._createNodeBuilder(e,e.material);try{l.build()}catch(c){l=this._createNodeBuilder(e,new Pr),l.build();let u=c.stackTrace;!u&&c.stack&&(u=new ts(c.stack)),ze("TSL: "+c,u)}r=this._createNodeBuilderState(l),s.set(o,r)}}r.usedTimes++,n.nodeBuilderState=r}return r}getForRenderAsync(e){let t=this.getForRender(e,!0);return t.then?t:Promise.resolve(t)}getForRenderDeferred(e){let t=this.get(e);if(t.nodeBuilderState!==void 0)return t.nodeBuilderState;let n=this.getForRenderCacheKey(e),r=this.nodeBuilderCache.get(n);return r!==void 0?(r.usedTimes++,t.nodeBuilderState=r,r):(t.pendingBuild!==!0&&(t.pendingBuild=!0,this._buildQueue.push(()=>this.getForRenderAsync(e).then(()=>{t.pendingBuild=!1})),this._processBuildQueue()),null)}_processBuildQueue(){if(this._buildInProgress||this._buildQueue.length===0)return;this._buildInProgress=!0,this._buildQueue.shift()().then(()=>{this._buildInProgress=!1,this._processBuildQueue()})}delete(e){if(e.isRenderObject){let t=this.get(e).nodeBuilderState;t!==void 0&&(t.usedTimes--,t.usedTimes===0&&this.nodeBuilderCache.delete(this.getForRenderCacheKey(e)))}return super.delete(e)}getForCompute(e){let t=this.get(e),n=t.nodeBuilderState;if(n===void 0||t.version!==e.version){let r=this.backend.createNodeBuilder(e,this.renderer);r.build(),n=this._createNodeBuilderState(r),t.nodeBuilderState=n,t.version=e.version}return n}_createNodeBuilderState(e){return new Ok(e.vertexShader,e.fragmentShader,e.computeShader,e.getAttributesArray(),e.getBindings(),e.updateNodes,e.updateBeforeNodes,e.updateAfterNodes,e.observer,e.hardwareClipping,e.transforms)}getEnvironmentNode(e){if(this.renderer.lighting.enabled===!1)return null;this.updateEnvironment(e);let t=null;if(e.environmentNode&&e.environmentNode.isNode)t=e.environmentNode;else{let n=this.get(e);n.environmentNode&&(t=n.environmentNode)}return t}getBackgroundNode(e){this.updateBackground(e);let t=null;if(e.backgroundNode&&e.backgroundNode.isNode)t=e.backgroundNode;else{let n=this.get(e);n.backgroundNode&&(t=n.backgroundNode)}return t}getFogNode(e){return this.updateFog(e),e.fogNode||this.get(e).fogNode||null}getCacheKey(e,t){Yc[0]=e,Yc[1]=t;let n=this.renderer.info.calls,r=this.callHashCache.get(Yc)||{};if(r.callId!==n){if(Gd.push(this.renderer.getOutputRenderTarget()&&this.renderer.getOutputRenderTarget().multiview?1:0),Gd.push(this.renderer.lighting.enabled?1:0),this.renderer.lighting.enabled){Gd.push(t.getCacheKey(!0)),Gd.push(this.renderer.shadowMap.enabled?1:0),Gd.push(this.renderer.shadowMap.type);let o=this.getEnvironmentNode(e);o&&Gd.push(o.getCacheKey())}let s=this.getFogNode(e);s&&Gd.push(s.getCacheKey()),r.callId=n,r.cacheKey=LS(Gd),this.callHashCache.set(Yc,r),Gd.length=0}return Yc[0]=null,Yc[1]=null,r.cacheKey}get isToneMappingState(){return!this.renderer.getRenderTarget()}updateBackground(e){let t=this.get(e),n=e.background;if(n){let r=e.backgroundBlurriness===0&&t.backgroundBlurriness>0||e.backgroundBlurriness>0&&t.backgroundBlurriness===0;if(t.background!==n||r){let s=this.getCacheNode("background",n,()=>{if(n.isCubeTexture===!0||n.mapping===p0||n.mapping===m0||n.mapping===Bh){if(e.backgroundBlurriness>0||n.mapping===Bh)return wV(n);{let o;return n.isCubeTexture===!0?o=Qa(n):o=fi(n),lse(o)}}else{if(n.isTexture===!0)return fi(n,ju.flipY()).setUpdateMatrix(!0);n.isColor!==!0&&ze("WebGPUNodes: Unsupported background configuration.",n)}},r);t.backgroundNode=s,t.background=n,t.backgroundBlurriness=e.backgroundBlurriness}}else t.backgroundNode&&(delete t.backgroundNode,delete t.background)}getCacheNode(e,t,n,r=!1){let s=this.cacheLib[e]||(this.cacheLib[e]=new WeakMap),o=s.get(t);return(o===void 0||r)&&(o=n(),s.set(t,o)),o}updateFog(e){let t=this.get(e),n=e.fog;if(n){if(t.fog!==n){let r=this.getCacheNode("fog",n,()=>{if(n.isFogExp2){let s=mr("color","color",n).setGroup(Jt),o=mr("density","float",n).setGroup(Jt);return Mk(s,Hse(o))}else if(n.isFog){let s=mr("color","color",n).setGroup(Jt),o=mr("near","float",n).setGroup(Jt),a=mr("far","float",n).setGroup(Jt);return Mk(s,qse(o,a))}else ze("Renderer: Unsupported fog configuration.",n)});t.fogNode=r,t.fog=n}}else delete t.fogNode,delete t.fog}updateEnvironment(e){let t=this.get(e),n=e.environment;if(n){if(t.environment!==n){let r=this.getCacheNode("environment",n,()=>{if(n.isCubeTexture===!0)return Qa(n);if(n.isTexture===!0)return fi(n);ze("Nodes: Unsupported environment configuration.",n)});t.environmentNode=r,t.environment=n}}else t.environmentNode&&(delete t.environmentNode,delete t.environment)}getNodeFrame(e=this.renderer,t=null,n=null,r=null,s=null){let o=this.nodeFrame;return o.renderer=e,o.scene=t,o.object=n,o.camera=r,o.material=s,o}getNodeFrameForRender(e){return this.getNodeFrame(e.renderer,e.scene,e.object,e.camera,e.material)}getOutputCacheKey(){let e=this.renderer;return e.toneMapping+","+e.currentColorSpace+","+e.xr.isPresenting}getOutputNode(e){let t=this.renderer,n;return e.isArrayTexture?this.backend.isWebGLBackend?n=fi(e,ju).depth(tp("gl_ViewID_OVR")).renderOutput(t.toneMapping,t.currentColorSpace):n=fi(e,ju).depth(Lte).renderOutput(t.toneMapping,t.currentColorSpace):n=fi(e,ju).renderOutput(t.toneMapping,t.currentColorSpace),n}setOutputLayerIndex(e){Lte.value=e}updateBefore(e){let t=e.getNodeBuilderState();for(let n of t.updateBeforeNodes)this.getNodeFrameForRender(e).updateBeforeNode(n)}updateAfter(e){let t=e.getNodeBuilderState();for(let n of t.updateAfterNodes)this.getNodeFrameForRender(e).updateAfterNode(n)}updateForCompute(e){let t=this.getNodeFrame(),n=this.getForCompute(e);for(let r of n.updateNodes)t.updateNode(r)}updateForRender(e){let t=this.getNodeFrameForRender(e),n=e.getNodeBuilderState();for(let r of n.updateNodes)t.updateNode(r)}needsRefresh(e){let t=this.getNodeFrameForRender(e);return e.getMonitor().needsRefresh(e,t)}dispose(){super.dispose(),this.nodeFrame=new j4,this.nodeBuilderCache=new Map,this.cacheLib={}}},uU=new Na,$4=class i{constructor(e=null){this.version=0,this.clipIntersection=null,this.cacheKey="",this.shadowPass=!1,this.viewMatrix=new cn,this.viewNormalMatrix=new Mn,this.clippingGroupContexts=new WeakMap,this.intersectionPlanes=[],this.unionPlanes=[],this.parentVersion=null,e!==null&&(this.viewMatrix=e.viewMatrix,this.viewNormalMatrix=e.viewNormalMatrix,this.clippingGroupContexts=e.clippingGroupContexts,this.shadowPass=e.shadowPass)}projectPlanes(e,t,n){let r=e.length;for(let s=0;s<r;s++){uU.copy(e[s]).applyMatrix4(this.viewMatrix,this.viewNormalMatrix);let o=t[n+s],a=uU.normal;o.x=-a.x,o.y=-a.y,o.z=-a.z,o.w=uU.constant}}updateGlobal(e,t){this.shadowPass=e.overrideMaterial!==null&&e.overrideMaterial.isShadowPassMaterial,this.viewMatrix.copy(t.matrixWorldInverse),this.viewNormalMatrix.getNormalMatrix(this.viewMatrix)}update(e,t){let n=!1;e.version!==this.parentVersion&&(this.intersectionPlanes=Array.from(e.intersectionPlanes),this.unionPlanes=Array.from(e.unionPlanes),this.parentVersion=e.version),this.clipIntersection!==t.clipIntersection&&(this.clipIntersection=t.clipIntersection,this.clipIntersection?this.unionPlanes.length=e.unionPlanes.length:this.intersectionPlanes.length=e.intersectionPlanes.length);let r=t.clippingPlanes,s=r.length,o,a;if(this.clipIntersection?(o=this.intersectionPlanes,a=e.intersectionPlanes.length):(o=this.unionPlanes,a=e.unionPlanes.length),o.length!==a+s){o.length=a+s;for(let l=0;l<s;l++)o[a+l]=new xn;n=!0}this.projectPlanes(r,o,a),n&&(this.version++,this.cacheKey=`${this.intersectionPlanes.length}:${this.unionPlanes.length}`)}getGroupContext(e){if(this.shadowPass&&!e.clipShadows)return this;let t=this.clippingGroupContexts.get(e);return t===void 0&&(t=new i(this),this.clippingGroupContexts.set(e,t)),t.update(this,e),t}get unionClippingCount(){return this.unionPlanes.length}},p9=class{constructor(e,t,n){this.bundleGroup=e,this.camera=t,this.renderContext=n}},tm=[],m9=class{constructor(){this.bundles=new Sf}get(e,t,n){let r=this.bundles;tm[0]=e,tm[1]=t,tm[2]=n;let s=r.get(tm);return s===void 0&&(s=new p9(e,t,n),r.set(tm,s)),tm[0]=null,tm[1]=null,tm[2]=null,s}dispose(){this.bundles=new Sf}},Y4=class{constructor(){this.lightNodes=new WeakMap,this.materialNodes=new Map,this.toneMappingNodes=new Map}fromMaterial(e){if(e.isNodeMaterial)return e;let t=null,n=this.getMaterialNodeClass(e.type);if(n!==null){t=new n;for(let r in e)t[r]=e[r]}return t}addToneMapping(e,t){this.addType(e,t,this.toneMappingNodes)}getToneMappingFunction(e){return this.toneMappingNodes.get(e)||null}getMaterialNodeClass(e){return this.materialNodes.get(e)||null}addMaterial(e,t){this.addType(e,t,this.materialNodes)}getLightNodeClass(e){return this.lightNodes.get(e)||null}addLight(e,t){this.addClass(e,t,this.lightNodes)}addType(e,t,n){if(n.has(t)){Xe(`Redefinition of node ${t}`);return}if(typeof e!="function")throw new Error(`THREE.NodeLibrary: Node class ${e.name} is not a class.`);if(typeof t=="function"||typeof t=="object")throw new Error(`THREE.NodeLibrary: Base class ${t} is not a class.`);n.set(t,e)}addClass(e,t,n){if(n.has(t)){Xe(`Redefinition of node ${t.name}`);return}if(typeof e!="function")throw new Error(`THREE.NodeLibrary: Node class ${e.name} is not a class.`);if(typeof t!="function")throw new Error(`THREE.NodeLibrary: Base class ${t.name} is not a class.`);n.set(t,e)}},mIe=new SS,Dte=new WeakMap,A9=class{constructor(){this.enabled=!0,this._cache=[]}createNode(e=[]){return new SS().setLights(e)}getNode(e){if(e.isScene!==!0&&e.isGroup!==!0)return mIe;let t=Dte.get(e);return t===void 0&&(t=this.createNode(),Dte.set(e,t)),t}beginRender(e){this._cache.push(this.getNode(e).getLights())}finishRender(e){this.getNode(e).setLights(this._cache.pop())}},Hg=class extends Ba{constructor(e=1,t=1,n={}){super(e,t,n),this.isXRRenderTarget=!0,this._hasExternalTextures=!1,this._autoAllocateDepthBuffer=!0,this._isOpaqueFramebuffer=!1}copy(e){return super.copy(e),this._hasExternalTextures=e._hasExternalTextures,this._autoAllocateDepthBuffer=e._autoAllocateDepthBuffer,this._isOpaqueFramebuffer=e._isOpaqueFramebuffer,this}},Nte=new re,Fte=new re,Bte=new WeakMap,g9=class extends ca{constructor(e,t=!1){super(),this.enabled=!1,this.isPresenting=!1,this.cameraAutoUpdate=!0,this._renderer=e,this._cameraL=new Yr,this._cameraL.viewport=new xn,this._cameraL.matrixWorldAutoUpdate=!1,this._cameraR=new Yr,this._cameraR.viewport=new xn,this._cameraR.matrixWorldAutoUpdate=!1,this._cameras=[this._cameraL,this._cameraR],this._cameraXR=new a_,this._currentDepthNear=null,this._currentDepthFar=null,this._controllers=[],this._controllerInputSources=[],this._xrRenderTarget=null,this._layers=[],this._sessionUsesLayers=!1,this._supportsGlBinding=typeof XRWebGLBinding<"u",this._supportsWebGPUBinding=typeof globalThis.XRGPUBinding<"u",this._createXRLayer=yIe.bind(this),this._gl=null,this._currentAnimationContext=null,this._currentAnimationLoop=null,this._currentPixelRatio=null,this._currentSamples=null,this._currentSize=new Oe,this._onSessionEvent=vIe.bind(this),this._onSessionEnd=_Ie.bind(this),this._onInputSourcesChange=xIe.bind(this),this._onAnimationFrame=bIe.bind(this),this._referenceSpace=null,this._referenceSpaceType="local-floor",this._customReferenceSpace=null,this._framebufferScaleFactor=1,this._foveation=1,this._session=null,this._glBaseLayer=null,this._glBinding=null,this._webgpuBinding=null,this._glProjLayer=null,this._xrFrame=null,this._supportsLayers=this._supportsGlBinding&&"createProjectionLayer"in XRWebGLBinding.prototype,this._useMultiviewIfPossible=t,this._useMultiview=!1}getController(e){return this._getController(e).getTargetRaySpace()}getControllerGrip(e){return this._getController(e).getGripSpace()}getHand(e){return this._getController(e).getHandSpace()}getFoveation(){return this._foveation}setFoveation(e){this._foveation=e,this._glProjLayer!==null&&(this._glProjLayer.fixedFoveation=e),this._glBaseLayer!==null&&this._glBaseLayer.fixedFoveation!==void 0&&(this._glBaseLayer.fixedFoveation=e)}getFramebufferScaleFactor(){return this._framebufferScaleFactor}setFramebufferScaleFactor(e){this._framebufferScaleFactor=e,this.isPresenting===!0&&Xe("XRManager: Cannot change framebuffer scale while presenting.")}getReferenceSpaceType(){return this._referenceSpaceType}setReferenceSpaceType(e){this._referenceSpaceType=e,this.isPresenting===!0&&Xe("XRManager: Cannot change reference space type while presenting.")}getReferenceSpace(){return this._customReferenceSpace||this._referenceSpace}setReferenceSpace(e){this._customReferenceSpace=e}getCamera(){return this._cameraXR}getEnvironmentBlendMode(){if(this._session!==null)return this._session.environmentBlendMode}getBaseLayer(){return this._glProjLayer!==null?this._glProjLayer:this._glBaseLayer}getBinding(){return this._glBinding===null&&this._supportsGlBinding&&(this._glBinding=new XRWebGLBinding(this._session,this._gl)),this._glBinding}foveateBoundTexture(e){if(e.isPostProcessingRenderTarget!==!0||this.isPresenting!==!0||this._glProjLayer===null)return;let t=this._renderer.backend;if(t===void 0||t.isWebGLBackend!==!0||t.state===null)return;let n=this._renderer.getOutputRenderTarget();if(n===null||n.isXRRenderTarget!==!0)return;let r=this.getBinding();if(r===null||typeof r.foveateBoundTexture!="function")return;this._renderer._textures.updateRenderTarget(e);let{textureGPU:s,glTextureType:o}=t.get(e.texture);if(!(s===void 0||o===void 0)&&e._xrFoveationTextureGPU!==s){e._xrFoveationTextureGPU=s,t.state.bindTexture(o,s);try{r.foveateBoundTexture(o,this.getFoveation())}catch(a){ni(`XRManager: Unable to foveate bound XR post-processing texture. ${a.name}: ${a.message}`)}finally{t.state.unbindTexture()}}}getWebGPUBinding(){return this._webgpuBinding===null&&this._supportsWebGPUBinding&&(this._webgpuBinding=new globalThis.XRGPUBinding(this._session,this._renderer.backend.device)),this._webgpuBinding}_isWebGPUSession(){return this._renderer.backend.isWebGPUBackend===!0&&this._session!==null&&this._session.enabledFeatures.includes("webgpu")}_validateWebGPUSession(){let e=this._renderer;if(e.backend.isWebGPUBackend===!0){if(this._session.enabledFeatures.includes("webgpu")===!1)throw new Error('THREE.XRManager: WebGPU XR sessions require the "webgpu" session feature. Use VRButtonGPU/XRButton with "webgpu" enabled or use a WebGL backend.');e.samples>0&&(ni("THREE.XRManager: WebGPU XR does not support MSAA yet. Disabling MSAA for this XR session."),this._currentSamples===null&&(this._currentSamples=e.samples),e._samples=0)}}async _initWebGPUSession(e){let t=this.getWebGPUBinding(),n=t.createProjectionLayer({colorFormat:t.getPreferredColorFormat(),depthStencilFormat:"depth24plus"});this._glProjLayer=n,e.updateRenderState({layers:[n]}),this._referenceSpace=await e.requestReferenceSpace(this.getReferenceSpaceType()),this._xrRenderTarget=new Ba(n.textureWidth,n.textureHeight,{depth:2,minFilter:Mi,magFilter:Mi,depthBuffer:!0,multiview:!1,useArrayDepthTexture:!0,samples:0}),this._xrRenderTarget.texture.isArrayTexture=!0,this._useMultiviewIfPossible===!0&&ni("THREE.XRManager: WebGPU XR does not support multiview yet. Disabling multiview for this XR session."),this._useMultiview=!1}_disposeWebGPUSession(){let e=this._renderer,t=this._xrRenderTarget;if(t===null||e.backend.isWebGPUBackend!==!0)return;let n=e.backend,r=e._textures,s=n.get?n.get(t):null;s&&(s.descriptors=void 0);let o=a=>{a!=null&&(n.delete&&n.delete(a),r.delete&&r.delete(a))};for(let a=0;a<t.textures.length;a++)o(t.textures[a]);o(t.depthTexture),o(t),e._renderContexts&&e._renderContexts.dispose&&e._renderContexts.dispose(),t.dispose()}_getWebGPUViewData(e){let t=this.getWebGPUBinding(),n={colorTexture:null,viewDescriptors:[],viewports:[]};for(let r=0;r<e.length;r++){let s=t.getViewSubImage(this._glProjLayer,e[r]);n.colorTexture===null&&(n.colorTexture=s.colorTexture),n.viewports.push(s.viewport),s.getViewDescriptor&&n.viewDescriptors.push(s.getViewDescriptor())}return n}getFrame(){return this._xrFrame}useMultiview(){return this._useMultiview}createQuadLayer(e,t,n,r,s,o,a,l={}){let c=new YA(e,t),u=new Hg(s,o,{format:Or,type:Ji,depthTexture:new Es(s,o,l.stencil?ua:xi,void 0,void 0,void 0,void 0,void 0,void 0,l.stencil?xo:Vs),stencilBuffer:l.stencil,resolveDepthBuffer:!1,resolveStencilBuffer:!1});u._autoAllocateDepthBuffer=!0;let f=new fs({color:16777215,side:zo});f.map=u.texture,f.map.offset.y=1,f.map.repeat.y=-1;let d=new Hn(c,f);d.position.copy(n),d.quaternion.copy(r);let A={type:"quad",width:e,height:t,translation:n,quaternion:r,pixelwidth:s,pixelheight:o,plane:d,material:f,rendercall:a,renderTarget:u};if(this._layers.push(A),this._session!==null){A.plane.material=new fs({color:16777215,side:zo}),A.plane.material.blending=Dd,A.plane.material.blendEquation=oo,A.plane.material.blendSrc=Nu,A.plane.material.blendDst=Nu,A.xrlayer=this._createXRLayer(A);let y=this._session.renderState.layers;y.unshift(A.xrlayer),this._session.updateRenderState({layers:y})}else u.isXRRenderTarget=!1;return d}createCylinderLayer(e,t,n,r,s,o,a,l,c={}){let u=new jA(e,e,e*t/n,64,64,!0,Math.PI-t/2,t),f=new Hg(o,a,{format:Or,type:Ji,depthTexture:new Es(o,a,c.stencil?ua:xi,void 0,void 0,void 0,void 0,void 0,void 0,c.stencil?xo:Vs),stencilBuffer:c.stencil,resolveDepthBuffer:!1,resolveStencilBuffer:!1});f._autoAllocateDepthBuffer=!0;let d=new fs({color:16777215,side:mi});d.map=f.texture,d.map.offset.y=1,d.map.repeat.y=-1;let A=new Hn(u,d);A.position.copy(r),A.quaternion.copy(s);let y={type:"cylinder",radius:e,centralAngle:t,aspectratio:n,translation:r,quaternion:s,pixelwidth:o,pixelheight:a,plane:A,material:d,rendercall:l,renderTarget:f};if(this._layers.push(y),this._session!==null){y.plane.material=new fs({color:16777215,side:mi}),y.plane.material.blending=Dd,y.plane.material.blendEquation=oo,y.plane.material.blendSrc=Nu,y.plane.material.blendDst=Nu,y.xrlayer=this._createXRLayer(y);let w=this._session.renderState.layers;w.unshift(y.xrlayer),this._session.updateRenderState({layers:w})}else f.isXRRenderTarget=!1;return A}renderLayers(){let e=new re,t=new Gs,n=this._renderer,r=this.isPresenting;this.isPresenting=!1;let s=new Oe;n.getSize(s);let o=n.getRenderTarget();for(let a of this._layers){a.renderTarget.isXRRenderTarget=this._session!==null,a.renderTarget._hasExternalTextures=a.renderTarget.isXRRenderTarget;let l=n.contextNode,c;if(a.renderTarget.isXRRenderTarget&&this._sessionUsesLayers){a.xrlayer.transform=new XRRigidTransform(a.plane.getWorldPosition(e),a.plane.getWorldQuaternion(t));let u=this._glBinding.getSubImage(a.xrlayer,this._xrFrame);n.backend.setXRRenderTargetTextures(a.renderTarget,u.colorTexture,void 0),n._setXRLayerSize(a.renderTarget.width,a.renderTarget.height),c=Bte.get(l),c===void 0&&(c=l.context({getOutput:f=>$z(f,n.toneMapping,n.outputColorSpace)}),Bte.set(l,c))}else c=l;n.contextNode=c,n.setRenderTarget(a.renderTarget),a.rendercall(),n.contextNode=l}n.setRenderTarget(o),n._setXRLayerSize(s.x,s.y),this.isPresenting=r}getSession(){return this._session}async setSession(e){let t=this._renderer;t.initialized===!1&&await t.init(),this._gl=t.getContext();let n=this._gl;if(this._session=e,e!==null){if(e.addEventListener("select",this._onSessionEvent),e.addEventListener("selectstart",this._onSessionEvent),e.addEventListener("selectend",this._onSessionEvent),e.addEventListener("squeeze",this._onSessionEvent),e.addEventListener("squeezestart",this._onSessionEvent),e.addEventListener("squeezeend",this._onSessionEvent),e.addEventListener("end",this._onSessionEnd),e.addEventListener("inputsourceschange",this._onInputSourcesChange),this._validateWebGPUSession(),this._currentPixelRatio=t.getPixelRatio(),t.getSize(this._currentSize),this._currentAnimationContext=t._animation.getContext(),this._currentAnimationLoop=t._animation.getAnimationLoop(),t._animation.stop(),this._isWebGPUSession())await this._initWebGPUSession(e);else if(this._supportsLayers===!0){let r=null,s=null,o=null,a=n.getContextAttributes();await t.backend.makeXRCompatible(),this.setFoveation(this.getFoveation()),t.depth&&(o=t.stencil?n.DEPTH24_STENCIL8:n.DEPTH_COMPONENT24,r=t.stencil?xo:Vs,s=t.stencil?ua:xi);let l={colorFormat:n.RGBA8,depthFormat:o,scaleFactor:this._framebufferScaleFactor,clearOnAccess:!1};this._useMultiviewIfPossible&&t.hasFeature("OVR_multiview2")&&(l.textureType="texture-array",this._useMultiview=!0),this._glBinding=this.getBinding();let c=this._glBinding.createProjectionLayer(l),u=[c];this._glProjLayer=c,t.setPixelRatio(1),t._setXRLayerSize(c.textureWidth,c.textureHeight);let f=this._useMultiview?2:1,d=new Es(c.textureWidth,c.textureHeight,s,void 0,void 0,void 0,void 0,void 0,void 0,r,f);if(this._xrRenderTarget=new Hg(c.textureWidth,c.textureHeight,{format:Or,type:Ji,colorSpace:t.outputColorSpace,depthTexture:d,stencilBuffer:t.stencil,samples:a.antialias?4:0,resolveDepthBuffer:c.ignoreDepthValues===!1,resolveStencilBuffer:c.ignoreDepthValues===!1,depth:this._useMultiview?2:1,multiview:this._useMultiview}),this._xrRenderTarget._hasExternalTextures=!0,this._xrRenderTarget.depth=this._useMultiview?2:1,this._sessionUsesLayers=e.enabledFeatures.includes("layers"),this._referenceSpace=await e.requestReferenceSpace(this.getReferenceSpaceType()),this._sessionUsesLayers)for(let A of this._layers)A.plane.material=new fs({color:16777215,side:A.type==="cylinder"?mi:zo}),A.plane.material.blending=Dd,A.plane.material.blendEquation=oo,A.plane.material.blendSrc=Nu,A.plane.material.blendDst=Nu,A.xrlayer=this._createXRLayer(A),u.unshift(A.xrlayer);e.updateRenderState({layers:u})}else{await t.backend.makeXRCompatible(),this.setFoveation(this.getFoveation());let r={antialias:t.currentSamples>0,alpha:!0,depth:t.depth,stencil:t.stencil,framebufferScaleFactor:this.getFramebufferScaleFactor()},s=new XRWebGLLayer(e,n,r);this._glBaseLayer=s,e.updateRenderState({baseLayer:s}),t.setPixelRatio(1),t._setXRLayerSize(s.framebufferWidth,s.framebufferHeight),this._xrRenderTarget=new Hg(s.framebufferWidth,s.framebufferHeight,{format:Or,type:Ji,colorSpace:t.outputColorSpace,stencilBuffer:t.stencil,resolveDepthBuffer:s.ignoreDepthValues===!1,resolveStencilBuffer:s.ignoreDepthValues===!1}),this._xrRenderTarget._isOpaqueFramebuffer=!0,this._referenceSpace=await e.requestReferenceSpace(this.getReferenceSpaceType())}t._animation.setAnimationLoop(this._onAnimationFrame),t._animation.setContext(e),t._animation.start(),this.isPresenting=!0,this.dispatchEvent({type:"sessionstart"})}}updateCamera(e){let t=this._session;if(t===null)return;let n=e.near,r=e.far,s=this._cameraXR,o=this._cameraL,a=this._cameraR;s.near=a.near=o.near=n,s.far=a.far=o.far=r,s.isMultiViewCamera=this._useMultiview,(this._currentDepthNear!==s.near||this._currentDepthFar!==s.far)&&(t.updateRenderState({depthNear:s.near,depthFar:s.far}),this._currentDepthNear=s.near,this._currentDepthFar=s.far),s.layers.mask=e.layers.mask|6,o.layers.mask=s.layers.mask&-5,a.layers.mask=s.layers.mask&-3;let l=e.parent,c=s.cameras;Ote(s,l);for(let u=0;u<c.length;u++)Ote(c[u],l);c.length===2?AIe(s,o,a):s.projectionMatrix.copy(o.projectionMatrix),gIe(e,s,l)}_getController(e){let t=this._controllers[e];return t===void 0&&(t=new r0,this._controllers[e]=t),t}};function AIe(i,e,t){Nte.setFromMatrixPosition(e.matrixWorld),Fte.setFromMatrixPosition(t.matrixWorld);let n=Nte.distanceTo(Fte),r=e.projectionMatrix.elements,s=t.projectionMatrix.elements,o=r[14]/(r[10]-1),a=r[14]/(r[10]+1),l=(r[9]+1)/r[5],c=(r[9]-1)/r[5],u=(r[8]-1)/r[0],f=(s[8]+1)/s[0],d=o*u,A=o*f,y=n/(-u+f),w=y*-u;if(e.matrixWorld.decompose(i.position,i.quaternion,i.scale),i.translateX(w),i.translateZ(y),i.matrixWorld.compose(i.position,i.quaternion,i.scale),i.matrixWorldInverse.copy(i.matrixWorld).invert(),r[10]===-1)i.projectionMatrix.copy(e.projectionMatrix),i.projectionMatrixInverse.copy(e.projectionMatrixInverse);else{let S=o+y,T=a+y,R=d-w,I=A+(n-w),P=l*a/T*S,F=c*a/T*S;i.projectionMatrix.makePerspective(R,I,P,F,S,T),i.projectionMatrixInverse.copy(i.projectionMatrix).invert()}}function Ote(i,e){e===null?i.matrixWorld.copy(i.matrix):i.matrixWorld.multiplyMatrices(e.matrixWorld,i.matrix),i.matrixWorldInverse.copy(i.matrixWorld).invert()}function gIe(i,e,t){t===null?i.matrix.copy(e.matrixWorld):(i.matrix.copy(t.matrixWorld),i.matrix.invert(),i.matrix.multiply(e.matrixWorld)),i.matrix.decompose(i.position,i.quaternion,i.scale),i.updateMatrixWorld(!0),i.projectionMatrix.copy(e.projectionMatrix),i.projectionMatrixInverse.copy(e.projectionMatrixInverse),i.isPerspectiveCamera&&(i.fov=Cd*2*Math.atan(1/i.projectionMatrix.elements[5]),i.zoom=1)}function vIe(i){let e=this._controllerInputSources.indexOf(i.inputSource);if(e===-1)return;let t=this._controllers[e];if(t!==void 0){let n=this.getReferenceSpace();t.update(i.inputSource,i.frame,n),t.dispatchEvent({type:i.type,data:i.inputSource})}}function _Ie(){let i=this._session,e=this._renderer;i.removeEventListener("select",this._onSessionEvent),i.removeEventListener("selectstart",this._onSessionEvent),i.removeEventListener("selectend",this._onSessionEvent),i.removeEventListener("squeeze",this._onSessionEvent),i.removeEventListener("squeezestart",this._onSessionEvent),i.removeEventListener("squeezeend",this._onSessionEvent),i.removeEventListener("end",this._onSessionEnd),i.removeEventListener("inputsourceschange",this._onInputSourcesChange);for(let t=0;t<this._controllers.length;t++){let n=this._controllerInputSources[t];n!==null&&(this._controllerInputSources[t]=null,this._controllers[t].disconnect(n))}if(this._currentDepthNear=null,this._currentDepthFar=null,this._currentSamples!==null&&(e._samples=this._currentSamples,this._currentSamples=null),e._resetXRState(),this._disposeWebGPUSession(),this._session=null,this._xrRenderTarget=null,this._glBinding=null,this._webgpuBinding=null,this._glBaseLayer=null,this._glProjLayer=null,this._sessionUsesLayers===!0)for(let t of this._layers)t.renderTarget=new Hg(t.pixelwidth,t.pixelheight,{format:Or,type:Ji,depthTexture:new Es(t.pixelwidth,t.pixelheight,t.stencilBuffer?ua:xi,void 0,void 0,void 0,void 0,void 0,void 0,t.stencilBuffer?xo:Vs),stencilBuffer:t.stencilBuffer,resolveDepthBuffer:!1,resolveStencilBuffer:!1}),t.renderTarget.isXRRenderTarget=!1,t.plane.material=t.material,t.material.map=t.renderTarget.texture,t.material.map.offset.y=1,t.material.map.repeat.y=-1,delete t.xrlayer;this.isPresenting=!1,this._useMultiview=!1,e._animation.stop(),e._animation.setAnimationLoop(this._currentAnimationLoop),e._animation.setContext(this._currentAnimationContext),e._animation.start(),e.setPixelRatio(this._currentPixelRatio),e.setSize(this._currentSize.width,this._currentSize.height,!1),this.dispatchEvent({type:"sessionend"})}function xIe(i){let e=this._controllers,t=this._controllerInputSources;for(let n=0;n<i.removed.length;n++){let r=i.removed[n],s=t.indexOf(r);s>=0&&(t[s]=null,e[s].disconnect(r))}for(let n=0;n<i.added.length;n++){let r=i.added[n],s=t.indexOf(r);if(s===-1){for(let a=0;a<e.length;a++)if(a>=t.length){t.push(r),s=a;break}else if(t[a]===null){t[a]=r,s=a;break}if(s===-1)break}let o=e[s];o&&o.connect(r)}}function yIe(i){return i.type==="quad"?this._glBinding.createQuadLayer({transform:new XRRigidTransform(i.translation,i.quaternion),width:i.width/2,height:i.height/2,space:this._referenceSpace,viewPixelWidth:i.pixelwidth,viewPixelHeight:i.pixelheight,clearOnAccess:!1}):this._glBinding.createCylinderLayer({transform:new XRRigidTransform(i.translation,i.quaternion),radius:i.radius,centralAngle:i.centralAngle,aspectRatio:i.aspectRatio,space:this._referenceSpace,viewPixelWidth:i.pixelwidth,viewPixelHeight:i.pixelheight,clearOnAccess:!1})}function bIe(i,e){if(e===void 0)return;let t=this._cameraXR,n=this._renderer,r=n.backend,s=this._glBaseLayer,o=this.getReferenceSpace(),a=e.getViewerPose(o);if(this._xrFrame=e,a!==null){let l=a.views,c=this._isWebGPUSession()?this._getWebGPUViewData(l):null;this._glBaseLayer!==null&&c===null&&r.setXRTarget(s.framebuffer);let u=!1;l.length!==t.cameras.length&&(t.cameras.length=0,u=!0);for(let d=0;d<l.length;d++){let A=l[d],y;if(c!==null)y=c.viewports[d];else if(this._supportsLayers===!0){let S=this._glBinding.getViewSubImage(this._glProjLayer,A);y=S.viewport,d===0&&r.setXRRenderTargetTextures(this._xrRenderTarget,S.colorTexture,this._glProjLayer.ignoreDepthValues&&!this._useMultiview?void 0:S.depthStencilTexture)}else y=s.getViewport(A);let w=this._cameras[d];w===void 0&&(w=new Yr,w.layers.enable(d),w.viewport=new xn,w.matrixWorldAutoUpdate=!1,this._cameras[d]=w),w.matrix.fromArray(A.transform.matrix),w.matrix.decompose(w.position,w.quaternion,w.scale),w.projectionMatrix.fromArray(A.projectionMatrix),w.projectionMatrixInverse.copy(w.projectionMatrix).invert(),w.viewport.set(y.x,y.y,y.width,y.height),d===0&&(t.matrix.copy(w.matrix),t.matrix.decompose(t.position,t.quaternion,t.scale)),u===!0&&t.cameras.push(w)}c!==null&&c.colorTexture!==null&&r.setXRRenderTargetTextures(this._xrRenderTarget,c.colorTexture,c.viewDescriptors),n.setOutputRenderTarget(this._xrRenderTarget);let f=n._getFrameBufferTarget();n.xr.foveateBoundTexture(f)}for(let l=0;l<this._controllers.length;l++){let c=this._controllerInputSources[l],u=this._controllers[l];c!==null&&u!==void 0&&u.update(c,e,o)}this._currentAnimationLoop&&this._currentAnimationLoop(i,e),e.detectedPlanes&&this.dispatchEvent({type:"planesdetected",data:e}),this._xrFrame=null}var v9=class extends ca{constructor(e){super(),this.domElement=e,this._pixelRatio=1,this._width=this.domElement.width,this._height=this.domElement.height,this._viewport=new xn(0,0,this._width,this._height),this._scissor=new xn(0,0,this._width,this._height),this._scissorTest=!1,this.colorTexture=new WA,this.depthTexture=new Es}getPixelRatio(){return this._pixelRatio}getDrawingBufferSize(e){return e.set(this._width*this._pixelRatio,this._height*this._pixelRatio).floor()}getSize(e){return e.set(this._width,this._height)}setPixelRatio(e=1){this._pixelRatio!==e&&(this._pixelRatio=e,this.setSize(this._width,this._height,!1))}setDrawingBufferSize(e,t,n){this.xr&&this.xr.isPresenting||(this._width=e,this._height=t,this._pixelRatio=n,this.domElement.width=Math.floor(e*n),this.domElement.height=Math.floor(t*n),this.setViewport(0,0,e,t),this._dispatchResize())}setSize(e,t,n=!0){this.xr&&this.xr.isPresenting||(this._width=e,this._height=t,this.domElement.width=Math.floor(e*this._pixelRatio),this.domElement.height=Math.floor(t*this._pixelRatio),n===!0&&(this.domElement.style.width=e+"px",this.domElement.style.height=t+"px"),this.setViewport(0,0,e,t),this._dispatchResize())}getScissor(e){let t=this._scissor;return e.x=t.x,e.y=t.y,e.width=t.width,e.height=t.height,e}setScissor(e,t,n,r){let s=this._scissor;e.isVector4?s.copy(e):s.set(e,t,n,r)}getScissorTest(){return this._scissorTest}setScissorTest(e){this._scissorTest=e}getViewport(e){return e.copy(this._viewport)}setViewport(e,t,n,r,s=0,o=1){let a=this._viewport;e.isVector4?a.copy(e):a.set(e,t,n,r),a.minDepth=s,a.maxDepth=o}_dispatchResize(){this.dispatchEvent({type:"resize"})}dispose(){this.dispatchEvent({type:"dispose"})}},Ute=new s0,W_=new Oe,hU=new xn,BR=new zc,OR=new N2,j_=new cn,qd=new xn,wIe={[zo]:mi,[mi]:zo,[vr]:vr},_9=class{constructor(e,t={}){this.isRenderer=!0;let{logarithmicDepthBuffer:n=!1,reversedDepthBuffer:r=!1,alpha:s=!0,depth:o=!0,stencil:a=!1,antialias:l=!1,samples:c=0,getFallback:u=null,outputBufferType:f=Wi,multiview:d=!1}=t;this.backend=e,this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.alpha=s,this.logarithmicDepthBuffer=n,this.reversedDepthBuffer=r,this.outputColorSpace=Fr,this.toneMapping=ao,this.toneMappingExposure=1,this.sortObjects=!0,this.depth=o,this.stencil=a,this.info=new K7,this.contextNode=ep(),this.library=new Y4,this.lighting=new A9,this._samples=c||l===!0?4:0,this._onCanvasTargetResize=this._onCanvasTargetResize.bind(this),this._canvasTarget=new v9(e.getDomElement()),this._canvasTarget.addEventListener("resize",this._onCanvasTargetResize),this._canvasTarget.isDefaultCanvasTarget=!0,this._inspector=new p4,this._inspector.setRenderer(this),this._getFallback=u,this._attributes=null,this._geometries=null,this._nodes=null,this._animation=null,this._bindings=null,this._objects=null,this._pipelines=null,this._bundles=null,this._renderLists=null,this._renderContexts=null,this._textures=null,this._background=null,this._quadCache=new Map,this._currentRenderContext=null,this._opaqueSort=null,this._transparentSort=null,this._frameBufferTargets=new Map;let A=this.alpha===!0?0:1;this._clearColor=new xS(0,0,0,A),this._clearDepth=1,this._clearStencil=0,this._renderTarget=null,this._activeCubeFace=0,this._activeMipmapLevel=0,this._outputRenderTarget=null,this._mrt=null,this._renderObjectFunction=null,this._currentRenderObjectFunction=null,this._currentRenderBundle=null,this._handleObjectFunction=this._renderObjectDirect,this._isDeviceLost=!1,this.onDeviceLost=this._onDeviceLost,this.onError=this._onError,this._outputBufferType=f,this._cacheShadowNodes=new WeakMap,this._initialized=!1,this._callDepth=-1,this._initPromise=null,this._compilationPromises=null,this._currentSourceMaterial=null,this.transparent=!0,this.opaque=!0,this.shadowMap={enabled:!1,transmitted:!1,type:d0},this.xr=new g9(this,d),this.debug={checkShaderErrors:!0,onShaderError:null,getShaderAsync:async(y,w,S)=>{await this.compileAsync(S,w,y);let R=this.needsFrameBufferTarget&&this._renderTarget===null?this._getFrameBufferTarget():this._renderTarget||this._outputRenderTarget,I=this._renderLists.get(y,w),P=this._renderContexts.get(R,this._mrt),F=y.overrideMaterial||S.material,D=this._objects.get(S,F,y,w,I.lightsNode,P,P.clippingContext),{fragmentShader:L,vertexShader:C}=D.getNodeBuilderState();return{fragmentShader:L,vertexShader:C}}}}async init(){return this._initPromise!==null?this._initPromise:(this._initPromise=new Promise(async(e,t)=>{let n=this.backend;try{await n.init(this)}catch(r){if(this._getFallback!==null)try{this.backend=n=this._getFallback(r),await n.init(this)}catch(s){t(s);return}else{t(r);return}}this._nodes=new d9(this,n),this._animation=new j7(this,this._nodes,this.info),this._attributes=new Y7(n,this.info),this._background=new Bk(this,this._nodes),this._geometries=new Z7(this._attributes,this.info),this._textures=new ok(this,n,this.info),this._pipelines=new ek(n,this._nodes,this.info),this._bindings=new tk(n,this._nodes,this._textures,this._attributes,this._pipelines,this.info),this._objects=new $7(this,this._nodes,this._geometries,this._pipelines,this._bindings,this.info),this._renderLists=new ik(this.lighting),this._bundles=new m9,this._renderContexts=new sk(this),this._animation.start(),this._initialized=!0,this._inspector.init(),e(this)}),this._initPromise)}get domElement(){return this._canvasTarget.domElement}get coordinateSystem(){return this.backend.coordinateSystem}async compileAsync(e,t,n=null){if(this._isDeviceLost===!0)return;this._initialized===!1&&await this.init();let r=this._nodes.nodeFrame,s=r.renderId,o=this._currentRenderContext,a=this._currentRenderObjectFunction,l=this._handleObjectFunction,c=this._compilationPromises;n===null&&(n=e);let u=e.isScene===!0?e:n.isScene===!0?n:Ute,d=this.needsFrameBufferTarget&&this._renderTarget===null?this._getFrameBufferTarget():this._renderTarget||this._outputRenderTarget,A=this._renderContexts.get(d,this._mrt),y=this._activeMipmapLevel,w=[];this._currentRenderContext=A,this._currentRenderObjectFunction=this.renderObject,this._handleObjectFunction=this._createObjectPipeline,this._compilationPromises=w,r.renderId++,r.update(),A.depth=this.depth,A.stencil=this.stencil,A.clippingContext||(A.clippingContext=new $4),A.clippingContext.updateGlobal(u,t),e.matrixWorldAutoUpdate===!0&&e.updateMatrixWorld(),t=this._updateCamera(t),u.onBeforeRender(this,e,t,d);let S=t.isArrayCamera?OR:BR;t.isArrayCamera?S.setFromArrayCamera(t):(j_.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),S.setFromProjectionMatrix(j_,t.coordinateSystem,t.reversedDepth));let T=this._renderLists.get(u,t);if(T.begin(),this._projectObject(e,t,0,T,A.clippingContext),n!==e&&n.traverseVisible(function(D){D.isLight&&D.layers.test(t.layers)&&T.pushLight(D)}),T.finish(),d!==null){this._textures.updateRenderTarget(d,y);let D=this._textures.get(d);A.textures=D.textures,A.depthTexture=D.depthTexture}else A.textures=null,A.depthTexture=null;n!==e?this._background.update(n,T,A):this._background.update(u,T,A);let R=T.opaque,I=T.transparent,P=T.transparentDoublePass,F=T.lightsNode;this.opaque===!0&&R.length>0&&this._renderObjects(R,t,u,F),this.transparent===!0&&I.length>0&&this._renderTransparents(I,P,t,u,F),r.renderId=s,this._currentRenderContext=o,this._currentRenderObjectFunction=a,this._handleObjectFunction=l,this._compilationPromises=c;for(let D of w){let L=this._objects.get(D.object,D.material,D.scene,D.camera,D.lightsNode,D.renderContext,D.clippingContext,D.passId);L.drawRange=D.object.geometry.drawRange,L.group=D.group,await this._nodes.getForRenderAsync(L),this._nodes.updateBefore(L),this._geometries.updateForRender(L),this._nodes.updateForRender(L),this._bindings.updateForRender(L);let C=[];this._pipelines.getForRender(L,C),C.length>0&&await Promise.all(C),this._nodes.updateAfter(L),await AF()}}async renderAsync(e,t){ni('Renderer: "renderAsync()" has been deprecated. Use "render()" and "await renderer.init();" when creating the renderer.'),await this.init(),this.render(e,t)}async waitForGPU(){ze("Renderer: waitForGPU() has been removed. Read https://github.com/mrdoob/three.js/issues/32012 for more information.")}set inspector(e){this._inspector!==null&&this._inspector.setRenderer(null),this._inspector=e,this._inspector.setRenderer(this)}get inspector(){return this._inspector}set highPrecision(e){let t=this.contextNode.value;e===!0?(t.modelViewMatrix=QU,t.modelNormalViewMatrix=JU):this.highPrecision&&(delete t.modelViewMatrix,delete t.modelNormalViewMatrix)}get highPrecision(){let e=this.contextNode.value;return e.modelViewMatrix===QU&&e.modelNormalViewMatrix===JU}setMRT(e){return this._mrt=e,this}getMRT(){return this._mrt}getOutputBufferType(){return this._outputBufferType}getColorBufferType(){return ni('Renderer: ".getColorBufferType()" has been renamed to ".getOutputBufferType()".'),this.getOutputBufferType()}_onDeviceLost(e){let t=`THREE.WebGPURenderer: ${e.api} Device Lost:41674167 41684168 Message: ${e.message}`;e.reason&&(t+=`4169-Reason: ${e.reason}`),ze(t),this._isDeviceLost=!0}_onError(e){let t=`WebGPURenderer: Uncaptured ${e.api} ${e.type}`;e.message&&(t+=`: ${e.message}`),ze(t)}_bundleNeedsUpdate(e,t){return t.bundleGPU===void 0||e.version!==t.version}_renderBundle(e,t,n){let{bundleGroup:r,camera:s,renderList:o}=e,a=this._currentRenderContext,l=this._bundles.get(r,s,a),c=this.backend.get(l);if(this._bundleNeedsUpdate(r,c)){this.backend.beginBundle(a),this._currentRenderBundle=l;let{transparentDoublePass:f,transparent:d,opaque:A}=o;this.opaque===!0&&A.length>0&&this._renderObjects(A,s,t,n),this.transparent===!0&&d.length>0&&this._renderTransparents(d,f,s,t,n),this._currentRenderBundle=null,this.backend.finishBundle(a,l),c.version=r.version}else{let{renderObjects:f}=c;for(let d=0,A=f.length;d<A;d++){let y=f[d];this._nodes.needsRefresh(y)&&(this._nodes.updateBefore(y),this._geometries.updateForRender(y),this._nodes.updateForRender(y),this._bindings.updateForRender(y),this._nodes.updateAfter(y))}}this.backend.addBundle(a,l)}render(e,t){if(this._initialized===!1)throw new Error('THREE.Renderer: .render() called before the backend is initialized. Use "await renderer.init();" before rendering.');this._renderScene(e,t)}get initialized(){return this._initialized}_renderOutputLayers(e,t){if(t.texture.isArrayTexture!==!0||t.texture.image.depth<=1){this._renderScene(e,e.camera,!1);return}let n=this._activeCubeFace;try{for(let r=0;r<t.texture.image.depth;r++)this._nodes.setOutputLayerIndex(r),this._activeCubeFace=r,this._renderScene(e,e.camera,!1)}finally{this._nodes.setOutputLayerIndex(0),this._activeCubeFace=n}}_getFrameBufferTarget(){let{currentToneMapping:e,currentColorSpace:t}=this,n=e!==ao,r=t!==ln.workingColorSpace;if(n===!1&&r===!1)return null;let{width:s,height:o}=this.getDrawingBufferSize(k_),{depth:a,stencil:l}=this,c=this._outputRenderTarget||this._canvasTarget,u=this._frameBufferTargets.get(c);if(u===void 0){u=new Fa(s,o,{depthBuffer:a,stencilBuffer:l,type:this._outputBufferType,format:Or,colorSpace:ln.workingColorSpace,generateMipmaps:!1,minFilter:Mi,magFilter:Mi,samples:this.samples}),u.isPostProcessingRenderTarget=!0;let S=()=>{c.removeEventListener("dispose",S),u.dispose(),this._frameBufferTargets.delete(c)};c.addEventListener("dispose",S),this._frameBufferTargets.set(c,u)}let f=this.getOutputRenderTarget();u.depthBuffer=a,u.stencilBuffer=l,f!==null?u.setSize(f.width,f.height,f.depth):u.setSize(s,o,1);let d=this._outputRenderTarget?this._outputRenderTarget.viewport:c._viewport,A=this._outputRenderTarget?this._outputRenderTarget.scissor:c._scissor,y=this._outputRenderTarget?1:c._pixelRatio,w=this._outputRenderTarget?this._outputRenderTarget.scissorTest:c._scissorTest;return u.viewport.copy(d),u.scissor.copy(A),u.viewport.multiplyScalar(y),u.scissor.multiplyScalar(y),u.scissorTest=w,u.multiview=f!==null?f.multiview:!1,u.useArrayDepthTexture=f!==null?f.useArrayDepthTexture:!1,u.resolveDepthBuffer=f!==null?f.resolveDepthBuffer:!0,u._autoAllocateDepthBuffer=f!==null?f._autoAllocateDepthBuffer:!1,u}_renderScene(e,t,n=!0){if(this._isDeviceLost===!0)return;let r=n?this._getFrameBufferTarget():null,s=this._nodes.nodeFrame,o=s.renderId,a=this._currentRenderContext,l=this._currentRenderObjectFunction,c=this._handleObjectFunction;this.lighting.beginRender(e),this._callDepth++;let u=e.isScene===!0?e:dte,f=this._renderTarget||this._outputRenderTarget,d=this._activeCubeFace,A=this._activeMipmapLevel,y;if(r!==null?(y=r,this.setRenderTarget(y)):y=f,y!==null&&y.depthBuffer===!0){let W=this._textures.get(y);W.depthInitialized!==!0&&((this.autoClear===!1||this.autoClear===!0&&this.autoClearDepth===!1)&&this.clearDepth(),W.depthInitialized=!0)}let w=this._renderContexts.get(y,this._mrt,this._callDepth);this._currentRenderContext=w,this._currentRenderObjectFunction=this._renderObjectFunction||this.renderObject,this._handleObjectFunction=this._renderObjectDirect,this.info.calls++,this.info.render.calls++,this.info.render.frameCalls++,s.renderId=this.info.calls,this.backend.updateTimeStampUID(w),this.inspector.beginRender(this.backend.getTimestampUID(w),e,t,y),e.matrixWorldAutoUpdate===!0&&e.updateMatrixWorld(),t=this._updateCamera(t);let S=this._canvasTarget,T=S._viewport,R=S._scissor,P=S._pixelRatio;y!==null&&(T=y.viewport,R=y.scissor,P=1),this.getDrawingBufferSize(k_),HO.set(0,0,k_.width,k_.height);let I=T.minDepth===void 0?0:T.minDepth,F=T.maxDepth===void 0?1:T.maxDepth;w.viewportValue.copy(T).multiplyScalar(P).floor(),w.viewportValue.width>>=A,w.viewportValue.height>>=A,w.viewportValue.minDepth=I,w.viewportValue.maxDepth=F,w.viewport=w.viewportValue.equals(HO)===!1,w.scissorValue.copy(R).multiplyScalar(P).floor(),w.scissor=S._scissorTest&&w.scissorValue.equals(HO)===!1,w.scissorValue.width>>=A,w.scissorValue.height>>=A,w.clippingContext||(w.clippingContext=new z4),w.clippingContext.updateGlobal(u,t),u.onBeforeRender(this,e,t,y);let D=t.isArrayCamera?RR:CR;t.isArrayCamera?D.setFromArrayCamera(t):(z_.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),D.setFromProjectionMatrix(z_,t.coordinateSystem,t.reversedDepth));let L=this._renderLists.get(e,t);if(L.begin(),this._projectObject(e,t,0,L,w.clippingContext),L.finish(),this.sortObjects===!0&&L.sort(this._opaqueSort,this._transparentSort,t.reversedDepth),y!==null){this._textures.updateRenderTarget(y,A);let W=this._textures.get(y);w.textures=W.textures,w.depthTexture=W.depthTexture,w.width=W.width,w.height=W.height,w.renderTarget=y,w.depth=y.depthBuffer,w.stencil=y.stencilBuffer}else w.textures=null,w.depthTexture=null,w.width=k_.width,w.height=k_.height,w.depth=this.depth,w.stencil=this.stencil;w.width>>=A,w.height>>=A,w.activeCubeFace=d,w.activeMipmapLevel=A,w.occlusionQueryCount=L.occlusionQueryCount,w.scissorValue.max(zd.set(0,0,0,0)),w.scissorValue.x+w.scissorValue.width>w.width&&(w.scissorValue.width=Math.max(w.width-w.scissorValue.x,0)),w.scissorValue.y+w.scissorValue.height>w.height&&(w.scissorValue.height=Math.max(w.height-w.scissorValue.y,0)),this._background.update(u,L,w),w.camera=t,this.backend.beginRender(w);let{bundles:C,lightsNode:B,transparentDoublePass:k,transparent:z,opaque:G}=L;return C.length>0&&this._renderBundles(C,u,B),this.opaque===!0&&G.length>0&&this._renderObjects(G,t,u,B),this.transparent===!0&&z.length>0&&this._renderTransparents(z,k,t,u,B),this.backend.finishRender(w),s.renderId=o,this._currentRenderContext=a,this._currentRenderObjectFunction=l,this._handleObjectFunction=c,this.lighting.finishRender(e),this._callDepth--,r!==null&&(this.setRenderTarget(f,d,A),this._renderOutput(y)),u.onAfterRender(this,e,t,y),this.inspector.finishRender(this.backend.getTimestampUID(w)),w}_setXRLayerSize(e,t){this._canvasTarget._width=e,this._canvasTarget._height=t,this.setViewport(0,0,e,t)}_renderOutput(e){let t=this._nodes.getOutputCacheKey(),n=this._quadCache.get(e.texture),r;if(n===void 0){r=new gS(new Rr),r.name="Output Color Transform",r.material.name="outputColorTransform",r.material.fragmentNode=this._nodes.getOutputNode(e.texture),n={quad:r,cacheKey:t},this._quadCache.set(e.texture,n);let a=()=>{r.material.dispose(),this._quadCache.delete(e.texture),e.texture.removeEventListener("dispose",a)};e.texture.addEventListener("dispose",a)}else r=n.quad,n.cacheKey!==t&&(r.material.fragmentNode=this._nodes.getOutputNode(e.texture),r.material.needsUpdate=!0,n.cacheKey=t);let s=this.autoClear,o=this.xr.enabled;this.autoClear=!1,this.xr.enabled=!1,this._renderOutputLayers(r,e),this.autoClear=s,this.xr.enabled=o}getMaxAnisotropy(){return this.backend.capabilities.getMaxAnisotropy()}getActiveCubeFace(){return this._activeCubeFace}getActiveMipmapLevel(){return this._activeMipmapLevel}async setAnimationLoop(e){this._initialized===!1&&await this.init(),this._animation.setAnimationLoop(e)}getAnimationLoop(){return this._animation.getAnimationLoop()}async getArrayBufferAsync(e,t=null,n=0,r=-1){if(t!==null&&t.isReadbackBuffer&&this.info.memoryMap.has(t)===!1){this.info.createReadbackBuffer(t);let s=()=>{t.removeEventListener("dispose",s),this.info.destroyReadbackBuffer(t)};t.addEventListener("dispose",s)}if(n%4!==0||r>0&&r%4!==0)throw new Error('THREE.Renderer: "getArrayBufferAsync()" offset and count must be a multiple of 4.');return await this.backend.getArrayBufferAsync(e,t,n,r)}getContext(){return this.backend.getContext()}getPixelRatio(){return this._canvasTarget.getPixelRatio()}getDrawingBufferSize(e){return this._canvasTarget.getDrawingBufferSize(e)}getSize(e){return this._canvasTarget.getSize(e)}setPixelRatio(e=1){this._canvasTarget.setPixelRatio(e)}setDrawingBufferSize(e,t,n){this.xr&&this.xr.isPresenting||this._canvasTarget.setDrawingBufferSize(e,t,n)}setSize(e,t,n=!0){this.xr&&this.xr.isPresenting||this._canvasTarget.setSize(e,t,n)}setOpaqueSort(e){this._opaqueSort=e}setTransparentSort(e){this._transparentSort=e}getScissor(e){return this._canvasTarget.getScissor(e)}setScissor(e,t,n,r){this._canvasTarget.setScissor(e,t,n,r)}getScissorTest(){return this._canvasTarget.getScissorTest()}setScissorTest(e){this._canvasTarget.setScissorTest(e),this.backend.setScissorTest(e)}getViewport(e){return this._canvasTarget.getViewport(e)}setViewport(e,t,n,r,s=0,o=1){this._canvasTarget.setViewport(e,t,n,r,s,o)}getClearColor(e){return e.copy(this._clearColor)}setClearColor(e,t=1){this._clearColor.set(e),this._clearColor.a=t}getClearAlpha(){return this._clearColor.a}setClearAlpha(e){this._clearColor.a=e}getClearDepth(){return this.reversedDepthBuffer===!0?1-this._clearDepth:this._clearDepth}setClearDepth(e){this._clearDepth=e}getClearStencil(){return this._clearStencil}setClearStencil(e){this._clearStencil=e}isOccluded(e){let t=this._currentRenderContext;return t&&this.backend.isOccluded(t,e)}clear(e=!0,t=!0,n=!0){if(this._initialized===!1)throw new Error('THREE.Renderer: .clear() called before the backend is initialized. Use "await renderer.init();" before using this method.');let r=this._renderTarget||this._getFrameBufferTarget(),s=null;if(r!==null){this._textures.updateRenderTarget(r);let o=this._textures.get(r);s=this._renderContexts.get(r,null,-1),s.textures=o.textures,s.depthTexture=o.depthTexture,s.width=o.width,s.height=o.height,s.renderTarget=r,s.depth=r.depthBuffer,s.stencil=r.stencilBuffer;let a=this.backend.getClearColor();s.clearColorValue.r=a.r,s.clearColorValue.g=a.g,s.clearColorValue.b=a.b,s.clearColorValue.a=a.a,s.clearDepthValue=this.getClearDepth(),s.clearStencilValue=this.getClearStencil(),s.activeCubeFace=this.getActiveCubeFace(),s.activeMipmapLevel=this.getActiveMipmapLevel(),r.depthBuffer===!0&&(o.depthInitialized=!0)}this.backend.clear(e,t,n,s),r!==null&&this._renderTarget===null&&this._renderOutput(r)}clearColor(){this.clear(!0,!1,!1)}clearDepth(){this.clear(!1,!0,!1)}clearStencil(){this.clear(!1,!1,!0)}async clearAsync(e=!0,t=!0,n=!0){ni('Renderer: "clearAsync()" has been deprecated. Use "clear()" and "await renderer.init();" when creating the renderer.'),await this.init(),this.clear(e,t,n)}async clearColorAsync(){ni('Renderer: "clearColorAsync()" has been deprecated. Use "clearColor()" and "await renderer.init();" when creating the renderer.'),this.clear(!0,!1,!1)}async clearDepthAsync(){ni('Renderer: "clearDepthAsync()" has been deprecated. Use "clearDepth()" and "await renderer.init();" when creating the renderer.'),this.clear(!1,!0,!1)}async clearStencilAsync(){ni('Renderer: "clearStencilAsync()" has been deprecated. Use "clearStencil()" and "await renderer.init();" when creating the renderer.'),this.clear(!1,!1,!0)}get needsFrameBufferTarget(){let e=this.currentToneMapping!==ao,t=this.currentColorSpace!==ln.workingColorSpace;return e||t}get samples(){return this._samples}get currentSamples(){let e=this._samples;return this._renderTarget!==null?e=this._renderTarget.samples:this.needsFrameBufferTarget&&(e=0),e}get currentToneMapping(){return this.isOutputTarget?this.toneMapping:ao}get currentColorSpace(){return this.isOutputTarget?this.outputColorSpace:ln.workingColorSpace}get isOutputTarget(){return this._renderTarget===this._outputRenderTarget||this._renderTarget===null}dispose(){if(this._initialized===!0){this.info.dispose(),this.backend.dispose(),this._animation.dispose(),this._objects.dispose(),this._geometries.dispose(),this._pipelines.dispose(),this._nodes.dispose(),this._bindings.dispose(),this._renderLists.dispose(),this._renderContexts.dispose(),this._textures.dispose();for(let e of this._frameBufferTargets.keys())e.dispose();Object.values(this.backend.timestampQueryPool).forEach(e=>{e!==null&&e.dispose()})}this.setRenderTarget(null),this.setAnimationLoop(null)}setRenderTarget(e,t=0,n=0){this._renderTarget=e,this._activeCubeFace=t,this._activeMipmapLevel=n}getRenderTarget(){return this._renderTarget}setOutputRenderTarget(e){this._outputRenderTarget=e}getOutputRenderTarget(){return this._outputRenderTarget}setCanvasTarget(e){this._canvasTarget.removeEventListener("resize",this._onCanvasTargetResize),this._canvasTarget=e,this._canvasTarget.addEventListener("resize",this._onCanvasTargetResize)}getCanvasTarget(){return this._canvasTarget}_resetXRState(){this.backend.setXRTarget(null),this.setOutputRenderTarget(null),this.setRenderTarget(null);for(let e of this._frameBufferTargets.keys())e.dispose()}setRenderObjectFunction(e){this._renderObjectFunction=e}getRenderObjectFunction(){return this._renderObjectFunction}compute(e,t=null){if(this._isDeviceLost===!0)return;if(this._initialized===!1)return Xe("Renderer: .compute() called before the backend is initialized. Try using .computeAsync() instead."),this.computeAsync(e,t);let n=this._nodes.nodeFrame,r=n.renderId;this.info.calls++,this.info.compute.calls++,this.info.compute.frameCalls++,n.renderId=this.info.calls,this.backend.updateTimeStampUID(e),this.inspector.beginCompute(this.backend.getTimestampUID(e),e);let s=this.backend,o=this._pipelines,a=this._bindings,l=this._nodes,c=Array.isArray(e)?e:[e];if(c[0]===void 0||c[0].isComputeNode!==!0)throw new Error("THREE.Renderer: .compute() expects a ComputeNode.");s.beginCompute(e);for(let u of c){if(o.has(u)===!1){let A=()=>{u.removeEventListener("dispose",A),o.delete(u),a.deleteForCompute(u),l.delete(u)};u.addEventListener("dispose",A);let y=u.onInitFunction;y!==null&&y.call(u,{renderer:this})}l.updateForCompute(u),a.updateForCompute(u);let f=a.getForCompute(u),d=o.getForCompute(u,f);s.compute(e,u,f,d,t)}s.finishCompute(e),n.renderId=r,this.inspector.finishCompute(this.backend.getTimestampUID(e))}async computeAsync(e,t=null){this._initialized===!1&&await this.init(),this.compute(e,t)}async hasFeatureAsync(e){return ni('Renderer: "hasFeatureAsync()" has been deprecated. Use "hasFeature()" and "await renderer.init();" when creating the renderer.'),await this.init(),this.hasFeature(e)}async resolveTimestampsAsync(e="render"){return this._initialized===!1&&await this.init(),this.backend.resolveTimestampsAsync(e)}hasFeature(e){if(this._initialized===!1)throw new Error('THREE.Renderer: .hasFeature() called before the backend is initialized. Use "await renderer.init();" before using this method.');return this.backend.hasFeature(e)}hasInitialized(){return this._initialized}async initTextureAsync(e){ni('Renderer: "initTextureAsync()" has been deprecated. Use "initTexture()" and "await renderer.init();" when creating the renderer.'),await this.init(),this.initTexture(e)}initTexture(e){if(this._initialized===!1)throw new Error('THREE.Renderer: .initTexture() called before the backend is initialized. Use "await renderer.init();" before using this method.');this._textures.updateTexture(e)}initRenderTarget(e){if(this._initialized===!1)throw new Error('THREE.Renderer: .initRenderTarget() called before the backend is initialized. Use "await renderer.init();" before using this method.');this._textures.updateRenderTarget(e);let t=this._textures.get(e),n=this._renderContexts.get(e);n.textures=t.textures,n.depthTexture=t.depthTexture,n.width=t.width,n.height=t.height,n.renderTarget=e,n.depth=e.depthBuffer,n.stencil=e.stencilBuffer,this.backend.initRenderTarget(n)}copyFramebufferToTexture(e,t=null){if(t!==null)if(t.isVector2)t=zd.set(t.x,t.y,e.image.width,e.image.height).floor();else if(t.isVector4)t=zd.copy(t).floor();else{ze("Renderer.copyFramebufferToTexture: Invalid rectangle.");return}else t=zd.set(0,0,e.image.width,e.image.height);let n=this._currentRenderContext,r;n!==null?r=n.renderTarget:(r=this._renderTarget||this._getFrameBufferTarget(),r!==null&&(this._textures.updateRenderTarget(r),n=this._textures.get(r))),this._textures.updateTexture(e,{renderTarget:r}),this.backend.copyFramebufferToTexture(e,n,t),this._inspector.copyFramebufferToTexture(e)}copyTextureToTexture(e,t,n=null,r=null,s=0,o=0){this._textures.updateTexture(e),this._textures.updateTexture(t),this.backend.copyTextureToTexture(e,t,n,r,s,o),this._inspector.copyTextureToTexture(e,t)}async readRenderTargetPixelsAsync(e,t,n,r,s,o=0,a=0){return this.backend.copyTextureToBuffer(e.textures[o],t,n,r,s,a)}_projectObject(e,t,n,r,s){if(e.visible===!1)return;if(e.layers.test(t.layers)){if(e.isGroup)n=e.renderOrder,e.isClippingGroup&&e.enabled&&(s=s.getGroupContext(e));else if(e.isLOD)e.autoUpdate===!0&&e.update(t);else if(e.isLight)r.pushLight(e);else if(e.isSprite){let l=t.isArrayCamera?RR:CR;if(!e.frustumCulled||l.intersectsSprite(e)){this.sortObjects===!0&&zd.setFromMatrixPosition(e.matrixWorld).applyMatrix4(z_);let{geometry:c,material:u}=e;u.visible&&r.push(e,c,u,n,zd.z,null,s)}}else if(e.isLineLoop)ze("Renderer: Objects of type THREE.LineLoop are not supported. Please use THREE.Line or THREE.LineSegments.");else if(e.isMesh||e.isLine||e.isPoints){let l=t.isArrayCamera?RR:CR;if(!e.frustumCulled||l.intersectsObject(e)){let{geometry:c,material:u}=e;if(this.sortObjects===!0&&(c.boundingSphere===null&&c.computeBoundingSphere(),zd.copy(c.boundingSphere.center).applyMatrix4(e.matrixWorld).applyMatrix4(z_)),Array.isArray(u)){let f=c.groups;for(let d=0,A=f.length;d<A;d++){let y=f[d],w=u[y.materialIndex];w&&w.visible&&r.push(e,c,w,n,zd.z,y,s)}}else u.visible&&r.push(e,c,u,n,zd.z,null,s)}}}if(e.isBundleGroup===!0&&this.backend.beginBundle!==void 0){let l=r;r=this._renderLists.get(e,t);let c=this._bundles.get(e,t,this._currentRenderContext),u=this.backend.get(c);if(this._bundleNeedsUpdate(e,u)){r.begin(),u.renderObjects===void 0?u.renderObjects=[]:u.renderObjects.length=0;let d=e.children;for(let A=0,y=d.length;A<y;A++)this._projectObject(d[A],t,n,r,s);r.finish()}l.pushBundle({bundleGroup:e,camera:t,renderList:r});return}let a=e.children;for(let l=0,c=a.length;l<c;l++)this._projectObject(a[l],t,n,r,s)}_renderBundles(e,t,n){for(let r of e)this._renderBundle(r,t,n)}_renderTransparents(e,t,n,r,s){if(t.length>0){for(let{material:o}of t)o.side=mi;this._renderObjects(t,n,r,s,"backSide");for(let{material:o}of t)o.side=ko;this._renderObjects(e,n,r,s);for(let{material:o}of t)o.side=gr}else this._renderObjects(e,n,r,s)}_renderObjects(e,t,n,r,s=null){for(let o=0,a=e.length;o<a;o++){let{object:l,geometry:c,material:u,group:f,clippingContext:d}=e[o];this._currentRenderObjectFunction(l,n,t,c,u,f,r,d,s)}}_getShadowNodes(e){let t=e.version,n=this._cacheShadowNodes.get(e);if(n===void 0||n.version!==t){let r=e.map&&e.map.isTexture,s=e.colorNode&&e.colorNode.isNode,o=e.castShadowNode&&e.castShadowNode.isNode,a=e.maskShadowNode&&e.maskShadowNode.isNode||e.maskNode&&e.maskNode.isNode,l=null,c=null,u=null;if(r||s||o||a){let f,d;if(o?(f=e.castShadowNode.rgb,d=e.castShadowNode.a,this.shadowMap.transmitted!==!0&&ni("Renderer: `shadowMap.transmitted` needs to be set to `true` when using `material.castShadowNode`.")):(f=pe(0),d=oe(1)),r&&(d=d.mul(mr("map","texture",e).a)),s&&(d=d.mul(e.colorNode.a)),c=Ft(f,d),a){let A=e.maskShadowNode||e.maskNode;c=me(([y])=>(A.not().discard(),y))(c)}}e.depthNode&&e.depthNode.isNode&&(u=e.depthNode),e.castShadowPositionNode&&e.castShadowPositionNode.isNode?l=e.castShadowPositionNode:e.positionNode&&e.positionNode.isNode&&(l=e.positionNode),n={version:t,colorNode:c,depthNode:u,positionNode:l},this._cacheShadowNodes.set(e,n)}return n}_updateCamera(e){let t=this.xr;if(t.isPresenting===!1){let n=!1;if(this.reversedDepthBuffer===!0&&e.reversedDepth!==!0){if(e._reversedDepth=!0,e.isArrayCamera)for(let s of e.cameras)s._reversedDepth=!0;n=!0}let r=this.coordinateSystem;if(e.coordinateSystem!==r){if(e.coordinateSystem=r,e.isArrayCamera)for(let s of e.cameras)s.coordinateSystem=r;n=!0}if(n===!0&&(e.updateProjectionMatrix(),e.isArrayCamera))for(let s of e.cameras)s.updateProjectionMatrix()}return e.parent===null&&e.matrixWorldAutoUpdate===!0&&e.updateMatrixWorld(),t.enabled===!0&&t.isPresenting===!0&&(t.cameraAutoUpdate===!0&&t.updateCamera(e),e=t.getCamera()),e}renderObject(e,t,n,r,s,o,a,l=null,c=null){let u=!1,f,d,A,y,w,S,T,R=this._currentSourceMaterial;if(e.onBeforeRender(this,t,n,r,s,o),s.allowOverride===!0&&t.overrideMaterial!==null){this._currentSourceMaterial=s;let P=t.overrideMaterial;if(u=!0,f=P.isNodeMaterial?P.colorNode:null,d=P.isNodeMaterial?P.depthNode:null,A=P.isNodeMaterial?P.positionNode:null,y=t.overrideMaterial.side,w=P.displacementMap,S=P.displacementScale,T=P.displacementBias,s.positionNode&&s.positionNode.isNode&&(P.positionNode=s.positionNode),P.alphaTest=s.alphaTest,P.alphaMap=s.alphaMap,P.displacementMap=s.displacementMap,P.displacementScale=s.displacementScale,P.displacementBias=s.displacementBias,P.transparent=s.transparent||s.transmission>0||s.transmissionNode&&s.transmissionNode.isNode||s.backdropNode&&s.backdropNode.isNode,P.isShadowPassMaterial){let{colorNode:I,depthNode:F,positionNode:D}=this._getShadowNodes(s);this.shadowMap.type===Vc?P.side=s.shadowSide!==null?s.shadowSide:s.side:P.side=s.shadowSide!==null?s.shadowSide:GIe[s.side],I!==null&&(P.colorNode=I),F!==null&&(P.depthNode=F),D!==null&&(P.positionNode=D)}s=P}s.transparent===!0&&s.side===gr&&s.forceSinglePass===!1?(s.side=mi,this._handleObjectFunction(e,s,t,n,a,o,l,"backSide"),s.side=ko,this._handleObjectFunction(e,s,t,n,a,o,l,c),s.side=gr):this._handleObjectFunction(e,s,t,n,a,o,l,c),u&&(t.overrideMaterial.colorNode=f,t.overrideMaterial.depthNode=d,t.overrideMaterial.positionNode=A,t.overrideMaterial.side=y,t.overrideMaterial.displacementMap=w,t.overrideMaterial.displacementScale=S,t.overrideMaterial.displacementBias=T),this._currentSourceMaterial=R,e.onAfterRender(this,t,n,r,s,o)}hasCompatibility(e){if(this._initialized===!1)throw new Error('THREE.Renderer: .hasCompatibility() called before the backend is initialized. Use "await renderer.init();" before using this method.');return this.backend.hasCompatibility(e)}_renderObjectDirect(e,t,n,r,s,o,a,l){let c=this._objects.get(e,t,n,r,s,this._currentRenderContext,a,l);c.drawRange=e.geometry.drawRange,c.group=o,this._currentRenderBundle!==null&&(this.backend.get(this._currentRenderBundle).renderObjects.push(c),c.bundle=this._currentRenderBundle.bundleGroup);let u=this._nodes.needsRefresh(c);u&&(this._nodes.updateBefore(c),this._geometries.updateForRender(c),this._nodes.updateForRender(c),this._bindings.updateForRender(c)),this._pipelines.updateForRender(c),this._pipelines.isReady(c)&&(this.backend.draw(c,this.info),u&&this._nodes.updateAfter(c))}_createObjectPipeline(e,t,n,r,s,o,a,l){if(this._compilationPromises!==null){this._compilationPromises.push({object:e,material:t,scene:n,camera:r,lightsNode:s,group:o,clippingContext:a,passId:l,renderContext:this._currentRenderContext});return}let c=this._objects.get(e,t,n,r,s,this._currentRenderContext,a,l);c.drawRange=e.geometry.drawRange,c.group=o,this._nodes.updateBefore(c),this._geometries.updateForRender(c),this._nodes.updateForRender(c),this._bindings.updateForRender(c),this._pipelines.getForRender(c,this._compilationPromises),this._nodes.updateAfter(c)}_onCanvasTargetResize(){this._initialized&&this.backend.updateSize()}get compile(){return this.compileAsync}},G4=class{constructor(e=""){this.name=e,this.visibility=0}setVisibility(e){this.visibility|=e}getVisibility(){return this.visibility}clone(){return Object.assign(new this.constructor,this)}};function Hse(i){return i+(am-i%am)%am}var q4=class extends G4{constructor(e,t=null){super(e),this.isBuffer=!0,this.bytesPerElement=Float32Array.BYTES_PER_ELEMENT,this._buffer=t,this._updateRanges=[]}get updateRanges(){return this._updateRanges}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}get byteLength(){return Hse(this._buffer.byteLength)}get buffer(){return this._buffer}update(){return!0}release(){this._buffer=null}},H4=class extends q4{constructor(e,t=null){super(e,t),this.isUniformBuffer=!0}},qIe=0,W4=class extends H4{constructor(e,t){super("UniformBuffer_"+qIe++,e?e.value:null),this.nodeUniform=e,this.groupNode=t,this.isNodeUniformBuffer=!0}set updateRanges(e){this.nodeUniform.updateRanges=e}get updateRanges(){return this.nodeUniform.updateRanges}addUpdateRange(e,t){this.nodeUniform.addUpdateRange(e,t)}clearUpdateRanges(){this.nodeUniform.clearUpdateRanges()}get byteLength(){return Hse(this.buffer.byteLength)}get buffer(){return this.nodeUniform.value}},Jk=class extends H4{constructor(e){super(e),this.isUniformsGroup=!0,this._values=null,this.uniforms=[],this._updateRangeCache=new Map,this._addedIndices=new Set}addUniformUpdateRange(e){let t=e.index;if(this._addedIndices.has(t))return;let n=this._updateRangeCache.get(t);n===void 0&&(n={start:0,count:0},this._updateRangeCache.set(t,n)),n.start=e.offset,n.count=e.itemSize,this._addedIndices.add(t),this.updateRanges.push(n)}clearUpdateRanges(){this._addedIndices.clear(),super.clearUpdateRanges()}addUniform(e){return this.uniforms.push(e),this}removeUniform(e){let t=this.uniforms.indexOf(e);return t!==-1&&this.uniforms.splice(t,1),this}get values(){return this._values===null&&(this._values=Array.from(this.buffer)),this._values}get buffer(){let e=this._buffer;if(e===null){let t=this.byteLength;e=new Float32Array(new ArrayBuffer(t)),this._buffer=e}return e}get byteLength(){let e=this.bytesPerElement,t=0;for(let n=0,r=this.uniforms.length;n<r;n++){let s=this.uniforms[n],o=s.boundary,a=s.itemSize*e,l=t%am,c=l%o,u=l+c;t+=c,u!==0&&am-u<a&&(t+=am-u),s.offset=t/e,s.index=n,t+=a}return Math.ceil(t/am)*am}update(){let e=!1;for(let t of this.uniforms)this.updateByType(t)===!0&&(e=!0);return e}release(){super.release(),this._values=null}updateByType(e){if(e.isNumberUniform)return this.updateNumber(e);if(e.isVector2Uniform)return this.updateVector2(e);if(e.isVector3Uniform)return this.updateVector3(e);if(e.isVector4Uniform)return this.updateVector4(e);if(e.isColorUniform)return this.updateColor(e);if(e.isMatrix3Uniform)return this.updateMatrix3(e);if(e.isMatrix4Uniform)return this.updateMatrix4(e);ze("WebGPUUniformsGroup: Unsupported uniform type.",e)}updateNumber(e){let t=!1,n=this.values,r=e.getValue(),s=e.offset,o=e.getType();if(n[s]!==r){let a=this._getBufferForType(o);a[s]=n[s]=r,t=!0,this.addUniformUpdateRange(e)}return t}updateVector2(e){let t=!1,n=this.values,r=e.getValue(),s=e.offset,o=e.getType();if(n[s+0]!==r.x||n[s+1]!==r.y){let a=this._getBufferForType(o);a[s+0]=n[s+0]=r.x,a[s+1]=n[s+1]=r.y,t=!0,this.addUniformUpdateRange(e)}return t}updateVector3(e){let t=!1,n=this.values,r=e.getValue(),s=e.offset,o=e.getType();if(n[s+0]!==r.x||n[s+1]!==r.y||n[s+2]!==r.z){let a=this._getBufferForType(o);a[s+0]=n[s+0]=r.x,a[s+1]=n[s+1]=r.y,a[s+2]=n[s+2]=r.z,t=!0,this.addUniformUpdateRange(e)}return t}updateVector4(e){let t=!1,n=this.values,r=e.getValue(),s=e.offset,o=e.getType();if(n[s+0]!==r.x||n[s+1]!==r.y||n[s+2]!==r.z||n[s+3]!==r.w){let a=this._getBufferForType(o);a[s+0]=n[s+0]=r.x,a[s+1]=n[s+1]=r.y,a[s+2]=n[s+2]=r.z,a[s+3]=n[s+3]=r.w,t=!0,this.addUniformUpdateRange(e)}return t}updateColor(e){let t=!1,n=this.values,r=e.getValue(),s=e.offset;if(n[s+0]!==r.r||n[s+1]!==r.g||n[s+2]!==r.b){let o=this.buffer;o[s+0]=n[s+0]=r.r,o[s+1]=n[s+1]=r.g,o[s+2]=n[s+2]=r.b,t=!0,this.addUniformUpdateRange(e)}return t}updateMatrix3(e){let t=!1,n=this.values,r=e.getValue().elements,s=e.offset;if(n[s+0]!==r[0]||n[s+1]!==r[1]||n[s+2]!==r[2]||n[s+4]!==r[3]||n[s+5]!==r[4]||n[s+6]!==r[5]||n[s+8]!==r[6]||n[s+9]!==r[7]||n[s+10]!==r[8]){let o=this.buffer;o[s+0]=n[s+0]=r[0],o[s+1]=n[s+1]=r[1],o[s+2]=n[s+2]=r[2],o[s+4]=n[s+4]=r[3],o[s+5]=n[s+5]=r[4],o[s+6]=n[s+6]=r[5],o[s+8]=n[s+8]=r[6],o[s+9]=n[s+9]=r[7],o[s+10]=n[s+10]=r[8],t=!0,this.addUniformUpdateRange(e)}return t}updateMatrix4(e){let t=!1,n=this.values,r=e.getValue().elements,s=e.offset;return WIe(n,r,s)===!1&&(this.buffer.set(r,s),HIe(n,r,s),t=!0,this.addUniformUpdateRange(e)),t}_getBufferForType(e){return e==="int"||e==="ivec2"||e==="ivec3"||e==="ivec4"?new Int32Array(this.buffer.buffer):e==="uint"||e==="uvec2"||e==="uvec3"||e==="uvec4"?new Uint32Array(this.buffer.buffer):this.buffer}};function HIe(i,e,t){for(let n=0,r=e.length;n<r;n++)i[t+n]=e[n]}function WIe(i,e,t){for(let n=0,r=e.length;n<r;n++)if(i[t+n]!==e[n])return!1;return!0}var jIe=0,j4=class extends Jk{constructor(e,t){super(e),this.id=jIe++,this.groupNode=t,this.isNodeUniformsGroup=!0}},X4=class extends G4{constructor(e,t){super(e),this._texture=t,this.version=-1,this.generation=null,this.samplerKey="",this.isSampler=!0}set texture(e){this._texture!==e&&(this._texture=e,this.reset())}get texture(){return this._texture}update(){let{texture:e,version:t}=this;return t!==e.version?(this.version=e.version,!0):!1}reset(){this.generation=null,this.version=-1}release(){this._texture=null}},XIe=0,e9=class extends X4{constructor(e,t){super(e,t),this.id=XIe++,this.store=!1,this.mipLevel=0,this.isSampledTexture=!0}},fx=class extends e9{constructor(e,t,n,r=null){super(e,t?t.value:null),this.textureNode=t,this.groupNode=n,this.access=r}update(){let{textureNode:e}=this;return this.texture!==e.value?(this.texture=e.value,!0):super.update()}},$4=class extends fx{constructor(e,t,n,r=null){super(e,t,n,r),this.isSampledCubeTexture=!0}},wS=class extends fx{constructor(e,t,n,r=null){super(e,t,n,r),this.isSampledTexture3D=!0}},pte={bitcast_int_uint:new hr("uint tsl_bitcast_int_to_uint ( int x ) { return floatBitsToUint( intBitsToFloat ( x ) ); }"),bitcast_uint_int:new hr("uint tsl_bitcast_uint_to_int ( uint x ) { return floatBitsToInt( uintBitsToFloat ( x ) ); }"),textureGather:new hr(`4169+Reason: ${e.reason}`),ze(t),this._isDeviceLost=!0}_onError(e){let t=`WebGPURenderer: Uncaptured ${e.api} ${e.type}`;e.message&&(t+=`: ${e.message}`),ze(t)}_bundleNeedsUpdate(e,t){return t.bundleGPU===void 0||e.version!==t.version}_renderBundle(e,t,n){let{bundleGroup:r,camera:s,renderList:o}=e,a=this._currentRenderContext,l=this._bundles.get(r,s,a),c=this.backend.get(l);if(this._bundleNeedsUpdate(r,c)){this.backend.beginBundle(a),this._currentRenderBundle=l;let{transparentDoublePass:f,transparent:d,opaque:A}=o;this.opaque===!0&&A.length>0&&this._renderObjects(A,s,t,n),this.transparent===!0&&d.length>0&&this._renderTransparents(d,f,s,t,n),this._currentRenderBundle=null,this.backend.finishBundle(a,l),c.version=r.version}else{let{renderObjects:f}=c;for(let d=0,A=f.length;d<A;d++){let y=f[d];this._nodes.needsRefresh(y)&&(this._nodes.updateBefore(y),this._geometries.updateForRender(y),this._nodes.updateForRender(y),this._bindings.updateForRender(y),this._nodes.updateAfter(y))}}this.backend.addBundle(a,l)}render(e,t){if(this._initialized===!1)throw new Error('THREE.Renderer: .render() called before the backend is initialized. Use "await renderer.init();" before rendering.');this._renderScene(e,t)}get initialized(){return this._initialized}_renderOutputLayers(e,t){if(t.texture.isArrayTexture!==!0||t.texture.image.depth<=1){this._renderScene(e,e.camera,!1);return}let n=this._activeCubeFace;try{for(let r=0;r<t.texture.image.depth;r++)this._nodes.setOutputLayerIndex(r),this._activeCubeFace=r,this._renderScene(e,e.camera,!1)}finally{this._nodes.setOutputLayerIndex(0),this._activeCubeFace=n}}_getFrameBufferTarget(){let{currentToneMapping:e,currentColorSpace:t}=this,n=e!==ao,r=t!==ln.workingColorSpace;if(n===!1&&r===!1)return null;let{width:s,height:o}=this.getDrawingBufferSize(W_),{depth:a,stencil:l}=this,c=this._outputRenderTarget||this._canvasTarget,u=this._frameBufferTargets.get(c);if(u===void 0){u=new Ba(s,o,{depthBuffer:a,stencilBuffer:l,type:this._outputBufferType,format:Or,colorSpace:ln.workingColorSpace,generateMipmaps:!1,minFilter:Mi,magFilter:Mi,samples:this.samples}),u.isPostProcessingRenderTarget=!0;let S=()=>{c.removeEventListener("dispose",S),u.dispose(),this._frameBufferTargets.delete(c)};c.addEventListener("dispose",S),this._frameBufferTargets.set(c,u)}let f=this.getOutputRenderTarget();u.depthBuffer=a,u.stencilBuffer=l,f!==null?u.setSize(f.width,f.height,f.depth):u.setSize(s,o,1);let d=this._outputRenderTarget?this._outputRenderTarget.viewport:c._viewport,A=this._outputRenderTarget?this._outputRenderTarget.scissor:c._scissor,y=this._outputRenderTarget?1:c._pixelRatio,w=this._outputRenderTarget?this._outputRenderTarget.scissorTest:c._scissorTest;return u.viewport.copy(d),u.scissor.copy(A),u.viewport.multiplyScalar(y),u.scissor.multiplyScalar(y),u.scissorTest=w,u.multiview=f!==null?f.multiview:!1,u.useArrayDepthTexture=f!==null?f.useArrayDepthTexture:!1,u.resolveDepthBuffer=f!==null?f.resolveDepthBuffer:!0,u._autoAllocateDepthBuffer=f!==null?f._autoAllocateDepthBuffer:!1,u}_renderScene(e,t,n=!0){if(this._isDeviceLost===!0)return;let r=n?this._getFrameBufferTarget():null,s=this._nodes.nodeFrame,o=s.renderId,a=this._currentRenderContext,l=this._currentRenderObjectFunction,c=this._handleObjectFunction;this.lighting.beginRender(e),this._callDepth++;let u=e.isScene===!0?e:Ute,f=this._renderTarget||this._outputRenderTarget,d=this._activeCubeFace,A=this._activeMipmapLevel,y;if(r!==null?(y=r,this.setRenderTarget(y)):y=f,y!==null&&y.depthBuffer===!0){let W=this._textures.get(y);W.depthInitialized!==!0&&((this.autoClear===!1||this.autoClear===!0&&this.autoClearDepth===!1)&&this.clearDepth(),W.depthInitialized=!0)}let w=this._renderContexts.get(y,this._mrt,this._callDepth);this._currentRenderContext=w,this._currentRenderObjectFunction=this._renderObjectFunction||this.renderObject,this._handleObjectFunction=this._renderObjectDirect,this.info.calls++,this.info.render.calls++,this.info.render.frameCalls++,s.renderId=this.info.calls,this.backend.updateTimeStampUID(w),this.inspector.beginRender(this.backend.getTimestampUID(w),e,t,y),e.matrixWorldAutoUpdate===!0&&e.updateMatrixWorld(),t=this._updateCamera(t);let S=this._canvasTarget,T=S._viewport,R=S._scissor,I=S._pixelRatio;y!==null&&(T=y.viewport,R=y.scissor,I=1),this.getDrawingBufferSize(W_),hU.set(0,0,W_.width,W_.height);let P=T.minDepth===void 0?0:T.minDepth,F=T.maxDepth===void 0?1:T.maxDepth;w.viewportValue.copy(T).multiplyScalar(I).floor(),w.viewportValue.width>>=A,w.viewportValue.height>>=A,w.viewportValue.minDepth=P,w.viewportValue.maxDepth=F,w.viewport=w.viewportValue.equals(hU)===!1,w.scissorValue.copy(R).multiplyScalar(I).floor(),w.scissor=S._scissorTest&&w.scissorValue.equals(hU)===!1,w.scissorValue.width>>=A,w.scissorValue.height>>=A,w.clippingContext||(w.clippingContext=new $4),w.clippingContext.updateGlobal(u,t),u.onBeforeRender(this,e,t,y);let D=t.isArrayCamera?OR:BR;t.isArrayCamera?D.setFromArrayCamera(t):(j_.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),D.setFromProjectionMatrix(j_,t.coordinateSystem,t.reversedDepth));let L=this._renderLists.get(e,t);if(L.begin(),this._projectObject(e,t,0,L,w.clippingContext),L.finish(),this.sortObjects===!0&&L.sort(this._opaqueSort,this._transparentSort,t.reversedDepth),y!==null){this._textures.updateRenderTarget(y,A);let W=this._textures.get(y);w.textures=W.textures,w.depthTexture=W.depthTexture,w.width=W.width,w.height=W.height,w.renderTarget=y,w.depth=y.depthBuffer,w.stencil=y.stencilBuffer}else w.textures=null,w.depthTexture=null,w.width=W_.width,w.height=W_.height,w.depth=this.depth,w.stencil=this.stencil;w.width>>=A,w.height>>=A,w.activeCubeFace=d,w.activeMipmapLevel=A,w.occlusionQueryCount=L.occlusionQueryCount,w.scissorValue.max(qd.set(0,0,0,0)),w.scissorValue.x+w.scissorValue.width>w.width&&(w.scissorValue.width=Math.max(w.width-w.scissorValue.x,0)),w.scissorValue.y+w.scissorValue.height>w.height&&(w.scissorValue.height=Math.max(w.height-w.scissorValue.y,0)),this._background.update(u,L,w),w.camera=t,this.backend.beginRender(w);let{bundles:C,lightsNode:B,transparentDoublePass:k,transparent:z,opaque:G}=L;return C.length>0&&this._renderBundles(C,u,B),this.opaque===!0&&G.length>0&&this._renderObjects(G,t,u,B),this.transparent===!0&&z.length>0&&this._renderTransparents(z,k,t,u,B),this.backend.finishRender(w),s.renderId=o,this._currentRenderContext=a,this._currentRenderObjectFunction=l,this._handleObjectFunction=c,this.lighting.finishRender(e),this._callDepth--,r!==null&&(this.setRenderTarget(f,d,A),this._renderOutput(y)),u.onAfterRender(this,e,t,y),this.inspector.finishRender(this.backend.getTimestampUID(w)),w}_setXRLayerSize(e,t){this._canvasTarget._width=e,this._canvasTarget._height=t,this.setViewport(0,0,e,t)}_renderOutput(e){let t=this._nodes.getOutputCacheKey(),n=this._quadCache.get(e.texture),r;if(n===void 0){r=new wS(new Pr),r.name="Output Color Transform",r.material.name="outputColorTransform",r.material.fragmentNode=this._nodes.getOutputNode(e.texture),n={quad:r,cacheKey:t},this._quadCache.set(e.texture,n);let a=()=>{r.material.dispose(),this._quadCache.delete(e.texture),e.texture.removeEventListener("dispose",a)};e.texture.addEventListener("dispose",a)}else r=n.quad,n.cacheKey!==t&&(r.material.fragmentNode=this._nodes.getOutputNode(e.texture),r.material.needsUpdate=!0,n.cacheKey=t);let s=this.autoClear,o=this.xr.enabled;this.autoClear=!1,this.xr.enabled=!1,this._renderOutputLayers(r,e),this.autoClear=s,this.xr.enabled=o}getMaxAnisotropy(){return this.backend.capabilities.getMaxAnisotropy()}getActiveCubeFace(){return this._activeCubeFace}getActiveMipmapLevel(){return this._activeMipmapLevel}async setAnimationLoop(e){this._initialized===!1&&await this.init(),this._animation.setAnimationLoop(e)}getAnimationLoop(){return this._animation.getAnimationLoop()}async getArrayBufferAsync(e,t=null,n=0,r=-1){if(t!==null&&t.isReadbackBuffer&&this.info.memoryMap.has(t)===!1){this.info.createReadbackBuffer(t);let s=()=>{t.removeEventListener("dispose",s),this.info.destroyReadbackBuffer(t)};t.addEventListener("dispose",s)}if(n%4!==0||r>0&&r%4!==0)throw new Error('THREE.Renderer: "getArrayBufferAsync()" offset and count must be a multiple of 4.');return await this.backend.getArrayBufferAsync(e,t,n,r)}getContext(){return this.backend.getContext()}getPixelRatio(){return this._canvasTarget.getPixelRatio()}getDrawingBufferSize(e){return this._canvasTarget.getDrawingBufferSize(e)}getSize(e){return this._canvasTarget.getSize(e)}setPixelRatio(e=1){this._canvasTarget.setPixelRatio(e)}setDrawingBufferSize(e,t,n){this.xr&&this.xr.isPresenting||this._canvasTarget.setDrawingBufferSize(e,t,n)}setSize(e,t,n=!0){this.xr&&this.xr.isPresenting||this._canvasTarget.setSize(e,t,n)}setOpaqueSort(e){this._opaqueSort=e}setTransparentSort(e){this._transparentSort=e}getScissor(e){return this._canvasTarget.getScissor(e)}setScissor(e,t,n,r){this._canvasTarget.setScissor(e,t,n,r)}getScissorTest(){return this._canvasTarget.getScissorTest()}setScissorTest(e){this._canvasTarget.setScissorTest(e),this.backend.setScissorTest(e)}getViewport(e){return this._canvasTarget.getViewport(e)}setViewport(e,t,n,r,s=0,o=1){this._canvasTarget.setViewport(e,t,n,r,s,o)}getClearColor(e){return e.copy(this._clearColor)}setClearColor(e,t=1){this._clearColor.set(e),this._clearColor.a=t}getClearAlpha(){return this._clearColor.a}setClearAlpha(e){this._clearColor.a=e}getClearDepth(){return this.reversedDepthBuffer===!0?1-this._clearDepth:this._clearDepth}setClearDepth(e){this._clearDepth=e}getClearStencil(){return this._clearStencil}setClearStencil(e){this._clearStencil=e}isOccluded(e){let t=this._currentRenderContext;return t&&this.backend.isOccluded(t,e)}clear(e=!0,t=!0,n=!0){if(this._initialized===!1)throw new Error('THREE.Renderer: .clear() called before the backend is initialized. Use "await renderer.init();" before using this method.');let r=this._renderTarget||this._getFrameBufferTarget(),s=null;if(r!==null){this._textures.updateRenderTarget(r);let o=this._textures.get(r);s=this._renderContexts.get(r,null,-1),s.textures=o.textures,s.depthTexture=o.depthTexture,s.width=o.width,s.height=o.height,s.renderTarget=r,s.depth=r.depthBuffer,s.stencil=r.stencilBuffer;let a=this.backend.getClearColor();s.clearColorValue.r=a.r,s.clearColorValue.g=a.g,s.clearColorValue.b=a.b,s.clearColorValue.a=a.a,s.clearDepthValue=this.getClearDepth(),s.clearStencilValue=this.getClearStencil(),s.activeCubeFace=this.getActiveCubeFace(),s.activeMipmapLevel=this.getActiveMipmapLevel(),r.depthBuffer===!0&&(o.depthInitialized=!0)}this.backend.clear(e,t,n,s),r!==null&&this._renderTarget===null&&this._renderOutput(r)}clearColor(){this.clear(!0,!1,!1)}clearDepth(){this.clear(!1,!0,!1)}clearStencil(){this.clear(!1,!1,!0)}async clearAsync(e=!0,t=!0,n=!0){ni('Renderer: "clearAsync()" has been deprecated. Use "clear()" and "await renderer.init();" when creating the renderer.'),await this.init(),this.clear(e,t,n)}async clearColorAsync(){ni('Renderer: "clearColorAsync()" has been deprecated. Use "clearColor()" and "await renderer.init();" when creating the renderer.'),this.clear(!0,!1,!1)}async clearDepthAsync(){ni('Renderer: "clearDepthAsync()" has been deprecated. Use "clearDepth()" and "await renderer.init();" when creating the renderer.'),this.clear(!1,!0,!1)}async clearStencilAsync(){ni('Renderer: "clearStencilAsync()" has been deprecated. Use "clearStencil()" and "await renderer.init();" when creating the renderer.'),this.clear(!1,!1,!0)}get needsFrameBufferTarget(){let e=this.currentToneMapping!==ao,t=this.currentColorSpace!==ln.workingColorSpace;return e||t}get samples(){return this._samples}get currentSamples(){let e=this._samples;return this._renderTarget!==null?e=this._renderTarget.samples:this.needsFrameBufferTarget&&(e=0),e}get currentToneMapping(){return this.isOutputTarget?this.toneMapping:ao}get currentColorSpace(){return this.isOutputTarget?this.outputColorSpace:ln.workingColorSpace}get isOutputTarget(){return this._renderTarget===this._outputRenderTarget||this._renderTarget===null}dispose(){if(this._initialized===!0){this.info.dispose(),this.backend.dispose(),this._animation.dispose(),this._objects.dispose(),this._geometries.dispose(),this._pipelines.dispose(),this._nodes.dispose(),this._bindings.dispose(),this._renderLists.dispose(),this._renderContexts.dispose(),this._textures.dispose();for(let e of this._frameBufferTargets.keys())e.dispose();Object.values(this.backend.timestampQueryPool).forEach(e=>{e!==null&&e.dispose()})}this.setRenderTarget(null),this.setAnimationLoop(null)}setRenderTarget(e,t=0,n=0){this._renderTarget=e,this._activeCubeFace=t,this._activeMipmapLevel=n}getRenderTarget(){return this._renderTarget}setOutputRenderTarget(e){this._outputRenderTarget=e}getOutputRenderTarget(){return this._outputRenderTarget}setCanvasTarget(e){this._canvasTarget.removeEventListener("resize",this._onCanvasTargetResize),this._canvasTarget=e,this._canvasTarget.addEventListener("resize",this._onCanvasTargetResize)}getCanvasTarget(){return this._canvasTarget}_resetXRState(){this.backend.setXRTarget(null),this.setOutputRenderTarget(null),this.setRenderTarget(null);for(let e of this._frameBufferTargets.keys())e.dispose()}setRenderObjectFunction(e){this._renderObjectFunction=e}getRenderObjectFunction(){return this._renderObjectFunction}compute(e,t=null){if(this._isDeviceLost===!0)return;if(this._initialized===!1)return Xe("Renderer: .compute() called before the backend is initialized. Try using .computeAsync() instead."),this.computeAsync(e,t);let n=this._nodes.nodeFrame,r=n.renderId;this.info.calls++,this.info.compute.calls++,this.info.compute.frameCalls++,n.renderId=this.info.calls,this.backend.updateTimeStampUID(e),this.inspector.beginCompute(this.backend.getTimestampUID(e),e);let s=this.backend,o=this._pipelines,a=this._bindings,l=this._nodes,c=Array.isArray(e)?e:[e];if(c[0]===void 0||c[0].isComputeNode!==!0)throw new Error("THREE.Renderer: .compute() expects a ComputeNode.");s.beginCompute(e);for(let u of c){if(o.has(u)===!1){let A=()=>{u.removeEventListener("dispose",A),o.delete(u),a.deleteForCompute(u),l.delete(u)};u.addEventListener("dispose",A);let y=u.onInitFunction;y!==null&&y.call(u,{renderer:this})}l.updateForCompute(u),a.updateForCompute(u);let f=a.getForCompute(u),d=o.getForCompute(u,f);s.compute(e,u,f,d,t)}s.finishCompute(e),n.renderId=r,this.inspector.finishCompute(this.backend.getTimestampUID(e))}async computeAsync(e,t=null){this._initialized===!1&&await this.init(),this.compute(e,t)}async hasFeatureAsync(e){return ni('Renderer: "hasFeatureAsync()" has been deprecated. Use "hasFeature()" and "await renderer.init();" when creating the renderer.'),await this.init(),this.hasFeature(e)}async resolveTimestampsAsync(e="render"){return this._initialized===!1&&await this.init(),this.backend.resolveTimestampsAsync(e)}hasFeature(e){if(this._initialized===!1)throw new Error('THREE.Renderer: .hasFeature() called before the backend is initialized. Use "await renderer.init();" before using this method.');return this.backend.hasFeature(e)}hasInitialized(){return this._initialized}async initTextureAsync(e){ni('Renderer: "initTextureAsync()" has been deprecated. Use "initTexture()" and "await renderer.init();" when creating the renderer.'),await this.init(),this.initTexture(e)}initTexture(e){if(this._initialized===!1)throw new Error('THREE.Renderer: .initTexture() called before the backend is initialized. Use "await renderer.init();" before using this method.');this._textures.updateTexture(e)}initRenderTarget(e){if(this._initialized===!1)throw new Error('THREE.Renderer: .initRenderTarget() called before the backend is initialized. Use "await renderer.init();" before using this method.');this._textures.updateRenderTarget(e);let t=this._textures.get(e),n=this._renderContexts.get(e);n.textures=t.textures,n.depthTexture=t.depthTexture,n.width=t.width,n.height=t.height,n.renderTarget=e,n.depth=e.depthBuffer,n.stencil=e.stencilBuffer,this.backend.initRenderTarget(n)}copyFramebufferToTexture(e,t=null){if(t!==null)if(t.isVector2)t=qd.set(t.x,t.y,e.image.width,e.image.height).floor();else if(t.isVector4)t=qd.copy(t).floor();else{ze("Renderer.copyFramebufferToTexture: Invalid rectangle.");return}else t=qd.set(0,0,e.image.width,e.image.height);let n=this._currentRenderContext,r;n!==null?r=n.renderTarget:(r=this._renderTarget||this._getFrameBufferTarget(),r!==null&&(this._textures.updateRenderTarget(r),n=this._textures.get(r))),this._textures.updateTexture(e,{renderTarget:r}),this.backend.copyFramebufferToTexture(e,n,t),this._inspector.copyFramebufferToTexture(e)}copyTextureToTexture(e,t,n=null,r=null,s=0,o=0){this._textures.updateTexture(e),this._textures.updateTexture(t),this.backend.copyTextureToTexture(e,t,n,r,s,o),this._inspector.copyTextureToTexture(e,t)}async readRenderTargetPixelsAsync(e,t,n,r,s,o=0,a=0){return this.backend.copyTextureToBuffer(e.textures[o],t,n,r,s,a)}_projectObject(e,t,n,r,s){if(e.visible===!1)return;if(e.layers.test(t.layers)){if(e.isGroup)n=e.renderOrder,e.isClippingGroup&&e.enabled&&(s=s.getGroupContext(e));else if(e.isLOD)e.autoUpdate===!0&&e.update(t);else if(e.isLight)r.pushLight(e);else if(e.isSprite){let l=t.isArrayCamera?OR:BR;if(!e.frustumCulled||l.intersectsSprite(e)){this.sortObjects===!0&&qd.setFromMatrixPosition(e.matrixWorld).applyMatrix4(j_);let{geometry:c,material:u}=e;u.visible&&r.push(e,c,u,n,qd.z,null,s)}}else if(e.isLineLoop)ze("Renderer: Objects of type THREE.LineLoop are not supported. Please use THREE.Line or THREE.LineSegments.");else if(e.isMesh||e.isLine||e.isPoints){let l=t.isArrayCamera?OR:BR;if(!e.frustumCulled||l.intersectsObject(e)){let{geometry:c,material:u}=e;if(this.sortObjects===!0&&(c.boundingSphere===null&&c.computeBoundingSphere(),qd.copy(c.boundingSphere.center).applyMatrix4(e.matrixWorld).applyMatrix4(j_)),Array.isArray(u)){let f=c.groups;for(let d=0,A=f.length;d<A;d++){let y=f[d],w=u[y.materialIndex];w&&w.visible&&r.push(e,c,w,n,qd.z,y,s)}}else u.visible&&r.push(e,c,u,n,qd.z,null,s)}}}if(e.isBundleGroup===!0&&this.backend.beginBundle!==void 0){let l=r;r=this._renderLists.get(e,t);let c=this._bundles.get(e,t,this._currentRenderContext),u=this.backend.get(c);if(this._bundleNeedsUpdate(e,u)){r.begin(),u.renderObjects===void 0?u.renderObjects=[]:u.renderObjects.length=0;let d=e.children;for(let A=0,y=d.length;A<y;A++)this._projectObject(d[A],t,n,r,s);r.finish()}l.pushBundle({bundleGroup:e,camera:t,renderList:r});return}let a=e.children;for(let l=0,c=a.length;l<c;l++)this._projectObject(a[l],t,n,r,s)}_renderBundles(e,t,n){for(let r of e)this._renderBundle(r,t,n)}_renderTransparents(e,t,n,r,s){if(t.length>0){for(let{material:o}of t)o.side=mi;this._renderObjects(t,n,r,s,"backSide");for(let{material:o}of t)o.side=zo;this._renderObjects(e,n,r,s);for(let{material:o}of t)o.side=vr}else this._renderObjects(e,n,r,s)}_renderObjects(e,t,n,r,s=null){for(let o=0,a=e.length;o<a;o++){let{object:l,geometry:c,material:u,group:f,clippingContext:d}=e[o];this._currentRenderObjectFunction(l,n,t,c,u,f,r,d,s)}}_getShadowNodes(e){let t=e.version,n=this._cacheShadowNodes.get(e);if(n===void 0||n.version!==t){let r=e.map&&e.map.isTexture,s=e.colorNode&&e.colorNode.isNode,o=e.castShadowNode&&e.castShadowNode.isNode,a=e.maskShadowNode&&e.maskShadowNode.isNode||e.maskNode&&e.maskNode.isNode,l=null,c=null,u=null;if(r||s||o||a){let f,d;if(o?(f=e.castShadowNode.rgb,d=e.castShadowNode.a,this.shadowMap.transmitted!==!0&&ni("Renderer: `shadowMap.transmitted` needs to be set to `true` when using `material.castShadowNode`.")):(f=pe(0),d=oe(1)),r&&(d=d.mul(mr("map","texture",e).a)),s&&(d=d.mul(e.colorNode.a)),c=Ft(f,d),a){let A=e.maskShadowNode||e.maskNode;c=me(([y])=>(A.not().discard(),y))(c)}}e.depthNode&&e.depthNode.isNode&&(u=e.depthNode),e.castShadowPositionNode&&e.castShadowPositionNode.isNode?l=e.castShadowPositionNode:e.positionNode&&e.positionNode.isNode&&(l=e.positionNode),n={version:t,colorNode:c,depthNode:u,positionNode:l},this._cacheShadowNodes.set(e,n)}return n}_updateCamera(e){let t=this.xr;if(t.isPresenting===!1){let n=!1;if(this.reversedDepthBuffer===!0&&e.reversedDepth!==!0){if(e._reversedDepth=!0,e.isArrayCamera)for(let s of e.cameras)s._reversedDepth=!0;n=!0}let r=this.coordinateSystem;if(e.coordinateSystem!==r){if(e.coordinateSystem=r,e.isArrayCamera)for(let s of e.cameras)s.coordinateSystem=r;n=!0}if(n===!0&&(e.updateProjectionMatrix(),e.isArrayCamera))for(let s of e.cameras)s.updateProjectionMatrix()}return e.parent===null&&e.matrixWorldAutoUpdate===!0&&e.updateMatrixWorld(),t.enabled===!0&&t.isPresenting===!0&&(t.cameraAutoUpdate===!0&&t.updateCamera(e),e=t.getCamera()),e}renderObject(e,t,n,r,s,o,a,l=null,c=null){let u=!1,f,d,A,y,w,S,T,R=this._currentSourceMaterial;if(e.onBeforeRender(this,t,n,r,s,o),s.allowOverride===!0&&t.overrideMaterial!==null){this._currentSourceMaterial=s;let I=t.overrideMaterial;if(u=!0,f=I.isNodeMaterial?I.colorNode:null,d=I.isNodeMaterial?I.depthNode:null,A=I.isNodeMaterial?I.positionNode:null,y=t.overrideMaterial.side,w=I.displacementMap,S=I.displacementScale,T=I.displacementBias,s.positionNode&&s.positionNode.isNode&&(I.positionNode=s.positionNode),I.alphaTest=s.alphaTest,I.alphaMap=s.alphaMap,I.displacementMap=s.displacementMap,I.displacementScale=s.displacementScale,I.displacementBias=s.displacementBias,I.transparent=s.transparent||s.transmission>0||s.transmissionNode&&s.transmissionNode.isNode||s.backdropNode&&s.backdropNode.isNode,I.isShadowPassMaterial){let{colorNode:P,depthNode:F,positionNode:D}=this._getShadowNodes(s);this.shadowMap.type===Vc?I.side=s.shadowSide!==null?s.shadowSide:s.side:I.side=s.shadowSide!==null?s.shadowSide:wIe[s.side],P!==null&&(I.colorNode=P),F!==null&&(I.depthNode=F),D!==null&&(I.positionNode=D)}s=I}s.transparent===!0&&s.side===vr&&s.forceSinglePass===!1?(s.side=mi,this._handleObjectFunction(e,s,t,n,a,o,l,"backSide"),s.side=zo,this._handleObjectFunction(e,s,t,n,a,o,l,c),s.side=vr):this._handleObjectFunction(e,s,t,n,a,o,l,c),u&&(t.overrideMaterial.colorNode=f,t.overrideMaterial.depthNode=d,t.overrideMaterial.positionNode=A,t.overrideMaterial.side=y,t.overrideMaterial.displacementMap=w,t.overrideMaterial.displacementScale=S,t.overrideMaterial.displacementBias=T),this._currentSourceMaterial=R,e.onAfterRender(this,t,n,r,s,o)}hasCompatibility(e){if(this._initialized===!1)throw new Error('THREE.Renderer: .hasCompatibility() called before the backend is initialized. Use "await renderer.init();" before using this method.');return this.backend.hasCompatibility(e)}_renderObjectDirect(e,t,n,r,s,o,a,l){let c=this._objects.get(e,t,n,r,s,this._currentRenderContext,a,l);c.drawRange=e.geometry.drawRange,c.group=o,this._currentRenderBundle!==null&&(this.backend.get(this._currentRenderBundle).renderObjects.push(c),c.bundle=this._currentRenderBundle.bundleGroup);let u=this._nodes.needsRefresh(c);u&&(this._nodes.updateBefore(c),this._geometries.updateForRender(c),this._nodes.updateForRender(c),this._bindings.updateForRender(c)),this._pipelines.updateForRender(c),this._pipelines.isReady(c)&&(this.backend.draw(c,this.info),u&&this._nodes.updateAfter(c))}_createObjectPipeline(e,t,n,r,s,o,a,l){if(this._compilationPromises!==null){this._compilationPromises.push({object:e,material:t,scene:n,camera:r,lightsNode:s,group:o,clippingContext:a,passId:l,renderContext:this._currentRenderContext});return}let c=this._objects.get(e,t,n,r,s,this._currentRenderContext,a,l);c.drawRange=e.geometry.drawRange,c.group=o,this._nodes.updateBefore(c),this._geometries.updateForRender(c),this._nodes.updateForRender(c),this._bindings.updateForRender(c),this._pipelines.getForRender(c,this._compilationPromises),this._nodes.updateAfter(c)}_onCanvasTargetResize(){this._initialized&&this.backend.updateSize()}get compile(){return this.compileAsync}},Z4=class{constructor(e=""){this.name=e,this.visibility=0}setVisibility(e){this.visibility|=e}getVisibility(){return this.visibility}clone(){return Object.assign(new this.constructor,this)}};function moe(i){return i+(hm-i%hm)%hm}var K4=class extends Z4{constructor(e,t=null){super(e),this.isBuffer=!0,this.bytesPerElement=Float32Array.BYTES_PER_ELEMENT,this._buffer=t,this._updateRanges=[]}get updateRanges(){return this._updateRanges}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}get byteLength(){return moe(this._buffer.byteLength)}get buffer(){return this._buffer}update(){return!0}release(){this._buffer=null}},Q4=class extends K4{constructor(e,t=null){super(e,t),this.isUniformBuffer=!0}},SIe=0,J4=class extends Q4{constructor(e,t){super("UniformBuffer_"+SIe++,e?e.value:null),this.nodeUniform=e,this.groupNode=t,this.isNodeUniformBuffer=!0}set updateRanges(e){this.nodeUniform.updateRanges=e}get updateRanges(){return this.nodeUniform.updateRanges}addUpdateRange(e,t){this.nodeUniform.addUpdateRange(e,t)}clearUpdateRanges(){this.nodeUniform.clearUpdateRanges()}get byteLength(){return moe(this.buffer.byteLength)}get buffer(){return this.nodeUniform.value}},x9=class extends Q4{constructor(e){super(e),this.isUniformsGroup=!0,this._values=null,this.uniforms=[],this._updateRangeCache=new Map,this._addedIndices=new Set}addUniformUpdateRange(e){let t=e.index;if(this._addedIndices.has(t))return;let n=this._updateRangeCache.get(t);n===void 0&&(n={start:0,count:0},this._updateRangeCache.set(t,n)),n.start=e.offset,n.count=e.itemSize,this._addedIndices.add(t),this.updateRanges.push(n)}clearUpdateRanges(){this._addedIndices.clear(),super.clearUpdateRanges()}addUniform(e){return this.uniforms.push(e),this}removeUniform(e){let t=this.uniforms.indexOf(e);return t!==-1&&this.uniforms.splice(t,1),this}get values(){return this._values===null&&(this._values=Array.from(this.buffer)),this._values}get buffer(){let e=this._buffer;if(e===null){let t=this.byteLength;e=new Float32Array(new ArrayBuffer(t)),this._buffer=e}return e}get byteLength(){let e=this.bytesPerElement,t=0;for(let n=0,r=this.uniforms.length;n<r;n++){let s=this.uniforms[n],o=s.boundary,a=s.itemSize*e,l=t%hm,c=l%o,u=l+c;t+=c,u!==0&&hm-u<a&&(t+=hm-u),s.offset=t/e,s.index=n,t+=a}return Math.ceil(t/hm)*hm}update(){let e=!1;for(let t of this.uniforms)this.updateByType(t)===!0&&(e=!0);return e}release(){super.release(),this._values=null}updateByType(e){if(e.isNumberUniform)return this.updateNumber(e);if(e.isVector2Uniform)return this.updateVector2(e);if(e.isVector3Uniform)return this.updateVector3(e);if(e.isVector4Uniform)return this.updateVector4(e);if(e.isColorUniform)return this.updateColor(e);if(e.isMatrix3Uniform)return this.updateMatrix3(e);if(e.isMatrix4Uniform)return this.updateMatrix4(e);ze("WebGPUUniformsGroup: Unsupported uniform type.",e)}updateNumber(e){let t=!1,n=this.values,r=e.getValue(),s=e.offset,o=e.getType();if(n[s]!==r){let a=this._getBufferForType(o);a[s]=n[s]=r,t=!0,this.addUniformUpdateRange(e)}return t}updateVector2(e){let t=!1,n=this.values,r=e.getValue(),s=e.offset,o=e.getType();if(n[s+0]!==r.x||n[s+1]!==r.y){let a=this._getBufferForType(o);a[s+0]=n[s+0]=r.x,a[s+1]=n[s+1]=r.y,t=!0,this.addUniformUpdateRange(e)}return t}updateVector3(e){let t=!1,n=this.values,r=e.getValue(),s=e.offset,o=e.getType();if(n[s+0]!==r.x||n[s+1]!==r.y||n[s+2]!==r.z){let a=this._getBufferForType(o);a[s+0]=n[s+0]=r.x,a[s+1]=n[s+1]=r.y,a[s+2]=n[s+2]=r.z,t=!0,this.addUniformUpdateRange(e)}return t}updateVector4(e){let t=!1,n=this.values,r=e.getValue(),s=e.offset,o=e.getType();if(n[s+0]!==r.x||n[s+1]!==r.y||n[s+2]!==r.z||n[s+3]!==r.w){let a=this._getBufferForType(o);a[s+0]=n[s+0]=r.x,a[s+1]=n[s+1]=r.y,a[s+2]=n[s+2]=r.z,a[s+3]=n[s+3]=r.w,t=!0,this.addUniformUpdateRange(e)}return t}updateColor(e){let t=!1,n=this.values,r=e.getValue(),s=e.offset;if(n[s+0]!==r.r||n[s+1]!==r.g||n[s+2]!==r.b){let o=this.buffer;o[s+0]=n[s+0]=r.r,o[s+1]=n[s+1]=r.g,o[s+2]=n[s+2]=r.b,t=!0,this.addUniformUpdateRange(e)}return t}updateMatrix3(e){let t=!1,n=this.values,r=e.getValue().elements,s=e.offset;if(n[s+0]!==r[0]||n[s+1]!==r[1]||n[s+2]!==r[2]||n[s+4]!==r[3]||n[s+5]!==r[4]||n[s+6]!==r[5]||n[s+8]!==r[6]||n[s+9]!==r[7]||n[s+10]!==r[8]){let o=this.buffer;o[s+0]=n[s+0]=r[0],o[s+1]=n[s+1]=r[1],o[s+2]=n[s+2]=r[2],o[s+4]=n[s+4]=r[3],o[s+5]=n[s+5]=r[4],o[s+6]=n[s+6]=r[5],o[s+8]=n[s+8]=r[6],o[s+9]=n[s+9]=r[7],o[s+10]=n[s+10]=r[8],t=!0,this.addUniformUpdateRange(e)}return t}updateMatrix4(e){let t=!1,n=this.values,r=e.getValue().elements,s=e.offset;return EIe(n,r,s)===!1&&(this.buffer.set(r,s),TIe(n,r,s),t=!0,this.addUniformUpdateRange(e)),t}_getBufferForType(e){return e==="int"||e==="ivec2"||e==="ivec3"||e==="ivec4"?new Int32Array(this.buffer.buffer):e==="uint"||e==="uvec2"||e==="uvec3"||e==="uvec4"?new Uint32Array(this.buffer.buffer):this.buffer}};function TIe(i,e,t){for(let n=0,r=e.length;n<r;n++)i[t+n]=e[n]}function EIe(i,e,t){for(let n=0,r=e.length;n<r;n++)if(i[t+n]!==e[n])return!1;return!0}var MIe=0,eP=class extends x9{constructor(e,t){super(e),this.id=MIe++,this.groupNode=t,this.isNodeUniformsGroup=!0}},tP=class extends Z4{constructor(e,t){super(e),this._texture=t,this.version=-1,this.generation=null,this.samplerKey="",this.isSampler=!0}set texture(e){this._texture!==e&&(this._texture=e,this.reset())}get texture(){return this._texture}update(){let{texture:e,version:t}=this;return t!==e.version?(this.version=e.version,!0):!1}reset(){this.generation=null,this.version=-1}release(){this._texture=null}},CIe=0,y9=class extends tP{constructor(e,t){super(e,t),this.id=CIe++,this.store=!1,this.mipLevel=0,this.isSampledTexture=!0}},vx=class extends y9{constructor(e,t,n,r=null){super(e,t?t.value:null),this.textureNode=t,this.groupNode=n,this.access=r}update(){let{textureNode:e}=this;return this.texture!==e.value?(this.texture=e.value,!0):super.update()}},nP=class extends vx{constructor(e,t,n,r=null){super(e,t,n,r),this.isSampledCubeTexture=!0}},RS=class extends vx{constructor(e,t,n,r=null){super(e,t,n,r),this.isSampledTexture3D=!0}},kte={bitcast_int_uint:new hr("uint tsl_bitcast_int_to_uint ( int x ) { return floatBitsToUint( intBitsToFloat ( x ) ); }"),bitcast_uint_int:new hr("uint tsl_bitcast_uint_to_int ( uint x ) { return floatBitsToInt( uintBitsToFloat ( x ) ); }"),textureGather:new hr(`41704170 vec4 tsl_textureGather( const int comp, sampler2D map, vec2 coord, ivec2 offset, bool flipY ) {41714171 if ( flipY ) offset.y = - offset.y;41724172 vec2 size = vec2( textureSize( map, 0 ) );@@ -4222,7 +4222,7 @@ vec4 tsl_textureGatherCompare_array( sampler2DArrayShadow map, vec3 coord, ivec2
42224222 );42234223 return flipY ? ret.wzyx : ret;42244224 }4225-`)},$Ie={textureDimensions:"textureSize",equals:"equal",bitcast_float_int:"floatBitsToInt",bitcast_int_float:"intBitsToFloat",bitcast_uint_float:"uintBitsToFloat",bitcast_float_uint:"floatBitsToUint",bitcast_uint_int:"tsl_bitcast_uint_to_int",bitcast_int_uint:"tsl_bitcast_int_to_uint",floatpack_snorm_2x16:"packSnorm2x16",floatpack_unorm_2x16:"packUnorm2x16",floatpack_float16_2x16:"packHalf2x16",floatunpack_snorm_2x16:"unpackSnorm2x16",floatunpack_unorm_2x16:"unpackUnorm2x16",floatunpack_float16_2x16:"unpackHalf2x16"},mte={low:"lowp",medium:"mediump",high:"highp"},Ate={swizzleAssign:!0,storageBuffer:!1},gte={perspective:"smooth",linear:"noperspective"},vte={centroid:"centroid"},_te=`4225+`)},RIe={textureDimensions:"textureSize",equals:"equal",bitcast_float_int:"floatBitsToInt",bitcast_int_float:"intBitsToFloat",bitcast_uint_float:"uintBitsToFloat",bitcast_float_uint:"floatBitsToUint",bitcast_uint_int:"tsl_bitcast_uint_to_int",bitcast_int_uint:"tsl_bitcast_int_to_uint",floatpack_snorm_2x16:"packSnorm2x16",floatpack_unorm_2x16:"packUnorm2x16",floatpack_float16_2x16:"packHalf2x16",floatunpack_snorm_2x16:"unpackSnorm2x16",floatunpack_unorm_2x16:"unpackUnorm2x16",floatunpack_float16_2x16:"unpackHalf2x16"},zte={low:"lowp",medium:"mediump",high:"highp"},Vte={swizzleAssign:!0,storageBuffer:!1},Gte={perspective:"smooth",linear:"noperspective"},qte={centroid:"centroid"},Hte=`42264226 precision highp float;42274227 precision highp int;42284228 precision highp sampler2D;@@ -4243,20 +4243,20 @@ precision highp isampler2DArray;
42434243 precision highp sampler2DShadow;42444244 precision highp sampler2DArrayShadow;42454245 precision highp samplerCubeShadow;4246-`,t9=class extends O4{constructor(e,t){super(e,t,new Wk),this.uniformGroups={},this.transforms=[],this.extensions={},this.builtins={vertex:[],fragment:[],compute:[]}}needsToWorkingColorSpace(e){return e.isVideoTexture===!0&&e.colorSpace!==ua}_include(e){let t=pte[e];return t.build(this),this.addInclude(t),t}getMethod(e){return pte[e]!==void 0&&this._include(e),$Ie[e]||e}getBitcastMethod(e,t){return this.getMethod(`bitcast_${t}_${e}`)}getFloatPackingMethod(e){return this.getMethod(`floatpack_${e}_2x16`)}getFloatUnpackingMethod(e){return this.getMethod(`floatunpack_${e}_2x16`)}getTernary(e,t,n){return`${e} ? ${t} : ${n}`}getOutputStructName(){return""}buildFunctionCode(e){let t=e.layout,n=this.flowShaderNode(e),r=[];for(let o of t.inputs)r.push(this.getType(o.type)+" "+o.name);return`${this.getType(t.type)} ${t.name}( ${r.join(", ")} ) {4246+`,b9=class extends W4{constructor(e,t){super(e,t,new f9),this.uniformGroups={},this.transforms=[],this.extensions={},this.builtins={vertex:[],fragment:[],compute:[]}}needsToWorkingColorSpace(e){return e.isVideoTexture===!0&&e.colorSpace!==ha}_include(e){let t=kte[e];return t.build(this),this.addInclude(t),t}getMethod(e){return kte[e]!==void 0&&this._include(e),RIe[e]||e}getBitcastMethod(e,t){return this.getMethod(`bitcast_${t}_${e}`)}getFloatPackingMethod(e){return this.getMethod(`floatpack_${e}_2x16`)}getFloatUnpackingMethod(e){return this.getMethod(`floatunpack_${e}_2x16`)}getTernary(e,t,n){return`${e} ? ${t} : ${n}`}getOutputStructName(){return""}buildFunctionCode(e){let t=e.layout,n=this.flowShaderNode(e),r=[];for(let o of t.inputs)r.push(this.getType(o.type)+" "+o.name);return`${this.getType(t.type)} ${t.name}( ${r.join(", ")} ) {42474247 42484248 ${n.vars}42494249 42504250 ${n.code}42514251 return ${n.result};42524252 4253-}`}setupPBO(e){let t=e.value;if(t.pbo===void 0){let n=t.array,r=t.count*t.itemSize,{itemSize:s}=t,o=t.array.constructor.name.toLowerCase().includes("int"),a=o?kh:Ld;s===2?a=o?zh:js:s===3?a=o?Tb:Pd:s===4&&(a=o?d0:Or);let l={Float32Array:cr,Uint8Array:Ji,Uint16Array:bl,Uint32Array:xi,Int8Array:Oh,Int16Array:Uh,Int32Array:Zr,Uint8ClampedArray:Ji},c=Math.pow(2,Math.ceil(Math.log2(Math.sqrt(r/s)))),u=Math.ceil(r/s/c);c*u*s<r&&u++;let f=c*u*s,d=new n.constructor(f);d.set(n,0),t.array=d;let A=new kA(t.array,c,u,a,l[t.array.constructor.name]||cr);A.needsUpdate=!0,A.isPBOTexture=!0;let y=new su(A,null,null);y.setPrecision("high"),t.pboNode=y,t.pbo=y.value,this.getUniformFromNode(t.pboNode,"texture",this.shaderStage,this.context.nodeName)}}getPropertyName(e,t=this.shaderStage){return e.isNodeUniform&&e.node.isTextureNode!==!0&&e.node.isBufferNode!==!0?e.name:super.getPropertyName(e,t)}generatePBO(e){let{node:t,indexNode:n}=e,r=t.value;if(this.renderer.backend.has(r)){let u=this.renderer.backend.get(r);u.pbo=r.pbo}let s=this.getUniformFromNode(r.pboNode,"texture",this.shaderStage,this.context.nodeName),o=this.getPropertyName(s);this.increaseUsage(n);let a=n.build(this,"uint"),l=this.getDataFromNode(e),c=l.propertyName;if(c===void 0){let u=this.getVarFromNode(e);c=this.getPropertyName(u);let f=this.getDataFromNode(t),d=f.propertySizeName;d===void 0&&(d=c+"Size",this.getVarFromNode(t,d,"uint"),this.addLineFlowCode(`${d} = uint( textureSize( ${o}, 0 ).x )`,e),f.propertySizeName=d);let{itemSize:A}=r,y="."+n1.join("").slice(0,A),w=`ivec2(${a} % ${d}, ${a} / ${d})`,S=this.generateTextureLoad(null,o,w,"0",null,null),T="vec4";r.pbo.type===xi?T="uvec4":r.pbo.type===Zr&&(T="ivec4"),this.addLineFlowCode(`${c} = ${T}(${S})${y}`,e),l.propertyName=c}return c}generateTextureLoad(e,t,n,r,s,o){r===null&&(r="0");let a;return s?o?a=`texelFetchOffset( ${t}, ivec3( ${n}, ${s} ), int( ${r} ), ${o} )`:a=`texelFetch( ${t}, ivec3( ${n}, ${s} ), int( ${r} ) )`:o?a=`texelFetchOffset( ${t}, ${n}, int( ${r} ), ${o} )`:a=`texelFetch( ${t}, ${n}, int( ${r} ) )`,e!==null&&e.isDepthTexture&&(a+=".x"),a}generateTexture(e,t,n,r,s){return r&&(n=`vec3( ${n}, ${r} )`),e.isDepthTexture?s?`textureOffset( ${t}, ${n}, ${s} ).x`:`texture( ${t}, ${n} ).x`:s?`textureOffset( ${t}, ${n}, ${s} )`:`texture( ${t}, ${n} )`}generateTextureLevel(e,t,n,r,s,o){return s&&(n=`vec3( ${n}, ${s} )`),o?`textureLodOffset( ${t}, ${n}, ${r}, ${o} )`:`textureLod( ${t}, ${n}, ${r} )`}generateTextureBias(e,t,n,r,s,o){return s&&(n=`vec3( ${n}, ${s} )`),o?`textureOffset( ${t}, ${n}, ${o}, ${r} )`:`texture( ${t}, ${n}, ${r} )`}generateTextureGrad(e,t,n,r,s,o){return s&&(n=`vec3( ${n}, ${s} )`),o?`textureGradOffset( ${t}, ${n}, ${r[0]}, ${r[1]}, ${o} )`:`textureGrad( ${t}, ${n}, ${r[0]}, ${r[1]} )`}generateTextureCompare(e,t,n,r,s,o,a=this.shaderStage){if(a==="fragment")return e.isCubeTexture?`texture( ${t}, vec4( ${n}, ${r} ) )`:s?o?`textureOffset( ${t}, vec4( ${n}, ${s}, ${r} ), ${o} )`:`texture( ${t}, vec4( ${n}, ${s}, ${r} ) )`:o?`textureOffset( ${t}, vec3( ${n}, ${r} ), ${o} )`:`texture( ${t}, vec3( ${n}, ${r} ) )`;ze(`WebGPURenderer: THREE.DepthTexture.compareFunction() does not support ${a} shader.`)}generateTextureGather(e,t,n,r,s,o,a){return e.isDepthTexture&&(r="0"),o===null&&(o="ivec2( 0 )"),a===null&&(a="false"),s?(this._include("textureGatherArray"),`tsl_textureGather_array( ${r}, ${t}, vec3( ${n}, ${s} ), ${o}, ${a} )`):(this._include("textureGather"),`tsl_textureGather( ${r}, ${t}, ${n}, ${o}, ${a} )`)}generateTextureGatherCompare(e,t,n,r,s,o,a){return o===null&&(o="ivec2( 0 )"),a===null&&(a="false"),s?(this._include("textureGatherCompareArray"),`tsl_textureGatherCompare_array( ${t}, vec3( ${n}, ${s} ), ${o}, ${r}, ${a} )`):(this._include("textureGatherCompare"),`tsl_textureGatherCompare( ${t}, ${n}, ${o}, ${r}, ${a} )`)}getUniforms(e){let t=this.uniforms[e],n=[],r={};for(let o of t){let a=null,l=!1;if(o.type==="texture"||o.type==="texture3D"){let c=o.node,u=c.value,f="";(u.isDataTexture===!0||u.isData3DTexture===!0)&&(u.type===xi?f="u":u.type===Zr&&(f="i")),o.type==="texture3D"&&u.isArrayTexture===!1?a=`${f}sampler3D ${o.name};`:u.compareFunction&&c.compareNode!==null?u.isArrayTexture===!0?a=`sampler2DArrayShadow ${o.name};`:a=`sampler2DShadow ${o.name};`:u.isArrayTexture===!0||u.isDataArrayTexture===!0||u.isCompressedArrayTexture===!0?a=`${f}sampler2DArray ${o.name};`:a=`${f}sampler2D ${o.name};`}else if(o.type==="cubeTexture")a=`samplerCube ${o.name};`;else if(o.type==="cubeDepthTexture")o.node.value.compareFunction?a=`samplerCubeShadow ${o.name};`:a=`samplerCube ${o.name};`;else if(o.type==="buffer"){let c=o.node,u=this.getType(c.bufferType),f=c.bufferCount,d=f>0?f:"";a=`${c.name} {4253+}`}setupPBO(e){let t=e.value;if(t.pbo===void 0){let n=t.array,r=t.count*t.itemSize,{itemSize:s}=t,o=t.array.constructor.name.toLowerCase().includes("int"),a=o?kh:Fd;s===2?a=o?zh:Ws:s===3?a=o?Ib:Nd:s===4&&(a=o?g0:Or);let l={Float32Array:cr,Uint8Array:Ji,Uint16Array:wl,Uint32Array:xi,Int8Array:Oh,Int16Array:Uh,Int32Array:Kr,Uint8ClampedArray:Ji},c=Math.pow(2,Math.ceil(Math.log2(Math.sqrt(r/s)))),u=Math.ceil(r/s/c);c*u*s<r&&u++;let f=c*u*s,d=new n.constructor(f);d.set(n,0),t.array=d;let A=new HA(t.array,c,u,a,l[t.array.constructor.name]||cr);A.needsUpdate=!0,A.isPBOTexture=!0;let y=new su(A,null,null);y.setPrecision("high"),t.pboNode=y,t.pbo=y.value,this.getUniformFromNode(t.pboNode,"texture",this.shaderStage,this.context.nodeName)}}getPropertyName(e,t=this.shaderStage){return e.isNodeUniform&&e.node.isTextureNode!==!0&&e.node.isBufferNode!==!0?e.name:super.getPropertyName(e,t)}generatePBO(e){let{node:t,indexNode:n}=e,r=t.value;if(this.renderer.backend.has(r)){let u=this.renderer.backend.get(r);u.pbo=r.pbo}let s=this.getUniformFromNode(r.pboNode,"texture",this.shaderStage,this.context.nodeName),o=this.getPropertyName(s);this.increaseUsage(n);let a=n.build(this,"uint"),l=this.getDataFromNode(e),c=l.propertyName;if(c===void 0){let u=this.getVarFromNode(e);c=this.getPropertyName(u);let f=this.getDataFromNode(t),d=f.propertySizeName;d===void 0&&(d=c+"Size",this.getVarFromNode(t,d,"uint"),this.addLineFlowCode(`${d} = uint( textureSize( ${o}, 0 ).x )`,e),f.propertySizeName=d);let{itemSize:A}=r,y="."+a1.join("").slice(0,A),w=`ivec2(${a} % ${d}, ${a} / ${d})`,S=this.generateTextureLoad(null,o,w,"0",null,null),T="vec4";r.pbo.type===xi?T="uvec4":r.pbo.type===Kr&&(T="ivec4"),this.addLineFlowCode(`${c} = ${T}(${S})${y}`,e),l.propertyName=c}return c}generateTextureLoad(e,t,n,r,s,o){r===null&&(r="0");let a;return s?o?a=`texelFetchOffset( ${t}, ivec3( ${n}, ${s} ), int( ${r} ), ${o} )`:a=`texelFetch( ${t}, ivec3( ${n}, ${s} ), int( ${r} ) )`:o?a=`texelFetchOffset( ${t}, ${n}, int( ${r} ), ${o} )`:a=`texelFetch( ${t}, ${n}, int( ${r} ) )`,e!==null&&e.isDepthTexture&&(a+=".x"),a}generateTexture(e,t,n,r,s){return r&&(n=`vec3( ${n}, ${r} )`),e.isDepthTexture?s?`textureOffset( ${t}, ${n}, ${s} ).x`:`texture( ${t}, ${n} ).x`:s?`textureOffset( ${t}, ${n}, ${s} )`:`texture( ${t}, ${n} )`}generateTextureLevel(e,t,n,r,s,o){return s&&(n=`vec3( ${n}, ${s} )`),o?`textureLodOffset( ${t}, ${n}, ${r}, ${o} )`:`textureLod( ${t}, ${n}, ${r} )`}generateTextureBias(e,t,n,r,s,o){return s&&(n=`vec3( ${n}, ${s} )`),o?`textureOffset( ${t}, ${n}, ${o}, ${r} )`:`texture( ${t}, ${n}, ${r} )`}generateTextureGrad(e,t,n,r,s,o){return s&&(n=`vec3( ${n}, ${s} )`),o?`textureGradOffset( ${t}, ${n}, ${r[0]}, ${r[1]}, ${o} )`:`textureGrad( ${t}, ${n}, ${r[0]}, ${r[1]} )`}generateTextureCompare(e,t,n,r,s,o,a=this.shaderStage){if(a==="fragment")return e.isCubeTexture?`texture( ${t}, vec4( ${n}, ${r} ) )`:s?o?`textureOffset( ${t}, vec4( ${n}, ${s}, ${r} ), ${o} )`:`texture( ${t}, vec4( ${n}, ${s}, ${r} ) )`:o?`textureOffset( ${t}, vec3( ${n}, ${r} ), ${o} )`:`texture( ${t}, vec3( ${n}, ${r} ) )`;ze(`WebGPURenderer: THREE.DepthTexture.compareFunction() does not support ${a} shader.`)}generateTextureGather(e,t,n,r,s,o,a){return e.isDepthTexture&&(r="0"),o===null&&(o="ivec2( 0 )"),a===null&&(a="false"),s?(this._include("textureGatherArray"),`tsl_textureGather_array( ${r}, ${t}, vec3( ${n}, ${s} ), ${o}, ${a} )`):(this._include("textureGather"),`tsl_textureGather( ${r}, ${t}, ${n}, ${o}, ${a} )`)}generateTextureGatherCompare(e,t,n,r,s,o,a){return o===null&&(o="ivec2( 0 )"),a===null&&(a="false"),s?(this._include("textureGatherCompareArray"),`tsl_textureGatherCompare_array( ${t}, vec3( ${n}, ${s} ), ${o}, ${r}, ${a} )`):(this._include("textureGatherCompare"),`tsl_textureGatherCompare( ${t}, ${n}, ${o}, ${r}, ${a} )`)}getUniforms(e){let t=this.uniforms[e],n=[],r={};for(let o of t){let a=null,l=!1;if(o.type==="texture"||o.type==="texture3D"){let c=o.node,u=c.value,f="";(u.isDataTexture===!0||u.isData3DTexture===!0)&&(u.type===xi?f="u":u.type===Kr&&(f="i")),o.type==="texture3D"&&u.isArrayTexture===!1?a=`${f}sampler3D ${o.name};`:u.compareFunction&&c.compareNode!==null?u.isArrayTexture===!0?a=`sampler2DArrayShadow ${o.name};`:a=`sampler2DShadow ${o.name};`:u.isArrayTexture===!0||u.isDataArrayTexture===!0||u.isCompressedArrayTexture===!0?a=`${f}sampler2DArray ${o.name};`:a=`${f}sampler2D ${o.name};`}else if(o.type==="cubeTexture")a=`samplerCube ${o.name};`;else if(o.type==="cubeDepthTexture")o.node.value.compareFunction?a=`samplerCubeShadow ${o.name};`:a=`samplerCube ${o.name};`;else if(o.type==="buffer"){let c=o.node,u=this.getType(c.bufferType),f=c.bufferCount,d=f>0?f:"";a=`${c.name} {42544254 ${u} ${o.name}[${d}];42554255 };4256-`}else{let c=o.groupNode.name;if(r[c]===void 0){let u=this.uniformGroups[c];if(u!==void 0){let f=[];for(let d of u.uniforms){let A=d.getType(),y=this.getVectorType(A),w=d.nodeUniform.node.precision,S=`${y} ${d.name};`;w!==null&&(S=mte[w]+" "+S),f.push(" "+S)}r[c]=f}}l=!0}if(!l){let c=o.node.precision;c!==null&&(a=mte[c]+" "+a),a="uniform "+a,n.push(a)}}let s="";for(let o in r){let a=r[o];s+=this._getGLSLUniformStruct(o,a.join(`4256+`}else{let c=o.groupNode.name;if(r[c]===void 0){let u=this.uniformGroups[c];if(u!==void 0){let f=[];for(let d of u.uniforms){let A=d.getType(),y=this.getVectorType(A),w=d.nodeUniform.node.precision,S=`${y} ${d.name};`;w!==null&&(S=zte[w]+" "+S),f.push(" "+S)}r[c]=f}}l=!0}if(!l){let c=o.node.precision;c!==null&&(a=zte[c]+" "+a),a="uniform "+a,n.push(a)}}let s="";for(let o in r){let a=r[o];s+=this._getGLSLUniformStruct(o,a.join(`42574257 `))+`42584258 `}return s+=n.join(`4259-`),s}getTypeFromAttribute(e){let t=super.getTypeFromAttribute(e);if(/^[iu]/.test(t)&&e.gpuType!==Zr){let n=e;e.isInterleavedBufferAttribute&&(n=e.data);let r=n.array;r instanceof Uint32Array||r instanceof Int32Array||(t=t.slice(1))}return t}getAttributes(e){let t="";if(e==="vertex"||e==="compute"){let n=this.getAttributesArray(),r=0;for(let s of n)t+=`layout( location = ${r++} ) in ${s.type} ${s.name};4259+`),s}getTypeFromAttribute(e){let t=super.getTypeFromAttribute(e);if(/^[iu]/.test(t)&&e.gpuType!==Kr){let n=e;e.isInterleavedBufferAttribute&&(n=e.data);let r=n.array;r instanceof Uint32Array||r instanceof Int32Array||(t=t.slice(1))}return t}getAttributes(e){let t="";if(e==="vertex"||e==="compute"){let n=this.getAttributesArray(),r=0;for(let s of n)t+=`layout( location = ${r++} ) in ${s.type} ${s.name};42604260 `}return t}getStructMembers(e){let t=[];for(let n of e.members)t.push(` ${n.type} ${n.name};`);return t.join(`42614261 `)}getStructs(e){let t=[],n=this.structs[e],r=[];for(let s of n)if(s.output)for(let o of s.members)r.push(`layout( location = ${o.index} ) out ${o.type} ${o.name};`);else{let o="struct "+s.name+` {42624262 `;o+=this.getStructMembers(s),o+=`@@ -4266,14 +4266,14 @@ ${n.code}
42664266 `)+`42674267 42684268 `+t.join(`4269-`)}getVaryings(e){let t="",n=this.varyings;if(e==="vertex"||e==="compute")for(let r of n){e==="compute"&&(r.needsInterpolation=!0);let s=this.getType(r.type);if(r.needsInterpolation)if(r.interpolationType){let o=gte[r.interpolationType]||r.interpolationType,a=vte[r.interpolationSampling]||"";t+=`${o} ${a} out ${s} ${r.name};4269+`)}getVaryings(e){let t="",n=this.varyings;if(e==="vertex"||e==="compute")for(let r of n){e==="compute"&&(r.needsInterpolation=!0);let s=this.getType(r.type);if(r.needsInterpolation)if(r.interpolationType){let o=Gte[r.interpolationType]||r.interpolationType,a=qte[r.interpolationSampling]||"";t+=`${o} ${a} out ${s} ${r.name};42704270 `}else{let o=s.includes("int")||s.includes("uv")||s.includes("iv")?"flat ":"";t+=`${o}out ${s} ${r.name};42714271 `}else t+=`${s} ${r.name};4272-`}else if(e==="fragment"){for(let r of n)if(r.needsInterpolation){let s=this.getType(r.type);if(r.interpolationType){let o=gte[r.interpolationType]||r.interpolationType,a=vte[r.interpolationSampling]||"";t+=`${o} ${a} in ${s} ${r.name};4272+`}else if(e==="fragment"){for(let r of n)if(r.needsInterpolation){let s=this.getType(r.type);if(r.interpolationType){let o=Gte[r.interpolationType]||r.interpolationType,a=qte[r.interpolationSampling]||"";t+=`${o} ${a} in ${s} ${r.name};42734273 `}else{let o=s.includes("int")||s.includes("uv")||s.includes("iv")?"flat ":"";t+=`${o}in ${s} ${r.name};42744274 `}}}for(let r of this.builtins[e])t+=`${r};42754275 `;return t}getVertexIndex(){return"uint( gl_VertexID )"}getInstanceIndex(){return"uint( gl_InstanceID )"}getInvocationLocalIndex(){return`uint( gl_InstanceID ) % ${this.object.workgroupSize.reduce((n,r)=>n*r,1)}u`}getSubgroupSize(){ze("GLSLNodeBuilder: WebGLBackend does not support the subgroupSize node")}getInvocationSubgroupIndex(){ze("GLSLNodeBuilder: WebGLBackend does not support the invocationSubgroupIndex node")}getSubgroupIndex(){ze("GLSLNodeBuilder: WebGLBackend does not support the subgroupIndex node")}getDrawIndex(){return this.renderer.backend.extensions.has("WEBGL_multi_draw")?"uint( gl_DrawID )":"nodeUniformDrawId"}getFrontFacing(){return"gl_FrontFacing"}getFragCoord(){return"gl_FragCoord.xy"}getFragDepth(){return"gl_FragDepth"}enableExtension(e,t,n=this.shaderStage){let r=this.extensions[n]||(this.extensions[n]=new Map);r.has(e)===!1&&r.set(e,{name:e,behavior:t})}getExtensions(e){let t=[];if(e==="vertex"){let r=this.renderer.backend.extensions;this.object.isBatchedMesh&&r.has("WEBGL_multi_draw")&&this.enableExtension("GL_ANGLE_multi_draw","require",e)}let n=this.extensions[e];if(n!==void 0)for(let{name:r,behavior:s}of n.values())t.push(`#extension ${r} : ${s}`);return t.join(`4276-`)}getClipDistance(){return"gl_ClipDistance"}isAvailable(e){let t=Ate[e];if(t===void 0){let n;switch(t=!1,e){case"float32Filterable":n="OES_texture_float_linear";break;case"clipDistance":n="WEBGL_clip_cull_distance";break}if(n!==void 0){let r=this.renderer.backend.extensions;r.has(n)&&(r.get(n),t=!0)}Ate[e]=t}return t}isFlipY(){return!0}enableHardwareClipping(e){this.enableExtension("GL_ANGLE_clip_cull_distance","require"),this.builtins.vertex.push(`out float gl_ClipDistance[ ${e} ]`)}enableMultiview(){this.enableExtension("GL_OVR_multiview2","require","fragment"),this.enableExtension("GL_OVR_multiview2","require","vertex"),this.builtins.vertex.push("layout(num_views = 2) in")}registerTransform(e,t){this.transforms.push({varyingName:e,attributeNode:t})}getTransforms(){let e=this.transforms,t="";for(let n=0;n<e.length;n++){let r=e[n],s=this.getPropertyName(r.attributeNode);s&&(t+=`${r.varyingName} = ${s};4276+`)}getClipDistance(){return"gl_ClipDistance"}isAvailable(e){let t=Vte[e];if(t===void 0){let n;switch(t=!1,e){case"float32Filterable":n="OES_texture_float_linear";break;case"clipDistance":n="WEBGL_clip_cull_distance";break}if(n!==void 0){let r=this.renderer.backend.extensions;r.has(n)&&(r.get(n),t=!0)}Vte[e]=t}return t}isFlipY(){return!0}enableHardwareClipping(e){this.enableExtension("GL_ANGLE_clip_cull_distance","require"),this.builtins.vertex.push(`out float gl_ClipDistance[ ${e} ]`)}enableMultiview(){this.enableExtension("GL_OVR_multiview2","require","fragment"),this.enableExtension("GL_OVR_multiview2","require","vertex"),this.builtins.vertex.push("layout(num_views = 2) in")}registerTransform(e,t){this.transforms.push({varyingName:e,attributeNode:t})}getTransforms(){let e=this.transforms,t="";for(let n=0;n<e.length;n++){let r=e[n],s=this.getPropertyName(r.attributeNode);s&&(t+=`${r.varyingName} = ${s};42774277 `)}return t}_getGLSLUniformStruct(e,t){return`42784278 layout( std140 ) uniform ${e} {42794279 ${t}@@ -4285,7 +4285,7 @@ ${this.getSignature()}
42854285 ${e.extensions}42864286 42874287 // precision4288-${_te}4288+${Hte}42894289 42904290 // structs42914291 ${e.structs}@@ -4324,7 +4324,7 @@ ${this.getSignature()}
43244324 ${e.extensions}43254325 43264326 // precision4327-${_te}4327+${Hte}43284328 43294329 // structs43304330 ${e.structs}@@ -4355,7 +4355,7 @@ void main() {
43554355 `,a===s&&t!=="compute"&&(n+=`// result43564356 `,t==="vertex"?(n+="gl_Position = ",n+=`${this.format(l.result,s.getNodeType(this),"vec4")};`):t==="fragment"&&(a.outputNode.isOutputStructNode||(n+="fragColor = ",n+=`${this.format(l.result,s.getNodeType(this),this.getOutputType())};`)))}let o=e[t];if(o.extensions=this.getExtensions(t),o.uniforms=this.getUniforms(t),o.attributes=this.getAttributes(t),o.varyings=this.getVaryings(t),o.vars=this.getVars(t,!0),o.structs=this.getStructs(t),o.codes=this.getCodes(t),o.transforms=this.getTransforms(t),o.flow=n,t==="vertex"){let a=this.renderer.backend.extensions;this.object.isBatchedMesh&&a.has("WEBGL_multi_draw")===!1&&(o.uniforms+=`43574357 uniform uint nodeUniformDrawId;4358-`)}}this.material!==null?(this.vertexShader=this._getGLSLVertexCode(e.vertex),this.fragmentShader=this._getGLSLFragmentCode(e.fragment)):this.computeShader=this._getGLSLVertexCode(e.compute)}getUniformFromNode(e,t,n,r=null){let s=super.getUniformFromNode(e,t,n,r),o=this.getDataFromNode(e,n,this.globalCache),a=o.uniformGPU;if(a===void 0){let l=e.groupNode,c=l.name,u=this.getBindGroupArray(c,n);if(t==="texture")a=new fx(s.name,s.node,l),u.push(a);else if(t==="cubeTexture"||t==="cubeDepthTexture")a=new $4(s.name,s.node,l),u.push(a);else if(t==="texture3D")a=new wS(s.name,s.node,l),u.push(a);else if(t==="buffer"){s.name=`buffer${e.id}`;let f=this.getSharedDataFromNode(e),d=f.buffer;d===void 0&&(e.name=`NodeBuffer_${e.id}`,d=new W4(e,l),d.name=e.name,f.buffer=d),u.push(d),a=d}else{let f=this.uniformGroups[c];f===void 0?(f=new j4(c,l),this.uniformGroups[c]=f,u.push(f)):u.indexOf(f)===-1&&u.push(f),a=this.getNodeUniform(s,t);let d=a.name;f.uniforms.some(y=>y.name===d)||f.addUniform(a)}o.uniformGPU=a}return s}},WO=null,V_=null,Y4=class{constructor(e={}){this.parameters=Object.assign({},e),this.data=new WeakMap,this.renderer=null,this.domElement=null,this.timestampQueryPool={[Hc.RENDER]:null,[Hc.COMPUTE]:null},this.trackTimestamp=e.trackTimestamp===!0}async init(e){this.renderer=e}get coordinateSystem(){}beginRender(){}finishRender(){}setXRTarget(){}beginCompute(){}finishCompute(){}draw(){}compute(){}createProgram(){}destroyProgram(){}createBindings(){}updateBindings(){}updateBinding(){}createRenderPipeline(){}createComputePipeline(){}needsRenderUpdate(){}getRenderCacheKey(){}createNodeBuilder(){}updateSampler(){}destroySampler(){}createDefaultTexture(){}createTexture(){}updateTexture(){}generateMipmaps(){}destroyTexture(){}async copyTextureToBuffer(){}copyTextureToTexture(){}copyFramebufferToTexture(){}createAttribute(){}createIndexAttribute(){}createStorageAttribute(){}createUniformBuffer(){}destroyUniformBuffer(){}updateAttribute(){}destroyAttribute(){}getContext(){}updateSize(){}updateViewport(){}updateTimeStampUID(e){let t=this.get(e),n=this.renderer.info.frame,r;e.isComputeNode===!0?r="c:"+this.renderer.info.compute.frameCalls:r="r:"+this.renderer.info.render.frameCalls,t.timestampUID=r+":"+e.id+":f"+n}getTimestampUID(e){return this.get(e).timestampUID}getTimestampFrames(e){let t=this.timestampQueryPool[e];return t?t.getTimestampFrames():[]}_getQueryPool(e){let t=e.startsWith("c:")?Hc.COMPUTE:Hc.RENDER;return this.timestampQueryPool[t]}getTimestamp(e){return this._getQueryPool(e).getTimestamp(e)}get hasTimestamp(){return!1}hasTimestampQuery(e){return this._getQueryPool(e).hasTimestampQuery(e)}isOccluded(){}async resolveTimestampsAsync(e="render"){if(!this.trackTimestamp){ni("WebGPURenderer: Timestamp tracking is disabled.");return}let t=this.timestampQueryPool[e];if(!t)return;let n=await t.resolveQueriesAsync();return this.renderer.info[e].timestamp=n,n}async getArrayBufferAsync(){}async hasFeatureAsync(){}hasFeature(){}getDrawingBufferSize(){return WO=WO||new Oe,this.renderer.getDrawingBufferSize(WO)}setScissorTest(){}getClearColor(){let e=this.renderer;return V_=V_||new pS,e.getClearColor(V_),V_.getRGB(V_),V_}getDomElement(){let e=this.domElement;return e===null&&(e=this.parameters.canvas!==void 0?this.parameters.canvas:DM(),"setAttribute"in e&&e.setAttribute("data-engine",`three.js r${"185"} webgpu`),this.domElement=e),e}hasCompatibility(){return!1}initRenderTarget(){}set(e,t){this.data.set(e,t)}get(e){let t=this.data.get(e);return t===void 0&&(t={},this.data.set(e,t)),t}has(e){return this.data.has(e)}delete(e){this.data.delete(e)}deleteBindGroupData(){}dispose(){}},YIe=0,n9=class{constructor(e,t){this.buffers=[e.bufferGPU,t],this.type=e.type,this.bufferType=e.bufferType,this.pbo=e.pbo,this.byteLength=e.byteLength,this.bytesPerElement=e.BYTES_PER_ELEMENT,this.version=e.version,this.isInteger=e.isInteger,this.activeBufferIndex=0,this.baseId=e.id}get id(){return`${this.baseId}|${this.activeBufferIndex}`}get bufferGPU(){return this.buffers[this.activeBufferIndex]}get transformBuffer(){return this.buffers[this.activeBufferIndex^1]}switchBuffers(){this.activeBufferIndex^=1}},i9=class{constructor(e){this.backend=e}createAttribute(e,t){let n=this.backend,{gl:r}=n,s=e.array,o=e.usage||r.STATIC_DRAW,a=e.isInterleavedBufferAttribute?e.data:e,l=n.get(a),c=l.bufferGPU;c===void 0&&(c=this._createBuffer(r,t,s,o),l.bufferGPU=c,l.bufferType=t,l.version=a.version);let u;if(s instanceof Float32Array)u=r.FLOAT;else if(typeof Float16Array<"u"&&s instanceof Float16Array)u=r.HALF_FLOAT;else if(s instanceof Uint16Array)e.isFloat16BufferAttribute?u=r.HALF_FLOAT:u=r.UNSIGNED_SHORT;else if(s instanceof Int16Array)u=r.SHORT;else if(s instanceof Uint32Array)u=r.UNSIGNED_INT;else if(s instanceof Int32Array)u=r.INT;else if(s instanceof Int8Array)u=r.BYTE;else if(s instanceof Uint8Array)u=r.UNSIGNED_BYTE;else if(s instanceof Uint8ClampedArray)u=r.UNSIGNED_BYTE;else throw new Error("THREE.WebGLBackend: Unsupported buffer data format: "+s);let f={bufferGPU:c,bufferType:t,type:u,byteLength:s.byteLength,bytesPerElement:s.BYTES_PER_ELEMENT,version:e.version,pbo:e.pbo,isInteger:u===r.INT||u===r.UNSIGNED_INT||e.gpuType===Zr,id:YIe++};if(e.isStorageBufferAttribute||e.isStorageInstancedBufferAttribute){let d=this._createBuffer(r,t,s,o);f=new n9(f,d)}n.set(e,f)}updateAttribute(e){let t=this.backend,{gl:n}=t,r=e.array,s=e.isInterleavedBufferAttribute?e.data:e,o=t.get(s),a=o.bufferType,l=e.isInterleavedBufferAttribute?e.data.updateRanges:e.updateRanges;if(n.bindBuffer(a,o.bufferGPU),l.length===0)n.bufferSubData(a,0,r);else{for(let c=0,u=l.length;c<u;c++){let f=l[c];n.bufferSubData(a,f.start*r.BYTES_PER_ELEMENT,r,f.start,f.count)}s.clearUpdateRanges()}n.bindBuffer(a,null),o.version=s.version}destroyAttribute(e){let t=this.backend,{gl:n}=t;e.isInterleavedBufferAttribute&&t.delete(e.data);let r=t.get(e);n.deleteBuffer(r.bufferGPU),t.delete(e)}async getArrayBufferAsync(e,t=null,n=0,r=-1){let s=this.backend,{gl:o}=s,a=e.isInterleavedBufferAttribute?e.data:e,l=s.get(a),{bufferGPU:c}=l,u=r===-1?l.byteLength-n:r,f;if(t===null)f=new Uint8Array(new ArrayBuffer(u));else if(t.isReadbackBuffer){if(t._mapped===!0)throw new Error("THREE.WebGPURenderer: ReadbackBuffer must be released before being used again.");let d=()=>{t.buffer=null,t._mapped=!1,t.removeEventListener("release",d),t.removeEventListener("dispose",d)};t.addEventListener("release",d),t.addEventListener("dispose",d),f=new Uint8Array(new ArrayBuffer(u)),t.buffer=f.buffer}else f=new Uint8Array(t);return o.bindBuffer(o.COPY_READ_BUFFER,c),o.getBufferSubData(o.COPY_READ_BUFFER,n,f),o.bindBuffer(o.COPY_READ_BUFFER,null),o.bindBuffer(o.COPY_WRITE_BUFFER,null),t&&t.isReadbackBuffer?t:f.buffer}_createBuffer(e,t,n,r){let s=e.createBuffer();return e.bindBuffer(t,s),e.bufferData(t,n,r),e.bindBuffer(t,null),s}},Vw,Vd,r9=class{constructor(e){this.backend=e,this.gl=this.backend.gl,this.enabled={},this.parameters={},this.currentFlipSided=null,this.currentCullFace=null,this.currentProgram=null,this.currentBlendingEnabled=!1,this.currentBlending=null,this.currentBlendSrc=null,this.currentBlendDst=null,this.currentBlendSrcAlpha=null,this.currentBlendDstAlpha=null,this.currentPremultipledAlpha=null,this.currentPolygonOffsetFactor=null,this.currentPolygonOffsetUnits=null,this.currentColorMask=null,this.currentDepthReversed=!1,this.currentDepthFunc=null,this.currentDepthMask=null,this.currentStencilFunc=null,this.currentStencilRef=null,this.currentStencilFuncMask=null,this.currentStencilFail=null,this.currentStencilZFail=null,this.currentStencilZPass=null,this.currentStencilMask=null,this.currentLineWidth=null,this.currentClippingPlanes=0,this.currentVAO=null,this.currentIndex=null,this.currentBoundFramebuffers={},this.currentDrawbuffers=new WeakMap,this.maxTextures=this.gl.getParameter(this.gl.MAX_TEXTURE_IMAGE_UNITS),this.currentTextureSlot=null,this.currentBoundTextures={},this.currentBoundBufferBases={},this._init()}_init(){let e=this.gl;Vw={[oo]:e.FUNC_ADD,[ab]:e.FUNC_SUBTRACT,[lb]:e.FUNC_REVERSE_SUBTRACT},Vd={[Nu]:e.ZERO,[cb]:e.ONE,[ub]:e.SRC_COLOR,[Yp]:e.SRC_ALPHA,[Ab]:e.SRC_ALPHA_SATURATE,[pb]:e.DST_COLOR,[fb]:e.DST_ALPHA,[hb]:e.ONE_MINUS_SRC_COLOR,[Zp]:e.ONE_MINUS_SRC_ALPHA,[mb]:e.ONE_MINUS_DST_COLOR,[db]:e.ONE_MINUS_DST_ALPHA};let t=e.getParameter(e.SCISSOR_BOX),n=e.getParameter(e.VIEWPORT);this.currentScissor=new xn().fromArray(t),this.currentViewport=new xn().fromArray(n),this._tempVec4=new xn}enable(e){let{enabled:t}=this;t[e]!==!0&&(this.gl.enable(e),t[e]=!0)}disable(e){let{enabled:t}=this;t[e]!==!1&&(this.gl.disable(e),t[e]=!1)}setFlipSided(e){if(this.currentFlipSided!==e){let{gl:t}=this;e?t.frontFace(t.CW):t.frontFace(t.CCW),this.currentFlipSided=e}}setCullFace(e){let{gl:t}=this;e!==wM?(this.enable(t.CULL_FACE),e!==this.currentCullFace&&(e===sb?t.cullFace(t.BACK):e===SM?t.cullFace(t.FRONT):t.cullFace(t.FRONT_AND_BACK))):this.disable(t.CULL_FACE),this.currentCullFace=e}setLineWidth(e){let{currentLineWidth:t,gl:n}=this;e!==t&&(n.lineWidth(e),this.currentLineWidth=e)}setMRTBlending(e,t,n){let r=this.gl,s=this.backend.drawBuffersIndexedExt;if(!s){ni("WebGPURenderer: Multiple Render Targets (MRT) blending configuration is not fully supported in compatibility mode. The material blending will be used for all render targets.");return}for(let o=0;o<e.length;o++){let a=e[o],l=null;if(t!==null){let c=t.getBlendMode(a.name);c.blending===ob?l=n:c.blending!==ps&&(l=c)}else l=n;l!==null?this._setMRTBlendingIndex(o,l):s.blendFuncSeparateiOES(o,r.ONE,r.ZERO,r.ONE,r.ZERO)}}_setMRTBlendingIndex(e,t){let{gl:n}=this,r=this.backend.drawBuffersIndexedExt,s=t.blending,o=t.blendSrc,a=t.blendDst,l=t.blendEquation,c=t.premultipliedAlpha;if(s===Id){let u=t.blendSrcAlpha!==null?t.blendSrcAlpha:o,f=t.blendDstAlpha!==null?t.blendDstAlpha:a,d=t.blendEquationAlpha!==null?t.blendEquationAlpha:l;r.blendEquationSeparateiOES(e,Vw[l],Vw[d]),r.blendFuncSeparateiOES(e,Vd[o],Vd[a],Vd[u],Vd[f])}else if(r.blendEquationSeparateiOES(e,n.FUNC_ADD,n.FUNC_ADD),c)switch(s){case Ms:r.blendFuncSeparateiOES(e,n.ONE,n.ONE_MINUS_SRC_ALPHA,n.ONE,n.ONE_MINUS_SRC_ALPHA);break;case Dh:r.blendFuncSeparateiOES(e,n.ONE,n.ONE,n.ONE,n.ONE);break;case Nh:r.blendFuncSeparateiOES(e,n.ZERO,n.ONE_MINUS_SRC_COLOR,n.ZERO,n.ONE);break;case Fh:r.blendFuncSeparateiOES(e,n.DST_COLOR,n.ONE_MINUS_SRC_ALPHA,n.ZERO,n.ONE);break;default:r.blendFuncSeparateiOES(e,n.ONE,n.ONE_MINUS_SRC_ALPHA,n.ONE,n.ONE_MINUS_SRC_ALPHA);break}else switch(s){case Ms:r.blendFuncSeparateiOES(e,n.SRC_ALPHA,n.ONE_MINUS_SRC_ALPHA,n.ONE,n.ONE_MINUS_SRC_ALPHA);break;case Dh:r.blendFuncSeparateiOES(e,n.SRC_ALPHA,n.ONE,n.ONE,n.ONE);break;case Nh:r.blendFuncSeparateiOES(e,n.ZERO,n.ONE_MINUS_SRC_COLOR,n.ZERO,n.ONE);break;case Fh:r.blendFuncSeparateiOES(e,n.DST_COLOR,n.ONE_MINUS_SRC_ALPHA,n.ZERO,n.ONE);break;default:r.blendFuncSeparateiOES(e,n.SRC_ALPHA,n.ONE_MINUS_SRC_ALPHA,n.ONE,n.ONE_MINUS_SRC_ALPHA);break}}setBlending(e,t,n,r,s,o,a,l){let{gl:c}=this;if(e===ps){this.currentBlendingEnabled===!0&&(this.disable(c.BLEND),this.currentBlendingEnabled=!1);return}if(this.currentBlendingEnabled===!1&&(this.enable(c.BLEND),this.currentBlendingEnabled=!0),e!==Id){if(e!==this.currentBlending||l!==this.currentPremultipledAlpha){if((this.currentBlendEquation!==oo||this.currentBlendEquationAlpha!==oo)&&(c.blendEquation(c.FUNC_ADD),this.currentBlendEquation=oo,this.currentBlendEquationAlpha=oo),l)switch(e){case Ms:c.blendFuncSeparate(c.ONE,c.ONE_MINUS_SRC_ALPHA,c.ONE,c.ONE_MINUS_SRC_ALPHA);break;case Dh:c.blendFunc(c.ONE,c.ONE);break;case Nh:c.blendFuncSeparate(c.ZERO,c.ONE_MINUS_SRC_COLOR,c.ZERO,c.ONE);break;case Fh:c.blendFuncSeparate(c.DST_COLOR,c.ONE_MINUS_SRC_ALPHA,c.ZERO,c.ONE);break;default:ze("WebGLState: Invalid blending: ",e);break}else switch(e){case Ms:c.blendFuncSeparate(c.SRC_ALPHA,c.ONE_MINUS_SRC_ALPHA,c.ONE,c.ONE_MINUS_SRC_ALPHA);break;case Dh:c.blendFuncSeparate(c.SRC_ALPHA,c.ONE,c.ONE,c.ONE);break;case Nh:ze("WebGLState: SubtractiveBlending requires material.premultipliedAlpha = true");break;case Fh:ze("WebGLState: MultiplyBlending requires material.premultipliedAlpha = true");break;default:ze("WebGLState: Invalid blending: ",e);break}this.currentBlendSrc=null,this.currentBlendDst=null,this.currentBlendSrcAlpha=null,this.currentBlendDstAlpha=null,this.currentBlending=e,this.currentPremultipledAlpha=l}return}s=s||t,o=o||n,a=a||r,(t!==this.currentBlendEquation||s!==this.currentBlendEquationAlpha)&&(c.blendEquationSeparate(Vw[t],Vw[s]),this.currentBlendEquation=t,this.currentBlendEquationAlpha=s),(n!==this.currentBlendSrc||r!==this.currentBlendDst||o!==this.currentBlendSrcAlpha||a!==this.currentBlendDstAlpha)&&(c.blendFuncSeparate(Vd[n],Vd[r],Vd[o],Vd[a]),this.currentBlendSrc=n,this.currentBlendDst=r,this.currentBlendSrcAlpha=o,this.currentBlendDstAlpha=a),this.currentBlending=e,this.currentPremultipledAlpha=!1}setColorMask(e){this.currentColorMask!==e&&(this.gl.colorMask(e,e,e,e),this.currentColorMask=e)}setDepthTest(e){let{gl:t}=this;e?this.enable(t.DEPTH_TEST):this.disable(t.DEPTH_TEST)}setReversedDepth(e){if(this.currentDepthReversed!==e){let t=this.backend.extensions.get("EXT_clip_control");e?t.clipControlEXT(t.LOWER_LEFT_EXT,t.ZERO_TO_ONE_EXT):t.clipControlEXT(t.LOWER_LEFT_EXT,t.NEGATIVE_ONE_TO_ONE_EXT),this.currentDepthReversed=e}}setDepthMask(e){this.currentDepthMask!==e&&(this.gl.depthMask(e),this.currentDepthMask=e)}setDepthFunc(e){if(this.currentDepthReversed&&(e=Pb[e]),this.currentDepthFunc!==e){let{gl:t}=this;switch(e){case MA:t.depthFunc(t.NEVER);break;case CA:t.depthFunc(t.ALWAYS);break;case RA:t.depthFunc(t.LESS);break;case Ch:t.depthFunc(t.LEQUAL);break;case IA:t.depthFunc(t.EQUAL);break;case PA:t.depthFunc(t.GEQUAL);break;case LA:t.depthFunc(t.GREATER);break;case DA:t.depthFunc(t.NOTEQUAL);break;default:t.depthFunc(t.LEQUAL)}this.currentDepthFunc=e}}scissor(e,t,n,r){let s=this._tempVec4.set(e,t,n,r);if(this.currentScissor.equals(s)===!1){let{gl:o}=this;o.scissor(s.x,s.y,s.z,s.w),this.currentScissor.copy(s)}}viewport(e,t,n,r){let s=this._tempVec4.set(e,t,n,r);if(this.currentViewport.equals(s)===!1){let{gl:o}=this;o.viewport(s.x,s.y,s.z,s.w),this.currentViewport.copy(s)}}setScissorTest(e){let t=this.gl;e?this.enable(t.SCISSOR_TEST):this.disable(t.SCISSOR_TEST)}setStencilTest(e){let{gl:t}=this;e?this.enable(t.STENCIL_TEST):this.disable(t.STENCIL_TEST)}setStencilMask(e){this.currentStencilMask!==e&&(this.gl.stencilMask(e),this.currentStencilMask=e)}setStencilFunc(e,t,n){(this.currentStencilFunc!==e||this.currentStencilRef!==t||this.currentStencilFuncMask!==n)&&(this.gl.stencilFunc(e,t,n),this.currentStencilFunc=e,this.currentStencilRef=t,this.currentStencilFuncMask=n)}setStencilOp(e,t,n){(this.currentStencilFail!==e||this.currentStencilZFail!==t||this.currentStencilZPass!==n)&&(this.gl.stencilOp(e,t,n),this.currentStencilFail=e,this.currentStencilZFail=t,this.currentStencilZPass=n)}setMaterial(e,t,n){let{gl:r}=this;e.side===gr?this.disable(r.CULL_FACE):this.enable(r.CULL_FACE);let s=e.side===mi;t&&(s=!s),this.setFlipSided(s),e.blending===Ms&&e.transparent===!1?this.setBlending(ps):this.setBlending(e.blending,e.blendEquation,e.blendSrc,e.blendDst,e.blendEquationAlpha,e.blendSrcAlpha,e.blendDstAlpha,e.premultipliedAlpha),this.setDepthFunc(e.depthFunc),this.setDepthTest(e.depthTest),this.setDepthMask(e.depthWrite),this.setColorMask(e.colorWrite);let o=e.stencilWrite;if(this.setStencilTest(o),o&&(this.setStencilMask(e.stencilWriteMask),this.setStencilFunc(e.stencilFunc,e.stencilRef,e.stencilFuncMask),this.setStencilOp(e.stencilFail,e.stencilZFail,e.stencilZPass)),this.setPolygonOffset(e.polygonOffset,e.polygonOffsetFactor,e.polygonOffsetUnits),e.alphaToCoverage===!0&&this.backend.renderer.currentSamples>0?this.enable(r.SAMPLE_ALPHA_TO_COVERAGE):this.disable(r.SAMPLE_ALPHA_TO_COVERAGE),n>0&&this.currentClippingPlanes!==n)for(let l=0;l<8;l++)l<n?this.enable(12288+l):this.disable(12288+l)}setPolygonOffset(e,t,n){let{gl:r}=this;e?(this.enable(r.POLYGON_OFFSET_FILL),(this.currentPolygonOffsetFactor!==t||this.currentPolygonOffsetUnits!==n)&&(r.polygonOffset(t,n),this.currentPolygonOffsetFactor=t,this.currentPolygonOffsetUnits=n)):this.disable(r.POLYGON_OFFSET_FILL)}useProgram(e){return this.currentProgram!==e?(this.gl.useProgram(e),this.currentProgram=e,!0):!1}setVertexState(e,t=null){let n=this.gl;return this.currentVAO!==e||this.currentIndex!==t?(n.bindVertexArray(e),t!==null&&n.bindBuffer(n.ELEMENT_ARRAY_BUFFER,t),this.currentVAO=e,this.currentIndex=t,!0):!1}resetVertexState(){let e=this.gl;e.bindVertexArray(null),e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,null),this.currentVAO=null,this.currentIndex=null}bindFramebuffer(e,t){let{gl:n,currentBoundFramebuffers:r}=this;return r[e]!==t?(n.bindFramebuffer(e,t),r[e]=t,e===n.DRAW_FRAMEBUFFER&&(r[n.FRAMEBUFFER]=t),e===n.FRAMEBUFFER&&(r[n.DRAW_FRAMEBUFFER]=t),!0):!1}drawBuffers(e,t){let{gl:n}=this,r=[],s=!1;if(e.textures!==null){r=this.currentDrawbuffers.get(t),r===void 0&&(r=[],this.currentDrawbuffers.set(t,r));let o=e.textures;if(r.length!==o.length||r[0]!==n.COLOR_ATTACHMENT0){for(let a=0,l=o.length;a<l;a++)r[a]=n.COLOR_ATTACHMENT0+a;r.length=o.length,s=!0}}else r[0]!==n.BACK&&(r[0]=n.BACK,s=!0);s&&n.drawBuffers(r)}activeTexture(e){let{gl:t,currentTextureSlot:n,maxTextures:r}=this;e===void 0&&(e=t.TEXTURE0+r-1),n!==e&&(t.activeTexture(e),this.currentTextureSlot=e)}bindTexture(e,t,n){let{gl:r,currentTextureSlot:s,currentBoundTextures:o,maxTextures:a}=this;n===void 0&&(s===null?n=r.TEXTURE0+a-1:n=s);let l=o[n];l===void 0&&(l={type:void 0,texture:void 0},o[n]=l),(l.type!==e||l.texture!==t)&&(s!==n&&(r.activeTexture(n),this.currentTextureSlot=n),r.bindTexture(e,t),l.type=e,l.texture=t)}bindBufferBase(e,t,n){let{gl:r}=this,s=`${e}-${t}`;return this.currentBoundBufferBases[s]!==n?(r.bindBufferBase(e,t,n),this.currentBoundBufferBases[s]=n,!0):!1}unbindTexture(){let{gl:e,currentTextureSlot:t,currentBoundTextures:n}=this,r=n[t];r!==void 0&&r.type!==void 0&&(e.bindTexture(r.type,null),r.type=void 0,r.texture=void 0)}getParameter(e){let{gl:t,parameters:n}=this;return n[e]!==void 0?n[e]:t.getParameter(e)}pixelStorei(e,t){let{gl:n,parameters:r}=this;r[e]!==t&&(n.pixelStorei(e,t),r[e]=t)}},s9=class{constructor(e){this.backend=e,this.gl=this.backend.gl,this.extensions=e.extensions}convert(e,t=ua){let{gl:n,extensions:r}=this,s,o=ln.getTransfer(t);if(e===Ji)return n.UNSIGNED_BYTE;if(e===KA)return n.UNSIGNED_SHORT_4_4_4_4;if(e===QA)return n.UNSIGNED_SHORT_5_5_5_1;if(e===JA)return n.UNSIGNED_INT_5_9_9_9_REV;if(e===eg)return n.UNSIGNED_INT_10F_11F_11F_REV;if(e===Oh)return n.BYTE;if(e===Uh)return n.SHORT;if(e===bl)return n.UNSIGNED_SHORT;if(e===Zr)return n.INT;if(e===xi)return n.UNSIGNED_INT;if(e===cr)return n.FLOAT;if(e===Wi)return n.HALF_FLOAT;if(e===r_)return n.ALPHA;if(e===Pd)return n.RGB;if(e===Or)return n.RGBA;if(e===Gs)return n.DEPTH_COMPONENT;if(e===xo)return n.DEPTH_STENCIL;if(e===Ld)return n.RED;if(e===kh)return n.RED_INTEGER;if(e===js)return n.RG;if(e===zh)return n.RG_INTEGER;if(e===d0)return n.RGBA_INTEGER;if(e===Vh||e===Gh||e===qh||e===Hh)if(o===kt)if(s=r.get("WEBGL_compressed_texture_s3tc_srgb"),s!==null){if(e===Vh)return s.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(e===Gh)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(e===qh)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(e===Hh)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(s=r.get("WEBGL_compressed_texture_s3tc"),s!==null){if(e===Vh)return s.COMPRESSED_RGB_S3TC_DXT1_EXT;if(e===Gh)return s.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(e===qh)return s.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(e===Hh)return s.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(e===tg||e===ng||e===ig||e===rg)if(s=r.get("WEBGL_compressed_texture_pvrtc"),s!==null){if(e===tg)return s.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(e===ng)return s.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(e===ig)return s.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(e===rg)return s.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(e===p0||e===m0||e===A0||e===g0||e===v0||e===Wh||e===_0)if(s=r.get("WEBGL_compressed_texture_etc"),s!==null){if(e===p0||e===m0)return o===kt?s.COMPRESSED_SRGB8_ETC2:s.COMPRESSED_RGB8_ETC2;if(e===A0)return o===kt?s.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:s.COMPRESSED_RGBA8_ETC2_EAC;if(e===g0)return s.COMPRESSED_R11_EAC;if(e===v0)return s.COMPRESSED_SIGNED_R11_EAC;if(e===Wh)return s.COMPRESSED_RG11_EAC;if(e===_0)return s.COMPRESSED_SIGNED_RG11_EAC}else return null;if(e===x0||e===y0||e===b0||e===w0||e===S0||e===T0||e===E0||e===M0||e===C0||e===R0||e===I0||e===P0||e===L0||e===D0)if(s=r.get("WEBGL_compressed_texture_astc"),s!==null){if(e===x0)return o===kt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:s.COMPRESSED_RGBA_ASTC_4x4_KHR;if(e===y0)return o===kt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:s.COMPRESSED_RGBA_ASTC_5x4_KHR;if(e===b0)return o===kt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:s.COMPRESSED_RGBA_ASTC_5x5_KHR;if(e===w0)return o===kt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:s.COMPRESSED_RGBA_ASTC_6x5_KHR;if(e===S0)return o===kt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:s.COMPRESSED_RGBA_ASTC_6x6_KHR;if(e===T0)return o===kt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:s.COMPRESSED_RGBA_ASTC_8x5_KHR;if(e===E0)return o===kt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:s.COMPRESSED_RGBA_ASTC_8x6_KHR;if(e===M0)return o===kt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:s.COMPRESSED_RGBA_ASTC_8x8_KHR;if(e===C0)return o===kt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:s.COMPRESSED_RGBA_ASTC_10x5_KHR;if(e===R0)return o===kt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:s.COMPRESSED_RGBA_ASTC_10x6_KHR;if(e===I0)return o===kt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:s.COMPRESSED_RGBA_ASTC_10x8_KHR;if(e===P0)return o===kt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:s.COMPRESSED_RGBA_ASTC_10x10_KHR;if(e===L0)return o===kt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:s.COMPRESSED_RGBA_ASTC_12x10_KHR;if(e===D0)return o===kt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:s.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(e===N0||e===F0||e===B0)if(s=r.get("EXT_texture_compression_bptc"),s!==null){if(e===N0)return o===kt?s.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:s.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(e===F0)return s.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(e===B0)return s.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}else return null;if(e===O0||e===U0||e===jh||e===k0)if(s=r.get("EXT_texture_compression_rgtc"),s!==null){if(e===O0)return s.COMPRESSED_RED_RGTC1_EXT;if(e===U0)return s.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(e===jh)return s.COMPRESSED_RED_GREEN_RGTC2_EXT;if(e===k0)return s.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return e===ca?n.UNSIGNED_INT_24_8:n[e]!==void 0?n[e]:null}_clientWaitAsync(){let{gl:e}=this,t=e.fenceSync(e.SYNC_GPU_COMMANDS_COMPLETE,0);return e.flush(),new Promise((n,r)=>{function s(){let o=e.clientWaitSync(t,e.SYNC_FLUSH_COMMANDS_BIT,0);if(o===e.WAIT_FAILED){e.deleteSync(t),r();return}if(o===e.TIMEOUT_EXPIRED){requestAnimationFrame(s);return}e.deleteSync(t),n()}s()})}},xte=!1,IR,jO,yte,o9=class{constructor(e){this.backend=e,this.gl=e.gl,this.extensions=e.extensions,this.defaultTextures={},this._srcFramebuffer=null,this._dstFramebuffer=null,xte===!1&&(this._init(),xte=!0)}_init(){let e=this.gl;IR={[wd]:e.REPEAT,[aa]:e.CLAMP_TO_EDGE,[Sd]:e.MIRRORED_REPEAT},jO={[Ti]:e.NEAREST,[Sb]:e.NEAREST_MIPMAP_NEAREST,[qc]:e.NEAREST_MIPMAP_LINEAR,[Mi]:e.LINEAR,[f0]:e.LINEAR_MIPMAP_NEAREST,[Vo]:e.LINEAR_MIPMAP_LINEAR},yte={[Mb]:e.NEVER,[Ib]:e.ALWAYS,[s_]:e.LESS,[Xh]:e.LEQUAL,[Cb]:e.EQUAL,[Fu]:e.GEQUAL,[sg]:e.GREATER,[Rb]:e.NOTEQUAL}}getGLTextureType(e){let{gl:t}=this,n;return e.isCubeTexture===!0?n=t.TEXTURE_CUBE_MAP:e.isArrayTexture===!0||e.isDataArrayTexture===!0||e.isCompressedArrayTexture===!0?n=t.TEXTURE_2D_ARRAY:e.isData3DTexture===!0?n=t.TEXTURE_3D:n=t.TEXTURE_2D,n}getInternalFormat(e,t,n,r,s,o=!1){let{gl:a,extensions:l}=this;if(e!==null){if(a[e]!==void 0)return a[e];Xe("WebGLBackend: Attempt to use non-existing WebGL internal format '"+e+"'")}let c=null;r&&(c=l.get("EXT_texture_norm16"),c||Xe("WebGLRenderer: Unable to use normalized textures without EXT_texture_norm16 extension"));let u=t;if(t===a.RED&&(n===a.FLOAT&&(u=a.R32F),n===a.HALF_FLOAT&&(u=a.R16F),n===a.UNSIGNED_BYTE&&(u=a.R8),n===a.BYTE&&(u=a.R8_SNORM),n===a.UNSIGNED_SHORT&&c&&(u=c.R16_EXT),n===a.SHORT&&c&&(u=c.R16_SNORM_EXT)),t===a.RED_INTEGER&&(n===a.UNSIGNED_BYTE&&(u=a.R8UI),n===a.UNSIGNED_SHORT&&(u=a.R16UI),n===a.UNSIGNED_INT&&(u=a.R32UI),n===a.BYTE&&(u=a.R8I),n===a.SHORT&&(u=a.R16I),n===a.INT&&(u=a.R32I)),t===a.RG&&(n===a.FLOAT&&(u=a.RG32F),n===a.HALF_FLOAT&&(u=a.RG16F),n===a.UNSIGNED_BYTE&&(u=a.RG8),n===a.BYTE&&(u=a.RG8_SNORM),n===a.UNSIGNED_SHORT&&c&&(u=c.RG16_EXT),n===a.SHORT&&c&&(u=c.RG16_SNORM_EXT)),t===a.RG_INTEGER&&(n===a.UNSIGNED_BYTE&&(u=a.RG8UI),n===a.UNSIGNED_SHORT&&(u=a.RG16UI),n===a.UNSIGNED_INT&&(u=a.RG32UI),n===a.BYTE&&(u=a.RG8I),n===a.SHORT&&(u=a.RG16I),n===a.INT&&(u=a.RG32I)),t===a.RGB){let f=o?Qp:ln.getTransfer(s);n===a.FLOAT&&(u=a.RGB32F),n===a.HALF_FLOAT&&(u=a.RGB16F),n===a.UNSIGNED_BYTE&&(u=f===kt?a.SRGB8:a.RGB8),n===a.BYTE&&(u=a.RGB8_SNORM),n===a.UNSIGNED_SHORT&&c&&(u=c.RGB16_EXT),n===a.SHORT&&c&&(u=c.RGB16_SNORM_EXT),n===a.UNSIGNED_SHORT_5_6_5&&(u=a.RGB565),n===a.UNSIGNED_SHORT_5_5_5_1&&(u=a.RGB5_A1),n===a.UNSIGNED_SHORT_4_4_4_4&&(u=a.RGB4),n===a.UNSIGNED_INT_5_9_9_9_REV&&(u=a.RGB9_E5),n===a.UNSIGNED_INT_10F_11F_11F_REV&&(u=a.R11F_G11F_B10F)}if(t===a.RGB_INTEGER&&(n===a.UNSIGNED_BYTE&&(u=a.RGB8UI),n===a.UNSIGNED_SHORT&&(u=a.RGB16UI),n===a.UNSIGNED_INT&&(u=a.RGB32UI),n===a.BYTE&&(u=a.RGB8I),n===a.SHORT&&(u=a.RGB16I),n===a.INT&&(u=a.RGB32I)),t===a.RGBA){let f=o?Qp:ln.getTransfer(s);n===a.FLOAT&&(u=a.RGBA32F),n===a.HALF_FLOAT&&(u=a.RGBA16F),n===a.UNSIGNED_BYTE&&(u=f===kt?a.SRGB8_ALPHA8:a.RGBA8),n===a.BYTE&&(u=a.RGBA8_SNORM),n===a.UNSIGNED_SHORT&&c&&(u=c.RGBA16_EXT),n===a.SHORT&&c&&(u=c.RGBA16_SNORM_EXT),n===a.UNSIGNED_SHORT_4_4_4_4&&(u=a.RGBA4),n===a.UNSIGNED_SHORT_5_5_5_1&&(u=a.RGB5_A1)}return t===a.RGBA_INTEGER&&(n===a.UNSIGNED_BYTE&&(u=a.RGBA8UI),n===a.UNSIGNED_SHORT&&(u=a.RGBA16UI),n===a.UNSIGNED_INT&&(u=a.RGBA32UI),n===a.BYTE&&(u=a.RGBA8I),n===a.SHORT&&(u=a.RGBA16I),n===a.INT&&(u=a.RGBA32I)),t===a.DEPTH_COMPONENT&&(n===a.UNSIGNED_SHORT&&(u=a.DEPTH_COMPONENT16),n===a.UNSIGNED_INT&&(u=a.DEPTH_COMPONENT24),n===a.FLOAT&&(u=a.DEPTH_COMPONENT32F)),t===a.DEPTH_STENCIL&&n===a.UNSIGNED_INT_24_8&&(u=a.DEPTH24_STENCIL8),(u===a.R16F||u===a.R32F||u===a.RG16F||u===a.RG32F||u===a.RGBA16F||u===a.RGBA32F)&&l.get("EXT_color_buffer_float"),u}setTextureParameters(e,t){let{gl:n,extensions:r,backend:s}=this,{state:o}=this.backend,a=ln.getPrimaries(ln.workingColorSpace),l=t.colorSpace===ua?null:ln.getPrimaries(t.colorSpace),c=t.colorSpace===ua||a===l?n.NONE:n.BROWSER_DEFAULT_WEBGL;o.pixelStorei(n.UNPACK_FLIP_Y_WEBGL,t.flipY),o.pixelStorei(n.UNPACK_PREMULTIPLY_ALPHA_WEBGL,t.premultiplyAlpha),o.pixelStorei(n.UNPACK_ALIGNMENT,t.unpackAlignment),o.pixelStorei(n.UNPACK_COLORSPACE_CONVERSION_WEBGL,c),n.texParameteri(e,n.TEXTURE_WRAP_S,IR[t.wrapS]),n.texParameteri(e,n.TEXTURE_WRAP_T,IR[t.wrapT]),(e===n.TEXTURE_3D||e===n.TEXTURE_2D_ARRAY)&&(t.isArrayTexture||n.texParameteri(e,n.TEXTURE_WRAP_R,IR[t.wrapR])),n.texParameteri(e,n.TEXTURE_MAG_FILTER,jO[t.magFilter]);let u=t.mipmaps!==void 0&&t.mipmaps.length>0,f=t.minFilter===Mi&&u?Vo:t.minFilter;if(n.texParameteri(e,n.TEXTURE_MIN_FILTER,jO[f]),t.compareFunction&&(n.texParameteri(e,n.TEXTURE_COMPARE_MODE,n.COMPARE_REF_TO_TEXTURE),n.texParameteri(e,n.TEXTURE_COMPARE_FUNC,yte[t.compareFunction])),r.has("EXT_texture_filter_anisotropic")===!0){if(t.magFilter===Ti||t.minFilter!==qc&&t.minFilter!==Vo||t.type===cr&&r.has("OES_texture_float_linear")===!1)return;if(t.anisotropy>1){let d=r.get("EXT_texture_filter_anisotropic");n.texParameterf(e,d.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(t.anisotropy,s.capabilities.getMaxAnisotropy()))}}}createDefaultTexture(e){let{gl:t,backend:n,defaultTextures:r}=this,s=this.getGLTextureType(e),o=r[s];o===void 0&&(o=t.createTexture(),n.state.bindTexture(s,o),t.texParameteri(s,t.TEXTURE_MIN_FILTER,t.NEAREST),t.texParameteri(s,t.TEXTURE_MAG_FILTER,t.NEAREST),r[s]=o),n.set(e,{textureGPU:o,glTextureType:s})}createTexture(e,t){let{gl:n,backend:r}=this,s,o,a,l,c;if(e.isExternalTexture===!0)s=e.sourceTexture,o=this.getGLTextureType(e);else{let{levels:u,width:f,height:d,depth:A}=t;a=r.utils.convert(e.format,e.colorSpace),l=r.utils.convert(e.type),c=this.getInternalFormat(e.internalFormat,a,l,e.normalized,e.colorSpace,e.isVideoTexture),s=n.createTexture(),o=this.getGLTextureType(e),r.state.bindTexture(o,s),this.setTextureParameters(o,e),e.isArrayTexture||e.isDataArrayTexture||e.isCompressedArrayTexture?n.texStorage3D(n.TEXTURE_2D_ARRAY,u,c,f,d,A):e.isData3DTexture?n.texStorage3D(n.TEXTURE_3D,u,c,f,d,A):e.isVideoTexture||n.texStorage2D(o,u,c,f,d)}r.set(e,{textureGPU:s,glTextureType:o,glFormat:a,glType:l,glInternalFormat:c})}copyBufferToTexture(e,t){let{gl:n,backend:r}=this,{state:s}=r,{textureGPU:o,glTextureType:a,glFormat:l,glType:c}=r.get(t),{width:u,height:f}=t.source.data;n.bindBuffer(n.PIXEL_UNPACK_BUFFER,e),r.state.bindTexture(a,o),s.pixelStorei(n.UNPACK_FLIP_Y_WEBGL,!1),s.pixelStorei(n.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1),n.texSubImage2D(a,0,0,0,u,f,l,c,0),n.bindBuffer(n.PIXEL_UNPACK_BUFFER,null),r.state.unbindTexture()}updateTexture(e,t){let{gl:n}=this,{width:r,height:s}=t,{textureGPU:o,glTextureType:a,glFormat:l,glType:c,glInternalFormat:u}=this.backend.get(e);if(!(e.isRenderTargetTexture||o===void 0))if(this.backend.state.bindTexture(a,o),this.setTextureParameters(a,e),e.isCompressedTexture){let f=e.mipmaps,d=t.image;for(let A=0;A<f.length;A++){let y=f[A];e.isCompressedArrayTexture?e.format!==n.RGBA?l!==null?n.compressedTexSubImage3D(n.TEXTURE_2D_ARRAY,A,0,0,0,y.width,y.height,d.depth,l,y.data):Xe("WebGLBackend: Attempt to load unsupported compressed texture format in .uploadTexture()"):n.texSubImage3D(n.TEXTURE_2D_ARRAY,A,0,0,0,y.width,y.height,d.depth,l,c,y.data):l!==null?n.compressedTexSubImage2D(n.TEXTURE_2D,A,0,0,y.width,y.height,l,y.data):Xe("WebGLBackend: Unsupported compressed texture format")}}else if(e.isCubeTexture){let f=t.images,d=e.mipmaps;for(let A=0;A<6;A++){let y=PR(f[A]);n.texSubImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+A,0,0,0,r,s,l,c,y);for(let w=0;w<d.length;w++){let S=d[w],T=PR(S.images[A]);n.texSubImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+A,w+1,0,0,T.width,T.height,l,c,T)}}}else if(e.isDataArrayTexture||e.isArrayTexture){let f=t.image;if(e.layerUpdates.size>0){let d=Lb(f.width,f.height,e.format,e.type);for(let A of e.layerUpdates){let y=f.data.subarray(A*d/f.data.BYTES_PER_ELEMENT,(A+1)*d/f.data.BYTES_PER_ELEMENT);n.texSubImage3D(n.TEXTURE_2D_ARRAY,0,0,0,A,f.width,f.height,1,l,c,y)}e.clearLayerUpdates()}else n.texSubImage3D(n.TEXTURE_2D_ARRAY,0,0,0,0,f.width,f.height,f.depth,l,c,f.data)}else if(e.isData3DTexture){let f=t.image;n.texSubImage3D(n.TEXTURE_3D,0,0,0,0,f.width,f.height,f.depth,l,c,f.data)}else if(e.isVideoTexture)e.update(),n.texImage2D(a,0,u,l,c,t.image);else if(e.isHTMLTexture)typeof n.texElementImage2D=="function"&&(n.texElementImage2D.length===3?n.texElementImage2D(n.TEXTURE_2D,n.RGBA8,t.image):n.texElementImage2D(n.TEXTURE_2D,0,n.RGBA,n.RGBA,n.UNSIGNED_BYTE,t.image));else{let f=e.mipmaps;if(f.length>0)for(let d=0,A=f.length;d<A;d++){let y=f[d],w=PR(y);n.texSubImage2D(a,d,0,0,y.width,y.height,l,c,w)}else{let d=PR(t.image);n.texSubImage2D(a,0,0,0,r,s,l,c,d)}}}generateMipmaps(e){let{gl:t,backend:n}=this,{textureGPU:r,glTextureType:s}=n.get(e);n.state.bindTexture(s,r),t.generateMipmap(s)}deallocateRenderBuffers(e){let{gl:t,backend:n}=this;if(e){let r=n.get(e);if(r.renderBufferStorageSetup=void 0,r.framebuffers){for(let s in r.framebuffers)t.deleteFramebuffer(r.framebuffers[s]);delete r.framebuffers}if(r.depthRenderbuffer&&(t.deleteRenderbuffer(r.depthRenderbuffer),delete r.depthRenderbuffer),r.stencilRenderbuffer&&(t.deleteRenderbuffer(r.stencilRenderbuffer),delete r.stencilRenderbuffer),r.msaaFrameBuffer&&(t.deleteFramebuffer(r.msaaFrameBuffer),delete r.msaaFrameBuffer),r.msaaRenderbuffers){for(let s=0;s<r.msaaRenderbuffers.length;s++)t.deleteRenderbuffer(r.msaaRenderbuffers[s]);delete r.msaaRenderbuffers}}}destroyTexture(e,t=!1){let{gl:n,backend:r}=this,{textureGPU:s,renderTarget:o}=r.get(e);this.deallocateRenderBuffers(o),t===!1&&e.isExternalTexture!==!0&&n.deleteTexture(s),r.delete(e)}copyTextureToTexture(e,t,n=null,r=null,s=0,o=0){let{gl:a,backend:l}=this,{state:c}=this.backend,{textureGPU:u,glTextureType:f,glType:d,glFormat:A}=l.get(t);c.bindTexture(f,u);let y,w,S,T,R,P,I,F,D,L=e.isCompressedTexture?e.mipmaps[o]:e.image;if(n!==null)y=n.max.x-n.min.x,w=n.max.y-n.min.y,S=n.isBox3?n.max.z-n.min.z:1,T=n.min.x,R=n.min.y,P=n.isBox3?n.min.z:0;else{let H=Math.pow(2,-s);y=Math.floor(L.width*H),w=Math.floor(L.height*H),e.isDataArrayTexture||e.isArrayTexture?S=L.depth:e.isData3DTexture?S=Math.floor(L.depth*H):S=1,T=0,R=0,P=0}r!==null?(I=r.x,F=r.y,D=r.z):(I=0,F=0,D=0),c.pixelStorei(a.UNPACK_FLIP_Y_WEBGL,t.flipY),c.pixelStorei(a.UNPACK_PREMULTIPLY_ALPHA_WEBGL,t.premultiplyAlpha),c.pixelStorei(a.UNPACK_ALIGNMENT,t.unpackAlignment);let C=c.getParameter(a.UNPACK_ROW_LENGTH),B=c.getParameter(a.UNPACK_IMAGE_HEIGHT),k=c.getParameter(a.UNPACK_SKIP_PIXELS),z=c.getParameter(a.UNPACK_SKIP_ROWS),G=c.getParameter(a.UNPACK_SKIP_IMAGES);c.pixelStorei(a.UNPACK_ROW_LENGTH,L.width),c.pixelStorei(a.UNPACK_IMAGE_HEIGHT,L.height),c.pixelStorei(a.UNPACK_SKIP_PIXELS,T),c.pixelStorei(a.UNPACK_SKIP_ROWS,R),c.pixelStorei(a.UNPACK_SKIP_IMAGES,P);let W=e.isDataArrayTexture||e.isData3DTexture||t.isArrayTexture,Y=t.isDataArrayTexture||t.isData3DTexture||t.isArrayTexture;if(e.isDepthTexture){let H=l.get(e),$=l.get(t),J=l.get(H.renderTarget),te=l.get($.renderTarget),ce=J.framebuffers[H.cacheKey],he=te.framebuffers[$.cacheKey],ve=c.currentBoundFramebuffers[a.READ_FRAMEBUFFER]??null,Re=c.currentBoundFramebuffers[a.DRAW_FRAMEBUFFER]??null;c.bindFramebuffer(a.READ_FRAMEBUFFER,ce),c.bindFramebuffer(a.DRAW_FRAMEBUFFER,he);for(let Qe=0;Qe<S;Qe++)W&&(a.framebufferTextureLayer(a.READ_FRAMEBUFFER,a.COLOR_ATTACHMENT0,H.textureGPU,s,P+Qe),a.framebufferTextureLayer(a.DRAW_FRAMEBUFFER,a.COLOR_ATTACHMENT0,u,o,D+Qe)),a.blitFramebuffer(T,R,y,w,I,F,y,w,a.DEPTH_BUFFER_BIT,a.NEAREST);c.bindFramebuffer(a.READ_FRAMEBUFFER,ve),c.bindFramebuffer(a.DRAW_FRAMEBUFFER,Re)}else if(s!==0||e.isRenderTargetTexture||l.has(e)){let H=l.get(e);this._srcFramebuffer===null&&(this._srcFramebuffer=a.createFramebuffer()),this._dstFramebuffer===null&&(this._dstFramebuffer=a.createFramebuffer());let $=c.currentBoundFramebuffers[a.READ_FRAMEBUFFER]??null,J=c.currentBoundFramebuffers[a.DRAW_FRAMEBUFFER]??null;c.bindFramebuffer(a.READ_FRAMEBUFFER,this._srcFramebuffer),c.bindFramebuffer(a.DRAW_FRAMEBUFFER,this._dstFramebuffer);for(let te=0;te<S;te++)W?a.framebufferTextureLayer(a.READ_FRAMEBUFFER,a.COLOR_ATTACHMENT0,H.textureGPU,s,P+te):a.framebufferTexture2D(a.READ_FRAMEBUFFER,a.COLOR_ATTACHMENT0,a.TEXTURE_2D,H.textureGPU,s),Y?a.framebufferTextureLayer(a.DRAW_FRAMEBUFFER,a.COLOR_ATTACHMENT0,u,o,D+te):a.framebufferTexture2D(a.DRAW_FRAMEBUFFER,a.COLOR_ATTACHMENT0,a.TEXTURE_2D,u,o),s!==0?a.blitFramebuffer(T,R,y,w,I,F,y,w,a.COLOR_BUFFER_BIT,a.NEAREST):Y?a.copyTexSubImage3D(f,o,I,F,D+te,T,R,y,w):a.copyTexSubImage2D(f,o,I,F,T,R,y,w);c.bindFramebuffer(a.READ_FRAMEBUFFER,$),c.bindFramebuffer(a.DRAW_FRAMEBUFFER,J)}else Y?e.isDataTexture||e.isData3DTexture?a.texSubImage3D(f,o,I,F,D,y,w,S,A,d,L.data):t.isCompressedArrayTexture?a.compressedTexSubImage3D(f,o,I,F,D,y,w,S,A,L.data):a.texSubImage3D(f,o,I,F,D,y,w,S,A,d,L):e.isDataTexture?a.texSubImage2D(a.TEXTURE_2D,o,I,F,y,w,A,d,L.data):e.isCompressedTexture?a.compressedTexSubImage2D(a.TEXTURE_2D,o,I,F,L.width,L.height,A,L.data):a.texSubImage2D(a.TEXTURE_2D,o,I,F,y,w,A,d,L);c.pixelStorei(a.UNPACK_ROW_LENGTH,C),c.pixelStorei(a.UNPACK_IMAGE_HEIGHT,B),c.pixelStorei(a.UNPACK_SKIP_PIXELS,k),c.pixelStorei(a.UNPACK_SKIP_ROWS,z),c.pixelStorei(a.UNPACK_SKIP_IMAGES,G),o===0&&t.generateMipmaps&&a.generateMipmap(f),c.unbindTexture()}copyFramebufferToTexture(e,t,n){let{gl:r}=this,{state:s}=this.backend,{textureGPU:o}=this.backend.get(e),{x:a,y:l,z:c,w:u}=n,f=e.isDepthTexture===!0||t.renderTarget&&t.renderTarget.samples>0,d=t.renderTarget?t.renderTarget.height:this.backend.getDrawingBufferSize().y;if(f){let A=a!==0||l!==0,y,w;if(e.isDepthTexture===!0?(y=r.DEPTH_BUFFER_BIT,w=r.DEPTH_ATTACHMENT,t.stencil&&(y|=r.STENCIL_BUFFER_BIT)):(y=r.COLOR_BUFFER_BIT,w=r.COLOR_ATTACHMENT0),A){let S=this.backend.get(t.renderTarget),T=S.framebuffers[t.getCacheKey()],R=S.msaaFrameBuffer;s.bindFramebuffer(r.DRAW_FRAMEBUFFER,T),s.bindFramebuffer(r.READ_FRAMEBUFFER,R);let P=d-l-u;r.blitFramebuffer(a,P,a+c,P+u,a,P,a+c,P+u,y,r.NEAREST),s.bindFramebuffer(r.READ_FRAMEBUFFER,T),s.bindTexture(r.TEXTURE_2D,o),r.copyTexSubImage2D(r.TEXTURE_2D,0,0,0,a,P,c,u),s.unbindTexture()}else{let S=r.createFramebuffer();s.bindFramebuffer(r.DRAW_FRAMEBUFFER,S),r.framebufferTexture2D(r.DRAW_FRAMEBUFFER,w,r.TEXTURE_2D,o,0),r.blitFramebuffer(0,0,c,u,0,0,c,u,y,r.NEAREST),r.deleteFramebuffer(S)}}else s.bindTexture(r.TEXTURE_2D,o),r.copyTexSubImage2D(r.TEXTURE_2D,0,0,0,a,d-u-l,c,u),s.unbindTexture();e.generateMipmaps&&this.generateMipmaps(e),this.backend._setFramebuffer(t)}setupRenderBufferStorage(e,t,n,r=!1){let{gl:s}=this,o=t.renderTarget,{depthTexture:a,depthBuffer:l,stencilBuffer:c,width:u,height:f}=o;if(s.bindRenderbuffer(s.RENDERBUFFER,e),l&&!c){let d=s.DEPTH_COMPONENT24;r===!0?this.extensions.get("WEBGL_multisampled_render_to_texture").renderbufferStorageMultisampleEXT(s.RENDERBUFFER,o.samples,d,u,f):n>0?(a&&a.isDepthTexture&&a.type===s.FLOAT&&(d=s.DEPTH_COMPONENT32F),s.renderbufferStorageMultisample(s.RENDERBUFFER,n,d,u,f)):s.renderbufferStorage(s.RENDERBUFFER,d,u,f),s.framebufferRenderbuffer(s.FRAMEBUFFER,s.DEPTH_ATTACHMENT,s.RENDERBUFFER,e)}else l&&c&&(n>0?s.renderbufferStorageMultisample(s.RENDERBUFFER,n,s.DEPTH24_STENCIL8,u,f):s.renderbufferStorage(s.RENDERBUFFER,s.DEPTH_STENCIL,u,f),s.framebufferRenderbuffer(s.FRAMEBUFFER,s.DEPTH_STENCIL_ATTACHMENT,s.RENDERBUFFER,e));s.bindRenderbuffer(s.RENDERBUFFER,null)}async copyTextureToBuffer(e,t,n,r,s,o){let{backend:a,gl:l}=this,{textureGPU:c,glFormat:u,glType:f}=this.backend.get(e),d=l.createFramebuffer();a.state.bindFramebuffer(l.READ_FRAMEBUFFER,d);let A=e.isCubeTexture?l.TEXTURE_CUBE_MAP_POSITIVE_X+o:l.TEXTURE_2D;l.framebufferTexture2D(l.READ_FRAMEBUFFER,l.COLOR_ATTACHMENT0,A,c,0);let y=this._getTypedArrayType(f),w=this._getBytesPerTexel(f,u),T=r*s*w,R=l.createBuffer();l.bindBuffer(l.PIXEL_PACK_BUFFER,R),l.bufferData(l.PIXEL_PACK_BUFFER,T,l.STREAM_READ),l.readPixels(t,n,r,s,u,f,0),l.bindBuffer(l.PIXEL_PACK_BUFFER,null),await a.utils._clientWaitAsync();let P=new y(T/y.BYTES_PER_ELEMENT);return l.bindBuffer(l.PIXEL_PACK_BUFFER,R),l.getBufferSubData(l.PIXEL_PACK_BUFFER,0,P),l.bindBuffer(l.PIXEL_PACK_BUFFER,null),a.state.bindFramebuffer(l.READ_FRAMEBUFFER,null),l.deleteFramebuffer(d),P}_getTypedArrayType(e){let{gl:t}=this;if(e===t.UNSIGNED_BYTE)return Uint8Array;if(e===t.UNSIGNED_SHORT_4_4_4_4||e===t.UNSIGNED_SHORT_5_5_5_1||e===t.UNSIGNED_SHORT_5_6_5||e===t.UNSIGNED_SHORT)return Uint16Array;if(e===t.UNSIGNED_INT)return Uint32Array;if(e===t.HALF_FLOAT)return Uint16Array;if(e===t.FLOAT)return Float32Array;throw new Error(`THREE.WebGLTextureUtils: Unsupported WebGL type: ${e}`)}_getBytesPerTexel(e,t){let{gl:n}=this,r=0;if(e===n.UNSIGNED_BYTE&&(r=1),(e===n.UNSIGNED_SHORT_4_4_4_4||e===n.UNSIGNED_SHORT_5_5_5_1||e===n.UNSIGNED_SHORT_5_6_5||e===n.UNSIGNED_SHORT||e===n.HALF_FLOAT)&&(r=2),(e===n.UNSIGNED_INT||e===n.FLOAT)&&(r=4),t===n.RGBA)return r*4;if(t===n.RGB)return r*3;if(t===n.ALPHA)return r}dispose(){let{gl:e}=this;this._srcFramebuffer!==null&&e.deleteFramebuffer(this._srcFramebuffer),this._dstFramebuffer!==null&&e.deleteFramebuffer(this._dstFramebuffer)}};function PR(i){return i.isDataTexture?i.image.data:typeof HTMLImageElement<"u"&&i instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&i instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&i instanceof ImageBitmap||typeof OffscreenCanvas<"u"&&i instanceof OffscreenCanvas?i:i.data}var a9=class{constructor(e){this.backend=e,this.gl=this.backend.gl,this.availableExtensions=this.gl.getSupportedExtensions(),this.extensions={}}get(e){let t=this.extensions[e];return t===void 0&&(t=this.gl.getExtension(e),this.extensions[e]=t),t}has(e){return this.availableExtensions.includes(e)}},l9=class{constructor(e){this.backend=e,this.maxAnisotropy=null,this.maxUniformBlockSize=null}getMaxAnisotropy(){if(this.maxAnisotropy!==null)return this.maxAnisotropy;let e=this.backend.gl,t=this.backend.extensions;if(t.has("EXT_texture_filter_anisotropic")===!0){let n=t.get("EXT_texture_filter_anisotropic");this.maxAnisotropy=e.getParameter(n.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else this.maxAnisotropy=0;return this.maxAnisotropy}getUniformBufferLimit(){if(this.maxUniformBlockSize!==null)return this.maxUniformBlockSize;let e=this.backend.gl;return this.maxUniformBlockSize=e.getParameter(e.MAX_UNIFORM_BLOCK_SIZE),this.maxUniformBlockSize}},bte={WEBGL_multi_draw:"WEBGL_multi_draw",WEBGL_compressed_texture_astc:"texture-compression-astc",WEBGL_compressed_texture_etc:"texture-compression-etc2",WEBGL_compressed_texture_etc1:"texture-compression-etc1",WEBGL_compressed_texture_pvrtc:"texture-compression-pvrtc",WEBGL_compressed_texture_s3tc:"texture-compression-s3tc",EXT_texture_compression_bptc:"texture-compression-bc",EXT_disjoint_timer_query_webgl2:"timestamp-query",OVR_multiview2:"OVR_multiview2"},c9=class{constructor(e){this.gl=e.gl,this.extensions=e.extensions,this.info=e.renderer.info,this.mode=null,this.index=0,this.type=null,this.object=null}render(e,t){let{gl:n,mode:r,object:s,type:o,info:a,index:l}=this;l!==0?n.drawElements(r,t,o,e):n.drawArrays(r,e,t),a.update(s,t,1)}renderInstances(e,t,n){let{gl:r,mode:s,type:o,index:a,object:l,info:c}=this;n!==0&&(a!==0?r.drawElementsInstanced(s,t,o,e,n):r.drawArraysInstanced(s,e,t,n),c.update(l,t,n))}renderMultiDraw(e,t,n){let{extensions:r,mode:s,object:o,info:a}=this;if(n===0)return;let l=r.get("WEBGL_multi_draw");if(l===null)for(let c=0;c<n;c++)this.render(e[c],t[c]);else{this.index!==0?l.multiDrawElementsWEBGL(s,t,0,this.type,e,0,n):l.multiDrawArraysWEBGL(s,e,0,t,0,n);let c=0;for(let u=0;u<n;u++)c+=t[u];a.update(o,c,1)}}},Z4=class{constructor(e=256){this.trackTimestamp=!0,this.maxQueries=e,this.currentQueryIndex=0,this.queryOffsets=new Map,this.isDisposed=!1,this.lastValue=0,this.frames=[],this.pendingResolve=!1,this.timestamps=new Map}getTimestampFrames(){return this.frames}getTimestamp(e){let t=this.timestamps.get(e);return t===void 0&&(Xe(`TimestampQueryPool: No timestamp available for uid ${e}.`),t=0),t}hasTimestampQuery(e){return this.timestamps.has(e)}allocateQueriesForContext(){}async resolveQueriesAsync(){}dispose(){}},u9=class extends Z4{constructor(e,t,n=2048){if(super(n),this.gl=e,this.type=t,this.ext=e.getExtension("EXT_disjoint_timer_query_webgl2")||e.getExtension("EXT_disjoint_timer_query"),!this.ext){Xe("EXT_disjoint_timer_query not supported; timestamps will be disabled."),this.trackTimestamp=!1;return}this.queries=[];for(let r=0;r<this.maxQueries;r++)this.queries.push(e.createQuery());this.activeQuery=null,this.queryStates=new Map}allocateQueriesForContext(e){if(!this.trackTimestamp)return null;if(this.currentQueryIndex+2>this.maxQueries)return ni(`WebGLTimestampQueryPool [${this.type}]: Maximum number of queries exceeded, when using trackTimestamp it is necessary to resolves the queries via renderer.resolveTimestampsAsync( THREE.TimestampQuery.${this.type.toUpperCase()} ).`),null;let t=this.currentQueryIndex;return this.currentQueryIndex+=2,this.queryStates.set(t,"inactive"),this.queryOffsets.set(e,t),t}beginQuery(e){if(!this.trackTimestamp||this.isDisposed)return;let t=this.queryOffsets.get(e);if(t==null||this.activeQuery!==null)return;let n=this.queries[t];if(n)try{this.queryStates.get(t)==="inactive"&&(this.gl.beginQuery(this.ext.TIME_ELAPSED_EXT,n),this.activeQuery=t,this.queryStates.set(t,"started"))}catch(r){ze("Error in beginQuery:",r),this.activeQuery=null,this.queryStates.set(t,"inactive")}}endQuery(e){if(!this.trackTimestamp||this.isDisposed)return;let t=this.queryOffsets.get(e);if(t!=null&&this.activeQuery===t)try{this.gl.endQuery(this.ext.TIME_ELAPSED_EXT),this.queryStates.set(t,"ended"),this.activeQuery=null}catch(n){ze("Error in endQuery:",n),this.queryStates.set(t,"inactive"),this.activeQuery=null}}async resolveQueriesAsync(){if(!this.trackTimestamp||this.pendingResolve)return this.lastValue;this.pendingResolve=!0;try{let e=new Map;for(let[s,o]of this.queryOffsets)if(this.queryStates.get(o)==="ended"){let l=this.queries[o];e.set(s,this.resolveQuery(l))}if(e.size===0)return this.lastValue;let t={},n=[];for(let[s,o]of e){let a=s.match(/^(.*):f(\d+)$/),l=parseInt(a[2]);n.includes(l)===!1&&n.push(l),t[l]===void 0&&(t[l]=0);let c=await o;this.timestamps.set(s,c),t[l]+=c}let r=t[n[n.length-1]];return this.lastValue=r,this.frames=n,this.currentQueryIndex=0,this.queryOffsets.clear(),this.queryStates.clear(),this.activeQuery=null,r}catch(e){return ze("Error resolving queries:",e),this.lastValue}finally{this.pendingResolve=!1}}async resolveQuery(e){return new Promise(t=>{if(this.isDisposed){t(this.lastValue);return}let n,r=!1,s=()=>{n&&(clearTimeout(n),n=null)},o=l=>{r||(r=!0,s(),t(l))},a=()=>{if(this.isDisposed){o(this.lastValue);return}try{if(this.gl.getParameter(this.ext.GPU_DISJOINT_EXT)){o(this.lastValue);return}if(!this.gl.getQueryParameter(e,this.gl.QUERY_RESULT_AVAILABLE)){n=setTimeout(a,1);return}let u=this.gl.getQueryParameter(e,this.gl.QUERY_RESULT);t(Number(u)/1e6)}catch(l){ze("Error checking query:",l),t(this.lastValue)}};a()})}dispose(){if(!this.isDisposed&&(this.isDisposed=!0,!!this.trackTimestamp)){for(let e of this.queries)this.gl.deleteQuery(e);this.queries=[],this.queryStates.clear(),this.queryOffsets.clear(),this.lastValue=0,this.activeQuery=null}}},K4=class extends Y4{constructor(e={}){super(e),this.isWebGLBackend=!0,this.attributeUtils=null,this.extensions=null,this.capabilities=null,this.textureUtils=null,this.bufferRenderer=null,this.gl=null,this.state=null,this.utils=null,this.vaoCache={},this.transformFeedbackCache={},this.discard=!1,this.disjoint=null,this.parallel=null,this._currentContext=null,this._knownBindings=new WeakSet,this._supportsInvalidateFramebuffer=typeof navigator>"u"?!1:/OculusBrowser/g.test(navigator.userAgent),this._xrFramebuffer=null}init(e){super.init(e);let t=this.parameters,n={antialias:e.currentSamples>0,alpha:!0,depth:e.depth,stencil:e.stencil},r=t.context!==void 0?t.context:e.domElement.getContext("webgl2",n);function s(o){o.preventDefault();let a={api:"WebGL",message:o.statusMessage||"Unknown reason",reason:null,originalEvent:o};e.onDeviceLost(a)}this._onContextLost=s,e.domElement.addEventListener("webglcontextlost",s,!1),this.gl=r,this.extensions=new a9(this),this.capabilities=new l9(this),this.attributeUtils=new i9(this),this.textureUtils=new o9(this),this.bufferRenderer=new c9(this),this.state=new r9(this),this.utils=new s9(this),this.extensions.get("EXT_color_buffer_float"),this.extensions.get("WEBGL_clip_cull_distance"),this.extensions.get("OES_texture_float_linear"),this.extensions.get("EXT_color_buffer_half_float"),this.extensions.get("WEBGL_multisampled_render_to_texture"),this.extensions.get("WEBGL_render_shared_exponent"),this.extensions.get("WEBGL_multi_draw"),this.extensions.get("OVR_multiview2"),this.extensions.get("EXT_clip_control"),this.disjoint=this.extensions.get("EXT_disjoint_timer_query_webgl2"),this.parallel=this.extensions.get("KHR_parallel_shader_compile"),this.drawBuffersIndexedExt=this.extensions.get("OES_draw_buffers_indexed"),t.reversedDepthBuffer&&(this.extensions.has("EXT_clip_control")?e.reversedDepthBuffer=!0:(Xe("WebGPURenderer: Unable to use reversed depth buffer due to missing EXT_clip_control extension. Fallback to default depth buffer."),e.reversedDepthBuffer=!1)),e.reversedDepthBuffer&&this.state.setReversedDepth(!0)}get coordinateSystem(){return Uo}get hasTimestamp(){return this.disjoint!==null}async getArrayBufferAsync(e,t=null,n=0,r=-1){return await this.attributeUtils.getArrayBufferAsync(e,t,n,r)}async makeXRCompatible(){this.gl.getContextAttributes().xrCompatible!==!0&&await this.gl.makeXRCompatible()}setXRTarget(e){this._xrFramebuffer=e}setXRRenderTargetTextures(e,t,n=null){let r=this.gl;if(this.set(e.texture,{textureGPU:t,glInternalFormat:r.RGBA8}),n!==null){let s=e.stencilBuffer?r.DEPTH24_STENCIL8:r.DEPTH_COMPONENT24;this.set(e.depthTexture,{textureGPU:n,glInternalFormat:s}),this.extensions.has("WEBGL_multisampled_render_to_texture")===!0&&e._autoAllocateDepthBuffer===!0&&e.multiview===!1&&Xe("WebGLBackend: Render-to-texture extension was disabled because an external texture was provided"),e._autoAllocateDepthBuffer=!1}}initTimestampQuery(e,t){if(!this.disjoint||!this.trackTimestamp)return;this.timestampQueryPool[e]||(this.timestampQueryPool[e]=new u9(this.gl,e,2048));let n=this.timestampQueryPool[e];n.allocateQueriesForContext(t)!==null&&n.beginQuery(t)}prepareTimestampBuffer(e,t){if(!this.disjoint||!this.trackTimestamp)return;this.timestampQueryPool[e].endQuery(t)}getContext(){return this.gl}beginRender(e){let{state:t}=this,n=this.get(e);if(e.viewport)this.updateViewport(e);else{let{width:s,height:o}=this.getDrawingBufferSize();t.viewport(0,0,s,o)}if(e.scissor)this.updateScissor(e);else{let{width:s,height:o}=this.getDrawingBufferSize();t.scissor(0,0,s,o)}this.initTimestampQuery(Hc.RENDER,this.getTimestampUID(e)),n.previousContext=this._currentContext,this._currentContext=e,this._setFramebuffer(e),this.clear(e.clearColor,e.clearDepth,e.clearStencil,e,!1);let r=e.occlusionQueryCount;r>0&&(n.currentOcclusionQueries=n.occlusionQueries,n.currentOcclusionQueryObjects=n.occlusionQueryObjects,n.lastOcclusionObject=null,n.occlusionQueries=new Array(r),n.occlusionQueryObjects=new Array(r),n.occlusionQueryIndex=0)}finishRender(e){let{gl:t,state:n}=this,r=this.get(e),s=r.previousContext;n.resetVertexState();let o=e.occlusionQueryCount;o>0&&(o>r.occlusionQueryIndex&&t.endQuery(t.ANY_SAMPLES_PASSED),this.resolveOccludedAsync(e));let a=e.textures;if(a!==null)for(let l=0;l<a.length;l++){let c=a[l];c.generateMipmaps&&this.generateMipmaps(c)}if(this._currentContext=s,this._resolveRenderTarget(e),s!==null){if(this._setFramebuffer(s),s.viewport)this.updateViewport(s);else{let{width:l,height:c}=this.getDrawingBufferSize();n.viewport(0,0,l,c)}if(s.scissor)this.updateScissor(s);else{let{width:l,height:c}=this.getDrawingBufferSize();n.scissor(0,0,l,c)}}this.prepareTimestampBuffer(Hc.RENDER,this.getTimestampUID(e))}resolveOccludedAsync(e){let t=this.get(e),{currentOcclusionQueries:n,currentOcclusionQueryObjects:r}=t;if(n&&r){let s=new WeakSet,{gl:o}=this;t.currentOcclusionQueryObjects=null,t.currentOcclusionQueries=null;let a=()=>{let l=0;for(let c=0;c<n.length;c++){let u=n[c];u!==null&&o.getQueryParameter(u,o.QUERY_RESULT_AVAILABLE)&&(o.getQueryParameter(u,o.QUERY_RESULT)===0&&s.add(r[c]),n[c]=null,o.deleteQuery(u),l++)}l<n.length?requestAnimationFrame(a):t.occluded=s};a()}}isOccluded(e,t){let n=this.get(e);return n.occluded&&n.occluded.has(t)}updateViewport(e){let{state:t}=this,{x:n,y:r,width:s,height:o}=e.viewportValue;t.viewport(n,e.height-o-r,s,o)}updateScissor(e){let{state:t}=this,{x:n,y:r,width:s,height:o}=e.scissorValue;t.scissor(n,e.height-o-r,s,o)}setScissorTest(e){this.state.setScissorTest(e)}getClearColor(){let e=super.getClearColor();return e.r*=e.a,e.g*=e.a,e.b*=e.a,e}clear(e,t,n,r=null,s=!0,o=!0){let{gl:a,renderer:l}=this;r===null&&(r={textures:null,clearColorValue:this.getClearColor()});let c=0;if(e&&(c|=a.COLOR_BUFFER_BIT),t&&(c|=a.DEPTH_BUFFER_BIT),n&&(c|=a.STENCIL_BUFFER_BIT),c!==0){let u;r.clearColorValue?u=r.clearColorValue:u=this.getClearColor();let f=l.getClearDepth(),d=l.getClearStencil();if(t&&this.state.setDepthMask(!0),r.textures===null)a.clearColor(u.r,u.g,u.b,u.a),a.clear(c);else{if(s&&this._setFramebuffer(r),e)for(let A=0;A<r.textures.length;A++)A===0?a.clearBufferfv(a.COLOR,A,[u.r,u.g,u.b,u.a]):a.clearBufferfv(a.COLOR,A,[0,0,0,1]);t&&n?a.clearBufferfi(a.DEPTH_STENCIL,0,f,d):t?a.clearBufferfv(a.DEPTH,0,[f]):n&&a.clearBufferiv(a.STENCIL,0,[d]),s&&o&&this._resolveRenderTarget(r),s&&this._currentContext!==null&&this._currentContext!==r&&this._setFramebuffer(this._currentContext)}}}beginCompute(e){let{state:t,gl:n}=this;t.bindFramebuffer(n.FRAMEBUFFER,null),this.initTimestampQuery(Hc.COMPUTE,this.getTimestampUID(e))}compute(e,t,n,r,s=null){let{state:o,gl:a}=this;this.discard===!1&&(o.enable(a.RASTERIZER_DISCARD),this.discard=!0);let{programGPU:l,transformBuffers:c,attributes:u}=this.get(r),f=this._getVaoKey(u),d=this.vaoCache[f];d===void 0?this.vaoCache[f]=this._createVao(u):o.setVertexState(d),o.useProgram(l),this._bindUniforms(n);let A=this._getTransformFeedback(c);a.bindTransformFeedback(a.TRANSFORM_FEEDBACK,A),a.beginTransformFeedback(a.POINTS),s=s!==null?s:t.count,Array.isArray(s)?(ni("WebGLBackend.compute(): The count parameter must be a single number, not an array."),s=s[0]):s&&typeof s=="object"&&s.isIndirectStorageBufferAttribute&&(ni("WebGLBackend.compute(): The count parameter must be a single number, not IndirectStorageBufferAttribute"),s=t.count),u[0].isStorageInstancedBufferAttribute?a.drawArraysInstanced(a.POINTS,0,1,s):a.drawArrays(a.POINTS,0,s),a.endTransformFeedback(),a.bindTransformFeedback(a.TRANSFORM_FEEDBACK,null);for(let y=0;y<c.length;y++){let w=c[y];w.pbo&&this.has(w.pbo)&&this.textureUtils.copyBufferToTexture(w.transformBuffer,w.pbo),w.switchBuffers()}}finishCompute(e){let{state:t,gl:n}=this;this.discard=!1,t.disable(n.RASTERIZER_DISCARD),this.prepareTimestampBuffer(Hc.COMPUTE,this.getTimestampUID(e)),this._currentContext&&this._setFramebuffer(this._currentContext)}_isRenderCameraDepthArray(e){return e.depthTexture&&e.depthTexture.isArrayTexture&&e.camera.isArrayCamera}_draw(e,t,n,r,s,o){if(e.isBatchedMesh)if(this.hasFeature("WEBGL_multi_draw")===!1){let{gl:a}=this,l=a.getUniformLocation(o,"nodeUniformDrawId"),c=e._multiDrawStarts,u=e._multiDrawCounts,f=e._multiDrawCount;for(let d=0;d<f;d++)a.uniform1ui(l,d),t.render(c[d],u[d])}else t.renderMultiDraw(e._multiDrawStarts,e._multiDrawCounts,e._multiDrawCount);else s>1?t.renderInstances(n,r,s):t.render(n,r)}draw(e){let{object:t,pipeline:n,material:r,context:s,hardwareClippingPlanes:o}=e,{programGPU:a}=this.get(n),{gl:l,state:c}=this,u=this.get(s),f=e.getDrawParameters();if(f===null)return;this._bindUniforms(e.getBindings());let d=t.isMesh&&t.matrixWorld.determinantAffine()<0;c.setMaterial(r,d,o),s.mrt!==null&&s.textures!==null&&c.setMRTBlending(s.textures,s.mrt,r),c.useProgram(a);let A=e.getAttributes(),y=this.get(A),w=y.vaoGPU;if(w===void 0){let L=this._getVaoKey(A);w=this.vaoCache[L],w===void 0&&(w=this._createVao(A),this.vaoCache[L]=w,y.vaoGPU=w)}let S=e.getIndex(),T=S!==null?this.get(S).bufferGPU:null;c.setVertexState(w,T);let R=u.lastOcclusionObject;if(R!==t&&R!==void 0){if(R!==null&&R.occlusionTest===!0&&(l.endQuery(l.ANY_SAMPLES_PASSED),u.occlusionQueryIndex++),t.occlusionTest===!0){let L=l.createQuery();l.beginQuery(l.ANY_SAMPLES_PASSED,L),u.occlusionQueries[u.occlusionQueryIndex]=L,u.occlusionQueryObjects[u.occlusionQueryIndex]=t}u.lastOcclusionObject=t}let P=this.bufferRenderer;t.isPoints?P.mode=l.POINTS:t.isLineSegments?P.mode=l.LINES:t.isLine?P.mode=l.LINE_STRIP:t.isLineLoop?P.mode=l.LINE_LOOP:r.wireframe===!0?(c.setLineWidth(r.wireframeLinewidth*this.renderer.getPixelRatio()),P.mode=l.LINES):P.mode=l.TRIANGLES;let{vertexCount:I,instanceCount:F}=f,{firstVertex:D}=f;if(P.object=t,S!==null){D*=S.array.BYTES_PER_ELEMENT;let L=this.get(S);P.index=S.count,P.type=L.type}else P.index=0;if(e.camera.isArrayCamera===!0&&e.camera.cameras.length>0&&e.camera.isMultiViewCamera===!1){let L=this.get(e.camera),C=e.camera.cameras,B=e.getBindingGroup("cameraIndex").bindings[0];if(L.indexesGPU===void 0||L.indexesGPU.length!==C.length){let H=new Uint32Array([0,0,0,0]),$=[];for(let J=0,te=C.length;J<te;J++){let ce=l.createBuffer();H[0]=J,l.bindBuffer(l.UNIFORM_BUFFER,ce),l.bufferData(l.UNIFORM_BUFFER,H,l.STATIC_DRAW),$.push(ce)}L.indexesGPU=$}let k=0;e:for(let H of e.getBindings())for(let $ of H.bindings){if($===B)break e;($.isUniformsGroup||$.isUniformBuffer)&&k++}let z=this.renderer.getPixelRatio(),G=this._currentContext.renderTarget,W=this._isRenderCameraDepthArray(this._currentContext),Y=this._currentContext.activeCubeFace;if(W){let H=this.get(G.depthTexture);if(H.clearedRenderId!==this.renderer._nodes.nodeFrame.renderId){H.clearedRenderId=this.renderer._nodes.nodeFrame.renderId;let{stencilBuffer:$}=G;for(let J=0,te=C.length;J<te;J++)this.renderer._activeCubeFace=J,this._currentContext.activeCubeFace=J,this._setFramebuffer(this._currentContext),this.clear(!1,!0,$,this._currentContext,!1,!1);this.renderer._activeCubeFace=Y,this._currentContext.activeCubeFace=Y}}for(let H=0,$=C.length;H<$;H++){let J=C[H];if(t.layers.test(J.layers)){W&&(this.renderer._activeCubeFace=H,this._currentContext.activeCubeFace=H,this._setFramebuffer(this._currentContext));let te=J.viewport;if(te!==void 0){let ce=te.x*z,he=te.y*z,ve=te.width*z,Re=te.height*z;c.viewport(Math.floor(ce),Math.floor(e.context.height-Re-he),Math.floor(ve),Math.floor(Re))}c.bindBufferBase(l.UNIFORM_BUFFER,k,L.indexesGPU[H]),this._draw(t,P,D,I,F,a)}this._currentContext.activeCubeFace=Y,this.renderer._activeCubeFace=Y}}else this._draw(t,P,D,I,F,a)}needsRenderUpdate(){return!1}getRenderCacheKey(){return""}createDefaultTexture(e){this.textureUtils.createDefaultTexture(e)}createTexture(e,t){this.textureUtils.createTexture(e,t)}updateTexture(e,t){this.textureUtils.updateTexture(e,t)}generateMipmaps(e){this.textureUtils.generateMipmaps(e)}destroyTexture(e,t=!1){this.textureUtils.destroyTexture(e,t)}async copyTextureToBuffer(e,t,n,r,s,o){return this.textureUtils.copyTextureToBuffer(e,t,n,r,s,o)}updateSampler(){return""}createNodeBuilder(e,t){return new t9(e,t)}createProgram(e){let t=this.gl,{stage:n,code:r}=e,s=n==="fragment"?t.createShader(t.FRAGMENT_SHADER):t.createShader(t.VERTEX_SHADER);t.shaderSource(s,r),t.compileShader(s),this.set(e,{shaderGPU:s})}destroyProgram(e){this.delete(e)}createRenderPipeline(e,t){let n=this.gl,r=e.pipeline,{fragmentProgram:s,vertexProgram:o}=r,a=n.createProgram(),l=this.get(s).shaderGPU,c=this.get(o).shaderGPU;if(n.attachShader(a,l),n.attachShader(a,c),n.linkProgram(a),this.set(r,{programGPU:a,fragmentShader:l,vertexShader:c}),t!==null&&this.parallel){let u=new Promise(f=>{let d=this.parallel,A=()=>{n.getProgramParameter(a,d.COMPLETION_STATUS_KHR)?(this._completeCompile(e,r),f()):requestAnimationFrame(A)};A()});t.push(u);return}this._completeCompile(e,r)}_handleSource(e,t){let n=e.split(`4358+`)}}this.material!==null?(this.vertexShader=this._getGLSLVertexCode(e.vertex),this.fragmentShader=this._getGLSLFragmentCode(e.fragment)):this.computeShader=this._getGLSLVertexCode(e.compute)}getUniformFromNode(e,t,n,r=null){let s=super.getUniformFromNode(e,t,n,r),o=this.getDataFromNode(e,n,this.globalCache),a=o.uniformGPU;if(a===void 0){let l=e.groupNode,c=l.name,u=this.getBindGroupArray(c,n);if(t==="texture")a=new vx(s.name,s.node,l),u.push(a);else if(t==="cubeTexture"||t==="cubeDepthTexture")a=new nP(s.name,s.node,l),u.push(a);else if(t==="texture3D")a=new RS(s.name,s.node,l),u.push(a);else if(t==="buffer"){s.name=`buffer${e.id}`;let f=this.getSharedDataFromNode(e),d=f.buffer;d===void 0&&(e.name=`NodeBuffer_${e.id}`,d=new J4(e,l),d.name=e.name,f.buffer=d),u.push(d),a=d}else{let f=this.uniformGroups[c];f===void 0?(f=new eP(c,l),this.uniformGroups[c]=f,u.push(f)):u.indexOf(f)===-1&&u.push(f),a=this.getNodeUniform(s,t);let d=a.name;f.uniforms.some(y=>y.name===d)||f.addUniform(a)}o.uniformGPU=a}return s}},fU=null,X_=null,iP=class{constructor(e={}){this.parameters=Object.assign({},e),this.data=new WeakMap,this.renderer=null,this.domElement=null,this.timestampQueryPool={[Hc.RENDER]:null,[Hc.COMPUTE]:null},this.trackTimestamp=e.trackTimestamp===!0}async init(e){this.renderer=e}get coordinateSystem(){}beginRender(){}finishRender(){}setXRTarget(){}beginCompute(){}finishCompute(){}draw(){}compute(){}createProgram(){}destroyProgram(){}createBindings(){}updateBindings(){}updateBinding(){}createRenderPipeline(){}createComputePipeline(){}needsRenderUpdate(){}getRenderCacheKey(){}createNodeBuilder(){}updateSampler(){}destroySampler(){}createDefaultTexture(){}createTexture(){}updateTexture(){}generateMipmaps(){}destroyTexture(){}async copyTextureToBuffer(){}copyTextureToTexture(){}copyFramebufferToTexture(){}createAttribute(){}createIndexAttribute(){}createStorageAttribute(){}createUniformBuffer(){}destroyUniformBuffer(){}updateAttribute(){}destroyAttribute(){}getContext(){}updateSize(){}updateViewport(){}updateTimeStampUID(e){let t=this.get(e),n=this.renderer.info.frame,r;e.isComputeNode===!0?r="c:"+this.renderer.info.compute.frameCalls:r="r:"+this.renderer.info.render.frameCalls,t.timestampUID=r+":"+e.id+":f"+n}getTimestampUID(e){return this.get(e).timestampUID}getTimestampFrames(e){let t=this.timestampQueryPool[e];return t?t.getTimestampFrames():[]}_getQueryPool(e){let t=e.startsWith("c:")?Hc.COMPUTE:Hc.RENDER;return this.timestampQueryPool[t]}getTimestamp(e){return this._getQueryPool(e).getTimestamp(e)}get hasTimestamp(){return!1}hasTimestampQuery(e){return this._getQueryPool(e).hasTimestampQuery(e)}isOccluded(){}async resolveTimestampsAsync(e="render"){if(!this.trackTimestamp){ni("WebGPURenderer: Timestamp tracking is disabled.");return}let t=this.timestampQueryPool[e];if(!t)return;let n=await t.resolveQueriesAsync();return this.renderer.info[e].timestamp=n,n}async getArrayBufferAsync(){}async hasFeatureAsync(){}hasFeature(){}getDrawingBufferSize(){return fU=fU||new Oe,this.renderer.getDrawingBufferSize(fU)}setScissorTest(){}getClearColor(){let e=this.renderer;return X_=X_||new xS,e.getClearColor(X_),X_.getRGB(X_),X_}getDomElement(){let e=this.domElement;return e===null&&(e=this.parameters.canvas!==void 0?this.parameters.canvas:VM(),"setAttribute"in e&&e.setAttribute("data-engine",`three.js r${"185"} webgpu`),this.domElement=e),e}hasCompatibility(){return!1}initRenderTarget(){}set(e,t){this.data.set(e,t)}get(e){let t=this.data.get(e);return t===void 0&&(t={},this.data.set(e,t)),t}has(e){return this.data.has(e)}delete(e){this.data.delete(e)}deleteBindGroupData(){}dispose(){}},PIe=0,w9=class{constructor(e,t){this.buffers=[e.bufferGPU,t],this.type=e.type,this.bufferType=e.bufferType,this.pbo=e.pbo,this.byteLength=e.byteLength,this.bytesPerElement=e.BYTES_PER_ELEMENT,this.version=e.version,this.isInteger=e.isInteger,this.activeBufferIndex=0,this.baseId=e.id}get id(){return`${this.baseId}|${this.activeBufferIndex}`}get bufferGPU(){return this.buffers[this.activeBufferIndex]}get transformBuffer(){return this.buffers[this.activeBufferIndex^1]}switchBuffers(){this.activeBufferIndex^=1}},S9=class{constructor(e){this.backend=e}createAttribute(e,t){let n=this.backend,{gl:r}=n,s=e.array,o=e.usage||r.STATIC_DRAW,a=e.isInterleavedBufferAttribute?e.data:e,l=n.get(a),c=l.bufferGPU;c===void 0&&(c=this._createBuffer(r,t,s,o),l.bufferGPU=c,l.bufferType=t,l.version=a.version);let u;if(s instanceof Float32Array)u=r.FLOAT;else if(typeof Float16Array<"u"&&s instanceof Float16Array)u=r.HALF_FLOAT;else if(s instanceof Uint16Array)e.isFloat16BufferAttribute?u=r.HALF_FLOAT:u=r.UNSIGNED_SHORT;else if(s instanceof Int16Array)u=r.SHORT;else if(s instanceof Uint32Array)u=r.UNSIGNED_INT;else if(s instanceof Int32Array)u=r.INT;else if(s instanceof Int8Array)u=r.BYTE;else if(s instanceof Uint8Array)u=r.UNSIGNED_BYTE;else if(s instanceof Uint8ClampedArray)u=r.UNSIGNED_BYTE;else throw new Error("THREE.WebGLBackend: Unsupported buffer data format: "+s);let f={bufferGPU:c,bufferType:t,type:u,byteLength:s.byteLength,bytesPerElement:s.BYTES_PER_ELEMENT,version:e.version,pbo:e.pbo,isInteger:u===r.INT||u===r.UNSIGNED_INT||e.gpuType===Kr,id:PIe++};if(e.isStorageBufferAttribute||e.isStorageInstancedBufferAttribute){let d=this._createBuffer(r,t,s,o);f=new w9(f,d)}n.set(e,f)}updateAttribute(e){let t=this.backend,{gl:n}=t,r=e.array,s=e.isInterleavedBufferAttribute?e.data:e,o=t.get(s),a=o.bufferType,l=e.isInterleavedBufferAttribute?e.data.updateRanges:e.updateRanges;if(n.bindBuffer(a,o.bufferGPU),l.length===0)n.bufferSubData(a,0,r);else{for(let c=0,u=l.length;c<u;c++){let f=l[c];n.bufferSubData(a,f.start*r.BYTES_PER_ELEMENT,r,f.start,f.count)}s.clearUpdateRanges()}n.bindBuffer(a,null),o.version=s.version}destroyAttribute(e){let t=this.backend,{gl:n}=t;e.isInterleavedBufferAttribute&&t.delete(e.data);let r=t.get(e);n.deleteBuffer(r.bufferGPU),t.delete(e)}async getArrayBufferAsync(e,t=null,n=0,r=-1){let s=this.backend,{gl:o}=s,a=e.isInterleavedBufferAttribute?e.data:e,l=s.get(a),{bufferGPU:c}=l,u=r===-1?l.byteLength-n:r,f;if(t===null)f=new Uint8Array(new ArrayBuffer(u));else if(t.isReadbackBuffer){if(t._mapped===!0)throw new Error("THREE.WebGPURenderer: ReadbackBuffer must be released before being used again.");let d=()=>{t.buffer=null,t._mapped=!1,t.removeEventListener("release",d),t.removeEventListener("dispose",d)};t.addEventListener("release",d),t.addEventListener("dispose",d),f=new Uint8Array(new ArrayBuffer(u)),t.buffer=f.buffer}else f=new Uint8Array(t);return o.bindBuffer(o.COPY_READ_BUFFER,c),o.getBufferSubData(o.COPY_READ_BUFFER,n,f),o.bindBuffer(o.COPY_READ_BUFFER,null),o.bindBuffer(o.COPY_WRITE_BUFFER,null),t&&t.isReadbackBuffer?t:f.buffer}_createBuffer(e,t,n,r){let s=e.createBuffer();return e.bindBuffer(t,s),e.bufferData(t,n,r),e.bindBuffer(t,null),s}},Xw,Hd,T9=class{constructor(e){this.backend=e,this.gl=this.backend.gl,this.enabled={},this.parameters={},this.currentFlipSided=null,this.currentCullFace=null,this.currentProgram=null,this.currentBlendingEnabled=!1,this.currentBlending=null,this.currentBlendSrc=null,this.currentBlendDst=null,this.currentBlendSrcAlpha=null,this.currentBlendDstAlpha=null,this.currentPremultipledAlpha=null,this.currentPolygonOffsetFactor=null,this.currentPolygonOffsetUnits=null,this.currentColorMask=null,this.currentDepthReversed=!1,this.currentDepthFunc=null,this.currentDepthMask=null,this.currentStencilFunc=null,this.currentStencilRef=null,this.currentStencilFuncMask=null,this.currentStencilFail=null,this.currentStencilZFail=null,this.currentStencilZPass=null,this.currentStencilMask=null,this.currentLineWidth=null,this.currentClippingPlanes=0,this.currentVAO=null,this.currentIndex=null,this.currentBoundFramebuffers={},this.currentDrawbuffers=new WeakMap,this.maxTextures=this.gl.getParameter(this.gl.MAX_TEXTURE_IMAGE_UNITS),this.currentTextureSlot=null,this.currentBoundTextures={},this.currentBoundBufferBases={},this._init()}_init(){let e=this.gl;Xw={[oo]:e.FUNC_ADD,[db]:e.FUNC_SUBTRACT,[pb]:e.FUNC_REVERSE_SUBTRACT},Hd={[Nu]:e.ZERO,[mb]:e.ONE,[Ab]:e.SRC_COLOR,[Jp]:e.SRC_ALPHA,[bb]:e.SRC_ALPHA_SATURATE,[xb]:e.DST_COLOR,[vb]:e.DST_ALPHA,[gb]:e.ONE_MINUS_SRC_COLOR,[e0]:e.ONE_MINUS_SRC_ALPHA,[yb]:e.ONE_MINUS_DST_COLOR,[_b]:e.ONE_MINUS_DST_ALPHA};let t=e.getParameter(e.SCISSOR_BOX),n=e.getParameter(e.VIEWPORT);this.currentScissor=new xn().fromArray(t),this.currentViewport=new xn().fromArray(n),this._tempVec4=new xn}enable(e){let{enabled:t}=this;t[e]!==!0&&(this.gl.enable(e),t[e]=!0)}disable(e){let{enabled:t}=this;t[e]!==!1&&(this.gl.disable(e),t[e]=!1)}setFlipSided(e){if(this.currentFlipSided!==e){let{gl:t}=this;e?t.frontFace(t.CW):t.frontFace(t.CCW),this.currentFlipSided=e}}setCullFace(e){let{gl:t}=this;e!==IM?(this.enable(t.CULL_FACE),e!==this.currentCullFace&&(e===hb?t.cullFace(t.BACK):e===LM?t.cullFace(t.FRONT):t.cullFace(t.FRONT_AND_BACK))):this.disable(t.CULL_FACE),this.currentCullFace=e}setLineWidth(e){let{currentLineWidth:t,gl:n}=this;e!==t&&(n.lineWidth(e),this.currentLineWidth=e)}setMRTBlending(e,t,n){let r=this.gl,s=this.backend.drawBuffersIndexedExt;if(!s){ni("WebGPURenderer: Multiple Render Targets (MRT) blending configuration is not fully supported in compatibility mode. The material blending will be used for all render targets.");return}for(let o=0;o<e.length;o++){let a=e[o],l=null;if(t!==null){let c=t.getBlendMode(a.name);c.blending===fb?l=n:c.blending!==ps&&(l=c)}else l=n;l!==null?this._setMRTBlendingIndex(o,l):s.blendFuncSeparateiOES(o,r.ONE,r.ZERO,r.ONE,r.ZERO)}}_setMRTBlendingIndex(e,t){let{gl:n}=this,r=this.backend.drawBuffersIndexedExt,s=t.blending,o=t.blendSrc,a=t.blendDst,l=t.blendEquation,c=t.premultipliedAlpha;if(s===Dd){let u=t.blendSrcAlpha!==null?t.blendSrcAlpha:o,f=t.blendDstAlpha!==null?t.blendDstAlpha:a,d=t.blendEquationAlpha!==null?t.blendEquationAlpha:l;r.blendEquationSeparateiOES(e,Xw[l],Xw[d]),r.blendFuncSeparateiOES(e,Hd[o],Hd[a],Hd[u],Hd[f])}else if(r.blendEquationSeparateiOES(e,n.FUNC_ADD,n.FUNC_ADD),c)switch(s){case Ts:r.blendFuncSeparateiOES(e,n.ONE,n.ONE_MINUS_SRC_ALPHA,n.ONE,n.ONE_MINUS_SRC_ALPHA);break;case Dh:r.blendFuncSeparateiOES(e,n.ONE,n.ONE,n.ONE,n.ONE);break;case Nh:r.blendFuncSeparateiOES(e,n.ZERO,n.ONE_MINUS_SRC_COLOR,n.ZERO,n.ONE);break;case Fh:r.blendFuncSeparateiOES(e,n.DST_COLOR,n.ONE_MINUS_SRC_ALPHA,n.ZERO,n.ONE);break;default:r.blendFuncSeparateiOES(e,n.ONE,n.ONE_MINUS_SRC_ALPHA,n.ONE,n.ONE_MINUS_SRC_ALPHA);break}else switch(s){case Ts:r.blendFuncSeparateiOES(e,n.SRC_ALPHA,n.ONE_MINUS_SRC_ALPHA,n.ONE,n.ONE_MINUS_SRC_ALPHA);break;case Dh:r.blendFuncSeparateiOES(e,n.SRC_ALPHA,n.ONE,n.ONE,n.ONE);break;case Nh:r.blendFuncSeparateiOES(e,n.ZERO,n.ONE_MINUS_SRC_COLOR,n.ZERO,n.ONE);break;case Fh:r.blendFuncSeparateiOES(e,n.DST_COLOR,n.ONE_MINUS_SRC_ALPHA,n.ZERO,n.ONE);break;default:r.blendFuncSeparateiOES(e,n.SRC_ALPHA,n.ONE_MINUS_SRC_ALPHA,n.ONE,n.ONE_MINUS_SRC_ALPHA);break}}setBlending(e,t,n,r,s,o,a,l){let{gl:c}=this;if(e===ps){this.currentBlendingEnabled===!0&&(this.disable(c.BLEND),this.currentBlendingEnabled=!1);return}if(this.currentBlendingEnabled===!1&&(this.enable(c.BLEND),this.currentBlendingEnabled=!0),e!==Dd){if(e!==this.currentBlending||l!==this.currentPremultipledAlpha){if((this.currentBlendEquation!==oo||this.currentBlendEquationAlpha!==oo)&&(c.blendEquation(c.FUNC_ADD),this.currentBlendEquation=oo,this.currentBlendEquationAlpha=oo),l)switch(e){case Ts:c.blendFuncSeparate(c.ONE,c.ONE_MINUS_SRC_ALPHA,c.ONE,c.ONE_MINUS_SRC_ALPHA);break;case Dh:c.blendFunc(c.ONE,c.ONE);break;case Nh:c.blendFuncSeparate(c.ZERO,c.ONE_MINUS_SRC_COLOR,c.ZERO,c.ONE);break;case Fh:c.blendFuncSeparate(c.DST_COLOR,c.ONE_MINUS_SRC_ALPHA,c.ZERO,c.ONE);break;default:ze("WebGLState: Invalid blending: ",e);break}else switch(e){case Ts:c.blendFuncSeparate(c.SRC_ALPHA,c.ONE_MINUS_SRC_ALPHA,c.ONE,c.ONE_MINUS_SRC_ALPHA);break;case Dh:c.blendFuncSeparate(c.SRC_ALPHA,c.ONE,c.ONE,c.ONE);break;case Nh:ze("WebGLState: SubtractiveBlending requires material.premultipliedAlpha = true");break;case Fh:ze("WebGLState: MultiplyBlending requires material.premultipliedAlpha = true");break;default:ze("WebGLState: Invalid blending: ",e);break}this.currentBlendSrc=null,this.currentBlendDst=null,this.currentBlendSrcAlpha=null,this.currentBlendDstAlpha=null,this.currentBlending=e,this.currentPremultipledAlpha=l}return}s=s||t,o=o||n,a=a||r,(t!==this.currentBlendEquation||s!==this.currentBlendEquationAlpha)&&(c.blendEquationSeparate(Xw[t],Xw[s]),this.currentBlendEquation=t,this.currentBlendEquationAlpha=s),(n!==this.currentBlendSrc||r!==this.currentBlendDst||o!==this.currentBlendSrcAlpha||a!==this.currentBlendDstAlpha)&&(c.blendFuncSeparate(Hd[n],Hd[r],Hd[o],Hd[a]),this.currentBlendSrc=n,this.currentBlendDst=r,this.currentBlendSrcAlpha=o,this.currentBlendDstAlpha=a),this.currentBlending=e,this.currentPremultipledAlpha=!1}setColorMask(e){this.currentColorMask!==e&&(this.gl.colorMask(e,e,e,e),this.currentColorMask=e)}setDepthTest(e){let{gl:t}=this;e?this.enable(t.DEPTH_TEST):this.disable(t.DEPTH_TEST)}setReversedDepth(e){if(this.currentDepthReversed!==e){let t=this.backend.extensions.get("EXT_clip_control");e?t.clipControlEXT(t.LOWER_LEFT_EXT,t.ZERO_TO_ONE_EXT):t.clipControlEXT(t.LOWER_LEFT_EXT,t.NEGATIVE_ONE_TO_ONE_EXT),this.currentDepthReversed=e}}setDepthMask(e){this.currentDepthMask!==e&&(this.gl.depthMask(e),this.currentDepthMask=e)}setDepthFunc(e){if(this.currentDepthReversed&&(e=Ob[e]),this.currentDepthFunc!==e){let{gl:t}=this;switch(e){case LA:t.depthFunc(t.NEVER);break;case DA:t.depthFunc(t.ALWAYS);break;case NA:t.depthFunc(t.LESS);break;case Ch:t.depthFunc(t.LEQUAL);break;case FA:t.depthFunc(t.EQUAL);break;case BA:t.depthFunc(t.GEQUAL);break;case OA:t.depthFunc(t.GREATER);break;case UA:t.depthFunc(t.NOTEQUAL);break;default:t.depthFunc(t.LEQUAL)}this.currentDepthFunc=e}}scissor(e,t,n,r){let s=this._tempVec4.set(e,t,n,r);if(this.currentScissor.equals(s)===!1){let{gl:o}=this;o.scissor(s.x,s.y,s.z,s.w),this.currentScissor.copy(s)}}viewport(e,t,n,r){let s=this._tempVec4.set(e,t,n,r);if(this.currentViewport.equals(s)===!1){let{gl:o}=this;o.viewport(s.x,s.y,s.z,s.w),this.currentViewport.copy(s)}}setScissorTest(e){let t=this.gl;e?this.enable(t.SCISSOR_TEST):this.disable(t.SCISSOR_TEST)}setStencilTest(e){let{gl:t}=this;e?this.enable(t.STENCIL_TEST):this.disable(t.STENCIL_TEST)}setStencilMask(e){this.currentStencilMask!==e&&(this.gl.stencilMask(e),this.currentStencilMask=e)}setStencilFunc(e,t,n){(this.currentStencilFunc!==e||this.currentStencilRef!==t||this.currentStencilFuncMask!==n)&&(this.gl.stencilFunc(e,t,n),this.currentStencilFunc=e,this.currentStencilRef=t,this.currentStencilFuncMask=n)}setStencilOp(e,t,n){(this.currentStencilFail!==e||this.currentStencilZFail!==t||this.currentStencilZPass!==n)&&(this.gl.stencilOp(e,t,n),this.currentStencilFail=e,this.currentStencilZFail=t,this.currentStencilZPass=n)}setMaterial(e,t,n){let{gl:r}=this;e.side===vr?this.disable(r.CULL_FACE):this.enable(r.CULL_FACE);let s=e.side===mi;t&&(s=!s),this.setFlipSided(s),e.blending===Ts&&e.transparent===!1?this.setBlending(ps):this.setBlending(e.blending,e.blendEquation,e.blendSrc,e.blendDst,e.blendEquationAlpha,e.blendSrcAlpha,e.blendDstAlpha,e.premultipliedAlpha),this.setDepthFunc(e.depthFunc),this.setDepthTest(e.depthTest),this.setDepthMask(e.depthWrite),this.setColorMask(e.colorWrite);let o=e.stencilWrite;if(this.setStencilTest(o),o&&(this.setStencilMask(e.stencilWriteMask),this.setStencilFunc(e.stencilFunc,e.stencilRef,e.stencilFuncMask),this.setStencilOp(e.stencilFail,e.stencilZFail,e.stencilZPass)),this.setPolygonOffset(e.polygonOffset,e.polygonOffsetFactor,e.polygonOffsetUnits),e.alphaToCoverage===!0&&this.backend.renderer.currentSamples>0?this.enable(r.SAMPLE_ALPHA_TO_COVERAGE):this.disable(r.SAMPLE_ALPHA_TO_COVERAGE),n>0&&this.currentClippingPlanes!==n)for(let l=0;l<8;l++)l<n?this.enable(12288+l):this.disable(12288+l)}setPolygonOffset(e,t,n){let{gl:r}=this;e?(this.enable(r.POLYGON_OFFSET_FILL),(this.currentPolygonOffsetFactor!==t||this.currentPolygonOffsetUnits!==n)&&(r.polygonOffset(t,n),this.currentPolygonOffsetFactor=t,this.currentPolygonOffsetUnits=n)):this.disable(r.POLYGON_OFFSET_FILL)}useProgram(e){return this.currentProgram!==e?(this.gl.useProgram(e),this.currentProgram=e,!0):!1}setVertexState(e,t=null){let n=this.gl;return this.currentVAO!==e||this.currentIndex!==t?(n.bindVertexArray(e),t!==null&&n.bindBuffer(n.ELEMENT_ARRAY_BUFFER,t),this.currentVAO=e,this.currentIndex=t,!0):!1}resetVertexState(){let e=this.gl;e.bindVertexArray(null),e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,null),this.currentVAO=null,this.currentIndex=null}bindFramebuffer(e,t){let{gl:n,currentBoundFramebuffers:r}=this;return r[e]!==t?(n.bindFramebuffer(e,t),r[e]=t,e===n.DRAW_FRAMEBUFFER&&(r[n.FRAMEBUFFER]=t),e===n.FRAMEBUFFER&&(r[n.DRAW_FRAMEBUFFER]=t),!0):!1}drawBuffers(e,t){let{gl:n}=this,r=[],s=!1;if(e.textures!==null){r=this.currentDrawbuffers.get(t),r===void 0&&(r=[],this.currentDrawbuffers.set(t,r));let o=e.textures;if(r.length!==o.length||r[0]!==n.COLOR_ATTACHMENT0){for(let a=0,l=o.length;a<l;a++)r[a]=n.COLOR_ATTACHMENT0+a;r.length=o.length,s=!0}}else r[0]!==n.BACK&&(r[0]=n.BACK,s=!0);s&&n.drawBuffers(r)}activeTexture(e){let{gl:t,currentTextureSlot:n,maxTextures:r}=this;e===void 0&&(e=t.TEXTURE0+r-1),n!==e&&(t.activeTexture(e),this.currentTextureSlot=e)}bindTexture(e,t,n){let{gl:r,currentTextureSlot:s,currentBoundTextures:o,maxTextures:a}=this;n===void 0&&(s===null?n=r.TEXTURE0+a-1:n=s);let l=o[n];l===void 0&&(l={type:void 0,texture:void 0},o[n]=l),(l.type!==e||l.texture!==t)&&(s!==n&&(r.activeTexture(n),this.currentTextureSlot=n),r.bindTexture(e,t),l.type=e,l.texture=t)}bindBufferBase(e,t,n){let{gl:r}=this,s=`${e}-${t}`;return this.currentBoundBufferBases[s]!==n?(r.bindBufferBase(e,t,n),this.currentBoundBufferBases[s]=n,!0):!1}unbindTexture(){let{gl:e,currentTextureSlot:t,currentBoundTextures:n}=this,r=n[t];r!==void 0&&r.type!==void 0&&(e.bindTexture(r.type,null),r.type=void 0,r.texture=void 0)}getParameter(e){let{gl:t,parameters:n}=this;return n[e]!==void 0?n[e]:t.getParameter(e)}pixelStorei(e,t){let{gl:n,parameters:r}=this;r[e]!==t&&(n.pixelStorei(e,t),r[e]=t)}},E9=class{constructor(e){this.backend=e,this.gl=this.backend.gl,this.extensions=e.extensions}convert(e,t=ha){let{gl:n,extensions:r}=this,s,o=ln.getTransfer(t);if(e===Ji)return n.UNSIGNED_BYTE;if(e===ng)return n.UNSIGNED_SHORT_4_4_4_4;if(e===ig)return n.UNSIGNED_SHORT_5_5_5_1;if(e===rg)return n.UNSIGNED_INT_5_9_9_9_REV;if(e===sg)return n.UNSIGNED_INT_10F_11F_11F_REV;if(e===Oh)return n.BYTE;if(e===Uh)return n.SHORT;if(e===wl)return n.UNSIGNED_SHORT;if(e===Kr)return n.INT;if(e===xi)return n.UNSIGNED_INT;if(e===cr)return n.FLOAT;if(e===Wi)return n.HALF_FLOAT;if(e===u_)return n.ALPHA;if(e===Nd)return n.RGB;if(e===Or)return n.RGBA;if(e===Vs)return n.DEPTH_COMPONENT;if(e===xo)return n.DEPTH_STENCIL;if(e===Fd)return n.RED;if(e===kh)return n.RED_INTEGER;if(e===Ws)return n.RG;if(e===zh)return n.RG_INTEGER;if(e===g0)return n.RGBA_INTEGER;if(e===Vh||e===Gh||e===qh||e===Hh)if(o===kt)if(s=r.get("WEBGL_compressed_texture_s3tc_srgb"),s!==null){if(e===Vh)return s.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(e===Gh)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(e===qh)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(e===Hh)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(s=r.get("WEBGL_compressed_texture_s3tc"),s!==null){if(e===Vh)return s.COMPRESSED_RGB_S3TC_DXT1_EXT;if(e===Gh)return s.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(e===qh)return s.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(e===Hh)return s.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(e===og||e===ag||e===lg||e===cg)if(s=r.get("WEBGL_compressed_texture_pvrtc"),s!==null){if(e===og)return s.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(e===ag)return s.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(e===lg)return s.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(e===cg)return s.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(e===v0||e===_0||e===x0||e===y0||e===b0||e===Wh||e===w0)if(s=r.get("WEBGL_compressed_texture_etc"),s!==null){if(e===v0||e===_0)return o===kt?s.COMPRESSED_SRGB8_ETC2:s.COMPRESSED_RGB8_ETC2;if(e===x0)return o===kt?s.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:s.COMPRESSED_RGBA8_ETC2_EAC;if(e===y0)return s.COMPRESSED_R11_EAC;if(e===b0)return s.COMPRESSED_SIGNED_R11_EAC;if(e===Wh)return s.COMPRESSED_RG11_EAC;if(e===w0)return s.COMPRESSED_SIGNED_RG11_EAC}else return null;if(e===S0||e===T0||e===E0||e===M0||e===C0||e===R0||e===P0||e===I0||e===L0||e===D0||e===N0||e===F0||e===B0||e===O0)if(s=r.get("WEBGL_compressed_texture_astc"),s!==null){if(e===S0)return o===kt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:s.COMPRESSED_RGBA_ASTC_4x4_KHR;if(e===T0)return o===kt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:s.COMPRESSED_RGBA_ASTC_5x4_KHR;if(e===E0)return o===kt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:s.COMPRESSED_RGBA_ASTC_5x5_KHR;if(e===M0)return o===kt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:s.COMPRESSED_RGBA_ASTC_6x5_KHR;if(e===C0)return o===kt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:s.COMPRESSED_RGBA_ASTC_6x6_KHR;if(e===R0)return o===kt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:s.COMPRESSED_RGBA_ASTC_8x5_KHR;if(e===P0)return o===kt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:s.COMPRESSED_RGBA_ASTC_8x6_KHR;if(e===I0)return o===kt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:s.COMPRESSED_RGBA_ASTC_8x8_KHR;if(e===L0)return o===kt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:s.COMPRESSED_RGBA_ASTC_10x5_KHR;if(e===D0)return o===kt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:s.COMPRESSED_RGBA_ASTC_10x6_KHR;if(e===N0)return o===kt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:s.COMPRESSED_RGBA_ASTC_10x8_KHR;if(e===F0)return o===kt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:s.COMPRESSED_RGBA_ASTC_10x10_KHR;if(e===B0)return o===kt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:s.COMPRESSED_RGBA_ASTC_12x10_KHR;if(e===O0)return o===kt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:s.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(e===U0||e===k0||e===z0)if(s=r.get("EXT_texture_compression_bptc"),s!==null){if(e===U0)return o===kt?s.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:s.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(e===k0)return s.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(e===z0)return s.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}else return null;if(e===V0||e===G0||e===jh||e===q0)if(s=r.get("EXT_texture_compression_rgtc"),s!==null){if(e===V0)return s.COMPRESSED_RED_RGTC1_EXT;if(e===G0)return s.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(e===jh)return s.COMPRESSED_RED_GREEN_RGTC2_EXT;if(e===q0)return s.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return e===ua?n.UNSIGNED_INT_24_8:n[e]!==void 0?n[e]:null}_clientWaitAsync(){let{gl:e}=this,t=e.fenceSync(e.SYNC_GPU_COMMANDS_COMPLETE,0);return e.flush(),new Promise((n,r)=>{function s(){let o=e.clientWaitSync(t,e.SYNC_FLUSH_COMMANDS_BIT,0);if(o===e.WAIT_FAILED){e.deleteSync(t),r();return}if(o===e.TIMEOUT_EXPIRED){requestAnimationFrame(s);return}e.deleteSync(t),n()}s()})}},Wte=!1,UR,dU,jte,M9=class{constructor(e){this.backend=e,this.gl=e.gl,this.extensions=e.extensions,this.defaultTextures={},this._srcFramebuffer=null,this._dstFramebuffer=null,Wte===!1&&(this._init(),Wte=!0)}_init(){let e=this.gl;UR={[Ed]:e.REPEAT,[la]:e.CLAMP_TO_EDGE,[Md]:e.MIRRORED_REPEAT},dU={[Ti]:e.NEAREST,[Pb]:e.NEAREST_MIPMAP_NEAREST,[qc]:e.NEAREST_MIPMAP_LINEAR,[Mi]:e.LINEAR,[A0]:e.LINEAR_MIPMAP_NEAREST,[Go]:e.LINEAR_MIPMAP_LINEAR},jte={[Db]:e.NEVER,[Bb]:e.ALWAYS,[h_]:e.LESS,[Xh]:e.LEQUAL,[Nb]:e.EQUAL,[Fu]:e.GEQUAL,[ug]:e.GREATER,[Fb]:e.NOTEQUAL}}getGLTextureType(e){let{gl:t}=this,n;return e.isCubeTexture===!0?n=t.TEXTURE_CUBE_MAP:e.isArrayTexture===!0||e.isDataArrayTexture===!0||e.isCompressedArrayTexture===!0?n=t.TEXTURE_2D_ARRAY:e.isData3DTexture===!0?n=t.TEXTURE_3D:n=t.TEXTURE_2D,n}getInternalFormat(e,t,n,r,s,o=!1){let{gl:a,extensions:l}=this;if(e!==null){if(a[e]!==void 0)return a[e];Xe("WebGLBackend: Attempt to use non-existing WebGL internal format '"+e+"'")}let c=null;r&&(c=l.get("EXT_texture_norm16"),c||Xe("WebGLRenderer: Unable to use normalized textures without EXT_texture_norm16 extension"));let u=t;if(t===a.RED&&(n===a.FLOAT&&(u=a.R32F),n===a.HALF_FLOAT&&(u=a.R16F),n===a.UNSIGNED_BYTE&&(u=a.R8),n===a.BYTE&&(u=a.R8_SNORM),n===a.UNSIGNED_SHORT&&c&&(u=c.R16_EXT),n===a.SHORT&&c&&(u=c.R16_SNORM_EXT)),t===a.RED_INTEGER&&(n===a.UNSIGNED_BYTE&&(u=a.R8UI),n===a.UNSIGNED_SHORT&&(u=a.R16UI),n===a.UNSIGNED_INT&&(u=a.R32UI),n===a.BYTE&&(u=a.R8I),n===a.SHORT&&(u=a.R16I),n===a.INT&&(u=a.R32I)),t===a.RG&&(n===a.FLOAT&&(u=a.RG32F),n===a.HALF_FLOAT&&(u=a.RG16F),n===a.UNSIGNED_BYTE&&(u=a.RG8),n===a.BYTE&&(u=a.RG8_SNORM),n===a.UNSIGNED_SHORT&&c&&(u=c.RG16_EXT),n===a.SHORT&&c&&(u=c.RG16_SNORM_EXT)),t===a.RG_INTEGER&&(n===a.UNSIGNED_BYTE&&(u=a.RG8UI),n===a.UNSIGNED_SHORT&&(u=a.RG16UI),n===a.UNSIGNED_INT&&(u=a.RG32UI),n===a.BYTE&&(u=a.RG8I),n===a.SHORT&&(u=a.RG16I),n===a.INT&&(u=a.RG32I)),t===a.RGB){let f=o?n0:ln.getTransfer(s);n===a.FLOAT&&(u=a.RGB32F),n===a.HALF_FLOAT&&(u=a.RGB16F),n===a.UNSIGNED_BYTE&&(u=f===kt?a.SRGB8:a.RGB8),n===a.BYTE&&(u=a.RGB8_SNORM),n===a.UNSIGNED_SHORT&&c&&(u=c.RGB16_EXT),n===a.SHORT&&c&&(u=c.RGB16_SNORM_EXT),n===a.UNSIGNED_SHORT_5_6_5&&(u=a.RGB565),n===a.UNSIGNED_SHORT_5_5_5_1&&(u=a.RGB5_A1),n===a.UNSIGNED_SHORT_4_4_4_4&&(u=a.RGB4),n===a.UNSIGNED_INT_5_9_9_9_REV&&(u=a.RGB9_E5),n===a.UNSIGNED_INT_10F_11F_11F_REV&&(u=a.R11F_G11F_B10F)}if(t===a.RGB_INTEGER&&(n===a.UNSIGNED_BYTE&&(u=a.RGB8UI),n===a.UNSIGNED_SHORT&&(u=a.RGB16UI),n===a.UNSIGNED_INT&&(u=a.RGB32UI),n===a.BYTE&&(u=a.RGB8I),n===a.SHORT&&(u=a.RGB16I),n===a.INT&&(u=a.RGB32I)),t===a.RGBA){let f=o?n0:ln.getTransfer(s);n===a.FLOAT&&(u=a.RGBA32F),n===a.HALF_FLOAT&&(u=a.RGBA16F),n===a.UNSIGNED_BYTE&&(u=f===kt?a.SRGB8_ALPHA8:a.RGBA8),n===a.BYTE&&(u=a.RGBA8_SNORM),n===a.UNSIGNED_SHORT&&c&&(u=c.RGBA16_EXT),n===a.SHORT&&c&&(u=c.RGBA16_SNORM_EXT),n===a.UNSIGNED_SHORT_4_4_4_4&&(u=a.RGBA4),n===a.UNSIGNED_SHORT_5_5_5_1&&(u=a.RGB5_A1)}return t===a.RGBA_INTEGER&&(n===a.UNSIGNED_BYTE&&(u=a.RGBA8UI),n===a.UNSIGNED_SHORT&&(u=a.RGBA16UI),n===a.UNSIGNED_INT&&(u=a.RGBA32UI),n===a.BYTE&&(u=a.RGBA8I),n===a.SHORT&&(u=a.RGBA16I),n===a.INT&&(u=a.RGBA32I)),t===a.DEPTH_COMPONENT&&(n===a.UNSIGNED_SHORT&&(u=a.DEPTH_COMPONENT16),n===a.UNSIGNED_INT&&(u=a.DEPTH_COMPONENT24),n===a.FLOAT&&(u=a.DEPTH_COMPONENT32F)),t===a.DEPTH_STENCIL&&n===a.UNSIGNED_INT_24_8&&(u=a.DEPTH24_STENCIL8),(u===a.R16F||u===a.R32F||u===a.RG16F||u===a.RG32F||u===a.RGBA16F||u===a.RGBA32F)&&l.get("EXT_color_buffer_float"),u}setTextureParameters(e,t){let{gl:n,extensions:r,backend:s}=this,{state:o}=this.backend,a=ln.getPrimaries(ln.workingColorSpace),l=t.colorSpace===ha?null:ln.getPrimaries(t.colorSpace),c=t.colorSpace===ha||a===l?n.NONE:n.BROWSER_DEFAULT_WEBGL;o.pixelStorei(n.UNPACK_FLIP_Y_WEBGL,t.flipY),o.pixelStorei(n.UNPACK_PREMULTIPLY_ALPHA_WEBGL,t.premultiplyAlpha),o.pixelStorei(n.UNPACK_ALIGNMENT,t.unpackAlignment),o.pixelStorei(n.UNPACK_COLORSPACE_CONVERSION_WEBGL,c),n.texParameteri(e,n.TEXTURE_WRAP_S,UR[t.wrapS]),n.texParameteri(e,n.TEXTURE_WRAP_T,UR[t.wrapT]),(e===n.TEXTURE_3D||e===n.TEXTURE_2D_ARRAY)&&(t.isArrayTexture||n.texParameteri(e,n.TEXTURE_WRAP_R,UR[t.wrapR])),n.texParameteri(e,n.TEXTURE_MAG_FILTER,dU[t.magFilter]);let u=t.mipmaps!==void 0&&t.mipmaps.length>0,f=t.minFilter===Mi&&u?Go:t.minFilter;if(n.texParameteri(e,n.TEXTURE_MIN_FILTER,dU[f]),t.compareFunction&&(n.texParameteri(e,n.TEXTURE_COMPARE_MODE,n.COMPARE_REF_TO_TEXTURE),n.texParameteri(e,n.TEXTURE_COMPARE_FUNC,jte[t.compareFunction])),r.has("EXT_texture_filter_anisotropic")===!0){if(t.magFilter===Ti||t.minFilter!==qc&&t.minFilter!==Go||t.type===cr&&r.has("OES_texture_float_linear")===!1)return;if(t.anisotropy>1){let d=r.get("EXT_texture_filter_anisotropic");n.texParameterf(e,d.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(t.anisotropy,s.capabilities.getMaxAnisotropy()))}}}createDefaultTexture(e){let{gl:t,backend:n,defaultTextures:r}=this,s=this.getGLTextureType(e),o=r[s];o===void 0&&(o=t.createTexture(),n.state.bindTexture(s,o),t.texParameteri(s,t.TEXTURE_MIN_FILTER,t.NEAREST),t.texParameteri(s,t.TEXTURE_MAG_FILTER,t.NEAREST),r[s]=o),n.set(e,{textureGPU:o,glTextureType:s})}createTexture(e,t){let{gl:n,backend:r}=this,s,o,a,l,c;if(e.isExternalTexture===!0)s=e.sourceTexture,o=this.getGLTextureType(e);else{let{levels:u,width:f,height:d,depth:A}=t;a=r.utils.convert(e.format,e.colorSpace),l=r.utils.convert(e.type),c=this.getInternalFormat(e.internalFormat,a,l,e.normalized,e.colorSpace,e.isVideoTexture),s=n.createTexture(),o=this.getGLTextureType(e),r.state.bindTexture(o,s),this.setTextureParameters(o,e),e.isArrayTexture||e.isDataArrayTexture||e.isCompressedArrayTexture?n.texStorage3D(n.TEXTURE_2D_ARRAY,u,c,f,d,A):e.isData3DTexture?n.texStorage3D(n.TEXTURE_3D,u,c,f,d,A):e.isVideoTexture||n.texStorage2D(o,u,c,f,d)}r.set(e,{textureGPU:s,glTextureType:o,glFormat:a,glType:l,glInternalFormat:c})}copyBufferToTexture(e,t){let{gl:n,backend:r}=this,{state:s}=r,{textureGPU:o,glTextureType:a,glFormat:l,glType:c}=r.get(t),{width:u,height:f}=t.source.data;n.bindBuffer(n.PIXEL_UNPACK_BUFFER,e),r.state.bindTexture(a,o),s.pixelStorei(n.UNPACK_FLIP_Y_WEBGL,!1),s.pixelStorei(n.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1),n.texSubImage2D(a,0,0,0,u,f,l,c,0),n.bindBuffer(n.PIXEL_UNPACK_BUFFER,null),r.state.unbindTexture()}updateTexture(e,t){let{gl:n}=this,{width:r,height:s}=t,{textureGPU:o,glTextureType:a,glFormat:l,glType:c,glInternalFormat:u}=this.backend.get(e);if(!(e.isRenderTargetTexture||o===void 0))if(this.backend.state.bindTexture(a,o),this.setTextureParameters(a,e),e.isCompressedTexture){let f=e.mipmaps,d=t.image;for(let A=0;A<f.length;A++){let y=f[A];e.isCompressedArrayTexture?e.format!==n.RGBA?l!==null?n.compressedTexSubImage3D(n.TEXTURE_2D_ARRAY,A,0,0,0,y.width,y.height,d.depth,l,y.data):Xe("WebGLBackend: Attempt to load unsupported compressed texture format in .uploadTexture()"):n.texSubImage3D(n.TEXTURE_2D_ARRAY,A,0,0,0,y.width,y.height,d.depth,l,c,y.data):l!==null?n.compressedTexSubImage2D(n.TEXTURE_2D,A,0,0,y.width,y.height,l,y.data):Xe("WebGLBackend: Unsupported compressed texture format")}}else if(e.isCubeTexture){let f=t.images,d=e.mipmaps;for(let A=0;A<6;A++){let y=kR(f[A]);n.texSubImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+A,0,0,0,r,s,l,c,y);for(let w=0;w<d.length;w++){let S=d[w],T=kR(S.images[A]);n.texSubImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+A,w+1,0,0,T.width,T.height,l,c,T)}}}else if(e.isDataArrayTexture||e.isArrayTexture){let f=t.image;if(e.layerUpdates.size>0){let d=Ub(f.width,f.height,e.format,e.type);for(let A of e.layerUpdates){let y=f.data.subarray(A*d/f.data.BYTES_PER_ELEMENT,(A+1)*d/f.data.BYTES_PER_ELEMENT);n.texSubImage3D(n.TEXTURE_2D_ARRAY,0,0,0,A,f.width,f.height,1,l,c,y)}e.clearLayerUpdates()}else n.texSubImage3D(n.TEXTURE_2D_ARRAY,0,0,0,0,f.width,f.height,f.depth,l,c,f.data)}else if(e.isData3DTexture){let f=t.image;n.texSubImage3D(n.TEXTURE_3D,0,0,0,0,f.width,f.height,f.depth,l,c,f.data)}else if(e.isVideoTexture)e.update(),n.texImage2D(a,0,u,l,c,t.image);else if(e.isHTMLTexture)typeof n.texElementImage2D=="function"&&(n.texElementImage2D.length===3?n.texElementImage2D(n.TEXTURE_2D,n.RGBA8,t.image):n.texElementImage2D(n.TEXTURE_2D,0,n.RGBA,n.RGBA,n.UNSIGNED_BYTE,t.image));else{let f=e.mipmaps;if(f.length>0)for(let d=0,A=f.length;d<A;d++){let y=f[d],w=kR(y);n.texSubImage2D(a,d,0,0,y.width,y.height,l,c,w)}else{let d=kR(t.image);n.texSubImage2D(a,0,0,0,r,s,l,c,d)}}}generateMipmaps(e){let{gl:t,backend:n}=this,{textureGPU:r,glTextureType:s}=n.get(e);n.state.bindTexture(s,r),t.generateMipmap(s)}deallocateRenderBuffers(e){let{gl:t,backend:n}=this;if(e){let r=n.get(e);if(r.renderBufferStorageSetup=void 0,r.framebuffers){for(let s in r.framebuffers)t.deleteFramebuffer(r.framebuffers[s]);delete r.framebuffers}if(r.depthRenderbuffer&&(t.deleteRenderbuffer(r.depthRenderbuffer),delete r.depthRenderbuffer),r.stencilRenderbuffer&&(t.deleteRenderbuffer(r.stencilRenderbuffer),delete r.stencilRenderbuffer),r.msaaFrameBuffer&&(t.deleteFramebuffer(r.msaaFrameBuffer),delete r.msaaFrameBuffer),r.msaaRenderbuffers){for(let s=0;s<r.msaaRenderbuffers.length;s++)t.deleteRenderbuffer(r.msaaRenderbuffers[s]);delete r.msaaRenderbuffers}}}destroyTexture(e,t=!1){let{gl:n,backend:r}=this,{textureGPU:s,renderTarget:o}=r.get(e);this.deallocateRenderBuffers(o),t===!1&&e.isExternalTexture!==!0&&n.deleteTexture(s),r.delete(e)}copyTextureToTexture(e,t,n=null,r=null,s=0,o=0){let{gl:a,backend:l}=this,{state:c}=this.backend,{textureGPU:u,glTextureType:f,glType:d,glFormat:A}=l.get(t);c.bindTexture(f,u);let y,w,S,T,R,I,P,F,D,L=e.isCompressedTexture?e.mipmaps[o]:e.image;if(n!==null)y=n.max.x-n.min.x,w=n.max.y-n.min.y,S=n.isBox3?n.max.z-n.min.z:1,T=n.min.x,R=n.min.y,I=n.isBox3?n.min.z:0;else{let H=Math.pow(2,-s);y=Math.floor(L.width*H),w=Math.floor(L.height*H),e.isDataArrayTexture||e.isArrayTexture?S=L.depth:e.isData3DTexture?S=Math.floor(L.depth*H):S=1,T=0,R=0,I=0}r!==null?(P=r.x,F=r.y,D=r.z):(P=0,F=0,D=0),c.pixelStorei(a.UNPACK_FLIP_Y_WEBGL,t.flipY),c.pixelStorei(a.UNPACK_PREMULTIPLY_ALPHA_WEBGL,t.premultiplyAlpha),c.pixelStorei(a.UNPACK_ALIGNMENT,t.unpackAlignment);let C=c.getParameter(a.UNPACK_ROW_LENGTH),B=c.getParameter(a.UNPACK_IMAGE_HEIGHT),k=c.getParameter(a.UNPACK_SKIP_PIXELS),z=c.getParameter(a.UNPACK_SKIP_ROWS),G=c.getParameter(a.UNPACK_SKIP_IMAGES);c.pixelStorei(a.UNPACK_ROW_LENGTH,L.width),c.pixelStorei(a.UNPACK_IMAGE_HEIGHT,L.height),c.pixelStorei(a.UNPACK_SKIP_PIXELS,T),c.pixelStorei(a.UNPACK_SKIP_ROWS,R),c.pixelStorei(a.UNPACK_SKIP_IMAGES,I);let W=e.isDataArrayTexture||e.isData3DTexture||t.isArrayTexture,Y=t.isDataArrayTexture||t.isData3DTexture||t.isArrayTexture;if(e.isDepthTexture){let H=l.get(e),$=l.get(t),J=l.get(H.renderTarget),te=l.get($.renderTarget),ce=J.framebuffers[H.cacheKey],he=te.framebuffers[$.cacheKey],ve=c.currentBoundFramebuffers[a.READ_FRAMEBUFFER]??null,Re=c.currentBoundFramebuffers[a.DRAW_FRAMEBUFFER]??null;c.bindFramebuffer(a.READ_FRAMEBUFFER,ce),c.bindFramebuffer(a.DRAW_FRAMEBUFFER,he);for(let Qe=0;Qe<S;Qe++)W&&(a.framebufferTextureLayer(a.READ_FRAMEBUFFER,a.COLOR_ATTACHMENT0,H.textureGPU,s,I+Qe),a.framebufferTextureLayer(a.DRAW_FRAMEBUFFER,a.COLOR_ATTACHMENT0,u,o,D+Qe)),a.blitFramebuffer(T,R,y,w,P,F,y,w,a.DEPTH_BUFFER_BIT,a.NEAREST);c.bindFramebuffer(a.READ_FRAMEBUFFER,ve),c.bindFramebuffer(a.DRAW_FRAMEBUFFER,Re)}else if(s!==0||e.isRenderTargetTexture||l.has(e)){let H=l.get(e);this._srcFramebuffer===null&&(this._srcFramebuffer=a.createFramebuffer()),this._dstFramebuffer===null&&(this._dstFramebuffer=a.createFramebuffer());let $=c.currentBoundFramebuffers[a.READ_FRAMEBUFFER]??null,J=c.currentBoundFramebuffers[a.DRAW_FRAMEBUFFER]??null;c.bindFramebuffer(a.READ_FRAMEBUFFER,this._srcFramebuffer),c.bindFramebuffer(a.DRAW_FRAMEBUFFER,this._dstFramebuffer);for(let te=0;te<S;te++)W?a.framebufferTextureLayer(a.READ_FRAMEBUFFER,a.COLOR_ATTACHMENT0,H.textureGPU,s,I+te):a.framebufferTexture2D(a.READ_FRAMEBUFFER,a.COLOR_ATTACHMENT0,a.TEXTURE_2D,H.textureGPU,s),Y?a.framebufferTextureLayer(a.DRAW_FRAMEBUFFER,a.COLOR_ATTACHMENT0,u,o,D+te):a.framebufferTexture2D(a.DRAW_FRAMEBUFFER,a.COLOR_ATTACHMENT0,a.TEXTURE_2D,u,o),s!==0?a.blitFramebuffer(T,R,y,w,P,F,y,w,a.COLOR_BUFFER_BIT,a.NEAREST):Y?a.copyTexSubImage3D(f,o,P,F,D+te,T,R,y,w):a.copyTexSubImage2D(f,o,P,F,T,R,y,w);c.bindFramebuffer(a.READ_FRAMEBUFFER,$),c.bindFramebuffer(a.DRAW_FRAMEBUFFER,J)}else Y?e.isDataTexture||e.isData3DTexture?a.texSubImage3D(f,o,P,F,D,y,w,S,A,d,L.data):t.isCompressedArrayTexture?a.compressedTexSubImage3D(f,o,P,F,D,y,w,S,A,L.data):a.texSubImage3D(f,o,P,F,D,y,w,S,A,d,L):e.isDataTexture?a.texSubImage2D(a.TEXTURE_2D,o,P,F,y,w,A,d,L.data):e.isCompressedTexture?a.compressedTexSubImage2D(a.TEXTURE_2D,o,P,F,L.width,L.height,A,L.data):a.texSubImage2D(a.TEXTURE_2D,o,P,F,y,w,A,d,L);c.pixelStorei(a.UNPACK_ROW_LENGTH,C),c.pixelStorei(a.UNPACK_IMAGE_HEIGHT,B),c.pixelStorei(a.UNPACK_SKIP_PIXELS,k),c.pixelStorei(a.UNPACK_SKIP_ROWS,z),c.pixelStorei(a.UNPACK_SKIP_IMAGES,G),o===0&&t.generateMipmaps&&a.generateMipmap(f),c.unbindTexture()}copyFramebufferToTexture(e,t,n){let{gl:r}=this,{state:s}=this.backend,{textureGPU:o}=this.backend.get(e),{x:a,y:l,z:c,w:u}=n,f=e.isDepthTexture===!0||t.renderTarget&&t.renderTarget.samples>0,d=t.renderTarget?t.renderTarget.height:this.backend.getDrawingBufferSize().y;if(f){let A=a!==0||l!==0,y,w;if(e.isDepthTexture===!0?(y=r.DEPTH_BUFFER_BIT,w=r.DEPTH_ATTACHMENT,t.stencil&&(y|=r.STENCIL_BUFFER_BIT)):(y=r.COLOR_BUFFER_BIT,w=r.COLOR_ATTACHMENT0),A){let S=this.backend.get(t.renderTarget),T=S.framebuffers[t.getCacheKey()],R=S.msaaFrameBuffer;s.bindFramebuffer(r.DRAW_FRAMEBUFFER,T),s.bindFramebuffer(r.READ_FRAMEBUFFER,R);let I=d-l-u;r.blitFramebuffer(a,I,a+c,I+u,a,I,a+c,I+u,y,r.NEAREST),s.bindFramebuffer(r.READ_FRAMEBUFFER,T),s.bindTexture(r.TEXTURE_2D,o),r.copyTexSubImage2D(r.TEXTURE_2D,0,0,0,a,I,c,u),s.unbindTexture()}else{let S=r.createFramebuffer();s.bindFramebuffer(r.DRAW_FRAMEBUFFER,S),r.framebufferTexture2D(r.DRAW_FRAMEBUFFER,w,r.TEXTURE_2D,o,0),r.blitFramebuffer(0,0,c,u,0,0,c,u,y,r.NEAREST),r.deleteFramebuffer(S)}}else s.bindTexture(r.TEXTURE_2D,o),r.copyTexSubImage2D(r.TEXTURE_2D,0,0,0,a,d-u-l,c,u),s.unbindTexture();e.generateMipmaps&&this.generateMipmaps(e),this.backend._setFramebuffer(t)}setupRenderBufferStorage(e,t,n,r=!1){let{gl:s}=this,o=t.renderTarget,{depthTexture:a,depthBuffer:l,stencilBuffer:c,width:u,height:f}=o;if(s.bindRenderbuffer(s.RENDERBUFFER,e),l&&!c){let d=s.DEPTH_COMPONENT24;r===!0?this.extensions.get("WEBGL_multisampled_render_to_texture").renderbufferStorageMultisampleEXT(s.RENDERBUFFER,o.samples,d,u,f):n>0?(a&&a.isDepthTexture&&a.type===s.FLOAT&&(d=s.DEPTH_COMPONENT32F),s.renderbufferStorageMultisample(s.RENDERBUFFER,n,d,u,f)):s.renderbufferStorage(s.RENDERBUFFER,d,u,f),s.framebufferRenderbuffer(s.FRAMEBUFFER,s.DEPTH_ATTACHMENT,s.RENDERBUFFER,e)}else l&&c&&(n>0?s.renderbufferStorageMultisample(s.RENDERBUFFER,n,s.DEPTH24_STENCIL8,u,f):s.renderbufferStorage(s.RENDERBUFFER,s.DEPTH_STENCIL,u,f),s.framebufferRenderbuffer(s.FRAMEBUFFER,s.DEPTH_STENCIL_ATTACHMENT,s.RENDERBUFFER,e));s.bindRenderbuffer(s.RENDERBUFFER,null)}async copyTextureToBuffer(e,t,n,r,s,o){let{backend:a,gl:l}=this,{textureGPU:c,glFormat:u,glType:f}=this.backend.get(e),d=l.createFramebuffer();a.state.bindFramebuffer(l.READ_FRAMEBUFFER,d);let A=e.isCubeTexture?l.TEXTURE_CUBE_MAP_POSITIVE_X+o:l.TEXTURE_2D;l.framebufferTexture2D(l.READ_FRAMEBUFFER,l.COLOR_ATTACHMENT0,A,c,0);let y=this._getTypedArrayType(f),w=this._getBytesPerTexel(f,u),T=r*s*w,R=l.createBuffer();l.bindBuffer(l.PIXEL_PACK_BUFFER,R),l.bufferData(l.PIXEL_PACK_BUFFER,T,l.STREAM_READ),l.readPixels(t,n,r,s,u,f,0),l.bindBuffer(l.PIXEL_PACK_BUFFER,null),await a.utils._clientWaitAsync();let I=new y(T/y.BYTES_PER_ELEMENT);return l.bindBuffer(l.PIXEL_PACK_BUFFER,R),l.getBufferSubData(l.PIXEL_PACK_BUFFER,0,I),l.bindBuffer(l.PIXEL_PACK_BUFFER,null),a.state.bindFramebuffer(l.READ_FRAMEBUFFER,null),l.deleteFramebuffer(d),I}_getTypedArrayType(e){let{gl:t}=this;if(e===t.UNSIGNED_BYTE)return Uint8Array;if(e===t.UNSIGNED_SHORT_4_4_4_4||e===t.UNSIGNED_SHORT_5_5_5_1||e===t.UNSIGNED_SHORT_5_6_5||e===t.UNSIGNED_SHORT)return Uint16Array;if(e===t.UNSIGNED_INT)return Uint32Array;if(e===t.HALF_FLOAT)return Uint16Array;if(e===t.FLOAT)return Float32Array;throw new Error(`THREE.WebGLTextureUtils: Unsupported WebGL type: ${e}`)}_getBytesPerTexel(e,t){let{gl:n}=this,r=0;if(e===n.UNSIGNED_BYTE&&(r=1),(e===n.UNSIGNED_SHORT_4_4_4_4||e===n.UNSIGNED_SHORT_5_5_5_1||e===n.UNSIGNED_SHORT_5_6_5||e===n.UNSIGNED_SHORT||e===n.HALF_FLOAT)&&(r=2),(e===n.UNSIGNED_INT||e===n.FLOAT)&&(r=4),t===n.RGBA)return r*4;if(t===n.RGB)return r*3;if(t===n.ALPHA)return r}dispose(){let{gl:e}=this;this._srcFramebuffer!==null&&e.deleteFramebuffer(this._srcFramebuffer),this._dstFramebuffer!==null&&e.deleteFramebuffer(this._dstFramebuffer)}};function kR(i){return i.isDataTexture?i.image.data:typeof HTMLImageElement<"u"&&i instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&i instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&i instanceof ImageBitmap||typeof OffscreenCanvas<"u"&&i instanceof OffscreenCanvas?i:i.data}var C9=class{constructor(e){this.backend=e,this.gl=this.backend.gl,this.availableExtensions=this.gl.getSupportedExtensions(),this.extensions={}}get(e){let t=this.extensions[e];return t===void 0&&(t=this.gl.getExtension(e),this.extensions[e]=t),t}has(e){return this.availableExtensions.includes(e)}},R9=class{constructor(e){this.backend=e,this.maxAnisotropy=null,this.maxUniformBlockSize=null}getMaxAnisotropy(){if(this.maxAnisotropy!==null)return this.maxAnisotropy;let e=this.backend.gl,t=this.backend.extensions;if(t.has("EXT_texture_filter_anisotropic")===!0){let n=t.get("EXT_texture_filter_anisotropic");this.maxAnisotropy=e.getParameter(n.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else this.maxAnisotropy=0;return this.maxAnisotropy}getUniformBufferLimit(){if(this.maxUniformBlockSize!==null)return this.maxUniformBlockSize;let e=this.backend.gl;return this.maxUniformBlockSize=e.getParameter(e.MAX_UNIFORM_BLOCK_SIZE),this.maxUniformBlockSize}},Xte={WEBGL_multi_draw:"WEBGL_multi_draw",WEBGL_compressed_texture_astc:"texture-compression-astc",WEBGL_compressed_texture_etc:"texture-compression-etc2",WEBGL_compressed_texture_etc1:"texture-compression-etc1",WEBGL_compressed_texture_pvrtc:"texture-compression-pvrtc",WEBGL_compressed_texture_s3tc:"texture-compression-s3tc",EXT_texture_compression_bptc:"texture-compression-bc",EXT_disjoint_timer_query_webgl2:"timestamp-query",OVR_multiview2:"OVR_multiview2"},P9=class{constructor(e){this.gl=e.gl,this.extensions=e.extensions,this.info=e.renderer.info,this.mode=null,this.index=0,this.type=null,this.object=null}render(e,t){let{gl:n,mode:r,object:s,type:o,info:a,index:l}=this;l!==0?n.drawElements(r,t,o,e):n.drawArrays(r,e,t),a.update(s,t,1)}renderInstances(e,t,n){let{gl:r,mode:s,type:o,index:a,object:l,info:c}=this;n!==0&&(a!==0?r.drawElementsInstanced(s,t,o,e,n):r.drawArraysInstanced(s,e,t,n),c.update(l,t,n))}renderMultiDraw(e,t,n){let{extensions:r,mode:s,object:o,info:a}=this;if(n===0)return;let l=r.get("WEBGL_multi_draw");if(l===null)for(let c=0;c<n;c++)this.render(e[c],t[c]);else{this.index!==0?l.multiDrawElementsWEBGL(s,t,0,this.type,e,0,n):l.multiDrawArraysWEBGL(s,e,0,t,0,n);let c=0;for(let u=0;u<n;u++)c+=t[u];a.update(o,c,1)}}},rP=class{constructor(e=256){this.trackTimestamp=!0,this.maxQueries=e,this.currentQueryIndex=0,this.queryOffsets=new Map,this.isDisposed=!1,this.lastValue=0,this.frames=[],this.pendingResolve=!1,this.timestamps=new Map}getTimestampFrames(){return this.frames}getTimestamp(e){let t=this.timestamps.get(e);return t===void 0&&(Xe(`TimestampQueryPool: No timestamp available for uid ${e}.`),t=0),t}hasTimestampQuery(e){return this.timestamps.has(e)}allocateQueriesForContext(){}async resolveQueriesAsync(){}dispose(){}},I9=class extends rP{constructor(e,t,n=2048){if(super(n),this.gl=e,this.type=t,this.ext=e.getExtension("EXT_disjoint_timer_query_webgl2")||e.getExtension("EXT_disjoint_timer_query"),!this.ext){Xe("EXT_disjoint_timer_query not supported; timestamps will be disabled."),this.trackTimestamp=!1;return}this.queries=[];for(let r=0;r<this.maxQueries;r++)this.queries.push(e.createQuery());this.activeQuery=null,this.queryStates=new Map}allocateQueriesForContext(e){if(!this.trackTimestamp)return null;if(this.currentQueryIndex+2>this.maxQueries)return ni(`WebGLTimestampQueryPool [${this.type}]: Maximum number of queries exceeded, when using trackTimestamp it is necessary to resolves the queries via renderer.resolveTimestampsAsync( THREE.TimestampQuery.${this.type.toUpperCase()} ).`),null;let t=this.currentQueryIndex;return this.currentQueryIndex+=2,this.queryStates.set(t,"inactive"),this.queryOffsets.set(e,t),t}beginQuery(e){if(!this.trackTimestamp||this.isDisposed)return;let t=this.queryOffsets.get(e);if(t==null||this.activeQuery!==null)return;let n=this.queries[t];if(n)try{this.queryStates.get(t)==="inactive"&&(this.gl.beginQuery(this.ext.TIME_ELAPSED_EXT,n),this.activeQuery=t,this.queryStates.set(t,"started"))}catch(r){ze("Error in beginQuery:",r),this.activeQuery=null,this.queryStates.set(t,"inactive")}}endQuery(e){if(!this.trackTimestamp||this.isDisposed)return;let t=this.queryOffsets.get(e);if(t!=null&&this.activeQuery===t)try{this.gl.endQuery(this.ext.TIME_ELAPSED_EXT),this.queryStates.set(t,"ended"),this.activeQuery=null}catch(n){ze("Error in endQuery:",n),this.queryStates.set(t,"inactive"),this.activeQuery=null}}async resolveQueriesAsync(){if(!this.trackTimestamp||this.pendingResolve)return this.lastValue;this.pendingResolve=!0;try{let e=new Map;for(let[s,o]of this.queryOffsets)if(this.queryStates.get(o)==="ended"){let l=this.queries[o];e.set(s,this.resolveQuery(l))}if(e.size===0)return this.lastValue;let t={},n=[];for(let[s,o]of e){let a=s.match(/^(.*):f(\d+)$/),l=parseInt(a[2]);n.includes(l)===!1&&n.push(l),t[l]===void 0&&(t[l]=0);let c=await o;this.timestamps.set(s,c),t[l]+=c}let r=t[n[n.length-1]];return this.lastValue=r,this.frames=n,this.currentQueryIndex=0,this.queryOffsets.clear(),this.queryStates.clear(),this.activeQuery=null,r}catch(e){return ze("Error resolving queries:",e),this.lastValue}finally{this.pendingResolve=!1}}async resolveQuery(e){return new Promise(t=>{if(this.isDisposed){t(this.lastValue);return}let n,r=!1,s=()=>{n&&(clearTimeout(n),n=null)},o=l=>{r||(r=!0,s(),t(l))},a=()=>{if(this.isDisposed){o(this.lastValue);return}try{if(this.gl.getParameter(this.ext.GPU_DISJOINT_EXT)){o(this.lastValue);return}if(!this.gl.getQueryParameter(e,this.gl.QUERY_RESULT_AVAILABLE)){n=setTimeout(a,1);return}let u=this.gl.getQueryParameter(e,this.gl.QUERY_RESULT);t(Number(u)/1e6)}catch(l){ze("Error checking query:",l),t(this.lastValue)}};a()})}dispose(){if(!this.isDisposed&&(this.isDisposed=!0,!!this.trackTimestamp)){for(let e of this.queries)this.gl.deleteQuery(e);this.queries=[],this.queryStates.clear(),this.queryOffsets.clear(),this.lastValue=0,this.activeQuery=null}}},sP=class extends iP{constructor(e={}){super(e),this.isWebGLBackend=!0,this.attributeUtils=null,this.extensions=null,this.capabilities=null,this.textureUtils=null,this.bufferRenderer=null,this.gl=null,this.state=null,this.utils=null,this.vaoCache={},this.transformFeedbackCache={},this.discard=!1,this.disjoint=null,this.parallel=null,this._currentContext=null,this._knownBindings=new WeakSet,this._supportsInvalidateFramebuffer=typeof navigator>"u"?!1:/OculusBrowser/g.test(navigator.userAgent),this._xrFramebuffer=null}init(e){super.init(e);let t=this.parameters,n={antialias:e.currentSamples>0,alpha:!0,depth:e.depth,stencil:e.stencil},r=t.context!==void 0?t.context:e.domElement.getContext("webgl2",n);function s(o){o.preventDefault();let a={api:"WebGL",message:o.statusMessage||"Unknown reason",reason:null,originalEvent:o};e.onDeviceLost(a)}this._onContextLost=s,e.domElement.addEventListener("webglcontextlost",s,!1),this.gl=r,this.extensions=new C9(this),this.capabilities=new R9(this),this.attributeUtils=new S9(this),this.textureUtils=new M9(this),this.bufferRenderer=new P9(this),this.state=new T9(this),this.utils=new E9(this),this.extensions.get("EXT_color_buffer_float"),this.extensions.get("WEBGL_clip_cull_distance"),this.extensions.get("OES_texture_float_linear"),this.extensions.get("EXT_color_buffer_half_float"),this.extensions.get("WEBGL_multisampled_render_to_texture"),this.extensions.get("WEBGL_render_shared_exponent"),this.extensions.get("WEBGL_multi_draw"),this.extensions.get("OVR_multiview2"),this.extensions.get("EXT_clip_control"),this.disjoint=this.extensions.get("EXT_disjoint_timer_query_webgl2"),this.parallel=this.extensions.get("KHR_parallel_shader_compile"),this.drawBuffersIndexedExt=this.extensions.get("OES_draw_buffers_indexed"),t.reversedDepthBuffer&&(this.extensions.has("EXT_clip_control")?e.reversedDepthBuffer=!0:(Xe("WebGPURenderer: Unable to use reversed depth buffer due to missing EXT_clip_control extension. Fallback to default depth buffer."),e.reversedDepthBuffer=!1)),e.reversedDepthBuffer&&this.state.setReversedDepth(!0)}get coordinateSystem(){return ko}get hasTimestamp(){return this.disjoint!==null}async getArrayBufferAsync(e,t=null,n=0,r=-1){return await this.attributeUtils.getArrayBufferAsync(e,t,n,r)}async makeXRCompatible(){this.gl.getContextAttributes().xrCompatible!==!0&&await this.gl.makeXRCompatible()}setXRTarget(e){this._xrFramebuffer=e}setXRRenderTargetTextures(e,t,n=null){let r=this.gl;if(this.set(e.texture,{textureGPU:t,glInternalFormat:r.RGBA8}),n!==null){let s=e.stencilBuffer?r.DEPTH24_STENCIL8:r.DEPTH_COMPONENT24;this.set(e.depthTexture,{textureGPU:n,glInternalFormat:s}),this.extensions.has("WEBGL_multisampled_render_to_texture")===!0&&e._autoAllocateDepthBuffer===!0&&e.multiview===!1&&Xe("WebGLBackend: Render-to-texture extension was disabled because an external texture was provided"),e._autoAllocateDepthBuffer=!1}}initTimestampQuery(e,t){if(!this.disjoint||!this.trackTimestamp)return;this.timestampQueryPool[e]||(this.timestampQueryPool[e]=new I9(this.gl,e,2048));let n=this.timestampQueryPool[e];n.allocateQueriesForContext(t)!==null&&n.beginQuery(t)}prepareTimestampBuffer(e,t){if(!this.disjoint||!this.trackTimestamp)return;this.timestampQueryPool[e].endQuery(t)}getContext(){return this.gl}beginRender(e){let{state:t}=this,n=this.get(e);if(e.viewport)this.updateViewport(e);else{let{width:s,height:o}=this.getDrawingBufferSize();t.viewport(0,0,s,o)}if(e.scissor)this.updateScissor(e);else{let{width:s,height:o}=this.getDrawingBufferSize();t.scissor(0,0,s,o)}this.initTimestampQuery(Hc.RENDER,this.getTimestampUID(e)),n.previousContext=this._currentContext,this._currentContext=e,this._setFramebuffer(e),this.clear(e.clearColor,e.clearDepth,e.clearStencil,e,!1);let r=e.occlusionQueryCount;r>0&&(n.currentOcclusionQueries=n.occlusionQueries,n.currentOcclusionQueryObjects=n.occlusionQueryObjects,n.lastOcclusionObject=null,n.occlusionQueries=new Array(r),n.occlusionQueryObjects=new Array(r),n.occlusionQueryIndex=0)}finishRender(e){let{gl:t,state:n}=this,r=this.get(e),s=r.previousContext;n.resetVertexState();let o=e.occlusionQueryCount;o>0&&(o>r.occlusionQueryIndex&&t.endQuery(t.ANY_SAMPLES_PASSED),this.resolveOccludedAsync(e));let a=e.textures;if(a!==null)for(let l=0;l<a.length;l++){let c=a[l];c.generateMipmaps&&this.generateMipmaps(c)}if(this._currentContext=s,this._resolveRenderTarget(e),s!==null){if(this._setFramebuffer(s),s.viewport)this.updateViewport(s);else{let{width:l,height:c}=this.getDrawingBufferSize();n.viewport(0,0,l,c)}if(s.scissor)this.updateScissor(s);else{let{width:l,height:c}=this.getDrawingBufferSize();n.scissor(0,0,l,c)}}this.prepareTimestampBuffer(Hc.RENDER,this.getTimestampUID(e))}resolveOccludedAsync(e){let t=this.get(e),{currentOcclusionQueries:n,currentOcclusionQueryObjects:r}=t;if(n&&r){let s=new WeakSet,{gl:o}=this;t.currentOcclusionQueryObjects=null,t.currentOcclusionQueries=null;let a=()=>{let l=0;for(let c=0;c<n.length;c++){let u=n[c];u!==null&&o.getQueryParameter(u,o.QUERY_RESULT_AVAILABLE)&&(o.getQueryParameter(u,o.QUERY_RESULT)===0&&s.add(r[c]),n[c]=null,o.deleteQuery(u),l++)}l<n.length?requestAnimationFrame(a):t.occluded=s};a()}}isOccluded(e,t){let n=this.get(e);return n.occluded&&n.occluded.has(t)}updateViewport(e){let{state:t}=this,{x:n,y:r,width:s,height:o}=e.viewportValue;t.viewport(n,e.height-o-r,s,o)}updateScissor(e){let{state:t}=this,{x:n,y:r,width:s,height:o}=e.scissorValue;t.scissor(n,e.height-o-r,s,o)}setScissorTest(e){this.state.setScissorTest(e)}getClearColor(){let e=super.getClearColor();return e.r*=e.a,e.g*=e.a,e.b*=e.a,e}clear(e,t,n,r=null,s=!0,o=!0){let{gl:a,renderer:l}=this;r===null&&(r={textures:null,clearColorValue:this.getClearColor()});let c=0;if(e&&(c|=a.COLOR_BUFFER_BIT),t&&(c|=a.DEPTH_BUFFER_BIT),n&&(c|=a.STENCIL_BUFFER_BIT),c!==0){let u;r.clearColorValue?u=r.clearColorValue:u=this.getClearColor();let f=l.getClearDepth(),d=l.getClearStencil();if(t&&this.state.setDepthMask(!0),r.textures===null)a.clearColor(u.r,u.g,u.b,u.a),a.clear(c);else{if(s&&this._setFramebuffer(r),e)for(let A=0;A<r.textures.length;A++)A===0?a.clearBufferfv(a.COLOR,A,[u.r,u.g,u.b,u.a]):a.clearBufferfv(a.COLOR,A,[0,0,0,1]);t&&n?a.clearBufferfi(a.DEPTH_STENCIL,0,f,d):t?a.clearBufferfv(a.DEPTH,0,[f]):n&&a.clearBufferiv(a.STENCIL,0,[d]),s&&o&&this._resolveRenderTarget(r),s&&this._currentContext!==null&&this._currentContext!==r&&this._setFramebuffer(this._currentContext)}}}beginCompute(e){let{state:t,gl:n}=this;t.bindFramebuffer(n.FRAMEBUFFER,null),this.initTimestampQuery(Hc.COMPUTE,this.getTimestampUID(e))}compute(e,t,n,r,s=null){let{state:o,gl:a}=this;this.discard===!1&&(o.enable(a.RASTERIZER_DISCARD),this.discard=!0);let{programGPU:l,transformBuffers:c,attributes:u}=this.get(r),f=this._getVaoKey(u),d=this.vaoCache[f];d===void 0?this.vaoCache[f]=this._createVao(u):o.setVertexState(d),o.useProgram(l),this._bindUniforms(n);let A=this._getTransformFeedback(c);a.bindTransformFeedback(a.TRANSFORM_FEEDBACK,A),a.beginTransformFeedback(a.POINTS),s=s!==null?s:t.count,Array.isArray(s)?(ni("WebGLBackend.compute(): The count parameter must be a single number, not an array."),s=s[0]):s&&typeof s=="object"&&s.isIndirectStorageBufferAttribute&&(ni("WebGLBackend.compute(): The count parameter must be a single number, not IndirectStorageBufferAttribute"),s=t.count),u[0].isStorageInstancedBufferAttribute?a.drawArraysInstanced(a.POINTS,0,1,s):a.drawArrays(a.POINTS,0,s),a.endTransformFeedback(),a.bindTransformFeedback(a.TRANSFORM_FEEDBACK,null);for(let y=0;y<c.length;y++){let w=c[y];w.pbo&&this.has(w.pbo)&&this.textureUtils.copyBufferToTexture(w.transformBuffer,w.pbo),w.switchBuffers()}}finishCompute(e){let{state:t,gl:n}=this;this.discard=!1,t.disable(n.RASTERIZER_DISCARD),this.prepareTimestampBuffer(Hc.COMPUTE,this.getTimestampUID(e)),this._currentContext&&this._setFramebuffer(this._currentContext)}_isRenderCameraDepthArray(e){return e.depthTexture&&e.depthTexture.isArrayTexture&&e.camera.isArrayCamera}_draw(e,t,n,r,s,o){if(e.isBatchedMesh)if(this.hasFeature("WEBGL_multi_draw")===!1){let{gl:a}=this,l=a.getUniformLocation(o,"nodeUniformDrawId"),c=e._multiDrawStarts,u=e._multiDrawCounts,f=e._multiDrawCount;for(let d=0;d<f;d++)a.uniform1ui(l,d),t.render(c[d],u[d])}else t.renderMultiDraw(e._multiDrawStarts,e._multiDrawCounts,e._multiDrawCount);else s>1?t.renderInstances(n,r,s):t.render(n,r)}draw(e){let{object:t,pipeline:n,material:r,context:s,hardwareClippingPlanes:o}=e,{programGPU:a}=this.get(n),{gl:l,state:c}=this,u=this.get(s),f=e.getDrawParameters();if(f===null)return;this._bindUniforms(e.getBindings());let d=t.isMesh&&t.matrixWorld.determinantAffine()<0;c.setMaterial(r,d,o),s.mrt!==null&&s.textures!==null&&c.setMRTBlending(s.textures,s.mrt,r),c.useProgram(a);let A=e.getAttributes(),y=this.get(A),w=y.vaoGPU;if(w===void 0){let L=this._getVaoKey(A);w=this.vaoCache[L],w===void 0&&(w=this._createVao(A),this.vaoCache[L]=w,y.vaoGPU=w)}let S=e.getIndex(),T=S!==null?this.get(S).bufferGPU:null;c.setVertexState(w,T);let R=u.lastOcclusionObject;if(R!==t&&R!==void 0){if(R!==null&&R.occlusionTest===!0&&(l.endQuery(l.ANY_SAMPLES_PASSED),u.occlusionQueryIndex++),t.occlusionTest===!0){let L=l.createQuery();l.beginQuery(l.ANY_SAMPLES_PASSED,L),u.occlusionQueries[u.occlusionQueryIndex]=L,u.occlusionQueryObjects[u.occlusionQueryIndex]=t}u.lastOcclusionObject=t}let I=this.bufferRenderer;t.isPoints?I.mode=l.POINTS:t.isLineSegments?I.mode=l.LINES:t.isLine?I.mode=l.LINE_STRIP:t.isLineLoop?I.mode=l.LINE_LOOP:r.wireframe===!0?(c.setLineWidth(r.wireframeLinewidth*this.renderer.getPixelRatio()),I.mode=l.LINES):I.mode=l.TRIANGLES;let{vertexCount:P,instanceCount:F}=f,{firstVertex:D}=f;if(I.object=t,S!==null){D*=S.array.BYTES_PER_ELEMENT;let L=this.get(S);I.index=S.count,I.type=L.type}else I.index=0;if(e.camera.isArrayCamera===!0&&e.camera.cameras.length>0&&e.camera.isMultiViewCamera===!1){let L=this.get(e.camera),C=e.camera.cameras,B=e.getBindingGroup("cameraIndex").bindings[0];if(L.indexesGPU===void 0||L.indexesGPU.length!==C.length){let H=new Uint32Array([0,0,0,0]),$=[];for(let J=0,te=C.length;J<te;J++){let ce=l.createBuffer();H[0]=J,l.bindBuffer(l.UNIFORM_BUFFER,ce),l.bufferData(l.UNIFORM_BUFFER,H,l.STATIC_DRAW),$.push(ce)}L.indexesGPU=$}let k=0;e:for(let H of e.getBindings())for(let $ of H.bindings){if($===B)break e;($.isUniformsGroup||$.isUniformBuffer)&&k++}let z=this.renderer.getPixelRatio(),G=this._currentContext.renderTarget,W=this._isRenderCameraDepthArray(this._currentContext),Y=this._currentContext.activeCubeFace;if(W){let H=this.get(G.depthTexture);if(H.clearedRenderId!==this.renderer._nodes.nodeFrame.renderId){H.clearedRenderId=this.renderer._nodes.nodeFrame.renderId;let{stencilBuffer:$}=G;for(let J=0,te=C.length;J<te;J++)this.renderer._activeCubeFace=J,this._currentContext.activeCubeFace=J,this._setFramebuffer(this._currentContext),this.clear(!1,!0,$,this._currentContext,!1,!1);this.renderer._activeCubeFace=Y,this._currentContext.activeCubeFace=Y}}for(let H=0,$=C.length;H<$;H++){let J=C[H];if(t.layers.test(J.layers)){W&&(this.renderer._activeCubeFace=H,this._currentContext.activeCubeFace=H,this._setFramebuffer(this._currentContext));let te=J.viewport;if(te!==void 0){let ce=te.x*z,he=te.y*z,ve=te.width*z,Re=te.height*z;c.viewport(Math.floor(ce),Math.floor(e.context.height-Re-he),Math.floor(ve),Math.floor(Re))}c.bindBufferBase(l.UNIFORM_BUFFER,k,L.indexesGPU[H]),this._draw(t,I,D,P,F,a)}this._currentContext.activeCubeFace=Y,this.renderer._activeCubeFace=Y}}else this._draw(t,I,D,P,F,a)}needsRenderUpdate(){return!1}getRenderCacheKey(){return""}createDefaultTexture(e){this.textureUtils.createDefaultTexture(e)}createTexture(e,t){this.textureUtils.createTexture(e,t)}updateTexture(e,t){this.textureUtils.updateTexture(e,t)}generateMipmaps(e){this.textureUtils.generateMipmaps(e)}destroyTexture(e,t=!1){this.textureUtils.destroyTexture(e,t)}async copyTextureToBuffer(e,t,n,r,s,o){return this.textureUtils.copyTextureToBuffer(e,t,n,r,s,o)}updateSampler(){return""}createNodeBuilder(e,t){return new b9(e,t)}createProgram(e){let t=this.gl,{stage:n,code:r}=e,s=n==="fragment"?t.createShader(t.FRAGMENT_SHADER):t.createShader(t.VERTEX_SHADER);t.shaderSource(s,r),t.compileShader(s),this.set(e,{shaderGPU:s})}destroyProgram(e){this.delete(e)}createRenderPipeline(e,t){let n=this.gl,r=e.pipeline,{fragmentProgram:s,vertexProgram:o}=r,a=n.createProgram(),l=this.get(s).shaderGPU,c=this.get(o).shaderGPU;if(n.attachShader(a,l),n.attachShader(a,c),n.linkProgram(a),this.set(r,{programGPU:a,fragmentShader:l,vertexShader:c}),t!==null&&this.parallel){let u=new Promise(f=>{let d=this.parallel,A=()=>{n.getProgramParameter(a,d.COMPLETION_STATUS_KHR)?(this._completeCompile(e,r),f()):requestAnimationFrame(A)};A()});t.push(u);return}this._completeCompile(e,r)}_handleSource(e,t){let n=e.split(`43594359 `),r=[],s=Math.max(t-6,0),o=Math.min(t+6,n.length);for(let a=s;a<o;a++){let l=a+1;r.push(`${l===t?">":" "} ${l}: ${n[a]}`)}return r.join(`43604360 `)}_getShaderErrors(e,t,n){let r=e.getShaderParameter(t,e.COMPILE_STATUS),o=(e.getShaderInfoLog(t)||"").trim();if(r&&o==="")return"";let a=/ERROR: 0:(\d+)/.exec(o);if(a){let l=parseInt(a[1]);return n.toUpperCase()+`43614361 @@ -4367,7 +4367,7 @@ Program Info Log: `+o+`
43674367 `+a+`43684368 `+l)}else o!==""&&Xe("WebGLProgram: Program Info Log:",o)}}_completeCompile(e,t){let{state:n,gl:r}=this,s=this.get(t),{programGPU:o,fragmentShader:a,vertexShader:l}=s;r.getProgramParameter(o,r.LINK_STATUS)===!1&&this._logProgramError(o,a,l),n.useProgram(o);let c=e.getBindings();this._setupBindings(c,o),this.set(t,{programGPU:o,pipeline:o})}createComputePipeline(e,t){let{state:n,gl:r}=this,s={stage:"fragment",code:`#version 300 es43694369 precision highp float;4370-void main() {}`};this.createProgram(s);let{computeProgram:o}=e,a=r.createProgram(),l=this.get(s).shaderGPU,c=this.get(o).shaderGPU,u=o.transforms,f=[],d=[];for(let S=0;S<u.length;S++){let T=u[S];f.push(T.varyingName),d.push(T.attributeNode)}r.attachShader(a,l),r.attachShader(a,c),r.transformFeedbackVaryings(a,f,r.SEPARATE_ATTRIBS),r.linkProgram(a),r.getProgramParameter(a,r.LINK_STATUS)===!1&&this._logProgramError(a,l,c),n.useProgram(a),this._setupBindings(t,a);let A=o.attributes,y=[],w=[];for(let S=0;S<A.length;S++){let T=A[S].node.attribute;y.push(T),this.has(T)||this.attributeUtils.createAttribute(T,r.ARRAY_BUFFER)}for(let S=0;S<d.length;S++){let T=d[S].attribute;this.has(T)||this.attributeUtils.createAttribute(T,r.ARRAY_BUFFER);let R=this.get(T);w.push(R)}this.set(e,{programGPU:a,transformBuffers:w,attributes:y})}createBindings(e,t){if(this._knownBindings.has(t)===!1){this._knownBindings.add(t);let n=0,r=0;for(let s of t){this.set(s,{textures:r,uniformBuffers:n});for(let o of s.bindings)o.isUniformBuffer&&n++,o.isSampledTexture&&r++}}this.updateBindings(e,t)}updateBindings(e){let{gl:t}=this;for(let n of e.bindings){let r=this.get(n);if(n.isUniformsGroup||n.isUniformBuffer){let s=n.buffer,o=r.bufferGPU;t.bindBuffer(t.UNIFORM_BUFFER,o);let a=n.updateRanges;if(t.bindBuffer(t.UNIFORM_BUFFER,o),a.length===0)t.bufferData(t.UNIFORM_BUFFER,s,t.DYNAMIC_DRAW);else{let l=o_(s),c=l?1:s.BYTES_PER_ELEMENT;for(let u=0,f=a.length;u<f;u++){let d=a[u],A=d.start*c,y=d.count*c,w=A*(l?s.BYTES_PER_ELEMENT:1);t.bufferSubData(t.UNIFORM_BUFFER,w,s,A,y)}}this.set(n,r)}else if(n.isSampledTexture){let{textureGPU:s,glTextureType:o}=this.get(n.texture);r.textureGPU=s,r.glTextureType=o,this.set(n,r)}}}updateBinding(e){let t=this.gl;if(e.isUniformsGroup||e.isUniformBuffer){let r=this.get(e).bufferGPU,s=e.buffer,o=e.updateRanges;if(t.bindBuffer(t.UNIFORM_BUFFER,r),o.length===0)t.bufferData(t.UNIFORM_BUFFER,s,t.DYNAMIC_DRAW);else{let a=o_(s),l=a?1:s.BYTES_PER_ELEMENT,c=o[0].start;for(let u=0,f=o.length;u<f;u++){let d=o[u],A=o[u+1],y=d.start+d.count;if(A!==void 0&&A.start===y)continue;let w=c*l,S=(y-c)*l,T=w*(a?s.BYTES_PER_ELEMENT:1);t.bufferSubData(t.UNIFORM_BUFFER,T,s,w,S),A!==void 0&&(c=A.start)}}}}createUniformBuffer(e){let t=this.get(e);if(t.bufferGPU===void 0){let n=this.gl,r=e.buffer;t.bufferGPU=n.createBuffer(),n.bindBuffer(n.UNIFORM_BUFFER,t.bufferGPU),n.bufferData(n.UNIFORM_BUFFER,r.byteLength,n.DYNAMIC_DRAW)}}destroyUniformBuffer(e){let t=this.get(e);this.gl.deleteBuffer(t.bufferGPU),this.delete(e)}createIndexAttribute(e){let t=this.gl;this.attributeUtils.createAttribute(e,t.ELEMENT_ARRAY_BUFFER)}createAttribute(e){if(this.has(e))return;let t=this.gl;this.attributeUtils.createAttribute(e,t.ARRAY_BUFFER)}createStorageAttribute(e){if(this.has(e))return;let t=this.gl;this.attributeUtils.createAttribute(e,t.ARRAY_BUFFER)}updateAttribute(e){this.attributeUtils.updateAttribute(e)}destroyAttribute(e){this.attributeUtils.destroyAttribute(e)}hasFeature(e){let t=Object.keys(bte).filter(r=>bte[r]===e),n=this.extensions;for(let r=0;r<t.length;r++)if(n.has(t[r]))return!0;return!1}copyTextureToTexture(e,t,n=null,r=null,s=0,o=0){this.textureUtils.copyTextureToTexture(e,t,n,r,s,o)}copyFramebufferToTexture(e,t,n){this.textureUtils.copyFramebufferToTexture(e,t,n)}hasCompatibility(e){return e===Dd.TEXTURE_COMPARE?!0:super.hasCompatibility(e)}initRenderTarget(e){let{gl:t,state:n}=this;this._setFramebuffer(e),n.bindFramebuffer(t.FRAMEBUFFER,null)}_setFramebuffer(e){let{gl:t,state:n}=this,r=null;if(e.textures!==null){let s=e.renderTarget,o=this.get(s),{samples:a,depthBuffer:l,stencilBuffer:c}=s,u=s.isCubeRenderTarget===!0,f=s.isRenderTarget3D===!0,d=s.depth>1,A=s.isXRRenderTarget===!0,y=A===!0&&s._hasExternalTextures===!0,w=o.msaaFrameBuffer,S=o.depthRenderbuffer,T=this.extensions.get("WEBGL_multisampled_render_to_texture"),R=this.extensions.get("OVR_multiview2"),P=this._useMultisampledExtension(s),I=Kre(e),F;if(u?(o.cubeFramebuffers||(o.cubeFramebuffers={}),F=o.cubeFramebuffers[I]):A&&y===!1?F=this._xrFramebuffer:(o.framebuffers||(o.framebuffers={}),F=o.framebuffers[I]),F===void 0){F=t.createFramebuffer(),n.bindFramebuffer(t.FRAMEBUFFER,F);let D=e.textures,L=[];if(u){o.cubeFramebuffers[I]=F;let{textureGPU:B}=this.get(D[0]),k=this.renderer._activeCubeFace,z=this.renderer._activeMipmapLevel;t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_CUBE_MAP_POSITIVE_X+k,B,z)}else{o.framebuffers[I]=F;for(let B=0;B<D.length;B++){let k=D[B],z=this.get(k);z.renderTarget=e.renderTarget,z.cacheKey=I;let G=t.COLOR_ATTACHMENT0+B;if(s.multiview)R.framebufferTextureMultisampleMultiviewOVR(t.FRAMEBUFFER,G,z.textureGPU,0,a,0,2);else if(f||d){let W=this.renderer._activeCubeFace,Y=this.renderer._activeMipmapLevel;t.framebufferTextureLayer(t.FRAMEBUFFER,G,z.textureGPU,Y,W)}else if(P)T.framebufferTexture2DMultisampleEXT(t.FRAMEBUFFER,G,t.TEXTURE_2D,z.textureGPU,0,a);else{let W=this.renderer._activeMipmapLevel;t.framebufferTexture2D(t.FRAMEBUFFER,G,t.TEXTURE_2D,z.textureGPU,W)}}}let C=c?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT;if(s._autoAllocateDepthBuffer===!0){let B=t.createRenderbuffer();this.textureUtils.setupRenderBufferStorage(B,e,0,P),o.xrDepthRenderbuffer=B,L.push(c?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT),t.bindRenderbuffer(t.RENDERBUFFER,B),t.framebufferRenderbuffer(t.FRAMEBUFFER,C,t.RENDERBUFFER,B)}else if(e.depthTexture!==null){L.push(c?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT);let B=this.get(e.depthTexture);if(B.renderTarget=e.renderTarget,B.cacheKey=I,s.multiview)R.framebufferTextureMultisampleMultiviewOVR(t.FRAMEBUFFER,C,B.textureGPU,0,a,0,2);else if(y&&P)T.framebufferTexture2DMultisampleEXT(t.FRAMEBUFFER,C,t.TEXTURE_2D,B.textureGPU,0,a);else if(e.depthTexture.isArrayTexture){let k=this.renderer._activeCubeFace;t.framebufferTextureLayer(t.FRAMEBUFFER,C,B.textureGPU,0,k)}else if(e.depthTexture.isCubeTexture){let k=this.renderer._activeCubeFace;t.framebufferTexture2D(t.FRAMEBUFFER,C,t.TEXTURE_CUBE_MAP_POSITIVE_X+k,B.textureGPU,0)}else t.framebufferTexture2D(t.FRAMEBUFFER,C,t.TEXTURE_2D,B.textureGPU,0)}o.depthInvalidationArray=L}else{if(this._isRenderCameraDepthArray(e)){n.bindFramebuffer(t.FRAMEBUFFER,F);let L=this.renderer._activeCubeFace,C=this.get(e.depthTexture),B=c?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT;t.framebufferTextureLayer(t.FRAMEBUFFER,B,C.textureGPU,0,L)}if((A||P||s.multiview)&&s._isOpaqueFramebuffer!==!0){n.bindFramebuffer(t.FRAMEBUFFER,F);let L=this.get(e.textures[0]);s.multiview?R.framebufferTextureMultisampleMultiviewOVR(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,L.textureGPU,0,a,0,2):P?T.framebufferTexture2DMultisampleEXT(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,L.textureGPU,0,a):t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,L.textureGPU,0);let C=c?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT;if(s._autoAllocateDepthBuffer===!0){let B=o.xrDepthRenderbuffer;t.bindRenderbuffer(t.RENDERBUFFER,B),t.framebufferRenderbuffer(t.FRAMEBUFFER,C,t.RENDERBUFFER,B)}else{let B=this.get(e.depthTexture);s.multiview?R.framebufferTextureMultisampleMultiviewOVR(t.FRAMEBUFFER,C,B.textureGPU,0,a,0,2):P?T.framebufferTexture2DMultisampleEXT(t.FRAMEBUFFER,C,t.TEXTURE_2D,B.textureGPU,0,a):t.framebufferTexture2D(t.FRAMEBUFFER,C,t.TEXTURE_2D,B.textureGPU,0)}}}if(a>0&&P===!1&&!s.multiview){if(w===void 0){let D=[];w=t.createFramebuffer(),n.bindFramebuffer(t.FRAMEBUFFER,w);let L=[],C=e.textures;for(let B=0;B<C.length;B++){L[B]=t.createRenderbuffer(),t.bindRenderbuffer(t.RENDERBUFFER,L[B]),D.push(t.COLOR_ATTACHMENT0+B);let k=e.textures[B],z=this.get(k);t.renderbufferStorageMultisample(t.RENDERBUFFER,a,z.glInternalFormat,e.width,e.height),t.framebufferRenderbuffer(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0+B,t.RENDERBUFFER,L[B])}if(t.bindRenderbuffer(t.RENDERBUFFER,null),o.msaaFrameBuffer=w,o.msaaRenderbuffers=L,l&&S===void 0){S=t.createRenderbuffer(),this.textureUtils.setupRenderBufferStorage(S,e,a),o.depthRenderbuffer=S;let B=c?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT;D.push(B)}o.invalidationArray=D}r=o.msaaFrameBuffer}else r=F;n.drawBuffers(e,F)}n.bindFramebuffer(t.FRAMEBUFFER,r)}_getVaoKey(e){let t="";for(let n=0;n<e.length;n++){let r=this.get(e[n]);t+=":"+r.id}return t}_createVao(e){let{gl:t}=this,n=t.createVertexArray();t.bindVertexArray(n);for(let r=0;r<e.length;r++){let s=e[r],o=this.get(s);t.bindBuffer(t.ARRAY_BUFFER,o.bufferGPU),t.enableVertexAttribArray(r);let a,l;s.isInterleavedBufferAttribute===!0?(a=s.data.stride*o.bytesPerElement,l=s.offset*o.bytesPerElement):(a=0,l=0),o.isInteger?t.vertexAttribIPointer(r,s.itemSize,o.type,a,l):t.vertexAttribPointer(r,s.itemSize,o.type,s.normalized,a,l),s.isInstancedBufferAttribute&&!s.isInterleavedBufferAttribute?t.vertexAttribDivisor(r,s.meshPerAttribute):s.isInterleavedBufferAttribute&&s.data.isInstancedInterleavedBuffer&&t.vertexAttribDivisor(r,s.data.meshPerAttribute)}return t.bindBuffer(t.ARRAY_BUFFER,null),n}_getTransformFeedback(e){let t="";for(let s=0;s<e.length;s++)t+=":"+e[s].id;let n=this.transformFeedbackCache[t];if(n!==void 0)return n;let{gl:r}=this;n=r.createTransformFeedback(),r.bindTransformFeedback(r.TRANSFORM_FEEDBACK,n);for(let s=0;s<e.length;s++){let o=e[s];r.bindBufferBase(r.TRANSFORM_FEEDBACK_BUFFER,s,o.transformBuffer)}return r.bindTransformFeedback(r.TRANSFORM_FEEDBACK,null),this.transformFeedbackCache[t]=n,n}_setupBindings(e,t){let n=this.gl,r=0,s=0;for(let o of e)for(let a of o.bindings)if(a.isUniformsGroup||a.isUniformBuffer){let l=r++,c=n.getUniformBlockIndex(t,a.name);n.uniformBlockBinding(t,c,l)}else if(a.isSampledTexture){let l=s++,c=n.getUniformLocation(t,a.name);n.uniform1i(c,l)}}_bindUniforms(e){let{gl:t,state:n}=this,r=0,s=0;for(let o of e)for(let a of o.bindings){let l=this.get(a);if(a.isUniformsGroup||a.isUniformBuffer){let c=r++;n.bindBufferBase(t.UNIFORM_BUFFER,c,l.bufferGPU)}else if(a.isSampledTexture){let c=s++;n.bindTexture(l.glTextureType,l.textureGPU,t.TEXTURE0+c)}}}_resolveRenderTarget(e){let{gl:t,state:n}=this,r=e.renderTarget;if(e.textures!==null&&r){let s=this.get(r);if(r.samples>0&&this._useMultisampledExtension(r)===!1){let o=s.framebuffers[e.getCacheKey()],a=t.COLOR_BUFFER_BIT;r.resolveDepthBuffer&&(r.depthBuffer&&(a|=t.DEPTH_BUFFER_BIT),r.stencilBuffer&&r.resolveStencilBuffer&&(a|=t.STENCIL_BUFFER_BIT));let l=s.msaaFrameBuffer,c=s.msaaRenderbuffers,u=e.textures,f=u.length>1;if(n.bindFramebuffer(t.READ_FRAMEBUFFER,l),n.bindFramebuffer(t.DRAW_FRAMEBUFFER,o),f)for(let d=0;d<u.length;d++)t.framebufferRenderbuffer(t.READ_FRAMEBUFFER,t.COLOR_ATTACHMENT0+d,t.RENDERBUFFER,null),t.framebufferTexture2D(t.DRAW_FRAMEBUFFER,t.COLOR_ATTACHMENT0+d,t.TEXTURE_2D,null,0);for(let d=0;d<u.length;d++){if(f){let{textureGPU:A}=this.get(u[d]);t.framebufferRenderbuffer(t.READ_FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.RENDERBUFFER,c[d]),t.framebufferTexture2D(t.DRAW_FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,A,0)}if(e.scissor){let{x:A,y,width:w,height:S}=e.scissorValue,T=e.height-S-y;t.blitFramebuffer(A,T,A+w,T+S,A,T,A+w,T+S,a,t.NEAREST)}else t.blitFramebuffer(0,0,e.width,e.height,0,0,e.width,e.height,a,t.NEAREST)}if(f)for(let d=0;d<u.length;d++){let{textureGPU:A}=this.get(u[d]);t.framebufferRenderbuffer(t.READ_FRAMEBUFFER,t.COLOR_ATTACHMENT0+d,t.RENDERBUFFER,c[d]),t.framebufferTexture2D(t.DRAW_FRAMEBUFFER,t.COLOR_ATTACHMENT0+d,t.TEXTURE_2D,A,0)}this._supportsInvalidateFramebuffer===!0&&t.invalidateFramebuffer(t.READ_FRAMEBUFFER,s.invalidationArray)}else if(r.resolveDepthBuffer===!1&&s.framebuffers){let o=s.framebuffers[e.getCacheKey()];n.bindFramebuffer(t.DRAW_FRAMEBUFFER,o),t.invalidateFramebuffer(t.DRAW_FRAMEBUFFER,s.depthInvalidationArray)}}}_useMultisampledExtension(e){return e.multiview===!0?!0:e.samples>0&&this.extensions.has("WEBGL_multisampled_render_to_texture")===!0&&e._autoAllocateDepthBuffer!==!1}dispose(){this.textureUtils!==null&&this.textureUtils.dispose();let e=this.extensions.get("WEBGL_lose_context");e&&e.loseContext(),this.renderer.domElement.removeEventListener("webglcontextlost",this._onContextLost)}},Yw={PointList:"point-list",LineList:"line-list",LineStrip:"line-strip",TriangleList:"triangle-list"},yf=typeof self<"u"&&self.GPUShaderStage?self.GPUShaderStage:{VERTEX:1,FRAGMENT:2,COMPUTE:4},Wo={Never:"never",Less:"less",Equal:"equal",LessEqual:"less-equal",Greater:"greater",NotEqual:"not-equal",GreaterEqual:"greater-equal",Always:"always"},Ya={Store:"store"},Fi={Load:"load",Clear:"clear"},wte={CCW:"ccw",CW:"cw"},Ste={None:"none",Back:"back"},Q4={Uint16:"uint16",Uint32:"uint32"},fe={R8Unorm:"r8unorm",R8Snorm:"r8snorm",R8Uint:"r8uint",R8Sint:"r8sint",R16Uint:"r16uint",R16Sint:"r16sint",R16Float:"r16float",RG8Unorm:"rg8unorm",RG8Snorm:"rg8snorm",RG8Uint:"rg8uint",RG8Sint:"rg8sint",R16Unorm:"r16unorm",R16Snorm:"r16snorm",R32Uint:"r32uint",R32Sint:"r32sint",R32Float:"r32float",RG16Uint:"rg16uint",RG16Sint:"rg16sint",RG16Float:"rg16float",RGBA8Unorm:"rgba8unorm",RGBA8UnormSRGB:"rgba8unorm-srgb",RGBA8Snorm:"rgba8snorm",RGBA8Uint:"rgba8uint",RGBA8Sint:"rgba8sint",BGRA8Unorm:"bgra8unorm",BGRA8UnormSRGB:"bgra8unorm-srgb",RG16Unorm:"rg16unorm",RG16Snorm:"rg16snorm",RGB9E5UFloat:"rgb9e5ufloat",RGB10A2Unorm:"rgb10a2unorm",RG11B10UFloat:"rg11b10ufloat",RG32Uint:"rg32uint",RG32Sint:"rg32sint",RG32Float:"rg32float",RGBA16Uint:"rgba16uint",RGBA16Sint:"rgba16sint",RGBA16Float:"rgba16float",RGBA16Unorm:"rgba16unorm",RGBA16Snorm:"rgba16snorm",RGBA32Uint:"rgba32uint",RGBA32Sint:"rgba32sint",RGBA32Float:"rgba32float",Depth16Unorm:"depth16unorm",Depth24Plus:"depth24plus",Depth24PlusStencil8:"depth24plus-stencil8",Depth32Float:"depth32float",Depth32FloatStencil8:"depth32float-stencil8",BC1RGBAUnorm:"bc1-rgba-unorm",BC1RGBAUnormSRGB:"bc1-rgba-unorm-srgb",BC2RGBAUnorm:"bc2-rgba-unorm",BC2RGBAUnormSRGB:"bc2-rgba-unorm-srgb",BC3RGBAUnorm:"bc3-rgba-unorm",BC3RGBAUnormSRGB:"bc3-rgba-unorm-srgb",BC4RUnorm:"bc4-r-unorm",BC4RSnorm:"bc4-r-snorm",BC5RGUnorm:"bc5-rg-unorm",BC5RGSnorm:"bc5-rg-snorm",BC6HRGBUFloat:"bc6h-rgb-ufloat",BC6HRGBFloat:"bc6h-rgb-float",BC7RGBAUnorm:"bc7-rgba-unorm",BC7RGBAUnormSRGB:"bc7-rgba-unorm-srgb",ETC2RGB8Unorm:"etc2-rgb8unorm",ETC2RGB8UnormSRGB:"etc2-rgb8unorm-srgb",ETC2RGB8A1Unorm:"etc2-rgb8a1unorm",ETC2RGB8A1UnormSRGB:"etc2-rgb8a1unorm-srgb",ETC2RGBA8Unorm:"etc2-rgba8unorm",ETC2RGBA8UnormSRGB:"etc2-rgba8unorm-srgb",EACR11Unorm:"eac-r11unorm",EACR11Snorm:"eac-r11snorm",EACRG11Unorm:"eac-rg11unorm",EACRG11Snorm:"eac-rg11snorm",ASTC4x4Unorm:"astc-4x4-unorm",ASTC4x4UnormSRGB:"astc-4x4-unorm-srgb",ASTC5x4Unorm:"astc-5x4-unorm",ASTC5x4UnormSRGB:"astc-5x4-unorm-srgb",ASTC5x5Unorm:"astc-5x5-unorm",ASTC5x5UnormSRGB:"astc-5x5-unorm-srgb",ASTC6x5Unorm:"astc-6x5-unorm",ASTC6x5UnormSRGB:"astc-6x5-unorm-srgb",ASTC6x6Unorm:"astc-6x6-unorm",ASTC6x6UnormSRGB:"astc-6x6-unorm-srgb",ASTC8x5Unorm:"astc-8x5-unorm",ASTC8x5UnormSRGB:"astc-8x5-unorm-srgb",ASTC8x6Unorm:"astc-8x6-unorm",ASTC8x6UnormSRGB:"astc-8x6-unorm-srgb",ASTC8x8Unorm:"astc-8x8-unorm",ASTC8x8UnormSRGB:"astc-8x8-unorm-srgb",ASTC10x5Unorm:"astc-10x5-unorm",ASTC10x5UnormSRGB:"astc-10x5-unorm-srgb",ASTC10x6Unorm:"astc-10x6-unorm",ASTC10x6UnormSRGB:"astc-10x6-unorm-srgb",ASTC10x8Unorm:"astc-10x8-unorm",ASTC10x8UnormSRGB:"astc-10x8-unorm-srgb",ASTC10x10Unorm:"astc-10x10-unorm",ASTC10x10UnormSRGB:"astc-10x10-unorm-srgb",ASTC12x10Unorm:"astc-12x10-unorm",ASTC12x10UnormSRGB:"astc-12x10-unorm-srgb",ASTC12x12Unorm:"astc-12x12-unorm",ASTC12x12UnormSRGB:"astc-12x12-unorm-srgb"},XO={ClampToEdge:"clamp-to-edge",Repeat:"repeat",MirrorRepeat:"mirror-repeat"},Kc={Linear:"linear",Nearest:"nearest"},ui={Zero:"zero",One:"one",Src:"src",OneMinusSrc:"one-minus-src",SrcAlpha:"src-alpha",OneMinusSrcAlpha:"one-minus-src-alpha",Dst:"dst",OneMinusDst:"one-minus-dst",DstAlpha:"dst-alpha",OneMinusDstAlpha:"one-minus-dst-alpha",SrcAlphaSaturated:"src-alpha-saturated",Constant:"constant",OneMinusConstant:"one-minus-constant"},Pg={Add:"add",Subtract:"subtract",ReverseSubtract:"reverse-subtract",Min:"min",Max:"max"},Tte={None:0,All:15},Q0={Keep:"keep",Zero:"zero",Replace:"replace",Invert:"invert",IncrementClamp:"increment-clamp",DecrementClamp:"decrement-clamp",IncrementWrap:"increment-wrap",DecrementWrap:"decrement-wrap"},$O={Storage:"storage",ReadOnlyStorage:"read-only-storage"},YO={WriteOnly:"write-only",ReadOnly:"read-only",ReadWrite:"read-write"},Ete={NonFiltering:"non-filtering",Comparison:"comparison"},Lg={Float:"float",UnfilterableFloat:"unfilterable-float",Depth:"depth",SInt:"sint",UInt:"uint"},Mte={TwoD:"2d",ThreeD:"3d"},jo={TwoD:"2d",TwoDArray:"2d-array",Cube:"cube",ThreeD:"3d"},ZIe={All:"all"},LR={Vertex:"vertex",Instance:"instance"},J4={CoreFeaturesAndLimits:"core-features-and-limits",DepthClipControl:"depth-clip-control",Depth32FloatStencil8:"depth32float-stencil8",TextureCompressionBC:"texture-compression-bc",TextureCompressionBCSliced3D:"texture-compression-bc-sliced-3d",TextureCompressionETC2:"texture-compression-etc2",TextureCompressionASTC:"texture-compression-astc",TextureCompressionASTCSliced3D:"texture-compression-astc-sliced-3d",TimestampQuery:"timestamp-query",IndirectFirstInstance:"indirect-first-instance",ShaderF16:"shader-f16",RG11B10UFloat:"rg11b10ufloat-renderable",BGRA8UNormStorage:"bgra8unorm-storage",Float32Filterable:"float32-filterable",Float32Blendable:"float32-blendable",ClipDistances:"clip-distances",DualSourceBlending:"dual-source-blending",Subgroups:"subgroups",TextureFormatsTier1:"texture-formats-tier1",TextureFormatsTier2:"texture-formats-tier2"},Cte={"texture-compression-s3tc":"texture-compression-bc","texture-compression-etc1":"texture-compression-etc2"},h9=class extends X4{constructor(e,t,n){super(e,t?t.value:null),this.textureNode=t,this.groupNode=n}update(){let{textureNode:e}=this;return this.texture!==e.value?(this.texture=e.value,!0):super.update()}},f9=class extends q4{constructor(e,t){super(e,t?t.array:null),this._attribute=t,this.isStorageBuffer=!0}get attribute(){return this._attribute}},KIe=0,d9=class extends f9{constructor(e,t){super("StorageBuffer_"+KIe++,e?e.value:null),this.nodeUniform=e,this.access=e?e.access:$o.READ_WRITE,this.groupNode=t}get attribute(){return this.nodeUniform.value}get buffer(){return this.nodeUniform.value.array}},ZO=[null],p9=class{constructor(e){this.backend=e,this._preferredCanvasFormat=null}getCurrentDepthStencilFormat(e){let t;return e.depth&&(e.depthTexture!==null?t=this.getTextureFormatGPU(e.depthTexture):e.stencil?this.backend.renderer.reversedDepthBuffer===!0?t=fe.Depth32FloatStencil8:t=fe.Depth24PlusStencil8:this.backend.renderer.reversedDepthBuffer===!0?t=fe.Depth32Float:t=fe.Depth24Plus),t}getTextureFormatGPU(e){return this.backend.get(e).format}getTextureSampleData(e){let t;if(e.isFramebufferTexture)t=1;else if(e.isDepthTexture&&!e.renderTarget){let s=this.backend.renderer,o=s.getRenderTarget();t=o?o.samples:s.currentSamples}else e.renderTarget&&(t=e.renderTarget.samples);t=this.getSampleCount(t||1);let n=t>1&&e.renderTarget!==null&&e.isDepthTexture!==!0&&e.isFramebufferTexture!==!0;return{samples:t,primarySamples:n?1:t,isMSAA:n}}getCurrentColorFormat(e){let t;return e.textures!==null?t=this.getTextureFormatGPU(e.textures[0]):t=this.getPreferredCanvasFormat(),t}getCurrentColorFormats(e){return e.textures!==null?e.textures.map(t=>this.getTextureFormatGPU(t)):[this.getPreferredCanvasFormat()]}getCurrentColorSpace(e){return e.textures!==null?e.textures[0].colorSpace:this.backend.renderer.outputColorSpace}getPrimitiveTopology(e,t){if(e.isPoints)return Yw.PointList;if(e.isLineSegments||e.isMesh&&t.wireframe===!0)return Yw.LineList;if(e.isLine)return Yw.LineStrip;if(e.isMesh)return Yw.TriangleList}getSampleCount(e){return e>=4?4:1}getSampleCountRenderContext(e){return e.textures!==null?this.getSampleCount(e.sampleCount):this.getSampleCount(this.backend.renderer.currentSamples)}getPreferredCanvasFormat(){let t=this.backend.parameters.outputType;if(t===void 0)return this._preferredCanvasFormat===null&&(this._preferredCanvasFormat=navigator.gpu.getPreferredCanvasFormat()),this._preferredCanvasFormat;if(t===Ji)return fe.BGRA8Unorm;if(t===Wi)return fe.RGBA16Float;throw new Error("THREE.WebGPUUtils: Unsupported output buffer type.")}};function mf(i,e){ZO[0]=e,i.queue.submit(ZO),ZO[0]=null}var eI=class{constructor(){this.label="",this.layout=null,this.entries=[]}reset(){this.label="",this.layout=null,this.entries.length=0}},Am=class{constructor(){this.label="",this.size=0,this.usage=0,this.mappedAtCreation=!1}reset(){this.label="",this.size=0,this.usage=0,this.mappedAtCreation=!1}},t1=class{constructor(){this.label=""}reset(){this.label=""}},tI=class{constructor(){this.label="",this.colorFormats=null,this.depthStencilFormat=void 0,this.sampleCount=1,this.depthReadOnly=!1,this.stencilReadOnly=!1}reset(){this.label="",this.colorFormats=null,this.depthStencilFormat=void 0,this.sampleCount=1,this.depthReadOnly=!1,this.stencilReadOnly=!1}},Wg=class{constructor(){this.view=null,this.depthSlice=void 0,this.resolveTarget=void 0,this.clearValue=void 0,this.loadOp=void 0,this.storeOp=void 0}reset(){this.view=null,this.depthSlice=void 0,this.resolveTarget=void 0,this.clearValue=void 0,this.loadOp=void 0,this.storeOp=void 0}},jg=class{constructor(){this.label="",this.colorAttachments=[],this.depthStencilAttachment=void 0,this.occlusionQuerySet=void 0,this.timestampWrites=void 0,this.maxDrawCount=5e7}reset(){this.label="",this.colorAttachments.length=0,this.depthStencilAttachment=void 0,this.occlusionQuerySet=void 0,this.timestampWrites=void 0,this.maxDrawCount=5e7}},nI=class{constructor(){this.label="",this.layout=null,this.vertex=null,this.primitive={},this.depthStencil=void 0,this.multisample=new m9,this.fragment=null}reset(){this.label="",this.layout=null,this.vertex=null,this.primitive={},this.depthStencil=void 0,this.multisample.reset(),this.fragment=null}},m9=class{constructor(){this.count=1,this.mask=4294967295,this.alphaToCoverageEnabled=!1}reset(){this.count=1,this.mask=4294967295,this.alphaToCoverageEnabled=!1}},iI=class{constructor(){this.label="",this.code="",this.compilationHints=[]}reset(){this.label="",this.code="",this.compilationHints.length=0}},SS=class{constructor(){this.label="",this.size={width:0,height:1,depthOrArrayLayers:1},this.mipLevelCount=1,this.sampleCount=1,this.dimension="2d",this.format=void 0,this.usage=void 0,this.viewFormats=[],this.textureBindingViewDimension=void 0}reset(){this.label="",this.size.width=0,this.size.height=1,this.size.depthOrArrayLayers=1,this.mipLevelCount=1,this.sampleCount=1,this.dimension="2d",this.format=void 0,this.usage=void 0,this.viewFormats.length=0,this.textureBindingViewDimension=void 0}},TS=class{constructor(){this.label="",this.format=void 0,this.dimension=void 0,this.usage=0,this.aspect="all",this.baseMipLevel=0,this.mipLevelCount=void 0,this.baseArrayLayer=0,this.arrayLayerCount=void 0,this.swizzle="rgba"}reset(){this.label="",this.format=void 0,this.dimension=void 0,this.usage=0,this.aspect="all",this.baseMipLevel=0,this.mipLevelCount=void 0,this.baseArrayLayer=0,this.arrayLayerCount=void 0,this.swizzle="rgba"}},J0=new eI,em=new Am,DR=new t1,KO=new tI,QO=new jg,G_=new nI,Gw=new Wg,NR=new iI,q_=new SS,vs=new TS,A9=class extends Tf{constructor(e){super(),this.device=e;let t=`4370+void main() {}`};this.createProgram(s);let{computeProgram:o}=e,a=r.createProgram(),l=this.get(s).shaderGPU,c=this.get(o).shaderGPU,u=o.transforms,f=[],d=[];for(let S=0;S<u.length;S++){let T=u[S];f.push(T.varyingName),d.push(T.attributeNode)}r.attachShader(a,l),r.attachShader(a,c),r.transformFeedbackVaryings(a,f,r.SEPARATE_ATTRIBS),r.linkProgram(a),r.getProgramParameter(a,r.LINK_STATUS)===!1&&this._logProgramError(a,l,c),n.useProgram(a),this._setupBindings(t,a);let A=o.attributes,y=[],w=[];for(let S=0;S<A.length;S++){let T=A[S].node.attribute;y.push(T),this.has(T)||this.attributeUtils.createAttribute(T,r.ARRAY_BUFFER)}for(let S=0;S<d.length;S++){let T=d[S].attribute;this.has(T)||this.attributeUtils.createAttribute(T,r.ARRAY_BUFFER);let R=this.get(T);w.push(R)}this.set(e,{programGPU:a,transformBuffers:w,attributes:y})}createBindings(e,t){if(this._knownBindings.has(t)===!1){this._knownBindings.add(t);let n=0,r=0;for(let s of t){this.set(s,{textures:r,uniformBuffers:n});for(let o of s.bindings)o.isUniformBuffer&&n++,o.isSampledTexture&&r++}}this.updateBindings(e,t)}updateBindings(e){let{gl:t}=this;for(let n of e.bindings){let r=this.get(n);if(n.isUniformsGroup||n.isUniformBuffer){let s=n.buffer,o=r.bufferGPU;t.bindBuffer(t.UNIFORM_BUFFER,o);let a=n.updateRanges;if(t.bindBuffer(t.UNIFORM_BUFFER,o),a.length===0)t.bufferData(t.UNIFORM_BUFFER,s,t.DYNAMIC_DRAW);else{let l=f_(s),c=l?1:s.BYTES_PER_ELEMENT;for(let u=0,f=a.length;u<f;u++){let d=a[u],A=d.start*c,y=d.count*c,w=A*(l?s.BYTES_PER_ELEMENT:1);t.bufferSubData(t.UNIFORM_BUFFER,w,s,A,y)}}this.set(n,r)}else if(n.isSampledTexture){let{textureGPU:s,glTextureType:o}=this.get(n.texture);r.textureGPU=s,r.glTextureType=o,this.set(n,r)}}}updateBinding(e){let t=this.gl;if(e.isUniformsGroup||e.isUniformBuffer){let r=this.get(e).bufferGPU,s=e.buffer,o=e.updateRanges;if(t.bindBuffer(t.UNIFORM_BUFFER,r),o.length===0)t.bufferData(t.UNIFORM_BUFFER,s,t.DYNAMIC_DRAW);else{let a=f_(s),l=a?1:s.BYTES_PER_ELEMENT,c=o[0].start;for(let u=0,f=o.length;u<f;u++){let d=o[u],A=o[u+1],y=d.start+d.count;if(A!==void 0&&A.start===y)continue;let w=c*l,S=(y-c)*l,T=w*(a?s.BYTES_PER_ELEMENT:1);t.bufferSubData(t.UNIFORM_BUFFER,T,s,w,S),A!==void 0&&(c=A.start)}}}}createUniformBuffer(e){let t=this.get(e);if(t.bufferGPU===void 0){let n=this.gl,r=e.buffer;t.bufferGPU=n.createBuffer(),n.bindBuffer(n.UNIFORM_BUFFER,t.bufferGPU),n.bufferData(n.UNIFORM_BUFFER,r.byteLength,n.DYNAMIC_DRAW)}}destroyUniformBuffer(e){let t=this.get(e);this.gl.deleteBuffer(t.bufferGPU),this.delete(e)}createIndexAttribute(e){let t=this.gl;this.attributeUtils.createAttribute(e,t.ELEMENT_ARRAY_BUFFER)}createAttribute(e){if(this.has(e))return;let t=this.gl;this.attributeUtils.createAttribute(e,t.ARRAY_BUFFER)}createStorageAttribute(e){if(this.has(e))return;let t=this.gl;this.attributeUtils.createAttribute(e,t.ARRAY_BUFFER)}updateAttribute(e){this.attributeUtils.updateAttribute(e)}destroyAttribute(e){this.attributeUtils.destroyAttribute(e)}hasFeature(e){let t=Object.keys(Xte).filter(r=>Xte[r]===e),n=this.extensions;for(let r=0;r<t.length;r++)if(n.has(t[r]))return!0;return!1}copyTextureToTexture(e,t,n=null,r=null,s=0,o=0){this.textureUtils.copyTextureToTexture(e,t,n,r,s,o)}copyFramebufferToTexture(e,t,n){this.textureUtils.copyFramebufferToTexture(e,t,n)}hasCompatibility(e){return e===Bd.TEXTURE_COMPARE?!0:super.hasCompatibility(e)}initRenderTarget(e){let{gl:t,state:n}=this;this._setFramebuffer(e),n.bindFramebuffer(t.FRAMEBUFFER,null)}_setFramebuffer(e){let{gl:t,state:n}=this,r=null;if(e.textures!==null){let s=e.renderTarget,o=this.get(s),{samples:a,depthBuffer:l,stencilBuffer:c}=s,u=s.isCubeRenderTarget===!0,f=s.isRenderTarget3D===!0,d=s.depth>1,A=s.isXRRenderTarget===!0,y=A===!0&&s._hasExternalTextures===!0,w=o.msaaFrameBuffer,S=o.depthRenderbuffer,T=this.extensions.get("WEBGL_multisampled_render_to_texture"),R=this.extensions.get("OVR_multiview2"),I=this._useMultisampledExtension(s),P=bse(e),F;if(u?(o.cubeFramebuffers||(o.cubeFramebuffers={}),F=o.cubeFramebuffers[P]):A&&y===!1?F=this._xrFramebuffer:(o.framebuffers||(o.framebuffers={}),F=o.framebuffers[P]),F===void 0){F=t.createFramebuffer(),n.bindFramebuffer(t.FRAMEBUFFER,F);let D=e.textures,L=[];if(u){o.cubeFramebuffers[P]=F;let{textureGPU:B}=this.get(D[0]),k=this.renderer._activeCubeFace,z=this.renderer._activeMipmapLevel;t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_CUBE_MAP_POSITIVE_X+k,B,z)}else{o.framebuffers[P]=F;for(let B=0;B<D.length;B++){let k=D[B],z=this.get(k);z.renderTarget=e.renderTarget,z.cacheKey=P;let G=t.COLOR_ATTACHMENT0+B;if(s.multiview)R.framebufferTextureMultisampleMultiviewOVR(t.FRAMEBUFFER,G,z.textureGPU,0,a,0,2);else if(f||d){let W=this.renderer._activeCubeFace,Y=this.renderer._activeMipmapLevel;t.framebufferTextureLayer(t.FRAMEBUFFER,G,z.textureGPU,Y,W)}else if(I)T.framebufferTexture2DMultisampleEXT(t.FRAMEBUFFER,G,t.TEXTURE_2D,z.textureGPU,0,a);else{let W=this.renderer._activeMipmapLevel;t.framebufferTexture2D(t.FRAMEBUFFER,G,t.TEXTURE_2D,z.textureGPU,W)}}}let C=c?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT;if(s._autoAllocateDepthBuffer===!0){let B=t.createRenderbuffer();this.textureUtils.setupRenderBufferStorage(B,e,0,I),o.xrDepthRenderbuffer=B,L.push(c?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT),t.bindRenderbuffer(t.RENDERBUFFER,B),t.framebufferRenderbuffer(t.FRAMEBUFFER,C,t.RENDERBUFFER,B)}else if(e.depthTexture!==null){L.push(c?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT);let B=this.get(e.depthTexture);if(B.renderTarget=e.renderTarget,B.cacheKey=P,s.multiview)R.framebufferTextureMultisampleMultiviewOVR(t.FRAMEBUFFER,C,B.textureGPU,0,a,0,2);else if(y&&I)T.framebufferTexture2DMultisampleEXT(t.FRAMEBUFFER,C,t.TEXTURE_2D,B.textureGPU,0,a);else if(e.depthTexture.isArrayTexture){let k=this.renderer._activeCubeFace;t.framebufferTextureLayer(t.FRAMEBUFFER,C,B.textureGPU,0,k)}else if(e.depthTexture.isCubeTexture){let k=this.renderer._activeCubeFace;t.framebufferTexture2D(t.FRAMEBUFFER,C,t.TEXTURE_CUBE_MAP_POSITIVE_X+k,B.textureGPU,0)}else t.framebufferTexture2D(t.FRAMEBUFFER,C,t.TEXTURE_2D,B.textureGPU,0)}o.depthInvalidationArray=L}else{if(this._isRenderCameraDepthArray(e)){n.bindFramebuffer(t.FRAMEBUFFER,F);let L=this.renderer._activeCubeFace,C=this.get(e.depthTexture),B=c?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT;t.framebufferTextureLayer(t.FRAMEBUFFER,B,C.textureGPU,0,L)}if((A||I||s.multiview)&&s._isOpaqueFramebuffer!==!0){n.bindFramebuffer(t.FRAMEBUFFER,F);let L=this.get(e.textures[0]);s.multiview?R.framebufferTextureMultisampleMultiviewOVR(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,L.textureGPU,0,a,0,2):I?T.framebufferTexture2DMultisampleEXT(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,L.textureGPU,0,a):t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,L.textureGPU,0);let C=c?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT;if(s._autoAllocateDepthBuffer===!0){let B=o.xrDepthRenderbuffer;t.bindRenderbuffer(t.RENDERBUFFER,B),t.framebufferRenderbuffer(t.FRAMEBUFFER,C,t.RENDERBUFFER,B)}else{let B=this.get(e.depthTexture);s.multiview?R.framebufferTextureMultisampleMultiviewOVR(t.FRAMEBUFFER,C,B.textureGPU,0,a,0,2):I?T.framebufferTexture2DMultisampleEXT(t.FRAMEBUFFER,C,t.TEXTURE_2D,B.textureGPU,0,a):t.framebufferTexture2D(t.FRAMEBUFFER,C,t.TEXTURE_2D,B.textureGPU,0)}}}if(a>0&&I===!1&&!s.multiview){if(w===void 0){let D=[];w=t.createFramebuffer(),n.bindFramebuffer(t.FRAMEBUFFER,w);let L=[],C=e.textures;for(let B=0;B<C.length;B++){L[B]=t.createRenderbuffer(),t.bindRenderbuffer(t.RENDERBUFFER,L[B]),D.push(t.COLOR_ATTACHMENT0+B);let k=e.textures[B],z=this.get(k);t.renderbufferStorageMultisample(t.RENDERBUFFER,a,z.glInternalFormat,e.width,e.height),t.framebufferRenderbuffer(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0+B,t.RENDERBUFFER,L[B])}if(t.bindRenderbuffer(t.RENDERBUFFER,null),o.msaaFrameBuffer=w,o.msaaRenderbuffers=L,l&&S===void 0){S=t.createRenderbuffer(),this.textureUtils.setupRenderBufferStorage(S,e,a),o.depthRenderbuffer=S;let B=c?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT;D.push(B)}o.invalidationArray=D}r=o.msaaFrameBuffer}else r=F;n.drawBuffers(e,F)}n.bindFramebuffer(t.FRAMEBUFFER,r)}_getVaoKey(e){let t="";for(let n=0;n<e.length;n++){let r=this.get(e[n]);t+=":"+r.id}return t}_createVao(e){let{gl:t}=this,n=t.createVertexArray();t.bindVertexArray(n);for(let r=0;r<e.length;r++){let s=e[r],o=this.get(s);t.bindBuffer(t.ARRAY_BUFFER,o.bufferGPU),t.enableVertexAttribArray(r);let a,l;s.isInterleavedBufferAttribute===!0?(a=s.data.stride*o.bytesPerElement,l=s.offset*o.bytesPerElement):(a=0,l=0),o.isInteger?t.vertexAttribIPointer(r,s.itemSize,o.type,a,l):t.vertexAttribPointer(r,s.itemSize,o.type,s.normalized,a,l),s.isInstancedBufferAttribute&&!s.isInterleavedBufferAttribute?t.vertexAttribDivisor(r,s.meshPerAttribute):s.isInterleavedBufferAttribute&&s.data.isInstancedInterleavedBuffer&&t.vertexAttribDivisor(r,s.data.meshPerAttribute)}return t.bindBuffer(t.ARRAY_BUFFER,null),n}_getTransformFeedback(e){let t="";for(let s=0;s<e.length;s++)t+=":"+e[s].id;let n=this.transformFeedbackCache[t];if(n!==void 0)return n;let{gl:r}=this;n=r.createTransformFeedback(),r.bindTransformFeedback(r.TRANSFORM_FEEDBACK,n);for(let s=0;s<e.length;s++){let o=e[s];r.bindBufferBase(r.TRANSFORM_FEEDBACK_BUFFER,s,o.transformBuffer)}return r.bindTransformFeedback(r.TRANSFORM_FEEDBACK,null),this.transformFeedbackCache[t]=n,n}_setupBindings(e,t){let n=this.gl,r=0,s=0;for(let o of e)for(let a of o.bindings)if(a.isUniformsGroup||a.isUniformBuffer){let l=r++,c=n.getUniformBlockIndex(t,a.name);n.uniformBlockBinding(t,c,l)}else if(a.isSampledTexture){let l=s++,c=n.getUniformLocation(t,a.name);n.uniform1i(c,l)}}_bindUniforms(e){let{gl:t,state:n}=this,r=0,s=0;for(let o of e)for(let a of o.bindings){let l=this.get(a);if(a.isUniformsGroup||a.isUniformBuffer){let c=r++;n.bindBufferBase(t.UNIFORM_BUFFER,c,l.bufferGPU)}else if(a.isSampledTexture){let c=s++;n.bindTexture(l.glTextureType,l.textureGPU,t.TEXTURE0+c)}}}_resolveRenderTarget(e){let{gl:t,state:n}=this,r=e.renderTarget;if(e.textures!==null&&r){let s=this.get(r);if(r.samples>0&&this._useMultisampledExtension(r)===!1){let o=s.framebuffers[e.getCacheKey()],a=t.COLOR_BUFFER_BIT;r.resolveDepthBuffer&&(r.depthBuffer&&(a|=t.DEPTH_BUFFER_BIT),r.stencilBuffer&&r.resolveStencilBuffer&&(a|=t.STENCIL_BUFFER_BIT));let l=s.msaaFrameBuffer,c=s.msaaRenderbuffers,u=e.textures,f=u.length>1;if(n.bindFramebuffer(t.READ_FRAMEBUFFER,l),n.bindFramebuffer(t.DRAW_FRAMEBUFFER,o),f)for(let d=0;d<u.length;d++)t.framebufferRenderbuffer(t.READ_FRAMEBUFFER,t.COLOR_ATTACHMENT0+d,t.RENDERBUFFER,null),t.framebufferTexture2D(t.DRAW_FRAMEBUFFER,t.COLOR_ATTACHMENT0+d,t.TEXTURE_2D,null,0);for(let d=0;d<u.length;d++){if(f){let{textureGPU:A}=this.get(u[d]);t.framebufferRenderbuffer(t.READ_FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.RENDERBUFFER,c[d]),t.framebufferTexture2D(t.DRAW_FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,A,0)}if(e.scissor){let{x:A,y,width:w,height:S}=e.scissorValue,T=e.height-S-y;t.blitFramebuffer(A,T,A+w,T+S,A,T,A+w,T+S,a,t.NEAREST)}else t.blitFramebuffer(0,0,e.width,e.height,0,0,e.width,e.height,a,t.NEAREST)}if(f)for(let d=0;d<u.length;d++){let{textureGPU:A}=this.get(u[d]);t.framebufferRenderbuffer(t.READ_FRAMEBUFFER,t.COLOR_ATTACHMENT0+d,t.RENDERBUFFER,c[d]),t.framebufferTexture2D(t.DRAW_FRAMEBUFFER,t.COLOR_ATTACHMENT0+d,t.TEXTURE_2D,A,0)}this._supportsInvalidateFramebuffer===!0&&t.invalidateFramebuffer(t.READ_FRAMEBUFFER,s.invalidationArray)}else if(r.resolveDepthBuffer===!1&&s.framebuffers){let o=s.framebuffers[e.getCacheKey()];n.bindFramebuffer(t.DRAW_FRAMEBUFFER,o),t.invalidateFramebuffer(t.DRAW_FRAMEBUFFER,s.depthInvalidationArray)}}}_useMultisampledExtension(e){return e.multiview===!0?!0:e.samples>0&&this.extensions.has("WEBGL_multisampled_render_to_texture")===!0&&e._autoAllocateDepthBuffer!==!1}dispose(){this.textureUtils!==null&&this.textureUtils.dispose();let e=this.extensions.get("WEBGL_lose_context");e&&e.loseContext(),this.renderer.domElement.removeEventListener("webglcontextlost",this._onContextLost)}},tS={PointList:"point-list",LineList:"line-list",LineStrip:"line-strip",TriangleList:"triangle-list"},yf=typeof self<"u"&&self.GPUShaderStage?self.GPUShaderStage:{VERTEX:1,FRAGMENT:2,COMPUTE:4},jo={Never:"never",Less:"less",Equal:"equal",LessEqual:"less-equal",Greater:"greater",NotEqual:"not-equal",GreaterEqual:"greater-equal",Always:"always"},Za={Store:"store"},Fi={Load:"load",Clear:"clear"},$te={CCW:"ccw",CW:"cw"},Yte={None:"none",Back:"back"},oP={Uint16:"uint16",Uint32:"uint32"},fe={R8Unorm:"r8unorm",R8Snorm:"r8snorm",R8Uint:"r8uint",R8Sint:"r8sint",R16Uint:"r16uint",R16Sint:"r16sint",R16Float:"r16float",RG8Unorm:"rg8unorm",RG8Snorm:"rg8snorm",RG8Uint:"rg8uint",RG8Sint:"rg8sint",R16Unorm:"r16unorm",R16Snorm:"r16snorm",R32Uint:"r32uint",R32Sint:"r32sint",R32Float:"r32float",RG16Uint:"rg16uint",RG16Sint:"rg16sint",RG16Float:"rg16float",RGBA8Unorm:"rgba8unorm",RGBA8UnormSRGB:"rgba8unorm-srgb",RGBA8Snorm:"rgba8snorm",RGBA8Uint:"rgba8uint",RGBA8Sint:"rgba8sint",BGRA8Unorm:"bgra8unorm",BGRA8UnormSRGB:"bgra8unorm-srgb",RG16Unorm:"rg16unorm",RG16Snorm:"rg16snorm",RGB9E5UFloat:"rgb9e5ufloat",RGB10A2Unorm:"rgb10a2unorm",RG11B10UFloat:"rg11b10ufloat",RG32Uint:"rg32uint",RG32Sint:"rg32sint",RG32Float:"rg32float",RGBA16Uint:"rgba16uint",RGBA16Sint:"rgba16sint",RGBA16Float:"rgba16float",RGBA16Unorm:"rgba16unorm",RGBA16Snorm:"rgba16snorm",RGBA32Uint:"rgba32uint",RGBA32Sint:"rgba32sint",RGBA32Float:"rgba32float",Depth16Unorm:"depth16unorm",Depth24Plus:"depth24plus",Depth24PlusStencil8:"depth24plus-stencil8",Depth32Float:"depth32float",Depth32FloatStencil8:"depth32float-stencil8",BC1RGBAUnorm:"bc1-rgba-unorm",BC1RGBAUnormSRGB:"bc1-rgba-unorm-srgb",BC2RGBAUnorm:"bc2-rgba-unorm",BC2RGBAUnormSRGB:"bc2-rgba-unorm-srgb",BC3RGBAUnorm:"bc3-rgba-unorm",BC3RGBAUnormSRGB:"bc3-rgba-unorm-srgb",BC4RUnorm:"bc4-r-unorm",BC4RSnorm:"bc4-r-snorm",BC5RGUnorm:"bc5-rg-unorm",BC5RGSnorm:"bc5-rg-snorm",BC6HRGBUFloat:"bc6h-rgb-ufloat",BC6HRGBFloat:"bc6h-rgb-float",BC7RGBAUnorm:"bc7-rgba-unorm",BC7RGBAUnormSRGB:"bc7-rgba-unorm-srgb",ETC2RGB8Unorm:"etc2-rgb8unorm",ETC2RGB8UnormSRGB:"etc2-rgb8unorm-srgb",ETC2RGB8A1Unorm:"etc2-rgb8a1unorm",ETC2RGB8A1UnormSRGB:"etc2-rgb8a1unorm-srgb",ETC2RGBA8Unorm:"etc2-rgba8unorm",ETC2RGBA8UnormSRGB:"etc2-rgba8unorm-srgb",EACR11Unorm:"eac-r11unorm",EACR11Snorm:"eac-r11snorm",EACRG11Unorm:"eac-rg11unorm",EACRG11Snorm:"eac-rg11snorm",ASTC4x4Unorm:"astc-4x4-unorm",ASTC4x4UnormSRGB:"astc-4x4-unorm-srgb",ASTC5x4Unorm:"astc-5x4-unorm",ASTC5x4UnormSRGB:"astc-5x4-unorm-srgb",ASTC5x5Unorm:"astc-5x5-unorm",ASTC5x5UnormSRGB:"astc-5x5-unorm-srgb",ASTC6x5Unorm:"astc-6x5-unorm",ASTC6x5UnormSRGB:"astc-6x5-unorm-srgb",ASTC6x6Unorm:"astc-6x6-unorm",ASTC6x6UnormSRGB:"astc-6x6-unorm-srgb",ASTC8x5Unorm:"astc-8x5-unorm",ASTC8x5UnormSRGB:"astc-8x5-unorm-srgb",ASTC8x6Unorm:"astc-8x6-unorm",ASTC8x6UnormSRGB:"astc-8x6-unorm-srgb",ASTC8x8Unorm:"astc-8x8-unorm",ASTC8x8UnormSRGB:"astc-8x8-unorm-srgb",ASTC10x5Unorm:"astc-10x5-unorm",ASTC10x5UnormSRGB:"astc-10x5-unorm-srgb",ASTC10x6Unorm:"astc-10x6-unorm",ASTC10x6UnormSRGB:"astc-10x6-unorm-srgb",ASTC10x8Unorm:"astc-10x8-unorm",ASTC10x8UnormSRGB:"astc-10x8-unorm-srgb",ASTC10x10Unorm:"astc-10x10-unorm",ASTC10x10UnormSRGB:"astc-10x10-unorm-srgb",ASTC12x10Unorm:"astc-12x10-unorm",ASTC12x10UnormSRGB:"astc-12x10-unorm-srgb",ASTC12x12Unorm:"astc-12x12-unorm",ASTC12x12UnormSRGB:"astc-12x12-unorm-srgb"},pU={ClampToEdge:"clamp-to-edge",Repeat:"repeat",MirrorRepeat:"mirror-repeat"},Kc={Linear:"linear",Nearest:"nearest"},ui={Zero:"zero",One:"one",Src:"src",OneMinusSrc:"one-minus-src",SrcAlpha:"src-alpha",OneMinusSrcAlpha:"one-minus-src-alpha",Dst:"dst",OneMinusDst:"one-minus-dst",DstAlpha:"dst-alpha",OneMinusDstAlpha:"one-minus-dst-alpha",SrcAlphaSaturated:"src-alpha-saturated",Constant:"constant",OneMinusConstant:"one-minus-constant"},Bg={Add:"add",Subtract:"subtract",ReverseSubtract:"reverse-subtract",Min:"min",Max:"max"},Zte={None:0,All:15},nm={Keep:"keep",Zero:"zero",Replace:"replace",Invert:"invert",IncrementClamp:"increment-clamp",DecrementClamp:"decrement-clamp",IncrementWrap:"increment-wrap",DecrementWrap:"decrement-wrap"},mU={Storage:"storage",ReadOnlyStorage:"read-only-storage"},AU={WriteOnly:"write-only",ReadOnly:"read-only",ReadWrite:"read-write"},Kte={NonFiltering:"non-filtering",Comparison:"comparison"},Og={Float:"float",UnfilterableFloat:"unfilterable-float",Depth:"depth",SInt:"sint",UInt:"uint"},Qte={TwoD:"2d",ThreeD:"3d"},Xo={TwoD:"2d",TwoDArray:"2d-array",Cube:"cube",ThreeD:"3d"},IIe={All:"all"},zR={Vertex:"vertex",Instance:"instance"},aP={CoreFeaturesAndLimits:"core-features-and-limits",DepthClipControl:"depth-clip-control",Depth32FloatStencil8:"depth32float-stencil8",TextureCompressionBC:"texture-compression-bc",TextureCompressionBCSliced3D:"texture-compression-bc-sliced-3d",TextureCompressionETC2:"texture-compression-etc2",TextureCompressionASTC:"texture-compression-astc",TextureCompressionASTCSliced3D:"texture-compression-astc-sliced-3d",TimestampQuery:"timestamp-query",IndirectFirstInstance:"indirect-first-instance",ShaderF16:"shader-f16",RG11B10UFloat:"rg11b10ufloat-renderable",BGRA8UNormStorage:"bgra8unorm-storage",Float32Filterable:"float32-filterable",Float32Blendable:"float32-blendable",ClipDistances:"clip-distances",DualSourceBlending:"dual-source-blending",Subgroups:"subgroups",TextureFormatsTier1:"texture-formats-tier1",TextureFormatsTier2:"texture-formats-tier2"},Jte={"texture-compression-s3tc":"texture-compression-bc","texture-compression-etc1":"texture-compression-etc2"},L9=class extends tP{constructor(e,t,n){super(e,t?t.value:null),this.textureNode=t,this.groupNode=n}update(){let{textureNode:e}=this;return this.texture!==e.value?(this.texture=e.value,!0):super.update()}},D9=class extends K4{constructor(e,t){super(e,t?t.array:null),this._attribute=t,this.isStorageBuffer=!0}get attribute(){return this._attribute}},LIe=0,N9=class extends D9{constructor(e,t){super("StorageBuffer_"+LIe++,e?e.value:null),this.nodeUniform=e,this.access=e?e.access:Yo.READ_WRITE,this.groupNode=t}get attribute(){return this.nodeUniform.value}get buffer(){return this.nodeUniform.value.array}},gU=[null],F9=class{constructor(e){this.backend=e,this._preferredCanvasFormat=null}getCurrentDepthStencilFormat(e){let t;return e.depth&&(e.depthTexture!==null?t=this.getTextureFormatGPU(e.depthTexture):e.stencil?this.backend.renderer.reversedDepthBuffer===!0?t=fe.Depth32FloatStencil8:t=fe.Depth24PlusStencil8:this.backend.renderer.reversedDepthBuffer===!0?t=fe.Depth32Float:t=fe.Depth24Plus),t}getTextureFormatGPU(e){return this.backend.get(e).format}getTextureSampleData(e){let t;if(e.isFramebufferTexture)t=1;else if(e.isDepthTexture&&!e.renderTarget){let s=this.backend.renderer,o=s.getRenderTarget();t=o?o.samples:s.currentSamples}else e.renderTarget&&(t=e.renderTarget.samples);t=this.getSampleCount(t||1);let n=t>1&&e.renderTarget!==null&&e.isDepthTexture!==!0&&e.isFramebufferTexture!==!0;return{samples:t,primarySamples:n?1:t,isMSAA:n}}getCurrentColorFormat(e){let t;return e.textures!==null?t=this.getTextureFormatGPU(e.textures[0]):t=this.getPreferredCanvasFormat(),t}getCurrentColorFormats(e){return e.textures!==null?e.textures.map(t=>this.getTextureFormatGPU(t)):[this.getPreferredCanvasFormat()]}getCurrentColorSpace(e){return e.textures!==null?e.textures[0].colorSpace:this.backend.renderer.outputColorSpace}getPrimitiveTopology(e,t){if(e.isPoints)return tS.PointList;if(e.isLineSegments||e.isMesh&&t.wireframe===!0)return tS.LineList;if(e.isLine)return tS.LineStrip;if(e.isMesh)return tS.TriangleList}getSampleCount(e){return e>=4?4:1}getSampleCountRenderContext(e){return e.textures!==null?this.getSampleCount(e.sampleCount):this.getSampleCount(this.backend.renderer.currentSamples)}getPreferredCanvasFormat(){let t=this.backend.parameters.outputType;if(t===void 0)return this._preferredCanvasFormat===null&&(this._preferredCanvasFormat=navigator.gpu.getPreferredCanvasFormat()),this._preferredCanvasFormat;if(t===Ji)return fe.BGRA8Unorm;if(t===Wi)return fe.RGBA16Float;throw new Error("THREE.WebGPUUtils: Unsupported output buffer type.")}};function mf(i,e){gU[0]=e,i.queue.submit(gU),gU[0]=null}var lP=class{constructor(){this.label="",this.layout=null,this.entries=[]}reset(){this.label="",this.layout=null,this.entries.length=0}},xm=class{constructor(){this.label="",this.size=0,this.usage=0,this.mappedAtCreation=!1}reset(){this.label="",this.size=0,this.usage=0,this.mappedAtCreation=!1}},o1=class{constructor(){this.label=""}reset(){this.label=""}},cP=class{constructor(){this.label="",this.colorFormats=null,this.depthStencilFormat=void 0,this.sampleCount=1,this.depthReadOnly=!1,this.stencilReadOnly=!1}reset(){this.label="",this.colorFormats=null,this.depthStencilFormat=void 0,this.sampleCount=1,this.depthReadOnly=!1,this.stencilReadOnly=!1}},Zg=class{constructor(){this.view=null,this.depthSlice=void 0,this.resolveTarget=void 0,this.clearValue=void 0,this.loadOp=void 0,this.storeOp=void 0}reset(){this.view=null,this.depthSlice=void 0,this.resolveTarget=void 0,this.clearValue=void 0,this.loadOp=void 0,this.storeOp=void 0}},Kg=class{constructor(){this.label="",this.colorAttachments=[],this.depthStencilAttachment=void 0,this.occlusionQuerySet=void 0,this.timestampWrites=void 0,this.maxDrawCount=5e7}reset(){this.label="",this.colorAttachments.length=0,this.depthStencilAttachment=void 0,this.occlusionQuerySet=void 0,this.timestampWrites=void 0,this.maxDrawCount=5e7}},uP=class{constructor(){this.label="",this.layout=null,this.vertex=null,this.primitive={},this.depthStencil=void 0,this.multisample=new B9,this.fragment=null}reset(){this.label="",this.layout=null,this.vertex=null,this.primitive={},this.depthStencil=void 0,this.multisample.reset(),this.fragment=null}},B9=class{constructor(){this.count=1,this.mask=4294967295,this.alphaToCoverageEnabled=!1}reset(){this.count=1,this.mask=4294967295,this.alphaToCoverageEnabled=!1}},hP=class{constructor(){this.label="",this.code="",this.compilationHints=[]}reset(){this.label="",this.code="",this.compilationHints.length=0}},PS=class{constructor(){this.label="",this.size={width:0,height:1,depthOrArrayLayers:1},this.mipLevelCount=1,this.sampleCount=1,this.dimension="2d",this.format=void 0,this.usage=void 0,this.viewFormats=[],this.textureBindingViewDimension=void 0}reset(){this.label="",this.size.width=0,this.size.height=1,this.size.depthOrArrayLayers=1,this.mipLevelCount=1,this.sampleCount=1,this.dimension="2d",this.format=void 0,this.usage=void 0,this.viewFormats.length=0,this.textureBindingViewDimension=void 0}},IS=class{constructor(){this.label="",this.format=void 0,this.dimension=void 0,this.usage=0,this.aspect="all",this.baseMipLevel=0,this.mipLevelCount=void 0,this.baseArrayLayer=0,this.arrayLayerCount=void 0,this.swizzle="rgba"}reset(){this.label="",this.format=void 0,this.dimension=void 0,this.usage=0,this.aspect="all",this.baseMipLevel=0,this.mipLevelCount=void 0,this.baseArrayLayer=0,this.arrayLayerCount=void 0,this.swizzle="rgba"}},im=new lP,rm=new xm,VR=new o1,vU=new cP,_U=new Kg,$_=new uP,$w=new Zg,GR=new hP,Y_=new PS,vs=new IS,O9=class extends Tf{constructor(e){super(),this.device=e;let t=`43714371 struct VarysStruct {43724372 @builtin( position ) Position: vec4f,43734373 @location( 0 ) vTex : vec2f,@@ -4441,7 +4441,7 @@ fn main_cube( Varys: VarysStruct ) -> @location( 0 ) vec4<f32> {
44414441 return textureSample( imgCube, imgSampler, faceMat[ Varys.vBaseArrayLayer ] * vec3f( fract( Varys.vTex ), 1 ) );44424442 44434443 }4444-`;this.mipmapSampler=e.createSampler({minFilter:Kc.Linear}),this.flipYSampler=e.createSampler({minFilter:Kc.Nearest}),em.size=4,em.usage=GPUBufferUsage.UNIFORM|GPUBufferUsage.COPY_DST,this.flipUniformBuffer=e.createBuffer(em),em.reset(),e.queue.writeBuffer(this.flipUniformBuffer,0,new Uint32Array([1])),em.size=4,em.usage=GPUBufferUsage.UNIFORM,this.noFlipUniformBuffer=e.createBuffer(em),em.reset(),this.transferPipelines={},NR.label="mipmap",NR.code=t,this.mipmapShaderModule=e.createShaderModule(NR),NR.reset()}getTransferPipeline(e,t){t=t||"2d-array";let n=`${e}-${t}`,r=this.transferPipelines[n];return r===void 0&&(G_.label=`mipmap-${e}-${t}`,G_.vertex={module:this.mipmapShaderModule},G_.fragment={module:this.mipmapShaderModule,entryPoint:`main_${t.replace("-","_")}`,targets:[{format:e}]},G_.layout="auto",r=this.device.createRenderPipeline(G_),G_.reset(),this.transferPipelines[n]=r),r}flipY(e,t,n=0){let r=t.format,{width:s,height:o}=t.size;q_.size.width=s,q_.size.height=o,q_.format=r,q_.usage=GPUTextureUsage.RENDER_ATTACHMENT|GPUTextureUsage.TEXTURE_BINDING;let a=this.device.createTexture(q_);q_.reset();let l=this.getTransferPipeline(r,e.textureBindingViewDimension),c=this.getTransferPipeline(r,a.textureBindingViewDimension),u=this.device.createCommandEncoder(DR),f=(d,A,y,w,S,T)=>{let R=d.getBindGroupLayout(0);vs.dimension=A.textureBindingViewDimension||"2d-array",vs.mipLevelCount=1;let P=A.createView(vs);vs.reset(),J0.layout=R,J0.entries.push({binding:0,resource:this.flipYSampler},{binding:1,resource:P},{binding:2,resource:{buffer:T?this.flipUniformBuffer:this.noFlipUniformBuffer}});let I=this.device.createBindGroup(J0);J0.reset(),vs.dimension="2d",vs.mipLevelCount=1,vs.baseArrayLayer=S,vs.arrayLayerCount=1;let F=w.createView(vs);vs.reset(),Gw.view=F,Gw.loadOp=Fi.Clear,Gw.storeOp=Ya.Store,QO.colorAttachments.push(Gw);let D=u.beginRenderPass(QO);QO.reset(),Gw.reset(),D.setPipeline(d),D.setBindGroup(0,I),D.draw(3,1,0,y),D.end()};f(l,e,n,a,0,!1),f(c,a,0,e,n,!0),mf(this.device,u.finish()),a.destroy()}generateMipmaps(e,t=null){let n=this.get(e),r=n.layers||this._mipmapCreateBundles(e),s=t;s===null&&(DR.label="mipmapEncoder",s=this.device.createCommandEncoder(DR),DR.reset()),this._mipmapRunBundles(s,r),t===null&&mf(this.device,s.finish()),n.layers=r}_mipmapCreateBundles(e){let t=e.textureBindingViewDimension||"2d-array",n=this.getTransferPipeline(e.format,t),r=n.getBindGroupLayout(0),s=[];for(let o=1;o<e.mipLevelCount;o++)for(let a=0;a<e.depthOrArrayLayers;a++){vs.dimension=t,vs.baseMipLevel=o-1,vs.mipLevelCount=1;let l=e.createView(vs);vs.reset(),J0.layout=r,J0.entries.push({binding:0,resource:this.mipmapSampler},{binding:1,resource:l},{binding:2,resource:{buffer:this.noFlipUniformBuffer}});let c=this.device.createBindGroup(J0);J0.reset(),vs.dimension="2d",vs.baseMipLevel=o,vs.mipLevelCount=1,vs.baseArrayLayer=a,vs.arrayLayerCount=1;let u=e.createView(vs);vs.reset();let f=new Wg;f.view=u,f.loadOp=Fi.Clear,f.storeOp=Ya.Store;let d=new jg;d.colorAttachments.push(f),KO.colorFormats=[e.format];let A=this.device.createRenderBundleEncoder(KO);KO.reset(),A.setPipeline(n),A.setBindGroup(0,c),A.draw(3,1,0,a),s.push({renderBundles:[A.finish()],passDescriptor:d})}return s}_mipmapRunBundles(e,t){let n=t.length;for(let r=0;r<n;r++){let s=t[r],o=e.beginRenderPass(s.passDescriptor);o.executeBundles(s.renderBundles),o.end()}}},g9=class{constructor(){this.label="",this.addressModeU="clamp-to-edge",this.addressModeV="clamp-to-edge",this.addressModeW="clamp-to-edge",this.magFilter="nearest",this.minFilter="nearest",this.mipmapFilter="nearest",this.lodMinClamp=0,this.lodMaxClamp=32,this.compare=void 0,this.maxAnisotropy=1}reset(){this.label="",this.addressModeU="clamp-to-edge",this.addressModeV="clamp-to-edge",this.addressModeW="clamp-to-edge",this.magFilter="nearest",this.minFilter="nearest",this.mipmapFilter="nearest",this.lodMinClamp=0,this.lodMaxClamp=32,this.compare=void 0,this.maxAnisotropy=1}},dx=class{constructor(){this.texture=null,this.mipLevel=0,this.origin={x:0,y:0,z:0},this.aspect="all"}reset(){this.texture=null,this.mipLevel=0,this.origin.x=0,this.origin.y=0,this.origin.z=0,this.aspect="all"}},v9=class{constructor(){this.buffer=null,this.offset=0,this.bytesPerRow=void 0,this.rowsPerImage=void 0}reset(){this.buffer=null,this.offset=0,this.bytesPerRow=void 0,this.rowsPerImage=void 0}},_9=class{constructor(){this.offset=0,this.bytesPerRow=void 0,this.rowsPerImage=void 0}reset(){this.offset=0,this.bytesPerRow=void 0,this.rowsPerImage=void 0}},x9=class{constructor(){this.source=null,this.origin={x:0,y:0},this.flipY=!1}reset(){this.source=null,this.origin.x=0,this.origin.y=0,this.flipY=!1}},y9=class extends dx{constructor(){super(),this.colorSpace="srgb",this.premultipliedAlpha=!1}reset(){super.reset(),this.colorSpace="srgb",this.premultipliedAlpha=!1}},rI=class{constructor(){this.width=0,this.height=1,this.depthOrArrayLayers=1}reset(){this.width=0,this.height=1,this.depthOrArrayLayers=1}},FR=new Am,QIe=new t1,pa=new g9,va=new dx,BR=new v9,Wd=new _9,OR=new x9,H_=new y9,tm=new SS,Aa=new rI,JIe={[Mb]:"never",[s_]:"less",[Cb]:"equal",[Xh]:"less-equal",[sg]:"greater",[Fu]:"greater-equal",[Ib]:"always",[Rb]:"not-equal"},ePe=[0,1,3,2,4,5];function Rte(i,e,t,n,r,s,o,a,l,c){va.texture=e,va.mipLevel=t,va.origin.z=n,Wd.offset=n*s,Wd.bytesPerRow=o,Wd.rowsPerImage=a,Aa.width=l,Aa.height=c,i.queue.writeTexture(va,r.data,Wd,Aa),va.reset(),Wd.reset(),Aa.reset()}var b9=class{constructor(e){this.backend=e,this._passUtils=null,this.defaultTexture={},this.defaultCubeTexture={},this.defaultVideoFrame=null,this._samplerCache=new Map}updateSampler(e){let t=this.backend,n=e.texture,r=e.textureNode,s=n.minFilter+"-"+n.magFilter+"-"+n.wrapS+"-"+n.wrapT+"-"+(n.wrapR||"0")+"-"+n.anisotropy+"-"+(n.isDepthTexture===!0?1:0)+"-"+(n.compareFunction!==null&&r.compareNode!==null?n.compareFunction:0),o=this._samplerCache.get(s);if(o===void 0){pa.addressModeU=this._convertAddressMode(n.wrapS),pa.addressModeV=this._convertAddressMode(n.wrapT),pa.addressModeW=this._convertAddressMode(n.wrapR),pa.magFilter=this._convertFilterMode(n.magFilter),pa.minFilter=this._convertFilterMode(n.minFilter),pa.mipmapFilter=this._convertMipmapFilterMode(n.minFilter),n.isDepthTexture&&(n.compareFunction===null||r.compareNode===null)&&(pa.magFilter=Kc.Nearest,pa.minFilter=Kc.Nearest,pa.mipmapFilter=Kc.Nearest),pa.magFilter===Kc.Linear&&pa.minFilter===Kc.Linear&&pa.mipmapFilter===Kc.Linear&&(pa.maxAnisotropy=n.anisotropy),n.isDepthTexture&&n.compareFunction!==null&&r.compareNode!==null&&t.hasCompatibility(Dd.TEXTURE_COMPARE)&&(pa.compare=JIe[n.compareFunction]);let l=t.device.createSampler(pa);pa.reset(),o={sampler:l,usedTimes:0},this._samplerCache.set(s,o)}let a=t.get(e);return a.sampler!==o.sampler&&(this._releaseSampler(a),a.samplerKey=s,a.sampler=o.sampler,o.usedTimes++),s}destroySampler(e){this._releaseSampler(this.backend.get(e))}_releaseSampler(e){if(e.sampler!==void 0){let t=this._samplerCache.get(e.samplerKey);t.usedTimes--,t.usedTimes===0&&this._samplerCache.delete(e.samplerKey),e.sampler=void 0,e.samplerKey=void 0}}createDefaultTexture(e){let t,n=w9(e,this.backend.device);e.isCubeTexture?t=this._getDefaultCubeTextureGPU(n):t=this._getDefaultTextureGPU(n),this.backend.get(e).texture=t}createTexture(e,t={}){let n=this.backend,r=n.get(e);if(r.initialized){if(r.externalTexture===!0)return;throw new Error("THREE.WebGPUTextureUtils: Texture already initialized.")}if(e.isExternalTexture){r.texture=e.sourceTexture,r.initialized=!0;return}t.needsMipmaps===void 0&&(t.needsMipmaps=!1),t.levels===void 0&&(t.levels=1),t.depth===void 0&&(t.depth=1);let{width:s,height:o,depth:a,levels:l}=t;e.isFramebufferTexture&&(t.renderTarget?t.format=this.backend.utils.getCurrentColorFormat(t.renderTarget):t.format=this.backend.utils.getPreferredCanvasFormat());let c=this._getDimension(e),u=e.internalFormat||t.format||w9(e,n.device);r.format=u;let{samples:f,primarySamples:d,isMSAA:A}=n.utils.getTextureSampleData(e),y=GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_DST|GPUTextureUsage.COPY_SRC;e.isStorageTexture===!0&&(y|=GPUTextureUsage.STORAGE_BINDING),e.isCompressedTexture!==!0&&e.isCompressedArrayTexture!==!0&&u!==fe.RGB9E5UFloat&&(y|=GPUTextureUsage.RENDER_ATTACHMENT);let w=new SS;if(w.label=e.name,w.size.width=s,w.size.height=o,w.size.depthOrArrayLayers=a,w.mipLevelCount=l,w.sampleCount=d,w.dimension=c,w.format=u,w.usage=y,u===void 0){Xe("WebGPURenderer: Texture format not supported."),this.createDefaultTexture(e);return}e.isCubeTexture&&(w.textureBindingViewDimension=jo.Cube);try{r.texture=n.device.createTexture(w)}catch{Xe("WebGPURenderer: Failed to create texture with descriptor:",w),this.createDefaultTexture(e);return}if(A){let S=Object.assign({},w);S.label=S.label+"-msaa",S.sampleCount=f,S.mipLevelCount=1,r.msaaTexture=n.device.createTexture(S)}r.initialized=!0,r.textureDescriptorGPU=w}destroyTexture(e,t=!1){let n=this.backend,r=n.get(e);r.texture!==void 0&&t===!1&&e.isExternalTexture!==!0&&r.texture.destroy(),r.msaaTexture!==void 0&&r.msaaTexture.destroy(),n.delete(e)}generateMipmaps(e,t=null){let n=this.backend.get(e);this._generateMipmaps(n.texture,t)}getColorBuffer(){let e=this.backend,t=e.renderer.getCanvasTarget(),{width:n,height:r}=e.getDrawingBufferSize(),s=e.renderer.currentSamples,o=t.colorTexture,a=e.get(o);if(o.width===n&&o.height===r&&o.samples===s)return a.texture;let l=a.texture;return l&&l.destroy(),tm.label="colorBuffer",tm.size.width=n,tm.size.height=r,tm.sampleCount=e.utils.getSampleCount(e.renderer.currentSamples),tm.format=e.utils.getPreferredCanvasFormat(),tm.usage=GPUTextureUsage.RENDER_ATTACHMENT|GPUTextureUsage.COPY_SRC,l=e.device.createTexture(tm),tm.reset(),o.source.width=n,o.source.height=r,o.samples=s,a.texture=l,l}getDepthBuffer(e=!0,t=!1){let n=this.backend,r=n.renderer.getCanvasTarget(),{width:s,height:o}=n.getDrawingBufferSize(),a=n.renderer.currentSamples,l=r.depthTexture;if(l.width===s&&l.height===o&&l.samples===a&&l.depth===e&&l.stencil===t)return n.get(l).texture;let c=n.get(l).texture,u,f;if(t?(u=xo,f=n.renderer.reversedDepthBuffer===!0?cr:ca):e&&(u=Gs,f=n.renderer.reversedDepthBuffer===!0?cr:xi),c!==void 0){if(l.image.width===s&&l.image.height===o&&l.format===u&&l.type===f&&l.samples===a)return c;this.destroyTexture(l)}return l.name="depthBuffer",l.format=u,l.type=f,l.image.width=s,l.image.height=o,l.samples=a,this.createTexture(l,{width:s,height:o}),n.get(l).texture}updateTexture(e,t){let n=this.backend.get(e),r=e.mipmaps,{textureDescriptorGPU:s}=n;if(!(e.isRenderTargetTexture||s===void 0)){if(e.isDataTexture)if(r.length>0)for(let o=0,a=r.length;o<a;o++){let l=r[o];this._copyBufferToTexture(l,n.texture,s,0,e.flipY,0,o)}else this._copyBufferToTexture(t.image,n.texture,s,0,e.flipY);else if(e.isArrayTexture||e.isDataArrayTexture||e.isData3DTexture)if(e.layerUpdates&&e.layerUpdates.size>0){for(let o of e.layerUpdates)this._copyBufferToTexture(t.image,n.texture,s,o,e.flipY,o);e.clearLayerUpdates()}else for(let o=0;o<t.image.depth;o++)this._copyBufferToTexture(t.image,n.texture,s,o,e.flipY,o);else if(e.isCompressedTexture||e.isCompressedArrayTexture)e.isCompressedArrayTexture&&e.layerUpdates.size>0?(this._copyCompressedBufferToTexture(e.mipmaps,n.texture,s,e.layerUpdates),e.clearLayerUpdates()):this._copyCompressedBufferToTexture(e.mipmaps,n.texture,s);else if(e.isCubeTexture)this._copyCubeMapToTexture(e,n.texture,s);else if(e.isHTMLTexture){let o=this.backend.device,a=this.backend.renderer.domElement,l=e.image;if(typeof o.queue.copyElementImageToTexture!="function")return;if(!n.hasPaintCallback){n.hasPaintCallback=!0,a.requestPaint();return}let c=s.size.width,u=s.size.height;o.queue.copyElementImageToTexture.length===2?o.queue.copyElementImageToTexture({source:l},{destination:{texture:n.texture},width:c,height:u}):o.queue.copyElementImageToTexture(l,c,u,{texture:n.texture}),e.flipY&&this._flipY(n.texture,s)}else if(r.length>0)for(let o=0,a=r.length;o<a;o++){let l=r[o];this._copyImageToTexture(l,n.texture,s,0,e.flipY,e.premultiplyAlpha,o)}else this._copyImageToTexture(t.image,n.texture,s,0,e.flipY,e.premultiplyAlpha);n.version=e.version}}async copyTextureToBuffer(e,t,n,r,s,o){let a=this.backend.device,l=this.backend.get(e),c=l.texture,u=l.textureDescriptorGPU.format,f=this._getBytesPerTexel(u),d=r*f;d=Math.ceil(d/256)*256,FR.size=(s-1)*d+r*f,FR.usage=GPUBufferUsage.COPY_DST|GPUBufferUsage.MAP_READ;let A=a.createBuffer(FR);FR.reset();let y=a.createCommandEncoder(QIe);va.texture=c,va.origin.x=t,va.origin.y=n,va.origin.z=o,BR.buffer=A,BR.bytesPerRow=d,Aa.width=r,Aa.height=s,y.copyTextureToBuffer(va,BR,Aa),va.reset(),BR.reset(),Aa.reset();let w=this._getTypedArrayType(u);mf(a,y.finish()),await A.mapAsync(GPUMapMode.READ);let S=A.getMappedRange().slice();return A.destroy(),new w(S)}dispose(){this._samplerCache.clear()}_getDefaultTextureGPU(e){let t=this.defaultTexture[e];if(t===void 0){let n=new Hs;n.minFilter=Ti,n.magFilter=Ti,this.createTexture(n,{width:1,height:1,format:e}),this.defaultTexture[e]=t=n}return this.backend.get(t).texture}_getDefaultCubeTextureGPU(e){let t=this.defaultCubeTexture[e];if(t===void 0){let n=new Ih;n.minFilter=Ti,n.magFilter=Ti,this.createTexture(n,{width:1,height:1,depth:6}),this.defaultCubeTexture[e]=t=n}return this.backend.get(t).texture}_copyCubeMapToTexture(e,t,n){let r=e.images,s=e.mipmaps;for(let o=0;o<6;o++){let a=r[o],l=e.flipY===!0?ePe[o]:o;a.isDataTexture?this._copyBufferToTexture(a.image,t,n,l,e.flipY):this._copyImageToTexture(a,t,n,l,e.flipY,e.premultiplyAlpha);for(let c=0;c<s.length;c++){let f=s[c].images[o];f.isDataTexture?this._copyBufferToTexture(f.image,t,n,l,e.flipY,0,c+1):this._copyImageToTexture(f,t,n,l,e.flipY,e.premultiplyAlpha,c+1)}}}_copyImageToTexture(e,t,n,r,s,o,a=0){let l=this.backend.device,c=a>0?e.width:n.size.width,u=a>0?e.height:n.size.height;OR.source=e,OR.flipY=s,H_.texture=t,H_.mipLevel=a,H_.origin.z=r,H_.premultipliedAlpha=o,Aa.width=c,Aa.height=u;try{l.queue.copyExternalImageToTexture(OR,H_,Aa)}catch{}finally{OR.reset(),H_.reset(),Aa.reset()}}_getPassUtils(){let e=this._passUtils;return e===null&&(this._passUtils=e=new A9(this.backend.device)),e}_generateMipmaps(e,t=null){this._getPassUtils().generateMipmaps(e,t)}_flipY(e,t,n=0){this._getPassUtils().flipY(e,t,n)}_copyBufferToTexture(e,t,n,r,s,o=0,a=0){let l=this.backend.device,c=e.data,u=this._getBytesPerTexel(n.format),f=e.width*u;va.texture=t,va.mipLevel=a,va.origin.z=r,Wd.offset=e.width*e.height*u*o,Wd.bytesPerRow=f,Aa.width=e.width,Aa.height=e.height,l.queue.writeTexture(va,c,Wd,Aa),va.reset(),Wd.reset(),Aa.reset(),s===!0&&this._flipY(t,n,r)}_copyCompressedBufferToTexture(e,t,n,r=null){let s=this.backend.device,o=this._getBlockData(n.format),a=n.size.depthOrArrayLayers>1,l=r&&r.size>0?r:null;for(let c=0;c<e.length;c++){let u=e[c],f=u.width,d=u.height,A=a?n.size.depthOrArrayLayers:1,y=Math.ceil(f/o.width)*o.byteLength,w=Math.ceil(d/o.height),S=y*w,T=Math.ceil(f/o.width)*o.width,R=w*o.height;if(l!==null)for(let P of l)Rte(s,t,c,P,u,S,y,w,T,R);else for(let P=0;P<A;P++)Rte(s,t,c,P,u,S,y,w,T,R)}}_getBlockData(e){if(e===fe.BC1RGBAUnorm||e===fe.BC1RGBAUnormSRGB)return{byteLength:8,width:4,height:4};if(e===fe.BC2RGBAUnorm||e===fe.BC2RGBAUnormSRGB)return{byteLength:16,width:4,height:4};if(e===fe.BC3RGBAUnorm||e===fe.BC3RGBAUnormSRGB)return{byteLength:16,width:4,height:4};if(e===fe.BC4RUnorm||e===fe.BC4RSnorm)return{byteLength:8,width:4,height:4};if(e===fe.BC5RGUnorm||e===fe.BC5RGSnorm)return{byteLength:16,width:4,height:4};if(e===fe.BC6HRGBUFloat||e===fe.BC6HRGBFloat)return{byteLength:16,width:4,height:4};if(e===fe.BC7RGBAUnorm||e===fe.BC7RGBAUnormSRGB)return{byteLength:16,width:4,height:4};if(e===fe.ETC2RGB8Unorm||e===fe.ETC2RGB8UnormSRGB)return{byteLength:8,width:4,height:4};if(e===fe.ETC2RGB8A1Unorm||e===fe.ETC2RGB8A1UnormSRGB)return{byteLength:8,width:4,height:4};if(e===fe.ETC2RGBA8Unorm||e===fe.ETC2RGBA8UnormSRGB)return{byteLength:16,width:4,height:4};if(e===fe.EACR11Unorm)return{byteLength:8,width:4,height:4};if(e===fe.EACR11Snorm)return{byteLength:8,width:4,height:4};if(e===fe.EACRG11Unorm)return{byteLength:16,width:4,height:4};if(e===fe.EACRG11Snorm)return{byteLength:16,width:4,height:4};if(e===fe.ASTC4x4Unorm||e===fe.ASTC4x4UnormSRGB)return{byteLength:16,width:4,height:4};if(e===fe.ASTC5x4Unorm||e===fe.ASTC5x4UnormSRGB)return{byteLength:16,width:5,height:4};if(e===fe.ASTC5x5Unorm||e===fe.ASTC5x5UnormSRGB)return{byteLength:16,width:5,height:5};if(e===fe.ASTC6x5Unorm||e===fe.ASTC6x5UnormSRGB)return{byteLength:16,width:6,height:5};if(e===fe.ASTC6x6Unorm||e===fe.ASTC6x6UnormSRGB)return{byteLength:16,width:6,height:6};if(e===fe.ASTC8x5Unorm||e===fe.ASTC8x5UnormSRGB)return{byteLength:16,width:8,height:5};if(e===fe.ASTC8x6Unorm||e===fe.ASTC8x6UnormSRGB)return{byteLength:16,width:8,height:6};if(e===fe.ASTC8x8Unorm||e===fe.ASTC8x8UnormSRGB)return{byteLength:16,width:8,height:8};if(e===fe.ASTC10x5Unorm||e===fe.ASTC10x5UnormSRGB)return{byteLength:16,width:10,height:5};if(e===fe.ASTC10x6Unorm||e===fe.ASTC10x6UnormSRGB)return{byteLength:16,width:10,height:6};if(e===fe.ASTC10x8Unorm||e===fe.ASTC10x8UnormSRGB)return{byteLength:16,width:10,height:8};if(e===fe.ASTC10x10Unorm||e===fe.ASTC10x10UnormSRGB)return{byteLength:16,width:10,height:10};if(e===fe.ASTC12x10Unorm||e===fe.ASTC12x10UnormSRGB)return{byteLength:16,width:12,height:10};if(e===fe.ASTC12x12Unorm||e===fe.ASTC12x12UnormSRGB)return{byteLength:16,width:12,height:12}}_convertAddressMode(e){let t=XO.ClampToEdge;return e===wd?t=XO.Repeat:e===Sd&&(t=XO.MirrorRepeat),t}_convertFilterMode(e){let t=Kc.Linear;return(e===Ti||e===Sb||e===qc)&&(t=Kc.Nearest),t}_convertMipmapFilterMode(e){return e===qc||e===Vo?Kc.Linear:Kc.Nearest}_getBytesPerTexel(e){if(e===fe.R8Unorm||e===fe.R8Snorm||e===fe.R8Uint||e===fe.R8Sint)return 1;if(e===fe.R16Uint||e===fe.R16Sint||e===fe.R16Float||e===fe.RG8Unorm||e===fe.RG8Snorm||e===fe.RG8Uint||e===fe.RG8Sint||e===fe.R16Unorm||e===fe.R16Snorm)return 2;if(e===fe.R32Uint||e===fe.R32Sint||e===fe.R32Float||e===fe.RG16Uint||e===fe.RG16Sint||e===fe.RG16Float||e===fe.RGBA8Unorm||e===fe.RGBA8UnormSRGB||e===fe.RGBA8Snorm||e===fe.RGBA8Uint||e===fe.RGBA8Sint||e===fe.BGRA8Unorm||e===fe.BGRA8UnormSRGB||e===fe.RG16Unorm||e===fe.RG16Snorm||e===fe.RGB9E5UFloat||e===fe.RGB10A2Unorm||e===fe.RG11B10UFloat||e===fe.Depth32Float||e===fe.Depth24Plus||e===fe.Depth24PlusStencil8||e===fe.Depth32FloatStencil8)return 4;if(e===fe.RG32Uint||e===fe.RG32Sint||e===fe.RG32Float||e===fe.RGBA16Uint||e===fe.RGBA16Sint||e===fe.RGBA16Float||e===fe.RGBA16Unorm||e===fe.RGBA16Snorm)return 8;if(e===fe.RGBA32Uint||e===fe.RGBA32Sint||e===fe.RGBA32Float)return 16}_getTypedArrayType(e){if(e===fe.R8Uint)return Uint8Array;if(e===fe.R8Sint)return Int8Array;if(e===fe.R8Unorm)return Uint8Array;if(e===fe.R8Snorm)return Int8Array;if(e===fe.RG8Uint)return Uint8Array;if(e===fe.RG8Sint)return Int8Array;if(e===fe.RG8Unorm)return Uint8Array;if(e===fe.RG8Snorm)return Int8Array;if(e===fe.RGBA8Uint)return Uint8Array;if(e===fe.RGBA8Sint)return Int8Array;if(e===fe.RGBA8Unorm||e===fe.RGBA8UnormSRGB)return Uint8Array;if(e===fe.RGBA8Snorm)return Int8Array;if(e===fe.R16Uint)return Uint16Array;if(e===fe.R16Sint)return Int16Array;if(e===fe.RG16Uint)return Uint16Array;if(e===fe.RG16Sint)return Int16Array;if(e===fe.RGBA16Uint)return Uint16Array;if(e===fe.RGBA16Sint)return Int16Array;if(e===fe.R16Float||e===fe.RG16Float||e===fe.RGBA16Float||e===fe.R16Unorm)return Uint16Array;if(e===fe.R16Snorm)return Int16Array;if(e===fe.RG16Unorm)return Uint16Array;if(e===fe.RG16Snorm)return Int16Array;if(e===fe.RGBA16Unorm)return Uint16Array;if(e===fe.RGBA16Snorm)return Int16Array;if(e===fe.R32Uint)return Uint32Array;if(e===fe.R32Sint)return Int32Array;if(e===fe.R32Float)return Float32Array;if(e===fe.RG32Uint)return Uint32Array;if(e===fe.RG32Sint)return Int32Array;if(e===fe.RG32Float)return Float32Array;if(e===fe.RGBA32Uint)return Uint32Array;if(e===fe.RGBA32Sint)return Int32Array;if(e===fe.RGBA32Float)return Float32Array;if(e===fe.BGRA8Unorm||e===fe.BGRA8UnormSRGB)return Uint8Array;if(e===fe.RGB10A2Unorm||e===fe.RGB9E5UFloat||e===fe.RG11B10UFloat)return Uint32Array;if(e===fe.Depth32Float)return Float32Array;if(e===fe.Depth24Plus||e===fe.Depth24PlusStencil8)return Uint32Array;if(e===fe.Depth32FloatStencil8)return Float32Array}_getDimension(e){let t;return e.is3DTexture||e.isData3DTexture?t=Mte.ThreeD:t=Mte.TwoD,t}};function w9(i,e){let t=i.format,n=i.type,r=i.normalized,s=i.colorSpace,o=ln.getTransfer(s),a,l=!1;if(r&&(l=e.features.has(J4.TextureFormatsTier1),l===!1&&Xe("WebGPURenderer: Unable to use normalized textures without texture-formats-tier1 feature.")),i.isCompressedTexture===!0||i.isCompressedArrayTexture===!0)switch(t){case Vh:case Gh:a=o===kt?fe.BC1RGBAUnormSRGB:fe.BC1RGBAUnorm;break;case qh:a=o===kt?fe.BC2RGBAUnormSRGB:fe.BC2RGBAUnorm;break;case Hh:a=o===kt?fe.BC3RGBAUnormSRGB:fe.BC3RGBAUnorm;break;case O0:a=fe.BC4RUnorm;break;case U0:a=fe.BC4RSnorm;break;case jh:a=fe.BC5RGUnorm;break;case k0:a=fe.BC5RGSnorm;break;case N0:a=o===kt?fe.BC7RGBAUnormSRGB:fe.BC7RGBAUnorm;break;case F0:a=fe.BC6HRGBFloat;break;case B0:a=fe.BC6HRGBUFloat;break;case m0:case p0:a=o===kt?fe.ETC2RGB8UnormSRGB:fe.ETC2RGB8Unorm;break;case A0:a=o===kt?fe.ETC2RGBA8UnormSRGB:fe.ETC2RGBA8Unorm;break;case g0:a=fe.EACR11Unorm;break;case v0:a=fe.EACR11Snorm;break;case Wh:a=fe.EACRG11Unorm;break;case _0:a=fe.EACRG11Snorm;break;case x0:a=o===kt?fe.ASTC4x4UnormSRGB:fe.ASTC4x4Unorm;break;case y0:a=o===kt?fe.ASTC5x4UnormSRGB:fe.ASTC5x4Unorm;break;case b0:a=o===kt?fe.ASTC5x5UnormSRGB:fe.ASTC5x5Unorm;break;case w0:a=o===kt?fe.ASTC6x5UnormSRGB:fe.ASTC6x5Unorm;break;case S0:a=o===kt?fe.ASTC6x6UnormSRGB:fe.ASTC6x6Unorm;break;case T0:a=o===kt?fe.ASTC8x5UnormSRGB:fe.ASTC8x5Unorm;break;case E0:a=o===kt?fe.ASTC8x6UnormSRGB:fe.ASTC8x6Unorm;break;case M0:a=o===kt?fe.ASTC8x8UnormSRGB:fe.ASTC8x8Unorm;break;case C0:a=o===kt?fe.ASTC10x5UnormSRGB:fe.ASTC10x5Unorm;break;case R0:a=o===kt?fe.ASTC10x6UnormSRGB:fe.ASTC10x6Unorm;break;case I0:a=o===kt?fe.ASTC10x8UnormSRGB:fe.ASTC10x8Unorm;break;case P0:a=o===kt?fe.ASTC10x10UnormSRGB:fe.ASTC10x10Unorm;break;case L0:a=o===kt?fe.ASTC12x10UnormSRGB:fe.ASTC12x10Unorm;break;case D0:a=o===kt?fe.ASTC12x12UnormSRGB:fe.ASTC12x12Unorm;break;case Or:a=o===kt?fe.RGBA8UnormSRGB:fe.RGBA8Unorm;break;default:ze("WebGPURenderer: Unsupported texture format.",t)}else switch(t){case Or:switch(n){case Oh:a=fe.RGBA8Snorm;break;case Uh:a=l?fe.RGBA16Snorm:fe.RGBA16Sint;break;case bl:a=l?fe.RGBA16Unorm:fe.RGBA16Uint;break;case xi:a=fe.RGBA32Uint;break;case Zr:a=fe.RGBA32Sint;break;case Ji:a=o===kt?fe.RGBA8UnormSRGB:fe.RGBA8Unorm;break;case Wi:a=fe.RGBA16Float;break;case cr:a=fe.RGBA32Float;break;default:ze("WebGPURenderer: Unsupported texture type with RGBAFormat.",n)}break;case Pd:switch(n){case JA:a=fe.RGB9E5UFloat;break;case eg:a=fe.RG11B10UFloat;break;default:ze("WebGPURenderer: Unsupported texture type with RGBFormat.",n)}break;case Ld:switch(n){case Oh:a=fe.R8Snorm;break;case Uh:a=l?fe.R16Snorm:fe.R16Sint;break;case bl:a=l?fe.R16Unorm:fe.R16Uint;break;case xi:a=fe.R32Uint;break;case Zr:a=fe.R32Sint;break;case Ji:a=fe.R8Unorm;break;case Wi:a=fe.R16Float;break;case cr:a=fe.R32Float;break;default:ze("WebGPURenderer: Unsupported texture type with RedFormat.",n)}break;case js:switch(n){case Oh:a=fe.RG8Snorm;break;case Uh:a=l?fe.RG16Snorm:fe.RG16Sint;break;case bl:a=l?fe.RG16Unorm:fe.RG16Uint;break;case xi:a=fe.RG32Uint;break;case Zr:a=fe.RG32Sint;break;case Ji:a=fe.RG8Unorm;break;case Wi:a=fe.RG16Float;break;case cr:a=fe.RG32Float;break;default:ze("WebGPURenderer: Unsupported texture type with RGFormat.",n)}break;case Gs:switch(n){case bl:a=fe.Depth16Unorm;break;case xi:a=fe.Depth24Plus;break;case cr:a=fe.Depth32Float;break;default:ze("WebGPURenderer: Unsupported texture type with DepthFormat.",n)}break;case xo:switch(n){case ca:a=fe.Depth24PlusStencil8;break;case cr:e&&e.features.has(J4.Depth32FloatStencil8)===!1&&ze('WebGPURenderer: Depth textures with DepthStencilFormat + FloatType can only be used with the "depth32float-stencil8" GPU feature.'),a=fe.Depth32FloatStencil8;break;default:ze("WebGPURenderer: Unsupported texture type with DepthStencilFormat.",n)}break;case kh:switch(n){case Zr:a=fe.R32Sint;break;case xi:a=fe.R32Uint;break;default:ze("WebGPURenderer: Unsupported texture type with RedIntegerFormat.",n)}break;case zh:switch(n){case Zr:a=fe.RG32Sint;break;case xi:a=fe.RG32Uint;break;default:ze("WebGPURenderer: Unsupported texture type with RGIntegerFormat.",n)}break;case d0:switch(n){case Zr:a=fe.RGBA32Sint;break;case xi:a=fe.RGBA32Uint;break;default:ze("WebGPURenderer: Unsupported texture type with RGBAIntegerFormat.",n)}break;default:ze("WebGPURenderer: Unsupported texture format.",t)}return a}var tPe=/^[fn]*\s*([a-z_0-9]+)?\s*\(([\s\S]*?)\)\s*[\-\>]*\s*([a-z_0-9]+(?:<[\s\S]+?>)?)/i,nPe=/([a-z_0-9]+)\s*:\s*([a-z_0-9]+(?:<[\s\S]+?>)?)/ig,Ite={f32:"float",i32:"int",u32:"uint",bool:"bool","vec2<f32>":"vec2","vec2<i32>":"ivec2","vec2<u32>":"uvec2","vec2<bool>":"bvec2",vec2f:"vec2",vec2i:"ivec2",vec2u:"uvec2",vec2b:"bvec2","vec3<f32>":"vec3","vec3<i32>":"ivec3","vec3<u32>":"uvec3","vec3<bool>":"bvec3",vec3f:"vec3",vec3i:"ivec3",vec3u:"uvec3",vec3b:"bvec3","vec4<f32>":"vec4","vec4<i32>":"ivec4","vec4<u32>":"uvec4","vec4<bool>":"bvec4",vec4f:"vec4",vec4i:"ivec4",vec4u:"uvec4",vec4b:"bvec4","mat2x2<f32>":"mat2",mat2x2f:"mat2","mat3x3<f32>":"mat3",mat3x3f:"mat3","mat4x4<f32>":"mat4",mat4x4f:"mat4",sampler:"sampler",texture_1d:"texture",texture_2d:"texture",texture_2d_array:"texture",texture_multisampled_2d:"cubeTexture",texture_depth_2d:"depthTexture",texture_depth_2d_array:"depthTexture",texture_depth_multisampled_2d:"depthTexture",texture_depth_cube:"depthTexture",texture_depth_cube_array:"depthTexture",texture_3d:"texture3D",texture_cube:"cubeTexture",texture_cube_array:"cubeTexture",texture_storage_1d:"storageTexture",texture_storage_2d:"storageTexture",texture_storage_2d_array:"storageTexture",texture_storage_3d:"storageTexture"},iPe=i=>{i=i.trim();let e=i.match(tPe);if(e!==null&&e.length===4){let t=e[2],n=[],r=null;for(;(r=nPe.exec(t))!==null;)n.push({name:r[1],type:r[2]});let s=[];for(let u=0;u<n.length;u++){let{name:f,type:d}=n[u],A=d;A.startsWith("ptr")?A="pointer":(A.startsWith("texture")&&(A=d.split("<")[0]),A=Ite[A]),s.push(new xS(A,f))}let o=i.substring(e[0].length),a=e[3]||"void",l=e[1]!==void 0?e[1]:"";return{type:Ite[a]||a,inputs:s,name:l,inputsCode:t,blockCode:o,outputType:a}}else throw new Error("THREE.WGSLNodeFunction: Function is not a WGSL code.")},S9=class extends bS{constructor(e){let{type:t,inputs:n,name:r,inputsCode:s,blockCode:o,outputType:a}=iPe(e);super(t,n,r),this.inputsCode=s,this.blockCode=o,this.outputType=a}getCode(e=this.name){let t=this.outputType!=="void"?"-> "+this.outputType:"";return`fn ${e} ( ${this.inputsCode.trim()} ) ${t}`+this.blockCode}},T9=class extends k4{parseFunction(e){return new S9(e)}},rPe={[$o.READ_ONLY]:"read",[$o.WRITE_ONLY]:"write",[$o.READ_WRITE]:"read_write"},Pte={[wd]:"repeat",[aa]:"clamp",[Sd]:"mirror"},JO={vertex:yf.VERTEX,fragment:yf.FRAGMENT,compute:yf.COMPUTE},Lte={instance:!0,swizzleAssign:!1,storageBuffer:!0},sPe={"^^":"tsl_xor"},oPe={float:"f32",int:"i32",uint:"u32",bool:"bool",color:"vec3<f32>",vec2:"vec2<f32>",ivec2:"vec2<i32>",uvec2:"vec2<u32>",bvec2:"vec2<bool>",vec3:"vec3<f32>",ivec3:"vec3<i32>",uvec3:"vec3<u32>",bvec3:"vec3<bool>",vec4:"vec4<f32>",ivec4:"vec4<i32>",uvec4:"vec4<u32>",bvec4:"vec4<bool>",mat2:"mat2x2<f32>",mat3:"mat3x3<f32>",mat4:"mat4x4<f32>"},Dte={},qw={tsl_xor:new hr("fn tsl_xor( a : bool, b : bool ) -> bool { return ( a || b ) && !( a && b ); }"),mod_float:new hr("fn tsl_mod_float( x : f32, y : f32 ) -> f32 { return x - y * floor( x / y ); }"),mod_vec2:new hr("fn tsl_mod_vec2( x : vec2f, y : vec2f ) -> vec2f { return x - y * floor( x / y ); }"),mod_vec3:new hr("fn tsl_mod_vec3( x : vec3f, y : vec3f ) -> vec3f { return x - y * floor( x / y ); }"),mod_vec4:new hr("fn tsl_mod_vec4( x : vec4f, y : vec4f ) -> vec4f { return x - y * floor( x / y ); }"),equals_bool:new hr("fn tsl_equals_bool( a : bool, b : bool ) -> bool { return a == b; }"),equals_bvec2:new hr("fn tsl_equals_bvec2( a : vec2f, b : vec2f ) -> vec2<bool> { return vec2<bool>( a.x == b.x, a.y == b.y ); }"),equals_bvec3:new hr("fn tsl_equals_bvec3( a : vec3f, b : vec3f ) -> vec3<bool> { return vec3<bool>( a.x == b.x, a.y == b.y, a.z == b.z ); }"),equals_bvec4:new hr("fn tsl_equals_bvec4( a : vec4f, b : vec4f ) -> vec4<bool> { return vec4<bool>( a.x == b.x, a.y == b.y, a.z == b.z, a.w == b.w ); }"),repeatWrapping_float:new hr("fn tsl_repeatWrapping_float( coord: f32 ) -> f32 { return fract( coord ); }"),mirrorWrapping_float:new hr("fn tsl_mirrorWrapping_float( coord: f32 ) -> f32 { let mirrored = fract( coord * 0.5 ) * 2.0; return 1.0 - abs( 1.0 - mirrored ); }"),clampWrapping_float:new hr("fn tsl_clampWrapping_float( coord: f32 ) -> f32 { return clamp( coord, 0.0, 1.0 ); }"),inverse_mat2:new hr(`4444+`;this.mipmapSampler=e.createSampler({minFilter:Kc.Linear}),this.flipYSampler=e.createSampler({minFilter:Kc.Nearest}),rm.size=4,rm.usage=GPUBufferUsage.UNIFORM|GPUBufferUsage.COPY_DST,this.flipUniformBuffer=e.createBuffer(rm),rm.reset(),e.queue.writeBuffer(this.flipUniformBuffer,0,new Uint32Array([1])),rm.size=4,rm.usage=GPUBufferUsage.UNIFORM,this.noFlipUniformBuffer=e.createBuffer(rm),rm.reset(),this.transferPipelines={},GR.label="mipmap",GR.code=t,this.mipmapShaderModule=e.createShaderModule(GR),GR.reset()}getTransferPipeline(e,t){t=t||"2d-array";let n=`${e}-${t}`,r=this.transferPipelines[n];return r===void 0&&($_.label=`mipmap-${e}-${t}`,$_.vertex={module:this.mipmapShaderModule},$_.fragment={module:this.mipmapShaderModule,entryPoint:`main_${t.replace("-","_")}`,targets:[{format:e}]},$_.layout="auto",r=this.device.createRenderPipeline($_),$_.reset(),this.transferPipelines[n]=r),r}flipY(e,t,n=0){let r=t.format,{width:s,height:o}=t.size;Y_.size.width=s,Y_.size.height=o,Y_.format=r,Y_.usage=GPUTextureUsage.RENDER_ATTACHMENT|GPUTextureUsage.TEXTURE_BINDING;let a=this.device.createTexture(Y_);Y_.reset();let l=this.getTransferPipeline(r,e.textureBindingViewDimension),c=this.getTransferPipeline(r,a.textureBindingViewDimension),u=this.device.createCommandEncoder(VR),f=(d,A,y,w,S,T)=>{let R=d.getBindGroupLayout(0);vs.dimension=A.textureBindingViewDimension||"2d-array",vs.mipLevelCount=1;let I=A.createView(vs);vs.reset(),im.layout=R,im.entries.push({binding:0,resource:this.flipYSampler},{binding:1,resource:I},{binding:2,resource:{buffer:T?this.flipUniformBuffer:this.noFlipUniformBuffer}});let P=this.device.createBindGroup(im);im.reset(),vs.dimension="2d",vs.mipLevelCount=1,vs.baseArrayLayer=S,vs.arrayLayerCount=1;let F=w.createView(vs);vs.reset(),$w.view=F,$w.loadOp=Fi.Clear,$w.storeOp=Za.Store,_U.colorAttachments.push($w);let D=u.beginRenderPass(_U);_U.reset(),$w.reset(),D.setPipeline(d),D.setBindGroup(0,P),D.draw(3,1,0,y),D.end()};f(l,e,n,a,0,!1),f(c,a,0,e,n,!0),mf(this.device,u.finish()),a.destroy()}generateMipmaps(e,t=null){let n=this.get(e),r=n.layers||this._mipmapCreateBundles(e),s=t;s===null&&(VR.label="mipmapEncoder",s=this.device.createCommandEncoder(VR),VR.reset()),this._mipmapRunBundles(s,r),t===null&&mf(this.device,s.finish()),n.layers=r}_mipmapCreateBundles(e){let t=e.textureBindingViewDimension||"2d-array",n=this.getTransferPipeline(e.format,t),r=n.getBindGroupLayout(0),s=[];for(let o=1;o<e.mipLevelCount;o++)for(let a=0;a<e.depthOrArrayLayers;a++){vs.dimension=t,vs.baseMipLevel=o-1,vs.mipLevelCount=1;let l=e.createView(vs);vs.reset(),im.layout=r,im.entries.push({binding:0,resource:this.mipmapSampler},{binding:1,resource:l},{binding:2,resource:{buffer:this.noFlipUniformBuffer}});let c=this.device.createBindGroup(im);im.reset(),vs.dimension="2d",vs.baseMipLevel=o,vs.mipLevelCount=1,vs.baseArrayLayer=a,vs.arrayLayerCount=1;let u=e.createView(vs);vs.reset();let f=new Zg;f.view=u,f.loadOp=Fi.Clear,f.storeOp=Za.Store;let d=new Kg;d.colorAttachments.push(f),vU.colorFormats=[e.format];let A=this.device.createRenderBundleEncoder(vU);vU.reset(),A.setPipeline(n),A.setBindGroup(0,c),A.draw(3,1,0,a),s.push({renderBundles:[A.finish()],passDescriptor:d})}return s}_mipmapRunBundles(e,t){let n=t.length;for(let r=0;r<n;r++){let s=t[r],o=e.beginRenderPass(s.passDescriptor);o.executeBundles(s.renderBundles),o.end()}}},U9=class{constructor(){this.label="",this.addressModeU="clamp-to-edge",this.addressModeV="clamp-to-edge",this.addressModeW="clamp-to-edge",this.magFilter="nearest",this.minFilter="nearest",this.mipmapFilter="nearest",this.lodMinClamp=0,this.lodMaxClamp=32,this.compare=void 0,this.maxAnisotropy=1}reset(){this.label="",this.addressModeU="clamp-to-edge",this.addressModeV="clamp-to-edge",this.addressModeW="clamp-to-edge",this.magFilter="nearest",this.minFilter="nearest",this.mipmapFilter="nearest",this.lodMinClamp=0,this.lodMaxClamp=32,this.compare=void 0,this.maxAnisotropy=1}},_x=class{constructor(){this.texture=null,this.mipLevel=0,this.origin={x:0,y:0,z:0},this.aspect="all"}reset(){this.texture=null,this.mipLevel=0,this.origin.x=0,this.origin.y=0,this.origin.z=0,this.aspect="all"}},k9=class{constructor(){this.buffer=null,this.offset=0,this.bytesPerRow=void 0,this.rowsPerImage=void 0}reset(){this.buffer=null,this.offset=0,this.bytesPerRow=void 0,this.rowsPerImage=void 0}},z9=class{constructor(){this.offset=0,this.bytesPerRow=void 0,this.rowsPerImage=void 0}reset(){this.offset=0,this.bytesPerRow=void 0,this.rowsPerImage=void 0}},V9=class{constructor(){this.source=null,this.origin={x:0,y:0},this.flipY=!1}reset(){this.source=null,this.origin.x=0,this.origin.y=0,this.flipY=!1}},G9=class extends _x{constructor(){super(),this.colorSpace="srgb",this.premultipliedAlpha=!1}reset(){super.reset(),this.colorSpace="srgb",this.premultipliedAlpha=!1}},fP=class{constructor(){this.width=0,this.height=1,this.depthOrArrayLayers=1}reset(){this.width=0,this.height=1,this.depthOrArrayLayers=1}},qR=new xm,DIe=new o1,ma=new U9,_a=new _x,HR=new k9,$d=new z9,WR=new V9,Z_=new G9,sm=new PS,ga=new fP,NIe={[Db]:"never",[h_]:"less",[Nb]:"equal",[Xh]:"less-equal",[ug]:"greater",[Fu]:"greater-equal",[Bb]:"always",[Fb]:"not-equal"},FIe=[0,1,3,2,4,5];function ene(i,e,t,n,r,s,o,a,l,c){_a.texture=e,_a.mipLevel=t,_a.origin.z=n,$d.offset=n*s,$d.bytesPerRow=o,$d.rowsPerImage=a,ga.width=l,ga.height=c,i.queue.writeTexture(_a,r.data,$d,ga),_a.reset(),$d.reset(),ga.reset()}var q9=class{constructor(e){this.backend=e,this._passUtils=null,this.defaultTexture={},this.defaultCubeTexture={},this.defaultVideoFrame=null,this._samplerCache=new Map}updateSampler(e){let t=this.backend,n=e.texture,r=e.textureNode,s=n.minFilter+"-"+n.magFilter+"-"+n.wrapS+"-"+n.wrapT+"-"+(n.wrapR||"0")+"-"+n.anisotropy+"-"+(n.isDepthTexture===!0?1:0)+"-"+(n.compareFunction!==null&&r.compareNode!==null?n.compareFunction:0),o=this._samplerCache.get(s);if(o===void 0){ma.addressModeU=this._convertAddressMode(n.wrapS),ma.addressModeV=this._convertAddressMode(n.wrapT),ma.addressModeW=this._convertAddressMode(n.wrapR),ma.magFilter=this._convertFilterMode(n.magFilter),ma.minFilter=this._convertFilterMode(n.minFilter),ma.mipmapFilter=this._convertMipmapFilterMode(n.minFilter),n.isDepthTexture&&(n.compareFunction===null||r.compareNode===null)&&(ma.magFilter=Kc.Nearest,ma.minFilter=Kc.Nearest,ma.mipmapFilter=Kc.Nearest),ma.magFilter===Kc.Linear&&ma.minFilter===Kc.Linear&&ma.mipmapFilter===Kc.Linear&&(ma.maxAnisotropy=n.anisotropy),n.isDepthTexture&&n.compareFunction!==null&&r.compareNode!==null&&t.hasCompatibility(Bd.TEXTURE_COMPARE)&&(ma.compare=NIe[n.compareFunction]);let l=t.device.createSampler(ma);ma.reset(),o={sampler:l,usedTimes:0},this._samplerCache.set(s,o)}let a=t.get(e);return a.sampler!==o.sampler&&(this._releaseSampler(a),a.samplerKey=s,a.sampler=o.sampler,o.usedTimes++),s}destroySampler(e){this._releaseSampler(this.backend.get(e))}_releaseSampler(e){if(e.sampler!==void 0){let t=this._samplerCache.get(e.samplerKey);t.usedTimes--,t.usedTimes===0&&this._samplerCache.delete(e.samplerKey),e.sampler=void 0,e.samplerKey=void 0}}createDefaultTexture(e){let t,n=H9(e,this.backend.device);e.isCubeTexture?t=this._getDefaultCubeTextureGPU(n):t=this._getDefaultTextureGPU(n),this.backend.get(e).texture=t}createTexture(e,t={}){let n=this.backend,r=n.get(e);if(r.initialized){if(r.externalTexture===!0)return;throw new Error("THREE.WebGPUTextureUtils: Texture already initialized.")}if(e.isExternalTexture){r.texture=e.sourceTexture,r.initialized=!0;return}t.needsMipmaps===void 0&&(t.needsMipmaps=!1),t.levels===void 0&&(t.levels=1),t.depth===void 0&&(t.depth=1);let{width:s,height:o,depth:a,levels:l}=t;e.isFramebufferTexture&&(t.renderTarget?t.format=this.backend.utils.getCurrentColorFormat(t.renderTarget):t.format=this.backend.utils.getPreferredCanvasFormat());let c=this._getDimension(e),u=e.internalFormat||t.format||H9(e,n.device);r.format=u;let{samples:f,primarySamples:d,isMSAA:A}=n.utils.getTextureSampleData(e),y=GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_DST|GPUTextureUsage.COPY_SRC;e.isStorageTexture===!0&&(y|=GPUTextureUsage.STORAGE_BINDING),e.isCompressedTexture!==!0&&e.isCompressedArrayTexture!==!0&&u!==fe.RGB9E5UFloat&&(y|=GPUTextureUsage.RENDER_ATTACHMENT);let w=new PS;if(w.label=e.name,w.size.width=s,w.size.height=o,w.size.depthOrArrayLayers=a,w.mipLevelCount=l,w.sampleCount=d,w.dimension=c,w.format=u,w.usage=y,u===void 0){Xe("WebGPURenderer: Texture format not supported."),this.createDefaultTexture(e);return}e.isCubeTexture&&(w.textureBindingViewDimension=Xo.Cube);try{r.texture=n.device.createTexture(w)}catch{Xe("WebGPURenderer: Failed to create texture with descriptor:",w),this.createDefaultTexture(e);return}if(A){let S=Object.assign({},w);S.label=S.label+"-msaa",S.sampleCount=f,S.mipLevelCount=1,r.msaaTexture=n.device.createTexture(S)}r.initialized=!0,r.textureDescriptorGPU=w}destroyTexture(e,t=!1){let n=this.backend,r=n.get(e);r.texture!==void 0&&t===!1&&e.isExternalTexture!==!0&&r.texture.destroy(),r.msaaTexture!==void 0&&r.msaaTexture.destroy(),n.delete(e)}generateMipmaps(e,t=null){let n=this.backend.get(e);this._generateMipmaps(n.texture,t)}getColorBuffer(){let e=this.backend,t=e.renderer.getCanvasTarget(),{width:n,height:r}=e.getDrawingBufferSize(),s=e.renderer.currentSamples,o=t.colorTexture,a=e.get(o);if(o.width===n&&o.height===r&&o.samples===s)return a.texture;let l=a.texture;return l&&l.destroy(),sm.label="colorBuffer",sm.size.width=n,sm.size.height=r,sm.sampleCount=e.utils.getSampleCount(e.renderer.currentSamples),sm.format=e.utils.getPreferredCanvasFormat(),sm.usage=GPUTextureUsage.RENDER_ATTACHMENT|GPUTextureUsage.COPY_SRC,l=e.device.createTexture(sm),sm.reset(),o.source.width=n,o.source.height=r,o.samples=s,a.texture=l,l}getDepthBuffer(e=!0,t=!1){let n=this.backend,r=n.renderer.getCanvasTarget(),{width:s,height:o}=n.getDrawingBufferSize(),a=n.renderer.currentSamples,l=r.depthTexture;if(l.width===s&&l.height===o&&l.samples===a&&l.depth===e&&l.stencil===t)return n.get(l).texture;let c=n.get(l).texture,u,f;if(t?(u=xo,f=n.renderer.reversedDepthBuffer===!0?cr:ua):e&&(u=Vs,f=n.renderer.reversedDepthBuffer===!0?cr:xi),c!==void 0){if(l.image.width===s&&l.image.height===o&&l.format===u&&l.type===f&&l.samples===a)return c;this.destroyTexture(l)}return l.name="depthBuffer",l.format=u,l.type=f,l.image.width=s,l.image.height=o,l.samples=a,this.createTexture(l,{width:s,height:o}),n.get(l).texture}updateTexture(e,t){let n=this.backend.get(e),r=e.mipmaps,{textureDescriptorGPU:s}=n;if(!(e.isRenderTargetTexture||s===void 0)){if(e.isDataTexture)if(r.length>0)for(let o=0,a=r.length;o<a;o++){let l=r[o];this._copyBufferToTexture(l,n.texture,s,0,e.flipY,0,o)}else this._copyBufferToTexture(t.image,n.texture,s,0,e.flipY);else if(e.isArrayTexture||e.isDataArrayTexture||e.isData3DTexture)if(e.layerUpdates&&e.layerUpdates.size>0){for(let o of e.layerUpdates)this._copyBufferToTexture(t.image,n.texture,s,o,e.flipY,o);e.clearLayerUpdates()}else for(let o=0;o<t.image.depth;o++)this._copyBufferToTexture(t.image,n.texture,s,o,e.flipY,o);else if(e.isCompressedTexture||e.isCompressedArrayTexture)e.isCompressedArrayTexture&&e.layerUpdates.size>0?(this._copyCompressedBufferToTexture(e.mipmaps,n.texture,s,e.layerUpdates),e.clearLayerUpdates()):this._copyCompressedBufferToTexture(e.mipmaps,n.texture,s);else if(e.isCubeTexture)this._copyCubeMapToTexture(e,n.texture,s);else if(e.isHTMLTexture){let o=this.backend.device,a=this.backend.renderer.domElement,l=e.image;if(typeof o.queue.copyElementImageToTexture!="function")return;if(!n.hasPaintCallback){n.hasPaintCallback=!0,a.requestPaint();return}let c=s.size.width,u=s.size.height;o.queue.copyElementImageToTexture.length===2?o.queue.copyElementImageToTexture({source:l},{destination:{texture:n.texture},width:c,height:u}):o.queue.copyElementImageToTexture(l,c,u,{texture:n.texture}),e.flipY&&this._flipY(n.texture,s)}else if(r.length>0)for(let o=0,a=r.length;o<a;o++){let l=r[o];this._copyImageToTexture(l,n.texture,s,0,e.flipY,e.premultiplyAlpha,o)}else this._copyImageToTexture(t.image,n.texture,s,0,e.flipY,e.premultiplyAlpha);n.version=e.version}}async copyTextureToBuffer(e,t,n,r,s,o){let a=this.backend.device,l=this.backend.get(e),c=l.texture,u=l.textureDescriptorGPU.format,f=this._getBytesPerTexel(u),d=r*f;d=Math.ceil(d/256)*256,qR.size=(s-1)*d+r*f,qR.usage=GPUBufferUsage.COPY_DST|GPUBufferUsage.MAP_READ;let A=a.createBuffer(qR);qR.reset();let y=a.createCommandEncoder(DIe);_a.texture=c,_a.origin.x=t,_a.origin.y=n,_a.origin.z=o,HR.buffer=A,HR.bytesPerRow=d,ga.width=r,ga.height=s,y.copyTextureToBuffer(_a,HR,ga),_a.reset(),HR.reset(),ga.reset();let w=this._getTypedArrayType(u);mf(a,y.finish()),await A.mapAsync(GPUMapMode.READ);let S=A.getMappedRange().slice();return A.destroy(),new w(S)}dispose(){this._samplerCache.clear()}_getDefaultTextureGPU(e){let t=this.defaultTexture[e];if(t===void 0){let n=new qs;n.minFilter=Ti,n.magFilter=Ti,this.createTexture(n,{width:1,height:1,format:e}),this.defaultTexture[e]=t=n}return this.backend.get(t).texture}_getDefaultCubeTextureGPU(e){let t=this.defaultCubeTexture[e];if(t===void 0){let n=new Ph;n.minFilter=Ti,n.magFilter=Ti,this.createTexture(n,{width:1,height:1,depth:6}),this.defaultCubeTexture[e]=t=n}return this.backend.get(t).texture}_copyCubeMapToTexture(e,t,n){let r=e.images,s=e.mipmaps;for(let o=0;o<6;o++){let a=r[o],l=e.flipY===!0?FIe[o]:o;a.isDataTexture?this._copyBufferToTexture(a.image,t,n,l,e.flipY):this._copyImageToTexture(a,t,n,l,e.flipY,e.premultiplyAlpha);for(let c=0;c<s.length;c++){let f=s[c].images[o];f.isDataTexture?this._copyBufferToTexture(f.image,t,n,l,e.flipY,0,c+1):this._copyImageToTexture(f,t,n,l,e.flipY,e.premultiplyAlpha,c+1)}}}_copyImageToTexture(e,t,n,r,s,o,a=0){let l=this.backend.device,c=a>0?e.width:n.size.width,u=a>0?e.height:n.size.height;WR.source=e,WR.flipY=s,Z_.texture=t,Z_.mipLevel=a,Z_.origin.z=r,Z_.premultipliedAlpha=o,ga.width=c,ga.height=u;try{l.queue.copyExternalImageToTexture(WR,Z_,ga)}catch{}finally{WR.reset(),Z_.reset(),ga.reset()}}_getPassUtils(){let e=this._passUtils;return e===null&&(this._passUtils=e=new O9(this.backend.device)),e}_generateMipmaps(e,t=null){this._getPassUtils().generateMipmaps(e,t)}_flipY(e,t,n=0){this._getPassUtils().flipY(e,t,n)}_copyBufferToTexture(e,t,n,r,s,o=0,a=0){let l=this.backend.device,c=e.data,u=this._getBytesPerTexel(n.format),f=e.width*u;_a.texture=t,_a.mipLevel=a,_a.origin.z=r,$d.offset=e.width*e.height*u*o,$d.bytesPerRow=f,ga.width=e.width,ga.height=e.height,l.queue.writeTexture(_a,c,$d,ga),_a.reset(),$d.reset(),ga.reset(),s===!0&&this._flipY(t,n,r)}_copyCompressedBufferToTexture(e,t,n,r=null){let s=this.backend.device,o=this._getBlockData(n.format),a=n.size.depthOrArrayLayers>1,l=r&&r.size>0?r:null;for(let c=0;c<e.length;c++){let u=e[c],f=u.width,d=u.height,A=a?n.size.depthOrArrayLayers:1,y=Math.ceil(f/o.width)*o.byteLength,w=Math.ceil(d/o.height),S=y*w,T=Math.ceil(f/o.width)*o.width,R=w*o.height;if(l!==null)for(let I of l)ene(s,t,c,I,u,S,y,w,T,R);else for(let I=0;I<A;I++)ene(s,t,c,I,u,S,y,w,T,R)}}_getBlockData(e){if(e===fe.BC1RGBAUnorm||e===fe.BC1RGBAUnormSRGB)return{byteLength:8,width:4,height:4};if(e===fe.BC2RGBAUnorm||e===fe.BC2RGBAUnormSRGB)return{byteLength:16,width:4,height:4};if(e===fe.BC3RGBAUnorm||e===fe.BC3RGBAUnormSRGB)return{byteLength:16,width:4,height:4};if(e===fe.BC4RUnorm||e===fe.BC4RSnorm)return{byteLength:8,width:4,height:4};if(e===fe.BC5RGUnorm||e===fe.BC5RGSnorm)return{byteLength:16,width:4,height:4};if(e===fe.BC6HRGBUFloat||e===fe.BC6HRGBFloat)return{byteLength:16,width:4,height:4};if(e===fe.BC7RGBAUnorm||e===fe.BC7RGBAUnormSRGB)return{byteLength:16,width:4,height:4};if(e===fe.ETC2RGB8Unorm||e===fe.ETC2RGB8UnormSRGB)return{byteLength:8,width:4,height:4};if(e===fe.ETC2RGB8A1Unorm||e===fe.ETC2RGB8A1UnormSRGB)return{byteLength:8,width:4,height:4};if(e===fe.ETC2RGBA8Unorm||e===fe.ETC2RGBA8UnormSRGB)return{byteLength:16,width:4,height:4};if(e===fe.EACR11Unorm)return{byteLength:8,width:4,height:4};if(e===fe.EACR11Snorm)return{byteLength:8,width:4,height:4};if(e===fe.EACRG11Unorm)return{byteLength:16,width:4,height:4};if(e===fe.EACRG11Snorm)return{byteLength:16,width:4,height:4};if(e===fe.ASTC4x4Unorm||e===fe.ASTC4x4UnormSRGB)return{byteLength:16,width:4,height:4};if(e===fe.ASTC5x4Unorm||e===fe.ASTC5x4UnormSRGB)return{byteLength:16,width:5,height:4};if(e===fe.ASTC5x5Unorm||e===fe.ASTC5x5UnormSRGB)return{byteLength:16,width:5,height:5};if(e===fe.ASTC6x5Unorm||e===fe.ASTC6x5UnormSRGB)return{byteLength:16,width:6,height:5};if(e===fe.ASTC6x6Unorm||e===fe.ASTC6x6UnormSRGB)return{byteLength:16,width:6,height:6};if(e===fe.ASTC8x5Unorm||e===fe.ASTC8x5UnormSRGB)return{byteLength:16,width:8,height:5};if(e===fe.ASTC8x6Unorm||e===fe.ASTC8x6UnormSRGB)return{byteLength:16,width:8,height:6};if(e===fe.ASTC8x8Unorm||e===fe.ASTC8x8UnormSRGB)return{byteLength:16,width:8,height:8};if(e===fe.ASTC10x5Unorm||e===fe.ASTC10x5UnormSRGB)return{byteLength:16,width:10,height:5};if(e===fe.ASTC10x6Unorm||e===fe.ASTC10x6UnormSRGB)return{byteLength:16,width:10,height:6};if(e===fe.ASTC10x8Unorm||e===fe.ASTC10x8UnormSRGB)return{byteLength:16,width:10,height:8};if(e===fe.ASTC10x10Unorm||e===fe.ASTC10x10UnormSRGB)return{byteLength:16,width:10,height:10};if(e===fe.ASTC12x10Unorm||e===fe.ASTC12x10UnormSRGB)return{byteLength:16,width:12,height:10};if(e===fe.ASTC12x12Unorm||e===fe.ASTC12x12UnormSRGB)return{byteLength:16,width:12,height:12}}_convertAddressMode(e){let t=pU.ClampToEdge;return e===Ed?t=pU.Repeat:e===Md&&(t=pU.MirrorRepeat),t}_convertFilterMode(e){let t=Kc.Linear;return(e===Ti||e===Pb||e===qc)&&(t=Kc.Nearest),t}_convertMipmapFilterMode(e){return e===qc||e===Go?Kc.Linear:Kc.Nearest}_getBytesPerTexel(e){if(e===fe.R8Unorm||e===fe.R8Snorm||e===fe.R8Uint||e===fe.R8Sint)return 1;if(e===fe.R16Uint||e===fe.R16Sint||e===fe.R16Float||e===fe.RG8Unorm||e===fe.RG8Snorm||e===fe.RG8Uint||e===fe.RG8Sint||e===fe.R16Unorm||e===fe.R16Snorm)return 2;if(e===fe.R32Uint||e===fe.R32Sint||e===fe.R32Float||e===fe.RG16Uint||e===fe.RG16Sint||e===fe.RG16Float||e===fe.RGBA8Unorm||e===fe.RGBA8UnormSRGB||e===fe.RGBA8Snorm||e===fe.RGBA8Uint||e===fe.RGBA8Sint||e===fe.BGRA8Unorm||e===fe.BGRA8UnormSRGB||e===fe.RG16Unorm||e===fe.RG16Snorm||e===fe.RGB9E5UFloat||e===fe.RGB10A2Unorm||e===fe.RG11B10UFloat||e===fe.Depth32Float||e===fe.Depth24Plus||e===fe.Depth24PlusStencil8||e===fe.Depth32FloatStencil8)return 4;if(e===fe.RG32Uint||e===fe.RG32Sint||e===fe.RG32Float||e===fe.RGBA16Uint||e===fe.RGBA16Sint||e===fe.RGBA16Float||e===fe.RGBA16Unorm||e===fe.RGBA16Snorm)return 8;if(e===fe.RGBA32Uint||e===fe.RGBA32Sint||e===fe.RGBA32Float)return 16}_getTypedArrayType(e){if(e===fe.R8Uint)return Uint8Array;if(e===fe.R8Sint)return Int8Array;if(e===fe.R8Unorm)return Uint8Array;if(e===fe.R8Snorm)return Int8Array;if(e===fe.RG8Uint)return Uint8Array;if(e===fe.RG8Sint)return Int8Array;if(e===fe.RG8Unorm)return Uint8Array;if(e===fe.RG8Snorm)return Int8Array;if(e===fe.RGBA8Uint)return Uint8Array;if(e===fe.RGBA8Sint)return Int8Array;if(e===fe.RGBA8Unorm||e===fe.RGBA8UnormSRGB)return Uint8Array;if(e===fe.RGBA8Snorm)return Int8Array;if(e===fe.R16Uint)return Uint16Array;if(e===fe.R16Sint)return Int16Array;if(e===fe.RG16Uint)return Uint16Array;if(e===fe.RG16Sint)return Int16Array;if(e===fe.RGBA16Uint)return Uint16Array;if(e===fe.RGBA16Sint)return Int16Array;if(e===fe.R16Float||e===fe.RG16Float||e===fe.RGBA16Float||e===fe.R16Unorm)return Uint16Array;if(e===fe.R16Snorm)return Int16Array;if(e===fe.RG16Unorm)return Uint16Array;if(e===fe.RG16Snorm)return Int16Array;if(e===fe.RGBA16Unorm)return Uint16Array;if(e===fe.RGBA16Snorm)return Int16Array;if(e===fe.R32Uint)return Uint32Array;if(e===fe.R32Sint)return Int32Array;if(e===fe.R32Float)return Float32Array;if(e===fe.RG32Uint)return Uint32Array;if(e===fe.RG32Sint)return Int32Array;if(e===fe.RG32Float)return Float32Array;if(e===fe.RGBA32Uint)return Uint32Array;if(e===fe.RGBA32Sint)return Int32Array;if(e===fe.RGBA32Float)return Float32Array;if(e===fe.BGRA8Unorm||e===fe.BGRA8UnormSRGB)return Uint8Array;if(e===fe.RGB10A2Unorm||e===fe.RGB9E5UFloat||e===fe.RG11B10UFloat)return Uint32Array;if(e===fe.Depth32Float)return Float32Array;if(e===fe.Depth24Plus||e===fe.Depth24PlusStencil8)return Uint32Array;if(e===fe.Depth32FloatStencil8)return Float32Array}_getDimension(e){let t;return e.is3DTexture||e.isData3DTexture?t=Qte.ThreeD:t=Qte.TwoD,t}};function H9(i,e){let t=i.format,n=i.type,r=i.normalized,s=i.colorSpace,o=ln.getTransfer(s),a,l=!1;if(r&&(l=e.features.has(aP.TextureFormatsTier1),l===!1&&Xe("WebGPURenderer: Unable to use normalized textures without texture-formats-tier1 feature.")),i.isCompressedTexture===!0||i.isCompressedArrayTexture===!0)switch(t){case Vh:case Gh:a=o===kt?fe.BC1RGBAUnormSRGB:fe.BC1RGBAUnorm;break;case qh:a=o===kt?fe.BC2RGBAUnormSRGB:fe.BC2RGBAUnorm;break;case Hh:a=o===kt?fe.BC3RGBAUnormSRGB:fe.BC3RGBAUnorm;break;case V0:a=fe.BC4RUnorm;break;case G0:a=fe.BC4RSnorm;break;case jh:a=fe.BC5RGUnorm;break;case q0:a=fe.BC5RGSnorm;break;case U0:a=o===kt?fe.BC7RGBAUnormSRGB:fe.BC7RGBAUnorm;break;case k0:a=fe.BC6HRGBFloat;break;case z0:a=fe.BC6HRGBUFloat;break;case _0:case v0:a=o===kt?fe.ETC2RGB8UnormSRGB:fe.ETC2RGB8Unorm;break;case x0:a=o===kt?fe.ETC2RGBA8UnormSRGB:fe.ETC2RGBA8Unorm;break;case y0:a=fe.EACR11Unorm;break;case b0:a=fe.EACR11Snorm;break;case Wh:a=fe.EACRG11Unorm;break;case w0:a=fe.EACRG11Snorm;break;case S0:a=o===kt?fe.ASTC4x4UnormSRGB:fe.ASTC4x4Unorm;break;case T0:a=o===kt?fe.ASTC5x4UnormSRGB:fe.ASTC5x4Unorm;break;case E0:a=o===kt?fe.ASTC5x5UnormSRGB:fe.ASTC5x5Unorm;break;case M0:a=o===kt?fe.ASTC6x5UnormSRGB:fe.ASTC6x5Unorm;break;case C0:a=o===kt?fe.ASTC6x6UnormSRGB:fe.ASTC6x6Unorm;break;case R0:a=o===kt?fe.ASTC8x5UnormSRGB:fe.ASTC8x5Unorm;break;case P0:a=o===kt?fe.ASTC8x6UnormSRGB:fe.ASTC8x6Unorm;break;case I0:a=o===kt?fe.ASTC8x8UnormSRGB:fe.ASTC8x8Unorm;break;case L0:a=o===kt?fe.ASTC10x5UnormSRGB:fe.ASTC10x5Unorm;break;case D0:a=o===kt?fe.ASTC10x6UnormSRGB:fe.ASTC10x6Unorm;break;case N0:a=o===kt?fe.ASTC10x8UnormSRGB:fe.ASTC10x8Unorm;break;case F0:a=o===kt?fe.ASTC10x10UnormSRGB:fe.ASTC10x10Unorm;break;case B0:a=o===kt?fe.ASTC12x10UnormSRGB:fe.ASTC12x10Unorm;break;case O0:a=o===kt?fe.ASTC12x12UnormSRGB:fe.ASTC12x12Unorm;break;case Or:a=o===kt?fe.RGBA8UnormSRGB:fe.RGBA8Unorm;break;default:ze("WebGPURenderer: Unsupported texture format.",t)}else switch(t){case Or:switch(n){case Oh:a=fe.RGBA8Snorm;break;case Uh:a=l?fe.RGBA16Snorm:fe.RGBA16Sint;break;case wl:a=l?fe.RGBA16Unorm:fe.RGBA16Uint;break;case xi:a=fe.RGBA32Uint;break;case Kr:a=fe.RGBA32Sint;break;case Ji:a=o===kt?fe.RGBA8UnormSRGB:fe.RGBA8Unorm;break;case Wi:a=fe.RGBA16Float;break;case cr:a=fe.RGBA32Float;break;default:ze("WebGPURenderer: Unsupported texture type with RGBAFormat.",n)}break;case Nd:switch(n){case rg:a=fe.RGB9E5UFloat;break;case sg:a=fe.RG11B10UFloat;break;default:ze("WebGPURenderer: Unsupported texture type with RGBFormat.",n)}break;case Fd:switch(n){case Oh:a=fe.R8Snorm;break;case Uh:a=l?fe.R16Snorm:fe.R16Sint;break;case wl:a=l?fe.R16Unorm:fe.R16Uint;break;case xi:a=fe.R32Uint;break;case Kr:a=fe.R32Sint;break;case Ji:a=fe.R8Unorm;break;case Wi:a=fe.R16Float;break;case cr:a=fe.R32Float;break;default:ze("WebGPURenderer: Unsupported texture type with RedFormat.",n)}break;case Ws:switch(n){case Oh:a=fe.RG8Snorm;break;case Uh:a=l?fe.RG16Snorm:fe.RG16Sint;break;case wl:a=l?fe.RG16Unorm:fe.RG16Uint;break;case xi:a=fe.RG32Uint;break;case Kr:a=fe.RG32Sint;break;case Ji:a=fe.RG8Unorm;break;case Wi:a=fe.RG16Float;break;case cr:a=fe.RG32Float;break;default:ze("WebGPURenderer: Unsupported texture type with RGFormat.",n)}break;case Vs:switch(n){case wl:a=fe.Depth16Unorm;break;case xi:a=fe.Depth24Plus;break;case cr:a=fe.Depth32Float;break;default:ze("WebGPURenderer: Unsupported texture type with DepthFormat.",n)}break;case xo:switch(n){case ua:a=fe.Depth24PlusStencil8;break;case cr:e&&e.features.has(aP.Depth32FloatStencil8)===!1&&ze('WebGPURenderer: Depth textures with DepthStencilFormat + FloatType can only be used with the "depth32float-stencil8" GPU feature.'),a=fe.Depth32FloatStencil8;break;default:ze("WebGPURenderer: Unsupported texture type with DepthStencilFormat.",n)}break;case kh:switch(n){case Kr:a=fe.R32Sint;break;case xi:a=fe.R32Uint;break;default:ze("WebGPURenderer: Unsupported texture type with RedIntegerFormat.",n)}break;case zh:switch(n){case Kr:a=fe.RG32Sint;break;case xi:a=fe.RG32Uint;break;default:ze("WebGPURenderer: Unsupported texture type with RGIntegerFormat.",n)}break;case g0:switch(n){case Kr:a=fe.RGBA32Sint;break;case xi:a=fe.RGBA32Uint;break;default:ze("WebGPURenderer: Unsupported texture type with RGBAIntegerFormat.",n)}break;default:ze("WebGPURenderer: Unsupported texture format.",t)}return a}var BIe=/^[fn]*\s*([a-z_0-9]+)?\s*\(([\s\S]*?)\)\s*[\-\>]*\s*([a-z_0-9]+(?:<[\s\S]+?>)?)/i,OIe=/([a-z_0-9]+)\s*:\s*([a-z_0-9]+(?:<[\s\S]+?>)?)/ig,tne={f32:"float",i32:"int",u32:"uint",bool:"bool","vec2<f32>":"vec2","vec2<i32>":"ivec2","vec2<u32>":"uvec2","vec2<bool>":"bvec2",vec2f:"vec2",vec2i:"ivec2",vec2u:"uvec2",vec2b:"bvec2","vec3<f32>":"vec3","vec3<i32>":"ivec3","vec3<u32>":"uvec3","vec3<bool>":"bvec3",vec3f:"vec3",vec3i:"ivec3",vec3u:"uvec3",vec3b:"bvec3","vec4<f32>":"vec4","vec4<i32>":"ivec4","vec4<u32>":"uvec4","vec4<bool>":"bvec4",vec4f:"vec4",vec4i:"ivec4",vec4u:"uvec4",vec4b:"bvec4","mat2x2<f32>":"mat2",mat2x2f:"mat2","mat3x3<f32>":"mat3",mat3x3f:"mat3","mat4x4<f32>":"mat4",mat4x4f:"mat4",sampler:"sampler",texture_1d:"texture",texture_2d:"texture",texture_2d_array:"texture",texture_multisampled_2d:"cubeTexture",texture_depth_2d:"depthTexture",texture_depth_2d_array:"depthTexture",texture_depth_multisampled_2d:"depthTexture",texture_depth_cube:"depthTexture",texture_depth_cube_array:"depthTexture",texture_3d:"texture3D",texture_cube:"cubeTexture",texture_cube_array:"cubeTexture",texture_storage_1d:"storageTexture",texture_storage_2d:"storageTexture",texture_storage_2d_array:"storageTexture",texture_storage_3d:"storageTexture"},UIe=i=>{i=i.trim();let e=i.match(BIe);if(e!==null&&e.length===4){let t=e[2],n=[],r=null;for(;(r=OIe.exec(t))!==null;)n.push({name:r[1],type:r[2]});let s=[];for(let u=0;u<n.length;u++){let{name:f,type:d}=n[u],A=d;A.startsWith("ptr")?A="pointer":(A.startsWith("texture")&&(A=d.split("<")[0]),A=tne[A]),s.push(new ES(A,f))}let o=i.substring(e[0].length),a=e[3]||"void",l=e[1]!==void 0?e[1]:"";return{type:tne[a]||a,inputs:s,name:l,inputsCode:t,blockCode:o,outputType:a}}else throw new Error("THREE.WGSLNodeFunction: Function is not a WGSL code.")},W9=class extends CS{constructor(e){let{type:t,inputs:n,name:r,inputsCode:s,blockCode:o,outputType:a}=UIe(e);super(t,n,r),this.inputsCode=s,this.blockCode=o,this.outputType=a}getCode(e=this.name){let t=this.outputType!=="void"?"-> "+this.outputType:"";return`fn ${e} ( ${this.inputsCode.trim()} ) ${t}`+this.blockCode}},j9=class extends X4{parseFunction(e){return new W9(e)}},kIe={[Yo.READ_ONLY]:"read",[Yo.WRITE_ONLY]:"write",[Yo.READ_WRITE]:"read_write"},nne={[Ed]:"repeat",[la]:"clamp",[Md]:"mirror"},xU={vertex:yf.VERTEX,fragment:yf.FRAGMENT,compute:yf.COMPUTE},ine={instance:!0,swizzleAssign:!1,storageBuffer:!0},zIe={"^^":"tsl_xor"},VIe={float:"f32",int:"i32",uint:"u32",bool:"bool",color:"vec3<f32>",vec2:"vec2<f32>",ivec2:"vec2<i32>",uvec2:"vec2<u32>",bvec2:"vec2<bool>",vec3:"vec3<f32>",ivec3:"vec3<i32>",uvec3:"vec3<u32>",bvec3:"vec3<bool>",vec4:"vec4<f32>",ivec4:"vec4<i32>",uvec4:"vec4<u32>",bvec4:"vec4<bool>",mat2:"mat2x2<f32>",mat3:"mat3x3<f32>",mat4:"mat4x4<f32>"},rne={},Yw={tsl_xor:new hr("fn tsl_xor( a : bool, b : bool ) -> bool { return ( a || b ) && !( a && b ); }"),mod_float:new hr("fn tsl_mod_float( x : f32, y : f32 ) -> f32 { return x - y * floor( x / y ); }"),mod_vec2:new hr("fn tsl_mod_vec2( x : vec2f, y : vec2f ) -> vec2f { return x - y * floor( x / y ); }"),mod_vec3:new hr("fn tsl_mod_vec3( x : vec3f, y : vec3f ) -> vec3f { return x - y * floor( x / y ); }"),mod_vec4:new hr("fn tsl_mod_vec4( x : vec4f, y : vec4f ) -> vec4f { return x - y * floor( x / y ); }"),equals_bool:new hr("fn tsl_equals_bool( a : bool, b : bool ) -> bool { return a == b; }"),equals_bvec2:new hr("fn tsl_equals_bvec2( a : vec2f, b : vec2f ) -> vec2<bool> { return vec2<bool>( a.x == b.x, a.y == b.y ); }"),equals_bvec3:new hr("fn tsl_equals_bvec3( a : vec3f, b : vec3f ) -> vec3<bool> { return vec3<bool>( a.x == b.x, a.y == b.y, a.z == b.z ); }"),equals_bvec4:new hr("fn tsl_equals_bvec4( a : vec4f, b : vec4f ) -> vec4<bool> { return vec4<bool>( a.x == b.x, a.y == b.y, a.z == b.z, a.w == b.w ); }"),repeatWrapping_float:new hr("fn tsl_repeatWrapping_float( coord: f32 ) -> f32 { return fract( coord ); }"),mirrorWrapping_float:new hr("fn tsl_mirrorWrapping_float( coord: f32 ) -> f32 { let mirrored = fract( coord * 0.5 ) * 2.0; return 1.0 - abs( 1.0 - mirrored ); }"),clampWrapping_float:new hr("fn tsl_clampWrapping_float( coord: f32 ) -> f32 { return clamp( coord, 0.0, 1.0 ); }"),inverse_mat2:new hr(`44454445 fn tsl_inverse_mat2( m : mat2x2<f32> ) -> mat2x2<f32> {44464446 44474447 let det = m[ 0 ][ 0 ] * m[ 1 ][ 1 ] - m[ 0 ][ 1 ] * m[ 1 ][ 0 ];@@ -4559,17 +4559,17 @@ fn tsl_biquadraticTexture_array( map : texture_2d_array<f32>, coord : vec2f, iRe
45594559 return mix( mix( rg1, rg2, f.x ), mix( rg3, rg4, f.x ), f.y );45604560 45614561 }4562-`)},aPe={dFdx:"dpdx",dFdy:"- dpdy",mod_float:"tsl_mod_float",mod_vec2:"tsl_mod_vec2",mod_vec3:"tsl_mod_vec3",mod_vec4:"tsl_mod_vec4",equals_bool:"tsl_equals_bool",equals_bvec2:"tsl_equals_bvec2",equals_bvec3:"tsl_equals_bvec3",equals_bvec4:"tsl_equals_bvec4",inverse_mat2:"tsl_inverse_mat2",inverse_mat3:"tsl_inverse_mat3",inverse_mat4:"tsl_inverse_mat4",inversesqrt:"inverseSqrt",bitcast:"bitcast<f32>",floatpack_snorm_2x16:"pack2x16snorm",floatpack_unorm_2x16:"pack2x16unorm",floatpack_float16_2x16:"pack2x16float",floatunpack_snorm_2x16:"unpack2x16snorm",floatunpack_unorm_2x16:"unpack2x16unorm",floatunpack_float16_2x16:"unpack2x16float"},Wse="";(typeof navigator<"u"&&/Firefox|Deno/g.test(navigator.userAgent))!==!0&&(Wse+=`diagnostic( off, derivative_uniformity );4563-`);var E9=class extends O4{constructor(e,t){super(e,t,new T9),this.uniformGroups={},this.uniformGroupsBindings={},this.builtins={},this.directives={},this.scopedArrays=new Map,this.allowEarlyReturns=!0,this.allowGlobalVariables=!0}_generateTextureSample(e,t,n,r,s,o=this.shaderStage){return o==="fragment"?r?s?`textureSample( ${t}, ${t}_sampler, ${n}, ${r}, ${s} )`:`textureSample( ${t}, ${t}_sampler, ${n}, ${r} )`:s?`textureSample( ${t}, ${t}_sampler, ${n}, ${s} )`:`textureSample( ${t}, ${t}_sampler, ${n} )`:this.generateTextureSampleLevel(e,t,n,"0",r)}generateTextureSampleLevel(e,t,n,r,s,o){return this.isUnfilterable(e)===!1?s?o?`textureSampleLevel( ${t}, ${t}_sampler, ${n}, ${s}, ${r}, ${o} )`:`textureSampleLevel( ${t}, ${t}_sampler, ${n}, ${s}, ${r} )`:o?`textureSampleLevel( ${t}, ${t}_sampler, ${n}, ${r}, ${o} )`:`textureSampleLevel( ${t}, ${t}_sampler, ${n}, ${r} )`:this.isFilteredTexture(e)?this.generateFilteredTexture(e,t,n,o,r,s):this.generateTextureLod(e,t,n,s,o,r)}generateWrapFunction(e){let t=`tsl_coord_${Pte[e.wrapS]}S_${Pte[e.wrapT]}T_${e.is3DTexture||e.isData3DTexture?"3d":"2d"}`,n=Dte[t];if(n===void 0){let r=[],s=e.is3DTexture||e.isData3DTexture?"vec3f":"vec2f",o=`fn ${t}( coord : ${s} ) -> ${s} {4562+`)},GIe={dFdx:"dpdx",dFdy:"- dpdy",mod_float:"tsl_mod_float",mod_vec2:"tsl_mod_vec2",mod_vec3:"tsl_mod_vec3",mod_vec4:"tsl_mod_vec4",equals_bool:"tsl_equals_bool",equals_bvec2:"tsl_equals_bvec2",equals_bvec3:"tsl_equals_bvec3",equals_bvec4:"tsl_equals_bvec4",inverse_mat2:"tsl_inverse_mat2",inverse_mat3:"tsl_inverse_mat3",inverse_mat4:"tsl_inverse_mat4",inversesqrt:"inverseSqrt",bitcast:"bitcast<f32>",floatpack_snorm_2x16:"pack2x16snorm",floatpack_unorm_2x16:"pack2x16unorm",floatpack_float16_2x16:"pack2x16float",floatunpack_snorm_2x16:"unpack2x16snorm",floatunpack_unorm_2x16:"unpack2x16unorm",floatunpack_float16_2x16:"unpack2x16float"},Aoe="";(typeof navigator<"u"&&/Firefox|Deno/g.test(navigator.userAgent))!==!0&&(Aoe+=`diagnostic( off, derivative_uniformity );4563+`);var X9=class extends W4{constructor(e,t){super(e,t,new j9),this.uniformGroups={},this.uniformGroupsBindings={},this.builtins={},this.directives={},this.scopedArrays=new Map,this.allowEarlyReturns=!0,this.allowGlobalVariables=!0}_generateTextureSample(e,t,n,r,s,o=this.shaderStage){return o==="fragment"?r?s?`textureSample( ${t}, ${t}_sampler, ${n}, ${r}, ${s} )`:`textureSample( ${t}, ${t}_sampler, ${n}, ${r} )`:s?`textureSample( ${t}, ${t}_sampler, ${n}, ${s} )`:`textureSample( ${t}, ${t}_sampler, ${n} )`:this.generateTextureSampleLevel(e,t,n,"0",r)}generateTextureSampleLevel(e,t,n,r,s,o){return this.isUnfilterable(e)===!1?s?o?`textureSampleLevel( ${t}, ${t}_sampler, ${n}, ${s}, ${r}, ${o} )`:`textureSampleLevel( ${t}, ${t}_sampler, ${n}, ${s}, ${r} )`:o?`textureSampleLevel( ${t}, ${t}_sampler, ${n}, ${r}, ${o} )`:`textureSampleLevel( ${t}, ${t}_sampler, ${n}, ${r} )`:this.isFilteredTexture(e)?this.generateFilteredTexture(e,t,n,o,r,s):this.generateTextureLod(e,t,n,s,o,r)}generateWrapFunction(e){let t=`tsl_coord_${nne[e.wrapS]}S_${nne[e.wrapT]}T_${e.is3DTexture||e.isData3DTexture?"3d":"2d"}`,n=rne[t];if(n===void 0){let r=[],s=e.is3DTexture||e.isData3DTexture?"vec3f":"vec2f",o=`fn ${t}( coord : ${s} ) -> ${s} {45644564 45654565 return ${s}(4566-`,a=(l,c)=>{l===wd?(r.push(qw.repeatWrapping_float),o+=` tsl_repeatWrapping_float( coord.${c} )`):l===aa?(r.push(qw.clampWrapping_float),o+=` tsl_clampWrapping_float( coord.${c} )`):l===Sd?(r.push(qw.mirrorWrapping_float),o+=` tsl_mirrorWrapping_float( coord.${c} )`):(o+=` coord.${c}`,Xe(`WebGPURenderer: Unsupported texture wrap type "${l}" for vertex shader.`))};a(e.wrapS,"x"),o+=`,4566+`,a=(l,c)=>{l===Ed?(r.push(Yw.repeatWrapping_float),o+=` tsl_repeatWrapping_float( coord.${c} )`):l===la?(r.push(Yw.clampWrapping_float),o+=` tsl_clampWrapping_float( coord.${c} )`):l===Md?(r.push(Yw.mirrorWrapping_float),o+=` tsl_mirrorWrapping_float( coord.${c} )`):(o+=` coord.${c}`,Xe(`WebGPURenderer: Unsupported texture wrap type "${l}" for vertex shader.`))};a(e.wrapS,"x"),o+=`,45674567 `,a(e.wrapT,"y"),(e.is3DTexture||e.isData3DTexture)&&(o+=`,45684568 `,a(e.wrapR,"z")),o+=`45694569 );45704570 45714571 }4572-`,Dte[t]=n=new hr(o,r)}return n.build(this),t}generateArrayDeclaration(e,t){return`array< ${this.getType(e)}, ${t} >`}generateTextureDimension(e,t,n){let r=this.getDataFromNode(e,this.shaderStage,this.cache);r.dimensionsSnippet===void 0&&(r.dimensionsSnippet={});let s=r.dimensionsSnippet[n];if(r.dimensionsSnippet[n]===void 0){let o,a,{primarySamples:l}=this.renderer.backend.utils.getTextureSampleData(e),c=l>1;e.is3DTexture||e.isData3DTexture?a="vec3<u32>":a="vec2<u32>",c||e.isStorageTexture?o=t:o=`${t}${n?`, u32( ${n} )`:""}`,s=new tx(new ix(`textureDimensions( ${o} )`,a)),r.dimensionsSnippet[n]=s,(e.isArrayTexture||e.isDataArrayTexture||e.is3DTexture||e.isData3DTexture)&&(r.arrayLayerCount=new tx(new ix(`textureNumLayers(${t})`,"u32"))),e.isTextureCube&&(r.cubeFaceCount=new tx(new ix("6u","u32")))}return s.build(this)}generateFilteredTexture(e,t,n,r,s="0u",o){let a=this.generateWrapFunction(e),l=this.generateTextureDimension(e,t,s);return r&&(n=`${n} + vec2<f32>(${r}) / ${l}`),o?(this._include("biquadraticTextureArray"),`tsl_biquadraticTexture_array( ${t}, ${a}( ${n} ), ${l}, u32( ${o} ), u32( ${s} ) )`):(this._include("biquadraticTexture"),`tsl_biquadraticTexture( ${t}, ${a}( ${n} ), ${l}, u32( ${s} ) )`)}generateTextureLod(e,t,n,r,s,o="0u"){if(e.isCubeTexture===!0){s&&(n=`${n} + vec3<f32>(${s})`);let A=e.isDepthTexture?"u32":"f32";return`textureSampleLevel( ${t}, ${t}_sampler, ${n}, ${A}( ${o} ) )`}let a=this.generateWrapFunction(e),l=this.generateTextureDimension(e,t,o),c=e.is3DTexture||e.isData3DTexture?"vec3":"vec2",u=c==="vec3"?"vec3<u32>( 1, 1, 1 )":"vec2<u32>( 1, 1 )";s&&(n=`${n} + ${c}<f32>(${s}) / ${c}<f32>( ${l} )`);let f=`${c}<f32>( 0 )`,d=`${c}<f32>( ${l} - ${u} )`;return n=`${c}<u32>( clamp( floor( ${a}( ${n} ) * ${c}<f32>( ${l} ) ), ${f}, ${d} ) )`,this.generateTextureLoad(e,t,n,o,r,null)}generateStorageTextureLoad(e,t,n,r,s,o){o&&(n=`${n} + ${o}`);let a;return s?a=`textureLoad( ${t}, ${n}, ${s} )`:a=`textureLoad( ${t}, ${n} )`,a}generateTextureLoad(e,t,n,r,s,o){r===null&&(r="0u"),o&&(n=`${n} + ${o}`);let a;return s?a=`textureLoad( ${t}, ${n}, ${s}, u32( ${r} ) )`:(a=`textureLoad( ${t}, ${n}, u32( ${r} ) )`,this.renderer.backend.compatibilityMode&&e.isDepthTexture&&(a+=".x")),a}generateTextureStore(e,t,n,r,s){let o;return r?o=`textureStore( ${t}, ${n}, ${r}, ${s} )`:o=`textureStore( ${t}, ${n}, ${s} )`,o}isSampleCompare(e){return e.isDepthTexture===!0&&e.compareFunction!==null&&this.renderer.hasCompatibility(Dd.TEXTURE_COMPARE)}isUnfilterable(e){return this.getComponentTypeFromTexture(e)!=="float"||!this.isAvailable("float32Filterable")&&e.type===cr||this.isSampleCompare(e)===!1&&e.minFilter===Ti&&e.magFilter===Ti||this.renderer.backend.utils.getTextureSampleData(e).primarySamples>1}generateTexture(e,t,n,r,s,o=this.shaderStage){let a=null;return this.isUnfilterable(e)?a=this.generateTextureLod(e,t,n,r,s,"0",o):a=this._generateTextureSample(e,t,n,r,s,o),a}generateTextureGrad(e,t,n,r,s,o,a=this.shaderStage){if(a==="fragment")return s?o?`textureSampleGrad( ${t}, ${t}_sampler, ${n}, ${s}, ${r[0]}, ${r[1]}, ${o} )`:`textureSampleGrad( ${t}, ${t}_sampler, ${n}, ${s}, ${r[0]}, ${r[1]} )`:o?`textureSampleGrad( ${t}, ${t}_sampler, ${n}, ${r[0]}, ${r[1]}, ${o} )`:`textureSampleGrad( ${t}, ${t}_sampler, ${n}, ${r[0]}, ${r[1]} )`;ze(`WebGPURenderer: THREE.TextureNode.gradient() does not support ${a} shader.`)}generateTextureCompare(e,t,n,r,s,o,a=this.shaderStage){if(a==="fragment")return e.isDepthTexture===!0&&e.isArrayTexture===!0?o?`textureSampleCompare( ${t}, ${t}_sampler, ${n}, ${s}, ${r}, ${o} )`:`textureSampleCompare( ${t}, ${t}_sampler, ${n}, ${s}, ${r} )`:o?`textureSampleCompare( ${t}, ${t}_sampler, ${n}, ${r}, ${o} )`:`textureSampleCompare( ${t}, ${t}_sampler, ${n}, ${r} )`;ze(`WebGPURenderer: THREE.DepthTexture.compareFunction() does not support ${a} shader.`)}generateTextureGather(e,t,n,r,s,o){let a=e.isDepthTexture===!0?"":`${r}, `;return s?o?`textureGather( ${a}${t}, ${t}_sampler, ${n}, ${s}, ${o} )`:`textureGather( ${a}${t}, ${t}_sampler, ${n}, ${s} )`:o?`textureGather( ${a}${t}, ${t}_sampler, ${n}, ${o} )`:`textureGather( ${a}${t}, ${t}_sampler, ${n})`}generateTextureGatherCompare(e,t,n,r,s,o){return s?o?`textureGatherCompare( ${t}, ${t}_sampler, ${n}, ${s}, ${r}, ${o} )`:`textureGatherCompare( ${t}, ${t}_sampler, ${n}, ${s}, ${r})`:o?`textureGatherCompare( ${t}, ${t}_sampler, ${n}, ${r}, ${o} )`:`textureGatherCompare( ${t}, ${t}_sampler, ${n}, ${r})`}generateTextureLevel(e,t,n,r,s,o){return this.isUnfilterable(e)===!1?s?o?`textureSampleLevel( ${t}, ${t}_sampler, ${n}, ${s}, ${r}, ${o} )`:`textureSampleLevel( ${t}, ${t}_sampler, ${n}, ${s}, ${r} )`:o?`textureSampleLevel( ${t}, ${t}_sampler, ${n}, ${r}, ${o} )`:`textureSampleLevel( ${t}, ${t}_sampler, ${n}, ${r} )`:this.isFilteredTexture(e)?this.generateFilteredTexture(e,t,n,o,r,s):this.generateTextureLod(e,t,n,s,o,r)}generateTextureBias(e,t,n,r,s,o,a=this.shaderStage){if(a==="fragment")return s?o?`textureSampleBias( ${t}, ${t}_sampler, ${n}, ${s}, ${r}, ${o} )`:`textureSampleBias( ${t}, ${t}_sampler, ${n}, ${s}, ${r} )`:o?`textureSampleBias( ${t}, ${t}_sampler, ${n}, ${r}, ${o} )`:`textureSampleBias( ${t}, ${t}_sampler, ${n}, ${r} )`;ze(`WebGPURenderer: THREE.TextureNode.biasNode does not support ${a} shader.`)}getPropertyName(e,t=this.shaderStage){if(e.isNodeVarying===!0&&e.needsInterpolation===!0){if(t==="vertex")return`varyings.${e.name}`}else if(e.isNodeUniform===!0){let n=e.name,r=e.type;return r==="texture"||r==="cubeTexture"||r==="cubeDepthTexture"||r==="storageTexture"||r==="texture3D"?n:r==="buffer"||r==="storageBuffer"||r==="indirectStorageBuffer"?this.isCustomStruct(e)?n:n+".value":e.groupNode.name+"."+n}return super.getPropertyName(e)}getOutputStructName(){return"output"}getFunctionOperator(e){let t=sPe[e];return t!==void 0?(this._include(t),t):null}getNodeAccess(e,t){return t!=="compute"?e.isAtomic===!0?(Xe("WebGPURenderer: Atomic operations are only supported in compute shaders."),$o.READ_WRITE):$o.READ_ONLY:e.access}getStorageAccess(e,t){return rPe[this.getNodeAccess(e,t)]}getUniformFromNode(e,t,n,r=null){let s=super.getUniformFromNode(e,t,n,r),o=this.getDataFromNode(e,n,this.globalCache);if(o.uniformGPU===void 0){let a,l=e.groupNode,c=l.name,u=this.getBindGroupArray(c,n);if(t==="texture"||t==="cubeTexture"||t==="cubeDepthTexture"||t==="storageTexture"||t==="texture3D"){let f=null,d=this.getNodeAccess(e,n);if(t==="texture"||t==="storageTexture"?e.value.is3DTexture===!0?f=new wS(s.name,s.node,l,d):f=new fx(s.name,s.node,l,d):t==="cubeTexture"||t==="cubeDepthTexture"?f=new $4(s.name,s.node,l,d):t==="texture3D"&&(f=new wS(s.name,s.node,l,d)),f.store=e.isStorageTextureNode===!0,f.mipLevel=f.store?e.mipLevel:0,f.setVisibility(JO[n]),e.value.isCubeTexture===!0||this.isUnfilterable(e.value)===!1&&f.store===!1||e.gatherNode!==null){let y=new h9(`${s.name}_sampler`,s.node,l);y.setVisibility(JO[n]),u.push(y,f),a=[y,f]}else u.push(f),a=[f]}else if(t==="buffer"||t==="storageBuffer"||t==="indirectStorageBuffer"){let f=this.getSharedDataFromNode(e),d=f.buffer;if(d===void 0){let A=t==="buffer"?W4:d9;d=new A(e,l),f.buffer=d}d.setVisibility(d.getVisibility()|JO[n]),u.push(d),a=d,s.name=r||"NodeBuffer_"+s.id}else{let f=this.uniformGroups[c];f===void 0&&(f=new j4(c,l),f.setVisibility(yf.VERTEX|yf.FRAGMENT|yf.COMPUTE),this.uniformGroups[c]=f),u.indexOf(f)===-1&&u.push(f),a=this.getNodeUniform(s,t);let d=a.name;f.uniforms.some(y=>y.name===d)||f.addUniform(a)}o.uniformGPU=a}return s}getBuiltin(e,t,n,r=this.shaderStage){let s=this.builtins[r]||(this.builtins[r]=new Map);return s.has(e)===!1&&s.set(e,{name:e,property:t,type:n}),t}hasBuiltin(e,t=this.shaderStage){return this.builtins[t]!==void 0&&this.builtins[t].has(e)}getVertexIndex(){return this.shaderStage==="vertex"?this.getBuiltin("vertex_index","vertexIndex","u32","attribute"):"vertexIndex"}buildFunctionCode(e){let t=e.layout,n=this.flowShaderNode(e),r=[];for(let o of t.inputs)r.push(o.name+" : "+this.getType(o.type));let s=`fn ${t.name}( ${r.join(", ")} ) -> ${this.getType(t.type)} {4572+`,rne[t]=n=new hr(o,r)}return n.build(this),t}generateArrayDeclaration(e,t){return`array< ${this.getType(e)}, ${t} >`}generateTextureDimension(e,t,n){let r=this.getDataFromNode(e,this.shaderStage,this.cache);r.dimensionsSnippet===void 0&&(r.dimensionsSnippet={});let s=r.dimensionsSnippet[n];if(r.dimensionsSnippet[n]===void 0){let o,a,{primarySamples:l}=this.renderer.backend.utils.getTextureSampleData(e),c=l>1;e.is3DTexture||e.isData3DTexture?a="vec3<u32>":a="vec2<u32>",c||e.isStorageTexture?o=t:o=`${t}${n?`, u32( ${n} )`:""}`,s=new ax(new cx(`textureDimensions( ${o} )`,a)),r.dimensionsSnippet[n]=s,(e.isArrayTexture||e.isDataArrayTexture||e.is3DTexture||e.isData3DTexture)&&(r.arrayLayerCount=new ax(new cx(`textureNumLayers(${t})`,"u32"))),e.isTextureCube&&(r.cubeFaceCount=new ax(new cx("6u","u32")))}return s.build(this)}generateFilteredTexture(e,t,n,r,s="0u",o){let a=this.generateWrapFunction(e),l=this.generateTextureDimension(e,t,s);return r&&(n=`${n} + vec2<f32>(${r}) / ${l}`),o?(this._include("biquadraticTextureArray"),`tsl_biquadraticTexture_array( ${t}, ${a}( ${n} ), ${l}, u32( ${o} ), u32( ${s} ) )`):(this._include("biquadraticTexture"),`tsl_biquadraticTexture( ${t}, ${a}( ${n} ), ${l}, u32( ${s} ) )`)}generateTextureLod(e,t,n,r,s,o="0u"){if(e.isCubeTexture===!0){s&&(n=`${n} + vec3<f32>(${s})`);let A=e.isDepthTexture?"u32":"f32";return`textureSampleLevel( ${t}, ${t}_sampler, ${n}, ${A}( ${o} ) )`}let a=this.generateWrapFunction(e),l=this.generateTextureDimension(e,t,o),c=e.is3DTexture||e.isData3DTexture?"vec3":"vec2",u=c==="vec3"?"vec3<u32>( 1, 1, 1 )":"vec2<u32>( 1, 1 )";s&&(n=`${n} + ${c}<f32>(${s}) / ${c}<f32>( ${l} )`);let f=`${c}<f32>( 0 )`,d=`${c}<f32>( ${l} - ${u} )`;return n=`${c}<u32>( clamp( floor( ${a}( ${n} ) * ${c}<f32>( ${l} ) ), ${f}, ${d} ) )`,this.generateTextureLoad(e,t,n,o,r,null)}generateStorageTextureLoad(e,t,n,r,s,o){o&&(n=`${n} + ${o}`);let a;return s?a=`textureLoad( ${t}, ${n}, ${s} )`:a=`textureLoad( ${t}, ${n} )`,a}generateTextureLoad(e,t,n,r,s,o){r===null&&(r="0u"),o&&(n=`${n} + ${o}`);let a;return s?a=`textureLoad( ${t}, ${n}, ${s}, u32( ${r} ) )`:(a=`textureLoad( ${t}, ${n}, u32( ${r} ) )`,this.renderer.backend.compatibilityMode&&e.isDepthTexture&&(a+=".x")),a}generateTextureStore(e,t,n,r,s){let o;return r?o=`textureStore( ${t}, ${n}, ${r}, ${s} )`:o=`textureStore( ${t}, ${n}, ${s} )`,o}isSampleCompare(e){return e.isDepthTexture===!0&&e.compareFunction!==null&&this.renderer.hasCompatibility(Bd.TEXTURE_COMPARE)}isUnfilterable(e){return this.getComponentTypeFromTexture(e)!=="float"||!this.isAvailable("float32Filterable")&&e.type===cr||this.isSampleCompare(e)===!1&&e.minFilter===Ti&&e.magFilter===Ti||this.renderer.backend.utils.getTextureSampleData(e).primarySamples>1}generateTexture(e,t,n,r,s,o=this.shaderStage){let a=null;return this.isUnfilterable(e)?a=this.generateTextureLod(e,t,n,r,s,"0",o):a=this._generateTextureSample(e,t,n,r,s,o),a}generateTextureGrad(e,t,n,r,s,o,a=this.shaderStage){if(a==="fragment")return s?o?`textureSampleGrad( ${t}, ${t}_sampler, ${n}, ${s}, ${r[0]}, ${r[1]}, ${o} )`:`textureSampleGrad( ${t}, ${t}_sampler, ${n}, ${s}, ${r[0]}, ${r[1]} )`:o?`textureSampleGrad( ${t}, ${t}_sampler, ${n}, ${r[0]}, ${r[1]}, ${o} )`:`textureSampleGrad( ${t}, ${t}_sampler, ${n}, ${r[0]}, ${r[1]} )`;ze(`WebGPURenderer: THREE.TextureNode.gradient() does not support ${a} shader.`)}generateTextureCompare(e,t,n,r,s,o,a=this.shaderStage){if(a==="fragment")return e.isDepthTexture===!0&&e.isArrayTexture===!0?o?`textureSampleCompare( ${t}, ${t}_sampler, ${n}, ${s}, ${r}, ${o} )`:`textureSampleCompare( ${t}, ${t}_sampler, ${n}, ${s}, ${r} )`:o?`textureSampleCompare( ${t}, ${t}_sampler, ${n}, ${r}, ${o} )`:`textureSampleCompare( ${t}, ${t}_sampler, ${n}, ${r} )`;ze(`WebGPURenderer: THREE.DepthTexture.compareFunction() does not support ${a} shader.`)}generateTextureGather(e,t,n,r,s,o){let a=e.isDepthTexture===!0?"":`${r}, `;return s?o?`textureGather( ${a}${t}, ${t}_sampler, ${n}, ${s}, ${o} )`:`textureGather( ${a}${t}, ${t}_sampler, ${n}, ${s} )`:o?`textureGather( ${a}${t}, ${t}_sampler, ${n}, ${o} )`:`textureGather( ${a}${t}, ${t}_sampler, ${n})`}generateTextureGatherCompare(e,t,n,r,s,o){return s?o?`textureGatherCompare( ${t}, ${t}_sampler, ${n}, ${s}, ${r}, ${o} )`:`textureGatherCompare( ${t}, ${t}_sampler, ${n}, ${s}, ${r})`:o?`textureGatherCompare( ${t}, ${t}_sampler, ${n}, ${r}, ${o} )`:`textureGatherCompare( ${t}, ${t}_sampler, ${n}, ${r})`}generateTextureLevel(e,t,n,r,s,o){return this.isUnfilterable(e)===!1?s?o?`textureSampleLevel( ${t}, ${t}_sampler, ${n}, ${s}, ${r}, ${o} )`:`textureSampleLevel( ${t}, ${t}_sampler, ${n}, ${s}, ${r} )`:o?`textureSampleLevel( ${t}, ${t}_sampler, ${n}, ${r}, ${o} )`:`textureSampleLevel( ${t}, ${t}_sampler, ${n}, ${r} )`:this.isFilteredTexture(e)?this.generateFilteredTexture(e,t,n,o,r,s):this.generateTextureLod(e,t,n,s,o,r)}generateTextureBias(e,t,n,r,s,o,a=this.shaderStage){if(a==="fragment")return s?o?`textureSampleBias( ${t}, ${t}_sampler, ${n}, ${s}, ${r}, ${o} )`:`textureSampleBias( ${t}, ${t}_sampler, ${n}, ${s}, ${r} )`:o?`textureSampleBias( ${t}, ${t}_sampler, ${n}, ${r}, ${o} )`:`textureSampleBias( ${t}, ${t}_sampler, ${n}, ${r} )`;ze(`WebGPURenderer: THREE.TextureNode.biasNode does not support ${a} shader.`)}getPropertyName(e,t=this.shaderStage){if(e.isNodeVarying===!0&&e.needsInterpolation===!0){if(t==="vertex")return`varyings.${e.name}`}else if(e.isNodeUniform===!0){let n=e.name,r=e.type;return r==="texture"||r==="cubeTexture"||r==="cubeDepthTexture"||r==="storageTexture"||r==="texture3D"?n:r==="buffer"||r==="storageBuffer"||r==="indirectStorageBuffer"?this.isCustomStruct(e)?n:n+".value":e.groupNode.name+"."+n}return super.getPropertyName(e)}getOutputStructName(){return"output"}getFunctionOperator(e){let t=zIe[e];return t!==void 0?(this._include(t),t):null}getNodeAccess(e,t){return t!=="compute"?e.isAtomic===!0?(Xe("WebGPURenderer: Atomic operations are only supported in compute shaders."),Yo.READ_WRITE):Yo.READ_ONLY:e.access}getStorageAccess(e,t){return kIe[this.getNodeAccess(e,t)]}getUniformFromNode(e,t,n,r=null){let s=super.getUniformFromNode(e,t,n,r),o=this.getDataFromNode(e,n,this.globalCache);if(o.uniformGPU===void 0){let a,l=e.groupNode,c=l.name,u=this.getBindGroupArray(c,n);if(t==="texture"||t==="cubeTexture"||t==="cubeDepthTexture"||t==="storageTexture"||t==="texture3D"){let f=null,d=this.getNodeAccess(e,n);if(t==="texture"||t==="storageTexture"?e.value.is3DTexture===!0?f=new RS(s.name,s.node,l,d):f=new vx(s.name,s.node,l,d):t==="cubeTexture"||t==="cubeDepthTexture"?f=new nP(s.name,s.node,l,d):t==="texture3D"&&(f=new RS(s.name,s.node,l,d)),f.store=e.isStorageTextureNode===!0,f.mipLevel=f.store?e.mipLevel:0,f.setVisibility(xU[n]),e.value.isCubeTexture===!0||this.isUnfilterable(e.value)===!1&&f.store===!1||e.gatherNode!==null){let y=new L9(`${s.name}_sampler`,s.node,l);y.setVisibility(xU[n]),u.push(y,f),a=[y,f]}else u.push(f),a=[f]}else if(t==="buffer"||t==="storageBuffer"||t==="indirectStorageBuffer"){let f=this.getSharedDataFromNode(e),d=f.buffer;if(d===void 0){let A=t==="buffer"?J4:N9;d=new A(e,l),f.buffer=d}d.setVisibility(d.getVisibility()|xU[n]),u.push(d),a=d,s.name=r||"NodeBuffer_"+s.id}else{let f=this.uniformGroups[c];f===void 0&&(f=new eP(c,l),f.setVisibility(yf.VERTEX|yf.FRAGMENT|yf.COMPUTE),this.uniformGroups[c]=f),u.indexOf(f)===-1&&u.push(f),a=this.getNodeUniform(s,t);let d=a.name;f.uniforms.some(y=>y.name===d)||f.addUniform(a)}o.uniformGPU=a}return s}getBuiltin(e,t,n,r=this.shaderStage){let s=this.builtins[r]||(this.builtins[r]=new Map);return s.has(e)===!1&&s.set(e,{name:e,property:t,type:n}),t}hasBuiltin(e,t=this.shaderStage){return this.builtins[t]!==void 0&&this.builtins[t].has(e)}getVertexIndex(){return this.shaderStage==="vertex"?this.getBuiltin("vertex_index","vertexIndex","u32","attribute"):"vertexIndex"}buildFunctionCode(e){let t=e.layout,n=this.flowShaderNode(e),r=[];for(let o of t.inputs)r.push(o.name+" : "+this.getType(o.type));let s=`fn ${t.name}( ${r.join(", ")} ) -> ${this.getType(t.type)} {45734573 ${n.vars}45744574 ${n.code}45754575 `;return n.result&&(s+=` return ${n.result};@@ -4591,7 +4591,7 @@ ${n.code}
45914591 ${r.join(`45924592 `)}45934593 `}getVaryings(e){let t=[];if(e==="vertex"&&this.getBuiltin("position","builtinClipSpace","vec4<f32>","vertex"),e==="vertex"||e==="fragment"){let s=this.varyings,o=this.vars[e],a=0;for(let l=0;l<s.length;l++){let c=s[l];if(c.needsInterpolation){let u=`@location( ${a++} )`;if(c.interpolationType){let f=c.interpolationSampling!==null?`, ${c.interpolationSampling} )`:" )";u+=` @interpolate( ${c.interpolationType}${f}`}else/^(int|uint|ivec|uvec)/.test(c.type)&&(u+=" @interpolate(flat, either)");t.push(`${u} ${c.name} : ${this.getType(c.type)}`)}else e==="vertex"&&o.includes(c)===!1&&o.push(c)}}let n=this.getBuiltins(e);n&&t.push(n);let r=t.join(`,4594- `);return e==="vertex"?this._getWGSLStruct("VaryingsStruct"," "+r):r}isCustomStruct(e){let t=e.value,n=e.node,r=(t.isBufferAttribute||t.isInstancedBufferAttribute)&&n.structTypeNode!==null,s=n.value&&n.value.array&&typeof n.value.itemSize=="number"&&n.value.array.length>n.value.itemSize;return r&&!s}getUniforms(e){let t=this.renderer.backend,n=this.uniforms[e],r=[],s=[],o=[],a={};for(let c of n){let u=c.groupNode.name,f=this.bindingsIndexes[u];if(c.type==="texture"||c.type==="cubeTexture"||c.type==="cubeDepthTexture"||c.type==="storageTexture"||c.type==="texture3D"){let d=c.node,A=d.value;(A.isCubeTexture===!0||this.isUnfilterable(A)===!1&&d.isStorageTextureNode!==!0||d.gatherNode!==null)&&(this.isSampleCompare(A)&&d.compareNode!==null?r.push(`@binding( ${f.binding++} ) @group( ${f.group} ) var ${c.name}_sampler : sampler_comparison;`):r.push(`@binding( ${f.binding++} ) @group( ${f.group} ) var ${c.name}_sampler : sampler;`));let w,S="",{primarySamples:T}=t.utils.getTextureSampleData(A);if(T>1&&(S="_multisampled"),A.isCubeTexture===!0&&A.isDepthTexture===!0)w="texture_depth_cube";else if(A.isCubeTexture===!0)w="texture_cube<f32>";else if(A.isDepthTexture===!0)t.compatibilityMode&&A.compareFunction===null?w=`texture${S}_2d<f32>`:w=`texture_depth${S}_2d${A.isArrayTexture===!0?"_array":""}`;else if(c.node.isStorageTextureNode===!0){let R=w9(A,t.device),P=this.getStorageAccess(c.node,e),I=c.node.value.is3DTexture,F=c.node.value.isArrayTexture;w=`texture_storage_${I?"3d":`2d${F?"_array":""}`}<${R}, ${P}>`}else if(A.isArrayTexture===!0||A.isDataArrayTexture===!0||A.isCompressedArrayTexture===!0)w="texture_2d_array<f32>";else if(A.is3DTexture===!0||A.isData3DTexture===!0)w="texture_3d<f32>";else{let R=this.getComponentTypeFromTexture(A).charAt(0);w=`texture${S}_2d<${R}32>`}r.push(`@binding( ${f.binding++} ) @group( ${f.group} ) var ${c.name} : ${w};`)}else if(c.type==="buffer"||c.type==="storageBuffer"||c.type==="indirectStorageBuffer"){let d=c.node,A=this.getType(d.getNodeType(this)),y=d.bufferCount,w=y>0&&c.type==="buffer"?", "+y:"",S=d.isStorageBufferNode?`storage, ${this.getStorageAccess(d,e)}`:"uniform";if(this.isCustomStruct(c))s.push(`@binding( ${f.binding++} ) @group( ${f.group} ) var<${S}> ${c.name} : ${A};`);else{let R=` value : array< ${d.isAtomic?`atomic<${A}>`:`${A}`}${w} >`;s.push(this._getWGSLStructBinding(c.name,R,S,f.binding++,f.group))}}else{let d=c.groupNode.name;if(a[d]===void 0){let A=this.uniformGroups[d];if(A!==void 0){let y=[];for(let S of A.uniforms){let T=S.getType(),R=this.getType(this.getVectorType(T));y.push(` ${S.name} : ${R}`)}let w=this.uniformGroupsBindings[d];w===void 0&&(w={index:f.binding++,id:f.group},this.uniformGroupsBindings[d]=w),a[d]={index:w.index,id:w.id,snippets:y}}}}}for(let c in a){let u=a[c];o.push(this._getWGSLStructBinding(c,u.snippets.join(`,4594+ `);return e==="vertex"?this._getWGSLStruct("VaryingsStruct"," "+r):r}isCustomStruct(e){let t=e.value,n=e.node,r=(t.isBufferAttribute||t.isInstancedBufferAttribute)&&n.structTypeNode!==null,s=n.value&&n.value.array&&typeof n.value.itemSize=="number"&&n.value.array.length>n.value.itemSize;return r&&!s}getUniforms(e){let t=this.renderer.backend,n=this.uniforms[e],r=[],s=[],o=[],a={};for(let c of n){let u=c.groupNode.name,f=this.bindingsIndexes[u];if(c.type==="texture"||c.type==="cubeTexture"||c.type==="cubeDepthTexture"||c.type==="storageTexture"||c.type==="texture3D"){let d=c.node,A=d.value;(A.isCubeTexture===!0||this.isUnfilterable(A)===!1&&d.isStorageTextureNode!==!0||d.gatherNode!==null)&&(this.isSampleCompare(A)&&d.compareNode!==null?r.push(`@binding( ${f.binding++} ) @group( ${f.group} ) var ${c.name}_sampler : sampler_comparison;`):r.push(`@binding( ${f.binding++} ) @group( ${f.group} ) var ${c.name}_sampler : sampler;`));let w,S="",{primarySamples:T}=t.utils.getTextureSampleData(A);if(T>1&&(S="_multisampled"),A.isCubeTexture===!0&&A.isDepthTexture===!0)w="texture_depth_cube";else if(A.isCubeTexture===!0)w="texture_cube<f32>";else if(A.isDepthTexture===!0)t.compatibilityMode&&A.compareFunction===null?w=`texture${S}_2d<f32>`:w=`texture_depth${S}_2d${A.isArrayTexture===!0?"_array":""}`;else if(c.node.isStorageTextureNode===!0){let R=H9(A,t.device),I=this.getStorageAccess(c.node,e),P=c.node.value.is3DTexture,F=c.node.value.isArrayTexture;w=`texture_storage_${P?"3d":`2d${F?"_array":""}`}<${R}, ${I}>`}else if(A.isArrayTexture===!0||A.isDataArrayTexture===!0||A.isCompressedArrayTexture===!0)w="texture_2d_array<f32>";else if(A.is3DTexture===!0||A.isData3DTexture===!0)w="texture_3d<f32>";else{let R=this.getComponentTypeFromTexture(A).charAt(0);w=`texture${S}_2d<${R}32>`}r.push(`@binding( ${f.binding++} ) @group( ${f.group} ) var ${c.name} : ${w};`)}else if(c.type==="buffer"||c.type==="storageBuffer"||c.type==="indirectStorageBuffer"){let d=c.node,A=this.getType(d.getNodeType(this)),y=d.bufferCount,w=y>0&&c.type==="buffer"?", "+y:"",S=d.isStorageBufferNode?`storage, ${this.getStorageAccess(d,e)}`:"uniform";if(this.isCustomStruct(c))s.push(`@binding( ${f.binding++} ) @group( ${f.group} ) var<${S}> ${c.name} : ${A};`);else{let R=` value : array< ${d.isAtomic?`atomic<${A}>`:`${A}`}${w} >`;s.push(this._getWGSLStructBinding(c.name,R,S,f.binding++,f.group))}}else{let d=c.groupNode.name;if(a[d]===void 0){let A=this.uniformGroups[d];if(A!==void 0){let y=[];for(let S of A.uniforms){let T=S.getType(),R=this.getType(this.getVectorType(T));y.push(` ${S.name} : ${R}`)}let w=this.uniformGroupsBindings[d];w===void 0&&(w={index:f.binding++,id:f.group},this.uniformGroupsBindings[d]=w),a[d]={index:w.index,id:w.id,snippets:y}}}}}for(let c in a){let u=a[c];o.push(this._getWGSLStructBinding(c,u.snippets.join(`,45954595 `),"uniform",u.index,u.id))}return[...r,...s,...o].join(`45964596 `)}buildCode(){let e=this.material!==null?{fragment:{},vertex:{}}:{compute:{}};this.sortBindingGroups();for(let t in e){this.shaderStage=t;let n=this.allowGlobalVariables,r=e[t];r.uniforms=this.getUniforms(t),r.attributes=this.getAttributes(t),r.varyings=this.getVaryings(t),r.structs=this.getStructs(t),r.vars=this.getVars(t,n),r.codes=this.getCodes(t),r.directives=this.getDirectives(t),r.scopedArrays=this.getScopedArrays(t);let s=`// code45974597 @@ -4604,7 +4604,7 @@ ${n.code}
46044604 `+y),r.returnType="OutputStruct",r.structs+=this._getWGSLStruct("OutputStruct",A),r.structs+=`46054605 var<private> output : OutputStruct;`,s+=`output.color = ${this.format(f.result,a.getNodeType(this),this.getOutputType())};46064606 4607- return output;`}}}r.flow=s}if(this.shaderStage=null,this.material!==null)this.vertexShader=this._getWGSLVertexCode(e.vertex),this.fragmentShader=this._getWGSLFragmentCode(e.fragment);else{let t=this.object.workgroupSize;this.computeShader=this._getWGSLComputeCode(e.compute,t)}}getMethod(e,t=null){let n;return t!==null&&(n=this._getWGSLMethod(e+"_"+t)),n===void 0&&(n=this._getWGSLMethod(e)),n||e}getBitcastMethod(e){return`bitcast<${this.getType(e)}>`}getFloatPackingMethod(e){return this.getMethod(`floatpack_${e}_2x16`)}getFloatUnpackingMethod(e){return this.getMethod(`floatunpack_${e}_2x16`)}getTernary(e,t,n){return`select( ${n}, ${t}, ${e} )`}getType(e){return oPe[e]||e}isAvailable(e){let t=Lte[e];return t===void 0&&(e==="float32Filterable"?t=this.renderer.hasFeature("float32-filterable"):e==="clipDistance"&&(t=this.renderer.hasFeature("clip-distances")),Lte[e]=t),t}_getWGSLMethod(e){return qw[e]!==void 0&&this._include(e),aPe[e]}_include(e){let t=qw[e];return t.build(this),this.addInclude(t),t}_getWGSLVertexCode(e){return`${this.getSignature()}4607+ return output;`}}}r.flow=s}if(this.shaderStage=null,this.material!==null)this.vertexShader=this._getWGSLVertexCode(e.vertex),this.fragmentShader=this._getWGSLFragmentCode(e.fragment);else{let t=this.object.workgroupSize;this.computeShader=this._getWGSLComputeCode(e.compute,t)}}getMethod(e,t=null){let n;return t!==null&&(n=this._getWGSLMethod(e+"_"+t)),n===void 0&&(n=this._getWGSLMethod(e)),n||e}getBitcastMethod(e){return`bitcast<${this.getType(e)}>`}getFloatPackingMethod(e){return this.getMethod(`floatpack_${e}_2x16`)}getFloatUnpackingMethod(e){return this.getMethod(`floatunpack_${e}_2x16`)}getTernary(e,t,n){return`select( ${n}, ${t}, ${e} )`}getType(e){return VIe[e]||e}isAvailable(e){let t=ine[e];return t===void 0&&(e==="float32Filterable"?t=this.renderer.hasFeature("float32-filterable"):e==="clipDistance"&&(t=this.renderer.hasFeature("clip-distances")),ine[e]=t),t}_getWGSLMethod(e){return Yw[e]!==void 0&&this._include(e),GIe[e]}_include(e){let t=Yw[e];return t.build(this),this.addInclude(t),t}_getWGSLVertexCode(e){return`${this.getSignature()}46084608 // directives46094609 ${e.directives}46104610 @@ -4635,7 +4635,7 @@ fn main( ${e.attributes} ) -> VaryingsStruct {
46354635 }46364636 `}_getWGSLFragmentCode(e){return`${this.getSignature()}46374637 // global4638-${Wse}4638+${Aoe}46394639 46404640 // structs46414641 ${e.structs}@@ -4698,10 +4698,10 @@ struct ${e} {
46984698 ${t}46994699 };`}_getWGSLStructBinding(e,t,n,r=0,s=0){let o=e+"Struct";return`${this._getWGSLStruct(o,t)}47004700 @binding( ${r} ) @group( ${s} )4701-var<${n}> ${e} : ${o};`}},ma=new Am,eU=new t1,jse=new Map([[Int8Array,["sint8","snorm8"]],[Uint8Array,["uint8","unorm8"]],[Int16Array,["sint16","snorm16"]],[Uint16Array,["uint16","unorm16"]],[Int32Array,["sint32","snorm32"]],[Uint32Array,["uint32","unorm32"]],[Float32Array,["float32"]]]);typeof Float16Array<"u"&&jse.set(Float16Array,["float16"]);var lPe=new Map([[jv,["float16"]]]),cPe=new Map([[Int32Array,"sint32"],[Int16Array,"sint32"],[Uint32Array,"uint32"],[Uint16Array,"uint32"],[Float32Array,"float32"]]),M9=class{constructor(e){this.backend=e}createAttribute(e,t){let n=this._getBufferAttribute(e),r=this.backend,s=r.get(n),o=s.buffer;if(o===void 0){let a=r.device,l=n.array;if(e.normalized===!1){if(l.constructor===Int16Array||l.constructor===Int8Array)l=new Int32Array(l);else if((l.constructor===Uint16Array||l.constructor===Uint8Array)&&(l=new Uint32Array(l),t&GPUBufferUsage.INDEX))for(let d=0;d<l.length;d++)l[d]===65535&&(l[d]=4294967295)}n.array=l;let c;if((n.isStorageBufferAttribute||n.isStorageInstancedBufferAttribute)&&n.itemSize===3)c=4;else if(n.itemSize>1&&n.itemSize*l.BYTES_PER_ELEMENT%4!==0){let d=n.itemSize*l.BYTES_PER_ELEMENT;c=Math.floor((d+3)/4)*4/l.BYTES_PER_ELEMENT}if(c!==void 0){let d=n.itemSize,A=new l.constructor(n.count*c);for(let y=0;y<n.count;y++)A.set(l.subarray(y*d,y*d+d),y*c);(n.isStorageBufferAttribute||n.isStorageInstancedBufferAttribute)&&(n.itemSize=c,n.array=A),l=A,s._itemSize=d,s._paddedItemSize=c}let u=l.byteLength,f=u+(4-u%4)%4;ma.label=n.name,ma.size=f,ma.usage=t,ma.mappedAtCreation=!0,o=a.createBuffer(ma),ma.reset(),new l.constructor(o.getMappedRange()).set(l),o.unmap(),s.buffer=o}}updateAttribute(e){let t=this._getBufferAttribute(e),n=this.backend,r=n.device,s=n.get(t),o=n.get(t).buffer,a=t.array,l=s._itemSize,c=s._paddedItemSize;if(c!==void 0){a=new a.constructor(t.count*c);for(let f=0;f<t.count;f++)a.set(t.array.subarray(f*l,f*l+l),f*c);(t.isStorageBufferAttribute||t.isStorageInstancedBufferAttribute)&&(t.array=a)}let u=t.updateRanges;if(u.length===0)r.queue.writeBuffer(o,0,a,0);else{let f=o_(a),d=f?1:a.BYTES_PER_ELEMENT;for(let A=0,y=u.length;A<y;A++){let w=u[A],S,T;if(c!==void 0){let P=Math.floor(w.start/l),I=Math.ceil((w.start+w.count)/l)-P;S=P*c*d,T=I*c*d}else S=w.start*d,T=w.count*d;let R=S*(f?a.BYTES_PER_ELEMENT:1);r.queue.writeBuffer(o,R,a,S,T)}t.clearUpdateRanges()}}createShaderVertexBuffers(e){let t=e.getAttributes(),n=new Map;for(let r=0;r<t.length;r++){let s=t[r],o=s.array.BYTES_PER_ELEMENT,a=this._getBufferAttribute(s),l=n.get(a);if(l===void 0){let f,d;s.isInterleavedBufferAttribute===!0?(f=s.data.stride*o,d=s.data.isInstancedInterleavedBuffer?LR.Instance:LR.Vertex):(f=s.itemSize*o,d=s.isInstancedBufferAttribute?LR.Instance:LR.Vertex,s.itemSize>1&&f%4!==0&&(f=Math.floor((f+3)/4)*4)),s.normalized===!1&&(s.array.constructor===Int16Array||s.array.constructor===Uint16Array)&&(f=4),l={arrayStride:f,attributes:[],stepMode:d},n.set(a,l)}let c=this._getVertexFormat(s),u=s.isInterleavedBufferAttribute===!0?s.offset*o:0;l.attributes.push({shaderLocation:r,offset:u,format:c})}return Array.from(n.values())}destroyAttribute(e){let t=this.backend;t.get(this._getBufferAttribute(e)).buffer.destroy(),t.delete(e)}async getArrayBufferAsync(e,t=null,n=0,r=-1){let s=this.backend,o=s.device,l=s.get(this._getBufferAttribute(e)).buffer,c=r===-1?l.size-n:r,u;if(t!==null&&t.isReadbackBuffer){let A=s.get(t);if(t._mapped===!0)throw new Error("THREE.WebGPUAttributeUtils: ReadbackBuffer must be released before being used again.");if(t._mapped=!0,A.readBufferGPU===void 0){ma.label=`${t.name}_readback`,ma.size=t.maxByteLength,ma.usage=GPUBufferUsage.COPY_DST|GPUBufferUsage.MAP_READ,u=o.createBuffer(ma),ma.reset();let y=()=>{t.buffer=null,t._mapped=!1,u.unmap()},w=()=>{t.buffer=null,t._mapped=!1,u.destroy(),s.delete(t),t.removeEventListener("release",y),t.removeEventListener("dispose",w)};t.addEventListener("release",y),t.addEventListener("dispose",w),A.readBufferGPU=u}else u=A.readBufferGPU}else ma.label=`${e.name}_readback`,ma.size=c,ma.usage=GPUBufferUsage.COPY_DST|GPUBufferUsage.MAP_READ,u=o.createBuffer(ma),ma.reset();eU.label=`readback_encoder_${e.name}`;let f=o.createCommandEncoder(eU);eU.reset(),f.copyBufferToBuffer(l,n,u,0,c);let d=f.finish();if(mf(o,d),await u.mapAsync(GPUMapMode.READ,0,c),t===null){let y=u.getMappedRange(0,c).slice();return u.destroy(),y}else{if(t.isReadbackBuffer)return t.buffer=u.getMappedRange(0,c),t;{let A=u.getMappedRange(0,c);return new Uint8Array(t).set(new Uint8Array(A)),u.destroy(),t}}}_getVertexFormat(e){let{itemSize:t,normalized:n}=e,r=e.array.constructor,s=e.constructor,o;if(t===1)o=cPe.get(r);else{let l=(lPe.get(s)||jse.get(r))[n?1:0];if(l){let c=r.BYTES_PER_ELEMENT*t,f=Math.floor((c+3)/4)*4/r.BYTES_PER_ELEMENT;if(f%1)throw new Error("THREE.WebGPUAttributeUtils: Bad vertex format item size.");o=`${l}x${f}`}}return o||ze("WebGPUAttributeUtils: Vertex format not supported yet."),o}_getBufferAttribute(e){return e.isInterleavedBufferAttribute&&(e=e.data),e}},ic=new eI,Hw=new Am,W_=new TS,C9=class{constructor(e){this.layoutGPU=e,this.usedTimes=0}},R9=class{constructor(e){this.backend=e,this._bindGroupLayoutCache=new Map}createBindingsLayout(e){let t=this.backend,n=t.device,r=t.get(e);if(r.layout)return r.layout.layoutGPU;let s=this._createLayoutEntries(e),o=mx(JSON.stringify(s)),a=this._bindGroupLayoutCache.get(o);return a===void 0&&(a=new C9(n.createBindGroupLayout({entries:s})),this._bindGroupLayoutCache.set(o,a)),a.usedTimes++,r.layout=a,r.layoutKey=o,a.layoutGPU}createBindings(e,t,n,r=0){let{backend:s}=this,o=s.get(e),a=this.createBindingsLayout(e),l;n>0&&(o.groups===void 0&&(o.groups=[],o.versions=[]),o.versions[n]===r&&(l=o.groups[n])),l===void 0&&(l=this.createBindGroup(e,a),n>0&&(o.groups[n]=l,o.versions[n]=r)),o.group=l}updateBinding(e){let t=this.backend,n=t.device,r=e.buffer,s=t.get(e).buffer,o=e.updateRanges;if(o.length===0)n.queue.writeBuffer(s,0,r,0);else{let a=o_(r),l=a?1:r.BYTES_PER_ELEMENT,c=o[0].start;for(let u=0,f=o.length;u<f;u++){let d=o[u],A=o[u+1],y=d.start+d.count;if(A!==void 0&&A.start===y)continue;let w=c*l,S=(y-c)*l,T=w*(a?r.BYTES_PER_ELEMENT:1);n.queue.writeBuffer(s,T,r,w,S),A!==void 0&&(c=A.start)}}}createBindGroupIndex(e,t){let r=this.backend.device,s=GPUBufferUsage.UNIFORM|GPUBufferUsage.COPY_DST,o=e[0];Hw.label="bindingCameraIndex_"+o,Hw.size=16,Hw.usage=s;let a=r.createBuffer(Hw);Hw.reset(),r.queue.writeBuffer(a,0,e,0),ic.label="bindGroupCameraIndex_"+o,ic.layout=t,ic.entries.push({binding:0,resource:{buffer:a}});let l=r.createBindGroup(ic);return ic.reset(),l}createBindGroup(e,t){let n=this.backend,r=n.device,s=0;ic.label="bindGroup_"+e.name,ic.layout=t;for(let a of e.bindings){if(a.isUniformBuffer){let l=n.get(a);ic.entries.push({binding:s,resource:{buffer:l.buffer}})}else if(a.isStorageBuffer){let l=n.get(a.attribute).buffer;ic.entries.push({binding:s,resource:{buffer:l}})}else if(a.isSampledTexture){let l=n.get(a.texture),c;if(l.externalTexture!==void 0)c=r.importExternalTexture({source:l.externalTexture});else{let u=a.store?1:l.texture.mipLevelCount,f=a.store?a.mipLevel:0,d=`view-${l.texture.width}-${l.texture.height}`;if(l.texture.depthOrArrayLayers>1&&(d+=`-${l.texture.depthOrArrayLayers}`),d+=`-${u}-${f}`,c=l[d],c===void 0){let A=ZIe.All,y;a.isSampledCubeTexture?y=jo.Cube:a.texture.isArrayTexture||a.texture.isDataArrayTexture||a.texture.isCompressedArrayTexture?y=jo.TwoDArray:a.isSampledTexture3D?y=jo.ThreeD:y=jo.TwoD,W_.aspect=A,W_.dimension=y,W_.mipLevelCount=u,W_.baseMipLevel=f,c=l[d]=l.texture.createView(W_),W_.reset()}}ic.entries.push({binding:s,resource:c})}else if(a.isSampler){let l=n.get(a);ic.entries.push({binding:s,resource:l.sampler})}s++}let o=r.createBindGroup(ic);return ic.reset(),o}_createLayoutEntries(e){let t=[],n=0;for(let r of e.bindings){let s=this.backend,o={binding:n,visibility:r.visibility};if(r.isUniformBuffer||r.isStorageBuffer){let a={};r.isStorageBuffer&&(r.visibility&yf.COMPUTE&&(r.access===$o.READ_WRITE||r.access===$o.WRITE_ONLY)?a.type=$O.Storage:a.type=$O.ReadOnlyStorage),o.buffer=a}else if(r.isSampledTexture&&r.store){let a={};a.format=this.backend.get(r.texture).texture.format;let l=r.access;l===$o.READ_WRITE?a.access=YO.ReadWrite:l===$o.WRITE_ONLY?a.access=YO.WriteOnly:a.access=YO.ReadOnly,r.texture.isArrayTexture?a.viewDimension=jo.TwoDArray:r.texture.is3DTexture&&(a.viewDimension=jo.ThreeD),o.storageTexture=a}else if(r.isSampledTexture){let a={},{primarySamples:l}=s.utils.getTextureSampleData(r.texture);if(l>1&&(a.multisampled=!0,r.texture.isDepthTexture||(a.sampleType=Lg.UnfilterableFloat)),r.texture.isDepthTexture)s.compatibilityMode&&r.texture.compareFunction===null?a.sampleType=Lg.UnfilterableFloat:a.sampleType=Lg.Depth;else{let c=r.texture.type;c===Zr?a.sampleType=Lg.SInt:c===xi?a.sampleType=Lg.UInt:c===cr&&(this.backend.hasFeature("float32-filterable")?a.sampleType=Lg.Float:a.sampleType=Lg.UnfilterableFloat)}r.isSampledCubeTexture?a.viewDimension=jo.Cube:r.texture.isArrayTexture||r.texture.isDataArrayTexture||r.texture.isCompressedArrayTexture?a.viewDimension=jo.TwoDArray:r.isSampledTexture3D&&(a.viewDimension=jo.ThreeD),o.texture=a}else if(r.isSampler){let a={};r.texture.isDepthTexture&&(r.texture.compareFunction!==null&&r.textureNode.compareNode!==null&&s.hasCompatibility(Dd.TEXTURE_COMPARE)?a.type=Ete.Comparison:a.type=Ete.NonFiltering),o.sampler=a}else ze(`WebGPUBindingUtils: Unsupported binding "${r}".`);t.push(o),n++}return t}deleteBindGroupData(e){let{backend:t}=this,n=t.get(e);n.layout&&(n.layout.usedTimes--,n.layout.usedTimes===0&&this._bindGroupLayoutCache.delete(n.layoutKey),n.layout=void 0,n.layoutKey=void 0)}dispose(){this._bindGroupLayoutCache.clear()}},I9=class{constructor(e){this.backend=e}getMaxAnisotropy(){return 16}getUniformBufferLimit(){return this.backend.device.limits.maxUniformBufferBindingSize}},P9=class{constructor(){this.label="",this.layout=null,this.compute=null}reset(){this.label="",this.layout=null,this.compute=null}},L9=class{constructor(){this.label="",this.bindGroupLayouts=null}reset(){this.label="",this.bindGroupLayouts=null}},Ww=new P9,j_=new L9,X_=new tI,rc=new nI,D9=class{constructor(e){this.backend=e}_getSampleCount(e){return this.backend.utils.getSampleCountRenderContext(e)}createRenderPipeline(e,t){let{object:n,material:r,geometry:s,pipeline:o}=e,{vertexProgram:a,fragmentProgram:l}=o,c=this.backend,u=c.device,f=c.utils,d=c.get(o),A=[];for(let H of e.getBindings()){let $=c.get(H),{layoutGPU:J}=$.layout;A.push(J)}let y=c.attributeUtils.createShaderVertexBuffers(e),w;r.blending!==ps&&(r.blending!==Ms||r.transparent!==!1)&&(w=this._getBlending(r));let S={};r.stencilWrite===!0&&(S={compare:this._getStencilCompare(r),failOp:this._getStencilOperation(r.stencilFail),depthFailOp:this._getStencilOperation(r.stencilZFail),passOp:this._getStencilOperation(r.stencilZPass)});let T=this._getColorWriteMask(r),R=[];if(e.context.textures!==null){let H=e.context.textures,$=e.context.mrt;for(let J=0;J<H.length;J++){let te=H[J],ce=f.getTextureFormatGPU(te),he;if($!==null)if(this.backend.compatibilityMode!==!0){let ve=$.getBlendMode(te.name);ve.blending===ob?he=w:ve.blending!==ps&&(he=this._getBlending(ve))}else ni("WebGPURenderer: Multiple Render Targets (MRT) blending configuration is not fully supported in compatibility mode. The material blending will be used for all render targets."),he=w;else he=w;R.push({format:ce,blend:he,writeMask:T})}}else{let H=f.getCurrentColorFormat(e.context);R.push({format:H,blend:w,writeMask:T})}let P=c.get(a).module,I=c.get(l).module,F=this._getPrimitiveState(n,s,r),D=this._getDepthCompare(r),L=f.getCurrentDepthStencilFormat(e.context),C=this._getSampleCount(e.context);j_.bindGroupLayouts=A;let B=u.createPipelineLayout(j_);j_.reset(),rc.label=`renderPipeline_${r.name||r.type}_${r.id}`,rc.vertex=Object.assign({},P,{buffers:y}),rc.fragment=Object.assign({},I,{targets:R}),rc.primitive=F,rc.multisample.count=C,rc.multisample.alphaToCoverageEnabled=r.alphaToCoverage&&C>1,rc.layout=B;let k={},z=e.context.depth,G=e.context.stencil;(z===!0||G===!0)&&(z===!0&&(k.format=L,k.depthWriteEnabled=r.depthWrite,k.depthCompare=D),G===!0&&(k.stencilFront=S,k.stencilBack=S,k.stencilReadMask=r.stencilFuncMask,k.stencilWriteMask=r.stencilWriteMask),r.polygonOffset===!0&&F.topology===Yw.TriangleList&&(k.depthBias=r.polygonOffsetUnits,k.depthBiasSlopeScale=r.polygonOffsetFactor,k.depthBiasClamp=0),rc.depthStencil=k),u.pushErrorScope("validation");let W=[{program:a,module:P.module},{program:l,module:I.module}],Y=rc.label;if(t===null)d.pipeline=u.createRenderPipeline(rc),rc.reset(),u.popErrorScope().then(H=>{H!==null&&(d.error=!0,ze(`WebGPURenderer: Render pipeline creation failed (${Y}): ${H.message}`),this._reportShaderDiagnostics(W,Y))});else{let H=new Promise(async $=>{try{let J=null,te=null;try{te=u.createRenderPipelineAsync(rc)}catch(he){J=he}if(rc.reset(),te!==null)try{d.pipeline=await te}catch(he){J=he}let ce=await u.popErrorScope();if(ce!==null||J!==null){d.error=!0;let he=ce&&ce.message||J&&J.message||"unknown";ze(`WebGPURenderer: Async render pipeline creation failed (${Y}): ${he}`),await this._reportShaderDiagnostics(W,Y)}}finally{$()}});t.push(H)}}createBundleEncoder(e,t="renderBundleEncoder"){let n=this.backend,{utils:r,device:s}=n,o=r.getCurrentDepthStencilFormat(e),a=r.getCurrentColorFormats(e),l=this._getSampleCount(e);X_.label=t,X_.colorFormats=a,X_.depthStencilFormat=o,X_.sampleCount=l;let c=s.createRenderBundleEncoder(X_);return X_.reset(),c}createComputePipeline(e,t){let n=this.backend,r=n.device,s=n.get(e.computeProgram).module,o=n.get(e),a=[];for(let f of t){let d=n.get(f),{layoutGPU:A}=d.layout;a.push(A)}let l=e.computeProgram,c=`computePipeline_${l.stage}${l.name?`_${l.name}`:""}`;r.pushErrorScope("validation"),j_.bindGroupLayouts=a;let u=r.createPipelineLayout(j_);j_.reset(),Ww.label=c,Ww.compute=s,Ww.layout=u,o.pipeline=r.createComputePipeline(Ww),Ww.reset(),r.popErrorScope().then(f=>{f!==null&&(o.error=!0,ze(`WebGPURenderer: Compute pipeline creation failed (${c}): ${f.message}`),this._reportShaderDiagnostics([{program:l,module:s.module}],c))})}async _reportShaderDiagnostics(e,t){for(let{program:n,module:r}of e){let s=await r.getCompilationInfo();if(s.messages.length===0)continue;let o=n.code.split(`4701+var<${n}> ${e} : ${o};`}},Aa=new xm,yU=new o1,goe=new Map([[Int8Array,["sint8","snorm8"]],[Uint8Array,["uint8","unorm8"]],[Int16Array,["sint16","snorm16"]],[Uint16Array,["uint16","unorm16"]],[Int32Array,["sint32","snorm32"]],[Uint32Array,["uint32","unorm32"]],[Float32Array,["float32"]]]);typeof Float16Array<"u"&&goe.set(Float16Array,["float16"]);var qIe=new Map([[Qv,["float16"]]]),HIe=new Map([[Int32Array,"sint32"],[Int16Array,"sint32"],[Uint32Array,"uint32"],[Uint16Array,"uint32"],[Float32Array,"float32"]]),$9=class{constructor(e){this.backend=e}createAttribute(e,t){let n=this._getBufferAttribute(e),r=this.backend,s=r.get(n),o=s.buffer;if(o===void 0){let a=r.device,l=n.array;if(e.normalized===!1){if(l.constructor===Int16Array||l.constructor===Int8Array)l=new Int32Array(l);else if((l.constructor===Uint16Array||l.constructor===Uint8Array)&&(l=new Uint32Array(l),t&GPUBufferUsage.INDEX))for(let d=0;d<l.length;d++)l[d]===65535&&(l[d]=4294967295)}n.array=l;let c;if((n.isStorageBufferAttribute||n.isStorageInstancedBufferAttribute)&&n.itemSize===3)c=4;else if(n.itemSize>1&&n.itemSize*l.BYTES_PER_ELEMENT%4!==0){let d=n.itemSize*l.BYTES_PER_ELEMENT;c=Math.floor((d+3)/4)*4/l.BYTES_PER_ELEMENT}if(c!==void 0){let d=n.itemSize,A=new l.constructor(n.count*c);for(let y=0;y<n.count;y++)A.set(l.subarray(y*d,y*d+d),y*c);(n.isStorageBufferAttribute||n.isStorageInstancedBufferAttribute)&&(n.itemSize=c,n.array=A),l=A,s._itemSize=d,s._paddedItemSize=c}let u=l.byteLength,f=u+(4-u%4)%4;Aa.label=n.name,Aa.size=f,Aa.usage=t,Aa.mappedAtCreation=!0,o=a.createBuffer(Aa),Aa.reset(),new l.constructor(o.getMappedRange()).set(l),o.unmap(),s.buffer=o}}updateAttribute(e){let t=this._getBufferAttribute(e),n=this.backend,r=n.device,s=n.get(t),o=n.get(t).buffer,a=t.array,l=s._itemSize,c=s._paddedItemSize;if(c!==void 0){a=new a.constructor(t.count*c);for(let f=0;f<t.count;f++)a.set(t.array.subarray(f*l,f*l+l),f*c);(t.isStorageBufferAttribute||t.isStorageInstancedBufferAttribute)&&(t.array=a)}let u=t.updateRanges;if(u.length===0)r.queue.writeBuffer(o,0,a,0);else{let f=f_(a),d=f?1:a.BYTES_PER_ELEMENT;for(let A=0,y=u.length;A<y;A++){let w=u[A],S,T;if(c!==void 0){let I=Math.floor(w.start/l),P=Math.ceil((w.start+w.count)/l)-I;S=I*c*d,T=P*c*d}else S=w.start*d,T=w.count*d;let R=S*(f?a.BYTES_PER_ELEMENT:1);r.queue.writeBuffer(o,R,a,S,T)}t.clearUpdateRanges()}}createShaderVertexBuffers(e){let t=e.getAttributes(),n=new Map;for(let r=0;r<t.length;r++){let s=t[r],o=s.array.BYTES_PER_ELEMENT,a=this._getBufferAttribute(s),l=n.get(a);if(l===void 0){let f,d;s.isInterleavedBufferAttribute===!0?(f=s.data.stride*o,d=s.data.isInstancedInterleavedBuffer?zR.Instance:zR.Vertex):(f=s.itemSize*o,d=s.isInstancedBufferAttribute?zR.Instance:zR.Vertex,s.itemSize>1&&f%4!==0&&(f=Math.floor((f+3)/4)*4)),s.normalized===!1&&(s.array.constructor===Int16Array||s.array.constructor===Uint16Array)&&(f=4),l={arrayStride:f,attributes:[],stepMode:d},n.set(a,l)}let c=this._getVertexFormat(s),u=s.isInterleavedBufferAttribute===!0?s.offset*o:0;l.attributes.push({shaderLocation:r,offset:u,format:c})}return Array.from(n.values())}destroyAttribute(e){let t=this.backend;t.get(this._getBufferAttribute(e)).buffer.destroy(),t.delete(e)}async getArrayBufferAsync(e,t=null,n=0,r=-1){let s=this.backend,o=s.device,l=s.get(this._getBufferAttribute(e)).buffer,c=r===-1?l.size-n:r,u;if(t!==null&&t.isReadbackBuffer){let A=s.get(t);if(t._mapped===!0)throw new Error("THREE.WebGPUAttributeUtils: ReadbackBuffer must be released before being used again.");if(t._mapped=!0,A.readBufferGPU===void 0){Aa.label=`${t.name}_readback`,Aa.size=t.maxByteLength,Aa.usage=GPUBufferUsage.COPY_DST|GPUBufferUsage.MAP_READ,u=o.createBuffer(Aa),Aa.reset();let y=()=>{t.buffer=null,t._mapped=!1,u.unmap()},w=()=>{t.buffer=null,t._mapped=!1,u.destroy(),s.delete(t),t.removeEventListener("release",y),t.removeEventListener("dispose",w)};t.addEventListener("release",y),t.addEventListener("dispose",w),A.readBufferGPU=u}else u=A.readBufferGPU}else Aa.label=`${e.name}_readback`,Aa.size=c,Aa.usage=GPUBufferUsage.COPY_DST|GPUBufferUsage.MAP_READ,u=o.createBuffer(Aa),Aa.reset();yU.label=`readback_encoder_${e.name}`;let f=o.createCommandEncoder(yU);yU.reset(),f.copyBufferToBuffer(l,n,u,0,c);let d=f.finish();if(mf(o,d),await u.mapAsync(GPUMapMode.READ,0,c),t===null){let y=u.getMappedRange(0,c).slice();return u.destroy(),y}else{if(t.isReadbackBuffer)return t.buffer=u.getMappedRange(0,c),t;{let A=u.getMappedRange(0,c);return new Uint8Array(t).set(new Uint8Array(A)),u.destroy(),t}}}_getVertexFormat(e){let{itemSize:t,normalized:n}=e,r=e.array.constructor,s=e.constructor,o;if(t===1)o=HIe.get(r);else{let l=(qIe.get(s)||goe.get(r))[n?1:0];if(l){let c=r.BYTES_PER_ELEMENT*t,f=Math.floor((c+3)/4)*4/r.BYTES_PER_ELEMENT;if(f%1)throw new Error("THREE.WebGPUAttributeUtils: Bad vertex format item size.");o=`${l}x${f}`}}return o||ze("WebGPUAttributeUtils: Vertex format not supported yet."),o}_getBufferAttribute(e){return e.isInterleavedBufferAttribute&&(e=e.data),e}},oc=new lP,Zw=new xm,K_=new IS,Y9=class{constructor(e){this.layoutGPU=e,this.usedTimes=0}},Z9=class{constructor(e){this.backend=e,this._bindGroupLayoutCache=new Map}createBindingsLayout(e){let t=this.backend,n=t.device,r=t.get(e);if(r.layout)return r.layout.layoutGPU;let s=this._createLayoutEntries(e),o=yx(JSON.stringify(s)),a=this._bindGroupLayoutCache.get(o);return a===void 0&&(a=new Y9(n.createBindGroupLayout({entries:s})),this._bindGroupLayoutCache.set(o,a)),a.usedTimes++,r.layout=a,r.layoutKey=o,a.layoutGPU}createBindings(e,t,n,r=0){let{backend:s}=this,o=s.get(e),a=this.createBindingsLayout(e),l;n>0&&(o.groups===void 0&&(o.groups=[],o.versions=[]),o.versions[n]===r&&(l=o.groups[n])),l===void 0&&(l=this.createBindGroup(e,a),n>0&&(o.groups[n]=l,o.versions[n]=r)),o.group=l}updateBinding(e){let t=this.backend,n=t.device,r=e.buffer,s=t.get(e).buffer,o=e.updateRanges;if(o.length===0)n.queue.writeBuffer(s,0,r,0);else{let a=f_(r),l=a?1:r.BYTES_PER_ELEMENT,c=o[0].start;for(let u=0,f=o.length;u<f;u++){let d=o[u],A=o[u+1],y=d.start+d.count;if(A!==void 0&&A.start===y)continue;let w=c*l,S=(y-c)*l,T=w*(a?r.BYTES_PER_ELEMENT:1);n.queue.writeBuffer(s,T,r,w,S),A!==void 0&&(c=A.start)}}}createBindGroupIndex(e,t){let r=this.backend.device,s=GPUBufferUsage.UNIFORM|GPUBufferUsage.COPY_DST,o=e[0];Zw.label="bindingCameraIndex_"+o,Zw.size=16,Zw.usage=s;let a=r.createBuffer(Zw);Zw.reset(),r.queue.writeBuffer(a,0,e,0),oc.label="bindGroupCameraIndex_"+o,oc.layout=t,oc.entries.push({binding:0,resource:{buffer:a}});let l=r.createBindGroup(oc);return oc.reset(),l}createBindGroup(e,t){let n=this.backend,r=n.device,s=0;oc.label="bindGroup_"+e.name,oc.layout=t;for(let a of e.bindings){if(a.isUniformBuffer){let l=n.get(a);oc.entries.push({binding:s,resource:{buffer:l.buffer}})}else if(a.isStorageBuffer){let l=n.get(a.attribute).buffer;oc.entries.push({binding:s,resource:{buffer:l}})}else if(a.isSampledTexture){let l=n.get(a.texture),c;if(l.externalTexture!==void 0)c=r.importExternalTexture({source:l.externalTexture});else{let u=a.store?1:l.texture.mipLevelCount,f=a.store?a.mipLevel:0,d=`view-${l.texture.width}-${l.texture.height}`;if(l.texture.depthOrArrayLayers>1&&(d+=`-${l.texture.depthOrArrayLayers}`),d+=`-${u}-${f}`,c=l[d],c===void 0){let A=IIe.All,y;a.isSampledCubeTexture?y=Xo.Cube:a.texture.isArrayTexture||a.texture.isDataArrayTexture||a.texture.isCompressedArrayTexture?y=Xo.TwoDArray:a.isSampledTexture3D?y=Xo.ThreeD:y=Xo.TwoD,K_.aspect=A,K_.dimension=y,K_.mipLevelCount=u,K_.baseMipLevel=f,c=l[d]=l.texture.createView(K_),K_.reset()}}oc.entries.push({binding:s,resource:c})}else if(a.isSampler){let l=n.get(a);oc.entries.push({binding:s,resource:l.sampler})}s++}let o=r.createBindGroup(oc);return oc.reset(),o}_createLayoutEntries(e){let t=[],n=0;for(let r of e.bindings){let s=this.backend,o={binding:n,visibility:r.visibility};if(r.isUniformBuffer||r.isStorageBuffer){let a={};r.isStorageBuffer&&(r.visibility&yf.COMPUTE&&(r.access===Yo.READ_WRITE||r.access===Yo.WRITE_ONLY)?a.type=mU.Storage:a.type=mU.ReadOnlyStorage),o.buffer=a}else if(r.isSampledTexture&&r.store){let a={};a.format=this.backend.get(r.texture).texture.format;let l=r.access;l===Yo.READ_WRITE?a.access=AU.ReadWrite:l===Yo.WRITE_ONLY?a.access=AU.WriteOnly:a.access=AU.ReadOnly,r.texture.isArrayTexture?a.viewDimension=Xo.TwoDArray:r.texture.is3DTexture&&(a.viewDimension=Xo.ThreeD),o.storageTexture=a}else if(r.isSampledTexture){let a={},{primarySamples:l}=s.utils.getTextureSampleData(r.texture);if(l>1&&(a.multisampled=!0,r.texture.isDepthTexture||(a.sampleType=Og.UnfilterableFloat)),r.texture.isDepthTexture)s.compatibilityMode&&r.texture.compareFunction===null?a.sampleType=Og.UnfilterableFloat:a.sampleType=Og.Depth;else{let c=r.texture.type;c===Kr?a.sampleType=Og.SInt:c===xi?a.sampleType=Og.UInt:c===cr&&(this.backend.hasFeature("float32-filterable")?a.sampleType=Og.Float:a.sampleType=Og.UnfilterableFloat)}r.isSampledCubeTexture?a.viewDimension=Xo.Cube:r.texture.isArrayTexture||r.texture.isDataArrayTexture||r.texture.isCompressedArrayTexture?a.viewDimension=Xo.TwoDArray:r.isSampledTexture3D&&(a.viewDimension=Xo.ThreeD),o.texture=a}else if(r.isSampler){let a={};r.texture.isDepthTexture&&(r.texture.compareFunction!==null&&r.textureNode.compareNode!==null&&s.hasCompatibility(Bd.TEXTURE_COMPARE)?a.type=Kte.Comparison:a.type=Kte.NonFiltering),o.sampler=a}else ze(`WebGPUBindingUtils: Unsupported binding "${r}".`);t.push(o),n++}return t}deleteBindGroupData(e){let{backend:t}=this,n=t.get(e);n.layout&&(n.layout.usedTimes--,n.layout.usedTimes===0&&this._bindGroupLayoutCache.delete(n.layoutKey),n.layout=void 0,n.layoutKey=void 0)}dispose(){this._bindGroupLayoutCache.clear()}},K9=class{constructor(e){this.backend=e}getMaxAnisotropy(){return 16}getUniformBufferLimit(){return this.backend.device.limits.maxUniformBufferBindingSize}},Q9=class{constructor(){this.label="",this.layout=null,this.compute=null}reset(){this.label="",this.layout=null,this.compute=null}},J9=class{constructor(){this.label="",this.bindGroupLayouts=null}reset(){this.label="",this.bindGroupLayouts=null}},Kw=new Q9,Q_=new J9,J_=new cP,ac=new uP,ez=class{constructor(e){this.backend=e}_getSampleCount(e){return this.backend.utils.getSampleCountRenderContext(e)}createRenderPipeline(e,t){let{object:n,material:r,geometry:s,pipeline:o}=e,{vertexProgram:a,fragmentProgram:l}=o,c=this.backend,u=c.device,f=c.utils,d=c.get(o),A=[];for(let H of e.getBindings()){let $=c.get(H),{layoutGPU:J}=$.layout;A.push(J)}let y=c.attributeUtils.createShaderVertexBuffers(e),w;r.blending!==ps&&(r.blending!==Ts||r.transparent!==!1)&&(w=this._getBlending(r));let S={};r.stencilWrite===!0&&(S={compare:this._getStencilCompare(r),failOp:this._getStencilOperation(r.stencilFail),depthFailOp:this._getStencilOperation(r.stencilZFail),passOp:this._getStencilOperation(r.stencilZPass)});let T=this._getColorWriteMask(r),R=[];if(e.context.textures!==null){let H=e.context.textures,$=e.context.mrt;for(let J=0;J<H.length;J++){let te=H[J],ce=f.getTextureFormatGPU(te),he;if($!==null)if(this.backend.compatibilityMode!==!0){let ve=$.getBlendMode(te.name);ve.blending===fb?he=w:ve.blending!==ps&&(he=this._getBlending(ve))}else ni("WebGPURenderer: Multiple Render Targets (MRT) blending configuration is not fully supported in compatibility mode. The material blending will be used for all render targets."),he=w;else he=w;R.push({format:ce,blend:he,writeMask:T})}}else{let H=f.getCurrentColorFormat(e.context);R.push({format:H,blend:w,writeMask:T})}let I=c.get(a).module,P=c.get(l).module,F=this._getPrimitiveState(n,s,r),D=this._getDepthCompare(r),L=f.getCurrentDepthStencilFormat(e.context),C=this._getSampleCount(e.context);Q_.bindGroupLayouts=A;let B=u.createPipelineLayout(Q_);Q_.reset(),ac.label=`renderPipeline_${r.name||r.type}_${r.id}`,ac.vertex=Object.assign({},I,{buffers:y}),ac.fragment=Object.assign({},P,{targets:R}),ac.primitive=F,ac.multisample.count=C,ac.multisample.alphaToCoverageEnabled=r.alphaToCoverage&&C>1,ac.layout=B;let k={},z=e.context.depth,G=e.context.stencil;(z===!0||G===!0)&&(z===!0&&(k.format=L,k.depthWriteEnabled=r.depthWrite,k.depthCompare=D),G===!0&&(k.stencilFront=S,k.stencilBack=S,k.stencilReadMask=r.stencilFuncMask,k.stencilWriteMask=r.stencilWriteMask),r.polygonOffset===!0&&F.topology===tS.TriangleList&&(k.depthBias=r.polygonOffsetUnits,k.depthBiasSlopeScale=r.polygonOffsetFactor,k.depthBiasClamp=0),ac.depthStencil=k),u.pushErrorScope("validation");let W=[{program:a,module:I.module},{program:l,module:P.module}],Y=ac.label;if(t===null)d.pipeline=u.createRenderPipeline(ac),ac.reset(),u.popErrorScope().then(H=>{H!==null&&(d.error=!0,ze(`WebGPURenderer: Render pipeline creation failed (${Y}): ${H.message}`),this._reportShaderDiagnostics(W,Y))});else{let H=new Promise(async $=>{try{let J=null,te=null;try{te=u.createRenderPipelineAsync(ac)}catch(he){J=he}if(ac.reset(),te!==null)try{d.pipeline=await te}catch(he){J=he}let ce=await u.popErrorScope();if(ce!==null||J!==null){d.error=!0;let he=ce&&ce.message||J&&J.message||"unknown";ze(`WebGPURenderer: Async render pipeline creation failed (${Y}): ${he}`),await this._reportShaderDiagnostics(W,Y)}}finally{$()}});t.push(H)}}createBundleEncoder(e,t="renderBundleEncoder"){let n=this.backend,{utils:r,device:s}=n,o=r.getCurrentDepthStencilFormat(e),a=r.getCurrentColorFormats(e),l=this._getSampleCount(e);J_.label=t,J_.colorFormats=a,J_.depthStencilFormat=o,J_.sampleCount=l;let c=s.createRenderBundleEncoder(J_);return J_.reset(),c}createComputePipeline(e,t){let n=this.backend,r=n.device,s=n.get(e.computeProgram).module,o=n.get(e),a=[];for(let f of t){let d=n.get(f),{layoutGPU:A}=d.layout;a.push(A)}let l=e.computeProgram,c=`computePipeline_${l.stage}${l.name?`_${l.name}`:""}`;r.pushErrorScope("validation"),Q_.bindGroupLayouts=a;let u=r.createPipelineLayout(Q_);Q_.reset(),Kw.label=c,Kw.compute=s,Kw.layout=u,o.pipeline=r.createComputePipeline(Kw),Kw.reset(),r.popErrorScope().then(f=>{f!==null&&(o.error=!0,ze(`WebGPURenderer: Compute pipeline creation failed (${c}): ${f.message}`),this._reportShaderDiagnostics([{program:l,module:s.module}],c))})}async _reportShaderDiagnostics(e,t){for(let{program:n,module:r}of e){let s=await r.getCompilationInfo();if(s.messages.length===0)continue;let o=n.code.split(`47024702 `);for(let a of s.messages){let l=a.lineNum>0?` at line ${a.lineNum}${a.linePos>0?`:${a.linePos}`:""}`:"",c=`WebGPURenderer [${t} / ${n.stage} ${a.type}]${l}: ${a.message}`,u="";a.lineNum>0&&a.lineNum<=o.length&&(u=`47034703 ${o[a.lineNum-1]}`,a.linePos>0&&(u+=`4704- ${" ".repeat(a.linePos-1)}^`)),(a.type==="error"?ze:Xe)(c+u)}}}_getBlending(e){let t,n,r=e.blending,s=e.blendSrc,o=e.blendDst,a=e.blendEquation;if(r===Id){let l=e.blendSrcAlpha!==null?e.blendSrcAlpha:s,c=e.blendDstAlpha!==null?e.blendDstAlpha:o,u=e.blendEquationAlpha!==null?e.blendEquationAlpha:a;t={srcFactor:this._getBlendFactor(s),dstFactor:this._getBlendFactor(o),operation:this._getBlendOperation(a)},n={srcFactor:this._getBlendFactor(l),dstFactor:this._getBlendFactor(c),operation:this._getBlendOperation(u)}}else{let l=e.premultipliedAlpha,c=(u,f,d,A)=>{t={srcFactor:u,dstFactor:f,operation:Pg.Add},n={srcFactor:d,dstFactor:A,operation:Pg.Add}};if(l)switch(r){case Ms:c(ui.One,ui.OneMinusSrcAlpha,ui.One,ui.OneMinusSrcAlpha);break;case Dh:c(ui.One,ui.One,ui.One,ui.One);break;case Nh:c(ui.Zero,ui.OneMinusSrc,ui.Zero,ui.One);break;case Fh:c(ui.Dst,ui.OneMinusSrcAlpha,ui.Zero,ui.One);break}else switch(r){case Ms:c(ui.SrcAlpha,ui.OneMinusSrcAlpha,ui.One,ui.OneMinusSrcAlpha);break;case Dh:c(ui.SrcAlpha,ui.One,ui.One,ui.One);break;case Nh:ze(`WebGPURenderer: "SubtractiveBlending" requires "${e.isMaterial?"material":"blendMode"}.premultipliedAlpha = true".`);break;case Fh:ze(`WebGPURenderer: "MultiplyBlending" requires "${e.isMaterial?"material":"blendMode"}.premultipliedAlpha = true".`);break}}if(t!==void 0&&n!==void 0)return{color:t,alpha:n};ze("WebGPURenderer: Invalid blending: ",r)}_getBlendFactor(e){let t;switch(e){case Nu:t=ui.Zero;break;case cb:t=ui.One;break;case ub:t=ui.Src;break;case hb:t=ui.OneMinusSrc;break;case Yp:t=ui.SrcAlpha;break;case Zp:t=ui.OneMinusSrcAlpha;break;case pb:t=ui.Dst;break;case mb:t=ui.OneMinusDst;break;case fb:t=ui.DstAlpha;break;case db:t=ui.OneMinusDstAlpha;break;case Ab:t=ui.SrcAlphaSaturated;break;case $3e:t=ui.Constant;break;case Y3e:t=ui.OneMinusConstant;break;default:ze("WebGPURenderer: Blend factor not supported.",e)}return t}_getStencilCompare(e){let t,n=e.stencilFunc;switch(n){case V8:t=Wo.Never;break;case M2:t=Wo.Always;break;case G8:t=Wo.Less;break;case H8:t=Wo.LessEqual;break;case q8:t=Wo.Equal;break;case X8:t=Wo.GreaterEqual;break;case W8:t=Wo.Greater;break;case j8:t=Wo.NotEqual;break;default:ze("WebGPURenderer: Invalid stencil function.",n)}return t}_getStencilOperation(e){let t;switch(e){case _d:t=Q0.Keep;break;case N8:t=Q0.Zero;break;case F8:t=Q0.Replace;break;case z8:t=Q0.Invert;break;case B8:t=Q0.IncrementClamp;break;case O8:t=Q0.DecrementClamp;break;case U8:t=Q0.IncrementWrap;break;case k8:t=Q0.DecrementWrap;break;default:ze("WebGPURenderer: Invalid stencil operation.",t)}return t}_getBlendOperation(e){let t;switch(e){case oo:t=Pg.Add;break;case ab:t=Pg.Subtract;break;case lb:t=Pg.ReverseSubtract;break;case EM:t=Pg.Min;break;case MM:t=Pg.Max;break;default:ze("WebGPUPipelineUtils: Blend equation not supported.",e)}return t}_getPrimitiveState(e,t,n){let r={},s=this.backend.utils;r.topology=s.getPrimitiveTopology(e,n),t.index!==null&&e.isLine===!0&&e.isLineSegments!==!0&&(r.stripIndexFormat=t.index.array instanceof Uint16Array?Q4.Uint16:Q4.Uint32);let o=n.side===mi;return e.isMesh&&e.matrixWorld.determinantAffine()<0&&(o=!o),r.frontFace=o===!0?wte.CW:wte.CCW,r.cullMode=n.side===gr?Ste.None:Ste.Back,r}_getColorWriteMask(e){return e.colorWrite===!0?Tte.All:Tte.None}_getDepthCompare(e){let t;if(e.depthTest===!1)t=Wo.Always;else{let n=this.backend.parameters.reversedDepthBuffer?Pb[e.depthFunc]:e.depthFunc;switch(n){case MA:t=Wo.Never;break;case CA:t=Wo.Always;break;case RA:t=Wo.Less;break;case Ch:t=Wo.LessEqual;break;case IA:t=Wo.Equal;break;case PA:t=Wo.GreaterEqual;break;case LA:t=Wo.Greater;break;case DA:t=Wo.NotEqual;break;default:ze("WebGPUPipelineUtils: Invalid depth function.",n)}}return t}},sI=class{constructor(){this.label="",this.type=void 0,this.count=0}reset(){this.label="",this.type=void 0,this.count=0}},hf=new Am,uPe=new t1,jw=new sI,N9=class extends Z4{constructor(e,t,n=2048){super(n),this.device=e,this.type=t,jw.label=`queryset_global_timestamp_${t}`,jw.type="timestamp",jw.count=this.maxQueries,this.querySet=this.device.createQuerySet(jw),jw.reset();let r=this.maxQueries*8;hf.label=`buffer_timestamp_resolve_${t}`,hf.size=r,hf.usage=GPUBufferUsage.QUERY_RESOLVE|GPUBufferUsage.COPY_SRC,this.resolveBuffer=this.device.createBuffer(hf),hf.reset(),hf.label=`buffer_timestamp_result_${t}`,hf.size=r,hf.usage=GPUBufferUsage.COPY_DST|GPUBufferUsage.MAP_READ,this.resultBuffer=this.device.createBuffer(hf),hf.reset()}allocateQueriesForContext(e){if(!this.trackTimestamp||this.isDisposed)return null;if(this.currentQueryIndex+2>this.maxQueries)return ni(`WebGPUTimestampQueryPool [${this.type}]: Maximum number of queries exceeded, when using trackTimestamp it is necessary to resolves the queries via renderer.resolveTimestampsAsync( THREE.TimestampQuery.${this.type.toUpperCase()} ).`),null;let t=this.currentQueryIndex;return this.currentQueryIndex+=2,this.queryOffsets.set(e,t),t}async resolveQueriesAsync(){if(!this.trackTimestamp||this.currentQueryIndex===0||this.isDisposed)return this.lastValue;if(this.pendingResolve)return this.pendingResolve;this.pendingResolve=this._resolveQueries();try{return await this.pendingResolve}finally{this.pendingResolve=null}}async _resolveQueries(){if(this.isDisposed)return this.lastValue;try{if(this.resultBuffer.mapState!=="unmapped")return this.lastValue;let e=new Map(this.queryOffsets),t=this.currentQueryIndex,n=t*8;this.currentQueryIndex=0,this.queryOffsets.clear();let r=this.device.createCommandEncoder(uPe);r.resolveQuerySet(this.querySet,0,t,this.resolveBuffer,0),r.copyBufferToBuffer(this.resolveBuffer,0,this.resultBuffer,0,n);let s=r.finish();if(mf(this.device,s),this.resultBuffer.mapState!=="unmapped")return this.lastValue;if(await this.resultBuffer.mapAsync(GPUMapMode.READ,0,n),this.isDisposed)return this.resultBuffer.mapState==="mapped"&&this.resultBuffer.unmap(),this.lastValue;let o=new BigUint64Array(this.resultBuffer.getMappedRange(0,n)),a={},l=[];for(let[u,f]of e){let d=u.match(/^(.*):f(\d+)$/),A=parseInt(d[2]);l.includes(A)===!1&&l.push(A),a[A]===void 0&&(a[A]=0);let y=o[f],w=o[f+1],S=Number(w-y)/1e6;this.timestamps.set(u,S),a[A]+=S}let c=a[l[l.length-1]];return this.resultBuffer.unmap(),this.lastValue=c,this.frames=l,c}catch(e){return ze("Error resolving queries:",e),this.resultBuffer.mapState==="mapped"&&this.resultBuffer.unmap(),this.lastValue}}async dispose(){if(!this.isDisposed){if(this.isDisposed=!0,this.pendingResolve)try{await this.pendingResolve}catch(e){ze("Error waiting for pending resolve:",e)}if(this.resultBuffer&&this.resultBuffer.mapState==="mapped")try{this.resultBuffer.unmap()}catch(e){ze("Error unmapping buffer:",e)}this.querySet&&(this.querySet.destroy(),this.querySet=null),this.resolveBuffer&&(this.resolveBuffer.destroy(),this.resolveBuffer=null),this.resultBuffer&&(this.resultBuffer.destroy(),this.resultBuffer=null),this.queryOffsets.clear(),this.pendingResolve=null}}},F9=class{constructor(){this.label="",this.timestampWrites=void 0}reset(){this.label="",this.timestampWrites=void 0}},Q_=class{constructor(){this.view=null,this.depthLoadOp=void 0,this.depthStoreOp=void 0,this.depthClearValue=void 0,this.depthReadOnly=!1,this.stencilLoadOp=void 0,this.stencilStoreOp=void 0,this.stencilClearValue=0,this.stencilReadOnly=!1}reset(){this.view=null,this.depthLoadOp=void 0,this.depthStoreOp=void 0,this.depthClearValue=void 0,this.depthReadOnly=!1,this.stencilLoadOp=void 0,this.stencilStoreOp=void 0,this.stencilClearValue=0,this.stencilReadOnly=!1}},B9=class{constructor(){this.querySet=null,this.beginningOfPassWriteIndex=void 0,this.endOfPassWriteIndex=void 0}reset(){this.querySet=null,this.beginningOfPassWriteIndex=void 0,this.endOfPassWriteIndex=void 0}},qu={r:0,g:0,b:0,a:1},sc=new Am,$a=new t1,UR=new F9,Xw=new sI,kR=new iI,zR=new B9,Zc=new dx,ff=new dx,Tr=new TS,Gd=new rI,O9=class extends Y4{constructor(e={}){super(e),this.isWebGPUBackend=!0,this.parameters.alpha=e.alpha===void 0?!0:e.alpha,this.parameters.requiredLimits=e.requiredLimits===void 0?{}:e.requiredLimits,this.compatibilityMode=null,this.device=null,this.defaultRenderPassdescriptor=null,this.utils=new p9(this),this.attributeUtils=new M9(this),this.bindingUtils=new R9(this),this.capabilities=new I9(this),this.pipelineUtils=new D9(this),this.textureUtils=new b9(this),this.occludedResolveCache=new Map;let t=typeof navigator>"u"?!0:/Android/.test(navigator.userAgent)===!1;this._compatibility={[Dd.TEXTURE_COMPARE]:t}}async init(e){await super.init(e);let t=this.parameters,n;if(t.device===void 0){let r={powerPreference:t.powerPreference,featureLevel:"compatibility",xrCompatible:e.xr.enabled},s=typeof navigator<"u"?await navigator.gpu.requestAdapter(r):null;if(s===null)throw new Error("THREE.WebGPUBackend: Unable to create WebGPU adapter.");let o=Object.values(J4),a=[];for(let c of o)s.features.has(c)&&a.push(c);let l={requiredFeatures:a,requiredLimits:t.requiredLimits};n=await s.requestDevice(l)}else n=t.device;this.compatibilityMode=!n.features.has("core-features-and-limits"),this.compatibilityMode&&(e._samples=0),n.lost.then(r=>{if(r.reason==="destroyed")return;let s={api:"WebGPU",message:r.message||"Unknown reason",reason:r.reason||null,originalEvent:r};e.onDeviceLost(s)}),n.onuncapturederror=r=>{let s=r.error,o=s&&s.constructor?s.constructor.name:"GPUError",a=s&&s.message||"Unknown uncaptured GPU error";e.onError({api:"WebGPU",type:o,message:a,originalEvent:r})},this.device=n,this.trackTimestamp=this.trackTimestamp&&this.hasFeature(J4.TimestampQuery),this.updateSize()}setXRRenderTargetTextures(e,t,n=null){this.set(e.texture,{texture:t,format:t.format,externalTexture:!0,xrViewDescriptors:n,initialized:!0})}get context(){let e=this.renderer.getCanvasTarget(),t=this.get(e),n=t.context;if(n===void 0){let r=this.parameters;e.isDefaultCanvasTarget===!0&&r.context!==void 0?n=r.context:n=e.domElement.getContext("webgpu"),"setAttribute"in e.domElement&&e.domElement.setAttribute("data-engine",`three.js r${"185"} webgpu`);let s=r.alpha?"premultiplied":"opaque",o=r.outputType===Wi?"extended":"standard";n.configure({device:this.device,format:this.utils.getPreferredCanvasFormat(),usage:GPUTextureUsage.RENDER_ATTACHMENT|GPUTextureUsage.COPY_SRC,alphaMode:s,toneMapping:{mode:o}}),t.context=n}return n}get coordinateSystem(){return _l}get hasTimestamp(){return!0}async getArrayBufferAsync(e,t=null,n=0,r=-1){return await this.attributeUtils.getArrayBufferAsync(e,t,n,r)}getContext(){return this.context}_getDefaultRenderPassDescriptor(){let e=this.renderer,t=e.getCanvasTarget(),n=this.get(t),r=e.currentSamples,s=n.descriptor;if(s===void 0||n.samples!==r){if(s=new jg,s.colorAttachments.push(new Wg),e.depth===!0||e.stencil===!0){let l=new Q_;l.view=this.textureUtils.getDepthBuffer(e.depth,e.stencil).createView(),s.depthStencilAttachment=l}let a=s.colorAttachments[0];r>0?a.view=this.textureUtils.getColorBuffer().createView():a.resolveTarget=void 0,n.descriptor=s,n.samples=r}let o=s.colorAttachments[0];return r>0?o.resolveTarget=this.context.getCurrentTexture().createView():o.view=this.context.getCurrentTexture().createView(),s}_isRenderCameraDepthArray(e){let t=e.camera;return e.depthTexture&&e.depthTexture.isArrayTexture===!0&&t!==null&&t.isArrayCamera===!0}_hasExternalTexture(e){let t=e.textures;if(t===null)return!1;for(let n=0;n<t.length;n++)if(this.get(t[n]).externalTexture===!0)return!0;return!1}_createExternalTextureViews(e,t){let n=[],r=e.camera;if(t.xrViewDescriptors&&r!==null&&r.isArrayCamera===!0)for(let s=0;s<t.xrViewDescriptors.length;s++)n.push({view:t.texture.createView(t.xrViewDescriptors[s]),resolveTarget:void 0,depthSlice:void 0});else n.push({view:t.texture.createView({dimension:jo.TwoD,baseArrayLayer:e.activeCubeFace,arrayLayerCount:1}),resolveTarget:void 0,depthSlice:void 0});return n}_getRenderPassDescriptor(e,t={}){let n=e.renderTarget,r=this.get(n),s=this._hasExternalTexture(e),o=r.descriptors;(o===void 0||r.width!==n.width||r.height!==n.height||r.samples!==n.samples||s)&&(o={},r.descriptors=o);let a=e.getCacheKey(),l=o[a];if(l===void 0||s){let u=e.textures,f=[],d,A=this._isRenderCameraDepthArray(e);for(let w=0;w<u.length;w++){let S=this.get(u[w]);if(S.externalTexture===!0){f.push(...this._createExternalTextureViews(e,S));continue}if(Tr.label=`colorAttachment_${w}`,Tr.baseMipLevel=e.activeMipmapLevel,Tr.mipLevelCount=1,Tr.baseArrayLayer=e.activeCubeFace,Tr.arrayLayerCount=1,Tr.dimension=jo.TwoD,n.isRenderTarget3D)d=e.activeCubeFace,Tr.baseArrayLayer=0,Tr.dimension=jo.ThreeD;else if(n.isRenderTarget&&u[w].image.depth>1)if(A===!0){let T=e.camera.cameras;for(let R=0;R<T.length;R++){Tr.baseArrayLayer=R,Tr.arrayLayerCount=1,Tr.dimension=jo.TwoD;let P=S.texture.createView(Tr);f.push({view:P,resolveTarget:void 0,depthSlice:void 0})}}else Tr.dimension=jo.TwoDArray;if(A!==!0){let T=S.texture.createView(Tr),R,P;S.msaaTexture!==void 0?(R=S.msaaTexture.createView(),P=T):(R=T,P=void 0),f.push({view:R,resolveTarget:P,depthSlice:d})}Tr.reset()}let y=[];for(let w=0;w<f.length;w++){let S=f[w],T=new Wg;T.view=S.view,T.depthSlice=S.depthSlice,T.resolveTarget=S.resolveTarget,y.push(T)}if(l={textureViews:f,colorAttachments:y,descriptor:new jg},e.depth){let w=this.get(e.depthTexture);(e.depthTexture.isArrayTexture||e.depthTexture.isCubeTexture)&&(Tr.dimension=jo.TwoD,Tr.arrayLayerCount=1,Tr.baseArrayLayer=e.activeCubeFace);let S=new Q_;S.view=w.texture.createView(Tr),l.depthStencilAttachment=S,Tr.reset()}o[a]=l,r.width=n.width,r.height=n.height,r.samples=n.samples,r.activeMipmapLevel=e.activeMipmapLevel,r.activeCubeFace=e.activeCubeFace}let c=l.descriptor;c.reset();for(let u=0;u<l.colorAttachments.length;u++){let f=l.colorAttachments[u],d={r:0,g:0,b:0,a:1};u===0&&t.clearValue&&(d=t.clearValue),f.loadOp=t.loadOp||Fi.Load,f.storeOp=t.storeOp||Ya.Store,f.clearValue=d,c.colorAttachments.push(f)}return l.depthStencilAttachment&&(c.depthStencilAttachment=l.depthStencilAttachment),c}beginRender(e){let t=this.get(e),n=this.device,r=e.occlusionQueryCount,s;r>0&&(t.currentOcclusionQuerySet&&t.currentOcclusionQuerySet.destroy(),t.currentOcclusionQueryBuffer&&t.currentOcclusionQueryBuffer.destroy(),t.currentOcclusionQuerySet=t.occlusionQuerySet,t.currentOcclusionQueryBuffer=t.occlusionQueryBuffer,t.currentOcclusionQueryObjects=t.occlusionQueryObjects,Xw.label=`occlusionQuerySet_${e.id}`,Xw.type="occlusion",Xw.count=r,s=n.createQuerySet(Xw),Xw.reset(),t.occlusionQuerySet=s,t.occlusionQueryIndex=0,t.occlusionQueryObjects=new Array(r),t.lastOcclusionObject=null);let o;e.textures===null?o=this._getDefaultRenderPassDescriptor():o=this._getRenderPassDescriptor(e,{loadOp:Fi.Load}),this.initTimestampQuery(Hc.RENDER,this.getTimestampUID(e),o),o.occlusionQuerySet=s;let a=o.depthStencilAttachment;if(e.textures!==null){let c=o.colorAttachments;for(let u=0;u<c.length;u++){let f=c[u];e.clearColor?(u===0?f.clearValue=e.clearColorValue:(qu.r=0,qu.g=0,qu.b=0,qu.a=1,f.clearValue=qu),f.loadOp=Fi.Clear):f.loadOp=Fi.Load,f.storeOp=Ya.Store}}else{let c=o.colorAttachments[0];e.clearColor?(c.clearValue=e.clearColorValue,c.loadOp=Fi.Clear):c.loadOp=Fi.Load,c.storeOp=Ya.Store}e.depth&&(e.clearDepth?(a.depthClearValue=e.clearDepthValue,a.depthLoadOp=Fi.Clear):a.depthLoadOp=Fi.Load,a.depthStoreOp=Ya.Store),e.stencil&&(e.clearStencil?(a.stencilClearValue=e.clearStencilValue,a.stencilLoadOp=Fi.Clear):a.stencilLoadOp=Fi.Load,a.stencilStoreOp=Ya.Store),$a.label="renderContext_"+e.id;let l=n.createCommandEncoder($a);if($a.reset(),this._isRenderCameraDepthArray(e)===!0){let c=e.camera.cameras;!t.layerDescriptors||t.layerDescriptors.length!==c.length?this._createArrayCameraLayerDescriptors(e,t,o,c):this._updateArrayCameraLayerDescriptors(e,t,c),t.bundleEncoders=[],t.bundleSets=[];for(let u=0;u<c.length;u++){let f=this.pipelineUtils.createBundleEncoder(e,"renderBundleArrayCamera_"+u),d={attributes:{},bindingGroups:[],pipeline:null,index:null};t.bundleEncoders.push(f),t.bundleSets.push(d)}t.currentPass=null}else{let c=l.beginRenderPass(o);t.currentPass=c,e.viewport&&this.updateViewport(e),e.scissor&&this.updateScissor(e)}t.descriptor=o,t.encoder=l,t.currentSets={attributes:{},bindingGroups:[],pipeline:null,index:null},t.renderBundles=[]}_createArrayCameraLayerDescriptors(e,t,n,r){let s=n.depthStencilAttachment;t.layerDescriptors=[];let o=this.get(e.depthTexture);o.viewCache||(o.viewCache=[]);for(let a=0;a<r.length;a++){let l=n.colorAttachments[0],c=new Wg;c.view=n.colorAttachments[a].view,c.depthSlice=l.depthSlice,c.resolveTarget=l.resolveTarget,c.loadOp=l.loadOp,c.storeOp=l.storeOp,c.clearValue=l.clearValue;let u=new jg;if(u.label=n.label,u.occlusionQuerySet=n.occlusionQuerySet,u.timestampWrites=n.timestampWrites,u.colorAttachments.push(c),n.depthStencilAttachment){let f=a;o.viewCache[f]||(Tr.dimension=jo.TwoD,Tr.baseArrayLayer=a,Tr.arrayLayerCount=1,o.viewCache[f]=o.texture.createView(Tr),Tr.reset());let d=new Q_;d.view=o.viewCache[f],d.depthLoadOp=s.depthLoadOp||Fi.Clear,d.depthStoreOp=s.depthStoreOp||Ya.Store,d.depthClearValue=s.depthClearValue||1,e.stencil&&(d.stencilLoadOp=s.stencilLoadOp,d.stencilStoreOp=s.stencilStoreOp,d.stencilClearValue=s.stencilClearValue),u.depthStencilAttachment=d}else{let f=new Q_;f.view=s.view,f.depthLoadOp=s.depthLoadOp,f.depthStoreOp=s.depthStoreOp,f.depthClearValue=s.depthClearValue,f.depthReadOnly=s.depthReadOnly,f.stencilLoadOp=s.stencilLoadOp,f.stencilStoreOp=s.stencilStoreOp,f.stencilClearValue=s.stencilClearValue,f.stencilReadOnly=s.stencilReadOnly,u.depthStencilAttachment=f}t.layerDescriptors.push(u)}}_updateArrayCameraLayerDescriptors(e,t,n){for(let r=0;r<n.length;r++){let s=t.layerDescriptors[r];if(s.depthStencilAttachment){let o=s.depthStencilAttachment;e.depth&&(e.clearDepth?(o.depthClearValue=e.clearDepthValue,o.depthLoadOp=Fi.Clear):o.depthLoadOp=Fi.Load),e.stencil&&(e.clearStencil?(o.stencilClearValue=e.clearStencilValue,o.stencilLoadOp=Fi.Clear):o.stencilLoadOp=Fi.Load)}}}finishRender(e){let t=this.get(e),n=e.occlusionQueryCount;t.renderBundles.length>0&&t.currentPass.executeBundles(t.renderBundles),n>t.occlusionQueryIndex&&t.currentPass.endOcclusionQuery();let r=t.encoder;if(this._isRenderCameraDepthArray(e)===!0){let s=[];for(let o=0;o<t.bundleEncoders.length;o++){let a=t.bundleEncoders[o];s.push(a.finish())}for(let o=0;o<t.layerDescriptors.length;o++)if(o<s.length){let a=t.layerDescriptors[o],l=r.beginRenderPass(a);if(e.viewport){let{x:c,y:u,width:f,height:d,minDepth:A,maxDepth:y}=e.viewportValue;l.setViewport(c,u,f,d,A,y)}if(e.scissor){let{x:c,y:u,width:f,height:d}=e.scissorValue;l.setScissorRect(c,u,f,d)}l.executeBundles([s[o]]),l.end()}}else t.currentPass&&t.currentPass.end();if(n>0){let s=n*8,o=this.occludedResolveCache.get(s);o===void 0&&(sc.size=s,sc.usage=GPUBufferUsage.QUERY_RESOLVE|GPUBufferUsage.COPY_SRC,o=this.device.createBuffer(sc),sc.reset(),this.occludedResolveCache.set(s,o)),sc.size=s,sc.usage=GPUBufferUsage.COPY_DST|GPUBufferUsage.MAP_READ;let a=this.device.createBuffer(sc);sc.reset(),t.encoder.resolveQuerySet(t.occlusionQuerySet,0,n,o,0),t.encoder.copyBufferToBuffer(o,0,a,0,s),t.occlusionQueryBuffer=a,this.resolveOccludedAsync(e)}if(mf(this.device,t.encoder.finish()),e.textures!==null){let s=e.textures;for(let o=0;o<s.length;o++){let a=s[o];a.generateMipmaps===!0&&this.textureUtils.generateMipmaps(a)}}}isOccluded(e,t){let n=this.get(e);return n.occluded&&n.occluded.has(t)}async resolveOccludedAsync(e){let t=this.get(e),{currentOcclusionQueryBuffer:n,currentOcclusionQueryObjects:r}=t;if(n&&r){let s=new WeakSet;t.currentOcclusionQueryObjects=null,t.currentOcclusionQueryBuffer=null,await n.mapAsync(GPUMapMode.READ);let o=n.getMappedRange(),a=new BigUint64Array(o);for(let l=0;l<r.length;l++)a[l]===BigInt(0)&&s.add(r[l]);n.destroy(),t.occluded=s}}updateViewport(e){let{currentPass:t}=this.get(e),{x:n,y:r,width:s,height:o,minDepth:a,maxDepth:l}=e.viewportValue;t.setViewport(n,r,s,o,a,l)}updateScissor(e){let{currentPass:t}=this.get(e),{x:n,y:r,width:s,height:o}=e.scissorValue;t.setScissorRect(n,r,s,o)}getClearColor(){let e=super.getClearColor();return this.renderer.alpha===!0&&(e.r*=e.a,e.g*=e.a,e.b*=e.a),e}clear(e,t,n,r=null){let s=this.device,o=this.renderer,a=[],l,c,u;if(e){let A=this.getClearColor();qu.r=A.r,qu.g=A.g,qu.b=A.b,qu.a=A.a}if(r===null){c=o.depth,u=o.stencil;let A=this._getDefaultRenderPassDescriptor();if(e){a=A.colorAttachments;let y=a[0];y.clearValue=qu,y.loadOp=Fi.Clear,y.storeOp=Ya.Store}(c||u)&&(l=A.depthStencilAttachment)}else{c=r.depth,u=r.stencil;let A={loadOp:e?Fi.Clear:Fi.Load,clearValue:e?qu:void 0};c&&(A.depthLoadOp=t?Fi.Clear:Fi.Load,A.depthClearValue=t?o.getClearDepth():void 0,A.depthStoreOp=Ya.Store),u&&(A.stencilLoadOp=n?Fi.Clear:Fi.Load,A.stencilClearValue=n?o.getClearStencil():void 0,A.stencilStoreOp=Ya.Store);let y=this._getRenderPassDescriptor(r,A);a=y.colorAttachments,l=y.depthStencilAttachment}c&&l&&(t?(l.depthLoadOp=Fi.Clear,l.depthClearValue=o.getClearDepth(),l.depthStoreOp=Ya.Store):(l.depthLoadOp=Fi.Load,l.depthStoreOp=Ya.Store)),u&&l&&(n?(l.stencilLoadOp=Fi.Clear,l.stencilClearValue=o.getClearStencil(),l.stencilStoreOp=Ya.Store):(l.stencilLoadOp=Fi.Load,l.stencilStoreOp=Ya.Store)),$a.label="clear";let f=s.createCommandEncoder($a);$a.reset(),f.beginRenderPass({colorAttachments:a,depthStencilAttachment:l}).end(),mf(s,f.finish())}beginCompute(e){let t=this.get(e),n="computeGroup_"+e.id;UR.label=n,$a.label=n,this.initTimestampQuery(Hc.COMPUTE,this.getTimestampUID(e),UR),t.cmdEncoderGPU=this.device.createCommandEncoder($a),t.passEncoderGPU=t.cmdEncoderGPU.beginComputePass(UR),t.currentPipeline=null,$a.reset(),UR.reset()}compute(e,t,n,r,s=null){let o=this.get(t),a=this.get(e),{passEncoderGPU:l}=a,c=this.get(r).pipeline;a.currentPipeline!==c&&(l.setPipeline(c),a.currentPipeline=c);for(let u=0,f=n.length;u<f;u++){let d=n[u],A=this.get(d);l.setBindGroup(u,A.group)}if(s===null&&(s=t.dispatchSize||t.count),s&&s.isIndirectStorageBufferAttribute){let u=this.get(s).buffer;l.dispatchWorkgroupsIndirect(u,0);return}if(typeof s=="number"){let u=s;if(o.dispatchSize===void 0||o.count!==u){o.dispatchSize=[0,1,1],o.count=u;let f=t.workgroupSize,d=f[0];for(let w=1;w<f.length;w++)d*=f[w];let A=Math.ceil(u/d),y=this.device.limits.maxComputeWorkgroupsPerDimension;s=[A,1,1],A>y&&(s[0]=Math.min(A,y),s[1]=Math.ceil(A/y)),o.dispatchSize=s}s=o.dispatchSize}l.dispatchWorkgroups(s[0],s[1]||1,s[2]||1)}finishCompute(e){let t=this.get(e);t.passEncoderGPU.end(),mf(this.device,t.cmdEncoderGPU.finish())}_draw(e,t,n,r,s,o,a,l,c){let{object:u,material:f,context:d}=e,A=e.getIndex(),y=A!==null;c.pipeline!==r&&(l.setPipeline(r),c.pipeline=r);let w=c.bindingGroups;for(let S=0,T=s.length;S<T;S++){let R=s[S];if(w[S]!==R.id){let P=this.get(R);l.setBindGroup(S,P.group),w[S]=R.id}}if(y===!0&&c.index!==A){let S=this.get(A).buffer,T=A.array instanceof Uint16Array?Q4.Uint16:Q4.Uint32;l.setIndexBuffer(S,T),c.index=A}for(let S=0,T=o.length;S<T;S++){let R=o[S];if(c.attributes[S]!==R){let P=this.get(R).buffer;l.setVertexBuffer(S,P),c.attributes[S]=R}}if(d.stencil===!0&&f.stencilWrite===!0&&n.currentStencilRef!==f.stencilRef&&(l.setStencilReference(f.stencilRef),n.currentStencilRef=f.stencilRef),u.isBatchedMesh===!0){let S=u._multiDrawStarts,T=u._multiDrawCounts,R=u._multiDrawCount,P=y===!0?A.array.BYTES_PER_ELEMENT:1;f.wireframe&&(P=u.geometry.attributes.position.count>65535?4:2);for(let I=0;I<R;I++)y===!0?l.drawIndexed(T[I],1,S[I]/P,0,I):l.draw(T[I],1,S[I],I),t.update(u,T[I],1)}else if(y===!0){let{vertexCount:S,instanceCount:T,firstVertex:R}=a,P=e.getIndirect();if(P!==null){let I=this.get(P).buffer,F=e.getIndirectOffset(),D=Array.isArray(F)?F:[F];for(let L=0;L<D.length;L++)l.drawIndexedIndirect(I,D[L])}else l.drawIndexed(S,T,R,0,0);t.update(u,S,T)}else{let{vertexCount:S,instanceCount:T,firstVertex:R}=a,P=e.getIndirect();if(P!==null){let I=this.get(P).buffer,F=e.getIndirectOffset(),D=Array.isArray(F)?F:[F];for(let L=0;L<D.length;L++)l.drawIndirect(I,D[L])}else l.draw(S,T,R,0);t.update(u,S,T)}}draw(e,t){let{object:n,context:r,pipeline:s}=e,o=this.get(r),a=this.get(s),l=a.pipeline;if(a.error===!0)return;let c=e.getDrawParameters();if(c===null)return;let u=e.getBindings(),f=e.getVertexBuffers();if(e.camera.isArrayCamera&&e.camera.cameras.length>0){let d=this.get(e.camera),A=e.camera.cameras,y=e.getBindingGroup("cameraIndex");if(d.indexesGPU===void 0||d.indexesGPU.length!==A.length){let S=this.get(y),T=[],R=new Uint32Array([0,0,0,0]);for(let P=0,I=A.length;P<I;P++){R[0]=P;let{layoutGPU:F}=S.layout,D=this.bindingUtils.createBindGroupIndex(R,F);T.push(D)}d.indexesGPU=T}let w=this.renderer.getPixelRatio();for(let S=0,T=A.length;S<T;S++){let R=A[S];if(n.layers.test(R.layers)){let P=R.viewport,I=o.currentPass,F=o.currentSets,D=o.bundleEncoders!==void 0;if(D){let L=o.bundleEncoders[S],C=o.bundleSets[S];I=L,F=C}if(P&&!D&&I.setViewport(Math.floor(P.x*w),Math.floor(P.y*w),Math.floor(P.width*w),Math.floor(P.height*w),r.viewportValue.minDepth,r.viewportValue.maxDepth),y&&d.indexesGPU){let L=u.indexOf(y);I.setBindGroup(L,d.indexesGPU[S]),F.bindingGroups[L]=y.id}this._draw(e,t,o,l,u,f,c,I,F)}}}else if(o.currentPass){if(o.occlusionQuerySet!==void 0){let d=o.lastOcclusionObject;d!==n&&(d!==null&&d.occlusionTest===!0&&(o.currentPass.endOcclusionQuery(),o.occlusionQueryIndex++),n.occlusionTest===!0&&(o.currentPass.beginOcclusionQuery(o.occlusionQueryIndex),o.occlusionQueryObjects[o.occlusionQueryIndex]=n),o.lastOcclusionObject=n)}this._draw(e,t,o,l,u,f,c,o.currentPass,o.currentSets)}}needsRenderUpdate(e){let t=this.get(e),{object:n,material:r}=e,s=this.utils,o=s.getSampleCountRenderContext(e.context),a=s.getCurrentColorSpace(e.context),l=s.getCurrentColorFormat(e.context),c=s.getCurrentDepthStencilFormat(e.context),u=s.getPrimitiveTopology(n,r),f=n.isMesh&&n.matrixWorld.determinantAffine()<0,d=!1;return(t.material!==r||t.materialVersion!==r.version||t.transparent!==r.transparent||t.blending!==r.blending||t.premultipliedAlpha!==r.premultipliedAlpha||t.blendSrc!==r.blendSrc||t.blendDst!==r.blendDst||t.blendEquation!==r.blendEquation||t.blendSrcAlpha!==r.blendSrcAlpha||t.blendDstAlpha!==r.blendDstAlpha||t.blendEquationAlpha!==r.blendEquationAlpha||t.colorWrite!==r.colorWrite||t.depthWrite!==r.depthWrite||t.depthTest!==r.depthTest||t.depthFunc!==r.depthFunc||t.stencilWrite!==r.stencilWrite||t.stencilFunc!==r.stencilFunc||t.stencilFail!==r.stencilFail||t.stencilZFail!==r.stencilZFail||t.stencilZPass!==r.stencilZPass||t.stencilFuncMask!==r.stencilFuncMask||t.stencilWriteMask!==r.stencilWriteMask||t.side!==r.side||t.alphaToCoverage!==r.alphaToCoverage||t.sampleCount!==o||t.colorSpace!==a||t.colorFormat!==l||t.depthStencilFormat!==c||t.primitiveTopology!==u||t.frontFaceCW!==f||t.clippingContextCacheKey!==e.clippingContextCacheKey)&&(t.material=r,t.materialVersion=r.version,t.transparent=r.transparent,t.blending=r.blending,t.premultipliedAlpha=r.premultipliedAlpha,t.blendSrc=r.blendSrc,t.blendDst=r.blendDst,t.blendEquation=r.blendEquation,t.blendSrcAlpha=r.blendSrcAlpha,t.blendDstAlpha=r.blendDstAlpha,t.blendEquationAlpha=r.blendEquationAlpha,t.colorWrite=r.colorWrite,t.depthWrite=r.depthWrite,t.depthTest=r.depthTest,t.depthFunc=r.depthFunc,t.stencilWrite=r.stencilWrite,t.stencilFunc=r.stencilFunc,t.stencilFail=r.stencilFail,t.stencilZFail=r.stencilZFail,t.stencilZPass=r.stencilZPass,t.stencilFuncMask=r.stencilFuncMask,t.stencilWriteMask=r.stencilWriteMask,t.side=r.side,t.alphaToCoverage=r.alphaToCoverage,t.sampleCount=o,t.colorSpace=a,t.colorFormat=l,t.depthStencilFormat=c,t.primitiveTopology=u,t.frontFaceCW=f,t.clippingContextCacheKey=e.clippingContextCacheKey,d=!0),d}getRenderCacheKey(e){let{object:t,material:n}=e,r=this.utils,s=e.context,o=t.isMesh&&t.matrixWorld.determinantAffine()<0;return[n.transparent,n.blending,n.premultipliedAlpha,n.blendSrc,n.blendDst,n.blendEquation,n.blendSrcAlpha,n.blendDstAlpha,n.blendEquationAlpha,n.colorWrite,n.depthWrite,n.depthTest,n.depthFunc,n.stencilWrite,n.stencilFunc,n.stencilFail,n.stencilZFail,n.stencilZPass,n.stencilFuncMask,n.stencilWriteMask,n.side,o,r.getSampleCountRenderContext(s),r.getCurrentColorSpace(s),r.getCurrentColorFormat(s),r.getCurrentDepthStencilFormat(s),r.getPrimitiveTopology(t,n),e.getGeometryCacheKey(),e.clippingContextCacheKey].join()}updateSampler(e){return this.textureUtils.updateSampler(e)}destroySampler(e){this.textureUtils.destroySampler(e)}createDefaultTexture(e){return this.textureUtils.createDefaultTexture(e)}createTexture(e,t){this.textureUtils.createTexture(e,t)}updateTexture(e,t){this.textureUtils.updateTexture(e,t)}generateMipmaps(e){this.textureUtils.generateMipmaps(e)}destroyTexture(e,t=!1){this.textureUtils.destroyTexture(e,t)}async copyTextureToBuffer(e,t,n,r,s,o){return this.textureUtils.copyTextureToBuffer(e,t,n,r,s,o)}initTimestampQuery(e,t,n){if(!this.trackTimestamp)return;this.timestampQueryPool[e]||(this.timestampQueryPool[e]=new N9(this.device,e,2048));let r=this.timestampQueryPool[e],s=r.allocateQueriesForContext(t);zR.querySet=r.querySet,zR.beginningOfPassWriteIndex=s,zR.endOfPassWriteIndex=s+1,n.timestampWrites=zR}createNodeBuilder(e,t){return new E9(e,t)}createProgram(e){let t=this.get(e);kR.label=e.stage+(e.name!==""?`_${e.name}`:""),kR.code=e.code,t.module={module:this.device.createShaderModule(kR),entryPoint:"main"},kR.reset()}destroyProgram(e){this.delete(e)}createRenderPipeline(e,t){this.pipelineUtils.createRenderPipeline(e,t)}createComputePipeline(e,t){this.pipelineUtils.createComputePipeline(e,t)}beginBundle(e){let t=this.get(e);t._currentPass=t.currentPass,t._currentSets=t.currentSets,t.currentSets={attributes:{},bindingGroups:[],pipeline:null,index:null},t.currentPass=this.pipelineUtils.createBundleEncoder(e)}finishBundle(e,t){let n=this.get(e),s=n.currentPass.finish();this.get(t).bundleGPU=s,n.currentSets=n._currentSets,n.currentPass=n._currentPass}addBundle(e,t){this.get(e).renderBundles.push(this.get(t).bundleGPU)}createUniformBuffer(e){let t=this.get(e);if(t.buffer===void 0){let n=e.byteLength,r=GPUBufferUsage.UNIFORM|GPUBufferUsage.COPY_DST,s=[];e.visibility&yf.VERTEX&&s.push("vertex"),e.visibility&yf.FRAGMENT&&s.push("fragment"),e.visibility&yf.COMPUTE&&s.push("compute");let o=`(${s.join(",")})`;sc.label=`bindingBuffer${e.id}_${e.name}_${o}`,sc.size=n,sc.usage=r;let a=this.device.createBuffer(sc);sc.reset(),t.buffer=a}}destroyUniformBuffer(e){this.get(e).buffer.destroy(),this.delete(e)}createBindings(e,t,n,r){this.bindingUtils.createBindings(e,t,n,r)}updateBindings(e,t,n,r){this.bindingUtils.createBindings(e,t,n,r)}updateBinding(e){this.bindingUtils.updateBinding(e)}deleteBindGroupData(e){this.bindingUtils.deleteBindGroupData(e)}createIndexAttribute(e){let t=GPUBufferUsage.INDEX|GPUBufferUsage.COPY_SRC|GPUBufferUsage.COPY_DST;(e.isStorageBufferAttribute||e.isStorageInstancedBufferAttribute)&&(t|=GPUBufferUsage.STORAGE),this.attributeUtils.createAttribute(e,t)}createAttribute(e){this.attributeUtils.createAttribute(e,GPUBufferUsage.VERTEX|GPUBufferUsage.COPY_SRC|GPUBufferUsage.COPY_DST)}createStorageAttribute(e){this.attributeUtils.createAttribute(e,GPUBufferUsage.STORAGE|GPUBufferUsage.VERTEX|GPUBufferUsage.COPY_SRC|GPUBufferUsage.COPY_DST)}createIndirectStorageAttribute(e){this.attributeUtils.createAttribute(e,GPUBufferUsage.STORAGE|GPUBufferUsage.INDIRECT|GPUBufferUsage.COPY_SRC|GPUBufferUsage.COPY_DST)}updateAttribute(e){this.attributeUtils.updateAttribute(e)}destroyAttribute(e){this.attributeUtils.destroyAttribute(e)}updateSize(){this.delete(this.renderer.getCanvasTarget())}hasFeature(e){return Cte[e]!==void 0&&(e=Cte[e]),this.device.features.has(e)}copyTextureToTexture(e,t,n=null,r=null,s=0,o=0){let a=0,l=0,c=0,u=0,f=0,d=0,A=e.image.width,y=e.image.height,w=1;n!==null&&(n.isBox3===!0?(u=n.min.x,f=n.min.y,d=n.min.z,A=n.max.x-n.min.x,y=n.max.y-n.min.y,w=n.max.z-n.min.z):(u=n.min.x,f=n.min.y,A=n.max.x-n.min.x,y=n.max.y-n.min.y,w=1)),r!==null&&(a=r.x,l=r.y,c=r.z||0),$a.label="copyTextureToTexture_"+e.id+"_"+t.id;let S=this.device.createCommandEncoder($a);$a.reset();let T=this.get(e).texture,R=this.get(t).texture;Zc.texture=T,Zc.mipLevel=s,Zc.origin.x=u,Zc.origin.y=f,Zc.origin.z=d,ff.texture=R,ff.mipLevel=o,ff.origin.x=a,ff.origin.y=l,ff.origin.z=c,Gd.width=A,Gd.height=y,Gd.depthOrArrayLayers=w,S.copyTextureToTexture(Zc,ff,Gd),Zc.reset(),ff.reset(),Gd.reset(),mf(this.device,S.finish()),o===0&&t.generateMipmaps&&this.textureUtils.generateMipmaps(t)}copyFramebufferToTexture(e,t,n){let r=this.get(t),s=null;t.renderTarget?e.isDepthTexture?s=this.get(t.depthTexture).texture:s=this.get(t.textures[0]).texture:e.isDepthTexture?s=this.textureUtils.getDepthBuffer(t.depth,t.stencil):s=this.context.getCurrentTexture();let o=this.get(e).texture;if(s.format!==o.format){ze("WebGPUBackend: copyFramebufferToTexture: Source and destination formats do not match.",s.format,o.format);return}let a;if(r.currentPass?(r.currentPass.end(),a=r.encoder):($a.label="copyFramebufferToTexture_"+e.id,a=this.device.createCommandEncoder($a),$a.reset()),Zc.texture=s,Zc.origin.x=n.x,Zc.origin.y=n.y,ff.texture=o,Gd.width=n.z,Gd.height=n.w,a.copyTextureToTexture(Zc,ff,Gd),Zc.reset(),ff.reset(),Gd.reset(),e.generateMipmaps&&this.textureUtils.generateMipmaps(e,a),r.currentPass){let{descriptor:l}=r;for(let c=0;c<l.colorAttachments.length;c++)l.colorAttachments[c].loadOp=Fi.Load;t.depth&&(l.depthStencilAttachment.depthLoadOp=Fi.Load),t.stencil&&(l.depthStencilAttachment.stencilLoadOp=Fi.Load),r.currentPass=a.beginRenderPass(l),r.currentSets={attributes:{},bindingGroups:[],pipeline:null,index:null},t.viewport&&this.updateViewport(t),t.scissor&&this.updateScissor(t)}else mf(this.device,a.finish())}hasCompatibility(e){return this._compatibility[e]!==void 0?this._compatibility[e]:super.hasCompatibility(e)}dispose(){if(this.bindingUtils.dispose(),this.textureUtils.dispose(),this.occludedResolveCache){for(let e of this.occludedResolveCache.values())e.destroy();this.occludedResolveCache.clear()}if(this.timestampQueryPool)for(let e of Object.values(this.timestampQueryPool))e!==null&&e.dispose();this.parameters.device===void 0&&this.device!==null&&this.device.destroy()}},U9=class extends jA{constructor(e,t,n,r,s,o){super(e,t,n,r,s,o),this.iesMap=null}copy(e,t){return super.copy(e,t),this.iesMap=e.iesMap,this}},k9=class extends jA{constructor(e,t,n,r,s,o){super(e,t,n,r,s,o),this.aspect=null}copy(e,t){return super.copy(e,t),this.aspect=e.aspect,this}},z9=class extends V4{constructor(){super(),this.addMaterial(c7,"MeshPhongMaterial"),this.addMaterial(_4,"MeshStandardMaterial"),this.addMaterial(g7,"MeshPhysicalMaterial"),this.addMaterial(_7,"MeshToonMaterial"),this.addMaterial(a7,"MeshBasicMaterial"),this.addMaterial(l7,"MeshLambertMaterial"),this.addMaterial(i7,"MeshNormalMaterial"),this.addMaterial(x7,"MeshMatcapMaterial"),this.addMaterial(e7,"LineBasicMaterial"),this.addMaterial(t7,"LineDashedMaterial"),this.addMaterial(b7,"PointsMaterial"),this.addMaterial(x4,"SpriteMaterial"),this.addMaterial(S7,"ShadowMaterial"),this.addLight(pk,Q2),this.addLight(Uk,XA),this.addLight(qk,J2),this.addLight(yS,jA),this.addLight(Ok,$A),this.addLight(kk,Z2),this.addLight(Vk,eb),this.addLight(zk,U9),this.addLight(Gk,k9),this.addToneMapping(hse,gb),this.addToneMapping(fse,vb),this.addToneMapping(dse,_b),this.addToneMapping(pse,xb),this.addToneMapping(mse,yb),this.addToneMapping(Ase,bb)}},px=class extends Qk{constructor(e={}){let t;e.forceWebGL?t=K4:(t=O9,e.getFallback=()=>(Xe("WebGPURenderer: WebGPU is not available, running under WebGL2 backend."),new K4(e)));let n=new t(e);super(n,e),this.library=new z9,this.isWebGPURenderer=!0,typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}};var Oat=V.BRDF_GGX,Uat=V.BRDF_Lambert,kat=V.BasicPointShadowFilter,zat=V.BasicShadowFilter,Vat=V.Break,Gat=V.Const,qat=V.Continue,Hat=V.DFGLUT,Wat=V.D_GGX,jat=V.Discard,Xat=V.EPSILON,$at=V.F_Schlick,Xse=V.Fn,Yat=V.INFINITY,$se=V.If,Yse=V.Loop,Zat=V.NodeAccess,Kat=V.NodeShaderStage,Qat=V.NodeType,Jat=V.NodeUpdateType,elt=V.PCFShadowFilter,tlt=V.PCFSoftShadowFilter,nlt=V.PI,ilt=V.PI2,rlt=V.TWO_PI,slt=V.HALF_PI,olt=V.PointShadowFilter,alt=V.Return,llt=V.Schlick_to_F0,clt=V.ShaderNode,ult=V.Stack,hlt=V.Switch,flt=V.TBNViewMatrix,dlt=V.VSMShadowFilter,plt=V.V_GGX_SmithCorrelated,mlt=V.Var,Alt=V.VarIntent,glt=V.abs,vlt=V.acesFilmicToneMapping,_lt=V.acos,xlt=V.acosh,ylt=V.add,blt=V.addMethodChaining,wlt=V.addNodeElement,Slt=V.agxToneMapping,Tlt=V.all,Elt=V.alphaT,Mlt=V.ambientOcclusion,Clt=V.and,Rlt=V.anisotropy,Ilt=V.anisotropyB,Plt=V.anisotropyT,Llt=V.any,Dlt=V.append,Nlt=V.array,Zse=V.asin,Flt=V.asinh,Blt=V.assign,Olt=V.atan,Ult=V.atanh,klt=V.atomicAdd,zlt=V.atomicAnd,Vlt=V.atomicFunc,Glt=V.atomicLoad,qlt=V.atomicMax,Hlt=V.atomicMin,Wlt=V.atomicOr,jlt=V.atomicStore,Xlt=V.atomicSub,$lt=V.atomicXor,Ylt=V.attenuationColor,Zlt=V.attenuationDistance,Klt=V.attribute,Qlt=V.attributeArray,Jlt=V.backgroundBlurriness,ect=V.backgroundIntensity,tct=V.backgroundRotation,nct=V.batch,ict=V.bentNormalView,rct=V.billboarding,sct=V.bitAnd,oct=V.bitNot,act=V.bitOr,lct=V.bitXor,cct=V.bitangentGeometry,uct=V.bitangentLocal,hct=V.bitangentView,fct=V.bitangentWorld,dct=V.bitcast,pct=V.blendBurn,mct=V.blendColor,Act=V.blendDodge,gct=V.blendOverlay,vct=V.blendScreen,_ct=V.blur,xct=V.bool,yct=V.buffer,bct=V.bufferAttribute,wct=V.bumpMap,Sct=V.builtin,Tct=V.builtinAOContext,Ect=V.builtinShadowContext,Mct=V.bvec2,Cct=V.bvec3,Rct=V.bvec4,Ict=V.bypass,Pct=V.cache,Lct=V.call,Dct=V.cameraFar,Nct=V.cameraIndex,Fct=V.cameraNear,Bct=V.cameraNormalMatrix,Oct=V.cameraPosition,Uct=V.cameraProjectionMatrix,kct=V.cameraProjectionMatrixInverse,zct=V.cameraViewMatrix,Vct=V.cameraViewport,Gct=V.cameraWorldMatrix,qct=V.cbrt,Hct=V.cdl,Wct=V.ceil,jct=V.checker,Xct=V.cineonToneMapping,$ct=V.clamp,Yct=V.clearcoat,Zct=V.clearcoatNormalView,Kct=V.clearcoatRoughness,Qct=V.clipSpace,Jct=V.code,eut=V.color,tut=V.colorSpaceToWorking,nut=V.colorToDirection,iut=V.compute,rut=V.computeKernel,sut=V.computeSkinning,out=V.context,aut=V.convert,lut=V.convertColorSpace,cut=V.convertToTexture,uut=V.countLeadingZeros,hut=V.countOneBits,fut=V.countTrailingZeros,Kse=V.cos,dut=V.cosh,put=V.cross,mut=V.cubeTexture,Aut=V.cubeTextureBase,gut=V.dFdx,vut=V.dFdy,_ut=V.dashSize,xut=V.debug,yut=V.decrement,but=V.decrementBefore,wut=V.defaultBuildStages,Sut=V.defaultShaderStages,Tut=V.defined,Eut=V.degrees,Mut=V.deltaTime,Cut=V.densityFog,Rut=V.densityFogFactor,Iut=V.depth,Put=V.depthPass,Lut=V.determinant,Dut=V.difference,Nut=V.diffuseColor,Fut=V.directPointLight,But=V.directionToColor,Out=V.directionToFaceDirection,Uut=V.dispersion,kut=V.distance,zut=V.div,Vut=V.dot,Gut=V.drawIndex,qut=V.dynamicBufferAttribute,Hut=V.element,Wut=V.emissive,jut=V.equal,Xut=V.equirectDirection,$ut=V.equirectUV,Qse=V.exp,Yut=V.exp2,Zut=V.exponentialHeightFogFactor,Kut=V.expression,Qut=V.faceDirection,Jut=V.faceForward,eht=V.faceforward,Jse=V.float,tht=V.floatBitsToInt,nht=V.floatBitsToUint,iht=V.floor,rht=V.fog,sht=V.fract,oht=V.frameGroup,aht=V.frameId,lht=V.frontFacing,cht=V.fwidth,uht=V.gain,hht=V.gapSize,fht=V.getConstNodeType,dht=V.getCurrentStack,pht=V.getDirection,mht=V.getDistanceAttenuation,Aht=V.getGeometryRoughness,ght=V.getNormalFromDepth,vht=V.interleavedGradientNoise,_ht=V.vogelDiskSample,xht=V.getParallaxCorrectNormal,yht=V.getRoughness,bht=V.getScreenPosition,wht=V.getShIrradianceAt,Sht=V.getShadowMaterial,Tht=V.getShadowRenderObjectFunction,Eht=V.getTextureIndex,Mht=V.getViewPosition,Cht=V.globalId,Rht=V.glsl,Iht=V.glslFn,Pht=V.grayscale,Lht=V.greaterThan,Dht=V.greaterThanEqual,Nht=V.hash,Fht=V.highpModelNormalViewMatrix,Bht=V.highpModelViewMatrix,Oht=V.hue,Uht=V.increment,kht=V.incrementBefore,zht=V.instance,eoe=V.instanceIndex,Vht=V.instancedArray,Ght=V.instancedBufferAttribute,qht=V.instancedDynamicBufferAttribute,Hht=V.instancedMesh,Wht=V.int,jht=V.intBitsToFloat,Xht=V.inverse,$ht=V.inverseSqrt,Yht=V.inversesqrt,Zht=V.invocationLocalIndex,Kht=V.invocationSubgroupIndex,Qht=V.ior,Jht=V.iridescence,eft=V.iridescenceIOR,tft=V.iridescenceThickness,nft=V.ivec2,ift=V.ivec3,rft=V.ivec4,sft=V.js,oft=V.label,aft=V.length,lft=V.lengthSq,cft=V.lessThan,uft=V.lessThanEqual,hft=V.lightPosition,fft=V.lightProjectionUV,dft=V.lightShadowMatrix,pft=V.lightTargetDirection,mft=V.lightTargetPosition,Aft=V.lightViewPosition,gft=V.lightingContext,vft=V.lights,_ft=V.linearDepth,xft=V.linearToneMapping,yft=V.localId,bft=V.log,wft=V.log2,Sft=V.logarithmicDepthToViewZ,Tft=V.luminance,Eft=V.mat2,Mft=V.mat3,Cft=V.mat4,Rft=V.matcapUV,Ift=V.materialAO,Pft=V.materialAlphaTest,Lft=V.materialAnisotropy,Dft=V.materialAnisotropyVector,Nft=V.materialAttenuationColor,Fft=V.materialAttenuationDistance,Bft=V.materialClearcoat,Oft=V.materialClearcoatNormal,Uft=V.materialClearcoatRoughness,kft=V.materialColor,zft=V.materialDispersion,Vft=V.materialEmissive,Gft=V.materialEnvIntensity,qft=V.materialEnvRotation,Hft=V.materialIOR,Wft=V.materialIridescence,jft=V.materialIridescenceIOR,Xft=V.materialIridescenceThickness,$ft=V.materialLightMap,Yft=V.materialLineDashOffset,Zft=V.materialLineDashSize,Kft=V.materialLineGapSize,Qft=V.materialLineScale,Jft=V.materialLineWidth,edt=V.materialMetalness,tdt=V.materialNormal,ndt=V.materialOpacity,idt=V.materialPointSize,rdt=V.materialReference,sdt=V.materialReflectivity,odt=V.materialRefractionRatio,adt=V.materialRotation,ldt=V.materialRoughness,cdt=V.materialSheen,udt=V.materialSheenRoughness,hdt=V.materialShininess,fdt=V.materialSpecular,ddt=V.materialSpecularColor,pdt=V.materialSpecularIntensity,mdt=V.materialSpecularStrength,Adt=V.materialThickness,gdt=V.materialTransmission,vdt=V.max,_dt=V.maxMipLevel,xdt=V.mediumpModelViewMatrix,ydt=V.metalness,bdt=V.min,wdt=V.mix,Sdt=V.mixElement,Tdt=V.mod,Edt=V.modelDirection,Mdt=V.modelNormalMatrix,Cdt=V.modelPosition,Rdt=V.modelRadius,Idt=V.modelScale,Pdt=V.modelViewMatrix,Ldt=V.modelViewPosition,Ddt=V.modelViewProjection,Ndt=V.modelWorldMatrix,Fdt=V.modelWorldMatrixInverse,Bdt=V.morphReference,Odt=V.mrt,Udt=V.mul,kdt=V.mx_aastep,zdt=V.mx_add,Vdt=V.mx_atan2,Gdt=V.mx_cell_noise_float,qdt=V.mx_contrast,Hdt=V.mx_divide,Wdt=V.mx_fractal_noise_float,jdt=V.mx_fractal_noise_vec2,Xdt=V.mx_fractal_noise_vec3,$dt=V.mx_fractal_noise_vec4,Ydt=V.mx_frame,Zdt=V.mx_heighttonormal,Kdt=V.mx_hsvtorgb,Qdt=V.mx_ifequal,Jdt=V.mx_ifgreater,ept=V.mx_ifgreatereq,tpt=V.mx_invert,npt=V.mx_modulo,ipt=V.mx_multiply,rpt=V.mx_noise_float,spt=V.mx_noise_vec3,opt=V.mx_noise_vec4,apt=V.mx_place2d,lpt=V.mx_power,cpt=V.mx_ramp4,upt=V.mx_ramplr,hpt=V.mx_ramptb,fpt=V.mx_rgbtohsv,dpt=V.mx_rotate2d,ppt=V.mx_rotate3d,mpt=V.mx_safepower,Apt=V.mx_separate,gpt=V.mx_splitlr,vpt=V.mx_splittb,_pt=V.mx_srgb_texture_to_lin_rec709,xpt=V.mx_subtract,ypt=V.mx_timer,bpt=V.mx_transform_uv,wpt=V.mx_unifiednoise2d,Spt=V.mx_unifiednoise3d,Tpt=V.mx_worley_noise_float,Ept=V.mx_worley_noise_vec2,Mpt=V.mx_worley_noise_vec3,toe=V.negate,Cpt=V.negateOnBackSide,Rpt=V.neutralToneMapping,Ipt=V.nodeArray,Ppt=V.nodeImmutable,Lpt=V.nodeObject,Dpt=V.nodeObjectIntent,Npt=V.nodeObjects,Fpt=V.nodeProxy,Bpt=V.nodeProxyIntent,Opt=V.normalFlat,Upt=V.normalGeometry,kpt=V.normalLocal,zpt=V.normalMap,Vpt=V.normalView,Gpt=V.normalViewGeometry,qpt=V.normalWorld,Hpt=V.normalWorldGeometry,Wpt=V.normalize,jpt=V.not,Xpt=V.notEqual,$pt=V.numWorkgroups,Ypt=V.objectDirection,Zpt=V.objectGroup,Kpt=V.objectPosition,Qpt=V.objectRadius,Jpt=V.objectScale,e0t=V.objectViewPosition,t0t=V.objectWorldMatrix,n0t=V.OnBeforeObjectUpdate,i0t=V.OnBeforeMaterialUpdate,r0t=V.OnObjectUpdate,s0t=V.OnMaterialUpdate,o0t=V.oneMinus,a0t=V.or,l0t=V.orthographicDepthToViewZ,c0t=V.oscSawtooth,u0t=V.oscSine,h0t=V.oscSquare,f0t=V.oscTriangle,d0t=V.output,p0t=V.outputStruct,m0t=V.overloadingFn,A0t=V.overrideNode,g0t=V.overrideNodes,v0t=V.packHalf2x16,_0t=V.packSnorm2x16,x0t=V.packUnorm2x16,y0t=V.packNormalToRGB,b0t=V.parabola,w0t=V.parallaxDirection,S0t=V.parallaxUV,T0t=V.parameter,E0t=V.pass,M0t=V.passTexture,C0t=V.pcurve,R0t=V.perspectiveDepthToViewZ,I0t=V.pmremTexture,P0t=V.pointShadow,L0t=V.pointUV,D0t=V.pointWidth,N0t=V.positionGeometry,F0t=V.positionLocal,B0t=V.positionPrevious,O0t=V.positionView,U0t=V.positionViewDirection,k0t=V.positionWorld,z0t=V.positionWorldDirection,V0t=V.posterize,G0t=V.pow,q0t=V.pow2,H0t=V.pow3,W0t=V.pow4,j0t=V.premultiplyAlpha,X0t=V.property,$0t=V.radians,Y0t=V.rand,Z0t=V.range,K0t=V.rangeFog,Q0t=V.rangeFogFactor,J0t=V.reciprocal,emt=V.reference,tmt=V.referenceBuffer,nmt=V.reflect,imt=V.reflectVector,rmt=V.reflectView,smt=V.reflector,omt=V.refract,amt=V.refractVector,lmt=V.refractView,cmt=V.reinhardToneMapping,umt=V.remap,hmt=V.remapClamp,fmt=V.renderGroup,dmt=V.renderOutput,pmt=V.rendererReference,mmt=V.replaceDefaultUV,Amt=V.rotate,gmt=V.rotateUV,vmt=V.roughness,_mt=V.round,xmt=V.rtt,ymt=V.sRGBTransferEOTF,bmt=V.sRGBTransferOETF,wmt=V.sample,Smt=V.sampler,Tmt=V.samplerComparison,Emt=V.saturate,Mmt=V.saturation,Cmt=V.screen,Rmt=V.screenCoordinate,Imt=V.screenDPR,Pmt=V.screenSize,Lmt=V.screenUV,Dmt=V.select,Nmt=V.setCurrentStack,Fmt=V.setName,Bmt=V.shaderStages,Omt=V.shadow,Umt=V.shadowPositionWorld,kmt=V.shapeCircle,zmt=V.sharedUniformGroup,Vmt=V.sheen,Gmt=V.sheenRoughness,qmt=V.shiftLeft,Hmt=V.shiftRight,Wmt=V.shininess,jmt=V.sign,noe=V.sin,Xmt=V.sinh,$mt=V.sinc,Ymt=V.skinning,Zmt=V.smoothstep,Kmt=V.smoothstepElement,Qmt=V.specularColor,Jmt=V.specularF90,eAt=V.spherizeUV,tAt=V.split,nAt=V.spritesheetUV,ioe=V.sqrt,iAt=V.stack,rAt=V.step,sAt=V.stepElement,roe=V.storage,oAt=V.storageBarrier,aAt=V.storageTexture,lAt=V.storageTexture3D,cAt=V.struct,uAt=V.sub,hAt=V.subgroupAdd,fAt=V.subgroupAll,dAt=V.subgroupAnd,pAt=V.subgroupAny,mAt=V.subgroupBallot,AAt=V.subgroupBroadcast,gAt=V.subgroupBroadcastFirst,vAt=V.subBuild,_At=V.subgroupElect,xAt=V.subgroupExclusiveAdd,yAt=V.subgroupExclusiveMul,bAt=V.subgroupInclusiveAdd,wAt=V.subgroupInclusiveMul,SAt=V.subgroupIndex,TAt=V.subgroupMax,EAt=V.subgroupMin,MAt=V.subgroupMul,CAt=V.subgroupOr,RAt=V.subgroupShuffle,IAt=V.subgroupShuffleDown,PAt=V.subgroupShuffleUp,LAt=V.subgroupShuffleXor,DAt=V.subgroupSize,NAt=V.subgroupXor,FAt=V.tan,BAt=V.tanh,OAt=V.tangentGeometry,UAt=V.tangentLocal,kAt=V.tangentView,zAt=V.tangentWorld,VAt=V.texture,GAt=V.texture3D,qAt=V.textureBarrier,HAt=V.textureBicubic,WAt=V.textureBicubicLevel,jAt=V.textureCubeUV,XAt=V.textureLoad,$At=V.textureSize,YAt=V.textureLevel,ZAt=V.textureStore,KAt=V.thickness,QAt=V.time,JAt=V.toneMapping,egt=V.toneMappingExposure,tgt=V.toonOutlinePass,ngt=V.transformDirection,igt=V.transformNormal,rgt=V.transformNormalByInverseViewMatrix,sgt=V.transformNormalByViewMatrix,ogt=V.transformNormalToView,agt=V.transformedClearcoatNormalView,lgt=V.transformedNormalView,cgt=V.transformedNormalWorld,ugt=V.transmission,hgt=V.transpose,fgt=V.triNoise3D,dgt=V.triplanarTexture,pgt=V.triplanarTextures,mgt=V.trunc,Agt=V.uint,ggt=V.uintBitsToFloat,soe=V.uniform,vgt=V.uniformArray,_gt=V.uniformCubeTexture,xgt=V.uniformGroup,ygt=V.uniformFlow,bgt=V.uniformTexture,wgt=V.unpackHalf2x16,Sgt=V.unpackSnorm2x16,Tgt=V.unpackUnorm2x16,Egt=V.unpackRGBToNormal,Mgt=V.unpremultiplyAlpha,Cgt=V.userData,Rgt=V.uv,Igt=V.uvec2,Pgt=V.uvec3,Lgt=V.uvec4,Dgt=V.varying,Ngt=V.varyingProperty,Fgt=V.vec2,Bgt=V.vec3,Ogt=V.vec4,Ugt=V.vectorComponents,kgt=V.velocity,zgt=V.vertexColor,Vgt=V.vertexIndex,Ggt=V.vertexStage,qgt=V.vibrance,Hgt=V.viewZToLogarithmicDepth,Wgt=V.viewZToOrthographicDepth,jgt=V.viewZToPerspectiveDepth,Xgt=V.viewZToReversedOrthographicDepth,$gt=V.viewZToReversedPerspectiveDepth,Ygt=V.viewport,Zgt=V.viewportCoordinate,Kgt=V.viewportDepthTexture,Qgt=V.viewportLinearDepth,Jgt=V.viewportMipTexture,e1t=V.viewportOpaqueMipTexture,t1t=V.viewportResolution,n1t=V.viewportSafeUV,i1t=V.viewportSharedTexture,r1t=V.viewportSize,s1t=V.viewportTexture,o1t=V.viewportUV,a1t=V.wgsl,l1t=V.wgslFn,c1t=V.workgroupArray,u1t=V.workgroupBarrier,h1t=V.workgroupId,f1t=V.workingToColorSpace,d1t=V.xor;var ooe=new Ua,FI=new re,xx=class extends tb{constructor(){super(),this.isLineSegmentsGeometry=!0,this.type="LineSegmentsGeometry";let e=[-1,2,0,1,2,0,-1,1,0,1,1,0,-1,0,0,1,0,0,-1,-1,0,1,-1,0],t=[-1,2,1,2,-1,1,1,1,-1,-1,1,-1,-1,-2,1,-2],n=[0,2,1,2,3,1,2,4,3,4,5,3,4,6,5,6,7,5];this.setIndex(n),this.setAttribute("position",new Ln(e,3)),this.setAttribute("uv",new Ln(t,2))}applyMatrix4(e){let t=this.attributes.instanceStart,n=this.attributes.instanceEnd;return t!==void 0&&(t.applyMatrix4(e),n.applyMatrix4(e),t.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this}setPositions(e){let t;e instanceof Float32Array?t=e:Array.isArray(e)&&(t=new Float32Array(e));let n=new Lh(t,6,1);return this.setAttribute("instanceStart",new zo(n,3,0)),this.setAttribute("instanceEnd",new zo(n,3,3)),this.instanceCount=this.attributes.instanceStart.count,this.computeBoundingBox(),this.computeBoundingSphere(),this}setColors(e){let t;e instanceof Float32Array?t=e:Array.isArray(e)&&(t=new Float32Array(e));let n=new Lh(t,6,1);return this.setAttribute("instanceColorStart",new zo(n,3,0)),this.setAttribute("instanceColorEnd",new zo(n,3,3)),this}fromWireframeGeometry(e){return this.setPositions(e.attributes.position.array),this}fromEdgesGeometry(e){return this.setPositions(e.attributes.position.array),this}fromMesh(e){return this.fromWireframeGeometry(new G2(e.geometry)),this}fromLineSegments(e){let t=e.geometry;return this.setPositions(t.attributes.position.array),this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new Ua);let e=this.attributes.instanceStart,t=this.attributes.instanceEnd;e!==void 0&&t!==void 0&&(this.boundingBox.setFromBufferAttribute(e),ooe.setFromBufferAttribute(t),this.boundingBox.union(ooe))}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new xl),this.boundingBox===null&&this.computeBoundingBox();let e=this.attributes.instanceStart,t=this.attributes.instanceEnd;if(e!==void 0&&t!==void 0){let n=this.boundingSphere.center;this.boundingBox.getCenter(n);let r=0;for(let s=0,o=e.count;s<o;s++)FI.fromBufferAttribute(e,s),r=Math.max(r,n.distanceToSquared(FI)),FI.fromBufferAttribute(t,s),r=Math.max(r,n.distanceToSquared(FI));this.boundingSphere.radius=Math.sqrt(r),isNaN(this.boundingSphere.radius)&&console.error("THREE.LineSegmentsGeometry.computeBoundingSphere(): Computed radius is NaN. The instanced position data is likely to have NaN values.",this)}}toJSON(){}};Nt.line={worldUnits:{value:1},linewidth:{value:1},resolution:{value:new Oe},dashOffset:{value:0},dashScale:{value:1},dashSize:{value:1},gapSize:{value:1}};qa.line={uniforms:lg.merge([Nt.common,Nt.fog,Nt.line]),vertexShader:`4704+ ${" ".repeat(a.linePos-1)}^`)),(a.type==="error"?ze:Xe)(c+u)}}}_getBlending(e){let t,n,r=e.blending,s=e.blendSrc,o=e.blendDst,a=e.blendEquation;if(r===Dd){let l=e.blendSrcAlpha!==null?e.blendSrcAlpha:s,c=e.blendDstAlpha!==null?e.blendDstAlpha:o,u=e.blendEquationAlpha!==null?e.blendEquationAlpha:a;t={srcFactor:this._getBlendFactor(s),dstFactor:this._getBlendFactor(o),operation:this._getBlendOperation(a)},n={srcFactor:this._getBlendFactor(l),dstFactor:this._getBlendFactor(c),operation:this._getBlendOperation(u)}}else{let l=e.premultipliedAlpha,c=(u,f,d,A)=>{t={srcFactor:u,dstFactor:f,operation:Bg.Add},n={srcFactor:d,dstFactor:A,operation:Bg.Add}};if(l)switch(r){case Ts:c(ui.One,ui.OneMinusSrcAlpha,ui.One,ui.OneMinusSrcAlpha);break;case Dh:c(ui.One,ui.One,ui.One,ui.One);break;case Nh:c(ui.Zero,ui.OneMinusSrc,ui.Zero,ui.One);break;case Fh:c(ui.Dst,ui.OneMinusSrcAlpha,ui.Zero,ui.One);break}else switch(r){case Ts:c(ui.SrcAlpha,ui.OneMinusSrcAlpha,ui.One,ui.OneMinusSrcAlpha);break;case Dh:c(ui.SrcAlpha,ui.One,ui.One,ui.One);break;case Nh:ze(`WebGPURenderer: "SubtractiveBlending" requires "${e.isMaterial?"material":"blendMode"}.premultipliedAlpha = true".`);break;case Fh:ze(`WebGPURenderer: "MultiplyBlending" requires "${e.isMaterial?"material":"blendMode"}.premultipliedAlpha = true".`);break}}if(t!==void 0&&n!==void 0)return{color:t,alpha:n};ze("WebGPURenderer: Invalid blending: ",r)}_getBlendFactor(e){let t;switch(e){case Nu:t=ui.Zero;break;case mb:t=ui.One;break;case Ab:t=ui.Src;break;case gb:t=ui.OneMinusSrc;break;case Jp:t=ui.SrcAlpha;break;case e0:t=ui.OneMinusSrcAlpha;break;case xb:t=ui.Dst;break;case yb:t=ui.OneMinusDst;break;case vb:t=ui.DstAlpha;break;case _b:t=ui.OneMinusDstAlpha;break;case bb:t=ui.SrcAlphaSaturated;break;case RMe:t=ui.Constant;break;case PMe:t=ui.OneMinusConstant;break;default:ze("WebGPURenderer: Blend factor not supported.",e)}return t}_getStencilCompare(e){let t,n=e.stencilFunc;switch(n){case lF:t=jo.Never;break;case D2:t=jo.Always;break;case cF:t=jo.Less;break;case hF:t=jo.LessEqual;break;case uF:t=jo.Equal;break;case pF:t=jo.GreaterEqual;break;case fF:t=jo.Greater;break;case dF:t=jo.NotEqual;break;default:ze("WebGPURenderer: Invalid stencil function.",n)}return t}_getStencilOperation(e){let t;switch(e){case bd:t=nm.Keep;break;case tF:t=nm.Zero;break;case nF:t=nm.Replace;break;case aF:t=nm.Invert;break;case iF:t=nm.IncrementClamp;break;case rF:t=nm.DecrementClamp;break;case sF:t=nm.IncrementWrap;break;case oF:t=nm.DecrementWrap;break;default:ze("WebGPURenderer: Invalid stencil operation.",t)}return t}_getBlendOperation(e){let t;switch(e){case oo:t=Bg.Add;break;case db:t=Bg.Subtract;break;case pb:t=Bg.ReverseSubtract;break;case NM:t=Bg.Min;break;case FM:t=Bg.Max;break;default:ze("WebGPUPipelineUtils: Blend equation not supported.",e)}return t}_getPrimitiveState(e,t,n){let r={},s=this.backend.utils;r.topology=s.getPrimitiveTopology(e,n),t.index!==null&&e.isLine===!0&&e.isLineSegments!==!0&&(r.stripIndexFormat=t.index.array instanceof Uint16Array?oP.Uint16:oP.Uint32);let o=n.side===mi;return e.isMesh&&e.matrixWorld.determinantAffine()<0&&(o=!o),r.frontFace=o===!0?$te.CW:$te.CCW,r.cullMode=n.side===vr?Yte.None:Yte.Back,r}_getColorWriteMask(e){return e.colorWrite===!0?Zte.All:Zte.None}_getDepthCompare(e){let t;if(e.depthTest===!1)t=jo.Always;else{let n=this.backend.parameters.reversedDepthBuffer?Ob[e.depthFunc]:e.depthFunc;switch(n){case LA:t=jo.Never;break;case DA:t=jo.Always;break;case NA:t=jo.Less;break;case Ch:t=jo.LessEqual;break;case FA:t=jo.Equal;break;case BA:t=jo.GreaterEqual;break;case OA:t=jo.Greater;break;case UA:t=jo.NotEqual;break;default:ze("WebGPUPipelineUtils: Invalid depth function.",n)}}return t}},dP=class{constructor(){this.label="",this.type=void 0,this.count=0}reset(){this.label="",this.type=void 0,this.count=0}},hf=new xm,WIe=new o1,Qw=new dP,tz=class extends rP{constructor(e,t,n=2048){super(n),this.device=e,this.type=t,Qw.label=`queryset_global_timestamp_${t}`,Qw.type="timestamp",Qw.count=this.maxQueries,this.querySet=this.device.createQuerySet(Qw),Qw.reset();let r=this.maxQueries*8;hf.label=`buffer_timestamp_resolve_${t}`,hf.size=r,hf.usage=GPUBufferUsage.QUERY_RESOLVE|GPUBufferUsage.COPY_SRC,this.resolveBuffer=this.device.createBuffer(hf),hf.reset(),hf.label=`buffer_timestamp_result_${t}`,hf.size=r,hf.usage=GPUBufferUsage.COPY_DST|GPUBufferUsage.MAP_READ,this.resultBuffer=this.device.createBuffer(hf),hf.reset()}allocateQueriesForContext(e){if(!this.trackTimestamp||this.isDisposed)return null;if(this.currentQueryIndex+2>this.maxQueries)return ni(`WebGPUTimestampQueryPool [${this.type}]: Maximum number of queries exceeded, when using trackTimestamp it is necessary to resolves the queries via renderer.resolveTimestampsAsync( THREE.TimestampQuery.${this.type.toUpperCase()} ).`),null;let t=this.currentQueryIndex;return this.currentQueryIndex+=2,this.queryOffsets.set(e,t),t}async resolveQueriesAsync(){if(!this.trackTimestamp||this.currentQueryIndex===0||this.isDisposed)return this.lastValue;if(this.pendingResolve)return this.pendingResolve;this.pendingResolve=this._resolveQueries();try{return await this.pendingResolve}finally{this.pendingResolve=null}}async _resolveQueries(){if(this.isDisposed)return this.lastValue;try{if(this.resultBuffer.mapState!=="unmapped")return this.lastValue;let e=new Map(this.queryOffsets),t=this.currentQueryIndex,n=t*8;this.currentQueryIndex=0,this.queryOffsets.clear();let r=this.device.createCommandEncoder(WIe);r.resolveQuerySet(this.querySet,0,t,this.resolveBuffer,0),r.copyBufferToBuffer(this.resolveBuffer,0,this.resultBuffer,0,n);let s=r.finish();if(mf(this.device,s),this.resultBuffer.mapState!=="unmapped")return this.lastValue;if(await this.resultBuffer.mapAsync(GPUMapMode.READ,0,n),this.isDisposed)return this.resultBuffer.mapState==="mapped"&&this.resultBuffer.unmap(),this.lastValue;let o=new BigUint64Array(this.resultBuffer.getMappedRange(0,n)),a={},l=[];for(let[u,f]of e){let d=u.match(/^(.*):f(\d+)$/),A=parseInt(d[2]);l.includes(A)===!1&&l.push(A),a[A]===void 0&&(a[A]=0);let y=o[f],w=o[f+1],S=Number(w-y)/1e6;this.timestamps.set(u,S),a[A]+=S}let c=a[l[l.length-1]];return this.resultBuffer.unmap(),this.lastValue=c,this.frames=l,c}catch(e){return ze("Error resolving queries:",e),this.resultBuffer.mapState==="mapped"&&this.resultBuffer.unmap(),this.lastValue}}async dispose(){if(!this.isDisposed){if(this.isDisposed=!0,this.pendingResolve)try{await this.pendingResolve}catch(e){ze("Error waiting for pending resolve:",e)}if(this.resultBuffer&&this.resultBuffer.mapState==="mapped")try{this.resultBuffer.unmap()}catch(e){ze("Error unmapping buffer:",e)}this.querySet&&(this.querySet.destroy(),this.querySet=null),this.resolveBuffer&&(this.resolveBuffer.destroy(),this.resolveBuffer=null),this.resultBuffer&&(this.resultBuffer.destroy(),this.resultBuffer=null),this.queryOffsets.clear(),this.pendingResolve=null}}},nz=class{constructor(){this.label="",this.timestampWrites=void 0}reset(){this.label="",this.timestampWrites=void 0}},rx=class{constructor(){this.view=null,this.depthLoadOp=void 0,this.depthStoreOp=void 0,this.depthClearValue=void 0,this.depthReadOnly=!1,this.stencilLoadOp=void 0,this.stencilStoreOp=void 0,this.stencilClearValue=0,this.stencilReadOnly=!1}reset(){this.view=null,this.depthLoadOp=void 0,this.depthStoreOp=void 0,this.depthClearValue=void 0,this.depthReadOnly=!1,this.stencilLoadOp=void 0,this.stencilStoreOp=void 0,this.stencilClearValue=0,this.stencilReadOnly=!1}},iz=class{constructor(){this.querySet=null,this.beginningOfPassWriteIndex=void 0,this.endOfPassWriteIndex=void 0}reset(){this.querySet=null,this.beginningOfPassWriteIndex=void 0,this.endOfPassWriteIndex=void 0}},qu={r:0,g:0,b:0,a:1},lc=new xm,Ya=new o1,jR=new nz,Jw=new dP,XR=new hP,$R=new iz,Zc=new _x,ff=new _x,Er=new IS,Wd=new fP,rz=class extends iP{constructor(e={}){super(e),this.isWebGPUBackend=!0,this.parameters.alpha=e.alpha===void 0?!0:e.alpha,this.parameters.requiredLimits=e.requiredLimits===void 0?{}:e.requiredLimits,this.compatibilityMode=null,this.device=null,this.defaultRenderPassdescriptor=null,this.utils=new F9(this),this.attributeUtils=new $9(this),this.bindingUtils=new Z9(this),this.capabilities=new K9(this),this.pipelineUtils=new ez(this),this.textureUtils=new q9(this),this.occludedResolveCache=new Map;let t=typeof navigator>"u"?!0:/Android/.test(navigator.userAgent)===!1;this._compatibility={[Bd.TEXTURE_COMPARE]:t}}async init(e){await super.init(e);let t=this.parameters,n;if(t.device===void 0){let r={powerPreference:t.powerPreference,featureLevel:"compatibility",xrCompatible:e.xr.enabled},s=typeof navigator<"u"?await navigator.gpu.requestAdapter(r):null;if(s===null)throw new Error("THREE.WebGPUBackend: Unable to create WebGPU adapter.");let o=Object.values(aP),a=[];for(let c of o)s.features.has(c)&&a.push(c);let l={requiredFeatures:a,requiredLimits:t.requiredLimits};n=await s.requestDevice(l)}else n=t.device;this.compatibilityMode=!n.features.has("core-features-and-limits"),this.compatibilityMode&&(e._samples=0),n.lost.then(r=>{if(r.reason==="destroyed")return;let s={api:"WebGPU",message:r.message||"Unknown reason",reason:r.reason||null,originalEvent:r};e.onDeviceLost(s)}),n.onuncapturederror=r=>{let s=r.error,o=s&&s.constructor?s.constructor.name:"GPUError",a=s&&s.message||"Unknown uncaptured GPU error";e.onError({api:"WebGPU",type:o,message:a,originalEvent:r})},this.device=n,this.trackTimestamp=this.trackTimestamp&&this.hasFeature(aP.TimestampQuery),this.updateSize()}setXRRenderTargetTextures(e,t,n=null){this.set(e.texture,{texture:t,format:t.format,externalTexture:!0,xrViewDescriptors:n,initialized:!0})}get context(){let e=this.renderer.getCanvasTarget(),t=this.get(e),n=t.context;if(n===void 0){let r=this.parameters;e.isDefaultCanvasTarget===!0&&r.context!==void 0?n=r.context:n=e.domElement.getContext("webgpu"),"setAttribute"in e.domElement&&e.domElement.setAttribute("data-engine",`three.js r${"185"} webgpu`);let s=r.alpha?"premultiplied":"opaque",o=r.outputType===Wi?"extended":"standard";n.configure({device:this.device,format:this.utils.getPreferredCanvasFormat(),usage:GPUTextureUsage.RENDER_ATTACHMENT|GPUTextureUsage.COPY_SRC,alphaMode:s,toneMapping:{mode:o}}),t.context=n}return n}get coordinateSystem(){return xl}get hasTimestamp(){return!0}async getArrayBufferAsync(e,t=null,n=0,r=-1){return await this.attributeUtils.getArrayBufferAsync(e,t,n,r)}getContext(){return this.context}_getDefaultRenderPassDescriptor(){let e=this.renderer,t=e.getCanvasTarget(),n=this.get(t),r=e.currentSamples,s=n.descriptor;if(s===void 0||n.samples!==r){if(s=new Kg,s.colorAttachments.push(new Zg),e.depth===!0||e.stencil===!0){let l=new rx;l.view=this.textureUtils.getDepthBuffer(e.depth,e.stencil).createView(),s.depthStencilAttachment=l}let a=s.colorAttachments[0];r>0?a.view=this.textureUtils.getColorBuffer().createView():a.resolveTarget=void 0,n.descriptor=s,n.samples=r}let o=s.colorAttachments[0];return r>0?o.resolveTarget=this.context.getCurrentTexture().createView():o.view=this.context.getCurrentTexture().createView(),s}_isRenderCameraDepthArray(e){let t=e.camera;return e.depthTexture&&e.depthTexture.isArrayTexture===!0&&t!==null&&t.isArrayCamera===!0}_hasExternalTexture(e){let t=e.textures;if(t===null)return!1;for(let n=0;n<t.length;n++)if(this.get(t[n]).externalTexture===!0)return!0;return!1}_createExternalTextureViews(e,t){let n=[],r=e.camera;if(t.xrViewDescriptors&&r!==null&&r.isArrayCamera===!0)for(let s=0;s<t.xrViewDescriptors.length;s++)n.push({view:t.texture.createView(t.xrViewDescriptors[s]),resolveTarget:void 0,depthSlice:void 0});else n.push({view:t.texture.createView({dimension:Xo.TwoD,baseArrayLayer:e.activeCubeFace,arrayLayerCount:1}),resolveTarget:void 0,depthSlice:void 0});return n}_getRenderPassDescriptor(e,t={}){let n=e.renderTarget,r=this.get(n),s=this._hasExternalTexture(e),o=r.descriptors;(o===void 0||r.width!==n.width||r.height!==n.height||r.samples!==n.samples||s)&&(o={},r.descriptors=o);let a=e.getCacheKey(),l=o[a];if(l===void 0||s){let u=e.textures,f=[],d,A=this._isRenderCameraDepthArray(e);for(let w=0;w<u.length;w++){let S=this.get(u[w]);if(S.externalTexture===!0){f.push(...this._createExternalTextureViews(e,S));continue}if(Er.label=`colorAttachment_${w}`,Er.baseMipLevel=e.activeMipmapLevel,Er.mipLevelCount=1,Er.baseArrayLayer=e.activeCubeFace,Er.arrayLayerCount=1,Er.dimension=Xo.TwoD,n.isRenderTarget3D)d=e.activeCubeFace,Er.baseArrayLayer=0,Er.dimension=Xo.ThreeD;else if(n.isRenderTarget&&u[w].image.depth>1)if(A===!0){let T=e.camera.cameras;for(let R=0;R<T.length;R++){Er.baseArrayLayer=R,Er.arrayLayerCount=1,Er.dimension=Xo.TwoD;let I=S.texture.createView(Er);f.push({view:I,resolveTarget:void 0,depthSlice:void 0})}}else Er.dimension=Xo.TwoDArray;if(A!==!0){let T=S.texture.createView(Er),R,I;S.msaaTexture!==void 0?(R=S.msaaTexture.createView(),I=T):(R=T,I=void 0),f.push({view:R,resolveTarget:I,depthSlice:d})}Er.reset()}let y=[];for(let w=0;w<f.length;w++){let S=f[w],T=new Zg;T.view=S.view,T.depthSlice=S.depthSlice,T.resolveTarget=S.resolveTarget,y.push(T)}if(l={textureViews:f,colorAttachments:y,descriptor:new Kg},e.depth){let w=this.get(e.depthTexture);(e.depthTexture.isArrayTexture||e.depthTexture.isCubeTexture)&&(Er.dimension=Xo.TwoD,Er.arrayLayerCount=1,Er.baseArrayLayer=e.activeCubeFace);let S=new rx;S.view=w.texture.createView(Er),l.depthStencilAttachment=S,Er.reset()}o[a]=l,r.width=n.width,r.height=n.height,r.samples=n.samples,r.activeMipmapLevel=e.activeMipmapLevel,r.activeCubeFace=e.activeCubeFace}let c=l.descriptor;c.reset();for(let u=0;u<l.colorAttachments.length;u++){let f=l.colorAttachments[u],d={r:0,g:0,b:0,a:1};u===0&&t.clearValue&&(d=t.clearValue),f.loadOp=t.loadOp||Fi.Load,f.storeOp=t.storeOp||Za.Store,f.clearValue=d,c.colorAttachments.push(f)}return l.depthStencilAttachment&&(c.depthStencilAttachment=l.depthStencilAttachment),c}beginRender(e){let t=this.get(e),n=this.device,r=e.occlusionQueryCount,s;r>0&&(t.currentOcclusionQuerySet&&t.currentOcclusionQuerySet.destroy(),t.currentOcclusionQueryBuffer&&t.currentOcclusionQueryBuffer.destroy(),t.currentOcclusionQuerySet=t.occlusionQuerySet,t.currentOcclusionQueryBuffer=t.occlusionQueryBuffer,t.currentOcclusionQueryObjects=t.occlusionQueryObjects,Jw.label=`occlusionQuerySet_${e.id}`,Jw.type="occlusion",Jw.count=r,s=n.createQuerySet(Jw),Jw.reset(),t.occlusionQuerySet=s,t.occlusionQueryIndex=0,t.occlusionQueryObjects=new Array(r),t.lastOcclusionObject=null);let o;e.textures===null?o=this._getDefaultRenderPassDescriptor():o=this._getRenderPassDescriptor(e,{loadOp:Fi.Load}),this.initTimestampQuery(Hc.RENDER,this.getTimestampUID(e),o),o.occlusionQuerySet=s;let a=o.depthStencilAttachment;if(e.textures!==null){let c=o.colorAttachments;for(let u=0;u<c.length;u++){let f=c[u];e.clearColor?(u===0?f.clearValue=e.clearColorValue:(qu.r=0,qu.g=0,qu.b=0,qu.a=1,f.clearValue=qu),f.loadOp=Fi.Clear):f.loadOp=Fi.Load,f.storeOp=Za.Store}}else{let c=o.colorAttachments[0];e.clearColor?(c.clearValue=e.clearColorValue,c.loadOp=Fi.Clear):c.loadOp=Fi.Load,c.storeOp=Za.Store}e.depth&&(e.clearDepth?(a.depthClearValue=e.clearDepthValue,a.depthLoadOp=Fi.Clear):a.depthLoadOp=Fi.Load,a.depthStoreOp=Za.Store),e.stencil&&(e.clearStencil?(a.stencilClearValue=e.clearStencilValue,a.stencilLoadOp=Fi.Clear):a.stencilLoadOp=Fi.Load,a.stencilStoreOp=Za.Store),Ya.label="renderContext_"+e.id;let l=n.createCommandEncoder(Ya);if(Ya.reset(),this._isRenderCameraDepthArray(e)===!0){let c=e.camera.cameras;!t.layerDescriptors||t.layerDescriptors.length!==c.length?this._createArrayCameraLayerDescriptors(e,t,o,c):this._updateArrayCameraLayerDescriptors(e,t,c),t.bundleEncoders=[],t.bundleSets=[];for(let u=0;u<c.length;u++){let f=this.pipelineUtils.createBundleEncoder(e,"renderBundleArrayCamera_"+u),d={attributes:{},bindingGroups:[],pipeline:null,index:null};t.bundleEncoders.push(f),t.bundleSets.push(d)}t.currentPass=null}else{let c=l.beginRenderPass(o);t.currentPass=c,e.viewport&&this.updateViewport(e),e.scissor&&this.updateScissor(e)}t.descriptor=o,t.encoder=l,t.currentSets={attributes:{},bindingGroups:[],pipeline:null,index:null},t.renderBundles=[]}_createArrayCameraLayerDescriptors(e,t,n,r){let s=n.depthStencilAttachment;t.layerDescriptors=[];let o=this.get(e.depthTexture);o.viewCache||(o.viewCache=[]);for(let a=0;a<r.length;a++){let l=n.colorAttachments[0],c=new Zg;c.view=n.colorAttachments[a].view,c.depthSlice=l.depthSlice,c.resolveTarget=l.resolveTarget,c.loadOp=l.loadOp,c.storeOp=l.storeOp,c.clearValue=l.clearValue;let u=new Kg;if(u.label=n.label,u.occlusionQuerySet=n.occlusionQuerySet,u.timestampWrites=n.timestampWrites,u.colorAttachments.push(c),n.depthStencilAttachment){let f=a;o.viewCache[f]||(Er.dimension=Xo.TwoD,Er.baseArrayLayer=a,Er.arrayLayerCount=1,o.viewCache[f]=o.texture.createView(Er),Er.reset());let d=new rx;d.view=o.viewCache[f],d.depthLoadOp=s.depthLoadOp||Fi.Clear,d.depthStoreOp=s.depthStoreOp||Za.Store,d.depthClearValue=s.depthClearValue||1,e.stencil&&(d.stencilLoadOp=s.stencilLoadOp,d.stencilStoreOp=s.stencilStoreOp,d.stencilClearValue=s.stencilClearValue),u.depthStencilAttachment=d}else{let f=new rx;f.view=s.view,f.depthLoadOp=s.depthLoadOp,f.depthStoreOp=s.depthStoreOp,f.depthClearValue=s.depthClearValue,f.depthReadOnly=s.depthReadOnly,f.stencilLoadOp=s.stencilLoadOp,f.stencilStoreOp=s.stencilStoreOp,f.stencilClearValue=s.stencilClearValue,f.stencilReadOnly=s.stencilReadOnly,u.depthStencilAttachment=f}t.layerDescriptors.push(u)}}_updateArrayCameraLayerDescriptors(e,t,n){for(let r=0;r<n.length;r++){let s=t.layerDescriptors[r];if(s.depthStencilAttachment){let o=s.depthStencilAttachment;e.depth&&(e.clearDepth?(o.depthClearValue=e.clearDepthValue,o.depthLoadOp=Fi.Clear):o.depthLoadOp=Fi.Load),e.stencil&&(e.clearStencil?(o.stencilClearValue=e.clearStencilValue,o.stencilLoadOp=Fi.Clear):o.stencilLoadOp=Fi.Load)}}}finishRender(e){let t=this.get(e),n=e.occlusionQueryCount;t.renderBundles.length>0&&t.currentPass.executeBundles(t.renderBundles),n>t.occlusionQueryIndex&&t.currentPass.endOcclusionQuery();let r=t.encoder;if(this._isRenderCameraDepthArray(e)===!0){let s=[];for(let o=0;o<t.bundleEncoders.length;o++){let a=t.bundleEncoders[o];s.push(a.finish())}for(let o=0;o<t.layerDescriptors.length;o++)if(o<s.length){let a=t.layerDescriptors[o],l=r.beginRenderPass(a);if(e.viewport){let{x:c,y:u,width:f,height:d,minDepth:A,maxDepth:y}=e.viewportValue;l.setViewport(c,u,f,d,A,y)}if(e.scissor){let{x:c,y:u,width:f,height:d}=e.scissorValue;l.setScissorRect(c,u,f,d)}l.executeBundles([s[o]]),l.end()}}else t.currentPass&&t.currentPass.end();if(n>0){let s=n*8,o=this.occludedResolveCache.get(s);o===void 0&&(lc.size=s,lc.usage=GPUBufferUsage.QUERY_RESOLVE|GPUBufferUsage.COPY_SRC,o=this.device.createBuffer(lc),lc.reset(),this.occludedResolveCache.set(s,o)),lc.size=s,lc.usage=GPUBufferUsage.COPY_DST|GPUBufferUsage.MAP_READ;let a=this.device.createBuffer(lc);lc.reset(),t.encoder.resolveQuerySet(t.occlusionQuerySet,0,n,o,0),t.encoder.copyBufferToBuffer(o,0,a,0,s),t.occlusionQueryBuffer=a,this.resolveOccludedAsync(e)}if(mf(this.device,t.encoder.finish()),e.textures!==null){let s=e.textures;for(let o=0;o<s.length;o++){let a=s[o];a.generateMipmaps===!0&&this.textureUtils.generateMipmaps(a)}}}isOccluded(e,t){let n=this.get(e);return n.occluded&&n.occluded.has(t)}async resolveOccludedAsync(e){let t=this.get(e),{currentOcclusionQueryBuffer:n,currentOcclusionQueryObjects:r}=t;if(n&&r){let s=new WeakSet;t.currentOcclusionQueryObjects=null,t.currentOcclusionQueryBuffer=null,await n.mapAsync(GPUMapMode.READ);let o=n.getMappedRange(),a=new BigUint64Array(o);for(let l=0;l<r.length;l++)a[l]===BigInt(0)&&s.add(r[l]);n.destroy(),t.occluded=s}}updateViewport(e){let{currentPass:t}=this.get(e),{x:n,y:r,width:s,height:o,minDepth:a,maxDepth:l}=e.viewportValue;t.setViewport(n,r,s,o,a,l)}updateScissor(e){let{currentPass:t}=this.get(e),{x:n,y:r,width:s,height:o}=e.scissorValue;t.setScissorRect(n,r,s,o)}getClearColor(){let e=super.getClearColor();return this.renderer.alpha===!0&&(e.r*=e.a,e.g*=e.a,e.b*=e.a),e}clear(e,t,n,r=null){let s=this.device,o=this.renderer,a=[],l,c,u;if(e){let A=this.getClearColor();qu.r=A.r,qu.g=A.g,qu.b=A.b,qu.a=A.a}if(r===null){c=o.depth,u=o.stencil;let A=this._getDefaultRenderPassDescriptor();if(e){a=A.colorAttachments;let y=a[0];y.clearValue=qu,y.loadOp=Fi.Clear,y.storeOp=Za.Store}(c||u)&&(l=A.depthStencilAttachment)}else{c=r.depth,u=r.stencil;let A={loadOp:e?Fi.Clear:Fi.Load,clearValue:e?qu:void 0};c&&(A.depthLoadOp=t?Fi.Clear:Fi.Load,A.depthClearValue=t?o.getClearDepth():void 0,A.depthStoreOp=Za.Store),u&&(A.stencilLoadOp=n?Fi.Clear:Fi.Load,A.stencilClearValue=n?o.getClearStencil():void 0,A.stencilStoreOp=Za.Store);let y=this._getRenderPassDescriptor(r,A);a=y.colorAttachments,l=y.depthStencilAttachment}c&&l&&(t?(l.depthLoadOp=Fi.Clear,l.depthClearValue=o.getClearDepth(),l.depthStoreOp=Za.Store):(l.depthLoadOp=Fi.Load,l.depthStoreOp=Za.Store)),u&&l&&(n?(l.stencilLoadOp=Fi.Clear,l.stencilClearValue=o.getClearStencil(),l.stencilStoreOp=Za.Store):(l.stencilLoadOp=Fi.Load,l.stencilStoreOp=Za.Store)),Ya.label="clear";let f=s.createCommandEncoder(Ya);Ya.reset(),f.beginRenderPass({colorAttachments:a,depthStencilAttachment:l}).end(),mf(s,f.finish())}beginCompute(e){let t=this.get(e),n="computeGroup_"+e.id;jR.label=n,Ya.label=n,this.initTimestampQuery(Hc.COMPUTE,this.getTimestampUID(e),jR),t.cmdEncoderGPU=this.device.createCommandEncoder(Ya),t.passEncoderGPU=t.cmdEncoderGPU.beginComputePass(jR),t.currentPipeline=null,Ya.reset(),jR.reset()}compute(e,t,n,r,s=null){let o=this.get(t),a=this.get(e),{passEncoderGPU:l}=a,c=this.get(r).pipeline;a.currentPipeline!==c&&(l.setPipeline(c),a.currentPipeline=c);for(let u=0,f=n.length;u<f;u++){let d=n[u],A=this.get(d);l.setBindGroup(u,A.group)}if(s===null&&(s=t.dispatchSize||t.count),s&&s.isIndirectStorageBufferAttribute){let u=this.get(s).buffer;l.dispatchWorkgroupsIndirect(u,0);return}if(typeof s=="number"){let u=s;if(o.dispatchSize===void 0||o.count!==u){o.dispatchSize=[0,1,1],o.count=u;let f=t.workgroupSize,d=f[0];for(let w=1;w<f.length;w++)d*=f[w];let A=Math.ceil(u/d),y=this.device.limits.maxComputeWorkgroupsPerDimension;s=[A,1,1],A>y&&(s[0]=Math.min(A,y),s[1]=Math.ceil(A/y)),o.dispatchSize=s}s=o.dispatchSize}l.dispatchWorkgroups(s[0],s[1]||1,s[2]||1)}finishCompute(e){let t=this.get(e);t.passEncoderGPU.end(),mf(this.device,t.cmdEncoderGPU.finish())}_draw(e,t,n,r,s,o,a,l,c){let{object:u,material:f,context:d}=e,A=e.getIndex(),y=A!==null;c.pipeline!==r&&(l.setPipeline(r),c.pipeline=r);let w=c.bindingGroups;for(let S=0,T=s.length;S<T;S++){let R=s[S];if(w[S]!==R.id){let I=this.get(R);l.setBindGroup(S,I.group),w[S]=R.id}}if(y===!0&&c.index!==A){let S=this.get(A).buffer,T=A.array instanceof Uint16Array?oP.Uint16:oP.Uint32;l.setIndexBuffer(S,T),c.index=A}for(let S=0,T=o.length;S<T;S++){let R=o[S];if(c.attributes[S]!==R){let I=this.get(R).buffer;l.setVertexBuffer(S,I),c.attributes[S]=R}}if(d.stencil===!0&&f.stencilWrite===!0&&n.currentStencilRef!==f.stencilRef&&(l.setStencilReference(f.stencilRef),n.currentStencilRef=f.stencilRef),u.isBatchedMesh===!0){let S=u._multiDrawStarts,T=u._multiDrawCounts,R=u._multiDrawCount,I=y===!0?A.array.BYTES_PER_ELEMENT:1;f.wireframe&&(I=u.geometry.attributes.position.count>65535?4:2);for(let P=0;P<R;P++)y===!0?l.drawIndexed(T[P],1,S[P]/I,0,P):l.draw(T[P],1,S[P],P),t.update(u,T[P],1)}else if(y===!0){let{vertexCount:S,instanceCount:T,firstVertex:R}=a,I=e.getIndirect();if(I!==null){let P=this.get(I).buffer,F=e.getIndirectOffset(),D=Array.isArray(F)?F:[F];for(let L=0;L<D.length;L++)l.drawIndexedIndirect(P,D[L])}else l.drawIndexed(S,T,R,0,0);t.update(u,S,T)}else{let{vertexCount:S,instanceCount:T,firstVertex:R}=a,I=e.getIndirect();if(I!==null){let P=this.get(I).buffer,F=e.getIndirectOffset(),D=Array.isArray(F)?F:[F];for(let L=0;L<D.length;L++)l.drawIndirect(P,D[L])}else l.draw(S,T,R,0);t.update(u,S,T)}}draw(e,t){let{object:n,context:r,pipeline:s}=e,o=this.get(r),a=this.get(s),l=a.pipeline;if(a.error===!0)return;let c=e.getDrawParameters();if(c===null)return;let u=e.getBindings(),f=e.getVertexBuffers();if(e.camera.isArrayCamera&&e.camera.cameras.length>0){let d=this.get(e.camera),A=e.camera.cameras,y=e.getBindingGroup("cameraIndex");if(d.indexesGPU===void 0||d.indexesGPU.length!==A.length){let S=this.get(y),T=[],R=new Uint32Array([0,0,0,0]);for(let I=0,P=A.length;I<P;I++){R[0]=I;let{layoutGPU:F}=S.layout,D=this.bindingUtils.createBindGroupIndex(R,F);T.push(D)}d.indexesGPU=T}let w=this.renderer.getPixelRatio();for(let S=0,T=A.length;S<T;S++){let R=A[S];if(n.layers.test(R.layers)){let I=R.viewport,P=o.currentPass,F=o.currentSets,D=o.bundleEncoders!==void 0;if(D){let L=o.bundleEncoders[S],C=o.bundleSets[S];P=L,F=C}if(I&&!D&&P.setViewport(Math.floor(I.x*w),Math.floor(I.y*w),Math.floor(I.width*w),Math.floor(I.height*w),r.viewportValue.minDepth,r.viewportValue.maxDepth),y&&d.indexesGPU){let L=u.indexOf(y);P.setBindGroup(L,d.indexesGPU[S]),F.bindingGroups[L]=y.id}this._draw(e,t,o,l,u,f,c,P,F)}}}else if(o.currentPass){if(o.occlusionQuerySet!==void 0){let d=o.lastOcclusionObject;d!==n&&(d!==null&&d.occlusionTest===!0&&(o.currentPass.endOcclusionQuery(),o.occlusionQueryIndex++),n.occlusionTest===!0&&(o.currentPass.beginOcclusionQuery(o.occlusionQueryIndex),o.occlusionQueryObjects[o.occlusionQueryIndex]=n),o.lastOcclusionObject=n)}this._draw(e,t,o,l,u,f,c,o.currentPass,o.currentSets)}}needsRenderUpdate(e){let t=this.get(e),{object:n,material:r}=e,s=this.utils,o=s.getSampleCountRenderContext(e.context),a=s.getCurrentColorSpace(e.context),l=s.getCurrentColorFormat(e.context),c=s.getCurrentDepthStencilFormat(e.context),u=s.getPrimitiveTopology(n,r),f=n.isMesh&&n.matrixWorld.determinantAffine()<0,d=!1;return(t.material!==r||t.materialVersion!==r.version||t.transparent!==r.transparent||t.blending!==r.blending||t.premultipliedAlpha!==r.premultipliedAlpha||t.blendSrc!==r.blendSrc||t.blendDst!==r.blendDst||t.blendEquation!==r.blendEquation||t.blendSrcAlpha!==r.blendSrcAlpha||t.blendDstAlpha!==r.blendDstAlpha||t.blendEquationAlpha!==r.blendEquationAlpha||t.colorWrite!==r.colorWrite||t.depthWrite!==r.depthWrite||t.depthTest!==r.depthTest||t.depthFunc!==r.depthFunc||t.stencilWrite!==r.stencilWrite||t.stencilFunc!==r.stencilFunc||t.stencilFail!==r.stencilFail||t.stencilZFail!==r.stencilZFail||t.stencilZPass!==r.stencilZPass||t.stencilFuncMask!==r.stencilFuncMask||t.stencilWriteMask!==r.stencilWriteMask||t.side!==r.side||t.alphaToCoverage!==r.alphaToCoverage||t.sampleCount!==o||t.colorSpace!==a||t.colorFormat!==l||t.depthStencilFormat!==c||t.primitiveTopology!==u||t.frontFaceCW!==f||t.clippingContextCacheKey!==e.clippingContextCacheKey)&&(t.material=r,t.materialVersion=r.version,t.transparent=r.transparent,t.blending=r.blending,t.premultipliedAlpha=r.premultipliedAlpha,t.blendSrc=r.blendSrc,t.blendDst=r.blendDst,t.blendEquation=r.blendEquation,t.blendSrcAlpha=r.blendSrcAlpha,t.blendDstAlpha=r.blendDstAlpha,t.blendEquationAlpha=r.blendEquationAlpha,t.colorWrite=r.colorWrite,t.depthWrite=r.depthWrite,t.depthTest=r.depthTest,t.depthFunc=r.depthFunc,t.stencilWrite=r.stencilWrite,t.stencilFunc=r.stencilFunc,t.stencilFail=r.stencilFail,t.stencilZFail=r.stencilZFail,t.stencilZPass=r.stencilZPass,t.stencilFuncMask=r.stencilFuncMask,t.stencilWriteMask=r.stencilWriteMask,t.side=r.side,t.alphaToCoverage=r.alphaToCoverage,t.sampleCount=o,t.colorSpace=a,t.colorFormat=l,t.depthStencilFormat=c,t.primitiveTopology=u,t.frontFaceCW=f,t.clippingContextCacheKey=e.clippingContextCacheKey,d=!0),d}getRenderCacheKey(e){let{object:t,material:n}=e,r=this.utils,s=e.context,o=t.isMesh&&t.matrixWorld.determinantAffine()<0;return[n.transparent,n.blending,n.premultipliedAlpha,n.blendSrc,n.blendDst,n.blendEquation,n.blendSrcAlpha,n.blendDstAlpha,n.blendEquationAlpha,n.colorWrite,n.depthWrite,n.depthTest,n.depthFunc,n.stencilWrite,n.stencilFunc,n.stencilFail,n.stencilZFail,n.stencilZPass,n.stencilFuncMask,n.stencilWriteMask,n.side,o,r.getSampleCountRenderContext(s),r.getCurrentColorSpace(s),r.getCurrentColorFormat(s),r.getCurrentDepthStencilFormat(s),r.getPrimitiveTopology(t,n),e.getGeometryCacheKey(),e.clippingContextCacheKey].join()}updateSampler(e){return this.textureUtils.updateSampler(e)}destroySampler(e){this.textureUtils.destroySampler(e)}createDefaultTexture(e){return this.textureUtils.createDefaultTexture(e)}createTexture(e,t){this.textureUtils.createTexture(e,t)}updateTexture(e,t){this.textureUtils.updateTexture(e,t)}generateMipmaps(e){this.textureUtils.generateMipmaps(e)}destroyTexture(e,t=!1){this.textureUtils.destroyTexture(e,t)}async copyTextureToBuffer(e,t,n,r,s,o){return this.textureUtils.copyTextureToBuffer(e,t,n,r,s,o)}initTimestampQuery(e,t,n){if(!this.trackTimestamp)return;this.timestampQueryPool[e]||(this.timestampQueryPool[e]=new tz(this.device,e,2048));let r=this.timestampQueryPool[e],s=r.allocateQueriesForContext(t);$R.querySet=r.querySet,$R.beginningOfPassWriteIndex=s,$R.endOfPassWriteIndex=s+1,n.timestampWrites=$R}createNodeBuilder(e,t){return new X9(e,t)}createProgram(e){let t=this.get(e);XR.label=e.stage+(e.name!==""?`_${e.name}`:""),XR.code=e.code,t.module={module:this.device.createShaderModule(XR),entryPoint:"main"},XR.reset()}destroyProgram(e){this.delete(e)}createRenderPipeline(e,t){this.pipelineUtils.createRenderPipeline(e,t)}createComputePipeline(e,t){this.pipelineUtils.createComputePipeline(e,t)}beginBundle(e){let t=this.get(e);t._currentPass=t.currentPass,t._currentSets=t.currentSets,t.currentSets={attributes:{},bindingGroups:[],pipeline:null,index:null},t.currentPass=this.pipelineUtils.createBundleEncoder(e)}finishBundle(e,t){let n=this.get(e),s=n.currentPass.finish();this.get(t).bundleGPU=s,n.currentSets=n._currentSets,n.currentPass=n._currentPass}addBundle(e,t){this.get(e).renderBundles.push(this.get(t).bundleGPU)}createUniformBuffer(e){let t=this.get(e);if(t.buffer===void 0){let n=e.byteLength,r=GPUBufferUsage.UNIFORM|GPUBufferUsage.COPY_DST,s=[];e.visibility&yf.VERTEX&&s.push("vertex"),e.visibility&yf.FRAGMENT&&s.push("fragment"),e.visibility&yf.COMPUTE&&s.push("compute");let o=`(${s.join(",")})`;lc.label=`bindingBuffer${e.id}_${e.name}_${o}`,lc.size=n,lc.usage=r;let a=this.device.createBuffer(lc);lc.reset(),t.buffer=a}}destroyUniformBuffer(e){this.get(e).buffer.destroy(),this.delete(e)}createBindings(e,t,n,r){this.bindingUtils.createBindings(e,t,n,r)}updateBindings(e,t,n,r){this.bindingUtils.createBindings(e,t,n,r)}updateBinding(e){this.bindingUtils.updateBinding(e)}deleteBindGroupData(e){this.bindingUtils.deleteBindGroupData(e)}createIndexAttribute(e){let t=GPUBufferUsage.INDEX|GPUBufferUsage.COPY_SRC|GPUBufferUsage.COPY_DST;(e.isStorageBufferAttribute||e.isStorageInstancedBufferAttribute)&&(t|=GPUBufferUsage.STORAGE),this.attributeUtils.createAttribute(e,t)}createAttribute(e){this.attributeUtils.createAttribute(e,GPUBufferUsage.VERTEX|GPUBufferUsage.COPY_SRC|GPUBufferUsage.COPY_DST)}createStorageAttribute(e){this.attributeUtils.createAttribute(e,GPUBufferUsage.STORAGE|GPUBufferUsage.VERTEX|GPUBufferUsage.COPY_SRC|GPUBufferUsage.COPY_DST)}createIndirectStorageAttribute(e){this.attributeUtils.createAttribute(e,GPUBufferUsage.STORAGE|GPUBufferUsage.INDIRECT|GPUBufferUsage.COPY_SRC|GPUBufferUsage.COPY_DST)}updateAttribute(e){this.attributeUtils.updateAttribute(e)}destroyAttribute(e){this.attributeUtils.destroyAttribute(e)}updateSize(){this.delete(this.renderer.getCanvasTarget())}hasFeature(e){return Jte[e]!==void 0&&(e=Jte[e]),this.device.features.has(e)}copyTextureToTexture(e,t,n=null,r=null,s=0,o=0){let a=0,l=0,c=0,u=0,f=0,d=0,A=e.image.width,y=e.image.height,w=1;n!==null&&(n.isBox3===!0?(u=n.min.x,f=n.min.y,d=n.min.z,A=n.max.x-n.min.x,y=n.max.y-n.min.y,w=n.max.z-n.min.z):(u=n.min.x,f=n.min.y,A=n.max.x-n.min.x,y=n.max.y-n.min.y,w=1)),r!==null&&(a=r.x,l=r.y,c=r.z||0),Ya.label="copyTextureToTexture_"+e.id+"_"+t.id;let S=this.device.createCommandEncoder(Ya);Ya.reset();let T=this.get(e).texture,R=this.get(t).texture;Zc.texture=T,Zc.mipLevel=s,Zc.origin.x=u,Zc.origin.y=f,Zc.origin.z=d,ff.texture=R,ff.mipLevel=o,ff.origin.x=a,ff.origin.y=l,ff.origin.z=c,Wd.width=A,Wd.height=y,Wd.depthOrArrayLayers=w,S.copyTextureToTexture(Zc,ff,Wd),Zc.reset(),ff.reset(),Wd.reset(),mf(this.device,S.finish()),o===0&&t.generateMipmaps&&this.textureUtils.generateMipmaps(t)}copyFramebufferToTexture(e,t,n){let r=this.get(t),s=null;t.renderTarget?e.isDepthTexture?s=this.get(t.depthTexture).texture:s=this.get(t.textures[0]).texture:e.isDepthTexture?s=this.textureUtils.getDepthBuffer(t.depth,t.stencil):s=this.context.getCurrentTexture();let o=this.get(e).texture;if(s.format!==o.format){ze("WebGPUBackend: copyFramebufferToTexture: Source and destination formats do not match.",s.format,o.format);return}let a;if(r.currentPass?(r.currentPass.end(),a=r.encoder):(Ya.label="copyFramebufferToTexture_"+e.id,a=this.device.createCommandEncoder(Ya),Ya.reset()),Zc.texture=s,Zc.origin.x=n.x,Zc.origin.y=n.y,ff.texture=o,Wd.width=n.z,Wd.height=n.w,a.copyTextureToTexture(Zc,ff,Wd),Zc.reset(),ff.reset(),Wd.reset(),e.generateMipmaps&&this.textureUtils.generateMipmaps(e,a),r.currentPass){let{descriptor:l}=r;for(let c=0;c<l.colorAttachments.length;c++)l.colorAttachments[c].loadOp=Fi.Load;t.depth&&(l.depthStencilAttachment.depthLoadOp=Fi.Load),t.stencil&&(l.depthStencilAttachment.stencilLoadOp=Fi.Load),r.currentPass=a.beginRenderPass(l),r.currentSets={attributes:{},bindingGroups:[],pipeline:null,index:null},t.viewport&&this.updateViewport(t),t.scissor&&this.updateScissor(t)}else mf(this.device,a.finish())}hasCompatibility(e){return this._compatibility[e]!==void 0?this._compatibility[e]:super.hasCompatibility(e)}dispose(){if(this.bindingUtils.dispose(),this.textureUtils.dispose(),this.occludedResolveCache){for(let e of this.occludedResolveCache.values())e.destroy();this.occludedResolveCache.clear()}if(this.timestampQueryPool)for(let e of Object.values(this.timestampQueryPool))e!==null&&e.dispose();this.parameters.device===void 0&&this.device!==null&&this.device.destroy()}},sz=class extends KA{constructor(e,t,n,r,s,o){super(e,t,n,r,s,o),this.iesMap=null}copy(e,t){return super.copy(e,t),this.iesMap=e.iesMap,this}},oz=class extends KA{constructor(e,t,n,r,s,o){super(e,t,n,r,s,o),this.aspect=null}copy(e,t){return super.copy(e,t),this.aspect=e.aspect,this}},az=class extends Y4{constructor(){super(),this.addMaterial(P7,"MeshPhongMaterial"),this.addMaterial(M4,"MeshStandardMaterial"),this.addMaterial(U7,"MeshPhysicalMaterial"),this.addMaterial(z7,"MeshToonMaterial"),this.addMaterial(C7,"MeshBasicMaterial"),this.addMaterial(R7,"MeshLambertMaterial"),this.addMaterial(S7,"MeshNormalMaterial"),this.addMaterial(V7,"MeshMatcapMaterial"),this.addMaterial(y7,"LineBasicMaterial"),this.addMaterial(b7,"LineDashedMaterial"),this.addMaterial(q7,"PointsMaterial"),this.addMaterial(C4,"SpriteMaterial"),this.addMaterial(W7,"ShadowMaterial"),this.addLight(Fk,rb),this.addLight(s9,QA),this.addLight(u9,sb),this.addLight(MS,KA),this.addLight(r9,JA),this.addLight(o9,nb),this.addLight(l9,ob),this.addLight(a9,sz),this.addLight(c9,oz),this.addToneMapping(Bse,wb),this.addToneMapping(Ose,Sb),this.addToneMapping(Use,Tb),this.addToneMapping(kse,Eb),this.addToneMapping(zse,Mb),this.addToneMapping(Vse,Cb)}},xx=class extends _9{constructor(e={}){let t;e.forceWebGL?t=sP:(t=rz,e.getFallback=()=>(Xe("WebGPURenderer: WebGPU is not available, running under WebGL2 backend."),new sP(e)));let n=new t(e);super(n,e),this.library=new az,this.isWebGPURenderer=!0,typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}};var Rlt=V.BRDF_GGX,Plt=V.BRDF_Lambert,Ilt=V.BasicPointShadowFilter,Llt=V.BasicShadowFilter,Dlt=V.Break,Nlt=V.Const,Flt=V.Continue,Blt=V.DFGLUT,Olt=V.D_GGX,Ult=V.Discard,klt=V.EPSILON,zlt=V.F_Schlick,voe=V.Fn,Vlt=V.INFINITY,_oe=V.If,xoe=V.Loop,Glt=V.NodeAccess,qlt=V.NodeShaderStage,Hlt=V.NodeType,Wlt=V.NodeUpdateType,jlt=V.PCFShadowFilter,Xlt=V.PCFSoftShadowFilter,$lt=V.PI,Ylt=V.PI2,Zlt=V.TWO_PI,Klt=V.HALF_PI,Qlt=V.PointShadowFilter,Jlt=V.Return,ect=V.Schlick_to_F0,tct=V.ShaderNode,nct=V.Stack,ict=V.Switch,rct=V.TBNViewMatrix,sct=V.VSMShadowFilter,oct=V.V_GGX_SmithCorrelated,act=V.Var,lct=V.VarIntent,cct=V.abs,uct=V.acesFilmicToneMapping,hct=V.acos,fct=V.acosh,dct=V.add,pct=V.addMethodChaining,mct=V.addNodeElement,Act=V.agxToneMapping,gct=V.all,vct=V.alphaT,_ct=V.ambientOcclusion,xct=V.and,yct=V.anisotropy,bct=V.anisotropyB,wct=V.anisotropyT,Sct=V.any,Tct=V.append,Ect=V.array,yoe=V.asin,Mct=V.asinh,Cct=V.assign,Rct=V.atan,Pct=V.atanh,Ict=V.atomicAdd,Lct=V.atomicAnd,Dct=V.atomicFunc,Nct=V.atomicLoad,Fct=V.atomicMax,Bct=V.atomicMin,Oct=V.atomicOr,Uct=V.atomicStore,kct=V.atomicSub,zct=V.atomicXor,Vct=V.attenuationColor,Gct=V.attenuationDistance,qct=V.attribute,Hct=V.attributeArray,Wct=V.backgroundBlurriness,jct=V.backgroundIntensity,Xct=V.backgroundRotation,$ct=V.batch,Yct=V.bentNormalView,Zct=V.billboarding,Kct=V.bitAnd,Qct=V.bitNot,Jct=V.bitOr,eut=V.bitXor,tut=V.bitangentGeometry,nut=V.bitangentLocal,iut=V.bitangentView,rut=V.bitangentWorld,sut=V.bitcast,out=V.blendBurn,aut=V.blendColor,lut=V.blendDodge,cut=V.blendOverlay,uut=V.blendScreen,hut=V.blur,fut=V.bool,dut=V.buffer,put=V.bufferAttribute,mut=V.bumpMap,Aut=V.builtin,gut=V.builtinAOContext,vut=V.builtinShadowContext,_ut=V.bvec2,xut=V.bvec3,yut=V.bvec4,but=V.bypass,wut=V.cache,Sut=V.call,Tut=V.cameraFar,Eut=V.cameraIndex,Mut=V.cameraNear,Cut=V.cameraNormalMatrix,Rut=V.cameraPosition,Put=V.cameraProjectionMatrix,Iut=V.cameraProjectionMatrixInverse,Lut=V.cameraViewMatrix,Dut=V.cameraViewport,Nut=V.cameraWorldMatrix,Fut=V.cbrt,But=V.cdl,Out=V.ceil,Uut=V.checker,kut=V.cineonToneMapping,zut=V.clamp,Vut=V.clearcoat,Gut=V.clearcoatNormalView,qut=V.clearcoatRoughness,Hut=V.clipSpace,Wut=V.code,jut=V.color,Xut=V.colorSpaceToWorking,$ut=V.colorToDirection,Yut=V.compute,Zut=V.computeKernel,Kut=V.computeSkinning,Qut=V.context,Jut=V.convert,eht=V.convertColorSpace,tht=V.convertToTexture,nht=V.countLeadingZeros,iht=V.countOneBits,rht=V.countTrailingZeros,boe=V.cos,sht=V.cosh,oht=V.cross,aht=V.cubeTexture,lht=V.cubeTextureBase,cht=V.dFdx,uht=V.dFdy,hht=V.dashSize,fht=V.debug,dht=V.decrement,pht=V.decrementBefore,mht=V.defaultBuildStages,Aht=V.defaultShaderStages,ght=V.defined,vht=V.degrees,_ht=V.deltaTime,xht=V.densityFog,yht=V.densityFogFactor,bht=V.depth,wht=V.depthPass,Sht=V.determinant,Tht=V.difference,Eht=V.diffuseColor,Mht=V.directPointLight,Cht=V.directionToColor,Rht=V.directionToFaceDirection,Pht=V.dispersion,Iht=V.distance,Lht=V.div,Dht=V.dot,Nht=V.drawIndex,Fht=V.dynamicBufferAttribute,Bht=V.element,Oht=V.emissive,Uht=V.equal,kht=V.equirectDirection,zht=V.equirectUV,woe=V.exp,Vht=V.exp2,Ght=V.exponentialHeightFogFactor,qht=V.expression,Hht=V.faceDirection,Wht=V.faceForward,jht=V.faceforward,Soe=V.float,Xht=V.floatBitsToInt,$ht=V.floatBitsToUint,Yht=V.floor,Zht=V.fog,Kht=V.fract,Qht=V.frameGroup,Jht=V.frameId,eft=V.frontFacing,tft=V.fwidth,nft=V.gain,ift=V.gapSize,rft=V.getConstNodeType,sft=V.getCurrentStack,oft=V.getDirection,aft=V.getDistanceAttenuation,lft=V.getGeometryRoughness,cft=V.getNormalFromDepth,uft=V.interleavedGradientNoise,hft=V.vogelDiskSample,fft=V.getParallaxCorrectNormal,dft=V.getRoughness,pft=V.getScreenPosition,mft=V.getShIrradianceAt,Aft=V.getShadowMaterial,gft=V.getShadowRenderObjectFunction,vft=V.getTextureIndex,_ft=V.getViewPosition,xft=V.globalId,yft=V.glsl,bft=V.glslFn,wft=V.grayscale,Sft=V.greaterThan,Tft=V.greaterThanEqual,Eft=V.hash,Mft=V.highpModelNormalViewMatrix,Cft=V.highpModelViewMatrix,Rft=V.hue,Pft=V.increment,Ift=V.incrementBefore,Lft=V.instance,Toe=V.instanceIndex,Dft=V.instancedArray,Nft=V.instancedBufferAttribute,Fft=V.instancedDynamicBufferAttribute,Bft=V.instancedMesh,Oft=V.int,Uft=V.intBitsToFloat,kft=V.inverse,zft=V.inverseSqrt,Vft=V.inversesqrt,Gft=V.invocationLocalIndex,qft=V.invocationSubgroupIndex,Hft=V.ior,Wft=V.iridescence,jft=V.iridescenceIOR,Xft=V.iridescenceThickness,$ft=V.ivec2,Yft=V.ivec3,Zft=V.ivec4,Kft=V.js,Qft=V.label,Jft=V.length,edt=V.lengthSq,tdt=V.lessThan,ndt=V.lessThanEqual,idt=V.lightPosition,rdt=V.lightProjectionUV,sdt=V.lightShadowMatrix,odt=V.lightTargetDirection,adt=V.lightTargetPosition,ldt=V.lightViewPosition,cdt=V.lightingContext,udt=V.lights,hdt=V.linearDepth,fdt=V.linearToneMapping,ddt=V.localId,pdt=V.log,mdt=V.log2,Adt=V.logarithmicDepthToViewZ,gdt=V.luminance,vdt=V.mat2,_dt=V.mat3,xdt=V.mat4,ydt=V.matcapUV,bdt=V.materialAO,wdt=V.materialAlphaTest,Sdt=V.materialAnisotropy,Tdt=V.materialAnisotropyVector,Edt=V.materialAttenuationColor,Mdt=V.materialAttenuationDistance,Cdt=V.materialClearcoat,Rdt=V.materialClearcoatNormal,Pdt=V.materialClearcoatRoughness,Idt=V.materialColor,Ldt=V.materialDispersion,Ddt=V.materialEmissive,Ndt=V.materialEnvIntensity,Fdt=V.materialEnvRotation,Bdt=V.materialIOR,Odt=V.materialIridescence,Udt=V.materialIridescenceIOR,kdt=V.materialIridescenceThickness,zdt=V.materialLightMap,Vdt=V.materialLineDashOffset,Gdt=V.materialLineDashSize,qdt=V.materialLineGapSize,Hdt=V.materialLineScale,Wdt=V.materialLineWidth,jdt=V.materialMetalness,Xdt=V.materialNormal,$dt=V.materialOpacity,Ydt=V.materialPointSize,Zdt=V.materialReference,Kdt=V.materialReflectivity,Qdt=V.materialRefractionRatio,Jdt=V.materialRotation,ept=V.materialRoughness,tpt=V.materialSheen,npt=V.materialSheenRoughness,ipt=V.materialShininess,rpt=V.materialSpecular,spt=V.materialSpecularColor,opt=V.materialSpecularIntensity,apt=V.materialSpecularStrength,lpt=V.materialThickness,cpt=V.materialTransmission,upt=V.max,hpt=V.maxMipLevel,fpt=V.mediumpModelViewMatrix,dpt=V.metalness,ppt=V.min,mpt=V.mix,Apt=V.mixElement,gpt=V.mod,vpt=V.modelDirection,_pt=V.modelNormalMatrix,xpt=V.modelPosition,ypt=V.modelRadius,bpt=V.modelScale,wpt=V.modelViewMatrix,Spt=V.modelViewPosition,Tpt=V.modelViewProjection,Ept=V.modelWorldMatrix,Mpt=V.modelWorldMatrixInverse,Cpt=V.morphReference,Rpt=V.mrt,Ppt=V.mul,Ipt=V.mx_aastep,Lpt=V.mx_add,Dpt=V.mx_atan2,Npt=V.mx_cell_noise_float,Fpt=V.mx_contrast,Bpt=V.mx_divide,Opt=V.mx_fractal_noise_float,Upt=V.mx_fractal_noise_vec2,kpt=V.mx_fractal_noise_vec3,zpt=V.mx_fractal_noise_vec4,Vpt=V.mx_frame,Gpt=V.mx_heighttonormal,qpt=V.mx_hsvtorgb,Hpt=V.mx_ifequal,Wpt=V.mx_ifgreater,jpt=V.mx_ifgreatereq,Xpt=V.mx_invert,$pt=V.mx_modulo,Ypt=V.mx_multiply,Zpt=V.mx_noise_float,Kpt=V.mx_noise_vec3,Qpt=V.mx_noise_vec4,Jpt=V.mx_place2d,e0t=V.mx_power,t0t=V.mx_ramp4,n0t=V.mx_ramplr,i0t=V.mx_ramptb,r0t=V.mx_rgbtohsv,s0t=V.mx_rotate2d,o0t=V.mx_rotate3d,a0t=V.mx_safepower,l0t=V.mx_separate,c0t=V.mx_splitlr,u0t=V.mx_splittb,h0t=V.mx_srgb_texture_to_lin_rec709,f0t=V.mx_subtract,d0t=V.mx_timer,p0t=V.mx_transform_uv,m0t=V.mx_unifiednoise2d,A0t=V.mx_unifiednoise3d,g0t=V.mx_worley_noise_float,v0t=V.mx_worley_noise_vec2,_0t=V.mx_worley_noise_vec3,Eoe=V.negate,x0t=V.negateOnBackSide,y0t=V.neutralToneMapping,b0t=V.nodeArray,w0t=V.nodeImmutable,S0t=V.nodeObject,T0t=V.nodeObjectIntent,E0t=V.nodeObjects,M0t=V.nodeProxy,C0t=V.nodeProxyIntent,R0t=V.normalFlat,P0t=V.normalGeometry,I0t=V.normalLocal,L0t=V.normalMap,D0t=V.normalView,N0t=V.normalViewGeometry,F0t=V.normalWorld,B0t=V.normalWorldGeometry,O0t=V.normalize,U0t=V.not,k0t=V.notEqual,z0t=V.numWorkgroups,V0t=V.objectDirection,G0t=V.objectGroup,q0t=V.objectPosition,H0t=V.objectRadius,W0t=V.objectScale,j0t=V.objectViewPosition,X0t=V.objectWorldMatrix,$0t=V.OnBeforeObjectUpdate,Y0t=V.OnBeforeMaterialUpdate,Z0t=V.OnObjectUpdate,K0t=V.OnMaterialUpdate,Q0t=V.oneMinus,J0t=V.or,emt=V.orthographicDepthToViewZ,tmt=V.oscSawtooth,nmt=V.oscSine,imt=V.oscSquare,rmt=V.oscTriangle,smt=V.output,omt=V.outputStruct,amt=V.overloadingFn,lmt=V.overrideNode,cmt=V.overrideNodes,umt=V.packHalf2x16,hmt=V.packSnorm2x16,fmt=V.packUnorm2x16,dmt=V.packNormalToRGB,pmt=V.parabola,mmt=V.parallaxDirection,Amt=V.parallaxUV,gmt=V.parameter,vmt=V.pass,_mt=V.passTexture,xmt=V.pcurve,ymt=V.perspectiveDepthToViewZ,bmt=V.pmremTexture,wmt=V.pointShadow,Smt=V.pointUV,Tmt=V.pointWidth,Emt=V.positionGeometry,Mmt=V.positionLocal,Cmt=V.positionPrevious,Rmt=V.positionView,Pmt=V.positionViewDirection,Imt=V.positionWorld,Lmt=V.positionWorldDirection,Dmt=V.posterize,Nmt=V.pow,Fmt=V.pow2,Bmt=V.pow3,Omt=V.pow4,Umt=V.premultiplyAlpha,kmt=V.property,zmt=V.radians,Vmt=V.rand,Gmt=V.range,qmt=V.rangeFog,Hmt=V.rangeFogFactor,Wmt=V.reciprocal,jmt=V.reference,Xmt=V.referenceBuffer,$mt=V.reflect,Ymt=V.reflectVector,Zmt=V.reflectView,Kmt=V.reflector,Qmt=V.refract,Jmt=V.refractVector,eAt=V.refractView,tAt=V.reinhardToneMapping,nAt=V.remap,iAt=V.remapClamp,rAt=V.renderGroup,sAt=V.renderOutput,oAt=V.rendererReference,aAt=V.replaceDefaultUV,lAt=V.rotate,cAt=V.rotateUV,uAt=V.roughness,hAt=V.round,fAt=V.rtt,dAt=V.sRGBTransferEOTF,pAt=V.sRGBTransferOETF,mAt=V.sample,AAt=V.sampler,gAt=V.samplerComparison,vAt=V.saturate,_At=V.saturation,xAt=V.screen,yAt=V.screenCoordinate,bAt=V.screenDPR,wAt=V.screenSize,SAt=V.screenUV,TAt=V.select,EAt=V.setCurrentStack,MAt=V.setName,CAt=V.shaderStages,RAt=V.shadow,PAt=V.shadowPositionWorld,IAt=V.shapeCircle,LAt=V.sharedUniformGroup,DAt=V.sheen,NAt=V.sheenRoughness,FAt=V.shiftLeft,BAt=V.shiftRight,OAt=V.shininess,UAt=V.sign,Moe=V.sin,kAt=V.sinh,zAt=V.sinc,VAt=V.skinning,GAt=V.smoothstep,qAt=V.smoothstepElement,HAt=V.specularColor,WAt=V.specularF90,jAt=V.spherizeUV,XAt=V.split,$At=V.spritesheetUV,Coe=V.sqrt,YAt=V.stack,ZAt=V.step,KAt=V.stepElement,Roe=V.storage,QAt=V.storageBarrier,JAt=V.storageTexture,egt=V.storageTexture3D,tgt=V.struct,ngt=V.sub,igt=V.subgroupAdd,rgt=V.subgroupAll,sgt=V.subgroupAnd,ogt=V.subgroupAny,agt=V.subgroupBallot,lgt=V.subgroupBroadcast,cgt=V.subgroupBroadcastFirst,ugt=V.subBuild,hgt=V.subgroupElect,fgt=V.subgroupExclusiveAdd,dgt=V.subgroupExclusiveMul,pgt=V.subgroupInclusiveAdd,mgt=V.subgroupInclusiveMul,Agt=V.subgroupIndex,ggt=V.subgroupMax,vgt=V.subgroupMin,_gt=V.subgroupMul,xgt=V.subgroupOr,ygt=V.subgroupShuffle,bgt=V.subgroupShuffleDown,wgt=V.subgroupShuffleUp,Sgt=V.subgroupShuffleXor,Tgt=V.subgroupSize,Egt=V.subgroupXor,Mgt=V.tan,Cgt=V.tanh,Rgt=V.tangentGeometry,Pgt=V.tangentLocal,Igt=V.tangentView,Lgt=V.tangentWorld,Dgt=V.texture,Ngt=V.texture3D,Fgt=V.textureBarrier,Bgt=V.textureBicubic,Ogt=V.textureBicubicLevel,Ugt=V.textureCubeUV,kgt=V.textureLoad,zgt=V.textureSize,Vgt=V.textureLevel,Ggt=V.textureStore,qgt=V.thickness,Hgt=V.time,Wgt=V.toneMapping,jgt=V.toneMappingExposure,Xgt=V.toonOutlinePass,$gt=V.transformDirection,Ygt=V.transformNormal,Zgt=V.transformNormalByInverseViewMatrix,Kgt=V.transformNormalByViewMatrix,Qgt=V.transformNormalToView,Jgt=V.transformedClearcoatNormalView,e1t=V.transformedNormalView,t1t=V.transformedNormalWorld,n1t=V.transmission,i1t=V.transpose,r1t=V.triNoise3D,s1t=V.triplanarTexture,o1t=V.triplanarTextures,a1t=V.trunc,l1t=V.uint,c1t=V.uintBitsToFloat,Poe=V.uniform,u1t=V.uniformArray,h1t=V.uniformCubeTexture,f1t=V.uniformGroup,d1t=V.uniformFlow,p1t=V.uniformTexture,m1t=V.unpackHalf2x16,A1t=V.unpackSnorm2x16,g1t=V.unpackUnorm2x16,v1t=V.unpackRGBToNormal,_1t=V.unpremultiplyAlpha,x1t=V.userData,y1t=V.uv,b1t=V.uvec2,w1t=V.uvec3,S1t=V.uvec4,T1t=V.varying,E1t=V.varyingProperty,M1t=V.vec2,C1t=V.vec3,R1t=V.vec4,P1t=V.vectorComponents,I1t=V.velocity,L1t=V.vertexColor,D1t=V.vertexIndex,N1t=V.vertexStage,F1t=V.vibrance,B1t=V.viewZToLogarithmicDepth,O1t=V.viewZToOrthographicDepth,U1t=V.viewZToPerspectiveDepth,k1t=V.viewZToReversedOrthographicDepth,z1t=V.viewZToReversedPerspectiveDepth,V1t=V.viewport,G1t=V.viewportCoordinate,q1t=V.viewportDepthTexture,H1t=V.viewportLinearDepth,W1t=V.viewportMipTexture,j1t=V.viewportOpaqueMipTexture,X1t=V.viewportResolution,$1t=V.viewportSafeUV,Y1t=V.viewportSharedTexture,Z1t=V.viewportSize,K1t=V.viewportTexture,Q1t=V.viewportUV,J1t=V.wgsl,evt=V.wgslFn,tvt=V.workgroupArray,nvt=V.workgroupBarrier,ivt=V.workgroupId,rvt=V.workingToColorSpace,svt=V.xor;var Ioe=new ka,qP=new re,Ex=class extends ab{constructor(){super(),this.isLineSegmentsGeometry=!0,this.type="LineSegmentsGeometry";let e=[-1,2,0,1,2,0,-1,1,0,1,1,0,-1,0,0,1,0,0,-1,-1,0,1,-1,0],t=[-1,2,1,2,-1,1,1,1,-1,-1,1,-1,-1,-2,1,-2],n=[0,2,1,2,3,1,2,4,3,4,5,3,4,6,5,6,7,5];this.setIndex(n),this.setAttribute("position",new Ln(e,3)),this.setAttribute("uv",new Ln(t,2))}applyMatrix4(e){let t=this.attributes.instanceStart,n=this.attributes.instanceEnd;return t!==void 0&&(t.applyMatrix4(e),n.applyMatrix4(e),t.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this}setPositions(e){let t;e instanceof Float32Array?t=e:Array.isArray(e)&&(t=new Float32Array(e));let n=new Lh(t,6,1);return this.setAttribute("instanceStart",new Vo(n,3,0)),this.setAttribute("instanceEnd",new Vo(n,3,3)),this.instanceCount=this.attributes.instanceStart.count,this.computeBoundingBox(),this.computeBoundingSphere(),this}setColors(e){let t;e instanceof Float32Array?t=e:Array.isArray(e)&&(t=new Float32Array(e));let n=new Lh(t,6,1);return this.setAttribute("instanceColorStart",new Vo(n,3,0)),this.setAttribute("instanceColorEnd",new Vo(n,3,3)),this}fromWireframeGeometry(e){return this.setPositions(e.attributes.position.array),this}fromEdgesGeometry(e){return this.setPositions(e.attributes.position.array),this}fromMesh(e){return this.fromWireframeGeometry(new $2(e.geometry)),this}fromLineSegments(e){let t=e.geometry;return this.setPositions(t.attributes.position.array),this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new ka);let e=this.attributes.instanceStart,t=this.attributes.instanceEnd;e!==void 0&&t!==void 0&&(this.boundingBox.setFromBufferAttribute(e),Ioe.setFromBufferAttribute(t),this.boundingBox.union(Ioe))}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new yl),this.boundingBox===null&&this.computeBoundingBox();let e=this.attributes.instanceStart,t=this.attributes.instanceEnd;if(e!==void 0&&t!==void 0){let n=this.boundingSphere.center;this.boundingBox.getCenter(n);let r=0;for(let s=0,o=e.count;s<o;s++)qP.fromBufferAttribute(e,s),r=Math.max(r,n.distanceToSquared(qP)),qP.fromBufferAttribute(t,s),r=Math.max(r,n.distanceToSquared(qP));this.boundingSphere.radius=Math.sqrt(r),isNaN(this.boundingSphere.radius)&&console.error("THREE.LineSegmentsGeometry.computeBoundingSphere(): Computed radius is NaN. The instanced position data is likely to have NaN values.",this)}}toJSON(){}};Nt.line={worldUnits:{value:1},linewidth:{value:1},resolution:{value:new Oe},dashOffset:{value:0},dashScale:{value:1},dashSize:{value:1},gapSize:{value:1}};Ha.line={uniforms:dg.merge([Nt.common,Nt.fog,Nt.line]),vertexShader:`47054705 #include <common>47064706 #include <color_pars_vertex>47074707 #include <fog_pars_vertex>@@ -5093,10 +5093,10 @@ var<${n}> ${e} : ${o};`}},ma=new Am,eU=new t1,jse=new Map([[Int8Array,["sint8","
50935093 #include <premultiplied_alpha_fragment>50945094 50955095 }5096- `};var Rf=class extends ds{constructor(e){super({type:"LineMaterial",uniforms:lg.clone(qa.line.uniforms),vertexShader:qa.line.vertexShader,fragmentShader:qa.line.fragmentShader,clipping:!0}),this.isLineMaterial=!0,this.setValues(e)}get color(){return this.uniforms.diffuse.value}set color(e){this.uniforms.diffuse.value=e}get worldUnits(){return"WORLD_UNITS"in this.defines}set worldUnits(e){e===!0!==this.worldUnits&&(this.needsUpdate=!0),e===!0?this.defines.WORLD_UNITS="":delete this.defines.WORLD_UNITS}get linewidth(){return this.uniforms.linewidth.value}set linewidth(e){this.uniforms.linewidth&&(this.uniforms.linewidth.value=e)}get dashed(){return"USE_DASH"in this.defines}set dashed(e){e===!0!==this.dashed&&(this.needsUpdate=!0),e===!0?this.defines.USE_DASH="":delete this.defines.USE_DASH}get dashScale(){return this.uniforms.dashScale.value}set dashScale(e){this.uniforms.dashScale.value=e}get dashSize(){return this.uniforms.dashSize.value}set dashSize(e){this.uniforms.dashSize.value=e}get dashOffset(){return this.uniforms.dashOffset.value}set dashOffset(e){this.uniforms.dashOffset.value=e}get gapSize(){return this.uniforms.gapSize.value}set gapSize(e){this.uniforms.gapSize.value=e}get opacity(){return this.uniforms.opacity.value}set opacity(e){this.uniforms&&(this.uniforms.opacity.value=e)}get resolution(){return this.uniforms.resolution.value}set resolution(e){this.uniforms.resolution.value.copy(e)}get alphaToCoverage(){return"USE_ALPHA_TO_COVERAGE"in this.defines}set alphaToCoverage(e){this.defines&&(e===!0!==this.alphaToCoverage&&(this.needsUpdate=!0),e===!0?this.defines.USE_ALPHA_TO_COVERAGE="":delete this.defines.USE_ALPHA_TO_COVERAGE)}};var mV=new xn,aoe=new re,loe=new re,Ko=new xn,Qo=new xn,If=new xn,AV=new re,gV=new cn,Jo=new ib,coe=new re,BI=new Ua,OI=new xl,Pf=new xn,Lf,a1;function uoe(i,e,t){return Pf.set(0,0,-e,1).applyMatrix4(i.projectionMatrix),Pf.multiplyScalar(1/Pf.w),Pf.x=a1/t.width,Pf.y=a1/t.height,Pf.applyMatrix4(i.projectionMatrixInverse),Pf.multiplyScalar(1/Pf.w),Math.abs(Math.max(Pf.x,Pf.y))}function fPe(i,e){let t=i.matrixWorld,n=i.geometry,r=n.attributes.instanceStart,s=n.attributes.instanceEnd,o=Math.min(n.instanceCount,r.count);for(let a=0,l=o;a<l;a++){Jo.start.fromBufferAttribute(r,a),Jo.end.fromBufferAttribute(s,a),Jo.applyMatrix4(t);let c=new re,u=new re;Lf.distanceSqToSegment(Jo.start,Jo.end,u,c),u.distanceTo(c)<a1*.5&&e.push({point:u,pointOnLine:c,distance:Lf.origin.distanceTo(u),object:i,face:null,faceIndex:a,uv:null,uv1:null})}}function dPe(i,e,t){let n=e.projectionMatrix,s=i.material.resolution,o=i.matrixWorld,a=i.geometry,l=a.attributes.instanceStart,c=a.attributes.instanceEnd,u=Math.min(a.instanceCount,l.count),f=-e.near;Lf.at(1,If),If.w=1,If.applyMatrix4(e.matrixWorldInverse),If.applyMatrix4(n),If.multiplyScalar(1/If.w),If.x*=s.x/2,If.y*=s.y/2,If.z=0,AV.copy(If),gV.multiplyMatrices(e.matrixWorldInverse,o);for(let d=0,A=u;d<A;d++){if(Ko.fromBufferAttribute(l,d),Qo.fromBufferAttribute(c,d),Ko.w=1,Qo.w=1,Ko.applyMatrix4(gV),Qo.applyMatrix4(gV),Ko.z>f&&Qo.z>f)continue;if(Ko.z>f){let P=Ko.z-Qo.z,I=(Ko.z-f)/P;Ko.lerp(Qo,I)}else if(Qo.z>f){let P=Qo.z-Ko.z,I=(Qo.z-f)/P;Qo.lerp(Ko,I)}Ko.applyMatrix4(n),Qo.applyMatrix4(n),Ko.multiplyScalar(1/Ko.w),Qo.multiplyScalar(1/Qo.w),Ko.x*=s.x/2,Ko.y*=s.y/2,Qo.x*=s.x/2,Qo.y*=s.y/2,Jo.start.copy(Ko),Jo.start.z=0,Jo.end.copy(Qo),Jo.end.z=0;let w=Jo.closestPointToPointParameter(AV,!0);Jo.at(w,coe);let S=Bu.lerp(Ko.z,Qo.z,w),T=S>=-1&&S<=1,R=AV.distanceTo(coe)<a1*.5;if(T&&R){Jo.start.fromBufferAttribute(l,d),Jo.end.fromBufferAttribute(c,d),Jo.start.applyMatrix4(o),Jo.end.applyMatrix4(o);let P=new re,I=new re;Lf.distanceSqToSegment(Jo.start,Jo.end,I,P),t.push({point:I,pointOnLine:P,distance:Lf.origin.distanceTo(I),object:i,face:null,faceIndex:d,uv:null,uv1:null})}}}var UI=class extends Hn{constructor(e=new xx,t=new Rf({color:Math.random()*16777215})){super(e,t),this.isLineSegments2=!0,this.type="LineSegments2"}computeLineDistances(){let e=this.geometry,t=e.attributes.instanceStart,n=e.attributes.instanceEnd,r=new Float32Array(2*t.count);for(let o=0,a=0,l=t.count;o<l;o++,a+=2)aoe.fromBufferAttribute(t,o),loe.fromBufferAttribute(n,o),r[a]=a===0?0:r[a-1],r[a+1]=r[a]+aoe.distanceTo(loe);let s=new Lh(r,2,1);return e.setAttribute("instanceDistanceStart",new zo(s,1,0)),e.setAttribute("instanceDistanceEnd",new zo(s,1,1)),this}raycast(e,t){let n=this.material.worldUnits,r=e.camera;if(r===null&&!n&&console.error('LineSegments2: "Raycaster.camera" needs to be set in order to raycast against LineSegments2 while worldUnits is set to false.'),n===!1&&(this.material.resolution.x===0||this.material.resolution.y===0))return;let s=e.params.Line2!==void 0&&e.params.Line2.threshold||0;Lf=e.ray;let o=this.matrixWorld,a=this.geometry,l=this.material;a1=l.linewidth+s,a.boundingSphere===null&&a.computeBoundingSphere(),OI.copy(a.boundingSphere).applyMatrix4(o);let c;if(n)c=a1*.5;else{let f=Math.max(r.near,OI.distanceToPoint(Lf.origin));c=uoe(r,f,l.resolution)}if(OI.radius+=c,Lf.intersectsSphere(OI)===!1)return;a.boundingBox===null&&a.computeBoundingBox(),BI.copy(a.boundingBox).applyMatrix4(o);let u;if(n)u=a1*.5;else{let f=Math.max(r.near,BI.distanceToPoint(Lf.origin));u=uoe(r,f,l.resolution)}BI.expandByScalar(u),Lf.intersectsBox(BI)!==!1&&(n?fPe(this,t):dPe(this,r,t))}onBeforeRender(e){let t=this.material.uniforms;t&&t.resolution&&(e.getViewport(mV),this.material.uniforms.resolution.value.set(mV.z,mV.w))}};var ym=class extends xx{constructor(){super(),this.isLineGeometry=!0,this.type="LineGeometry"}setPositions(e){let t=e.length-3,n=new Float32Array(2*t);for(let r=0;r<t;r+=3)n[2*r]=e[r],n[2*r+1]=e[r+1],n[2*r+2]=e[r+2],n[2*r+3]=e[r+3],n[2*r+4]=e[r+4],n[2*r+5]=e[r+5];return super.setPositions(n),this}setColors(e){let t=e.length-3,n=new Float32Array(2*t);for(let r=0;r<t;r+=3)n[2*r]=e[r],n[2*r+1]=e[r+1],n[2*r+2]=e[r+2],n[2*r+3]=e[r+3],n[2*r+4]=e[r+4],n[2*r+5]=e[r+5];return super.setColors(n),this}setFromPoints(e){let t=e.length-1,n=new Float32Array(6*t);for(let r=0;r<t;r++)n[6*r]=e[r].x,n[6*r+1]=e[r].y,n[6*r+2]=e[r].z||0,n[6*r+3]=e[r+1].x,n[6*r+4]=e[r+1].y,n[6*r+5]=e[r+1].z||0;return super.setPositions(n),this}fromLine(e){let t=e.geometry;return this.setPositions(t.attributes.position.array),this}};var yx=class extends UI{constructor(e=new ym,t=new Rf({color:Math.random()*16777215})){super(e,t),this.isLine2=!0,this.type="Line2"}};var bx=class{constructor(e){this.isFont=!0,this.type="Font",this.data=e}generateShapes(e,t=100,n="ltr"){let r=[],s=pPe(e,t,this.data,n);for(let o=0,a=s.length;o<a;o++)r.push(...s[o].toShapes());return r}};function pPe(i,e,t,n){let r=Array.from(i),s=e/t.resolution,o=(t.boundingBox.yMax-t.boundingBox.yMin+t.underlineThickness)*s,a=[],l=0,c=0;(n=="rtl"||n=="tb")&&r.reverse();for(let u=0;u<r.length;u++){let f=r[u];if(f===`5097-`)l=0,c-=o;else{let d=mPe(f,s,l,c,t);n=="tb"?(l=0,c+=t.ascender*s):l+=d.offsetX,a.push(d.path)}}return a}function mPe(i,e,t,n,r){let s=r.glyphs[i]||r.glyphs["?"];if(!s){console.error('THREE.Font: character "'+i+'" does not exists in font family '+r.familyName+".");return}let o=new rb,a,l,c,u,f,d,A,y;if(s.o){let w=s._cachedOutline||(s._cachedOutline=s.o.split(" "));for(let S=0,T=w.length;S<T;)switch(w[S++]){case"m":a=w[S++]*e+t,l=w[S++]*e+n,o.moveTo(a,l);break;case"l":a=w[S++]*e+t,l=w[S++]*e+n,o.lineTo(a,l);break;case"q":c=w[S++]*e+t,u=w[S++]*e+n,f=w[S++]*e+t,d=w[S++]*e+n,o.quadraticCurveTo(f,d,c,u);break;case"b":c=w[S++]*e+t,u=w[S++]*e+n,f=w[S++]*e+t,d=w[S++]*e+n,A=w[S++]*e+t,y=w[S++]*e+n,o.bezierCurveTo(f,d,A,y,c,u);break}}return{offsetX:s.ha*e,path:o}}var DS=class i extends z2{constructor(e,t={}){let n=t.font;if(n===void 0)super();else{let r=n.generateShapes(e,t.size,t.direction);t.depth===void 0&&(t.depth=50),t.bevelThickness===void 0&&(t.bevelThickness=10),t.bevelSize===void 0&&(t.bevelSize=8),t.bevelEnabled===void 0&&(t.bevelEnabled=!1),super(r,t)}this.type="TextGeometry"}toJSON(){return super.toJSON()}static fromJSON(e){let t=e.options;return t.font=new bx(t.font.data),new i(t.text,t)}};function bV(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 APe(i){if(Array.isArray(i))return i}function gPe(i){if(Array.isArray(i))return bV(i)}function boe(i,e,t){if(typeof i=="function"?i===e:i.has(e))return arguments.length<3?e:t;throw new TypeError("Private element is not present on this object")}function vPe(i){if(i===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return i}function hoe(i,e,t,n,r,s,o){try{var a=i[s](o),l=a.value}catch(c){return void t(c)}a.done?e(l):Promise.resolve(l).then(n,r)}function _Pe(i){return function(){var e=this,t=arguments;return new Promise(function(n,r){var s=i.apply(e,t);function o(l){hoe(s,n,r,o,a,"next",l)}function a(l){hoe(s,n,r,o,a,"throw",l)}o(void 0)})}}function WI(i,e,t){return e=Ex(e),CPe(i,CV()?Reflect.construct(e,t||[],Ex(i).constructor):e.apply(i,t))}function xPe(i,e){if(e.has(i))throw new TypeError("Cannot initialize the same private elements twice on an object")}function jI(i,e){if(!(i instanceof e))throw new TypeError("Cannot call a class as a function")}function NS(i,e){return i.get(boe(i,e))}function vV(i,e,t){xPe(i,e),e.set(i,t)}function _V(i,e,t){return i.set(boe(i,e),t),t}function MV(i,e,t){if(CV())return Reflect.construct.apply(null,arguments);var n=[null];n.push.apply(n,e);var r=new(i.bind.apply(i,n));return r}function yPe(i,e){for(var t=0;t<e.length;t++){var n=e[t];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(i,woe(n.key),n)}}function XI(i,e,t){return e&&yPe(i.prototype,e),Object.defineProperty(i,"prototype",{writable:!1}),i}function Eo(i,e,t){return(e=woe(e))in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function wV(){return wV=typeof Reflect<"u"&&Reflect.get?Reflect.get.bind():function(i,e,t){var n=RPe(i,e);if(n){var r=Object.getOwnPropertyDescriptor(n,e);return r.get?r.get.call(arguments.length<3?i:t):r.value}},wV.apply(null,arguments)}function Ex(i){return Ex=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},Ex(i)}function $I(i,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");i.prototype=Object.create(e&&e.prototype,{constructor:{value:i,writable:!0,configurable:!0}}),Object.defineProperty(i,"prototype",{writable:!1}),e&&TV(i,e)}function CV(){try{var i=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(CV=function(){return!!i})()}function bPe(i){if(typeof Symbol<"u"&&i[Symbol.iterator]!=null||i["@@iterator"]!=null)return Array.from(i)}function wPe(i,e){var t=i==null?null:typeof Symbol<"u"&&i[Symbol.iterator]||i["@@iterator"];if(t!=null){var n,r,s,o,a=[],l=!0,c=!1;try{if(s=(t=t.call(i)).next,e===0){if(Object(t)!==t)return;l=!1}else for(;!(l=(n=s.call(t)).done)&&(a.push(n.value),a.length!==e);l=!0);}catch(u){c=!0,r=u}finally{try{if(!l&&t.return!=null&&(o=t.return(),Object(o)!==o))return}finally{if(c)throw r}}return a}}function SPe(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.5098-In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function TPe(){throw new TypeError(`Invalid attempt to spread non-iterable instance.5099-In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function foe(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 $i(i){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?foe(Object(t),!0).forEach(function(n){Eo(i,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(t)):foe(Object(t)).forEach(function(n){Object.defineProperty(i,n,Object.getOwnPropertyDescriptor(t,n))})}return i}function EPe(i,e){if(i==null)return{};var t,n,r=MPe(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 MPe(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 CPe(i,e){if(e&&(typeof e=="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return vPe(i)}function SV(){var i,e,t=typeof Symbol=="function"?Symbol:{},n=t.iterator||"@@iterator",r=t.toStringTag||"@@toStringTag";function s(A,y,w,S){var T=y&&y.prototype instanceof a?y:a,R=Object.create(T.prototype);return dc(R,"_invoke",(function(P,I,F){var D,L,C,B=0,k=F||[],z=!1,G={p:0,n:0,v:i,a:W,f:W.bind(i,4),d:function(Y,H){return D=Y,L=0,C=i,G.n=H,o}};function W(Y,H){for(L=Y,C=H,e=0;!z&&B&&!$&&e<k.length;e++){var $,J=k[e],te=G.p,ce=J[2];Y>3?($=ce===H)&&(C=J[(L=J[4])?5:(L=3,3)],J[4]=J[5]=i):J[0]<=te&&(($=Y<2&&te<J[1])?(L=0,G.v=H,G.n=J[1]):te<ce&&($=Y<3||J[0]>H||H>ce)&&(J[4]=Y,J[5]=H,G.n=ce,L=0))}if($||Y>1)return o;throw z=!0,H}return function(Y,H,$){if(B>1)throw TypeError("Generator is already running");for(z&&H===1&&W(H,$),L=H,C=$;(e=L<2?i:C)||!z;){D||(L?L<3?(L>1&&(G.n=-1),W(L,C)):G.n=C:G.v=C);try{if(B=2,D){if(L||(Y="next"),e=D[Y]){if(!(e=e.call(D,C)))throw TypeError("iterator result is not an object");if(!e.done)return e;C=e.value,L<2&&(L=0)}else L===1&&(e=D.return)&&e.call(D),L<2&&(C=TypeError("The iterator does not provide a '"+Y+"' method"),L=1);D=i}else if((e=(z=G.n<0)?C:P.call(I,G))!==o)break}catch(J){D=i,L=1,C=J}finally{B=1}}return{value:e,done:z}}})(A,w,S),!0),R}var o={};function a(){}function l(){}function c(){}e=Object.getPrototypeOf;var u=[][n]?e(e([][n]())):(dc(e={},n,function(){return this}),e),f=c.prototype=a.prototype=Object.create(u);function d(A){return Object.setPrototypeOf?Object.setPrototypeOf(A,c):(A.__proto__=c,dc(A,r,"GeneratorFunction")),A.prototype=Object.create(f),A}return l.prototype=c,dc(f,"constructor",c),dc(c,"constructor",l),l.displayName="GeneratorFunction",dc(c,r,"GeneratorFunction"),dc(f),dc(f,r,"Generator"),dc(f,n,function(){return this}),dc(f,"toString",function(){return"[object Generator]"}),(SV=function(){return{w:s,m:d}})()}function dc(i,e,t,n){var r=Object.defineProperty;try{r({},"",{})}catch{r=0}dc=function(s,o,a,l){function c(u,f){dc(s,u,function(d){return this._invoke(u,f,d)})}o?r?r(s,o,{value:a,enumerable:!l,configurable:!l,writable:!l}):s[o]=a:(c("next",0),c("throw",1),c("return",2))},dc(i,e,t,n)}function TV(i,e){return TV=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,n){return t.__proto__=n,t},TV(i,e)}function Ir(i,e){return APe(i)||wPe(i,e)||Soe(i,e)||SPe()}function RPe(i,e){for(;!{}.hasOwnProperty.call(i,e)&&(i=Ex(i))!==null;);return i}function xV(i,e,t,n){var r=wV(Ex(i.prototype),e,t);return typeof r=="function"?function(s){return r.apply(t,s)}:r}function tr(i){return gPe(i)||bPe(i)||Soe(i)||TPe()}function IPe(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 woe(i){var e=IPe(i,"string");return typeof e=="symbol"?e:e+""}function Soe(i,e){if(i){if(typeof i=="string")return bV(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)?bV(i,e):void 0}}var Toe=function(e){e instanceof Array?e.forEach(Toe):(e.map&&e.map.dispose(),e.dispose())},Sm=function(e){e.geometry&&e.geometry.dispose(),e.material&&Toe(e.material),e.texture&&e.texture.dispose(),e.children&&e.children.forEach(Sm)},ns=function(e){if(e&&e.children)for(;e.children.length;){var t=e.children[0];e.remove(t),Sm(t)}};function tl(i,e){var t=new e;return{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 vr=100;function doe(){return vr}function ou(i,e){var t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,n=(90-i)*Math.PI/180,r=(90-e)*Math.PI/180,s=vr*(1+t),o=Math.sin(n);return{x:s*o*Math.cos(r),y:s*Math.cos(n),z:s*o*Math.sin(r)}}function Eoe(i){var e=i.x,t=i.y,n=i.z,r=Math.sqrt(e*e+t*t+n*n),s=Math.acos(t/r),o=Math.atan2(n,e);return{lat:90-s*180/Math.PI,lng:90-o*180/Math.PI-(o<-Math.PI/2?360:0),altitude:r/vr-1}}function c1(i){return i*Math.PI/180}var BS=window.THREE?window.THREE:{BackSide:mi,BufferAttribute:Hi,Color:zt,Mesh:Hn,ShaderMaterial:ds},PPe=`5096+ `};var Rf=class extends ds{constructor(e){super({type:"LineMaterial",uniforms:dg.clone(Ha.line.uniforms),vertexShader:Ha.line.vertexShader,fragmentShader:Ha.line.fragmentShader,clipping:!0}),this.isLineMaterial=!0,this.setValues(e)}get color(){return this.uniforms.diffuse.value}set color(e){this.uniforms.diffuse.value=e}get worldUnits(){return"WORLD_UNITS"in this.defines}set worldUnits(e){e===!0!==this.worldUnits&&(this.needsUpdate=!0),e===!0?this.defines.WORLD_UNITS="":delete this.defines.WORLD_UNITS}get linewidth(){return this.uniforms.linewidth.value}set linewidth(e){this.uniforms.linewidth&&(this.uniforms.linewidth.value=e)}get dashed(){return"USE_DASH"in this.defines}set dashed(e){e===!0!==this.dashed&&(this.needsUpdate=!0),e===!0?this.defines.USE_DASH="":delete this.defines.USE_DASH}get dashScale(){return this.uniforms.dashScale.value}set dashScale(e){this.uniforms.dashScale.value=e}get dashSize(){return this.uniforms.dashSize.value}set dashSize(e){this.uniforms.dashSize.value=e}get dashOffset(){return this.uniforms.dashOffset.value}set dashOffset(e){this.uniforms.dashOffset.value=e}get gapSize(){return this.uniforms.gapSize.value}set gapSize(e){this.uniforms.gapSize.value=e}get opacity(){return this.uniforms.opacity.value}set opacity(e){this.uniforms&&(this.uniforms.opacity.value=e)}get resolution(){return this.uniforms.resolution.value}set resolution(e){this.uniforms.resolution.value.copy(e)}get alphaToCoverage(){return"USE_ALPHA_TO_COVERAGE"in this.defines}set alphaToCoverage(e){this.defines&&(e===!0!==this.alphaToCoverage&&(this.needsUpdate=!0),e===!0?this.defines.USE_ALPHA_TO_COVERAGE="":delete this.defines.USE_ALPHA_TO_COVERAGE)}};var BV=new xn,Loe=new re,Doe=new re,Qo=new xn,Jo=new xn,Pf=new xn,OV=new re,UV=new cn,ea=new cb,Noe=new re,HP=new ka,WP=new yl,If=new xn,Lf,f1;function Foe(i,e,t){return If.set(0,0,-e,1).applyMatrix4(i.projectionMatrix),If.multiplyScalar(1/If.w),If.x=f1/t.width,If.y=f1/t.height,If.applyMatrix4(i.projectionMatrixInverse),If.multiplyScalar(1/If.w),Math.abs(Math.max(If.x,If.y))}function XIe(i,e){let t=i.matrixWorld,n=i.geometry,r=n.attributes.instanceStart,s=n.attributes.instanceEnd,o=Math.min(n.instanceCount,r.count);for(let a=0,l=o;a<l;a++){ea.start.fromBufferAttribute(r,a),ea.end.fromBufferAttribute(s,a),ea.applyMatrix4(t);let c=new re,u=new re;Lf.distanceSqToSegment(ea.start,ea.end,u,c),u.distanceTo(c)<f1*.5&&e.push({point:u,pointOnLine:c,distance:Lf.origin.distanceTo(u),object:i,face:null,faceIndex:a,uv:null,uv1:null})}}function $Ie(i,e,t){let n=e.projectionMatrix,s=i.material.resolution,o=i.matrixWorld,a=i.geometry,l=a.attributes.instanceStart,c=a.attributes.instanceEnd,u=Math.min(a.instanceCount,l.count),f=-e.near;Lf.at(1,Pf),Pf.w=1,Pf.applyMatrix4(e.matrixWorldInverse),Pf.applyMatrix4(n),Pf.multiplyScalar(1/Pf.w),Pf.x*=s.x/2,Pf.y*=s.y/2,Pf.z=0,OV.copy(Pf),UV.multiplyMatrices(e.matrixWorldInverse,o);for(let d=0,A=u;d<A;d++){if(Qo.fromBufferAttribute(l,d),Jo.fromBufferAttribute(c,d),Qo.w=1,Jo.w=1,Qo.applyMatrix4(UV),Jo.applyMatrix4(UV),Qo.z>f&&Jo.z>f)continue;if(Qo.z>f){let I=Qo.z-Jo.z,P=(Qo.z-f)/I;Qo.lerp(Jo,P)}else if(Jo.z>f){let I=Jo.z-Qo.z,P=(Jo.z-f)/I;Jo.lerp(Qo,P)}Qo.applyMatrix4(n),Jo.applyMatrix4(n),Qo.multiplyScalar(1/Qo.w),Jo.multiplyScalar(1/Jo.w),Qo.x*=s.x/2,Qo.y*=s.y/2,Jo.x*=s.x/2,Jo.y*=s.y/2,ea.start.copy(Qo),ea.start.z=0,ea.end.copy(Jo),ea.end.z=0;let w=ea.closestPointToPointParameter(OV,!0);ea.at(w,Noe);let S=Bu.lerp(Qo.z,Jo.z,w),T=S>=-1&&S<=1,R=OV.distanceTo(Noe)<f1*.5;if(T&&R){ea.start.fromBufferAttribute(l,d),ea.end.fromBufferAttribute(c,d),ea.start.applyMatrix4(o),ea.end.applyMatrix4(o);let I=new re,P=new re;Lf.distanceSqToSegment(ea.start,ea.end,P,I),t.push({point:P,pointOnLine:I,distance:Lf.origin.distanceTo(P),object:i,face:null,faceIndex:d,uv:null,uv1:null})}}}var jP=class extends Hn{constructor(e=new Ex,t=new Rf({color:Math.random()*16777215})){super(e,t),this.isLineSegments2=!0,this.type="LineSegments2"}computeLineDistances(){let e=this.geometry,t=e.attributes.instanceStart,n=e.attributes.instanceEnd,r=new Float32Array(2*t.count);for(let o=0,a=0,l=t.count;o<l;o++,a+=2)Loe.fromBufferAttribute(t,o),Doe.fromBufferAttribute(n,o),r[a]=a===0?0:r[a-1],r[a+1]=r[a]+Loe.distanceTo(Doe);let s=new Lh(r,2,1);return e.setAttribute("instanceDistanceStart",new Vo(s,1,0)),e.setAttribute("instanceDistanceEnd",new Vo(s,1,1)),this}raycast(e,t){let n=this.material.worldUnits,r=e.camera;if(r===null&&!n&&console.error('LineSegments2: "Raycaster.camera" needs to be set in order to raycast against LineSegments2 while worldUnits is set to false.'),n===!1&&(this.material.resolution.x===0||this.material.resolution.y===0))return;let s=e.params.Line2!==void 0&&e.params.Line2.threshold||0;Lf=e.ray;let o=this.matrixWorld,a=this.geometry,l=this.material;f1=l.linewidth+s,a.boundingSphere===null&&a.computeBoundingSphere(),WP.copy(a.boundingSphere).applyMatrix4(o);let c;if(n)c=f1*.5;else{let f=Math.max(r.near,WP.distanceToPoint(Lf.origin));c=Foe(r,f,l.resolution)}if(WP.radius+=c,Lf.intersectsSphere(WP)===!1)return;a.boundingBox===null&&a.computeBoundingBox(),HP.copy(a.boundingBox).applyMatrix4(o);let u;if(n)u=f1*.5;else{let f=Math.max(r.near,HP.distanceToPoint(Lf.origin));u=Foe(r,f,l.resolution)}HP.expandByScalar(u),Lf.intersectsBox(HP)!==!1&&(n?XIe(this,t):$Ie(this,r,t))}onBeforeRender(e){let t=this.material.uniforms;t&&t.resolution&&(e.getViewport(BV),this.material.uniforms.resolution.value.set(BV.z,BV.w))}};var Tm=class extends Ex{constructor(){super(),this.isLineGeometry=!0,this.type="LineGeometry"}setPositions(e){let t=e.length-3,n=new Float32Array(2*t);for(let r=0;r<t;r+=3)n[2*r]=e[r],n[2*r+1]=e[r+1],n[2*r+2]=e[r+2],n[2*r+3]=e[r+3],n[2*r+4]=e[r+4],n[2*r+5]=e[r+5];return super.setPositions(n),this}setColors(e){let t=e.length-3,n=new Float32Array(2*t);for(let r=0;r<t;r+=3)n[2*r]=e[r],n[2*r+1]=e[r+1],n[2*r+2]=e[r+2],n[2*r+3]=e[r+3],n[2*r+4]=e[r+4],n[2*r+5]=e[r+5];return super.setColors(n),this}setFromPoints(e){let t=e.length-1,n=new Float32Array(6*t);for(let r=0;r<t;r++)n[6*r]=e[r].x,n[6*r+1]=e[r].y,n[6*r+2]=e[r].z||0,n[6*r+3]=e[r+1].x,n[6*r+4]=e[r+1].y,n[6*r+5]=e[r+1].z||0;return super.setPositions(n),this}fromLine(e){let t=e.geometry;return this.setPositions(t.attributes.position.array),this}};var Mx=class extends jP{constructor(e=new Tm,t=new Rf({color:Math.random()*16777215})){super(e,t),this.isLine2=!0,this.type="Line2"}};var Cx=class{constructor(e){this.isFont=!0,this.type="Font",this.data=e}generateShapes(e,t=100,n="ltr"){let r=[],s=YIe(e,t,this.data,n);for(let o=0,a=s.length;o<a;o++)r.push(...s[o].toShapes());return r}};function YIe(i,e,t,n){let r=Array.from(i),s=e/t.resolution,o=(t.boundingBox.yMax-t.boundingBox.yMin+t.underlineThickness)*s,a=[],l=0,c=0;(n=="rtl"||n=="tb")&&r.reverse();for(let u=0;u<r.length;u++){let f=r[u];if(f===`5097+`)l=0,c-=o;else{let d=ZIe(f,s,l,c,t);n=="tb"?(l=0,c+=t.ascender*s):l+=d.offsetX,a.push(d.path)}}return a}function ZIe(i,e,t,n,r){let s=r.glyphs[i]||r.glyphs["?"];if(!s){console.error('THREE.Font: character "'+i+'" does not exists in font family '+r.familyName+".");return}let o=new ub,a,l,c,u,f,d,A,y;if(s.o){let w=s._cachedOutline||(s._cachedOutline=s.o.split(" "));for(let S=0,T=w.length;S<T;)switch(w[S++]){case"m":a=w[S++]*e+t,l=w[S++]*e+n,o.moveTo(a,l);break;case"l":a=w[S++]*e+t,l=w[S++]*e+n,o.lineTo(a,l);break;case"q":c=w[S++]*e+t,u=w[S++]*e+n,f=w[S++]*e+t,d=w[S++]*e+n,o.quadraticCurveTo(f,d,c,u);break;case"b":c=w[S++]*e+t,u=w[S++]*e+n,f=w[S++]*e+t,d=w[S++]*e+n,A=w[S++]*e+t,y=w[S++]*e+n,o.bezierCurveTo(f,d,A,y,c,u);break}}return{offsetX:s.ha*e,path:o}}var kS=class i extends j2{constructor(e,t={}){let n=t.font;if(n===void 0)super();else{let r=n.generateShapes(e,t.size,t.direction);t.depth===void 0&&(t.depth=50),t.bevelThickness===void 0&&(t.bevelThickness=10),t.bevelSize===void 0&&(t.bevelSize=8),t.bevelEnabled===void 0&&(t.bevelEnabled=!1),super(r,t)}this.type="TextGeometry"}toJSON(){return super.toJSON()}static fromJSON(e){let t=e.options;return t.font=new Cx(t.font.data),new i(t.text,t)}};function qV(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 KIe(i){if(Array.isArray(i))return i}function QIe(i){if(Array.isArray(i))return qV(i)}function Xoe(i,e,t){if(typeof i=="function"?i===e:i.has(e))return arguments.length<3?e:t;throw new TypeError("Private element is not present on this object")}function JIe(i){if(i===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return i}function Boe(i,e,t,n,r,s,o){try{var a=i[s](o),l=a.value}catch(c){return void t(c)}a.done?e(l):Promise.resolve(l).then(n,r)}function eLe(i){return function(){var e=this,t=arguments;return new Promise(function(n,r){var s=i.apply(e,t);function o(l){Boe(s,n,r,o,a,"next",l)}function a(l){Boe(s,n,r,o,a,"throw",l)}o(void 0)})}}function JP(i,e,t){return e=Lx(e),cLe(i,YV()?Reflect.construct(e,t||[],Lx(i).constructor):e.apply(i,t))}function tLe(i,e){if(e.has(i))throw new TypeError("Cannot initialize the same private elements twice on an object")}function eI(i,e){if(!(i instanceof e))throw new TypeError("Cannot call a class as a function")}function zS(i,e){return i.get(Xoe(i,e))}function kV(i,e,t){tLe(i,e),e.set(i,t)}function zV(i,e,t){return i.set(Xoe(i,e),t),t}function $V(i,e,t){if(YV())return Reflect.construct.apply(null,arguments);var n=[null];n.push.apply(n,e);var r=new(i.bind.apply(i,n));return r}function nLe(i,e){for(var t=0;t<e.length;t++){var n=e[t];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(i,$oe(n.key),n)}}function tI(i,e,t){return e&&nLe(i.prototype,e),Object.defineProperty(i,"prototype",{writable:!1}),i}function Eo(i,e,t){return(e=$oe(e))in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function HV(){return HV=typeof Reflect<"u"&&Reflect.get?Reflect.get.bind():function(i,e,t){var n=uLe(i,e);if(n){var r=Object.getOwnPropertyDescriptor(n,e);return r.get?r.get.call(arguments.length<3?i:t):r.value}},HV.apply(null,arguments)}function Lx(i){return Lx=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},Lx(i)}function nI(i,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");i.prototype=Object.create(e&&e.prototype,{constructor:{value:i,writable:!0,configurable:!0}}),Object.defineProperty(i,"prototype",{writable:!1}),e&&jV(i,e)}function YV(){try{var i=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(YV=function(){return!!i})()}function iLe(i){if(typeof Symbol<"u"&&i[Symbol.iterator]!=null||i["@@iterator"]!=null)return Array.from(i)}function rLe(i,e){var t=i==null?null:typeof Symbol<"u"&&i[Symbol.iterator]||i["@@iterator"];if(t!=null){var n,r,s,o,a=[],l=!0,c=!1;try{if(s=(t=t.call(i)).next,e===0){if(Object(t)!==t)return;l=!1}else for(;!(l=(n=s.call(t)).done)&&(a.push(n.value),a.length!==e);l=!0);}catch(u){c=!0,r=u}finally{try{if(!l&&t.return!=null&&(o=t.return(),Object(o)!==o))return}finally{if(c)throw r}}return a}}function sLe(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.5098+In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function oLe(){throw new TypeError(`Invalid attempt to spread non-iterable instance.5099+In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Ooe(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 $i(i){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Ooe(Object(t),!0).forEach(function(n){Eo(i,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(t)):Ooe(Object(t)).forEach(function(n){Object.defineProperty(i,n,Object.getOwnPropertyDescriptor(t,n))})}return i}function aLe(i,e){if(i==null)return{};var t,n,r=lLe(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 lLe(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 cLe(i,e){if(e&&(typeof e=="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return JIe(i)}function WV(){var i,e,t=typeof Symbol=="function"?Symbol:{},n=t.iterator||"@@iterator",r=t.toStringTag||"@@toStringTag";function s(A,y,w,S){var T=y&&y.prototype instanceof a?y:a,R=Object.create(T.prototype);return Ac(R,"_invoke",(function(I,P,F){var D,L,C,B=0,k=F||[],z=!1,G={p:0,n:0,v:i,a:W,f:W.bind(i,4),d:function(Y,H){return D=Y,L=0,C=i,G.n=H,o}};function W(Y,H){for(L=Y,C=H,e=0;!z&&B&&!$&&e<k.length;e++){var $,J=k[e],te=G.p,ce=J[2];Y>3?($=ce===H)&&(C=J[(L=J[4])?5:(L=3,3)],J[4]=J[5]=i):J[0]<=te&&(($=Y<2&&te<J[1])?(L=0,G.v=H,G.n=J[1]):te<ce&&($=Y<3||J[0]>H||H>ce)&&(J[4]=Y,J[5]=H,G.n=ce,L=0))}if($||Y>1)return o;throw z=!0,H}return function(Y,H,$){if(B>1)throw TypeError("Generator is already running");for(z&&H===1&&W(H,$),L=H,C=$;(e=L<2?i:C)||!z;){D||(L?L<3?(L>1&&(G.n=-1),W(L,C)):G.n=C:G.v=C);try{if(B=2,D){if(L||(Y="next"),e=D[Y]){if(!(e=e.call(D,C)))throw TypeError("iterator result is not an object");if(!e.done)return e;C=e.value,L<2&&(L=0)}else L===1&&(e=D.return)&&e.call(D),L<2&&(C=TypeError("The iterator does not provide a '"+Y+"' method"),L=1);D=i}else if((e=(z=G.n<0)?C:I.call(P,G))!==o)break}catch(J){D=i,L=1,C=J}finally{B=1}}return{value:e,done:z}}})(A,w,S),!0),R}var o={};function a(){}function l(){}function c(){}e=Object.getPrototypeOf;var u=[][n]?e(e([][n]())):(Ac(e={},n,function(){return this}),e),f=c.prototype=a.prototype=Object.create(u);function d(A){return Object.setPrototypeOf?Object.setPrototypeOf(A,c):(A.__proto__=c,Ac(A,r,"GeneratorFunction")),A.prototype=Object.create(f),A}return l.prototype=c,Ac(f,"constructor",c),Ac(c,"constructor",l),l.displayName="GeneratorFunction",Ac(c,r,"GeneratorFunction"),Ac(f),Ac(f,r,"Generator"),Ac(f,n,function(){return this}),Ac(f,"toString",function(){return"[object Generator]"}),(WV=function(){return{w:s,m:d}})()}function Ac(i,e,t,n){var r=Object.defineProperty;try{r({},"",{})}catch{r=0}Ac=function(s,o,a,l){function c(u,f){Ac(s,u,function(d){return this._invoke(u,f,d)})}o?r?r(s,o,{value:a,enumerable:!l,configurable:!l,writable:!l}):s[o]=a:(c("next",0),c("throw",1),c("return",2))},Ac(i,e,t,n)}function jV(i,e){return jV=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,n){return t.__proto__=n,t},jV(i,e)}function Ir(i,e){return KIe(i)||rLe(i,e)||Yoe(i,e)||sLe()}function uLe(i,e){for(;!{}.hasOwnProperty.call(i,e)&&(i=Lx(i))!==null;);return i}function VV(i,e,t,n){var r=HV(Lx(i.prototype),e,t);return typeof r=="function"?function(s){return r.apply(t,s)}:r}function tr(i){return QIe(i)||iLe(i)||Yoe(i)||oLe()}function hLe(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 $oe(i){var e=hLe(i,"string");return typeof e=="symbol"?e:e+""}function Yoe(i,e){if(i){if(typeof i=="string")return qV(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)?qV(i,e):void 0}}var Zoe=function(e){e instanceof Array?e.forEach(Zoe):(e.map&&e.map.dispose(),e.dispose())},Cm=function(e){e.geometry&&e.geometry.dispose(),e.material&&Zoe(e.material),e.texture&&e.texture.dispose(),e.children&&e.children.forEach(Cm)},is=function(e){if(e&&e.children)for(;e.children.length;){var t=e.children[0];e.remove(t),Cm(t)}};function nl(i,e){var t=new e;return{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 _r=100;function Uoe(){return _r}function ou(i,e){var t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,n=(90-i)*Math.PI/180,r=(90-e)*Math.PI/180,s=_r*(1+t),o=Math.sin(n);return{x:s*o*Math.cos(r),y:s*Math.cos(n),z:s*o*Math.sin(r)}}function Koe(i){var e=i.x,t=i.y,n=i.z,r=Math.sqrt(e*e+t*t+n*n),s=Math.acos(t/r),o=Math.atan2(n,e);return{lat:90-s*180/Math.PI,lng:90-o*180/Math.PI-(o<-Math.PI/2?360:0),altitude:r/_r-1}}function p1(i){return i*Math.PI/180}var GS=window.THREE?window.THREE:{BackSide:mi,BufferAttribute:Hi,Color:zt,Mesh:Hn,ShaderMaterial:ds},fLe=`51005100 uniform float hollowRadius;51015101 51025102 varying vec3 vVertexWorldPosition;@@ -5116,7 +5116,7 @@ void main() {
51165116 vVertexAngularDistanceToHollowRadius = vertexAngle - edgeAngle;51175117 51185118 gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);5119-}`,LPe=`5119+}`,dLe=`51205120 uniform vec3 color;51215121 uniform float coefficient;51225122 uniform float power;@@ -5139,7 +5139,7 @@ void main() {
51395139 power51405140 );51415141 gl_FragColor = vec4(color, intensity);5142-}`;function DPe(i,e,t,n){return new BS.ShaderMaterial({depthWrite:!1,transparent:!0,vertexShader:PPe,fragmentShader:LPe,uniforms:{coefficient:{value:i},color:{value:new BS.Color(e)},power:{value:t},hollowRadius:{value:n}}})}function NPe(i,e){for(var t=i.clone(),n=new Float32Array(i.attributes.position.count*3),r=0,s=n.length;r<s;r++){var o=i.attributes.normal.array[r],a=i.attributes.position.array[r];n[r]=a+o*e}return t.setAttribute("position",new BS.BufferAttribute(n,3)),t}var FPe=(function(i){function e(t){var n,r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},s=r.color,o=s===void 0?"gold":s,a=r.size,l=a===void 0?2:a,c=r.coefficient,u=c===void 0?.5:c,f=r.power,d=f===void 0?1:f,A=r.hollowRadius,y=A===void 0?0:A,w=r.backside,S=w===void 0?!0:w;jI(this,e),n=WI(this,e);var T=NPe(t,l),R=DPe(u,o,d,y);return S&&(R.side=BS.BackSide),n.geometry=T,n.material=R,n}return $I(e,i),XI(e)})(BS.Mesh),Df=window.THREE?window.THREE:{Color:zt,Group:Br,LineBasicMaterial:Pu,LineSegments:Xv,Mesh:Hn,MeshPhongMaterial:WA,SphereGeometry:za,SRGBColorSpace:Fr,TextureLoader:yl},Moe=Kr({props:{globeImageUrl:{},bumpImageUrl:{},showGlobe:{default:!0,onChange:function(e,t){t.globeGroup.visible=!!e},triggerUpdate:!1},showGraticules:{default:!1,onChange:function(e,t){t.graticulesObj.visible=!!e},triggerUpdate:!1},showAtmosphere:{default:!0,onChange:function(e,t){t.atmosphereObj&&(t.atmosphereObj.visible=!!e)},triggerUpdate:!1},atmosphereColor:{default:"lightskyblue"},atmosphereAltitude:{default:.15},globeCurvatureResolution:{default:4},globeTileEngineUrl:{onChange:function(e,t){t.tileEngine.tileUrl=e}},globeTileEngineMaxLevel:{default:17,onChange:function(e,t){t.tileEngine.maxLevel=e},triggerUpdate:!1},updatePov:{onChange:function(e,t){t.tileEngine.updatePov(e)},triggerUpdate:!1},onReady:{default:function(){},triggerUpdate:!1}},methods:{globeMaterial:function(e,t){return t!==void 0?(e.globeObj.material=t||e.defaultGlobeMaterial,this):e.globeObj.material},globeTileEngineClearCache:function(e){e.tileEngine.clearTiles()},_destructor:function(e){Sm(e.globeObj),Sm(e.tileEngine),Sm(e.graticulesObj)}},stateInit:function(){var e=new Df.MeshPhongMaterial({color:0}),t=new Df.Mesh(void 0,e);t.rotation.y=-Math.PI/2;var n=new sJ(vr),r=new Df.Group;r.__globeObjType="globe",r.add(t),r.add(n);var s=new Df.LineSegments(new WB(AB(),vr,2),new Df.LineBasicMaterial({color:"lightgrey",transparent:!0,opacity:.1}));return{globeGroup:r,globeObj:t,graticulesObj:s,defaultGlobeMaterial:e,tileEngine:n}},init:function(e,t){ns(e),t.scene=e,t.scene.add(t.globeGroup),t.scene.add(t.graticulesObj),t.ready=!1},update:function(e,t){var n=e.globeObj.material;if(e.tileEngine.visible=!(e.globeObj.visible=!e.globeTileEngineUrl),t.hasOwnProperty("globeCurvatureResolution")){var r;(r=e.globeObj.geometry)===null||r===void 0||r.dispose();var s=Math.max(4,Math.round(360/e.globeCurvatureResolution));e.globeObj.geometry=new Df.SphereGeometry(vr,s,s/2),e.tileEngine.curvatureResolution=e.globeCurvatureResolution}if(t.hasOwnProperty("globeImageUrl")&&(e.globeImageUrl?new Df.TextureLoader().load(e.globeImageUrl,function(a){var l;a.colorSpace=Df.SRGBColorSpace,(l=n.map)===null||l===void 0||l.dispose(),n.map=a,n.color=null,n.needsUpdate=!0,!e.ready&&(e.ready=!0)&&setTimeout(e.onReady)}):!n.color&&(n.color=new Df.Color(0))),t.hasOwnProperty("bumpImageUrl")&&(e.bumpImageUrl?e.bumpImageUrl&&new Df.TextureLoader().load(e.bumpImageUrl,function(a){var l;(l=n.bumpMap)===null||l===void 0||l.dispose(),n.bumpMap=a,n.needsUpdate=!0}):(n.bumpMap=null,n.needsUpdate=!0)),(t.hasOwnProperty("atmosphereColor")||t.hasOwnProperty("atmosphereAltitude"))&&(e.atmosphereObj&&(e.scene.remove(e.atmosphereObj),Sm(e.atmosphereObj)),e.atmosphereColor&&e.atmosphereAltitude)){var o=e.atmosphereObj=new FPe(e.globeObj.geometry,{color:e.atmosphereColor,size:vr*e.atmosphereAltitude,hollowRadius:vr,coefficient:.1,power:3.5});o.visible=!!e.showAtmosphere,o.__globeObjType="atmosphere",e.scene.add(o)}!e.ready&&(!e.globeImageUrl||e.globeTileEngineUrl)&&(e.ready=!0,e.onReady())}}),Nf=function(e){return isNaN(e)?parseInt(An(e).toHex(),16):e},th=function(e){return e&&isNaN(e)?Uu(e).opacity:1},Tm=function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,r,s=1,o=/^rgba\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*,\s*([\d.eE+-]+)\s*\)$/.exec(e.trim().toLowerCase());if(o){var a=o.slice(1),l=Ir(a,4),c=l[0],u=l[1],f=l[2],d=l[3];r=new zt("rgb(".concat(+c,",").concat(+u,",").concat(+f,")")),s=Math.min(+d,1)}else r=new zt(e);n&&r.convertLinearToSRGB();var A=r.toArray();return t?[].concat(tr(A),[s]):A};function BPe(i,e,t){return i.opacity=e,i.transparent=e<1,i.depthWrite=e>=1,i}var poe=window.THREE?window.THREE:{BufferAttribute:Hi};function Ff(i){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Float32Array;if(e===1)return new poe.BufferAttribute(new t(i),e);for(var n=new poe.BufferAttribute(new t(i.length*e),e),r=0,s=i.length;r<s;r++)n.set(i[r],r*e);return n}function OPe(i){for(var e=i.itemSize,t=[],n=0;n<i.count;n++)t.push(i.array.slice(n*e,(n+1)*e));return t}var yV=new WeakMap,kI=new WeakMap,zI=new WeakMap,Pl=(function(i){function e(t){var n,r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},s=r.dataBindAttr,o=s===void 0?"__data":s,a=r.objBindAttr,l=a===void 0?"__threeObj":a,c=r.removeDelay,u=c===void 0?0:c;return jI(this,e),n=WI(this,e),Eo(n,"scene",void 0),vV(n,yV,void 0),vV(n,kI,void 0),vV(n,zI,void 0),n.scene=t,_V(yV,n,o),_V(kI,n,l),_V(zI,n,u),n.onRemoveObj(function(){}),n}return $I(e,i),XI(e,[{key:"onCreateObj",value:function(n){var r=this;return xV(e,"onCreateObj",this)([function(s){var o=n(s);return s[NS(kI,r)]=o,o[NS(yV,r)]=s,r.scene.add(o),o}]),this}},{key:"onRemoveObj",value:function(n){var r=this;return xV(e,"onRemoveObj",this)([function(s,o){var a=xV(e,"getData",r)([s]);n(s,o);var l=function(){r.scene.remove(s),Sm(s),delete a[NS(kI,r)]};NS(zI,r)?setTimeout(l,NS(zI,r)):l()}]),this}}])})(MJ),Qu=window.THREE?window.THREE:{BufferGeometry:Xn,CylinderGeometry:VA,Matrix4:cn,Mesh:Hn,MeshLambertMaterial:Va,Object3D:lr,Vector3:re},moe=Object.assign({},Aw),Aoe=moe.BufferGeometryUtils||moe,Coe=Kr({props:{pointsData:{default:[]},pointLat:{default:"lat"},pointLng:{default:"lng"},pointColor:{default:function(){return"#ffffaa"}},pointAltitude:{default:.1},pointRadius:{default:.25},pointResolution:{default:12,triggerUpdate:!1},pointsMerge:{default:!1},pointsTransitionDuration:{default:1e3,triggerUpdate:!1}},init:function(e,t,n){var r=n.tweenGroup;ns(e),t.scene=e,t.tweenGroup=r,t.dataMapper=new Pl(e,{objBindAttr:"__threeObjPoint"})},update:function(e,t){var n=st(e.pointLat),r=st(e.pointLng),s=st(e.pointAltitude),o=st(e.pointRadius),a=st(e.pointColor),l=new Qu.CylinderGeometry(1,1,1,e.pointResolution);l.applyMatrix4(new Qu.Matrix4().makeRotationX(Math.PI/2)),l.applyMatrix4(new Qu.Matrix4().makeTranslation(0,0,-.5));var c=2*Math.PI*vr/360,u={};if(!e.pointsMerge&&t.hasOwnProperty("pointsMerge")&&ns(e.scene),e.dataMapper.scene=e.pointsMerge?new Qu.Object3D:e.scene,e.dataMapper.onCreateObj(A).onUpdateObj(y).digest(e.pointsData),e.pointsMerge){var f=e.pointsData.length?(Aoe.mergeGeometries||Aoe.mergeBufferGeometries)(e.pointsData.map(function(w){var S=e.dataMapper.getObj(w),T=S.geometry.clone();S.updateMatrix(),T.applyMatrix4(S.matrix);var R=Tm(a(w));return T.setAttribute("color",Ff(Array(T.getAttribute("position").count).fill(R),4)),T})):new Qu.BufferGeometry,d=new Qu.Mesh(f,new Qu.MeshLambertMaterial({color:16777215,transparent:!0,vertexColors:!0}));d.__globeObjType="points",d.__data=e.pointsData,e.dataMapper.clear(),ns(e.scene),e.scene.add(d)}function A(){var w=new Qu.Mesh(l);return w.__globeObjType="point",w}function y(w,S){var T=function(C){var B=w.__currentTargetD=C,k=B.r,z=B.alt,G=B.lat,W=B.lng;Object.assign(w.position,ou(G,W));var Y=e.pointsMerge?new Qu.Vector3(0,0,0):e.scene.localToWorld(new Qu.Vector3(0,0,0));w.lookAt(Y),w.scale.x=w.scale.y=Math.min(30,k)*c,w.scale.z=Math.max(z*vr,.1)},R={alt:+s(S),r:+o(S),lat:+n(S),lng:+r(S)},P=w.__currentTargetD||Object.assign({},R,{alt:-.001});if(Object.keys(R).some(function(L){return P[L]!==R[L]})&&(e.pointsMerge||!e.pointsTransitionDuration||e.pointsTransitionDuration<0?T(R):e.tweenGroup.add(new uo(P).to(R,e.pointsTransitionDuration).easing(Qr.Quadratic.InOut).onUpdate(T).onComplete(function(){e.tweenGroup.remove(this)}).start())),!e.pointsMerge){var I=a(S),F=I?th(I):0,D=!!F;w.visible=D,D&&(u.hasOwnProperty(I)||(u[I]=new Qu.MeshLambertMaterial({color:Nf(I),transparent:F<1,opacity:F})),w.material=u[I])}}}}),Roe=function(){return{uniforms:{dashOffset:{value:0},dashSize:{value:1},gapSize:{value:0},dashTranslate:{value:0}},vertexShader:`5142+}`;function pLe(i,e,t,n){return new GS.ShaderMaterial({depthWrite:!1,transparent:!0,vertexShader:fLe,fragmentShader:dLe,uniforms:{coefficient:{value:i},color:{value:new GS.Color(e)},power:{value:t},hollowRadius:{value:n}}})}function mLe(i,e){for(var t=i.clone(),n=new Float32Array(i.attributes.position.count*3),r=0,s=n.length;r<s;r++){var o=i.attributes.normal.array[r],a=i.attributes.position.array[r];n[r]=a+o*e}return t.setAttribute("position",new GS.BufferAttribute(n,3)),t}var ALe=(function(i){function e(t){var n,r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},s=r.color,o=s===void 0?"gold":s,a=r.size,l=a===void 0?2:a,c=r.coefficient,u=c===void 0?.5:c,f=r.power,d=f===void 0?1:f,A=r.hollowRadius,y=A===void 0?0:A,w=r.backside,S=w===void 0?!0:w;eI(this,e),n=JP(this,e);var T=mLe(t,l),R=pLe(u,o,d,y);return S&&(R.side=GS.BackSide),n.geometry=T,n.material=R,n}return nI(e,i),tI(e)})(GS.Mesh),Df=window.THREE?window.THREE:{Color:zt,Group:Br,LineBasicMaterial:Iu,LineSegments:Jv,Mesh:Hn,MeshPhongMaterial:ZA,SphereGeometry:Va,SRGBColorSpace:Fr,TextureLoader:bl},Qoe=Qr({props:{globeImageUrl:{},bumpImageUrl:{},showGlobe:{default:!0,onChange:function(e,t){t.globeGroup.visible=!!e},triggerUpdate:!1},showGraticules:{default:!1,onChange:function(e,t){t.graticulesObj.visible=!!e},triggerUpdate:!1},showAtmosphere:{default:!0,onChange:function(e,t){t.atmosphereObj&&(t.atmosphereObj.visible=!!e)},triggerUpdate:!1},atmosphereColor:{default:"lightskyblue"},atmosphereAltitude:{default:.15},globeCurvatureResolution:{default:4},globeTileEngineUrl:{onChange:function(e,t){t.tileEngine.tileUrl=e}},globeTileEngineMaxLevel:{default:17,onChange:function(e,t){t.tileEngine.maxLevel=e},triggerUpdate:!1},updatePov:{onChange:function(e,t){t.tileEngine.updatePov(e)},triggerUpdate:!1},onReady:{default:function(){},triggerUpdate:!1}},methods:{globeMaterial:function(e,t){return t!==void 0?(e.globeObj.material=t||e.defaultGlobeMaterial,this):e.globeObj.material},globeTileEngineClearCache:function(e){e.tileEngine.clearTiles()},_destructor:function(e){Cm(e.globeObj),Cm(e.tileEngine),Cm(e.graticulesObj)}},stateInit:function(){var e=new Df.MeshPhongMaterial({color:0}),t=new Df.Mesh(void 0,e);t.rotation.y=-Math.PI/2;var n=new PJ(_r),r=new Df.Group;r.__globeObjType="globe",r.add(t),r.add(n);var s=new Df.LineSegments(new fO(OB(),_r,2),new Df.LineBasicMaterial({color:"lightgrey",transparent:!0,opacity:.1}));return{globeGroup:r,globeObj:t,graticulesObj:s,defaultGlobeMaterial:e,tileEngine:n}},init:function(e,t){is(e),t.scene=e,t.scene.add(t.globeGroup),t.scene.add(t.graticulesObj),t.ready=!1},update:function(e,t){var n=e.globeObj.material;if(e.tileEngine.visible=!(e.globeObj.visible=!e.globeTileEngineUrl),t.hasOwnProperty("globeCurvatureResolution")){var r;(r=e.globeObj.geometry)===null||r===void 0||r.dispose();var s=Math.max(4,Math.round(360/e.globeCurvatureResolution));e.globeObj.geometry=new Df.SphereGeometry(_r,s,s/2),e.tileEngine.curvatureResolution=e.globeCurvatureResolution}if(t.hasOwnProperty("globeImageUrl")&&(e.globeImageUrl?new Df.TextureLoader().load(e.globeImageUrl,function(a){var l;a.colorSpace=Df.SRGBColorSpace,(l=n.map)===null||l===void 0||l.dispose(),n.map=a,n.color=null,n.needsUpdate=!0,!e.ready&&(e.ready=!0)&&setTimeout(e.onReady)}):!n.color&&(n.color=new Df.Color(0))),t.hasOwnProperty("bumpImageUrl")&&(e.bumpImageUrl?e.bumpImageUrl&&new Df.TextureLoader().load(e.bumpImageUrl,function(a){var l;(l=n.bumpMap)===null||l===void 0||l.dispose(),n.bumpMap=a,n.needsUpdate=!0}):(n.bumpMap=null,n.needsUpdate=!0)),(t.hasOwnProperty("atmosphereColor")||t.hasOwnProperty("atmosphereAltitude"))&&(e.atmosphereObj&&(e.scene.remove(e.atmosphereObj),Cm(e.atmosphereObj)),e.atmosphereColor&&e.atmosphereAltitude)){var o=e.atmosphereObj=new ALe(e.globeObj.geometry,{color:e.atmosphereColor,size:_r*e.atmosphereAltitude,hollowRadius:_r,coefficient:.1,power:3.5});o.visible=!!e.showAtmosphere,o.__globeObjType="atmosphere",e.scene.add(o)}!e.ready&&(!e.globeImageUrl||e.globeTileEngineUrl)&&(e.ready=!0,e.onReady())}}),Nf=function(e){return isNaN(e)?parseInt(An(e).toHex(),16):e},th=function(e){return e&&isNaN(e)?Uu(e).opacity:1},Rm=function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,r,s=1,o=/^rgba\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*,\s*([\d.eE+-]+)\s*\)$/.exec(e.trim().toLowerCase());if(o){var a=o.slice(1),l=Ir(a,4),c=l[0],u=l[1],f=l[2],d=l[3];r=new zt("rgb(".concat(+c,",").concat(+u,",").concat(+f,")")),s=Math.min(+d,1)}else r=new zt(e);n&&r.convertLinearToSRGB();var A=r.toArray();return t?[].concat(tr(A),[s]):A};function gLe(i,e,t){return i.opacity=e,i.transparent=e<1,i.depthWrite=e>=1,i}var koe=window.THREE?window.THREE:{BufferAttribute:Hi};function Ff(i){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Float32Array;if(e===1)return new koe.BufferAttribute(new t(i),e);for(var n=new koe.BufferAttribute(new t(i.length*e),e),r=0,s=i.length;r<s;r++)n.set(i[r],r*e);return n}function vLe(i){for(var e=i.itemSize,t=[],n=0;n<i.count;n++)t.push(i.array.slice(n*e,(n+1)*e));return t}var GV=new WeakMap,XP=new WeakMap,$P=new WeakMap,Ll=(function(i){function e(t){var n,r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},s=r.dataBindAttr,o=s===void 0?"__data":s,a=r.objBindAttr,l=a===void 0?"__threeObj":a,c=r.removeDelay,u=c===void 0?0:c;return eI(this,e),n=JP(this,e),Eo(n,"scene",void 0),kV(n,GV,void 0),kV(n,XP,void 0),kV(n,$P,void 0),n.scene=t,zV(GV,n,o),zV(XP,n,l),zV($P,n,u),n.onRemoveObj(function(){}),n}return nI(e,i),tI(e,[{key:"onCreateObj",value:function(n){var r=this;return VV(e,"onCreateObj",this)([function(s){var o=n(s);return s[zS(XP,r)]=o,o[zS(GV,r)]=s,r.scene.add(o),o}]),this}},{key:"onRemoveObj",value:function(n){var r=this;return VV(e,"onRemoveObj",this)([function(s,o){var a=VV(e,"getData",r)([s]);n(s,o);var l=function(){r.scene.remove(s),Cm(s),delete a[zS(XP,r)]};zS($P,r)?setTimeout(l,zS($P,r)):l()}]),this}}])})(QJ),Qu=window.THREE?window.THREE:{BufferGeometry:Xn,CylinderGeometry:jA,Matrix4:cn,Mesh:Hn,MeshLambertMaterial:Ga,Object3D:lr,Vector3:re},zoe=Object.assign({},bw),Voe=zoe.BufferGeometryUtils||zoe,Joe=Qr({props:{pointsData:{default:[]},pointLat:{default:"lat"},pointLng:{default:"lng"},pointColor:{default:function(){return"#ffffaa"}},pointAltitude:{default:.1},pointRadius:{default:.25},pointResolution:{default:12,triggerUpdate:!1},pointsMerge:{default:!1},pointsTransitionDuration:{default:1e3,triggerUpdate:!1}},init:function(e,t,n){var r=n.tweenGroup;is(e),t.scene=e,t.tweenGroup=r,t.dataMapper=new Ll(e,{objBindAttr:"__threeObjPoint"})},update:function(e,t){var n=st(e.pointLat),r=st(e.pointLng),s=st(e.pointAltitude),o=st(e.pointRadius),a=st(e.pointColor),l=new Qu.CylinderGeometry(1,1,1,e.pointResolution);l.applyMatrix4(new Qu.Matrix4().makeRotationX(Math.PI/2)),l.applyMatrix4(new Qu.Matrix4().makeTranslation(0,0,-.5));var c=2*Math.PI*_r/360,u={};if(!e.pointsMerge&&t.hasOwnProperty("pointsMerge")&&is(e.scene),e.dataMapper.scene=e.pointsMerge?new Qu.Object3D:e.scene,e.dataMapper.onCreateObj(A).onUpdateObj(y).digest(e.pointsData),e.pointsMerge){var f=e.pointsData.length?(Voe.mergeGeometries||Voe.mergeBufferGeometries)(e.pointsData.map(function(w){var S=e.dataMapper.getObj(w),T=S.geometry.clone();S.updateMatrix(),T.applyMatrix4(S.matrix);var R=Rm(a(w));return T.setAttribute("color",Ff(Array(T.getAttribute("position").count).fill(R),4)),T})):new Qu.BufferGeometry,d=new Qu.Mesh(f,new Qu.MeshLambertMaterial({color:16777215,transparent:!0,vertexColors:!0}));d.__globeObjType="points",d.__data=e.pointsData,e.dataMapper.clear(),is(e.scene),e.scene.add(d)}function A(){var w=new Qu.Mesh(l);return w.__globeObjType="point",w}function y(w,S){var T=function(C){var B=w.__currentTargetD=C,k=B.r,z=B.alt,G=B.lat,W=B.lng;Object.assign(w.position,ou(G,W));var Y=e.pointsMerge?new Qu.Vector3(0,0,0):e.scene.localToWorld(new Qu.Vector3(0,0,0));w.lookAt(Y),w.scale.x=w.scale.y=Math.min(30,k)*c,w.scale.z=Math.max(z*_r,.1)},R={alt:+s(S),r:+o(S),lat:+n(S),lng:+r(S)},I=w.__currentTargetD||Object.assign({},R,{alt:-.001});if(Object.keys(R).some(function(L){return I[L]!==R[L]})&&(e.pointsMerge||!e.pointsTransitionDuration||e.pointsTransitionDuration<0?T(R):e.tweenGroup.add(new uo(I).to(R,e.pointsTransitionDuration).easing(Jr.Quadratic.InOut).onUpdate(T).onComplete(function(){e.tweenGroup.remove(this)}).start())),!e.pointsMerge){var P=a(S),F=P?th(P):0,D=!!F;w.visible=D,D&&(u.hasOwnProperty(P)||(u[P]=new Qu.MeshLambertMaterial({color:Nf(P),transparent:F<1,opacity:F})),w.material=u[P])}}}}),eae=function(){return{uniforms:{dashOffset:{value:0},dashSize:{value:1},gapSize:{value:0},dashTranslate:{value:0}},vertexShader:`51435143 `.concat(kn.common,`51445144 `).concat(kn.logdepthbuf_pars_vertex,`51455145 @@ -5179,7 +5179,7 @@ void main() {
51795179 51805180 `).concat(kn.logdepthbuf_fragment,`51815181 }5182- `)}},EV=function(e){return e.uniforms.uSurfaceRadius={type:"float",value:0},e.vertexShader=(`attribute float surfaceRadius;5182+ `)}},XV=function(e){return e.uniforms.uSurfaceRadius={type:"float",value:0},e.vertexShader=(`attribute float surfaceRadius;51835183 varying float vSurfaceRadius;51845184 varying vec3 vPos;51855185 `+e.vertexShader).replace("void main() {",["void main() {","vSurfaceRadius = surfaceRadius;","vPos = position;"].join(`@@ -5187,7 +5187,7 @@ varying vec3 vPos;
51875187 varying float vSurfaceRadius;51885188 varying vec3 vPos;51895189 `+e.fragmentShader).replace("void main() {",["void main() {","if (length(vPos) < max(uSurfaceRadius, vSurfaceRadius)) discard;"].join(`5190-`)),e},UPe=function(e){return e.vertexShader=`5190+`)),e},_Le=function(e){return e.vertexShader=`51915191 attribute float r;51925192 51935193 const float PI = 3.1415926535897932384626433832795;@@ -5220,7 +5220,7 @@ varying vec3 vPos;
52205220 gl_Position = projectionMatrix * modelViewMatrix * vec4(pos, 1.0);52215221 }52225222 `),`5223- `),e},RV=function(e,t){return e.onBeforeCompile=function(n){e.userData.shader=t(n)},e},kPe=function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:function(r){return r};if(e.userData.shader)t(e.userData.shader.uniforms);else{var n=e.onBeforeCompile;e.onBeforeCompile=function(r){n(r),t(r.uniforms)}}},zPe=["stroke"],Ju=window.THREE?window.THREE:{BufferGeometry:Xn,CubicBezierCurve3:Kv,Curve:ka,Group:Br,Line:n0,Mesh:Hn,NormalBlending:Ms,ShaderMaterial:ds,TubeGeometry:V2,Vector3:re},VPe=u1.default.default||u1.default,Ioe=Kr({props:{arcsData:{default:[]},arcStartLat:{default:"startLat"},arcStartLng:{default:"startLng"},arcStartAltitude:{default:0},arcEndLat:{default:"endLat"},arcEndLng:{default:"endLng"},arcEndAltitude:{default:0},arcColor:{default:function(){return"#ffffaa"}},arcAltitude:{},arcAltitudeAutoScale:{default:.5},arcStroke:{},arcCurveResolution:{default:64,triggerUpdate:!1},arcCircularResolution:{default:6,triggerUpdate:!1},arcDashLength:{default:1},arcDashGap:{default:0},arcDashInitialGap:{default:0},arcDashAnimateTime:{default:0},arcsTransitionDuration:{default:1e3,triggerUpdate:!1}},methods:{pauseAnimation:function(e){var t;(t=e.ticker)===null||t===void 0||t.pause()},resumeAnimation:function(e){var t;(t=e.ticker)===null||t===void 0||t.resume()},_destructor:function(e){var t;e.sharedMaterial.dispose(),(t=e.ticker)===null||t===void 0||t.dispose()}},stateInit:function(e){var t=e.tweenGroup;return{tweenGroup:t,ticker:new VPe,sharedMaterial:new Ju.ShaderMaterial($i($i({},Roe()),{},{transparent:!0,blending:Ju.NormalBlending}))}},init:function(e,t){ns(e),t.scene=e,t.dataMapper=new Pl(e,{objBindAttr:"__threeObjArc"}).onCreateObj(function(){var n=new Ju.Group;return n.__globeObjType="arc",n}),t.ticker.onTick.add(function(n,r){t.dataMapper.entries().map(function(s){var o=Ir(s,2),a=o[1];return a}).filter(function(s){return s.children.length&&s.children[0].material&&s.children[0].__dashAnimateStep}).forEach(function(s){var o=s.children[0],a=o.__dashAnimateStep*r,l=o.material.uniforms.dashTranslate.value%1e9;o.material.uniforms.dashTranslate.value=l+a})})},update:function(e){var t=st(e.arcStartLat),n=st(e.arcStartLng),r=st(e.arcStartAltitude),s=st(e.arcEndLat),o=st(e.arcEndLng),a=st(e.arcEndAltitude),l=st(e.arcAltitude),c=st(e.arcAltitudeAutoScale),u=st(e.arcStroke),f=st(e.arcColor),d=st(e.arcDashLength),A=st(e.arcDashGap),y=st(e.arcDashInitialGap),w=st(e.arcDashAnimateTime);e.dataMapper.onUpdateObj(function(P,I){var F=u(I),D=F!=null;if(!P.children.length||D!==(P.children[0].type==="Mesh")){ns(P);var L=D?new Ju.Mesh:new Ju.Line(new Ju.BufferGeometry);L.material=e.sharedMaterial.clone(),P.add(L)}var C=P.children[0];Object.assign(C.material.uniforms,{dashSize:{value:d(I)},gapSize:{value:A(I)},dashOffset:{value:y(I)}});var B=w(I);C.__dashAnimateStep=B>0?1e3/B:0;var k=T(f(I),e.arcCurveResolution,D?e.arcCircularResolution+1:1),z=R(e.arcCurveResolution,D?e.arcCircularResolution+1:1,!0);C.geometry.setAttribute("color",k),C.geometry.setAttribute("relDistance",z);var G=function($){var J=P.__currentTargetD=$,te=J.stroke,ce=EPe(J,zPe),he=S(ce);D?(C.geometry&&C.geometry.dispose(),C.geometry=new Ju.TubeGeometry(he,e.arcCurveResolution,te/2,e.arcCircularResolution),C.geometry.setAttribute("color",k),C.geometry.setAttribute("relDistance",z)):C.geometry.setFromPoints(he.getPoints(e.arcCurveResolution))},W={stroke:F,alt:l(I),altAutoScale:+c(I),startLat:+t(I),startLng:+n(I),startAlt:+r(I),endLat:+s(I),endLng:+o(I),endAlt:+a(I)},Y=P.__currentTargetD||Object.assign({},W,{altAutoScale:-.001});Object.keys(W).some(function(H){return Y[H]!==W[H]})&&(!e.arcsTransitionDuration||e.arcsTransitionDuration<0?G(W):e.tweenGroup.add(new uo(Y).to(W,e.arcsTransitionDuration).easing(Qr.Quadratic.InOut).onUpdate(G).onComplete(function(){e.tweenGroup.remove(this)}).start()))}).digest(e.arcsData);function S(P){var I=P.alt,F=P.altAutoScale,D=P.startLat,L=P.startLng,C=P.startAlt,B=P.endLat,k=P.endLng,z=P.endAlt,G=function(Ee){var Ve=Ir(Ee,3),Ye=Ve[0],Mt=Ve[1],Et=Ve[2],It=ou(Mt,Ye,Et),dn=It.x,Gt=It.y,$e=It.z;return new Ju.Vector3(dn,Gt,$e)},W=[L,D],Y=[k,B],H=I;if(H==null&&(H=El(W,Y)/2*F+Math.max(C,z)),H||C||z){var $=yg(W,Y),J=function(Ee,Ve){return Ve+(Ve-Ee)*(Ee<Ve?.5:.25)},te=[.25,.75].map(function(mt){return[].concat(tr($(mt)),[J(mt<.5?C:z,H)])}),ce=Ir(te,2),he=ce[0],ve=ce[1],Re=MV(Ju.CubicBezierCurve3,tr([[].concat(W,[C]),he,ve,[].concat(Y,[z])].map(G)));return Re}else{var Qe=.001;return Fe.apply(void 0,tr([[].concat(W,[Qe]),[].concat(Y,[Qe])].map(G)))}function Fe(mt,Ee){var Ve=mt.angleTo(Ee),Ye=Ve===0?function(){return mt.clone()}:function(Et){return new Ju.Vector3().addVectors(mt.clone().multiplyScalar(Math.sin((1-Et)*Ve)),Ee.clone().multiplyScalar(Math.sin(Et*Ve))).divideScalar(Math.sin(Ve))},Mt=new Ju.Curve;return Mt.getPoint=Ye,Mt}}function T(P,I){var F=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,D=I+1,L;if(P instanceof Array||P instanceof Function){var C=P instanceof Array?Sl().domain(P.map(function(H,$){return $/(P.length-1)})).range(P):P;L=function($){return Tm(C($),!0,!0)}}else{var B=Tm(P,!0,!0);L=function(){return B}}for(var k=[],z=0,G=D;z<G;z++)for(var W=L(z/(G-1)),Y=0;Y<F;Y++)k.push(W);return Ff(k,4)}function R(P){for(var I=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,F=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,D=P+1,L=[],C=0,B=D;C<B;C++)for(var k=C/(B-1),z=0;z<I;z++)L.push(k);return F&&L.reverse(),Ff(L,1)}}}),bm=window.THREE?window.THREE:{BufferGeometry:Xn,DoubleSide:gr,Mesh:Hn,MeshLambertMaterial:Va,Object3D:lr},goe=Object.assign({},Aw),voe=goe.BufferGeometryUtils||goe,Poe=Kr({props:{hexBinPointsData:{default:[]},hexBinPointLat:{default:"lat"},hexBinPointLng:{default:"lng"},hexBinPointWeight:{default:1},hexBinResolution:{default:4},hexMargin:{default:.2},hexTopCurvatureResolution:{default:5},hexTopColor:{default:function(){return"#ffffaa"}},hexSideColor:{default:function(){return"#ffffaa"}},hexAltitude:{default:function(e){var t=e.sumWeight;return t*.01}},hexBinMerge:{default:!1},hexTransitionDuration:{default:1e3,triggerUpdate:!1}},init:function(e,t,n){var r=n.tweenGroup;ns(e),t.scene=e,t.tweenGroup=r,t.dataMapper=new Pl(e,{objBindAttr:"__threeObjHexbin"})},update:function(e,t){var n=st(e.hexBinPointLat),r=st(e.hexBinPointLng),s=st(e.hexBinPointWeight),o=st(e.hexAltitude),a=st(e.hexTopColor),l=st(e.hexSideColor),c=st(e.hexMargin),u=$J(e.hexBinPointsData.map(function(R){return $i($i({},R),{},{h3Idx:aee(n(R),r(R),e.hexBinResolution)})}),"h3Idx"),f=Object.entries(u).map(function(R){var P=Ir(R,2),I=P[0],F=P[1];return{h3Idx:I,points:F,sumWeight:F.reduce(function(D,L){return D+ +s(L)},0)}}),d={};if(!e.hexBinMerge&&t.hasOwnProperty("hexBinMerge")&&ns(e.scene),e.dataMapper.scene=e.hexBinMerge?new bm.Object3D:e.scene,e.dataMapper.id(function(R){return R.h3Idx}).onCreateObj(S).onUpdateObj(T).digest(f),e.hexBinMerge){var A=f.length?(voe.mergeGeometries||voe.mergeBufferGeometries)(f.map(function(R){var P=e.dataMapper.getObj(R),I=P.geometry.toNonIndexed();P.updateMatrix(),I.applyMatrix4(P.matrix);var F=Tm(a(R)),D=Tm(l(R)),L=I.getAttribute("position").count,C=I.groups[0].count;return I.setAttribute("color",Ff(tr(new Array(L)).map(function(B,k){return k>=C?F:D}),4)),I})):new bm.BufferGeometry,y=new bm.MeshLambertMaterial({color:16777215,transparent:!0,vertexColors:!0,side:bm.DoubleSide});y.onBeforeCompile=function(R){y.userData.shader=EV(R)};var w=new bm.Mesh(A,y);w.__globeObjType="hexBinPoints",w.__data=f,e.dataMapper.clear(),ns(e.scene),e.scene.add(w)}function S(R){var P=new bm.Mesh;P.__hexCenter=dO(R.h3Idx),P.__hexGeoJson=pO(R.h3Idx,!0).reverse();var I=P.__hexCenter[1];return P.__hexGeoJson.forEach(function(F){var D=F[0];Math.abs(I-D)>170&&(F[0]+=I>D?360:-360)}),P.__globeObjType="hexbin",P}function T(R,P){var I=function(J,te,ce){return J-(J-te)*ce},F=Math.max(0,Math.min(1,+c(P))),D=Ir(R.__hexCenter,2),L=D[0],C=D[1],B=F===0?R.__hexGeoJson:R.__hexGeoJson.map(function($){var J=Ir($,2),te=J[0],ce=J[1];return[[te,C],[ce,L]].map(function(he){var ve=Ir(he,2),Re=ve[0],Qe=ve[1];return I(Re,Qe,F)})}),k=e.hexTopCurvatureResolution;R.geometry&&R.geometry.dispose(),R.geometry=new eR([B],0,vr,!1,!0,!0,k);var z={alt:+o(P)},G=function(J){var te=R.__currentTargetD=J,ce=te.alt;R.scale.x=R.scale.y=R.scale.z=1+ce;var he=vr/(ce+1);R.geometry.setAttribute("surfaceRadius",Ff(Array(R.geometry.getAttribute("position").count).fill(he),1))},W=R.__currentTargetD||Object.assign({},z,{alt:-.001});if(Object.keys(z).some(function($){return W[$]!==z[$]})&&(e.hexBinMerge||!e.hexTransitionDuration||e.hexTransitionDuration<0?G(z):e.tweenGroup.add(new uo(W).to(z,e.hexTransitionDuration).easing(Qr.Quadratic.InOut).onUpdate(G).onComplete(function(){e.tweenGroup.remove(this)}).start())),!e.hexBinMerge){var Y=l(P),H=a(P);[Y,H].forEach(function($){if(!d.hasOwnProperty($)){var J=th($);d[$]=RV(new bm.MeshLambertMaterial({color:Nf($),transparent:J<1,opacity:J,side:bm.DoubleSide}),EV)}}),R.material=[Y,H].map(function($){return d[$]})}}}}),Loe=function(e){return e*e},Jd=function(e){return e*Math.PI/180};function GPe(i,e){var t=Math.sqrt,n=Math.cos,r=function(u){return Loe(Math.sin(u/2))},s=Jd(i[1]),o=Jd(e[1]),a=Jd(i[0]),l=Jd(e[0]);return 2*Math.asin(t(r(o-s)+n(s)*n(o)*r(l-a)))}var qPe=Math.sqrt(2*Math.PI);function HPe(i,e){return Math.exp(-Loe(i/e)/2)/(e*qPe)}var WPe=function(e){var t=Ir(e,2),n=t[0],r=t[1],s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},a=o.lngAccessor,l=a===void 0?function(S){return S[0]}:a,c=o.latAccessor,u=c===void 0?function(S){return S[1]}:c,f=o.weightAccessor,d=f===void 0?function(){return 1}:f,A=o.bandwidth,y=[n,r],w=A*Math.PI/180;return ZM(s.map(function(S){var T=d(S);if(!T)return 0;var R=GPe(y,[l(S),u(S)]);return HPe(R,w)*T}))},jPe=(function(){var i=_Pe(SV().m(function e(t){var n,r,s,o,a,l,c,u,f,d,A,y,w,S,T,R,P,I,F,D,L,C,B,k,z,G,W,Y,H,$,J,te,ce,he,ve,Re,Qe,Fe,mt,Ee,Ve=arguments,Ye,Mt,Et;return SV().w(function(It){for(;;)switch(It.n){case 0:if(r=Ve.length>1&&Ve[1]!==void 0?Ve[1]:[],s=Ve.length>2&&Ve[2]!==void 0?Ve[2]:{},o=s.lngAccessor,a=o===void 0?function(dn){return dn[0]}:o,l=s.latAccessor,c=l===void 0?function(dn){return dn[1]}:l,u=s.weightAccessor,f=u===void 0?function(){return 1}:u,d=s.bandwidth,(n=navigator)!==null&&n!==void 0&&n.gpu){It.n=1;break}return console.warn("WebGPU not enabled in browser. Please consider enabling it to improve performance."),It.a(2,t.map(function(dn){return WPe(dn,r,{lngAccessor:a,latAccessor:c,weightAccessor:f,bandwidth:d})}));case 1:return A=4,y=Xse,w=$se,S=soe,T=roe,R=Jse,P=eoe,I=Yse,F=ioe,D=noe,L=Kse,C=Zse,B=Qse,k=toe,z=T(new e1(new Float32Array(t.flat().map(Jd)),2),"vec2",t.length),G=T(new e1(new Float32Array(r.map(function(dn){return[Jd(a(dn)),Jd(c(dn)),f(dn)]}).flat()),3),"vec3",r.length),W=new e1(t.length,1),Y=T(W,"float",t.length),H=R(Math.PI),$=F(H.mul(2)),J=function(Gt){return Gt.mul(Gt)},te=function(Gt){return J(D(Gt.div(2)))},ce=function(Gt,$e){var ot=R(Gt[1]),nt=R($e[1]),bt=R(Gt[0]),yt=R($e[0]);return R(2).mul(C(F(te(nt.sub(ot)).add(L(ot).mul(L(nt)).mul(te(yt.sub(bt)))))))},he=function(Gt,$e){return B(k(J(Gt.div($e)).div(2))).div($e.mul($))},ve=S(Jd(d)),Re=S(Jd(d*A)),Qe=S(r.length),Fe=y(function(){var dn=z.element(P),Gt=Y.element(P);Gt.assign(0),I(Qe,function($e){var ot=$e.i,nt=G.element(ot),bt=nt.z;w(bt,function(){var yt=ce(nt.xy,dn.xy);w(yt&&yt.lessThan(Re),function(){Gt.addAssign(he(yt,ve).mul(bt))})})})}),mt=Fe().compute(t.length),Ee=new px,It.n=2,Ee.computeAsync(mt);case 2:return Ye=Array,Mt=Float32Array,It.n=3,Ee.getArrayBufferAsync(W);case 3:return Et=It.v,It.a(2,Ye.from.call(Ye,new Mt(Et)))}},e)}));return function(t){return i.apply(this,arguments)}})(),VI=window.THREE?window.THREE:{Mesh:Hn,MeshLambertMaterial:Va,SphereGeometry:za},XPe=3.5,$Pe=.1,_oe=100,YPe=function(e){var t=Uu(AO(e));return t.opacity=Math.cbrt(e),t.formatRgb()},Doe=Kr({props:{heatmapsData:{default:[]},heatmapPoints:{default:function(e){return e}},heatmapPointLat:{default:function(e){return e[0]}},heatmapPointLng:{default:function(e){return e[1]}},heatmapPointWeight:{default:1},heatmapBandwidth:{default:2.5},heatmapColorFn:{default:function(){return YPe}},heatmapColorSaturation:{default:1.5},heatmapBaseAltitude:{default:.01},heatmapTopAltitude:{},heatmapsTransitionDuration:{default:0,triggerUpdate:!1}},init:function(e,t,n){var r=n.tweenGroup;ns(e),t.scene=e,t.tweenGroup=r,t.dataMapper=new Pl(e,{objBindAttr:"__threeObjHeatmap"}).onCreateObj(function(){var s=new VI.Mesh(new VI.SphereGeometry(vr),RV(new VI.MeshLambertMaterial({vertexColors:!0,transparent:!0}),UPe));return s.__globeObjType="heatmap",s})},update:function(e){var t=st(e.heatmapPoints),n=st(e.heatmapPointLat),r=st(e.heatmapPointLng),s=st(e.heatmapPointWeight),o=st(e.heatmapBandwidth),a=st(e.heatmapColorFn),l=st(e.heatmapColorSaturation),c=st(e.heatmapBaseAltitude),u=st(e.heatmapTopAltitude);e.dataMapper.onUpdateObj(function(f,d){var A=o(d),y=a(d),w=l(d),S=c(d),T=u(d),R=t(d).map(function(L){var C=n(L),B=r(L),k=ou(C,B),z=k.x,G=k.y,W=k.z;return{x:z,y:G,z:W,lat:C,lng:B,weight:s(L)}}),P=Math.max($Pe,A/XPe),I=Math.ceil(360/(P||-1));f.geometry.parameters.widthSegments!==I&&(f.geometry.dispose(),f.geometry=new VI.SphereGeometry(vr,I,I/2));var F=OPe(f.geometry.getAttribute("position")),D=F.map(function(L){var C=Ir(L,3),B=C[0],k=C[1],z=C[2],G=Eoe({x:B,y:k,z}),W=G.lng,Y=G.lat;return[W,Y]});jPe(D,R,{latAccessor:function(C){return C.lat},lngAccessor:function(C){return C.lng},weightAccessor:function(C){return C.weight},bandwidth:A}).then(function(L){var C=tr(new Array(_oe)).map(function(G,W){return Tm(y(W/(_oe-1)))}),B=function(W){var Y=f.__currentTargetD=W,H=Y.kdeVals,$=Y.topAlt,J=Y.saturation,te=$M(H.map(Math.abs))||1e-15,ce=Xb([0,te/J],C);f.geometry.setAttribute("color",Ff(H.map(function(ve){return ce(Math.abs(ve))}),4));var he=Sl([0,te],[vr*(1+S),vr*(1+($||S))]);f.geometry.setAttribute("r",Ff(H.map(he)))},k={kdeVals:L,topAlt:T,saturation:w},z=f.__currentTargetD||Object.assign({},k,{kdeVals:L.map(function(){return 0}),topAlt:T&&S,saturation:.5});z.kdeVals.length!==L.length&&(z.kdeVals=L.slice()),Object.keys(k).some(function(G){return z[G]!==k[G]})&&(!e.heatmapsTransitionDuration||e.heatmapsTransitionDuration<0?B(k):e.tweenGroup.add(new uo(z).to(k,e.heatmapsTransitionDuration).easing(Qr.Quadratic.InOut).onUpdate(B).onComplete(function(){e.tweenGroup.remove(this)}).start()))})}).digest(e.heatmapsData)}}),wm=window.THREE?window.THREE:{DoubleSide:gr,Group:Br,LineBasicMaterial:Pu,LineSegments:Xv,Mesh:Hn,MeshBasicMaterial:fs},Noe=Kr({props:{polygonsData:{default:[]},polygonGeoJsonGeometry:{default:"geometry"},polygonSideColor:{default:function(){return"#ffffaa"}},polygonSideMaterial:{},polygonCapColor:{default:function(){return"#ffffaa"}},polygonCapMaterial:{},polygonStrokeColor:{},polygonAltitude:{default:.01},polygonCapCurvatureResolution:{default:5},polygonsTransitionDuration:{default:1e3,triggerUpdate:!1}},init:function(e,t,n){var r=n.tweenGroup;ns(e),t.scene=e,t.tweenGroup=r,t.dataMapper=new Pl(e,{objBindAttr:"__threeObjPolygon"}).id(function(s){return s.id}).onCreateObj(function(){var s=new wm.Group;return s.__defaultSideMaterial=RV(new wm.MeshBasicMaterial({side:wm.DoubleSide,depthWrite:!0}),EV),s.__defaultCapMaterial=new wm.MeshBasicMaterial({side:wm.DoubleSide,depthWrite:!0}),s.add(new wm.Mesh(void 0,[s.__defaultSideMaterial,s.__defaultCapMaterial])),s.add(new wm.LineSegments(void 0,new wm.LineBasicMaterial)),s.__globeObjType="polygon",s})},update:function(e){var t=st(e.polygonGeoJsonGeometry),n=st(e.polygonAltitude),r=st(e.polygonCapCurvatureResolution),s=st(e.polygonCapColor),o=st(e.polygonCapMaterial),a=st(e.polygonSideColor),l=st(e.polygonSideMaterial),c=st(e.polygonStrokeColor),u=[];e.polygonsData.forEach(function(f){var d={data:f,capColor:s(f),capMaterial:o(f),sideColor:a(f),sideMaterial:l(f),strokeColor:c(f),altitude:+n(f),capCurvatureResolution:+r(f)},A=t(f),y=f.__id||"".concat(Math.round(Math.random()*1e9));f.__id=y,A.type==="Polygon"?u.push($i({id:"".concat(y,"_0"),coords:A.coordinates},d)):A.type==="MultiPolygon"?u.push.apply(u,tr(A.coordinates.map(function(w,S){return $i({id:"".concat(y,"_").concat(S),coords:w},d)}))):console.warn("Unsupported GeoJson geometry type: ".concat(A.type,". Skipping geometry..."))}),e.dataMapper.onUpdateObj(function(f,d){var A=d.coords,y=d.capColor,w=d.capMaterial,S=d.sideColor,T=d.sideMaterial,R=d.strokeColor,P=d.altitude,I=d.capCurvatureResolution,F=Ir(f.children,2),D=F[0],L=F[1],C=!!R;L.visible=C;var B=!!(y||w),k=!!(S||T);ZPe(D.geometry.parameters||{},{polygonGeoJson:A,curvatureResolution:I,closedTop:B,includeSides:k})||(D.geometry&&D.geometry.dispose(),D.geometry=new eR(A,0,vr,!1,B,k,I)),C&&(!L.geometry.parameters||L.geometry.parameters.geoJson.coordinates!==A||L.geometry.parameters.resolution!==I)&&(L.geometry&&L.geometry.dispose(),L.geometry=new WB({type:"Polygon",coordinates:A},vr,I));var z=k?0:-1,G=B?k?1:0:-1;if(z>=0&&(D.material[z]=T||f.__defaultSideMaterial),G>=0&&(D.material[G]=w||f.__defaultCapMaterial),[[!T&&S,z],[!w&&y,G]].forEach(function(te){var ce=Ir(te,2),he=ce[0],ve=ce[1];if(!(!he||ve<0)){var Re=D.material[ve],Qe=th(he);Re.color.set(Nf(he)),Re.transparent=Qe<1,Re.opacity=Qe}}),C){var W=L.material,Y=th(R);W.color.set(Nf(R)),W.transparent=Y<1,W.opacity=Y}var H={alt:P},$=function(ce){var he=f.__currentTargetD=ce,ve=he.alt;D.scale.x=D.scale.y=D.scale.z=1+ve,C&&(L.scale.x=L.scale.y=L.scale.z=1+ve+1e-4),kPe(f.__defaultSideMaterial,function(Re){return Re.uSurfaceRadius.value=vr/(ve+1)})},J=f.__currentTargetD||Object.assign({},H,{alt:-.001});Object.keys(H).some(function(te){return J[te]!==H[te]})&&(!e.polygonsTransitionDuration||e.polygonsTransitionDuration<0||J.alt===H.alt?$(H):e.tweenGroup.add(new uo(J).to(H,e.polygonsTransitionDuration).easing(Qr.Quadratic.InOut).onUpdate($).onComplete(function(){e.tweenGroup.remove(this)}).start()))}).digest(u)}});function ZPe(i,e){var t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:function(){return function(n,r){return n===r}};return Object.entries(e).every(function(n){var r=Ir(n,2),s=r[0],o=r[1];return i.hasOwnProperty(s)&&t(s)(i[s],o)})}var wx=window.THREE?window.THREE:{BufferGeometry:Xn,DoubleSide:gr,Mesh:Hn,MeshLambertMaterial:Va,Vector3:re},xoe=Object.assign({},Aw),yoe=xoe.BufferGeometryUtils||xoe,Foe=Kr({props:{hexPolygonsData:{default:[]},hexPolygonGeoJsonGeometry:{default:"geometry"},hexPolygonColor:{default:function(){return"#ffffaa"}},hexPolygonAltitude:{default:.001},hexPolygonResolution:{default:3},hexPolygonMargin:{default:.2},hexPolygonUseDots:{default:!1},hexPolygonCurvatureResolution:{default:5},hexPolygonDotResolution:{default:12},hexPolygonsTransitionDuration:{default:0,triggerUpdate:!1}},init:function(e,t,n){var r=n.tweenGroup;ns(e),t.scene=e,t.tweenGroup=r,t.dataMapper=new Pl(e,{objBindAttr:"__threeObjHexPolygon"}).onCreateObj(function(){var s=new wx.Mesh(void 0,new wx.MeshLambertMaterial({side:wx.DoubleSide}));return s.__globeObjType="hexPolygon",s})},update:function(e){var t=st(e.hexPolygonGeoJsonGeometry),n=st(e.hexPolygonColor),r=st(e.hexPolygonAltitude),s=st(e.hexPolygonResolution),o=st(e.hexPolygonMargin),a=st(e.hexPolygonUseDots),l=st(e.hexPolygonCurvatureResolution),c=st(e.hexPolygonDotResolution);e.dataMapper.onUpdateObj(function(u,f){var d=t(f),A=s(f),y=r(f),w=Math.max(0,Math.min(1,+o(f))),S=a(f),T=l(f),R=c(f),P=n(f),I=th(P);u.material.color.set(Nf(P)),u.material.transparent=I<1,u.material.opacity=I;var F={alt:y,margin:w,curvatureResolution:T},D={geoJson:d,h3Res:A},L=u.__currentTargetD||Object.assign({},F,{alt:-.001}),C=u.__currentMemD||D;if(Object.keys(F).some(function(G){return L[G]!==F[G]})||Object.keys(D).some(function(G){return C[G]!==D[G]})){u.__currentMemD=D;var B=[];d.type==="Polygon"?mO(d.coordinates,A,!0).forEach(function(G){return B.push(G)}):d.type==="MultiPolygon"?d.coordinates.forEach(function(G){return mO(G,A,!0).forEach(function(W){return B.push(W)})}):console.warn("Unsupported GeoJson geometry type: ".concat(d.type,". Skipping geometry..."));var k=B.map(function(G){var W=dO(G),Y=pO(G,!0).reverse(),H=W[1];return Y.forEach(function($){var J=$[0];Math.abs(H-J)>170&&($[0]+=H>J?360:-360)}),{h3Idx:G,hexCenter:W,hexGeoJson:Y}}),z=function(W){var Y=u.__currentTargetD=W,H=Y.alt,$=Y.margin,J=Y.curvatureResolution;u.geometry&&u.geometry.dispose(),u.geometry=k.length?(yoe.mergeGeometries||yoe.mergeBufferGeometries)(k.map(function(te){var ce=Ir(te.hexCenter,2),he=ce[0],ve=ce[1];if(S){var Re=ou(he,ve,H),Qe=ou(te.hexGeoJson[0][1],te.hexGeoJson[0][0],H),Fe=.85*(1-$)*new wx.Vector3(Re.x,Re.y,Re.z).distanceTo(new wx.Vector3(Qe.x,Qe.y,Qe.z)),mt=new Yv(Fe,R);return mt.rotateX(c1(-he)),mt.rotateY(c1(ve)),mt.translate(Re.x,Re.y,Re.z),mt}else{var Ee=function(Mt,Et,It){return Mt-(Mt-Et)*It},Ve=$===0?te.hexGeoJson:te.hexGeoJson.map(function(Ye){var Mt=Ir(Ye,2),Et=Mt[0],It=Mt[1];return[[Et,ve],[It,he]].map(function(dn){var Gt=Ir(dn,2),$e=Gt[0],ot=Gt[1];return Ee($e,ot,$)})});return new eR([Ve],vr,vr*(1+H),!1,!0,!1,J)}})):new wx.BufferGeometry};!e.hexPolygonsTransitionDuration||e.hexPolygonsTransitionDuration<0?z(F):e.tweenGroup.add(new uo(L).to(F,e.hexPolygonsTransitionDuration).easing(Qr.Quadratic.InOut).onUpdate(z).onComplete(function(){e.tweenGroup.remove(this)}).start())}}).digest(e.hexPolygonsData)}}),KPe=window.THREE?window.THREE:{Vector3:re};function QPe(i,e){var t=function(o,a){var l=o[o.length-1];return[].concat(tr(o),tr(Array(a-o.length).fill(l)))},n=Math.max(i.length,e.length),r=PF.apply(void 0,tr([i,e].map(function(s){return s.map(function(o){var a=o.x,l=o.y,c=o.z;return[a,l,c]})}).map(function(s){return t(s,n)})));return function(s){return s===0?i:s===1?e:r(s).map(function(o){var a=Ir(o,3),l=a[0],c=a[1],u=a[2];return new KPe.Vector3(l,c,u)})}}var l1=window.THREE?window.THREE:{BufferGeometry:Xn,Color:zt,Group:Br,Line:n0,NormalBlending:Ms,ShaderMaterial:ds,Vector3:re},JPe=u1.default.default||u1.default,Boe=Kr({props:{pathsData:{default:[]},pathPoints:{default:function(e){return e}},pathPointLat:{default:function(e){return e[0]}},pathPointLng:{default:function(e){return e[1]}},pathPointAlt:{default:.001},pathResolution:{default:2},pathColor:{default:function(){return"#ffffaa"}},pathStroke:{},pathDashLength:{default:1},pathDashGap:{default:0},pathDashInitialGap:{default:0},pathDashAnimateTime:{default:0},pathTransitionDuration:{default:1e3,triggerUpdate:!1},rendererSize:{}},methods:{pauseAnimation:function(e){var t;(t=e.ticker)===null||t===void 0||t.pause()},resumeAnimation:function(e){var t;(t=e.ticker)===null||t===void 0||t.resume()},_destructor:function(e){var t;(t=e.ticker)===null||t===void 0||t.dispose()}},stateInit:function(e){var t=e.tweenGroup;return{tweenGroup:t,ticker:new JPe,sharedMaterial:new l1.ShaderMaterial($i($i({},Roe()),{},{transparent:!0,blending:l1.NormalBlending}))}},init:function(e,t){ns(e),t.scene=e,t.dataMapper=new Pl(e,{objBindAttr:"__threeObjPath"}).onCreateObj(function(){var n=new l1.Group;return n.__globeObjType="path",n}),t.ticker.onTick.add(function(n,r){t.dataMapper.entries().map(function(s){var o=Ir(s,2),a=o[1];return a}).filter(function(s){return s.children.length&&s.children[0].material&&s.children[0].__dashAnimateStep}).forEach(function(s){var o=s.children[0],a=o.__dashAnimateStep*r;if(o.type==="Line"){var l=o.material.uniforms.dashTranslate.value%1e9;o.material.uniforms.dashTranslate.value=l+a}else if(o.type==="Line2"){for(var c=o.material.dashOffset-a,u=o.material.dashSize+o.material.gapSize;c<=-u;)c+=u;o.material.dashOffset=c}})})},update:function(e){var t=st(e.pathPoints),n=st(e.pathPointLat),r=st(e.pathPointLng),s=st(e.pathPointAlt),o=st(e.pathStroke),a=st(e.pathColor),l=st(e.pathDashLength),c=st(e.pathDashGap),u=st(e.pathDashInitialGap),f=st(e.pathDashAnimateTime);e.dataMapper.onUpdateObj(function(S,T){var R=o(T),P=R!=null;if(!S.children.length||P===(S.children[0].type==="Line")){ns(S);var I=P?new yx(new ym,new Rf):new l1.Line(new l1.BufferGeometry,e.sharedMaterial.clone());S.add(I)}var F=S.children[0],D=A(t(T),n,r,s,e.pathResolution),L=f(T);if(F.__dashAnimateStep=L>0?1e3/L:0,P){F.material.resolution=e.rendererSize;{var k=l(T),z=c(T),G=u(T);F.material.dashed=z>0,F.material.dashed?F.material.defines.USE_DASH="":delete F.material.defines.USE_DASH,F.material.dashed&&(F.material.dashScale=1/d(D),F.material.dashSize=k,F.material.gapSize=z,F.material.dashOffset=-G)}{var W=a(T);if(W instanceof Array){var Y=y(a(T),D.length-1,1,!1);F.geometry.setColors(Y.array),F.material.vertexColors=!0}else{var H=W,$=th(H);F.material.color=new l1.Color(Nf(H)),F.material.transparent=$<1,F.material.opacity=$,F.material.vertexColors=!1}}F.material.needsUpdate=!0}else{Object.assign(F.material.uniforms,{dashSize:{value:l(T)},gapSize:{value:c(T)},dashOffset:{value:u(T)}});var C=y(a(T),D.length),B=w(D.length,1,!0);F.geometry.setAttribute("color",C),F.geometry.setAttribute("relDistance",B)}var J=QPe(S.__currentTargetD&&S.__currentTargetD.points||[D[0]],D),te=function(Re){var Qe=S.__currentTargetD=Re,Fe=Qe.stroke,mt=Qe.interpolK,Ee=S.__currentTargetD.points=J(mt);if(P){var Ve;F.geometry.setPositions((Ve=[]).concat.apply(Ve,tr(Ee.map(function(Ye){var Mt=Ye.x,Et=Ye.y,It=Ye.z;return[Mt,Et,It]})))),F.material.linewidth=Fe,F.material.dashed&&F.computeLineDistances()}else F.geometry.setFromPoints(Ee),F.geometry.computeBoundingSphere()},ce={stroke:R,interpolK:1},he=Object.assign({},S.__currentTargetD||ce,{interpolK:0});Object.keys(ce).some(function(ve){return he[ve]!==ce[ve]})&&(!e.pathTransitionDuration||e.pathTransitionDuration<0?te(ce):e.tweenGroup.add(new uo(he).to(ce,e.pathTransitionDuration).easing(Qr.Quadratic.InOut).onUpdate(te).onComplete(function(){e.tweenGroup.remove(this)}).start()))}).digest(e.pathsData);function d(S){var T=0,R;return S.forEach(function(P){R&&(T+=R.distanceTo(P)),R=P}),T}function A(S,T,R,P,I){var F=function(B,k,z){for(var G=[],W=1;W<=z;W++)G.push(B+(k-B)*W/(z+1));return G},D=function(){var B=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],k=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,z=[],G=null;return B.forEach(function(W){if(G){for(;Math.abs(G[1]-W[1])>180;)G[1]+=360*(G[1]<W[1]?1:-1);var Y=Math.sqrt(Math.pow(W[0]-G[0],2)+Math.pow(W[1]-G[1],2));if(Y>k)for(var H=Math.floor(Y/k),$=F(G[0],W[0],H),J=F(G[1],W[1],H),te=F(G[2],W[2],H),ce=0,he=$.length;ce<he;ce++)z.push([$[ce],J[ce],te[ce]])}z.push(G=W)}),z},L=function(B){var k=Ir(B,3),z=k[0],G=k[1],W=k[2],Y=ou(z,G,W),H=Y.x,$=Y.y,J=Y.z;return new l1.Vector3(H,$,J)};return D(S.map(function(C){return[T(C),R(C),P(C)]}),I).map(L)}function y(S,T){var R=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,P=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0,I=T+1,F;if(S instanceof Array||S instanceof Function){var D=S instanceof Array?Sl().domain(S.map(function(W,Y){return Y/(S.length-1)})).range(S):S;F=function(Y){return Tm(D(Y),P,!0)}}else{var L=Tm(S,P,!0);F=function(){return L}}for(var C=[],B=0,k=I;B<k;B++)for(var z=F(B/(k-1)),G=0;G<R;G++)C.push(z);return Ff(C,P?4:3)}function w(S){for(var T=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,R=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,P=S+1,I=[],F=0,D=P;F<D;F++)for(var L=F/(D-1),C=0;C<T;C++)I.push(L);return R&&I.reverse(),Ff(I,1)}}}),GI=window.THREE?window.THREE:{Euler:Oa,Mesh:Hn,MeshLambertMaterial:Va,SphereGeometry:za},Ooe=Kr({props:{tilesData:{default:[]},tileLat:{default:"lat"},tileLng:{default:"lng"},tileAltitude:{default:.01},tileWidth:{default:1},tileHeight:{default:1},tileUseGlobeProjection:{default:!0},tileMaterial:{default:function(){return new GI.MeshLambertMaterial({color:"#ffbb88",opacity:.4,transparent:!0})}},tileCurvatureResolution:{default:5},tilesTransitionDuration:{default:1e3,triggerUpdate:!1}},init:function(e,t,n){var r=n.tweenGroup;ns(e),t.scene=e,t.tweenGroup=r,t.dataMapper=new Pl(e,{objBindAttr:"__threeObjTile"}).onCreateObj(function(){var s=new GI.Mesh;return s.__globeObjType="tile",s})},update:function(e){var t=st(e.tileLat),n=st(e.tileLng),r=st(e.tileAltitude),s=st(e.tileWidth),o=st(e.tileHeight),a=st(e.tileUseGlobeProjection),l=st(e.tileMaterial),c=st(e.tileCurvatureResolution);e.dataMapper.onUpdateObj(function(u,f){u.material=l(f);var d=a(f),A=c(f),y=function(R){var P=u.__currentTargetD=R,I=P.lat,F=P.lng,D=P.alt,L=P.width,C=P.height,B=Sx(F),k=Sx(-I);u.geometry&&u.geometry.dispose(),u.geometry=new GI.SphereGeometry(vr*(1+D),Math.ceil(L/(A||-1)),Math.ceil(C/(A||-1)),Sx(90-L/2)+(d?B:0),Sx(L),Sx(90-C/2)+(d?k:0),Sx(C)),d||u.setRotationFromEuler(new GI.Euler(k,B,0,"YXZ"))},w={lat:+t(f),lng:+n(f),alt:+r(f),width:+s(f),height:+o(f)},S=u.__currentTargetD||Object.assign({},w,{width:0,height:0});Object.keys(w).some(function(T){return S[T]!==w[T]})&&(!e.tilesTransitionDuration||e.tilesTransitionDuration<0?y(w):e.tweenGroup.add(new uo(S).to(w,e.tilesTransitionDuration).easing(Qr.Quadratic.InOut).onUpdate(y).onComplete(function(){e.tweenGroup.remove(this)}).start()))}).digest(e.tilesData)}}),Sx=function(e){return e*Math.PI/180},FS=window.THREE?window.THREE:{BufferGeometry:Xn,Color:zt,Points:R2,PointsMaterial:i0},Uoe=Kr({props:{particlesData:{default:[]},particlesList:{default:function(e){return e}},particleLat:{default:"lat"},particleLng:{default:"lng"},particleAltitude:{default:.01},particlesSize:{default:.5},particlesSizeAttenuation:{default:!0},particlesColor:{default:function(){return"white"}},particlesTexture:{}},init:function(e,t){ns(e),t.scene=e,t.dataMapper=new Pl(e,{objBindAttr:"__threeObjParticles"}).onCreateObj(function(){var n=new FS.Points(new FS.BufferGeometry,new FS.PointsMaterial);return n.__globeObjType="particles",n}).onUpdateObj(function(n,r){var s=st(t.particlesList),o=st(t.particleLat),a=st(t.particleLng),l=st(t.particleAltitude);n.geometry.setAttribute("position",Ff(s(r).map(function(c){return Object.values(ou(o(c),a(c),l(c)))}),3))})},update:function(e,t){["particlesData","particlesList","particleLat","particleLng","particleAltitude"].some(function(a){return t.hasOwnProperty(a)})&&e.dataMapper.digest(e.particlesData);var n=st(e.particlesColor),r=st(e.particlesSize),s=st(e.particlesSizeAttenuation),o=st(e.particlesTexture);e.dataMapper.entries().forEach(function(a){var l=Ir(a,2),c=l[0],u=l[1];if(u.material.size=r(c),u.material.sizeAttenuation=s(c),e.particlesTexture)u.material.color=new FS.Color(16777215),u.material.transparent=!1,u.material.alphaTest=.5,u.material.map=o(c);else{var f=n(c),d=th(f);u.material.color=new FS.Color(Nf(f)),u.material.transparent=d<1,u.material.opacity=d,u.material.alphaTest=0}})}}),eLe=window.THREE?window.THREE:{BufferGeometry:Xn},tLe=(function(i){function e(){var t,n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:1,r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:32;jI(this,e),t=WI(this,e),t.type="CircleLineGeometry",t.parameters={radius:n,segmentCount:r};for(var s=[],o=0;o<=r;o++){var a=(o/r-.25)*Math.PI*2;s.push({x:Math.cos(a)*n,y:Math.sin(a)*n,z:0})}return t.setFromPoints(s),t}return $I(e,i),XI(e)})(eLe.BufferGeometry),Tx=window.THREE?window.THREE:{Color:zt,Group:Br,Line:n0,LineBasicMaterial:Pu,Vector3:re},nLe=u1.default.default||u1.default,koe=Kr({props:{ringsData:{default:[]},ringLat:{default:"lat"},ringLng:{default:"lng"},ringAltitude:{default:.0015},ringColor:{default:function(){return"#ffffaa"},triggerUpdate:!1},ringResolution:{default:64,triggerUpdate:!1},ringMaxRadius:{default:2,triggerUpdate:!1},ringPropagationSpeed:{default:1,triggerUpdate:!1},ringRepeatPeriod:{default:700,triggerUpdate:!1}},methods:{pauseAnimation:function(e){var t;(t=e.ticker)===null||t===void 0||t.pause()},resumeAnimation:function(e){var t;(t=e.ticker)===null||t===void 0||t.resume()},_destructor:function(e){var t;(t=e.ticker)===null||t===void 0||t.dispose()}},init:function(e,t,n){var r=n.tweenGroup;ns(e),t.scene=e,t.tweenGroup=r,t.dataMapper=new Pl(e,{objBindAttr:"__threeObjRing",removeDelay:3e4}).onCreateObj(function(){var s=new Tx.Group;return s.__globeObjType="ring",s}),t.ticker=new nLe,t.ticker.onTick.add(function(s){if(t.ringsData.length){var o=st(t.ringColor),a=st(t.ringAltitude),l=st(t.ringMaxRadius),c=st(t.ringPropagationSpeed),u=st(t.ringRepeatPeriod);t.dataMapper.entries().filter(function(f){var d=Ir(f,2),A=d[1];return A}).forEach(function(f){var d=Ir(f,2),A=d[0],y=d[1];if((y.__nextRingTime||0)<=s){var w=u(A)/1e3;y.__nextRingTime=s+(w<=0?1/0:w);var S=new Tx.Line(new tLe(1,t.ringResolution),new Tx.LineBasicMaterial),T=o(A),R=T instanceof Array||T instanceof Function,P;R?T instanceof Array?(P=Sl().domain(T.map(function(z,G){return G/(T.length-1)})).range(T),S.material.transparent=T.some(function(z){return th(z)<1})):(P=T,S.material.transparent=!0):(S.material.color=new Tx.Color(Nf(T)),BPe(S.material,th(T)));var I=vr*(1+a(A)),F=l(A),D=F*Math.PI/180,L=c(A),C=L<=0,B=function(G){var W=G.t,Y=(C?1-W:W)*D;if(S.scale.x=S.scale.y=I*Math.sin(Y),S.position.z=I*(1-Math.cos(Y)),R){var H=P(W);S.material.color=new Tx.Color(Nf(H)),S.material.transparent&&(S.material.opacity=th(H))}};if(L===0)B({t:0}),y.add(S);else{var k=Math.abs(F/L)*1e3;t.tweenGroup.add(new uo({t:0}).to({t:1},k).onUpdate(B).onStart(function(){return y.add(S)}).onComplete(function(){t.tweenGroup.remove(this),y.remove(S),Sm(S)}).start())}}})}})},update:function(e){var t=st(e.ringLat),n=st(e.ringLng),r=st(e.ringAltitude),s=e.scene.localToWorld(new Tx.Vector3(0,0,0));e.dataMapper.onUpdateObj(function(o,a){var l=t(a),c=n(a),u=r(a);Object.assign(o.position,ou(l,c,u)),o.lookAt(s)}).digest(e.ringsData)}}),iLe={0:{x_min:73,x_max:715,ha:792,o:"m 394 -29 q 153 129 242 -29 q 73 479 73 272 q 152 829 73 687 q 394 989 241 989 q 634 829 545 989 q 715 479 715 684 q 635 129 715 270 q 394 -29 546 -29 m 394 89 q 546 211 489 89 q 598 479 598 322 q 548 748 598 640 q 394 871 491 871 q 241 748 298 871 q 190 479 190 637 q 239 211 190 319 q 394 89 296 89 "},1:{x_min:215.671875,x_max:574,ha:792,o:"m 574 0 l 442 0 l 442 697 l 215 697 l 215 796 q 386 833 330 796 q 475 986 447 875 l 574 986 l 574 0 "},2:{x_min:59,x_max:731,ha:792,o:"m 731 0 l 59 0 q 197 314 59 188 q 457 487 199 315 q 598 691 598 580 q 543 819 598 772 q 411 867 488 867 q 272 811 328 867 q 209 630 209 747 l 81 630 q 182 901 81 805 q 408 986 271 986 q 629 909 536 986 q 731 694 731 826 q 613 449 731 541 q 378 316 495 383 q 201 122 235 234 l 731 122 l 731 0 "},3:{x_min:54,x_max:737,ha:792,o:"m 737 284 q 635 55 737 141 q 399 -25 541 -25 q 156 52 248 -25 q 54 308 54 140 l 185 308 q 245 147 185 202 q 395 96 302 96 q 539 140 484 96 q 602 280 602 190 q 510 429 602 390 q 324 454 451 454 l 324 565 q 487 584 441 565 q 565 719 565 617 q 515 835 565 791 q 395 879 466 879 q 255 824 307 879 q 203 661 203 769 l 78 661 q 166 909 78 822 q 387 992 250 992 q 603 921 513 992 q 701 723 701 844 q 669 607 701 656 q 578 524 637 558 q 696 434 655 499 q 737 284 737 369 "},4:{x_min:48,x_max:742.453125,ha:792,o:"m 742 243 l 602 243 l 602 0 l 476 0 l 476 243 l 48 243 l 48 368 l 476 958 l 602 958 l 602 354 l 742 354 l 742 243 m 476 354 l 476 792 l 162 354 l 476 354 "},5:{x_min:54.171875,x_max:738,ha:792,o:"m 738 314 q 626 60 738 153 q 382 -23 526 -23 q 155 47 248 -23 q 54 256 54 125 l 183 256 q 259 132 204 174 q 382 91 314 91 q 533 149 471 91 q 602 314 602 213 q 538 469 602 411 q 386 528 475 528 q 284 506 332 528 q 197 439 237 484 l 81 439 l 159 958 l 684 958 l 684 840 l 254 840 l 214 579 q 306 627 258 612 q 407 643 354 643 q 636 552 540 643 q 738 314 738 457 "},6:{x_min:53,x_max:739,ha:792,o:"m 739 312 q 633 62 739 162 q 400 -31 534 -31 q 162 78 257 -31 q 53 439 53 206 q 178 859 53 712 q 441 986 284 986 q 643 912 559 986 q 732 713 732 833 l 601 713 q 544 830 594 786 q 426 875 494 875 q 268 793 331 875 q 193 517 193 697 q 301 597 240 570 q 427 624 362 624 q 643 540 552 624 q 739 312 739 451 m 603 298 q 540 461 603 400 q 404 516 484 516 q 268 461 323 516 q 207 300 207 401 q 269 137 207 198 q 405 83 325 83 q 541 137 486 83 q 603 298 603 197 "},7:{x_min:58.71875,x_max:730.953125,ha:792,o:"m 730 839 q 469 448 560 641 q 335 0 378 255 l 192 0 q 328 441 235 252 q 593 830 421 630 l 58 830 l 58 958 l 730 958 l 730 839 "},8:{x_min:55,x_max:736,ha:792,o:"m 571 527 q 694 424 652 491 q 736 280 736 358 q 648 71 736 158 q 395 -26 551 -26 q 142 69 238 -26 q 55 279 55 157 q 96 425 55 359 q 220 527 138 491 q 120 615 153 562 q 88 726 88 668 q 171 904 88 827 q 395 986 261 986 q 618 905 529 986 q 702 727 702 830 q 670 616 702 667 q 571 527 638 565 m 394 565 q 519 610 475 565 q 563 717 563 655 q 521 823 563 781 q 392 872 474 872 q 265 824 312 872 q 224 720 224 783 q 265 613 224 656 q 394 565 312 565 m 395 91 q 545 150 488 91 q 597 280 597 204 q 546 408 597 355 q 395 465 492 465 q 244 408 299 465 q 194 280 194 356 q 244 150 194 203 q 395 91 299 91 "},9:{x_min:53,x_max:739,ha:792,o:"m 739 524 q 619 94 739 241 q 362 -32 516 -32 q 150 47 242 -32 q 59 244 59 126 l 191 244 q 246 129 191 176 q 373 82 301 82 q 526 161 466 82 q 597 440 597 255 q 363 334 501 334 q 130 432 216 334 q 53 650 53 521 q 134 880 53 786 q 383 986 226 986 q 659 841 566 986 q 739 524 739 719 m 388 449 q 535 514 480 449 q 585 658 585 573 q 535 805 585 744 q 388 873 480 873 q 242 809 294 873 q 191 658 191 745 q 239 514 191 572 q 388 449 292 449 "},\u03BF:{x_min:0,x_max:712,ha:815,o:"m 356 -25 q 96 88 192 -25 q 0 368 0 201 q 92 642 0 533 q 356 761 192 761 q 617 644 517 761 q 712 368 712 533 q 619 91 712 201 q 356 -25 520 -25 m 356 85 q 527 175 465 85 q 583 369 583 255 q 528 562 583 484 q 356 651 466 651 q 189 560 250 651 q 135 369 135 481 q 187 177 135 257 q 356 85 250 85 "},S:{x_min:0,x_max:788,ha:890,o:"m 788 291 q 662 54 788 144 q 397 -26 550 -26 q 116 68 226 -26 q 0 337 0 168 l 131 337 q 200 152 131 220 q 384 85 269 85 q 557 129 479 85 q 650 270 650 183 q 490 429 650 379 q 194 513 341 470 q 33 739 33 584 q 142 964 33 881 q 388 1041 242 1041 q 644 957 543 1041 q 756 716 756 867 l 625 716 q 561 874 625 816 q 395 933 497 933 q 243 891 309 933 q 164 759 164 841 q 325 609 164 656 q 625 526 475 568 q 788 291 788 454 "},"\xA6":{x_min:343,x_max:449,ha:792,o:"m 449 462 l 343 462 l 343 986 l 449 986 l 449 462 m 449 -242 l 343 -242 l 343 280 l 449 280 l 449 -242 "},"/":{x_min:183.25,x_max:608.328125,ha:792,o:"m 608 1041 l 266 -129 l 183 -129 l 520 1041 l 608 1041 "},\u03A4:{x_min:-.4375,x_max:777.453125,ha:839,o:"m 777 893 l 458 893 l 458 0 l 319 0 l 319 892 l 0 892 l 0 1013 l 777 1013 l 777 893 "},y:{x_min:0,x_max:684.78125,ha:771,o:"m 684 738 l 388 -83 q 311 -216 356 -167 q 173 -279 252 -279 q 97 -266 133 -279 l 97 -149 q 132 -155 109 -151 q 168 -160 155 -160 q 240 -114 213 -160 q 274 -26 248 -98 l 0 738 l 137 737 l 341 139 l 548 737 l 684 738 "},\u03A0:{x_min:0,x_max:803,ha:917,o:"m 803 0 l 667 0 l 667 886 l 140 886 l 140 0 l 0 0 l 0 1012 l 803 1012 l 803 0 "},\u0390:{x_min:-111,x_max:339,ha:361,o:"m 339 800 l 229 800 l 229 925 l 339 925 l 339 800 m -1 800 l -111 800 l -111 925 l -1 925 l -1 800 m 284 3 q 233 -10 258 -5 q 182 -15 207 -15 q 85 26 119 -15 q 42 200 42 79 l 42 737 l 167 737 l 168 215 q 172 141 168 157 q 226 101 183 101 q 248 103 239 101 q 284 112 257 104 l 284 3 m 302 1040 l 113 819 l 30 819 l 165 1040 l 302 1040 "},g:{x_min:0,x_max:686,ha:838,o:"m 686 34 q 586 -213 686 -121 q 331 -306 487 -306 q 131 -252 216 -306 q 31 -84 31 -190 l 155 -84 q 228 -174 166 -138 q 345 -207 284 -207 q 514 -109 454 -207 q 564 89 564 -27 q 461 6 521 36 q 335 -23 401 -23 q 88 100 184 -23 q 0 370 0 215 q 87 634 0 522 q 330 758 183 758 q 457 728 398 758 q 564 644 515 699 l 564 737 l 686 737 l 686 34 m 582 367 q 529 560 582 481 q 358 652 468 652 q 189 561 250 652 q 135 369 135 482 q 189 176 135 255 q 361 85 251 85 q 529 176 468 85 q 582 367 582 255 "},"\xB2":{x_min:0,x_max:442,ha:539,o:"m 442 383 l 0 383 q 91 566 0 492 q 260 668 176 617 q 354 798 354 727 q 315 875 354 845 q 227 905 277 905 q 136 869 173 905 q 99 761 99 833 l 14 761 q 82 922 14 864 q 232 974 141 974 q 379 926 316 974 q 442 797 442 878 q 351 635 442 704 q 183 539 321 611 q 92 455 92 491 l 442 455 l 442 383 "},"\u2013":{x_min:0,x_max:705.5625,ha:803,o:"m 705 334 l 0 334 l 0 410 l 705 410 l 705 334 "},\u039A:{x_min:0,x_max:819.5625,ha:893,o:"m 819 0 l 650 0 l 294 509 l 139 356 l 139 0 l 0 0 l 0 1013 l 139 1013 l 139 526 l 626 1013 l 809 1013 l 395 600 l 819 0 "},\u0192:{x_min:-46.265625,x_max:392,ha:513,o:"m 392 651 l 259 651 l 79 -279 l -46 -278 l 134 651 l 14 651 l 14 751 l 135 751 q 151 948 135 900 q 304 1041 185 1041 q 334 1040 319 1041 q 392 1034 348 1039 l 392 922 q 337 931 360 931 q 271 883 287 931 q 260 793 260 853 l 260 751 l 392 751 l 392 651 "},e:{x_min:0,x_max:714,ha:813,o:"m 714 326 l 140 326 q 200 157 140 227 q 359 87 260 87 q 488 130 431 87 q 561 245 545 174 l 697 245 q 577 48 670 123 q 358 -26 484 -26 q 97 85 195 -26 q 0 363 0 197 q 94 642 0 529 q 358 765 195 765 q 626 627 529 765 q 714 326 714 503 m 576 429 q 507 583 564 522 q 355 650 445 650 q 206 583 266 650 q 140 429 152 522 l 576 429 "},\u03CC:{x_min:0,x_max:712,ha:815,o:"m 356 -25 q 94 91 194 -25 q 0 368 0 202 q 92 642 0 533 q 356 761 192 761 q 617 644 517 761 q 712 368 712 533 q 619 91 712 201 q 356 -25 520 -25 m 356 85 q 527 175 465 85 q 583 369 583 255 q 528 562 583 484 q 356 651 466 651 q 189 560 250 651 q 135 369 135 481 q 187 177 135 257 q 356 85 250 85 m 576 1040 l 387 819 l 303 819 l 438 1040 l 576 1040 "},J:{x_min:0,x_max:588,ha:699,o:"m 588 279 q 287 -26 588 -26 q 58 73 126 -26 q 0 327 0 158 l 133 327 q 160 172 133 227 q 288 96 198 96 q 426 171 391 96 q 449 336 449 219 l 449 1013 l 588 1013 l 588 279 "},"\xBB":{x_min:-1,x_max:503,ha:601,o:"m 503 302 l 280 136 l 281 256 l 429 373 l 281 486 l 280 608 l 503 440 l 503 302 m 221 302 l 0 136 l 0 255 l 145 372 l 0 486 l -1 608 l 221 440 l 221 302 "},"\xA9":{x_min:-3,x_max:1008,ha:1106,o:"m 502 -7 q 123 151 263 -7 q -3 501 -3 294 q 123 851 -3 706 q 502 1011 263 1011 q 881 851 739 1011 q 1008 501 1008 708 q 883 151 1008 292 q 502 -7 744 -7 m 502 60 q 830 197 709 60 q 940 501 940 322 q 831 805 940 681 q 502 944 709 944 q 174 805 296 944 q 65 501 65 680 q 173 197 65 320 q 502 60 294 60 m 741 394 q 661 246 731 302 q 496 190 591 190 q 294 285 369 190 q 228 497 228 370 q 295 714 228 625 q 499 813 370 813 q 656 762 588 813 q 733 625 724 711 l 634 625 q 589 704 629 673 q 498 735 550 735 q 377 666 421 735 q 334 504 334 597 q 374 340 334 408 q 490 272 415 272 q 589 304 549 272 q 638 394 628 337 l 741 394 "},\u03CE:{x_min:0,x_max:922,ha:1030,o:"m 687 1040 l 498 819 l 415 819 l 549 1040 l 687 1040 m 922 339 q 856 97 922 203 q 650 -26 780 -26 q 538 9 587 -26 q 461 103 489 44 q 387 12 436 46 q 277 -22 339 -22 q 69 97 147 -22 q 0 338 0 202 q 45 551 0 444 q 161 737 84 643 l 302 737 q 175 552 219 647 q 124 336 124 446 q 155 179 124 248 q 275 88 197 88 q 375 163 341 88 q 400 294 400 219 l 400 572 l 524 572 l 524 294 q 561 135 524 192 q 643 88 591 88 q 762 182 719 88 q 797 341 797 257 q 745 555 797 450 q 619 737 705 637 l 760 737 q 874 551 835 640 q 922 339 922 444 "},"^":{x_min:193.0625,x_max:598.609375,ha:792,o:"m 598 772 l 515 772 l 395 931 l 277 772 l 193 772 l 326 1013 l 462 1013 l 598 772 "},"\xAB":{x_min:0,x_max:507.203125,ha:604,o:"m 506 136 l 284 302 l 284 440 l 506 608 l 507 485 l 360 371 l 506 255 l 506 136 m 222 136 l 0 302 l 0 440 l 222 608 l 221 486 l 73 373 l 222 256 l 222 136 "},D:{x_min:0,x_max:828,ha:935,o:"m 389 1013 q 714 867 593 1013 q 828 521 828 729 q 712 161 828 309 q 382 0 587 0 l 0 0 l 0 1013 l 389 1013 m 376 124 q 607 247 523 124 q 681 510 681 355 q 607 771 681 662 q 376 896 522 896 l 139 896 l 139 124 l 376 124 "},"\u2219":{x_min:0,x_max:142,ha:239,o:"m 142 585 l 0 585 l 0 738 l 142 738 l 142 585 "},\u00FF:{x_min:0,x_max:47,ha:125,o:"m 47 3 q 37 -7 47 -7 q 28 0 30 -7 q 39 -4 32 -4 q 45 3 45 -1 l 37 0 q 28 9 28 0 q 39 19 28 19 l 47 16 l 47 19 l 47 3 m 37 1 q 44 8 44 1 q 37 16 44 16 q 30 8 30 16 q 37 1 30 1 m 26 1 l 23 22 l 14 0 l 3 22 l 3 3 l 0 25 l 13 1 l 22 25 l 26 1 "},w:{x_min:0,x_max:1009.71875,ha:1100,o:"m 1009 738 l 783 0 l 658 0 l 501 567 l 345 0 l 222 0 l 0 738 l 130 738 l 284 174 l 432 737 l 576 738 l 721 173 l 881 737 l 1009 738 "},$:{x_min:0,x_max:700,ha:793,o:"m 664 717 l 542 717 q 490 825 531 785 q 381 872 450 865 l 381 551 q 620 446 540 522 q 700 241 700 370 q 618 45 700 116 q 381 -25 536 -25 l 381 -152 l 307 -152 l 307 -25 q 81 62 162 -25 q 0 297 0 149 l 124 297 q 169 146 124 204 q 307 81 215 89 l 307 441 q 80 536 148 469 q 13 725 13 603 q 96 910 13 839 q 307 982 180 982 l 307 1077 l 381 1077 l 381 982 q 574 917 494 982 q 664 717 664 845 m 307 565 l 307 872 q 187 831 233 872 q 142 724 142 791 q 180 618 142 656 q 307 565 218 580 m 381 76 q 562 237 562 96 q 517 361 562 313 q 381 423 472 409 l 381 76 "},"\\":{x_min:-.015625,x_max:425.0625,ha:522,o:"m 425 -129 l 337 -129 l 0 1041 l 83 1041 l 425 -129 "},\u00B5:{x_min:0,x_max:697.21875,ha:747,o:"m 697 -4 q 629 -14 658 -14 q 498 97 513 -14 q 422 9 470 41 q 313 -23 374 -23 q 207 4 258 -23 q 119 81 156 32 l 119 -278 l 0 -278 l 0 738 l 124 738 l 124 343 q 165 173 124 246 q 308 83 216 83 q 452 178 402 83 q 493 359 493 255 l 493 738 l 617 738 l 617 214 q 623 136 617 160 q 673 92 637 92 q 697 96 684 92 l 697 -4 "},\u0399:{x_min:42,x_max:181,ha:297,o:"m 181 0 l 42 0 l 42 1013 l 181 1013 l 181 0 "},\u038E:{x_min:0,x_max:1144.5,ha:1214,o:"m 1144 1012 l 807 416 l 807 0 l 667 0 l 667 416 l 325 1012 l 465 1012 l 736 533 l 1004 1012 l 1144 1012 m 277 1040 l 83 799 l 0 799 l 140 1040 l 277 1040 "},"\u2019":{x_min:0,x_max:139,ha:236,o:"m 139 851 q 102 737 139 784 q 0 669 65 690 l 0 734 q 59 787 42 741 q 72 873 72 821 l 0 873 l 0 1013 l 139 1013 l 139 851 "},\u039D:{x_min:0,x_max:801,ha:915,o:"m 801 0 l 651 0 l 131 822 l 131 0 l 0 0 l 0 1013 l 151 1013 l 670 191 l 670 1013 l 801 1013 l 801 0 "},"-":{x_min:8.71875,x_max:350.390625,ha:478,o:"m 350 317 l 8 317 l 8 428 l 350 428 l 350 317 "},Q:{x_min:0,x_max:968,ha:1072,o:"m 954 5 l 887 -79 l 744 35 q 622 -11 687 2 q 483 -26 556 -26 q 127 130 262 -26 q 0 504 0 279 q 127 880 0 728 q 484 1041 262 1041 q 841 884 708 1041 q 968 507 968 735 q 933 293 968 398 q 832 104 899 188 l 954 5 m 723 191 q 802 330 777 248 q 828 499 828 412 q 744 790 828 673 q 483 922 650 922 q 228 791 322 922 q 142 505 142 673 q 227 221 142 337 q 487 91 323 91 q 632 123 566 91 l 520 215 l 587 301 l 723 191 "},\u03C2:{x_min:1,x_max:676.28125,ha:740,o:"m 676 460 l 551 460 q 498 595 542 546 q 365 651 448 651 q 199 578 263 651 q 136 401 136 505 q 266 178 136 241 q 508 106 387 142 q 640 -50 640 62 q 625 -158 640 -105 q 583 -278 611 -211 l 465 -278 q 498 -182 490 -211 q 515 -80 515 -126 q 381 12 515 -15 q 134 91 197 51 q 1 388 1 179 q 100 651 1 542 q 354 761 199 761 q 587 680 498 761 q 676 460 676 599 "},M:{x_min:0,x_max:954,ha:1067,o:"m 954 0 l 819 0 l 819 869 l 537 0 l 405 0 l 128 866 l 128 0 l 0 0 l 0 1013 l 200 1013 l 472 160 l 757 1013 l 954 1013 l 954 0 "},\u03A8:{x_min:0,x_max:1006,ha:1094,o:"m 1006 678 q 914 319 1006 429 q 571 200 814 200 l 571 0 l 433 0 l 433 200 q 92 319 194 200 q 0 678 0 429 l 0 1013 l 139 1013 l 139 679 q 191 417 139 492 q 433 326 255 326 l 433 1013 l 571 1013 l 571 326 l 580 326 q 813 423 747 326 q 868 679 868 502 l 868 1013 l 1006 1013 l 1006 678 "},C:{x_min:0,x_max:886,ha:944,o:"m 886 379 q 760 87 886 201 q 455 -26 634 -26 q 112 136 236 -26 q 0 509 0 283 q 118 882 0 737 q 469 1041 245 1041 q 748 955 630 1041 q 879 708 879 859 l 745 708 q 649 862 724 805 q 473 920 573 920 q 219 791 312 920 q 136 509 136 675 q 217 229 136 344 q 470 99 311 99 q 672 179 591 99 q 753 379 753 259 l 886 379 "},"!":{x_min:0,x_max:138,ha:236,o:"m 138 684 q 116 409 138 629 q 105 244 105 299 l 33 244 q 16 465 33 313 q 0 684 0 616 l 0 1013 l 138 1013 l 138 684 m 138 0 l 0 0 l 0 151 l 138 151 l 138 0 "},"{":{x_min:0,x_max:480.5625,ha:578,o:"m 480 -286 q 237 -213 303 -286 q 187 -45 187 -159 q 194 48 187 -15 q 201 141 201 112 q 164 264 201 225 q 0 314 118 314 l 0 417 q 164 471 119 417 q 201 605 201 514 q 199 665 201 644 q 193 772 193 769 q 241 941 193 887 q 480 1015 308 1015 l 480 915 q 336 866 375 915 q 306 742 306 828 q 310 662 306 717 q 314 577 314 606 q 288 452 314 500 q 176 365 256 391 q 289 275 257 337 q 314 143 314 226 q 313 84 314 107 q 310 -11 310 -5 q 339 -131 310 -94 q 480 -182 377 -182 l 480 -286 "},X:{x_min:-.015625,x_max:854.15625,ha:940,o:"m 854 0 l 683 0 l 423 409 l 166 0 l 0 0 l 347 519 l 18 1013 l 186 1013 l 428 637 l 675 1013 l 836 1013 l 504 520 l 854 0 "},"#":{x_min:0,x_max:963.890625,ha:1061,o:"m 963 690 l 927 590 l 719 590 l 655 410 l 876 410 l 840 310 l 618 310 l 508 -3 l 393 -2 l 506 309 l 329 310 l 215 -2 l 102 -3 l 212 310 l 0 310 l 36 410 l 248 409 l 312 590 l 86 590 l 120 690 l 347 690 l 459 1006 l 573 1006 l 462 690 l 640 690 l 751 1006 l 865 1006 l 754 690 l 963 690 m 606 590 l 425 590 l 362 410 l 543 410 l 606 590 "},\u03B9:{x_min:42,x_max:284,ha:361,o:"m 284 3 q 233 -10 258 -5 q 182 -15 207 -15 q 85 26 119 -15 q 42 200 42 79 l 42 738 l 167 738 l 168 215 q 172 141 168 157 q 226 101 183 101 q 248 103 239 101 q 284 112 257 104 l 284 3 "},\u0386:{x_min:0,x_max:906.953125,ha:982,o:"m 283 1040 l 88 799 l 5 799 l 145 1040 l 283 1040 m 906 0 l 756 0 l 650 303 l 251 303 l 143 0 l 0 0 l 376 1012 l 529 1012 l 906 0 m 609 421 l 452 866 l 293 421 l 609 421 "},")":{x_min:0,x_max:318,ha:415,o:"m 318 365 q 257 25 318 191 q 87 -290 197 -141 l 0 -290 q 140 21 93 -128 q 193 360 193 189 q 141 704 193 537 q 0 1024 97 850 l 87 1024 q 257 706 197 871 q 318 365 318 542 "},\u03B5:{x_min:0,x_max:634.71875,ha:714,o:"m 634 234 q 527 38 634 110 q 300 -25 433 -25 q 98 29 183 -25 q 0 204 0 93 q 37 314 0 265 q 128 390 67 353 q 56 460 82 419 q 26 555 26 505 q 114 712 26 654 q 295 763 191 763 q 499 700 416 763 q 589 515 589 631 l 478 515 q 419 618 464 580 q 307 657 374 657 q 207 630 253 657 q 151 547 151 598 q 238 445 151 469 q 389 434 280 434 l 389 331 l 349 331 q 206 315 255 331 q 125 210 125 287 q 183 107 125 145 q 302 76 233 76 q 436 117 379 76 q 509 234 493 159 l 634 234 "},\u0394:{x_min:0,x_max:952.78125,ha:1028,o:"m 952 0 l 0 0 l 400 1013 l 551 1013 l 952 0 m 762 124 l 476 867 l 187 124 l 762 124 "},"}":{x_min:0,x_max:481,ha:578,o:"m 481 314 q 318 262 364 314 q 282 136 282 222 q 284 65 282 97 q 293 -58 293 -48 q 241 -217 293 -166 q 0 -286 174 -286 l 0 -182 q 143 -130 105 -182 q 171 -2 171 -93 q 168 81 171 22 q 165 144 165 140 q 188 275 165 229 q 306 365 220 339 q 191 455 224 391 q 165 588 165 505 q 168 681 165 624 q 171 742 171 737 q 141 865 171 827 q 0 915 102 915 l 0 1015 q 243 942 176 1015 q 293 773 293 888 q 287 675 293 741 q 282 590 282 608 q 318 466 282 505 q 481 417 364 417 l 481 314 "},"\u2030":{x_min:-3,x_max:1672,ha:1821,o:"m 846 0 q 664 76 732 0 q 603 244 603 145 q 662 412 603 344 q 846 489 729 489 q 1027 412 959 489 q 1089 244 1089 343 q 1029 76 1089 144 q 846 0 962 0 m 845 103 q 945 143 910 103 q 981 243 981 184 q 947 340 981 301 q 845 385 910 385 q 745 342 782 385 q 709 243 709 300 q 742 147 709 186 q 845 103 781 103 m 888 986 l 284 -25 l 199 -25 l 803 986 l 888 986 m 241 468 q 58 545 126 468 q -3 715 -3 615 q 56 881 -3 813 q 238 958 124 958 q 421 881 353 958 q 483 712 483 813 q 423 544 483 612 q 241 468 356 468 m 241 855 q 137 811 175 855 q 100 710 100 768 q 136 612 100 653 q 240 572 172 572 q 344 614 306 572 q 382 713 382 656 q 347 810 382 771 q 241 855 308 855 m 1428 0 q 1246 76 1314 0 q 1185 244 1185 145 q 1244 412 1185 344 q 1428 489 1311 489 q 1610 412 1542 489 q 1672 244 1672 343 q 1612 76 1672 144 q 1428 0 1545 0 m 1427 103 q 1528 143 1492 103 q 1564 243 1564 184 q 1530 340 1564 301 q 1427 385 1492 385 q 1327 342 1364 385 q 1291 243 1291 300 q 1324 147 1291 186 q 1427 103 1363 103 "},a:{x_min:0,x_max:698.609375,ha:794,o:"m 698 0 q 661 -12 679 -7 q 615 -17 643 -17 q 536 12 564 -17 q 500 96 508 41 q 384 6 456 37 q 236 -25 312 -25 q 65 31 130 -25 q 0 194 0 88 q 118 390 0 334 q 328 435 180 420 q 488 483 476 451 q 495 523 495 504 q 442 619 495 584 q 325 654 389 654 q 209 617 257 654 q 152 513 161 580 l 33 513 q 123 705 33 633 q 332 772 207 772 q 528 712 448 772 q 617 531 617 645 l 617 163 q 624 108 617 126 q 664 90 632 90 l 698 94 l 698 0 m 491 262 l 491 372 q 272 329 350 347 q 128 201 128 294 q 166 113 128 144 q 264 83 205 83 q 414 130 346 83 q 491 262 491 183 "},"\u2014":{x_min:0,x_max:941.671875,ha:1039,o:"m 941 334 l 0 334 l 0 410 l 941 410 l 941 334 "},"=":{x_min:8.71875,x_max:780.953125,ha:792,o:"m 780 510 l 8 510 l 8 606 l 780 606 l 780 510 m 780 235 l 8 235 l 8 332 l 780 332 l 780 235 "},N:{x_min:0,x_max:801,ha:914,o:"m 801 0 l 651 0 l 131 823 l 131 0 l 0 0 l 0 1013 l 151 1013 l 670 193 l 670 1013 l 801 1013 l 801 0 "},\u03C1:{x_min:0,x_max:712,ha:797,o:"m 712 369 q 620 94 712 207 q 362 -26 521 -26 q 230 2 292 -26 q 119 83 167 30 l 119 -278 l 0 -278 l 0 362 q 91 643 0 531 q 355 764 190 764 q 617 647 517 764 q 712 369 712 536 m 583 366 q 530 559 583 480 q 359 651 469 651 q 190 562 252 651 q 135 370 135 483 q 189 176 135 257 q 359 85 250 85 q 528 175 466 85 q 583 366 583 254 "},"\xAF":{x_min:0,x_max:941.671875,ha:938,o:"m 941 1033 l 0 1033 l 0 1109 l 941 1109 l 941 1033 "},Z:{x_min:0,x_max:779,ha:849,o:"m 779 0 l 0 0 l 0 113 l 621 896 l 40 896 l 40 1013 l 779 1013 l 778 887 l 171 124 l 779 124 l 779 0 "},u:{x_min:0,x_max:617,ha:729,o:"m 617 0 l 499 0 l 499 110 q 391 10 460 45 q 246 -25 322 -25 q 61 58 127 -25 q 0 258 0 136 l 0 738 l 125 738 l 125 284 q 156 148 125 202 q 273 82 197 82 q 433 165 369 82 q 493 340 493 243 l 493 738 l 617 738 l 617 0 "},k:{x_min:0,x_max:612.484375,ha:697,o:"m 612 738 l 338 465 l 608 0 l 469 0 l 251 382 l 121 251 l 121 0 l 0 0 l 0 1013 l 121 1013 l 121 402 l 456 738 l 612 738 "},\u0397:{x_min:0,x_max:803,ha:917,o:"m 803 0 l 667 0 l 667 475 l 140 475 l 140 0 l 0 0 l 0 1013 l 140 1013 l 140 599 l 667 599 l 667 1013 l 803 1013 l 803 0 "},\u0391:{x_min:0,x_max:906.953125,ha:985,o:"m 906 0 l 756 0 l 650 303 l 251 303 l 143 0 l 0 0 l 376 1013 l 529 1013 l 906 0 m 609 421 l 452 866 l 293 421 l 609 421 "},s:{x_min:0,x_max:604,ha:697,o:"m 604 217 q 501 36 604 104 q 292 -23 411 -23 q 86 43 166 -23 q 0 238 0 114 l 121 237 q 175 122 121 164 q 300 85 223 85 q 415 112 363 85 q 479 207 479 147 q 361 309 479 276 q 140 372 141 370 q 21 544 21 426 q 111 708 21 647 q 298 761 190 761 q 492 705 413 761 q 583 531 583 643 l 462 531 q 412 625 462 594 q 298 657 363 657 q 199 636 242 657 q 143 558 143 608 q 262 454 143 486 q 484 394 479 397 q 604 217 604 341 "},B:{x_min:0,x_max:778,ha:876,o:"m 580 546 q 724 469 670 535 q 778 311 778 403 q 673 83 778 171 q 432 0 575 0 l 0 0 l 0 1013 l 411 1013 q 629 957 541 1013 q 732 768 732 892 q 691 633 732 693 q 580 546 650 572 m 393 899 l 139 899 l 139 588 l 379 588 q 521 624 462 588 q 592 744 592 667 q 531 859 592 819 q 393 899 471 899 m 419 124 q 566 169 504 124 q 635 303 635 219 q 559 436 635 389 q 402 477 494 477 l 139 477 l 139 124 l 419 124 "},"\u2026":{x_min:0,x_max:614,ha:708,o:"m 142 0 l 0 0 l 0 151 l 142 151 l 142 0 m 378 0 l 236 0 l 236 151 l 378 151 l 378 0 m 614 0 l 472 0 l 472 151 l 614 151 l 614 0 "},"?":{x_min:0,x_max:607,ha:704,o:"m 607 777 q 543 599 607 674 q 422 474 482 537 q 357 272 357 391 l 236 272 q 297 487 236 395 q 411 619 298 490 q 474 762 474 691 q 422 885 474 838 q 301 933 371 933 q 179 880 228 933 q 124 706 124 819 l 0 706 q 94 963 0 872 q 302 1044 177 1044 q 511 973 423 1044 q 607 777 607 895 m 370 0 l 230 0 l 230 151 l 370 151 l 370 0 "},H:{x_min:0,x_max:803,ha:915,o:"m 803 0 l 667 0 l 667 475 l 140 475 l 140 0 l 0 0 l 0 1013 l 140 1013 l 140 599 l 667 599 l 667 1013 l 803 1013 l 803 0 "},\u03BD:{x_min:0,x_max:675,ha:761,o:"m 675 738 l 404 0 l 272 0 l 0 738 l 133 738 l 340 147 l 541 738 l 675 738 "},c:{x_min:1,x_max:701.390625,ha:775,o:"m 701 264 q 584 53 681 133 q 353 -26 487 -26 q 91 91 188 -26 q 1 370 1 201 q 92 645 1 537 q 353 761 190 761 q 572 688 479 761 q 690 493 666 615 l 556 493 q 487 606 545 562 q 356 650 428 650 q 186 563 246 650 q 134 372 134 487 q 188 179 134 258 q 359 88 250 88 q 492 136 437 88 q 566 264 548 185 l 701 264 "},"\xB6":{x_min:0,x_max:566.671875,ha:678,o:"m 21 892 l 52 892 l 98 761 l 145 892 l 176 892 l 178 741 l 157 741 l 157 867 l 108 741 l 88 741 l 40 871 l 40 741 l 21 741 l 21 892 m 308 854 l 308 731 q 252 691 308 691 q 227 691 240 691 q 207 696 213 695 l 207 712 l 253 706 q 288 733 288 706 l 288 763 q 244 741 279 741 q 193 797 193 741 q 261 860 193 860 q 287 860 273 860 q 308 854 302 855 m 288 842 l 263 843 q 213 796 213 843 q 248 756 213 756 q 288 796 288 756 l 288 842 m 566 988 l 502 988 l 502 -1 l 439 -1 l 439 988 l 317 988 l 317 -1 l 252 -1 l 252 602 q 81 653 155 602 q 0 805 0 711 q 101 989 0 918 q 309 1053 194 1053 l 566 1053 l 566 988 "},\u03B2:{x_min:0,x_max:660,ha:745,o:"m 471 550 q 610 450 561 522 q 660 280 660 378 q 578 64 660 151 q 367 -22 497 -22 q 239 5 299 -22 q 126 82 178 32 l 126 -278 l 0 -278 l 0 593 q 54 903 0 801 q 318 1042 127 1042 q 519 964 436 1042 q 603 771 603 887 q 567 644 603 701 q 471 550 532 586 m 337 79 q 476 138 418 79 q 535 279 535 198 q 427 437 535 386 q 226 477 344 477 l 226 583 q 398 620 329 583 q 486 762 486 668 q 435 884 486 833 q 312 935 384 935 q 169 861 219 935 q 126 698 126 797 l 126 362 q 170 169 126 242 q 337 79 224 79 "},\u039C:{x_min:0,x_max:954,ha:1068,o:"m 954 0 l 819 0 l 819 868 l 537 0 l 405 0 l 128 865 l 128 0 l 0 0 l 0 1013 l 199 1013 l 472 158 l 758 1013 l 954 1013 l 954 0 "},\u038C:{x_min:.109375,x_max:1120,ha:1217,o:"m 1120 505 q 994 132 1120 282 q 642 -29 861 -29 q 290 130 422 -29 q 167 505 167 280 q 294 883 167 730 q 650 1046 430 1046 q 999 882 868 1046 q 1120 505 1120 730 m 977 504 q 896 784 977 669 q 644 915 804 915 q 391 785 484 915 q 307 504 307 669 q 391 224 307 339 q 644 95 486 95 q 894 224 803 95 q 977 504 977 339 m 277 1040 l 83 799 l 0 799 l 140 1040 l 277 1040 "},\u0389:{x_min:0,x_max:1158,ha:1275,o:"m 1158 0 l 1022 0 l 1022 475 l 496 475 l 496 0 l 356 0 l 356 1012 l 496 1012 l 496 599 l 1022 599 l 1022 1012 l 1158 1012 l 1158 0 m 277 1040 l 83 799 l 0 799 l 140 1040 l 277 1040 "},"\u2022":{x_min:0,x_max:663.890625,ha:775,o:"m 663 529 q 566 293 663 391 q 331 196 469 196 q 97 294 194 196 q 0 529 0 393 q 96 763 0 665 q 331 861 193 861 q 566 763 469 861 q 663 529 663 665 "},"\xA5":{x_min:.1875,x_max:819.546875,ha:886,o:"m 563 561 l 697 561 l 696 487 l 520 487 l 482 416 l 482 380 l 697 380 l 695 308 l 482 308 l 482 0 l 342 0 l 342 308 l 125 308 l 125 380 l 342 380 l 342 417 l 303 487 l 125 487 l 125 561 l 258 561 l 0 1013 l 140 1013 l 411 533 l 679 1013 l 819 1013 l 563 561 "},"(":{x_min:0,x_max:318.0625,ha:415,o:"m 318 -290 l 230 -290 q 61 23 122 -142 q 0 365 0 190 q 62 712 0 540 q 230 1024 119 869 l 318 1024 q 175 705 219 853 q 125 360 125 542 q 176 22 125 187 q 318 -290 223 -127 "},U:{x_min:0,x_max:796,ha:904,o:"m 796 393 q 681 93 796 212 q 386 -25 566 -25 q 101 95 208 -25 q 0 393 0 211 l 0 1013 l 138 1013 l 138 391 q 204 191 138 270 q 394 107 276 107 q 586 191 512 107 q 656 391 656 270 l 656 1013 l 796 1013 l 796 393 "},\u03B3:{x_min:.5,x_max:744.953125,ha:822,o:"m 744 737 l 463 54 l 463 -278 l 338 -278 l 338 54 l 154 495 q 104 597 124 569 q 13 651 67 651 l 0 651 l 0 751 l 39 753 q 168 711 121 753 q 242 594 207 676 l 403 208 l 617 737 l 744 737 "},\u03B1:{x_min:0,x_max:765.5625,ha:809,o:"m 765 -4 q 698 -14 726 -14 q 564 97 586 -14 q 466 7 525 40 q 337 -26 407 -26 q 88 98 186 -26 q 0 369 0 212 q 88 637 0 525 q 337 760 184 760 q 465 728 407 760 q 563 637 524 696 l 563 739 l 685 739 l 685 222 q 693 141 685 168 q 748 94 708 94 q 765 96 760 94 l 765 -4 m 584 371 q 531 562 584 485 q 360 653 470 653 q 192 566 254 653 q 135 379 135 489 q 186 181 135 261 q 358 84 247 84 q 528 176 465 84 q 584 371 584 260 "},F:{x_min:0,x_max:683.328125,ha:717,o:"m 683 888 l 140 888 l 140 583 l 613 583 l 613 458 l 140 458 l 140 0 l 0 0 l 0 1013 l 683 1013 l 683 888 "},"\xAD":{x_min:0,x_max:705.5625,ha:803,o:"m 705 334 l 0 334 l 0 410 l 705 410 l 705 334 "},":":{x_min:0,x_max:142,ha:239,o:"m 142 585 l 0 585 l 0 738 l 142 738 l 142 585 m 142 0 l 0 0 l 0 151 l 142 151 l 142 0 "},\u03A7:{x_min:0,x_max:854.171875,ha:935,o:"m 854 0 l 683 0 l 423 409 l 166 0 l 0 0 l 347 519 l 18 1013 l 186 1013 l 427 637 l 675 1013 l 836 1013 l 504 521 l 854 0 "},"*":{x_min:116,x_max:674,ha:792,o:"m 674 768 l 475 713 l 610 544 l 517 477 l 394 652 l 272 478 l 178 544 l 314 713 l 116 766 l 153 876 l 341 812 l 342 1013 l 446 1013 l 446 811 l 635 874 l 674 768 "},"\u2020":{x_min:0,x_max:777,ha:835,o:"m 458 804 l 777 804 l 777 683 l 458 683 l 458 0 l 319 0 l 319 681 l 0 683 l 0 804 l 319 804 l 319 1015 l 458 1013 l 458 804 "},"\xB0":{x_min:0,x_max:347,ha:444,o:"m 173 802 q 43 856 91 802 q 0 977 0 905 q 45 1101 0 1049 q 173 1153 90 1153 q 303 1098 255 1153 q 347 977 347 1049 q 303 856 347 905 q 173 802 256 802 m 173 884 q 238 910 214 884 q 262 973 262 937 q 239 1038 262 1012 q 173 1064 217 1064 q 108 1037 132 1064 q 85 973 85 1010 q 108 910 85 937 q 173 884 132 884 "},V:{x_min:0,x_max:862.71875,ha:940,o:"m 862 1013 l 505 0 l 361 0 l 0 1013 l 143 1013 l 434 165 l 718 1012 l 862 1013 "},\u039E:{x_min:0,x_max:734.71875,ha:763,o:"m 723 889 l 9 889 l 9 1013 l 723 1013 l 723 889 m 673 463 l 61 463 l 61 589 l 673 589 l 673 463 m 734 0 l 0 0 l 0 124 l 734 124 l 734 0 "},"\xA0":{x_min:0,x_max:0,ha:853},\u03AB:{x_min:.328125,x_max:819.515625,ha:889,o:"m 588 1046 l 460 1046 l 460 1189 l 588 1189 l 588 1046 m 360 1046 l 232 1046 l 232 1189 l 360 1189 l 360 1046 m 819 1012 l 482 416 l 482 0 l 342 0 l 342 416 l 0 1012 l 140 1012 l 411 533 l 679 1012 l 819 1012 "},"\u201D":{x_min:0,x_max:347,ha:454,o:"m 139 851 q 102 737 139 784 q 0 669 65 690 l 0 734 q 59 787 42 741 q 72 873 72 821 l 0 873 l 0 1013 l 139 1013 l 139 851 m 347 851 q 310 737 347 784 q 208 669 273 690 l 208 734 q 267 787 250 741 q 280 873 280 821 l 208 873 l 208 1013 l 347 1013 l 347 851 "},"@":{x_min:0,x_max:1260,ha:1357,o:"m 1098 -45 q 877 -160 1001 -117 q 633 -203 752 -203 q 155 -29 327 -203 q 0 360 0 127 q 176 802 0 616 q 687 1008 372 1008 q 1123 854 969 1008 q 1260 517 1260 718 q 1155 216 1260 341 q 868 82 1044 82 q 772 106 801 82 q 737 202 737 135 q 647 113 700 144 q 527 82 594 82 q 367 147 420 82 q 314 312 314 212 q 401 565 314 452 q 639 690 498 690 q 810 588 760 690 l 849 668 l 938 668 q 877 441 900 532 q 833 226 833 268 q 853 182 833 198 q 902 167 873 167 q 1088 272 1012 167 q 1159 512 1159 372 q 1051 793 1159 681 q 687 925 925 925 q 248 747 415 925 q 97 361 97 586 q 226 26 97 159 q 627 -122 370 -122 q 856 -87 737 -122 q 1061 8 976 -53 l 1098 -45 m 786 488 q 738 580 777 545 q 643 615 700 615 q 483 517 548 615 q 425 322 425 430 q 457 203 425 250 q 552 156 490 156 q 722 273 665 156 q 786 488 738 309 "},\u038A:{x_min:0,x_max:499,ha:613,o:"m 277 1040 l 83 799 l 0 799 l 140 1040 l 277 1040 m 499 0 l 360 0 l 360 1012 l 499 1012 l 499 0 "},i:{x_min:14,x_max:136,ha:275,o:"m 136 873 l 14 873 l 14 1013 l 136 1013 l 136 873 m 136 0 l 14 0 l 14 737 l 136 737 l 136 0 "},\u0392:{x_min:0,x_max:778,ha:877,o:"m 580 545 q 724 468 671 534 q 778 310 778 402 q 673 83 778 170 q 432 0 575 0 l 0 0 l 0 1013 l 411 1013 q 629 957 541 1013 q 732 768 732 891 q 691 632 732 692 q 580 545 650 571 m 393 899 l 139 899 l 139 587 l 379 587 q 521 623 462 587 q 592 744 592 666 q 531 859 592 819 q 393 899 471 899 m 419 124 q 566 169 504 124 q 635 302 635 219 q 559 435 635 388 q 402 476 494 476 l 139 476 l 139 124 l 419 124 "},\u03C5:{x_min:0,x_max:617,ha:725,o:"m 617 352 q 540 94 617 199 q 308 -24 455 -24 q 76 94 161 -24 q 0 352 0 199 l 0 739 l 126 739 l 126 355 q 169 185 126 257 q 312 98 220 98 q 451 185 402 98 q 492 355 492 257 l 492 739 l 617 739 l 617 352 "},"]":{x_min:0,x_max:275,ha:372,o:"m 275 -281 l 0 -281 l 0 -187 l 151 -187 l 151 920 l 0 920 l 0 1013 l 275 1013 l 275 -281 "},m:{x_min:0,x_max:1019,ha:1128,o:"m 1019 0 l 897 0 l 897 454 q 860 591 897 536 q 739 660 816 660 q 613 586 659 660 q 573 436 573 522 l 573 0 l 447 0 l 447 455 q 412 591 447 535 q 294 657 372 657 q 165 586 213 657 q 122 437 122 521 l 122 0 l 0 0 l 0 738 l 117 738 l 117 640 q 202 730 150 697 q 316 763 254 763 q 437 730 381 763 q 525 642 494 697 q 621 731 559 700 q 753 763 682 763 q 943 694 867 763 q 1019 512 1019 625 l 1019 0 "},\u03C7:{x_min:8.328125,x_max:780.5625,ha:815,o:"m 780 -278 q 715 -294 747 -294 q 616 -257 663 -294 q 548 -175 576 -227 l 379 133 l 143 -277 l 9 -277 l 313 254 l 163 522 q 127 586 131 580 q 36 640 91 640 q 8 637 27 640 l 8 752 l 52 757 q 162 719 113 757 q 236 627 200 690 l 383 372 l 594 737 l 726 737 l 448 250 l 625 -69 q 670 -153 647 -110 q 743 -188 695 -188 q 780 -184 759 -188 l 780 -278 "},\u03AF:{x_min:42,x_max:326.71875,ha:361,o:"m 284 3 q 233 -10 258 -5 q 182 -15 207 -15 q 85 26 119 -15 q 42 200 42 79 l 42 737 l 167 737 l 168 215 q 172 141 168 157 q 226 101 183 101 q 248 102 239 101 q 284 112 257 104 l 284 3 m 326 1040 l 137 819 l 54 819 l 189 1040 l 326 1040 "},\u0396:{x_min:0,x_max:779.171875,ha:850,o:"m 779 0 l 0 0 l 0 113 l 620 896 l 40 896 l 40 1013 l 779 1013 l 779 887 l 170 124 l 779 124 l 779 0 "},R:{x_min:0,x_max:781.953125,ha:907,o:"m 781 0 l 623 0 q 587 242 590 52 q 407 433 585 433 l 138 433 l 138 0 l 0 0 l 0 1013 l 396 1013 q 636 946 539 1013 q 749 731 749 868 q 711 597 749 659 q 608 502 674 534 q 718 370 696 474 q 729 207 722 352 q 781 26 736 62 l 781 0 m 373 551 q 533 594 465 551 q 614 731 614 645 q 532 859 614 815 q 373 896 465 896 l 138 896 l 138 551 l 373 551 "},o:{x_min:0,x_max:713,ha:821,o:"m 357 -25 q 94 91 194 -25 q 0 368 0 202 q 93 642 0 533 q 357 761 193 761 q 618 644 518 761 q 713 368 713 533 q 619 91 713 201 q 357 -25 521 -25 m 357 85 q 528 175 465 85 q 584 369 584 255 q 529 562 584 484 q 357 651 467 651 q 189 560 250 651 q 135 369 135 481 q 187 177 135 257 q 357 85 250 85 "},K:{x_min:0,x_max:819.46875,ha:906,o:"m 819 0 l 649 0 l 294 509 l 139 355 l 139 0 l 0 0 l 0 1013 l 139 1013 l 139 526 l 626 1013 l 809 1013 l 395 600 l 819 0 "},",":{x_min:0,x_max:142,ha:239,o:"m 142 -12 q 105 -132 142 -82 q 0 -205 68 -182 l 0 -138 q 57 -82 40 -124 q 70 0 70 -51 l 0 0 l 0 151 l 142 151 l 142 -12 "},d:{x_min:0,x_max:683,ha:796,o:"m 683 0 l 564 0 l 564 93 q 456 6 516 38 q 327 -25 395 -25 q 87 100 181 -25 q 0 365 0 215 q 90 639 0 525 q 343 763 187 763 q 564 647 486 763 l 564 1013 l 683 1013 l 683 0 m 582 373 q 529 562 582 484 q 361 653 468 653 q 190 561 253 653 q 135 365 135 479 q 189 175 135 254 q 358 85 251 85 q 529 178 468 85 q 582 373 582 258 "},"\xA8":{x_min:-109,x_max:247,ha:232,o:"m 247 1046 l 119 1046 l 119 1189 l 247 1189 l 247 1046 m 19 1046 l -109 1046 l -109 1189 l 19 1189 l 19 1046 "},E:{x_min:0,x_max:736.109375,ha:789,o:"m 736 0 l 0 0 l 0 1013 l 725 1013 l 725 889 l 139 889 l 139 585 l 677 585 l 677 467 l 139 467 l 139 125 l 736 125 l 736 0 "},Y:{x_min:0,x_max:820,ha:886,o:"m 820 1013 l 482 416 l 482 0 l 342 0 l 342 416 l 0 1013 l 140 1013 l 411 534 l 679 1012 l 820 1013 "},'"':{x_min:0,x_max:299,ha:396,o:"m 299 606 l 203 606 l 203 988 l 299 988 l 299 606 m 96 606 l 0 606 l 0 988 l 96 988 l 96 606 "},"\u2039":{x_min:17.984375,x_max:773.609375,ha:792,o:"m 773 40 l 18 376 l 17 465 l 773 799 l 773 692 l 159 420 l 773 149 l 773 40 "},"\u201E":{x_min:0,x_max:364,ha:467,o:"m 141 -12 q 104 -132 141 -82 q 0 -205 67 -182 l 0 -138 q 56 -82 40 -124 q 69 0 69 -51 l 0 0 l 0 151 l 141 151 l 141 -12 m 364 -12 q 327 -132 364 -82 q 222 -205 290 -182 l 222 -138 q 279 -82 262 -124 q 292 0 292 -51 l 222 0 l 222 151 l 364 151 l 364 -12 "},\u03B4:{x_min:1,x_max:710,ha:810,o:"m 710 360 q 616 87 710 196 q 356 -28 518 -28 q 99 82 197 -28 q 1 356 1 192 q 100 606 1 509 q 355 703 199 703 q 180 829 288 754 q 70 903 124 866 l 70 1012 l 643 1012 l 643 901 l 258 901 q 462 763 422 794 q 636 592 577 677 q 710 360 710 485 m 584 365 q 552 501 584 447 q 451 602 521 555 q 372 611 411 611 q 197 541 258 611 q 136 355 136 472 q 190 171 136 245 q 358 85 252 85 q 528 173 465 85 q 584 365 584 252 "},\u03AD:{x_min:0,x_max:634.71875,ha:714,o:"m 634 234 q 527 38 634 110 q 300 -25 433 -25 q 98 29 183 -25 q 0 204 0 93 q 37 313 0 265 q 128 390 67 352 q 56 459 82 419 q 26 555 26 505 q 114 712 26 654 q 295 763 191 763 q 499 700 416 763 q 589 515 589 631 l 478 515 q 419 618 464 580 q 307 657 374 657 q 207 630 253 657 q 151 547 151 598 q 238 445 151 469 q 389 434 280 434 l 389 331 l 349 331 q 206 315 255 331 q 125 210 125 287 q 183 107 125 145 q 302 76 233 76 q 436 117 379 76 q 509 234 493 159 l 634 234 m 520 1040 l 331 819 l 248 819 l 383 1040 l 520 1040 "},\u03C9:{x_min:0,x_max:922,ha:1031,o:"m 922 339 q 856 97 922 203 q 650 -26 780 -26 q 538 9 587 -26 q 461 103 489 44 q 387 12 436 46 q 277 -22 339 -22 q 69 97 147 -22 q 0 339 0 203 q 45 551 0 444 q 161 738 84 643 l 302 738 q 175 553 219 647 q 124 336 124 446 q 155 179 124 249 q 275 88 197 88 q 375 163 341 88 q 400 294 400 219 l 400 572 l 524 572 l 524 294 q 561 135 524 192 q 643 88 591 88 q 762 182 719 88 q 797 342 797 257 q 745 556 797 450 q 619 738 705 638 l 760 738 q 874 551 835 640 q 922 339 922 444 "},"\xB4":{x_min:0,x_max:96,ha:251,o:"m 96 606 l 0 606 l 0 988 l 96 988 l 96 606 "},"\xB1":{x_min:11,x_max:781,ha:792,o:"m 781 490 l 446 490 l 446 255 l 349 255 l 349 490 l 11 490 l 11 586 l 349 586 l 349 819 l 446 819 l 446 586 l 781 586 l 781 490 m 781 21 l 11 21 l 11 115 l 781 115 l 781 21 "},"|":{x_min:343,x_max:449,ha:792,o:"m 449 462 l 343 462 l 343 986 l 449 986 l 449 462 m 449 -242 l 343 -242 l 343 280 l 449 280 l 449 -242 "},\u03CB:{x_min:0,x_max:617,ha:725,o:"m 482 800 l 372 800 l 372 925 l 482 925 l 482 800 m 239 800 l 129 800 l 129 925 l 239 925 l 239 800 m 617 352 q 540 93 617 199 q 308 -24 455 -24 q 76 93 161 -24 q 0 352 0 199 l 0 738 l 126 738 l 126 354 q 169 185 126 257 q 312 98 220 98 q 451 185 402 98 q 492 354 492 257 l 492 738 l 617 738 l 617 352 "},"\xA7":{x_min:0,x_max:593,ha:690,o:"m 593 425 q 554 312 593 369 q 467 233 516 254 q 537 83 537 172 q 459 -74 537 -12 q 288 -133 387 -133 q 115 -69 184 -133 q 47 96 47 -6 l 166 96 q 199 7 166 40 q 288 -26 232 -26 q 371 -5 332 -26 q 420 60 420 21 q 311 201 420 139 q 108 309 210 255 q 0 490 0 383 q 33 602 0 551 q 124 687 66 654 q 75 743 93 712 q 58 812 58 773 q 133 984 58 920 q 300 1043 201 1043 q 458 987 394 1043 q 529 814 529 925 l 411 814 q 370 908 404 877 q 289 939 336 939 q 213 911 246 939 q 180 841 180 883 q 286 720 180 779 q 484 612 480 615 q 593 425 593 534 m 467 409 q 355 544 467 473 q 196 630 228 612 q 146 587 162 609 q 124 525 124 558 q 239 387 124 462 q 398 298 369 315 q 448 345 429 316 q 467 409 467 375 "},b:{x_min:0,x_max:685,ha:783,o:"m 685 372 q 597 99 685 213 q 347 -25 501 -25 q 219 5 277 -25 q 121 93 161 36 l 121 0 l 0 0 l 0 1013 l 121 1013 l 121 634 q 214 723 157 692 q 341 754 272 754 q 591 637 493 754 q 685 372 685 526 m 554 356 q 499 550 554 470 q 328 644 437 644 q 162 556 223 644 q 108 369 108 478 q 160 176 108 256 q 330 83 221 83 q 498 169 435 83 q 554 356 554 245 "},q:{x_min:0,x_max:683,ha:876,o:"m 683 -278 l 564 -278 l 564 97 q 474 8 533 39 q 345 -23 415 -23 q 91 93 188 -23 q 0 364 0 203 q 87 635 0 522 q 337 760 184 760 q 466 727 408 760 q 564 637 523 695 l 564 737 l 683 737 l 683 -278 m 582 375 q 527 564 582 488 q 358 652 466 652 q 190 565 253 652 q 135 377 135 488 q 189 179 135 261 q 361 84 251 84 q 530 179 469 84 q 582 375 582 260 "},\u03A9:{x_min:-.171875,x_max:969.5625,ha:1068,o:"m 969 0 l 555 0 l 555 123 q 744 308 675 194 q 814 558 814 423 q 726 812 814 709 q 484 922 633 922 q 244 820 334 922 q 154 567 154 719 q 223 316 154 433 q 412 123 292 199 l 412 0 l 0 0 l 0 124 l 217 124 q 68 327 122 210 q 15 572 15 444 q 144 911 15 781 q 484 1041 274 1041 q 822 909 691 1041 q 953 569 953 777 q 899 326 953 443 q 750 124 846 210 l 969 124 l 969 0 "},\u03CD:{x_min:0,x_max:617,ha:725,o:"m 617 352 q 540 93 617 199 q 308 -24 455 -24 q 76 93 161 -24 q 0 352 0 199 l 0 738 l 126 738 l 126 354 q 169 185 126 257 q 312 98 220 98 q 451 185 402 98 q 492 354 492 257 l 492 738 l 617 738 l 617 352 m 535 1040 l 346 819 l 262 819 l 397 1040 l 535 1040 "},z:{x_min:-.015625,x_max:613.890625,ha:697,o:"m 613 0 l 0 0 l 0 100 l 433 630 l 20 630 l 20 738 l 594 738 l 593 636 l 163 110 l 613 110 l 613 0 "},"\u2122":{x_min:0,x_max:894,ha:1e3,o:"m 389 951 l 229 951 l 229 503 l 160 503 l 160 951 l 0 951 l 0 1011 l 389 1011 l 389 951 m 894 503 l 827 503 l 827 939 l 685 503 l 620 503 l 481 937 l 481 503 l 417 503 l 417 1011 l 517 1011 l 653 580 l 796 1010 l 894 1011 l 894 503 "},\u03AE:{x_min:.78125,x_max:697,ha:810,o:"m 697 -278 l 572 -278 l 572 454 q 540 587 572 536 q 425 650 501 650 q 271 579 337 650 q 206 420 206 509 l 206 0 l 81 0 l 81 489 q 73 588 81 562 q 0 644 56 644 l 0 741 q 68 755 38 755 q 158 721 124 755 q 200 630 193 687 q 297 726 234 692 q 434 761 359 761 q 620 692 544 761 q 697 516 697 624 l 697 -278 m 479 1040 l 290 819 l 207 819 l 341 1040 l 479 1040 "},\u0398:{x_min:0,x_max:960,ha:1056,o:"m 960 507 q 833 129 960 280 q 476 -32 698 -32 q 123 129 255 -32 q 0 507 0 280 q 123 883 0 732 q 476 1045 255 1045 q 832 883 696 1045 q 960 507 960 732 m 817 500 q 733 789 817 669 q 476 924 639 924 q 223 792 317 924 q 142 507 142 675 q 222 222 142 339 q 476 89 315 89 q 730 218 636 89 q 817 500 817 334 m 716 449 l 243 449 l 243 571 l 716 571 l 716 449 "},"\xAE":{x_min:-3,x_max:1008,ha:1106,o:"m 503 532 q 614 562 566 532 q 672 658 672 598 q 614 747 672 716 q 503 772 569 772 l 338 772 l 338 532 l 503 532 m 502 -7 q 123 151 263 -7 q -3 501 -3 294 q 123 851 -3 706 q 502 1011 263 1011 q 881 851 739 1011 q 1008 501 1008 708 q 883 151 1008 292 q 502 -7 744 -7 m 502 60 q 830 197 709 60 q 940 501 940 322 q 831 805 940 681 q 502 944 709 944 q 174 805 296 944 q 65 501 65 680 q 173 197 65 320 q 502 60 294 60 m 788 146 l 678 146 q 653 316 655 183 q 527 449 652 449 l 338 449 l 338 146 l 241 146 l 241 854 l 518 854 q 688 808 621 854 q 766 658 766 755 q 739 563 766 607 q 668 497 713 519 q 751 331 747 472 q 788 164 756 190 l 788 146 "},"~":{x_min:0,x_max:833,ha:931,o:"m 833 958 q 778 753 833 831 q 594 665 716 665 q 402 761 502 665 q 240 857 302 857 q 131 795 166 857 q 104 665 104 745 l 0 665 q 54 867 0 789 q 237 958 116 958 q 429 861 331 958 q 594 765 527 765 q 704 827 670 765 q 729 958 729 874 l 833 958 "},\u0395:{x_min:0,x_max:736.21875,ha:778,o:"m 736 0 l 0 0 l 0 1013 l 725 1013 l 725 889 l 139 889 l 139 585 l 677 585 l 677 467 l 139 467 l 139 125 l 736 125 l 736 0 "},"\xB3":{x_min:0,x_max:450,ha:547,o:"m 450 552 q 379 413 450 464 q 220 366 313 366 q 69 414 130 366 q 0 567 0 470 l 85 567 q 126 470 85 504 q 225 437 168 437 q 320 467 280 437 q 360 552 360 498 q 318 632 360 608 q 213 657 276 657 q 195 657 203 657 q 176 657 181 657 l 176 722 q 279 733 249 722 q 334 815 334 752 q 300 881 334 856 q 220 907 267 907 q 133 875 169 907 q 97 781 97 844 l 15 781 q 78 926 15 875 q 220 972 135 972 q 364 930 303 972 q 426 817 426 888 q 344 697 426 733 q 421 642 392 681 q 450 552 450 603 "},"[":{x_min:0,x_max:273.609375,ha:371,o:"m 273 -281 l 0 -281 l 0 1013 l 273 1013 l 273 920 l 124 920 l 124 -187 l 273 -187 l 273 -281 "},L:{x_min:0,x_max:645.828125,ha:696,o:"m 645 0 l 0 0 l 0 1013 l 140 1013 l 140 126 l 645 126 l 645 0 "},\u03C3:{x_min:0,x_max:803.390625,ha:894,o:"m 803 628 l 633 628 q 713 368 713 512 q 618 93 713 204 q 357 -25 518 -25 q 94 91 194 -25 q 0 368 0 201 q 94 644 0 533 q 356 761 194 761 q 481 750 398 761 q 608 739 564 739 l 803 739 l 803 628 m 360 85 q 529 180 467 85 q 584 374 584 262 q 527 566 584 490 q 352 651 463 651 q 187 559 247 651 q 135 368 135 478 q 189 175 135 254 q 360 85 251 85 "},\u03B6:{x_min:0,x_max:573,ha:642,o:"m 573 -40 q 553 -162 573 -97 q 510 -278 543 -193 l 400 -278 q 441 -187 428 -219 q 462 -90 462 -132 q 378 -14 462 -14 q 108 45 197 -14 q 0 290 0 117 q 108 631 0 462 q 353 901 194 767 l 55 901 l 55 1012 l 561 1012 l 561 924 q 261 669 382 831 q 128 301 128 489 q 243 117 128 149 q 458 98 350 108 q 573 -40 573 80 "},\u03B8:{x_min:0,x_max:674,ha:778,o:"m 674 496 q 601 160 674 304 q 336 -26 508 -26 q 73 153 165 -26 q 0 485 0 296 q 72 840 0 683 q 343 1045 166 1045 q 605 844 516 1045 q 674 496 674 692 m 546 579 q 498 798 546 691 q 336 935 437 935 q 178 798 237 935 q 126 579 137 701 l 546 579 m 546 475 l 126 475 q 170 233 126 348 q 338 80 230 80 q 504 233 447 80 q 546 475 546 346 "},\u039F:{x_min:0,x_max:958,ha:1054,o:"m 485 1042 q 834 883 703 1042 q 958 511 958 735 q 834 136 958 287 q 481 -26 701 -26 q 126 130 261 -26 q 0 504 0 279 q 127 880 0 729 q 485 1042 263 1042 m 480 98 q 731 225 638 98 q 815 504 815 340 q 733 783 815 670 q 480 913 640 913 q 226 785 321 913 q 142 504 142 671 q 226 224 142 339 q 480 98 319 98 "},\u0393:{x_min:0,x_max:705.28125,ha:749,o:"m 705 886 l 140 886 l 140 0 l 0 0 l 0 1012 l 705 1012 l 705 886 "}," ":{x_min:0,x_max:0,ha:375},"%":{x_min:-3,x_max:1089,ha:1186,o:"m 845 0 q 663 76 731 0 q 602 244 602 145 q 661 412 602 344 q 845 489 728 489 q 1027 412 959 489 q 1089 244 1089 343 q 1029 76 1089 144 q 845 0 962 0 m 844 103 q 945 143 909 103 q 981 243 981 184 q 947 340 981 301 q 844 385 909 385 q 744 342 781 385 q 708 243 708 300 q 741 147 708 186 q 844 103 780 103 m 888 986 l 284 -25 l 199 -25 l 803 986 l 888 986 m 241 468 q 58 545 126 468 q -3 715 -3 615 q 56 881 -3 813 q 238 958 124 958 q 421 881 353 958 q 483 712 483 813 q 423 544 483 612 q 241 468 356 468 m 241 855 q 137 811 175 855 q 100 710 100 768 q 136 612 100 653 q 240 572 172 572 q 344 614 306 572 q 382 713 382 656 q 347 810 382 771 q 241 855 308 855 "},P:{x_min:0,x_max:726,ha:806,o:"m 424 1013 q 640 931 555 1013 q 726 719 726 850 q 637 506 726 587 q 413 426 548 426 l 140 426 l 140 0 l 0 0 l 0 1013 l 424 1013 m 379 889 l 140 889 l 140 548 l 372 548 q 522 589 459 548 q 593 720 593 637 q 528 845 593 801 q 379 889 463 889 "},\u0388:{x_min:0,x_max:1078.21875,ha:1118,o:"m 1078 0 l 342 0 l 342 1013 l 1067 1013 l 1067 889 l 481 889 l 481 585 l 1019 585 l 1019 467 l 481 467 l 481 125 l 1078 125 l 1078 0 m 277 1040 l 83 799 l 0 799 l 140 1040 l 277 1040 "},\u038F:{x_min:.125,x_max:1136.546875,ha:1235,o:"m 1136 0 l 722 0 l 722 123 q 911 309 842 194 q 981 558 981 423 q 893 813 981 710 q 651 923 800 923 q 411 821 501 923 q 321 568 321 720 q 390 316 321 433 q 579 123 459 200 l 579 0 l 166 0 l 166 124 l 384 124 q 235 327 289 210 q 182 572 182 444 q 311 912 182 782 q 651 1042 441 1042 q 989 910 858 1042 q 1120 569 1120 778 q 1066 326 1120 443 q 917 124 1013 210 l 1136 124 l 1136 0 m 277 1040 l 83 800 l 0 800 l 140 1041 l 277 1040 "},_:{x_min:0,x_max:705.5625,ha:803,o:"m 705 -334 l 0 -334 l 0 -234 l 705 -234 l 705 -334 "},\u03AA:{x_min:-110,x_max:246,ha:275,o:"m 246 1046 l 118 1046 l 118 1189 l 246 1189 l 246 1046 m 18 1046 l -110 1046 l -110 1189 l 18 1189 l 18 1046 m 136 0 l 0 0 l 0 1012 l 136 1012 l 136 0 "},"+":{x_min:23,x_max:768,ha:792,o:"m 768 372 l 444 372 l 444 0 l 347 0 l 347 372 l 23 372 l 23 468 l 347 468 l 347 840 l 444 840 l 444 468 l 768 468 l 768 372 "},"\xBD":{x_min:0,x_max:1050,ha:1149,o:"m 1050 0 l 625 0 q 712 178 625 108 q 878 277 722 187 q 967 385 967 328 q 932 456 967 429 q 850 484 897 484 q 759 450 798 484 q 721 352 721 416 l 640 352 q 706 502 640 448 q 851 551 766 551 q 987 509 931 551 q 1050 385 1050 462 q 976 251 1050 301 q 829 179 902 215 q 717 68 740 133 l 1050 68 l 1050 0 m 834 985 l 215 -28 l 130 -28 l 750 984 l 834 985 m 224 422 l 142 422 l 142 811 l 0 811 l 0 867 q 104 889 62 867 q 164 973 157 916 l 224 973 l 224 422 "},\u03A1:{x_min:0,x_max:720,ha:783,o:"m 424 1013 q 637 933 554 1013 q 720 723 720 853 q 633 508 720 591 q 413 426 546 426 l 140 426 l 140 0 l 0 0 l 0 1013 l 424 1013 m 378 889 l 140 889 l 140 548 l 371 548 q 521 589 458 548 q 592 720 592 637 q 527 845 592 801 q 378 889 463 889 "},"'":{x_min:0,x_max:139,ha:236,o:"m 139 851 q 102 737 139 784 q 0 669 65 690 l 0 734 q 59 787 42 741 q 72 873 72 821 l 0 873 l 0 1013 l 139 1013 l 139 851 "},\u00AA:{x_min:0,x_max:350,ha:397,o:"m 350 625 q 307 616 328 616 q 266 631 281 616 q 247 673 251 645 q 190 628 225 644 q 116 613 156 613 q 32 641 64 613 q 0 722 0 669 q 72 826 0 800 q 247 866 159 846 l 247 887 q 220 934 247 916 q 162 953 194 953 q 104 934 129 953 q 76 882 80 915 l 16 882 q 60 976 16 941 q 166 1011 104 1011 q 266 979 224 1011 q 308 891 308 948 l 308 706 q 311 679 308 688 q 331 670 315 670 l 350 672 l 350 625 m 247 757 l 247 811 q 136 790 175 798 q 64 726 64 773 q 83 682 64 697 q 132 667 103 667 q 207 690 174 667 q 247 757 247 718 "},"\u0385":{x_min:0,x_max:450,ha:553,o:"m 450 800 l 340 800 l 340 925 l 450 925 l 450 800 m 406 1040 l 212 800 l 129 800 l 269 1040 l 406 1040 m 110 800 l 0 800 l 0 925 l 110 925 l 110 800 "},T:{x_min:0,x_max:777,ha:835,o:"m 777 894 l 458 894 l 458 0 l 319 0 l 319 894 l 0 894 l 0 1013 l 777 1013 l 777 894 "},\u03A6:{x_min:0,x_max:915,ha:997,o:"m 527 0 l 389 0 l 389 122 q 110 231 220 122 q 0 509 0 340 q 110 785 0 677 q 389 893 220 893 l 389 1013 l 527 1013 l 527 893 q 804 786 693 893 q 915 509 915 679 q 805 231 915 341 q 527 122 696 122 l 527 0 m 527 226 q 712 310 641 226 q 779 507 779 389 q 712 705 779 627 q 527 787 641 787 l 527 226 m 389 226 l 389 787 q 205 698 275 775 q 136 505 136 620 q 206 308 136 391 q 389 226 276 226 "},"\u204B":{x_min:0,x_max:0,ha:694},j:{x_min:-77.78125,x_max:167,ha:349,o:"m 167 871 l 42 871 l 42 1013 l 167 1013 l 167 871 m 167 -80 q 121 -231 167 -184 q -26 -278 76 -278 l -77 -278 l -77 -164 l -41 -164 q 26 -143 11 -164 q 42 -65 42 -122 l 42 737 l 167 737 l 167 -80 "},\u03A3:{x_min:0,x_max:756.953125,ha:819,o:"m 756 0 l 0 0 l 0 107 l 395 523 l 22 904 l 22 1013 l 745 1013 l 745 889 l 209 889 l 566 523 l 187 125 l 756 125 l 756 0 "},"\u203A":{x_min:18.0625,x_max:774,ha:792,o:"m 774 376 l 18 40 l 18 149 l 631 421 l 18 692 l 18 799 l 774 465 l 774 376 "},"<":{x_min:17.984375,x_max:773.609375,ha:792,o:"m 773 40 l 18 376 l 17 465 l 773 799 l 773 692 l 159 420 l 773 149 l 773 40 "},"\xA3":{x_min:0,x_max:704.484375,ha:801,o:"m 704 41 q 623 -10 664 5 q 543 -26 583 -26 q 359 15 501 -26 q 243 36 288 36 q 158 23 197 36 q 73 -21 119 10 l 6 76 q 125 195 90 150 q 175 331 175 262 q 147 443 175 383 l 0 443 l 0 512 l 108 512 q 43 734 43 623 q 120 929 43 854 q 358 1010 204 1010 q 579 936 487 1010 q 678 729 678 857 l 678 684 l 552 684 q 504 838 552 780 q 362 896 457 896 q 216 852 263 896 q 176 747 176 815 q 199 627 176 697 q 248 512 217 574 l 468 512 l 468 443 l 279 443 q 297 356 297 398 q 230 194 297 279 q 153 107 211 170 q 227 133 190 125 q 293 142 264 142 q 410 119 339 142 q 516 96 482 96 q 579 105 550 96 q 648 142 608 115 l 704 41 "},t:{x_min:0,x_max:367,ha:458,o:"m 367 0 q 312 -5 339 -2 q 262 -8 284 -8 q 145 28 183 -8 q 108 143 108 64 l 108 638 l 0 638 l 0 738 l 108 738 l 108 944 l 232 944 l 232 738 l 367 738 l 367 638 l 232 638 l 232 185 q 248 121 232 140 q 307 102 264 102 q 345 104 330 102 q 367 107 360 107 l 367 0 "},"\xAC":{x_min:0,x_max:706,ha:803,o:"m 706 411 l 706 158 l 630 158 l 630 335 l 0 335 l 0 411 l 706 411 "},\u03BB:{x_min:0,x_max:750,ha:803,o:"m 750 -7 q 679 -15 716 -15 q 538 59 591 -15 q 466 214 512 97 l 336 551 l 126 0 l 0 0 l 270 705 q 223 837 247 770 q 116 899 190 899 q 90 898 100 899 l 90 1004 q 152 1011 125 1011 q 298 938 244 1011 q 373 783 326 901 l 605 192 q 649 115 629 136 q 716 95 669 95 l 736 95 q 750 97 745 97 l 750 -7 "},W:{x_min:0,x_max:1263.890625,ha:1351,o:"m 1263 1013 l 995 0 l 859 0 l 627 837 l 405 0 l 265 0 l 0 1013 l 136 1013 l 342 202 l 556 1013 l 701 1013 l 921 207 l 1133 1012 l 1263 1013 "},">":{x_min:18.0625,x_max:774,ha:792,o:"m 774 376 l 18 40 l 18 149 l 631 421 l 18 692 l 18 799 l 774 465 l 774 376 "},v:{x_min:0,x_max:675.15625,ha:761,o:"m 675 738 l 404 0 l 272 0 l 0 738 l 133 737 l 340 147 l 541 737 l 675 738 "},\u03C4:{x_min:.28125,x_max:644.5,ha:703,o:"m 644 628 l 382 628 l 382 179 q 388 120 382 137 q 436 91 401 91 q 474 94 447 91 q 504 97 501 97 l 504 0 q 454 -9 482 -5 q 401 -14 426 -14 q 278 67 308 -14 q 260 233 260 118 l 260 628 l 0 628 l 0 739 l 644 739 l 644 628 "},\u03BE:{x_min:0,x_max:624.9375,ha:699,o:"m 624 -37 q 608 -153 624 -96 q 563 -278 593 -211 l 454 -278 q 491 -183 486 -200 q 511 -83 511 -126 q 484 -23 511 -44 q 370 1 452 1 q 323 0 354 1 q 283 -1 293 -1 q 84 76 169 -1 q 0 266 0 154 q 56 431 0 358 q 197 538 108 498 q 94 613 134 562 q 54 730 54 665 q 77 823 54 780 q 143 901 101 867 l 27 901 l 27 1012 l 576 1012 l 576 901 l 380 901 q 244 863 303 901 q 178 745 178 820 q 312 600 178 636 q 532 582 380 582 l 532 479 q 276 455 361 479 q 118 281 118 410 q 165 173 118 217 q 274 120 208 133 q 494 101 384 110 q 624 -37 624 76 "},"&":{x_min:-3,x_max:894.25,ha:992,o:"m 894 0 l 725 0 l 624 123 q 471 0 553 40 q 306 -41 390 -41 q 168 -7 231 -41 q 62 92 105 26 q 14 187 31 139 q -3 276 -3 235 q 55 433 -3 358 q 248 581 114 508 q 170 689 196 640 q 137 817 137 751 q 214 985 137 922 q 384 1041 284 1041 q 548 988 483 1041 q 622 824 622 928 q 563 666 622 739 q 431 556 516 608 l 621 326 q 649 407 639 361 q 663 493 653 426 l 781 493 q 703 229 781 352 l 894 0 m 504 818 q 468 908 504 877 q 384 940 433 940 q 293 907 331 940 q 255 818 255 875 q 289 714 255 767 q 363 628 313 678 q 477 729 446 682 q 504 818 504 771 m 556 209 l 314 499 q 179 395 223 449 q 135 283 135 341 q 146 222 135 253 q 183 158 158 192 q 333 80 241 80 q 556 209 448 80 "},\u039B:{x_min:0,x_max:862.5,ha:942,o:"m 862 0 l 719 0 l 426 847 l 143 0 l 0 0 l 356 1013 l 501 1013 l 862 0 "},I:{x_min:41,x_max:180,ha:293,o:"m 180 0 l 41 0 l 41 1013 l 180 1013 l 180 0 "},G:{x_min:0,x_max:921,ha:1011,o:"m 921 0 l 832 0 l 801 136 q 655 15 741 58 q 470 -28 568 -28 q 126 133 259 -28 q 0 499 0 284 q 125 881 0 731 q 486 1043 259 1043 q 763 957 647 1043 q 905 709 890 864 l 772 709 q 668 866 747 807 q 486 926 589 926 q 228 795 322 926 q 142 507 142 677 q 228 224 142 342 q 483 94 323 94 q 712 195 625 94 q 796 435 796 291 l 477 435 l 477 549 l 921 549 l 921 0 "},\u03B0:{x_min:0,x_max:617,ha:725,o:"m 524 800 l 414 800 l 414 925 l 524 925 l 524 800 m 183 800 l 73 800 l 73 925 l 183 925 l 183 800 m 617 352 q 540 93 617 199 q 308 -24 455 -24 q 76 93 161 -24 q 0 352 0 199 l 0 738 l 126 738 l 126 354 q 169 185 126 257 q 312 98 220 98 q 451 185 402 98 q 492 354 492 257 l 492 738 l 617 738 l 617 352 m 489 1040 l 300 819 l 216 819 l 351 1040 l 489 1040 "},"`":{x_min:0,x_max:138.890625,ha:236,o:"m 138 699 l 0 699 l 0 861 q 36 974 0 929 q 138 1041 72 1020 l 138 977 q 82 931 95 969 q 69 839 69 893 l 138 839 l 138 699 "},"\xB7":{x_min:0,x_max:142,ha:239,o:"m 142 585 l 0 585 l 0 738 l 142 738 l 142 585 "},\u03A5:{x_min:.328125,x_max:819.515625,ha:889,o:"m 819 1013 l 482 416 l 482 0 l 342 0 l 342 416 l 0 1013 l 140 1013 l 411 533 l 679 1013 l 819 1013 "},r:{x_min:0,x_max:355.5625,ha:432,o:"m 355 621 l 343 621 q 179 569 236 621 q 122 411 122 518 l 122 0 l 0 0 l 0 737 l 117 737 l 117 604 q 204 719 146 686 q 355 753 262 753 l 355 621 "},x:{x_min:0,x_max:675,ha:764,o:"m 675 0 l 525 0 l 331 286 l 144 0 l 0 0 l 256 379 l 12 738 l 157 737 l 336 473 l 516 738 l 661 738 l 412 380 l 675 0 "},\u03BC:{x_min:0,x_max:696.609375,ha:747,o:"m 696 -4 q 628 -14 657 -14 q 498 97 513 -14 q 422 8 470 41 q 313 -24 374 -24 q 207 3 258 -24 q 120 80 157 31 l 120 -278 l 0 -278 l 0 738 l 124 738 l 124 343 q 165 172 124 246 q 308 82 216 82 q 451 177 402 82 q 492 358 492 254 l 492 738 l 616 738 l 616 214 q 623 136 616 160 q 673 92 636 92 q 696 95 684 92 l 696 -4 "},h:{x_min:0,x_max:615,ha:724,o:"m 615 472 l 615 0 l 490 0 l 490 454 q 456 590 490 535 q 338 654 416 654 q 186 588 251 654 q 122 436 122 522 l 122 0 l 0 0 l 0 1013 l 122 1013 l 122 633 q 218 727 149 694 q 362 760 287 760 q 552 676 484 760 q 615 472 615 600 "},".":{x_min:0,x_max:142,ha:239,o:"m 142 0 l 0 0 l 0 151 l 142 151 l 142 0 "},\u03C6:{x_min:-2,x_max:878,ha:974,o:"m 496 -279 l 378 -279 l 378 -17 q 101 88 204 -17 q -2 367 -2 194 q 68 626 -2 510 q 283 758 151 758 l 283 646 q 167 537 209 626 q 133 373 133 462 q 192 177 133 254 q 378 93 259 93 l 378 758 q 445 764 426 763 q 476 765 464 765 q 765 659 653 765 q 878 377 878 553 q 771 96 878 209 q 496 -17 665 -17 l 496 -279 m 496 93 l 514 93 q 687 183 623 93 q 746 380 746 265 q 691 569 746 491 q 522 658 629 658 l 496 656 l 496 93 "},";":{x_min:0,x_max:142,ha:239,o:"m 142 585 l 0 585 l 0 738 l 142 738 l 142 585 m 142 -12 q 105 -132 142 -82 q 0 -206 68 -182 l 0 -138 q 58 -82 43 -123 q 68 0 68 -56 l 0 0 l 0 151 l 142 151 l 142 -12 "},f:{x_min:0,x_max:378,ha:472,o:"m 378 638 l 246 638 l 246 0 l 121 0 l 121 638 l 0 638 l 0 738 l 121 738 q 137 935 121 887 q 290 1028 171 1028 q 320 1027 305 1028 q 378 1021 334 1026 l 378 908 q 323 918 346 918 q 257 870 273 918 q 246 780 246 840 l 246 738 l 378 738 l 378 638 "},"\u201C":{x_min:1,x_max:348.21875,ha:454,o:"m 140 670 l 1 670 l 1 830 q 37 943 1 897 q 140 1011 74 990 l 140 947 q 82 900 97 940 q 68 810 68 861 l 140 810 l 140 670 m 348 670 l 209 670 l 209 830 q 245 943 209 897 q 348 1011 282 990 l 348 947 q 290 900 305 940 q 276 810 276 861 l 348 810 l 348 670 "},A:{x_min:.03125,x_max:906.953125,ha:1008,o:"m 906 0 l 756 0 l 648 303 l 251 303 l 142 0 l 0 0 l 376 1013 l 529 1013 l 906 0 m 610 421 l 452 867 l 293 421 l 610 421 "},"\u2018":{x_min:1,x_max:139.890625,ha:236,o:"m 139 670 l 1 670 l 1 830 q 37 943 1 897 q 139 1011 74 990 l 139 947 q 82 900 97 940 q 68 810 68 861 l 139 810 l 139 670 "},\u03CA:{x_min:-70,x_max:283,ha:361,o:"m 283 800 l 173 800 l 173 925 l 283 925 l 283 800 m 40 800 l -70 800 l -70 925 l 40 925 l 40 800 m 283 3 q 232 -10 257 -5 q 181 -15 206 -15 q 84 26 118 -15 q 41 200 41 79 l 41 737 l 166 737 l 167 215 q 171 141 167 157 q 225 101 182 101 q 247 103 238 101 q 283 112 256 104 l 283 3 "},\u03C0:{x_min:-.21875,x_max:773.21875,ha:857,o:"m 773 -7 l 707 -11 q 575 40 607 -11 q 552 174 552 77 l 552 226 l 552 626 l 222 626 l 222 0 l 97 0 l 97 626 l 0 626 l 0 737 l 773 737 l 773 626 l 676 626 l 676 171 q 695 103 676 117 q 773 90 714 90 l 773 -7 "},\u03AC:{x_min:0,x_max:765.5625,ha:809,o:"m 765 -4 q 698 -14 726 -14 q 564 97 586 -14 q 466 7 525 40 q 337 -26 407 -26 q 88 98 186 -26 q 0 369 0 212 q 88 637 0 525 q 337 760 184 760 q 465 727 407 760 q 563 637 524 695 l 563 738 l 685 738 l 685 222 q 693 141 685 168 q 748 94 708 94 q 765 95 760 94 l 765 -4 m 584 371 q 531 562 584 485 q 360 653 470 653 q 192 566 254 653 q 135 379 135 489 q 186 181 135 261 q 358 84 247 84 q 528 176 465 84 q 584 371 584 260 m 604 1040 l 415 819 l 332 819 l 466 1040 l 604 1040 "},O:{x_min:0,x_max:958,ha:1057,o:"m 485 1041 q 834 882 702 1041 q 958 512 958 734 q 834 136 958 287 q 481 -26 702 -26 q 126 130 261 -26 q 0 504 0 279 q 127 880 0 728 q 485 1041 263 1041 m 480 98 q 731 225 638 98 q 815 504 815 340 q 733 783 815 669 q 480 912 640 912 q 226 784 321 912 q 142 504 142 670 q 226 224 142 339 q 480 98 319 98 "},n:{x_min:0,x_max:615,ha:724,o:"m 615 463 l 615 0 l 490 0 l 490 454 q 453 592 490 537 q 331 656 410 656 q 178 585 240 656 q 117 421 117 514 l 117 0 l 0 0 l 0 738 l 117 738 l 117 630 q 218 728 150 693 q 359 764 286 764 q 552 675 484 764 q 615 463 615 593 "},l:{x_min:41,x_max:166,ha:279,o:"m 166 0 l 41 0 l 41 1013 l 166 1013 l 166 0 "},"\xA4":{x_min:40.09375,x_max:728.796875,ha:825,o:"m 728 304 l 649 224 l 512 363 q 383 331 458 331 q 256 363 310 331 l 119 224 l 40 304 l 177 441 q 150 553 150 493 q 184 673 150 621 l 40 818 l 119 898 l 267 749 q 321 766 291 759 q 384 773 351 773 q 447 766 417 773 q 501 749 477 759 l 649 898 l 728 818 l 585 675 q 612 618 604 648 q 621 553 621 587 q 591 441 621 491 l 728 304 m 384 682 q 280 643 318 682 q 243 551 243 604 q 279 461 243 499 q 383 423 316 423 q 487 461 449 423 q 525 553 525 500 q 490 641 525 605 q 384 682 451 682 "},\u03BA:{x_min:0,x_max:632.328125,ha:679,o:"m 632 0 l 482 0 l 225 384 l 124 288 l 124 0 l 0 0 l 0 738 l 124 738 l 124 446 l 433 738 l 596 738 l 312 466 l 632 0 "},p:{x_min:0,x_max:685,ha:786,o:"m 685 364 q 598 96 685 205 q 350 -23 504 -23 q 121 89 205 -23 l 121 -278 l 0 -278 l 0 738 l 121 738 l 121 633 q 220 726 159 691 q 351 761 280 761 q 598 636 504 761 q 685 364 685 522 m 557 371 q 501 560 557 481 q 330 651 437 651 q 162 559 223 651 q 108 366 108 479 q 162 177 108 254 q 333 87 224 87 q 502 178 441 87 q 557 371 557 258 "},"\u2021":{x_min:0,x_max:777,ha:835,o:"m 458 238 l 458 0 l 319 0 l 319 238 l 0 238 l 0 360 l 319 360 l 319 681 l 0 683 l 0 804 l 319 804 l 319 1015 l 458 1013 l 458 804 l 777 804 l 777 683 l 458 683 l 458 360 l 777 360 l 777 238 l 458 238 "},\u03C8:{x_min:0,x_max:808,ha:907,o:"m 465 -278 l 341 -278 l 341 -15 q 87 102 180 -15 q 0 378 0 210 l 0 739 l 133 739 l 133 379 q 182 195 133 275 q 341 98 242 98 l 341 922 l 465 922 l 465 98 q 623 195 563 98 q 675 382 675 278 l 675 742 l 808 742 l 808 381 q 720 104 808 213 q 466 -13 627 -13 l 465 -278 "},\u03B7:{x_min:.78125,x_max:697,ha:810,o:"m 697 -278 l 572 -278 l 572 454 q 540 587 572 536 q 425 650 501 650 q 271 579 337 650 q 206 420 206 509 l 206 0 l 81 0 l 81 489 q 73 588 81 562 q 0 644 56 644 l 0 741 q 68 755 38 755 q 158 720 124 755 q 200 630 193 686 q 297 726 234 692 q 434 761 359 761 q 620 692 544 761 q 697 516 697 624 l 697 -278 "}},rLe="normal",sLe=1189,oLe=-100,aLe="normal",lLe={yMin:-334,xMin:-111,yMax:1189,xMax:1672},cLe=1e3,uLe={postscript_name:"Helvetiker-Regular",version_string:"Version 1.00 2004 initial release",vendor_url:"http://www.magenta.gr/",full_font_name:"Helvetiker",font_family_name:"Helvetiker",copyright:"Copyright (c) \u039Cagenta ltd, 2004",description:"",trademark:"",designer:"",designer_url:"",unique_font_identifier:"\u039Cagenta ltd:Helvetiker:22-10-104",license_url:"http://www.ellak.gr/fonts/MgOpen/license.html",license_description:`Copyright (c) 2004 by MAGENTA Ltd. All Rights Reserved.\r5223+ `),e},ZV=function(e,t){return e.onBeforeCompile=function(n){e.userData.shader=t(n)},e},xLe=function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:function(r){return r};if(e.userData.shader)t(e.userData.shader.uniforms);else{var n=e.onBeforeCompile;e.onBeforeCompile=function(r){n(r),t(r.uniforms)}}},yLe=["stroke"],Ju=window.THREE?window.THREE:{BufferGeometry:Xn,CubicBezierCurve3:i_,Curve:za,Group:Br,Line:o0,Mesh:Hn,NormalBlending:Ts,ShaderMaterial:ds,TubeGeometry:X2,Vector3:re},bLe=m1.default.default||m1.default,tae=Qr({props:{arcsData:{default:[]},arcStartLat:{default:"startLat"},arcStartLng:{default:"startLng"},arcStartAltitude:{default:0},arcEndLat:{default:"endLat"},arcEndLng:{default:"endLng"},arcEndAltitude:{default:0},arcColor:{default:function(){return"#ffffaa"}},arcAltitude:{},arcAltitudeAutoScale:{default:.5},arcStroke:{},arcCurveResolution:{default:64,triggerUpdate:!1},arcCircularResolution:{default:6,triggerUpdate:!1},arcDashLength:{default:1},arcDashGap:{default:0},arcDashInitialGap:{default:0},arcDashAnimateTime:{default:0},arcsTransitionDuration:{default:1e3,triggerUpdate:!1}},methods:{pauseAnimation:function(e){var t;(t=e.ticker)===null||t===void 0||t.pause()},resumeAnimation:function(e){var t;(t=e.ticker)===null||t===void 0||t.resume()},_destructor:function(e){var t;e.sharedMaterial.dispose(),(t=e.ticker)===null||t===void 0||t.dispose()}},stateInit:function(e){var t=e.tweenGroup;return{tweenGroup:t,ticker:new bLe,sharedMaterial:new Ju.ShaderMaterial($i($i({},eae()),{},{transparent:!0,blending:Ju.NormalBlending}))}},init:function(e,t){is(e),t.scene=e,t.dataMapper=new Ll(e,{objBindAttr:"__threeObjArc"}).onCreateObj(function(){var n=new Ju.Group;return n.__globeObjType="arc",n}),t.ticker.onTick.add(function(n,r){t.dataMapper.entries().map(function(s){var o=Ir(s,2),a=o[1];return a}).filter(function(s){return s.children.length&&s.children[0].material&&s.children[0].__dashAnimateStep}).forEach(function(s){var o=s.children[0],a=o.__dashAnimateStep*r,l=o.material.uniforms.dashTranslate.value%1e9;o.material.uniforms.dashTranslate.value=l+a})})},update:function(e){var t=st(e.arcStartLat),n=st(e.arcStartLng),r=st(e.arcStartAltitude),s=st(e.arcEndLat),o=st(e.arcEndLng),a=st(e.arcEndAltitude),l=st(e.arcAltitude),c=st(e.arcAltitudeAutoScale),u=st(e.arcStroke),f=st(e.arcColor),d=st(e.arcDashLength),A=st(e.arcDashGap),y=st(e.arcDashInitialGap),w=st(e.arcDashAnimateTime);e.dataMapper.onUpdateObj(function(I,P){var F=u(P),D=F!=null;if(!I.children.length||D!==(I.children[0].type==="Mesh")){is(I);var L=D?new Ju.Mesh:new Ju.Line(new Ju.BufferGeometry);L.material=e.sharedMaterial.clone(),I.add(L)}var C=I.children[0];Object.assign(C.material.uniforms,{dashSize:{value:d(P)},gapSize:{value:A(P)},dashOffset:{value:y(P)}});var B=w(P);C.__dashAnimateStep=B>0?1e3/B:0;var k=T(f(P),e.arcCurveResolution,D?e.arcCircularResolution+1:1),z=R(e.arcCurveResolution,D?e.arcCircularResolution+1:1,!0);C.geometry.setAttribute("color",k),C.geometry.setAttribute("relDistance",z);var G=function($){var J=I.__currentTargetD=$,te=J.stroke,ce=aLe(J,yLe),he=S(ce);D?(C.geometry&&C.geometry.dispose(),C.geometry=new Ju.TubeGeometry(he,e.arcCurveResolution,te/2,e.arcCircularResolution),C.geometry.setAttribute("color",k),C.geometry.setAttribute("relDistance",z)):C.geometry.setFromPoints(he.getPoints(e.arcCurveResolution))},W={stroke:F,alt:l(P),altAutoScale:+c(P),startLat:+t(P),startLng:+n(P),startAlt:+r(P),endLat:+s(P),endLng:+o(P),endAlt:+a(P)},Y=I.__currentTargetD||Object.assign({},W,{altAutoScale:-.001});Object.keys(W).some(function(H){return Y[H]!==W[H]})&&(!e.arcsTransitionDuration||e.arcsTransitionDuration<0?G(W):e.tweenGroup.add(new uo(Y).to(W,e.arcsTransitionDuration).easing(Jr.Quadratic.InOut).onUpdate(G).onComplete(function(){e.tweenGroup.remove(this)}).start()))}).digest(e.arcsData);function S(I){var P=I.alt,F=I.altAutoScale,D=I.startLat,L=I.startLng,C=I.startAlt,B=I.endLat,k=I.endLng,z=I.endAlt,G=function(Ee){var Ve=Ir(Ee,3),Ye=Ve[0],Mt=Ve[1],Et=Ve[2],Pt=ou(Mt,Ye,Et),dn=Pt.x,Gt=Pt.y,$e=Pt.z;return new Ju.Vector3(dn,Gt,$e)},W=[L,D],Y=[k,B],H=P;if(H==null&&(H=Ml(W,Y)/2*F+Math.max(C,z)),H||C||z){var $=Eg(W,Y),J=function(Ee,Ve){return Ve+(Ve-Ee)*(Ee<Ve?.5:.25)},te=[.25,.75].map(function(mt){return[].concat(tr($(mt)),[J(mt<.5?C:z,H)])}),ce=Ir(te,2),he=ce[0],ve=ce[1],Re=$V(Ju.CubicBezierCurve3,tr([[].concat(W,[C]),he,ve,[].concat(Y,[z])].map(G)));return Re}else{var Qe=.001;return Fe.apply(void 0,tr([[].concat(W,[Qe]),[].concat(Y,[Qe])].map(G)))}function Fe(mt,Ee){var Ve=mt.angleTo(Ee),Ye=Ve===0?function(){return mt.clone()}:function(Et){return new Ju.Vector3().addVectors(mt.clone().multiplyScalar(Math.sin((1-Et)*Ve)),Ee.clone().multiplyScalar(Math.sin(Et*Ve))).divideScalar(Math.sin(Ve))},Mt=new Ju.Curve;return Mt.getPoint=Ye,Mt}}function T(I,P){var F=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,D=P+1,L;if(I instanceof Array||I instanceof Function){var C=I instanceof Array?Tl().domain(I.map(function(H,$){return $/(I.length-1)})).range(I):I;L=function($){return Rm(C($),!0,!0)}}else{var B=Rm(I,!0,!0);L=function(){return B}}for(var k=[],z=0,G=D;z<G;z++)for(var W=L(z/(G-1)),Y=0;Y<F;Y++)k.push(W);return Ff(k,4)}function R(I){for(var P=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,F=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,D=I+1,L=[],C=0,B=D;C<B;C++)for(var k=C/(B-1),z=0;z<P;z++)L.push(k);return F&&L.reverse(),Ff(L,1)}}}),Em=window.THREE?window.THREE:{BufferGeometry:Xn,DoubleSide:vr,Mesh:Hn,MeshLambertMaterial:Ga,Object3D:lr},Goe=Object.assign({},bw),qoe=Goe.BufferGeometryUtils||Goe,nae=Qr({props:{hexBinPointsData:{default:[]},hexBinPointLat:{default:"lat"},hexBinPointLng:{default:"lng"},hexBinPointWeight:{default:1},hexBinResolution:{default:4},hexMargin:{default:.2},hexTopCurvatureResolution:{default:5},hexTopColor:{default:function(){return"#ffffaa"}},hexSideColor:{default:function(){return"#ffffaa"}},hexAltitude:{default:function(e){var t=e.sumWeight;return t*.01}},hexBinMerge:{default:!1},hexTransitionDuration:{default:1e3,triggerUpdate:!1}},init:function(e,t,n){var r=n.tweenGroup;is(e),t.scene=e,t.tweenGroup=r,t.dataMapper=new Ll(e,{objBindAttr:"__threeObjHexbin"})},update:function(e,t){var n=st(e.hexBinPointLat),r=st(e.hexBinPointLng),s=st(e.hexBinPointWeight),o=st(e.hexAltitude),a=st(e.hexTopColor),l=st(e.hexSideColor),c=st(e.hexMargin),u=_ee(e.hexBinPointsData.map(function(R){return $i($i({},R),{},{h3Idx:Lee(n(R),r(R),e.hexBinResolution)})}),"h3Idx"),f=Object.entries(u).map(function(R){var I=Ir(R,2),P=I[0],F=I[1];return{h3Idx:P,points:F,sumWeight:F.reduce(function(D,L){return D+ +s(L)},0)}}),d={};if(!e.hexBinMerge&&t.hasOwnProperty("hexBinMerge")&&is(e.scene),e.dataMapper.scene=e.hexBinMerge?new Em.Object3D:e.scene,e.dataMapper.id(function(R){return R.h3Idx}).onCreateObj(S).onUpdateObj(T).digest(f),e.hexBinMerge){var A=f.length?(qoe.mergeGeometries||qoe.mergeBufferGeometries)(f.map(function(R){var I=e.dataMapper.getObj(R),P=I.geometry.toNonIndexed();I.updateMatrix(),P.applyMatrix4(I.matrix);var F=Rm(a(R)),D=Rm(l(R)),L=P.getAttribute("position").count,C=P.groups[0].count;return P.setAttribute("color",Ff(tr(new Array(L)).map(function(B,k){return k>=C?F:D}),4)),P})):new Em.BufferGeometry,y=new Em.MeshLambertMaterial({color:16777215,transparent:!0,vertexColors:!0,side:Em.DoubleSide});y.onBeforeCompile=function(R){y.userData.shader=XV(R)};var w=new Em.Mesh(A,y);w.__globeObjType="hexBinPoints",w.__data=f,e.dataMapper.clear(),is(e.scene),e.scene.add(w)}function S(R){var I=new Em.Mesh;I.__hexCenter=NO(R.h3Idx),I.__hexGeoJson=FO(R.h3Idx,!0).reverse();var P=I.__hexCenter[1];return I.__hexGeoJson.forEach(function(F){var D=F[0];Math.abs(P-D)>170&&(F[0]+=P>D?360:-360)}),I.__globeObjType="hexbin",I}function T(R,I){var P=function(J,te,ce){return J-(J-te)*ce},F=Math.max(0,Math.min(1,+c(I))),D=Ir(R.__hexCenter,2),L=D[0],C=D[1],B=F===0?R.__hexGeoJson:R.__hexGeoJson.map(function($){var J=Ir($,2),te=J[0],ce=J[1];return[[te,C],[ce,L]].map(function(he){var ve=Ir(he,2),Re=ve[0],Qe=ve[1];return P(Re,Qe,F)})}),k=e.hexTopCurvatureResolution;R.geometry&&R.geometry.dispose(),R.geometry=new lR([B],0,_r,!1,!0,!0,k);var z={alt:+o(I)},G=function(J){var te=R.__currentTargetD=J,ce=te.alt;R.scale.x=R.scale.y=R.scale.z=1+ce;var he=_r/(ce+1);R.geometry.setAttribute("surfaceRadius",Ff(Array(R.geometry.getAttribute("position").count).fill(he),1))},W=R.__currentTargetD||Object.assign({},z,{alt:-.001});if(Object.keys(z).some(function($){return W[$]!==z[$]})&&(e.hexBinMerge||!e.hexTransitionDuration||e.hexTransitionDuration<0?G(z):e.tweenGroup.add(new uo(W).to(z,e.hexTransitionDuration).easing(Jr.Quadratic.InOut).onUpdate(G).onComplete(function(){e.tweenGroup.remove(this)}).start())),!e.hexBinMerge){var Y=l(I),H=a(I);[Y,H].forEach(function($){if(!d.hasOwnProperty($)){var J=th($);d[$]=ZV(new Em.MeshLambertMaterial({color:Nf($),transparent:J<1,opacity:J,side:Em.DoubleSide}),XV)}}),R.material=[Y,H].map(function($){return d[$]})}}}}),iae=function(e){return e*e},np=function(e){return e*Math.PI/180};function wLe(i,e){var t=Math.sqrt,n=Math.cos,r=function(u){return iae(Math.sin(u/2))},s=np(i[1]),o=np(e[1]),a=np(i[0]),l=np(e[0]);return 2*Math.asin(t(r(o-s)+n(s)*n(o)*r(l-a)))}var SLe=Math.sqrt(2*Math.PI);function TLe(i,e){return Math.exp(-iae(i/e)/2)/(e*SLe)}var ELe=function(e){var t=Ir(e,2),n=t[0],r=t[1],s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},a=o.lngAccessor,l=a===void 0?function(S){return S[0]}:a,c=o.latAccessor,u=c===void 0?function(S){return S[1]}:c,f=o.weightAccessor,d=f===void 0?function(){return 1}:f,A=o.bandwidth,y=[n,r],w=A*Math.PI/180;return rC(s.map(function(S){var T=d(S);if(!T)return 0;var R=wLe(y,[l(S),u(S)]);return TLe(R,w)*T}))},MLe=(function(){var i=eLe(WV().m(function e(t){var n,r,s,o,a,l,c,u,f,d,A,y,w,S,T,R,I,P,F,D,L,C,B,k,z,G,W,Y,H,$,J,te,ce,he,ve,Re,Qe,Fe,mt,Ee,Ve=arguments,Ye,Mt,Et;return WV().w(function(Pt){for(;;)switch(Pt.n){case 0:if(r=Ve.length>1&&Ve[1]!==void 0?Ve[1]:[],s=Ve.length>2&&Ve[2]!==void 0?Ve[2]:{},o=s.lngAccessor,a=o===void 0?function(dn){return dn[0]}:o,l=s.latAccessor,c=l===void 0?function(dn){return dn[1]}:l,u=s.weightAccessor,f=u===void 0?function(){return 1}:u,d=s.bandwidth,(n=navigator)!==null&&n!==void 0&&n.gpu){Pt.n=1;break}return console.warn("WebGPU not enabled in browser. Please consider enabling it to improve performance."),Pt.a(2,t.map(function(dn){return ELe(dn,r,{lngAccessor:a,latAccessor:c,weightAccessor:f,bandwidth:d})}));case 1:return A=4,y=voe,w=_oe,S=Poe,T=Roe,R=Soe,I=Toe,P=xoe,F=Coe,D=Moe,L=boe,C=yoe,B=woe,k=Eoe,z=T(new s1(new Float32Array(t.flat().map(np)),2),"vec2",t.length),G=T(new s1(new Float32Array(r.map(function(dn){return[np(a(dn)),np(c(dn)),f(dn)]}).flat()),3),"vec3",r.length),W=new s1(t.length,1),Y=T(W,"float",t.length),H=R(Math.PI),$=F(H.mul(2)),J=function(Gt){return Gt.mul(Gt)},te=function(Gt){return J(D(Gt.div(2)))},ce=function(Gt,$e){var ot=R(Gt[1]),nt=R($e[1]),bt=R(Gt[0]),yt=R($e[0]);return R(2).mul(C(F(te(nt.sub(ot)).add(L(ot).mul(L(nt)).mul(te(yt.sub(bt)))))))},he=function(Gt,$e){return B(k(J(Gt.div($e)).div(2))).div($e.mul($))},ve=S(np(d)),Re=S(np(d*A)),Qe=S(r.length),Fe=y(function(){var dn=z.element(I),Gt=Y.element(I);Gt.assign(0),P(Qe,function($e){var ot=$e.i,nt=G.element(ot),bt=nt.z;w(bt,function(){var yt=ce(nt.xy,dn.xy);w(yt&&yt.lessThan(Re),function(){Gt.addAssign(he(yt,ve).mul(bt))})})})}),mt=Fe().compute(t.length),Ee=new xx,Pt.n=2,Ee.computeAsync(mt);case 2:return Ye=Array,Mt=Float32Array,Pt.n=3,Ee.getArrayBufferAsync(W);case 3:return Et=Pt.v,Pt.a(2,Ye.from.call(Ye,new Mt(Et)))}},e)}));return function(t){return i.apply(this,arguments)}})(),YP=window.THREE?window.THREE:{Mesh:Hn,MeshLambertMaterial:Ga,SphereGeometry:Va},CLe=3.5,RLe=.1,Hoe=100,PLe=function(e){var t=Uu(OO(e));return t.opacity=Math.cbrt(e),t.formatRgb()},rae=Qr({props:{heatmapsData:{default:[]},heatmapPoints:{default:function(e){return e}},heatmapPointLat:{default:function(e){return e[0]}},heatmapPointLng:{default:function(e){return e[1]}},heatmapPointWeight:{default:1},heatmapBandwidth:{default:2.5},heatmapColorFn:{default:function(){return PLe}},heatmapColorSaturation:{default:1.5},heatmapBaseAltitude:{default:.01},heatmapTopAltitude:{},heatmapsTransitionDuration:{default:0,triggerUpdate:!1}},init:function(e,t,n){var r=n.tweenGroup;is(e),t.scene=e,t.tweenGroup=r,t.dataMapper=new Ll(e,{objBindAttr:"__threeObjHeatmap"}).onCreateObj(function(){var s=new YP.Mesh(new YP.SphereGeometry(_r),ZV(new YP.MeshLambertMaterial({vertexColors:!0,transparent:!0}),_Le));return s.__globeObjType="heatmap",s})},update:function(e){var t=st(e.heatmapPoints),n=st(e.heatmapPointLat),r=st(e.heatmapPointLng),s=st(e.heatmapPointWeight),o=st(e.heatmapBandwidth),a=st(e.heatmapColorFn),l=st(e.heatmapColorSaturation),c=st(e.heatmapBaseAltitude),u=st(e.heatmapTopAltitude);e.dataMapper.onUpdateObj(function(f,d){var A=o(d),y=a(d),w=l(d),S=c(d),T=u(d),R=t(d).map(function(L){var C=n(L),B=r(L),k=ou(C,B),z=k.x,G=k.y,W=k.z;return{x:z,y:G,z:W,lat:C,lng:B,weight:s(L)}}),I=Math.max(RLe,A/CLe),P=Math.ceil(360/(I||-1));f.geometry.parameters.widthSegments!==P&&(f.geometry.dispose(),f.geometry=new YP.SphereGeometry(_r,P,P/2));var F=vLe(f.geometry.getAttribute("position")),D=F.map(function(L){var C=Ir(L,3),B=C[0],k=C[1],z=C[2],G=Koe({x:B,y:k,z}),W=G.lng,Y=G.lat;return[W,Y]});MLe(D,R,{latAccessor:function(C){return C.lat},lngAccessor:function(C){return C.lng},weightAccessor:function(C){return C.weight},bandwidth:A}).then(function(L){var C=tr(new Array(Hoe)).map(function(G,W){return Rm(y(W/(Hoe-1)))}),B=function(W){var Y=f.__currentTargetD=W,H=Y.kdeVals,$=Y.topAlt,J=Y.saturation,te=nC(H.map(Math.abs))||1e-15,ce=Jb([0,te/J],C);f.geometry.setAttribute("color",Ff(H.map(function(ve){return ce(Math.abs(ve))}),4));var he=Tl([0,te],[_r*(1+S),_r*(1+($||S))]);f.geometry.setAttribute("r",Ff(H.map(he)))},k={kdeVals:L,topAlt:T,saturation:w},z=f.__currentTargetD||Object.assign({},k,{kdeVals:L.map(function(){return 0}),topAlt:T&&S,saturation:.5});z.kdeVals.length!==L.length&&(z.kdeVals=L.slice()),Object.keys(k).some(function(G){return z[G]!==k[G]})&&(!e.heatmapsTransitionDuration||e.heatmapsTransitionDuration<0?B(k):e.tweenGroup.add(new uo(z).to(k,e.heatmapsTransitionDuration).easing(Jr.Quadratic.InOut).onUpdate(B).onComplete(function(){e.tweenGroup.remove(this)}).start()))})}).digest(e.heatmapsData)}}),Mm=window.THREE?window.THREE:{DoubleSide:vr,Group:Br,LineBasicMaterial:Iu,LineSegments:Jv,Mesh:Hn,MeshBasicMaterial:fs},sae=Qr({props:{polygonsData:{default:[]},polygonGeoJsonGeometry:{default:"geometry"},polygonSideColor:{default:function(){return"#ffffaa"}},polygonSideMaterial:{},polygonCapColor:{default:function(){return"#ffffaa"}},polygonCapMaterial:{},polygonStrokeColor:{},polygonAltitude:{default:.01},polygonCapCurvatureResolution:{default:5},polygonsTransitionDuration:{default:1e3,triggerUpdate:!1}},init:function(e,t,n){var r=n.tweenGroup;is(e),t.scene=e,t.tweenGroup=r,t.dataMapper=new Ll(e,{objBindAttr:"__threeObjPolygon"}).id(function(s){return s.id}).onCreateObj(function(){var s=new Mm.Group;return s.__defaultSideMaterial=ZV(new Mm.MeshBasicMaterial({side:Mm.DoubleSide,depthWrite:!0}),XV),s.__defaultCapMaterial=new Mm.MeshBasicMaterial({side:Mm.DoubleSide,depthWrite:!0}),s.add(new Mm.Mesh(void 0,[s.__defaultSideMaterial,s.__defaultCapMaterial])),s.add(new Mm.LineSegments(void 0,new Mm.LineBasicMaterial)),s.__globeObjType="polygon",s})},update:function(e){var t=st(e.polygonGeoJsonGeometry),n=st(e.polygonAltitude),r=st(e.polygonCapCurvatureResolution),s=st(e.polygonCapColor),o=st(e.polygonCapMaterial),a=st(e.polygonSideColor),l=st(e.polygonSideMaterial),c=st(e.polygonStrokeColor),u=[];e.polygonsData.forEach(function(f){var d={data:f,capColor:s(f),capMaterial:o(f),sideColor:a(f),sideMaterial:l(f),strokeColor:c(f),altitude:+n(f),capCurvatureResolution:+r(f)},A=t(f),y=f.__id||"".concat(Math.round(Math.random()*1e9));f.__id=y,A.type==="Polygon"?u.push($i({id:"".concat(y,"_0"),coords:A.coordinates},d)):A.type==="MultiPolygon"?u.push.apply(u,tr(A.coordinates.map(function(w,S){return $i({id:"".concat(y,"_").concat(S),coords:w},d)}))):console.warn("Unsupported GeoJson geometry type: ".concat(A.type,". Skipping geometry..."))}),e.dataMapper.onUpdateObj(function(f,d){var A=d.coords,y=d.capColor,w=d.capMaterial,S=d.sideColor,T=d.sideMaterial,R=d.strokeColor,I=d.altitude,P=d.capCurvatureResolution,F=Ir(f.children,2),D=F[0],L=F[1],C=!!R;L.visible=C;var B=!!(y||w),k=!!(S||T);ILe(D.geometry.parameters||{},{polygonGeoJson:A,curvatureResolution:P,closedTop:B,includeSides:k})||(D.geometry&&D.geometry.dispose(),D.geometry=new lR(A,0,_r,!1,B,k,P)),C&&(!L.geometry.parameters||L.geometry.parameters.geoJson.coordinates!==A||L.geometry.parameters.resolution!==P)&&(L.geometry&&L.geometry.dispose(),L.geometry=new fO({type:"Polygon",coordinates:A},_r,P));var z=k?0:-1,G=B?k?1:0:-1;if(z>=0&&(D.material[z]=T||f.__defaultSideMaterial),G>=0&&(D.material[G]=w||f.__defaultCapMaterial),[[!T&&S,z],[!w&&y,G]].forEach(function(te){var ce=Ir(te,2),he=ce[0],ve=ce[1];if(!(!he||ve<0)){var Re=D.material[ve],Qe=th(he);Re.color.set(Nf(he)),Re.transparent=Qe<1,Re.opacity=Qe}}),C){var W=L.material,Y=th(R);W.color.set(Nf(R)),W.transparent=Y<1,W.opacity=Y}var H={alt:I},$=function(ce){var he=f.__currentTargetD=ce,ve=he.alt;D.scale.x=D.scale.y=D.scale.z=1+ve,C&&(L.scale.x=L.scale.y=L.scale.z=1+ve+1e-4),xLe(f.__defaultSideMaterial,function(Re){return Re.uSurfaceRadius.value=_r/(ve+1)})},J=f.__currentTargetD||Object.assign({},H,{alt:-.001});Object.keys(H).some(function(te){return J[te]!==H[te]})&&(!e.polygonsTransitionDuration||e.polygonsTransitionDuration<0||J.alt===H.alt?$(H):e.tweenGroup.add(new uo(J).to(H,e.polygonsTransitionDuration).easing(Jr.Quadratic.InOut).onUpdate($).onComplete(function(){e.tweenGroup.remove(this)}).start()))}).digest(u)}});function ILe(i,e){var t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:function(){return function(n,r){return n===r}};return Object.entries(e).every(function(n){var r=Ir(n,2),s=r[0],o=r[1];return i.hasOwnProperty(s)&&t(s)(i[s],o)})}var Rx=window.THREE?window.THREE:{BufferGeometry:Xn,DoubleSide:vr,Mesh:Hn,MeshLambertMaterial:Ga,Vector3:re},Woe=Object.assign({},bw),joe=Woe.BufferGeometryUtils||Woe,oae=Qr({props:{hexPolygonsData:{default:[]},hexPolygonGeoJsonGeometry:{default:"geometry"},hexPolygonColor:{default:function(){return"#ffffaa"}},hexPolygonAltitude:{default:.001},hexPolygonResolution:{default:3},hexPolygonMargin:{default:.2},hexPolygonUseDots:{default:!1},hexPolygonCurvatureResolution:{default:5},hexPolygonDotResolution:{default:12},hexPolygonsTransitionDuration:{default:0,triggerUpdate:!1}},init:function(e,t,n){var r=n.tweenGroup;is(e),t.scene=e,t.tweenGroup=r,t.dataMapper=new Ll(e,{objBindAttr:"__threeObjHexPolygon"}).onCreateObj(function(){var s=new Rx.Mesh(void 0,new Rx.MeshLambertMaterial({side:Rx.DoubleSide}));return s.__globeObjType="hexPolygon",s})},update:function(e){var t=st(e.hexPolygonGeoJsonGeometry),n=st(e.hexPolygonColor),r=st(e.hexPolygonAltitude),s=st(e.hexPolygonResolution),o=st(e.hexPolygonMargin),a=st(e.hexPolygonUseDots),l=st(e.hexPolygonCurvatureResolution),c=st(e.hexPolygonDotResolution);e.dataMapper.onUpdateObj(function(u,f){var d=t(f),A=s(f),y=r(f),w=Math.max(0,Math.min(1,+o(f))),S=a(f),T=l(f),R=c(f),I=n(f),P=th(I);u.material.color.set(Nf(I)),u.material.transparent=P<1,u.material.opacity=P;var F={alt:y,margin:w,curvatureResolution:T},D={geoJson:d,h3Res:A},L=u.__currentTargetD||Object.assign({},F,{alt:-.001}),C=u.__currentMemD||D;if(Object.keys(F).some(function(G){return L[G]!==F[G]})||Object.keys(D).some(function(G){return C[G]!==D[G]})){u.__currentMemD=D;var B=[];d.type==="Polygon"?BO(d.coordinates,A,!0).forEach(function(G){return B.push(G)}):d.type==="MultiPolygon"?d.coordinates.forEach(function(G){return BO(G,A,!0).forEach(function(W){return B.push(W)})}):console.warn("Unsupported GeoJson geometry type: ".concat(d.type,". Skipping geometry..."));var k=B.map(function(G){var W=NO(G),Y=FO(G,!0).reverse(),H=W[1];return Y.forEach(function($){var J=$[0];Math.abs(H-J)>170&&($[0]+=H>J?360:-360)}),{h3Idx:G,hexCenter:W,hexGeoJson:Y}}),z=function(W){var Y=u.__currentTargetD=W,H=Y.alt,$=Y.margin,J=Y.curvatureResolution;u.geometry&&u.geometry.dispose(),u.geometry=k.length?(joe.mergeGeometries||joe.mergeBufferGeometries)(k.map(function(te){var ce=Ir(te.hexCenter,2),he=ce[0],ve=ce[1];if(S){var Re=ou(he,ve,H),Qe=ou(te.hexGeoJson[0][1],te.hexGeoJson[0][0],H),Fe=.85*(1-$)*new Rx.Vector3(Re.x,Re.y,Re.z).distanceTo(new Rx.Vector3(Qe.x,Qe.y,Qe.z)),mt=new t_(Fe,R);return mt.rotateX(p1(-he)),mt.rotateY(p1(ve)),mt.translate(Re.x,Re.y,Re.z),mt}else{var Ee=function(Mt,Et,Pt){return Mt-(Mt-Et)*Pt},Ve=$===0?te.hexGeoJson:te.hexGeoJson.map(function(Ye){var Mt=Ir(Ye,2),Et=Mt[0],Pt=Mt[1];return[[Et,ve],[Pt,he]].map(function(dn){var Gt=Ir(dn,2),$e=Gt[0],ot=Gt[1];return Ee($e,ot,$)})});return new lR([Ve],_r,_r*(1+H),!1,!0,!1,J)}})):new Rx.BufferGeometry};!e.hexPolygonsTransitionDuration||e.hexPolygonsTransitionDuration<0?z(F):e.tweenGroup.add(new uo(L).to(F,e.hexPolygonsTransitionDuration).easing(Jr.Quadratic.InOut).onUpdate(z).onComplete(function(){e.tweenGroup.remove(this)}).start())}}).digest(e.hexPolygonsData)}}),LLe=window.THREE?window.THREE:{Vector3:re};function DLe(i,e){var t=function(o,a){var l=o[o.length-1];return[].concat(tr(o),tr(Array(a-o.length).fill(l)))},n=Math.max(i.length,e.length),r=QF.apply(void 0,tr([i,e].map(function(s){return s.map(function(o){var a=o.x,l=o.y,c=o.z;return[a,l,c]})}).map(function(s){return t(s,n)})));return function(s){return s===0?i:s===1?e:r(s).map(function(o){var a=Ir(o,3),l=a[0],c=a[1],u=a[2];return new LLe.Vector3(l,c,u)})}}var d1=window.THREE?window.THREE:{BufferGeometry:Xn,Color:zt,Group:Br,Line:o0,NormalBlending:Ts,ShaderMaterial:ds,Vector3:re},NLe=m1.default.default||m1.default,aae=Qr({props:{pathsData:{default:[]},pathPoints:{default:function(e){return e}},pathPointLat:{default:function(e){return e[0]}},pathPointLng:{default:function(e){return e[1]}},pathPointAlt:{default:.001},pathResolution:{default:2},pathColor:{default:function(){return"#ffffaa"}},pathStroke:{},pathDashLength:{default:1},pathDashGap:{default:0},pathDashInitialGap:{default:0},pathDashAnimateTime:{default:0},pathTransitionDuration:{default:1e3,triggerUpdate:!1},rendererSize:{}},methods:{pauseAnimation:function(e){var t;(t=e.ticker)===null||t===void 0||t.pause()},resumeAnimation:function(e){var t;(t=e.ticker)===null||t===void 0||t.resume()},_destructor:function(e){var t;(t=e.ticker)===null||t===void 0||t.dispose()}},stateInit:function(e){var t=e.tweenGroup;return{tweenGroup:t,ticker:new NLe,sharedMaterial:new d1.ShaderMaterial($i($i({},eae()),{},{transparent:!0,blending:d1.NormalBlending}))}},init:function(e,t){is(e),t.scene=e,t.dataMapper=new Ll(e,{objBindAttr:"__threeObjPath"}).onCreateObj(function(){var n=new d1.Group;return n.__globeObjType="path",n}),t.ticker.onTick.add(function(n,r){t.dataMapper.entries().map(function(s){var o=Ir(s,2),a=o[1];return a}).filter(function(s){return s.children.length&&s.children[0].material&&s.children[0].__dashAnimateStep}).forEach(function(s){var o=s.children[0],a=o.__dashAnimateStep*r;if(o.type==="Line"){var l=o.material.uniforms.dashTranslate.value%1e9;o.material.uniforms.dashTranslate.value=l+a}else if(o.type==="Line2"){for(var c=o.material.dashOffset-a,u=o.material.dashSize+o.material.gapSize;c<=-u;)c+=u;o.material.dashOffset=c}})})},update:function(e){var t=st(e.pathPoints),n=st(e.pathPointLat),r=st(e.pathPointLng),s=st(e.pathPointAlt),o=st(e.pathStroke),a=st(e.pathColor),l=st(e.pathDashLength),c=st(e.pathDashGap),u=st(e.pathDashInitialGap),f=st(e.pathDashAnimateTime);e.dataMapper.onUpdateObj(function(S,T){var R=o(T),I=R!=null;if(!S.children.length||I===(S.children[0].type==="Line")){is(S);var P=I?new Mx(new Tm,new Rf):new d1.Line(new d1.BufferGeometry,e.sharedMaterial.clone());S.add(P)}var F=S.children[0],D=A(t(T),n,r,s,e.pathResolution),L=f(T);if(F.__dashAnimateStep=L>0?1e3/L:0,I){F.material.resolution=e.rendererSize;{var k=l(T),z=c(T),G=u(T);F.material.dashed=z>0,F.material.dashed?F.material.defines.USE_DASH="":delete F.material.defines.USE_DASH,F.material.dashed&&(F.material.dashScale=1/d(D),F.material.dashSize=k,F.material.gapSize=z,F.material.dashOffset=-G)}{var W=a(T);if(W instanceof Array){var Y=y(a(T),D.length-1,1,!1);F.geometry.setColors(Y.array),F.material.vertexColors=!0}else{var H=W,$=th(H);F.material.color=new d1.Color(Nf(H)),F.material.transparent=$<1,F.material.opacity=$,F.material.vertexColors=!1}}F.material.needsUpdate=!0}else{Object.assign(F.material.uniforms,{dashSize:{value:l(T)},gapSize:{value:c(T)},dashOffset:{value:u(T)}});var C=y(a(T),D.length),B=w(D.length,1,!0);F.geometry.setAttribute("color",C),F.geometry.setAttribute("relDistance",B)}var J=DLe(S.__currentTargetD&&S.__currentTargetD.points||[D[0]],D),te=function(Re){var Qe=S.__currentTargetD=Re,Fe=Qe.stroke,mt=Qe.interpolK,Ee=S.__currentTargetD.points=J(mt);if(I){var Ve;F.geometry.setPositions((Ve=[]).concat.apply(Ve,tr(Ee.map(function(Ye){var Mt=Ye.x,Et=Ye.y,Pt=Ye.z;return[Mt,Et,Pt]})))),F.material.linewidth=Fe,F.material.dashed&&F.computeLineDistances()}else F.geometry.setFromPoints(Ee),F.geometry.computeBoundingSphere()},ce={stroke:R,interpolK:1},he=Object.assign({},S.__currentTargetD||ce,{interpolK:0});Object.keys(ce).some(function(ve){return he[ve]!==ce[ve]})&&(!e.pathTransitionDuration||e.pathTransitionDuration<0?te(ce):e.tweenGroup.add(new uo(he).to(ce,e.pathTransitionDuration).easing(Jr.Quadratic.InOut).onUpdate(te).onComplete(function(){e.tweenGroup.remove(this)}).start()))}).digest(e.pathsData);function d(S){var T=0,R;return S.forEach(function(I){R&&(T+=R.distanceTo(I)),R=I}),T}function A(S,T,R,I,P){var F=function(B,k,z){for(var G=[],W=1;W<=z;W++)G.push(B+(k-B)*W/(z+1));return G},D=function(){var B=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],k=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,z=[],G=null;return B.forEach(function(W){if(G){for(;Math.abs(G[1]-W[1])>180;)G[1]+=360*(G[1]<W[1]?1:-1);var Y=Math.sqrt(Math.pow(W[0]-G[0],2)+Math.pow(W[1]-G[1],2));if(Y>k)for(var H=Math.floor(Y/k),$=F(G[0],W[0],H),J=F(G[1],W[1],H),te=F(G[2],W[2],H),ce=0,he=$.length;ce<he;ce++)z.push([$[ce],J[ce],te[ce]])}z.push(G=W)}),z},L=function(B){var k=Ir(B,3),z=k[0],G=k[1],W=k[2],Y=ou(z,G,W),H=Y.x,$=Y.y,J=Y.z;return new d1.Vector3(H,$,J)};return D(S.map(function(C){return[T(C),R(C),I(C)]}),P).map(L)}function y(S,T){var R=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,I=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0,P=T+1,F;if(S instanceof Array||S instanceof Function){var D=S instanceof Array?Tl().domain(S.map(function(W,Y){return Y/(S.length-1)})).range(S):S;F=function(Y){return Rm(D(Y),I,!0)}}else{var L=Rm(S,I,!0);F=function(){return L}}for(var C=[],B=0,k=P;B<k;B++)for(var z=F(B/(k-1)),G=0;G<R;G++)C.push(z);return Ff(C,I?4:3)}function w(S){for(var T=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,R=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,I=S+1,P=[],F=0,D=I;F<D;F++)for(var L=F/(D-1),C=0;C<T;C++)P.push(L);return R&&P.reverse(),Ff(P,1)}}}),ZP=window.THREE?window.THREE:{Euler:Ua,Mesh:Hn,MeshLambertMaterial:Ga,SphereGeometry:Va},lae=Qr({props:{tilesData:{default:[]},tileLat:{default:"lat"},tileLng:{default:"lng"},tileAltitude:{default:.01},tileWidth:{default:1},tileHeight:{default:1},tileUseGlobeProjection:{default:!0},tileMaterial:{default:function(){return new ZP.MeshLambertMaterial({color:"#ffbb88",opacity:.4,transparent:!0})}},tileCurvatureResolution:{default:5},tilesTransitionDuration:{default:1e3,triggerUpdate:!1}},init:function(e,t,n){var r=n.tweenGroup;is(e),t.scene=e,t.tweenGroup=r,t.dataMapper=new Ll(e,{objBindAttr:"__threeObjTile"}).onCreateObj(function(){var s=new ZP.Mesh;return s.__globeObjType="tile",s})},update:function(e){var t=st(e.tileLat),n=st(e.tileLng),r=st(e.tileAltitude),s=st(e.tileWidth),o=st(e.tileHeight),a=st(e.tileUseGlobeProjection),l=st(e.tileMaterial),c=st(e.tileCurvatureResolution);e.dataMapper.onUpdateObj(function(u,f){u.material=l(f);var d=a(f),A=c(f),y=function(R){var I=u.__currentTargetD=R,P=I.lat,F=I.lng,D=I.alt,L=I.width,C=I.height,B=Px(F),k=Px(-P);u.geometry&&u.geometry.dispose(),u.geometry=new ZP.SphereGeometry(_r*(1+D),Math.ceil(L/(A||-1)),Math.ceil(C/(A||-1)),Px(90-L/2)+(d?B:0),Px(L),Px(90-C/2)+(d?k:0),Px(C)),d||u.setRotationFromEuler(new ZP.Euler(k,B,0,"YXZ"))},w={lat:+t(f),lng:+n(f),alt:+r(f),width:+s(f),height:+o(f)},S=u.__currentTargetD||Object.assign({},w,{width:0,height:0});Object.keys(w).some(function(T){return S[T]!==w[T]})&&(!e.tilesTransitionDuration||e.tilesTransitionDuration<0?y(w):e.tweenGroup.add(new uo(S).to(w,e.tilesTransitionDuration).easing(Jr.Quadratic.InOut).onUpdate(y).onComplete(function(){e.tweenGroup.remove(this)}).start()))}).digest(e.tilesData)}}),Px=function(e){return e*Math.PI/180},VS=window.THREE?window.THREE:{BufferGeometry:Xn,Color:zt,Points:F2,PointsMaterial:a0},cae=Qr({props:{particlesData:{default:[]},particlesList:{default:function(e){return e}},particleLat:{default:"lat"},particleLng:{default:"lng"},particleAltitude:{default:.01},particlesSize:{default:.5},particlesSizeAttenuation:{default:!0},particlesColor:{default:function(){return"white"}},particlesTexture:{}},init:function(e,t){is(e),t.scene=e,t.dataMapper=new Ll(e,{objBindAttr:"__threeObjParticles"}).onCreateObj(function(){var n=new VS.Points(new VS.BufferGeometry,new VS.PointsMaterial);return n.__globeObjType="particles",n}).onUpdateObj(function(n,r){var s=st(t.particlesList),o=st(t.particleLat),a=st(t.particleLng),l=st(t.particleAltitude);n.geometry.setAttribute("position",Ff(s(r).map(function(c){return Object.values(ou(o(c),a(c),l(c)))}),3))})},update:function(e,t){["particlesData","particlesList","particleLat","particleLng","particleAltitude"].some(function(a){return t.hasOwnProperty(a)})&&e.dataMapper.digest(e.particlesData);var n=st(e.particlesColor),r=st(e.particlesSize),s=st(e.particlesSizeAttenuation),o=st(e.particlesTexture);e.dataMapper.entries().forEach(function(a){var l=Ir(a,2),c=l[0],u=l[1];if(u.material.size=r(c),u.material.sizeAttenuation=s(c),e.particlesTexture)u.material.color=new VS.Color(16777215),u.material.transparent=!1,u.material.alphaTest=.5,u.material.map=o(c);else{var f=n(c),d=th(f);u.material.color=new VS.Color(Nf(f)),u.material.transparent=d<1,u.material.opacity=d,u.material.alphaTest=0}})}}),FLe=window.THREE?window.THREE:{BufferGeometry:Xn},BLe=(function(i){function e(){var t,n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:1,r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:32;eI(this,e),t=JP(this,e),t.type="CircleLineGeometry",t.parameters={radius:n,segmentCount:r};for(var s=[],o=0;o<=r;o++){var a=(o/r-.25)*Math.PI*2;s.push({x:Math.cos(a)*n,y:Math.sin(a)*n,z:0})}return t.setFromPoints(s),t}return nI(e,i),tI(e)})(FLe.BufferGeometry),Ix=window.THREE?window.THREE:{Color:zt,Group:Br,Line:o0,LineBasicMaterial:Iu,Vector3:re},OLe=m1.default.default||m1.default,uae=Qr({props:{ringsData:{default:[]},ringLat:{default:"lat"},ringLng:{default:"lng"},ringAltitude:{default:.0015},ringColor:{default:function(){return"#ffffaa"},triggerUpdate:!1},ringResolution:{default:64,triggerUpdate:!1},ringMaxRadius:{default:2,triggerUpdate:!1},ringPropagationSpeed:{default:1,triggerUpdate:!1},ringRepeatPeriod:{default:700,triggerUpdate:!1}},methods:{pauseAnimation:function(e){var t;(t=e.ticker)===null||t===void 0||t.pause()},resumeAnimation:function(e){var t;(t=e.ticker)===null||t===void 0||t.resume()},_destructor:function(e){var t;(t=e.ticker)===null||t===void 0||t.dispose()}},init:function(e,t,n){var r=n.tweenGroup;is(e),t.scene=e,t.tweenGroup=r,t.dataMapper=new Ll(e,{objBindAttr:"__threeObjRing",removeDelay:3e4}).onCreateObj(function(){var s=new Ix.Group;return s.__globeObjType="ring",s}),t.ticker=new OLe,t.ticker.onTick.add(function(s){if(t.ringsData.length){var o=st(t.ringColor),a=st(t.ringAltitude),l=st(t.ringMaxRadius),c=st(t.ringPropagationSpeed),u=st(t.ringRepeatPeriod);t.dataMapper.entries().filter(function(f){var d=Ir(f,2),A=d[1];return A}).forEach(function(f){var d=Ir(f,2),A=d[0],y=d[1];if((y.__nextRingTime||0)<=s){var w=u(A)/1e3;y.__nextRingTime=s+(w<=0?1/0:w);var S=new Ix.Line(new BLe(1,t.ringResolution),new Ix.LineBasicMaterial),T=o(A),R=T instanceof Array||T instanceof Function,I;R?T instanceof Array?(I=Tl().domain(T.map(function(z,G){return G/(T.length-1)})).range(T),S.material.transparent=T.some(function(z){return th(z)<1})):(I=T,S.material.transparent=!0):(S.material.color=new Ix.Color(Nf(T)),gLe(S.material,th(T)));var P=_r*(1+a(A)),F=l(A),D=F*Math.PI/180,L=c(A),C=L<=0,B=function(G){var W=G.t,Y=(C?1-W:W)*D;if(S.scale.x=S.scale.y=P*Math.sin(Y),S.position.z=P*(1-Math.cos(Y)),R){var H=I(W);S.material.color=new Ix.Color(Nf(H)),S.material.transparent&&(S.material.opacity=th(H))}};if(L===0)B({t:0}),y.add(S);else{var k=Math.abs(F/L)*1e3;t.tweenGroup.add(new uo({t:0}).to({t:1},k).onUpdate(B).onStart(function(){return y.add(S)}).onComplete(function(){t.tweenGroup.remove(this),y.remove(S),Cm(S)}).start())}}})}})},update:function(e){var t=st(e.ringLat),n=st(e.ringLng),r=st(e.ringAltitude),s=e.scene.localToWorld(new Ix.Vector3(0,0,0));e.dataMapper.onUpdateObj(function(o,a){var l=t(a),c=n(a),u=r(a);Object.assign(o.position,ou(l,c,u)),o.lookAt(s)}).digest(e.ringsData)}}),ULe={0:{x_min:73,x_max:715,ha:792,o:"m 394 -29 q 153 129 242 -29 q 73 479 73 272 q 152 829 73 687 q 394 989 241 989 q 634 829 545 989 q 715 479 715 684 q 635 129 715 270 q 394 -29 546 -29 m 394 89 q 546 211 489 89 q 598 479 598 322 q 548 748 598 640 q 394 871 491 871 q 241 748 298 871 q 190 479 190 637 q 239 211 190 319 q 394 89 296 89 "},1:{x_min:215.671875,x_max:574,ha:792,o:"m 574 0 l 442 0 l 442 697 l 215 697 l 215 796 q 386 833 330 796 q 475 986 447 875 l 574 986 l 574 0 "},2:{x_min:59,x_max:731,ha:792,o:"m 731 0 l 59 0 q 197 314 59 188 q 457 487 199 315 q 598 691 598 580 q 543 819 598 772 q 411 867 488 867 q 272 811 328 867 q 209 630 209 747 l 81 630 q 182 901 81 805 q 408 986 271 986 q 629 909 536 986 q 731 694 731 826 q 613 449 731 541 q 378 316 495 383 q 201 122 235 234 l 731 122 l 731 0 "},3:{x_min:54,x_max:737,ha:792,o:"m 737 284 q 635 55 737 141 q 399 -25 541 -25 q 156 52 248 -25 q 54 308 54 140 l 185 308 q 245 147 185 202 q 395 96 302 96 q 539 140 484 96 q 602 280 602 190 q 510 429 602 390 q 324 454 451 454 l 324 565 q 487 584 441 565 q 565 719 565 617 q 515 835 565 791 q 395 879 466 879 q 255 824 307 879 q 203 661 203 769 l 78 661 q 166 909 78 822 q 387 992 250 992 q 603 921 513 992 q 701 723 701 844 q 669 607 701 656 q 578 524 637 558 q 696 434 655 499 q 737 284 737 369 "},4:{x_min:48,x_max:742.453125,ha:792,o:"m 742 243 l 602 243 l 602 0 l 476 0 l 476 243 l 48 243 l 48 368 l 476 958 l 602 958 l 602 354 l 742 354 l 742 243 m 476 354 l 476 792 l 162 354 l 476 354 "},5:{x_min:54.171875,x_max:738,ha:792,o:"m 738 314 q 626 60 738 153 q 382 -23 526 -23 q 155 47 248 -23 q 54 256 54 125 l 183 256 q 259 132 204 174 q 382 91 314 91 q 533 149 471 91 q 602 314 602 213 q 538 469 602 411 q 386 528 475 528 q 284 506 332 528 q 197 439 237 484 l 81 439 l 159 958 l 684 958 l 684 840 l 254 840 l 214 579 q 306 627 258 612 q 407 643 354 643 q 636 552 540 643 q 738 314 738 457 "},6:{x_min:53,x_max:739,ha:792,o:"m 739 312 q 633 62 739 162 q 400 -31 534 -31 q 162 78 257 -31 q 53 439 53 206 q 178 859 53 712 q 441 986 284 986 q 643 912 559 986 q 732 713 732 833 l 601 713 q 544 830 594 786 q 426 875 494 875 q 268 793 331 875 q 193 517 193 697 q 301 597 240 570 q 427 624 362 624 q 643 540 552 624 q 739 312 739 451 m 603 298 q 540 461 603 400 q 404 516 484 516 q 268 461 323 516 q 207 300 207 401 q 269 137 207 198 q 405 83 325 83 q 541 137 486 83 q 603 298 603 197 "},7:{x_min:58.71875,x_max:730.953125,ha:792,o:"m 730 839 q 469 448 560 641 q 335 0 378 255 l 192 0 q 328 441 235 252 q 593 830 421 630 l 58 830 l 58 958 l 730 958 l 730 839 "},8:{x_min:55,x_max:736,ha:792,o:"m 571 527 q 694 424 652 491 q 736 280 736 358 q 648 71 736 158 q 395 -26 551 -26 q 142 69 238 -26 q 55 279 55 157 q 96 425 55 359 q 220 527 138 491 q 120 615 153 562 q 88 726 88 668 q 171 904 88 827 q 395 986 261 986 q 618 905 529 986 q 702 727 702 830 q 670 616 702 667 q 571 527 638 565 m 394 565 q 519 610 475 565 q 563 717 563 655 q 521 823 563 781 q 392 872 474 872 q 265 824 312 872 q 224 720 224 783 q 265 613 224 656 q 394 565 312 565 m 395 91 q 545 150 488 91 q 597 280 597 204 q 546 408 597 355 q 395 465 492 465 q 244 408 299 465 q 194 280 194 356 q 244 150 194 203 q 395 91 299 91 "},9:{x_min:53,x_max:739,ha:792,o:"m 739 524 q 619 94 739 241 q 362 -32 516 -32 q 150 47 242 -32 q 59 244 59 126 l 191 244 q 246 129 191 176 q 373 82 301 82 q 526 161 466 82 q 597 440 597 255 q 363 334 501 334 q 130 432 216 334 q 53 650 53 521 q 134 880 53 786 q 383 986 226 986 q 659 841 566 986 q 739 524 739 719 m 388 449 q 535 514 480 449 q 585 658 585 573 q 535 805 585 744 q 388 873 480 873 q 242 809 294 873 q 191 658 191 745 q 239 514 191 572 q 388 449 292 449 "},\u03BF:{x_min:0,x_max:712,ha:815,o:"m 356 -25 q 96 88 192 -25 q 0 368 0 201 q 92 642 0 533 q 356 761 192 761 q 617 644 517 761 q 712 368 712 533 q 619 91 712 201 q 356 -25 520 -25 m 356 85 q 527 175 465 85 q 583 369 583 255 q 528 562 583 484 q 356 651 466 651 q 189 560 250 651 q 135 369 135 481 q 187 177 135 257 q 356 85 250 85 "},S:{x_min:0,x_max:788,ha:890,o:"m 788 291 q 662 54 788 144 q 397 -26 550 -26 q 116 68 226 -26 q 0 337 0 168 l 131 337 q 200 152 131 220 q 384 85 269 85 q 557 129 479 85 q 650 270 650 183 q 490 429 650 379 q 194 513 341 470 q 33 739 33 584 q 142 964 33 881 q 388 1041 242 1041 q 644 957 543 1041 q 756 716 756 867 l 625 716 q 561 874 625 816 q 395 933 497 933 q 243 891 309 933 q 164 759 164 841 q 325 609 164 656 q 625 526 475 568 q 788 291 788 454 "},"\xA6":{x_min:343,x_max:449,ha:792,o:"m 449 462 l 343 462 l 343 986 l 449 986 l 449 462 m 449 -242 l 343 -242 l 343 280 l 449 280 l 449 -242 "},"/":{x_min:183.25,x_max:608.328125,ha:792,o:"m 608 1041 l 266 -129 l 183 -129 l 520 1041 l 608 1041 "},\u03A4:{x_min:-.4375,x_max:777.453125,ha:839,o:"m 777 893 l 458 893 l 458 0 l 319 0 l 319 892 l 0 892 l 0 1013 l 777 1013 l 777 893 "},y:{x_min:0,x_max:684.78125,ha:771,o:"m 684 738 l 388 -83 q 311 -216 356 -167 q 173 -279 252 -279 q 97 -266 133 -279 l 97 -149 q 132 -155 109 -151 q 168 -160 155 -160 q 240 -114 213 -160 q 274 -26 248 -98 l 0 738 l 137 737 l 341 139 l 548 737 l 684 738 "},\u03A0:{x_min:0,x_max:803,ha:917,o:"m 803 0 l 667 0 l 667 886 l 140 886 l 140 0 l 0 0 l 0 1012 l 803 1012 l 803 0 "},\u0390:{x_min:-111,x_max:339,ha:361,o:"m 339 800 l 229 800 l 229 925 l 339 925 l 339 800 m -1 800 l -111 800 l -111 925 l -1 925 l -1 800 m 284 3 q 233 -10 258 -5 q 182 -15 207 -15 q 85 26 119 -15 q 42 200 42 79 l 42 737 l 167 737 l 168 215 q 172 141 168 157 q 226 101 183 101 q 248 103 239 101 q 284 112 257 104 l 284 3 m 302 1040 l 113 819 l 30 819 l 165 1040 l 302 1040 "},g:{x_min:0,x_max:686,ha:838,o:"m 686 34 q 586 -213 686 -121 q 331 -306 487 -306 q 131 -252 216 -306 q 31 -84 31 -190 l 155 -84 q 228 -174 166 -138 q 345 -207 284 -207 q 514 -109 454 -207 q 564 89 564 -27 q 461 6 521 36 q 335 -23 401 -23 q 88 100 184 -23 q 0 370 0 215 q 87 634 0 522 q 330 758 183 758 q 457 728 398 758 q 564 644 515 699 l 564 737 l 686 737 l 686 34 m 582 367 q 529 560 582 481 q 358 652 468 652 q 189 561 250 652 q 135 369 135 482 q 189 176 135 255 q 361 85 251 85 q 529 176 468 85 q 582 367 582 255 "},"\xB2":{x_min:0,x_max:442,ha:539,o:"m 442 383 l 0 383 q 91 566 0 492 q 260 668 176 617 q 354 798 354 727 q 315 875 354 845 q 227 905 277 905 q 136 869 173 905 q 99 761 99 833 l 14 761 q 82 922 14 864 q 232 974 141 974 q 379 926 316 974 q 442 797 442 878 q 351 635 442 704 q 183 539 321 611 q 92 455 92 491 l 442 455 l 442 383 "},"\u2013":{x_min:0,x_max:705.5625,ha:803,o:"m 705 334 l 0 334 l 0 410 l 705 410 l 705 334 "},\u039A:{x_min:0,x_max:819.5625,ha:893,o:"m 819 0 l 650 0 l 294 509 l 139 356 l 139 0 l 0 0 l 0 1013 l 139 1013 l 139 526 l 626 1013 l 809 1013 l 395 600 l 819 0 "},\u0192:{x_min:-46.265625,x_max:392,ha:513,o:"m 392 651 l 259 651 l 79 -279 l -46 -278 l 134 651 l 14 651 l 14 751 l 135 751 q 151 948 135 900 q 304 1041 185 1041 q 334 1040 319 1041 q 392 1034 348 1039 l 392 922 q 337 931 360 931 q 271 883 287 931 q 260 793 260 853 l 260 751 l 392 751 l 392 651 "},e:{x_min:0,x_max:714,ha:813,o:"m 714 326 l 140 326 q 200 157 140 227 q 359 87 260 87 q 488 130 431 87 q 561 245 545 174 l 697 245 q 577 48 670 123 q 358 -26 484 -26 q 97 85 195 -26 q 0 363 0 197 q 94 642 0 529 q 358 765 195 765 q 626 627 529 765 q 714 326 714 503 m 576 429 q 507 583 564 522 q 355 650 445 650 q 206 583 266 650 q 140 429 152 522 l 576 429 "},\u03CC:{x_min:0,x_max:712,ha:815,o:"m 356 -25 q 94 91 194 -25 q 0 368 0 202 q 92 642 0 533 q 356 761 192 761 q 617 644 517 761 q 712 368 712 533 q 619 91 712 201 q 356 -25 520 -25 m 356 85 q 527 175 465 85 q 583 369 583 255 q 528 562 583 484 q 356 651 466 651 q 189 560 250 651 q 135 369 135 481 q 187 177 135 257 q 356 85 250 85 m 576 1040 l 387 819 l 303 819 l 438 1040 l 576 1040 "},J:{x_min:0,x_max:588,ha:699,o:"m 588 279 q 287 -26 588 -26 q 58 73 126 -26 q 0 327 0 158 l 133 327 q 160 172 133 227 q 288 96 198 96 q 426 171 391 96 q 449 336 449 219 l 449 1013 l 588 1013 l 588 279 "},"\xBB":{x_min:-1,x_max:503,ha:601,o:"m 503 302 l 280 136 l 281 256 l 429 373 l 281 486 l 280 608 l 503 440 l 503 302 m 221 302 l 0 136 l 0 255 l 145 372 l 0 486 l -1 608 l 221 440 l 221 302 "},"\xA9":{x_min:-3,x_max:1008,ha:1106,o:"m 502 -7 q 123 151 263 -7 q -3 501 -3 294 q 123 851 -3 706 q 502 1011 263 1011 q 881 851 739 1011 q 1008 501 1008 708 q 883 151 1008 292 q 502 -7 744 -7 m 502 60 q 830 197 709 60 q 940 501 940 322 q 831 805 940 681 q 502 944 709 944 q 174 805 296 944 q 65 501 65 680 q 173 197 65 320 q 502 60 294 60 m 741 394 q 661 246 731 302 q 496 190 591 190 q 294 285 369 190 q 228 497 228 370 q 295 714 228 625 q 499 813 370 813 q 656 762 588 813 q 733 625 724 711 l 634 625 q 589 704 629 673 q 498 735 550 735 q 377 666 421 735 q 334 504 334 597 q 374 340 334 408 q 490 272 415 272 q 589 304 549 272 q 638 394 628 337 l 741 394 "},\u03CE:{x_min:0,x_max:922,ha:1030,o:"m 687 1040 l 498 819 l 415 819 l 549 1040 l 687 1040 m 922 339 q 856 97 922 203 q 650 -26 780 -26 q 538 9 587 -26 q 461 103 489 44 q 387 12 436 46 q 277 -22 339 -22 q 69 97 147 -22 q 0 338 0 202 q 45 551 0 444 q 161 737 84 643 l 302 737 q 175 552 219 647 q 124 336 124 446 q 155 179 124 248 q 275 88 197 88 q 375 163 341 88 q 400 294 400 219 l 400 572 l 524 572 l 524 294 q 561 135 524 192 q 643 88 591 88 q 762 182 719 88 q 797 341 797 257 q 745 555 797 450 q 619 737 705 637 l 760 737 q 874 551 835 640 q 922 339 922 444 "},"^":{x_min:193.0625,x_max:598.609375,ha:792,o:"m 598 772 l 515 772 l 395 931 l 277 772 l 193 772 l 326 1013 l 462 1013 l 598 772 "},"\xAB":{x_min:0,x_max:507.203125,ha:604,o:"m 506 136 l 284 302 l 284 440 l 506 608 l 507 485 l 360 371 l 506 255 l 506 136 m 222 136 l 0 302 l 0 440 l 222 608 l 221 486 l 73 373 l 222 256 l 222 136 "},D:{x_min:0,x_max:828,ha:935,o:"m 389 1013 q 714 867 593 1013 q 828 521 828 729 q 712 161 828 309 q 382 0 587 0 l 0 0 l 0 1013 l 389 1013 m 376 124 q 607 247 523 124 q 681 510 681 355 q 607 771 681 662 q 376 896 522 896 l 139 896 l 139 124 l 376 124 "},"\u2219":{x_min:0,x_max:142,ha:239,o:"m 142 585 l 0 585 l 0 738 l 142 738 l 142 585 "},\u00FF:{x_min:0,x_max:47,ha:125,o:"m 47 3 q 37 -7 47 -7 q 28 0 30 -7 q 39 -4 32 -4 q 45 3 45 -1 l 37 0 q 28 9 28 0 q 39 19 28 19 l 47 16 l 47 19 l 47 3 m 37 1 q 44 8 44 1 q 37 16 44 16 q 30 8 30 16 q 37 1 30 1 m 26 1 l 23 22 l 14 0 l 3 22 l 3 3 l 0 25 l 13 1 l 22 25 l 26 1 "},w:{x_min:0,x_max:1009.71875,ha:1100,o:"m 1009 738 l 783 0 l 658 0 l 501 567 l 345 0 l 222 0 l 0 738 l 130 738 l 284 174 l 432 737 l 576 738 l 721 173 l 881 737 l 1009 738 "},$:{x_min:0,x_max:700,ha:793,o:"m 664 717 l 542 717 q 490 825 531 785 q 381 872 450 865 l 381 551 q 620 446 540 522 q 700 241 700 370 q 618 45 700 116 q 381 -25 536 -25 l 381 -152 l 307 -152 l 307 -25 q 81 62 162 -25 q 0 297 0 149 l 124 297 q 169 146 124 204 q 307 81 215 89 l 307 441 q 80 536 148 469 q 13 725 13 603 q 96 910 13 839 q 307 982 180 982 l 307 1077 l 381 1077 l 381 982 q 574 917 494 982 q 664 717 664 845 m 307 565 l 307 872 q 187 831 233 872 q 142 724 142 791 q 180 618 142 656 q 307 565 218 580 m 381 76 q 562 237 562 96 q 517 361 562 313 q 381 423 472 409 l 381 76 "},"\\":{x_min:-.015625,x_max:425.0625,ha:522,o:"m 425 -129 l 337 -129 l 0 1041 l 83 1041 l 425 -129 "},\u00B5:{x_min:0,x_max:697.21875,ha:747,o:"m 697 -4 q 629 -14 658 -14 q 498 97 513 -14 q 422 9 470 41 q 313 -23 374 -23 q 207 4 258 -23 q 119 81 156 32 l 119 -278 l 0 -278 l 0 738 l 124 738 l 124 343 q 165 173 124 246 q 308 83 216 83 q 452 178 402 83 q 493 359 493 255 l 493 738 l 617 738 l 617 214 q 623 136 617 160 q 673 92 637 92 q 697 96 684 92 l 697 -4 "},\u0399:{x_min:42,x_max:181,ha:297,o:"m 181 0 l 42 0 l 42 1013 l 181 1013 l 181 0 "},\u038E:{x_min:0,x_max:1144.5,ha:1214,o:"m 1144 1012 l 807 416 l 807 0 l 667 0 l 667 416 l 325 1012 l 465 1012 l 736 533 l 1004 1012 l 1144 1012 m 277 1040 l 83 799 l 0 799 l 140 1040 l 277 1040 "},"\u2019":{x_min:0,x_max:139,ha:236,o:"m 139 851 q 102 737 139 784 q 0 669 65 690 l 0 734 q 59 787 42 741 q 72 873 72 821 l 0 873 l 0 1013 l 139 1013 l 139 851 "},\u039D:{x_min:0,x_max:801,ha:915,o:"m 801 0 l 651 0 l 131 822 l 131 0 l 0 0 l 0 1013 l 151 1013 l 670 191 l 670 1013 l 801 1013 l 801 0 "},"-":{x_min:8.71875,x_max:350.390625,ha:478,o:"m 350 317 l 8 317 l 8 428 l 350 428 l 350 317 "},Q:{x_min:0,x_max:968,ha:1072,o:"m 954 5 l 887 -79 l 744 35 q 622 -11 687 2 q 483 -26 556 -26 q 127 130 262 -26 q 0 504 0 279 q 127 880 0 728 q 484 1041 262 1041 q 841 884 708 1041 q 968 507 968 735 q 933 293 968 398 q 832 104 899 188 l 954 5 m 723 191 q 802 330 777 248 q 828 499 828 412 q 744 790 828 673 q 483 922 650 922 q 228 791 322 922 q 142 505 142 673 q 227 221 142 337 q 487 91 323 91 q 632 123 566 91 l 520 215 l 587 301 l 723 191 "},\u03C2:{x_min:1,x_max:676.28125,ha:740,o:"m 676 460 l 551 460 q 498 595 542 546 q 365 651 448 651 q 199 578 263 651 q 136 401 136 505 q 266 178 136 241 q 508 106 387 142 q 640 -50 640 62 q 625 -158 640 -105 q 583 -278 611 -211 l 465 -278 q 498 -182 490 -211 q 515 -80 515 -126 q 381 12 515 -15 q 134 91 197 51 q 1 388 1 179 q 100 651 1 542 q 354 761 199 761 q 587 680 498 761 q 676 460 676 599 "},M:{x_min:0,x_max:954,ha:1067,o:"m 954 0 l 819 0 l 819 869 l 537 0 l 405 0 l 128 866 l 128 0 l 0 0 l 0 1013 l 200 1013 l 472 160 l 757 1013 l 954 1013 l 954 0 "},\u03A8:{x_min:0,x_max:1006,ha:1094,o:"m 1006 678 q 914 319 1006 429 q 571 200 814 200 l 571 0 l 433 0 l 433 200 q 92 319 194 200 q 0 678 0 429 l 0 1013 l 139 1013 l 139 679 q 191 417 139 492 q 433 326 255 326 l 433 1013 l 571 1013 l 571 326 l 580 326 q 813 423 747 326 q 868 679 868 502 l 868 1013 l 1006 1013 l 1006 678 "},C:{x_min:0,x_max:886,ha:944,o:"m 886 379 q 760 87 886 201 q 455 -26 634 -26 q 112 136 236 -26 q 0 509 0 283 q 118 882 0 737 q 469 1041 245 1041 q 748 955 630 1041 q 879 708 879 859 l 745 708 q 649 862 724 805 q 473 920 573 920 q 219 791 312 920 q 136 509 136 675 q 217 229 136 344 q 470 99 311 99 q 672 179 591 99 q 753 379 753 259 l 886 379 "},"!":{x_min:0,x_max:138,ha:236,o:"m 138 684 q 116 409 138 629 q 105 244 105 299 l 33 244 q 16 465 33 313 q 0 684 0 616 l 0 1013 l 138 1013 l 138 684 m 138 0 l 0 0 l 0 151 l 138 151 l 138 0 "},"{":{x_min:0,x_max:480.5625,ha:578,o:"m 480 -286 q 237 -213 303 -286 q 187 -45 187 -159 q 194 48 187 -15 q 201 141 201 112 q 164 264 201 225 q 0 314 118 314 l 0 417 q 164 471 119 417 q 201 605 201 514 q 199 665 201 644 q 193 772 193 769 q 241 941 193 887 q 480 1015 308 1015 l 480 915 q 336 866 375 915 q 306 742 306 828 q 310 662 306 717 q 314 577 314 606 q 288 452 314 500 q 176 365 256 391 q 289 275 257 337 q 314 143 314 226 q 313 84 314 107 q 310 -11 310 -5 q 339 -131 310 -94 q 480 -182 377 -182 l 480 -286 "},X:{x_min:-.015625,x_max:854.15625,ha:940,o:"m 854 0 l 683 0 l 423 409 l 166 0 l 0 0 l 347 519 l 18 1013 l 186 1013 l 428 637 l 675 1013 l 836 1013 l 504 520 l 854 0 "},"#":{x_min:0,x_max:963.890625,ha:1061,o:"m 963 690 l 927 590 l 719 590 l 655 410 l 876 410 l 840 310 l 618 310 l 508 -3 l 393 -2 l 506 309 l 329 310 l 215 -2 l 102 -3 l 212 310 l 0 310 l 36 410 l 248 409 l 312 590 l 86 590 l 120 690 l 347 690 l 459 1006 l 573 1006 l 462 690 l 640 690 l 751 1006 l 865 1006 l 754 690 l 963 690 m 606 590 l 425 590 l 362 410 l 543 410 l 606 590 "},\u03B9:{x_min:42,x_max:284,ha:361,o:"m 284 3 q 233 -10 258 -5 q 182 -15 207 -15 q 85 26 119 -15 q 42 200 42 79 l 42 738 l 167 738 l 168 215 q 172 141 168 157 q 226 101 183 101 q 248 103 239 101 q 284 112 257 104 l 284 3 "},\u0386:{x_min:0,x_max:906.953125,ha:982,o:"m 283 1040 l 88 799 l 5 799 l 145 1040 l 283 1040 m 906 0 l 756 0 l 650 303 l 251 303 l 143 0 l 0 0 l 376 1012 l 529 1012 l 906 0 m 609 421 l 452 866 l 293 421 l 609 421 "},")":{x_min:0,x_max:318,ha:415,o:"m 318 365 q 257 25 318 191 q 87 -290 197 -141 l 0 -290 q 140 21 93 -128 q 193 360 193 189 q 141 704 193 537 q 0 1024 97 850 l 87 1024 q 257 706 197 871 q 318 365 318 542 "},\u03B5:{x_min:0,x_max:634.71875,ha:714,o:"m 634 234 q 527 38 634 110 q 300 -25 433 -25 q 98 29 183 -25 q 0 204 0 93 q 37 314 0 265 q 128 390 67 353 q 56 460 82 419 q 26 555 26 505 q 114 712 26 654 q 295 763 191 763 q 499 700 416 763 q 589 515 589 631 l 478 515 q 419 618 464 580 q 307 657 374 657 q 207 630 253 657 q 151 547 151 598 q 238 445 151 469 q 389 434 280 434 l 389 331 l 349 331 q 206 315 255 331 q 125 210 125 287 q 183 107 125 145 q 302 76 233 76 q 436 117 379 76 q 509 234 493 159 l 634 234 "},\u0394:{x_min:0,x_max:952.78125,ha:1028,o:"m 952 0 l 0 0 l 400 1013 l 551 1013 l 952 0 m 762 124 l 476 867 l 187 124 l 762 124 "},"}":{x_min:0,x_max:481,ha:578,o:"m 481 314 q 318 262 364 314 q 282 136 282 222 q 284 65 282 97 q 293 -58 293 -48 q 241 -217 293 -166 q 0 -286 174 -286 l 0 -182 q 143 -130 105 -182 q 171 -2 171 -93 q 168 81 171 22 q 165 144 165 140 q 188 275 165 229 q 306 365 220 339 q 191 455 224 391 q 165 588 165 505 q 168 681 165 624 q 171 742 171 737 q 141 865 171 827 q 0 915 102 915 l 0 1015 q 243 942 176 1015 q 293 773 293 888 q 287 675 293 741 q 282 590 282 608 q 318 466 282 505 q 481 417 364 417 l 481 314 "},"\u2030":{x_min:-3,x_max:1672,ha:1821,o:"m 846 0 q 664 76 732 0 q 603 244 603 145 q 662 412 603 344 q 846 489 729 489 q 1027 412 959 489 q 1089 244 1089 343 q 1029 76 1089 144 q 846 0 962 0 m 845 103 q 945 143 910 103 q 981 243 981 184 q 947 340 981 301 q 845 385 910 385 q 745 342 782 385 q 709 243 709 300 q 742 147 709 186 q 845 103 781 103 m 888 986 l 284 -25 l 199 -25 l 803 986 l 888 986 m 241 468 q 58 545 126 468 q -3 715 -3 615 q 56 881 -3 813 q 238 958 124 958 q 421 881 353 958 q 483 712 483 813 q 423 544 483 612 q 241 468 356 468 m 241 855 q 137 811 175 855 q 100 710 100 768 q 136 612 100 653 q 240 572 172 572 q 344 614 306 572 q 382 713 382 656 q 347 810 382 771 q 241 855 308 855 m 1428 0 q 1246 76 1314 0 q 1185 244 1185 145 q 1244 412 1185 344 q 1428 489 1311 489 q 1610 412 1542 489 q 1672 244 1672 343 q 1612 76 1672 144 q 1428 0 1545 0 m 1427 103 q 1528 143 1492 103 q 1564 243 1564 184 q 1530 340 1564 301 q 1427 385 1492 385 q 1327 342 1364 385 q 1291 243 1291 300 q 1324 147 1291 186 q 1427 103 1363 103 "},a:{x_min:0,x_max:698.609375,ha:794,o:"m 698 0 q 661 -12 679 -7 q 615 -17 643 -17 q 536 12 564 -17 q 500 96 508 41 q 384 6 456 37 q 236 -25 312 -25 q 65 31 130 -25 q 0 194 0 88 q 118 390 0 334 q 328 435 180 420 q 488 483 476 451 q 495 523 495 504 q 442 619 495 584 q 325 654 389 654 q 209 617 257 654 q 152 513 161 580 l 33 513 q 123 705 33 633 q 332 772 207 772 q 528 712 448 772 q 617 531 617 645 l 617 163 q 624 108 617 126 q 664 90 632 90 l 698 94 l 698 0 m 491 262 l 491 372 q 272 329 350 347 q 128 201 128 294 q 166 113 128 144 q 264 83 205 83 q 414 130 346 83 q 491 262 491 183 "},"\u2014":{x_min:0,x_max:941.671875,ha:1039,o:"m 941 334 l 0 334 l 0 410 l 941 410 l 941 334 "},"=":{x_min:8.71875,x_max:780.953125,ha:792,o:"m 780 510 l 8 510 l 8 606 l 780 606 l 780 510 m 780 235 l 8 235 l 8 332 l 780 332 l 780 235 "},N:{x_min:0,x_max:801,ha:914,o:"m 801 0 l 651 0 l 131 823 l 131 0 l 0 0 l 0 1013 l 151 1013 l 670 193 l 670 1013 l 801 1013 l 801 0 "},\u03C1:{x_min:0,x_max:712,ha:797,o:"m 712 369 q 620 94 712 207 q 362 -26 521 -26 q 230 2 292 -26 q 119 83 167 30 l 119 -278 l 0 -278 l 0 362 q 91 643 0 531 q 355 764 190 764 q 617 647 517 764 q 712 369 712 536 m 583 366 q 530 559 583 480 q 359 651 469 651 q 190 562 252 651 q 135 370 135 483 q 189 176 135 257 q 359 85 250 85 q 528 175 466 85 q 583 366 583 254 "},"\xAF":{x_min:0,x_max:941.671875,ha:938,o:"m 941 1033 l 0 1033 l 0 1109 l 941 1109 l 941 1033 "},Z:{x_min:0,x_max:779,ha:849,o:"m 779 0 l 0 0 l 0 113 l 621 896 l 40 896 l 40 1013 l 779 1013 l 778 887 l 171 124 l 779 124 l 779 0 "},u:{x_min:0,x_max:617,ha:729,o:"m 617 0 l 499 0 l 499 110 q 391 10 460 45 q 246 -25 322 -25 q 61 58 127 -25 q 0 258 0 136 l 0 738 l 125 738 l 125 284 q 156 148 125 202 q 273 82 197 82 q 433 165 369 82 q 493 340 493 243 l 493 738 l 617 738 l 617 0 "},k:{x_min:0,x_max:612.484375,ha:697,o:"m 612 738 l 338 465 l 608 0 l 469 0 l 251 382 l 121 251 l 121 0 l 0 0 l 0 1013 l 121 1013 l 121 402 l 456 738 l 612 738 "},\u0397:{x_min:0,x_max:803,ha:917,o:"m 803 0 l 667 0 l 667 475 l 140 475 l 140 0 l 0 0 l 0 1013 l 140 1013 l 140 599 l 667 599 l 667 1013 l 803 1013 l 803 0 "},\u0391:{x_min:0,x_max:906.953125,ha:985,o:"m 906 0 l 756 0 l 650 303 l 251 303 l 143 0 l 0 0 l 376 1013 l 529 1013 l 906 0 m 609 421 l 452 866 l 293 421 l 609 421 "},s:{x_min:0,x_max:604,ha:697,o:"m 604 217 q 501 36 604 104 q 292 -23 411 -23 q 86 43 166 -23 q 0 238 0 114 l 121 237 q 175 122 121 164 q 300 85 223 85 q 415 112 363 85 q 479 207 479 147 q 361 309 479 276 q 140 372 141 370 q 21 544 21 426 q 111 708 21 647 q 298 761 190 761 q 492 705 413 761 q 583 531 583 643 l 462 531 q 412 625 462 594 q 298 657 363 657 q 199 636 242 657 q 143 558 143 608 q 262 454 143 486 q 484 394 479 397 q 604 217 604 341 "},B:{x_min:0,x_max:778,ha:876,o:"m 580 546 q 724 469 670 535 q 778 311 778 403 q 673 83 778 171 q 432 0 575 0 l 0 0 l 0 1013 l 411 1013 q 629 957 541 1013 q 732 768 732 892 q 691 633 732 693 q 580 546 650 572 m 393 899 l 139 899 l 139 588 l 379 588 q 521 624 462 588 q 592 744 592 667 q 531 859 592 819 q 393 899 471 899 m 419 124 q 566 169 504 124 q 635 303 635 219 q 559 436 635 389 q 402 477 494 477 l 139 477 l 139 124 l 419 124 "},"\u2026":{x_min:0,x_max:614,ha:708,o:"m 142 0 l 0 0 l 0 151 l 142 151 l 142 0 m 378 0 l 236 0 l 236 151 l 378 151 l 378 0 m 614 0 l 472 0 l 472 151 l 614 151 l 614 0 "},"?":{x_min:0,x_max:607,ha:704,o:"m 607 777 q 543 599 607 674 q 422 474 482 537 q 357 272 357 391 l 236 272 q 297 487 236 395 q 411 619 298 490 q 474 762 474 691 q 422 885 474 838 q 301 933 371 933 q 179 880 228 933 q 124 706 124 819 l 0 706 q 94 963 0 872 q 302 1044 177 1044 q 511 973 423 1044 q 607 777 607 895 m 370 0 l 230 0 l 230 151 l 370 151 l 370 0 "},H:{x_min:0,x_max:803,ha:915,o:"m 803 0 l 667 0 l 667 475 l 140 475 l 140 0 l 0 0 l 0 1013 l 140 1013 l 140 599 l 667 599 l 667 1013 l 803 1013 l 803 0 "},\u03BD:{x_min:0,x_max:675,ha:761,o:"m 675 738 l 404 0 l 272 0 l 0 738 l 133 738 l 340 147 l 541 738 l 675 738 "},c:{x_min:1,x_max:701.390625,ha:775,o:"m 701 264 q 584 53 681 133 q 353 -26 487 -26 q 91 91 188 -26 q 1 370 1 201 q 92 645 1 537 q 353 761 190 761 q 572 688 479 761 q 690 493 666 615 l 556 493 q 487 606 545 562 q 356 650 428 650 q 186 563 246 650 q 134 372 134 487 q 188 179 134 258 q 359 88 250 88 q 492 136 437 88 q 566 264 548 185 l 701 264 "},"\xB6":{x_min:0,x_max:566.671875,ha:678,o:"m 21 892 l 52 892 l 98 761 l 145 892 l 176 892 l 178 741 l 157 741 l 157 867 l 108 741 l 88 741 l 40 871 l 40 741 l 21 741 l 21 892 m 308 854 l 308 731 q 252 691 308 691 q 227 691 240 691 q 207 696 213 695 l 207 712 l 253 706 q 288 733 288 706 l 288 763 q 244 741 279 741 q 193 797 193 741 q 261 860 193 860 q 287 860 273 860 q 308 854 302 855 m 288 842 l 263 843 q 213 796 213 843 q 248 756 213 756 q 288 796 288 756 l 288 842 m 566 988 l 502 988 l 502 -1 l 439 -1 l 439 988 l 317 988 l 317 -1 l 252 -1 l 252 602 q 81 653 155 602 q 0 805 0 711 q 101 989 0 918 q 309 1053 194 1053 l 566 1053 l 566 988 "},\u03B2:{x_min:0,x_max:660,ha:745,o:"m 471 550 q 610 450 561 522 q 660 280 660 378 q 578 64 660 151 q 367 -22 497 -22 q 239 5 299 -22 q 126 82 178 32 l 126 -278 l 0 -278 l 0 593 q 54 903 0 801 q 318 1042 127 1042 q 519 964 436 1042 q 603 771 603 887 q 567 644 603 701 q 471 550 532 586 m 337 79 q 476 138 418 79 q 535 279 535 198 q 427 437 535 386 q 226 477 344 477 l 226 583 q 398 620 329 583 q 486 762 486 668 q 435 884 486 833 q 312 935 384 935 q 169 861 219 935 q 126 698 126 797 l 126 362 q 170 169 126 242 q 337 79 224 79 "},\u039C:{x_min:0,x_max:954,ha:1068,o:"m 954 0 l 819 0 l 819 868 l 537 0 l 405 0 l 128 865 l 128 0 l 0 0 l 0 1013 l 199 1013 l 472 158 l 758 1013 l 954 1013 l 954 0 "},\u038C:{x_min:.109375,x_max:1120,ha:1217,o:"m 1120 505 q 994 132 1120 282 q 642 -29 861 -29 q 290 130 422 -29 q 167 505 167 280 q 294 883 167 730 q 650 1046 430 1046 q 999 882 868 1046 q 1120 505 1120 730 m 977 504 q 896 784 977 669 q 644 915 804 915 q 391 785 484 915 q 307 504 307 669 q 391 224 307 339 q 644 95 486 95 q 894 224 803 95 q 977 504 977 339 m 277 1040 l 83 799 l 0 799 l 140 1040 l 277 1040 "},\u0389:{x_min:0,x_max:1158,ha:1275,o:"m 1158 0 l 1022 0 l 1022 475 l 496 475 l 496 0 l 356 0 l 356 1012 l 496 1012 l 496 599 l 1022 599 l 1022 1012 l 1158 1012 l 1158 0 m 277 1040 l 83 799 l 0 799 l 140 1040 l 277 1040 "},"\u2022":{x_min:0,x_max:663.890625,ha:775,o:"m 663 529 q 566 293 663 391 q 331 196 469 196 q 97 294 194 196 q 0 529 0 393 q 96 763 0 665 q 331 861 193 861 q 566 763 469 861 q 663 529 663 665 "},"\xA5":{x_min:.1875,x_max:819.546875,ha:886,o:"m 563 561 l 697 561 l 696 487 l 520 487 l 482 416 l 482 380 l 697 380 l 695 308 l 482 308 l 482 0 l 342 0 l 342 308 l 125 308 l 125 380 l 342 380 l 342 417 l 303 487 l 125 487 l 125 561 l 258 561 l 0 1013 l 140 1013 l 411 533 l 679 1013 l 819 1013 l 563 561 "},"(":{x_min:0,x_max:318.0625,ha:415,o:"m 318 -290 l 230 -290 q 61 23 122 -142 q 0 365 0 190 q 62 712 0 540 q 230 1024 119 869 l 318 1024 q 175 705 219 853 q 125 360 125 542 q 176 22 125 187 q 318 -290 223 -127 "},U:{x_min:0,x_max:796,ha:904,o:"m 796 393 q 681 93 796 212 q 386 -25 566 -25 q 101 95 208 -25 q 0 393 0 211 l 0 1013 l 138 1013 l 138 391 q 204 191 138 270 q 394 107 276 107 q 586 191 512 107 q 656 391 656 270 l 656 1013 l 796 1013 l 796 393 "},\u03B3:{x_min:.5,x_max:744.953125,ha:822,o:"m 744 737 l 463 54 l 463 -278 l 338 -278 l 338 54 l 154 495 q 104 597 124 569 q 13 651 67 651 l 0 651 l 0 751 l 39 753 q 168 711 121 753 q 242 594 207 676 l 403 208 l 617 737 l 744 737 "},\u03B1:{x_min:0,x_max:765.5625,ha:809,o:"m 765 -4 q 698 -14 726 -14 q 564 97 586 -14 q 466 7 525 40 q 337 -26 407 -26 q 88 98 186 -26 q 0 369 0 212 q 88 637 0 525 q 337 760 184 760 q 465 728 407 760 q 563 637 524 696 l 563 739 l 685 739 l 685 222 q 693 141 685 168 q 748 94 708 94 q 765 96 760 94 l 765 -4 m 584 371 q 531 562 584 485 q 360 653 470 653 q 192 566 254 653 q 135 379 135 489 q 186 181 135 261 q 358 84 247 84 q 528 176 465 84 q 584 371 584 260 "},F:{x_min:0,x_max:683.328125,ha:717,o:"m 683 888 l 140 888 l 140 583 l 613 583 l 613 458 l 140 458 l 140 0 l 0 0 l 0 1013 l 683 1013 l 683 888 "},"\xAD":{x_min:0,x_max:705.5625,ha:803,o:"m 705 334 l 0 334 l 0 410 l 705 410 l 705 334 "},":":{x_min:0,x_max:142,ha:239,o:"m 142 585 l 0 585 l 0 738 l 142 738 l 142 585 m 142 0 l 0 0 l 0 151 l 142 151 l 142 0 "},\u03A7:{x_min:0,x_max:854.171875,ha:935,o:"m 854 0 l 683 0 l 423 409 l 166 0 l 0 0 l 347 519 l 18 1013 l 186 1013 l 427 637 l 675 1013 l 836 1013 l 504 521 l 854 0 "},"*":{x_min:116,x_max:674,ha:792,o:"m 674 768 l 475 713 l 610 544 l 517 477 l 394 652 l 272 478 l 178 544 l 314 713 l 116 766 l 153 876 l 341 812 l 342 1013 l 446 1013 l 446 811 l 635 874 l 674 768 "},"\u2020":{x_min:0,x_max:777,ha:835,o:"m 458 804 l 777 804 l 777 683 l 458 683 l 458 0 l 319 0 l 319 681 l 0 683 l 0 804 l 319 804 l 319 1015 l 458 1013 l 458 804 "},"\xB0":{x_min:0,x_max:347,ha:444,o:"m 173 802 q 43 856 91 802 q 0 977 0 905 q 45 1101 0 1049 q 173 1153 90 1153 q 303 1098 255 1153 q 347 977 347 1049 q 303 856 347 905 q 173 802 256 802 m 173 884 q 238 910 214 884 q 262 973 262 937 q 239 1038 262 1012 q 173 1064 217 1064 q 108 1037 132 1064 q 85 973 85 1010 q 108 910 85 937 q 173 884 132 884 "},V:{x_min:0,x_max:862.71875,ha:940,o:"m 862 1013 l 505 0 l 361 0 l 0 1013 l 143 1013 l 434 165 l 718 1012 l 862 1013 "},\u039E:{x_min:0,x_max:734.71875,ha:763,o:"m 723 889 l 9 889 l 9 1013 l 723 1013 l 723 889 m 673 463 l 61 463 l 61 589 l 673 589 l 673 463 m 734 0 l 0 0 l 0 124 l 734 124 l 734 0 "},"\xA0":{x_min:0,x_max:0,ha:853},\u03AB:{x_min:.328125,x_max:819.515625,ha:889,o:"m 588 1046 l 460 1046 l 460 1189 l 588 1189 l 588 1046 m 360 1046 l 232 1046 l 232 1189 l 360 1189 l 360 1046 m 819 1012 l 482 416 l 482 0 l 342 0 l 342 416 l 0 1012 l 140 1012 l 411 533 l 679 1012 l 819 1012 "},"\u201D":{x_min:0,x_max:347,ha:454,o:"m 139 851 q 102 737 139 784 q 0 669 65 690 l 0 734 q 59 787 42 741 q 72 873 72 821 l 0 873 l 0 1013 l 139 1013 l 139 851 m 347 851 q 310 737 347 784 q 208 669 273 690 l 208 734 q 267 787 250 741 q 280 873 280 821 l 208 873 l 208 1013 l 347 1013 l 347 851 "},"@":{x_min:0,x_max:1260,ha:1357,o:"m 1098 -45 q 877 -160 1001 -117 q 633 -203 752 -203 q 155 -29 327 -203 q 0 360 0 127 q 176 802 0 616 q 687 1008 372 1008 q 1123 854 969 1008 q 1260 517 1260 718 q 1155 216 1260 341 q 868 82 1044 82 q 772 106 801 82 q 737 202 737 135 q 647 113 700 144 q 527 82 594 82 q 367 147 420 82 q 314 312 314 212 q 401 565 314 452 q 639 690 498 690 q 810 588 760 690 l 849 668 l 938 668 q 877 441 900 532 q 833 226 833 268 q 853 182 833 198 q 902 167 873 167 q 1088 272 1012 167 q 1159 512 1159 372 q 1051 793 1159 681 q 687 925 925 925 q 248 747 415 925 q 97 361 97 586 q 226 26 97 159 q 627 -122 370 -122 q 856 -87 737 -122 q 1061 8 976 -53 l 1098 -45 m 786 488 q 738 580 777 545 q 643 615 700 615 q 483 517 548 615 q 425 322 425 430 q 457 203 425 250 q 552 156 490 156 q 722 273 665 156 q 786 488 738 309 "},\u038A:{x_min:0,x_max:499,ha:613,o:"m 277 1040 l 83 799 l 0 799 l 140 1040 l 277 1040 m 499 0 l 360 0 l 360 1012 l 499 1012 l 499 0 "},i:{x_min:14,x_max:136,ha:275,o:"m 136 873 l 14 873 l 14 1013 l 136 1013 l 136 873 m 136 0 l 14 0 l 14 737 l 136 737 l 136 0 "},\u0392:{x_min:0,x_max:778,ha:877,o:"m 580 545 q 724 468 671 534 q 778 310 778 402 q 673 83 778 170 q 432 0 575 0 l 0 0 l 0 1013 l 411 1013 q 629 957 541 1013 q 732 768 732 891 q 691 632 732 692 q 580 545 650 571 m 393 899 l 139 899 l 139 587 l 379 587 q 521 623 462 587 q 592 744 592 666 q 531 859 592 819 q 393 899 471 899 m 419 124 q 566 169 504 124 q 635 302 635 219 q 559 435 635 388 q 402 476 494 476 l 139 476 l 139 124 l 419 124 "},\u03C5:{x_min:0,x_max:617,ha:725,o:"m 617 352 q 540 94 617 199 q 308 -24 455 -24 q 76 94 161 -24 q 0 352 0 199 l 0 739 l 126 739 l 126 355 q 169 185 126 257 q 312 98 220 98 q 451 185 402 98 q 492 355 492 257 l 492 739 l 617 739 l 617 352 "},"]":{x_min:0,x_max:275,ha:372,o:"m 275 -281 l 0 -281 l 0 -187 l 151 -187 l 151 920 l 0 920 l 0 1013 l 275 1013 l 275 -281 "},m:{x_min:0,x_max:1019,ha:1128,o:"m 1019 0 l 897 0 l 897 454 q 860 591 897 536 q 739 660 816 660 q 613 586 659 660 q 573 436 573 522 l 573 0 l 447 0 l 447 455 q 412 591 447 535 q 294 657 372 657 q 165 586 213 657 q 122 437 122 521 l 122 0 l 0 0 l 0 738 l 117 738 l 117 640 q 202 730 150 697 q 316 763 254 763 q 437 730 381 763 q 525 642 494 697 q 621 731 559 700 q 753 763 682 763 q 943 694 867 763 q 1019 512 1019 625 l 1019 0 "},\u03C7:{x_min:8.328125,x_max:780.5625,ha:815,o:"m 780 -278 q 715 -294 747 -294 q 616 -257 663 -294 q 548 -175 576 -227 l 379 133 l 143 -277 l 9 -277 l 313 254 l 163 522 q 127 586 131 580 q 36 640 91 640 q 8 637 27 640 l 8 752 l 52 757 q 162 719 113 757 q 236 627 200 690 l 383 372 l 594 737 l 726 737 l 448 250 l 625 -69 q 670 -153 647 -110 q 743 -188 695 -188 q 780 -184 759 -188 l 780 -278 "},\u03AF:{x_min:42,x_max:326.71875,ha:361,o:"m 284 3 q 233 -10 258 -5 q 182 -15 207 -15 q 85 26 119 -15 q 42 200 42 79 l 42 737 l 167 737 l 168 215 q 172 141 168 157 q 226 101 183 101 q 248 102 239 101 q 284 112 257 104 l 284 3 m 326 1040 l 137 819 l 54 819 l 189 1040 l 326 1040 "},\u0396:{x_min:0,x_max:779.171875,ha:850,o:"m 779 0 l 0 0 l 0 113 l 620 896 l 40 896 l 40 1013 l 779 1013 l 779 887 l 170 124 l 779 124 l 779 0 "},R:{x_min:0,x_max:781.953125,ha:907,o:"m 781 0 l 623 0 q 587 242 590 52 q 407 433 585 433 l 138 433 l 138 0 l 0 0 l 0 1013 l 396 1013 q 636 946 539 1013 q 749 731 749 868 q 711 597 749 659 q 608 502 674 534 q 718 370 696 474 q 729 207 722 352 q 781 26 736 62 l 781 0 m 373 551 q 533 594 465 551 q 614 731 614 645 q 532 859 614 815 q 373 896 465 896 l 138 896 l 138 551 l 373 551 "},o:{x_min:0,x_max:713,ha:821,o:"m 357 -25 q 94 91 194 -25 q 0 368 0 202 q 93 642 0 533 q 357 761 193 761 q 618 644 518 761 q 713 368 713 533 q 619 91 713 201 q 357 -25 521 -25 m 357 85 q 528 175 465 85 q 584 369 584 255 q 529 562 584 484 q 357 651 467 651 q 189 560 250 651 q 135 369 135 481 q 187 177 135 257 q 357 85 250 85 "},K:{x_min:0,x_max:819.46875,ha:906,o:"m 819 0 l 649 0 l 294 509 l 139 355 l 139 0 l 0 0 l 0 1013 l 139 1013 l 139 526 l 626 1013 l 809 1013 l 395 600 l 819 0 "},",":{x_min:0,x_max:142,ha:239,o:"m 142 -12 q 105 -132 142 -82 q 0 -205 68 -182 l 0 -138 q 57 -82 40 -124 q 70 0 70 -51 l 0 0 l 0 151 l 142 151 l 142 -12 "},d:{x_min:0,x_max:683,ha:796,o:"m 683 0 l 564 0 l 564 93 q 456 6 516 38 q 327 -25 395 -25 q 87 100 181 -25 q 0 365 0 215 q 90 639 0 525 q 343 763 187 763 q 564 647 486 763 l 564 1013 l 683 1013 l 683 0 m 582 373 q 529 562 582 484 q 361 653 468 653 q 190 561 253 653 q 135 365 135 479 q 189 175 135 254 q 358 85 251 85 q 529 178 468 85 q 582 373 582 258 "},"\xA8":{x_min:-109,x_max:247,ha:232,o:"m 247 1046 l 119 1046 l 119 1189 l 247 1189 l 247 1046 m 19 1046 l -109 1046 l -109 1189 l 19 1189 l 19 1046 "},E:{x_min:0,x_max:736.109375,ha:789,o:"m 736 0 l 0 0 l 0 1013 l 725 1013 l 725 889 l 139 889 l 139 585 l 677 585 l 677 467 l 139 467 l 139 125 l 736 125 l 736 0 "},Y:{x_min:0,x_max:820,ha:886,o:"m 820 1013 l 482 416 l 482 0 l 342 0 l 342 416 l 0 1013 l 140 1013 l 411 534 l 679 1012 l 820 1013 "},'"':{x_min:0,x_max:299,ha:396,o:"m 299 606 l 203 606 l 203 988 l 299 988 l 299 606 m 96 606 l 0 606 l 0 988 l 96 988 l 96 606 "},"\u2039":{x_min:17.984375,x_max:773.609375,ha:792,o:"m 773 40 l 18 376 l 17 465 l 773 799 l 773 692 l 159 420 l 773 149 l 773 40 "},"\u201E":{x_min:0,x_max:364,ha:467,o:"m 141 -12 q 104 -132 141 -82 q 0 -205 67 -182 l 0 -138 q 56 -82 40 -124 q 69 0 69 -51 l 0 0 l 0 151 l 141 151 l 141 -12 m 364 -12 q 327 -132 364 -82 q 222 -205 290 -182 l 222 -138 q 279 -82 262 -124 q 292 0 292 -51 l 222 0 l 222 151 l 364 151 l 364 -12 "},\u03B4:{x_min:1,x_max:710,ha:810,o:"m 710 360 q 616 87 710 196 q 356 -28 518 -28 q 99 82 197 -28 q 1 356 1 192 q 100 606 1 509 q 355 703 199 703 q 180 829 288 754 q 70 903 124 866 l 70 1012 l 643 1012 l 643 901 l 258 901 q 462 763 422 794 q 636 592 577 677 q 710 360 710 485 m 584 365 q 552 501 584 447 q 451 602 521 555 q 372 611 411 611 q 197 541 258 611 q 136 355 136 472 q 190 171 136 245 q 358 85 252 85 q 528 173 465 85 q 584 365 584 252 "},\u03AD:{x_min:0,x_max:634.71875,ha:714,o:"m 634 234 q 527 38 634 110 q 300 -25 433 -25 q 98 29 183 -25 q 0 204 0 93 q 37 313 0 265 q 128 390 67 352 q 56 459 82 419 q 26 555 26 505 q 114 712 26 654 q 295 763 191 763 q 499 700 416 763 q 589 515 589 631 l 478 515 q 419 618 464 580 q 307 657 374 657 q 207 630 253 657 q 151 547 151 598 q 238 445 151 469 q 389 434 280 434 l 389 331 l 349 331 q 206 315 255 331 q 125 210 125 287 q 183 107 125 145 q 302 76 233 76 q 436 117 379 76 q 509 234 493 159 l 634 234 m 520 1040 l 331 819 l 248 819 l 383 1040 l 520 1040 "},\u03C9:{x_min:0,x_max:922,ha:1031,o:"m 922 339 q 856 97 922 203 q 650 -26 780 -26 q 538 9 587 -26 q 461 103 489 44 q 387 12 436 46 q 277 -22 339 -22 q 69 97 147 -22 q 0 339 0 203 q 45 551 0 444 q 161 738 84 643 l 302 738 q 175 553 219 647 q 124 336 124 446 q 155 179 124 249 q 275 88 197 88 q 375 163 341 88 q 400 294 400 219 l 400 572 l 524 572 l 524 294 q 561 135 524 192 q 643 88 591 88 q 762 182 719 88 q 797 342 797 257 q 745 556 797 450 q 619 738 705 638 l 760 738 q 874 551 835 640 q 922 339 922 444 "},"\xB4":{x_min:0,x_max:96,ha:251,o:"m 96 606 l 0 606 l 0 988 l 96 988 l 96 606 "},"\xB1":{x_min:11,x_max:781,ha:792,o:"m 781 490 l 446 490 l 446 255 l 349 255 l 349 490 l 11 490 l 11 586 l 349 586 l 349 819 l 446 819 l 446 586 l 781 586 l 781 490 m 781 21 l 11 21 l 11 115 l 781 115 l 781 21 "},"|":{x_min:343,x_max:449,ha:792,o:"m 449 462 l 343 462 l 343 986 l 449 986 l 449 462 m 449 -242 l 343 -242 l 343 280 l 449 280 l 449 -242 "},\u03CB:{x_min:0,x_max:617,ha:725,o:"m 482 800 l 372 800 l 372 925 l 482 925 l 482 800 m 239 800 l 129 800 l 129 925 l 239 925 l 239 800 m 617 352 q 540 93 617 199 q 308 -24 455 -24 q 76 93 161 -24 q 0 352 0 199 l 0 738 l 126 738 l 126 354 q 169 185 126 257 q 312 98 220 98 q 451 185 402 98 q 492 354 492 257 l 492 738 l 617 738 l 617 352 "},"\xA7":{x_min:0,x_max:593,ha:690,o:"m 593 425 q 554 312 593 369 q 467 233 516 254 q 537 83 537 172 q 459 -74 537 -12 q 288 -133 387 -133 q 115 -69 184 -133 q 47 96 47 -6 l 166 96 q 199 7 166 40 q 288 -26 232 -26 q 371 -5 332 -26 q 420 60 420 21 q 311 201 420 139 q 108 309 210 255 q 0 490 0 383 q 33 602 0 551 q 124 687 66 654 q 75 743 93 712 q 58 812 58 773 q 133 984 58 920 q 300 1043 201 1043 q 458 987 394 1043 q 529 814 529 925 l 411 814 q 370 908 404 877 q 289 939 336 939 q 213 911 246 939 q 180 841 180 883 q 286 720 180 779 q 484 612 480 615 q 593 425 593 534 m 467 409 q 355 544 467 473 q 196 630 228 612 q 146 587 162 609 q 124 525 124 558 q 239 387 124 462 q 398 298 369 315 q 448 345 429 316 q 467 409 467 375 "},b:{x_min:0,x_max:685,ha:783,o:"m 685 372 q 597 99 685 213 q 347 -25 501 -25 q 219 5 277 -25 q 121 93 161 36 l 121 0 l 0 0 l 0 1013 l 121 1013 l 121 634 q 214 723 157 692 q 341 754 272 754 q 591 637 493 754 q 685 372 685 526 m 554 356 q 499 550 554 470 q 328 644 437 644 q 162 556 223 644 q 108 369 108 478 q 160 176 108 256 q 330 83 221 83 q 498 169 435 83 q 554 356 554 245 "},q:{x_min:0,x_max:683,ha:876,o:"m 683 -278 l 564 -278 l 564 97 q 474 8 533 39 q 345 -23 415 -23 q 91 93 188 -23 q 0 364 0 203 q 87 635 0 522 q 337 760 184 760 q 466 727 408 760 q 564 637 523 695 l 564 737 l 683 737 l 683 -278 m 582 375 q 527 564 582 488 q 358 652 466 652 q 190 565 253 652 q 135 377 135 488 q 189 179 135 261 q 361 84 251 84 q 530 179 469 84 q 582 375 582 260 "},\u03A9:{x_min:-.171875,x_max:969.5625,ha:1068,o:"m 969 0 l 555 0 l 555 123 q 744 308 675 194 q 814 558 814 423 q 726 812 814 709 q 484 922 633 922 q 244 820 334 922 q 154 567 154 719 q 223 316 154 433 q 412 123 292 199 l 412 0 l 0 0 l 0 124 l 217 124 q 68 327 122 210 q 15 572 15 444 q 144 911 15 781 q 484 1041 274 1041 q 822 909 691 1041 q 953 569 953 777 q 899 326 953 443 q 750 124 846 210 l 969 124 l 969 0 "},\u03CD:{x_min:0,x_max:617,ha:725,o:"m 617 352 q 540 93 617 199 q 308 -24 455 -24 q 76 93 161 -24 q 0 352 0 199 l 0 738 l 126 738 l 126 354 q 169 185 126 257 q 312 98 220 98 q 451 185 402 98 q 492 354 492 257 l 492 738 l 617 738 l 617 352 m 535 1040 l 346 819 l 262 819 l 397 1040 l 535 1040 "},z:{x_min:-.015625,x_max:613.890625,ha:697,o:"m 613 0 l 0 0 l 0 100 l 433 630 l 20 630 l 20 738 l 594 738 l 593 636 l 163 110 l 613 110 l 613 0 "},"\u2122":{x_min:0,x_max:894,ha:1e3,o:"m 389 951 l 229 951 l 229 503 l 160 503 l 160 951 l 0 951 l 0 1011 l 389 1011 l 389 951 m 894 503 l 827 503 l 827 939 l 685 503 l 620 503 l 481 937 l 481 503 l 417 503 l 417 1011 l 517 1011 l 653 580 l 796 1010 l 894 1011 l 894 503 "},\u03AE:{x_min:.78125,x_max:697,ha:810,o:"m 697 -278 l 572 -278 l 572 454 q 540 587 572 536 q 425 650 501 650 q 271 579 337 650 q 206 420 206 509 l 206 0 l 81 0 l 81 489 q 73 588 81 562 q 0 644 56 644 l 0 741 q 68 755 38 755 q 158 721 124 755 q 200 630 193 687 q 297 726 234 692 q 434 761 359 761 q 620 692 544 761 q 697 516 697 624 l 697 -278 m 479 1040 l 290 819 l 207 819 l 341 1040 l 479 1040 "},\u0398:{x_min:0,x_max:960,ha:1056,o:"m 960 507 q 833 129 960 280 q 476 -32 698 -32 q 123 129 255 -32 q 0 507 0 280 q 123 883 0 732 q 476 1045 255 1045 q 832 883 696 1045 q 960 507 960 732 m 817 500 q 733 789 817 669 q 476 924 639 924 q 223 792 317 924 q 142 507 142 675 q 222 222 142 339 q 476 89 315 89 q 730 218 636 89 q 817 500 817 334 m 716 449 l 243 449 l 243 571 l 716 571 l 716 449 "},"\xAE":{x_min:-3,x_max:1008,ha:1106,o:"m 503 532 q 614 562 566 532 q 672 658 672 598 q 614 747 672 716 q 503 772 569 772 l 338 772 l 338 532 l 503 532 m 502 -7 q 123 151 263 -7 q -3 501 -3 294 q 123 851 -3 706 q 502 1011 263 1011 q 881 851 739 1011 q 1008 501 1008 708 q 883 151 1008 292 q 502 -7 744 -7 m 502 60 q 830 197 709 60 q 940 501 940 322 q 831 805 940 681 q 502 944 709 944 q 174 805 296 944 q 65 501 65 680 q 173 197 65 320 q 502 60 294 60 m 788 146 l 678 146 q 653 316 655 183 q 527 449 652 449 l 338 449 l 338 146 l 241 146 l 241 854 l 518 854 q 688 808 621 854 q 766 658 766 755 q 739 563 766 607 q 668 497 713 519 q 751 331 747 472 q 788 164 756 190 l 788 146 "},"~":{x_min:0,x_max:833,ha:931,o:"m 833 958 q 778 753 833 831 q 594 665 716 665 q 402 761 502 665 q 240 857 302 857 q 131 795 166 857 q 104 665 104 745 l 0 665 q 54 867 0 789 q 237 958 116 958 q 429 861 331 958 q 594 765 527 765 q 704 827 670 765 q 729 958 729 874 l 833 958 "},\u0395:{x_min:0,x_max:736.21875,ha:778,o:"m 736 0 l 0 0 l 0 1013 l 725 1013 l 725 889 l 139 889 l 139 585 l 677 585 l 677 467 l 139 467 l 139 125 l 736 125 l 736 0 "},"\xB3":{x_min:0,x_max:450,ha:547,o:"m 450 552 q 379 413 450 464 q 220 366 313 366 q 69 414 130 366 q 0 567 0 470 l 85 567 q 126 470 85 504 q 225 437 168 437 q 320 467 280 437 q 360 552 360 498 q 318 632 360 608 q 213 657 276 657 q 195 657 203 657 q 176 657 181 657 l 176 722 q 279 733 249 722 q 334 815 334 752 q 300 881 334 856 q 220 907 267 907 q 133 875 169 907 q 97 781 97 844 l 15 781 q 78 926 15 875 q 220 972 135 972 q 364 930 303 972 q 426 817 426 888 q 344 697 426 733 q 421 642 392 681 q 450 552 450 603 "},"[":{x_min:0,x_max:273.609375,ha:371,o:"m 273 -281 l 0 -281 l 0 1013 l 273 1013 l 273 920 l 124 920 l 124 -187 l 273 -187 l 273 -281 "},L:{x_min:0,x_max:645.828125,ha:696,o:"m 645 0 l 0 0 l 0 1013 l 140 1013 l 140 126 l 645 126 l 645 0 "},\u03C3:{x_min:0,x_max:803.390625,ha:894,o:"m 803 628 l 633 628 q 713 368 713 512 q 618 93 713 204 q 357 -25 518 -25 q 94 91 194 -25 q 0 368 0 201 q 94 644 0 533 q 356 761 194 761 q 481 750 398 761 q 608 739 564 739 l 803 739 l 803 628 m 360 85 q 529 180 467 85 q 584 374 584 262 q 527 566 584 490 q 352 651 463 651 q 187 559 247 651 q 135 368 135 478 q 189 175 135 254 q 360 85 251 85 "},\u03B6:{x_min:0,x_max:573,ha:642,o:"m 573 -40 q 553 -162 573 -97 q 510 -278 543 -193 l 400 -278 q 441 -187 428 -219 q 462 -90 462 -132 q 378 -14 462 -14 q 108 45 197 -14 q 0 290 0 117 q 108 631 0 462 q 353 901 194 767 l 55 901 l 55 1012 l 561 1012 l 561 924 q 261 669 382 831 q 128 301 128 489 q 243 117 128 149 q 458 98 350 108 q 573 -40 573 80 "},\u03B8:{x_min:0,x_max:674,ha:778,o:"m 674 496 q 601 160 674 304 q 336 -26 508 -26 q 73 153 165 -26 q 0 485 0 296 q 72 840 0 683 q 343 1045 166 1045 q 605 844 516 1045 q 674 496 674 692 m 546 579 q 498 798 546 691 q 336 935 437 935 q 178 798 237 935 q 126 579 137 701 l 546 579 m 546 475 l 126 475 q 170 233 126 348 q 338 80 230 80 q 504 233 447 80 q 546 475 546 346 "},\u039F:{x_min:0,x_max:958,ha:1054,o:"m 485 1042 q 834 883 703 1042 q 958 511 958 735 q 834 136 958 287 q 481 -26 701 -26 q 126 130 261 -26 q 0 504 0 279 q 127 880 0 729 q 485 1042 263 1042 m 480 98 q 731 225 638 98 q 815 504 815 340 q 733 783 815 670 q 480 913 640 913 q 226 785 321 913 q 142 504 142 671 q 226 224 142 339 q 480 98 319 98 "},\u0393:{x_min:0,x_max:705.28125,ha:749,o:"m 705 886 l 140 886 l 140 0 l 0 0 l 0 1012 l 705 1012 l 705 886 "}," ":{x_min:0,x_max:0,ha:375},"%":{x_min:-3,x_max:1089,ha:1186,o:"m 845 0 q 663 76 731 0 q 602 244 602 145 q 661 412 602 344 q 845 489 728 489 q 1027 412 959 489 q 1089 244 1089 343 q 1029 76 1089 144 q 845 0 962 0 m 844 103 q 945 143 909 103 q 981 243 981 184 q 947 340 981 301 q 844 385 909 385 q 744 342 781 385 q 708 243 708 300 q 741 147 708 186 q 844 103 780 103 m 888 986 l 284 -25 l 199 -25 l 803 986 l 888 986 m 241 468 q 58 545 126 468 q -3 715 -3 615 q 56 881 -3 813 q 238 958 124 958 q 421 881 353 958 q 483 712 483 813 q 423 544 483 612 q 241 468 356 468 m 241 855 q 137 811 175 855 q 100 710 100 768 q 136 612 100 653 q 240 572 172 572 q 344 614 306 572 q 382 713 382 656 q 347 810 382 771 q 241 855 308 855 "},P:{x_min:0,x_max:726,ha:806,o:"m 424 1013 q 640 931 555 1013 q 726 719 726 850 q 637 506 726 587 q 413 426 548 426 l 140 426 l 140 0 l 0 0 l 0 1013 l 424 1013 m 379 889 l 140 889 l 140 548 l 372 548 q 522 589 459 548 q 593 720 593 637 q 528 845 593 801 q 379 889 463 889 "},\u0388:{x_min:0,x_max:1078.21875,ha:1118,o:"m 1078 0 l 342 0 l 342 1013 l 1067 1013 l 1067 889 l 481 889 l 481 585 l 1019 585 l 1019 467 l 481 467 l 481 125 l 1078 125 l 1078 0 m 277 1040 l 83 799 l 0 799 l 140 1040 l 277 1040 "},\u038F:{x_min:.125,x_max:1136.546875,ha:1235,o:"m 1136 0 l 722 0 l 722 123 q 911 309 842 194 q 981 558 981 423 q 893 813 981 710 q 651 923 800 923 q 411 821 501 923 q 321 568 321 720 q 390 316 321 433 q 579 123 459 200 l 579 0 l 166 0 l 166 124 l 384 124 q 235 327 289 210 q 182 572 182 444 q 311 912 182 782 q 651 1042 441 1042 q 989 910 858 1042 q 1120 569 1120 778 q 1066 326 1120 443 q 917 124 1013 210 l 1136 124 l 1136 0 m 277 1040 l 83 800 l 0 800 l 140 1041 l 277 1040 "},_:{x_min:0,x_max:705.5625,ha:803,o:"m 705 -334 l 0 -334 l 0 -234 l 705 -234 l 705 -334 "},\u03AA:{x_min:-110,x_max:246,ha:275,o:"m 246 1046 l 118 1046 l 118 1189 l 246 1189 l 246 1046 m 18 1046 l -110 1046 l -110 1189 l 18 1189 l 18 1046 m 136 0 l 0 0 l 0 1012 l 136 1012 l 136 0 "},"+":{x_min:23,x_max:768,ha:792,o:"m 768 372 l 444 372 l 444 0 l 347 0 l 347 372 l 23 372 l 23 468 l 347 468 l 347 840 l 444 840 l 444 468 l 768 468 l 768 372 "},"\xBD":{x_min:0,x_max:1050,ha:1149,o:"m 1050 0 l 625 0 q 712 178 625 108 q 878 277 722 187 q 967 385 967 328 q 932 456 967 429 q 850 484 897 484 q 759 450 798 484 q 721 352 721 416 l 640 352 q 706 502 640 448 q 851 551 766 551 q 987 509 931 551 q 1050 385 1050 462 q 976 251 1050 301 q 829 179 902 215 q 717 68 740 133 l 1050 68 l 1050 0 m 834 985 l 215 -28 l 130 -28 l 750 984 l 834 985 m 224 422 l 142 422 l 142 811 l 0 811 l 0 867 q 104 889 62 867 q 164 973 157 916 l 224 973 l 224 422 "},\u03A1:{x_min:0,x_max:720,ha:783,o:"m 424 1013 q 637 933 554 1013 q 720 723 720 853 q 633 508 720 591 q 413 426 546 426 l 140 426 l 140 0 l 0 0 l 0 1013 l 424 1013 m 378 889 l 140 889 l 140 548 l 371 548 q 521 589 458 548 q 592 720 592 637 q 527 845 592 801 q 378 889 463 889 "},"'":{x_min:0,x_max:139,ha:236,o:"m 139 851 q 102 737 139 784 q 0 669 65 690 l 0 734 q 59 787 42 741 q 72 873 72 821 l 0 873 l 0 1013 l 139 1013 l 139 851 "},\u00AA:{x_min:0,x_max:350,ha:397,o:"m 350 625 q 307 616 328 616 q 266 631 281 616 q 247 673 251 645 q 190 628 225 644 q 116 613 156 613 q 32 641 64 613 q 0 722 0 669 q 72 826 0 800 q 247 866 159 846 l 247 887 q 220 934 247 916 q 162 953 194 953 q 104 934 129 953 q 76 882 80 915 l 16 882 q 60 976 16 941 q 166 1011 104 1011 q 266 979 224 1011 q 308 891 308 948 l 308 706 q 311 679 308 688 q 331 670 315 670 l 350 672 l 350 625 m 247 757 l 247 811 q 136 790 175 798 q 64 726 64 773 q 83 682 64 697 q 132 667 103 667 q 207 690 174 667 q 247 757 247 718 "},"\u0385":{x_min:0,x_max:450,ha:553,o:"m 450 800 l 340 800 l 340 925 l 450 925 l 450 800 m 406 1040 l 212 800 l 129 800 l 269 1040 l 406 1040 m 110 800 l 0 800 l 0 925 l 110 925 l 110 800 "},T:{x_min:0,x_max:777,ha:835,o:"m 777 894 l 458 894 l 458 0 l 319 0 l 319 894 l 0 894 l 0 1013 l 777 1013 l 777 894 "},\u03A6:{x_min:0,x_max:915,ha:997,o:"m 527 0 l 389 0 l 389 122 q 110 231 220 122 q 0 509 0 340 q 110 785 0 677 q 389 893 220 893 l 389 1013 l 527 1013 l 527 893 q 804 786 693 893 q 915 509 915 679 q 805 231 915 341 q 527 122 696 122 l 527 0 m 527 226 q 712 310 641 226 q 779 507 779 389 q 712 705 779 627 q 527 787 641 787 l 527 226 m 389 226 l 389 787 q 205 698 275 775 q 136 505 136 620 q 206 308 136 391 q 389 226 276 226 "},"\u204B":{x_min:0,x_max:0,ha:694},j:{x_min:-77.78125,x_max:167,ha:349,o:"m 167 871 l 42 871 l 42 1013 l 167 1013 l 167 871 m 167 -80 q 121 -231 167 -184 q -26 -278 76 -278 l -77 -278 l -77 -164 l -41 -164 q 26 -143 11 -164 q 42 -65 42 -122 l 42 737 l 167 737 l 167 -80 "},\u03A3:{x_min:0,x_max:756.953125,ha:819,o:"m 756 0 l 0 0 l 0 107 l 395 523 l 22 904 l 22 1013 l 745 1013 l 745 889 l 209 889 l 566 523 l 187 125 l 756 125 l 756 0 "},"\u203A":{x_min:18.0625,x_max:774,ha:792,o:"m 774 376 l 18 40 l 18 149 l 631 421 l 18 692 l 18 799 l 774 465 l 774 376 "},"<":{x_min:17.984375,x_max:773.609375,ha:792,o:"m 773 40 l 18 376 l 17 465 l 773 799 l 773 692 l 159 420 l 773 149 l 773 40 "},"\xA3":{x_min:0,x_max:704.484375,ha:801,o:"m 704 41 q 623 -10 664 5 q 543 -26 583 -26 q 359 15 501 -26 q 243 36 288 36 q 158 23 197 36 q 73 -21 119 10 l 6 76 q 125 195 90 150 q 175 331 175 262 q 147 443 175 383 l 0 443 l 0 512 l 108 512 q 43 734 43 623 q 120 929 43 854 q 358 1010 204 1010 q 579 936 487 1010 q 678 729 678 857 l 678 684 l 552 684 q 504 838 552 780 q 362 896 457 896 q 216 852 263 896 q 176 747 176 815 q 199 627 176 697 q 248 512 217 574 l 468 512 l 468 443 l 279 443 q 297 356 297 398 q 230 194 297 279 q 153 107 211 170 q 227 133 190 125 q 293 142 264 142 q 410 119 339 142 q 516 96 482 96 q 579 105 550 96 q 648 142 608 115 l 704 41 "},t:{x_min:0,x_max:367,ha:458,o:"m 367 0 q 312 -5 339 -2 q 262 -8 284 -8 q 145 28 183 -8 q 108 143 108 64 l 108 638 l 0 638 l 0 738 l 108 738 l 108 944 l 232 944 l 232 738 l 367 738 l 367 638 l 232 638 l 232 185 q 248 121 232 140 q 307 102 264 102 q 345 104 330 102 q 367 107 360 107 l 367 0 "},"\xAC":{x_min:0,x_max:706,ha:803,o:"m 706 411 l 706 158 l 630 158 l 630 335 l 0 335 l 0 411 l 706 411 "},\u03BB:{x_min:0,x_max:750,ha:803,o:"m 750 -7 q 679 -15 716 -15 q 538 59 591 -15 q 466 214 512 97 l 336 551 l 126 0 l 0 0 l 270 705 q 223 837 247 770 q 116 899 190 899 q 90 898 100 899 l 90 1004 q 152 1011 125 1011 q 298 938 244 1011 q 373 783 326 901 l 605 192 q 649 115 629 136 q 716 95 669 95 l 736 95 q 750 97 745 97 l 750 -7 "},W:{x_min:0,x_max:1263.890625,ha:1351,o:"m 1263 1013 l 995 0 l 859 0 l 627 837 l 405 0 l 265 0 l 0 1013 l 136 1013 l 342 202 l 556 1013 l 701 1013 l 921 207 l 1133 1012 l 1263 1013 "},">":{x_min:18.0625,x_max:774,ha:792,o:"m 774 376 l 18 40 l 18 149 l 631 421 l 18 692 l 18 799 l 774 465 l 774 376 "},v:{x_min:0,x_max:675.15625,ha:761,o:"m 675 738 l 404 0 l 272 0 l 0 738 l 133 737 l 340 147 l 541 737 l 675 738 "},\u03C4:{x_min:.28125,x_max:644.5,ha:703,o:"m 644 628 l 382 628 l 382 179 q 388 120 382 137 q 436 91 401 91 q 474 94 447 91 q 504 97 501 97 l 504 0 q 454 -9 482 -5 q 401 -14 426 -14 q 278 67 308 -14 q 260 233 260 118 l 260 628 l 0 628 l 0 739 l 644 739 l 644 628 "},\u03BE:{x_min:0,x_max:624.9375,ha:699,o:"m 624 -37 q 608 -153 624 -96 q 563 -278 593 -211 l 454 -278 q 491 -183 486 -200 q 511 -83 511 -126 q 484 -23 511 -44 q 370 1 452 1 q 323 0 354 1 q 283 -1 293 -1 q 84 76 169 -1 q 0 266 0 154 q 56 431 0 358 q 197 538 108 498 q 94 613 134 562 q 54 730 54 665 q 77 823 54 780 q 143 901 101 867 l 27 901 l 27 1012 l 576 1012 l 576 901 l 380 901 q 244 863 303 901 q 178 745 178 820 q 312 600 178 636 q 532 582 380 582 l 532 479 q 276 455 361 479 q 118 281 118 410 q 165 173 118 217 q 274 120 208 133 q 494 101 384 110 q 624 -37 624 76 "},"&":{x_min:-3,x_max:894.25,ha:992,o:"m 894 0 l 725 0 l 624 123 q 471 0 553 40 q 306 -41 390 -41 q 168 -7 231 -41 q 62 92 105 26 q 14 187 31 139 q -3 276 -3 235 q 55 433 -3 358 q 248 581 114 508 q 170 689 196 640 q 137 817 137 751 q 214 985 137 922 q 384 1041 284 1041 q 548 988 483 1041 q 622 824 622 928 q 563 666 622 739 q 431 556 516 608 l 621 326 q 649 407 639 361 q 663 493 653 426 l 781 493 q 703 229 781 352 l 894 0 m 504 818 q 468 908 504 877 q 384 940 433 940 q 293 907 331 940 q 255 818 255 875 q 289 714 255 767 q 363 628 313 678 q 477 729 446 682 q 504 818 504 771 m 556 209 l 314 499 q 179 395 223 449 q 135 283 135 341 q 146 222 135 253 q 183 158 158 192 q 333 80 241 80 q 556 209 448 80 "},\u039B:{x_min:0,x_max:862.5,ha:942,o:"m 862 0 l 719 0 l 426 847 l 143 0 l 0 0 l 356 1013 l 501 1013 l 862 0 "},I:{x_min:41,x_max:180,ha:293,o:"m 180 0 l 41 0 l 41 1013 l 180 1013 l 180 0 "},G:{x_min:0,x_max:921,ha:1011,o:"m 921 0 l 832 0 l 801 136 q 655 15 741 58 q 470 -28 568 -28 q 126 133 259 -28 q 0 499 0 284 q 125 881 0 731 q 486 1043 259 1043 q 763 957 647 1043 q 905 709 890 864 l 772 709 q 668 866 747 807 q 486 926 589 926 q 228 795 322 926 q 142 507 142 677 q 228 224 142 342 q 483 94 323 94 q 712 195 625 94 q 796 435 796 291 l 477 435 l 477 549 l 921 549 l 921 0 "},\u03B0:{x_min:0,x_max:617,ha:725,o:"m 524 800 l 414 800 l 414 925 l 524 925 l 524 800 m 183 800 l 73 800 l 73 925 l 183 925 l 183 800 m 617 352 q 540 93 617 199 q 308 -24 455 -24 q 76 93 161 -24 q 0 352 0 199 l 0 738 l 126 738 l 126 354 q 169 185 126 257 q 312 98 220 98 q 451 185 402 98 q 492 354 492 257 l 492 738 l 617 738 l 617 352 m 489 1040 l 300 819 l 216 819 l 351 1040 l 489 1040 "},"`":{x_min:0,x_max:138.890625,ha:236,o:"m 138 699 l 0 699 l 0 861 q 36 974 0 929 q 138 1041 72 1020 l 138 977 q 82 931 95 969 q 69 839 69 893 l 138 839 l 138 699 "},"\xB7":{x_min:0,x_max:142,ha:239,o:"m 142 585 l 0 585 l 0 738 l 142 738 l 142 585 "},\u03A5:{x_min:.328125,x_max:819.515625,ha:889,o:"m 819 1013 l 482 416 l 482 0 l 342 0 l 342 416 l 0 1013 l 140 1013 l 411 533 l 679 1013 l 819 1013 "},r:{x_min:0,x_max:355.5625,ha:432,o:"m 355 621 l 343 621 q 179 569 236 621 q 122 411 122 518 l 122 0 l 0 0 l 0 737 l 117 737 l 117 604 q 204 719 146 686 q 355 753 262 753 l 355 621 "},x:{x_min:0,x_max:675,ha:764,o:"m 675 0 l 525 0 l 331 286 l 144 0 l 0 0 l 256 379 l 12 738 l 157 737 l 336 473 l 516 738 l 661 738 l 412 380 l 675 0 "},\u03BC:{x_min:0,x_max:696.609375,ha:747,o:"m 696 -4 q 628 -14 657 -14 q 498 97 513 -14 q 422 8 470 41 q 313 -24 374 -24 q 207 3 258 -24 q 120 80 157 31 l 120 -278 l 0 -278 l 0 738 l 124 738 l 124 343 q 165 172 124 246 q 308 82 216 82 q 451 177 402 82 q 492 358 492 254 l 492 738 l 616 738 l 616 214 q 623 136 616 160 q 673 92 636 92 q 696 95 684 92 l 696 -4 "},h:{x_min:0,x_max:615,ha:724,o:"m 615 472 l 615 0 l 490 0 l 490 454 q 456 590 490 535 q 338 654 416 654 q 186 588 251 654 q 122 436 122 522 l 122 0 l 0 0 l 0 1013 l 122 1013 l 122 633 q 218 727 149 694 q 362 760 287 760 q 552 676 484 760 q 615 472 615 600 "},".":{x_min:0,x_max:142,ha:239,o:"m 142 0 l 0 0 l 0 151 l 142 151 l 142 0 "},\u03C6:{x_min:-2,x_max:878,ha:974,o:"m 496 -279 l 378 -279 l 378 -17 q 101 88 204 -17 q -2 367 -2 194 q 68 626 -2 510 q 283 758 151 758 l 283 646 q 167 537 209 626 q 133 373 133 462 q 192 177 133 254 q 378 93 259 93 l 378 758 q 445 764 426 763 q 476 765 464 765 q 765 659 653 765 q 878 377 878 553 q 771 96 878 209 q 496 -17 665 -17 l 496 -279 m 496 93 l 514 93 q 687 183 623 93 q 746 380 746 265 q 691 569 746 491 q 522 658 629 658 l 496 656 l 496 93 "},";":{x_min:0,x_max:142,ha:239,o:"m 142 585 l 0 585 l 0 738 l 142 738 l 142 585 m 142 -12 q 105 -132 142 -82 q 0 -206 68 -182 l 0 -138 q 58 -82 43 -123 q 68 0 68 -56 l 0 0 l 0 151 l 142 151 l 142 -12 "},f:{x_min:0,x_max:378,ha:472,o:"m 378 638 l 246 638 l 246 0 l 121 0 l 121 638 l 0 638 l 0 738 l 121 738 q 137 935 121 887 q 290 1028 171 1028 q 320 1027 305 1028 q 378 1021 334 1026 l 378 908 q 323 918 346 918 q 257 870 273 918 q 246 780 246 840 l 246 738 l 378 738 l 378 638 "},"\u201C":{x_min:1,x_max:348.21875,ha:454,o:"m 140 670 l 1 670 l 1 830 q 37 943 1 897 q 140 1011 74 990 l 140 947 q 82 900 97 940 q 68 810 68 861 l 140 810 l 140 670 m 348 670 l 209 670 l 209 830 q 245 943 209 897 q 348 1011 282 990 l 348 947 q 290 900 305 940 q 276 810 276 861 l 348 810 l 348 670 "},A:{x_min:.03125,x_max:906.953125,ha:1008,o:"m 906 0 l 756 0 l 648 303 l 251 303 l 142 0 l 0 0 l 376 1013 l 529 1013 l 906 0 m 610 421 l 452 867 l 293 421 l 610 421 "},"\u2018":{x_min:1,x_max:139.890625,ha:236,o:"m 139 670 l 1 670 l 1 830 q 37 943 1 897 q 139 1011 74 990 l 139 947 q 82 900 97 940 q 68 810 68 861 l 139 810 l 139 670 "},\u03CA:{x_min:-70,x_max:283,ha:361,o:"m 283 800 l 173 800 l 173 925 l 283 925 l 283 800 m 40 800 l -70 800 l -70 925 l 40 925 l 40 800 m 283 3 q 232 -10 257 -5 q 181 -15 206 -15 q 84 26 118 -15 q 41 200 41 79 l 41 737 l 166 737 l 167 215 q 171 141 167 157 q 225 101 182 101 q 247 103 238 101 q 283 112 256 104 l 283 3 "},\u03C0:{x_min:-.21875,x_max:773.21875,ha:857,o:"m 773 -7 l 707 -11 q 575 40 607 -11 q 552 174 552 77 l 552 226 l 552 626 l 222 626 l 222 0 l 97 0 l 97 626 l 0 626 l 0 737 l 773 737 l 773 626 l 676 626 l 676 171 q 695 103 676 117 q 773 90 714 90 l 773 -7 "},\u03AC:{x_min:0,x_max:765.5625,ha:809,o:"m 765 -4 q 698 -14 726 -14 q 564 97 586 -14 q 466 7 525 40 q 337 -26 407 -26 q 88 98 186 -26 q 0 369 0 212 q 88 637 0 525 q 337 760 184 760 q 465 727 407 760 q 563 637 524 695 l 563 738 l 685 738 l 685 222 q 693 141 685 168 q 748 94 708 94 q 765 95 760 94 l 765 -4 m 584 371 q 531 562 584 485 q 360 653 470 653 q 192 566 254 653 q 135 379 135 489 q 186 181 135 261 q 358 84 247 84 q 528 176 465 84 q 584 371 584 260 m 604 1040 l 415 819 l 332 819 l 466 1040 l 604 1040 "},O:{x_min:0,x_max:958,ha:1057,o:"m 485 1041 q 834 882 702 1041 q 958 512 958 734 q 834 136 958 287 q 481 -26 702 -26 q 126 130 261 -26 q 0 504 0 279 q 127 880 0 728 q 485 1041 263 1041 m 480 98 q 731 225 638 98 q 815 504 815 340 q 733 783 815 669 q 480 912 640 912 q 226 784 321 912 q 142 504 142 670 q 226 224 142 339 q 480 98 319 98 "},n:{x_min:0,x_max:615,ha:724,o:"m 615 463 l 615 0 l 490 0 l 490 454 q 453 592 490 537 q 331 656 410 656 q 178 585 240 656 q 117 421 117 514 l 117 0 l 0 0 l 0 738 l 117 738 l 117 630 q 218 728 150 693 q 359 764 286 764 q 552 675 484 764 q 615 463 615 593 "},l:{x_min:41,x_max:166,ha:279,o:"m 166 0 l 41 0 l 41 1013 l 166 1013 l 166 0 "},"\xA4":{x_min:40.09375,x_max:728.796875,ha:825,o:"m 728 304 l 649 224 l 512 363 q 383 331 458 331 q 256 363 310 331 l 119 224 l 40 304 l 177 441 q 150 553 150 493 q 184 673 150 621 l 40 818 l 119 898 l 267 749 q 321 766 291 759 q 384 773 351 773 q 447 766 417 773 q 501 749 477 759 l 649 898 l 728 818 l 585 675 q 612 618 604 648 q 621 553 621 587 q 591 441 621 491 l 728 304 m 384 682 q 280 643 318 682 q 243 551 243 604 q 279 461 243 499 q 383 423 316 423 q 487 461 449 423 q 525 553 525 500 q 490 641 525 605 q 384 682 451 682 "},\u03BA:{x_min:0,x_max:632.328125,ha:679,o:"m 632 0 l 482 0 l 225 384 l 124 288 l 124 0 l 0 0 l 0 738 l 124 738 l 124 446 l 433 738 l 596 738 l 312 466 l 632 0 "},p:{x_min:0,x_max:685,ha:786,o:"m 685 364 q 598 96 685 205 q 350 -23 504 -23 q 121 89 205 -23 l 121 -278 l 0 -278 l 0 738 l 121 738 l 121 633 q 220 726 159 691 q 351 761 280 761 q 598 636 504 761 q 685 364 685 522 m 557 371 q 501 560 557 481 q 330 651 437 651 q 162 559 223 651 q 108 366 108 479 q 162 177 108 254 q 333 87 224 87 q 502 178 441 87 q 557 371 557 258 "},"\u2021":{x_min:0,x_max:777,ha:835,o:"m 458 238 l 458 0 l 319 0 l 319 238 l 0 238 l 0 360 l 319 360 l 319 681 l 0 683 l 0 804 l 319 804 l 319 1015 l 458 1013 l 458 804 l 777 804 l 777 683 l 458 683 l 458 360 l 777 360 l 777 238 l 458 238 "},\u03C8:{x_min:0,x_max:808,ha:907,o:"m 465 -278 l 341 -278 l 341 -15 q 87 102 180 -15 q 0 378 0 210 l 0 739 l 133 739 l 133 379 q 182 195 133 275 q 341 98 242 98 l 341 922 l 465 922 l 465 98 q 623 195 563 98 q 675 382 675 278 l 675 742 l 808 742 l 808 381 q 720 104 808 213 q 466 -13 627 -13 l 465 -278 "},\u03B7:{x_min:.78125,x_max:697,ha:810,o:"m 697 -278 l 572 -278 l 572 454 q 540 587 572 536 q 425 650 501 650 q 271 579 337 650 q 206 420 206 509 l 206 0 l 81 0 l 81 489 q 73 588 81 562 q 0 644 56 644 l 0 741 q 68 755 38 755 q 158 720 124 755 q 200 630 193 686 q 297 726 234 692 q 434 761 359 761 q 620 692 544 761 q 697 516 697 624 l 697 -278 "}},kLe="normal",zLe=1189,VLe=-100,GLe="normal",qLe={yMin:-334,xMin:-111,yMax:1189,xMax:1672},HLe=1e3,WLe={postscript_name:"Helvetiker-Regular",version_string:"Version 1.00 2004 initial release",vendor_url:"http://www.magenta.gr/",full_font_name:"Helvetiker",font_family_name:"Helvetiker",copyright:"Copyright (c) \u039Cagenta ltd, 2004",description:"",trademark:"",designer:"",designer_url:"",unique_font_identifier:"\u039Cagenta ltd:Helvetiker:22-10-104",license_url:"http://www.ellak.gr/fonts/MgOpen/license.html",license_description:`Copyright (c) 2004 by MAGENTA Ltd. All Rights Reserved.\r52245224 \r52255225 Permission is hereby granted, free of charge, to any person obtaining a copy of the fonts accompanying this license ("Fonts") and associated documentation files (the "Font Software"), to reproduce and distribute the Font Software, including without limitation the rights to use, copy, merge, publish, distribute, and/or sell copies of the Font Software, and to permit persons to whom the Font Software is furnished to do so, subject to the following conditions: \r52265226 \r@@ -5232,7 +5232,7 @@ This License becomes null and void to the extent applicable to Fonts or Font Sof
52325232 \r52335233 The Font Software may be sold as part of a larger software package but no copy of one or more of the Font Software typefaces may be sold by itself. \r52345234 \r5235-THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL MAGENTA OR PERSONS OR BODIES IN CHARGE OF ADMINISTRATION AND MAINTENANCE OF THE FONT SOFTWARE BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM OTHER DEALINGS IN THE FONT SOFTWARE.`,manufacturer_name:"\u039Cagenta ltd",font_sub_family_name:"Regular"},hLe=-334,fLe="Helvetiker",dLe=1522,pLe=50,mLe={glyphs:iLe,cssFontWeight:rLe,ascender:sLe,underlinePosition:oLe,cssFontStyle:aLe,boundingBox:lLe,resolution:cLe,original_font_information:uLe,descender:hLe,familyName:fLe,lineHeight:dLe,underlineThickness:pLe},eh=$i($i({},window.THREE?window.THREE:{BoxGeometry:Lu,CircleGeometry:Yv,DoubleSide:gr,Group:Br,Mesh:Hn,MeshLambertMaterial:Va,TextGeometry:DS,Vector3:re}),{},{Font:bx,TextGeometry:DS}),zoe=Kr({props:{labelsData:{default:[]},labelLat:{default:"lat"},labelLng:{default:"lng"},labelAltitude:{default:.002},labelText:{default:"text"},labelSize:{default:.5},labelTypeFace:{default:mLe,onChange:function(e,t){t.font=new eh.Font(e)}},labelColor:{default:function(){return"lightgrey"}},labelRotation:{default:0},labelResolution:{default:3},labelIncludeDot:{default:!0},labelDotRadius:{default:.1},labelDotOrientation:{default:function(){return"bottom"}},labelsTransitionDuration:{default:1e3,triggerUpdate:!1}},init:function(e,t,n){var r=n.tweenGroup;ns(e),t.scene=e,t.tweenGroup=r;var s=new eh.CircleGeometry(1,32);t.dataMapper=new Pl(e,{objBindAttr:"__threeObjLabel"}).onCreateObj(function(){var o=new eh.MeshLambertMaterial;o.side=gr;var a=new eh.Group;a.add(new eh.Mesh(s,o));var l=new eh.Mesh(void 0,o);a.add(l);var c=new eh.Mesh;return c.visible=!1,l.add(c),a.__globeObjType="label",a})},update:function(e){var t=st(e.labelLat),n=st(e.labelLng),r=st(e.labelAltitude),s=st(e.labelText),o=st(e.labelSize),a=st(e.labelRotation),l=st(e.labelColor),c=st(e.labelIncludeDot),u=st(e.labelDotRadius),f=st(e.labelDotOrientation),d=new Set(["right","top","bottom"]),A=2*Math.PI*vr/360;e.dataMapper.onUpdateObj(function(y,w){var S=Ir(y.children,2),T=S[0],R=S[1],P=Ir(R.children,1),I=P[0],F=l(w),D=th(F);R.material.color.set(Nf(F)),R.material.transparent=D<1,R.material.opacity=D;var L=c(w),C=f(w);!L||!d.has(C)&&(C="bottom");var B=L?+u(w)*A:1e-12;T.scale.x=T.scale.y=B;var k=+o(w)*A;if(R.geometry&&R.geometry.dispose(),R.geometry=new eh.TextGeometry(s(w),{font:e.font,size:k,depth:0,bevelEnabled:!0,bevelThickness:0,bevelSize:0,curveSegments:e.labelResolution}),I.geometry&&I.geometry.dispose(),R.geometry.computeBoundingBox(),I.geometry=MV(eh.BoxGeometry,tr(new eh.Vector3().subVectors(R.geometry.boundingBox.max,R.geometry.boundingBox.min).clampScalar(0,1/0).toArray())),C!=="right"&&R.geometry.center(),L){var z=B+k/2;C==="right"&&(R.position.x=z),R.position.y={right:-k/2,top:z+k/2,bottom:-z-k/2}[C]}var G=function($){var J=y.__currentTargetD=$,te=J.lat,ce=J.lng,he=J.alt,ve=J.rot,Re=J.scale;Object.assign(y.position,ou(te,ce,he)),y.lookAt(e.scene.localToWorld(new eh.Vector3(0,0,0))),y.rotateY(Math.PI),y.rotateZ(-ve*Math.PI/180),y.scale.x=y.scale.y=y.scale.z=Re},W={lat:+t(w),lng:+n(w),alt:+r(w),rot:+a(w),scale:1},Y=y.__currentTargetD||Object.assign({},W,{scale:1e-12});Object.keys(W).some(function(H){return Y[H]!==W[H]})&&(!e.labelsTransitionDuration||e.labelsTransitionDuration<0?G(W):e.tweenGroup.add(new uo(Y).to(W,e.labelsTransitionDuration).easing(Qr.Quadratic.InOut).onUpdate(G).onComplete(function(){e.tweenGroup.remove(this)}).start()))}).digest(e.labelsData)}}),ALe=$i($i({},window.THREE?window.THREE:{}),{},{CSS2DObject:VM}),Voe=Kr({props:{htmlElementsData:{default:[]},htmlLat:{default:"lat"},htmlLng:{default:"lng"},htmlAltitude:{default:0},htmlElement:{},htmlElementVisibilityModifier:{triggerUpdate:!1},htmlTransitionDuration:{default:1e3,triggerUpdate:!1},isBehindGlobe:{onChange:function(){this.updateObjVisibility()},triggerUpdate:!1}},methods:{updateObjVisibility:function(e,t){if(e.dataMapper){var n=t?[t]:e.dataMapper.entries().map(function(r){var s=Ir(r,2),o=s[1];return o}).filter(function(r){return r});n.forEach(function(r){var s=!e.isBehindGlobe||!e.isBehindGlobe(r.position);e.htmlElementVisibilityModifier?(r.visible=!0,e.htmlElementVisibilityModifier(r.element,s)):r.visible=s})}}},init:function(e,t,n){var r=n.tweenGroup;ns(e),t.scene=e,t.tweenGroup=r,t.dataMapper=new Pl(e,{objBindAttr:"__threeObjHtml"}).onCreateObj(function(s){var o=st(t.htmlElement)(s),a=new ALe.CSS2DObject(o);return a.__globeObjType="html",a})},update:function(e,t){var n=this,r=st(e.htmlLat),s=st(e.htmlLng),o=st(e.htmlAltitude);t.hasOwnProperty("htmlElement")&&e.dataMapper.clear(),e.dataMapper.onUpdateObj(function(a,l){var c=function(d){var A=a.__currentTargetD=d,y=A.alt,w=A.lat,S=A.lng;Object.assign(a.position,ou(w,S,y)),n.updateObjVisibility(a)},u={lat:+r(l),lng:+s(l),alt:+o(l)};!e.htmlTransitionDuration||e.htmlTransitionDuration<0||!a.__currentTargetD?c(u):e.tweenGroup.add(new uo(a.__currentTargetD).to(u,e.htmlTransitionDuration).easing(Qr.Quadratic.InOut).onUpdate(c).onComplete(function(){e.tweenGroup.remove(this)}).start())}).digest(e.htmlElementsData)}}),qI=window.THREE?window.THREE:{Group:Br,Mesh:Hn,MeshLambertMaterial:Va,SphereGeometry:za},Goe=Kr({props:{objectsData:{default:[]},objectLat:{default:"lat"},objectLng:{default:"lng"},objectAltitude:{default:.01},objectFacesSurface:{default:!0},objectRotation:{},objectThreeObject:{default:new qI.Mesh(new qI.SphereGeometry(1,16,8),new qI.MeshLambertMaterial({color:"#ffffaa",transparent:!0,opacity:.7}))}},init:function(e,t){ns(e),t.scene=e,t.dataMapper=new Pl(e,{objBindAttr:"__threeObjObject"}).onCreateObj(function(n){var r=st(t.objectThreeObject)(n);t.objectThreeObject===r&&(r=r.clone());var s=new qI.Group;return s.add(r),s.__globeObjType="object",s})},update:function(e,t){var n=st(e.objectLat),r=st(e.objectLng),s=st(e.objectAltitude),o=st(e.objectFacesSurface),a=st(e.objectRotation);t.hasOwnProperty("objectThreeObject")&&e.dataMapper.clear(),e.dataMapper.onUpdateObj(function(l,c){var u=+n(c),f=+r(c),d=+s(c);Object.assign(l.position,ou(u,f,d)),o(c)?l.setRotationFromEuler(new Oa(c1(-u),c1(f),0,"YXZ")):l.rotation.set(0,0,0);var A=l.children[0],y=a(c);y&&A.setRotationFromEuler(new Oa(c1(y.x||0),c1(y.y||0),c1(y.z||0)))}).digest(e.objectsData)}}),qoe=Kr({props:{customLayerData:{default:[]},customThreeObject:{},customThreeObjectUpdate:{triggerUpdate:!1}},init:function(e,t){ns(e),t.scene=e,t.dataMapper=new Pl(e,{objBindAttr:"__threeObjCustom"}).onCreateObj(function(n){var r=st(t.customThreeObject)(n,vr);return r&&(t.customThreeObject===r&&(r=r.clone()),r.__globeObjType="custom"),r})},update:function(e,t){e.customThreeObjectUpdate||ns(e.scene);var n=st(e.customThreeObjectUpdate);t.hasOwnProperty("customThreeObject")&&e.dataMapper.clear(),e.dataMapper.onUpdateObj(function(r,s){return n(r,s,vr)}).digest(e.customLayerData)}}),HI=window.THREE?window.THREE:{Camera:Cd,Group:Br,Vector2:Oe,Vector3:re},gLe=["globeLayer","pointsLayer","arcsLayer","hexBinLayer","heatmapsLayer","polygonsLayer","hexedPolygonsLayer","pathsLayer","tilesLayer","particlesLayer","ringsLayer","labelsLayer","htmlElementsLayer","objectsLayer","customLayer"],Hoe=tl("globeLayer",Moe),vLe=Object.assign.apply(Object,tr(["globeImageUrl","bumpImageUrl","globeCurvatureResolution","globeTileEngineUrl","globeTileEngineMaxLevel","showGlobe","showGraticules","showAtmosphere","atmosphereColor","atmosphereAltitude"].map(function(i){return Eo({},i,Hoe.linkProp(i))}))),_Le=Object.assign.apply(Object,tr(["globeMaterial","globeTileEngineClearCache"].map(function(i){return Eo({},i,Hoe.linkMethod(i))}))),xLe=tl("pointsLayer",Coe),yLe=Object.assign.apply(Object,tr(["pointsData","pointLat","pointLng","pointColor","pointAltitude","pointRadius","pointResolution","pointsMerge","pointsTransitionDuration"].map(function(i){return Eo({},i,xLe.linkProp(i))}))),bLe=tl("arcsLayer",Ioe),wLe=Object.assign.apply(Object,tr(["arcsData","arcStartLat","arcStartLng","arcStartAltitude","arcEndLat","arcEndLng","arcEndAltitude","arcColor","arcAltitude","arcAltitudeAutoScale","arcStroke","arcCurveResolution","arcCircularResolution","arcDashLength","arcDashGap","arcDashInitialGap","arcDashAnimateTime","arcsTransitionDuration"].map(function(i){return Eo({},i,bLe.linkProp(i))}))),SLe=tl("hexBinLayer",Poe),TLe=Object.assign.apply(Object,tr(["hexBinPointsData","hexBinPointLat","hexBinPointLng","hexBinPointWeight","hexBinResolution","hexMargin","hexTopCurvatureResolution","hexTopColor","hexSideColor","hexAltitude","hexBinMerge","hexTransitionDuration"].map(function(i){return Eo({},i,SLe.linkProp(i))}))),ELe=tl("heatmapsLayer",Doe),MLe=Object.assign.apply(Object,tr(["heatmapsData","heatmapPoints","heatmapPointLat","heatmapPointLng","heatmapPointWeight","heatmapBandwidth","heatmapColorFn","heatmapColorSaturation","heatmapBaseAltitude","heatmapTopAltitude","heatmapsTransitionDuration"].map(function(i){return Eo({},i,ELe.linkProp(i))}))),CLe=tl("hexedPolygonsLayer",Foe),RLe=Object.assign.apply(Object,tr(["hexPolygonsData","hexPolygonGeoJsonGeometry","hexPolygonColor","hexPolygonAltitude","hexPolygonResolution","hexPolygonMargin","hexPolygonUseDots","hexPolygonCurvatureResolution","hexPolygonDotResolution","hexPolygonsTransitionDuration"].map(function(i){return Eo({},i,CLe.linkProp(i))}))),ILe=tl("polygonsLayer",Noe),PLe=Object.assign.apply(Object,tr(["polygonsData","polygonGeoJsonGeometry","polygonCapColor","polygonCapMaterial","polygonSideColor","polygonSideMaterial","polygonStrokeColor","polygonAltitude","polygonCapCurvatureResolution","polygonsTransitionDuration"].map(function(i){return Eo({},i,ILe.linkProp(i))}))),LLe=tl("pathsLayer",Boe),DLe=Object.assign.apply(Object,tr(["pathsData","pathPoints","pathPointLat","pathPointLng","pathPointAlt","pathResolution","pathColor","pathStroke","pathDashLength","pathDashGap","pathDashInitialGap","pathDashAnimateTime","pathTransitionDuration"].map(function(i){return Eo({},i,LLe.linkProp(i))}))),NLe=tl("tilesLayer",Ooe),FLe=Object.assign.apply(Object,tr(["tilesData","tileLat","tileLng","tileAltitude","tileWidth","tileHeight","tileUseGlobeProjection","tileMaterial","tileCurvatureResolution","tilesTransitionDuration"].map(function(i){return Eo({},i,NLe.linkProp(i))}))),BLe=tl("particlesLayer",Uoe),OLe=Object.assign.apply(Object,tr(["particlesData","particlesList","particleLat","particleLng","particleAltitude","particlesSize","particlesSizeAttenuation","particlesColor","particlesTexture"].map(function(i){return Eo({},i,BLe.linkProp(i))}))),ULe=tl("ringsLayer",koe),kLe=Object.assign.apply(Object,tr(["ringsData","ringLat","ringLng","ringAltitude","ringColor","ringResolution","ringMaxRadius","ringPropagationSpeed","ringRepeatPeriod"].map(function(i){return Eo({},i,ULe.linkProp(i))}))),zLe=tl("labelsLayer",zoe),VLe=Object.assign.apply(Object,tr(["labelsData","labelLat","labelLng","labelAltitude","labelRotation","labelText","labelSize","labelTypeFace","labelColor","labelResolution","labelIncludeDot","labelDotRadius","labelDotOrientation","labelsTransitionDuration"].map(function(i){return Eo({},i,zLe.linkProp(i))}))),GLe=tl("htmlElementsLayer",Voe),qLe=Object.assign.apply(Object,tr(["htmlElementsData","htmlLat","htmlLng","htmlAltitude","htmlElement","htmlElementVisibilityModifier","htmlTransitionDuration"].map(function(i){return Eo({},i,GLe.linkProp(i))}))),HLe=tl("objectsLayer",Goe),WLe=Object.assign.apply(Object,tr(["objectsData","objectLat","objectLng","objectAltitude","objectRotation","objectFacesSurface","objectThreeObject"].map(function(i){return Eo({},i,HLe.linkProp(i))}))),jLe=tl("customLayer",qoe),XLe=Object.assign.apply(Object,tr(["customLayerData","customThreeObject","customThreeObjectUpdate"].map(function(i){return Eo({},i,jLe.linkProp(i))}))),$Le=Kr({props:$i($i($i($i($i($i($i($i($i($i($i($i($i($i($i({onGlobeReady:{triggerUpdate:!1},rendererSize:{default:new HI.Vector2(window.innerWidth,window.innerHeight),onChange:function(e,t){t.pathsLayer.rendererSize(e)},triggerUpdate:!1}},vLe),yLe),wLe),TLe),MLe),PLe),RLe),DLe),FLe),OLe),kLe),VLe),qLe),WLe),XLe),methods:$i({getGlobeRadius:doe,getCoords:function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];return ou.apply(void 0,n)},toGeoCoords:function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];return Eoe.apply(void 0,n)},setPointOfView:function(e,t){var n=t instanceof HI.Camera?t.position:t,r=doe(),s=void 0;if(e.scene&&n){var o,a,l,c;s=function(f){o===void 0&&(o=n.clone().applyMatrix4(e.scene.matrixWorld.clone().invert())),a===void 0&&(a=o.length()),l===void 0&&(l=Math.sqrt(Math.pow(a,2)-Math.pow(r,2))),c===void 0&&(c=Math.acos(l/a));var d=o.distanceTo(f);if(d<l)return!1;var A=f.length(),y=Math.acos((Math.pow(a,2)+Math.pow(d,2)-Math.pow(A,2))/(2*a*d));return y<c}}e.layersThatNeedUpdatePov.forEach(function(u){return u.updatePov(t)}),e.layersThatNeedBehindGlobeChecker.forEach(function(u){return u.isBehindGlobe(s)})},pauseAnimation:function(e){return e.animationFrameRequestId!==null&&(cancelAnimationFrame(e.animationFrameRequestId),e.animationFrameRequestId=null),e.pausableLayers.forEach(function(t){var n;return(n=t.pauseAnimation)===null||n===void 0?void 0:n.call(t)}),this},resumeAnimation:function(e){return e.animationFrameRequestId===null&&this._animationCycle(),e.pausableLayers.forEach(function(t){var n;return(n=t.resumeAnimation)===null||n===void 0?void 0:n.call(t)}),this},_animationCycle:function(e){e.animationFrameRequestId=requestAnimationFrame(this._animationCycle),e.tweenGroup.update()},_destructor:function(e){this.pauseAnimation(),e.destructableLayers.forEach(function(t){return t._destructor()})}},_Le),stateInit:function(){var e=new hg,t={tweenGroup:e},n={globeLayer:Moe(t),pointsLayer:Coe(t),arcsLayer:Ioe(t),hexBinLayer:Poe(t),heatmapsLayer:Doe(t),polygonsLayer:Noe(t),hexedPolygonsLayer:Foe(t),pathsLayer:Boe(t),tilesLayer:Ooe(t),particlesLayer:Uoe(t),ringsLayer:koe(t),labelsLayer:zoe(t),htmlElementsLayer:Voe(t),objectsLayer:Goe(t),customLayer:qoe(t)};return $i($i({tweenGroup:e},n),{},{layersThatNeedUpdatePov:Object.values(n).filter(function(r){return r.hasOwnProperty("updatePov")}),layersThatNeedBehindGlobeChecker:Object.values(n).filter(function(r){return r.hasOwnProperty("isBehindGlobe")}),destructableLayers:Object.values(n).filter(function(r){return r.hasOwnProperty("_destructor")}),pausableLayers:Object.values(n).filter(function(r){return r.hasOwnProperty("pauseAnimation")})})},init:function(e,t,n){var r=n.animateIn,s=r===void 0?!0:r,o=n.waitForGlobeReady,a=o===void 0?!0:o;ns(e),t.scene=e,t.scene.visible=!1,gLe.forEach(function(c){var u=new HI.Group;t.scene.add(u),t[c](u)});var l=function(){if(s){t.scene.scale.set(1e-6,1e-6,1e-6),t.tweenGroup.add(new uo({k:1e-6}).to({k:1},600).easing(Qr.Quadratic.Out).onUpdate(function(f){var d=f.k;return t.scene.scale.set(d,d,d)}).onComplete(function(){t.tweenGroup.remove(this)}).start());var u=new HI.Vector3(0,1,0);t.tweenGroup.add(new uo({rot:Math.PI*2}).to({rot:0},1200).easing(Qr.Quintic.Out).onUpdate(function(f){var d=f.rot;return t.scene.setRotationFromAxisAngle(u,d)}).onComplete(function(){t.tweenGroup.remove(this)}).start())}t.scene.visible=!0,t.onGlobeReady&&t.onGlobeReady()};a?t.globeLayer.onReady(l):l(),this._animationCycle()},update:function(e){}});function YLe(i){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Object,t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,n=(function(r){function s(){var o;jI(this,s);for(var a=arguments.length,l=new Array(a),c=0;c<a;c++)l[c]=arguments[c];return o=WI(this,s,[].concat(l)),o.__kapsuleInstance=MV(i,[].concat(tr(t?[o]:[]),l)),o}return $I(s,r),XI(s)})(e);return Object.keys(i()).forEach(function(r){return n.prototype[r]=function(){var s,o=(s=this.__kapsuleInstance)[r].apply(s,arguments);return o===this.__kapsuleInstance?this:o}}),n}var ZLe=window.THREE?window.THREE:{Group:Br},IV=YLe($Le,ZLe.Group,!0);var PV={type:"change"},NV={type:"start"},FV={type:"end"},Woe=1e-6,ki={NONE:-1,ROTATE:0,ZOOM:1,PAN:2,TOUCH_ROTATE:3,TOUCH_ZOOM_PAN:4},YI=new Oe,Em=new Oe,KLe=new re,ZI=new re,LV=new re,Mx=new qs,joe=new re,KI=new re,DV=new re,QI=new re,JI=class extends Rd{constructor(e,t=null){super(e,t),this.screen={left:0,top:0,width:0,height:0},this.rotateSpeed=1,this.zoomSpeed=1.2,this.panSpeed=.3,this.noRotate=!1,this.noZoom=!1,this.noPan=!1,this.staticMoving=!1,this.dynamicDampingFactor=.2,this.minDistance=0,this.maxDistance=1/0,this.minZoom=0,this.maxZoom=1/0,this.keys=["KeyA","KeyS","KeyD"],this.mouseButtons={LEFT:Ga.ROTATE,MIDDLE:Ga.DOLLY,RIGHT:Ga.PAN},this.target=new re,this.state=ki.NONE,this.keyState=ki.NONE,this._lastPosition=new re,this._lastZoom=1,this._touchZoomDistanceStart=0,this._touchZoomDistanceEnd=0,this._lastAngle=0,this._eye=new re,this._movePrev=new Oe,this._moveCurr=new Oe,this._lastAxis=new re,this._zoomStart=new Oe,this._zoomEnd=new Oe,this._panStart=new Oe,this._panEnd=new Oe,this._pointers=[],this._pointerPositions={},this._onPointerMove=JLe.bind(this),this._onPointerDown=QLe.bind(this),this._onPointerUp=eDe.bind(this),this._onPointerCancel=tDe.bind(this),this._onContextMenu=lDe.bind(this),this._onMouseWheel=aDe.bind(this),this._onKeyDown=iDe.bind(this),this._onKeyUp=nDe.bind(this),this._onTouchStart=cDe.bind(this),this._onTouchMove=uDe.bind(this),this._onTouchEnd=hDe.bind(this),this._onMouseDown=rDe.bind(this),this._onMouseMove=sDe.bind(this),this._onMouseUp=oDe.bind(this),this._target0=this.target.clone(),this._position0=this.object.position.clone(),this._up0=this.object.up.clone(),this._zoom0=this.object.zoom,t!==null&&(this.connect(t),this.handleResize()),this.update()}connect(e){super.connect(e),window.addEventListener("keydown",this._onKeyDown),window.addEventListener("keyup",this._onKeyUp),this.domElement.addEventListener("pointerdown",this._onPointerDown),this.domElement.addEventListener("pointercancel",this._onPointerCancel),this.domElement.addEventListener("wheel",this._onMouseWheel,{passive:!1}),this.domElement.addEventListener("contextmenu",this._onContextMenu),this.domElement.style.touchAction="none"}disconnect(){window.removeEventListener("keydown",this._onKeyDown),window.removeEventListener("keyup",this._onKeyUp),this.domElement.removeEventListener("pointerdown",this._onPointerDown),this.domElement.ownerDocument.removeEventListener("pointermove",this._onPointerMove),this.domElement.ownerDocument.removeEventListener("pointerup",this._onPointerUp),this.domElement.removeEventListener("pointercancel",this._onPointerCancel),this.domElement.removeEventListener("wheel",this._onMouseWheel),this.domElement.removeEventListener("contextmenu",this._onContextMenu),this.domElement.style.touchAction=""}dispose(){this.disconnect()}handleResize(){let e=this.domElement.getBoundingClientRect(),t=this.domElement.ownerDocument.documentElement;this.screen.left=e.left+window.pageXOffset-t.clientLeft,this.screen.top=e.top+window.pageYOffset-t.clientTop,this.screen.width=e.width,this.screen.height=e.height}update(){this._eye.subVectors(this.object.position,this.target),this.noRotate||this._rotateCamera(),this.noZoom||this._zoomCamera(),this.noPan||this._panCamera(),this.object.position.addVectors(this.target,this._eye),this.object.isPerspectiveCamera?(this._checkDistances(),this.object.lookAt(this.target),this._lastPosition.distanceToSquared(this.object.position)>Woe&&(this.dispatchEvent(PV),this._lastPosition.copy(this.object.position))):this.object.isOrthographicCamera?(this.object.lookAt(this.target),(this._lastPosition.distanceToSquared(this.object.position)>Woe||this._lastZoom!==this.object.zoom)&&(this.dispatchEvent(PV),this._lastPosition.copy(this.object.position),this._lastZoom=this.object.zoom)):console.warn("THREE.TrackballControls: Unsupported camera type.")}reset(){this.state=ki.NONE,this.keyState=ki.NONE,this.target.copy(this._target0),this.object.position.copy(this._position0),this.object.up.copy(this._up0),this.object.zoom=this._zoom0,this.object.updateProjectionMatrix(),this._eye.subVectors(this.object.position,this.target),this.object.lookAt(this.target),this.dispatchEvent(PV),this._lastPosition.copy(this.object.position),this._lastZoom=this.object.zoom}_panCamera(){if(Em.copy(this._panEnd).sub(this._panStart),Em.lengthSq()){if(this.object.isOrthographicCamera){let e=(this.object.right-this.object.left)/this.object.zoom/this.domElement.clientWidth,t=(this.object.top-this.object.bottom)/this.object.zoom/this.domElement.clientWidth;Em.x*=e,Em.y*=t}Em.multiplyScalar(this._eye.length()*this.panSpeed),ZI.copy(this._eye).cross(this.object.up).setLength(Em.x),ZI.add(KLe.copy(this.object.up).setLength(Em.y)),this.object.position.add(ZI),this.target.add(ZI),this.staticMoving?this._panStart.copy(this._panEnd):this._panStart.add(Em.subVectors(this._panEnd,this._panStart).multiplyScalar(this.dynamicDampingFactor))}}_rotateCamera(){QI.set(this._moveCurr.x-this._movePrev.x,this._moveCurr.y-this._movePrev.y,0);let e=QI.length();e?(this._eye.copy(this.object.position).sub(this.target),joe.copy(this._eye).normalize(),KI.copy(this.object.up).normalize(),DV.crossVectors(KI,joe).normalize(),KI.setLength(this._moveCurr.y-this._movePrev.y),DV.setLength(this._moveCurr.x-this._movePrev.x),QI.copy(KI.add(DV)),LV.crossVectors(QI,this._eye).normalize(),e*=this.rotateSpeed,Mx.setFromAxisAngle(LV,e),this._eye.applyQuaternion(Mx),this.object.up.applyQuaternion(Mx),this._lastAxis.copy(LV),this._lastAngle=e):!this.staticMoving&&this._lastAngle&&(this._lastAngle*=Math.sqrt(1-this.dynamicDampingFactor),this._eye.copy(this.object.position).sub(this.target),Mx.setFromAxisAngle(this._lastAxis,this._lastAngle),this._eye.applyQuaternion(Mx),this.object.up.applyQuaternion(Mx)),this._movePrev.copy(this._moveCurr)}_zoomCamera(){let e;this.state===ki.TOUCH_ZOOM_PAN?(e=this._touchZoomDistanceStart/this._touchZoomDistanceEnd,this._touchZoomDistanceStart=this._touchZoomDistanceEnd,this.object.isPerspectiveCamera?this._eye.multiplyScalar(e):this.object.isOrthographicCamera?(this.object.zoom=Bu.clamp(this.object.zoom/e,this.minZoom,this.maxZoom),this._lastZoom!==this.object.zoom&&this.object.updateProjectionMatrix()):console.warn("THREE.TrackballControls: Unsupported camera type")):(e=1+(this._zoomEnd.y-this._zoomStart.y)*this.zoomSpeed,e!==1&&e>0&&(this.object.isPerspectiveCamera?this._eye.multiplyScalar(e):this.object.isOrthographicCamera?(this.object.zoom=Bu.clamp(this.object.zoom/e,this.minZoom,this.maxZoom),this._lastZoom!==this.object.zoom&&this.object.updateProjectionMatrix()):console.warn("THREE.TrackballControls: Unsupported camera type")),this.staticMoving?this._zoomStart.copy(this._zoomEnd):this._zoomStart.y+=(this._zoomEnd.y-this._zoomStart.y)*this.dynamicDampingFactor)}_getMouseOnScreen(e,t){return YI.set((e-this.screen.left)/this.screen.width,(t-this.screen.top)/this.screen.height),YI}_getMouseOnCircle(e,t){return YI.set((e-this.screen.width*.5-this.screen.left)/(this.screen.width*.5),(this.screen.height+2*(this.screen.top-t))/this.screen.width),YI}_addPointer(e){this._pointers.push(e)}_removePointer(e){delete this._pointerPositions[e.pointerId];for(let t=0;t<this._pointers.length;t++)if(this._pointers[t].pointerId==e.pointerId){this._pointers.splice(t,1);return}}_trackPointer(e){let t=this._pointerPositions[e.pointerId];t===void 0&&(t=new Oe,this._pointerPositions[e.pointerId]=t),t.set(e.pageX,e.pageY)}_getSecondPointerPosition(e){let t=e.pointerId===this._pointers[0].pointerId?this._pointers[1]:this._pointers[0];return this._pointerPositions[t.pointerId]}_checkDistances(){(!this.noZoom||!this.noPan)&&(this._eye.lengthSq()>this.maxDistance*this.maxDistance&&(this.object.position.addVectors(this.target,this._eye.setLength(this.maxDistance)),this._zoomStart.copy(this._zoomEnd)),this._eye.lengthSq()<this.minDistance*this.minDistance&&(this.object.position.addVectors(this.target,this._eye.setLength(this.minDistance)),this._zoomStart.copy(this._zoomEnd)))}};function QLe(i){this.enabled!==!1&&(this._pointers.length===0&&(this.domElement.setPointerCapture(i.pointerId),this.domElement.ownerDocument.addEventListener("pointermove",this._onPointerMove),this.domElement.ownerDocument.addEventListener("pointerup",this._onPointerUp)),this._addPointer(i),i.pointerType==="touch"?this._onTouchStart(i):this._onMouseDown(i))}function JLe(i){this.enabled!==!1&&(i.pointerType==="touch"?this._onTouchMove(i):this._onMouseMove(i))}function eDe(i){this.enabled!==!1&&(i.pointerType==="touch"?this._onTouchEnd(i):this._onMouseUp(),this._removePointer(i),this._pointers.length===0&&(this.domElement.releasePointerCapture(i.pointerId),this.domElement.ownerDocument.removeEventListener("pointermove",this._onPointerMove),this.domElement.ownerDocument.removeEventListener("pointerup",this._onPointerUp)))}function tDe(i){this._removePointer(i)}function nDe(){this.enabled!==!1&&(this.keyState=ki.NONE,window.addEventListener("keydown",this._onKeyDown))}function iDe(i){this.enabled!==!1&&(window.removeEventListener("keydown",this._onKeyDown),this.keyState===ki.NONE&&(i.code===this.keys[ki.ROTATE]&&!this.noRotate?this.keyState=ki.ROTATE:i.code===this.keys[ki.ZOOM]&&!this.noZoom?this.keyState=ki.ZOOM:i.code===this.keys[ki.PAN]&&!this.noPan&&(this.keyState=ki.PAN)))}function rDe(i){let e;switch(i.button){case 0:e=this.mouseButtons.LEFT;break;case 1:e=this.mouseButtons.MIDDLE;break;case 2:e=this.mouseButtons.RIGHT;break;default:e=-1}switch(e){case Ga.DOLLY:this.state=ki.ZOOM;break;case Ga.ROTATE:this.state=ki.ROTATE;break;case Ga.PAN:this.state=ki.PAN;break;default:this.state=ki.NONE}let t=this.keyState!==ki.NONE?this.keyState:this.state;t===ki.ROTATE&&!this.noRotate?(this._moveCurr.copy(this._getMouseOnCircle(i.pageX,i.pageY)),this._movePrev.copy(this._moveCurr)):t===ki.ZOOM&&!this.noZoom?(this._zoomStart.copy(this._getMouseOnScreen(i.pageX,i.pageY)),this._zoomEnd.copy(this._zoomStart)):t===ki.PAN&&!this.noPan&&(this._panStart.copy(this._getMouseOnScreen(i.pageX,i.pageY)),this._panEnd.copy(this._panStart)),this.dispatchEvent(NV)}function sDe(i){let e=this.keyState!==ki.NONE?this.keyState:this.state;e===ki.ROTATE&&!this.noRotate?(this._movePrev.copy(this._moveCurr),this._moveCurr.copy(this._getMouseOnCircle(i.pageX,i.pageY))):e===ki.ZOOM&&!this.noZoom?this._zoomEnd.copy(this._getMouseOnScreen(i.pageX,i.pageY)):e===ki.PAN&&!this.noPan&&this._panEnd.copy(this._getMouseOnScreen(i.pageX,i.pageY))}function oDe(){this.state=ki.NONE,this.dispatchEvent(FV)}function aDe(i){if(this.enabled!==!1&&this.noZoom!==!0){switch(i.preventDefault(),i.deltaMode){case 2:this._zoomStart.y-=i.deltaY*.025;break;case 1:this._zoomStart.y-=i.deltaY*.01;break;default:this._zoomStart.y-=i.deltaY*25e-5;break}this.dispatchEvent(NV),this.dispatchEvent(FV)}}function lDe(i){this.enabled!==!1&&i.preventDefault()}function cDe(i){if(this._trackPointer(i),this._pointers.length===1)this.state=ki.TOUCH_ROTATE,this._moveCurr.copy(this._getMouseOnCircle(this._pointers[0].pageX,this._pointers[0].pageY)),this._movePrev.copy(this._moveCurr);else{this.state=ki.TOUCH_ZOOM_PAN;let e=this._pointers[0].pageX-this._pointers[1].pageX,t=this._pointers[0].pageY-this._pointers[1].pageY;this._touchZoomDistanceEnd=this._touchZoomDistanceStart=Math.sqrt(e*e+t*t);let n=(this._pointers[0].pageX+this._pointers[1].pageX)/2,r=(this._pointers[0].pageY+this._pointers[1].pageY)/2;this._panStart.copy(this._getMouseOnScreen(n,r)),this._panEnd.copy(this._panStart)}this.dispatchEvent(NV)}function uDe(i){if(this._trackPointer(i),this._pointers.length===1)this._movePrev.copy(this._moveCurr),this._moveCurr.copy(this._getMouseOnCircle(i.pageX,i.pageY));else{let e=this._getSecondPointerPosition(i),t=i.pageX-e.x,n=i.pageY-e.y;this._touchZoomDistanceEnd=Math.sqrt(t*t+n*n);let r=(i.pageX+e.x)/2,s=(i.pageY+e.y)/2;this._panEnd.copy(this._getMouseOnScreen(r,s))}}function hDe(i){switch(this._pointers.length){case 0:this.state=ki.NONE;break;case 1:this.state=ki.TOUCH_ROTATE,this._moveCurr.copy(this._getMouseOnCircle(i.pageX,i.pageY)),this._movePrev.copy(this._moveCurr);break;case 2:this.state=ki.TOUCH_ZOOM_PAN;for(let e=0;e<this._pointers.length;e++)if(this._pointers[e].pointerId!==i.pointerId){let t=this._pointerPositions[this._pointers[e].pointerId];this._moveCurr.copy(this._getMouseOnCircle(t.x,t.y)),this._movePrev.copy(this._moveCurr);break}break}this.dispatchEvent(FV)}var Xoe={type:"change"},OV={type:"start"},Yoe={type:"end"},eP=new Md,$oe=new Da,fDe=Math.cos(70*Bu.DEG2RAD),ho=new re,Ll=2*Math.PI,dr={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_PAN:4,TOUCH_DOLLY_PAN:5,TOUCH_DOLLY_ROTATE:6},BV=1e-6,tP=class extends Rd{constructor(e,t=null){super(e,t),this.state=dr.NONE,this.target=new re,this.cursor=new re,this.minDistance=0,this.maxDistance=1/0,this.minZoom=0,this.maxZoom=1/0,this.minTargetRadius=0,this.maxTargetRadius=1/0,this.minPolarAngle=0,this.maxPolarAngle=Math.PI,this.minAzimuthAngle=-1/0,this.maxAzimuthAngle=1/0,this.enableDamping=!1,this.dampingFactor=.05,this.enableZoom=!0,this.zoomSpeed=1,this.enableRotate=!0,this.rotateSpeed=1,this.keyRotateSpeed=1,this.enablePan=!0,this.panSpeed=1,this.screenSpacePanning=!0,this.keyPanSpeed=7,this.zoomToCursor=!1,this.autoRotate=!1,this.autoRotateSpeed=2,this.keys={LEFT:"ArrowLeft",UP:"ArrowUp",RIGHT:"ArrowRight",BOTTOM:"ArrowDown"},this.mouseButtons={LEFT:Ga.ROTATE,MIDDLE:Ga.DOLLY,RIGHT:Ga.PAN},this.touches={ONE:l0.ROTATE,TWO:l0.DOLLY_PAN},this.target0=this.target.clone(),this.position0=this.object.position.clone(),this.zoom0=this.object.zoom,this._cursorStyle="auto",this._domElementKeyEvents=null,this._lastPosition=new re,this._lastQuaternion=new qs,this._lastTargetPosition=new re,this._quat=new qs().setFromUnitVectors(e.up,new re(0,1,0)),this._quatInverse=this._quat.clone().invert(),this._spherical=new n_,this._sphericalDelta=new n_,this._scale=1,this._panOffset=new re,this._rotateStart=new Oe,this._rotateEnd=new Oe,this._rotateDelta=new Oe,this._panStart=new Oe,this._panEnd=new Oe,this._panDelta=new Oe,this._dollyStart=new Oe,this._dollyEnd=new Oe,this._dollyDelta=new Oe,this._dollyDirection=new re,this._mouse=new Oe,this._performCursorZoom=!1,this._pointers=[],this._pointerPositions={},this._controlActive=!1,this._onPointerMove=pDe.bind(this),this._onPointerDown=dDe.bind(this),this._onPointerUp=mDe.bind(this),this._onContextMenu=bDe.bind(this),this._onMouseWheel=vDe.bind(this),this._onKeyDown=_De.bind(this),this._onTouchStart=xDe.bind(this),this._onTouchMove=yDe.bind(this),this._onMouseDown=ADe.bind(this),this._onMouseMove=gDe.bind(this),this._interceptControlDown=wDe.bind(this),this._interceptControlUp=SDe.bind(this),this.domElement!==null&&this.connect(this.domElement),this.update()}set cursorStyle(e){this._cursorStyle=e,e==="grab"?this.domElement.style.cursor="grab":this.domElement.style.cursor="auto"}get cursorStyle(){return this._cursorStyle}connect(e){super.connect(e),this.domElement.addEventListener("pointerdown",this._onPointerDown),this.domElement.addEventListener("pointercancel",this._onPointerUp),this.domElement.addEventListener("contextmenu",this._onContextMenu),this.domElement.addEventListener("wheel",this._onMouseWheel,{passive:!1}),this.domElement.getRootNode().addEventListener("keydown",this._interceptControlDown,{passive:!0,capture:!0}),this.domElement.style.touchAction="none"}disconnect(){this.domElement.removeEventListener("pointerdown",this._onPointerDown),this.domElement.ownerDocument.removeEventListener("pointermove",this._onPointerMove),this.domElement.ownerDocument.removeEventListener("pointerup",this._onPointerUp),this.domElement.removeEventListener("pointercancel",this._onPointerUp),this.domElement.removeEventListener("wheel",this._onMouseWheel),this.domElement.removeEventListener("contextmenu",this._onContextMenu),this.stopListenToKeyEvents(),this.domElement.getRootNode().removeEventListener("keydown",this._interceptControlDown,{capture:!0}),this.domElement.style.touchAction=""}dispose(){this.disconnect()}getPolarAngle(){return this._spherical.phi}getAzimuthalAngle(){return this._spherical.theta}getDistance(){return this.object.position.distanceTo(this.target)}listenToKeyEvents(e){e.addEventListener("keydown",this._onKeyDown),this._domElementKeyEvents=e}stopListenToKeyEvents(){this._domElementKeyEvents!==null&&(this._domElementKeyEvents.removeEventListener("keydown",this._onKeyDown),this._domElementKeyEvents=null)}saveState(){this.target0.copy(this.target),this.position0.copy(this.object.position),this.zoom0=this.object.zoom}reset(){this.target.copy(this.target0),this.object.position.copy(this.position0),this.object.zoom=this.zoom0,this.object.updateProjectionMatrix(),this.dispatchEvent(Xoe),this.update(),this.state=dr.NONE}pan(e,t){this._pan(e,t),this.update()}dollyIn(e){this._dollyIn(e),this.update()}dollyOut(e){this._dollyOut(e),this.update()}rotateLeft(e){this._rotateLeft(e),this.update()}rotateUp(e){this._rotateUp(e),this.update()}update(e=null){let t=this.object.position;ho.copy(t).sub(this.target),ho.applyQuaternion(this._quat),this._spherical.setFromVector3(ho),this.autoRotate&&this.state===dr.NONE&&this._rotateLeft(this._getAutoRotationAngle(e)),this.enableDamping?(this._spherical.theta+=this._sphericalDelta.theta*this.dampingFactor,this._spherical.phi+=this._sphericalDelta.phi*this.dampingFactor):(this._spherical.theta+=this._sphericalDelta.theta,this._spherical.phi+=this._sphericalDelta.phi);let n=this.minAzimuthAngle,r=this.maxAzimuthAngle;isFinite(n)&&isFinite(r)&&(n<-Math.PI?n+=Ll:n>Math.PI&&(n-=Ll),r<-Math.PI?r+=Ll:r>Math.PI&&(r-=Ll),n<=r?this._spherical.theta=Math.max(n,Math.min(r,this._spherical.theta)):this._spherical.theta=this._spherical.theta>(n+r)/2?Math.max(n,this._spherical.theta):Math.min(r,this._spherical.theta)),this._spherical.phi=Math.max(this.minPolarAngle,Math.min(this.maxPolarAngle,this._spherical.phi)),this._spherical.makeSafe(),this.enableDamping===!0?this.target.addScaledVector(this._panOffset,this.dampingFactor):this.target.add(this._panOffset),this.target.sub(this.cursor),this.target.clampLength(this.minTargetRadius,this.maxTargetRadius),this.target.add(this.cursor);let s=!1;if(this.zoomToCursor&&this._performCursorZoom||this.object.isOrthographicCamera)this._spherical.radius=this._clampDistance(this._spherical.radius);else{let o=this._spherical.radius;this._spherical.radius=this._clampDistance(this._spherical.radius*this._scale),s=o!=this._spherical.radius}if(ho.setFromSpherical(this._spherical),ho.applyQuaternion(this._quatInverse),t.copy(this.target).add(ho),this.object.lookAt(this.target),this.enableDamping===!0?(this._sphericalDelta.theta*=1-this.dampingFactor,this._sphericalDelta.phi*=1-this.dampingFactor,this._panOffset.multiplyScalar(1-this.dampingFactor)):(this._sphericalDelta.set(0,0,0),this._panOffset.set(0,0,0)),this.zoomToCursor&&this._performCursorZoom){let o=null;if(this.object.isPerspectiveCamera){let a=ho.length();o=this._clampDistance(a*this._scale);let l=a-o;this.object.position.addScaledVector(this._dollyDirection,l),this.object.updateMatrixWorld(),s=!!l}else if(this.object.isOrthographicCamera){let a=new re(this._mouse.x,this._mouse.y,0);a.unproject(this.object);let l=this.object.zoom;this.object.zoom=Math.max(this.minZoom,Math.min(this.maxZoom,this.object.zoom/this._scale)),this.object.updateProjectionMatrix(),s=l!==this.object.zoom;let c=new re(this._mouse.x,this._mouse.y,0);c.unproject(this.object),this.object.position.sub(c).add(a),this.object.updateMatrixWorld(),o=ho.length()}else console.warn("WARNING: OrbitControls.js encountered an unknown camera type - zoom to cursor disabled."),this.zoomToCursor=!1;o!==null&&(this.screenSpacePanning?this.target.set(0,0,-1).transformDirection(this.object.matrix).multiplyScalar(o).add(this.object.position):(eP.origin.copy(this.object.position),eP.direction.set(0,0,-1).transformDirection(this.object.matrix),Math.abs(this.object.up.dot(eP.direction))<fDe?this.object.lookAt(this.target):($oe.setFromNormalAndCoplanarPoint(this.object.up,this.target),eP.intersectPlane($oe,this.target))))}else if(this.object.isOrthographicCamera){let o=this.object.zoom;this.object.zoom=Math.max(this.minZoom,Math.min(this.maxZoom,this.object.zoom/this._scale)),o!==this.object.zoom&&(this.object.updateProjectionMatrix(),s=!0)}return this._scale=1,this._performCursorZoom=!1,s||this._lastPosition.distanceToSquared(this.object.position)>BV||8*(1-this._lastQuaternion.dot(this.object.quaternion))>BV||this._lastTargetPosition.distanceToSquared(this.target)>BV?(this.dispatchEvent(Xoe),this._lastPosition.copy(this.object.position),this._lastQuaternion.copy(this.object.quaternion),this._lastTargetPosition.copy(this.target),!0):!1}_getAutoRotationAngle(e){return e!==null?Ll/60*this.autoRotateSpeed*e:Ll/60/60*this.autoRotateSpeed}_getZoomScale(e){let t=Math.abs(e*.01);return Math.pow(.95,this.zoomSpeed*t)}_rotateLeft(e){this._sphericalDelta.theta-=e}_rotateUp(e){this._sphericalDelta.phi-=e}_panLeft(e,t){ho.setFromMatrixColumn(t,0),ho.multiplyScalar(-e),this._panOffset.add(ho)}_panUp(e,t){this.screenSpacePanning===!0?ho.setFromMatrixColumn(t,1):(ho.setFromMatrixColumn(t,0),ho.crossVectors(this.object.up,ho)),ho.multiplyScalar(e),this._panOffset.add(ho)}_pan(e,t){let n=this.domElement;if(this.object.isPerspectiveCamera){let r=this.object.position;ho.copy(r).sub(this.target);let s=ho.length();s*=Math.tan(this.object.fov/2*Math.PI/180),this._panLeft(2*e*s/n.clientHeight,this.object.matrix),this._panUp(2*t*s/n.clientHeight,this.object.matrix)}else this.object.isOrthographicCamera?(this._panLeft(e*(this.object.right-this.object.left)/this.object.zoom/n.clientWidth,this.object.matrix),this._panUp(t*(this.object.top-this.object.bottom)/this.object.zoom/n.clientHeight,this.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),this.enablePan=!1)}_dollyOut(e){this.object.isPerspectiveCamera||this.object.isOrthographicCamera?this._scale/=e:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),this.enableZoom=!1)}_dollyIn(e){this.object.isPerspectiveCamera||this.object.isOrthographicCamera?this._scale*=e:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),this.enableZoom=!1)}_updateZoomParameters(e,t){if(!this.zoomToCursor)return;this._performCursorZoom=!0;let n=this.domElement.getBoundingClientRect(),r=e-n.left,s=t-n.top,o=n.width,a=n.height;this._mouse.x=r/o*2-1,this._mouse.y=-(s/a)*2+1,this._dollyDirection.set(this._mouse.x,this._mouse.y,1).unproject(this.object).sub(this.object.position).normalize()}_clampDistance(e){return Math.max(this.minDistance,Math.min(this.maxDistance,e))}_handleMouseDownRotate(e){this._rotateStart.set(e.clientX,e.clientY)}_handleMouseDownDolly(e){this._updateZoomParameters(e.clientX,e.clientX),this._dollyStart.set(e.clientX,e.clientY)}_handleMouseDownPan(e){this._panStart.set(e.clientX,e.clientY)}_handleMouseMoveRotate(e){this._rotateEnd.set(e.clientX,e.clientY),this._rotateDelta.subVectors(this._rotateEnd,this._rotateStart).multiplyScalar(this.rotateSpeed);let t=this.domElement;this._rotateLeft(Ll*this._rotateDelta.x/t.clientHeight),this._rotateUp(Ll*this._rotateDelta.y/t.clientHeight),this._rotateStart.copy(this._rotateEnd),this.update()}_handleMouseMoveDolly(e){this._dollyEnd.set(e.clientX,e.clientY),this._dollyDelta.subVectors(this._dollyEnd,this._dollyStart),this._dollyDelta.y>0?this._dollyOut(this._getZoomScale(this._dollyDelta.y)):this._dollyDelta.y<0&&this._dollyIn(this._getZoomScale(this._dollyDelta.y)),this._dollyStart.copy(this._dollyEnd),this.update()}_handleMouseMovePan(e){this._panEnd.set(e.clientX,e.clientY),this._panDelta.subVectors(this._panEnd,this._panStart).multiplyScalar(this.panSpeed),this._pan(this._panDelta.x,this._panDelta.y),this._panStart.copy(this._panEnd),this.update()}_handleMouseWheel(e){this._updateZoomParameters(e.clientX,e.clientY),e.deltaY<0?this._dollyIn(this._getZoomScale(e.deltaY)):e.deltaY>0&&this._dollyOut(this._getZoomScale(e.deltaY)),this.update()}_handleKeyDown(e){let t=!1;switch(e.code){case this.keys.UP:e.ctrlKey||e.metaKey||e.shiftKey?this.enableRotate&&this._rotateUp(Ll*this.keyRotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(0,this.keyPanSpeed),t=!0;break;case this.keys.BOTTOM:e.ctrlKey||e.metaKey||e.shiftKey?this.enableRotate&&this._rotateUp(-Ll*this.keyRotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(0,-this.keyPanSpeed),t=!0;break;case this.keys.LEFT:e.ctrlKey||e.metaKey||e.shiftKey?this.enableRotate&&this._rotateLeft(Ll*this.keyRotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(this.keyPanSpeed,0),t=!0;break;case this.keys.RIGHT:e.ctrlKey||e.metaKey||e.shiftKey?this.enableRotate&&this._rotateLeft(-Ll*this.keyRotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(-this.keyPanSpeed,0),t=!0;break}t&&(e.preventDefault(),this.update())}_handleTouchStartRotate(e){if(this._pointers.length===1)this._rotateStart.set(e.pageX,e.pageY);else{let t=this._getSecondPointerPosition(e),n=.5*(e.pageX+t.x),r=.5*(e.pageY+t.y);this._rotateStart.set(n,r)}}_handleTouchStartPan(e){if(this._pointers.length===1)this._panStart.set(e.pageX,e.pageY);else{let t=this._getSecondPointerPosition(e),n=.5*(e.pageX+t.x),r=.5*(e.pageY+t.y);this._panStart.set(n,r)}}_handleTouchStartDolly(e){let t=this._getSecondPointerPosition(e),n=e.pageX-t.x,r=e.pageY-t.y,s=Math.sqrt(n*n+r*r);this._dollyStart.set(0,s)}_handleTouchStartDollyPan(e){this.enableZoom&&this._handleTouchStartDolly(e),this.enablePan&&this._handleTouchStartPan(e)}_handleTouchStartDollyRotate(e){this.enableZoom&&this._handleTouchStartDolly(e),this.enableRotate&&this._handleTouchStartRotate(e)}_handleTouchMoveRotate(e){if(this._pointers.length==1)this._rotateEnd.set(e.pageX,e.pageY);else{let n=this._getSecondPointerPosition(e),r=.5*(e.pageX+n.x),s=.5*(e.pageY+n.y);this._rotateEnd.set(r,s)}this._rotateDelta.subVectors(this._rotateEnd,this._rotateStart).multiplyScalar(this.rotateSpeed);let t=this.domElement;this._rotateLeft(Ll*this._rotateDelta.x/t.clientHeight),this._rotateUp(Ll*this._rotateDelta.y/t.clientHeight),this._rotateStart.copy(this._rotateEnd)}_handleTouchMovePan(e){if(this._pointers.length===1)this._panEnd.set(e.pageX,e.pageY);else{let t=this._getSecondPointerPosition(e),n=.5*(e.pageX+t.x),r=.5*(e.pageY+t.y);this._panEnd.set(n,r)}this._panDelta.subVectors(this._panEnd,this._panStart).multiplyScalar(this.panSpeed),this._pan(this._panDelta.x,this._panDelta.y),this._panStart.copy(this._panEnd)}_handleTouchMoveDolly(e){let t=this._getSecondPointerPosition(e),n=e.pageX-t.x,r=e.pageY-t.y,s=Math.sqrt(n*n+r*r);this._dollyEnd.set(0,s),this._dollyDelta.set(0,Math.pow(this._dollyEnd.y/this._dollyStart.y,this.zoomSpeed)),this._dollyOut(this._dollyDelta.y),this._dollyStart.copy(this._dollyEnd);let o=(e.pageX+t.x)*.5,a=(e.pageY+t.y)*.5;this._updateZoomParameters(o,a)}_handleTouchMoveDollyPan(e){this.enableZoom&&this._handleTouchMoveDolly(e),this.enablePan&&this._handleTouchMovePan(e)}_handleTouchMoveDollyRotate(e){this.enableZoom&&this._handleTouchMoveDolly(e),this.enableRotate&&this._handleTouchMoveRotate(e)}_addPointer(e){this._pointers.push(e.pointerId)}_removePointer(e){delete this._pointerPositions[e.pointerId];for(let t=0;t<this._pointers.length;t++)if(this._pointers[t]==e.pointerId){this._pointers.splice(t,1);return}}_isTrackingPointer(e){for(let t=0;t<this._pointers.length;t++)if(this._pointers[t]==e.pointerId)return!0;return!1}_trackPointer(e){let t=this._pointerPositions[e.pointerId];t===void 0&&(t=new Oe,this._pointerPositions[e.pointerId]=t),t.set(e.pageX,e.pageY)}_getSecondPointerPosition(e){let t=e.pointerId===this._pointers[0]?this._pointers[1]:this._pointers[0];return this._pointerPositions[t]}_customWheelEvent(e){let t=e.deltaMode,n={clientX:e.clientX,clientY:e.clientY,deltaY:e.deltaY};switch(t){case 1:n.deltaY*=16;break;case 2:n.deltaY*=100;break}return e.ctrlKey&&!this._controlActive&&(n.deltaY*=10),n}};function dDe(i){this.enabled!==!1&&(this._pointers.length===0&&(this.domElement.setPointerCapture(i.pointerId),this.domElement.ownerDocument.addEventListener("pointermove",this._onPointerMove),this.domElement.ownerDocument.addEventListener("pointerup",this._onPointerUp)),!this._isTrackingPointer(i)&&(this._addPointer(i),i.pointerType==="touch"?this._onTouchStart(i):this._onMouseDown(i),this._cursorStyle==="grab"&&(this.domElement.style.cursor="grabbing")))}function pDe(i){this.enabled!==!1&&(i.pointerType==="touch"?this._onTouchMove(i):this._onMouseMove(i))}function mDe(i){switch(this._removePointer(i),this._pointers.length){case 0:this.domElement.releasePointerCapture(i.pointerId),this.domElement.ownerDocument.removeEventListener("pointermove",this._onPointerMove),this.domElement.ownerDocument.removeEventListener("pointerup",this._onPointerUp),this.dispatchEvent(Yoe),this.state=dr.NONE,this._cursorStyle==="grab"&&(this.domElement.style.cursor="grab");break;case 1:let e=this._pointers[0],t=this._pointerPositions[e];this._onTouchStart({pointerId:e,pageX:t.x,pageY:t.y});break}}function ADe(i){let e;switch(i.button){case 0:e=this.mouseButtons.LEFT;break;case 1:e=this.mouseButtons.MIDDLE;break;case 2:e=this.mouseButtons.RIGHT;break;default:e=-1}switch(e){case Ga.DOLLY:if(this.enableZoom===!1)return;this._handleMouseDownDolly(i),this.state=dr.DOLLY;break;case Ga.ROTATE:if(i.ctrlKey||i.metaKey||i.shiftKey){if(this.enablePan===!1)return;this._handleMouseDownPan(i),this.state=dr.PAN}else{if(this.enableRotate===!1)return;this._handleMouseDownRotate(i),this.state=dr.ROTATE}break;case Ga.PAN:if(i.ctrlKey||i.metaKey||i.shiftKey){if(this.enableRotate===!1)return;this._handleMouseDownRotate(i),this.state=dr.ROTATE}else{if(this.enablePan===!1)return;this._handleMouseDownPan(i),this.state=dr.PAN}break;default:this.state=dr.NONE}this.state!==dr.NONE&&this.dispatchEvent(OV)}function gDe(i){switch(this.state){case dr.ROTATE:if(this.enableRotate===!1)return;this._handleMouseMoveRotate(i);break;case dr.DOLLY:if(this.enableZoom===!1)return;this._handleMouseMoveDolly(i);break;case dr.PAN:if(this.enablePan===!1)return;this._handleMouseMovePan(i);break}}function vDe(i){this.enabled===!1||this.enableZoom===!1||this.state!==dr.NONE||(i.preventDefault(),this.dispatchEvent(OV),this._handleMouseWheel(this._customWheelEvent(i)),this.dispatchEvent(Yoe))}function _De(i){this.enabled!==!1&&this._handleKeyDown(i)}function xDe(i){switch(this._trackPointer(i),this._pointers.length){case 1:switch(this.touches.ONE){case l0.ROTATE:if(this.enableRotate===!1)return;this._handleTouchStartRotate(i),this.state=dr.TOUCH_ROTATE;break;case l0.PAN:if(this.enablePan===!1)return;this._handleTouchStartPan(i),this.state=dr.TOUCH_PAN;break;default:this.state=dr.NONE}break;case 2:switch(this.touches.TWO){case l0.DOLLY_PAN:if(this.enableZoom===!1&&this.enablePan===!1)return;this._handleTouchStartDollyPan(i),this.state=dr.TOUCH_DOLLY_PAN;break;case l0.DOLLY_ROTATE:if(this.enableZoom===!1&&this.enableRotate===!1)return;this._handleTouchStartDollyRotate(i),this.state=dr.TOUCH_DOLLY_ROTATE;break;default:this.state=dr.NONE}break;default:this.state=dr.NONE}this.state!==dr.NONE&&this.dispatchEvent(OV)}function yDe(i){switch(this._trackPointer(i),this.state){case dr.TOUCH_ROTATE:if(this.enableRotate===!1)return;this._handleTouchMoveRotate(i),this.update();break;case dr.TOUCH_PAN:if(this.enablePan===!1)return;this._handleTouchMovePan(i),this.update();break;case dr.TOUCH_DOLLY_PAN:if(this.enableZoom===!1&&this.enablePan===!1)return;this._handleTouchMoveDollyPan(i),this.update();break;case dr.TOUCH_DOLLY_ROTATE:if(this.enableZoom===!1&&this.enableRotate===!1)return;this._handleTouchMoveDollyRotate(i),this.update();break;default:this.state=dr.NONE}}function bDe(i){this.enabled!==!1&&i.preventDefault()}function wDe(i){i.key==="Control"&&(this._controlActive=!0,this.domElement.getRootNode().addEventListener("keyup",this._interceptControlUp,{passive:!0,capture:!0}))}function SDe(i){i.key==="Control"&&(this._controlActive=!1,this.domElement.getRootNode().removeEventListener("keyup",this._interceptControlUp,{passive:!0,capture:!0}))}var TDe={type:"change"},Zoe=1e-6,Koe=new qs,nP=class extends Rd{constructor(e,t=null){super(e,t),this.movementSpeed=1,this.rollSpeed=.005,this.dragToLook=!1,this.autoForward=!1,this._moveState={up:0,down:0,left:0,right:0,forward:0,back:0,pitchUp:0,pitchDown:0,yawLeft:0,yawRight:0,rollLeft:0,rollRight:0},this._moveVector=new re(0,0,0),this._rotationVector=new re(0,0,0),this._lastQuaternion=new qs,this._lastPosition=new re,this._status=0,this._onKeyDown=EDe.bind(this),this._onKeyUp=MDe.bind(this),this._onPointerMove=RDe.bind(this),this._onPointerDown=CDe.bind(this),this._onPointerUp=IDe.bind(this),this._onPointerCancel=PDe.bind(this),this._onContextMenu=LDe.bind(this),t!==null&&this.connect(t)}connect(e){super.connect(e),window.addEventListener("keydown",this._onKeyDown),window.addEventListener("keyup",this._onKeyUp),this.domElement.addEventListener("pointermove",this._onPointerMove),this.domElement.addEventListener("pointerdown",this._onPointerDown),this.domElement.addEventListener("pointerup",this._onPointerUp),this.domElement.addEventListener("pointercancel",this._onPointerCancel),this.domElement.addEventListener("contextmenu",this._onContextMenu),this.domElement.style.touchAction="none"}disconnect(){window.removeEventListener("keydown",this._onKeyDown),window.removeEventListener("keyup",this._onKeyUp),this.domElement.removeEventListener("pointermove",this._onPointerMove),this.domElement.removeEventListener("pointerdown",this._onPointerDown),this.domElement.removeEventListener("pointerup",this._onPointerUp),this.domElement.removeEventListener("pointercancel",this._onPointerCancel),this.domElement.removeEventListener("contextmenu",this._onContextMenu),this.domElement.style.touchAction=""}dispose(){this.disconnect()}update(e){if(this.enabled===!1)return;let t=this.object,n=e*this.movementSpeed,r=e*this.rollSpeed;t.translateX(this._moveVector.x*n),t.translateY(this._moveVector.y*n),t.translateZ(this._moveVector.z*n),Koe.set(this._rotationVector.x*r,this._rotationVector.y*r,this._rotationVector.z*r,1).normalize(),t.quaternion.multiply(Koe),(this._lastPosition.distanceToSquared(t.position)>Zoe||8*(1-this._lastQuaternion.dot(t.quaternion))>Zoe)&&(this.dispatchEvent(TDe),this._lastQuaternion.copy(t.quaternion),this._lastPosition.copy(t.position))}_updateMovementVector(){let e=this._moveState.forward||this.autoForward&&!this._moveState.back?1:0;this._moveVector.x=-this._moveState.left+this._moveState.right,this._moveVector.y=-this._moveState.down+this._moveState.up,this._moveVector.z=-e+this._moveState.back}_updateRotationVector(){this._rotationVector.x=-this._moveState.pitchDown+this._moveState.pitchUp,this._rotationVector.y=-this._moveState.yawRight+this._moveState.yawLeft,this._rotationVector.z=-this._moveState.rollRight+this._moveState.rollLeft}_getContainerDimensions(){return this.domElement!=document?{size:[this.domElement.offsetWidth,this.domElement.offsetHeight],offset:[this.domElement.offsetLeft,this.domElement.offsetTop]}:{size:[window.innerWidth,window.innerHeight],offset:[0,0]}}};function EDe(i){if(!(i.altKey||this.enabled===!1)){switch(i.code){case"ShiftLeft":case"ShiftRight":this.movementSpeedMultiplier=.1;break;case"KeyW":this._moveState.forward=1;break;case"KeyS":this._moveState.back=1;break;case"KeyA":this._moveState.left=1;break;case"KeyD":this._moveState.right=1;break;case"KeyR":this._moveState.up=1;break;case"KeyF":this._moveState.down=1;break;case"ArrowUp":this._moveState.pitchUp=1;break;case"ArrowDown":this._moveState.pitchDown=1;break;case"ArrowLeft":this._moveState.yawLeft=1;break;case"ArrowRight":this._moveState.yawRight=1;break;case"KeyQ":this._moveState.rollLeft=1;break;case"KeyE":this._moveState.rollRight=1;break}this._updateMovementVector(),this._updateRotationVector()}}function MDe(i){if(this.enabled!==!1){switch(i.code){case"ShiftLeft":case"ShiftRight":this.movementSpeedMultiplier=1;break;case"KeyW":this._moveState.forward=0;break;case"KeyS":this._moveState.back=0;break;case"KeyA":this._moveState.left=0;break;case"KeyD":this._moveState.right=0;break;case"KeyR":this._moveState.up=0;break;case"KeyF":this._moveState.down=0;break;case"ArrowUp":this._moveState.pitchUp=0;break;case"ArrowDown":this._moveState.pitchDown=0;break;case"ArrowLeft":this._moveState.yawLeft=0;break;case"ArrowRight":this._moveState.yawRight=0;break;case"KeyQ":this._moveState.rollLeft=0;break;case"KeyE":this._moveState.rollRight=0;break}this._updateMovementVector(),this._updateRotationVector()}}function CDe(i){if(this.enabled!==!1)if(this.dragToLook)this._status++;else{switch(i.button){case 0:this._moveState.forward=1;break;case 2:this._moveState.back=1;break}this._updateMovementVector()}}function RDe(i){if(this.enabled!==!1&&(!this.dragToLook||this._status>0)){let e=this._getContainerDimensions(),t=e.size[0]/2,n=e.size[1]/2;this._moveState.yawLeft=-(i.pageX-e.offset[0]-t)/t,this._moveState.pitchDown=(i.pageY-e.offset[1]-n)/n,this._updateRotationVector()}}function IDe(i){if(this.enabled!==!1){if(this.dragToLook)this._status--,this._moveState.yawLeft=this._moveState.pitchDown=0;else{switch(i.button){case 0:this._moveState.forward=0;break;case 2:this._moveState.back=0;break}this._updateMovementVector()}this._updateRotationVector()}}function PDe(){this.enabled!==!1&&(this.dragToLook?(this._status=0,this._moveState.yawLeft=this._moveState.pitchDown=0):(this._moveState.forward=0,this._moveState.back=0,this._updateMovementVector()),this._updateRotationVector())}function LDe(i){this.enabled!==!1&&i.preventDefault()}var Qoe={name:"CopyShader",uniforms:{tDiffuse:{value:null},opacity:{value:1}},vertexShader:`5235+THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL MAGENTA OR PERSONS OR BODIES IN CHARGE OF ADMINISTRATION AND MAINTENANCE OF THE FONT SOFTWARE BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM OTHER DEALINGS IN THE FONT SOFTWARE.`,manufacturer_name:"\u039Cagenta ltd",font_sub_family_name:"Regular"},jLe=-334,XLe="Helvetiker",$Le=1522,YLe=50,ZLe={glyphs:ULe,cssFontWeight:kLe,ascender:zLe,underlinePosition:VLe,cssFontStyle:GLe,boundingBox:qLe,resolution:HLe,original_font_information:WLe,descender:jLe,familyName:XLe,lineHeight:$Le,underlineThickness:YLe},eh=$i($i({},window.THREE?window.THREE:{BoxGeometry:Lu,CircleGeometry:t_,DoubleSide:vr,Group:Br,Mesh:Hn,MeshLambertMaterial:Ga,TextGeometry:kS,Vector3:re}),{},{Font:Cx,TextGeometry:kS}),hae=Qr({props:{labelsData:{default:[]},labelLat:{default:"lat"},labelLng:{default:"lng"},labelAltitude:{default:.002},labelText:{default:"text"},labelSize:{default:.5},labelTypeFace:{default:ZLe,onChange:function(e,t){t.font=new eh.Font(e)}},labelColor:{default:function(){return"lightgrey"}},labelRotation:{default:0},labelResolution:{default:3},labelIncludeDot:{default:!0},labelDotRadius:{default:.1},labelDotOrientation:{default:function(){return"bottom"}},labelsTransitionDuration:{default:1e3,triggerUpdate:!1}},init:function(e,t,n){var r=n.tweenGroup;is(e),t.scene=e,t.tweenGroup=r;var s=new eh.CircleGeometry(1,32);t.dataMapper=new Ll(e,{objBindAttr:"__threeObjLabel"}).onCreateObj(function(){var o=new eh.MeshLambertMaterial;o.side=vr;var a=new eh.Group;a.add(new eh.Mesh(s,o));var l=new eh.Mesh(void 0,o);a.add(l);var c=new eh.Mesh;return c.visible=!1,l.add(c),a.__globeObjType="label",a})},update:function(e){var t=st(e.labelLat),n=st(e.labelLng),r=st(e.labelAltitude),s=st(e.labelText),o=st(e.labelSize),a=st(e.labelRotation),l=st(e.labelColor),c=st(e.labelIncludeDot),u=st(e.labelDotRadius),f=st(e.labelDotOrientation),d=new Set(["right","top","bottom"]),A=2*Math.PI*_r/360;e.dataMapper.onUpdateObj(function(y,w){var S=Ir(y.children,2),T=S[0],R=S[1],I=Ir(R.children,1),P=I[0],F=l(w),D=th(F);R.material.color.set(Nf(F)),R.material.transparent=D<1,R.material.opacity=D;var L=c(w),C=f(w);!L||!d.has(C)&&(C="bottom");var B=L?+u(w)*A:1e-12;T.scale.x=T.scale.y=B;var k=+o(w)*A;if(R.geometry&&R.geometry.dispose(),R.geometry=new eh.TextGeometry(s(w),{font:e.font,size:k,depth:0,bevelEnabled:!0,bevelThickness:0,bevelSize:0,curveSegments:e.labelResolution}),P.geometry&&P.geometry.dispose(),R.geometry.computeBoundingBox(),P.geometry=$V(eh.BoxGeometry,tr(new eh.Vector3().subVectors(R.geometry.boundingBox.max,R.geometry.boundingBox.min).clampScalar(0,1/0).toArray())),C!=="right"&&R.geometry.center(),L){var z=B+k/2;C==="right"&&(R.position.x=z),R.position.y={right:-k/2,top:z+k/2,bottom:-z-k/2}[C]}var G=function($){var J=y.__currentTargetD=$,te=J.lat,ce=J.lng,he=J.alt,ve=J.rot,Re=J.scale;Object.assign(y.position,ou(te,ce,he)),y.lookAt(e.scene.localToWorld(new eh.Vector3(0,0,0))),y.rotateY(Math.PI),y.rotateZ(-ve*Math.PI/180),y.scale.x=y.scale.y=y.scale.z=Re},W={lat:+t(w),lng:+n(w),alt:+r(w),rot:+a(w),scale:1},Y=y.__currentTargetD||Object.assign({},W,{scale:1e-12});Object.keys(W).some(function(H){return Y[H]!==W[H]})&&(!e.labelsTransitionDuration||e.labelsTransitionDuration<0?G(W):e.tweenGroup.add(new uo(Y).to(W,e.labelsTransitionDuration).easing(Jr.Quadratic.InOut).onUpdate(G).onComplete(function(){e.tweenGroup.remove(this)}).start()))}).digest(e.labelsData)}}),KLe=$i($i({},window.THREE?window.THREE:{}),{},{CSS2DObject:YM}),fae=Qr({props:{htmlElementsData:{default:[]},htmlLat:{default:"lat"},htmlLng:{default:"lng"},htmlAltitude:{default:0},htmlElement:{},htmlElementVisibilityModifier:{triggerUpdate:!1},htmlTransitionDuration:{default:1e3,triggerUpdate:!1},isBehindGlobe:{onChange:function(){this.updateObjVisibility()},triggerUpdate:!1}},methods:{updateObjVisibility:function(e,t){if(e.dataMapper){var n=t?[t]:e.dataMapper.entries().map(function(r){var s=Ir(r,2),o=s[1];return o}).filter(function(r){return r});n.forEach(function(r){var s=!e.isBehindGlobe||!e.isBehindGlobe(r.position);e.htmlElementVisibilityModifier?(r.visible=!0,e.htmlElementVisibilityModifier(r.element,s)):r.visible=s})}}},init:function(e,t,n){var r=n.tweenGroup;is(e),t.scene=e,t.tweenGroup=r,t.dataMapper=new Ll(e,{objBindAttr:"__threeObjHtml"}).onCreateObj(function(s){var o=st(t.htmlElement)(s),a=new KLe.CSS2DObject(o);return a.__globeObjType="html",a})},update:function(e,t){var n=this,r=st(e.htmlLat),s=st(e.htmlLng),o=st(e.htmlAltitude);t.hasOwnProperty("htmlElement")&&e.dataMapper.clear(),e.dataMapper.onUpdateObj(function(a,l){var c=function(d){var A=a.__currentTargetD=d,y=A.alt,w=A.lat,S=A.lng;Object.assign(a.position,ou(w,S,y)),n.updateObjVisibility(a)},u={lat:+r(l),lng:+s(l),alt:+o(l)};!e.htmlTransitionDuration||e.htmlTransitionDuration<0||!a.__currentTargetD?c(u):e.tweenGroup.add(new uo(a.__currentTargetD).to(u,e.htmlTransitionDuration).easing(Jr.Quadratic.InOut).onUpdate(c).onComplete(function(){e.tweenGroup.remove(this)}).start())}).digest(e.htmlElementsData)}}),KP=window.THREE?window.THREE:{Group:Br,Mesh:Hn,MeshLambertMaterial:Ga,SphereGeometry:Va},dae=Qr({props:{objectsData:{default:[]},objectLat:{default:"lat"},objectLng:{default:"lng"},objectAltitude:{default:.01},objectFacesSurface:{default:!0},objectRotation:{},objectThreeObject:{default:new KP.Mesh(new KP.SphereGeometry(1,16,8),new KP.MeshLambertMaterial({color:"#ffffaa",transparent:!0,opacity:.7}))}},init:function(e,t){is(e),t.scene=e,t.dataMapper=new Ll(e,{objBindAttr:"__threeObjObject"}).onCreateObj(function(n){var r=st(t.objectThreeObject)(n);t.objectThreeObject===r&&(r=r.clone());var s=new KP.Group;return s.add(r),s.__globeObjType="object",s})},update:function(e,t){var n=st(e.objectLat),r=st(e.objectLng),s=st(e.objectAltitude),o=st(e.objectFacesSurface),a=st(e.objectRotation);t.hasOwnProperty("objectThreeObject")&&e.dataMapper.clear(),e.dataMapper.onUpdateObj(function(l,c){var u=+n(c),f=+r(c),d=+s(c);Object.assign(l.position,ou(u,f,d)),o(c)?l.setRotationFromEuler(new Ua(p1(-u),p1(f),0,"YXZ")):l.rotation.set(0,0,0);var A=l.children[0],y=a(c);y&&A.setRotationFromEuler(new Ua(p1(y.x||0),p1(y.y||0),p1(y.z||0)))}).digest(e.objectsData)}}),pae=Qr({props:{customLayerData:{default:[]},customThreeObject:{},customThreeObjectUpdate:{triggerUpdate:!1}},init:function(e,t){is(e),t.scene=e,t.dataMapper=new Ll(e,{objBindAttr:"__threeObjCustom"}).onCreateObj(function(n){var r=st(t.customThreeObject)(n,_r);return r&&(t.customThreeObject===r&&(r=r.clone()),r.__globeObjType="custom"),r})},update:function(e,t){e.customThreeObjectUpdate||is(e.scene);var n=st(e.customThreeObjectUpdate);t.hasOwnProperty("customThreeObject")&&e.dataMapper.clear(),e.dataMapper.onUpdateObj(function(r,s){return n(r,s,_r)}).digest(e.customLayerData)}}),QP=window.THREE?window.THREE:{Camera:Id,Group:Br,Vector2:Oe,Vector3:re},QLe=["globeLayer","pointsLayer","arcsLayer","hexBinLayer","heatmapsLayer","polygonsLayer","hexedPolygonsLayer","pathsLayer","tilesLayer","particlesLayer","ringsLayer","labelsLayer","htmlElementsLayer","objectsLayer","customLayer"],mae=nl("globeLayer",Qoe),JLe=Object.assign.apply(Object,tr(["globeImageUrl","bumpImageUrl","globeCurvatureResolution","globeTileEngineUrl","globeTileEngineMaxLevel","showGlobe","showGraticules","showAtmosphere","atmosphereColor","atmosphereAltitude"].map(function(i){return Eo({},i,mae.linkProp(i))}))),eDe=Object.assign.apply(Object,tr(["globeMaterial","globeTileEngineClearCache"].map(function(i){return Eo({},i,mae.linkMethod(i))}))),tDe=nl("pointsLayer",Joe),nDe=Object.assign.apply(Object,tr(["pointsData","pointLat","pointLng","pointColor","pointAltitude","pointRadius","pointResolution","pointsMerge","pointsTransitionDuration"].map(function(i){return Eo({},i,tDe.linkProp(i))}))),iDe=nl("arcsLayer",tae),rDe=Object.assign.apply(Object,tr(["arcsData","arcStartLat","arcStartLng","arcStartAltitude","arcEndLat","arcEndLng","arcEndAltitude","arcColor","arcAltitude","arcAltitudeAutoScale","arcStroke","arcCurveResolution","arcCircularResolution","arcDashLength","arcDashGap","arcDashInitialGap","arcDashAnimateTime","arcsTransitionDuration"].map(function(i){return Eo({},i,iDe.linkProp(i))}))),sDe=nl("hexBinLayer",nae),oDe=Object.assign.apply(Object,tr(["hexBinPointsData","hexBinPointLat","hexBinPointLng","hexBinPointWeight","hexBinResolution","hexMargin","hexTopCurvatureResolution","hexTopColor","hexSideColor","hexAltitude","hexBinMerge","hexTransitionDuration"].map(function(i){return Eo({},i,sDe.linkProp(i))}))),aDe=nl("heatmapsLayer",rae),lDe=Object.assign.apply(Object,tr(["heatmapsData","heatmapPoints","heatmapPointLat","heatmapPointLng","heatmapPointWeight","heatmapBandwidth","heatmapColorFn","heatmapColorSaturation","heatmapBaseAltitude","heatmapTopAltitude","heatmapsTransitionDuration"].map(function(i){return Eo({},i,aDe.linkProp(i))}))),cDe=nl("hexedPolygonsLayer",oae),uDe=Object.assign.apply(Object,tr(["hexPolygonsData","hexPolygonGeoJsonGeometry","hexPolygonColor","hexPolygonAltitude","hexPolygonResolution","hexPolygonMargin","hexPolygonUseDots","hexPolygonCurvatureResolution","hexPolygonDotResolution","hexPolygonsTransitionDuration"].map(function(i){return Eo({},i,cDe.linkProp(i))}))),hDe=nl("polygonsLayer",sae),fDe=Object.assign.apply(Object,tr(["polygonsData","polygonGeoJsonGeometry","polygonCapColor","polygonCapMaterial","polygonSideColor","polygonSideMaterial","polygonStrokeColor","polygonAltitude","polygonCapCurvatureResolution","polygonsTransitionDuration"].map(function(i){return Eo({},i,hDe.linkProp(i))}))),dDe=nl("pathsLayer",aae),pDe=Object.assign.apply(Object,tr(["pathsData","pathPoints","pathPointLat","pathPointLng","pathPointAlt","pathResolution","pathColor","pathStroke","pathDashLength","pathDashGap","pathDashInitialGap","pathDashAnimateTime","pathTransitionDuration"].map(function(i){return Eo({},i,dDe.linkProp(i))}))),mDe=nl("tilesLayer",lae),ADe=Object.assign.apply(Object,tr(["tilesData","tileLat","tileLng","tileAltitude","tileWidth","tileHeight","tileUseGlobeProjection","tileMaterial","tileCurvatureResolution","tilesTransitionDuration"].map(function(i){return Eo({},i,mDe.linkProp(i))}))),gDe=nl("particlesLayer",cae),vDe=Object.assign.apply(Object,tr(["particlesData","particlesList","particleLat","particleLng","particleAltitude","particlesSize","particlesSizeAttenuation","particlesColor","particlesTexture"].map(function(i){return Eo({},i,gDe.linkProp(i))}))),_De=nl("ringsLayer",uae),xDe=Object.assign.apply(Object,tr(["ringsData","ringLat","ringLng","ringAltitude","ringColor","ringResolution","ringMaxRadius","ringPropagationSpeed","ringRepeatPeriod"].map(function(i){return Eo({},i,_De.linkProp(i))}))),yDe=nl("labelsLayer",hae),bDe=Object.assign.apply(Object,tr(["labelsData","labelLat","labelLng","labelAltitude","labelRotation","labelText","labelSize","labelTypeFace","labelColor","labelResolution","labelIncludeDot","labelDotRadius","labelDotOrientation","labelsTransitionDuration"].map(function(i){return Eo({},i,yDe.linkProp(i))}))),wDe=nl("htmlElementsLayer",fae),SDe=Object.assign.apply(Object,tr(["htmlElementsData","htmlLat","htmlLng","htmlAltitude","htmlElement","htmlElementVisibilityModifier","htmlTransitionDuration"].map(function(i){return Eo({},i,wDe.linkProp(i))}))),TDe=nl("objectsLayer",dae),EDe=Object.assign.apply(Object,tr(["objectsData","objectLat","objectLng","objectAltitude","objectRotation","objectFacesSurface","objectThreeObject"].map(function(i){return Eo({},i,TDe.linkProp(i))}))),MDe=nl("customLayer",pae),CDe=Object.assign.apply(Object,tr(["customLayerData","customThreeObject","customThreeObjectUpdate"].map(function(i){return Eo({},i,MDe.linkProp(i))}))),RDe=Qr({props:$i($i($i($i($i($i($i($i($i($i($i($i($i($i($i({onGlobeReady:{triggerUpdate:!1},rendererSize:{default:new QP.Vector2(window.innerWidth,window.innerHeight),onChange:function(e,t){t.pathsLayer.rendererSize(e)},triggerUpdate:!1}},JLe),nDe),rDe),oDe),lDe),fDe),uDe),pDe),ADe),vDe),xDe),bDe),SDe),EDe),CDe),methods:$i({getGlobeRadius:Uoe,getCoords:function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];return ou.apply(void 0,n)},toGeoCoords:function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];return Koe.apply(void 0,n)},setPointOfView:function(e,t){var n=t instanceof QP.Camera?t.position:t,r=Uoe(),s=void 0;if(e.scene&&n){var o,a,l,c;s=function(f){o===void 0&&(o=n.clone().applyMatrix4(e.scene.matrixWorld.clone().invert())),a===void 0&&(a=o.length()),l===void 0&&(l=Math.sqrt(Math.pow(a,2)-Math.pow(r,2))),c===void 0&&(c=Math.acos(l/a));var d=o.distanceTo(f);if(d<l)return!1;var A=f.length(),y=Math.acos((Math.pow(a,2)+Math.pow(d,2)-Math.pow(A,2))/(2*a*d));return y<c}}e.layersThatNeedUpdatePov.forEach(function(u){return u.updatePov(t)}),e.layersThatNeedBehindGlobeChecker.forEach(function(u){return u.isBehindGlobe(s)})},pauseAnimation:function(e){return e.animationFrameRequestId!==null&&(cancelAnimationFrame(e.animationFrameRequestId),e.animationFrameRequestId=null),e.pausableLayers.forEach(function(t){var n;return(n=t.pauseAnimation)===null||n===void 0?void 0:n.call(t)}),this},resumeAnimation:function(e){return e.animationFrameRequestId===null&&this._animationCycle(),e.pausableLayers.forEach(function(t){var n;return(n=t.resumeAnimation)===null||n===void 0?void 0:n.call(t)}),this},_animationCycle:function(e){e.animationFrameRequestId=requestAnimationFrame(this._animationCycle),e.tweenGroup.update()},_destructor:function(e){this.pauseAnimation(),e.destructableLayers.forEach(function(t){return t._destructor()})}},eDe),stateInit:function(){var e=new Ag,t={tweenGroup:e},n={globeLayer:Qoe(t),pointsLayer:Joe(t),arcsLayer:tae(t),hexBinLayer:nae(t),heatmapsLayer:rae(t),polygonsLayer:sae(t),hexedPolygonsLayer:oae(t),pathsLayer:aae(t),tilesLayer:lae(t),particlesLayer:cae(t),ringsLayer:uae(t),labelsLayer:hae(t),htmlElementsLayer:fae(t),objectsLayer:dae(t),customLayer:pae(t)};return $i($i({tweenGroup:e},n),{},{layersThatNeedUpdatePov:Object.values(n).filter(function(r){return r.hasOwnProperty("updatePov")}),layersThatNeedBehindGlobeChecker:Object.values(n).filter(function(r){return r.hasOwnProperty("isBehindGlobe")}),destructableLayers:Object.values(n).filter(function(r){return r.hasOwnProperty("_destructor")}),pausableLayers:Object.values(n).filter(function(r){return r.hasOwnProperty("pauseAnimation")})})},init:function(e,t,n){var r=n.animateIn,s=r===void 0?!0:r,o=n.waitForGlobeReady,a=o===void 0?!0:o;is(e),t.scene=e,t.scene.visible=!1,QLe.forEach(function(c){var u=new QP.Group;t.scene.add(u),t[c](u)});var l=function(){if(s){t.scene.scale.set(1e-6,1e-6,1e-6),t.tweenGroup.add(new uo({k:1e-6}).to({k:1},600).easing(Jr.Quadratic.Out).onUpdate(function(f){var d=f.k;return t.scene.scale.set(d,d,d)}).onComplete(function(){t.tweenGroup.remove(this)}).start());var u=new QP.Vector3(0,1,0);t.tweenGroup.add(new uo({rot:Math.PI*2}).to({rot:0},1200).easing(Jr.Quintic.Out).onUpdate(function(f){var d=f.rot;return t.scene.setRotationFromAxisAngle(u,d)}).onComplete(function(){t.tweenGroup.remove(this)}).start())}t.scene.visible=!0,t.onGlobeReady&&t.onGlobeReady()};a?t.globeLayer.onReady(l):l(),this._animationCycle()},update:function(e){}});function PDe(i){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Object,t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,n=(function(r){function s(){var o;eI(this,s);for(var a=arguments.length,l=new Array(a),c=0;c<a;c++)l[c]=arguments[c];return o=JP(this,s,[].concat(l)),o.__kapsuleInstance=$V(i,[].concat(tr(t?[o]:[]),l)),o}return nI(s,r),tI(s)})(e);return Object.keys(i()).forEach(function(r){return n.prototype[r]=function(){var s,o=(s=this.__kapsuleInstance)[r].apply(s,arguments);return o===this.__kapsuleInstance?this:o}}),n}var IDe=window.THREE?window.THREE:{Group:Br},KV=PDe(RDe,IDe.Group,!0);var QV={type:"change"},tG={type:"start"},nG={type:"end"},Aae=1e-6,ki={NONE:-1,ROTATE:0,ZOOM:1,PAN:2,TOUCH_ROTATE:3,TOUCH_ZOOM_PAN:4},iI=new Oe,Pm=new Oe,LDe=new re,rI=new re,JV=new re,Dx=new Gs,gae=new re,sI=new re,eG=new re,oI=new re,aI=class extends Ld{constructor(e,t=null){super(e,t),this.screen={left:0,top:0,width:0,height:0},this.rotateSpeed=1,this.zoomSpeed=1.2,this.panSpeed=.3,this.noRotate=!1,this.noZoom=!1,this.noPan=!1,this.staticMoving=!1,this.dynamicDampingFactor=.2,this.minDistance=0,this.maxDistance=1/0,this.minZoom=0,this.maxZoom=1/0,this.keys=["KeyA","KeyS","KeyD"],this.mouseButtons={LEFT:qa.ROTATE,MIDDLE:qa.DOLLY,RIGHT:qa.PAN},this.target=new re,this.state=ki.NONE,this.keyState=ki.NONE,this._lastPosition=new re,this._lastZoom=1,this._touchZoomDistanceStart=0,this._touchZoomDistanceEnd=0,this._lastAngle=0,this._eye=new re,this._movePrev=new Oe,this._moveCurr=new Oe,this._lastAxis=new re,this._zoomStart=new Oe,this._zoomEnd=new Oe,this._panStart=new Oe,this._panEnd=new Oe,this._pointers=[],this._pointerPositions={},this._onPointerMove=NDe.bind(this),this._onPointerDown=DDe.bind(this),this._onPointerUp=FDe.bind(this),this._onPointerCancel=BDe.bind(this),this._onContextMenu=qDe.bind(this),this._onMouseWheel=GDe.bind(this),this._onKeyDown=UDe.bind(this),this._onKeyUp=ODe.bind(this),this._onTouchStart=HDe.bind(this),this._onTouchMove=WDe.bind(this),this._onTouchEnd=jDe.bind(this),this._onMouseDown=kDe.bind(this),this._onMouseMove=zDe.bind(this),this._onMouseUp=VDe.bind(this),this._target0=this.target.clone(),this._position0=this.object.position.clone(),this._up0=this.object.up.clone(),this._zoom0=this.object.zoom,t!==null&&(this.connect(t),this.handleResize()),this.update()}connect(e){super.connect(e),window.addEventListener("keydown",this._onKeyDown),window.addEventListener("keyup",this._onKeyUp),this.domElement.addEventListener("pointerdown",this._onPointerDown),this.domElement.addEventListener("pointercancel",this._onPointerCancel),this.domElement.addEventListener("wheel",this._onMouseWheel,{passive:!1}),this.domElement.addEventListener("contextmenu",this._onContextMenu),this.domElement.style.touchAction="none"}disconnect(){window.removeEventListener("keydown",this._onKeyDown),window.removeEventListener("keyup",this._onKeyUp),this.domElement.removeEventListener("pointerdown",this._onPointerDown),this.domElement.ownerDocument.removeEventListener("pointermove",this._onPointerMove),this.domElement.ownerDocument.removeEventListener("pointerup",this._onPointerUp),this.domElement.removeEventListener("pointercancel",this._onPointerCancel),this.domElement.removeEventListener("wheel",this._onMouseWheel),this.domElement.removeEventListener("contextmenu",this._onContextMenu),this.domElement.style.touchAction=""}dispose(){this.disconnect()}handleResize(){let e=this.domElement.getBoundingClientRect(),t=this.domElement.ownerDocument.documentElement;this.screen.left=e.left+window.pageXOffset-t.clientLeft,this.screen.top=e.top+window.pageYOffset-t.clientTop,this.screen.width=e.width,this.screen.height=e.height}update(){this._eye.subVectors(this.object.position,this.target),this.noRotate||this._rotateCamera(),this.noZoom||this._zoomCamera(),this.noPan||this._panCamera(),this.object.position.addVectors(this.target,this._eye),this.object.isPerspectiveCamera?(this._checkDistances(),this.object.lookAt(this.target),this._lastPosition.distanceToSquared(this.object.position)>Aae&&(this.dispatchEvent(QV),this._lastPosition.copy(this.object.position))):this.object.isOrthographicCamera?(this.object.lookAt(this.target),(this._lastPosition.distanceToSquared(this.object.position)>Aae||this._lastZoom!==this.object.zoom)&&(this.dispatchEvent(QV),this._lastPosition.copy(this.object.position),this._lastZoom=this.object.zoom)):console.warn("THREE.TrackballControls: Unsupported camera type.")}reset(){this.state=ki.NONE,this.keyState=ki.NONE,this.target.copy(this._target0),this.object.position.copy(this._position0),this.object.up.copy(this._up0),this.object.zoom=this._zoom0,this.object.updateProjectionMatrix(),this._eye.subVectors(this.object.position,this.target),this.object.lookAt(this.target),this.dispatchEvent(QV),this._lastPosition.copy(this.object.position),this._lastZoom=this.object.zoom}_panCamera(){if(Pm.copy(this._panEnd).sub(this._panStart),Pm.lengthSq()){if(this.object.isOrthographicCamera){let e=(this.object.right-this.object.left)/this.object.zoom/this.domElement.clientWidth,t=(this.object.top-this.object.bottom)/this.object.zoom/this.domElement.clientWidth;Pm.x*=e,Pm.y*=t}Pm.multiplyScalar(this._eye.length()*this.panSpeed),rI.copy(this._eye).cross(this.object.up).setLength(Pm.x),rI.add(LDe.copy(this.object.up).setLength(Pm.y)),this.object.position.add(rI),this.target.add(rI),this.staticMoving?this._panStart.copy(this._panEnd):this._panStart.add(Pm.subVectors(this._panEnd,this._panStart).multiplyScalar(this.dynamicDampingFactor))}}_rotateCamera(){oI.set(this._moveCurr.x-this._movePrev.x,this._moveCurr.y-this._movePrev.y,0);let e=oI.length();e?(this._eye.copy(this.object.position).sub(this.target),gae.copy(this._eye).normalize(),sI.copy(this.object.up).normalize(),eG.crossVectors(sI,gae).normalize(),sI.setLength(this._moveCurr.y-this._movePrev.y),eG.setLength(this._moveCurr.x-this._movePrev.x),oI.copy(sI.add(eG)),JV.crossVectors(oI,this._eye).normalize(),e*=this.rotateSpeed,Dx.setFromAxisAngle(JV,e),this._eye.applyQuaternion(Dx),this.object.up.applyQuaternion(Dx),this._lastAxis.copy(JV),this._lastAngle=e):!this.staticMoving&&this._lastAngle&&(this._lastAngle*=Math.sqrt(1-this.dynamicDampingFactor),this._eye.copy(this.object.position).sub(this.target),Dx.setFromAxisAngle(this._lastAxis,this._lastAngle),this._eye.applyQuaternion(Dx),this.object.up.applyQuaternion(Dx)),this._movePrev.copy(this._moveCurr)}_zoomCamera(){let e;this.state===ki.TOUCH_ZOOM_PAN?(e=this._touchZoomDistanceStart/this._touchZoomDistanceEnd,this._touchZoomDistanceStart=this._touchZoomDistanceEnd,this.object.isPerspectiveCamera?this._eye.multiplyScalar(e):this.object.isOrthographicCamera?(this.object.zoom=Bu.clamp(this.object.zoom/e,this.minZoom,this.maxZoom),this._lastZoom!==this.object.zoom&&this.object.updateProjectionMatrix()):console.warn("THREE.TrackballControls: Unsupported camera type")):(e=1+(this._zoomEnd.y-this._zoomStart.y)*this.zoomSpeed,e!==1&&e>0&&(this.object.isPerspectiveCamera?this._eye.multiplyScalar(e):this.object.isOrthographicCamera?(this.object.zoom=Bu.clamp(this.object.zoom/e,this.minZoom,this.maxZoom),this._lastZoom!==this.object.zoom&&this.object.updateProjectionMatrix()):console.warn("THREE.TrackballControls: Unsupported camera type")),this.staticMoving?this._zoomStart.copy(this._zoomEnd):this._zoomStart.y+=(this._zoomEnd.y-this._zoomStart.y)*this.dynamicDampingFactor)}_getMouseOnScreen(e,t){return iI.set((e-this.screen.left)/this.screen.width,(t-this.screen.top)/this.screen.height),iI}_getMouseOnCircle(e,t){return iI.set((e-this.screen.width*.5-this.screen.left)/(this.screen.width*.5),(this.screen.height+2*(this.screen.top-t))/this.screen.width),iI}_addPointer(e){this._pointers.push(e)}_removePointer(e){delete this._pointerPositions[e.pointerId];for(let t=0;t<this._pointers.length;t++)if(this._pointers[t].pointerId==e.pointerId){this._pointers.splice(t,1);return}}_trackPointer(e){let t=this._pointerPositions[e.pointerId];t===void 0&&(t=new Oe,this._pointerPositions[e.pointerId]=t),t.set(e.pageX,e.pageY)}_getSecondPointerPosition(e){let t=e.pointerId===this._pointers[0].pointerId?this._pointers[1]:this._pointers[0];return this._pointerPositions[t.pointerId]}_checkDistances(){(!this.noZoom||!this.noPan)&&(this._eye.lengthSq()>this.maxDistance*this.maxDistance&&(this.object.position.addVectors(this.target,this._eye.setLength(this.maxDistance)),this._zoomStart.copy(this._zoomEnd)),this._eye.lengthSq()<this.minDistance*this.minDistance&&(this.object.position.addVectors(this.target,this._eye.setLength(this.minDistance)),this._zoomStart.copy(this._zoomEnd)))}};function DDe(i){this.enabled!==!1&&(this._pointers.length===0&&(this.domElement.setPointerCapture(i.pointerId),this.domElement.ownerDocument.addEventListener("pointermove",this._onPointerMove),this.domElement.ownerDocument.addEventListener("pointerup",this._onPointerUp)),this._addPointer(i),i.pointerType==="touch"?this._onTouchStart(i):this._onMouseDown(i))}function NDe(i){this.enabled!==!1&&(i.pointerType==="touch"?this._onTouchMove(i):this._onMouseMove(i))}function FDe(i){this.enabled!==!1&&(i.pointerType==="touch"?this._onTouchEnd(i):this._onMouseUp(),this._removePointer(i),this._pointers.length===0&&(this.domElement.releasePointerCapture(i.pointerId),this.domElement.ownerDocument.removeEventListener("pointermove",this._onPointerMove),this.domElement.ownerDocument.removeEventListener("pointerup",this._onPointerUp)))}function BDe(i){this._removePointer(i)}function ODe(){this.enabled!==!1&&(this.keyState=ki.NONE,window.addEventListener("keydown",this._onKeyDown))}function UDe(i){this.enabled!==!1&&(window.removeEventListener("keydown",this._onKeyDown),this.keyState===ki.NONE&&(i.code===this.keys[ki.ROTATE]&&!this.noRotate?this.keyState=ki.ROTATE:i.code===this.keys[ki.ZOOM]&&!this.noZoom?this.keyState=ki.ZOOM:i.code===this.keys[ki.PAN]&&!this.noPan&&(this.keyState=ki.PAN)))}function kDe(i){let e;switch(i.button){case 0:e=this.mouseButtons.LEFT;break;case 1:e=this.mouseButtons.MIDDLE;break;case 2:e=this.mouseButtons.RIGHT;break;default:e=-1}switch(e){case qa.DOLLY:this.state=ki.ZOOM;break;case qa.ROTATE:this.state=ki.ROTATE;break;case qa.PAN:this.state=ki.PAN;break;default:this.state=ki.NONE}let t=this.keyState!==ki.NONE?this.keyState:this.state;t===ki.ROTATE&&!this.noRotate?(this._moveCurr.copy(this._getMouseOnCircle(i.pageX,i.pageY)),this._movePrev.copy(this._moveCurr)):t===ki.ZOOM&&!this.noZoom?(this._zoomStart.copy(this._getMouseOnScreen(i.pageX,i.pageY)),this._zoomEnd.copy(this._zoomStart)):t===ki.PAN&&!this.noPan&&(this._panStart.copy(this._getMouseOnScreen(i.pageX,i.pageY)),this._panEnd.copy(this._panStart)),this.dispatchEvent(tG)}function zDe(i){let e=this.keyState!==ki.NONE?this.keyState:this.state;e===ki.ROTATE&&!this.noRotate?(this._movePrev.copy(this._moveCurr),this._moveCurr.copy(this._getMouseOnCircle(i.pageX,i.pageY))):e===ki.ZOOM&&!this.noZoom?this._zoomEnd.copy(this._getMouseOnScreen(i.pageX,i.pageY)):e===ki.PAN&&!this.noPan&&this._panEnd.copy(this._getMouseOnScreen(i.pageX,i.pageY))}function VDe(){this.state=ki.NONE,this.dispatchEvent(nG)}function GDe(i){if(this.enabled!==!1&&this.noZoom!==!0){switch(i.preventDefault(),i.deltaMode){case 2:this._zoomStart.y-=i.deltaY*.025;break;case 1:this._zoomStart.y-=i.deltaY*.01;break;default:this._zoomStart.y-=i.deltaY*25e-5;break}this.dispatchEvent(tG),this.dispatchEvent(nG)}}function qDe(i){this.enabled!==!1&&i.preventDefault()}function HDe(i){if(this._trackPointer(i),this._pointers.length===1)this.state=ki.TOUCH_ROTATE,this._moveCurr.copy(this._getMouseOnCircle(this._pointers[0].pageX,this._pointers[0].pageY)),this._movePrev.copy(this._moveCurr);else{this.state=ki.TOUCH_ZOOM_PAN;let e=this._pointers[0].pageX-this._pointers[1].pageX,t=this._pointers[0].pageY-this._pointers[1].pageY;this._touchZoomDistanceEnd=this._touchZoomDistanceStart=Math.sqrt(e*e+t*t);let n=(this._pointers[0].pageX+this._pointers[1].pageX)/2,r=(this._pointers[0].pageY+this._pointers[1].pageY)/2;this._panStart.copy(this._getMouseOnScreen(n,r)),this._panEnd.copy(this._panStart)}this.dispatchEvent(tG)}function WDe(i){if(this._trackPointer(i),this._pointers.length===1)this._movePrev.copy(this._moveCurr),this._moveCurr.copy(this._getMouseOnCircle(i.pageX,i.pageY));else{let e=this._getSecondPointerPosition(i),t=i.pageX-e.x,n=i.pageY-e.y;this._touchZoomDistanceEnd=Math.sqrt(t*t+n*n);let r=(i.pageX+e.x)/2,s=(i.pageY+e.y)/2;this._panEnd.copy(this._getMouseOnScreen(r,s))}}function jDe(i){switch(this._pointers.length){case 0:this.state=ki.NONE;break;case 1:this.state=ki.TOUCH_ROTATE,this._moveCurr.copy(this._getMouseOnCircle(i.pageX,i.pageY)),this._movePrev.copy(this._moveCurr);break;case 2:this.state=ki.TOUCH_ZOOM_PAN;for(let e=0;e<this._pointers.length;e++)if(this._pointers[e].pointerId!==i.pointerId){let t=this._pointerPositions[this._pointers[e].pointerId];this._moveCurr.copy(this._getMouseOnCircle(t.x,t.y)),this._movePrev.copy(this._moveCurr);break}break}this.dispatchEvent(nG)}var vae={type:"change"},rG={type:"start"},xae={type:"end"},lI=new Pd,_ae=new Na,XDe=Math.cos(70*Bu.DEG2RAD),ho=new re,Dl=2*Math.PI,dr={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_PAN:4,TOUCH_DOLLY_PAN:5,TOUCH_DOLLY_ROTATE:6},iG=1e-6,cI=class extends Ld{constructor(e,t=null){super(e,t),this.state=dr.NONE,this.target=new re,this.cursor=new re,this.minDistance=0,this.maxDistance=1/0,this.minZoom=0,this.maxZoom=1/0,this.minTargetRadius=0,this.maxTargetRadius=1/0,this.minPolarAngle=0,this.maxPolarAngle=Math.PI,this.minAzimuthAngle=-1/0,this.maxAzimuthAngle=1/0,this.enableDamping=!1,this.dampingFactor=.05,this.enableZoom=!0,this.zoomSpeed=1,this.enableRotate=!0,this.rotateSpeed=1,this.keyRotateSpeed=1,this.enablePan=!0,this.panSpeed=1,this.screenSpacePanning=!0,this.keyPanSpeed=7,this.zoomToCursor=!1,this.autoRotate=!1,this.autoRotateSpeed=2,this.keys={LEFT:"ArrowLeft",UP:"ArrowUp",RIGHT:"ArrowRight",BOTTOM:"ArrowDown"},this.mouseButtons={LEFT:qa.ROTATE,MIDDLE:qa.DOLLY,RIGHT:qa.PAN},this.touches={ONE:f0.ROTATE,TWO:f0.DOLLY_PAN},this.target0=this.target.clone(),this.position0=this.object.position.clone(),this.zoom0=this.object.zoom,this._cursorStyle="auto",this._domElementKeyEvents=null,this._lastPosition=new re,this._lastQuaternion=new Gs,this._lastTargetPosition=new re,this._quat=new Gs().setFromUnitVectors(e.up,new re(0,1,0)),this._quatInverse=this._quat.clone().invert(),this._spherical=new l_,this._sphericalDelta=new l_,this._scale=1,this._panOffset=new re,this._rotateStart=new Oe,this._rotateEnd=new Oe,this._rotateDelta=new Oe,this._panStart=new Oe,this._panEnd=new Oe,this._panDelta=new Oe,this._dollyStart=new Oe,this._dollyEnd=new Oe,this._dollyDelta=new Oe,this._dollyDirection=new re,this._mouse=new Oe,this._performCursorZoom=!1,this._pointers=[],this._pointerPositions={},this._controlActive=!1,this._onPointerMove=YDe.bind(this),this._onPointerDown=$De.bind(this),this._onPointerUp=ZDe.bind(this),this._onContextMenu=iNe.bind(this),this._onMouseWheel=JDe.bind(this),this._onKeyDown=eNe.bind(this),this._onTouchStart=tNe.bind(this),this._onTouchMove=nNe.bind(this),this._onMouseDown=KDe.bind(this),this._onMouseMove=QDe.bind(this),this._interceptControlDown=rNe.bind(this),this._interceptControlUp=sNe.bind(this),this.domElement!==null&&this.connect(this.domElement),this.update()}set cursorStyle(e){this._cursorStyle=e,e==="grab"?this.domElement.style.cursor="grab":this.domElement.style.cursor="auto"}get cursorStyle(){return this._cursorStyle}connect(e){super.connect(e),this.domElement.addEventListener("pointerdown",this._onPointerDown),this.domElement.addEventListener("pointercancel",this._onPointerUp),this.domElement.addEventListener("contextmenu",this._onContextMenu),this.domElement.addEventListener("wheel",this._onMouseWheel,{passive:!1}),this.domElement.getRootNode().addEventListener("keydown",this._interceptControlDown,{passive:!0,capture:!0}),this.domElement.style.touchAction="none"}disconnect(){this.domElement.removeEventListener("pointerdown",this._onPointerDown),this.domElement.ownerDocument.removeEventListener("pointermove",this._onPointerMove),this.domElement.ownerDocument.removeEventListener("pointerup",this._onPointerUp),this.domElement.removeEventListener("pointercancel",this._onPointerUp),this.domElement.removeEventListener("wheel",this._onMouseWheel),this.domElement.removeEventListener("contextmenu",this._onContextMenu),this.stopListenToKeyEvents(),this.domElement.getRootNode().removeEventListener("keydown",this._interceptControlDown,{capture:!0}),this.domElement.style.touchAction=""}dispose(){this.disconnect()}getPolarAngle(){return this._spherical.phi}getAzimuthalAngle(){return this._spherical.theta}getDistance(){return this.object.position.distanceTo(this.target)}listenToKeyEvents(e){e.addEventListener("keydown",this._onKeyDown),this._domElementKeyEvents=e}stopListenToKeyEvents(){this._domElementKeyEvents!==null&&(this._domElementKeyEvents.removeEventListener("keydown",this._onKeyDown),this._domElementKeyEvents=null)}saveState(){this.target0.copy(this.target),this.position0.copy(this.object.position),this.zoom0=this.object.zoom}reset(){this.target.copy(this.target0),this.object.position.copy(this.position0),this.object.zoom=this.zoom0,this.object.updateProjectionMatrix(),this.dispatchEvent(vae),this.update(),this.state=dr.NONE}pan(e,t){this._pan(e,t),this.update()}dollyIn(e){this._dollyIn(e),this.update()}dollyOut(e){this._dollyOut(e),this.update()}rotateLeft(e){this._rotateLeft(e),this.update()}rotateUp(e){this._rotateUp(e),this.update()}update(e=null){let t=this.object.position;ho.copy(t).sub(this.target),ho.applyQuaternion(this._quat),this._spherical.setFromVector3(ho),this.autoRotate&&this.state===dr.NONE&&this._rotateLeft(this._getAutoRotationAngle(e)),this.enableDamping?(this._spherical.theta+=this._sphericalDelta.theta*this.dampingFactor,this._spherical.phi+=this._sphericalDelta.phi*this.dampingFactor):(this._spherical.theta+=this._sphericalDelta.theta,this._spherical.phi+=this._sphericalDelta.phi);let n=this.minAzimuthAngle,r=this.maxAzimuthAngle;isFinite(n)&&isFinite(r)&&(n<-Math.PI?n+=Dl:n>Math.PI&&(n-=Dl),r<-Math.PI?r+=Dl:r>Math.PI&&(r-=Dl),n<=r?this._spherical.theta=Math.max(n,Math.min(r,this._spherical.theta)):this._spherical.theta=this._spherical.theta>(n+r)/2?Math.max(n,this._spherical.theta):Math.min(r,this._spherical.theta)),this._spherical.phi=Math.max(this.minPolarAngle,Math.min(this.maxPolarAngle,this._spherical.phi)),this._spherical.makeSafe(),this.enableDamping===!0?this.target.addScaledVector(this._panOffset,this.dampingFactor):this.target.add(this._panOffset),this.target.sub(this.cursor),this.target.clampLength(this.minTargetRadius,this.maxTargetRadius),this.target.add(this.cursor);let s=!1;if(this.zoomToCursor&&this._performCursorZoom||this.object.isOrthographicCamera)this._spherical.radius=this._clampDistance(this._spherical.radius);else{let o=this._spherical.radius;this._spherical.radius=this._clampDistance(this._spherical.radius*this._scale),s=o!=this._spherical.radius}if(ho.setFromSpherical(this._spherical),ho.applyQuaternion(this._quatInverse),t.copy(this.target).add(ho),this.object.lookAt(this.target),this.enableDamping===!0?(this._sphericalDelta.theta*=1-this.dampingFactor,this._sphericalDelta.phi*=1-this.dampingFactor,this._panOffset.multiplyScalar(1-this.dampingFactor)):(this._sphericalDelta.set(0,0,0),this._panOffset.set(0,0,0)),this.zoomToCursor&&this._performCursorZoom){let o=null;if(this.object.isPerspectiveCamera){let a=ho.length();o=this._clampDistance(a*this._scale);let l=a-o;this.object.position.addScaledVector(this._dollyDirection,l),this.object.updateMatrixWorld(),s=!!l}else if(this.object.isOrthographicCamera){let a=new re(this._mouse.x,this._mouse.y,0);a.unproject(this.object);let l=this.object.zoom;this.object.zoom=Math.max(this.minZoom,Math.min(this.maxZoom,this.object.zoom/this._scale)),this.object.updateProjectionMatrix(),s=l!==this.object.zoom;let c=new re(this._mouse.x,this._mouse.y,0);c.unproject(this.object),this.object.position.sub(c).add(a),this.object.updateMatrixWorld(),o=ho.length()}else console.warn("WARNING: OrbitControls.js encountered an unknown camera type - zoom to cursor disabled."),this.zoomToCursor=!1;o!==null&&(this.screenSpacePanning?this.target.set(0,0,-1).transformDirection(this.object.matrix).multiplyScalar(o).add(this.object.position):(lI.origin.copy(this.object.position),lI.direction.set(0,0,-1).transformDirection(this.object.matrix),Math.abs(this.object.up.dot(lI.direction))<XDe?this.object.lookAt(this.target):(_ae.setFromNormalAndCoplanarPoint(this.object.up,this.target),lI.intersectPlane(_ae,this.target))))}else if(this.object.isOrthographicCamera){let o=this.object.zoom;this.object.zoom=Math.max(this.minZoom,Math.min(this.maxZoom,this.object.zoom/this._scale)),o!==this.object.zoom&&(this.object.updateProjectionMatrix(),s=!0)}return this._scale=1,this._performCursorZoom=!1,s||this._lastPosition.distanceToSquared(this.object.position)>iG||8*(1-this._lastQuaternion.dot(this.object.quaternion))>iG||this._lastTargetPosition.distanceToSquared(this.target)>iG?(this.dispatchEvent(vae),this._lastPosition.copy(this.object.position),this._lastQuaternion.copy(this.object.quaternion),this._lastTargetPosition.copy(this.target),!0):!1}_getAutoRotationAngle(e){return e!==null?Dl/60*this.autoRotateSpeed*e:Dl/60/60*this.autoRotateSpeed}_getZoomScale(e){let t=Math.abs(e*.01);return Math.pow(.95,this.zoomSpeed*t)}_rotateLeft(e){this._sphericalDelta.theta-=e}_rotateUp(e){this._sphericalDelta.phi-=e}_panLeft(e,t){ho.setFromMatrixColumn(t,0),ho.multiplyScalar(-e),this._panOffset.add(ho)}_panUp(e,t){this.screenSpacePanning===!0?ho.setFromMatrixColumn(t,1):(ho.setFromMatrixColumn(t,0),ho.crossVectors(this.object.up,ho)),ho.multiplyScalar(e),this._panOffset.add(ho)}_pan(e,t){let n=this.domElement;if(this.object.isPerspectiveCamera){let r=this.object.position;ho.copy(r).sub(this.target);let s=ho.length();s*=Math.tan(this.object.fov/2*Math.PI/180),this._panLeft(2*e*s/n.clientHeight,this.object.matrix),this._panUp(2*t*s/n.clientHeight,this.object.matrix)}else this.object.isOrthographicCamera?(this._panLeft(e*(this.object.right-this.object.left)/this.object.zoom/n.clientWidth,this.object.matrix),this._panUp(t*(this.object.top-this.object.bottom)/this.object.zoom/n.clientHeight,this.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),this.enablePan=!1)}_dollyOut(e){this.object.isPerspectiveCamera||this.object.isOrthographicCamera?this._scale/=e:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),this.enableZoom=!1)}_dollyIn(e){this.object.isPerspectiveCamera||this.object.isOrthographicCamera?this._scale*=e:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),this.enableZoom=!1)}_updateZoomParameters(e,t){if(!this.zoomToCursor)return;this._performCursorZoom=!0;let n=this.domElement.getBoundingClientRect(),r=e-n.left,s=t-n.top,o=n.width,a=n.height;this._mouse.x=r/o*2-1,this._mouse.y=-(s/a)*2+1,this._dollyDirection.set(this._mouse.x,this._mouse.y,1).unproject(this.object).sub(this.object.position).normalize()}_clampDistance(e){return Math.max(this.minDistance,Math.min(this.maxDistance,e))}_handleMouseDownRotate(e){this._rotateStart.set(e.clientX,e.clientY)}_handleMouseDownDolly(e){this._updateZoomParameters(e.clientX,e.clientX),this._dollyStart.set(e.clientX,e.clientY)}_handleMouseDownPan(e){this._panStart.set(e.clientX,e.clientY)}_handleMouseMoveRotate(e){this._rotateEnd.set(e.clientX,e.clientY),this._rotateDelta.subVectors(this._rotateEnd,this._rotateStart).multiplyScalar(this.rotateSpeed);let t=this.domElement;this._rotateLeft(Dl*this._rotateDelta.x/t.clientHeight),this._rotateUp(Dl*this._rotateDelta.y/t.clientHeight),this._rotateStart.copy(this._rotateEnd),this.update()}_handleMouseMoveDolly(e){this._dollyEnd.set(e.clientX,e.clientY),this._dollyDelta.subVectors(this._dollyEnd,this._dollyStart),this._dollyDelta.y>0?this._dollyOut(this._getZoomScale(this._dollyDelta.y)):this._dollyDelta.y<0&&this._dollyIn(this._getZoomScale(this._dollyDelta.y)),this._dollyStart.copy(this._dollyEnd),this.update()}_handleMouseMovePan(e){this._panEnd.set(e.clientX,e.clientY),this._panDelta.subVectors(this._panEnd,this._panStart).multiplyScalar(this.panSpeed),this._pan(this._panDelta.x,this._panDelta.y),this._panStart.copy(this._panEnd),this.update()}_handleMouseWheel(e){this._updateZoomParameters(e.clientX,e.clientY),e.deltaY<0?this._dollyIn(this._getZoomScale(e.deltaY)):e.deltaY>0&&this._dollyOut(this._getZoomScale(e.deltaY)),this.update()}_handleKeyDown(e){let t=!1;switch(e.code){case this.keys.UP:e.ctrlKey||e.metaKey||e.shiftKey?this.enableRotate&&this._rotateUp(Dl*this.keyRotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(0,this.keyPanSpeed),t=!0;break;case this.keys.BOTTOM:e.ctrlKey||e.metaKey||e.shiftKey?this.enableRotate&&this._rotateUp(-Dl*this.keyRotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(0,-this.keyPanSpeed),t=!0;break;case this.keys.LEFT:e.ctrlKey||e.metaKey||e.shiftKey?this.enableRotate&&this._rotateLeft(Dl*this.keyRotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(this.keyPanSpeed,0),t=!0;break;case this.keys.RIGHT:e.ctrlKey||e.metaKey||e.shiftKey?this.enableRotate&&this._rotateLeft(-Dl*this.keyRotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(-this.keyPanSpeed,0),t=!0;break}t&&(e.preventDefault(),this.update())}_handleTouchStartRotate(e){if(this._pointers.length===1)this._rotateStart.set(e.pageX,e.pageY);else{let t=this._getSecondPointerPosition(e),n=.5*(e.pageX+t.x),r=.5*(e.pageY+t.y);this._rotateStart.set(n,r)}}_handleTouchStartPan(e){if(this._pointers.length===1)this._panStart.set(e.pageX,e.pageY);else{let t=this._getSecondPointerPosition(e),n=.5*(e.pageX+t.x),r=.5*(e.pageY+t.y);this._panStart.set(n,r)}}_handleTouchStartDolly(e){let t=this._getSecondPointerPosition(e),n=e.pageX-t.x,r=e.pageY-t.y,s=Math.sqrt(n*n+r*r);this._dollyStart.set(0,s)}_handleTouchStartDollyPan(e){this.enableZoom&&this._handleTouchStartDolly(e),this.enablePan&&this._handleTouchStartPan(e)}_handleTouchStartDollyRotate(e){this.enableZoom&&this._handleTouchStartDolly(e),this.enableRotate&&this._handleTouchStartRotate(e)}_handleTouchMoveRotate(e){if(this._pointers.length==1)this._rotateEnd.set(e.pageX,e.pageY);else{let n=this._getSecondPointerPosition(e),r=.5*(e.pageX+n.x),s=.5*(e.pageY+n.y);this._rotateEnd.set(r,s)}this._rotateDelta.subVectors(this._rotateEnd,this._rotateStart).multiplyScalar(this.rotateSpeed);let t=this.domElement;this._rotateLeft(Dl*this._rotateDelta.x/t.clientHeight),this._rotateUp(Dl*this._rotateDelta.y/t.clientHeight),this._rotateStart.copy(this._rotateEnd)}_handleTouchMovePan(e){if(this._pointers.length===1)this._panEnd.set(e.pageX,e.pageY);else{let t=this._getSecondPointerPosition(e),n=.5*(e.pageX+t.x),r=.5*(e.pageY+t.y);this._panEnd.set(n,r)}this._panDelta.subVectors(this._panEnd,this._panStart).multiplyScalar(this.panSpeed),this._pan(this._panDelta.x,this._panDelta.y),this._panStart.copy(this._panEnd)}_handleTouchMoveDolly(e){let t=this._getSecondPointerPosition(e),n=e.pageX-t.x,r=e.pageY-t.y,s=Math.sqrt(n*n+r*r);this._dollyEnd.set(0,s),this._dollyDelta.set(0,Math.pow(this._dollyEnd.y/this._dollyStart.y,this.zoomSpeed)),this._dollyOut(this._dollyDelta.y),this._dollyStart.copy(this._dollyEnd);let o=(e.pageX+t.x)*.5,a=(e.pageY+t.y)*.5;this._updateZoomParameters(o,a)}_handleTouchMoveDollyPan(e){this.enableZoom&&this._handleTouchMoveDolly(e),this.enablePan&&this._handleTouchMovePan(e)}_handleTouchMoveDollyRotate(e){this.enableZoom&&this._handleTouchMoveDolly(e),this.enableRotate&&this._handleTouchMoveRotate(e)}_addPointer(e){this._pointers.push(e.pointerId)}_removePointer(e){delete this._pointerPositions[e.pointerId];for(let t=0;t<this._pointers.length;t++)if(this._pointers[t]==e.pointerId){this._pointers.splice(t,1);return}}_isTrackingPointer(e){for(let t=0;t<this._pointers.length;t++)if(this._pointers[t]==e.pointerId)return!0;return!1}_trackPointer(e){let t=this._pointerPositions[e.pointerId];t===void 0&&(t=new Oe,this._pointerPositions[e.pointerId]=t),t.set(e.pageX,e.pageY)}_getSecondPointerPosition(e){let t=e.pointerId===this._pointers[0]?this._pointers[1]:this._pointers[0];return this._pointerPositions[t]}_customWheelEvent(e){let t=e.deltaMode,n={clientX:e.clientX,clientY:e.clientY,deltaY:e.deltaY};switch(t){case 1:n.deltaY*=16;break;case 2:n.deltaY*=100;break}return e.ctrlKey&&!this._controlActive&&(n.deltaY*=10),n}};function $De(i){this.enabled!==!1&&(this._pointers.length===0&&(this.domElement.setPointerCapture(i.pointerId),this.domElement.ownerDocument.addEventListener("pointermove",this._onPointerMove),this.domElement.ownerDocument.addEventListener("pointerup",this._onPointerUp)),!this._isTrackingPointer(i)&&(this._addPointer(i),i.pointerType==="touch"?this._onTouchStart(i):this._onMouseDown(i),this._cursorStyle==="grab"&&(this.domElement.style.cursor="grabbing")))}function YDe(i){this.enabled!==!1&&(i.pointerType==="touch"?this._onTouchMove(i):this._onMouseMove(i))}function ZDe(i){switch(this._removePointer(i),this._pointers.length){case 0:this.domElement.releasePointerCapture(i.pointerId),this.domElement.ownerDocument.removeEventListener("pointermove",this._onPointerMove),this.domElement.ownerDocument.removeEventListener("pointerup",this._onPointerUp),this.dispatchEvent(xae),this.state=dr.NONE,this._cursorStyle==="grab"&&(this.domElement.style.cursor="grab");break;case 1:let e=this._pointers[0],t=this._pointerPositions[e];this._onTouchStart({pointerId:e,pageX:t.x,pageY:t.y});break}}function KDe(i){let e;switch(i.button){case 0:e=this.mouseButtons.LEFT;break;case 1:e=this.mouseButtons.MIDDLE;break;case 2:e=this.mouseButtons.RIGHT;break;default:e=-1}switch(e){case qa.DOLLY:if(this.enableZoom===!1)return;this._handleMouseDownDolly(i),this.state=dr.DOLLY;break;case qa.ROTATE:if(i.ctrlKey||i.metaKey||i.shiftKey){if(this.enablePan===!1)return;this._handleMouseDownPan(i),this.state=dr.PAN}else{if(this.enableRotate===!1)return;this._handleMouseDownRotate(i),this.state=dr.ROTATE}break;case qa.PAN:if(i.ctrlKey||i.metaKey||i.shiftKey){if(this.enableRotate===!1)return;this._handleMouseDownRotate(i),this.state=dr.ROTATE}else{if(this.enablePan===!1)return;this._handleMouseDownPan(i),this.state=dr.PAN}break;default:this.state=dr.NONE}this.state!==dr.NONE&&this.dispatchEvent(rG)}function QDe(i){switch(this.state){case dr.ROTATE:if(this.enableRotate===!1)return;this._handleMouseMoveRotate(i);break;case dr.DOLLY:if(this.enableZoom===!1)return;this._handleMouseMoveDolly(i);break;case dr.PAN:if(this.enablePan===!1)return;this._handleMouseMovePan(i);break}}function JDe(i){this.enabled===!1||this.enableZoom===!1||this.state!==dr.NONE||(i.preventDefault(),this.dispatchEvent(rG),this._handleMouseWheel(this._customWheelEvent(i)),this.dispatchEvent(xae))}function eNe(i){this.enabled!==!1&&this._handleKeyDown(i)}function tNe(i){switch(this._trackPointer(i),this._pointers.length){case 1:switch(this.touches.ONE){case f0.ROTATE:if(this.enableRotate===!1)return;this._handleTouchStartRotate(i),this.state=dr.TOUCH_ROTATE;break;case f0.PAN:if(this.enablePan===!1)return;this._handleTouchStartPan(i),this.state=dr.TOUCH_PAN;break;default:this.state=dr.NONE}break;case 2:switch(this.touches.TWO){case f0.DOLLY_PAN:if(this.enableZoom===!1&&this.enablePan===!1)return;this._handleTouchStartDollyPan(i),this.state=dr.TOUCH_DOLLY_PAN;break;case f0.DOLLY_ROTATE:if(this.enableZoom===!1&&this.enableRotate===!1)return;this._handleTouchStartDollyRotate(i),this.state=dr.TOUCH_DOLLY_ROTATE;break;default:this.state=dr.NONE}break;default:this.state=dr.NONE}this.state!==dr.NONE&&this.dispatchEvent(rG)}function nNe(i){switch(this._trackPointer(i),this.state){case dr.TOUCH_ROTATE:if(this.enableRotate===!1)return;this._handleTouchMoveRotate(i),this.update();break;case dr.TOUCH_PAN:if(this.enablePan===!1)return;this._handleTouchMovePan(i),this.update();break;case dr.TOUCH_DOLLY_PAN:if(this.enableZoom===!1&&this.enablePan===!1)return;this._handleTouchMoveDollyPan(i),this.update();break;case dr.TOUCH_DOLLY_ROTATE:if(this.enableZoom===!1&&this.enableRotate===!1)return;this._handleTouchMoveDollyRotate(i),this.update();break;default:this.state=dr.NONE}}function iNe(i){this.enabled!==!1&&i.preventDefault()}function rNe(i){i.key==="Control"&&(this._controlActive=!0,this.domElement.getRootNode().addEventListener("keyup",this._interceptControlUp,{passive:!0,capture:!0}))}function sNe(i){i.key==="Control"&&(this._controlActive=!1,this.domElement.getRootNode().removeEventListener("keyup",this._interceptControlUp,{passive:!0,capture:!0}))}var oNe={type:"change"},yae=1e-6,bae=new Gs,uI=class extends Ld{constructor(e,t=null){super(e,t),this.movementSpeed=1,this.rollSpeed=.005,this.dragToLook=!1,this.autoForward=!1,this._moveState={up:0,down:0,left:0,right:0,forward:0,back:0,pitchUp:0,pitchDown:0,yawLeft:0,yawRight:0,rollLeft:0,rollRight:0},this._moveVector=new re(0,0,0),this._rotationVector=new re(0,0,0),this._lastQuaternion=new Gs,this._lastPosition=new re,this._status=0,this._onKeyDown=aNe.bind(this),this._onKeyUp=lNe.bind(this),this._onPointerMove=uNe.bind(this),this._onPointerDown=cNe.bind(this),this._onPointerUp=hNe.bind(this),this._onPointerCancel=fNe.bind(this),this._onContextMenu=dNe.bind(this),t!==null&&this.connect(t)}connect(e){super.connect(e),window.addEventListener("keydown",this._onKeyDown),window.addEventListener("keyup",this._onKeyUp),this.domElement.addEventListener("pointermove",this._onPointerMove),this.domElement.addEventListener("pointerdown",this._onPointerDown),this.domElement.addEventListener("pointerup",this._onPointerUp),this.domElement.addEventListener("pointercancel",this._onPointerCancel),this.domElement.addEventListener("contextmenu",this._onContextMenu),this.domElement.style.touchAction="none"}disconnect(){window.removeEventListener("keydown",this._onKeyDown),window.removeEventListener("keyup",this._onKeyUp),this.domElement.removeEventListener("pointermove",this._onPointerMove),this.domElement.removeEventListener("pointerdown",this._onPointerDown),this.domElement.removeEventListener("pointerup",this._onPointerUp),this.domElement.removeEventListener("pointercancel",this._onPointerCancel),this.domElement.removeEventListener("contextmenu",this._onContextMenu),this.domElement.style.touchAction=""}dispose(){this.disconnect()}update(e){if(this.enabled===!1)return;let t=this.object,n=e*this.movementSpeed,r=e*this.rollSpeed;t.translateX(this._moveVector.x*n),t.translateY(this._moveVector.y*n),t.translateZ(this._moveVector.z*n),bae.set(this._rotationVector.x*r,this._rotationVector.y*r,this._rotationVector.z*r,1).normalize(),t.quaternion.multiply(bae),(this._lastPosition.distanceToSquared(t.position)>yae||8*(1-this._lastQuaternion.dot(t.quaternion))>yae)&&(this.dispatchEvent(oNe),this._lastQuaternion.copy(t.quaternion),this._lastPosition.copy(t.position))}_updateMovementVector(){let e=this._moveState.forward||this.autoForward&&!this._moveState.back?1:0;this._moveVector.x=-this._moveState.left+this._moveState.right,this._moveVector.y=-this._moveState.down+this._moveState.up,this._moveVector.z=-e+this._moveState.back}_updateRotationVector(){this._rotationVector.x=-this._moveState.pitchDown+this._moveState.pitchUp,this._rotationVector.y=-this._moveState.yawRight+this._moveState.yawLeft,this._rotationVector.z=-this._moveState.rollRight+this._moveState.rollLeft}_getContainerDimensions(){return this.domElement!=document?{size:[this.domElement.offsetWidth,this.domElement.offsetHeight],offset:[this.domElement.offsetLeft,this.domElement.offsetTop]}:{size:[window.innerWidth,window.innerHeight],offset:[0,0]}}};function aNe(i){if(!(i.altKey||this.enabled===!1)){switch(i.code){case"ShiftLeft":case"ShiftRight":this.movementSpeedMultiplier=.1;break;case"KeyW":this._moveState.forward=1;break;case"KeyS":this._moveState.back=1;break;case"KeyA":this._moveState.left=1;break;case"KeyD":this._moveState.right=1;break;case"KeyR":this._moveState.up=1;break;case"KeyF":this._moveState.down=1;break;case"ArrowUp":this._moveState.pitchUp=1;break;case"ArrowDown":this._moveState.pitchDown=1;break;case"ArrowLeft":this._moveState.yawLeft=1;break;case"ArrowRight":this._moveState.yawRight=1;break;case"KeyQ":this._moveState.rollLeft=1;break;case"KeyE":this._moveState.rollRight=1;break}this._updateMovementVector(),this._updateRotationVector()}}function lNe(i){if(this.enabled!==!1){switch(i.code){case"ShiftLeft":case"ShiftRight":this.movementSpeedMultiplier=1;break;case"KeyW":this._moveState.forward=0;break;case"KeyS":this._moveState.back=0;break;case"KeyA":this._moveState.left=0;break;case"KeyD":this._moveState.right=0;break;case"KeyR":this._moveState.up=0;break;case"KeyF":this._moveState.down=0;break;case"ArrowUp":this._moveState.pitchUp=0;break;case"ArrowDown":this._moveState.pitchDown=0;break;case"ArrowLeft":this._moveState.yawLeft=0;break;case"ArrowRight":this._moveState.yawRight=0;break;case"KeyQ":this._moveState.rollLeft=0;break;case"KeyE":this._moveState.rollRight=0;break}this._updateMovementVector(),this._updateRotationVector()}}function cNe(i){if(this.enabled!==!1)if(this.dragToLook)this._status++;else{switch(i.button){case 0:this._moveState.forward=1;break;case 2:this._moveState.back=1;break}this._updateMovementVector()}}function uNe(i){if(this.enabled!==!1&&(!this.dragToLook||this._status>0)){let e=this._getContainerDimensions(),t=e.size[0]/2,n=e.size[1]/2;this._moveState.yawLeft=-(i.pageX-e.offset[0]-t)/t,this._moveState.pitchDown=(i.pageY-e.offset[1]-n)/n,this._updateRotationVector()}}function hNe(i){if(this.enabled!==!1){if(this.dragToLook)this._status--,this._moveState.yawLeft=this._moveState.pitchDown=0;else{switch(i.button){case 0:this._moveState.forward=0;break;case 2:this._moveState.back=0;break}this._updateMovementVector()}this._updateRotationVector()}}function fNe(){this.enabled!==!1&&(this.dragToLook?(this._status=0,this._moveState.yawLeft=this._moveState.pitchDown=0):(this._moveState.forward=0,this._moveState.back=0,this._updateMovementVector()),this._updateRotationVector())}function dNe(i){this.enabled!==!1&&i.preventDefault()}var wae={name:"CopyShader",uniforms:{tDiffuse:{value:null},opacity:{value:1}},vertexShader:`52365236 52375237 varying vec2 vUv;52385238 @@ -5255,8 +5255,8 @@ THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
52555255 gl_FragColor = opacity * texel;52565256 52575257 5258- }`};var ep=class{constructor(){this.isPass=!0,this.enabled=!0,this.needsSwap=!0,this.clear=!1,this.renderToScreen=!1}setSize(){}render(){console.error("THREE.Pass: .render() must be implemented in derived pass.")}dispose(){}},DDe=new Du(-1,1,1,-1,0,1),UV=class extends Xn{constructor(){super(),this.setAttribute("position",new Ln([-1,3,0,-1,-1,0,3,-1,0],3)),this.setAttribute("uv",new Ln([0,2,0,0,2,0],2))}},NDe=new UV,iP=class{constructor(e){this._mesh=new Hn(NDe,e)}dispose(){this._mesh.geometry.dispose()}render(e){e.render(this._mesh,DDe)}get material(){return this._mesh.material}set material(e){this._mesh.material=e}};var rP=class extends ep{constructor(e,t="tDiffuse"){super(),this.textureID=t,this.uniforms=null,this.material=null,e instanceof ds?(this.uniforms=e.uniforms,this.material=e):e&&(this.uniforms=lg.clone(e.uniforms),this.material=new ds({name:e.name!==void 0?e.name:"unspecified",defines:Object.assign({},e.defines),uniforms:this.uniforms,vertexShader:e.vertexShader,fragmentShader:e.fragmentShader})),this._fsQuad=new iP(this.material)}render(e,t,n){this.uniforms[this.textureID]&&(this.uniforms[this.textureID].value=n.texture),this._fsQuad.material=this.material,this.renderToScreen?(e.setRenderTarget(null),this._fsQuad.render(e)):(e.setRenderTarget(t),this.clear&&e.clear(e.autoClearColor,e.autoClearDepth,e.autoClearStencil),this._fsQuad.render(e))}dispose(){this.material.dispose(),this._fsQuad.dispose()}};var OS=class extends ep{constructor(e,t){super(),this.scene=e,this.camera=t,this.clear=!0,this.needsSwap=!1,this.inverse=!1}render(e,t,n){let r=e.getContext(),s=e.state;s.buffers.color.setMask(!1),s.buffers.depth.setMask(!1),s.buffers.color.setLocked(!0),s.buffers.depth.setLocked(!0);let o,a;this.inverse?(o=0,a=1):(o=1,a=0),s.buffers.stencil.setTest(!0),s.buffers.stencil.setOp(r.REPLACE,r.REPLACE,r.REPLACE),s.buffers.stencil.setFunc(r.ALWAYS,o,4294967295),s.buffers.stencil.setClear(a),s.buffers.stencil.setLocked(!0),e.setRenderTarget(n),this.clear&&e.clear(),e.render(this.scene,this.camera),e.setRenderTarget(t),this.clear&&e.clear(),e.render(this.scene,this.camera),s.buffers.color.setLocked(!1),s.buffers.depth.setLocked(!1),s.buffers.color.setMask(!0),s.buffers.depth.setMask(!0),s.buffers.stencil.setLocked(!1),s.buffers.stencil.setFunc(r.EQUAL,1,4294967295),s.buffers.stencil.setOp(r.KEEP,r.KEEP,r.KEEP),s.buffers.stencil.setLocked(!0)}},sP=class extends ep{constructor(){super(),this.needsSwap=!1}render(e){e.state.buffers.stencil.setLocked(!1),e.state.buffers.stencil.setTest(!1)}};var oP=class{constructor(e,t){if(this.renderer=e,this._pixelRatio=e.getPixelRatio(),t===void 0){let n=e.getSize(new Oe);this._width=n.width,this._height=n.height,t=new Ba(this._width*this._pixelRatio,this._height*this._pixelRatio,{type:Wi}),t.texture.name="EffectComposer.rt1"}else this._width=t.width,this._height=t.height;this.renderTarget1=t,this.renderTarget2=t.clone(),this.renderTarget2.texture.name="EffectComposer.rt2",this.writeBuffer=this.renderTarget1,this.readBuffer=this.renderTarget2,this.renderToScreen=!0,this.passes=[],this.copyPass=new rP(Qoe),this.copyPass.material.blending=ps,this.timer=new YA}swapBuffers(){let e=this.readBuffer;this.readBuffer=this.writeBuffer,this.writeBuffer=e}addPass(e){this.passes.push(e),e.setSize(this._width*this._pixelRatio,this._height*this._pixelRatio)}insertPass(e,t){this.passes.splice(t,0,e),e.setSize(this._width*this._pixelRatio,this._height*this._pixelRatio)}removePass(e){let t=this.passes.indexOf(e);t!==-1&&this.passes.splice(t,1)}isLastEnabledPass(e){for(let t=e+1;t<this.passes.length;t++)if(this.passes[t].enabled)return!1;return!0}render(e){this.timer.update(),e===void 0&&(e=this.timer.getDelta());let t=this.renderer.getRenderTarget(),n=!1;for(let r=0,s=this.passes.length;r<s;r++){let o=this.passes[r];if(o.enabled!==!1){if(o.renderToScreen=this.renderToScreen&&this.isLastEnabledPass(r),o.render(this.renderer,this.writeBuffer,this.readBuffer,e,n),o.needsSwap){if(n){let a=this.renderer.getContext(),l=this.renderer.state.buffers.stencil;l.setFunc(a.NOTEQUAL,1,4294967295),this.copyPass.render(this.renderer,this.writeBuffer,this.readBuffer,e),l.setFunc(a.EQUAL,1,4294967295)}this.swapBuffers()}OS!==void 0&&(o instanceof OS?n=!0:o instanceof sP&&(n=!1))}}this.renderer.setRenderTarget(t)}reset(e){if(e===void 0){let t=this.renderer.getSize(new Oe);this._pixelRatio=this.renderer.getPixelRatio(),this._width=t.width,this._height=t.height,e=this.renderTarget1.clone(),e.setSize(this._width*this._pixelRatio,this._height*this._pixelRatio)}this.renderTarget1.dispose(),this.renderTarget2.dispose(),this.renderTarget1=e,this.renderTarget2=e.clone(),this.writeBuffer=this.renderTarget1,this.readBuffer=this.renderTarget2}setSize(e,t){this._width=e,this._height=t;let n=this._width*this._pixelRatio,r=this._height*this._pixelRatio;this.renderTarget1.setSize(n,r),this.renderTarget2.setSize(n,r);for(let s=0;s<this.passes.length;s++)this.passes[s].setSize(n,r)}setPixelRatio(e){this._pixelRatio=e,this.setSize(this._width,this._height)}dispose(){this.renderTarget1.dispose(),this.renderTarget2.dispose(),this.copyPass.dispose()}};var aP=class extends ep{constructor(e,t,n=null,r=null,s=null){super(),this.scene=e,this.camera=t,this.overrideMaterial=n,this.clearColor=r,this.clearAlpha=s,this.clear=!0,this.clearDepth=!1,this.needsSwap=!1,this.isRenderPass=!0,this._oldClearColor=new zt}render(e,t,n){let r=e.autoClear;e.autoClear=!1;let s,o;this.overrideMaterial!==null&&(o=this.scene.overrideMaterial,this.scene.overrideMaterial=this.overrideMaterial),this.clearColor!==null&&(e.getClearColor(this._oldClearColor),e.setClearColor(this.clearColor,e.getClearAlpha())),this.clearAlpha!==null&&(s=e.getClearAlpha(),e.setClearAlpha(this.clearAlpha)),this.clearDepth==!0&&e.clearDepth(),e.setRenderTarget(this.renderToScreen?null:n),this.clear===!0&&e.clear(e.autoClearColor,e.autoClearDepth,e.autoClearStencil),e.render(this.scene,this.camera),this.clearColor!==null&&e.setClearColor(this._oldClearColor),this.clearAlpha!==null&&e.setClearAlpha(s),this.overrideMaterial!==null&&(this.scene.overrideMaterial=o),e.autoClear=r}};function nl(){return nl=Object.assign?Object.assign.bind():function(i){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var n in t)({}).hasOwnProperty.call(t,n)&&(i[n]=t[n])}return i},nl.apply(null,arguments)}function Joe(i){if(i===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return i}function Mm(i,e){return Mm=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,n){return t.__proto__=n,t},Mm(i,e)}function eae(i,e){i.prototype=Object.create(e.prototype),i.prototype.constructor=i,Mm(i,e)}function lP(i){return lP=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},lP(i)}function tae(i){try{return Function.toString.call(i).indexOf("[native code]")!==-1}catch{return typeof i=="function"}}function kV(){try{var i=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(kV=function(){return!!i})()}function nae(i,e,t){if(kV())return Reflect.construct.apply(null,arguments);var n=[null];n.push.apply(n,e);var r=new(i.bind.apply(i,n));return t&&Mm(r,t.prototype),r}function cP(i){var e=typeof Map=="function"?new Map:void 0;return cP=function(n){if(n===null||!tae(n))return n;if(typeof n!="function")throw new TypeError("Super expression must either be null or a function");if(e!==void 0){if(e.has(n))return e.get(n);e.set(n,r)}function r(){return nae(n,arguments,lP(this).constructor)}return r.prototype=Object.create(n.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),Mm(r,n)},cP(i)}var Dl=(function(i){eae(e,i);function e(t){var n;if(1)n=i.call(this,"An error occurred. See https://github.com/styled-components/polished/blob/main/src/internalHelpers/errors.md#"+t+" for more information.")||this;else for(var r,s,o;o<r;o++);return Joe(n)}return e})(cP(Error));function iae(i,e){return i.substr(-e.length)===e}var FDe=/^([+-]?(?:\d+|\d*\.\d+))([a-z]*|%)$/;function rae(i){if(typeof i!="string")return i;var e=i.match(FDe);return e?parseFloat(i):i}var BDe=function(e){return function(t,n){n===void 0&&(n="16px");var r=t,s=n;if(typeof t=="string"){if(!iae(t,"px"))throw new Dl(69,e,t);r=rae(t)}if(typeof n=="string"){if(!iae(n,"px"))throw new Dl(70,e,n);s=rae(n)}if(typeof r=="string")throw new Dl(71,t,e);if(typeof s=="string")throw new Dl(72,n,e);return""+r/s+e}},oae=BDe,Yvt=oae("em");var Zvt=oae("rem");function zV(i){return Math.round(i*255)}function ODe(i,e,t){return zV(i)+","+zV(e)+","+zV(t)}function US(i,e,t,n){if(n===void 0&&(n=ODe),e===0)return n(t,t,t);var r=(i%360+360)%360/60,s=(1-Math.abs(2*t-1))*e,o=s*(1-Math.abs(r%2-1)),a=0,l=0,c=0;r>=0&&r<1?(a=s,l=o):r>=1&&r<2?(a=o,l=s):r>=2&&r<3?(l=s,c=o):r>=3&&r<4?(l=o,c=s):r>=4&&r<5?(a=o,c=s):r>=5&&r<6&&(a=s,c=o);var u=t-s/2,f=a+u,d=l+u,A=c+u;return n(f,d,A)}var sae={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"00ffff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000",blanchedalmond:"ffebcd",blue:"0000ff",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"00ffff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkgrey:"a9a9a9",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkslategrey:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dimgrey:"696969",dodgerblue:"1e90ff",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"ff00ff",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",grey:"808080",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgray:"d3d3d3",lightgreen:"90ee90",lightgrey:"d3d3d3",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslategray:"789",lightslategrey:"789",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"0f0",limegreen:"32cd32",linen:"faf0e6",magenta:"f0f",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370db",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"db7093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",rebeccapurple:"639",red:"f00",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",slategrey:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",wheat:"f5deb3",white:"fff",whitesmoke:"f5f5f5",yellow:"ff0",yellowgreen:"9acd32"};function UDe(i){if(typeof i!="string")return i;var e=i.toLowerCase();return sae[e]?"#"+sae[e]:i}var kDe=/^#[a-fA-F0-9]{6}$/,zDe=/^#[a-fA-F0-9]{8}$/,VDe=/^#[a-fA-F0-9]{3}$/,GDe=/^#[a-fA-F0-9]{4}$/,VV=/^rgb\(\s*(\d{1,3})\s*(?:,)?\s*(\d{1,3})\s*(?:,)?\s*(\d{1,3})\s*\)$/i,qDe=/^rgb(?:a)?\(\s*(\d{1,3})\s*(?:,)?\s*(\d{1,3})\s*(?:,)?\s*(\d{1,3})\s*(?:,|\/)\s*([-+]?\d*[.]?\d+[%]?)\s*\)$/i,HDe=/^hsl\(\s*(\d{0,3}[.]?[0-9]+(?:deg)?)\s*(?:,)?\s*(\d{1,3}[.]?[0-9]?)%\s*(?:,)?\s*(\d{1,3}[.]?[0-9]?)%\s*\)$/i,WDe=/^hsl(?:a)?\(\s*(\d{0,3}[.]?[0-9]+(?:deg)?)\s*(?:,)?\s*(\d{1,3}[.]?[0-9]?)%\s*(?:,)?\s*(\d{1,3}[.]?[0-9]?)%\s*(?:,|\/)\s*([-+]?\d*[.]?\d+[%]?)\s*\)$/i;function Cm(i){if(typeof i!="string")throw new Dl(3);var e=UDe(i);if(e.match(kDe))return{red:parseInt(""+e[1]+e[2],16),green:parseInt(""+e[3]+e[4],16),blue:parseInt(""+e[5]+e[6],16)};if(e.match(zDe)){var t=parseFloat((parseInt(""+e[7]+e[8],16)/255).toFixed(2));return{red:parseInt(""+e[1]+e[2],16),green:parseInt(""+e[3]+e[4],16),blue:parseInt(""+e[5]+e[6],16),alpha:t}}if(e.match(VDe))return{red:parseInt(""+e[1]+e[1],16),green:parseInt(""+e[2]+e[2],16),blue:parseInt(""+e[3]+e[3],16)};if(e.match(GDe)){var n=parseFloat((parseInt(""+e[4]+e[4],16)/255).toFixed(2));return{red:parseInt(""+e[1]+e[1],16),green:parseInt(""+e[2]+e[2],16),blue:parseInt(""+e[3]+e[3],16),alpha:n}}var r=VV.exec(e);if(r)return{red:parseInt(""+r[1],10),green:parseInt(""+r[2],10),blue:parseInt(""+r[3],10)};var s=qDe.exec(e.substring(0,50));if(s)return{red:parseInt(""+s[1],10),green:parseInt(""+s[2],10),blue:parseInt(""+s[3],10),alpha:parseFloat(""+s[4])>1?parseFloat(""+s[4])/100:parseFloat(""+s[4])};var o=HDe.exec(e);if(o){var a=parseInt(""+o[1],10),l=parseInt(""+o[2],10)/100,c=parseInt(""+o[3],10)/100,u="rgb("+US(a,l,c)+")",f=VV.exec(u);if(!f)throw new Dl(4,e,u);return{red:parseInt(""+f[1],10),green:parseInt(""+f[2],10),blue:parseInt(""+f[3],10)}}var d=WDe.exec(e.substring(0,50));if(d){var A=parseInt(""+d[1],10),y=parseInt(""+d[2],10)/100,w=parseInt(""+d[3],10)/100,S="rgb("+US(A,y,w)+")",T=VV.exec(S);if(!T)throw new Dl(4,e,S);return{red:parseInt(""+T[1],10),green:parseInt(""+T[2],10),blue:parseInt(""+T[3],10),alpha:parseFloat(""+d[4])>1?parseFloat(""+d[4])/100:parseFloat(""+d[4])}}throw new Dl(5)}function jDe(i){var e=i.red/255,t=i.green/255,n=i.blue/255,r=Math.max(e,t,n),s=Math.min(e,t,n),o=(r+s)/2;if(r===s)return i.alpha!==void 0?{hue:0,saturation:0,lightness:o,alpha:i.alpha}:{hue:0,saturation:0,lightness:o};var a,l=r-s,c=o>.5?l/(2-r-s):l/(r+s);switch(r){case e:a=(t-n)/l+(t<n?6:0);break;case t:a=(n-e)/l+2;break;default:a=(e-t)/l+4;break}return a*=60,i.alpha!==void 0?{hue:a,saturation:c,lightness:o,alpha:i.alpha}:{hue:a,saturation:c,lightness:o}}function Rm(i){return jDe(Cm(i))}var XDe=function(e){return e.length===7&&e[1]===e[2]&&e[3]===e[4]&&e[5]===e[6]?"#"+e[1]+e[3]+e[5]:e},qV=XDe;function h1(i){var e=i.toString(16);return e.length===1?"0"+e:e}function GV(i){return h1(Math.round(i*255))}function $De(i,e,t){return qV("#"+GV(i)+GV(e)+GV(t))}function uP(i,e,t){return US(i,e,t,$De)}function YDe(i,e,t){if(typeof i=="number"&&typeof e=="number"&&typeof t=="number")return uP(i,e,t);if(typeof i=="object"&&e===void 0&&t===void 0)return uP(i.hue,i.saturation,i.lightness);throw new Dl(1)}function ZDe(i,e,t,n){if(typeof i=="number"&&typeof e=="number"&&typeof t=="number"&&typeof n=="number")return n>=1?uP(i,e,t):"rgba("+US(i,e,t)+","+n+")";if(typeof i=="object"&&e===void 0&&t===void 0&&n===void 0)return i.alpha>=1?uP(i.hue,i.saturation,i.lightness):"rgba("+US(i.hue,i.saturation,i.lightness)+","+i.alpha+")";throw new Dl(2)}function HV(i,e,t){if(typeof i=="number"&&typeof e=="number"&&typeof t=="number")return qV("#"+h1(i)+h1(e)+h1(t));if(typeof i=="object"&&e===void 0&&t===void 0)return qV("#"+h1(i.red)+h1(i.green)+h1(i.blue));throw new Dl(6)}function hP(i,e,t,n){if(typeof i=="string"&&typeof e=="number"){var r=Cm(i);return"rgba("+r.red+","+r.green+","+r.blue+","+e+")"}else{if(typeof i=="number"&&typeof e=="number"&&typeof t=="number"&&typeof n=="number")return n>=1?HV(i,e,t):"rgba("+i+","+e+","+t+","+n+")";if(typeof i=="object"&&e===void 0&&t===void 0&&n===void 0)return i.alpha>=1?HV(i.red,i.green,i.blue):"rgba("+i.red+","+i.green+","+i.blue+","+i.alpha+")"}throw new Dl(7)}var KDe=function(e){return typeof e.red=="number"&&typeof e.green=="number"&&typeof e.blue=="number"&&(typeof e.alpha!="number"||typeof e.alpha>"u")},QDe=function(e){return typeof e.red=="number"&&typeof e.green=="number"&&typeof e.blue=="number"&&typeof e.alpha=="number"},JDe=function(e){return typeof e.hue=="number"&&typeof e.saturation=="number"&&typeof e.lightness=="number"&&(typeof e.alpha!="number"||typeof e.alpha>"u")},eNe=function(e){return typeof e.hue=="number"&&typeof e.saturation=="number"&&typeof e.lightness=="number"&&typeof e.alpha=="number"};function Im(i){if(typeof i!="object")throw new Dl(8);if(QDe(i))return hP(i);if(KDe(i))return HV(i);if(eNe(i))return ZDe(i);if(JDe(i))return YDe(i);throw new Dl(8)}function aae(i,e,t){return function(){var r=t.concat(Array.prototype.slice.call(arguments));return r.length>=e?i.apply(this,r):aae(i,e,r)}}function pc(i){return aae(i,i.length,[])}function tNe(i,e){if(e==="transparent")return e;var t=Rm(e);return Im(nl({},t,{hue:t.hue+parseFloat(i)}))}var Kvt=pc(tNe);function Cx(i,e,t){return Math.max(i,Math.min(e,t))}function nNe(i,e){if(e==="transparent")return e;var t=Rm(e);return Im(nl({},t,{lightness:Cx(0,1,t.lightness-parseFloat(i))}))}var Qvt=pc(nNe);function iNe(i,e){if(e==="transparent")return e;var t=Rm(e);return Im(nl({},t,{saturation:Cx(0,1,t.saturation-parseFloat(i))}))}var Jvt=pc(iNe);function rNe(i,e){if(e==="transparent")return e;var t=Rm(e);return Im(nl({},t,{lightness:Cx(0,1,t.lightness+parseFloat(i))}))}var e_t=pc(rNe);function sNe(i,e,t){if(e==="transparent")return t;if(t==="transparent")return e;if(i===0)return t;var n=Cm(e),r=nl({},n,{alpha:typeof n.alpha=="number"?n.alpha:1}),s=Cm(t),o=nl({},s,{alpha:typeof s.alpha=="number"?s.alpha:1}),a=r.alpha-o.alpha,l=parseFloat(i)*2-1,c=l*a===-1?l:l+a,u=1+l*a,f=(c/u+1)/2,d=1-f,A={red:Math.floor(r.red*f+o.red*d),green:Math.floor(r.green*f+o.green*d),blue:Math.floor(r.blue*f+o.blue*d),alpha:r.alpha*parseFloat(i)+o.alpha*(1-parseFloat(i))};return hP(A)}var oNe=pc(sNe),lae=oNe;function aNe(i,e){if(e==="transparent")return e;var t=Cm(e),n=typeof t.alpha=="number"?t.alpha:1,r=nl({},t,{alpha:Cx(0,1,(n*100+parseFloat(i)*100)/100)});return hP(r)}var lNe=pc(aNe),cae=lNe;function cNe(i,e){if(e==="transparent")return e;var t=Rm(e);return Im(nl({},t,{saturation:Cx(0,1,t.saturation+parseFloat(i))}))}var t_t=pc(cNe);function uNe(i,e){return e==="transparent"?e:Im(nl({},Rm(e),{hue:parseFloat(i)}))}var n_t=pc(uNe);function hNe(i,e){return e==="transparent"?e:Im(nl({},Rm(e),{lightness:parseFloat(i)}))}var i_t=pc(hNe);function fNe(i,e){return e==="transparent"?e:Im(nl({},Rm(e),{saturation:parseFloat(i)}))}var r_t=pc(fNe);function dNe(i,e){return e==="transparent"?e:lae(parseFloat(i),"rgb(0, 0, 0)",e)}var s_t=pc(dNe);function pNe(i,e){return e==="transparent"?e:lae(parseFloat(i),"rgb(255, 255, 255)",e)}var o_t=pc(pNe);function mNe(i,e){if(e==="transparent")return e;var t=Cm(e),n=typeof t.alpha=="number"?t.alpha:1,r=nl({},t,{alpha:Cx(0,1,+(n*100-parseFloat(i)*100).toFixed(2)/100)});return hP(r)}var a_t=pc(mNe);var fP="http://www.w3.org/1999/xhtml",WV={svg:"http://www.w3.org/2000/svg",xhtml:fP,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function dP(i){var e=i+="",t=e.indexOf(":");return t>=0&&(e=i.slice(0,t))!=="xmlns"&&(i=i.slice(t+1)),WV.hasOwnProperty(e)?{space:WV[e],local:i}:i}function ANe(i){return function(){var e=this.ownerDocument,t=this.namespaceURI;return t===fP&&e.documentElement.namespaceURI===fP?e.createElement(i):e.createElementNS(t,i)}}function gNe(i){return function(){return this.ownerDocument.createElementNS(i.space,i.local)}}function pP(i){var e=dP(i);return(e.local?gNe:ANe)(e)}function vNe(){}function mP(i){return i==null?vNe:function(){return this.querySelector(i)}}function uae(i){typeof i!="function"&&(i=mP(i));for(var e=this._groups,t=e.length,n=new Array(t),r=0;r<t;++r)for(var s=e[r],o=s.length,a=n[r]=new Array(o),l,c,u=0;u<o;++u)(l=s[u])&&(c=i.call(l,l.__data__,u,s))&&("__data__"in l&&(c.__data__=l.__data__),a[u]=c);return new ys(n,this._parents)}function jV(i){return i==null?[]:Array.isArray(i)?i:Array.from(i)}function _Ne(){return[]}function hae(i){return i==null?_Ne:function(){return this.querySelectorAll(i)}}function xNe(i){return function(){return jV(i.apply(this,arguments))}}function fae(i){typeof i=="function"?i=xNe(i):i=hae(i);for(var e=this._groups,t=e.length,n=[],r=[],s=0;s<t;++s)for(var o=e[s],a=o.length,l,c=0;c<a;++c)(l=o[c])&&(n.push(i.call(l,l.__data__,c,o)),r.push(l));return new ys(n,r)}function dae(i){return function(){return this.matches(i)}}function AP(i){return function(e){return e.matches(i)}}var yNe=Array.prototype.find;function bNe(i){return function(){return yNe.call(this.children,i)}}function wNe(){return this.firstElementChild}function pae(i){return this.select(i==null?wNe:bNe(typeof i=="function"?i:AP(i)))}var SNe=Array.prototype.filter;function TNe(){return Array.from(this.children)}function ENe(i){return function(){return SNe.call(this.children,i)}}function mae(i){return this.selectAll(i==null?TNe:ENe(typeof i=="function"?i:AP(i)))}function Aae(i){typeof i!="function"&&(i=dae(i));for(var e=this._groups,t=e.length,n=new Array(t),r=0;r<t;++r)for(var s=e[r],o=s.length,a=n[r]=[],l,c=0;c<o;++c)(l=s[c])&&i.call(l,l.__data__,c,s)&&a.push(l);return new ys(n,this._parents)}function gP(i){return new Array(i.length)}function gae(){return new ys(this._enter||this._groups.map(gP),this._parents)}function kS(i,e){this.ownerDocument=i.ownerDocument,this.namespaceURI=i.namespaceURI,this._next=null,this._parent=i,this.__data__=e}kS.prototype={constructor:kS,appendChild:function(i){return this._parent.insertBefore(i,this._next)},insertBefore:function(i,e){return this._parent.insertBefore(i,e)},querySelector:function(i){return this._parent.querySelector(i)},querySelectorAll:function(i){return this._parent.querySelectorAll(i)}};function vae(i){return function(){return i}}function MNe(i,e,t,n,r,s){for(var o=0,a,l=e.length,c=s.length;o<c;++o)(a=e[o])?(a.__data__=s[o],n[o]=a):t[o]=new kS(i,s[o]);for(;o<l;++o)(a=e[o])&&(r[o]=a)}function CNe(i,e,t,n,r,s,o){var a,l,c=new Map,u=e.length,f=s.length,d=new Array(u),A;for(a=0;a<u;++a)(l=e[a])&&(d[a]=A=o.call(l,l.__data__,a,e)+"",c.has(A)?r[a]=l:c.set(A,l));for(a=0;a<f;++a)A=o.call(i,s[a],a,s)+"",(l=c.get(A))?(n[a]=l,l.__data__=s[a],c.delete(A)):t[a]=new kS(i,s[a]);for(a=0;a<u;++a)(l=e[a])&&c.get(d[a])===l&&(r[a]=l)}function RNe(i){return i.__data__}function _ae(i,e){if(!arguments.length)return Array.from(this,RNe);var t=e?CNe:MNe,n=this._parents,r=this._groups;typeof i!="function"&&(i=vae(i));for(var s=r.length,o=new Array(s),a=new Array(s),l=new Array(s),c=0;c<s;++c){var u=n[c],f=r[c],d=f.length,A=INe(i.call(u,u&&u.__data__,c,n)),y=A.length,w=a[c]=new Array(y),S=o[c]=new Array(y),T=l[c]=new Array(d);t(u,f,w,S,T,A,e);for(var R=0,P=0,I,F;R<y;++R)if(I=w[R]){for(R>=P&&(P=R+1);!(F=S[P])&&++P<y;);I._next=F||null}}return o=new ys(o,n),o._enter=a,o._exit=l,o}function INe(i){return typeof i=="object"&&"length"in i?i:Array.from(i)}function xae(){return new ys(this._exit||this._groups.map(gP),this._parents)}function yae(i,e,t){var n=this.enter(),r=this,s=this.exit();return typeof i=="function"?(n=i(n),n&&(n=n.selection())):n=n.append(i+""),e!=null&&(r=e(r),r&&(r=r.selection())),t==null?s.remove():t(s),n&&r?n.merge(r).order():r}function bae(i){for(var e=i.selection?i.selection():i,t=this._groups,n=e._groups,r=t.length,s=n.length,o=Math.min(r,s),a=new Array(r),l=0;l<o;++l)for(var c=t[l],u=n[l],f=c.length,d=a[l]=new Array(f),A,y=0;y<f;++y)(A=c[y]||u[y])&&(d[y]=A);for(;l<r;++l)a[l]=t[l];return new ys(a,this._parents)}function wae(){for(var i=this._groups,e=-1,t=i.length;++e<t;)for(var n=i[e],r=n.length-1,s=n[r],o;--r>=0;)(o=n[r])&&(s&&o.compareDocumentPosition(s)^4&&s.parentNode.insertBefore(o,s),s=o);return this}function Sae(i){i||(i=PNe);function e(f,d){return f&&d?i(f.__data__,d.__data__):!f-!d}for(var t=this._groups,n=t.length,r=new Array(n),s=0;s<n;++s){for(var o=t[s],a=o.length,l=r[s]=new Array(a),c,u=0;u<a;++u)(c=o[u])&&(l[u]=c);l.sort(e)}return new ys(r,this._parents).order()}function PNe(i,e){return i<e?-1:i>e?1:i>=e?0:NaN}function Tae(){var i=arguments[0];return arguments[0]=this,i.apply(null,arguments),this}function Eae(){return Array.from(this)}function Mae(){for(var i=this._groups,e=0,t=i.length;e<t;++e)for(var n=i[e],r=0,s=n.length;r<s;++r){var o=n[r];if(o)return o}return null}function Cae(){let i=0;for(let e of this)++i;return i}function Rae(){return!this.node()}function Iae(i){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var r=e[t],s=0,o=r.length,a;s<o;++s)(a=r[s])&&i.call(a,a.__data__,s,r);return this}function LNe(i){return function(){this.removeAttribute(i)}}function DNe(i){return function(){this.removeAttributeNS(i.space,i.local)}}function NNe(i,e){return function(){this.setAttribute(i,e)}}function FNe(i,e){return function(){this.setAttributeNS(i.space,i.local,e)}}function BNe(i,e){return function(){var t=e.apply(this,arguments);t==null?this.removeAttribute(i):this.setAttribute(i,t)}}function ONe(i,e){return function(){var t=e.apply(this,arguments);t==null?this.removeAttributeNS(i.space,i.local):this.setAttributeNS(i.space,i.local,t)}}function Pae(i,e){var t=dP(i);if(arguments.length<2){var n=this.node();return t.local?n.getAttributeNS(t.space,t.local):n.getAttribute(t)}return this.each((e==null?t.local?DNe:LNe:typeof e=="function"?t.local?ONe:BNe:t.local?FNe:NNe)(t,e))}function vP(i){return i.ownerDocument&&i.ownerDocument.defaultView||i.document&&i||i.defaultView}function UNe(i){return function(){this.style.removeProperty(i)}}function kNe(i,e,t){return function(){this.style.setProperty(i,e,t)}}function zNe(i,e,t){return function(){var n=e.apply(this,arguments);n==null?this.style.removeProperty(i):this.style.setProperty(i,n,t)}}function Lae(i,e,t){return arguments.length>1?this.each((e==null?UNe:typeof e=="function"?zNe:kNe)(i,e,t??"")):VNe(this.node(),i)}function VNe(i,e){return i.style.getPropertyValue(e)||vP(i).getComputedStyle(i,null).getPropertyValue(e)}function GNe(i){return function(){delete this[i]}}function qNe(i,e){return function(){this[i]=e}}function HNe(i,e){return function(){var t=e.apply(this,arguments);t==null?delete this[i]:this[i]=t}}function Dae(i,e){return arguments.length>1?this.each((e==null?GNe:typeof e=="function"?HNe:qNe)(i,e)):this.node()[i]}function Nae(i){return i.trim().split(/^|\s+/)}function XV(i){return i.classList||new Fae(i)}function Fae(i){this._node=i,this._names=Nae(i.getAttribute("class")||"")}Fae.prototype={add:function(i){var e=this._names.indexOf(i);e<0&&(this._names.push(i),this._node.setAttribute("class",this._names.join(" ")))},remove:function(i){var e=this._names.indexOf(i);e>=0&&(this._names.splice(e,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(i){return this._names.indexOf(i)>=0}};function Bae(i,e){for(var t=XV(i),n=-1,r=e.length;++n<r;)t.add(e[n])}function Oae(i,e){for(var t=XV(i),n=-1,r=e.length;++n<r;)t.remove(e[n])}function WNe(i){return function(){Bae(this,i)}}function jNe(i){return function(){Oae(this,i)}}function XNe(i,e){return function(){(e.apply(this,arguments)?Bae:Oae)(this,i)}}function Uae(i,e){var t=Nae(i+"");if(arguments.length<2){for(var n=XV(this.node()),r=-1,s=t.length;++r<s;)if(!n.contains(t[r]))return!1;return!0}return this.each((typeof e=="function"?XNe:e?WNe:jNe)(t,e))}function $Ne(){this.textContent=""}function YNe(i){return function(){this.textContent=i}}function ZNe(i){return function(){var e=i.apply(this,arguments);this.textContent=e??""}}function kae(i){return arguments.length?this.each(i==null?$Ne:(typeof i=="function"?ZNe:YNe)(i)):this.node().textContent}function KNe(){this.innerHTML=""}function QNe(i){return function(){this.innerHTML=i}}function JNe(i){return function(){var e=i.apply(this,arguments);this.innerHTML=e??""}}function zae(i){return arguments.length?this.each(i==null?KNe:(typeof i=="function"?JNe:QNe)(i)):this.node().innerHTML}function e5e(){this.nextSibling&&this.parentNode.appendChild(this)}function Vae(){return this.each(e5e)}function t5e(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function Gae(){return this.each(t5e)}function qae(i){var e=typeof i=="function"?i:pP(i);return this.select(function(){return this.appendChild(e.apply(this,arguments))})}function n5e(){return null}function Hae(i,e){var t=typeof i=="function"?i:pP(i),n=e==null?n5e:typeof e=="function"?e:mP(e);return this.select(function(){return this.insertBefore(t.apply(this,arguments),n.apply(this,arguments)||null)})}function i5e(){var i=this.parentNode;i&&i.removeChild(this)}function Wae(){return this.each(i5e)}function r5e(){var i=this.cloneNode(!1),e=this.parentNode;return e?e.insertBefore(i,this.nextSibling):i}function s5e(){var i=this.cloneNode(!0),e=this.parentNode;return e?e.insertBefore(i,this.nextSibling):i}function jae(i){return this.select(i?s5e:r5e)}function Xae(i){return arguments.length?this.property("__data__",i):this.node().__data__}function o5e(i){return function(e){i.call(this,e,this.__data__)}}function a5e(i){return i.trim().split(/^|\s+/).map(function(e){var t="",n=e.indexOf(".");return n>=0&&(t=e.slice(n+1),e=e.slice(0,n)),{type:e,name:t}})}function l5e(i){return function(){var e=this.__on;if(e){for(var t=0,n=-1,r=e.length,s;t<r;++t)s=e[t],(!i.type||s.type===i.type)&&s.name===i.name?this.removeEventListener(s.type,s.listener,s.options):e[++n]=s;++n?e.length=n:delete this.__on}}}function c5e(i,e,t){return function(){var n=this.__on,r,s=o5e(e);if(n){for(var o=0,a=n.length;o<a;++o)if((r=n[o]).type===i.type&&r.name===i.name){this.removeEventListener(r.type,r.listener,r.options),this.addEventListener(r.type,r.listener=s,r.options=t),r.value=e;return}}this.addEventListener(i.type,s,t),r={type:i.type,name:i.name,value:e,listener:s,options:t},n?n.push(r):this.__on=[r]}}function $ae(i,e,t){var n=a5e(i+""),r,s=n.length,o;if(arguments.length<2){var a=this.node().__on;if(a){for(var l=0,c=a.length,u;l<c;++l)for(r=0,u=a[l];r<s;++r)if((o=n[r]).type===u.type&&o.name===u.name)return u.value}return}for(a=e?c5e:l5e,r=0;r<s;++r)this.each(a(n[r],e,t));return this}function Yae(i,e,t){var n=vP(i),r=n.CustomEvent;typeof r=="function"?r=new r(e,t):(r=n.document.createEvent("Event"),t?(r.initEvent(e,t.bubbles,t.cancelable),r.detail=t.detail):r.initEvent(e,!1,!1)),i.dispatchEvent(r)}function u5e(i,e){return function(){return Yae(this,i,e)}}function h5e(i,e){return function(){return Yae(this,i,e.apply(this,arguments))}}function Zae(i,e){return this.each((typeof e=="function"?h5e:u5e)(i,e))}function*Kae(){for(var i=this._groups,e=0,t=i.length;e<t;++e)for(var n=i[e],r=0,s=n.length,o;r<s;++r)(o=n[r])&&(yield o)}var $V=[null];function ys(i,e){this._groups=i,this._parents=e}function f5e(){return new ys([[document.documentElement]],$V)}function d5e(){return this}ys.prototype=f5e.prototype={constructor:ys,select:uae,selectAll:fae,selectChild:pae,selectChildren:mae,filter:Aae,data:_ae,enter:gae,exit:xae,join:yae,merge:bae,selection:d5e,order:wae,sort:Sae,call:Tae,nodes:Eae,node:Mae,size:Cae,empty:Rae,each:Iae,attr:Pae,style:Lae,property:Dae,classed:Uae,text:kae,html:zae,raise:Vae,lower:Gae,append:qae,insert:Hae,remove:Wae,clone:jae,datum:Xae,on:$ae,dispatch:Zae,[Symbol.iterator]:Kae};function YV(i){return typeof i=="string"?new ys([[document.querySelector(i)]],[document.documentElement]):new ys([[i]],$V)}function Qae(i){let e;for(;e=i.sourceEvent;)i=e;return i}function ZV(i,e){if(i=Qae(i),e===void 0&&(e=i.currentTarget),e){var t=e.ownerSVGElement||e;if(t.createSVGPoint){var n=t.createSVGPoint();return n.x=i.clientX,n.y=i.clientY,n=n.matrixTransform(e.getScreenCTM().inverse()),[n.x,n.y]}if(e.getBoundingClientRect){var r=e.getBoundingClientRect();return[i.clientX-r.left-e.clientLeft,i.clientY-r.top-e.clientTop]}}return[i.pageX,i.pageY]}var GS,Vr,ile,eG,Pm,Jae,rle,sle,KV,xP,zS,ole,tG,QV,JV,p5e,bP={},wP=[],m5e=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,TP=Array.isArray;function Bf(i,e){for(var t in e)i[t]=e[t];return i}function nG(i){i&&i.parentNode&&i.parentNode.removeChild(i)}function A5e(i,e,t){var n,r,s,o={};for(s in e)s=="key"?n=e[s]:s=="ref"?r=e[s]:o[s]=e[s];if(arguments.length>2&&(o.children=arguments.length>3?GS.call(arguments,2):t),typeof i=="function"&&i.defaultProps!=null)for(s in i.defaultProps)o[s]===void 0&&(o[s]=i.defaultProps[s]);return VS(i,o,n,r,null)}function VS(i,e,t,n,r){var s={type:i,props:e,key:t,ref:n,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:r??++ile,__i:-1,__u:0};return r==null&&Vr.vnode!=null&&Vr.vnode(s),s}function EP(i){return i.children}function yP(i,e){this.props=i,this.context=e}function f1(i,e){if(e==null)return i.__?f1(i.__,i.__i+1):null;for(var t;e<i.__k.length;e++)if((t=i.__k[e])!=null&&t.__e!=null)return t.__e;return typeof i.type=="function"?f1(i):null}function g5e(i){if(i.__P&&i.__d){var e=i.__v,t=e.__e,n=[],r=[],s=Bf({},e);s.__v=e.__v+1,Vr.vnode&&Vr.vnode(s),iG(i.__P,s,e,i.__n,i.__P.namespaceURI,32&e.__u?[t]:null,n,t??f1(e),!!(32&e.__u),r),s.__v=e.__v,s.__.__k[s.__i]=s,hle(n,s,r),e.__e=e.__=null,s.__e!=t&&ale(s)}}function ale(i){if((i=i.__)!=null&&i.__c!=null)return i.__e=i.__c.base=null,i.__k.some(function(e){if(e!=null&&e.__e!=null)return i.__e=i.__c.base=e.__e}),ale(i)}function ele(i){(!i.__d&&(i.__d=!0)&&Pm.push(i)&&!SP.__r++||Jae!=Vr.debounceRendering)&&((Jae=Vr.debounceRendering)||rle)(SP)}function SP(){try{for(var i,e=1;Pm.length;)Pm.length>e&&Pm.sort(sle),i=Pm.shift(),e=Pm.length,g5e(i)}finally{Pm.length=SP.__r=0}}function lle(i,e,t,n,r,s,o,a,l,c,u){var f,d,A,y,w,S,T=n&&n.__k||wP,R=e.length;for(l=v5e(t,e,T,l,R),f=0;f<R;f++)(A=t.__k[f])!=null&&(d=A.__i!=-1&&T[A.__i]||bP,A.__i=f,S=iG(i,A,d,r,s,o,a,l,c,u),y=A.__e,A.ref&&d.ref!=A.ref&&(d.ref&&rG(d.ref,null,A),u.push(A.ref,A.__c||y,A)),w==null&&y!=null&&(w=y),4&A.__u?(l=cle(A,l,i),d.__e&&(d.__e=null)):typeof A.type=="function"&&S!==void 0?l=S:y&&(l=y.nextSibling),A.__u&=-7);return t.__e=w,l}function v5e(i,e,t,n,r){var s,o,a,l,c,u=t.length,f=u,d=0;for(i.__k=new Array(r),s=0;s<r;s++)(o=e[s])!=null&&typeof o!="boolean"&&typeof o!="function"?(typeof o=="string"||typeof o=="number"||typeof o=="bigint"||o.constructor==String?o=i.__k[s]=VS(null,o,null,null,null):TP(o)?o=i.__k[s]=VS(EP,{children:o},null,null,null):o.constructor===void 0&&o.__b>0?o=i.__k[s]=VS(o.type,o.props,o.key,o.ref?o.ref:null,o.__v):i.__k[s]=o,l=s+d,o.__=i,o.__b=i.__b+1,a=null,(c=o.__i=_5e(o,t,l,f))!=-1&&(f--,(a=t[c])&&(a.__u|=2)),a==null||a.__v==null?(c==-1&&(r>u?d--:r<u&&d++),typeof o.type!="function"&&(o.__u|=4)):c!=l&&(c==l-1?d--:c==l+1?d++:(c>l?d--:d++,o.__u|=4))):i.__k[s]=null;if(f)for(s=0;s<u;s++)(a=t[s])!=null&&(2&a.__u)==0&&(a.__e==n&&(n=f1(a)),dle(a,a));return n}function cle(i,e,t){var n,r;if(typeof i.type=="function"){for(n=i.__k,r=0;n&&r<n.length;r++)n[r]&&(n[r].__=i,e=cle(n[r],e,t));return e}i.__e!=e&&(e&&i.type&&!e.parentNode&&(e=f1(i)),e=t.insertBefore(i.__e,e||null));do e=e&&e.nextSibling;while(e!=null&&e.nodeType==8);return e}function _5e(i,e,t,n){var r,s,o,a=i.key,l=i.type,c=e[t],u=c!=null&&(2&c.__u)==0;if(c===null&&a==null||u&&a==c.key&&l==c.type)return t;if(n>(u?1:0)){for(r=t-1,s=t+1;r>=0||s<e.length;)if((c=e[o=r>=0?r--:s++])!=null&&(2&c.__u)==0&&a==c.key&&l==c.type)return o}return-1}function tle(i,e,t){e[0]=="-"?i.setProperty(e,t??""):i[e]=t==null?"":typeof t!="number"||m5e.test(e)?t:t+"px"}function _P(i,e,t,n,r){var s,o;e:if(e=="style")if(typeof t=="string")i.style.cssText=t;else{if(typeof n=="string"&&(i.style.cssText=n=""),n)for(e in n)t&&e in t||tle(i.style,e,"");if(t)for(e in t)n&&t[e]==n[e]||tle(i.style,e,t[e])}else if(e[0]=="o"&&e[1]=="n")s=e!=(e=e.replace(ole,"$1")),o=e.toLowerCase(),e=o in i||e=="onFocusOut"||e=="onFocusIn"?o.slice(2):e.slice(2),i.l||(i.l={}),i.l[e+s]=t,t?n?t[zS]=n[zS]:(t[zS]=tG,i.addEventListener(e,s?JV:QV,s)):i.removeEventListener(e,s?JV:QV,s);else{if(r=="http://www.w3.org/2000/svg")e=e.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if(e!="width"&&e!="height"&&e!="href"&&e!="list"&&e!="form"&&e!="tabIndex"&&e!="download"&&e!="rowSpan"&&e!="colSpan"&&e!="role"&&e!="popover"&&e in i)try{i[e]=t??"";break e}catch{}typeof t=="function"||(t==null||t===!1&&e[4]!="-"?i.removeAttribute(e):i.setAttribute(e,e=="popover"&&t==1?"":t))}}function nle(i){return function(e){if(this.l){var t=this.l[e.type+i];if(e[xP]==null)e[xP]=tG++;else if(e[xP]<t[zS])return;return t(Vr.event?Vr.event(e):e)}}}function iG(i,e,t,n,r,s,o,a,l,c){var u,f,d,A,y,w,S,T,R,P,I,F,D,L,C,B,k=e.type;if(e.constructor!==void 0)return null;128&t.__u&&(l=!!(32&t.__u),s=[a=e.__e=t.__e]),(u=Vr.__b)&&u(e);e:if(typeof k=="function"){f=o.length;try{if(R=e.props,P=k.prototype&&k.prototype.render,I=(u=k.contextType)&&n[u.__c],F=u?I?I.props.value:u.__:n,t.__c?T=(d=e.__c=t.__c).__=d.__E:(P?e.__c=d=new k(R,F):(e.__c=d=new yP(R,F),d.constructor=k,d.render=y5e),I&&I.sub(d),d.state||(d.state={}),d.__n=n,A=d.__d=!0,d.__h=[],d._sb=[]),P&&d.__s==null&&(d.__s=d.state),P&&k.getDerivedStateFromProps!=null&&(d.__s==d.state&&(d.__s=Bf({},d.__s)),Bf(d.__s,k.getDerivedStateFromProps(R,d.__s))),y=d.props,w=d.state,d.__v=e,A)P&&k.getDerivedStateFromProps==null&&d.componentWillMount!=null&&d.componentWillMount(),P&&d.componentDidMount!=null&&d.__h.push(d.componentDidMount);else{if(P&&k.getDerivedStateFromProps==null&&R!==y&&d.componentWillReceiveProps!=null&&d.componentWillReceiveProps(R,F),e.__v==t.__v||!d.__e&&d.shouldComponentUpdate!=null&&d.shouldComponentUpdate(R,d.__s,F)===!1){e.__v!=t.__v&&(d.props=R,d.state=d.__s,d.__d=!1),e.__e=t.__e,e.__k=t.__k,e.__k.some(function(z){z&&(z.__=e)}),wP.push.apply(d.__h,d._sb),d._sb=[],d.__h.length&&o.push(d),a=f1(t);break e}d.componentWillUpdate!=null&&d.componentWillUpdate(R,d.__s,F),P&&d.componentDidUpdate!=null&&d.__h.push(function(){d.componentDidUpdate(y,w,S)})}if(d.context=F,d.props=R,d.__P=i,d.__e=!1,D=Vr.__r,L=0,P)d.state=d.__s,d.__d=!1,D&&D(e),u=d.render(d.props,d.state,d.context),wP.push.apply(d.__h,d._sb),d._sb=[];else do d.__d=!1,D&&D(e),u=d.render(d.props,d.state,d.context),d.state=d.__s;while(d.__d&&++L<25);d.state=d.__s,d.getChildContext!=null&&(n=Bf(Bf({},n),d.getChildContext())),P&&!A&&d.getSnapshotBeforeUpdate!=null&&(S=d.getSnapshotBeforeUpdate(y,w)),C=u!=null&&u.type===EP&&u.key==null?fle(u.props.children):u,a=lle(i,TP(C)?C:[C],e,t,n,r,s,o,a,l,c),d.base=e.__e,e.__u&=-161,d.__h.length&&o.push(d),T&&(d.__E=d.__=null)}catch(z){if(o.length=f,e.__v=null,l||s!=null){if(z.then){for(e.__u|=l?160:128;a&&a.nodeType==8&&a.nextSibling;)a=a.nextSibling;s!=null&&(s[s.indexOf(a)]=null),e.__e=a}else if(s!=null)for(B=s.length;B--;)nG(s[B])}else e.__e=t.__e;e.__k==null&&(e.__k=t.__k||[]),z.then||ule(e),Vr.__e(z,e,t)}}else s==null&&e.__v==t.__v?(e.__k=t.__k,e.__e=t.__e):a=e.__e=x5e(t.__e,e,t,n,r,s,o,l,c);return(u=Vr.diffed)&&u(e),128&e.__u?void 0:a}function ule(i){i&&(i.__c&&(i.__c.__e=!0),i.__k&&i.__k.some(ule))}function hle(i,e,t){for(var n=0;n<t.length;n++)rG(t[n],t[++n],t[++n]);Vr.__c&&Vr.__c(e,i),i.some(function(r){try{i=r.__h,r.__h=[],i.some(function(s){s.call(r)})}catch(s){Vr.__e(s,r.__v)}})}function fle(i){return typeof i!="object"||i==null||i.__b>0?i:TP(i)?i.map(fle):i.constructor!==void 0?null:Bf({},i)}function x5e(i,e,t,n,r,s,o,a,l){var c,u,f,d,A,y,w,S=t.props||bP,T=e.props,R=e.type;if(R=="svg"?r="http://www.w3.org/2000/svg":R=="math"?r="http://www.w3.org/1998/Math/MathML":r||(r="http://www.w3.org/1999/xhtml"),s!=null){for(c=0;c<s.length;c++)if((A=s[c])&&"setAttribute"in A==!!R&&(R?A.localName==R:A.nodeType==3)){i=A,s[c]=null;break}}if(i==null){if(R==null)return document.createTextNode(T);i=document.createElementNS(r,R,T.is&&T),a&&(Vr.__m&&Vr.__m(e,s),a=!1),s=null}if(R==null)S===T||a&&i.data==T||(i.data=T);else{if(s=R=="textarea"&&T.defaultValue!=null?null:s&&GS.call(i.childNodes),!a&&s!=null)for(S={},c=0;c<i.attributes.length;c++)S[(A=i.attributes[c]).name]=A.value;for(c in S)A=S[c],c=="dangerouslySetInnerHTML"?f=A:c=="children"||c in T||c=="value"&&"defaultValue"in T||c=="checked"&&"defaultChecked"in T||_P(i,c,null,A,r);for(c in T)A=T[c],c=="children"?d=A:c=="dangerouslySetInnerHTML"?u=A:c=="value"?y=A:c=="checked"?w=A:a&&typeof A!="function"||S[c]===A||_P(i,c,A,S[c],r);if(u)a||f&&(u.__html==f.__html||u.__html==i.innerHTML)||(i.innerHTML=u.__html),e.__k=[];else if(f&&(i.innerHTML=""),lle(e.type=="template"?i.content:i,TP(d)?d:[d],e,t,n,R=="foreignObject"?"http://www.w3.org/1999/xhtml":r,s,o,s?s[0]:t.__k&&f1(t,0),a,l),s!=null)for(c=s.length;c--;)nG(s[c]);a&&R!="textarea"||(c="value",R=="progress"&&y==null?i.removeAttribute("value"):y!=null&&(y!==i[c]||R=="progress"&&!y||R=="option"&&y!=S[c])&&_P(i,c,y,S[c],r),c="checked",w!=null&&w!=i[c]&&_P(i,c,w,S[c],r))}return i}function rG(i,e,t){try{if(typeof i=="function"){var n=typeof i.__u=="function";n&&i.__u(),n&&e==null||(i.__u=i(e))}else i.current=e}catch(r){Vr.__e(r,t)}}function dle(i,e,t){var n,r;if(Vr.unmount&&Vr.unmount(i),(n=i.ref)&&(n.current&&n.current!=i.__e||rG(n,null,e)),(n=i.__c)!=null){if(n.componentWillUnmount)try{n.componentWillUnmount()}catch(s){Vr.__e(s,e)}n.base=n.__P=n.__n=null}if(n=i.__k)for(r=0;r<n.length;r++)n[r]&&dle(n[r],e,t||typeof i.type!="function");t||nG(i.__e),i.__c=i.__=i.__e=void 0}function y5e(i,e,t){return this.constructor(i,t)}function ple(i,e,t){var n,r,s,o;e==document&&(e=document.documentElement),Vr.__&&Vr.__(i,e),r=(n=typeof t=="function")?null:t&&t.__k||e.__k,s=[],o=[],iG(e,i=(!n&&t||e).__k=A5e(EP,null,[i]),r||bP,bP,e.namespaceURI,!n&&t?[t]:r?null:e.firstChild?GS.call(e.childNodes):null,s,!n&&t?t:r?r.__e:e.firstChild,n,o),hle(s,i,o),i.props.children=null}function sG(i,e,t){var n,r,s,o,a=Bf({},i.props);for(s in i.type&&i.type.defaultProps&&(o=i.type.defaultProps),e)s=="key"?n=e[s]:s=="ref"?r=e[s]:a[s]=e[s]===void 0&&o!=null?o[s]:e[s];return arguments.length>2&&(a.children=arguments.length>3?GS.call(arguments,2):t),VS(i.type,a,n||i.key,r||i.ref,null)}GS=wP.slice,Vr={__e:function(i,e,t,n){for(var r,s,o;e=e.__;)if((r=e.__c)&&!r.__)try{if((s=r.constructor)&&s.getDerivedStateFromError!=null&&(r.setState(s.getDerivedStateFromError(i)),o=r.__d),r.componentDidCatch!=null&&(r.componentDidCatch(i,n||{}),o=r.__d),o)return r.__E=r}catch(a){i=a}throw i}},ile=0,eG=function(i){return i!=null&&i.constructor===void 0},yP.prototype.setState=function(i,e){var t;t=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=Bf({},this.state),typeof i=="function"&&(i=i(Bf({},t),this.props)),i&&Bf(t,i),i!=null&&this.__v&&(e&&this._sb.push(e),ele(this))},yP.prototype.forceUpdate=function(i){this.__v&&(this.__e=!0,i&&this.__h.push(i),ele(this))},yP.prototype.render=EP,Pm=[],rle=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,sle=function(i,e){return i.__v.__b-e.__v.__b},SP.__r=0,KV=Math.random().toString(8),xP="__d"+KV,zS="__a"+KV,ole=/(PointerCapture)$|Capture$/i,tG=0,QV=nle(!1),JV=nle(!0),p5e=0;function mle(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 b5e(i){if(Array.isArray(i))return i}function w5e(i,e,t){return(e=R5e(e))in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function S5e(i,e){var t=i==null?null:typeof Symbol<"u"&&i[Symbol.iterator]||i["@@iterator"];if(t!=null){var n,r,s,o,a=[],l=!0,c=!1;try{if(s=(t=t.call(i)).next,e!==0)for(;!(l=(n=s.call(t)).done)&&(a.push(n.value),a.length!==e);l=!0);}catch(u){c=!0,r=u}finally{try{if(!l&&t.return!=null&&(o=t.return(),Object(o)!==o))return}finally{if(c)throw r}}return a}}function T5e(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.5259-In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Ale(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 E5e(i){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Ale(Object(t),!0).forEach(function(n){w5e(i,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(t)):Ale(Object(t)).forEach(function(n){Object.defineProperty(i,n,Object.getOwnPropertyDescriptor(t,n))})}return i}function M5e(i,e){return b5e(i)||S5e(i,e)||I5e(i,e)||T5e()}function C5e(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 R5e(i){var e=C5e(i,"string");return typeof e=="symbol"?e:e+""}function MP(i){"@babel/helpers - typeof";return MP=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},MP(i)}function I5e(i,e){if(i){if(typeof i=="string")return mle(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)?mle(i,e):void 0}}var oG=function(e){if(MP(e)!=="object")return e;var t=sG(e);if(t.props){var n;t.props=E5e({},t.props),t!=null&&(n=t.props)!==null&&n!==void 0&&n.children&&(t.props.children=Array.isArray(t.props.children)?t.props.children.map(oG):oG(t.props.children))}return t},P5e=function(e){return eG(sG(e))},L5e=function(e,t){delete t.__k,ple(oG(e),t)};function D5e(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 N5e=`.float-tooltip-kap {5258+ }`};var ip=class{constructor(){this.isPass=!0,this.enabled=!0,this.needsSwap=!0,this.clear=!1,this.renderToScreen=!1}setSize(){}render(){console.error("THREE.Pass: .render() must be implemented in derived pass.")}dispose(){}},pNe=new Du(-1,1,1,-1,0,1),sG=class extends Xn{constructor(){super(),this.setAttribute("position",new Ln([-1,3,0,-1,-1,0,3,-1,0],3)),this.setAttribute("uv",new Ln([0,2,0,0,2,0],2))}},mNe=new sG,hI=class{constructor(e){this._mesh=new Hn(mNe,e)}dispose(){this._mesh.geometry.dispose()}render(e){e.render(this._mesh,pNe)}get material(){return this._mesh.material}set material(e){this._mesh.material=e}};var fI=class extends ip{constructor(e,t="tDiffuse"){super(),this.textureID=t,this.uniforms=null,this.material=null,e instanceof ds?(this.uniforms=e.uniforms,this.material=e):e&&(this.uniforms=dg.clone(e.uniforms),this.material=new ds({name:e.name!==void 0?e.name:"unspecified",defines:Object.assign({},e.defines),uniforms:this.uniforms,vertexShader:e.vertexShader,fragmentShader:e.fragmentShader})),this._fsQuad=new hI(this.material)}render(e,t,n){this.uniforms[this.textureID]&&(this.uniforms[this.textureID].value=n.texture),this._fsQuad.material=this.material,this.renderToScreen?(e.setRenderTarget(null),this._fsQuad.render(e)):(e.setRenderTarget(t),this.clear&&e.clear(e.autoClearColor,e.autoClearDepth,e.autoClearStencil),this._fsQuad.render(e))}dispose(){this.material.dispose(),this._fsQuad.dispose()}};var qS=class extends ip{constructor(e,t){super(),this.scene=e,this.camera=t,this.clear=!0,this.needsSwap=!1,this.inverse=!1}render(e,t,n){let r=e.getContext(),s=e.state;s.buffers.color.setMask(!1),s.buffers.depth.setMask(!1),s.buffers.color.setLocked(!0),s.buffers.depth.setLocked(!0);let o,a;this.inverse?(o=0,a=1):(o=1,a=0),s.buffers.stencil.setTest(!0),s.buffers.stencil.setOp(r.REPLACE,r.REPLACE,r.REPLACE),s.buffers.stencil.setFunc(r.ALWAYS,o,4294967295),s.buffers.stencil.setClear(a),s.buffers.stencil.setLocked(!0),e.setRenderTarget(n),this.clear&&e.clear(),e.render(this.scene,this.camera),e.setRenderTarget(t),this.clear&&e.clear(),e.render(this.scene,this.camera),s.buffers.color.setLocked(!1),s.buffers.depth.setLocked(!1),s.buffers.color.setMask(!0),s.buffers.depth.setMask(!0),s.buffers.stencil.setLocked(!1),s.buffers.stencil.setFunc(r.EQUAL,1,4294967295),s.buffers.stencil.setOp(r.KEEP,r.KEEP,r.KEEP),s.buffers.stencil.setLocked(!0)}},dI=class extends ip{constructor(){super(),this.needsSwap=!1}render(e){e.state.buffers.stencil.setLocked(!1),e.state.buffers.stencil.setTest(!1)}};var pI=class{constructor(e,t){if(this.renderer=e,this._pixelRatio=e.getPixelRatio(),t===void 0){let n=e.getSize(new Oe);this._width=n.width,this._height=n.height,t=new Oa(this._width*this._pixelRatio,this._height*this._pixelRatio,{type:Wi}),t.texture.name="EffectComposer.rt1"}else this._width=t.width,this._height=t.height;this.renderTarget1=t,this.renderTarget2=t.clone(),this.renderTarget2.texture.name="EffectComposer.rt2",this.writeBuffer=this.renderTarget1,this.readBuffer=this.renderTarget2,this.renderToScreen=!0,this.passes=[],this.copyPass=new fI(wae),this.copyPass.material.blending=ps,this.timer=new eg}swapBuffers(){let e=this.readBuffer;this.readBuffer=this.writeBuffer,this.writeBuffer=e}addPass(e){this.passes.push(e),e.setSize(this._width*this._pixelRatio,this._height*this._pixelRatio)}insertPass(e,t){this.passes.splice(t,0,e),e.setSize(this._width*this._pixelRatio,this._height*this._pixelRatio)}removePass(e){let t=this.passes.indexOf(e);t!==-1&&this.passes.splice(t,1)}isLastEnabledPass(e){for(let t=e+1;t<this.passes.length;t++)if(this.passes[t].enabled)return!1;return!0}render(e){this.timer.update(),e===void 0&&(e=this.timer.getDelta());let t=this.renderer.getRenderTarget(),n=!1;for(let r=0,s=this.passes.length;r<s;r++){let o=this.passes[r];if(o.enabled!==!1){if(o.renderToScreen=this.renderToScreen&&this.isLastEnabledPass(r),o.render(this.renderer,this.writeBuffer,this.readBuffer,e,n),o.needsSwap){if(n){let a=this.renderer.getContext(),l=this.renderer.state.buffers.stencil;l.setFunc(a.NOTEQUAL,1,4294967295),this.copyPass.render(this.renderer,this.writeBuffer,this.readBuffer,e),l.setFunc(a.EQUAL,1,4294967295)}this.swapBuffers()}qS!==void 0&&(o instanceof qS?n=!0:o instanceof dI&&(n=!1))}}this.renderer.setRenderTarget(t)}reset(e){if(e===void 0){let t=this.renderer.getSize(new Oe);this._pixelRatio=this.renderer.getPixelRatio(),this._width=t.width,this._height=t.height,e=this.renderTarget1.clone(),e.setSize(this._width*this._pixelRatio,this._height*this._pixelRatio)}this.renderTarget1.dispose(),this.renderTarget2.dispose(),this.renderTarget1=e,this.renderTarget2=e.clone(),this.writeBuffer=this.renderTarget1,this.readBuffer=this.renderTarget2}setSize(e,t){this._width=e,this._height=t;let n=this._width*this._pixelRatio,r=this._height*this._pixelRatio;this.renderTarget1.setSize(n,r),this.renderTarget2.setSize(n,r);for(let s=0;s<this.passes.length;s++)this.passes[s].setSize(n,r)}setPixelRatio(e){this._pixelRatio=e,this.setSize(this._width,this._height)}dispose(){this.renderTarget1.dispose(),this.renderTarget2.dispose(),this.copyPass.dispose()}};var mI=class extends ip{constructor(e,t,n=null,r=null,s=null){super(),this.scene=e,this.camera=t,this.overrideMaterial=n,this.clearColor=r,this.clearAlpha=s,this.clear=!0,this.clearDepth=!1,this.needsSwap=!1,this.isRenderPass=!0,this._oldClearColor=new zt}render(e,t,n){let r=e.autoClear;e.autoClear=!1;let s,o;this.overrideMaterial!==null&&(o=this.scene.overrideMaterial,this.scene.overrideMaterial=this.overrideMaterial),this.clearColor!==null&&(e.getClearColor(this._oldClearColor),e.setClearColor(this.clearColor,e.getClearAlpha())),this.clearAlpha!==null&&(s=e.getClearAlpha(),e.setClearAlpha(this.clearAlpha)),this.clearDepth==!0&&e.clearDepth(),e.setRenderTarget(this.renderToScreen?null:n),this.clear===!0&&e.clear(e.autoClearColor,e.autoClearDepth,e.autoClearStencil),e.render(this.scene,this.camera),this.clearColor!==null&&e.setClearColor(this._oldClearColor),this.clearAlpha!==null&&e.setClearAlpha(s),this.overrideMaterial!==null&&(this.scene.overrideMaterial=o),e.autoClear=r}};function il(){return il=Object.assign?Object.assign.bind():function(i){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var n in t)({}).hasOwnProperty.call(t,n)&&(i[n]=t[n])}return i},il.apply(null,arguments)}function Sae(i){if(i===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return i}function Im(i,e){return Im=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,n){return t.__proto__=n,t},Im(i,e)}function Tae(i,e){i.prototype=Object.create(e.prototype),i.prototype.constructor=i,Im(i,e)}function AI(i){return AI=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},AI(i)}function Eae(i){try{return Function.toString.call(i).indexOf("[native code]")!==-1}catch{return typeof i=="function"}}function oG(){try{var i=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(oG=function(){return!!i})()}function Mae(i,e,t){if(oG())return Reflect.construct.apply(null,arguments);var n=[null];n.push.apply(n,e);var r=new(i.bind.apply(i,n));return t&&Im(r,t.prototype),r}function gI(i){var e=typeof Map=="function"?new Map:void 0;return gI=function(n){if(n===null||!Eae(n))return n;if(typeof n!="function")throw new TypeError("Super expression must either be null or a function");if(e!==void 0){if(e.has(n))return e.get(n);e.set(n,r)}function r(){return Mae(n,arguments,AI(this).constructor)}return r.prototype=Object.create(n.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),Im(r,n)},gI(i)}var Nl=(function(i){Tae(e,i);function e(t){var n;if(1)n=i.call(this,"An error occurred. See https://github.com/styled-components/polished/blob/main/src/internalHelpers/errors.md#"+t+" for more information.")||this;else for(var r,s,o;o<r;o++);return Sae(n)}return e})(gI(Error));function Cae(i,e){return i.substr(-e.length)===e}var ANe=/^([+-]?(?:\d+|\d*\.\d+))([a-z]*|%)$/;function Rae(i){if(typeof i!="string")return i;var e=i.match(ANe);return e?parseFloat(i):i}var gNe=function(e){return function(t,n){n===void 0&&(n="16px");var r=t,s=n;if(typeof t=="string"){if(!Cae(t,"px"))throw new Nl(69,e,t);r=Rae(t)}if(typeof n=="string"){if(!Cae(n,"px"))throw new Nl(70,e,n);s=Rae(n)}if(typeof r=="string")throw new Nl(71,t,e);if(typeof s=="string")throw new Nl(72,n,e);return""+r/s+e}},Iae=gNe,V_t=Iae("em");var G_t=Iae("rem");function aG(i){return Math.round(i*255)}function vNe(i,e,t){return aG(i)+","+aG(e)+","+aG(t)}function HS(i,e,t,n){if(n===void 0&&(n=vNe),e===0)return n(t,t,t);var r=(i%360+360)%360/60,s=(1-Math.abs(2*t-1))*e,o=s*(1-Math.abs(r%2-1)),a=0,l=0,c=0;r>=0&&r<1?(a=s,l=o):r>=1&&r<2?(a=o,l=s):r>=2&&r<3?(l=s,c=o):r>=3&&r<4?(l=o,c=s):r>=4&&r<5?(a=o,c=s):r>=5&&r<6&&(a=s,c=o);var u=t-s/2,f=a+u,d=l+u,A=c+u;return n(f,d,A)}var Pae={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"00ffff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000",blanchedalmond:"ffebcd",blue:"0000ff",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"00ffff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkgrey:"a9a9a9",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkslategrey:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dimgrey:"696969",dodgerblue:"1e90ff",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"ff00ff",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",grey:"808080",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgray:"d3d3d3",lightgreen:"90ee90",lightgrey:"d3d3d3",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslategray:"789",lightslategrey:"789",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"0f0",limegreen:"32cd32",linen:"faf0e6",magenta:"f0f",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370db",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"db7093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",rebeccapurple:"639",red:"f00",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",slategrey:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",wheat:"f5deb3",white:"fff",whitesmoke:"f5f5f5",yellow:"ff0",yellowgreen:"9acd32"};function _Ne(i){if(typeof i!="string")return i;var e=i.toLowerCase();return Pae[e]?"#"+Pae[e]:i}var xNe=/^#[a-fA-F0-9]{6}$/,yNe=/^#[a-fA-F0-9]{8}$/,bNe=/^#[a-fA-F0-9]{3}$/,wNe=/^#[a-fA-F0-9]{4}$/,lG=/^rgb\(\s*(\d{1,3})\s*(?:,)?\s*(\d{1,3})\s*(?:,)?\s*(\d{1,3})\s*\)$/i,SNe=/^rgb(?:a)?\(\s*(\d{1,3})\s*(?:,)?\s*(\d{1,3})\s*(?:,)?\s*(\d{1,3})\s*(?:,|\/)\s*([-+]?\d*[.]?\d+[%]?)\s*\)$/i,TNe=/^hsl\(\s*(\d{0,3}[.]?[0-9]+(?:deg)?)\s*(?:,)?\s*(\d{1,3}[.]?[0-9]?)%\s*(?:,)?\s*(\d{1,3}[.]?[0-9]?)%\s*\)$/i,ENe=/^hsl(?:a)?\(\s*(\d{0,3}[.]?[0-9]+(?:deg)?)\s*(?:,)?\s*(\d{1,3}[.]?[0-9]?)%\s*(?:,)?\s*(\d{1,3}[.]?[0-9]?)%\s*(?:,|\/)\s*([-+]?\d*[.]?\d+[%]?)\s*\)$/i;function Lm(i){if(typeof i!="string")throw new Nl(3);var e=_Ne(i);if(e.match(xNe))return{red:parseInt(""+e[1]+e[2],16),green:parseInt(""+e[3]+e[4],16),blue:parseInt(""+e[5]+e[6],16)};if(e.match(yNe)){var t=parseFloat((parseInt(""+e[7]+e[8],16)/255).toFixed(2));return{red:parseInt(""+e[1]+e[2],16),green:parseInt(""+e[3]+e[4],16),blue:parseInt(""+e[5]+e[6],16),alpha:t}}if(e.match(bNe))return{red:parseInt(""+e[1]+e[1],16),green:parseInt(""+e[2]+e[2],16),blue:parseInt(""+e[3]+e[3],16)};if(e.match(wNe)){var n=parseFloat((parseInt(""+e[4]+e[4],16)/255).toFixed(2));return{red:parseInt(""+e[1]+e[1],16),green:parseInt(""+e[2]+e[2],16),blue:parseInt(""+e[3]+e[3],16),alpha:n}}var r=lG.exec(e);if(r)return{red:parseInt(""+r[1],10),green:parseInt(""+r[2],10),blue:parseInt(""+r[3],10)};var s=SNe.exec(e.substring(0,50));if(s)return{red:parseInt(""+s[1],10),green:parseInt(""+s[2],10),blue:parseInt(""+s[3],10),alpha:parseFloat(""+s[4])>1?parseFloat(""+s[4])/100:parseFloat(""+s[4])};var o=TNe.exec(e);if(o){var a=parseInt(""+o[1],10),l=parseInt(""+o[2],10)/100,c=parseInt(""+o[3],10)/100,u="rgb("+HS(a,l,c)+")",f=lG.exec(u);if(!f)throw new Nl(4,e,u);return{red:parseInt(""+f[1],10),green:parseInt(""+f[2],10),blue:parseInt(""+f[3],10)}}var d=ENe.exec(e.substring(0,50));if(d){var A=parseInt(""+d[1],10),y=parseInt(""+d[2],10)/100,w=parseInt(""+d[3],10)/100,S="rgb("+HS(A,y,w)+")",T=lG.exec(S);if(!T)throw new Nl(4,e,S);return{red:parseInt(""+T[1],10),green:parseInt(""+T[2],10),blue:parseInt(""+T[3],10),alpha:parseFloat(""+d[4])>1?parseFloat(""+d[4])/100:parseFloat(""+d[4])}}throw new Nl(5)}function MNe(i){var e=i.red/255,t=i.green/255,n=i.blue/255,r=Math.max(e,t,n),s=Math.min(e,t,n),o=(r+s)/2;if(r===s)return i.alpha!==void 0?{hue:0,saturation:0,lightness:o,alpha:i.alpha}:{hue:0,saturation:0,lightness:o};var a,l=r-s,c=o>.5?l/(2-r-s):l/(r+s);switch(r){case e:a=(t-n)/l+(t<n?6:0);break;case t:a=(n-e)/l+2;break;default:a=(e-t)/l+4;break}return a*=60,i.alpha!==void 0?{hue:a,saturation:c,lightness:o,alpha:i.alpha}:{hue:a,saturation:c,lightness:o}}function Dm(i){return MNe(Lm(i))}var CNe=function(e){return e.length===7&&e[1]===e[2]&&e[3]===e[4]&&e[5]===e[6]?"#"+e[1]+e[3]+e[5]:e},uG=CNe;function A1(i){var e=i.toString(16);return e.length===1?"0"+e:e}function cG(i){return A1(Math.round(i*255))}function RNe(i,e,t){return uG("#"+cG(i)+cG(e)+cG(t))}function vI(i,e,t){return HS(i,e,t,RNe)}function PNe(i,e,t){if(typeof i=="number"&&typeof e=="number"&&typeof t=="number")return vI(i,e,t);if(typeof i=="object"&&e===void 0&&t===void 0)return vI(i.hue,i.saturation,i.lightness);throw new Nl(1)}function INe(i,e,t,n){if(typeof i=="number"&&typeof e=="number"&&typeof t=="number"&&typeof n=="number")return n>=1?vI(i,e,t):"rgba("+HS(i,e,t)+","+n+")";if(typeof i=="object"&&e===void 0&&t===void 0&&n===void 0)return i.alpha>=1?vI(i.hue,i.saturation,i.lightness):"rgba("+HS(i.hue,i.saturation,i.lightness)+","+i.alpha+")";throw new Nl(2)}function hG(i,e,t){if(typeof i=="number"&&typeof e=="number"&&typeof t=="number")return uG("#"+A1(i)+A1(e)+A1(t));if(typeof i=="object"&&e===void 0&&t===void 0)return uG("#"+A1(i.red)+A1(i.green)+A1(i.blue));throw new Nl(6)}function _I(i,e,t,n){if(typeof i=="string"&&typeof e=="number"){var r=Lm(i);return"rgba("+r.red+","+r.green+","+r.blue+","+e+")"}else{if(typeof i=="number"&&typeof e=="number"&&typeof t=="number"&&typeof n=="number")return n>=1?hG(i,e,t):"rgba("+i+","+e+","+t+","+n+")";if(typeof i=="object"&&e===void 0&&t===void 0&&n===void 0)return i.alpha>=1?hG(i.red,i.green,i.blue):"rgba("+i.red+","+i.green+","+i.blue+","+i.alpha+")"}throw new Nl(7)}var LNe=function(e){return typeof e.red=="number"&&typeof e.green=="number"&&typeof e.blue=="number"&&(typeof e.alpha!="number"||typeof e.alpha>"u")},DNe=function(e){return typeof e.red=="number"&&typeof e.green=="number"&&typeof e.blue=="number"&&typeof e.alpha=="number"},NNe=function(e){return typeof e.hue=="number"&&typeof e.saturation=="number"&&typeof e.lightness=="number"&&(typeof e.alpha!="number"||typeof e.alpha>"u")},FNe=function(e){return typeof e.hue=="number"&&typeof e.saturation=="number"&&typeof e.lightness=="number"&&typeof e.alpha=="number"};function Nm(i){if(typeof i!="object")throw new Nl(8);if(DNe(i))return _I(i);if(LNe(i))return hG(i);if(FNe(i))return INe(i);if(NNe(i))return PNe(i);throw new Nl(8)}function Lae(i,e,t){return function(){var r=t.concat(Array.prototype.slice.call(arguments));return r.length>=e?i.apply(this,r):Lae(i,e,r)}}function gc(i){return Lae(i,i.length,[])}function BNe(i,e){if(e==="transparent")return e;var t=Dm(e);return Nm(il({},t,{hue:t.hue+parseFloat(i)}))}var q_t=gc(BNe);function Nx(i,e,t){return Math.max(i,Math.min(e,t))}function ONe(i,e){if(e==="transparent")return e;var t=Dm(e);return Nm(il({},t,{lightness:Nx(0,1,t.lightness-parseFloat(i))}))}var H_t=gc(ONe);function UNe(i,e){if(e==="transparent")return e;var t=Dm(e);return Nm(il({},t,{saturation:Nx(0,1,t.saturation-parseFloat(i))}))}var W_t=gc(UNe);function kNe(i,e){if(e==="transparent")return e;var t=Dm(e);return Nm(il({},t,{lightness:Nx(0,1,t.lightness+parseFloat(i))}))}var j_t=gc(kNe);function zNe(i,e,t){if(e==="transparent")return t;if(t==="transparent")return e;if(i===0)return t;var n=Lm(e),r=il({},n,{alpha:typeof n.alpha=="number"?n.alpha:1}),s=Lm(t),o=il({},s,{alpha:typeof s.alpha=="number"?s.alpha:1}),a=r.alpha-o.alpha,l=parseFloat(i)*2-1,c=l*a===-1?l:l+a,u=1+l*a,f=(c/u+1)/2,d=1-f,A={red:Math.floor(r.red*f+o.red*d),green:Math.floor(r.green*f+o.green*d),blue:Math.floor(r.blue*f+o.blue*d),alpha:r.alpha*parseFloat(i)+o.alpha*(1-parseFloat(i))};return _I(A)}var VNe=gc(zNe),Dae=VNe;function GNe(i,e){if(e==="transparent")return e;var t=Lm(e),n=typeof t.alpha=="number"?t.alpha:1,r=il({},t,{alpha:Nx(0,1,(n*100+parseFloat(i)*100)/100)});return _I(r)}var qNe=gc(GNe),Nae=qNe;function HNe(i,e){if(e==="transparent")return e;var t=Dm(e);return Nm(il({},t,{saturation:Nx(0,1,t.saturation+parseFloat(i))}))}var X_t=gc(HNe);function WNe(i,e){return e==="transparent"?e:Nm(il({},Dm(e),{hue:parseFloat(i)}))}var $_t=gc(WNe);function jNe(i,e){return e==="transparent"?e:Nm(il({},Dm(e),{lightness:parseFloat(i)}))}var Y_t=gc(jNe);function XNe(i,e){return e==="transparent"?e:Nm(il({},Dm(e),{saturation:parseFloat(i)}))}var Z_t=gc(XNe);function $Ne(i,e){return e==="transparent"?e:Dae(parseFloat(i),"rgb(0, 0, 0)",e)}var K_t=gc($Ne);function YNe(i,e){return e==="transparent"?e:Dae(parseFloat(i),"rgb(255, 255, 255)",e)}var Q_t=gc(YNe);function ZNe(i,e){if(e==="transparent")return e;var t=Lm(e),n=typeof t.alpha=="number"?t.alpha:1,r=il({},t,{alpha:Nx(0,1,+(n*100-parseFloat(i)*100).toFixed(2)/100)});return _I(r)}var J_t=gc(ZNe);var xI="http://www.w3.org/1999/xhtml",fG={svg:"http://www.w3.org/2000/svg",xhtml:xI,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function yI(i){var e=i+="",t=e.indexOf(":");return t>=0&&(e=i.slice(0,t))!=="xmlns"&&(i=i.slice(t+1)),fG.hasOwnProperty(e)?{space:fG[e],local:i}:i}function KNe(i){return function(){var e=this.ownerDocument,t=this.namespaceURI;return t===xI&&e.documentElement.namespaceURI===xI?e.createElement(i):e.createElementNS(t,i)}}function QNe(i){return function(){return this.ownerDocument.createElementNS(i.space,i.local)}}function bI(i){var e=yI(i);return(e.local?QNe:KNe)(e)}function JNe(){}function wI(i){return i==null?JNe:function(){return this.querySelector(i)}}function Fae(i){typeof i!="function"&&(i=wI(i));for(var e=this._groups,t=e.length,n=new Array(t),r=0;r<t;++r)for(var s=e[r],o=s.length,a=n[r]=new Array(o),l,c,u=0;u<o;++u)(l=s[u])&&(c=i.call(l,l.__data__,u,s))&&("__data__"in l&&(c.__data__=l.__data__),a[u]=c);return new ys(n,this._parents)}function dG(i){return i==null?[]:Array.isArray(i)?i:Array.from(i)}function e5e(){return[]}function Bae(i){return i==null?e5e:function(){return this.querySelectorAll(i)}}function t5e(i){return function(){return dG(i.apply(this,arguments))}}function Oae(i){typeof i=="function"?i=t5e(i):i=Bae(i);for(var e=this._groups,t=e.length,n=[],r=[],s=0;s<t;++s)for(var o=e[s],a=o.length,l,c=0;c<a;++c)(l=o[c])&&(n.push(i.call(l,l.__data__,c,o)),r.push(l));return new ys(n,r)}function Uae(i){return function(){return this.matches(i)}}function SI(i){return function(e){return e.matches(i)}}var n5e=Array.prototype.find;function i5e(i){return function(){return n5e.call(this.children,i)}}function r5e(){return this.firstElementChild}function kae(i){return this.select(i==null?r5e:i5e(typeof i=="function"?i:SI(i)))}var s5e=Array.prototype.filter;function o5e(){return Array.from(this.children)}function a5e(i){return function(){return s5e.call(this.children,i)}}function zae(i){return this.selectAll(i==null?o5e:a5e(typeof i=="function"?i:SI(i)))}function Vae(i){typeof i!="function"&&(i=Uae(i));for(var e=this._groups,t=e.length,n=new Array(t),r=0;r<t;++r)for(var s=e[r],o=s.length,a=n[r]=[],l,c=0;c<o;++c)(l=s[c])&&i.call(l,l.__data__,c,s)&&a.push(l);return new ys(n,this._parents)}function TI(i){return new Array(i.length)}function Gae(){return new ys(this._enter||this._groups.map(TI),this._parents)}function WS(i,e){this.ownerDocument=i.ownerDocument,this.namespaceURI=i.namespaceURI,this._next=null,this._parent=i,this.__data__=e}WS.prototype={constructor:WS,appendChild:function(i){return this._parent.insertBefore(i,this._next)},insertBefore:function(i,e){return this._parent.insertBefore(i,e)},querySelector:function(i){return this._parent.querySelector(i)},querySelectorAll:function(i){return this._parent.querySelectorAll(i)}};function qae(i){return function(){return i}}function l5e(i,e,t,n,r,s){for(var o=0,a,l=e.length,c=s.length;o<c;++o)(a=e[o])?(a.__data__=s[o],n[o]=a):t[o]=new WS(i,s[o]);for(;o<l;++o)(a=e[o])&&(r[o]=a)}function c5e(i,e,t,n,r,s,o){var a,l,c=new Map,u=e.length,f=s.length,d=new Array(u),A;for(a=0;a<u;++a)(l=e[a])&&(d[a]=A=o.call(l,l.__data__,a,e)+"",c.has(A)?r[a]=l:c.set(A,l));for(a=0;a<f;++a)A=o.call(i,s[a],a,s)+"",(l=c.get(A))?(n[a]=l,l.__data__=s[a],c.delete(A)):t[a]=new WS(i,s[a]);for(a=0;a<u;++a)(l=e[a])&&c.get(d[a])===l&&(r[a]=l)}function u5e(i){return i.__data__}function Hae(i,e){if(!arguments.length)return Array.from(this,u5e);var t=e?c5e:l5e,n=this._parents,r=this._groups;typeof i!="function"&&(i=qae(i));for(var s=r.length,o=new Array(s),a=new Array(s),l=new Array(s),c=0;c<s;++c){var u=n[c],f=r[c],d=f.length,A=h5e(i.call(u,u&&u.__data__,c,n)),y=A.length,w=a[c]=new Array(y),S=o[c]=new Array(y),T=l[c]=new Array(d);t(u,f,w,S,T,A,e);for(var R=0,I=0,P,F;R<y;++R)if(P=w[R]){for(R>=I&&(I=R+1);!(F=S[I])&&++I<y;);P._next=F||null}}return o=new ys(o,n),o._enter=a,o._exit=l,o}function h5e(i){return typeof i=="object"&&"length"in i?i:Array.from(i)}function Wae(){return new ys(this._exit||this._groups.map(TI),this._parents)}function jae(i,e,t){var n=this.enter(),r=this,s=this.exit();return typeof i=="function"?(n=i(n),n&&(n=n.selection())):n=n.append(i+""),e!=null&&(r=e(r),r&&(r=r.selection())),t==null?s.remove():t(s),n&&r?n.merge(r).order():r}function Xae(i){for(var e=i.selection?i.selection():i,t=this._groups,n=e._groups,r=t.length,s=n.length,o=Math.min(r,s),a=new Array(r),l=0;l<o;++l)for(var c=t[l],u=n[l],f=c.length,d=a[l]=new Array(f),A,y=0;y<f;++y)(A=c[y]||u[y])&&(d[y]=A);for(;l<r;++l)a[l]=t[l];return new ys(a,this._parents)}function $ae(){for(var i=this._groups,e=-1,t=i.length;++e<t;)for(var n=i[e],r=n.length-1,s=n[r],o;--r>=0;)(o=n[r])&&(s&&o.compareDocumentPosition(s)^4&&s.parentNode.insertBefore(o,s),s=o);return this}function Yae(i){i||(i=f5e);function e(f,d){return f&&d?i(f.__data__,d.__data__):!f-!d}for(var t=this._groups,n=t.length,r=new Array(n),s=0;s<n;++s){for(var o=t[s],a=o.length,l=r[s]=new Array(a),c,u=0;u<a;++u)(c=o[u])&&(l[u]=c);l.sort(e)}return new ys(r,this._parents).order()}function f5e(i,e){return i<e?-1:i>e?1:i>=e?0:NaN}function Zae(){var i=arguments[0];return arguments[0]=this,i.apply(null,arguments),this}function Kae(){return Array.from(this)}function Qae(){for(var i=this._groups,e=0,t=i.length;e<t;++e)for(var n=i[e],r=0,s=n.length;r<s;++r){var o=n[r];if(o)return o}return null}function Jae(){let i=0;for(let e of this)++i;return i}function ele(){return!this.node()}function tle(i){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var r=e[t],s=0,o=r.length,a;s<o;++s)(a=r[s])&&i.call(a,a.__data__,s,r);return this}function d5e(i){return function(){this.removeAttribute(i)}}function p5e(i){return function(){this.removeAttributeNS(i.space,i.local)}}function m5e(i,e){return function(){this.setAttribute(i,e)}}function A5e(i,e){return function(){this.setAttributeNS(i.space,i.local,e)}}function g5e(i,e){return function(){var t=e.apply(this,arguments);t==null?this.removeAttribute(i):this.setAttribute(i,t)}}function v5e(i,e){return function(){var t=e.apply(this,arguments);t==null?this.removeAttributeNS(i.space,i.local):this.setAttributeNS(i.space,i.local,t)}}function nle(i,e){var t=yI(i);if(arguments.length<2){var n=this.node();return t.local?n.getAttributeNS(t.space,t.local):n.getAttribute(t)}return this.each((e==null?t.local?p5e:d5e:typeof e=="function"?t.local?v5e:g5e:t.local?A5e:m5e)(t,e))}function EI(i){return i.ownerDocument&&i.ownerDocument.defaultView||i.document&&i||i.defaultView}function _5e(i){return function(){this.style.removeProperty(i)}}function x5e(i,e,t){return function(){this.style.setProperty(i,e,t)}}function y5e(i,e,t){return function(){var n=e.apply(this,arguments);n==null?this.style.removeProperty(i):this.style.setProperty(i,n,t)}}function ile(i,e,t){return arguments.length>1?this.each((e==null?_5e:typeof e=="function"?y5e:x5e)(i,e,t??"")):b5e(this.node(),i)}function b5e(i,e){return i.style.getPropertyValue(e)||EI(i).getComputedStyle(i,null).getPropertyValue(e)}function w5e(i){return function(){delete this[i]}}function S5e(i,e){return function(){this[i]=e}}function T5e(i,e){return function(){var t=e.apply(this,arguments);t==null?delete this[i]:this[i]=t}}function rle(i,e){return arguments.length>1?this.each((e==null?w5e:typeof e=="function"?T5e:S5e)(i,e)):this.node()[i]}function sle(i){return i.trim().split(/^|\s+/)}function pG(i){return i.classList||new ole(i)}function ole(i){this._node=i,this._names=sle(i.getAttribute("class")||"")}ole.prototype={add:function(i){var e=this._names.indexOf(i);e<0&&(this._names.push(i),this._node.setAttribute("class",this._names.join(" ")))},remove:function(i){var e=this._names.indexOf(i);e>=0&&(this._names.splice(e,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(i){return this._names.indexOf(i)>=0}};function ale(i,e){for(var t=pG(i),n=-1,r=e.length;++n<r;)t.add(e[n])}function lle(i,e){for(var t=pG(i),n=-1,r=e.length;++n<r;)t.remove(e[n])}function E5e(i){return function(){ale(this,i)}}function M5e(i){return function(){lle(this,i)}}function C5e(i,e){return function(){(e.apply(this,arguments)?ale:lle)(this,i)}}function cle(i,e){var t=sle(i+"");if(arguments.length<2){for(var n=pG(this.node()),r=-1,s=t.length;++r<s;)if(!n.contains(t[r]))return!1;return!0}return this.each((typeof e=="function"?C5e:e?E5e:M5e)(t,e))}function R5e(){this.textContent=""}function P5e(i){return function(){this.textContent=i}}function I5e(i){return function(){var e=i.apply(this,arguments);this.textContent=e??""}}function ule(i){return arguments.length?this.each(i==null?R5e:(typeof i=="function"?I5e:P5e)(i)):this.node().textContent}function L5e(){this.innerHTML=""}function D5e(i){return function(){this.innerHTML=i}}function N5e(i){return function(){var e=i.apply(this,arguments);this.innerHTML=e??""}}function hle(i){return arguments.length?this.each(i==null?L5e:(typeof i=="function"?N5e:D5e)(i)):this.node().innerHTML}function F5e(){this.nextSibling&&this.parentNode.appendChild(this)}function fle(){return this.each(F5e)}function B5e(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function dle(){return this.each(B5e)}function ple(i){var e=typeof i=="function"?i:bI(i);return this.select(function(){return this.appendChild(e.apply(this,arguments))})}function O5e(){return null}function mle(i,e){var t=typeof i=="function"?i:bI(i),n=e==null?O5e:typeof e=="function"?e:wI(e);return this.select(function(){return this.insertBefore(t.apply(this,arguments),n.apply(this,arguments)||null)})}function U5e(){var i=this.parentNode;i&&i.removeChild(this)}function Ale(){return this.each(U5e)}function k5e(){var i=this.cloneNode(!1),e=this.parentNode;return e?e.insertBefore(i,this.nextSibling):i}function z5e(){var i=this.cloneNode(!0),e=this.parentNode;return e?e.insertBefore(i,this.nextSibling):i}function gle(i){return this.select(i?z5e:k5e)}function vle(i){return arguments.length?this.property("__data__",i):this.node().__data__}function V5e(i){return function(e){i.call(this,e,this.__data__)}}function G5e(i){return i.trim().split(/^|\s+/).map(function(e){var t="",n=e.indexOf(".");return n>=0&&(t=e.slice(n+1),e=e.slice(0,n)),{type:e,name:t}})}function q5e(i){return function(){var e=this.__on;if(e){for(var t=0,n=-1,r=e.length,s;t<r;++t)s=e[t],(!i.type||s.type===i.type)&&s.name===i.name?this.removeEventListener(s.type,s.listener,s.options):e[++n]=s;++n?e.length=n:delete this.__on}}}function H5e(i,e,t){return function(){var n=this.__on,r,s=V5e(e);if(n){for(var o=0,a=n.length;o<a;++o)if((r=n[o]).type===i.type&&r.name===i.name){this.removeEventListener(r.type,r.listener,r.options),this.addEventListener(r.type,r.listener=s,r.options=t),r.value=e;return}}this.addEventListener(i.type,s,t),r={type:i.type,name:i.name,value:e,listener:s,options:t},n?n.push(r):this.__on=[r]}}function _le(i,e,t){var n=G5e(i+""),r,s=n.length,o;if(arguments.length<2){var a=this.node().__on;if(a){for(var l=0,c=a.length,u;l<c;++l)for(r=0,u=a[l];r<s;++r)if((o=n[r]).type===u.type&&o.name===u.name)return u.value}return}for(a=e?H5e:q5e,r=0;r<s;++r)this.each(a(n[r],e,t));return this}function xle(i,e,t){var n=EI(i),r=n.CustomEvent;typeof r=="function"?r=new r(e,t):(r=n.document.createEvent("Event"),t?(r.initEvent(e,t.bubbles,t.cancelable),r.detail=t.detail):r.initEvent(e,!1,!1)),i.dispatchEvent(r)}function W5e(i,e){return function(){return xle(this,i,e)}}function j5e(i,e){return function(){return xle(this,i,e.apply(this,arguments))}}function yle(i,e){return this.each((typeof e=="function"?j5e:W5e)(i,e))}function*ble(){for(var i=this._groups,e=0,t=i.length;e<t;++e)for(var n=i[e],r=0,s=n.length,o;r<s;++r)(o=n[r])&&(yield o)}var mG=[null];function ys(i,e){this._groups=i,this._parents=e}function X5e(){return new ys([[document.documentElement]],mG)}function $5e(){return this}ys.prototype=X5e.prototype={constructor:ys,select:Fae,selectAll:Oae,selectChild:kae,selectChildren:zae,filter:Vae,data:Hae,enter:Gae,exit:Wae,join:jae,merge:Xae,selection:$5e,order:$ae,sort:Yae,call:Zae,nodes:Kae,node:Qae,size:Jae,empty:ele,each:tle,attr:nle,style:ile,property:rle,classed:cle,text:ule,html:hle,raise:fle,lower:dle,append:ple,insert:mle,remove:Ale,clone:gle,datum:vle,on:_le,dispatch:yle,[Symbol.iterator]:ble};function AG(i){return typeof i=="string"?new ys([[document.querySelector(i)]],[document.documentElement]):new ys([[i]],mG)}function wle(i){let e;for(;e=i.sourceEvent;)i=e;return i}function gG(i,e){if(i=wle(i),e===void 0&&(e=i.currentTarget),e){var t=e.ownerSVGElement||e;if(t.createSVGPoint){var n=t.createSVGPoint();return n.x=i.clientX,n.y=i.clientY,n=n.matrixTransform(e.getScreenCTM().inverse()),[n.x,n.y]}if(e.getBoundingClientRect){var r=e.getBoundingClientRect();return[i.clientX-r.left-e.clientLeft,i.clientY-r.top-e.clientTop]}}return[i.pageX,i.pageY]}var $S,Vr,Cle,yG,Fm,Sle,Rle,Ple,vG,CI,jS,Ile,bG,_G,xG,Y5e,PI={},II=[],Z5e=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,DI=Array.isArray;function Bf(i,e){for(var t in e)i[t]=e[t];return i}function wG(i){i&&i.parentNode&&i.parentNode.removeChild(i)}function K5e(i,e,t){var n,r,s,o={};for(s in e)s=="key"?n=e[s]:s=="ref"?r=e[s]:o[s]=e[s];if(arguments.length>2&&(o.children=arguments.length>3?$S.call(arguments,2):t),typeof i=="function"&&i.defaultProps!=null)for(s in i.defaultProps)o[s]===void 0&&(o[s]=i.defaultProps[s]);return XS(i,o,n,r,null)}function XS(i,e,t,n,r){var s={type:i,props:e,key:t,ref:n,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:r??++Cle,__i:-1,__u:0};return r==null&&Vr.vnode!=null&&Vr.vnode(s),s}function NI(i){return i.children}function RI(i,e){this.props=i,this.context=e}function g1(i,e){if(e==null)return i.__?g1(i.__,i.__i+1):null;for(var t;e<i.__k.length;e++)if((t=i.__k[e])!=null&&t.__e!=null)return t.__e;return typeof i.type=="function"?g1(i):null}function Q5e(i){if(i.__P&&i.__d){var e=i.__v,t=e.__e,n=[],r=[],s=Bf({},e);s.__v=e.__v+1,Vr.vnode&&Vr.vnode(s),SG(i.__P,s,e,i.__n,i.__P.namespaceURI,32&e.__u?[t]:null,n,t??g1(e),!!(32&e.__u),r),s.__v=e.__v,s.__.__k[s.__i]=s,Ble(n,s,r),e.__e=e.__=null,s.__e!=t&&Lle(s)}}function Lle(i){if((i=i.__)!=null&&i.__c!=null)return i.__e=i.__c.base=null,i.__k.some(function(e){if(e!=null&&e.__e!=null)return i.__e=i.__c.base=e.__e}),Lle(i)}function Tle(i){(!i.__d&&(i.__d=!0)&&Fm.push(i)&&!LI.__r++||Sle!=Vr.debounceRendering)&&((Sle=Vr.debounceRendering)||Rle)(LI)}function LI(){try{for(var i,e=1;Fm.length;)Fm.length>e&&Fm.sort(Ple),i=Fm.shift(),e=Fm.length,Q5e(i)}finally{Fm.length=LI.__r=0}}function Dle(i,e,t,n,r,s,o,a,l,c,u){var f,d,A,y,w,S,T=n&&n.__k||II,R=e.length;for(l=J5e(t,e,T,l,R),f=0;f<R;f++)(A=t.__k[f])!=null&&(d=A.__i!=-1&&T[A.__i]||PI,A.__i=f,S=SG(i,A,d,r,s,o,a,l,c,u),y=A.__e,A.ref&&d.ref!=A.ref&&(d.ref&&TG(d.ref,null,A),u.push(A.ref,A.__c||y,A)),w==null&&y!=null&&(w=y),4&A.__u?(l=Nle(A,l,i),d.__e&&(d.__e=null)):typeof A.type=="function"&&S!==void 0?l=S:y&&(l=y.nextSibling),A.__u&=-7);return t.__e=w,l}function J5e(i,e,t,n,r){var s,o,a,l,c,u=t.length,f=u,d=0;for(i.__k=new Array(r),s=0;s<r;s++)(o=e[s])!=null&&typeof o!="boolean"&&typeof o!="function"?(typeof o=="string"||typeof o=="number"||typeof o=="bigint"||o.constructor==String?o=i.__k[s]=XS(null,o,null,null,null):DI(o)?o=i.__k[s]=XS(NI,{children:o},null,null,null):o.constructor===void 0&&o.__b>0?o=i.__k[s]=XS(o.type,o.props,o.key,o.ref?o.ref:null,o.__v):i.__k[s]=o,l=s+d,o.__=i,o.__b=i.__b+1,a=null,(c=o.__i=e6e(o,t,l,f))!=-1&&(f--,(a=t[c])&&(a.__u|=2)),a==null||a.__v==null?(c==-1&&(r>u?d--:r<u&&d++),typeof o.type!="function"&&(o.__u|=4)):c!=l&&(c==l-1?d--:c==l+1?d++:(c>l?d--:d++,o.__u|=4))):i.__k[s]=null;if(f)for(s=0;s<u;s++)(a=t[s])!=null&&(2&a.__u)==0&&(a.__e==n&&(n=g1(a)),Ule(a,a));return n}function Nle(i,e,t){var n,r;if(typeof i.type=="function"){for(n=i.__k,r=0;n&&r<n.length;r++)n[r]&&(n[r].__=i,e=Nle(n[r],e,t));return e}i.__e!=e&&(e&&i.type&&!e.parentNode&&(e=g1(i)),e=t.insertBefore(i.__e,e||null));do e=e&&e.nextSibling;while(e!=null&&e.nodeType==8);return e}function e6e(i,e,t,n){var r,s,o,a=i.key,l=i.type,c=e[t],u=c!=null&&(2&c.__u)==0;if(c===null&&a==null||u&&a==c.key&&l==c.type)return t;if(n>(u?1:0)){for(r=t-1,s=t+1;r>=0||s<e.length;)if((c=e[o=r>=0?r--:s++])!=null&&(2&c.__u)==0&&a==c.key&&l==c.type)return o}return-1}function Ele(i,e,t){e[0]=="-"?i.setProperty(e,t??""):i[e]=t==null?"":typeof t!="number"||Z5e.test(e)?t:t+"px"}function MI(i,e,t,n,r){var s,o;e:if(e=="style")if(typeof t=="string")i.style.cssText=t;else{if(typeof n=="string"&&(i.style.cssText=n=""),n)for(e in n)t&&e in t||Ele(i.style,e,"");if(t)for(e in t)n&&t[e]==n[e]||Ele(i.style,e,t[e])}else if(e[0]=="o"&&e[1]=="n")s=e!=(e=e.replace(Ile,"$1")),o=e.toLowerCase(),e=o in i||e=="onFocusOut"||e=="onFocusIn"?o.slice(2):e.slice(2),i.l||(i.l={}),i.l[e+s]=t,t?n?t[jS]=n[jS]:(t[jS]=bG,i.addEventListener(e,s?xG:_G,s)):i.removeEventListener(e,s?xG:_G,s);else{if(r=="http://www.w3.org/2000/svg")e=e.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if(e!="width"&&e!="height"&&e!="href"&&e!="list"&&e!="form"&&e!="tabIndex"&&e!="download"&&e!="rowSpan"&&e!="colSpan"&&e!="role"&&e!="popover"&&e in i)try{i[e]=t??"";break e}catch{}typeof t=="function"||(t==null||t===!1&&e[4]!="-"?i.removeAttribute(e):i.setAttribute(e,e=="popover"&&t==1?"":t))}}function Mle(i){return function(e){if(this.l){var t=this.l[e.type+i];if(e[CI]==null)e[CI]=bG++;else if(e[CI]<t[jS])return;return t(Vr.event?Vr.event(e):e)}}}function SG(i,e,t,n,r,s,o,a,l,c){var u,f,d,A,y,w,S,T,R,I,P,F,D,L,C,B,k=e.type;if(e.constructor!==void 0)return null;128&t.__u&&(l=!!(32&t.__u),s=[a=e.__e=t.__e]),(u=Vr.__b)&&u(e);e:if(typeof k=="function"){f=o.length;try{if(R=e.props,I=k.prototype&&k.prototype.render,P=(u=k.contextType)&&n[u.__c],F=u?P?P.props.value:u.__:n,t.__c?T=(d=e.__c=t.__c).__=d.__E:(I?e.__c=d=new k(R,F):(e.__c=d=new RI(R,F),d.constructor=k,d.render=n6e),P&&P.sub(d),d.state||(d.state={}),d.__n=n,A=d.__d=!0,d.__h=[],d._sb=[]),I&&d.__s==null&&(d.__s=d.state),I&&k.getDerivedStateFromProps!=null&&(d.__s==d.state&&(d.__s=Bf({},d.__s)),Bf(d.__s,k.getDerivedStateFromProps(R,d.__s))),y=d.props,w=d.state,d.__v=e,A)I&&k.getDerivedStateFromProps==null&&d.componentWillMount!=null&&d.componentWillMount(),I&&d.componentDidMount!=null&&d.__h.push(d.componentDidMount);else{if(I&&k.getDerivedStateFromProps==null&&R!==y&&d.componentWillReceiveProps!=null&&d.componentWillReceiveProps(R,F),e.__v==t.__v||!d.__e&&d.shouldComponentUpdate!=null&&d.shouldComponentUpdate(R,d.__s,F)===!1){e.__v!=t.__v&&(d.props=R,d.state=d.__s,d.__d=!1),e.__e=t.__e,e.__k=t.__k,e.__k.some(function(z){z&&(z.__=e)}),II.push.apply(d.__h,d._sb),d._sb=[],d.__h.length&&o.push(d),a=g1(t);break e}d.componentWillUpdate!=null&&d.componentWillUpdate(R,d.__s,F),I&&d.componentDidUpdate!=null&&d.__h.push(function(){d.componentDidUpdate(y,w,S)})}if(d.context=F,d.props=R,d.__P=i,d.__e=!1,D=Vr.__r,L=0,I)d.state=d.__s,d.__d=!1,D&&D(e),u=d.render(d.props,d.state,d.context),II.push.apply(d.__h,d._sb),d._sb=[];else do d.__d=!1,D&&D(e),u=d.render(d.props,d.state,d.context),d.state=d.__s;while(d.__d&&++L<25);d.state=d.__s,d.getChildContext!=null&&(n=Bf(Bf({},n),d.getChildContext())),I&&!A&&d.getSnapshotBeforeUpdate!=null&&(S=d.getSnapshotBeforeUpdate(y,w)),C=u!=null&&u.type===NI&&u.key==null?Ole(u.props.children):u,a=Dle(i,DI(C)?C:[C],e,t,n,r,s,o,a,l,c),d.base=e.__e,e.__u&=-161,d.__h.length&&o.push(d),T&&(d.__E=d.__=null)}catch(z){if(o.length=f,e.__v=null,l||s!=null){if(z.then){for(e.__u|=l?160:128;a&&a.nodeType==8&&a.nextSibling;)a=a.nextSibling;s!=null&&(s[s.indexOf(a)]=null),e.__e=a}else if(s!=null)for(B=s.length;B--;)wG(s[B])}else e.__e=t.__e;e.__k==null&&(e.__k=t.__k||[]),z.then||Fle(e),Vr.__e(z,e,t)}}else s==null&&e.__v==t.__v?(e.__k=t.__k,e.__e=t.__e):a=e.__e=t6e(t.__e,e,t,n,r,s,o,l,c);return(u=Vr.diffed)&&u(e),128&e.__u?void 0:a}function Fle(i){i&&(i.__c&&(i.__c.__e=!0),i.__k&&i.__k.some(Fle))}function Ble(i,e,t){for(var n=0;n<t.length;n++)TG(t[n],t[++n],t[++n]);Vr.__c&&Vr.__c(e,i),i.some(function(r){try{i=r.__h,r.__h=[],i.some(function(s){s.call(r)})}catch(s){Vr.__e(s,r.__v)}})}function Ole(i){return typeof i!="object"||i==null||i.__b>0?i:DI(i)?i.map(Ole):i.constructor!==void 0?null:Bf({},i)}function t6e(i,e,t,n,r,s,o,a,l){var c,u,f,d,A,y,w,S=t.props||PI,T=e.props,R=e.type;if(R=="svg"?r="http://www.w3.org/2000/svg":R=="math"?r="http://www.w3.org/1998/Math/MathML":r||(r="http://www.w3.org/1999/xhtml"),s!=null){for(c=0;c<s.length;c++)if((A=s[c])&&"setAttribute"in A==!!R&&(R?A.localName==R:A.nodeType==3)){i=A,s[c]=null;break}}if(i==null){if(R==null)return document.createTextNode(T);i=document.createElementNS(r,R,T.is&&T),a&&(Vr.__m&&Vr.__m(e,s),a=!1),s=null}if(R==null)S===T||a&&i.data==T||(i.data=T);else{if(s=R=="textarea"&&T.defaultValue!=null?null:s&&$S.call(i.childNodes),!a&&s!=null)for(S={},c=0;c<i.attributes.length;c++)S[(A=i.attributes[c]).name]=A.value;for(c in S)A=S[c],c=="dangerouslySetInnerHTML"?f=A:c=="children"||c in T||c=="value"&&"defaultValue"in T||c=="checked"&&"defaultChecked"in T||MI(i,c,null,A,r);for(c in T)A=T[c],c=="children"?d=A:c=="dangerouslySetInnerHTML"?u=A:c=="value"?y=A:c=="checked"?w=A:a&&typeof A!="function"||S[c]===A||MI(i,c,A,S[c],r);if(u)a||f&&(u.__html==f.__html||u.__html==i.innerHTML)||(i.innerHTML=u.__html),e.__k=[];else if(f&&(i.innerHTML=""),Dle(e.type=="template"?i.content:i,DI(d)?d:[d],e,t,n,R=="foreignObject"?"http://www.w3.org/1999/xhtml":r,s,o,s?s[0]:t.__k&&g1(t,0),a,l),s!=null)for(c=s.length;c--;)wG(s[c]);a&&R!="textarea"||(c="value",R=="progress"&&y==null?i.removeAttribute("value"):y!=null&&(y!==i[c]||R=="progress"&&!y||R=="option"&&y!=S[c])&&MI(i,c,y,S[c],r),c="checked",w!=null&&w!=i[c]&&MI(i,c,w,S[c],r))}return i}function TG(i,e,t){try{if(typeof i=="function"){var n=typeof i.__u=="function";n&&i.__u(),n&&e==null||(i.__u=i(e))}else i.current=e}catch(r){Vr.__e(r,t)}}function Ule(i,e,t){var n,r;if(Vr.unmount&&Vr.unmount(i),(n=i.ref)&&(n.current&&n.current!=i.__e||TG(n,null,e)),(n=i.__c)!=null){if(n.componentWillUnmount)try{n.componentWillUnmount()}catch(s){Vr.__e(s,e)}n.base=n.__P=n.__n=null}if(n=i.__k)for(r=0;r<n.length;r++)n[r]&&Ule(n[r],e,t||typeof i.type!="function");t||wG(i.__e),i.__c=i.__=i.__e=void 0}function n6e(i,e,t){return this.constructor(i,t)}function kle(i,e,t){var n,r,s,o;e==document&&(e=document.documentElement),Vr.__&&Vr.__(i,e),r=(n=typeof t=="function")?null:t&&t.__k||e.__k,s=[],o=[],SG(e,i=(!n&&t||e).__k=K5e(NI,null,[i]),r||PI,PI,e.namespaceURI,!n&&t?[t]:r?null:e.firstChild?$S.call(e.childNodes):null,s,!n&&t?t:r?r.__e:e.firstChild,n,o),Ble(s,i,o),i.props.children=null}function EG(i,e,t){var n,r,s,o,a=Bf({},i.props);for(s in i.type&&i.type.defaultProps&&(o=i.type.defaultProps),e)s=="key"?n=e[s]:s=="ref"?r=e[s]:a[s]=e[s]===void 0&&o!=null?o[s]:e[s];return arguments.length>2&&(a.children=arguments.length>3?$S.call(arguments,2):t),XS(i.type,a,n||i.key,r||i.ref,null)}$S=II.slice,Vr={__e:function(i,e,t,n){for(var r,s,o;e=e.__;)if((r=e.__c)&&!r.__)try{if((s=r.constructor)&&s.getDerivedStateFromError!=null&&(r.setState(s.getDerivedStateFromError(i)),o=r.__d),r.componentDidCatch!=null&&(r.componentDidCatch(i,n||{}),o=r.__d),o)return r.__E=r}catch(a){i=a}throw i}},Cle=0,yG=function(i){return i!=null&&i.constructor===void 0},RI.prototype.setState=function(i,e){var t;t=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=Bf({},this.state),typeof i=="function"&&(i=i(Bf({},t),this.props)),i&&Bf(t,i),i!=null&&this.__v&&(e&&this._sb.push(e),Tle(this))},RI.prototype.forceUpdate=function(i){this.__v&&(this.__e=!0,i&&this.__h.push(i),Tle(this))},RI.prototype.render=NI,Fm=[],Rle=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,Ple=function(i,e){return i.__v.__b-e.__v.__b},LI.__r=0,vG=Math.random().toString(8),CI="__d"+vG,jS="__a"+vG,Ile=/(PointerCapture)$|Capture$/i,bG=0,_G=Mle(!1),xG=Mle(!0),Y5e=0;function zle(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 i6e(i){if(Array.isArray(i))return i}function r6e(i,e,t){return(e=u6e(e))in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function s6e(i,e){var t=i==null?null:typeof Symbol<"u"&&i[Symbol.iterator]||i["@@iterator"];if(t!=null){var n,r,s,o,a=[],l=!0,c=!1;try{if(s=(t=t.call(i)).next,e!==0)for(;!(l=(n=s.call(t)).done)&&(a.push(n.value),a.length!==e);l=!0);}catch(u){c=!0,r=u}finally{try{if(!l&&t.return!=null&&(o=t.return(),Object(o)!==o))return}finally{if(c)throw r}}return a}}function o6e(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.5259+In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Vle(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 a6e(i){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Vle(Object(t),!0).forEach(function(n){r6e(i,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(t)):Vle(Object(t)).forEach(function(n){Object.defineProperty(i,n,Object.getOwnPropertyDescriptor(t,n))})}return i}function l6e(i,e){return i6e(i)||s6e(i,e)||h6e(i,e)||o6e()}function c6e(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 u6e(i){var e=c6e(i,"string");return typeof e=="symbol"?e:e+""}function FI(i){"@babel/helpers - typeof";return FI=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},FI(i)}function h6e(i,e){if(i){if(typeof i=="string")return zle(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)?zle(i,e):void 0}}var MG=function(e){if(FI(e)!=="object")return e;var t=EG(e);if(t.props){var n;t.props=a6e({},t.props),t!=null&&(n=t.props)!==null&&n!==void 0&&n.children&&(t.props.children=Array.isArray(t.props.children)?t.props.children.map(MG):MG(t.props.children))}return t},f6e=function(e){return yG(EG(e))},d6e=function(e,t){delete t.__k,kle(MG(e),t)};function p6e(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 m6e=`.float-tooltip-kap {52605260 position: absolute;52615261 width: max-content; /* prevent shrinking near right edge */52625262 max-width: max(50%, 150px);@@ -5267,7 +5267,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
52675267 background: rgba(0,0,0,0.6);52685268 pointer-events: none;52695269 }5270-`;D5e(N5e);var gle=Kr({props:{content:{default:!1},offsetX:{triggerUpdate:!1},offsetY:{triggerUpdate:!1}},init:function(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},r=n.style,s=r===void 0?{}:r,o=!!e&&MP(e)==="object"&&!!e.node&&typeof e.node=="function",a=YV(o?e.node():e);a.style("position")==="static"&&a.style("position","relative"),t.tooltipEl=a.append("div").attr("class","float-tooltip-kap"),Object.entries(s).forEach(function(c){var u=M5e(c,2),f=u[0],d=u[1];return t.tooltipEl.style(f,d)}),t.tooltipEl.style("left","-10000px").style("display","none");var l="tooltip-".concat(Math.round(Math.random()*1e12));t.mouseInside=!1,a.on("mousemove.".concat(l),function(c){t.mouseInside=!0;var u=ZV(c),f=a.node(),d=f.offsetWidth,A=f.offsetHeight,y=[t.offsetX===null||t.offsetX===void 0?"-".concat(u[0]/d*100,"%"):typeof t.offsetX=="number"?"calc(-50% + ".concat(t.offsetX,"px)"):t.offsetX,t.offsetY===null||t.offsetY===void 0?A>130&&A-u[1]<100?"calc(-100% - 6px)":"21px":typeof t.offsetY=="number"?t.offsetY<0?"calc(-100% - ".concat(Math.abs(t.offsetY),"px)"):"".concat(t.offsetY,"px"):t.offsetY];t.tooltipEl.style("left",u[0]+"px").style("top",u[1]+"px").style("transform","translate(".concat(y.join(","),")")),t.content&&t.tooltipEl.style("display","inline")}),a.on("mouseover.".concat(l),function(){t.mouseInside=!0,t.content&&t.tooltipEl.style("display","inline")}),a.on("mouseout.".concat(l),function(){t.mouseInside=!1,t.tooltipEl.style("display","none")})},update:function(e){e.tooltipEl.style("display",e.content&&e.mouseInside?"inline":"none"),e.content?e.content instanceof HTMLElement?(e.tooltipEl.text(""),e.tooltipEl.append(function(){return e.content})):typeof e.content=="string"?e.tooltipEl.html(e.content):P5e(e.content)?(e.tooltipEl.text(""),L5e(e.content,e.tooltipEl.node())):(e.tooltipEl.style("display","none"),console.warn("Tooltip content is invalid, skipping.",e.content,e.content.toString())):e.tooltipEl.text("")}});function F5e(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 B5e=`.scene-nav-info {5270+`;p6e(m6e);var Gle=Qr({props:{content:{default:!1},offsetX:{triggerUpdate:!1},offsetY:{triggerUpdate:!1}},init:function(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},r=n.style,s=r===void 0?{}:r,o=!!e&&FI(e)==="object"&&!!e.node&&typeof e.node=="function",a=AG(o?e.node():e);a.style("position")==="static"&&a.style("position","relative"),t.tooltipEl=a.append("div").attr("class","float-tooltip-kap"),Object.entries(s).forEach(function(c){var u=l6e(c,2),f=u[0],d=u[1];return t.tooltipEl.style(f,d)}),t.tooltipEl.style("left","-10000px").style("display","none");var l="tooltip-".concat(Math.round(Math.random()*1e12));t.mouseInside=!1,a.on("mousemove.".concat(l),function(c){t.mouseInside=!0;var u=gG(c),f=a.node(),d=f.offsetWidth,A=f.offsetHeight,y=[t.offsetX===null||t.offsetX===void 0?"-".concat(u[0]/d*100,"%"):typeof t.offsetX=="number"?"calc(-50% + ".concat(t.offsetX,"px)"):t.offsetX,t.offsetY===null||t.offsetY===void 0?A>130&&A-u[1]<100?"calc(-100% - 6px)":"21px":typeof t.offsetY=="number"?t.offsetY<0?"calc(-100% - ".concat(Math.abs(t.offsetY),"px)"):"".concat(t.offsetY,"px"):t.offsetY];t.tooltipEl.style("left",u[0]+"px").style("top",u[1]+"px").style("transform","translate(".concat(y.join(","),")")),t.content&&t.tooltipEl.style("display","inline")}),a.on("mouseover.".concat(l),function(){t.mouseInside=!0,t.content&&t.tooltipEl.style("display","inline")}),a.on("mouseout.".concat(l),function(){t.mouseInside=!1,t.tooltipEl.style("display","none")})},update:function(e){e.tooltipEl.style("display",e.content&&e.mouseInside?"inline":"none"),e.content?e.content instanceof HTMLElement?(e.tooltipEl.text(""),e.tooltipEl.append(function(){return e.content})):typeof e.content=="string"?e.tooltipEl.html(e.content):f6e(e.content)?(e.tooltipEl.text(""),d6e(e.content,e.tooltipEl.node())):(e.tooltipEl.style("display","none"),console.warn("Tooltip content is invalid, skipping.",e.content,e.content.toString())):e.tooltipEl.text("")}});function A6e(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 g6e=`.scene-nav-info {52715271 position: absolute;52725272 bottom: 5px;52735273 width: 100%;@@ -5282,9 +5282,9 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
52825282 52835283 .scene-container canvas:focus {52845284 outline: none;5285-}`;F5e(B5e);function aG(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 O5e(i){if(Array.isArray(i))return i}function U5e(i){if(Array.isArray(i))return aG(i)}function k5e(i,e,t){return(e=j5e(e))in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function z5e(i){if(typeof Symbol<"u"&&i[Symbol.iterator]!=null||i["@@iterator"]!=null)return Array.from(i)}function V5e(i,e){var t=i==null?null:typeof Symbol<"u"&&i[Symbol.iterator]||i["@@iterator"];if(t!=null){var n,r,s,o,a=[],l=!0,c=!1;try{if(s=(t=t.call(i)).next,e!==0)for(;!(l=(n=s.call(t)).done)&&(a.push(n.value),a.length!==e);l=!0);}catch(u){c=!0,r=u}finally{try{if(!l&&t.return!=null&&(o=t.return(),Object(o)!==o))return}finally{if(c)throw r}}return a}}function G5e(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.5286-In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function q5e(){throw new TypeError(`Invalid attempt to spread non-iterable instance.5287-In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function H5e(i,e){return O5e(i)||V5e(i,e)||vle(i,e)||G5e()}function d1(i){return U5e(i)||z5e(i)||vle(i)||q5e()}function W5e(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 j5e(i){var e=W5e(i,"string");return typeof e=="symbol"?e:e+""}function vle(i,e){if(i){if(typeof i=="string")return aG(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)?aG(i,e):void 0}}var _le=function(e){e instanceof Array?e.forEach(_le):(e.map&&e.map.dispose(),e.dispose())},xle=function(e){e.geometry&&e.geometry.dispose(),e.material&&_le(e.material),e.texture&&e.texture.dispose(),e.children&&e.children.forEach(xle)},X5e=function(e){for(;e.children.length;){var t=e.children[0];e.remove(t),xle(t)}},Gr=window.THREE?window.THREE:{WebGLRenderer:UM,Scene:t0,PerspectiveCamera:$r,Raycaster:nb,SRGBColorSpace:Fr,TextureLoader:yl,Vector2:Oe,Vector3:re,Box3:Ua,Color:zt,Mesh:Hn,SphereGeometry:za,MeshBasicMaterial:fs,BackSide:mi,Timer:YA},lG=Kr({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&&st(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)d(l),A(c);else{var u=Object.assign({},s.position),f=y();e.tweenGroup.add(e.povPosTween=new uo(u).to(l,r).easing(Qr.Quadratic.Out).onUpdate(d).onComplete(function(){e.povPosTween=void 0,e.tweenGroup.remove(this)}).start()),e.tweenGroup.add(e.povTgtTween=new uo(f).to(c,r/3).easing(Qr.Quadratic.Out).onUpdate(A).onComplete(function(){e.povTgtTween=void 0,e.tweenGroup.remove(this)}).start())}return this}return Object.assign({},s.position,{lookAt:y()});function d(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 A(w){var S=new Gr.Vector3(w.x,w.y,w.z);e.controls.enabled&&e.controls.target?e.controls.target=S:s.lookAt(S)}function y(){return Object.assign(new Gr.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 Gr.Vector3(0,0,0),a=Math.max.apply(Math,d1(Object.entries(t).map(function(A){var y=H5e(A,2),w=y[0],S=y[1];return Math.max.apply(Math,d1(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 d=o.clone().sub(s.position).normalize().multiplyScalar(-f);this.cameraPosition(d,o,n)}}return this},getBbox:function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:function(){return!0},n=new Gr.Box3(new Gr.Vector3(0,0,0),new Gr.Vector3(0,0,0)),r=e.objects.filter(t);return r.length?(r.forEach(function(s){return n.expandByObject(s)}),Object.assign.apply(Object,d1(["x","y","z"].map(function(s){return k5e({},s,[n.min[s],n.max[s]])})))):null},getScreenCoords:function(e,t,n,r){var s=new Gr.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 Gr.Vector2(t/e.width*2-1,-(n/e.height)*2+1),o=new Gr.Raycaster;return o.setFromCamera(s,e.camera),Object.assign({},o.ray.at(r,new Gr.Vector3))},intersectingObjects:function(e,t,n){var r=new Gr.Vector2(t/e.width*2-1,-(n/e.height)*2+1),s=new Gr.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;X5e(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 Gr.Scene,camera:new Gr.PerspectiveCamera,timer:new Gr.Timer,tweenGroup:new hg,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,d=n.waitForLoadComplete,A=d===void 0?!0:d;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 gle(t.container),t.pointerPos=new Gr.Vector2,t.pointerPos.x=-2,t.pointerPos.y=-2,["pointermove","pointerdown"].forEach(function(y){return t.container.addEventListener(y,function(w){if(y==="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(),I=window.pageXOffset||document.documentElement.scrollLeft,F=window.pageYOffset||document.documentElement.scrollTop;return{top:P.top+F,left:P.left+I}}},{passive:!0})}),t.container.addEventListener("pointerup",function(y){t.isPointerPressed&&(t.isPointerPressed=!1,!(t.isPointerDragging&&(t.isPointerDragging=!1,!t.clickAfterDrag))&&requestAnimationFrame(function(){y.button===0&&t.onClick(t.hoverObj||null,y,t.intersection),y.button===2&&t.onRightClick&&t.onRightClick(t.hoverObj||null,y,t.intersection)}))},{passive:!0,capture:!0}),t.container.addEventListener("contextmenu",function(y){t.onRightClick&&y.preventDefault()}),t.renderer=new(a?px:Gr.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(y){y.domElement.style.position="absolute",y.domElement.style.top="0px",y.domElement.style.pointerEvents="none",t.container.appendChild(y.domElement)}),t.postProcessingComposer=new oP(t.renderer),t.postProcessingComposer.addPass(new aP(t.scene,t.camera)),t.controls=new{trackball:JI,orbit:tP,fly:nP}[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(d1(t.extraRenderers)).forEach(function(y){return y.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 Gr.Mesh),t.skysphere.visible=!1,t.loadComplete=t.scene.visible=!A,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(d1(e.extraRenderers)).forEach(function(A){return A.setSize(r,s)}),e.camera.aspect=r/s;var o=e.viewOffset.slice(0,2);o.some(function(A){return A})&&(n=e.camera).setViewOffset.apply(n,[r,s].concat(d1(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(A){return A})?(a=e.camera).setViewOffset.apply(a,[l,c].concat(d1(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 Gr.SphereGeometry(e.skyRadius)),t.hasOwnProperty("backgroundColor")){var f=Cm(e.backgroundColor).alpha;f===void 0&&(f=1),e.renderer.setClearColor(new Gr.Color(cae(1,e.backgroundColor)),f)}t.hasOwnProperty("backgroundImageUrl")&&(e.backgroundImageUrl?new Gr.TextureLoader().load(e.backgroundImageUrl,function(A){A.colorSpace=Gr.SRGBColorSpace,e.skysphere.material=new Gr.MeshBasicMaterial({map:A,side:Gr.BackSide}),e.skysphere.visible=!0,e.onBackgroundImageLoaded&&setTimeout(e.onBackgroundImageLoaded),!e.loadComplete&&d()}):(e.skysphere.visible=!1,e.skysphere.material.map=null,!e.loadComplete&&d())),t.hasOwnProperty("showNavInfo")&&(e.navInfo.style.display=e.showNavInfo?null:"none"),t.hasOwnProperty("lights")&&((t.lights||[]).forEach(function(A){return e.scene.remove(A)}),e.lights.forEach(function(A){return e.scene.add(A)})),t.hasOwnProperty("objects")&&((t.objects||[]).forEach(function(A){return e.scene.remove(A)}),e.objects.forEach(function(A){return e.scene.add(A)}));function d(){e.loadComplete=e.scene.visible=!0}}});function $5e(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 Y5e=`.scene-container .clickable {5285+}`;A6e(g6e);function CG(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 v6e(i){if(Array.isArray(i))return i}function _6e(i){if(Array.isArray(i))return CG(i)}function x6e(i,e,t){return(e=M6e(e))in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function y6e(i){if(typeof Symbol<"u"&&i[Symbol.iterator]!=null||i["@@iterator"]!=null)return Array.from(i)}function b6e(i,e){var t=i==null?null:typeof Symbol<"u"&&i[Symbol.iterator]||i["@@iterator"];if(t!=null){var n,r,s,o,a=[],l=!0,c=!1;try{if(s=(t=t.call(i)).next,e!==0)for(;!(l=(n=s.call(t)).done)&&(a.push(n.value),a.length!==e);l=!0);}catch(u){c=!0,r=u}finally{try{if(!l&&t.return!=null&&(o=t.return(),Object(o)!==o))return}finally{if(c)throw r}}return a}}function w6e(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.5286+In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function S6e(){throw new TypeError(`Invalid attempt to spread non-iterable instance.5287+In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function T6e(i,e){return v6e(i)||b6e(i,e)||qle(i,e)||w6e()}function v1(i){return _6e(i)||y6e(i)||qle(i)||S6e()}function E6e(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 M6e(i){var e=E6e(i,"string");return typeof e=="symbol"?e:e+""}function qle(i,e){if(i){if(typeof i=="string")return CG(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)?CG(i,e):void 0}}var Hle=function(e){e instanceof Array?e.forEach(Hle):(e.map&&e.map.dispose(),e.dispose())},Wle=function(e){e.geometry&&e.geometry.dispose(),e.material&&Hle(e.material),e.texture&&e.texture.dispose(),e.children&&e.children.forEach(Wle)},C6e=function(e){for(;e.children.length;){var t=e.children[0];e.remove(t),Wle(t)}},Gr=window.THREE?window.THREE:{WebGLRenderer:jM,Scene:s0,PerspectiveCamera:Yr,Raycaster:lb,SRGBColorSpace:Fr,TextureLoader:bl,Vector2:Oe,Vector3:re,Box3:ka,Color:zt,Mesh:Hn,SphereGeometry:Va,MeshBasicMaterial:fs,BackSide:mi,Timer:eg},RG=Qr({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&&st(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)d(l),A(c);else{var u=Object.assign({},s.position),f=y();e.tweenGroup.add(e.povPosTween=new uo(u).to(l,r).easing(Jr.Quadratic.Out).onUpdate(d).onComplete(function(){e.povPosTween=void 0,e.tweenGroup.remove(this)}).start()),e.tweenGroup.add(e.povTgtTween=new uo(f).to(c,r/3).easing(Jr.Quadratic.Out).onUpdate(A).onComplete(function(){e.povTgtTween=void 0,e.tweenGroup.remove(this)}).start())}return this}return Object.assign({},s.position,{lookAt:y()});function d(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 A(w){var S=new Gr.Vector3(w.x,w.y,w.z);e.controls.enabled&&e.controls.target?e.controls.target=S:s.lookAt(S)}function y(){return Object.assign(new Gr.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 Gr.Vector3(0,0,0),a=Math.max.apply(Math,v1(Object.entries(t).map(function(A){var y=T6e(A,2),w=y[0],S=y[1];return Math.max.apply(Math,v1(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 d=o.clone().sub(s.position).normalize().multiplyScalar(-f);this.cameraPosition(d,o,n)}}return this},getBbox:function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:function(){return!0},n=new Gr.Box3(new Gr.Vector3(0,0,0),new Gr.Vector3(0,0,0)),r=e.objects.filter(t);return r.length?(r.forEach(function(s){return n.expandByObject(s)}),Object.assign.apply(Object,v1(["x","y","z"].map(function(s){return x6e({},s,[n.min[s],n.max[s]])})))):null},getScreenCoords:function(e,t,n,r){var s=new Gr.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 Gr.Vector2(t/e.width*2-1,-(n/e.height)*2+1),o=new Gr.Raycaster;return o.setFromCamera(s,e.camera),Object.assign({},o.ray.at(r,new Gr.Vector3))},intersectingObjects:function(e,t,n){var r=new Gr.Vector2(t/e.width*2-1,-(n/e.height)*2+1),s=new Gr.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;C6e(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 Gr.Scene,camera:new Gr.PerspectiveCamera,timer:new Gr.Timer,tweenGroup:new Ag,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,d=n.waitForLoadComplete,A=d===void 0?!0:d;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 Gle(t.container),t.pointerPos=new Gr.Vector2,t.pointerPos.x=-2,t.pointerPos.y=-2,["pointermove","pointerdown"].forEach(function(y){return t.container.addEventListener(y,function(w){if(y==="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 I=R.getBoundingClientRect(),P=window.pageXOffset||document.documentElement.scrollLeft,F=window.pageYOffset||document.documentElement.scrollTop;return{top:I.top+F,left:I.left+P}}},{passive:!0})}),t.container.addEventListener("pointerup",function(y){t.isPointerPressed&&(t.isPointerPressed=!1,!(t.isPointerDragging&&(t.isPointerDragging=!1,!t.clickAfterDrag))&&requestAnimationFrame(function(){y.button===0&&t.onClick(t.hoverObj||null,y,t.intersection),y.button===2&&t.onRightClick&&t.onRightClick(t.hoverObj||null,y,t.intersection)}))},{passive:!0,capture:!0}),t.container.addEventListener("contextmenu",function(y){t.onRightClick&&y.preventDefault()}),t.renderer=new(a?xx:Gr.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(y){y.domElement.style.position="absolute",y.domElement.style.top="0px",y.domElement.style.pointerEvents="none",t.container.appendChild(y.domElement)}),t.postProcessingComposer=new pI(t.renderer),t.postProcessingComposer.addPass(new mI(t.scene,t.camera)),t.controls=new{trackball:aI,orbit:cI,fly:uI}[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(v1(t.extraRenderers)).forEach(function(y){return y.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 Gr.Mesh),t.skysphere.visible=!1,t.loadComplete=t.scene.visible=!A,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(v1(e.extraRenderers)).forEach(function(A){return A.setSize(r,s)}),e.camera.aspect=r/s;var o=e.viewOffset.slice(0,2);o.some(function(A){return A})&&(n=e.camera).setViewOffset.apply(n,[r,s].concat(v1(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(A){return A})?(a=e.camera).setViewOffset.apply(a,[l,c].concat(v1(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 Gr.SphereGeometry(e.skyRadius)),t.hasOwnProperty("backgroundColor")){var f=Lm(e.backgroundColor).alpha;f===void 0&&(f=1),e.renderer.setClearColor(new Gr.Color(Nae(1,e.backgroundColor)),f)}t.hasOwnProperty("backgroundImageUrl")&&(e.backgroundImageUrl?new Gr.TextureLoader().load(e.backgroundImageUrl,function(A){A.colorSpace=Gr.SRGBColorSpace,e.skysphere.material=new Gr.MeshBasicMaterial({map:A,side:Gr.BackSide}),e.skysphere.visible=!0,e.onBackgroundImageLoaded&&setTimeout(e.onBackgroundImageLoaded),!e.loadComplete&&d()}):(e.skysphere.visible=!1,e.skysphere.material.map=null,!e.loadComplete&&d())),t.hasOwnProperty("showNavInfo")&&(e.navInfo.style.display=e.showNavInfo?null:"none"),t.hasOwnProperty("lights")&&((t.lights||[]).forEach(function(A){return e.scene.remove(A)}),e.lights.forEach(function(A){return e.scene.add(A)})),t.hasOwnProperty("objects")&&((t.objects||[]).forEach(function(A){return e.scene.remove(A)}),e.objects.forEach(function(A){return e.scene.add(A)}));function d(){e.loadComplete=e.scene.visible=!0}}});function R6e(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 P6e=`.scene-container .clickable {52885288 cursor: pointer;5289-}`;$5e(Y5e);function cG(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 Z5e(i){if(Array.isArray(i))return cG(i)}function HS(i,e,t){return(e=n6e(e))in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function K5e(i){if(typeof Symbol<"u"&&i[Symbol.iterator]!=null||i["@@iterator"]!=null)return Array.from(i)}function Q5e(){throw new TypeError(`Invalid attempt to spread non-iterable instance.5290-In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function yle(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 p1(i){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?yle(Object(t),!0).forEach(function(n){HS(i,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(t)):yle(Object(t)).forEach(function(n){Object.defineProperty(i,n,Object.getOwnPropertyDescriptor(t,n))})}return i}function J5e(i,e){if(i==null)return{};var t,n,r=e6e(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 e6e(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 CP(i){return Z5e(i)||K5e(i)||i6e(i)||Q5e()}function t6e(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 n6e(i){var e=t6e(i,"string");return typeof e=="symbol"?e:e+""}function i6e(i,e){if(i){if(typeof i=="string")return cG(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)?cG(i,e):void 0}}function ble(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 r6e=["rendererConfig","waitForGlobeReady"],qS=p1(p1({},window.THREE?window.THREE:{AmbientLight:$A,DirectionalLight:XA,Vector2:Oe,REVISION:"185"}),{},{CSS2DRenderer:GM}),wle=ble("globe",IV),s6e=Object.assign.apply(Object,CP(["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 HS({},i,wle.linkProp(i))}))),o6e=Object.assign.apply(Object,CP(["globeMaterial","globeTileEngineClearCache","getGlobeRadius","getCoords","toGeoCoords"].map(function(i){return HS({},i,wle.linkMethod(i))}))),Sle=ble("renderObjs",lG),a6e=Object.assign.apply(Object,CP(["width","height","backgroundColor","backgroundImageUrl","enablePointerInteraction"].map(function(i){return HS({},i,Sle.linkProp(i))}))),l6e=Object.assign.apply(Object,CP(["lights","postProcessingComposer"].map(function(i){return HS({},i,Sle.linkMethod(i))}))),Tle=Kr({props:p1(p1({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}))}}},s6e),a6e),methods:p1(p1({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 uo(r).to(o,n).easing(Qr.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,d=c.altitude;e.renderObjs.cameraPosition(e.globe.getCoords(u,f,d)),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()}},o6e),l6e),stateInit:function(e){var t=e.rendererConfig,n=e.waitForGlobeReady,r=n===void 0?!0:n,s=J5e(e,r6e),o=new IV(p1({waitForGlobeReady:r},s));return{globe:o,renderObjs:lG({controlType:"orbit",rendererConfig:t,waitForLoadComplete:r,extraRenderers:[new qS.CSS2DRenderer]}).skyRadius(o.getGlobeRadius()*500).showNavInfo(!1).objects([o]).lights([new qS.AmbientLight(13421772,Math.PI),new qS.DirectionalLight(16777215,.6*Math.PI)]),tweenGroup:new hg}},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 qS.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}};qS.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 d=l.hasOwnProperty(f)&&u.__data?l[f](u.__data):null;return["points","hexBinPoints"].some(function(A){return A===f})&&Array.isArray(d)?!1:t.pointerEventsFilter(u,d)}).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},d=a(c),A=d&&d.__globeObjType;return d&&A&&f.hasOwnProperty(A)&&l.hasOwnProperty(A)&&st(f[A])(l[A](d.__data,u))||""}).onHover(function(c,u,f){var d={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},A={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},y=a(c);if(y&&!d.hasOwnProperty(y.__globeObjType)&&(y=null),y!==t.hoverObj){var w,S=t.hoverObj?t.hoverObj.__globeObjType:null,T=t.hoverData,R=y?y.__globeObjType:null,P=(w=y)!==null&&w!==void 0&&w.__data?l[R](y.__data,f):null;S&&S!==R&&d[S]&&d[S](null,T||null),R&&d[R]&&d[R](P,S===R?T:null),t.renderObjs.renderer().domElement.classList[R&&A[R]&&st(t.showPointerCursor)(R,P)?"add":"remove"]("clickable"),t.hoverObj=y,t.hoverData=P}}).onClick(function(c,u,f){if(c){var d={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},A=a(c),y=A.__globeObjType;if(A&&d.hasOwnProperty(y)&&d[y]){var w=[u],S=f!=null&&f.isVector3?f:f?.point;if(y==="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(y)&&w.unshift(l[y](A.__data,f)),d[y].apply(d,w)}}}).onRightClick(function(c,u,f){if(c){var d={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},A=a(c),y=A.__globeObjType;if(A&&d.hasOwnProperty(y)&&d[y]){var w=[u],S=f!=null&&f.isVector3?f:f?.point;if(y==="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(y)&&w.unshift(l[y](A.__data,f)),d[y].apply(d,w)}}}),this._animationCycle()}});var Cle=4,Rx=100,XS=Rx+.2,tp=8,c6e=96,Rle=.045,Ile=.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 Yn=null,IP="",Fs={group:null,tiles:new Map,key:"",lens:""},Mo={group:null,cell:null,fitKey:""},au={group:null,key:""},u6e=180,hG=null,Px=new Map,DP=new Map,Ele=new Map;function Ple(){let i=LT(U.world)==="sphere"&&ch(U.world)!==null;ge.globeToggle.hidden=!i,Lle(),!i&&Yn&&(WS(),Fs.group=null,Mo.group=null,Mo.cell=null,au.group=null,au.key="",Yn._destructor(),Yn=null,IP="",hG=null,ge.globe.replaceChildren())}function NP(){U.globeActive?Lle():Fle()}var jS=2.5,PP=2,Lx=.08,FP=4;function h6e(i){let e=Number.isFinite(i)?i:PP;return cs(jS/2**(e-PP),Lx,FP)}function dG(i){let e=Number.isFinite(i)?Math.max(i,Lx/2):jS,t=(U.lens?.maxZoom??PP)+2;return cs(PP+Math.log2(jS/e),0,t)}function pG(i){if(!Yn||!U.globeActive)return;let e=Yn.pointOfView(),t=cs((Number.isFinite(e.altitude)?e.altitude:jS)/2**i,Lx,FP);Yn.pointOfView({altitude:t},180)}function Lle(){let i=ch(U.world),e=U.engine?.getView();if(Yn&&U.globeActive&&i&&e){let t=Yn.pointOfView(),[n,r]=i.toWorld(t.lat,t.lng);Number.isFinite(n)&&Number.isFinite(r)&&(e.cancelAnimations(),e.setCenter([n,-r]),e.setZoom(dG(t.altitude)))}U.globeActive=!1,ge.globe.hidden=!0,ge.globeToggle.setAttribute("aria-pressed","false"),ge.viewport.hidden=!1,WS(),U.overviewKey="",document.dispatchEvent(new Event("atlas:globe-camera"))}function Dle(){if(!Yn||!U.globeActive)return null;let i=Yn.pointOfView();return{lat:i.lat,lng:i.lng}}function Nle(i,e,t){if(!Yn)return;let n=Yn.pointOfView().altitude;Yn.pointOfView({lat:i,lng:e,altitude:n},t?180:0)}async function Fle(){let i=ch(U.world);if(!i)return;if(U.globeActive=!0,ge.viewport.hidden=!0,ge.globe.hidden=!1,ge.globeToggle.setAttribute("aria-pressed","true"),U.overviewKey="",!Yn){Yn=Tle({animateIn:!1})(ge.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=>w6e(o.pin)).objectLabel(o=>o.pin.location.title).onObjectClick(o=>My(o.pin)).onObjectHover(o=>{ge.globe.style.cursor=o?"pointer":""}).onZoom(()=>{document.dispatchEvent(new Event("atlas:globe-camera")),Mle(),RP(),S6e(),AG()}),document.addEventListener("atlas:selection",b6e),document.addEventListener("atlas:filters",uG),document.addEventListener("atlas:grid",()=>{LP(),uG(),RP()}),document.addEventListener("atlas:labels",RP),Yn.onGlobeClick(({lat:o,lng:a})=>{if(!U.gridEnabled)return;let l=ch(U.world);if(!l)return;let[c,u]=l.toWorld(o,a),f=Ts().descendTarget(U.gridCell,[c,-u]);f&&uA(f)});let s=Yn.controls();s.minDistance=Rx*(1+Lx),s.maxDistance=Rx*(1+FP),Fs.group=new Br,Yn.scene().add(Fs.group),Mo.group=new Br,Yn.scene().add(Mo.group),au.group=new Br,Yn.scene().add(au.group),window.__atlasGlobe={detail:Fs,grid:Mo,labels:au,sprites:Px}}gG();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]);Yn.pointOfView({lat:s,lng:o,altitude:h6e(e.getZoom())})}else Yn.pointOfView({lat:10,lng:0,altitude:jS});let n=U.lens||U.world.lenses[0],r=`${U.volume.stamp}:${U.world.slug}:${n.tiles}`;if(IP!==r){IP=r;let s=await E6e(n);s&&IP===r&&Yn.globeImageUrl(s)}hG!==U.pins&&(hG=U.pins,Px.clear(),DP.clear(),Yn.objectsData(T6e(i))),uG(),kle(),Mle(),LP(),RP(),document.dispatchEvent(new Event("atlas:globe-camera"))}function LP(){if(!Yn||!Mo.group)return;for(let t of[...Mo.group.children])Mo.group.remove(t),t.geometry?.dispose(),t.material?.map?.dispose(),t.material?.dispose();let i=U.globeActive?ch(U.world):null;if(!i||!U.gridEnabled){Mo.cell=null;return}let e=Ts();for(let t of TE()){let n=Ble(t.ring,i),r=mG(n),s=SE(t,{subgridVisible:U.subgridVisible,labelled:p6e(t,r)});if(s){if(s.fill){let o=Ole(e.center(t.hash),i);Mo.group.add(m6e(n,o,s.fill))}Mo.group.add(v6e(n,s.line)),s.label&&Mo.group.add(_6e(s.label,r))}}Mo.cell!==null&&Mo.cell!==U.gridCell&&x6e(i),Mo.cell=U.gridCell,AG()}function Ble(i,e){return i.map(([t,n])=>e.toLatLng(t,-n))}function Ole(i,e){return e.toLatLng(i[0],-i[1])}function f6e(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=cs(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 mG(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 d6e(i){let e=Yn.pointOfView(),t=Math.max(e.altitude,Lx/2),n=50*Math.PI/180,r=2*t*Rx*Math.tan(n/2)/Math.max(1,ge.globe.clientHeight||1),s=Rx*Math.PI/180/r;return{width:Math.abs(i.east-i.west)*s,height:Math.abs(i.north-i.south)*s}}function p6e(i,e){let n=i.role==="neighbor"?Vi.neighborLabelSizePx:Vi.labelSizePx,r=`900 ${n}px ${Vi.labelFont}`,s=d6e(e);return $N(i.hash,r)+9<=s.width&&n+6<=s.height}function m6e(i,e,t){let n=XS+.12,r=f6e(i),s=mG(i),o=Math.max(s.east-s.west,s.north-s.south),a=cs(Math.ceil(o/6),2,24),l=Ix(e[0],e[1],n),c=r.map(([T,R])=>Ix(T,R,n)),u=[...l],f=[];for(let T=1;T<=a;T++){let R=T/a;for(let P of c){let I=l[0]+(P[0]-l[0])*R,F=l[1]+(P[1]-l[1])*R,D=l[2]+(P[2]-l[2])*R,L=n/(Math.hypot(I,F,D)||1);u.push(I*L,F*L,D*L)}}let d=r.length,A=(T,R)=>1+(T-1)*d+R%d;for(let T=0;T<d;T++)f.push(0,A(1,T),A(1,T+1));for(let T=1;T<a;T++)for(let R=0;R<d;R++)f.push(A(T,R),A(T+1,R),A(T,R+1)),f.push(A(T,R+1),A(T+1,R),A(T+1,R+1));let y=new Xn;y.setAttribute("position",new Ln(u,3)),y.setIndex(f);let w=new fs({color:t.color,transparent:!0,opacity:t.opacity,depthWrite:!1,side:2}),S=new Hn(y,w);return S.renderOrder=1,S}function RP(){if(!Yn||!au.group)return;let i=U.globeActive&&U.labelsHeld,e=i?Yn.pointOfView():null,t=i?`${Math.round(e.lat)}:${Math.round(e.lng)}:${e.altitude.toFixed(2)}:${U.gridSystem}:${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 Px){if(!s.visible)continue;let o=DP.get(r);if(!o)continue;let a=A6e(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,u6e))au.group.add(g6e(r,s));AG()}function AG(){if(!Yn)return;let i=Yn.camera().position,e=i.length()||1,t=Rx/e;for(let n of[Mo.group,au.group])if(n)for(let r of n.children){if(!r.isSprite)continue;let s=r.position,o=s.length()||1,a=(s.x*i.x+s.y*i.y+s.z*i.z)/(o*e);r.visible=a>t}}function A6e(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(cs(n,-1,1))*180/Math.PI}function g6e(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 Rh({depthTest:!1,depthWrite:!1,sizeAttenuation:!1,transparent:!0});new yl().load(n.toDataURL("image/png"),u=>{a.map=u,a.needsUpdate=!0});let l=new UA(a);l.position.set(...Ix(e.lat,e.lng,XS+.4)),l.renderOrder=4;let c=.028;return l.scale.set(c*o/40,c,1),l.center.set(.5,0),l}function v6e(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)),d=cs(Math.ceil(f/2),4,48);for(let A=0;A<d;A++){let y=A/d;t.push(...Ix(a+(c-a)*y,l+(u-l)*y,XS+.25))}}t.push(...t.slice(0,3));let n=new ym;n.setPositions(t);let r=new Rf({color:e.color,transparent:!0,opacity:e.opacity,linewidth:e.widthPx,depthWrite:!1});r.resolution.set(ge.globe.clientWidth||1,ge.globe.clientHeight||1);let s=new yx(n,r);return s.computeLineDistances(),s.renderOrder=2,s}function _6e(i,e){let n=i.sizePx*2,r=`500 ${n}px ${Vi.labelFont}`,s=`900 ${n}px ${Vi.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=Vi.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 d=new Rh({depthTest:!1,depthWrite:!1,transparent:!0,sizeAttenuation:!1});new yl().load(o.toDataURL("image/png"),R=>{d.map=R,d.needsUpdate=!0});let A=new UA(d),y=Math.abs(e.north-e.south)*.02,w=Math.abs(e.east-e.west)*.02;A.position.set(...Ix(e.south+y,e.east-w,XS+.35));let S=Math.max(1,ge.globe.clientHeight||1),T=o.height/2/S;return A.scale.set(T*o.width/o.height,T,1),A.center.set(1,0),A.renderOrder=3,A}function x6e(i){let t=TE().find(l=>l.role==="scope"||l.role==="leaf");if(!t)return;let[n,r]=Ole(Ts().center(t.hash),i),s=mG(Ble(t.ring,i)),o=Math.max(s.east-s.west,s.north-s.south),a=cs(o/45,Lx,FP);Yn.pointOfView({lat:n,lng:r,altitude:a},400)}function Mle(){if(!Yn||!Fs.group)return;let i=U.globeActive?U.lens||U.world.lenses[0]:null;if(!i){WS();return}Fs.lens!==i.tiles&&(WS(),Fs.lens=i.tiles);let e=Yn.pointOfView(),t=Math.min(Math.round(dG(e.altitude))+1,i.maxZoom);if(t<=Cle||!i.formats[t]){WS(),Fs.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>c6e&&c>1;)c--;let u=new Set;for(let d=-c;d<=c;d++){let A=l+d;if(!(A<0||A>=r))for(let y=-c;y<=c;y++){let w=((a+y)%n+n)%n;u.add(`${t}/${w}/${A}`)}}let f=`${i.tiles}:${[...u].sort().join(",")}`;if(f!==Fs.key){Fs.key=f;for(let[d,A]of Fs.tiles)u.has(d)||(Fs.group.remove(A),Ule(A),Fs.tiles.delete(d));for(let d of u){if(Fs.tiles.has(d))continue;let[A,y,w]=d.split("/").map(Number),S=y6e(i,A,y,w);Fs.tiles.set(d,S),Fs.group.add(S)}}}function y6e(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<=tp;w++){let S=o-w/tp*r;for(let T=0;T<=tp;T++){let R=s+T/tp*r;a.push(...Ix(S,R,XS)),l.push(T/tp,1-w/tp)}}let u=tp+1;for(let w=0;w<tp;w++)for(let S=0;S<tp;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 Xn;f.setAttribute("position",new Ln(a,3)),f.setAttribute("uv",new Ln(l,2)),f.setIndex(c);let d=new fs,A=new Hn(f,d);A.visible=!1;let y=`${U.volume.base}/tiles/${i.tiles}/${e}/${t}/${n}.${i.formats[e]}`;return new yl().load(y,w=>{w.colorSpace=Fr,d.map=w,d.needsUpdate=!0,A.visible=!0}),A}function WS(){if(Fs.group){for(let i of Fs.tiles.values())Fs.group.remove(i),Ule(i);Fs.tiles.clear(),Fs.key=""}}function Ule(i){i.geometry.dispose(),i.material.map?.dispose(),i.material.dispose()}function kle(){if(Yn){for(let[i,e]of Px){let t=i===U.selectedPin;e.material=Vle(i.category,t);let n=t?Ile:Rle;e.scale.set(n,n,1)}Yn.objectAltitude(i=>i.pin===U.selectedPin?.03:.014)}}function b6e(){if(!Yn||!U.globeActive)return;kle();let i=DP.get(U.selectedPin);if(i){let e=Yn.pointOfView().altitude;Yn.pointOfView({lat:i.lat,lng:i.lng,altitude:e},600)}}function zle(i){return!(i.filteredHidden||U.hiddenCategories.has(i.category.id)||U.gridEnabled&&U.gridCell&&!Pp(i))}function uG(){if(!(!Yn||!U.globeActive))for(let[i,e]of Px)e.visible=zle(i)}function w6e(i){let e=new UA(Vle(i.category,i===U.selectedPin)),t=i===U.selectedPin?Ile:Rle;return e.scale.set(t,t,1),e.visible=zle(i),Px.set(i,e),e}function Vle(i,e){let t=`${jy(i)}:${e?"ringed":"plain"}`,n=Ele.get(t);if(n)return n;n=new Rh({depthWrite:!1,sizeAttenuation:!1}),Ele.set(t,n);let r=U.markerIcons.get(jy(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=aA(),l.strokeText(bu(i.title),40,41),l.fillStyle=lA(i),l.fillText(bu(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 yl().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 Gle(){U.globeActive&&Fle()}function gG(){!Yn||ge.globe.hidden||(Yn.width(ge.globe.clientWidth).height(ge.globe.clientHeight),LP())}function S6e(){if(!Yn||!U.globeActive||!U.gridEnabled)return;let i=Yn.pointOfView(),e=`${U.gridSystem}:${U.gridCell}:${Math.round(dG(i.altitude)*2)}`;e!==Mo.fitKey&&(Mo.fitKey=e,LP())}function T6e(i){let e=[];for(let t of U.pins){let[n,r]=lv(t.location.lat,t.location.lng),[s,o]=i.toLatLng(n,-r);e.push({lat:s,lng:o,pin:t}),DP.set(t,{lat:s,lng:o})}return e}async function E6e(i){let e=Math.min(Cle,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(M6e(u).then(f=>{f&&o.drawImage(f,c*256,l*256,256,256)}))}return await Promise.all(a),s.toDataURL("image/jpeg",.92)}function M6e(i){return new Promise(e=>{let t=new Image;t.onload=()=>e(t),t.onerror=()=>e(null),t.src=i})}function qle(){let i=U.lens,e=ge.overviewCanvas,t=e.getContext("2d"),n=Of(),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],d=Math.floor(n[0]/r*2**l),A=Math.ceil(n[2]/r*2**l),y=Math.floor(-n[3]/r*2**l),w=Math.ceil(-n[1]/r*2**l);for(let S=y;S<w;S++)for(let T=d;T<A;T++){if(!f||!OP(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}`}Dx()}function Dx(){let i=Dle();if(i){let w=ch(U.world);if(!w||!U.lens)return;let S=Of(),[T,R]=w.toWorld(i.lat,i.lng),P=ge.overviewCanvas,I=cs((T-S[0])/(S[2]-S[0]),0,1),F=cs((R+S[3])/(S[3]-S[1]),0,1);U.overviewKey="",ge.overviewShelf.hidden=!1;let D=ge.overviewViewport.style,L=22;D.left=`${I*P.width-L/2}px`,D.top=`${F*P.height-L/2}px`,D.width=`${L}px`,D.height=`${L}px`;return}let e=U.engine?.getView();if(!e||!U.lens)return;let t=Of(),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,ge.overviewShelf.hidden=a,a))return;let c=ge.overviewCanvas,u=cs((n[0]-t[0])/r,0,1),f=cs((n[2]-t[0])/r,0,1),d=cs((t[3]-n[3])/s,0,1),A=cs((t[3]-n[1])/s,0,1),y=ge.overviewViewport.style;y.left=`${u*c.width}px`,y.top=`${d*c.height}px`,y.width=`${Math.max(8,(f-u)*c.width)}px`,y.height=`${Math.max(8,(A-d)*c.height)}px`}function BP(i,e=!0){U.overviewDocked=i,i&&U.overviewPointer!==null&&(U.overviewPointer=null,Nx()),ge.overviewShelf.classList.toggle("is-docked",i),ge.overviewDock.setAttribute("aria-expanded",String(!i));let t=i?"Bring the overview back":"Put the overview away";ge.overviewDock.setAttribute("aria-label",t),ge.overviewDock.title=t,e&&xu()}function vG(i,e){let t=ge.overviewCanvas.getBoundingClientRect(),n=Of(),r=(a,l,c)=>cs((a-l)/(c-l),0,1);if(U.globeActive){let a=ch(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);Nle(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 mc(i){return new oY({updateWhileAnimating:!0,...i})}function Hle(){let i=U.volume.tileGrid.size,e=[0,-i,i,0];U.projection=new xp({code:"ATLAS:PIXELS",units:"pixels",extent:e}),U.sources={grid:new dd({wrapX:!1}),gridContext:new dd({wrapX:!1}),zoneScrim:new dd({wrapX:!1}),zones:new dd({wrapX:!1}),zoneTitles:new dd({wrapX:!1}),text:new dd({wrapX:!1}),pins:new dd({wrapX:!1}),priority:new dd({wrapX:!1})},U.layers={raster:new d6({zIndex:0}),rasterDetail:new d6({zIndex:1}),grid:mc({source:U.sources.grid,style:XN,renderOrder:Bc,renderBuffer:40,zIndex:5}),zoneScrim:mc({source:U.sources.zoneScrim,style:AX,zIndex:6}),zones:mc({source:U.sources.zones,style:gX,renderBuffer:32,zIndex:10}),zoneTitles:mc({source:U.sources.zoneTitles,style:vX,renderOrder:Bc,renderBuffer:160,zIndex:20}),zoneTitleDetail:mc({source:U.sources.zoneTitles,style:_X,renderOrder:Bc,renderBuffer:160,zIndex:44}),text:mc({source:U.sources.text,style:uX,renderOrder:Bc,renderBuffer:220,zIndex:30}),textDetail:mc({source:U.sources.text,style:hX,renderOrder:Bc,renderBuffer:220,zIndex:45}),zoneText:mc({source:U.sources.text,style:fX,renderOrder:Bc,renderBuffer:220,zIndex:41}),pins:mc({source:U.sources.pins,style:aX,renderOrder:Bc,renderBuffer:48,zIndex:40}),zonePins:mc({source:U.sources.pins,style:lX,renderOrder:Bc,renderBuffer:48,zIndex:42}),pinLabels:mc({source:U.sources.pins,style:cX,renderOrder:Bc,renderBuffer:180,zIndex:45}),gridContext:mc({source:U.sources.gridContext,style:XN,renderOrder:Bc,renderBuffer:40,zIndex:48}),priority:mc({source:U.sources.priority,style:dX,renderOrder:Bc,renderBuffer:220,zIndex:50})},U.engine=new D$({target:ge.viewport,layers:Object.values(U.layers),controls:qE({attribution:!1,rotate:!1,zoom:!1}),interactions:YE({onFocusOnly:!1}),view:kP(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&&Nx()}),U.engine.on("postrender",Dx),ge.viewport.addEventListener("wheel",()=>{document.activeElement!==ge.viewport&&ge.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){uA(r.hash);return}}let n=U.engine.forEachFeatureAtPixel(t.pixel,(r,s)=>UP(s)&&r.get("pin")||null,{hitTolerance:5,layerFilter:UP});n&&My(n)}),U.engine.on("pointermove",t=>{if(t.dragging){cv(null);return}let n=U.engine.forEachFeatureAtPixel(t.pixel,(o,a)=>UP(a)&&o.get("pin")||null,{hitTolerance:4,layerFilter:UP}),r=n&&lh(n.category)==="text"?null:n;cv(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",()=>cv(null))}function UP(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 kP(i,e=null){let t=U.volume.tileGrid.size,n=e||[0,-t,t,0];return new Hl({projection:U.projection,center:[(n[0]+n[2])/2,(n[1]+n[3])/2],resolutions:_G(i),minZoom:0,maxZoom:i,extent:n,constrainResolution:!1,smoothResolutionConstraint:!1,showFullExtent:!0,zoom:0})}function _G(i){let e=U.volume.tileGrid.size/U.volume.tileGrid.tileSize;return Array.from({length:i+1},(t,n)=>e/2**n)}async function sd(i,e){U.volume=U.catalog.volumes.find(r=>r.slug===i)||U.catalog.volumes[0],U.engine||Hle(),!e&&!U.restore&&(U.restore=ev(U.volume.slug)),ge.volume.value=U.volume.slug,km(ge.world,U.volume.worlds,"title"),ge.world.disabled=U.volume.worlds.length===1,ge.world.title=ge.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.worlds.find(r=>r.slug===e)||t&&U.volume.worlds.find(r=>r.slug===t.world);await xG((n||U.volume.worlds[0]).slug)}async function xG(i){let e=U.volume.worlds.find(s=>s.slug===i)||U.volume.worlds[0],t=++U.worldRun;ge.loading.hidden=!1;let n;try{n=await BX(e)}catch(s){console.error(`world ${e.slug} failed to load`,s),U.worldRun===t&&(ge.loading.hidden=!0,AA());return}if(U.worldRun!==t)return;U.settling=!0,U.world=n,document.documentElement.style.setProperty("--icon-outset-color",aA()),ge.world.value=U.world.slug,km(ge.lens,U.world.lenses,"name"),ge.lensField.hidden=U.world.lenses.length<2,U.styleCache.clear(),cv(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)),BP(!!U.restore?.overviewDocked,!1),AE(U.restore?!!U.restore.dockFolded:!0,!1),U.dockDismissed=!!U.restore?.dockDismissed,U.search="",ge.search.value="",ge.dock.hidden=!1,ed(),LX(),QN(),IX(),yG(r?cs(r.lens,0,U.world.lenses.length-1):0,!0),Ple(),U.restore=null,ge.sidebar.classList.remove("is-open"),ge.mobileLegend.setAttribute("aria-expanded","false"),vj(),U.settling=!1,xu()}function yG(i,e=!1){let t=U.lens;U.lens=U.world.lenses[i]||U.world.lenses[0];let n=U.lens,r=e?null:I6e(t,n),s=mh(n);if(ge.lens.value=String(U.world.lenses.indexOf(U.lens)),e)U.engine.setView(kP(s,Of()));else{let w=U.engine.getView(),S=kP(s,Of());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},ge.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&&(ge.loading.hidden=!0))};return w.on("tileloadend",()=>S(!1)),w.on("tileloaderror",()=>S(!0)),w},c=(w,S)=>l(new Aj({projection:U.projection,tileGrid:new wy({extent:[0,-U.volume.tileGrid.size,U.volume.tileGrid.size,0],origin:[0,0],resolutions:_G(w),tileSize:U.volume.tileGrid.tileSize}),cacheSize:64,interpolate:n.interpolate,transition:0,wrapX:!1,tileUrlFunction:([T,R,P])=>{let I=n.formats[T];if(!(!I||R<0||P<0||!S(T,R,P)))return`${U.volume.base}/tiles/${encodeURIComponent(n.tiles)}/${T}/${R}/${P}.${I}`}})),u=n.fullZoom??n.maxZoom,f=c(u,(w,S,T)=>OP(n,w,S,T)),d=U.layers.raster.getSource();U.layers.raster.setSource(f),U.layers.raster.setExtent(Of()),U.layers.raster.setBackground(n.background||void 0),d?.clear();let A=U.layers.rasterDetail.getSource();n.maxZoom>u?(U.layers.rasterDetail.setSource(c(n.maxZoom,(w,S,T)=>w>u&&OP(n,w,S,T))),U.layers.rasterDetail.setExtent(Of()),U.layers.rasterDetail.setVisible(!0)):U.layers.rasterDetail.setVisible(!1),A?.clear(),Oy(),U.gridEnabled&&(Dc(),U.layers.pins.changed(),U.layers.text.changed(),U.layers.priority.changed()),U.overviewKey="",qle();let y=e&&U.restore?.map===U.world.slug?U.restore:null;if(U.renderedShard!==(n.shard||0)&&(QN(),Lc()),y?.center&&Number.isFinite(y.zoom)){let w=U.engine.getView();w.setCenter(y.center),w.setZoom(y.zoom),U.fitZoom=y.zoom,mA()}else e?requestAnimationFrame(P6e):(r&&U.engine.getView().animate({center:r,duration:200}),mA());xu()}function OP(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=R6e(i,e,r),l=o*r.w+s;return(a[l>>3]&1<<(l&7))!==0}function R6e(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 mh(i){return i.maxZoom+2}function Nx(){mA(),xu()}function I6e(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+cs(r,0,1)*e.bounds.width,-(e.bounds.y+cs(s,0,1)*e.bounds.height)]}function Wle(){let e=document.querySelector(".app-shell").classList.toggle("sidebar-collapsed");ge.mobileLegend.setAttribute("aria-expanded",String(!e)),requestAnimationFrame(()=>U.engine?.updateSize())}function Of(){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 P6e(){if(!U.engine||!U.lens)return;let i=U.engine.getView();i.fit(Of(),{size:U.engine.getSize(),padding:[36,36,36,36],maxZoom:U.lens.maxZoom,duration:0}),U.fitZoom=i.getZoom()||0,mA()}function $S(i){let e=U.engine.getView(),t=e.getZoom()||0;e.animate({zoom:cs(t+i,U.lens.minZoom,mh(U.lens)),duration:140})}function mA(){let i=U.engine?.getView().getZoom();if(ge.viewport.dataset.zoom=Number.isFinite(i)?i.toFixed(3):"",!U.engine||!U.pins.length){ge.visibleCount.textContent="0 locations visible";return}let e=U.engine.getView().calculateExtent(U.engine.getSize()),t=0;for(let n of U.pins){if(Oc(n))continue;let[r,s]=n.coordinate;r>=e[0]&&r<=e[2]&&s>=e[1]&&s<=e[3]&&t++}ge.visibleCount.textContent=`${wu(U.eligibleLocations)} enabled \xB7 ${wu(t)} in view`}function jle(){ge.volume.addEventListener("change",()=>{sd(ge.volume.value)}),ge.world.addEventListener("change",()=>{xG(ge.world.value)}),ge.addBundles.addEventListener("click",()=>{r5()}),ge.emptyOpen.addEventListener("click",()=>{r5()}),ge.lens.addEventListener("change",()=>{yG(Number(ge.lens.value)),Gle()}),ge.globeToggle.addEventListener("click",()=>NP()),ge.legend.addEventListener("change",n=>{let r=n.target;if(r.dataset.sectionToggle){NX(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),Lc(),Cp()});let i=null,e=()=>{for(let s of ge.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&&ge.layers.contains(r)&&r.classList.add("is-hovered")};ge.layers.addEventListener("pointermove",n=>{i={x:n.clientX,y:n.clientY},e()},{passive:!0}),ge.layers.addEventListener("pointerleave",()=>{i=null,e()}),ge.layers.addEventListener("scroll",e,{passive:!0}),ge.layers.addEventListener("click",n=>{let r=n.target.closest("[data-only-category], [data-only-section]");if(r){n.preventDefault(),n.stopPropagation(),FX(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),zE()}),ge.soloChip.addEventListener("click",()=>$y(!0)),en("#expand-all").addEventListener("click",()=>n5(!1)),en("#collapse-all").addEventListener("click",()=>n5(!0)),en("#show-all").addEventListener("click",()=>$y(!0)),en("#hide-all").addEventListener("click",()=>$y(!1)),ge.zoneToggle.addEventListener("change",()=>{UE(ge.zoneToggle.checked)}),ge.zoneIndex.addEventListener("click",n=>{let r=n.target.closest("[data-zone]");r&&MX(Number(r.dataset.zone))}),ge.zoneIndex.addEventListener("contextmenu",n=>{let r=n.target.closest("[data-zone]");r&&(n.preventDefault(),CX(Number(r.dataset.zone)))}),ge.search.addEventListener("input",()=>{U.search=ge.search.value.trim().toLocaleLowerCase(),Lc(),U.search&&Ey()}),ge.dockFold.addEventListener("click",()=>{cN(!U.dockFolded)}),ge.searchResults.addEventListener("click",n=>{let r=n.target.closest("[data-location]");if(!r)return;let s=U.pinByID.get(Number(r.dataset.location));s&&uN(s)}),ge.detailLinks.addEventListener("click",n=>{let r=n.target.closest("[data-location]");if(!r)return;let s=U.pinByID.get(Number(r.dataset.location));s&&uN(s)}),en("#close-detail").addEventListener("click",ed),en("#zoom-in").addEventListener("click",()=>U.globeActive?pG(1):$S(1)),en("#zoom-out").addEventListener("click",()=>U.globeActive?pG(-1):$S(-1)),ge.gridBack.addEventListener("click",bN),ge.gridSystem.addEventListener("click",wN),ge.gridInput.addEventListener("input",()=>{let n=Ts(),r=n.normalizeInput(ge.gridInput.value);ge.gridInput.value=r,n.parseInput(r)!==null&&uA(r)}),ge.subgridToggle.addEventListener("click",()=>{By(!U.subgridVisible),ge.viewport.focus({preventScroll:!0})}),ge.gridInput.addEventListener("keydown",n=>{if(n.key===" "){n.preventDefault(),By(!U.subgridVisible);return}if(n.key==="`"){n.preventDefault(),ge.globeToggle.hidden||NP();return}n.key==="Escape"&&(n.preventDefault(),n.stopPropagation(),ge.viewport.focus({preventScroll:!0}))}),ge.viewport.addEventListener("keydown",n=>{if(!mE(n.target)){if(n.key==="+"||n.key==="=")$S(1);else if(n.key==="-")$S(-1);else if(n.key==="Escape")ed();else return;n.preventDefault()}}),window.addEventListener("contextmenu",n=>{mE(n.target)||n.preventDefault()}),window.addEventListener("keydown",n=>{if((n.metaKey||n.ctrlKey)&&n.key.toLocaleLowerCase()==="r"){n.preventDefault(),location.reload();return}if((n.metaKey||n.ctrlKey)&&n.key.toLocaleLowerCase()==="g"){n.preventDefault(),wN();return}if(!mE(n.target)){if(n.key==="`"&&!n.metaKey&&!n.ctrlKey&&!n.altKey){ge.globeToggle.hidden||(n.preventDefault(),NP());return}if((n.metaKey||n.ctrlKey)&&n.key.toLocaleLowerCase()==="k"){n.preventDefault(),ge.search.focus(),ge.search.select();return}if((n.metaKey||n.ctrlKey)&&n.altKey&&n.code==="KeyB"){n.preventDefault(),ge.dock.hidden||cN(!U.dockFolded);return}if((n.metaKey||n.ctrlKey)&&n.key.toLocaleLowerCase()==="b"){n.preventDefault(),Wle();return}kj(n)||n.key.toLocaleLowerCase()==="z"&&(n.preventDefault(),n.repeat||kE(!0))}}),window.addEventListener("keyup",n=>{n.key.toLocaleLowerCase()==="z"&&kE(!1)}),window.addEventListener("blur",()=>kE(!1)),window.addEventListener("hashchange",()=>{let n=tv();n.volume===U.volume?.slug&&n.world===U.world?.slug||(U.restore=null,sd(n.volume||U.catalog.volumes[0].slug,n.world))}),window.addEventListener("resize",()=>{U.engine?.updateSize(),Dx(),gG()}),document.addEventListener("atlas:globe-camera",()=>Dx()),ge.overview.addEventListener("pointerdown",n=>{U.overviewDocked||n.pointerType==="mouse"&&n.button!==0||(n.preventDefault(),ge.overview.setPointerCapture(n.pointerId),U.overviewPointer=n.pointerId,vG(n,!0))}),ge.overview.addEventListener("pointermove",n=>{U.overviewPointer===n.pointerId&&(n.preventDefault(),vG(n,!1))});let t=n=>{U.overviewPointer===n.pointerId&&(U.overviewPointer=null,Nx())};ge.overview.addEventListener("pointerup",t),ge.overview.addEventListener("pointercancel",t),ge.overviewDock.addEventListener("click",()=>{BP(!U.overviewDocked),ge.viewport.focus({preventScroll:!0})}),ge.mobileLegend.addEventListener("click",()=>{let n=ge.sidebar.classList.toggle("is-open");ge.mobileLegend.setAttribute("aria-expanded",String(n))})}function Xle(){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?mh(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:!ge.detail.hidden,detailTitle:ge.detail.hidden?null:ge.detailTitle.textContent||null,searchQuery:U.search,searchResultsVisible:!ge.searchResults.hidden,soloChip:ge.soloChip.hidden?null:ge.soloChip.textContent,visibleCountText:ge.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,system:U.gridSystem,prefix:U.gridCell,maximumDepth:Gj(),extent:U.gridEnabled?SN():null,cells:[...U.sources.grid.getFeatures(),...U.sources.gridContext.getFeatures()].map(e=>e.get("gridCell")),priorityPins:U.gridCell?U.pins.filter(e=>!e.filteredHidden&&Pp(e)).length:0}});window.__atlasDebug={snapshot:i,setLayerVisible:(e,t)=>U.layers[e]?.setVisible(t),refreshCatalog:AA},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 $le(){jle();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(),km(ge.volume,U.catalog.volumes,"title"),i5(),window.runtime?.EventsOn?.("atlas:catalog-changed",()=>{AA()}),U.catalog.volumes.length){let e=tv(),t=ev(),n=t&&(!e.volume||e.volume===t.volume&&e.world===t.world);U.restore=n?t:null,await sd(e.volume||t?.volume||U.catalog.volumes[0].slug,e.world||t?.world),U.restore=null}else ge.loading.hidden=!0;Xle(),requestAnimationFrame(()=>ge.viewport.focus({preventScroll:!0}))}catch(i){ge.loading.hidden=!0,ge.fatalMessage.textContent=i instanceof Error?i.message:String(i),ge.fatal.hidden=!1}}$le();})();5289+}`;R6e(P6e);function PG(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 I6e(i){if(Array.isArray(i))return PG(i)}function ZS(i,e,t){return(e=O6e(e))in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function L6e(i){if(typeof Symbol<"u"&&i[Symbol.iterator]!=null||i["@@iterator"]!=null)return Array.from(i)}function D6e(){throw new TypeError(`Invalid attempt to spread non-iterable instance.5290+In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function jle(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 _1(i){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?jle(Object(t),!0).forEach(function(n){ZS(i,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(t)):jle(Object(t)).forEach(function(n){Object.defineProperty(i,n,Object.getOwnPropertyDescriptor(t,n))})}return i}function N6e(i,e){if(i==null)return{};var t,n,r=F6e(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 F6e(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 BI(i){return I6e(i)||L6e(i)||U6e(i)||D6e()}function B6e(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 O6e(i){var e=B6e(i,"string");return typeof e=="symbol"?e:e+""}function U6e(i,e){if(i){if(typeof i=="string")return PG(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)?PG(i,e):void 0}}function Xle(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 k6e=["rendererConfig","waitForGlobeReady"],YS=_1(_1({},window.THREE?window.THREE:{AmbientLight:JA,DirectionalLight:QA,Vector2:Oe,REVISION:"185"}),{},{CSS2DRenderer:ZM}),$le=Xle("globe",KV),z6e=Object.assign.apply(Object,BI(["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 ZS({},i,$le.linkProp(i))}))),V6e=Object.assign.apply(Object,BI(["globeMaterial","globeTileEngineClearCache","getGlobeRadius","getCoords","toGeoCoords"].map(function(i){return ZS({},i,$le.linkMethod(i))}))),Yle=Xle("renderObjs",RG),G6e=Object.assign.apply(Object,BI(["width","height","backgroundColor","backgroundImageUrl","enablePointerInteraction"].map(function(i){return ZS({},i,Yle.linkProp(i))}))),q6e=Object.assign.apply(Object,BI(["lights","postProcessingComposer"].map(function(i){return ZS({},i,Yle.linkMethod(i))}))),Zle=Qr({props:_1(_1({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}))}}},z6e),G6e),methods:_1(_1({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 uo(r).to(o,n).easing(Jr.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,d=c.altitude;e.renderObjs.cameraPosition(e.globe.getCoords(u,f,d)),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()}},V6e),q6e),stateInit:function(e){var t=e.rendererConfig,n=e.waitForGlobeReady,r=n===void 0?!0:n,s=N6e(e,k6e),o=new KV(_1({waitForGlobeReady:r},s));return{globe:o,renderObjs:RG({controlType:"orbit",rendererConfig:t,waitForLoadComplete:r,extraRenderers:[new YS.CSS2DRenderer]}).skyRadius(o.getGlobeRadius()*500).showNavInfo(!1).objects([o]).lights([new YS.AmbientLight(13421772,Math.PI),new YS.DirectionalLight(16777215,.6*Math.PI)]),tweenGroup:new Ag}},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 YS.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}};YS.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 d=l.hasOwnProperty(f)&&u.__data?l[f](u.__data):null;return["points","hexBinPoints"].some(function(A){return A===f})&&Array.isArray(d)?!1:t.pointerEventsFilter(u,d)}).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},d=a(c),A=d&&d.__globeObjType;return d&&A&&f.hasOwnProperty(A)&&l.hasOwnProperty(A)&&st(f[A])(l[A](d.__data,u))||""}).onHover(function(c,u,f){var d={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},A={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},y=a(c);if(y&&!d.hasOwnProperty(y.__globeObjType)&&(y=null),y!==t.hoverObj){var w,S=t.hoverObj?t.hoverObj.__globeObjType:null,T=t.hoverData,R=y?y.__globeObjType:null,I=(w=y)!==null&&w!==void 0&&w.__data?l[R](y.__data,f):null;S&&S!==R&&d[S]&&d[S](null,T||null),R&&d[R]&&d[R](I,S===R?T:null),t.renderObjs.renderer().domElement.classList[R&&A[R]&&st(t.showPointerCursor)(R,I)?"add":"remove"]("clickable"),t.hoverObj=y,t.hoverData=I}}).onClick(function(c,u,f){if(c){var d={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},A=a(c),y=A.__globeObjType;if(A&&d.hasOwnProperty(y)&&d[y]){var w=[u],S=f!=null&&f.isVector3?f:f?.point;if(y==="globe"){var T=n.toGeoCoords(S),R=T.lat,I=T.lng;w.unshift({lat:R,lng:I})}else w.push(n.toGeoCoords(S));l.hasOwnProperty(y)&&w.unshift(l[y](A.__data,f)),d[y].apply(d,w)}}}).onRightClick(function(c,u,f){if(c){var d={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},A=a(c),y=A.__globeObjType;if(A&&d.hasOwnProperty(y)&&d[y]){var w=[u],S=f!=null&&f.isVector3?f:f?.point;if(y==="globe"){var T=n.toGeoCoords(S),R=T.lat,I=T.lng;w.unshift({lat:R,lng:I})}else w.push(n.toGeoCoords(S));l.hasOwnProperty(y)&&w.unshift(l[y](A.__data,f)),d[y].apply(d,w)}}}),this._animationCycle()}});var Jle=4,Fx=100,JS=Fx+.2,rp=8,H6e=96,ece=.045,tce=.08;function Bx(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 Yn=null,UI="",Ds={group:null,tiles:new Map,key:"",lens:""},Mo={group:null,cell:null,fitKey:""},au={group:null,key:""},W6e=180,LG=null,Ox=new Map,VI=new Map,Kle=new Map;function nce(){let i=UT(O.world)==="sphere"&&lh(O.world)!==null;ge.globeToggle.hidden=!i,ice(),!i&&Yn&&(KS(),Ds.group=null,Mo.group=null,Mo.cell=null,au.group=null,au.key="",Yn._destructor(),Yn=null,UI="",LG=null,ge.globe.replaceChildren())}function GI(){O.globeActive?ice():oce()}var QS=2.5,kI=2,Ux=.08,qI=4;function j6e(i){let e=Number.isFinite(i)?i:kI;return us(QS/2**(e-kI),Ux,qI)}function NG(i){let e=Number.isFinite(i)?Math.max(i,Ux/2):QS,t=(O.lens?.maxZoom??kI)+2;return us(kI+Math.log2(QS/e),0,t)}function FG(i){if(!Yn||!O.globeActive)return;let e=Yn.pointOfView(),t=us((Number.isFinite(e.altitude)?e.altitude:QS)/2**i,Ux,qI);Yn.pointOfView({altitude:t},180)}function ice(){let i=lh(O.world),e=O.engine?.getView();if(Yn&&O.globeActive&&i&&e){let t=Yn.pointOfView(),[n,r]=i.toWorld(t.lat,t.lng);Number.isFinite(n)&&Number.isFinite(r)&&(e.cancelAnimations(),e.setCenter([n,-r]),e.setZoom(NG(t.altitude)))}O.globeActive=!1,ge.globe.hidden=!0,ge.globeToggle.setAttribute("aria-pressed","false"),ge.viewport.hidden=!1,KS(),O.overviewKey="",document.dispatchEvent(new Event("atlas:globe-camera"))}function rce(){if(!Yn||!O.globeActive)return null;let i=Yn.pointOfView();return{lat:i.lat,lng:i.lng}}function sce(i,e,t){if(!Yn)return;let n=Yn.pointOfView().altitude;Yn.pointOfView({lat:i,lng:e,altitude:n},t?180:0)}async function oce(){let i=lh(O.world);if(!i)return;if(O.globeActive=!0,ge.viewport.hidden=!0,ge.globe.hidden=!1,ge.globeToggle.setAttribute("aria-pressed","true"),O.overviewKey="",!Yn){Yn=Zle({animateIn:!1})(ge.globe).backgroundColor("#0b0e12").showAtmosphere(!0).atmosphereColor("#8a6f5b").atmosphereAltitude(.12).objectLat(o=>o.lat).objectLng(o=>o.lng).objectAltitude(o=>o.pin===O.selectedPin?.03:.014).objectThreeObject(o=>r8e(o.pin)).objectLabel(o=>o.pin.location.title).onObjectClick(o=>Fy(o.pin)).onObjectHover(o=>{ge.globe.style.cursor=o?"pointer":""}).onZoom(()=>{document.dispatchEvent(new Event("atlas:globe-camera")),Qle(),OI(),s8e(),OG()}),document.addEventListener("atlas:selection",i8e),document.addEventListener("atlas:filters",IG),document.addEventListener("atlas:grid",()=>{zI(),IG(),OI()}),document.addEventListener("atlas:labels",OI),Yn.onGlobeClick(({lat:o,lng:a})=>{if(!O.gridEnabled)return;let l=lh(O.world);if(!l)return;let[c,u]=l.toWorld(o,a),f=Ss().descendTarget(O.gridCell,[c,-u]);f&&mA(f)});let s=Yn.controls();s.minDistance=Fx*(1+Ux),s.maxDistance=Fx*(1+qI),Ds.group=new Br,Yn.scene().add(Ds.group),Mo.group=new Br,Yn.scene().add(Mo.group),au.group=new Br,Yn.scene().add(au.group),window.__atlasGlobe={detail:Ds,grid:Mo,labels:au,sprites:Ox}}UG();let e=O.engine?.getView(),t=e?.getCenter();if(t&&Number.isFinite(t[0])&&Number.isFinite(t[1])){let[s,o]=i.toLatLng(t[0],-t[1]);Yn.pointOfView({lat:s,lng:o,altitude:j6e(e.getZoom())})}else Yn.pointOfView({lat:10,lng:0,altitude:QS});let n=O.lens||O.world.lenses[0],r=`${O.volume.stamp}:${O.world.slug}:${n.tiles}`;if(UI!==r){UI=r;let s=await a8e(n);s&&UI===r&&Yn.globeImageUrl(s)}LG!==O.features&&(LG=O.features,Ox.clear(),VI.clear(),Yn.objectsData(o8e(i))),IG(),uce(),Qle(),zI(),OI(),document.dispatchEvent(new Event("atlas:globe-camera"))}function zI(){if(!Yn||!Mo.group)return;for(let t of[...Mo.group.children])Mo.group.remove(t),t.geometry?.dispose(),t.material?.map?.dispose(),t.material?.dispose();let i=O.globeActive?lh(O.world):null;if(!i||!O.gridEnabled){Mo.cell=null;return}let e=Ss();for(let t of LE()){let n=ace(t.ring,i),r=BG(n),s=IE(t,{subgridVisible:O.subgridVisible,labelled:Y6e(t,r)});if(s){if(s.fill){let o=lce(e.center(t.hash),i);Mo.group.add(Z6e(n,o,s.fill))}Mo.group.add(J6e(n,s.line)),s.label&&Mo.group.add(e8e(s.label,r))}}Mo.cell!==null&&Mo.cell!==O.gridCell&&t8e(i),Mo.cell=O.gridCell,OG()}function ace(i,e){return i.map(([t,n])=>e.toLatLng(t,-n))}function lce(i,e){return e.toLatLng(i[0],-i[1])}function X6e(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=us(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 BG(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 $6e(i){let e=Yn.pointOfView(),t=Math.max(e.altitude,Ux/2),n=50*Math.PI/180,r=2*t*Fx*Math.tan(n/2)/Math.max(1,ge.globe.clientHeight||1),s=Fx*Math.PI/180/r;return{width:Math.abs(i.east-i.west)*s,height:Math.abs(i.north-i.south)*s}}function Y6e(i,e){let n=i.role==="neighbor"?Vi.neighborLabelSizePx:Vi.labelSizePx,r=`900 ${n}px ${Vi.labelFont}`,s=$6e(e);return u5(i.hash,r)+9<=s.width&&n+6<=s.height}function Z6e(i,e,t){let n=JS+.12,r=X6e(i),s=BG(i),o=Math.max(s.east-s.west,s.north-s.south),a=us(Math.ceil(o/6),2,24),l=Bx(e[0],e[1],n),c=r.map(([T,R])=>Bx(T,R,n)),u=[...l],f=[];for(let T=1;T<=a;T++){let R=T/a;for(let I of c){let P=l[0]+(I[0]-l[0])*R,F=l[1]+(I[1]-l[1])*R,D=l[2]+(I[2]-l[2])*R,L=n/(Math.hypot(P,F,D)||1);u.push(P*L,F*L,D*L)}}let d=r.length,A=(T,R)=>1+(T-1)*d+R%d;for(let T=0;T<d;T++)f.push(0,A(1,T),A(1,T+1));for(let T=1;T<a;T++)for(let R=0;R<d;R++)f.push(A(T,R),A(T+1,R),A(T,R+1)),f.push(A(T,R+1),A(T+1,R),A(T+1,R+1));let y=new Xn;y.setAttribute("position",new Ln(u,3)),y.setIndex(f);let w=new fs({color:t.color,transparent:!0,opacity:t.opacity,depthWrite:!1,side:2}),S=new Hn(y,w);return S.renderOrder=1,S}function OI(){if(!Yn||!au.group)return;let i=O.globeActive&&O.labelsHeld,e=i?Yn.pointOfView():null,t=i?`${Math.round(e.lat)}:${Math.round(e.lng)}:${e.altitude.toFixed(2)}:${O.gridSystem}:${O.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 Ox){if(!s.visible)continue;let o=VI.get(r);if(!o)continue;let a=K6e(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,W6e))au.group.add(Q6e(r,s));OG()}function OG(){if(!Yn)return;let i=Yn.camera().position,e=i.length()||1,t=Fx/e;for(let n of[Mo.group,au.group])if(n)for(let r of n.children){if(!r.isSprite)continue;let s=r.position,o=s.length()||1,a=(s.x*i.x+s.y*i.y+s.z*i.z)/(o*e);r.visible=a>t}}function K6e(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(us(n,-1,1))*180/Math.PI}function Q6e(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 Rh({depthTest:!1,depthWrite:!1,sizeAttenuation:!1,transparent:!0});new bl().load(n.toDataURL("image/png"),u=>{a.map=u,a.needsUpdate=!0});let l=new qA(a);l.position.set(...Bx(e.lat,e.lng,JS+.4)),l.renderOrder=4;let c=.028;return l.scale.set(c*o/40,c,1),l.center.set(.5,0),l}function J6e(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)),d=us(Math.ceil(f/2),4,48);for(let A=0;A<d;A++){let y=A/d;t.push(...Bx(a+(c-a)*y,l+(u-l)*y,JS+.25))}}t.push(...t.slice(0,3));let n=new Tm;n.setPositions(t);let r=new Rf({color:e.color,transparent:!0,opacity:e.opacity,linewidth:e.widthPx,depthWrite:!1});r.resolution.set(ge.globe.clientWidth||1,ge.globe.clientHeight||1);let s=new Mx(n,r);return s.computeLineDistances(),s.renderOrder=2,s}function e8e(i,e){let n=i.sizePx*2,r=`500 ${n}px ${Vi.labelFont}`,s=`900 ${n}px ${Vi.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=Vi.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 d=new Rh({depthTest:!1,depthWrite:!1,transparent:!0,sizeAttenuation:!1});new bl().load(o.toDataURL("image/png"),R=>{d.map=R,d.needsUpdate=!0});let A=new qA(d),y=Math.abs(e.north-e.south)*.02,w=Math.abs(e.east-e.west)*.02;A.position.set(...Bx(e.south+y,e.east-w,JS+.35));let S=Math.max(1,ge.globe.clientHeight||1),T=o.height/2/S;return A.scale.set(T*o.width/o.height,T,1),A.center.set(1,0),A.renderOrder=3,A}function t8e(i){let t=LE().find(l=>l.role==="scope"||l.role==="leaf");if(!t)return;let[n,r]=lce(Ss().center(t.hash),i),s=BG(ace(t.ring,i)),o=Math.max(s.east-s.west,s.north-s.south),a=us(o/45,Ux,qI);Yn.pointOfView({lat:n,lng:r,altitude:a},400)}function Qle(){if(!Yn||!Ds.group)return;let i=O.globeActive?O.lens||O.world.lenses[0]:null;if(!i){KS();return}Ds.lens!==i.tiles&&(KS(),Ds.lens=i.tiles);let e=Yn.pointOfView(),t=Math.min(Math.round(NG(e.altitude))+1,i.maxZoom);if(t<=Jle||!i.formats[t]){KS(),Ds.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>H6e&&c>1;)c--;let u=new Set;for(let d=-c;d<=c;d++){let A=l+d;if(!(A<0||A>=r))for(let y=-c;y<=c;y++){let w=((a+y)%n+n)%n;u.add(`${t}/${w}/${A}`)}}let f=`${i.tiles}:${[...u].sort().join(",")}`;if(f!==Ds.key){Ds.key=f;for(let[d,A]of Ds.tiles)u.has(d)||(Ds.group.remove(A),cce(A),Ds.tiles.delete(d));for(let d of u){if(Ds.tiles.has(d))continue;let[A,y,w]=d.split("/").map(Number),S=n8e(i,A,y,w);Ds.tiles.set(d,S),Ds.group.add(S)}}}function n8e(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<=rp;w++){let S=o-w/rp*r;for(let T=0;T<=rp;T++){let R=s+T/rp*r;a.push(...Bx(S,R,JS)),l.push(T/rp,1-w/rp)}}let u=rp+1;for(let w=0;w<rp;w++)for(let S=0;S<rp;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 Xn;f.setAttribute("position",new Ln(a,3)),f.setAttribute("uv",new Ln(l,2)),f.setIndex(c);let d=new fs,A=new Hn(f,d);A.visible=!1;let y=`${O.volume.base}/tiles/${i.tiles}/${e}/${t}/${n}.${i.formats[e]}`;return new bl().load(y,w=>{w.colorSpace=Fr,d.map=w,d.needsUpdate=!0,A.visible=!0}),A}function KS(){if(Ds.group){for(let i of Ds.tiles.values())Ds.group.remove(i),cce(i);Ds.tiles.clear(),Ds.key=""}}function cce(i){i.geometry.dispose(),i.material.map?.dispose(),i.material.dispose()}function uce(){if(Yn){for(let[i,e]of Ox){let t=i===O.selectedPin;e.material=fce(i.category,t);let n=t?tce:ece;e.scale.set(n,n,1)}Yn.objectAltitude(i=>i.pin===O.selectedPin?.03:.014)}}function i8e(){if(!Yn||!O.globeActive)return;uce();let i=VI.get(O.selectedPin);if(i){let e=Yn.pointOfView().altitude;Yn.pointOfView({lat:i.lat,lng:i.lng,altitude:e},600)}}function hce(i){return!(i.filteredHidden||Io(i.category.id)||O.gridEnabled&&O.gridCell&&!Lp(i))}function IG(){if(!(!Yn||!O.globeActive))for(let[i,e]of Ox)e.visible=hce(i)}function r8e(i){let e=new qA(fce(i.category,i===O.selectedPin)),t=i===O.selectedPin?tce:ece;return e.scale.set(t,t,1),e.visible=hce(i),Ox.set(i,e),e}function fce(i,e){let t=`${Jy(i)}:${e?"ringed":"plain"}`,n=Kle.get(t);if(n)return n;n=new Rh({depthWrite:!1,sizeAttenuation:!1}),Kle.set(t,n);let r=O.markerIcons.get(Jy(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=hA(),l.strokeText(bu(i.title),40,41),l.fillStyle=fA(i),l.fillText(bu(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 bl().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 dce(){O.globeActive&&oce()}function UG(){!Yn||ge.globe.hidden||(Yn.width(ge.globe.clientWidth).height(ge.globe.clientHeight),zI())}function s8e(){if(!Yn||!O.globeActive||!O.gridEnabled)return;let i=Yn.pointOfView(),e=`${O.gridSystem}:${O.gridCell}:${Math.round(NG(i.altitude)*2)}`;e!==Mo.fitKey&&(Mo.fitKey=e,zI())}function o8e(i){let e=[];for(let t of O.features){let[n,r]=pv(t.location.lat,t.location.lng),[s,o]=i.toLatLng(n,-r);e.push({lat:s,lng:o,pin:t}),VI.set(t,{lat:s,lng:o})}return e}async function a8e(i){let e=Math.min(Jle,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=`${O.volume.base}/tiles/${i.tiles}/${e}/${c}/${l}.${t}`;a.push(l8e(u).then(f=>{f&&o.drawImage(f,c*256,l*256,256,256)}))}return await Promise.all(a),s.toDataURL("image/jpeg",.92)}function l8e(i){return new Promise(e=>{let t=new Image;t.onload=()=>e(t),t.onerror=()=>e(null),t.src=i})}function pce(){let i=O.lens,e=ge.overviewCanvas,t=e.getContext("2d"),n=Of(),r=O.volume.tileGrid.size,s=O.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=++O.overviewRun,f=i.formats[l],d=Math.floor(n[0]/r*2**l),A=Math.ceil(n[2]/r*2**l),y=Math.floor(-n[3]/r*2**l),w=Math.ceil(-n[1]/r*2**l);for(let S=y;S<w;S++)for(let T=d;T<A;T++){if(!f||!WI(i,l,T,S))continue;let R=new Image;R.onload=()=>{O.overviewRun===u&&t.drawImage(R,T*s-n[0]*c,S*s+n[3]*c,s,s)},R.src=`${O.volume.base}/tiles/${encodeURIComponent(i.tiles)}/${l}/${T}/${S}.${f}`}kx()}function kx(){let i=rce();if(i){let w=lh(O.world);if(!w||!O.lens)return;let S=Of(),[T,R]=w.toWorld(i.lat,i.lng),I=ge.overviewCanvas,P=us((T-S[0])/(S[2]-S[0]),0,1),F=us((R+S[3])/(S[3]-S[1]),0,1);O.overviewKey="",ge.overviewShelf.hidden=!1;let D=ge.overviewViewport.style,L=22;D.left=`${P*I.width-L/2}px`,D.top=`${F*I.height-L/2}px`,D.width=`${L}px`,D.height=`${L}px`;return}let e=O.engine?.getView();if(!e||!O.lens)return;let t=Of(),n=e.calculateExtent(O.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===O.overviewKey||(O.overviewKey=l,ge.overviewShelf.hidden=a,a))return;let c=ge.overviewCanvas,u=us((n[0]-t[0])/r,0,1),f=us((n[2]-t[0])/r,0,1),d=us((t[3]-n[3])/s,0,1),A=us((t[3]-n[1])/s,0,1),y=ge.overviewViewport.style;y.left=`${u*c.width}px`,y.top=`${d*c.height}px`,y.width=`${Math.max(8,(f-u)*c.width)}px`,y.height=`${Math.max(8,(A-d)*c.height)}px`}function HI(i,e=!0){O.overviewDocked=i,i&&O.overviewPointer!==null&&(O.overviewPointer=null,zx()),ge.overviewShelf.classList.toggle("is-docked",i),ge.overviewDock.setAttribute("aria-expanded",String(!i));let t=i?"Bring the overview back":"Put the overview away";ge.overviewDock.setAttribute("aria-label",t),ge.overviewDock.title=t,e&&Wl()}function kG(i,e){let t=ge.overviewCanvas.getBoundingClientRect(),n=Of(),r=(a,l,c)=>us((a-l)/(c-l),0,1);if(O.globeActive){let a=lh(O.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);sce(u,f,e);return}let s=O.engine?.getView();if(!s||!O.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 Uf(i){return new IY({updateWhileAnimating:!0,...i})}function mce(){let i=O.volume.tileGrid.size,e=[0,-i,i,0];O.projection=new bp({code:"ATLAS:PIXELS",units:"pixels",extent:e}),O.sources={grid:new Wp({wrapX:!1}),gridContext:new Wp({wrapX:!1}),zoneScrim:new Wp({wrapX:!1}),zones:new Wp({wrapX:!1}),zoneTitles:new Wp({wrapX:!1}),pins:new Wp({wrapX:!1}),priority:new Wp({wrapX:!1})},O.layers={raster:new N6({zIndex:0}),rasterDetail:new N6({zIndex:1}),grid:Uf({source:O.sources.grid,style:c5,renderOrder:ad,renderBuffer:40,zIndex:5}),zoneScrim:Uf({source:O.sources.zoneScrim,style:UX,zIndex:6}),zones:Uf({source:O.sources.zones,style:kX,renderBuffer:32,zIndex:10}),zoneTitles:Uf({source:O.sources.zoneTitles,style:zX,renderOrder:ad,renderBuffer:160,zIndex:20}),zoneTitleDetail:Uf({source:O.sources.zoneTitles,style:VX,renderOrder:ad,renderBuffer:160,zIndex:44}),pins:Uf({source:O.sources.pins,style:LX,renderOrder:ad,renderBuffer:48,zIndex:40}),zonePins:Uf({source:O.sources.pins,style:DX,renderOrder:ad,renderBuffer:48,zIndex:42}),pinLabels:Uf({source:O.sources.pins,style:NX,renderOrder:ad,renderBuffer:180,zIndex:45}),gridContext:Uf({source:O.sources.gridContext,style:c5,renderOrder:ad,renderBuffer:40,zIndex:48}),priority:Uf({source:O.sources.priority,style:FX,renderOrder:ad,renderBuffer:220,zIndex:50})},O.engine=new rY({target:ge.viewport,layers:Object.values(O.layers),controls:KE({attribution:!1,rotate:!1,zoom:!1}),interactions:i3({onFocusOnly:!1}),view:XI(5)}),O.engine.on("movestart",()=>{O.engine.getViewport().classList.add("is-dragging")}),O.engine.on("moveend",()=>{O.engine.getViewport().classList.remove("is-dragging"),O.overviewPointer===null&&zx()}),O.engine.on("postrender",kx),ge.viewport.addEventListener("wheel",()=>{document.activeElement!==ge.viewport&&ge.viewport.focus({preventScroll:!0})},{capture:!0,passive:!0}),O.engine.on("singleclick",t=>{if(O.gridEnabled){let s=O.engine.forEachFeatureAtPixel(t.pixel,o=>{let a=o.get("gridCell");return a&&a.role!=="leaf"&&a.role!=="scope"?a:null},{hitTolerance:1,layerFilter:o=>o===O.layers.grid||o===O.layers.gridContext});if(s){mA(s.hash);return}}let n=O.engine.forEachFeatureAtPixel(t.pixel,(s,o)=>jI(o)&&s.get("pin")||null,{hitTolerance:5,layerFilter:jI});if(n){Fy(n);return}let r=O.engine.forEachFeatureAtPixel(t.pixel,s=>{let o=s.get("zone");return o&&!Io(fu(o))?o:null},{layerFilter:s=>s===O.layers.zones});r&&wE(r)}),O.engine.on("pointermove",t=>{if(t.dragging){mv(null);return}let n=O.engine.forEachFeatureAtPixel(t.pixel,(s,o)=>jI(o)&&s.get("pin")||null,{hitTolerance:4,layerFilter:jI});mv(n||null);let r=O.gridEnabled&&O.engine.hasFeatureAtPixel(t.pixel,{layerFilter:s=>s===O.layers.grid||s===O.layers.gridContext});O.engine.getTargetElement().style.cursor=n||r?"pointer":""}),O.engine.getViewport().addEventListener("pointerleave",()=>mv(null))}function jI(i){return i===O.layers.pins||i===O.layers.zonePins||i===O.layers.pinLabels||i===O.layers.priority}function XI(i,e=null){let t=O.volume.tileGrid.size,n=e||[0,-t,t,0];return new Xl({projection:O.projection,center:[(n[0]+n[2])/2,(n[1]+n[3])/2],resolutions:zG(i),minZoom:0,maxZoom:i,extent:n,constrainResolution:!1,smoothResolutionConstraint:!1,showFullExtent:!0,zoom:0})}function zG(i){let e=O.volume.tileGrid.size/O.volume.tileGrid.tileSize;return Array.from({length:i+1},(t,n)=>e/2**n)}async function cd(i,e){O.volume=O.catalog.volumes.find(r=>r.slug===i)||O.catalog.volumes[0],O.engine||mce(),!e&&!O.restore&&(O.restore=av(O.volume.slug)),ge.volume.value=O.volume.slug,qm(ge.world,O.volume.worlds,"title"),ge.world.disabled=O.volume.worlds.length===1,ge.world.title=ge.world.disabled?"This volume has one world":"Choose a world";let t=O.restore?.volume===O.volume.slug?O.restore:null,n=e&&O.volume.worlds.find(r=>r.slug===e)||t&&O.volume.worlds.find(r=>r.slug===t.world);await VG((n||O.volume.worlds[0]).slug)}async function VG(i){let e=O.volume.worlds.find(s=>s.slug===i)||O.volume.worlds[0],t=++O.worldRun;ge.loading.hidden=!1;let n;try{n=await a$(e)}catch(s){console.error(`world ${e.slug} failed to load`,s),O.worldRun===t&&(ge.loading.hidden=!0,yA());return}if(O.worldRun!==t)return;O.settling=!0,O.world=n,document.documentElement.style.setProperty("--icon-outset-color",hA()),ge.world.value=O.world.slug,qm(ge.lens,O.world.lenses,"name"),ge.lensField.hidden=O.world.lenses.length<2,O.styleCache.clear(),mv(null),O.gridCell="",O.gridSystem="geohash",O.hiddenCollections.clear(),O.labelOverrides.clear(),O.collapsedSections.clear(),O.collapsedSections.add("zones"),O.expandedCollections.clear();for(let s of O.world.collections)s.kind!=="point"&&!s.group&&O.expandedCollections.add(s.id),s.visible||O.hiddenCollections.add(s.id);let r=O.restore?.world===O.world.slug?O.restore:null;r&&(O.hiddenCollections=new Set(r.hidden),O.collapsedSections=new Set(r.collapsed),O.expandedCollections=new Set(r.expanded||[]),O.labelOverrides=new Map(r.labels||[])),HI(!!O.restore?.overviewDocked,!1),bE(O.restore?!!O.restore.dockFolded:!0,!1),O.dockDismissed=!!O.restore?.dockDismissed,O.search="",ge.search.value="",ge.dock.hidden=!1,id(),JX(),A5(),$X(),GG(r?us(r.lens,0,O.world.lenses.length-1):0,!0),nce(),O.restore=null,ge.sidebar.classList.remove("is-open"),ge.mobileLegend.setAttribute("aria-expanded","false"),qj(),O.settling=!1,Wl()}function GG(i,e=!1){let t=O.lens;O.lens=O.world.lenses[i]||O.world.lenses[0];let n=O.lens,r=e?null:h8e(t,n),s=mh(n);if(ge.lens.value=String(O.world.lenses.indexOf(O.lens)),e)O.engine.setView(XI(s,Of()));else{let w=O.engine.getView(),S=XI(s,Of());S.setCenter(w.getCenter()),S.setZoom(w.getZoom()||0),O.engine.setView(S)}let o=++O.tileRun,a=0;O.tileStats={requested:0,loaded:0,errors:0,peakPending:0},ge.loading.hidden=!1;let l=w=>{w.on("tileloadstart",()=>{O.tileRun===o&&(a++,O.tileStats.requested++,O.tileStats.peakPending=Math.max(O.tileStats.peakPending,a))});let S=T=>{O.tileRun===o&&(a=Math.max(0,a-1),T?O.tileStats.errors++:O.tileStats.loaded++,a===0&&O.tileStats.loaded>0&&(ge.loading.hidden=!0))};return w.on("tileloadend",()=>S(!1)),w.on("tileloaderror",()=>S(!0)),w},c=(w,S)=>l(new Vj({projection:O.projection,tileGrid:new Iy({extent:[0,-O.volume.tileGrid.size,O.volume.tileGrid.size,0],origin:[0,0],resolutions:zG(w),tileSize:O.volume.tileGrid.tileSize}),cacheSize:64,interpolate:n.interpolate,transition:0,wrapX:!1,tileUrlFunction:([T,R,I])=>{let P=n.formats[T];if(!(!P||R<0||I<0||!S(T,R,I)))return`${O.volume.base}/tiles/${encodeURIComponent(n.tiles)}/${T}/${R}/${I}.${P}`}})),u=n.fullZoom??n.maxZoom,f=c(u,(w,S,T)=>WI(n,w,S,T)),d=O.layers.raster.getSource();O.layers.raster.setSource(f),O.layers.raster.setExtent(Of()),O.layers.raster.setBackground(n.background||void 0),d?.clear();let A=O.layers.rasterDetail.getSource();n.maxZoom>u?(O.layers.rasterDetail.setSource(c(n.maxZoom,(w,S,T)=>w>u&&WI(n,w,S,T))),O.layers.rasterDetail.setExtent(Of()),O.layers.rasterDetail.setVisible(!0)):O.layers.rasterDetail.setVisible(!1),A?.clear(),Wy(),O.gridEnabled&&(Fc(),O.layers.pins.changed(),O.layers.priority.changed()),O.overviewKey="",pce();let y=e&&O.restore?.world===O.world.slug?O.restore:null;if(O.renderedShard!==(n.shard||0)&&(A5(),Nc()),y?.center&&Number.isFinite(y.zoom)){let w=O.engine.getView();w.setCenter(y.center),w.setZoom(y.zoom),O.fitZoom=y.zoom,xA()}else e?requestAnimationFrame(f8e):(r&&O.engine.getView().animate({center:r,duration:200}),xA());Wl()}function WI(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=u8e(i,e,r),l=o*r.w+s;return(a[l>>3]&1<<(l&7))!==0}function u8e(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 mh(i){return i.maxZoom+2}function zx(){xA(),Wl()}function h8e(i,e){if(!i||!e||!i.shard||!e.shard||i.shard===e.shard||!i.bounds||!e.bounds)return null;let n=O.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+us(r,0,1)*e.bounds.width,-(e.bounds.y+us(s,0,1)*e.bounds.height)]}function Ace(){let e=document.querySelector(".app-shell").classList.toggle("sidebar-collapsed");ge.mobileLegend.setAttribute("aria-expanded",String(!e)),requestAnimationFrame(()=>O.engine?.updateSize())}function Of(){let i=O.volume.tileGrid.size,e=O.lens?.bounds||{x:0,y:0,width:i,height:i};return[e.x,-(e.y+e.height),e.x+e.width,-e.y]}function f8e(){if(!O.engine||!O.lens)return;let i=O.engine.getView();i.fit(Of(),{size:O.engine.getSize(),padding:[36,36,36,36],maxZoom:O.lens.maxZoom,duration:0}),O.fitZoom=i.getZoom()||0,xA()}function eT(i){let e=O.engine.getView(),t=e.getZoom()||0;e.animate({zoom:us(t+i,O.lens.minZoom,mh(O.lens)),duration:140})}function xA(){let i=O.engine?.getView().getZoom();if(ge.viewport.dataset.zoom=Number.isFinite(i)?i.toFixed(3):"",!O.engine||!O.world){ge.visibleCount.textContent="0 features enabled";return}let e=O.engine.getView().calculateExtent(O.engine.getSize()),t=O.eligibleLocations,n=0;for(let r of O.features){if(ld(r))continue;let[s,o]=r.coordinate;s>=e[0]&&s<=e[2]&&o>=e[1]&&o<=e[3]&&n++}for(let r of O.zoneRecords.values())Io(r.zone.collectionId)||(t++,Ar(r.extent,e)&&n++);ge.visibleCount.textContent=`${jl(t)} features enabled \xB7 ${jl(n)} in view`}function gce(){ge.volume.addEventListener("change",()=>{cd(ge.volume.value)}),ge.world.addEventListener("change",()=>{VG(ge.world.value)}),ge.addBundles.addEventListener("click",()=>{T5()}),ge.emptyOpen.addEventListener("click",()=>{T5()}),ge.lens.addEventListener("change",()=>{GG(Number(ge.lens.value)),dce()}),ge.globeToggle.addEventListener("click",()=>GI()),ge.legend.addEventListener("change",n=>{let r=n.target;if(r.dataset.sectionToggle){r$(r.dataset.sectionToggle);return}if(!r.dataset.collection)return;let s=wu(r.dataset.collection);r.checked?O.hiddenCollections.delete(s):O.hiddenCollections.add(s),Op(),Nc(),ph()});let i=null,e=()=>{for(let s of ge.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&&ge.layers.contains(r)&&r.classList.add("is-hovered")};ge.layers.addEventListener("pointermove",n=>{i={x:n.clientX,y:n.clientY},e()},{passive:!0}),ge.layers.addEventListener("pointerleave",()=>{i=null,e()}),ge.layers.addEventListener("scroll",e,{passive:!0}),ge.layers.addEventListener("click",n=>{let r=n.target.closest("[data-only-collection], [data-only-section]");if(r){n.preventDefault(),n.stopPropagation(),o$(r.dataset.onlyCollection?{collection:wu(r.dataset.onlyCollection)}:{section:r.dataset.onlySection});return}let s=n.target.closest("[data-expand-collection]");if(s){n.preventDefault(),n.stopPropagation(),t$(wu(s.dataset.expandCollection));return}let o=n.target.closest("[data-label-toggle]");if(o){n.preventDefault(),n.stopPropagation(),i$(wu(o.dataset.labelToggle));return}let a=n.target.closest("[data-zone]");if(a){_5(Number(a.dataset.zone));return}let l=n.target.closest("[data-section]");if(!l)return;let c=l.dataset.section;O.collapsedSections.has(c)?O.collapsedSections.delete(c):O.collapsedSections.add(c),XE()}),ge.layers.addEventListener("contextmenu",n=>{let r=n.target.closest("[data-zone]");r&&(n.preventDefault(),XX(Number(r.dataset.zone)))}),ge.soloChip.addEventListener("click",()=>$E(!0)),on("#expand-all").addEventListener("click",()=>w5(!1)),on("#collapse-all").addEventListener("click",()=>w5(!0)),on("#show-all").addEventListener("click",()=>$E(!0)),on("#hide-all").addEventListener("click",()=>$E(!1)),ge.search.addEventListener("input",()=>{O.search=ge.search.value.trim().toLocaleLowerCase(),Nc(),O.search&&Ny()}),ge.dockFold.addEventListener("click",()=>{yN(!O.dockFolded)}),ge.searchResults.addEventListener("click",n=>{let r=n.target.closest("[data-location], [data-zone]");if(!r)return;if(r.dataset.zone){_5(Number(r.dataset.zone));return}let s=O.featureByID.get(Number(r.dataset.location));s&&SN(s)}),ge.detailLinks.addEventListener("click",n=>{let r=n.target.closest("[data-location]");if(!r)return;let s=O.featureByID.get(Number(r.dataset.location));s&&SN(s)}),on("#close-detail").addEventListener("click",id),on("#zoom-in").addEventListener("click",()=>O.globeActive?FG(1):eT(1)),on("#zoom-out").addEventListener("click",()=>O.globeActive?FG(-1):eT(-1)),ge.gridBack.addEventListener("click",ON),ge.gridSystem.addEventListener("click",UN),ge.gridInput.addEventListener("input",()=>{let n=Ss(),r=n.normalizeInput(ge.gridInput.value);ge.gridInput.value=r,n.parseInput(r)!==null&&mA(r)}),ge.subgridToggle.addEventListener("click",()=>{Hy(!O.subgridVisible),ge.viewport.focus({preventScroll:!0})}),ge.gridInput.addEventListener("keydown",n=>{if(n.key===" "){n.preventDefault(),Hy(!O.subgridVisible);return}if(n.key==="`"){n.preventDefault(),ge.globeToggle.hidden||GI();return}n.key==="Escape"&&(n.preventDefault(),n.stopPropagation(),ge.viewport.focus({preventScroll:!0}))}),ge.viewport.addEventListener("keydown",n=>{if(!yE(n.target)){if(n.key==="+"||n.key==="=")eT(1);else if(n.key==="-")eT(-1);else if(n.key==="Escape")id();else return;n.preventDefault()}}),window.addEventListener("contextmenu",n=>{yE(n.target)||n.preventDefault()}),window.addEventListener("keydown",n=>{if((n.metaKey||n.ctrlKey)&&n.key.toLocaleLowerCase()==="r"){n.preventDefault(),location.reload();return}if((n.metaKey||n.ctrlKey)&&n.key.toLocaleLowerCase()==="g"){n.preventDefault(),UN();return}if(!yE(n.target)){if(n.key==="`"&&!n.metaKey&&!n.ctrlKey&&!n.altKey){ge.globeToggle.hidden||(n.preventDefault(),GI());return}if((n.metaKey||n.ctrlKey)&&n.key.toLocaleLowerCase()==="k"){n.preventDefault(),ge.search.focus(),ge.search.select();return}if((n.metaKey||n.ctrlKey)&&n.altKey&&n.code==="KeyB"){n.preventDefault(),ge.dock.hidden||yN(!O.dockFolded);return}if((n.metaKey||n.ctrlKey)&&n.key.toLocaleLowerCase()==="b"){n.preventDefault(),Ace();return}uX(n)||n.key.toLocaleLowerCase()==="z"&&(n.preventDefault(),n.repeat||jE(!0))}}),window.addEventListener("keyup",n=>{n.key.toLocaleLowerCase()==="z"&&jE(!1)}),window.addEventListener("blur",()=>jE(!1)),window.addEventListener("hashchange",()=>{let n=lv();n.volume===O.volume?.slug&&n.world===O.world?.slug||(O.restore=null,cd(n.volume||O.catalog.volumes[0].slug,n.world))}),window.addEventListener("resize",()=>{O.engine?.updateSize(),kx(),UG()}),document.addEventListener("atlas:globe-camera",()=>kx()),ge.overview.addEventListener("pointerdown",n=>{O.overviewDocked||n.pointerType==="mouse"&&n.button!==0||(n.preventDefault(),ge.overview.setPointerCapture(n.pointerId),O.overviewPointer=n.pointerId,kG(n,!0))}),ge.overview.addEventListener("pointermove",n=>{O.overviewPointer===n.pointerId&&(n.preventDefault(),kG(n,!1))});let t=n=>{O.overviewPointer===n.pointerId&&(O.overviewPointer=null,zx())};ge.overview.addEventListener("pointerup",t),ge.overview.addEventListener("pointercancel",t),ge.overviewDock.addEventListener("click",()=>{HI(!O.overviewDocked),ge.viewport.focus({preventScroll:!0})}),ge.mobileLegend.addEventListener("click",()=>{let n=ge.sidebar.classList.toggle("is-open");ge.mobileLegend.setAttribute("aria-expanded",String(n))})}function vce(){let i=()=>({volume:O.volume?.title,world:O.world?.title,lens:O.lens?.name,zoom:O.engine?.getView().getZoom(),center:O.engine?.getView().getCenter(),resolution:O.engine?.getView().getResolution(),nativeMaxZoom:O.lens?.maxZoom,maxZoom:O.lens?mh(O.lens):null,interpolate:O.lens?.interpolate,tileStats:{...O.tileStats},pins:O.features.length,eligibleLocations:O.eligibleLocations,domNodes:document.querySelectorAll("*").length,canvases:document.querySelectorAll("canvas").length,rasterCacheSize:64,labelsHeld:O.labelsHeld,hoveredPin:O.hoveredPin?.location.title||null,selectedPin:O.selectedPin?.location.title||null,fitZoom:O.fitZoom,filters:{hiddenCategories:[...O.hiddenCollections].sort(),collapsedSections:[...O.collapsedSections].sort()},ui:{sidebarCollapsed:document.querySelector(".app-shell")?.classList.contains("sidebar-collapsed")??!1,detailOpen:!ge.detail.hidden,detailTitle:ge.detail.hidden?null:ge.detailTitle.textContent||null,searchQuery:O.search,searchResultsVisible:!ge.searchResults.hidden,soloChip:ge.soloChip.hidden?null:ge.soloChip.textContent,visibleCountText:ge.visibleCount.textContent,overviewDocked:O.overviewDocked,dockFolded:O.dockFolded,dockDismissed:O.dockDismissed,subgridVisible:O.subgridVisible},zones:{visible:V1(),count:O.zoneRecords.size,focused:O.zoneRecords.get(O.focusedZoneID)?.zone.title||null,highlighted:[...O.highlightedZones].map(e=>O.zoneRecords.get(e)?.zone.title).filter(Boolean),focusedPins:O.features.filter(e=>!e.filteredHidden&&e.passesZoneFilters).length},grid:{enabled:O.gridEnabled,system:O.gridSystem,prefix:O.gridCell,maximumDepth:dX(),extent:O.gridEnabled?kN():null,cells:[...O.sources.grid.getFeatures(),...O.sources.gridContext.getFeatures()].map(e=>e.get("gridCell")),priorityPins:O.gridCell?O.features.filter(e=>!e.filteredHidden&&Lp(e)).length:0}});window.__atlasDebug={snapshot:i,setLayerVisible:(e,t)=>O.layers[e]?.setVisible(t),refreshCatalog:yA},window.render_game_to_text=()=>JSON.stringify({coordinateSystem:"ATLAS:PIXELS; origin top-left; x increases right; y decreases downward",...i()}),window.advanceTime=()=>O.engine?.renderSync()}async function _ce(){gce();try{let i=await fetch("/data/catalog.json");if(!i.ok)throw new Error(`catalog request returned ${i.status}`);if(O.catalog=await i.json(),qm(ge.volume,O.catalog.volumes,"title"),S5(),window.runtime?.EventsOn?.("atlas:catalog-changed",()=>{yA()}),O.catalog.volumes.length){let e=lv(),t=av(),n=t&&(!e.volume||e.volume===t.volume&&e.world===t.world);O.restore=n?t:null,await cd(e.volume||t?.volume||O.catalog.volumes[0].slug,e.world||t?.world),O.restore=null}else ge.loading.hidden=!0;vce(),requestAnimationFrame(()=>ge.viewport.focus({preventScroll:!0}))}catch(i){ge.loading.hidden=!0,ge.fatalMessage.textContent=i instanceof Error?i.message:String(i),ge.fatal.hidden=!1}}_ce();})();@@ -73,29 +73,12 @@
7373 </div>7474 7575 <div id="layers" class="layers">76- <section id="zone-index" class="layer-section" hidden>77- <div class="layer-header">78- <button class="layer-title" type="button" data-section="zones" aria-expanded="true">79- <span class="layer-chevron" aria-hidden="true">80- <svg viewBox="0 0 24 24"><path d="m9 6 6 6-6 6"/></svg>81- </span>82- <span>Zones</span>83- <span id="zone-count" class="layer-count"></span>84- </button>85- <label class="layer-switch">86- <input id="zone-toggle" type="checkbox" aria-label="Show zone boundaries" checked>87- <span aria-hidden="true"></span>88- </label>89- </div>90- <div id="zone-list" class="zone-list"></div>91- </section>92-9376 <div id="legend" class="legend"></div>9477 </div>9578 9679 <footer class="sidebar-footer">9780 <span class="live-dot"></span>98- <span id="visible-count">0 locations visible</span>81+ <span id="visible-count">0 features enabled</span>9982 </footer>10083 </aside>10184 @@ -12,6 +12,7 @@ import "github.com/FelineStateMachine/atlas/internal/measure"
1212 1313 type build = measure.Build1414 type mergeAccount = measure.MergeAccount15+type featureCounts = measure.FeatureCounts1516 1617 func measureBundle(path string) (*build, error) { return measure.MeasureBundle(path) }1718 @@ -23,6 +23,17 @@ func fixtureMerged() []map[string]any {
2323 "held": []map[string]any{{"d": 14, "t": "Old Well", "why": "name 200px away"}},2424 "rejected": []map[string]any{{"d": 15, "t": "Off World", "why": "outside the world"}},2525 "alignment": "affine over 9 anchors, median 26px",26+ }, {27+ // A ledger that speaks features, the way builds write them now:28+ // donorPins repeats the point count and the shapes ride held.29+ "source": "arcgis-hub",30+ "donorPins": 0,31+ "donorFeatures": map[string]any{"point": 0, "path": 1, "area": 2},32+ "held": []map[string]any{33+ {"d": 21, "t": "North Basin", "why": "shape features do not merge yet"},34+ {"d": 22, "t": "South Basin", "why": "shape features do not merge yet"},35+ {"d": 23, "t": "Mill Race", "why": "shape features do not merge yet"},36+ },2637 }}2738 }2839 @@ -80,14 +91,20 @@ func TestMeasureBundle(t *testing.T) {
8091 t.Errorf("icons: %d of %d; want 1 of 1", measured.IconsCarried, measured.IconsWanted)8192 }8293 83- // The merge account, kept whole rather than counted.84- if len(measured.Merges) != 1 {85- t.Fatalf("read %d merge accounts, want 1", len(measured.Merges))94+ // The merge accounts, kept whole rather than counted.95+ if len(measured.Merges) != 2 {96+ t.Fatalf("read %d merge accounts, want 2", len(measured.Merges))8697 }8798 account := measured.Merges[0]8899 if account.Map != "overworld" || account.Source != "ign-wiki" || account.DonorPins != 5 {89100 t.Errorf("account identity: map %s source %s donors %d", account.Map, account.Source, account.DonorPins)90101 }102+ // An account from before the ledger spoke features: the point count103+ // stands in for the whole offering.104+ if account.DonorFeatures != (featureCounts{Point: 5}) || account.DonorShapesN() != 0 {105+ t.Errorf("fallback features read as %+v (%d shapes), want 5 points standing in",106+ account.DonorFeatures, account.DonorShapesN())107+ }91108 if account.MatchedN() != 2 || account.MedianMatchPx() != 40 {92109 t.Errorf("matched %d at median %dpx, want 2 at 40px", account.MatchedN(), account.MedianMatchPx())93110 }@@ -98,8 +115,19 @@ func TestMeasureBundle(t *testing.T) {
98115 if account.HeldN() != 1 || account.Held[0].Title != "Old Well" || account.Held[0].Reason != "name 200px away" {99116 t.Errorf("held ledger read wrong: %+v", account.Held)100117 }101- if got := measured.SourcesSeen(); len(got) != 1 || got[0] != "ign-wiki" {102- t.Errorf("sources seen %v, want [ign-wiki]", got)118+ // An account that speaks features: the per-kind counts come through and119+ // the held shapes ride the same ledger the held pins do.120+ shapes := measured.Merges[1]121+ if shapes.DonorFeatures != (featureCounts{Point: 0, Path: 1, Area: 2}) || shapes.DonorShapesN() != 3 {122+ t.Errorf("feature counts read as %+v (%d shapes), want 1 path and 2 areas",123+ shapes.DonorFeatures, shapes.DonorShapesN())124+ }125+ if shapes.DonorPins != 0 || shapes.AddedShapes != 0 || shapes.HeldN() != 3 {126+ t.Errorf("shape account read as %d donor pins, %d added shapes, %d held; want 0, 0, 3",127+ shapes.DonorPins, shapes.AddedShapes, shapes.HeldN())128+ }129+ if got := measured.SourcesSeen(); len(got) != 2 || got[0] != "arcgis-hub" || got[1] != "ign-wiki" {130+ t.Errorf("sources seen %v, want [arcgis-hub ign-wiki]", got)103131 }104132 }105133 @@ -30,7 +30,7 @@
3030 {{if $b.Merges}}3131 <table class="merges">3232 <thead><tr>33- <th>map</th><th>source</th><th class="num">donor pins</th><th class="num">matched</th>33+ <th>map</th><th>source</th><th class="num">donor pins</th><th class="num">donor shapes</th><th class="num">matched</th>3434 <th class="num">median px</th><th class="num">added</th><th class="num">adopted</th>3535 <th class="num">held</th><th class="num">rejected</th><th>alignment</th>3636 </tr></thead>@@ -38,7 +38,7 @@
3838 {{range $b.Merges}}3939 <tr>4040 <td>{{.Map}}</td><td>{{.Source}}</td>41- <td class="num">{{.DonorPins}}</td><td class="num">{{.MatchedN}}</td>41+ <td class="num">{{.DonorPins}}</td><td class="num">{{.DonorShapesN}}</td><td class="num">{{.MatchedN}}</td>4242 <td class="num">{{.MedianMatchPx}}</td><td class="num">{{.Added}}</td>4343 <td class="num">{{.AdoptedN}}</td><td class="num">{{.HeldN}}</td>4444 <td class="num">{{.RejectedN}}</td><td class="dim">{{.Alignment}}</td>@@ -15,7 +15,7 @@
1515 @import "./css/solo-chip.css";1616 @import "./css/layer-switch.css";1717 @import "./css/text-symbol.css";18-@import "./css/zone-index.css";18+@import "./css/feature-index.css";1919 @import "./css/category-rows.css";2020 @import "./css/sidebar-footer.css";2121 @import "./css/map-panel.css";@@ -10,7 +10,10 @@
1010 display: grid;1111 width: 100%;1212 align-items: center;13- grid-template-columns: 22px minmax(0, 1fr) 22px 46px;13+ /* icon-or-chevron · name · isolate · label toggle · count. Every kind of14+ row keeps all five columns -- rows that have nothing for a column hold15+ it as space -- so counts and controls line up down the whole tree. */16+ grid-template-columns: 22px minmax(0, 1fr) 22px 22px 46px;1417 gap: 8px;1518 min-height: 26px;1619 padding: 0 4px;@@ -104,3 +107,100 @@
104107 text-align: right;105108 }106109 110+/* A shape collection's icon cell is its disclosure: a chevron that turns111+ when the feature index below is unfolded, beside a small glyph saying112+ what kind of ground the collection is. */113+.collection-expand {114+ display: flex;115+ width: 22px;116+ height: 22px;117+ align-items: center;118+ justify-content: center;119+ padding: 0;120+ border: 0;121+ border-radius: 3px;122+ background: transparent;123+ color: inherit;124+ cursor: pointer;125+}126+127+.collection-expand:hover {128+ background: rgba(255, 255, 255, 0.06);129+}130+131+.collection-expand:focus-visible {132+ outline: 1px solid var(--accent);133+ outline-offset: -1px;134+}135+136+.collection-expand svg {137+ fill: none;138+ stroke: currentColor;139+ stroke-linecap: round;140+ stroke-linejoin: round;141+}142+143+.collection-chevron {144+ width: 8px;145+ flex: none;146+ stroke-width: 2.2;147+ transition: transform 140ms ease;148+}149+150+.category-row.is-expanded .collection-chevron {151+ transform: rotate(90deg);152+}153+154+.collection-kind {155+ width: 11px;156+ flex: none;157+ stroke-width: 1.5;158+}159+160+/* Ground reads as a rounded triangle, not a box: the join rounding only161+ shows once the stroke is heavy enough to carry it. */162+.collection-kind-area {163+ stroke-width: 2.6;164+}165+166+/* The reader's word over whether a collection speaks its names unasked.167+ Revealed on rest like the isolate target beside it; lit while the168+ effective policy is "always". */169+.label-toggle {170+ display: grid;171+ justify-self: end;172+ width: 20px;173+ height: 20px;174+ padding: 0;175+ place-items: center;176+ border: 0;177+ border-radius: 3px;178+ opacity: 0;179+ background: none;180+ color: var(--muted);181+ cursor: pointer;182+ transition: opacity 110ms ease;183+}184+185+.category-row.is-hovered .label-toggle,186+.label-toggle:focus-visible {187+ opacity: 1;188+}189+190+.label-toggle:hover {191+ background: rgba(58, 165, 201, 0.14);192+}193+194+.label-toggle[aria-pressed="true"] {195+ color: var(--accent);196+}197+198+.label-toggle svg {199+ width: 12px;200+ fill: none;201+ stroke: currentColor;202+ stroke-linecap: round;203+ stroke-linejoin: round;204+ stroke-width: 1.7;205+}206+@@ -1,3 +1,13 @@
1+/* The feature index unfolds beneath a shape collection's row, inset so its2+ rows read as the row's children rather than its peers. */3+.feature-index {4+ padding: 0 0 4px 14px;5+}6+7+.feature-index[hidden] {8+ display: none;9+}10+111 .zone-index-item {212 --zone-depth: 0;313 display: grid;@@ -33,7 +43,7 @@
3343 color: #fff;3444 }3545 36-#zone-index.has-highlights .zone-index-item:not(.is-highlighted):not(.is-current) {46+.feature-index.has-highlights .zone-index-item:not(.is-highlighted):not(.is-current) {3747 opacity: 0.5;3848 }3949 @@ -0,0 +1,121 @@
1+// Runs the behavior-parity tour without a hand on the keyboard. The dev2+// build (`go run -tags dev .`) is a desktop window, but it also serves the3+// same frontend over plain HTTP and writes the port to inspector.url in the4+// app's config dir -- so a headless Chromium can load the app, call5+// window.__atlasTour() (the same entry F9 reaches), and let the tour post6+// its log to the dev-only /parity/result route as ever.7+//8+// The fresh-launch rule is honored by construction: every invocation starts9+// its own app process and a new browser session, and nothing touches either10+// before the tour does. The tour itself clears localStorage at both ends.11+//12+// node frontend/parity/run.mjs [--bundles <dir>] [--out <file>]13+//14+// --bundles pins ATLAS_BUNDLES_DIR so a recorded baseline names exactly one15+// bundle build; --out copies the freshly written tour log there. The browser16+// is driven through playwright-cli via npx, so the only prerequisite beyond17+// Node is a Playwright Chromium already installed (npx playwright install18+// chromium). macOS paths, like the dev loop itself.19+20+import { spawn, spawnSync } from "node:child_process";21+import { copyFileSync, mkdtempSync, readdirSync, readFileSync, statSync } from "node:fs";22+import { tmpdir, homedir } from "node:os";23+import { dirname, join, resolve } from "node:path";24+import { fileURLToPath } from "node:url";25+26+const repoRoot = resolve(dirname(fileURLToPath(import.meta.url)), "../..");27+const configDir = join(homedir(), "Library/Application Support/dev.felinestatemachine.atlas");28+const parityDir = join(configDir, "parity");29+const inspectorURL = join(configDir, "inspector.url");30+31+const args = process.argv.slice(2);32+const flag = (name) => {33+ const at = args.indexOf(name);34+ return at >= 0 ? args[at + 1] : undefined;35+};36+37+const sleep = (ms) => new Promise((resolveSleep) => setTimeout(resolveSleep, ms));38+39+// The playwright-cli keeps its session beside its working directory, so each40+// run drives a browser of its own from a scratch dir and leaves nothing in41+// the repo.42+const cliDir = mkdtempSync(join(tmpdir(), "atlas-parity-"));43+const cli = (...cliArgs) => {44+ const result = spawnSync(45+ "npx",46+ ["--yes", "--package=@playwright/cli@latest", "playwright-cli", ...cliArgs],47+ { cwd: cliDir, encoding: "utf8", timeout: 600_000 },48+ );49+ if (result.status !== 0) {50+ throw new Error(`playwright-cli ${cliArgs[0]} failed:\n${result.stdout}\n${result.stderr}`);51+ }52+ return result.stdout;53+};54+55+// A launch is only this run's if its port file is newer than this moment:56+// the file survives from earlier sessions and would otherwise answer for a57+// server that is no longer there.58+const launchedAt = Date.now();59+// ATLAS_HEADLESS keeps the sweep out of the reader's way: the dev build60+// serves the same frontend over HTTP and opens no window at all.61+const app = spawn("go", ["run", "-tags", "dev", "."], {62+ cwd: repoRoot,63+ env: {64+ ...process.env,65+ ATLAS_HEADLESS: "1",66+ ...(flag("--bundles") ? { ATLAS_BUNDLES_DIR: resolve(flag("--bundles")) } : {}),67+ },68+ stdio: "ignore",69+ detached: true,70+});71+72+// `go run` fronts the real binary, so teardown signals the whole process73+// group rather than the runner alone.74+const stopApp = () => {75+ try { process.kill(-app.pid, "SIGTERM"); } catch { /* already gone */ }76+};77+process.on("exit", stopApp);78+79+try {80+ let url = "";81+ for (let i = 0; i < 60 && !url; i++) {82+ await sleep(1000);83+ try {84+ if (statSync(inspectorURL).mtimeMs >= launchedAt) {85+ url = readFileSync(inspectorURL, "utf8").trim();86+ }87+ } catch { /* not written yet */ }88+ }89+ if (!url) throw new Error("the dev build never wrote inspector.url");90+91+ cli("open", url);92+ const badge = cli("run-code", `async page => {93+ await page.waitForFunction(() =>94+ window.__atlasTour && window.__atlasDebug &&95+ document.querySelectorAll(".category-row").length > 0, null, { timeout: 60000 });96+ await page.evaluate(() => { window.__atlasTour(); });97+ await page.waitForFunction(() => {98+ const badge = document.querySelector("#parity-badge");99+ return badge && (badge.textContent.includes("complete") || badge.textContent.includes("failed"));100+ }, null, { timeout: 480000 });101+ return await page.evaluate(() => document.querySelector("#parity-badge").textContent);102+ }`);103+ if (!badge.includes("complete")) throw new Error(`tour did not complete:\n${badge}`);104+105+ // The tour posted its log to /parity/result, which writes a timestamped106+ // file; the one belonging to this run is the one born after the launch.107+ const newest = readdirSync(parityDir)108+ .filter((name) => name.startsWith("tour-") && name.endsWith(".json"))109+ .map((name) => join(parityDir, name))110+ .filter((path) => statSync(path).mtimeMs >= launchedAt)111+ .sort((a, b) => statSync(b).mtimeMs - statSync(a).mtimeMs)[0];112+ if (!newest) throw new Error("the tour reported success but no result file arrived");113+114+ const steps = JSON.parse(readFileSync(newest, "utf8")).steps.length;115+ if (flag("--out")) copyFileSync(newest, flag("--out"));116+ console.log(`${badge.match(/parity tour complete[^"]*/)?.[0] || "complete"}`);117+ console.log(`result: ${flag("--out") || newest} (${steps} steps)`);118+} finally {119+ try { cli("close"); } catch { /* browser already gone */ }120+ stopApp();121+}@@ -89,7 +89,7 @@ async function tour() {
8989 // begins in the same place regardless of what was explored beforehand.9090 await waitForBoot();9191 localStorage.clear();92- const gameSelect = tourQuery("#game-select");92+ const gameSelect = tourQuery("#volume-select");9393 const firstGame = gameSelect.options[0].value;9494 change(gameSelect, firstGame);9595 await record("initial");@@ -152,6 +152,77 @@ async function tour() {
152152 await record("zone-unhighlighted");153153 }154154 155+ // The unified legend's own states: a shape collection folds and unfolds156+ // its feature index, hides and returns, isolates, and flips its label157+ // policy -- everything the one-tree rebuild added.158+ const shapeExpand = tourQuery("[data-expand-collection]");159+ if (shapeExpand) {160+ shapeExpand.click();161+ await record("collection-folded");162+ shapeExpand.click();163+ await record("collection-unfolded");164+ }165+ const shapeRows = [...document.querySelectorAll(".category-row")]166+ .filter((row) => row.querySelector("[data-expand-collection]"));167+ const shapeRow = shapeRows[1] || shapeRows[0];168+ if (shapeRow) {169+ const checkbox = shapeRow.querySelector("input[data-collection]");170+ checkbox.click();171+ await record("collection-hidden");172+ checkbox.click();173+ await record("collection-restored");174+ const only = shapeRow.querySelector("[data-only-collection]");175+ if (only) {176+ only.click();177+ await record("collection-solo");178+ const soloChip = tourQuery("#solo-chip");179+ if (soloChip && !soloChip.hidden) soloChip.click();180+ await record("collection-solo-cleared");181+ }182+ }183+ const labelToggle = tourQuery("[data-label-toggle]");184+ if (labelToggle) {185+ labelToggle.click();186+ await record("labels-flipped");187+ labelToggle.click();188+ await record("labels-curated");189+ }190+ // A point collection's labels answer the same toggle: static names on,191+ // and back to the curation.192+ const pointLabelToggle = [...document.querySelectorAll(".category-row")]193+ .filter((row) => !row.querySelector("[data-expand-collection]"))194+ .map((row) => row.querySelector("[data-label-toggle]"))195+ .find(Boolean);196+ if (pointLabelToggle) {197+ pointLabelToggle.click();198+ await record("point-labels-flipped");199+ pointLabelToggle.click();200+ await record("point-labels-curated");201+ }202+203+ // Highlights across two collections read AND: the ground both name is204+ // the only ground that keeps its pins, and holding Z while they stand205+ // reveals the quiet names among them.206+ const indexRows = [...document.querySelectorAll(".feature-index")]207+ .map((index) => index.querySelector(".zone-index-item"))208+ .filter(Boolean);209+ if (indexRows.length > 1) {210+ const rightClick = (row) => row.dispatchEvent(new MouseEvent("contextmenu", {211+ bubbles: true, cancelable: true,212+ }));213+ const near = indexRows[0];214+ const far = indexRows[indexRows.length - 1];215+ rightClick(near);216+ rightClick(far);217+ await record("and-highlighted");218+ keydown("z");219+ await record("labels-held-highlighted");220+ keyup("z");221+ rightClick(near);222+ rightClick(far);223+ await record("and-cleared");224+ }225+155226 // The geohash grid: open, descend one character, hide the subgrid,156227 // ascend, close.157228 keydown("g");@@ -194,14 +265,14 @@ async function tour() {
194265 await record("viewport-escape");195266 196267 // Variant, map, and game switching, then return to the start.197- const variant = tourQuery("#variant-select");268+ const variant = tourQuery("#lens-select");198269 if (variant.options.length > 1) {199270 change(variant, variant.options[1].value);200271 await record("variant-second");201272 change(variant, variant.options[0].value);202273 await record("variant-first");203274 }204- const mapSelect = tourQuery("#map-select");275+ const mapSelect = tourQuery("#world-select");205276 if (mapSelect.options.length > 1) {206277 change(mapSelect, mapSelect.options[1].value);207278 await record("map-second");@@ -5,16 +5,20 @@ import MultiLineString from "ol/geom/MultiLineString.js";
55 import MultiPolygon from "ol/geom/MultiPolygon.js";66 import Polygon from "ol/geom/Polygon.js";77 8+import { anyShapeCollectionVisible, collectionOf, isCollectionHidden } from "./collections.js";89 import { elements } from "./dom.js";910 import { state } from "./state.js";10-import { showZone } from "./detail.js";11+import { showFeature } from "./detail.js";12+import { collectionID, syncLegendCheckboxes, syncSectionSwitches } from "./legend.js";1113 import { viewMaxZoom } from "./navigation.js";12-import { onActiveShard, refreshPinRendering, updateZonePinFocus } from "./pins.js";14+import { onActiveShard, refreshPinRendering, updateZonePinFocus } from "./features.js";15+import { labelPolicy } from "./semconv.js";1316 import { colorFor } from "./theme.js";14-import { formatNumber } from "./util.js";1517 16-export function renderZones() {17- const zones = (state.world.zones || []).filter(onActiveShard);18+// renderShapes lays the world's shape features -- areas and paths both --19+// onto the chart: their geometries, their title anchors, and the records20+// everything downstream reads them by.21+export function renderShapes() {1822 state.renderedShard = state.lens?.shard || 0;1923 state.sources.zones.clear();2024 state.sources.zoneTitles.clear();@@ -22,51 +26,67 @@ export function renderZones() {
2226 state.highlightedZones.clear();2327 state.focusedZoneID = null;2428 state.zoneTitleCount = 0;25- setZonesVisible(true);26- elements.zoneIndex.hidden = zones.length === 0;27- elements.zoneCount.textContent = formatNumber(zones.length);29+ syncZoneLayers();2830 29- for (const zone of zones) {30- const zoneExtent = createEmpty();31- const geometries = [];32- let hasGeometry = false;33- for (const rawGeometry of zone.features || []) {34- const geometry = projectZoneGeometry(rawGeometry);35- if (!geometry) continue;36- hasGeometry = true;37- geometries.push(geometry);38- extend(zoneExtent, geometry.getExtent());39- state.sources.zones.addFeature(new Feature({40- geometry,31+ for (const collection of state.world.collections) {32+ if (collection.kind === "point") continue;33+ for (const zone of collection.features || []) {34+ if (!onActiveShard(zone)) continue;35+ // Each shape feature learns its collection's id here, once, so36+ // everything downstream -- styles, filters, the label ladder -- can37+ // ask the feature alone.38+ zone.collectionId = collection.id;39+ const zoneExtent = createEmpty();40+ const geometries = [];41+ let hasGeometry = false;42+ for (const rawGeometry of zone.geometry || []) {43+ const geometry = projectZoneGeometry(rawGeometry);44+ if (!geometry) continue;45+ hasGeometry = true;46+ geometries.push(geometry);47+ extend(zoneExtent, geometry.getExtent());48+ state.sources.zones.addFeature(new Feature({49+ geometry,50+ zone,51+ color: colorFor(zone.id),52+ child: zone.parent != null,53+ }));54+ }55+ if (!hasGeometry) continue;56+ const color = colorFor(zone.id);57+ const center = zone.center ? project(zone.center.lat, zone.center.lng) : getCenter(zoneExtent);58+ const span = Math.max(zoneExtent[2] - zoneExtent[0], zoneExtent[3] - zoneExtent[1]);59+ state.sources.zoneTitles.addFeature(new Feature({60+ geometry: new Point(center),4161 zone,42- color: colorFor(zone.id),43- child: zone.parentRegionId != null,62+ color,63+ child: zone.parent != null,64+ span,65+ priority: (zone.parent == null ? 2_000_000 : 1_000_000) + Math.round(span),4466 }));67+ state.zoneRecords.set(zone.id, {68+ zone,69+ collection,70+ extent: zoneExtent.slice(),71+ geometries,72+ color,73+ });4574 }46- if (!hasGeometry) continue;47- const color = colorFor(zone.id);48- const center = zone.center ? project(zone.center.lat, zone.center.lng) : getCenter(zoneExtent);49- const span = Math.max(zoneExtent[2] - zoneExtent[0], zoneExtent[3] - zoneExtent[1]);50- state.sources.zoneTitles.addFeature(new Feature({51- geometry: new Point(center),52- zone,53- color,54- child: zone.parentRegionId != null,55- span,56- priority: (zone.parentRegionId == null ? 2_000_000 : 1_000_000) + Math.round(span),57- }));58- state.zoneRecords.set(zone.id, {59- zone,60- extent: zoneExtent.slice(),61- geometries,62- color,63- });6475 }65- state.zoneTitleCount = state.sources.zoneTitles.getFeatures().length;76+ recountZoneTitles();6677 renderZoneScrim();6778 renderZoneIndex();6879 }6980 81+// Only names that draw on their own crowd the map, so only they press on82+// the threshold that starts thinning them. A hundred quiet zones cost the83+// spoken ones nothing. Recounted whenever the policy moves -- the legend's84+// label toggle changes the answer without rebuilding a single zone.85+export function recountZoneTitles() {86+ state.zoneTitleCount = state.sources.zoneTitles.getFeatures()87+ .filter((feature) => labelPolicy(feature.get("zone")) !== "quiet").length;88+}89+7090 // Highlighting a zone is a request to look at one place, so everything else7191 // recedes: the whole map is covered and the zone is cut back out of it.7292 // Shading only the neighbouring zones demoted them rather than raising the@@ -108,38 +128,44 @@ export function orientRing(ring, clockwise) {
108128 return (area < 0) === clockwise ? ring : ring.slice().reverse();109129 }110130 131+// The feature index under an unfolded shape row: one button per zone, in the132+// parent-first order of the ground itself, each container listing its own133+// collection's features.111134 export function renderZoneIndex() {112- const fragment = document.createDocumentFragment();113- for (const { zone, depth } of orderedZones()) {114- const record = state.zoneRecords.get(zone.id);115- if (!record) continue;116- const button = document.createElement("button");117- button.type = "button";118- button.className = "zone-index-item";119- button.dataset.zone = String(zone.id);120- button.style.setProperty("--zone-color", record.color);121- button.style.setProperty("--zone-depth", String(depth));122- button.setAttribute("aria-pressed", "false");123- button.title = `${zone.title}: click to jump; right-click to toggle highlight`;135+ for (const container of elements.legend.querySelectorAll(".feature-index")) {136+ const fragment = document.createDocumentFragment();137+ for (const { zone, depth } of orderedZones(collectionID(container.dataset.featureIndex))) {138+ const record = state.zoneRecords.get(zone.id);139+ if (!record) continue;140+ const button = document.createElement("button");141+ button.type = "button";142+ button.className = "zone-index-item";143+ button.dataset.zone = String(zone.id);144+ button.style.setProperty("--zone-color", record.color);145+ button.style.setProperty("--zone-depth", String(depth));146+ button.setAttribute("aria-pressed", "false");147+ button.title = `${zone.title}: click to jump; right-click to toggle highlight`;124148 125- const marker = document.createElement("span");126- marker.className = "zone-index-marker";127- marker.setAttribute("aria-hidden", "true");128- const title = document.createElement("span");129- title.textContent = zone.title;130- button.append(marker, title);131- fragment.append(button);149+ const marker = document.createElement("span");150+ marker.className = "zone-index-marker";151+ marker.setAttribute("aria-hidden", "true");152+ const title = document.createElement("span");153+ title.textContent = zone.title;154+ button.append(marker, title);155+ fragment.append(button);156+ }157+ container.replaceChildren(fragment);132158 }133- elements.zoneList.replaceChildren(fragment);134- elements.zoneIndex.hidden = state.zoneRecords.size === 0;135159 }136160 137-export function orderedZones() {138- const zones = [...state.zoneRecords.values()].map((record) => record.zone);161+export function orderedZones(collectionId) {162+ const zones = [...state.zoneRecords.values()]163+ .filter((record) => record.zone.collectionId === collectionId)164+ .map((record) => record.zone);139165 const zoneIDs = new Set(zones.map((zone) => zone.id));140166 const children = new Map();141167 for (const zone of zones) {142- const parentID = zoneIDs.has(zone.parentRegionId) ? zone.parentRegionId : null;168+ const parentID = zoneIDs.has(zone.parent) ? zone.parent : null;143169 if (!children.has(parentID)) children.set(parentID, []);144170 children.get(parentID).push(zone);145171 }@@ -163,13 +189,36 @@ export function orderedZones() {
163189 return ordered;164190 }165191 166-export function setZonesVisible(visible) {167- state.zonesVisible = visible;168- elements.zoneToggle.checked = visible;192+// The four zone layers answer the ledger the same way the pins do: drawn193+// while their collection is shown, and away while it is hidden. Hiding also194+// withdraws the hidden collection's highlights -- a filter must not keep195+// conditioning the map from under a layer the reader has put away.196+export function syncZoneLayers() {197+ const visible = anyShapeCollectionVisible();169198 state.layers.zoneScrim.setVisible(visible);170199 state.layers.zones.setVisible(visible);171200 state.layers.zoneTitles.setVisible(visible);172201 state.layers.zoneTitleDetail.setVisible(visible);202+ let pruned = false;203+ for (const zoneID of [...state.highlightedZones]) {204+ const record = state.zoneRecords.get(zoneID);205+ if (!record || isCollectionHidden(collectionOf(record.zone))) {206+ state.highlightedZones.delete(zoneID);207+ pruned = true;208+ }209+ }210+ if (pruned) {211+ updateZonePinFocus();212+ renderZoneScrim();213+ updateZoneIndexState();214+ }215+ // Which features draw is each feature's own style to answer, and the216+ // answer may just have changed while the layers' visibility did not:217+ // soloing one collection keeps the layers up but must repaint them, or218+ // the last frame -- every collection drawn -- keeps standing.219+ state.layers.zones.changed();220+ state.layers.zoneTitles.changed();221+ state.layers.zoneTitleDetail.changed();173222 }174223 175224 export function jumpToZone(zoneID) {@@ -177,7 +226,7 @@ export function jumpToZone(zoneID) {
177226 if (!record) return;178227 state.focusedZoneID = zoneID;179228 updateZoneIndexState();180- showZone(record.zone);229+ showFeature(record.zone);181230 state.engine.getView().fit(record.extent, {182231 size: state.engine.getSize(),183232 padding: [54, 54, 54, 54],@@ -189,11 +238,18 @@ export function jumpToZone(zoneID) {
189238 }190239 191240 export function toggleZoneHighlight(zoneID) {192- if (!state.zoneRecords.has(zoneID)) return;241+ const record = state.zoneRecords.get(zoneID);242+ if (!record) return;193243 if (state.highlightedZones.has(zoneID)) state.highlightedZones.delete(zoneID);194244 else {195245 state.highlightedZones.add(zoneID);196- setZonesVisible(true);246+ // Highlighting unhides: asking to look at a zone and keeping its layer247+ // away cannot both be meant.248+ if (state.hiddenCollections.delete(collectionOf(record.zone))) {249+ syncLegendCheckboxes();250+ syncSectionSwitches();251+ }252+ syncZoneLayers();197253 }198254 state.hoveredPin = null;199255 updateZonePinFocus();@@ -206,8 +262,10 @@ export function toggleZoneHighlight(zoneID) {
206262 }207263 208264 export function updateZoneIndexState() {209- elements.zoneIndex.classList.toggle("has-highlights", state.highlightedZones.size > 0);210- for (const button of elements.zoneList.querySelectorAll("[data-zone]")) {265+ for (const container of elements.legend.querySelectorAll(".feature-index")) {266+ container.classList.toggle("has-highlights", state.highlightedZones.size > 0);267+ }268+ for (const button of elements.legend.querySelectorAll("[data-zone]")) {211269 const zoneID = Number(button.dataset.zone);212270 const highlighted = state.highlightedZones.has(zoneID);213271 button.classList.toggle("is-highlighted", highlighted);@@ -1,8 +1,8 @@
11 import { state } from "./state.js";22 import { legendSections } from "./legend.js";33 4-// A map arrives in two pieces: its layers, categories and regions as JSON, and5-// its locations packed as parallel arrays. Nothing here is fetched until the4+// A map arrives in two pieces: its layers and collections as JSON, and its5+// point features packed as parallel arrays. Nothing here is fetched until the66 // map is opened, so the catalog can grow without the wait growing with it.77 export async function loadWorld(entry) {88 const [detailResponse, packedResponse] = await Promise.all([@@ -19,15 +19,17 @@ export async function loadWorld(entry) {
1919 detailResponse.json(),2020 packedResponse.arrayBuffer(),2121 ]);22- const categories = detail.groups.flatMap((group) => group.categories);23- unpackLocations(packed, categories);24- const sections = legendSections(detail.groups);22+ const collections = detail.collections || [];23+ unpackLocations(packed, collections);24+ const sections = legendSections(collections);2525 return {2626 ...entry,2727 grid: detail.grid,2828 lenses: detail.lenses,29- groups: detail.groups,30- zones: detail.zones || [],29+ collections,30+ // One index by id, because everything downstream -- the hide set, the31+ // label ladder, a zone asking after its own collection -- speaks in ids.32+ collectionsById: new Map(collections.map((collection) => [collection.id, collection])),3133 attrs: detail.attrs || {},3234 merged: detail.merged || [],3335 sections,@@ -35,44 +37,53 @@ export async function loadWorld(entry) {
3537 }3638 3739 // The reader of packLocations. Each field is a view straight onto the buffer,38-// laid out so no copying or realignment is needed to get at it.39-export function unpackLocations(buffer, categories) {40+// laid out so no copying or realignment is needed to get at it. The owner41+// column indexes the collections array; only a point collection may own a42+// packed location, and a payload saying otherwise is refused rather than43+// guessed at.44+export function unpackLocations(buffer, collections) {4045 const view = new DataView(buffer);4146 const magic = String.fromCharCode(...new Uint8Array(buffer, 0, 8));4247 if (magic !== "ATLASLOC") throw new Error("location payload is not in the expected form");4348 const version = view.getUint16(8, true);44- if (version !== 2) throw new Error(`location payload is version ${version}, and this reads 2`);49+ if (version !== 3) throw new Error(`location payload is version ${version}, and this reads 3`);4550 const count = view.getUint32(10, true);4651 4752 let at = 16;4853 const ids = new Int32Array(buffer, at, count);4954 const latitudes = new Float32Array(buffer, (at += count * 4), count);5055 const longitudes = new Float32Array(buffer, (at += count * 4), count);51- const regions = new Int32Array(buffer, (at += count * 4), count);56+ const members = new Int32Array(buffer, (at += count * 4), count);5257 const shards = new Int32Array(buffer, (at += count * 4), count);5358 const offsets = new Uint32Array(buffer, (at += count * 4), count + 1);5459 const owners = new Uint16Array(buffer, (at += (count + 1) * 4), count);5560 const titles = new Uint8Array(buffer, at + count * 2);5661 5762 const decoder = new TextDecoder();58- for (const category of categories) category.locations = [];63+ for (const collection of collections) {64+ if (collection.kind === "point") collection.locations = [];65+ }5966 for (let index = 0; index < count; index++) {60- categories[owners[index]].locations.push({67+ const owner = collections[owners[index]];68+ if (!owner || owner.kind !== "point") {69+ throw new Error(`location ${ids[index]} names collection ${owners[index]}, which is no point collection`);70+ }71+ owner.locations.push({6172 id: ids[index],6273 title: decoder.decode(titles.subarray(offsets[index], offsets[index + 1])),6374 lat: latitudes[index],6475 lng: longitudes[index],65- regionId: regions[index] || undefined,76+ memberId: members[index] || undefined,6677 shard: shards[index] || undefined,6778 });6879 }6980 }7081 7182 // Descriptions and cross-references are half the catalog by weight and are read72-// one pin at a time, so a map's are fetched the first time one of its pins is73-// opened, and not at all if none ever is. The cache is keyed by the volume's74-// stamped base as well as the map, so an updated bundle is never answered75-// with the words of the build it replaced.83+// one feature at a time, so a map's are fetched the first time one of its84+// features is opened, and not at all if none ever is. The cache is keyed by the85+// volume's stamped base as well as the map, so an updated bundle is never86+// answered with the words of the build it replaced.7687 export async function worldText() {7788 const key = `${state.volume.base}/${state.world.slug}`;7889 if (!state.textByWorld.has(key)) {@@ -0,0 +1,71 @@
1+// The filtering side of the collections model. Every feature belongs to a2+// named collection, and highlighting reads AND across collections, OR within3+// one: two districts highlighted widens the question, a district and a4+// subwatershed narrows it to the ground they share.5+6+import { state } from "./state.js";7+8+// collectionOf names the collection a shape feature belongs to: the id it9+// was stamped with when its collection was rendered.10+export function collectionOf(zone) {11+ return zone?.collectionId;12+}13+14+// collectionFor answers with the collection itself, for anything that needs15+// its attributes -- the label ladder, the stroke width -- rather than its id.16+export function collectionFor(zone) {17+ return state.world?.collectionsById?.get(zone?.collectionId);18+}19+20+// anyShapeCollectionVisible says whether any ground is drawn at all: the21+// zone layers stay up while one shape collection is shown, and each feature's22+// own style answers for its collection from there.23+export function anyShapeCollectionVisible() {24+ return (state.world?.collections || []).some(25+ (collection) => collection.kind !== "point" && !isCollectionHidden(collection.id),26+ );27+}28+29+// isCollectionHidden is the one question every renderer asks about a30+// collection: pins ask by their collection's id, shape features ask through31+// collectionOf. Nothing outside the legend touches the set directly.32+export function isCollectionHidden(collectionID) {33+ return state.hiddenCollections.has(collectionID);34+}35+36+// groupByCollection buckets highlighted zone records under their collections,37+// which is the shape the filter thinks in: each bucket a question, its38+// members the acceptable answers.39+export function groupByCollection(records) {40+ const groups = new Map();41+ for (const record of records) {42+ const key = collectionOf(record.zone);43+ if (!groups.has(key)) groups.set(key, []);44+ groups.get(key).push(record);45+ }46+ return groups;47+}48+49+// passesZoneFilters answers whether a coordinate survives the highlights: it50+// must lie inside at least one highlighted zone of every collection holding51+// any. Within a collection the zones are alternatives; across collections52+// they are conditions.53+export function passesZoneFilters(groups, coordinate) {54+ for (const records of groups.values()) {55+ const inside = records.some((record) =>56+ record.geometries.some((geometry) => geometryContainsCoordinate(geometry, coordinate)));57+ if (!inside) return false;58+ }59+ return true;60+}61+62+// Containment with a pixel of grace: a pin dropped on a zone's border was put63+// there to mean the zone, and exact point-in-polygon arithmetic would flip it64+// out over the width of the line it stands on.65+export function geometryContainsCoordinate(geometry, coordinate) {66+ if (geometry.intersectsCoordinate(coordinate)) return true;67+ const closest = geometry.getClosestPoint(coordinate);68+ const x = closest[0] - coordinate[0];69+ const y = closest[1] - coordinate[1];70+ return x * x + y * y <= 1;71+}@@ -19,7 +19,11 @@ export const overzoomLevels = 2;
1919 // to a default view discards work the reader did to reach where they were. The2020 // whole arrangement is kept: which map, which layer, where the view sits, what2121 // is filtered out and which groups are folded.22-export const sessionKey = "atlas.session";22+// The key carries the schema's generation: the unified hide-set writes ids of23+// more than one kind under "hidden", which a build from before the legend24+// tree would misread, and its sessions would misread us. A new key lets both25+// vintages keep their own arrangements rather than corrupt each other's.26+export const sessionKey = "atlas.session.v3";2327 2428 // The overview is drawn once per lens from the shallowest pyramid level big2529 // enough to read, then only the viewport rectangle moves.@@ -1,17 +1,19 @@
11 import { worldText } from "./catalog.js";22 import { applicableSystems } from "./cellsystems/index.js";33 import { geohashCellAt } from "./cellsystems/geohash.js";4+import { collectionFor, geometryContainsCoordinate } from "./collections.js";45 import { elements } from "./dom.js";56 import { syncLegendCheckboxes, syncSectionSwitches } from "./legend.js";67 import { viewMaxZoom } from "./navigation.js";7-import { applyPinFilters, refreshPrioritySource } from "./pins.js";8+import { applyPinFilters, onActiveShard, refreshPrioritySource } from "./features.js";89 import { renderSearchResults, revealDock } from "./search.js";10+import { featureAttributeRows, geoMapping } from "./semconv.js";911 import { state } from "./state.js";1012 import { applyCategoryVisual, applyCategoryGlyph, colorFor, initials } from "./theme.js";11-import { cleanDescription } from "./util.js";13+import { cleanDescription, formatNumber } from "./util.js";1214 1315 export function revealPin(pin) {14- state.hiddenCategories.delete(pin.category.id);16+ state.hiddenCollections.delete(pin.category.id);1517 syncLegendCheckboxes();1618 applyPinFilters();1719 syncSectionSwitches();@@ -28,13 +30,13 @@ export function showPin(pin, focus = false) {
2830 refreshPrioritySource();2931 state.layers.pins.changed();3032 state.layers.pinLabels.changed();31- state.layers.text.changed();32- state.layers.textDetail.changed();3333 state.layers.priority.changed();3434 elements.detailTitle.textContent = pin.location.title;35- elements.detailCategory.textContent = `${pin.group.title} / ${pin.category.title}`;35+ elements.detailCategory.textContent =36+ [pin.category.group, pin.category.title].filter(Boolean).join(" / ");3637 elements.detailDescription.textContent = "";3738 elements.detailLinks.hidden = true;39+ clearFeatureRows();3840 fillPinText(pin);3941 elements.detailID.textContent = String(pin.location.id);4042 elements.detailCoordinates.textContent =@@ -87,19 +89,27 @@ export function showPin(pin, focus = false) {
8789 }8890 }8991 90-// showZone opens the panel on a zone: its title and kind, its prose when the91-// archive carries any -- fetched the same lazy way a pin's is -- and the92-// volume's own provenance. Ground has no single coordinate or cell, so those93-// rows step aside.94-export function showZone(zone) {92+// showFeature opens the panel on a shape feature: its title and collection,93+// its prose when the archive carries any -- fetched the same lazy way a94+// pin's is -- its measure on the ground where the world declares a geographic95+// mapping, and whatever attributes it carries in its own right. Ground has96+// no single coordinate or cell, so those rows step aside.97+export function showFeature(zone) {9598 state.selectedPin = null;9699 state.selectedZone = zone;97100 document.dispatchEvent(new Event("atlas:selection"));98101 refreshPrioritySource();99102 state.layers.pins.changed();100103 state.layers.priority.changed();104+ // A quiet zone speaks its name for as long as it is the one being read105+ // about, so selection repaints the chips.106+ state.layers.zoneTitles.changed();107+ state.layers.zoneTitleDetail.changed();108+ const collection = collectionFor(zone);101109 elements.detailTitle.textContent = zone.title;102- elements.detailCategory.textContent = zone.subtitle || "Zone";110+ elements.detailCategory.textContent =111+ [collection?.group, collection?.title].filter(Boolean).join(" / ") ||112+ zone.subtitle || "Zone";103113 elements.detailDescription.textContent = "";104114 elements.detailLinks.hidden = true;105115 elements.detailLinks.replaceChildren();@@ -115,6 +125,8 @@ export function showZone(zone) {
115125 elements.detailDot.textContent = "";116126 elements.detailDot.removeAttribute("style");117127 elements.detailDot.style.setProperty("background", colorFor(zone.id));128+ clearFeatureRows();129+ renderFeatureRows([...featureMeasureRows(zone, collection), ...featureAttributeRows(zone.attrs)]);118130 if (zone.hasText) void fillZoneText(zone);119131 else elements.detailDescription.textContent = "No description is included in the archive.";120132 elements.detail.hidden = false;@@ -122,6 +134,122 @@ export function showZone(zone) {
122134 renderSearchResults();123135 }124136 137+// featureMeasureRows says what a feature's ground amounts to, in the units of138+// the planet -- so only where the world declares a mapping back to one. An139+// area gets its extent and how many visible locations stand inside it; a path140+// gets its length.141+function featureMeasureRows(zone, collection) {142+ const record = state.zoneRecords.get(zone.id);143+ if (!record || !collection) return [];144+ const rows = [];145+ const mapping = geoMapping(state.world);146+ if (collection.kind === "area") {147+ if (mapping) {148+ const km2 = record.geometries.reduce((sum, geometry) => sum + geometryAreaKm2(geometry, mapping), 0);149+ if (km2 > 0) rows.push({ label: "Area", value: formatKm2(km2) });150+ }151+ const inside = state.features.filter((pin) =>152+ !pin.filteredHidden && onActiveShard(pin.location) &&153+ record.geometries.some((geometry) => geometryContainsCoordinate(geometry, pin.coordinate))).length;154+ rows.push({ label: "Locations inside", value: formatNumber(inside) });155+ }156+ if (collection.kind === "path" && mapping) {157+ const km = record.geometries.reduce((sum, geometry) => sum + geometryLengthKm(geometry, mapping), 0);158+ if (km > 0) rows.push({ label: "Length", value: formatKm(km) });159+ }160+ return rows;161+}162+163+// The measures below flatten small grounds locally: latitude and longitude164+// come back through the world's declared mapping, and a city-sized ring is165+// near enough planar that the shoelace over locally scaled kilometres is the166+// honest figure.167+const kmPerDegreeLat = 110.574;168+169+function toLatLng(mapping, [x, y]) {170+ return mapping.toLatLng(x, -y);171+}172+173+function ringAreaKm2(ring, mapping) {174+ const points = ring.map((position) => toLatLng(mapping, position));175+ if (points.length < 3) return 0;176+ const midLat = points.reduce((sum, point) => sum + point[0], 0) / points.length;177+ const kmPerDegreeLng = 111.320 * Math.cos((midLat * Math.PI) / 180);178+ let doubled = 0;179+ for (let index = 0, prior = points.length - 1; index < points.length; prior = index++) {180+ const [latA, lngA] = points[prior];181+ const [latB, lngB] = points[index];182+ doubled += lngA * kmPerDegreeLng * latB * kmPerDegreeLat -183+ lngB * kmPerDegreeLng * latA * kmPerDegreeLat;184+ }185+ return Math.abs(doubled) / 2;186+}187+188+function geometryAreaKm2(geometry, mapping) {189+ const polygons = geometry.getType() === "MultiPolygon"190+ ? geometry.getPolygons()191+ : geometry.getType() === "Polygon" ? [geometry] : [];192+ let total = 0;193+ for (const polygon of polygons) {194+ polygon.getLinearRings().forEach((ring, index) => {195+ const area = ringAreaKm2(ring.getCoordinates(), mapping);196+ total += index === 0 ? area : -area;197+ });198+ }199+ return Math.max(0, total);200+}201+202+function geometryLengthKm(geometry, mapping) {203+ const lines = geometry.getType() === "MultiLineString"204+ ? geometry.getCoordinates()205+ : geometry.getType() === "LineString" ? [geometry.getCoordinates()] : [];206+ let total = 0;207+ for (const line of lines) {208+ for (let index = 1; index < line.length; index++) {209+ const [latA, lngA] = toLatLng(mapping, line[index - 1]);210+ const [latB, lngB] = toLatLng(mapping, line[index]);211+ const midLat = ((latA + latB) / 2) * (Math.PI / 180);212+ const dx = (lngB - lngA) * 111.320 * Math.cos(midLat);213+ const dy = (latB - latA) * kmPerDegreeLat;214+ total += Math.hypot(dx, dy);215+ }216+ }217+ return total;218+}219+220+function formatKm2(km2) {221+ return `${km2 >= 10 ? formatNumber(Math.round(km2)) : km2.toFixed(2)} km²`;222+}223+224+function formatKm(km) {225+ if (km < 1) return `${Math.round(km * 1000)} m`;226+ return `${km >= 10 ? formatNumber(Math.round(km)) : km.toFixed(1)} km`;227+}228+229+// The card's own rows -- a feature's measures and attributes -- live in the230+// same definition list the fixed rows do, marked so the next selection can231+// sweep them.232+function clearFeatureRows() {233+ for (const stray of elements.detail.querySelectorAll("[data-feature-row]")) {234+ stray.remove();235+ }236+}237+238+function renderFeatureRows(rows) {239+ let anchor = elements.detailSourceField;240+ for (const row of rows) {241+ const field = document.createElement("div");242+ field.dataset.featureRow = "";243+ const term = document.createElement("dt");244+ term.textContent = row.label;245+ const value = document.createElement("dd");246+ value.textContent = row.value;247+ field.append(term, value);248+ anchor.after(field);249+ anchor = field;250+ }251+}252+125253 // The words belonging to a zone arrive with the same text payload a pin's126254 // do, and the same rule holds: a zone closed or changed while they were on127255 // the way is left alone.@@ -156,7 +284,7 @@ function pinSource(pin) {
156284 state.pinSourceIndex = { world: state.world, byID };157285 }158286 for (const account of merged) {159- if (!account.origin && pin.group.title === account.source) return account.source;287+ if (!account.origin && pin.category.group === account.source) return account.source;160288 }161289 return state.pinSourceIndex.byID.get(pin.location.id) || origin;162290 }@@ -173,6 +301,10 @@ export async function fillPinText(pin) {
173301 pin.location.links = entry.l || [];174302 elements.detailDescription.textContent =175303 cleanDescription(entry.d) || "No description is included in the archive.";304+ // A point feature's attributes travel with its text, so its card rows --305+ // the HUC-12 of a pin that knows its subwatershed -- arrive with the words.306+ clearFeatureRows();307+ renderFeatureRows(featureAttributeRows(entry.a));176308 renderDetailLinks(pin);177309 }178310 @@ -180,7 +312,7 @@ export async function fillPinText(pin) {
180312 // they still work with no network, and dropped when the target is not on this181313 // map.182314 export function renderDetailLinks(pin) {183- const links = (pin.location.links || []).filter((link) => state.pinByID.has(link.locationId));315+ const links = (pin.location.links || []).filter((link) => state.featureByID.has(link.locationId));184316 elements.detailLinks.hidden = links.length === 0;185317 if (!links.length) {186318 elements.detailLinks.replaceChildren();@@ -207,9 +339,10 @@ export function closeDetail() {
207339 refreshPrioritySource();208340 state.layers.pins.changed();209341 state.layers.pinLabels.changed();210- state.layers.text.changed();211- state.layers.textDetail.changed();212342 state.layers.priority.changed();343+ // A quiet zone that spoke while selected falls silent again.344+ state.layers.zoneTitles.changed();345+ state.layers.zoneTitleDetail.changed();213346 }214347 elements.detail.hidden = true;215348 if (hadSelection) renderSearchResults();@@ -1,3 +1,4 @@
1+import { anyShapeCollectionVisible } from "./collections.js";12 import { elements } from "./dom.js";23 import { state } from "./state.js";34 import { viewMaxZoom } from "./navigation.js";@@ -16,7 +17,10 @@ export function exposeDiagnostics() {
1617 maxZoom: state.lens ? viewMaxZoom(state.lens) : null,1718 interpolate: state.lens?.interpolate,1819 tileStats: { ...state.tileStats },19- pins: state.pins.length,20+ // The registry is state.features now, but the snapshot keeps the key the21+ // parity diffs already know, so cross-build comparisons stay line-for-line22+ // readable.23+ pins: state.features.length,2024 eligibleLocations: state.eligibleLocations,2125 domNodes: document.querySelectorAll("*").length,2226 canvases: document.querySelectorAll("canvas").length,@@ -26,7 +30,10 @@ export function exposeDiagnostics() {
2630 selectedPin: state.selectedPin?.location.title || null,2731 fitZoom: state.fitZoom,2832 filters: {29- hiddenCategories: [...state.hiddenCategories].sort(),33+ // The state holds one hiddenCollections set now, but the snapshot keeps34+ // the key the parity diffs already know, so cross-build comparisons35+ // stay line-for-line readable.36+ hiddenCategories: [...state.hiddenCollections].sort(),3037 collapsedSections: [...state.collapsedSections].sort(),3138 },3239 ui: {@@ -46,14 +53,14 @@ export function exposeDiagnostics() {
4653 subgridVisible: state.subgridVisible,4754 },4855 zones: {49- visible: state.zonesVisible,56+ visible: anyShapeCollectionVisible(),5057 count: state.zoneRecords.size,5158 focused: state.zoneRecords.get(state.focusedZoneID)?.zone.title || null,5259 highlighted: [...state.highlightedZones]5360 .map((zoneID) => state.zoneRecords.get(zoneID)?.zone.title)5461 .filter(Boolean),55- focusedPins: state.pins.filter((pin) => !pin.filteredHidden &&56- pin.insideHighlightedZone).length,62+ focusedPins: state.features.filter((pin) => !pin.filteredHidden &&63+ pin.passesZoneFilters).length,5764 },5865 grid: {5966 enabled: state.gridEnabled,@@ -66,7 +73,7 @@ export function exposeDiagnostics() {
6673 ...state.sources.gridContext.getFeatures(),6774 ].map((feature) => feature.get("gridCell")),6875 priorityPins: state.gridCell69- ? state.pins.filter((pin) => !pin.filteredHidden && pinInGridCell(pin)).length76+ ? state.features.filter((pin) => !pin.filteredHidden && pinInGridCell(pin)).length7077 : 0,7178 },7279 });@@ -17,10 +17,6 @@ export const elements = {
1717 globe: $("#globe"),1818 globeToggle: $("#globe-toggle"),1919 layers: $("#layers"),20- zoneToggle: $("#zone-toggle"),21- zoneCount: $("#zone-count"),22- zoneIndex: $("#zone-index"),23- zoneList: $("#zone-list"),2420 loading: $("#map-loading"),2521 labelsHint: $("#labels-hint"),2622 gridHint: $("#grid-hint"),@@ -7,8 +7,8 @@ import VectorLayer from "ol/layer/Vector.js";
77 import Projection from "ol/proj/Projection.js";88 import VectorSource from "ol/source/Vector.js";99 10+import { collectionOf, isCollectionHidden } from "./collections.js";1011 import { elements } from "./dom.js";11-import { renderAs } from "./semconv.js";1212 import { state } from "./state.js";1313 import {1414 featureOrder,@@ -16,20 +16,17 @@ import {
1616 pinFeatureStyle,1717 pinLabelFeatureStyle,1818 priorityFeatureStyle,19- textDetailFeatureStyle,20- textFeatureStyle,2119 zonePinFeatureStyle,2220 zoneScrimStyle,2321 zoneStyle,24- zoneTextFeatureStyle,2522 zoneTitleDetailStyle,2623 zoneTitleStyle,2724 } from "./styles.js";2825 import { settleView } from "./navigation.js";2926 import { updateOverviewViewport } from "./overview.js";3027 import { selectGridCell } from "./grid.js";31-import { setHoveredPin } from "./pins.js";32-import { showPin } from "./detail.js";28+import { setHoveredPin } from "./features.js";29+import { showFeature, showPin } from "./detail.js";3330 3431 // A vector layer left to itself stretches the last frame it drew through an3532 // animation, which leaves markers the wrong size mid-zoom and blank ground@@ -53,7 +50,6 @@ export function initializeMap() {
5350 zoneScrim: new VectorSource({ wrapX: false }),5451 zones: new VectorSource({ wrapX: false }),5552 zoneTitles: new VectorSource({ wrapX: false }),56- text: new VectorSource({ wrapX: false }),5753 pins: new VectorSource({ wrapX: false }),5854 priority: new VectorSource({ wrapX: false }),5955 };@@ -97,27 +93,6 @@ export function initializeMap() {
9793 renderBuffer: 160,9894 zIndex: 44,9995 }),100- text: eagerVector({101- source: state.sources.text,102- style: textFeatureStyle,103- renderOrder: featureOrder,104- renderBuffer: 220,105- zIndex: 30,106- }),107- textDetail: eagerVector({108- source: state.sources.text,109- style: textDetailFeatureStyle,110- renderOrder: featureOrder,111- renderBuffer: 220,112- zIndex: 45,113- }),114- zoneText: eagerVector({115- source: state.sources.text,116- style: zoneTextFeatureStyle,117- renderOrder: featureOrder,118- renderBuffer: 220,119- zIndex: 41,120- }),12196 // Nothing is decluttered. Dropping whatever overlaps makes a crowded area12297 // quietly show less than it holds, for text labels as much as for markers;12398 // zooming in to separate them is the reader's job.@@ -220,7 +195,24 @@ export function initializeMap() {
220195 (feature, layer) => (isAnnotationLayer(layer) && feature.get("pin")) || null,221196 { hitTolerance: 5, layerFilter: isAnnotationLayer },222197 );223- if (pin) showPin(pin);198+ if (pin) {199+ showPin(pin);200+ return;201+ }202+ // A click that lands on no marker falls through to the ground itself:203+ // the topmost shape feature under the pointer opens the same card its204+ // legend row does. A hidden collection's ground is not drawn and so205+ // answers no hit-test, but the rule is spelled out here rather than206+ // left riding on a renderer detail.207+ const zone = state.engine.forEachFeatureAtPixel(208+ event.pixel,209+ (feature) => {210+ const ground = feature.get("zone");211+ return ground && !isCollectionHidden(collectionOf(ground)) ? ground : null;212+ },213+ { layerFilter: (layer) => layer === state.layers.zones },214+ );215+ if (zone) showFeature(zone);224216 });225217 state.engine.on("pointermove", (event) => {226218 if (event.dragging) {@@ -232,8 +224,7 @@ export function initializeMap() {
232224 (feature, layer) => (isAnnotationLayer(layer) && feature.get("pin")) || null,233225 { hitTolerance: 4, layerFilter: isAnnotationLayer },234226 );235- const hovered = hit && renderAs(hit.category) === "text" ? null : hit;236- setHoveredPin(hovered || null);227+ setHoveredPin(hit || null);237228 const gridHit = state.gridEnabled && state.engine.hasFeatureAtPixel(event.pixel, {238229 layerFilter: (layer) =>239230 layer === state.layers.grid || layer === state.layers.gridContext,@@ -248,9 +239,7 @@ export function initializeMap() {
248239 // the only ones still on screen -- answering neither the pointer nor a click.249240 export function isAnnotationLayer(layer) {250241 return layer === state.layers.pins || layer === state.layers.zonePins ||251- layer === state.layers.pinLabels || layer === state.layers.priority ||252- layer === state.layers.text || layer === state.layers.textDetail ||253- layer === state.layers.zoneText;242+ layer === state.layers.pinLabels || layer === state.layers.priority;254243 }255244 256245 // createView holds the camera to the map rather than to the world square@@ -10,16 +10,19 @@ import {
1010 toggleSidebar,1111 } from "./navigation.js";1212 import {13- setAllCategories,13+ collectionID,14+ setAllCollections,1415 setAllSectionsCollapsed,1516 showOnly,1617 syncSectionCollapse,1718 syncSectionSwitches,19+ toggleCollectionExpanded,20+ toggleLabelPolicy,1821 toggleSection,1922 } from "./legend.js";20-import { applyPinFilters, setLabelsHeld } from "./pins.js";23+import { applyPinFilters, setLabelsHeld } from "./features.js";2124 import { changeGlobeZoom, refreshGlobe, resizeGlobe, toggleGlobe } from "./globe.js";22-import { jumpToZone, setZonesVisible, toggleZoneHighlight } from "./zones.js";25+import { jumpToZone, syncZoneLayers, toggleZoneHighlight } from "./areas.js";2326 import { foldDockByHand, revealDock } from "./search.js";2427 import { importBundles } from "./library.js";2528 import { closeDetail, revealPin } from "./detail.js";@@ -55,10 +58,11 @@ export function bindUIEvents() {
5558 toggleSection(input.dataset.sectionToggle);5659 return;5760 }58- if (!input.dataset.category) return;59- const categoryID = Number(input.dataset.category);60- if (input.checked) state.hiddenCategories.delete(categoryID);61- else state.hiddenCategories.add(categoryID);61+ if (!input.dataset.collection) return;62+ const id = collectionID(input.dataset.collection);63+ if (input.checked) state.hiddenCollections.delete(id);64+ else state.hiddenCollections.add(id);65+ syncZoneLayers();6266 applyPinFilters();6367 syncSectionSwitches();6468 });@@ -90,17 +94,38 @@ export function bindUIEvents() {
9094 elements.layers.addEventListener("scroll", markHoveredRow, { passive: true });9195 9296 elements.layers.addEventListener("click", (event) => {93- const only = event.target.closest("[data-only-category], [data-only-section]");97+ const only = event.target.closest("[data-only-collection], [data-only-section]");9498 if (only) {9599 // The button sits inside the row's label, whose default action would96100 // otherwise toggle the very checkbox this is meant to override.97101 event.preventDefault();98102 event.stopPropagation();99- showOnly(only.dataset.onlyCategory100- ? { category: Number(only.dataset.onlyCategory) }103+ showOnly(only.dataset.onlyCollection104+ ? { collection: collectionID(only.dataset.onlyCollection) }101105 : { section: only.dataset.onlySection });102106 return;103107 }108+ // The unfolding chevron and the label toggle also live inside the row's109+ // label, and mean themselves rather than the checkbox under it.110+ const expand = event.target.closest("[data-expand-collection]");111+ if (expand) {112+ event.preventDefault();113+ event.stopPropagation();114+ toggleCollectionExpanded(collectionID(expand.dataset.expandCollection));115+ return;116+ }117+ const labels = event.target.closest("[data-label-toggle]");118+ if (labels) {119+ event.preventDefault();120+ event.stopPropagation();121+ toggleLabelPolicy(collectionID(labels.dataset.labelToggle));122+ return;123+ }124+ const zone = event.target.closest("[data-zone]");125+ if (zone) {126+ jumpToZone(Number(zone.dataset.zone));127+ return;128+ }104129 const button = event.target.closest("[data-section]");105130 if (!button) return;106131 const key = button.dataset.section;@@ -108,26 +133,20 @@ export function bindUIEvents() {
108133 else state.collapsedSections.add(key);109134 syncSectionCollapse();110135 });136+ // The right button asks after a zone in particular: toggle its highlight137+ // rather than jumping to it.138+ elements.layers.addEventListener("contextmenu", (event) => {139+ const zone = event.target.closest("[data-zone]");140+ if (!zone) return;141+ event.preventDefault();142+ toggleZoneHighlight(Number(zone.dataset.zone));143+ });111144 112- elements.soloChip.addEventListener("click", () => setAllCategories(true));145+ elements.soloChip.addEventListener("click", () => setAllCollections(true));113146 $("#expand-all").addEventListener("click", () => setAllSectionsCollapsed(false));114147 $("#collapse-all").addEventListener("click", () => setAllSectionsCollapsed(true));115- $("#show-all").addEventListener("click", () => setAllCategories(true));116- $("#hide-all").addEventListener("click", () => setAllCategories(false));117- elements.zoneToggle.addEventListener("change", () => {118- setZonesVisible(elements.zoneToggle.checked);119- });120- elements.zoneIndex.addEventListener("click", (event) => {121- const button = event.target.closest("[data-zone]");122- if (!button) return;123- jumpToZone(Number(button.dataset.zone));124- });125- elements.zoneIndex.addEventListener("contextmenu", (event) => {126- const button = event.target.closest("[data-zone]");127- if (!button) return;128- event.preventDefault();129- toggleZoneHighlight(Number(button.dataset.zone));130- });148+ $("#show-all").addEventListener("click", () => setAllCollections(true));149+ $("#hide-all").addEventListener("click", () => setAllCollections(false));131150 elements.search.addEventListener("input", () => {132151 state.search = elements.search.value.trim().toLocaleLowerCase();133152 // applyPinFilters refreshes the dock list along with the canvas.@@ -140,16 +159,20 @@ export function bindUIEvents() {
140159 foldDockByHand(!state.dockFolded);141160 });142161 elements.searchResults.addEventListener("click", (event) => {143- const result = event.target.closest("[data-location]");162+ const result = event.target.closest("[data-location], [data-zone]");144163 if (!result) return;145- const pin = state.pinByID.get(Number(result.dataset.location));164+ if (result.dataset.zone) {165+ jumpToZone(Number(result.dataset.zone));166+ return;167+ }168+ const pin = state.featureByID.get(Number(result.dataset.location));146169 if (pin) revealPin(pin);147170 });148171 149172 elements.detailLinks.addEventListener("click", (event) => {150173 const button = event.target.closest("[data-location]");151174 if (!button) return;152- const pin = state.pinByID.get(Number(button.dataset.location));175+ const pin = state.featureByID.get(Number(button.dataset.location));153176 if (pin) revealPin(pin);154177 });155178 @@ -1,57 +1,57 @@
11 import Feature from "ol/Feature.js";22 import Point from "ol/geom/Point.js";33 4+import { groupByCollection, isCollectionHidden, passesZoneFilters } from "./collections.js";45 import { closeDetail } from "./detail.js";56 import { elements } from "./dom.js";67 import { pinInGridCell } from "./grid.js";78 import { renderSearchResults } from "./search.js";8-import { renderAs } from "./semconv.js";99 import { updateVisibleCount } from "./navigation.js";1010 import { state } from "./state.js";1111 import { prepareMarkerIcon } from "./styles.js";1212 import { stableRank } from "./util.js";13-import { project } from "./zones.js";13+import { project } from "./areas.js";1414 15-export function buildPins() {15+// buildFeatures stands the world's point features up: every point collection's16+// locations become pin records in the features registry, each already wearing17+// its OpenLayers feature. Shape features are areas.js's to render -- they18+// arrive inline with their collections and never pass through here.19+export function buildFeatures() {1620 state.sources.pins.clear();17- state.sources.text.clear();1821 state.sources.priority.clear();19- state.pins = [];20- state.pinByID.clear();21- for (const group of state.world.groups) {22- for (const category of group.categories) {23- if (renderAs(category) !== "text") prepareMarkerIcon(category);24- for (const location of category.locations) {25- const pin = {26- location,27- category,28- group,29- coordinate: project(location.lat, location.lng),30- filteredHidden: false,31- priority: pinPriority(category, location),32- feature: null,33- };34- pin.feature = new Feature({35- geometry: new Point(pin.coordinate),36- pin,37- priority: pin.priority,38- });39- state.pins.push(pin);40- state.pinByID.set(location.id, pin);41- if (renderAs(category) === "text") state.sources.text.addFeature(pin.feature);42- else state.sources.pins.addFeature(pin.feature);43- }22+ state.features = [];23+ state.featureByID.clear();24+ for (const category of state.world.collections) {25+ if (category.kind !== "point") continue;26+ prepareMarkerIcon(category);27+ for (const location of category.locations) {28+ const pin = {29+ location,30+ category,31+ coordinate: project(location.lat, location.lng),32+ filteredHidden: false,33+ priority: pinPriority(category, location),34+ feature: null,35+ };36+ pin.feature = new Feature({37+ geometry: new Point(pin.coordinate),38+ pin,39+ priority: pin.priority,40+ });41+ state.features.push(pin);42+ state.featureByID.set(location.id, pin);43+ state.sources.pins.addFeature(pin.feature);4444 }4545 }4646 applyPinFilters();4747 }4848 4949 export function applyPinFilters() {50- for (const pin of state.pins) {51- const categoryHidden = state.hiddenCategories.has(pin.category.id);50+ for (const pin of state.features) {51+ const collectionHidden = isCollectionHidden(pin.category.id);5252 const searchHidden = state.search &&5353 !pin.location.title.toLocaleLowerCase().includes(state.search);54- pin.filteredHidden = Boolean(categoryHidden || searchHidden);54+ pin.filteredHidden = Boolean(collectionHidden || searchHidden);5555 }5656 updateZonePinFocus();5757 refreshPinRendering();@@ -62,44 +62,36 @@ export function applyPinFilters() {
6262 document.dispatchEvent(new Event("atlas:filters"));6363 }6464 65+// Highlights conjoin across collections and union within one: a pin stands66+// only where every highlighted collection claims it. With the v2 wire's one67+// implicit collection that is the plain union, so today's maps read exactly68+// as they always have; the second collection arrives with the v3 wire.6569 export function updateZonePinFocus() {6670 if (!state.highlightedZones.size) {67- for (const pin of state.pins) pin.insideHighlightedZone = false;71+ for (const pin of state.features) pin.passesZoneFilters = false;6872 return;6973 }70- const records = [...state.highlightedZones]74+ const groups = groupByCollection([...state.highlightedZones]7175 .map((zoneID) => state.zoneRecords.get(zoneID))72- .filter(Boolean);73- for (const pin of state.pins) {74- pin.insideHighlightedZone = records.some((record) =>75- record.geometries.some((geometry) => geometryContainsCoordinate(geometry, pin.coordinate)));76+ .filter(Boolean));77+ for (const pin of state.features) {78+ pin.passesZoneFilters = passesZoneFilters(groups, pin.coordinate);7679 }7780 }7881 79-export function geometryContainsCoordinate(geometry, coordinate) {80- if (geometry.intersectsCoordinate(coordinate)) return true;81- const closest = geometry.getClosestPoint(coordinate);82- const x = closest[0] - coordinate[0];83- const y = closest[1] - coordinate[1];84- return x * x + y * y <= 1;85-}86-8782 export function refreshPinRendering() {88- state.eligibleLocations = state.pins.filter((pin) => !pinIsHidden(pin)).length;83+ state.eligibleLocations = state.features.filter((pin) => !pinIsHidden(pin)).length;8984 refreshPrioritySource();9085 state.layers.pins.changed();9186 state.layers.zonePins.changed();9287 state.layers.pinLabels.changed();93- state.layers.text.changed();94- state.layers.zoneText.changed();95- state.layers.textDetail.changed();9688 state.layers.priority.changed();9789 updateVisibleCount();9890 }9991 10092 export function refreshPrioritySource() {10193 state.sources.priority.clear();102- for (const pin of state.pins) {94+ for (const pin of state.features) {10395 if (pinIsHidden(pin)) continue;10496 const searched = Boolean(state.search) &&10597 pin.location.title.toLocaleLowerCase().includes(state.search);@@ -127,7 +119,10 @@ export function setLabelsHeld(held) {
127119 state.labelsHeld = held;128120 elements.labelsHint.textContent = held ? "Z · labels shown" : "Z · hold for labels";129121 state.layers.pinLabels.changed();130- state.layers.text.changed();122+ // Quiet zone names answer the same key, so the title layers must hear it123+ // the moment the pin labels do.124+ state.layers.zoneTitles.changed();125+ state.layers.zoneTitleDetail.changed();131126 // Anything else writing names beside its pins -- the globe -- holds and132127 // releases them the same moment the chart does.133128 document.dispatchEvent(new Event("atlas:labels"));@@ -152,7 +147,7 @@ export function onActiveShard(item) {
152147 }153148 154149 export function pinIsZoneCulled(pin) {155- if (!state.highlightedZones.size || pin.insideHighlightedZone) return false;150+ if (!state.highlightedZones.size || pin.passesZoneFilters) return false;156151 if (pin === state.selectedPin) return false;157152 return !(Boolean(state.search) &&158153 pin.location.title.toLocaleLowerCase().includes(state.search));@@ -173,12 +168,6 @@ export function pinPriority(category, location) {
173168 return rarity + (stableRank(location.id) % 1000);174169 }175170 176-export function textDetailRatio(category) {177- if (category.locations.length > 200) return 4;178- if (category.locations.length > 75) return 2.5;179- return 1;180-}181-182171 export function atMaximumNativeZoom() {183172 const zoom = state.engine?.getView().getZoom() || 0;184173 return zoom >= (state.lens?.maxZoom || 0) - 0.05;@@ -26,6 +26,7 @@ import { Line2 } from "three/examples/jsm/lines/Line2.js";
2626 import { LineGeometry } from "three/examples/jsm/lines/LineGeometry.js";2727 import { LineMaterial } from "three/examples/jsm/lines/LineMaterial.js";2828 29+import { isCollectionHidden } from "./collections.js";2930 import { gridTheme, overzoomLevels } from "./constants.js";3031 import { showPin } from "./detail.js";3132 import { elements } from "./dom.js";@@ -41,7 +42,7 @@ import { state } from "./state.js";
4142 import { markerIconKey, measureLabel } from "./styles.js";4243 import { categoryColor, iconOutsetColor, initials } from "./theme.js";4344 import { clamp } from "./util.js";44-import { project } from "./zones.js";45+import { project } from "./areas.js";4546 4647 // textureZoom picks the pyramid level the sphere wears everywhere: deep4748 // enough to read from orbit, shallow enough that one canvas holds the whole@@ -302,8 +303,8 @@ async function enterGlobe() {
302303 globe.globeImageUrl(texture);303304 }304305 }305- if (pinsBuilt !== state.pins) {306- pinsBuilt = state.pins;306+ if (pinsBuilt !== state.features) {307+ pinsBuilt = state.features;307308 sprites.clear();308309 placed.clear();309310 globe.objectsData(spherePins(mapping));@@ -884,7 +885,7 @@ function syncSelection() {
884885 // legend's and search's filters, and the chosen geohash cell, exactly as885886 // the chart holds them.886887 function pinShown(pin) {887- if (pin.filteredHidden || state.hiddenCategories.has(pin.category.id)) return false;888+ if (pin.filteredHidden || isCollectionHidden(pin.category.id)) return false;888889 if (state.gridEnabled && state.gridCell && !pinInGridCell(pin)) return false;889890 return true;890891 }@@ -997,7 +998,7 @@ function regridWhenFitChanges() {
997998 // backward through the declared mapping to true latitude and longitude.998999 function spherePins(mapping) {9991000 const points = [];1000- for (const pin of state.pins) {1001+ for (const pin of state.features) {10011002 const [x, negY] = project(pin.location.lat, pin.location.lng);10021003 const [lat, lng] = mapping.toLatLng(x, -negY);10031004 points.push({ lat, lng, pin });@@ -19,7 +19,7 @@ import { gridTheme, palette } from "./constants.js";
1919 import { closeDetail } from "./detail.js";2020 import { elements } from "./dom.js";2121 import { viewMaxZoom } from "./navigation.js";22-import { refreshPrioritySource } from "./pins.js";22+import { refreshPrioritySource } from "./features.js";2323 import { state } from "./state.js";2424 2525 export function handleGridKey(event) {@@ -62,7 +62,6 @@ export function toggleGrid(enabled = !state.gridEnabled) {
6262 renderGrid();6363 refreshPrioritySource();6464 state.layers.pins.changed();65- state.layers.text.changed();6665 state.layers.priority.changed();6766 }6867 @@ -103,7 +102,6 @@ export function selectGridCell(raw) {
103102 renderGrid();104103 refreshPrioritySource();105104 state.layers.pins.changed();106- state.layers.text.changed();107105 state.layers.priority.changed();108106 if (!changed) return;109107 closeDetail();@@ -186,7 +184,6 @@ export function setGridSystem(slug) {
186184 renderGrid();187185 refreshPrioritySource();188186 state.layers.pins.changed();189- state.layers.text.changed();190187 state.layers.priority.changed();191188 }192189 @@ -305,7 +302,7 @@ function planCell(system, id, role, contextDistance) {
305302 306303 export function addGridFeature(cell) {307304 const system = activeSystem();308- const count = state.pins.filter((pin) =>305+ const count = state.features.filter((pin) =>309306 !pin.filteredHidden && system.contains(cell.hash, pin.coordinate)).length;310307 const feature = new Feature({311308 geometry: gridGeometry(cell),@@ -1,55 +1,99 @@
11 import { elements } from "./dom.js";22 import { state } from "./state.js";33 import { saveSession } from "./session.js";4-import { applyPinFilters } from "./pins.js";4+import { applyPinFilters } from "./features.js";55 import { renderSearchResults } from "./search.js";6-import { renderAs } from "./semconv.js";6+import { curatedLabelPolicy, labelPolicy, renderAs } from "./semconv.js";7+import { recountZoneTitles, syncZoneLayers } from "./areas.js";78 import { applyCategoryVisual, applyCategoryGlyph, initials } from "./theme.js";89 import { formatNumber } from "./util.js";910 10-// Categories drawn as text are labels for the ground itself -- Area, Region,11-// Province -- and are read and edited as one set. Gathered here rather than12-// left in place, where "Area" sits between Altar and Bank and reads like13-// another kind of marker.14-export function legendSections(groups) {11+// The sidebar is one legend tree: shape collections, text labels, and pin12+// groups are all sections of the same list, each holding rows of the same13+// shape. Sections come from the wire's group strings, in order of first14+// appearance; an ungrouped shape collection files under the viewer's own15+// Zones section, which keeps the pre-collapse behaviour a place to land.16+export function legendSections(collections) {1517 const sections = [];16- const text = [];17- for (const group of groups) {18- const drawn = [];19- for (const category of group.categories) {20- (renderAs(category) === "text" ? text : drawn).push(category);21- }22- if (drawn.length) {23- sections.push({ key: `group-${group.id}`, title: group.title, categories: drawn });18+ const at = new Map();19+ const place = (key, title, collection) => {20+ if (!at.has(key)) {21+ at.set(key, sections.length);22+ sections.push({ key, title, collections: [] });2423 }24+ sections[at.get(key)].collections.push(collection);25+ };26+ const zones = [];27+ for (const collection of collections) {28+ if (collection.kind !== "point" && !collection.group) zones.push(collection);29+ else place(`group-${collection.group}`, collection.group, collection);2530 }26- // Above the pin groups, under the zones: labels and boundaries both say where27- // you are, rather than what is worth going to.28- if (text.length) sections.unshift({ key: "text", title: "Text", categories: text });31+ // Text is how a point collection draws, not what it is: a collection of32+ // cities rendered as floating names sits in its own group beside the33+ // markers, wearing the toggle that flips it either way.34+ if (zones.length) sections.unshift({ key: "zones", title: "Zones", collections: zones });2935 return sections;3036 }3137 38+// A collection either packs its members as pin locations or carries them39+// inline as shape features; either way the row's count is how many there are.40+export function collectionKind(collection) {41+ return collection.kind || "point";42+}43+44+export function collectionCount(collection) {45+ return (collection.features || collection.locations || []).length;46+}47+48+// Collection ids ride the DOM as strings, but point categories are known49+// everywhere by number. One reader turns the attribute back into the id the50+// state sets actually hold.51+export function collectionID(value) {52+ return /^\d+$/.test(value) ? Number(value) : value;53+}54+55+export function findCollection(collectionID) {56+ for (const section of state.world?.sections || []) {57+ for (const collection of section.collections) {58+ if (collection.id === collectionID) return collection;59+ }60+ }61+ return null;62+}63+3264 export function renderLegend() {3365 const fragment = document.createDocumentFragment();3466 for (const section of state.world.sections) {3567 const element = document.createElement("section");3668 element.className = "layer-section";3769 element.dataset.layerSection = section.key;38- const locations = section.categories.reduce((total, category) => total + category.locations.length, 0);39- element.append(layerHeader(section.key, section.title, locations));70+ const members = section.collections.reduce((total, collection) => total + collectionCount(collection), 0);71+ element.append(layerHeader(section.key, section.title, members));4072 const toggles = document.createElement("div");4173 toggles.className = "category-toggles";42- for (const category of section.categories) toggles.append(categoryToggle(category));74+ for (const collection of section.collections) {75+ toggles.append(collectionRow(collection));76+ // A shape row unfolds into its feature index. The container is laid77+ // down empty here and filled by renderZoneIndex once the zone records78+ // exist -- the legend renders before the zones do.79+ if (collectionKind(collection) !== "point") {80+ const index = document.createElement("div");81+ index.className = "feature-index";82+ index.dataset.featureIndex = String(collection.id);83+ toggles.append(index);84+ }85+ }4386 element.append(toggles);4487 fragment.append(element);4588 }4689 elements.legend.replaceChildren(fragment);4790 syncSectionCollapse();91+ syncCollectionExpansion();4892 syncSectionSwitches();4993 }5094 51-// Mirrors the markup of the static zones header so every layer section reads the52-// same: disclosure on the left, one switch on the right.95+// Mirrors the markup every layer section reads the same by: disclosure on the96+// left, one switch on the right.5397 export function layerHeader(key, title, count) {5498 const header = document.createElement("div");5599 header.className = "layer-header";@@ -69,7 +113,7 @@ export function layerHeader(key, title, count) {
69113 total.textContent = formatNumber(count);70114 disclosure.append(chevron, name, total);71115 72- const only = onlyButton(`Show only ${title}`);116+ const only = onlyButton(`Exclusively ${title}`);73117 only.dataset.onlySection = key;74118 75119 const toggle = document.createElement("label");@@ -102,42 +146,88 @@ export function onlyButton(label) {
102146 return button;103147 }104148 105-export function categoryToggle(category) {106- const isText = renderAs(category) === "text";149+// One row for every kind of collection: checkbox, an icon cell -- the150+// category's glyph for points, an unfolding chevron for shapes -- the name,151+// the isolate target, the label-policy toggle where names are drawn on the152+// ground, and the count. The columns are fixed so every row lines up whether153+// or not it uses them all.154+export function collectionRow(collection) {155+ const kind = collectionKind(collection);107156 const row = document.createElement("label");108157 row.className = "category-row";109- applyCategoryVisual(row, category);110158 const checkbox = document.createElement("input");111159 checkbox.type = "checkbox";112- checkbox.dataset.category = String(category.id);113- checkbox.checked = !state.hiddenCategories.has(category.id);114- const icon = document.createElement("span");115- if (isText) {116- icon.className = "text-symbol";117- icon.textContent = "Tt";118- icon.title = "Drawn as a text label";160+ checkbox.dataset.collection = String(collection.id);161+ checkbox.checked = !state.hiddenCollections.has(collection.id);162+ let icon;163+ if (kind !== "point") {164+ icon = document.createElement("button");165+ icon.type = "button";166+ icon.className = "collection-expand";167+ icon.dataset.expandCollection = String(collection.id);168+ icon.setAttribute("aria-label", `Unfold the ${collection.title} index`);169+ icon.innerHTML =170+ '<svg class="collection-chevron" viewBox="0 0 16 16" aria-hidden="true"><path d="m6 4 4 4-4 4"/></svg>' +171+ (kind === "path"172+ ? '<svg class="collection-kind" viewBox="0 0 16 16" aria-hidden="true"><path d="M2.5 12.5c3-6 8-2 11-9"/></svg>'173+ : '<svg class="collection-kind collection-kind-area" viewBox="0 0 16 16" aria-hidden="true"><path d="M8 4.2 12.6 11.6H3.4z"/></svg>');119174 } else {175+ icon = document.createElement("span");120176 icon.className = "category-icon";121- applyCategoryGlyph(icon, category, initials(category.title));122- icon.title = category.icon || category.title;177+ applyCategoryVisual(row, collection);178+ applyCategoryGlyph(icon, collection, initials(collection.title));179+ icon.title = collection.icon || collection.title;123180 }124181 const name = document.createElement("span");125182 name.className = "category-name";126- name.textContent = category.title;127- const locations = document.createElement("span");128- locations.className = "category-count";129- locations.textContent = formatNumber(category.locations.length);183+ name.textContent = collection.title;130184 // Overlaid on the count rather than appended: these pills wrap, and a row131185 // that grows on hover would shove the one under the cursor somewhere else.132- const only = onlyButton(`Show only ${category.title}`);133- only.dataset.onlyCategory = String(category.id);134- row.append(checkbox, icon, name, only, locations);186+ const only = onlyButton(`Exclusively ${collection.title}`);187+ only.dataset.onlyCollection = String(collection.id);188+ // Areas draw their names on the ground, and whether they speak unasked is189+ // the reader's to override. A point collection's override is which shape190+ // it takes at all -- markers, or the floating names text categories used191+ // to be set apart for. Paths keep the column as space, so the count stays192+ // a column no row disagrees about.193+ let labels;194+ if (kind === "area") {195+ labels = document.createElement("button");196+ labels.type = "button";197+ labels.className = "label-toggle";198+ labels.dataset.labelToggle = String(collection.id);199+ labels.innerHTML =200+ '<svg viewBox="0 0 16 16" aria-hidden="true"><path d="M3.5 3.5h9M8 3.5v9"/></svg>';201+ syncLabelToggle(labels, collection);202+ } else if (kind === "point" && renderAs(collection) === "text") {203+ // Only a collection whose curation granted it names has names to offer:204+ // the toggle appears where the capability does, and a plain pin row205+ // simply has no button to press.206+ labels = document.createElement("button");207+ labels.type = "button";208+ labels.className = "label-toggle";209+ labels.dataset.labelToggle = String(collection.id);210+ labels.innerHTML =211+ '<svg viewBox="0 0 16 16" aria-hidden="true">' +212+ '<path d="M8.6 2.5H2.5v6.1l5.4 5.4a1.2 1.2 0 0 0 1.7 0l4.4-4.4a1.2 1.2 0 0 0 0-1.7z"/>' +213+ '<path d="M5.6 5.6h.01"/></svg>';214+ syncLabelToggle(labels, collection);215+ } else {216+ labels = document.createElement("span");217+ labels.className = "label-toggle-spacer";218+ }219+ const count = document.createElement("span");220+ count.className = "category-count";221+ count.textContent = formatNumber(collectionCount(collection));222+ // The label toggle sits inside the isolate target, so Only keeps one223+ // column down the whole legend whether or not a row has labels to offer.224+ row.append(checkbox, icon, name, labels, only, count);135225 return row;136226 }137227 138-// There is one level of nesting here -- sections hold rows, not more sections --139-// so folding by a depth and folding entirely are the same move, and only the140-// one exists.228+// There is one level of nesting per move here -- sections hold rows, rows may229+// hold a feature index -- so folding by a depth and folding entirely are the230+// same move, and only the one exists.141231 export function setAllSectionsCollapsed(collapsed) {142232 state.collapsedSections.clear();143233 if (collapsed) {@@ -157,106 +247,223 @@ export function syncSectionCollapse() {
157247 saveSession();158248 }159249 160-export function setAllCategories(visible) {161- state.hiddenCategories.clear();250+export function toggleCollectionExpanded(collectionID) {251+ if (state.expandedCollections.has(collectionID)) state.expandedCollections.delete(collectionID);252+ else state.expandedCollections.add(collectionID);253+ syncCollectionExpansion();254+}255+256+export function syncCollectionExpansion() {257+ for (const button of elements.legend.querySelectorAll("[data-expand-collection]")) {258+ const expanded = state.expandedCollections.has(collectionID(button.dataset.expandCollection));259+ button.setAttribute("aria-expanded", String(expanded));260+ button.closest(".category-row").classList.toggle("is-expanded", expanded);261+ }262+ for (const index of elements.legend.querySelectorAll(".feature-index")) {263+ index.hidden = !state.expandedCollections.has(collectionID(index.dataset.featureIndex));264+ }265+ saveSession();266+}267+268+// The label toggle is a two-state affair around the effective policy: press269+// it and the collection's names flip to the other word; if the other word is270+// what the producer curated anyway, the override has nothing left to say and271+// is dropped rather than stored.272+export function toggleLabelPolicy(id) {273+ const collection = findCollection(id);274+ if (!collection) return;275+ const flipped = labelPolicy(null, collection) === "always" ? "quiet" : "always";276+ if (flipped === curatedLabelPolicy(collection)) state.labelOverrides.delete(collection.id);277+ else state.labelOverrides.set(collection.id, flipped);278+ syncLabelToggles();279+ if (collection.kind === "point") {280+ // A point collection's names ride the pin-label layer.281+ state.layers.pinLabels.changed();282+ } else {283+ // The crowd-thinning threshold counts spoken names only, and the toggle284+ // just changed which names speak; ground names are drawn by the title285+ // layers, at either zoom depth.286+ recountZoneTitles();287+ state.layers.zoneTitles.changed();288+ state.layers.zoneTitleDetail.changed();289+ }290+ saveSession();291+}292+293+// One toggle, one language: the button says what pressing it would do,294+// "Hide labels" while the names are speaking and "Show labels" while they295+// wait, whatever the kind of collection behind it. The chip is the whole296+// tooltip -- no native title, which would say the same thing a second time297+// a few pixels away -- and the row already names the collection, so the298+// spoken label carries the name for ears alone.299+function syncLabelToggle(button, collection) {300+ const speaking = labelPolicy(null, collection) === "always";301+ button.dataset.label = speaking ? "Hide labels" : "Show labels";302+ button.setAttribute("aria-label",303+ `${speaking ? "Hide" : "Show"} ${collection.title} labels`);304+ button.setAttribute("aria-pressed", String(speaking));305+}306+307+export function syncLabelToggles() {308+ for (const button of elements.legend.querySelectorAll("[data-label-toggle]")) {309+ const collection = findCollection(collectionID(button.dataset.labelToggle));310+ if (collection) syncLabelToggle(button, collection);311+ }312+}313+314+export function setAllCollections(visible) {315+ state.hiddenCollections.clear();162316 if (!visible) {163- for (const group of state.world.groups) {164- for (const category of group.categories) state.hiddenCategories.add(category.id);317+ for (const section of state.world.sections) {318+ for (const collection of section.collections) state.hiddenCollections.add(collection.id);165319 }166320 }167321 syncLegendCheckboxes();322+ syncZoneLayers();168323 applyPinFilters();169324 renderSearchResults();170325 syncSectionSwitches();171326 }172327 173328 export function syncLegendCheckboxes() {174- for (const checkbox of document.querySelectorAll("[data-category]")) {175- checkbox.checked = !state.hiddenCategories.has(Number(checkbox.dataset.category));329+ for (const checkbox of document.querySelectorAll("[data-collection]")) {330+ checkbox.checked = !state.hiddenCollections.has(collectionID(checkbox.dataset.collection));176331 }177332 }178333 179334 export function toggleSection(key) {180335 const section = state.world.sections.find((item) => item.key === key);181336 if (!section) return;182- const hasVisible = section.categories.some((category) => !state.hiddenCategories.has(category.id));183- for (const category of section.categories) {184- if (hasVisible) state.hiddenCategories.add(category.id);185- else state.hiddenCategories.delete(category.id);337+ const hasVisible = section.collections.some((collection) => !state.hiddenCollections.has(collection.id));338+ for (const collection of section.collections) {339+ if (hasVisible) state.hiddenCollections.add(collection.id);340+ else state.hiddenCollections.delete(collection.id);186341 }187342 syncLegendCheckboxes();343+ syncZoneLayers();188344 applyPinFilters();189345 syncSectionSwitches();190346 }191347 192348 // Isolating is the common request of a long legend: "just the Korok Seeds",193-// out of a hundred and sixty categories. Everything else is hidden rather than194-// remembered, so Show all is the single, obvious way back.349+// out of a hundred and sixty categories. It stays inside its own domain --350+// point collections isolate against point collections, ground against351+// ground -- so highlighting a region and then asking for only one resource352+// leaves the region standing with the resource inside it. Everything else353+// in the domain is hidden rather than remembered; Show all is the single,354+// obvious way back.355+function collectionDomain(collection) {356+ return collection.kind === "point" ? "features" : "zones";357+}358+359+// soloDomains names the ground a target's isolation may touch: the target360+// collection's own domain, or every domain a section holds.361+function soloDomains(target) {362+ const domains = new Set();363+ for (const section of state.world.sections) {364+ for (const collection of section.collections) {365+ if (target.section === section.key || target.collection === collection.id) {366+ domains.add(collectionDomain(collection));367+ }368+ }369+ }370+ return domains;371+}372+195373 export function showOnly(target) {196374 if (!state.world) return;197375 // Asking to isolate what is already isolated means the reader is done with198- // it, so the same control lets them back out.376+ // it, so the same control lets them back out -- of this domain alone.377+ const domains = soloDomains(target);199378 if (isOnly(target)) {200- setAllCategories(true);201- return;202- }203- state.hiddenCategories.clear();204- for (const section of state.world.sections) {205- const wanted = target.section === section.key;206- for (const category of section.categories) {207- if (!wanted && target.category !== category.id) {208- state.hiddenCategories.add(category.id);379+ for (const section of state.world.sections) {380+ for (const collection of section.collections) {381+ if (domains.has(collectionDomain(collection))) {382+ state.hiddenCollections.delete(collection.id);383+ }384+ }385+ }386+ } else {387+ for (const section of state.world.sections) {388+ const wanted = target.section === section.key;389+ for (const collection of section.collections) {390+ if (!domains.has(collectionDomain(collection))) continue;391+ if (wanted || target.collection === collection.id) {392+ state.hiddenCollections.delete(collection.id);393+ } else {394+ state.hiddenCollections.add(collection.id);395+ }209396 }210397 }211398 }212399 syncLegendCheckboxes();400+ syncZoneLayers();213401 applyPinFilters();214402 renderSearchResults();215403 syncSectionSwitches();216404 }217405 218-// True when what is on screen is already exactly what this target would isolate.406+// True when this target's own domain already shows exactly what isolating407+// it would show. Other domains are none of the target's business.219408 export function isOnly(target) {409+ const domains = soloDomains(target);220410 for (const section of state.world.sections) {221- for (const category of section.categories) {222- const wanted = target.section === section.key || target.category === category.id;223- if (wanted === state.hiddenCategories.has(category.id)) return false;411+ for (const collection of section.collections) {412+ if (!domains.has(collectionDomain(collection))) continue;413+ const wanted = target.section === section.key || target.collection === collection.id;414+ if (wanted === state.hiddenCollections.has(collection.id)) return false;224415 }225416 }226417 return true;227418 }228419 229420 // Derived rather than remembered, so the chip is right however the state was230-// reached -- including by switching categories off one at a time.421+// reached -- including by switching collections off one at a time. Each422+// domain speaks for itself, and the chip reads them together: a region423+// isolated among the zones and a resource among the features is424+// "only: Regions · Ore", and one click shows everything again.231425 export function updateSoloChip() {232426 const chip = elements.soloChip;233427 if (!state.world) {234428 chip.hidden = true;235429 return;236430 }237- let onlyVisible = null;238- let visibleCount = 0;239- let soleSection = null;240- let sectionsShowing = 0;241- for (const section of state.world.sections) {242- let shown = 0;243- for (const category of section.categories) {244- if (state.hiddenCategories.has(category.id)) continue;245- shown++;246- visibleCount++;247- onlyVisible = category;431+ const labels = [];432+ for (const domain of ["zones", "features"]) {433+ let onlyVisible = null;434+ let visibleCount = 0;435+ let hiddenCount = 0;436+ let soleSection = null;437+ let sectionsShowing = 0;438+ for (const section of state.world.sections) {439+ let shown = 0;440+ let held = 0;441+ for (const collection of section.collections) {442+ if (collectionDomain(collection) !== domain) continue;443+ held++;444+ if (state.hiddenCollections.has(collection.id)) {445+ hiddenCount++;446+ continue;447+ }448+ shown++;449+ visibleCount++;450+ onlyVisible = collection;451+ }452+ if (shown > 0) {453+ sectionsShowing++;454+ soleSection = shown === held ? section : null;455+ }248456 }249- if (shown > 0) {250- sectionsShowing++;251- soleSection = shown === section.categories.length ? section : null;457+ if (hiddenCount === 0) continue;458+ if (visibleCount === 1 && onlyVisible) labels.push(onlyVisible.title);459+ else if (visibleCount > 1 && sectionsShowing === 1 && soleSection) {460+ labels.push(soleSection.title);252461 }253462 }254- let label = "";255- if (visibleCount === 1 && onlyVisible) label = onlyVisible.title;256- else if (sectionsShowing === 1 && soleSection) label = soleSection.title;463+ const label = labels.join(" · ");257464 chip.hidden = !label;258- chip.textContent = label ? `only: ${label}` : "";259- chip.title = label ? `Showing only ${label} — click to show everything` : "";465+ chip.textContent = label ? `exclusively: ${label}` : "";466+ chip.title = label ? `Showing exclusively ${label} — click to show everything` : "";260467 }261468 262469 export function syncSectionSwitches() {@@ -264,7 +471,7 @@ export function syncSectionSwitches() {
264471 for (const section of state.world.sections) {265472 const input = elements.legend.querySelector(`input[data-section-toggle="${section.key}"]`);266473 if (input) {267- input.checked = section.categories.some((category) => !state.hiddenCategories.has(category.id));474+ input.checked = section.collections.some((collection) => !state.hiddenCollections.has(collection.id));268475 }269476 }270477 updateSoloChip();@@ -55,8 +55,10 @@ async function reconcile() {
5555 lens: state.world ? state.world.lenses.indexOf(state.lens) : 0,5656 center: view?.getCenter(),5757 zoom: view?.getZoom(),58- hidden: [...state.hiddenCategories],58+ hidden: [...state.hiddenCollections],5959 collapsed: [...state.collapsedSections],60+ expanded: [...state.expandedCollections],61+ labels: [...state.labelOverrides],6062 overviewDocked: state.overviewDocked,6163 dockFolded: state.dockFolded,6264 dockDismissed: state.dockDismissed,@@ -1,6 +1,8 @@
1+import { intersects } from "ol/extent.js";12 import XYZ from "ol/source/XYZ.js";23 import TileGrid from "ol/tilegrid/TileGrid.js";34 5+import { isCollectionHidden } from "./collections.js";46 import { state } from "./state.js";57 import { elements, populateSelect } from "./dom.js";68 import { overzoomLevels } from "./constants.js";@@ -12,15 +14,15 @@ import { renderOverview, setOverviewDocked } from "./overview.js";
1214 import { setDockFolded } from "./search.js";1315 import { renderGrid } from "./grid.js";1416 import { syncGlobe } from "./globe.js";15-import { renderZones } from "./zones.js";17+import { renderShapes } from "./areas.js";1618 import { renderLegend } from "./legend.js";1719 import {1820 applyPinFilters,19- buildPins,21+ buildFeatures,2022 pinIsHidden,2123 refreshPrioritySource,2224 setHoveredPin,23-} from "./pins.js";25+} from "./features.js";2426 import { closeDetail } from "./detail.js";2527 import { iconOutsetColor } from "./theme.js";2628 import { clamp, formatNumber } from "./util.js";@@ -76,20 +78,28 @@ export async function selectWorld(slug) {
7678 setHoveredPin(null);7779 state.gridCell = "";7880 state.gridSystem = "geohash";79- state.hiddenCategories.clear();81+ state.hiddenCollections.clear();82+ state.labelOverrides.clear();8083 // Zones are a navigation aid, not the primary filter surface: keep boundaries81- // drawn but fold the index away so pin groups stay above the fold.84+ // drawn but fold their section away so pin groups stay above the fold. The85+ // ungrouped shape collections that section holds start unfolded, so their86+ // feature indexes are there the moment the section is opened -- and in the87+ // DOM for anything that reaches for a zone row without unfolding first.8288 state.collapsedSections.clear();8389 state.collapsedSections.add("zones");84- for (const group of state.world.groups) {85- for (const category of group.categories) {86- if (!category.visible) state.hiddenCategories.add(category.id);90+ state.expandedCollections.clear();91+ for (const collection of state.world.collections) {92+ if (collection.kind !== "point" && !collection.group) {93+ state.expandedCollections.add(collection.id);8794 }95+ if (!collection.visible) state.hiddenCollections.add(collection.id);8896 }89- const restore = state.restore?.map === state.world.slug ? state.restore : null;97+ const restore = state.restore?.world === state.world.slug ? state.restore : null;9098 if (restore) {91- state.hiddenCategories = new Set(restore.hidden);99+ state.hiddenCollections = new Set(restore.hidden);92100 state.collapsedSections = new Set(restore.collapsed);101+ state.expandedCollections = new Set(restore.expanded || []);102+ state.labelOverrides = new Map(restore.labels || []);93103 }94104 // Where the corner of the screen is wanted is a preference about the volume95105 // rather than about one of its maps, so it carries across them.@@ -104,8 +114,8 @@ export async function selectWorld(slug) {
104114 elements.dock.hidden = false;105115 closeDetail();106116 renderLegend();107- renderZones();108- buildPins();117+ renderShapes();118+ buildFeatures();109119 selectLens(restore ? clamp(restore.lens, 0, state.world.lenses.length - 1) : 0, true);110120 // A map that declares itself a sphere offers the globe; every map opens111121 // on the chart either way.@@ -211,7 +221,6 @@ export function selectLens(index, resetView = false) {
211221 if (state.gridEnabled) {212222 refreshPrioritySource();213223 state.layers.pins.changed();214- state.layers.text.changed();215224 state.layers.priority.changed();216225 }217226 state.overviewKey = "";@@ -220,12 +229,12 @@ export function selectLens(index, resetView = false) {
220229 // picture of the ground the reader is already looking at -- spring for221230 // summer, one layer of a split map for another -- so the swap is made222231 // underneath them and everything else, the view included, stays as it is.223- const resume = resetView && state.restore?.map === state.world.slug ? state.restore : null;224- // Zones and pins are built before a lens is chosen, so on a split world the232+ const resume = resetView && state.restore?.world === state.world.slug ? state.restore : null;233+ // Shapes and pins are built before a lens is chosen, so on a split world the225234 // first render shows every layer at once. Comparing against what was actually226235 // rendered catches that as well as a later switch between layers.227236 if (state.renderedShard !== (lens.shard || 0)) {228- renderZones();237+ renderShapes();229238 applyPinFilters();230239 }231240 if (resume?.center && Number.isFinite(resume.zoom)) {@@ -336,20 +345,29 @@ export function changeZoom(delta) {
336345 });337346 }338347 348+// The footer counts features of every kind: pins by their coordinate, zones349+// by whether their ground reaches into the view. "Enabled" is what the350+// legend's ledger lets draw; "in view" is the part of it under the window.339351 export function updateVisibleCount() {340352 const zoom = state.engine?.getView().getZoom();341353 elements.viewport.dataset.zoom = Number.isFinite(zoom) ? zoom.toFixed(3) : "";342- if (!state.engine || !state.pins.length) {343- elements.visibleCount.textContent = "0 locations visible";354+ if (!state.engine || !state.world) {355+ elements.visibleCount.textContent = "0 features enabled";344356 return;345357 }346358 const extent = state.engine.getView().calculateExtent(state.engine.getSize());359+ let enabled = state.eligibleLocations;347360 let inView = 0;348- for (const pin of state.pins) {361+ for (const pin of state.features) {349362 if (pinIsHidden(pin)) continue;350363 const [x, y] = pin.coordinate;351364 if (x >= extent[0] && x <= extent[2] && y >= extent[1] && y <= extent[3]) inView++;352365 }366+ for (const record of state.zoneRecords.values()) {367+ if (isCollectionHidden(record.zone.collectionId)) continue;368+ enabled++;369+ if (intersects(record.extent, extent)) inView++;370+ }353371 elements.visibleCount.textContent =354- `${formatNumber(state.eligibleLocations)} enabled · ${formatNumber(inView)} in view`;372+ `${formatNumber(enabled)} features enabled · ${formatNumber(inView)} in view`;355373 }@@ -1,3 +1,4 @@
1+import { isCollectionHidden } from "./collections.js";12 import { elements } from "./dom.js";23 import { saveSession } from "./session.js";34 import { state } from "./state.js";@@ -8,43 +9,35 @@ import { formatNumber } from "./util.js";
89 // the canvas; the list is a shortlist, and it says when it is one.910 const dockListLimit = 100;1011 11-// The dock's results pane: every location that survives the current search12-// and category filters, alphabetically, capped. With a search underway the13-// list is exactly the matches; with none it is a browsable index of what the14-// legend has left visible.12+// The dock's results pane: every feature that survives the current search and13+// collection filters, alphabetically, capped -- named shape features listed14+// beside the locations, since ground is as findable as anything standing on15+// it. With a search underway the list is exactly the matches; with none it is16+// a browsable index of what the legend has left visible.1517 export function renderSearchResults() {1618 if (!elements.searchResults) return;17- const eligible = state.pins18- .filter((pin) => !pin.filteredHidden)19- .sort((a, b) => a.location.title.localeCompare(b.location.title));19+ const eligible = [20+ ...state.features21+ .filter((pin) => !pin.filteredHidden)22+ .map((pin) => ({ title: pin.location.title, pin })),23+ ...[...state.zoneRecords.values()]24+ .filter((record) => record.zone.title &&25+ !isCollectionHidden(record.zone.collectionId) &&26+ (!state.search || record.zone.title.toLocaleLowerCase().includes(state.search)))27+ .map((record) => ({ title: record.zone.title, record })),28+ ].sort((a, b) => a.title.localeCompare(b.title));2029 const shown = eligible.slice(0, dockListLimit);2130 const fragment = document.createDocumentFragment();2231 if (!shown.length) {2332 const empty = document.createElement("p");2433 empty.className = "search-empty";2534 empty.textContent = state.search26- ? "No visible locations match."27- : "Nothing is enabled. Show a category to list its locations.";35+ ? "No visible features match."36+ : "Nothing is enabled. Show a collection to list its features.";2837 fragment.append(empty);2938 }30- for (const pin of shown) {31- const button = document.createElement("button");32- button.type = "button";33- button.className = "search-result";34- if (state.selectedPin === pin) button.classList.add("is-selected");35- button.dataset.location = String(pin.location.id);36- applyCategoryVisual(button, pin.category);37- const dot = document.createElement("span");38- dot.className = "result-dot";39- applyCategoryGlyph(dot, pin.category, initials(pin.category.title));40- const copy = document.createElement("span");41- const title = document.createElement("strong");42- title.textContent = pin.location.title;43- const category = document.createElement("small");44- category.textContent = `${pin.category.title} · ${pin.group.title}`;45- copy.append(title, category);46- button.append(dot, copy);47- fragment.append(button);39+ for (const entry of shown) {40+ fragment.append(entry.pin ? pinResult(entry.pin) : zoneResult(entry.record));4841 }4942 if (eligible.length > shown.length) {5043 const note = document.createElement("p");@@ -58,6 +51,47 @@ export function renderSearchResults() {
5851 updateDockRail();5952 }6053 54+function pinResult(pin) {55+ const button = document.createElement("button");56+ button.type = "button";57+ button.className = "search-result";58+ if (state.selectedPin === pin) button.classList.add("is-selected");59+ button.dataset.location = String(pin.location.id);60+ applyCategoryVisual(button, pin.category);61+ const dot = document.createElement("span");62+ dot.className = "result-dot";63+ applyCategoryGlyph(dot, pin.category, initials(pin.category.title));64+ const copy = document.createElement("span");65+ const title = document.createElement("strong");66+ title.textContent = pin.location.title;67+ const category = document.createElement("small");68+ category.textContent = [pin.category.title, pin.category.group].filter(Boolean).join(" · ");69+ copy.append(title, category);70+ button.append(dot, copy);71+ return button;72+}73+74+// A shape feature's row wears a swatch of the zone's own colour where a pin75+// wears its category glyph, and jumps the way its legend row does.76+function zoneResult(record) {77+ const button = document.createElement("button");78+ button.type = "button";79+ button.className = "search-result";80+ if (state.selectedZone === record.zone) button.classList.add("is-selected");81+ button.dataset.zone = String(record.zone.id);82+ const dot = document.createElement("span");83+ dot.className = "result-dot";84+ dot.style.setProperty("background", record.color);85+ const copy = document.createElement("span");86+ const title = document.createElement("strong");87+ title.textContent = record.zone.title;88+ const collection = document.createElement("small");89+ collection.textContent = record.collection?.title || "Zone";90+ copy.append(title, collection);91+ button.append(dot, copy);92+ return button;93+}94+6195 // Folded, the dock is a rail with one word on it, and that word read the same6296 // whether or not a location was open: the map had a pin picked out and the6397 // only panel saying which one was the one just put away. The rail carries the@@ -78,11 +112,11 @@ export function updateDockRail() {
78112 79113 function updateDockReadout(count) {80114 elements.dockCount.textContent =81- `${formatNumber(count)} ${count === 1 ? "location" : "locations"}`;115+ `${formatNumber(count)} ${count === 1 ? "feature" : "features"}`;82116 if (state.search) {83117 elements.dockFlag.textContent = `“${state.search}”`;84118 elements.dockFlag.hidden = false;85- } else if (state.hiddenCategories.size > 0) {119+ } else if (state.hiddenCollections.size > 0) {86120 elements.dockFlag.textContent = "filtered";87121 elements.dockFlag.hidden = false;88122 } else {@@ -4,12 +4,72 @@
44 // used to carry the meaning; a key this build has never heard of is simply55 // ignored, because a bundle is never refused over vocabulary.66 7-// renderAs answers how a category draws: "pin" or "text". This is the one8-// display rule the viewer holds, spelled once.9-export function renderAs(category) {10- const declared = category.attrs?.["atlas.render.as"];11- if (declared) return declared;12- return category.displayType === "text" ? "text" : "pin";7+import { collectionFor } from "./collections.js";8+import { state } from "./state.js";9+10+// The registry's vocabularies, mirrored: what shape of thing a collection11+// holds, and whether names draw unasked.12+export const geometryKinds = Object.freeze({ point: "point", path: "path", area: "area" });13+export const labelPolicies = Object.freeze({ always: "always", quiet: "quiet" });14+15+// labelPolicy answers whether a collection's names draw on their own or wait16+// to be asked: "always" or "quiet". The reader's per-collection override17+// wins, then the collection's declared word, then the kind's own default --18+// areas speak unasked, which is what every map before the key already did;19+// paths wait; and a point collection speaks when its curation asked for20+// text, because floating names are labels a producer pinned on, not a21+// different kind of thing.22+export function labelPolicy(zone, collection) {23+ const declared = collection ?? collectionFor(zone);24+ const override = state.labelOverrides.get(declared?.id);25+ if (override) return override;26+ return curatedLabelPolicy(declared);27+}28+29+// curatedLabelPolicy is the producer's word alone -- what the toggle returns30+// to when the reader's override is dropped.31+export function curatedLabelPolicy(collection) {32+ const curated = collection?.attrs?.["atlas.label.policy"];33+ if (curated) return curated;34+ if ((collection?.kind ?? geometryKinds.point) === geometryKinds.point) {35+ return renderAs(collection) === "text" ? labelPolicies.always : labelPolicies.quiet;36+ }37+ return collection?.kind === geometryKinds.path ? labelPolicies.quiet : labelPolicies.always;38+}39+40+// labelSilenced says whether the reader themselves quieted a collection's41+// names. Z reveals what is merely optional, never what was silenced: the42+// choice was the reader's, and the key is not an override.43+export function labelSilenced(collection) {44+ return state.labelOverrides.get(collection?.id) === labelPolicies.quiet;45+}46+47+// renderAs is the curation's word on a point collection: "pin" or "text".48+// Since text became a label policy rather than a way of drawing, this is49+// read only as the curated default the policy ladder falls back to --50+// markers draw either way.51+export function renderAs(collection) {52+ return collection?.attrs?.["atlas.render.as"] || "pin";53+}54+55+// The labels the detail card gives a feature's own attributes. Anything in56+// the reserved rendering namespaces is machinery rather than material, and57+// the geographic pair already has rows of its own.58+const attributeLabels = { "atlas.hydro.huc12": "HUC-12" };59+const attributeHidden = new Set(["atlas.geo.lat", "atlas.geo.lon"]);60+const reservedPrefixes = ["atlas.render.", "atlas.label.", "atlas.stroke.", "atlas.geometry."];61+62+// featureAttributeRows turns a feature's attributes into the rows its card63+// shows: curated label where one exists, the raw key where none does, and64+// nothing at all for machinery.65+export function featureAttributeRows(attrs) {66+ const rows = [];67+ for (const [key, value] of Object.entries(attrs || {})) {68+ if (attributeHidden.has(key)) continue;69+ if (reservedPrefixes.some((prefix) => key.startsWith(prefix))) continue;70+ rows.push({ label: attributeLabels[key] || key, value });71+ }72+ return rows.sort((left, right) => left.label.localeCompare(right.label));1373 }1474 1575 // worldSurface answers what the map's raster pictures. A map that says@@ -17,8 +17,10 @@ export function saveSession() {
1717 lens: state.world.lenses.indexOf(state.lens),1818 center: view?.getCenter(),1919 zoom: view?.getZoom(),20- hidden: [...state.hiddenCategories],20+ hidden: [...state.hiddenCollections],2121 collapsed: [...state.collapsedSections],22+ expanded: [...state.expandedCollections],23+ labels: [...state.labelOverrides],2224 overviewDocked: state.overviewDocked,2325 dockFolded: state.dockFolded,2426 dockDismissed: state.dockDismissed,@@ -7,10 +7,21 @@ export const state = {
77 projection: null,88 layers: null,99 sources: null,10- hiddenCategories: new Set(),10+ // One hide-set across every kind of collection, keyed by the numeric ids11+ // the wire declares. Nothing downstream cares which kind an id names; it12+ // only asks isCollectionHidden.13+ hiddenCollections: new Set(),1114 collapsedSections: new Set(),12- pins: [],13- pinByID: new Map(),15+ // Which area and path rows have their feature index unfolded in the legend.16+ expandedCollections: new Set(),17+ // The point-feature registry: one pin record per packed location, built by18+ // buildFeatures. Shape features keep their own registry in zoneRecords19+ // below -- that name (and highlightedZones, focusedZoneID with it) stays as20+ // it is because the diagnostics snapshot and the parity baselines grew up21+ // around the zone spelling, and the records it holds really are the zone22+ // layers' to draw.23+ features: [],24+ featureByID: new Map(),1425 selectedPin: null,1526 selectedZone: null,1627 hoveredPin: null,@@ -27,10 +38,12 @@ export const state = {
2738 // of them is holding the view to a place.2839 subgridVisible: true,2940 gridCell: "",30- zonesVisible: true,3141 zoneRecords: new Map(),3242 highlightedZones: new Set(),3343 focusedZoneID: null,44+ // The reader's word over a collection's label policy, keyed by collection45+ // id. Written by the legend's label toggle, read by the policy ladder.46+ labelOverrides: new Map(),3447 search: "",3548 fitZoom: 0,3649 zoneTitleCount: 0,@@ -7,16 +7,16 @@ import {
77 Text,88 } from "ol/style.js";99 10+import { anyShapeCollectionVisible, collectionFor, collectionOf, isCollectionHidden } from "./collections.js";1011 import { gridTheme } from "./constants.js";1112 import { gridCellVisual } from "./grid.js";12-import { renderAs } from "./semconv.js";13+import { labelPolicy, labelSilenced } from "./semconv.js";1314 import { state } from "./state.js";1415 import {1516 atMaximumNativeZoom,1617 isPriorityPin,1718 pinIsHidden,18- textDetailRatio,19-} from "./pins.js";19+} from "./features.js";2020 import {2121 categoryColor,2222 hexToRGBA,@@ -31,63 +31,36 @@ export function featureOrder(left, right) {
3131 3232 export function pinFeatureStyle(feature) {3333 const pin = feature.get("pin");34- if (!pin || pinIsHidden(pin) || pin.insideHighlightedZone || isPriorityPin(pin)) return null;34+ if (!pin || pinIsHidden(pin) || pin.passesZoneFilters || isPriorityPin(pin)) return null;3535 return markerStyles(pin, false);3636 }3737 3838 export function zonePinFeatureStyle(feature) {3939 const pin = feature.get("pin");40- if (!pin || !state.highlightedZones.size || !pin.insideHighlightedZone ||40+ if (!pin || !state.highlightedZones.size || !pin.passesZoneFilters ||4141 pinIsHidden(pin) || isPriorityPin(pin)) {4242 return null;4343 }4444 return markerStyles(pin, false);4545 }4646 47-// Held, so the zoom has no say in it. What the reader asked for is every name48-// on the map at once, and a rule that waited for the deepest zoom answered it49-// with the names of the few places already on screen.47+// A pin's label draws when its collection's names are spoken -- curated48+// always, or the reader's toggle -- or while Z is held. The key reveals what49+// is merely optional, never what the reader silenced by hand, and the zoom50+// has no say either way: what was asked for is every name at once.5051 export function pinLabelFeatureStyle(feature) {5152 const pin = feature.get("pin");52- if (!pin || pinIsHidden(pin) || !state.labelsHeld) return null;53- return markerLabelStyle(pin);54-}55-56-export function textFeatureStyle(feature) {57- const pin = feature.get("pin");58- if (!pin || pinIsHidden(pin) || pin.insideHighlightedZone || isPriorityPin(pin)) return null;59- if (atMaximumNativeZoom()) return null;60- // A text pin is its own label, so the key that shows every name shows these61- // too -- otherwise the crowded categories, the ones held back the longest,62- // would be the ones it never reached.63- if (state.labelsHeld) return textStyles(pin, false);64- const minimumZoom = state.fitZoom + Math.log2(textDetailRatio(pin.category));65- if ((state.engine.getView().getZoom() || 0) < minimumZoom) return null;66- return textStyles(pin, false);67-}68-69-export function textDetailFeatureStyle(feature) {70- const pin = feature.get("pin");71- if (!pin || pinIsHidden(pin) || pin.insideHighlightedZone ||72- isPriorityPin(pin) || !atMaximumNativeZoom()) {73- return null;74- }75- return textStyles(pin, false);76-}77-78-export function zoneTextFeatureStyle(feature) {79- const pin = feature.get("pin");80- if (!pin || !state.highlightedZones.size || !pin.insideHighlightedZone ||81- pinIsHidden(pin) || isPriorityPin(pin)) {53+ if (!pin || pinIsHidden(pin)) return null;54+ if (labelPolicy(null, pin.category) !== "always" &&55+ !(state.labelsHeld && !labelSilenced(pin.category))) {8256 return null;8357 }84- return textStyles(pin, false);58+ return markerLabelStyle(pin);8559 }8660 8761 export function priorityFeatureStyle(feature) {8862 const pin = feature.get("pin");8963 if (!pin || pinIsHidden(pin)) return null;90- if (renderAs(pin.category) === "text") return textStyles(pin, pin === state.selectedPin);9164 const marker = markerStyles(pin, pin === state.selectedPin);9265 if (pin === state.hoveredPin || pin === state.selectedPin) {9366 return [marker, markerLabelStyle(pin)];@@ -214,27 +187,6 @@ export function markerIconKey(category) {
214187 return `${category.iconAsset || ""}:${categoryColor(category)}:${state.world?.iconOutset || "light"}`;215188 }216189 217-export function textStyles(pin, selected) {218- const key = `text:${pin.location.id}:${selected ? 1 : 0}`;219- if (state.styleCache.has(key)) return state.styleCache.get(key);220- const style = new Style({221- text: new Text({222- text: pin.location.title,223- font: `${selected ? "900" : "800"} 14px "Arial Narrow", "Roboto Condensed", sans-serif`,224- fill: new Fill({ color: selected ? "#7fd0ea" : "#f2ece0" }),225- stroke: new Stroke({ color: "rgba(0,0,0,0.95)", width: 4 }),226- backgroundFill: new Fill({ color: selected ? "rgba(13,16,23,0.9)" : "rgba(10,12,17,0.58)" }),227- backgroundStroke: selected ? new Stroke({ color: "#3aa5c9", width: 1 }) : undefined,228- padding: [3, 6, 3, 6],229- overflow: true,230- }),231- zIndex: selected ? 20_000_000 : pin.priority + 3_000_000,232- });233- const styles = [style];234- state.styleCache.set(key, styles);235- return styles;236-}237-238190 // gridLabelFont spells one chunk of a cell label. Monospace, as the field239191 // these are typed into already is: every hash at a level is the same length,240192 // so in a fixed pitch a level keeps or drops its labels as one.@@ -353,19 +305,24 @@ export function measureLabel(text, font) {
353305 354306 export const zoneScrimFill = new Style({ fill: new Fill({ color: "rgba(5, 8, 16, 0.62)" }) });355307 308+// The scrim exists only while something is highlighted, and hiding a309+// collection withdraws its highlights, so an all-hidden map has no scrim310+// feature left to draw; the check covers the moment in between.356311 export function zoneScrimStyle() {357- return state.zonesVisible ? zoneScrimFill : null;312+ return anyShapeCollectionVisible() ? zoneScrimFill : null;358313 }359314 360315 export function zoneStyle(feature, resolution) {361- if (!state.zonesVisible) return null;362316 const zone = feature.get("zone");317+ if (isCollectionHidden(collectionOf(zone))) return null;363318 const child = feature.get("child");364319 const highlighted = state.highlightedZones.has(zone.id);365320 const dimmed = zoneContextDimmed(zone.id);366- // A path zone carries its ground width: the stroke is the zone, drawn at367- // the width the world gives it rather than a width the screen does.368- const groundWidth = Number(zone.attrs?.["atlas.stroke.width_px"]) || 0;321+ // A path is a line and a weight, and the weight is its collection's to322+ // declare -- drawn at the width the world gives it rather than a width the323+ // screen does. A feature spelling a width of its own is still honoured.324+ const groundWidth = Number(zone.attrs?.["atlas.stroke.width_px"]) ||325+ Number(collectionFor(zone)?.attrs?.["atlas.stroke.width_px"]) || 0;369326 if (groundWidth > 0 && feature.getGeometry()?.getType() === "MultiLineString") {370327 return pathZoneStyle(zone, feature.get("color"), groundWidth / resolution, highlighted, dimmed);371328 }@@ -467,9 +424,15 @@ function pathZoneStyle(zone, color, width, highlighted, dimmed) {
467424 }468425 469426 export function zoneTitleStyle(feature) {470- if (!state.zonesVisible || atMaximumNativeZoom()) return null;427+ if (atMaximumNativeZoom()) return null;428+ const zone = feature.get("zone");429+ if (isCollectionHidden(collectionOf(zone))) return null;430+ if (quietChipHidden(zone)) return null;431+ const highlighted = state.highlightedZones.has(zone.id);432+ // A quiet name, once asked for, skips the crowd-thinning below: like433+ // holding Z for pin labels, asking means every one of them.434+ if (labelPolicy(zone) === "quiet") return renderedZoneTitleStyle(feature);471435 const child = feature.get("child");472- const highlighted = state.highlightedZones.has(feature.get("zone").id);473436 const zoom = state.engine.getView().getZoom() || 0;474437 if (!highlighted && child && zoom < state.fitZoom + 3) return null;475438 const spanPixels = feature.get("span") / state.engine.getView().getResolution();@@ -478,10 +441,26 @@ export function zoneTitleStyle(feature) {
478441 }479442 480443 export function zoneTitleDetailStyle(feature) {481- if (!state.zonesVisible || !atMaximumNativeZoom()) return null;444+ if (!atMaximumNativeZoom()) return null;445+ const zone = feature.get("zone");446+ if (isCollectionHidden(collectionOf(zone))) return null;447+ if (quietChipHidden(zone)) return null;482448 return renderedZoneTitleStyle(feature);483449 }484450 451+// A quiet zone's name is context, not headline: the chip waits until the452+// reader asks after that zone in particular -- highlighting it, selecting it453+// -- or asks after every name at once by holding Z. Z reveals what is merely454+// optional, never what was silenced: a collection the reader quieted by hand455+// stays quiet under the key, because the choice was theirs and the key is456+// not an override.457+function quietChipHidden(zone) {458+ if (labelPolicy(zone) !== "quiet") return false;459+ if (state.highlightedZones.has(zone.id) || state.selectedZone === zone) return false;460+ const silenced = state.labelOverrides.get(collectionOf(zone)) === "quiet";461+ return silenced || !state.labelsHeld;462+}463+485464 export function renderedZoneTitleStyle(feature) {486465 const child = feature.get("child");487466 const zone = feature.get("zone");@@ -533,11 +512,11 @@ export function zoneContextDimmed(zoneID) {
533512 534513 export function zoneIsAncestorOf(candidateID, zoneID) {535514 const visited = new Set();536- let parentID = state.zoneRecords.get(zoneID)?.zone.parentRegionId;515+ let parentID = state.zoneRecords.get(zoneID)?.zone.parent;537516 while (parentID != null && !visited.has(parentID)) {538517 if (parentID === candidateID) return true;539518 visited.add(parentID);540- parentID = state.zoneRecords.get(parentID)?.zone.parentRegionId;519+ parentID = state.zoneRecords.get(parentID)?.zone.parent;541520 }542521 return false;543522 }@@ -0,0 +1,88 @@
1+// The highlight filter, run against real OpenLayers polygons but no map: the2+// rule is AND across collections and OR within one, with every zone3+// answering to the collection id the wire stamped it with.4+import assert from "node:assert/strict";5+import test from "node:test";6+7+import Polygon from "ol/geom/Polygon.js";8+9+import {10+ collectionOf,11+ geometryContainsCoordinate,12+ groupByCollection,13+ passesZoneFilters,14+} from "../src/collections.js";15+16+function square(x, y, size) {17+ return new Polygon([[18+ [x, y], [x + size, y], [x + size, y + size], [x, y + size], [x, y],19+ ]]);20+}21+22+function record(id, geometry, collectionId = 41) {23+ return { zone: { id, collectionId }, geometries: [geometry] };24+}25+26+test("a zone answers with the collection id the wire stamped", () => {27+ assert.equal(collectionOf({ id: 1, collectionId: 41 }), 41);28+ assert.equal(collectionOf({ id: 2 }), undefined, "an unstamped zone claims nothing");29+});30+31+test("groupByCollection buckets records by their real collections", () => {32+ const groups = groupByCollection([33+ record(1, square(0, 0, 10), 41),34+ record(2, square(100, 100, 10), 41),35+ record(3, square(0, 0, 40), 42),36+ ]);37+ assert.equal(groups.size, 2);38+ assert.equal(groups.get(41).length, 2);39+ assert.equal(groups.get(42).length, 1);40+});41+42+test("one collection, two zones: inside either is enough", () => {43+ const groups = groupByCollection([44+ record(1, square(0, 0, 10)),45+ record(2, square(100, 100, 10)),46+ ]);47+ assert.equal(groups.size, 1, "one collection, one bucket");48+ assert.equal(passesZoneFilters(groups, [5, 5]), true);49+ assert.equal(passesZoneFilters(groups, [105, 105]), true);50+ assert.equal(passesZoneFilters(groups, [50, 50]), false);51+});52+53+test("two collections: only the overlap survives", () => {54+ // Overlapping squares in different collections, so only their shared55+ // corner answers both.56+ const groups = groupByCollection([57+ record(1, square(0, 0, 10), 41),58+ record(2, square(5, 5, 10), 42),59+ ]);60+ assert.equal(passesZoneFilters(groups, [7, 7]), true, "inside both");61+ assert.equal(passesZoneFilters(groups, [2, 2]), false, "district only");62+ assert.equal(passesZoneFilters(groups, [12, 12]), false, "watershed only");63+ assert.equal(passesZoneFilters(groups, [50, 50]), false, "inside neither");64+});65+66+test("two collections, alternatives within one", () => {67+ const groups = groupByCollection([68+ record(1, square(0, 0, 10), 41),69+ record(2, square(20, 0, 10), 41),70+ record(3, square(0, 0, 40), 42),71+ ]);72+ assert.equal(passesZoneFilters(groups, [5, 5]), true, "first district");73+ assert.equal(passesZoneFilters(groups, [25, 5]), true, "second district");74+ assert.equal(passesZoneFilters(groups, [15, 5]), false,75+ "in the watershed but in neither district");76+});77+78+test("no highlights culls nothing", () => {79+ assert.equal(passesZoneFilters(groupByCollection([]), [5, 5]), true);80+});81+82+test("containment keeps its pixel of grace at the border", () => {83+ const geometry = square(0, 0, 10);84+ assert.equal(geometryContainsCoordinate(geometry, [5, 5]), true);85+ assert.equal(geometryContainsCoordinate(geometry, [10.9, 5]), true,86+ "within a pixel of the edge still counts");87+ assert.equal(geometryContainsCoordinate(geometry, [12, 5]), false);88+});@@ -0,0 +1,70 @@
1+// The label-policy ladder, pure and DOM-free: the reader's override2+// outranks the collection's declared word, which outranks the kind's own3+// default -- areas speak unasked, paths wait -- and a zone answers through4+// the collection the wire stamped it with.5+import assert from "node:assert/strict";6+import test from "node:test";7+8+import { featureAttributeRows, labelPolicy, labelSilenced, renderAs } from "../src/semconv.js";9+import { state } from "../src/state.js";10+11+test("labelPolicy climbs override, collection, kind default", () => {12+ state.labelOverrides.clear();13+ const districts = { id: 41, kind: "area", attrs: {} };14+ const hydro = { id: 42, kind: "area", attrs: { "atlas.label.policy": "quiet" } };15+ const creeks = { id: 43, kind: "path", attrs: { "atlas.stroke.width_px": "10" } };16+17+ assert.equal(labelPolicy(null, districts), "always", "silence means always for areas");18+ assert.equal(labelPolicy(null, hydro), "quiet", "the collection's curated word");19+ assert.equal(labelPolicy(null, creeks), "quiet", "paths wait by default");20+21+ state.labelOverrides.set(42, "always");22+ assert.equal(labelPolicy(null, hydro), "always", "the reader outranks the producer");23+ state.labelOverrides.clear();24+});25+26+test("a point collection's labels wait unless its curation asked for text", () => {27+ state.labelOverrides.clear();28+ const garages = { id: 51, kind: "point", attrs: { "atlas.render.as": "pin" } };29+ const cities = { id: 52, kind: "point", attrs: { "atlas.render.as": "text" } };30+31+ assert.equal(labelPolicy(null, garages), "quiet", "markers wait for Z");32+ assert.equal(labelPolicy(null, cities), "always", "curated text means names speak");33+34+ state.labelOverrides.set(52, "quiet");35+ assert.equal(labelPolicy(null, cities), "quiet", "the reader can quiet the names");36+ assert.ok(labelSilenced(cities), "and that silence is theirs, so Z respects it");37+ assert.ok(!labelSilenced(garages), "curated quiet is merely optional, so Z reveals it");38+ state.labelOverrides.clear();39+});40+41+test("a zone answers through the collection the wire stamped it with", () => {42+ state.labelOverrides.clear();43+ const hydro = { id: 42, kind: "area", attrs: { "atlas.label.policy": "quiet" } };44+ state.world = { collectionsById: new Map([[42, hydro]]) };45+ const zone = { id: 7, collectionId: 42 };46+ assert.equal(labelPolicy(zone), "quiet", "the collection speaks for its zone");47+ state.labelOverrides.set(42, "always");48+ assert.equal(labelPolicy(zone), "always", "the override lands by collection id");49+ state.labelOverrides.clear();50+ state.world = null;51+});52+53+test("renderAs reads the declared attribute alone", () => {54+ assert.equal(renderAs({ attrs: { "atlas.render.as": "text" } }), "text");55+ assert.equal(renderAs({ attrs: {} }), "pin", "silence means markers");56+ assert.equal(renderAs({}), "pin", "no attrs at all still means markers");57+});58+59+test("featureAttributeRows curates, labels, and skips machinery", () => {60+ const rows = featureAttributeRows({61+ "atlas.hydro.huc12": "170703010101",62+ "atlas.geo.lat": "44.05",63+ "atlas.geo.lon": "-121.3",64+ "atlas.stroke.width_px": "12",65+ "atlas.label.policy": "quiet",66+ });67+ assert.deepEqual(rows, [{ label: "HUC-12", value: "170703010101" }],68+ "only material survives: geo has rows of its own, rendering is machinery");69+ assert.deepEqual(featureAttributeRows(undefined), [], "no attrs, no rows");70+});@@ -80,9 +80,13 @@ type Dataset struct {
8080 8181 // Zones. StrokeWidth is the ground width a line dataset's zones are8282 // drawn and clicked at, in world pixels of the 8192 square: the path83- // stays the line it is, and the viewer strokes it.83+ // stays the line it is, and the viewer strokes it. Label is the label84+ // policy the dataset's collection declares: "quiet" keeps the zones'85+ // names off the map until something highlights them, and empty means86+ // the format's default -- always, for areas.8487 ZoneOf func(Fields) ZoneKey8588 StrokeWidth float6489+ Label string8690 8791 // Basemap. Emphasis scales a stroke per feature -- an arterial wider8892 // than a lane -- and absent means every feature draws alike.@@ -582,8 +586,9 @@ func Translate(doc []byte) ([]byte, error) {
582586 Title: title(capture.Title, city.Title),583587 Slug: capture.City,584588 },585- Groups: groups,586- Regions: regions,589+ Groups: groups,590+ Regions: regions,591+ Collections: declaredCollections(byOrder),587592 }588593 return json.Marshal(out)589594 }@@ -750,6 +755,40 @@ func buildGroups(capture *Capture, pairs []pairing, ids *mgdoc.IDSpace) ([]mgdoc
750755 return groups, nil751756 }752757 758+// declaredCollections spells the zone-making datasets as the collections759+// their zones belong to, in curated order: the table already knows each760+// dataset's kind, stroke and label policy, and the declaration says it in761+// the registered vocabulary so the generator never has to sniff geometry to762+// learn what a region is.763+func declaredCollections(pairs []pairing) []mgdoc.CollectionDecl {764+ var out []mgdoc.CollectionDecl765+ for _, pair := range pairs {766+ curated := pair.curated767+ if curated.ZoneOf == nil {768+ continue769+ }770+ kind := semconv.GeometryArea771+ if curated.Geometry == "line" {772+ kind = semconv.GeometryPath773+ }774+ attrs := map[string]string{semconv.KeyGeometryKind: kind}775+ if curated.Geometry == "line" {776+ attrs[semconv.KeyStrokeWidthPx] = strconv.FormatFloat(curated.StrokeWidth, 'f', -1, 64)777+ }778+ // Label policy is an area's word alone: a path is quiet by the779+ // registry's own default, so a line dataset's curation says nothing.780+ if curated.Label != "" && kind == semconv.GeometryArea {781+ attrs[semconv.KeyLabelPolicy] = curated.Label782+ }783+ out = append(out, mgdoc.CollectionDecl{784+ Key: curated.Slug,785+ Title: curated.Title,786+ Attrs: attrs,787+ })788+ }789+ return out790+}791+753792 // zoneLimit is the most zones one dataset may make. The viewer's zone index754793 // renders every zone a button and a title; an uncurated explosion -- every755794 // parcel a zone -- is refused while the mistake is one table edit old.@@ -797,13 +836,11 @@ func buildRegions(capture *Capture, pairs []pairing, ids *mgdoc.IDSpace, hydro *
797836 ID: zoneID,798837 Title: scrub(key.Title),799838 Subtitle: scrub(title(key.Subtitle, curated.Title)),800- }801- // A zone made of lines declares its ground width, so a802- // reader can draw the path as the one stroke it is.803- if curated.Geometry == "line" && curated.StrokeWidth > 0 {804- zone.Attrs = map[string]string{805- semconv.KeyStrokeWidthPx: strconv.FormatFloat(curated.StrokeWidth, 'f', -1, 64),806- }839+ // The zone says which declared collection it belongs840+ // to, which is the whole reason declarations exist:841+ // the collection speaks for its kind and its stroke,842+ // so the zone carries neither.843+ Collection: curated.Slug,807844 }808845 buckets[key.Key] = zone809846 order = append(order, key.Key)@@ -207,7 +207,7 @@ func TestTranslateShapesTheDocument(t *testing.T) {
207207 if historic.Title != "Historic Resources" || len(historic.Locations) != 2 {208208 t.Fatalf("category is %q with %d pins", historic.Title, len(historic.Locations))209209 }210- if err := semconv.Validate(semconv.EntityCategory, historic.Attrs); err != nil {210+ if err := semconv.Validate(semconv.EntityCollection, historic.Attrs); err != nil {211211 t.Fatalf("category attrs: %v", err)212212 }213213 pin := historic.Locations[0]@@ -217,7 +217,7 @@ func TestTranslateShapesTheDocument(t *testing.T) {
217217 if pin.Description != "Residential · 42 NW Hawthorne Ave · Constructed: 1910" {218218 t.Fatalf("pin card reads %q", pin.Description)219219 }220- if err := semconv.Validate(semconv.EntityLocation, pin.Attrs); err != nil {220+ if err := semconv.Validate(semconv.EntityFeature, pin.Attrs); err != nil {221221 t.Fatalf("pin attrs: %v", err)222222 }223223 if pin.Attrs[semconv.KeyGeoLat] != "44.0581" || pin.Attrs[semconv.KeyGeoLon] != "-121.3081" {@@ -243,6 +243,64 @@ func TestTranslateShapesTheDocument(t *testing.T) {
243243 }244244 }245245 246+ // The document declares its zone-making datasets as collections, in the247+ // same curated order, each saying its kind -- and its stroke, when its248+ // features are lines -- in the registered vocabulary. The hydro areas249+ // declare quiet labels: the nation's water is the city's context, not250+ // its headline. The stream lines say nothing, because a path is quiet251+ // by the registry's own default and label policy is an area's word.252+ wantDecls := []struct{ key, title, kind, label string }{253+ {"mpo-boundary", "MPO Boundary", "area", ""},254+ {"zoning", "Zoning", "area", ""},255+ {"annexations", "Annexations", "area", ""},256+ {"wetlands", "Wetlands", "area", ""},257+ {"trails", "Paths & Trails", "path", ""},258+ {"watersheds", "Watersheds", "area", "quiet"},259+ {"subwatersheds", "Subwatersheds", "area", "quiet"},260+ {"streams", "Streams", "path", ""},261+ {"waterbodies", "Waterbodies", "area", "quiet"},262+ }263+ if len(out.Collections) != len(wantDecls) {264+ t.Fatalf("document declares %d collections, want %d: %+v",265+ len(out.Collections), len(wantDecls), out.Collections)266+ }267+ for at, want := range wantDecls {268+ decl := out.Collections[at]269+ if decl.Key != want.key || decl.Title != want.title {270+ t.Fatalf("collection %d is %q titled %q, want %q titled %q",271+ at, decl.Key, decl.Title, want.key, want.title)272+ }273+ if err := semconv.Validate(semconv.EntityCollection, decl.Attrs); err != nil {274+ t.Fatalf("collection %q attrs: %v", decl.Key, err)275+ }276+ if got := decl.Attrs[semconv.KeyGeometryKind]; got != want.kind {277+ t.Fatalf("collection %q declares kind %q, want %q", decl.Key, got, want.kind)278+ }279+ if got := decl.Attrs[semconv.KeyLabelPolicy]; got != want.label {280+ t.Fatalf("collection %q declares label policy %q, want %q", decl.Key, got, want.label)281+ }282+ _, stroked := decl.Attrs[semconv.KeyStrokeWidthPx]283+ if stroked != (want.kind == "path") {284+ t.Fatalf("collection %q: only path collections declare a stroke, got %v", decl.Key, decl.Attrs)285+ }286+ }287+ if out.Collections[4].Attrs[semconv.KeyStrokeWidthPx] != "12" ||288+ out.Collections[7].Attrs[semconv.KeyStrokeWidthPx] != "10" {289+ t.Fatalf("path collections declare strokes %q and %q",290+ out.Collections[4].Attrs[semconv.KeyStrokeWidthPx],291+ out.Collections[7].Attrs[semconv.KeyStrokeWidthPx])292+ }293+294+ // Every region claims the collection its dataset declared.295+ wantHomes := []string{"mpo-boundary", "zoning", "zoning", "annexations",296+ "wetlands", "trails", "watersheds", "subwatersheds", "subwatersheds",297+ "streams", "waterbodies"}298+ for at, home := range wantHomes {299+ if got := out.Regions[at].Collection; got != home {300+ t.Fatalf("zone %q claims collection %q, want %q", out.Regions[at].Title, got, home)301+ }302+ }303+246304 // The national zones say which grain of the nation they are.247305 if got := out.Regions[6].Subtitle; got != "Watershed · HUC 1707030101" {248306 t.Fatalf("watershed subtitle is %q", got)@@ -263,7 +321,7 @@ func TestTranslateShapesTheDocument(t *testing.T) {
263321 if pf.Description != "Lies in the Tumalo Creek subwatershed (HUC 170703010101)." {264322 t.Fatalf("PF card reads %q", pf.Description)265323 }266- if err := semconv.Validate(semconv.EntityZone, pf.Attrs); err != nil {324+ if err := semconv.Validate(semconv.EntityFeature, pf.Attrs); err != nil {267325 t.Fatalf("PF attrs: %v", err)268326 }269327 if pf.Attrs[semconv.KeyHydroHUC12] != "170703010101" {@@ -278,10 +336,10 @@ func TestTranslateShapesTheDocument(t *testing.T) {
278336 t.Fatalf("zone %q claims membership: %q %v", zone.Title, zone.Description, zone.Attrs)279337 }280338 }281- // A line zone in one subwatershed claims it alongside its stroke.339+ // A line zone in one subwatershed claims it; its stroke is its340+ // collection's to declare, never its own.282341 riley := out.Regions[5]283- if riley.Attrs[semconv.KeyHydroHUC12] != "170703010102" ||284- riley.Attrs[semconv.KeyStrokeWidthPx] != "12" {342+ if riley.Attrs[semconv.KeyHydroHUC12] != "170703010102" {285343 t.Fatalf("trail attrs are %v", riley.Attrs)286344 }287345 if out.Regions[1].Subtitle != "Zoning" {@@ -294,12 +352,14 @@ func TestTranslateShapesTheDocument(t *testing.T) {
294352 if trail.Subtitle != "Riley Ranch Nature Reserve" || len(trail.Features) != 1 {295353 t.Fatalf("trail zone is %+v", trail)296354 }297- // A line zone stays the line it is, and declares the width it is drawn at.298- if err := semconv.Validate(semconv.EntityZone, trail.Attrs); err != nil {355+ // A line zone stays the line it is. Its width lives on the collection356+ // declaration alone, so the zone's own attributes validate as the357+ // feature they attach to, with nothing borrowed.358+ if err := semconv.Validate(semconv.EntityFeature, trail.Attrs); err != nil {299359 t.Fatalf("trail attrs: %v", err)300360 }301- if trail.Attrs[semconv.KeyStrokeWidthPx] != "12" {302- t.Fatalf("trail declares width %q", trail.Attrs[semconv.KeyStrokeWidthPx])361+ if _, stroked := trail.Attrs[semconv.KeyStrokeWidthPx]; stroked {362+ t.Fatalf("the trail zone spells a stroke of its own: %v", trail.Attrs)303363 }304364 if trail.Features[0].Geometry.Type != "MultiLineString" {305365 t.Fatalf("trail geometry is %q", trail.Features[0].Geometry.Type)@@ -527,6 +587,14 @@ func TestCuratedTableIsSound(t *testing.T) {
527587 if dataset.Geometry == "line" && dataset.ZoneOf != nil && dataset.StrokeWidth <= 0 {528588 t.Fatalf("dataset %q zones lines without a ribbon", dataset.Slug)529589 }590+ // A label policy, when curated, must be a word the registry591+ // admits, because it rides the declaration verbatim.592+ if dataset.Label != "" {593+ if err := semconv.Validate(semconv.EntityCollection,594+ map[string]string{semconv.KeyLabelPolicy: dataset.Label}); err != nil {595+ t.Fatalf("dataset %q label: %v", dataset.Slug, err)596+ }597+ }530598 }531599 }532600 }@@ -30,7 +30,10 @@ const (
3030 // its ground drains through, in two grains of the USGS hydrologic unit3131 // hierarchy, and the named streams and waterbodies that do the draining.3232 // A padded city window intersects a handful of hydrologic units and tens33-// of named streams -- national extent, city-sized answers.33+// of named streams -- national extent, city-sized answers. Every national34+// layer labels quiet: the hydrology is the city's context, not its35+// headline, and a map flooded with creek names is a map about the wrong36+// thing.3437 var National = []Dataset{3538 {3639 Slug: "watersheds", Title: "Watersheds",@@ -39,6 +42,7 @@ var National = []Dataset{
3942 Keep: []string{"objectid", "huc10", "name"},4043 IDOf: hucID("huc10"),4144 ZoneOf: hucZone("huc10", "Watershed"),45+ Label: "quiet",4246 },4347 {4448 Slug: SlugSubwatersheds, Title: "Subwatersheds",@@ -47,6 +51,7 @@ var National = []Dataset{
4751 Keep: []string{"objectid", "huc12", "name"},4852 IDOf: hucID("huc12"),4953 ZoneOf: hucZone("huc12", "Subwatershed"),54+ Label: "quiet",5055 },5156 {5257 Slug: "streams", Title: "Streams",@@ -64,6 +69,7 @@ var National = []Dataset{
6469 return ZoneKey{Key: slugify(name), Title: name, Subtitle: "Stream"}6570 },6671 StrokeWidth: 10,72+ Label: "quiet",6773 Role: "water",6874 },6975 {@@ -80,7 +86,8 @@ var National = []Dataset{
8086 }8187 return ZoneKey{Key: slugify(name), Title: name, Subtitle: "Waterbody"}8288 },83- Role: "water",89+ Label: "quiet",90+ Role: "water",8491 },8592 }8693 @@ -26,8 +26,11 @@ const (
2626 // FormatVersion is bumped when the layout changes shape. A reader refuses2727 // versions it does not know rather than guessing at them. Version 22828 // renamed the format's concepts -- game to volume, map to world, variant29- // to lens -- through the manifest and payload keys alike.30- FormatVersion = 229+ // to lens -- through the manifest and payload keys alike. Version 330+ // unified what a world holds: the payload's groups, zones, and pins31+ // became one collections array of point, path, and area features, and32+ // the manifest counts each kind instead of counting only pins.33+ FormatVersion = 33134 3235 // ManifestName is the entry the whole bundle is read through. The writer3336 // places it first in the archive so a listing shows it first, though the@@ -96,14 +99,19 @@ type Coordinate struct {
9699 // WorldEntry lists one world: enough to offer it and to open it, and nothing97100 // that only matters once it is open. The slug names the world's payload98101 // entries -- worlds/<slug>.json, .bin, and .text -- and is the world's99-// identity everywhere.102+// identity everywhere. Points, Paths, and Areas count the world's features103+// by kind -- every feature is exactly one of the three -- so a listing can104+// say how much a world holds without opening its payload, and validation105+// can hold the payload to the promise.100106 type WorldEntry struct {101107 Slug string `json:"slug"`102108 Title string `json:"title"`103109 Parent string `json:"parent,omitempty"`104110 IconOutset string `json:"iconOutset,omitempty"`105111 Center Coordinate `json:"center"`106- PinCount int `json:"pinCount"`112+ Points int `json:"points"`113+ Paths int `json:"paths"`114+ Areas int `json:"areas"`107115 UpdatedAt string `json:"updatedAt"`108116 }109117 @@ -83,8 +83,8 @@ func TestOpenRoundTripsWhatBuildWrites(t *testing.T) {
8383 if opened.Manifest.Volume.Slug != "fixture" {8484 t.Errorf("game slug = %q", opened.Manifest.Volume.Slug)8585 }86- if got := opened.Manifest.Worlds[0].PinCount; got != 2 {87- t.Errorf("pin count = %d, want 2", got)86+ if got := opened.Manifest.Worlds[0].Points; got != 2 {87+ t.Errorf("point count = %d, want 2", got)8888 }8989 if err := opened.Validate(); err != nil {9090 t.Errorf("a fixture bundle fails validation: %v", err)@@ -158,7 +158,7 @@ func TestValidateCatchesBrokenPromises(t *testing.T) {
158158 }159159 }160160 must(writer.AddDeflated("worlds/overworld.json",161- []byte(`{"lenses":[{"tiles":"overworld","minZoom":0,"maxZoom":0,"formats":["jpg"]}],"groups":[]}`)))161+ []byte(`{"lenses":[{"tiles":"overworld","minZoom":0,"maxZoom":0,"formats":["jpg"]}],"collections":[]}`)))162162 must(writer.AddStored("worlds/overworld.bin", bytes.NewReader(bundle.PackLocations(nil))))163163 must(writer.AddDeflated("worlds/overworld.text", []byte(`{}`)))164164 must(writer.AddStored("tiles/overworld/0/0/0.jpg", bytes.NewReader([]byte("raster"))))@@ -175,55 +175,140 @@ func TestValidateCatchesBrokenPromises(t *testing.T) {
175175 }176176 }177177 178-func TestValidateRefusesRuntimeURLsAndWrongCounts(t *testing.T) {179- build := func(text string, pins int) *bundle.Bundle {180- t.Helper()181- manifest := validManifest()182- manifest.Worlds[0].PinCount = pins183- path := filepath.Join(t.TempDir(), "fixture.atlas")184- file, err := os.Create(path)185- if err != nil {186- t.Fatal(err)187- }188- writer, err := bundle.NewWriter(file, manifest)189- if err != nil {190- t.Fatal(err)191- }192- steps := []error{193- writer.AddDeflated("worlds/overworld.json",194- []byte(`{"lenses":[{"tiles":"overworld","minZoom":0,"maxZoom":0,"formats":["jpg"]}],"groups":[]}`)),195- writer.AddStored("worlds/overworld.bin",196- bytes.NewReader(bundle.PackLocations([]bundle.Location{{ID: 1, Title: "Origin"}}))),197- writer.AddDeflated("worlds/overworld.text", []byte(text)),198- writer.AddStored("tiles/overworld/0/0/0.jpg", bytes.NewReader([]byte("raster"))),199- writer.Close(),200- file.Close(),201- }202- for _, err := range steps {203- if err != nil {204- t.Fatal(err)205- }206- }207- opened, err := bundle.Open(path)178+// buildForValidation writes a one-world bundle whose payload JSON, text, and179+// per-kind manifest counts a case chooses, so each promise Validate makes can180+// be broken one at a time.181+func buildForValidation(t *testing.T, detail, text string, points, paths, areas int) *bundle.Bundle {182+ t.Helper()183+ manifest := validManifest()184+ manifest.Worlds[0].Points = points185+ manifest.Worlds[0].Paths = paths186+ manifest.Worlds[0].Areas = areas187+ path := filepath.Join(t.TempDir(), "fixture.atlas")188+ file, err := os.Create(path)189+ if err != nil {190+ t.Fatal(err)191+ }192+ writer, err := bundle.NewWriter(file, manifest)193+ if err != nil {194+ t.Fatal(err)195+ }196+ // At most one location is packed however many the manifest promises, so197+ // a case can promise more than the payload holds.198+ locations := make([]bundle.Location, min(points, 1))199+ for index := range locations {200+ locations[index] = bundle.Location{ID: int64(index + 1), Title: "Origin"}201+ }202+ steps := []error{203+ writer.AddDeflated("worlds/overworld.json", []byte(detail)),204+ writer.AddStored("worlds/overworld.bin", bytes.NewReader(bundle.PackLocations(locations))),205+ writer.AddDeflated("worlds/overworld.text", []byte(text)),206+ writer.AddStored("tiles/overworld/0/0/0.jpg", bytes.NewReader([]byte("raster"))),207+ writer.Close(),208+ file.Close(),209+ }210+ for _, err := range steps {208211 if err != nil {209212 t.Fatal(err)210213 }211- t.Cleanup(func() { opened.Close() })212- return opened213214 }215+ opened, err := bundle.Open(path)216+ if err != nil {217+ t.Fatal(err)218+ }219+ t.Cleanup(func() { opened.Close() })220+ return opened221+}222+223+const validationLenses = `"lenses":[{"tiles":"overworld","minZoom":0,"maxZoom":0,"formats":["jpg"]}]`214224 215- if err := build(`{"1":{"d":"see https://mapgenie.io/x"}}`, 1).Validate(); err == nil ||216- !strings.Contains(err.Error(), "runtime URL") {225+func TestValidateRefusesRuntimeURLsAndWrongCounts(t *testing.T) {226+ pointOnly := `{` + validationLenses + `,"collections":[{"id":1,"title":"Marker","kind":"point","visible":true}]}`227+228+ if err := buildForValidation(t, pointOnly, `{"1":{"d":"see https://mapgenie.io/x"}}`, 1, 0, 0).229+ Validate(); err == nil || !strings.Contains(err.Error(), "runtime URL") {217230 t.Errorf("a payload carrying a live URL validates with %v", err)218231 }219- if err := build(`{}`, 7).Validate(); err == nil || !strings.Contains(err.Error(), "7") {220- t.Errorf("a wrong pin count validates with %v", err)232+ if err := buildForValidation(t, pointOnly, `{}`, 7, 0, 0).233+ Validate(); err == nil || !strings.Contains(err.Error(), "7") {234+ t.Errorf("a wrong point count validates with %v", err)221235 }222- if err := build(`{}`, 1).Validate(); err != nil {236+ if err := buildForValidation(t, pointOnly, `{}`, 1, 0, 0).Validate(); err != nil {223237 t.Errorf("a sound bundle is refused: %v", err)224238 }225239 }226240 241+// The v3 wire's structural promises: every collection is the kind it says,242+// paths carry their stroke, labels are curated only where labels draw, points243+// never inline, and the manifest's per-kind counts hold.244+func TestValidateHoldsCollectionsToTheirKinds(t *testing.T) {245+ area := func(attrs string) string {246+ return `{` + validationLenses + `,"collections":[{"id":9,"title":"Districts","kind":"area",` +247+ `"visible":true` + attrs + `,"features":[{"id":5,"title":"R-5",` +248+ `"geometry":[{"type":"MultiPolygon","coordinates":[[[[0,0],[1,0],[1,1],[0,0]]]]}]}]}]}`249+ }250+ line := `{"type":"MultiLineString","coordinates":[[[0,0],[1,1]]]}`251+ cases := []struct {252+ name string253+ detail string254+ paths, areas int255+ wantSomewhere string256+ }{257+ {258+ name: "geometry disagreeing with the declared kind",259+ detail: `{` + validationLenses + `,"collections":[{"id":9,"title":"Districts","kind":"area","visible":true,"features":[{"id":5,"title":"R-5","geometry":[` + line + `]}]}]}`,260+ areas: 1,261+ wantSomewhere: "inlines a MultiLineString",262+ },263+ {264+ name: "a path collection with no stroke width",265+ detail: `{` + validationLenses + `,"collections":[{"id":9,"title":"Creeks","kind":"path","visible":true,"features":[{"id":5,"title":"Big Dry Creek","geometry":[` + line + `]}]}]}`,266+ paths: 1,267+ wantSomewhere: "declares no atlas.stroke.width_px",268+ },269+ {270+ name: "a manifest counting more areas than the payload holds",271+ detail: area(""),272+ areas: 2,273+ wantSomewhere: "manifest says",274+ },275+ {276+ name: "a label policy on a path collection",277+ detail: `{` + validationLenses + `,"collections":[{"id":9,"title":"Creeks","kind":"path","visible":true,` +278+ `"attrs":{"atlas.stroke.width_px":"10","atlas.label.policy":"quiet"},` +279+ `"features":[{"id":5,"title":"Big Dry Creek","geometry":[` + line + `]}]}]}`,280+ paths: 1,281+ wantSomewhere: "label policy",282+ },283+ {284+ name: "a point collection carrying inline features",285+ detail: `{` + validationLenses + `,"collections":[{"id":1,"title":"Marker","kind":"point","visible":true,` +286+ `"features":[{"id":5,"title":"Stray","geometry":[]}]}]}`,287+ wantSomewhere: "inline features",288+ },289+ {290+ name: "a sound area collection",291+ detail: area(`,"attrs":{"atlas.label.policy":"quiet"}`),292+ areas: 1,293+ wantSomewhere: "",294+ },295+ }296+ for _, c := range cases {297+ t.Run(c.name, func(t *testing.T) {298+ err := buildForValidation(t, c.detail, `{}`, 0, c.paths, c.areas).Validate()299+ if c.wantSomewhere == "" {300+ if err != nil {301+ t.Fatalf("a sound bundle is refused: %v", err)302+ }303+ return304+ }305+ if err == nil || !strings.Contains(err.Error(), c.wantSomewhere) {306+ t.Fatalf("validated with %v, want a complaint about %q", err, c.wantSomewhere)307+ }308+ })309+ }310+}311+227312 // The file name is derived from nothing but the manifest, so the same build228313 // carries the same name wherever and whenever it is written.229314 func TestVersionedFileNameIsDeterministic(t *testing.T) {@@ -27,7 +27,7 @@ type Spec struct {
2727 }2828 2929 // WorldSpec describes one world of a fixture volume: a single layer two zoom30-// levels deep, one category, and the given pins. Merged, when set, rides30+// levels deep, one point collection, and the given pins. Merged, when set, rides3131 // into the payload's merged block verbatim, so a test can hand a world the3232 // provenance ledger a real composition would have written.3333 type WorldSpec struct {@@ -78,7 +78,7 @@ func Build(t testing.TB, dir string, spec Spec) string {
7878 manifest.Worlds = append(manifest.Worlds, bundle.WorldEntry{7979 Slug: m.Slug,8080 Title: m.Title,81- PinCount: len(m.Pins),81+ Points: len(m.Pins),8282 UpdatedAt: spec.CreatedAt,8383 })8484 }@@ -105,13 +105,9 @@ func Build(t testing.TB, dir string, spec Spec) string {
105105 "sourceZoom": 1,106106 "formats": []string{"jpg", "jpg"},107107 }},108- "groups": []map[string]any{{109- "id": 1,110- "title": "Markers",111- "categories": []map[string]any{{112- "id": 1, "title": "Marker", "iconAsset": "marker.svg",113- "displayType": "", "visible": true,114- }},108+ "collections": []map[string]any{{109+ "id": 1, "title": "Marker", "group": "Markers", "kind": "point",110+ "iconAsset": "marker.svg", "visible": true,115111 }},116112 }117113 if m.Merged != nil {@@ -10,19 +10,24 @@ const (
1010 locationMagic = "ATLASLOC"1111 // 2 added the shard column. A map split into layers offers one at a time,1212 // and without it every layer's locations were drawn over every other.13- locationVersion = 213+ // 3 moved the meaning without moving a byte: owner now indexes the world14+ // payload's collections array rather than a flattened category order, and15+ // the region column reads as Member -- the id of the area feature that16+ // contains the point, zero for none.17+ locationVersion = 31418 )1519 16-// Location is one pin as the packed payload carries it. Owner is the position17-// of the pin's category in the map's flattened category order, which is the18-// only category identity the viewer needs once the payload JSON has listed19-// the categories in that same order.20+// Location is one point feature as the packed payload carries it. Owner is21+// the position of the feature's collection in the world payload's22+// collections array, which is the only collection identity the viewer needs23+// once the payload JSON has listed the collections in that same order.24+// Member is the id of the area feature containing this point, zero for none.2025 type Location struct {2126 ID int642227 Title string2328 Lat float642429 Lng float6425- Region int6430+ Member int642631 Shard int642732 Owner uint162833 }@@ -64,7 +69,7 @@ func PackLocations(locations []Location) []byte {
6469 put32(math.Float32bits(float32(location.Lng)))6570 }6671 for _, location := range locations {67- put32(uint32(int32(location.Region)))72+ put32(uint32(int32(location.Member)))6873 }6974 for _, location := range locations {7075 put32(uint32(int32(location.Shard)))@@ -114,7 +119,7 @@ func UnpackLocations(data []byte) ([]Location, error) {
114119 }115120 next(count * 4)116121 for index := range out {117- out[index].Region = int64(int32(u32(index)))122+ out[index].Member = int64(int32(u32(index)))118123 }119124 next(count * 4)120125 for index := range out {@@ -123,8 +123,9 @@ func (b *Bundle) Close() error {
123123 }124124 125125 // payloadPeek is the sliver of a world payload that validation reads: which126-// pyramids its layers draw from, which icons its categories name, and what127-// the payload says of itself in the shared conventions.126+// pyramids its layers draw from, which icons its collections name, what kind127+// of features each collection declares and inlines, and what the payload128+// says of itself in the shared conventions.128129 type payloadPeek struct {129130 Lenses []struct {130131 Tiles string `json:"tiles"`@@ -132,16 +133,19 @@ type payloadPeek struct {
132133 MaxZoom int `json:"maxZoom"`133134 Formats []string `json:"formats"`134135 } `json:"lenses"`135- Groups []struct {136- Categories []struct {137- IconAsset string `json:"iconAsset"`138- DisplayType string `json:"displayType"`139- Attrs map[string]string `json:"attrs"`140- } `json:"categories"`141- } `json:"groups"`142- Zones []struct {143- Attrs map[string]string `json:"attrs"`144- } `json:"zones"`136+ Collections []struct {137+ ID int64 `json:"id"`138+ Title string `json:"title"`139+ Kind string `json:"kind"`140+ IconAsset string `json:"iconAsset"`141+ Attrs map[string]string `json:"attrs"`142+ Features []struct {143+ Geometry []struct {144+ Type string `json:"type"`145+ } `json:"geometry"`146+ Attrs map[string]string `json:"attrs"`147+ } `json:"features"`148+ } `json:"collections"`145149 Attrs map[string]string `json:"attrs"`146150 }147151 @@ -151,11 +155,13 @@ type textPeek struct {
151155 Attrs map[string]string `json:"a"`152156 }153157 154-// Validate checks the manifest's promises against the archive: // world has its three payloads, the packed locations agree with the advertised155-// pin count, every lens's tile levels hold tiles, every named icon exists,156-// and nothing carries a live URL -- Atlas runs with no network, so a URL in a157-// bundle is dead weight at best. Producers and importers run this; opening a158-// bundle at launch does not.158+// Validate checks the manifest's promises against the archive: every world159+// has its three payloads, the packed locations and inline shape features160+// agree with the advertised per-kind counts, every collection's features are161+// the kind it declares, every lens's tile levels hold tiles, every named162+// icon exists, and nothing carries a live URL -- Atlas runs with no network,163+// so a URL in a bundle is dead weight at best. Producers and importers run164+// this; opening a bundle at launch does not.159165 func (b *Bundle) Validate() error {160166 levels := make(map[string]int)161167 for name := range b.entries {@@ -190,9 +196,9 @@ func (b *Bundle) Validate() error {
190196 if err != nil {191197 return fmt.Errorf("world %s: %w", entry.Slug, err)192198 }193- if len(locations) != entry.PinCount {194- return fmt.Errorf("world %s packs %d locations, and the manifest says %d",195- entry.Slug, len(locations), entry.PinCount)199+ if len(locations) != entry.Points {200+ return fmt.Errorf("world %s packs %d locations, and the manifest says %d points",201+ entry.Slug, len(locations), entry.Points)196202 }197203 198204 var peek payloadPeek@@ -221,12 +227,8 @@ func (b *Bundle) Validate() error {
221227 }222228 }223229 }224- for _, group := range peek.Groups {225- for _, category := range group.Categories {226- if category.IconAsset != "" && !b.Has("icons/"+category.IconAsset) {227- return fmt.Errorf("world %s names a missing icon %s", entry.Slug, category.IconAsset)228- }229- }230+ if err := b.validateCollections(entry, peek, locations); err != nil {231+ return err230232 }231233 if b.Manifest.Conventions >= 1 {232234 if err := validateConventions(entry.Slug, peek, text); err != nil {@@ -237,12 +239,91 @@ func (b *Bundle) Validate() error {
237239 return nil238240 }239241 242+// validateCollections holds a world's collections array to the shape the243+// format declares, whatever vocabulary the bundle speaks: every collection a244+// known kind with a distinct id, point features packed rather than inlined,245+// inline geometry agreeing with its collection's kind, every path collection246+// carrying the stroke width a path is drawn at, label policy only where247+// labels draw on ground, the per-kind counts matching the manifest, and every248+// packed location owned by a point collection that exists.249+func (b *Bundle) validateCollections(entry WorldEntry, peek payloadPeek, locations []Location) error {250+ ids := make(map[int64]string, len(peek.Collections))251+ var paths, areas int252+ for _, collection := range peek.Collections {253+ if holder, taken := ids[collection.ID]; taken {254+ return fmt.Errorf("world %s collections %q and %q share id %d",255+ entry.Slug, holder, collection.Title, collection.ID)256+ }257+ ids[collection.ID] = collection.Title258+ if collection.IconAsset != "" && !b.Has("icons/"+collection.IconAsset) {259+ return fmt.Errorf("world %s names a missing icon %s", entry.Slug, collection.IconAsset)260+ }261+ switch collection.Kind {262+ case semconv.GeometryPoint:263+ if len(collection.Features) > 0 {264+ return fmt.Errorf("world %s point collection %q carries %d inline features; points ride the packed payload",265+ entry.Slug, collection.Title, len(collection.Features))266+ }267+ case semconv.GeometryPath, semconv.GeometryArea:268+ for _, feature := range collection.Features {269+ for _, geometry := range feature.Geometry {270+ if !geometryFitsKind(collection.Kind, geometry.Type) {271+ return fmt.Errorf("world %s %s collection %q inlines a %s",272+ entry.Slug, collection.Kind, collection.Title, geometry.Type)273+ }274+ }275+ }276+ if collection.Kind == semconv.GeometryPath {277+ paths += len(collection.Features)278+ if collection.Attrs[semconv.KeyStrokeWidthPx] == "" {279+ return fmt.Errorf("world %s path collection %q declares no %s",280+ entry.Slug, collection.Title, semconv.KeyStrokeWidthPx)281+ }282+ } else {283+ areas += len(collection.Features)284+ }285+ default:286+ return fmt.Errorf("world %s collection %q declares kind %q, which is none of point, path, area",287+ entry.Slug, collection.Title, collection.Kind)288+ }289+ if _, spoken := collection.Attrs[semconv.KeyLabelPolicy]; spoken && collection.Kind != semconv.GeometryArea {290+ return fmt.Errorf("world %s %s collection %q declares a label policy; only areas curate their labels",291+ entry.Slug, collection.Kind, collection.Title)292+ }293+ }294+ if paths != entry.Paths || areas != entry.Areas {295+ return fmt.Errorf("world %s inlines %d paths and %d areas, and the manifest says %d and %d",296+ entry.Slug, paths, areas, entry.Paths, entry.Areas)297+ }298+ for _, location := range locations {299+ if int(location.Owner) >= len(peek.Collections) ||300+ peek.Collections[location.Owner].Kind != semconv.GeometryPoint {301+ return fmt.Errorf("world %s location %d names collection index %d, which is no point collection",302+ entry.Slug, location.ID, location.Owner)303+ }304+ }305+ return nil306+}307+308+// geometryFitsKind says which GeoJSON geometry types a collection kind may309+// inline: ground for areas, lines for paths.310+func geometryFitsKind(kind, geometryType string) bool {311+ switch kind {312+ case semconv.GeometryArea:313+ return geometryType == "MultiPolygon" || geometryType == "Polygon"314+ case semconv.GeometryPath:315+ return geometryType == "MultiLineString" || geometryType == "LineString"316+ }317+ return false318+}319+240320 // validateConventions holds a declaring bundle to the vocabulary it claims:241-// every attribute registered and well-formed, the render attribute agreeing242-// with the legacy field it will one day retire, a declared standard icon243-// actually resolved, and a declared sphere carrying a mapping that parses.244-// A bundle that declares no conventions is not held to any -- the strictness245-// belongs to the claim.321+// every attribute registered, well-formed, and attached where the registry322+// says it lives -- collections speak for their kind, stroke, and labels;323+// features speak only for themselves -- a declared standard icon actually324+// resolved, a declared kind agreeing with the wire's own field, and a325+// declared sphere carrying a mapping that parses. A bundle that declares no326+// conventions is not held to any -- the strictness belongs to the claim.246327 func validateConventions(slug string, peek payloadPeek, text []byte) error {247328 if err := semconv.Validate(semconv.EntityWorld, peek.Attrs); err != nil {248329 return fmt.Errorf("world %s: %w", slug, err)@@ -257,25 +338,21 @@ func validateConventions(slug string, peek payloadPeek, text []byte) error {
257338 return fmt.Errorf("world %s: %w", slug, err)258339 }259340 }260- for _, zone := range peek.Zones {261- if err := semconv.Validate(semconv.EntityZone, zone.Attrs); err != nil {262- return fmt.Errorf("world %s: %w", slug, err)341+ for _, collection := range peek.Collections {342+ if err := semconv.Validate(semconv.EntityCollection, collection.Attrs); err != nil {343+ return fmt.Errorf("world %s collection %q: %w", slug, collection.Title, err)263344 }264- }265- for _, group := range peek.Groups {266- for _, category := range group.Categories {267- if err := semconv.Validate(semconv.EntityCategory, category.Attrs); err != nil {345+ if declared, spoken := collection.Attrs[semconv.KeyGeometryKind]; spoken && declared != collection.Kind {346+ return fmt.Errorf("world %s collection %q says kind %s while its attributes say %s",347+ slug, collection.Title, collection.Kind, declared)348+ }349+ if collection.Attrs[semconv.KeyIconStd] != "" && collection.IconAsset == "" {350+ return fmt.Errorf("world %s declares a standard icon that was never resolved", slug)351+ }352+ for _, feature := range collection.Features {353+ if err := semconv.Validate(semconv.EntityFeature, feature.Attrs); err != nil {268354 return fmt.Errorf("world %s: %w", slug, err)269355 }270- if declared, ok := category.Attrs[semconv.KeyRenderAs]; ok {271- if legacy := semconv.RenderAs(nil, category.DisplayType); declared != legacy {272- return fmt.Errorf("world %s renders a category as %s while its legacy field says %s",273- slug, declared, legacy)274- }275- }276- if category.Attrs[semconv.KeyIconStd] != "" && category.IconAsset == "" {277- return fmt.Errorf("world %s declares a standard icon that was never resolved", slug)278- }279356 }280357 }281358 var entries map[string]textPeek@@ -283,7 +360,7 @@ func validateConventions(slug string, peek payloadPeek, text []byte) error {
283360 return fmt.Errorf("world %s: decode text: %w", slug, err)284361 }285362 for id, entry := range entries {286- if err := semconv.Validate(semconv.EntityLocation, entry.Attrs); err != nil {363+ if err := semconv.Validate(semconv.EntityFeature, entry.Attrs); err != nil {287364 return fmt.Errorf("world %s pin %s: %w", slug, id, err)288365 }289366 }@@ -73,12 +73,26 @@ type MergeAccount struct {
7373 Map string7474 Source string7575 DonorPins int76- Matched []MatchedPair77- Added int78- Adopted []AdoptedPin79- Held []HeldPin80- Rejected []HeldPin81- Alignment string76+ // DonorFeatures is the donor's offering counted per kind. Bundles from77+ // before the ledger spoke features carry only donorPins; for those the78+ // point count stands in and the shapes read zero.79+ DonorFeatures FeatureCounts80+ Matched []MatchedPair81+ Added int82+ // AddedShapes is the ledger's reserved shape-merge count, zero in every83+ // bundle written so far.84+ AddedShapes int85+ Adopted []AdoptedPin86+ Held []HeldPin87+ Rejected []HeldPin88+ Alignment string89+}90+91+// FeatureCounts counts donor features by kind, in the ledger's own words.92+type FeatureCounts struct {93+ Point int `json:"point"`94+ Path int `json:"path"`95+ Area int `json:"area"`8296 }8397 8498 // MatchedPair records one place both sources pin, in the ledger's own words.@@ -105,29 +119,30 @@ type HeldPin struct {
105119 106120 // worldDetail is the sliver of a world payload measurement reads.107121 type worldDetail struct {108- Attrs map[string]string `json:"attrs"`109- Groups []struct {110- Categories []struct {111- IconAsset string `json:"iconAsset"`112- DisplayType string `json:"displayType"`113- Attrs map[string]string `json:"attrs"`114- } `json:"categories"`115- } `json:"groups"`122+ Attrs map[string]string `json:"attrs"`123+ Collections []struct {124+ Kind string `json:"kind"`125+ Group string `json:"group"`126+ IconAsset string `json:"iconAsset"`127+ Attrs map[string]string `json:"attrs"`128+ Features []struct {129+ Geometry []struct {130+ Coordinates json.RawMessage `json:"coordinates"`131+ } `json:"geometry"`132+ } `json:"features"`133+ } `json:"collections"`116134 Merged []struct {117- Source string `json:"source"`118- DonorPins int `json:"donorPins"`119- Matched []MatchedPair `json:"matched"`120- Added int `json:"added"`121- Adopted []AdoptedPin `json:"adopted"`122- Held []HeldPin `json:"held"`123- Rejected []HeldPin `json:"rejected"`124- Alignment string `json:"alignment"`135+ Source string `json:"source"`136+ DonorPins int `json:"donorPins"`137+ DonorFeatures *FeatureCounts `json:"donorFeatures"`138+ Matched []MatchedPair `json:"matched"`139+ Added int `json:"added"`140+ AddedShapes int `json:"addedShapes"`141+ Adopted []AdoptedPin `json:"adopted"`142+ Held []HeldPin `json:"held"`143+ Rejected []HeldPin `json:"rejected"`144+ Alignment string `json:"alignment"`125145 } `json:"merged"`126- Zones []struct {127- Features []struct {128- Coordinates json.RawMessage `json:"coordinates"`129- } `json:"features"`130- } `json:"zones"`131146 Lenses []struct {132147 Name string `json:"name"`133148 MaxZoom int `json:"maxZoom"`@@ -148,6 +163,11 @@ func (m MergeAccount) MedianMatchPx() int {
148163 return distances[len(distances)/2]149164 }150165 166+// DonorShapesN is how many shape features -- paths and areas together --167+// the donor offered; none of them merge yet, so each one shows up again in168+// the held ledger.169+func (m MergeAccount) DonorShapesN() int { return m.DonorFeatures.Path + m.DonorFeatures.Area }170+151171 func (m MergeAccount) MatchedN() int { return len(m.Matched) }152172 func (m MergeAccount) AdoptedN() int { return len(m.Adopted) }153173 func (m MergeAccount) HeldN() int { return len(m.Held) }@@ -249,7 +269,7 @@ func MeasureBundle(path string) (*Build, error) {
249269 var lengths []int250270 for _, entry := range manifest.Worlds {251271 b.MapSlugs = append(b.MapSlugs, entry.Slug)252- b.Pins += entry.PinCount272+ b.Pins += entry.Points253273 var text map[string]struct {254274 Description string `json:"d"`255275 Attrs map[string]string `json:"a"`@@ -287,46 +307,60 @@ func MeasureBundle(path string) (*Build, error) {
287307 for _, lens := range detail.Lenses {288308 b.Depth = max(b.Depth, lens.MaxZoom)289309 }290- b.Zones += len(detail.Zones)291- for _, zone := range detail.Zones {292- for _, feature := range zone.Features {293- b.Vertices += countVertices(feature.Coordinates)294- }295- }296- for _, group := range detail.Groups {297- b.Groups++298- for _, category := range group.Categories {299- b.Categories++300- b.UnknownAttrs += unknownAttrs(category.Attrs)301- if _, declared := category.Attrs[semconv.KeyRenderAs]; declared {302- b.RenderDeclared++303- }304- if category.Attrs[semconv.KeyIconStd] != "" {305- b.StdIcons++306- }307- // The conventions decide what a category is, so the metric308- // judging it reads the same attribute the viewer does.309- if semconv.RenderAs(category.Attrs, category.DisplayType) == semconv.RenderAsText {310- b.TextSets++311- continue312- }313- b.IconsWanted++314- if category.IconAsset != "" {315- b.IconsCarried++310+ groups := make(map[string]bool)311+ for _, collection := range detail.Collections {312+ b.UnknownAttrs += unknownAttrs(collection.Attrs)313+ if collection.Kind != semconv.GeometryPoint {314+ b.Zones += len(collection.Features)315+ for _, feature := range collection.Features {316+ for _, geometry := range feature.Geometry {317+ b.Vertices += countVertices(geometry.Coordinates)318+ }316319 }320+ continue321+ }322+ b.Categories++323+ if !groups[collection.Group] {324+ groups[collection.Group] = true325+ b.Groups++326+ }327+ if _, declared := collection.Attrs[semconv.KeyRenderAs]; declared {328+ b.RenderDeclared++329+ }330+ if collection.Attrs[semconv.KeyIconStd] != "" {331+ b.StdIcons++332+ }333+ // The conventions decide what a collection is, so the metric334+ // judging it reads the same attribute the viewer does.335+ if semconv.RenderAs(collection.Attrs, "") == semconv.RenderAsText {336+ b.TextSets++337+ continue338+ }339+ b.IconsWanted++340+ if collection.IconAsset != "" {341+ b.IconsCarried++317342 }318343 }319344 for _, merged := range detail.Merged {345+ // Bundles in the wild predate the per-kind count: where the346+ // account says only donorPins, the points stand for the whole347+ // offering, exactly as the writer of that day meant it.348+ counts := FeatureCounts{Point: merged.DonorPins}349+ if merged.DonorFeatures != nil {350+ counts = *merged.DonorFeatures351+ }320352 b.Merges = append(b.Merges, MergeAccount{321- Map: entry.Slug,322- Source: merged.Source,323- DonorPins: merged.DonorPins,324- Matched: merged.Matched,325- Added: merged.Added,326- Adopted: merged.Adopted,327- Held: merged.Held,328- Rejected: merged.Rejected,329- Alignment: merged.Alignment,353+ Map: entry.Slug,354+ Source: merged.Source,355+ DonorPins: counts.Point,356+ DonorFeatures: counts,357+ Matched: merged.Matched,358+ Added: merged.Added,359+ AddedShapes: merged.AddedShapes,360+ Adopted: merged.Adopted,361+ Held: merged.Held,362+ Rejected: merged.Rejected,363+ Alignment: merged.Alignment,330364 })331365 }332366 }@@ -41,9 +41,24 @@ type Map struct {
4141 Game Game `json:"game"`4242 Groups []Group `json:"groups"`4343 Regions []Region `json:"regions"`44+ Collections []CollectionDecl `json:"atlas_collections,omitempty"`4445 Attrs map[string]string `json:"atlas_attrs,omitempty"`4546 }4647 48+// CollectionDecl names a curated collection the map's regions may claim: a49+// translator that knows its regions come in kinds -- the zoning districts, the50+// streams -- declares each kind once and lets every region say which it is.51+// Attrs carry the collection's conventions -- its geometry kind, its label52+// policy, the stroke width its paths draw at -- under the same registered keys53+// everything else speaks. The field rides a name no real MapGenie capture54+// spells, so an untranslated snapshot simply declares nothing and its regions55+// fold into the map's implicit region collection as they always have.56+type CollectionDecl struct {57+ Key string `json:"key"`58+ Title string `json:"title"`59+ Attrs map[string]string `json:"atlas_attrs,omitempty"`60+}61+4762 // Region is a named piece of ground: the generator reads it into a zone, and4863 // its features carry GeoJSON-shaped polygon geometry whose positions are the4964 // same synthetic longitude and latitude a pin speaks. Sources without ground@@ -58,11 +73,15 @@ type Region struct {
5873 // what a place is -- deferred by the generator into the text payload5974 // the way a pin's description is, so naming ground stays cheap and6075 // explaining it costs only the reader who asks.61- Description string `json:"description,omitempty"`62- CenterX *float64 `json:"center_x,omitempty"`63- CenterY *float64 `json:"center_y,omitempty"`64- Features []RegionFeature `json:"features,omitempty"`65- Attrs map[string]string `json:"atlas_attrs,omitempty"`76+ Description string `json:"description,omitempty"`77+ CenterX *float64 `json:"center_x,omitempty"`78+ CenterY *float64 `json:"center_y,omitempty"`79+ Features []RegionFeature `json:"features,omitempty"`80+ // Collection is the key of the declared collection this region belongs81+ // to. A region naming nothing folds into the map's implicit region82+ // collection, which is every region a real MapGenie capture holds.83+ Collection string `json:"atlas_collection,omitempty"`84+ Attrs map[string]string `json:"atlas_attrs,omitempty"`6685 }6786 6887 type RegionFeature struct {@@ -1,4 +1,4 @@
1-# Atlas semantic conventions — registry v11+# Atlas semantic conventions — registry v222 33 The shared language of the pipeline: attribute keys that carry display and44 geometry meaning from a source's translator, through composition, into the@@ -8,16 +8,22 @@ over it. `semconv.go` is the executable twin of this document, and a test
88 holds the two to the same list.99 1010 A bundle declares the vocabulary it was written against in its manifest:11-`"conventions": 1`. The number moves only when an existing key's meaning12-breaks; new keys arrive as `experimental` and earn `stable`.11+`"conventions": 2`. The number moves only when an existing key's meaning12+breaks; new keys arrive as `experimental` and earn `stable`. v2 is such a13+break: it collapsed the v1 entities `zone`, `category`, and `location` into14+`collection` and `feature` when the format unified them — every kind of15+thing on a map is a feature, every named set of them a collection — and16+renamed `atlas.category.key` to `atlas.collection.key` to match.1317 1418 ## Attributes1519 1620 | Key | Entity | Values | Stability | Meaning |1721 |---|---|---|---|---|18-| `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`. |19-| `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. |20-| `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. |22+| `atlas.geometry.kind` | collection | `point` \| `path` \| `area` | stable | What shape of thing the collection holds. Declared once per collection; every feature in it is that kind, and readers pick rendering and UX by this key instead of sniffing geometry types. |23+| `atlas.label.policy` | collection | `always` \| `quiet` | experimental | Whether an area collection's features wear their names on the map always, or quietly — only on highlight, selection, or an explicit reveal. Area collections only; absent means `always` for areas (today's look), and paths are always quiet. |24+| `atlas.render.as` | collection | `pin` \| `text` | stable | How a point collection's features draw: markers, or floating text labels. Absent means `pin`; the legacy `displayType` field no longer rides the wire, and only ingestion still reads it to speak this key for old captures. |25+| `atlas.icon.std` | collection | `set/name`, e.g. `maki/mountain` | stable | Standard-library icon for a collection without artwork. Resolved to embedded bytes at build time; the app only sees the resolved asset. |26+| `atlas.icon.kind` | collection | `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. |2127 | `atlas.icon.outset` | world | `light` \| `dark` | stable | The rim a map's markers wear to stay legible against its art. |2228 | `atlas.geometry.surface` | world | `plane` \| `sphere` | stable | What the raster pictures. Absent means `plane` — every map before the planets. |2329 | `atlas.geometry.projection` | world | `equirect` | stable | How a sphere was flattened. Required when surface is `sphere`. |@@ -27,11 +33,11 @@ breaks; new keys arrive as `experimental` and earn `stable`.
2733 | `atlas.geometry.mercator.deg` | world | `west,north,east,south` (degrees) | experimental | The ground the Mercator window pictures, in degrees at its edges. |2834 | `atlas.geometry.body` | world | slug, e.g. `mars` | experimental | The body pictured. |2935 | `atlas.geometry.radius_km` | world | decimal string | experimental | The body's mean radius. |30-| `atlas.geo.lat` | location | decimal degrees | experimental | True planetary latitude as published (planetocentric). Provenance and card material; rendering derives from the map-level mapping. |31-| `atlas.geo.lon` | location | decimal degrees | experimental | True planetary longitude as published (east-positive). |32-| `atlas.hydro.huc12` | zone | twelve digits | experimental | The USGS twelve-digit hydrologic unit — the subwatershed — the zone's ground lies wholly within, from the national Watershed Boundary Dataset. A zone spanning subwatersheds carries no key rather than a misleading one. |33-| `atlas.stroke.width_px` | zone | positive decimal (world px) | experimental | The ground width of a zone whose features are lines: a trail is a line and a weight, and the weight lets a reader draw the path as one continuous stroke. |34-| `atlas.category.key` | category | slug | experimental | A category's merge identity across sources. Absent, the icon key stands in. |36+| `atlas.geo.lat` | feature | decimal degrees | experimental | True planetary latitude as published (planetocentric). Provenance and card material; rendering derives from the map-level mapping. |37+| `atlas.geo.lon` | feature | decimal degrees | experimental | True planetary longitude as published (east-positive). |38+| `atlas.hydro.huc12` | feature | twelve digits | experimental | The USGS twelve-digit hydrologic unit — the subwatershed — the feature's ground lies wholly within, from the national Watershed Boundary Dataset. A feature spanning subwatersheds carries no key rather than a misleading one. |39+| `atlas.stroke.width_px` | collection | positive decimal (world px) | experimental | The ground width of a path collection's features: a trail is a line and a weight, and the weight lets a reader draw the path as one continuous stroke. |40+| `atlas.collection.key` | collection | slug | experimental | A collection's merge identity across sources. Absent, the icon key stands in. |3541 3642 ## Policy names (never written to a payload)3743 @@ -28,18 +28,20 @@ import (
2828 2929 // Version names the vocabulary a bundle was written against. It rides the3030 // manifest as "conventions" and moves only when an existing key's meaning31-// breaks -- additions ride on per-key stability instead.32-const Version = 131+// breaks -- additions ride on per-key stability instead. v2 collapsed the32+// zone/category/location entities into collection/feature when the format33+// unified them: every kind of thing on a map is a feature, every named set34+// of them a collection.35+const Version = 23336 3437 // Entity is what an attribute attaches to.3538 type Entity string3639 3740 const (38- EntityBundle Entity = "bundle"39- EntityWorld Entity = "world"40- EntityZone Entity = "zone"41- EntityCategory Entity = "category"42- EntityLocation Entity = "location"41+ EntityBundle Entity = "bundle"42+ EntityWorld Entity = "world"43+ EntityCollection Entity = "collection"44+ EntityFeature Entity = "feature"4345 )4446 4547 // Stability says how settled a key is. Experimental keys may still change@@ -53,18 +55,31 @@ const (
5355 5456 // The registered keys.5557 const (56- // RenderAs says how a category's locations are drawn: as markers or as57- // floating text labels. It replaces the pipeline's single unspoken58+ // GeometryKind says what shape of thing a collection holds: points,59+ // paths, or areas. Every collection declares one kind and every feature60+ // in it is that kind; readers pick their rendering and UX by this key61+ // instead of sniffing geometry types at draw time.62+ KeyGeometryKind = "atlas.geometry.kind"63+64+ // LabelPolicy says whether an area collection's features wear their65+ // names on the map always, or quietly -- only on highlight, selection,66+ // or an explicit reveal. It attaches to area collections only: absent67+ // means always for areas, which is today's look, and paths are always68+ // quiet.69+ KeyLabelPolicy = "atlas.label.policy"70+71+ // RenderAs says how a point collection's features are drawn: as markers72+ // or as floating text labels. It replaces the pipeline's single unspoken5873 // display rule, the string compare on MapGenie's display_type.5974 KeyRenderAs = "atlas.render.as"6075 61- // IconStd names a standard-library icon for a category that has no76+ // IconStd names a standard-library icon for a collection that has no6277 // artwork of its own, as set/name, e.g. "maki/mountain". The ingestion6378 // pipeline resolves it to embedded bytes; the app only ever sees the6479 // resolved asset.6580 KeyIconStd = "atlas.icon.std"6681 67- // IconKind says whether a category's icon asset is a monochrome glyph82+ // IconKind says whether a collection's icon asset is a monochrome glyph6883 // the viewer tints, or a picture drawn as-is. It names what used to be6984 // inferred from the asset's file extension.7085 KeyIconKind = "atlas.icon.kind"@@ -109,7 +124,7 @@ const (
109124 // decimal string.110125 KeyGeometryRadiusKM = "atlas.geometry.radius_km"111126 112- // GeoLat and GeoLon carry a location's true planetary coordinates as127+ // GeoLat and GeoLon carry a feature's true planetary coordinates as113128 // the source published them: planetocentric degrees, east-positive114129 // longitude. They are provenance and card material; rendering derives115130 // positions from the map-level mapping instead.@@ -117,22 +132,23 @@ const (
117132 KeyGeoLon = "atlas.geo.lon"118133 119134 // HydroHUC12 names the USGS twelve-digit hydrologic unit -- the120- // subwatershed -- a zone's ground lies wholly within, from the national121- // Watershed Boundary Dataset, so watershed membership is machine-readable122- // beside whatever sentence the zone's card shows. A zone spanning123- // subwatersheds carries no key rather than a misleading one.135+ // subwatershed -- a feature's ground lies wholly within, from the136+ // national Watershed Boundary Dataset, so watershed membership is137+ // machine-readable beside whatever sentence the feature's card shows. A138+ // feature spanning subwatersheds carries no key rather than a misleading139+ // one.124140 KeyHydroHUC12 = "atlas.hydro.huc12"125141 126- // StrokeWidthPx is the ground width of a zone whose features are lines127- // rather than areas, in world pixels: a trail is a line and a weight,128- // and declaring the weight lets a reader draw the path as one129- // continuous stroke instead of an area faked around it.142+ // StrokeWidthPx is the ground width of a path collection's features, in143+ // world pixels: a trail is a line and a weight, and declaring the weight144+ // lets a reader draw the path as one continuous stroke instead of an145+ // area faked around it.130146 KeyStrokeWidthPx = "atlas.stroke.width_px"131147 132- // CategoryKey is a category's merge identity: the slug categories from133- // different sources meet under when they mean the same concept. Absent,134- // the icon key stands in, which is today's behavior named.135- KeyCategoryKey = "atlas.category.key"148+ // CollectionKey is a collection's merge identity: the slug collections149+ // from different sources meet under when they mean the same concept.150+ // Absent, the icon key stands in, which is today's behavior named.151+ KeyCollectionKey = "atlas.collection.key"136152 137153 // NoteText never appears in a payload: it is the name the merge policy138154 // table and ledger use for a pin's description, so "which description@@ -143,6 +159,13 @@ const (
143159 144160 // Vocabulary values.145161 const (162+ GeometryPoint = "point"163+ GeometryPath = "path"164+ GeometryArea = "area"165+166+ LabelAlways = "always"167+ LabelQuiet = "quiet"168+146169 RenderAsPin = "pin"147170 RenderAsText = "text"148171 @@ -244,9 +267,11 @@ func numbers(count int) func(string) error {
244267 // registry is the whole vocabulary. REGISTRY.md is its prose twin, and a245268 // test holds the two to the same list of keys.246269 var registry = map[string]definition{247- KeyRenderAs: {EntityCategory, Stable, enum(RenderAsPin, RenderAsText)},248- KeyIconStd: {EntityCategory, Stable, setName},249- KeyIconKind: {EntityCategory, Stable, enum(IconKindGlyph, IconKindPicture)},270+ KeyGeometryKind: {EntityCollection, Stable, enum(GeometryPoint, GeometryPath, GeometryArea)},271+ KeyLabelPolicy: {EntityCollection, Experimental, enum(LabelAlways, LabelQuiet)},272+ KeyRenderAs: {EntityCollection, Stable, enum(RenderAsPin, RenderAsText)},273+ KeyIconStd: {EntityCollection, Stable, setName},274+ KeyIconKind: {EntityCollection, Stable, enum(IconKindGlyph, IconKindPicture)},250275 KeyIconOutset: {EntityWorld, Stable, enum(OutsetLight, OutsetDark)},251276 KeyGeometrySurface: {EntityWorld, Stable, enum(SurfacePlane, SurfaceSphere)},252277 KeyGeometryProjection: {EntityWorld, Stable, enum(ProjectionEquirect)},@@ -256,11 +281,11 @@ var registry = map[string]definition{
256281 KeyGeometryMercatorDeg: {EntityWorld, Experimental, numbers(4)},257282 KeyGeometryBody: {EntityWorld, Experimental, slug},258283 KeyGeometryRadiusKM: {EntityWorld, Experimental, decimal},259- KeyGeoLat: {EntityLocation, Experimental, decimal},260- KeyGeoLon: {EntityLocation, Experimental, decimal},261- KeyHydroHUC12: {EntityZone, Experimental, huc12},262- KeyStrokeWidthPx: {EntityZone, Experimental, positiveDecimal},263- KeyCategoryKey: {EntityCategory, Experimental, slug},284+ KeyGeoLat: {EntityFeature, Experimental, decimal},285+ KeyGeoLon: {EntityFeature, Experimental, decimal},286+ KeyHydroHUC12: {EntityFeature, Experimental, huc12},287+ KeyStrokeWidthPx: {EntityCollection, Experimental, positiveDecimal},288+ KeyCollectionKey: {EntityCollection, Experimental, slug},264289 }265290 266291 // Keys lists every registered key in a stable order, for the tests and the@@ -310,10 +335,13 @@ func Validate(entity Entity, attrs map[string]string) error {
310335 return nil311336 }312337 313-// RenderAs answers how a category draws, from its attributes first and the314-// legacy display_type field when no attribute speaks. This is the one rule315-// the viewer used to hold as a string compare, spelled once for every316-// consumer: text is text, and everything else is a pin.338+// RenderAs answers how a point collection draws, from its attributes first339+// and the legacy display_type field when no attribute speaks. This is the340+// one rule the viewer used to hold as a string compare, spelled once for341+// every consumer: text is text, and everything else is a pin. The legacy342+// parameter survives only at ingestion, where the generator speaks this key343+// for MapGenie captures that predate the conventions; the wire itself344+// carries no displayType any more.317345 func RenderAs(attrs map[string]string, legacyDisplayType string) string {318346 if value, declared := attrs[KeyRenderAs]; declared {319347 return value@@ -13,9 +13,12 @@ func TestValidateHoldsTheVocabulary(t *testing.T) {
1313 entity Entity1414 attrs map[string]string1515 }{16- {EntityCategory, map[string]string{KeyRenderAs: "pin"}},17- {EntityCategory, map[string]string{KeyRenderAs: "text", KeyIconStd: "maki/mountain"}},18- {EntityCategory, map[string]string{KeyIconKind: "glyph", KeyCategoryKey: "ripperdoc"}},16+ {EntityCollection, map[string]string{KeyRenderAs: "pin"}},17+ {EntityCollection, map[string]string{KeyRenderAs: "text", KeyIconStd: "maki/mountain"}},18+ {EntityCollection, map[string]string{KeyIconKind: "glyph", KeyCollectionKey: "ripperdoc"}},19+ {EntityCollection, map[string]string{KeyGeometryKind: "point"}},20+ {EntityCollection, map[string]string{KeyGeometryKind: "path", KeyStrokeWidthPx: "12"}},21+ {EntityCollection, map[string]string{KeyGeometryKind: "area", KeyLabelPolicy: "quiet"}},1922 {EntityWorld, map[string]string{2023 KeyGeometrySurface: "sphere",2124 KeyGeometryProjection: "equirect",@@ -25,9 +28,10 @@ func TestValidateHoldsTheVocabulary(t *testing.T) {
2528 KeyGeometryRadiusKM: "3389.5",2629 }},2730 {EntityWorld, map[string]string{KeyIconOutset: "dark"}},28- {EntityLocation, map[string]string{KeyGeoLat: "-42.4301", KeyGeoLon: "70.5025"}},31+ {EntityFeature, map[string]string{KeyGeoLat: "-42.4301", KeyGeoLon: "70.5025"}},32+ {EntityFeature, map[string]string{KeyHydroHUC12: "170703010101"}},2933 // Empty is always fine: conventions are declared, never demanded.30- {EntityCategory, nil},34+ {EntityCollection, nil},3135 }3236 for _, test := range good {3337 if err := Validate(test.entity, test.attrs); err != nil {@@ -40,16 +44,21 @@ func TestValidateHoldsTheVocabulary(t *testing.T) {
4044 attrs map[string]string4145 mention string4246 }{43- {EntityCategory, map[string]string{"atlas.render.like": "pin"}, "not registered"},44- {EntityCategory, map[string]string{KeyRenderAs: "zone"}, "not one of"},47+ {EntityCollection, map[string]string{"atlas.render.like": "pin"}, "not registered"},48+ {EntityCollection, map[string]string{KeyRenderAs: "zone"}, "not one of"},4549 {EntityWorld, map[string]string{KeyRenderAs: "pin"}, "attaches to"},46- {EntityCategory, map[string]string{KeyIconStd: "mountain"}, "set/name"},47- {EntityCategory, map[string]string{KeyIconStd: "Maki/Mountain"}, "slug"},50+ {EntityCollection, map[string]string{KeyIconStd: "mountain"}, "set/name"},51+ {EntityCollection, map[string]string{KeyIconStd: "Maki/Mountain"}, "slug"},52+ {EntityCollection, map[string]string{KeyGeometryKind: "polygon"}, "not one of"},53+ {EntityCollection, map[string]string{KeyLabelPolicy: "loud"}, "not one of"},54+ {EntityFeature, map[string]string{KeyGeometryKind: "area"}, "attaches to"},55+ {EntityFeature, map[string]string{KeyStrokeWidthPx: "12"}, "attaches to"},4856 {EntityWorld, map[string]string{KeyGeometryEquirectPx: "0,0,8192"}, "4"},4957 {EntityWorld, map[string]string{KeyGeometryRadiusKM: "big"}, "number"},50- {EntityLocation, map[string]string{KeyGeoLat: "north"}, "number"},58+ {EntityFeature, map[string]string{KeyGeoLat: "north"}, "number"},59+ {EntityCollection, map[string]string{KeyHydroHUC12: "170703010101"}, "attaches to"},5160 // The policy name never rides a payload.52- {EntityLocation, map[string]string{KeyNoteText: "words"}, "not registered"},61+ {EntityFeature, map[string]string{KeyNoteText: "words"}, "not registered"},5362 }5463 for _, test := range bad {5564 err := Validate(test.entity, test.attrs)@@ -131,7 +140,7 @@ func TestRegistryAgreesWithItsDocument(t *testing.T) {
131140 if err != nil {132141 t.Fatal(err)133142 }134- row := regexp.MustCompile("(?m)^\\| `(atlas\\.[a-z0-9_.]+)` \\| (bundle|world|zone|category|location) \\|.*\\| (stable|experimental) \\|")143+ row := regexp.MustCompile("(?m)^\\| `(atlas\\.[a-z0-9_.]+)` \\| (bundle|world|collection|feature) \\|.*\\| (stable|experimental) \\|")135144 documented := make(map[string][2]string)136145 for _, match := range row.FindAllStringSubmatch(string(doc), -1) {137146 documented[match[1]] = [2]string{match[2], match[3]}@@ -40,6 +40,11 @@ const catalogChangedTopic = "atlas:catalog-changed"
4040 var assets embed.FS4141 4242 func main() {43+ // A development build asked to run headless serves the same application44+ // over plain HTTP and opens no window: the parity sweep's whole ask.45+ if runHeadless(assets) {46+ return47+ }4348 // Created inside Routes, which the framework calls while opening the4449 // application, and used again at startup below; Open completes before the4550 // window exists, so the order holds.@@ -5,12 +5,77 @@ package main
55 import (66 "fmt"77 "io"8+ "io/fs"9+ "log/slog"10+ "net"811 "net/http"912 "os"1013 "path/filepath"1114 "time"15+16+ "github.com/FelineStateMachine/atlas/internal/bundle"1217 )1318 19+// runHeadless serves the whole application over plain HTTP and never opens a20+// window, when ATLAS_HEADLESS asks for it. The parity harness drives the app21+// through a browser either way; a desktop window popping over the reader's22+// work was the one part of the sweep that was never needed. The listener's23+// address lands in inspector.url exactly where the framework would put it,24+// so the harness finds a headless run and a windowed one the same way.25+func runHeadless(assets fs.FS) bool {26+ if os.Getenv("ATLAS_HEADLESS") == "" {27+ return false28+ }29+ dir := os.Getenv("ATLAS_BUNDLES_DIR")30+ if dir == "" {31+ base, err := os.UserConfigDir()32+ if err != nil {33+ fmt.Fprintln(os.Stderr, "atlas: headless without a config dir:", err)34+ os.Exit(1)35+ }36+ dir = filepath.Join(base, "dev.felinestatemachine.atlas", "bundles")37+ }38+ registry := bundle.NewRegistry(dir)39+ if err := registry.Rescan(); err != nil {40+ slog.Warn("atlas: scanning bundles", "error", err)41+ }42+ handler := routes(assets, registry)43+ // The framework serves the shell's own files under /static; headless44+ // answers for them from the same embedded tree.45+ mux := http.NewServeMux()46+ mux.Handle("/", handler)47+ for name, kind := range map[string]string{"app.css": "text/css", "app.js": "text/javascript"} {48+ mux.HandleFunc("GET /static/"+name, func(w http.ResponseWriter, r *http.Request) {49+ data, err := fs.ReadFile(assets, "assets/"+filepath.Base(r.URL.Path))50+ if err != nil {51+ http.NotFound(w, r)52+ return53+ }54+ w.Header().Set("Content-Type", kind+"; charset=utf-8")55+ _, _ = w.Write(data)56+ })57+ }58+ listener, err := net.Listen("tcp", "127.0.0.1:0")59+ if err != nil {60+ fmt.Fprintln(os.Stderr, "atlas: headless listener:", err)61+ os.Exit(1)62+ }63+ base, err := os.UserConfigDir()64+ if err == nil {65+ address := "http://" + listener.Addr().String()66+ path := filepath.Join(base, "dev.felinestatemachine.atlas", "inspector.url")67+ if err := os.MkdirAll(filepath.Dir(path), 0o755); err == nil {68+ _ = os.WriteFile(path, []byte(address+"\n"), 0o644)69+ }70+ fmt.Println("atlas: headless at", address)71+ }72+ if err := http.Serve(listener, mux); err != nil {73+ fmt.Fprintln(os.Stderr, "atlas: headless server:", err)74+ os.Exit(1)75+ }76+ return true77+}78+1479 // parityDir returns the directory that receives behavior-parity tour results.1580 // It sits beside the app's own data so the harness can find results without1681 // threading an environment variable through `open`.@@ -2,8 +2,14 @@
22 33 package main44 5-import "net/http"5+import (6+ "io/fs"7+ "net/http"8+)69 710 // Release builds carry no parity harness; the frontend's tour hotkey POSTs8-// into a route that does not exist and receives a 404.11+// into a route that does not exist and receives a 404, and the headless12+// server the harness drives does not exist to ask for.913 func registerParityRoutes(*http.ServeMux) {}14+15+func runHeadless(fs.FS) bool { return false }@@ -57,8 +57,10 @@ func TestRoutesServeEmbeddedExplorer(t *testing.T) {
5757 if body := rec.Body.String(); !strings.Contains(body, `id="layers"`) {5858 t.Fatal("root response does not contain the layers list")5959 }60- if body := rec.Body.String(); !strings.Contains(body, `id="zone-toggle"`) {61- t.Fatal("root response does not contain the zone boundaries switch")60+ // Zones stopped being a hard-coded switch when the legend became one61+ // tree: every collection, shape or point, renders into the same list.62+ if body := rec.Body.String(); !strings.Contains(body, `id="legend"`) {63+ t.Fatal("root response does not contain the legend tree")6264 }6365 }6466 @@ -321,15 +323,14 @@ type mapPayload struct {
321323 X, Y, Width, Height int322324 } `json:"surface"`323325 } `json:"lenses"`324- Groups []struct {325- Categories []struct {326- Title string `json:"title"`327- DisplayType string `json:"displayType"`328- Color string `json:"color"`329- IconAsset string `json:"iconAsset"`330- } `json:"categories"`331- } `json:"groups"`332- Zones []any `json:"zones"`326+ Collections []struct {327+ Title string `json:"title"`328+ Kind string `json:"kind"`329+ Color string `json:"color"`330+ IconAsset string `json:"iconAsset"`331+ Attrs map[string]string `json:"attrs"`332+ Features []any `json:"features"`333+ } `json:"collections"`333334 }334335 335336 func readBuiltPayload(t *testing.T, held *bundle.Bundle, slug string) mapPayload {@@ -500,18 +501,14 @@ func TestBuiltBundlesCarryTextLabelsAndZones(t *testing.T) {
500501 marathon := builtGame(t, games, "marathon")501502 cryo := builtMapSlug(t, marathon, "Cryo Archive")502503 payload := readBuiltPayload(t, marathon, cryo)503- var areaOrdinal = -1504- var ordinal int505- for _, group := range payload.Groups {506- for _, category := range group.Categories {507- if category.Title == "Area" && category.DisplayType == "text" {508- areaOrdinal = ordinal509- }510- ordinal++504+ areaOrdinal := -1505+ for index, collection := range payload.Collections {506+ if collection.Title == "Area" && collection.Attrs["atlas.render.as"] == "text" {507+ areaOrdinal = index511508 }512509 }513510 if areaOrdinal < 0 {514- t.Fatal("Cryo Archive has no text-display Area category")511+ t.Fatal("Cryo Archive has no text-rendered Area collection")515512 }516513 var foundPanopticon bool517514 for _, location := range readBuiltLocations(t, marathon, cryo) {@@ -520,13 +517,19 @@ func TestBuiltBundlesCarryTextLabelsAndZones(t *testing.T) {
520517 }521518 }522519 if !foundPanopticon {523- t.Error("PANOPTICON is not preserved as a text-display location")520+ t.Error("PANOPTICON is not preserved as a text-rendered location")524521 }525522 526523 forza := builtGame(t, games, "forza-horizon-6")527524 japan := readBuiltPayload(t, forza, builtMapSlug(t, forza, "Japan"))528- if len(japan.Zones) != 10 {529- t.Errorf("Forza Japan zones = %d, want 10", len(japan.Zones))525+ var zones int526+ for _, collection := range japan.Collections {527+ if collection.Kind != "point" {528+ zones += len(collection.Features)529+ }530+ }531+ if zones != 10 {532+ t.Errorf("Forza Japan zones = %d, want 10", zones)530533 }531534 var bounded int532535 for _, variant := range japan.Lenses {@@ -592,30 +595,28 @@ func TestBuiltBundlesCarryCategoryIconsAndColors(t *testing.T) {
592595 var foundPokemonCenter bool593596 for _, held := range games {594597 for _, entry := range held.Manifest.Worlds {595- for _, group := range readBuiltPayload(t, held, entry.Slug).Groups {596- for _, category := range group.Categories {597- if category.IconAsset != "" {598- iconAssets++599- if strings.Contains(category.IconAsset, "/") {600- t.Errorf("%s names icon %q, which is not bundle-relative",601- held.Manifest.Volume.Slug, category.IconAsset)602- }603- if !held.Has("icons/" + category.IconAsset) {604- t.Errorf("%s icon %q is missing", held.Manifest.Volume.Slug, category.IconAsset)605- }606- }607- if held.Manifest.Volume.Slug != "pokemon-red-blue-yellow" ||608- entry.Title != "Yellow" || category.Title != "Pokémon Center" {609- continue598+ for _, collection := range readBuiltPayload(t, held, entry.Slug).Collections {599+ if collection.IconAsset != "" {600+ iconAssets++601+ if strings.Contains(collection.IconAsset, "/") {602+ t.Errorf("%s names icon %q, which is not bundle-relative",603+ held.Manifest.Volume.Slug, collection.IconAsset)610604 }611- foundPokemonCenter = true612- if category.Color != "#38344C" {613- t.Errorf("Pokémon Center color = %q, want #38344C", category.Color)614- }615- if category.IconAsset == "" {616- t.Error("Pokémon Center has no icon asset")605+ if !held.Has("icons/" + collection.IconAsset) {606+ t.Errorf("%s icon %q is missing", held.Manifest.Volume.Slug, collection.IconAsset)617607 }618608 }609+ if held.Manifest.Volume.Slug != "pokemon-red-blue-yellow" ||610+ entry.Title != "Yellow" || collection.Title != "Pokémon Center" {611+ continue612+ }613+ foundPokemonCenter = true614+ if collection.Color != "#38344C" {615+ t.Errorf("Pokémon Center color = %q, want #38344C", collection.Color)616+ }617+ if collection.IconAsset == "" {618+ t.Error("Pokémon Center has no icon asset")619+ }619620 }620621 }621622 }@@ -28,7 +28,8 @@ import (
2828 // 6 geometry declared: spheres say so, pins carry true coordinates2929 // 7 attribute-level merge resolution; ledgers name canonical source slugs3030 // 8 zone prose defers to the text payload; zones mark hasText31-const policyRevision = 831+// 9 format v3: one collections array of point, path, and area features32+const policyRevision = 93233 3334 // writeBundles packs each game into its own .atlas file, named by game,3435 // capture day, and stamp. The directory is a registry, not a mirror: a new@@ -70,9 +71,11 @@ func writeVolumeBundle(
7071 manifest := bundle.Manifest{7172 Format: bundle.Format,7273 FormatVersion: bundle.FormatVersion,73- Conventions: semconv.Version,74- Volume: bundle.Volume{Slug: game.Slug, Title: game.Title},75- Version: bundle.Version{Revision: policyRevision},74+ // The manifest names the vocabulary the payloads actually speak,75+ // which since the unified wire is the registry's own version.76+ Conventions: semconv.Version,77+ Volume: bundle.Volume{Slug: game.Slug, Title: game.Title},78+ Version: bundle.Version{Revision: policyRevision},7679 TileGrid: bundle.TileGrid{7780 SourceZoom: grid.SourceZoom,7881 FirstTile: grid.FirstTile,@@ -108,13 +111,16 @@ func writeVolumeBundle(
108111 stamp.Add("worlds/"+m.Slug+".bin", bundle.HashBytes(packed))109112 stamp.Add("worlds/"+m.Slug+".text", bundle.HashBytes(textJSON))110113 114+ counts := m.featureTally()111115 manifest.Worlds = append(manifest.Worlds, bundle.WorldEntry{112116 Slug: m.Slug,113117 Title: m.Title,114118 Parent: m.Parent,115119 IconOutset: m.IconOutset,116120 Center: bundle.Coordinate{Lat: m.Center.Latitude, Lng: m.Center.Longitude},117- PinCount: m.PinCount,121+ Points: counts.Point,122+ Paths: counts.Path,123+ Areas: counts.Area,118124 UpdatedAt: m.UpdatedAt,119125 })120126 }Not shown: this page already shows 6000 lines of diff.
Not shown: this page already shows 6000 lines of diff.
Not shown: this page already shows 6000 lines of diff.
Not shown: this page already shows 6000 lines of diff.
Not shown: this page already shows 6000 lines of diff.
Not shown: this page already shows 6000 lines of diff.
Not shown: this page already shows 6000 lines of diff.
Not shown: this page already shows 6000 lines of diff.
Not shown: this page already shows 6000 lines of diff.
Not shown: this page already shows 6000 lines of diff.